Merge of the NewUI changes into the trunk
This commit is contained in:
46
scripts/comm/admin_menu.js
Normal file
46
scripts/comm/admin_menu.js
Normal file
@@ -0,0 +1,46 @@
|
||||
// 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):
|
||||
|
||||
importPackage(java.util);
|
||||
importPackage(Packages.com.silverwrist.venice.core);
|
||||
importPackage(Packages.com.silverwrist.venice.except);
|
||||
importPackage(Packages.com.silverwrist.venice.ui);
|
||||
importPackage(Packages.com.silverwrist.venice.ui.helpers);
|
||||
importPackage(Packages.com.silverwrist.venice.ui.view);
|
||||
|
||||
// get the request object and the community
|
||||
rinput = bsf.lookupBean("request");
|
||||
comm = rinput.getCommunity(true,"top.js.vs");
|
||||
|
||||
if (!(comm.canAdministerCommunity()))
|
||||
{ // no access - sorry buddy
|
||||
logger.error("tried to call up community admin menu without access...naughty naughty!");
|
||||
vlib.output(new ErrorBox("Access Error","You do not have access to administer this community.",
|
||||
"community/" + comm.alias));
|
||||
vlib.done();
|
||||
|
||||
} // end if
|
||||
|
||||
// build the community admin menu
|
||||
vars = new HashMap();
|
||||
vars.put("cid",comm.communityID + "");
|
||||
vars.put("name",comm.name);
|
||||
menu = rinput.getMenu("community.admin",vars);
|
||||
|
||||
// build a view around it and return it
|
||||
rc = new MenuView(menu);
|
||||
rc.menuSelector = Content.MENU_SELECTOR_COMMUNITY;
|
||||
vlib.output(rc);
|
||||
59
scripts/comm/audit.js
Normal file
59
scripts/comm/audit.js
Normal 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):
|
||||
|
||||
importPackage(java.util);
|
||||
importPackage(Packages.com.silverwrist.venice.core);
|
||||
importPackage(Packages.com.silverwrist.venice.except);
|
||||
importPackage(Packages.com.silverwrist.venice.ui);
|
||||
importPackage(Packages.com.silverwrist.venice.ui.helpers);
|
||||
importPackage(Packages.com.silverwrist.venice.ui.view);
|
||||
|
||||
// get the request object and the community
|
||||
rinput = bsf.lookupBean("request");
|
||||
comm = rinput.getCommunity(true,"top.js.vs");
|
||||
|
||||
rc = null;
|
||||
try
|
||||
{ // read off the offset parameter
|
||||
offset = rinput.getParameterInt("ofs",0);
|
||||
|
||||
// generate the audit lists
|
||||
audit_list = comm.getAuditRecords(offset,rinput.engine.getNumAuditRecordsPerPage());
|
||||
audit_count = comm.getAuditRecordCount();
|
||||
|
||||
// output the audit data view
|
||||
rc = new AuditView(rinput.engine,audit_list,offset,audit_count,
|
||||
"Audit Records for Community \"" + comm.name + "\"",
|
||||
"comm/audit.js.vs?cc=" + comm.communityID + "&ofs=${offset}",
|
||||
"comm/admin_menu.js.vs?cc=" + comm.communityID,
|
||||
"Return to Community Administration Menu");
|
||||
rc.menuSelector = Content.MENU_SELECTOR_COMMUNITY;
|
||||
|
||||
} // end try
|
||||
catch (e)
|
||||
{ // display an error
|
||||
etype = vlib.exceptionType(e) + "";
|
||||
if (etype.match("DataException"))
|
||||
rc = new ErrorBox("Database Error","Database error getting audit records: " + e.message,
|
||||
"comm/admin_menu.js.vs?cc=" + comm.communityID);
|
||||
else if (etype.match("AccessError"))
|
||||
rc = new ErrorBox("Access Error",e.message,"comm/admin_menu.js.vs?cc=" + comm.communityID);
|
||||
else
|
||||
rc = e;
|
||||
|
||||
} // end catch
|
||||
|
||||
vlib.output(rc);
|
||||
114
scripts/comm/category.js
Normal file
114
scripts/comm/category.js
Normal file
@@ -0,0 +1,114 @@
|
||||
// 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):
|
||||
|
||||
importPackage(Packages.com.silverwrist.venice.core);
|
||||
importPackage(Packages.com.silverwrist.venice.except);
|
||||
importPackage(Packages.com.silverwrist.venice.ui);
|
||||
importPackage(Packages.com.silverwrist.venice.ui.helpers);
|
||||
importPackage(Packages.com.silverwrist.venice.ui.view);
|
||||
|
||||
// get the request object and the community
|
||||
rinput = bsf.lookupBean("request");
|
||||
comm = rinput.getCommunity(true,"top.js.vs");
|
||||
|
||||
if (!(comm.canModifyProfile()))
|
||||
{ // no access - sorry, dude
|
||||
logger.error("tried to call up community profile screen without access...naughty naughty!");
|
||||
vlib.output(new ErrorBox("Unauthorized","You do not have access to modify this community's profile.",
|
||||
"comm/admin_menu.js.vs?cc=" + comm.communityID));
|
||||
vlib.done();
|
||||
|
||||
} // end if
|
||||
|
||||
rc = null;
|
||||
if (rinput.hasParameter("set"))
|
||||
{ // OK...they're actually setting the category here - change it and bail out
|
||||
catid = rinput.getParameterInt("set",-1);
|
||||
if (engine.isValidCategoryID(catid))
|
||||
{ // try setting the category ID
|
||||
try
|
||||
{ // set the category ID and bounce back to the menu
|
||||
comm.categoryID = catid;
|
||||
rc = new Redirect("comm/admin_menu.js.vs?cc=" + comm.communityID,LinkTypes.SERVLET);
|
||||
|
||||
} // end try
|
||||
catch (e)
|
||||
{ // exception setting category
|
||||
etype = vlib.exceptionType(e) + "";
|
||||
if (etype.match("DataException"))
|
||||
rc = new ErrorBox("Database Error","Database error updating community: " + e.message,
|
||||
"comm/admin_menu.js.vs?cc=" + comm.communityID);
|
||||
else if (etype.match("AccessError"))
|
||||
rc = new ErrorBox("Access Error",e.message,"comm/admin_menu.js.vs?cc=" + comm.communityID);
|
||||
else
|
||||
rc = e;
|
||||
|
||||
} // end catch
|
||||
|
||||
} // end if
|
||||
else // invalid category ID
|
||||
rc = new ErrorBox("Invalid Input","Invalid category ID passed to category browser.",
|
||||
"comm/admin_menu.js.vs?cc=" + comm.communityID);
|
||||
|
||||
vlib.output(rc);
|
||||
vlib.done();
|
||||
|
||||
} // end if
|
||||
|
||||
// we must be browsing - try and figure out what category we're supposed to be browsing
|
||||
curr_catid = 0;
|
||||
if (rinput.hasParameter("go"))
|
||||
curr_catid = rinput.getParameterInt("go",-1);
|
||||
else
|
||||
curr_catid = comm.categoryID;
|
||||
if (!(engine.isValidCategoryID(curr_catid)))
|
||||
{ // this is not a valid category ID
|
||||
vlib.output(new ErrorBox("Invalid Input","Invalid category ID passed to category browser.",
|
||||
"comm/admin_menu.js.vs?cc=" + comm.communityID));
|
||||
vlib.done();
|
||||
|
||||
} // end if
|
||||
|
||||
try
|
||||
{ // get the categories
|
||||
prev_cat = comm.category;
|
||||
rinput.setRequestAttribute("category.previous",prev_cat);
|
||||
curr_cat = null;
|
||||
if (prev_cat.categoryID!=curr_catid)
|
||||
curr_cat = rinput.user.getCategoryDescriptor(curr_catid);
|
||||
else
|
||||
curr_cat = prev_cat;
|
||||
rinput.setRequestAttribute("category.current",curr_cat);
|
||||
rinput.setRequestAttribute("category.subcats",curr_cat.getSubCategories());
|
||||
|
||||
// create a view and return it
|
||||
rc = new JSPView("Set Community Category","comm/category.jsp");
|
||||
rc.menuSelector = Content.MENU_SELECTOR_COMMUNITY;
|
||||
|
||||
} // end try
|
||||
catch (e)
|
||||
{ // caught an exception here...
|
||||
etype = vlib.exceptionType(e) + "";
|
||||
if (etype.match("DataException"))
|
||||
rc = new ErrorBox("Database Error","Database error browsing categories: " + e.message,
|
||||
"comm/admin_menu.js.vs?cc=" + comm.communityID);
|
||||
else
|
||||
rc = e;
|
||||
|
||||
} // end catch
|
||||
|
||||
vlib.output(rc);
|
||||
|
||||
124
scripts/comm/create.js
Normal file
124
scripts/comm/create.js
Normal file
@@ -0,0 +1,124 @@
|
||||
// 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):
|
||||
|
||||
importPackage(Packages.com.silverwrist.venice.core);
|
||||
importPackage(Packages.com.silverwrist.venice.except);
|
||||
importPackage(Packages.com.silverwrist.venice.ui);
|
||||
importPackage(Packages.com.silverwrist.venice.ui.dlg);
|
||||
importPackage(Packages.com.silverwrist.venice.ui.helpers);
|
||||
importPackage(Packages.com.silverwrist.venice.ui.view);
|
||||
|
||||
// get the request object
|
||||
rinput = bsf.lookupBean("request");
|
||||
|
||||
if (!(rinput.user.canCreateCommunity()))
|
||||
{ // can't create communities - bye!
|
||||
if (rinput.user.isLoggedIn())
|
||||
vlib.output(new ErrorBox("Community Error","You are not permitted to create communities.","top.js.vs"));
|
||||
else
|
||||
vlib.output(new LogInOrCreate());
|
||||
vlib.done();
|
||||
|
||||
} // end if
|
||||
|
||||
dlg = rinput.getDialog("create.community");
|
||||
if ("GET"==rinput.verb)
|
||||
{ // just output the dialog
|
||||
dlg.setValue("language","en-US");
|
||||
dlg.setValue("country","US");
|
||||
vlib.output(dlg);
|
||||
vlib.done();
|
||||
|
||||
} // end if
|
||||
|
||||
// everything following is for a POST
|
||||
op = dlg.whichButton(rinput) + "";
|
||||
if (op=="cancel")
|
||||
{ // user cancelled - bail out
|
||||
vlib.output(new Redirect("top.js.vs",LinkTypes.SERVLET));
|
||||
vlib.done();
|
||||
|
||||
} // end if
|
||||
|
||||
rc = null;
|
||||
if (op=="create")
|
||||
{ // actually creating a community
|
||||
dlg.load(rinput); // load the dialog values
|
||||
|
||||
try
|
||||
{ // start by validating the dialog
|
||||
dlg.validate();
|
||||
|
||||
// validate some extra stuff
|
||||
my_alias = dlg.getValue("alias");
|
||||
if (rinput.engine.aliasExists(my_alias,-1))
|
||||
throw new ValidationException("That alias is already used by another community on the system.");
|
||||
my_comtype = dlg.getValue("comtype") + "";
|
||||
my_joinkey = null;
|
||||
if (my_comtype=="1")
|
||||
{ // get the join key for this private community
|
||||
my_joinkey = dlg.getValue("joinkey");
|
||||
if (vlib.emptyString(my_joinkey))
|
||||
throw new ValidationException("Private communities must specify a join key value.");
|
||||
|
||||
} // end if
|
||||
|
||||
my_hidemode = parseInt(dlg.getValue("hidemode"),10); // get the hide mode
|
||||
|
||||
// Create the new community context.
|
||||
new_comm = rinput.user.createCommunity(dlg.getValue("name"),my_alias,dlg.getValue("language"),
|
||||
dlg.getValue("synopsis"),dlg.getValue("rules"),my_joinkey,
|
||||
my_hidemode);
|
||||
|
||||
// Get the new community's contact record and fill in the pieces of info we know.
|
||||
ci = new_comm.getContactInfo();
|
||||
ci.locality = dlg.getValue("loc");
|
||||
ci.region = dlg.getValue("reg");
|
||||
ci.postalCode = dlg.getValue("pcode");
|
||||
ci.country = dlg.getValue("country");
|
||||
new_comm.putContactInfo(ci);
|
||||
|
||||
// create the return view
|
||||
rinput.setRequestAttribute("new.community",new_comm);
|
||||
rc = new JSPView("New Community Created","comm/new.jsp");
|
||||
rc.menuSelector = Content.MENU_SELECTOR_COMMUNITY;
|
||||
|
||||
} // end try
|
||||
catch (e)
|
||||
{ // exception creating the community
|
||||
etype = vlib.exceptionType(e) + "";
|
||||
if (etype.match("ValidationException") || etype.match("AccessError"))
|
||||
{ // reset the dialog and let them try again
|
||||
dlg.setErrorMessage(e.message + " Please try again.");
|
||||
rc = dlg;
|
||||
|
||||
} // end if
|
||||
else if (etype.match("DataException"))
|
||||
rc = new ErrorBox("Database Error","Database error creating community: " + e.message,"top.js.vs");
|
||||
else
|
||||
rc = e;
|
||||
|
||||
} // end catch
|
||||
|
||||
} // end if
|
||||
else
|
||||
{ // don't know what button was pressed
|
||||
logger.error("no known button click on POST to comm/create.js.vs");
|
||||
rc = new ErrorBox("Internal Error","Unknown command button pressed","top.js.vs");
|
||||
|
||||
} // end else
|
||||
|
||||
vlib.output(rc); // all done!
|
||||
74
scripts/comm/delete.js
Normal file
74
scripts/comm/delete.js
Normal file
@@ -0,0 +1,74 @@
|
||||
// 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):
|
||||
|
||||
importPackage(Packages.com.silverwrist.venice.core);
|
||||
importPackage(Packages.com.silverwrist.venice.except);
|
||||
importPackage(Packages.com.silverwrist.venice.ui);
|
||||
importPackage(Packages.com.silverwrist.venice.ui.helpers);
|
||||
|
||||
// get the request object and the community
|
||||
rinput = bsf.lookupBean("request");
|
||||
comm = rinput.getCommunity(true,"top.js.vs");
|
||||
|
||||
if (!(comm.canDelete()))
|
||||
{ // we can't delete the community, so what are we doing here?
|
||||
logger.error("you can't delete the community - not gonna do it, wouldn't be prudent");
|
||||
vlib.output(new ErrorBox("Access Error","You do not have permission to delete this community.",
|
||||
"comm/admin_menu.js.vs?cc=" + comm.communityID));
|
||||
vlib.done();
|
||||
|
||||
} // end if
|
||||
|
||||
CONFIRM_attr = "community.delete.confirm";
|
||||
CONFIRM_param = "confirm";
|
||||
|
||||
rc = null;
|
||||
|
||||
if (ConfirmBox.isConfirmed(rinput,CONFIRM_attr,CONFIRM_param))
|
||||
{ // we are confirmed - delete the community!
|
||||
try
|
||||
{ // delete the community
|
||||
comm.deleteCommunity();
|
||||
|
||||
// the community is now GONE - go back to the top
|
||||
rc = new Redirect("top.js.vs",LinkTypes.SERVLET);
|
||||
|
||||
} // end try
|
||||
catch (e)
|
||||
{ // caught an exception while unjoining
|
||||
etype = vlib.exceptionType(e) + "";
|
||||
if (etype.match("AccessError"))
|
||||
rc = new ErrorBox("Access Error",e.message,"comm/admin_menu.js.vs?cc=" + comm.communityID);
|
||||
else if (etype.match("DataException"))
|
||||
rc = new ErrorBox("Database Error","Database error deleting community: " + e.message,
|
||||
"comm/admin_menu.js.vs?cc=" + comm.communityID);
|
||||
else
|
||||
rc = e;
|
||||
|
||||
} // end catch
|
||||
|
||||
} // end if
|
||||
else
|
||||
{ // need to get confirmation
|
||||
message = "You are about to permanently delete the \"" + comm.name + "\" community, including all "
|
||||
+ "conferences and other resources it contains! Are you sure you want to do this?";
|
||||
rc = new ConfirmBox(rinput,CONFIRM_attr,CONFIRM_param,"Delete Community",message,
|
||||
"comm/delete.js.vs?cc=" + comm.communityID,LinkTypes.SERVLET,
|
||||
"comm/admin_menu.js.vs?cc=" + comm.communityID,LinkTypes.SERVLET);
|
||||
|
||||
} // end else
|
||||
|
||||
vlib.output(rc);
|
||||
86
scripts/comm/email.js
Normal file
86
scripts/comm/email.js
Normal file
@@ -0,0 +1,86 @@
|
||||
// The contents of this file are subject to the Mozilla Public License Version 1.1
|
||||
// (the "License"); you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at <http://www.mozilla.org/MPL/>.
|
||||
//
|
||||
// Software distributed under the License is distributed on an "AS IS" basis, WITHOUT
|
||||
// WARRANTY OF ANY KIND, either express or implied. See the License for the specific
|
||||
// language governing rights and limitations under the License.
|
||||
//
|
||||
// The Original Code is the Venice Web Communities System.
|
||||
//
|
||||
// The Initial Developer of the Original Code is Eric J. Bowersox <erbo@silcom.com>,
|
||||
// for Silverwrist Design Studios. Portions created by Eric J. Bowersox are
|
||||
// Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved.
|
||||
//
|
||||
// Contributor(s):
|
||||
|
||||
importPackage(java.util);
|
||||
importPackage(Packages.com.silverwrist.venice.core);
|
||||
importPackage(Packages.com.silverwrist.venice.except);
|
||||
importPackage(Packages.com.silverwrist.venice.ui);
|
||||
importPackage(Packages.com.silverwrist.venice.ui.helpers);
|
||||
importPackage(Packages.com.silverwrist.venice.ui.view);
|
||||
|
||||
// get the request object and the community
|
||||
rinput = bsf.lookupBean("request");
|
||||
comm = rinput.getCommunity(true,"top.js.vs");
|
||||
|
||||
if (!(comm.canMassMail()))
|
||||
{ // we can't send mass mail to the community, so what are we doing here?
|
||||
logger.error("you can't mass-mail the community - not gonna do it, wouldn't be prudent");
|
||||
vlib.output(new ErrorBox("Access Error","You do not have permission to sent mass mail to this community.",
|
||||
"comm/admin_menu.js.vs?cc=" + comm.communityID));
|
||||
vlib.done();
|
||||
|
||||
} // end if
|
||||
|
||||
if ("GET"==rinput.verb)
|
||||
{ // display the view
|
||||
view = new JSPView("Community E-Mail: " + comm.name,"comm/email.jsp");
|
||||
view.menuSelector = Content.MENU_SELECTOR_COMMUNITY;
|
||||
vlib.output(view);
|
||||
vlib.done();
|
||||
|
||||
} // end if
|
||||
|
||||
if (rinput.isImageButtonClicked("cancel"))
|
||||
{ // user cancelled - go back to the menu
|
||||
vlib.output(new Redirect("comm/admin_menu.js.vs?cc=" + comm.communityID,LinkTypes.SERVLET));
|
||||
vlib.done();
|
||||
|
||||
} // end if
|
||||
|
||||
rc = null;
|
||||
if (rinput.isImageButtonClicked("send"))
|
||||
{ // actually send the E-mail!
|
||||
try
|
||||
{ // do it!
|
||||
comm.massMail(rinput.getParameter("subj"),rinput.getParameter("pb"));
|
||||
|
||||
// now bounce back to the menu
|
||||
rc = new Redirect("comm/admin_menu.js.vs?cc=" + comm.communityID,LinkTypes.SERVLET);
|
||||
|
||||
} // end try
|
||||
catch (e)
|
||||
{ // exception caught in the mass mailing
|
||||
etype = vlib.exceptionType(e) + "";
|
||||
if (etype.match("DataException"))
|
||||
rc = new ErrorBox("Database Error","Database error getting mailing list: " + e.message,
|
||||
"comm/admin_menu.js.vs?cc=" + comm.communityID);
|
||||
else if (etype.match("AccessError"))
|
||||
rc = new ErrorBox("Access Error",e.message,"comm/admin_menu.js.vs?cc=" + comm.communityID);
|
||||
else
|
||||
rc = e;
|
||||
|
||||
} // end catch
|
||||
|
||||
} // end try
|
||||
else
|
||||
{ // what the hell was that button
|
||||
logger.error("no known button click on POST to comm/email.js");
|
||||
rc = new ErrorBox("Internal Error","Unknown command button pressed",
|
||||
"comm/admin_menu.js.vs?cc=" + comm.communityID);
|
||||
|
||||
} // end else
|
||||
|
||||
vlib.output(rc);
|
||||
93
scripts/comm/invite.js
Normal file
93
scripts/comm/invite.js
Normal file
@@ -0,0 +1,93 @@
|
||||
// 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):
|
||||
|
||||
importPackage(java.util);
|
||||
importPackage(Packages.com.silverwrist.venice.core);
|
||||
importPackage(Packages.com.silverwrist.venice.except);
|
||||
importPackage(Packages.com.silverwrist.venice.ui);
|
||||
importPackage(Packages.com.silverwrist.venice.ui.helpers);
|
||||
importPackage(Packages.com.silverwrist.venice.ui.view);
|
||||
|
||||
// get the request object and the community
|
||||
rinput = bsf.lookupBean("request");
|
||||
comm = rinput.getCommunity(true,"top.js.vs");
|
||||
|
||||
if (!(comm.canSendInvitation()))
|
||||
{ // you can't send an invitation
|
||||
vlib.output(new ErrorBox("Community Error","You are not permitted to send an invitation.",
|
||||
"community/" + comm.alias));
|
||||
vlib.done();
|
||||
|
||||
} // end if
|
||||
|
||||
locator = "cc=" + comm.communityID;
|
||||
if ("GET"==rinput.verb)
|
||||
{ // set up the invitation screen parameters
|
||||
rinput.setRequestAttribute("invitation.title","Send Community Invitation:");
|
||||
rinput.setRequestAttribute("invitation.subtitle",comm.name);
|
||||
rinput.setRequestAttribute("invitation.action",rinput.formatURL("comm/invite.js.vs",LinkTypes.SERVLET));
|
||||
rinput.setRequestAttribute("invitation.params",
|
||||
"<INPUT TYPE=\"HIDDEN\" NAME=\"cc\" VALUE=\"" + comm.communityID + "\">");
|
||||
|
||||
// create the invitation and display it
|
||||
view = new JSPView("Send Invitation","comm/invite.jsp");
|
||||
view.menuSelector = Content.MENU_SELECTOR_COMMUNITY;
|
||||
view.pageQID = "comm/invite.js.vs?" + locator;
|
||||
vlib.output(view);
|
||||
vlib.done();
|
||||
|
||||
} // end if
|
||||
|
||||
if (rinput.isImageButtonClicked("cancel"))
|
||||
{ // bounce back to the base page
|
||||
vlib.output(new Redirect("comm/show.js.vs?" + locator,LinkTypes.SERVLET));
|
||||
vlib.done();
|
||||
|
||||
} // end if
|
||||
|
||||
rc = null;
|
||||
if (rinput.isImageButtonClicked("send"))
|
||||
{ // do the actual send!
|
||||
try
|
||||
{ // send out the invitation and then redirect back
|
||||
comm.sendInvitation(rinput.getParameter("addr"),rinput.getParameter("pb"));
|
||||
rc = new Redirect("comm/show.js.vs?" + locator,LinkTypes.SERVLET);
|
||||
|
||||
} // end try
|
||||
catch (e)
|
||||
{ // exception sending the invitation
|
||||
etype = vlib.exceptionType(e) + "";
|
||||
if (etype.match("AccessError"))
|
||||
rc = new ErrorBox("Access Error",e.message,"comm/show.js.vs?" + locator);
|
||||
else if (etype.match("DataException"))
|
||||
rc = new ErrorBox("Database Error","Database error sending invitation: " + e.message,
|
||||
"comm/show.js.vs?" + locator);
|
||||
else if (etype.match("EmailException"))
|
||||
rc = new ErrorBox("E-Mail Error","Error sending E-mail: " + e.message,"comm/show.js.vs?" + locator);
|
||||
else
|
||||
rc = e;
|
||||
|
||||
} // end catch
|
||||
|
||||
} // end if
|
||||
else
|
||||
{ // no known button pressed
|
||||
logger.error("no known button click on POST to comm/invite.js");
|
||||
rc = new ErrorBox("Internal Error","Unknown command button pressed","comm/show.js.vs?" + locator);
|
||||
|
||||
} // end else
|
||||
|
||||
vlib.output(rc);
|
||||
70
scripts/comm/join.js
Normal file
70
scripts/comm/join.js
Normal file
@@ -0,0 +1,70 @@
|
||||
// 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):
|
||||
|
||||
importPackage(Packages.com.silverwrist.venice.core);
|
||||
importPackage(Packages.com.silverwrist.venice.except);
|
||||
importPackage(Packages.com.silverwrist.venice.ui);
|
||||
importPackage(Packages.com.silverwrist.venice.ui.dlg);
|
||||
importPackage(Packages.com.silverwrist.venice.ui.helpers);
|
||||
importPackage(Packages.com.silverwrist.venice.ui.view);
|
||||
|
||||
// get the request object and the community
|
||||
rinput = bsf.lookupBean("request");
|
||||
comm = rinput.getCommunity(true,"top.js.vs");
|
||||
|
||||
if (!(comm.canJoin()))
|
||||
{ // you can't join the community
|
||||
vlib.output(new ErrorBox("Community Error","You are not permitted to join this community.","top.js.vs"));
|
||||
vlib.done();
|
||||
|
||||
} // end if
|
||||
|
||||
if (comm.isPublicCommunity())
|
||||
{ // the community is public - attempt to join right away
|
||||
rc = null;
|
||||
try
|
||||
{ // join the community!
|
||||
comm.join(null);
|
||||
|
||||
// force the menus to be redrawn
|
||||
rinput.setSessionAttribute(RequestInput.LEFT_MENU_SESSION_ATTR,null);
|
||||
|
||||
// create a return view
|
||||
rc = new JSPView("Welcome to " + comm.name,"comm/welcome.jsp");
|
||||
rc.menuSelector = Content.MENU_SELECTOR_COMMUNITY;
|
||||
|
||||
} // end try
|
||||
catch (e)
|
||||
{ // exception when we tried to join the community
|
||||
etype = vlib.exceptionType(e) + "";
|
||||
if (etype.match("AccessError"))
|
||||
rc = new ErrorBox("Access Error","Unable to join community: " + e.message,"top.js.vs");
|
||||
else if (etype.match("DataException"))
|
||||
rc = new ErrorBox("Database Error","Database error joining community: " + e.message,"top.js.vs");
|
||||
else
|
||||
rc = e;
|
||||
|
||||
} // end catch
|
||||
|
||||
vlib.output(rc);
|
||||
vlib.done();
|
||||
|
||||
} // end if
|
||||
|
||||
// Get the "join key" dialog.
|
||||
dlg = rinput.getDialog("join");
|
||||
dlg.setValue("cc",comm.communityID + "");
|
||||
vlib.output(dlg);
|
||||
98
scripts/comm/join_key.js
Normal file
98
scripts/comm/join_key.js
Normal file
@@ -0,0 +1,98 @@
|
||||
// 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):
|
||||
|
||||
importPackage(Packages.com.silverwrist.venice.core);
|
||||
importPackage(Packages.com.silverwrist.venice.except);
|
||||
importPackage(Packages.com.silverwrist.venice.ui);
|
||||
importPackage(Packages.com.silverwrist.venice.ui.dlg);
|
||||
importPackage(Packages.com.silverwrist.venice.ui.helpers);
|
||||
importPackage(Packages.com.silverwrist.venice.ui.view);
|
||||
|
||||
// get the request object and the community
|
||||
rinput = bsf.lookupBean("request");
|
||||
comm = rinput.getCommunity(true,"top.js.vs");
|
||||
|
||||
if (!(comm.canJoin()))
|
||||
{ // you can't join the community
|
||||
vlib.output(new ErrorBox("Community Error","You are not permitted to join this community.","top.js.vs"));
|
||||
vlib.done();
|
||||
|
||||
} // end if
|
||||
|
||||
if (comm.isPublicCommunity())
|
||||
{ // we shouldn't have gotten here!
|
||||
vlib.output(new ErrorBox("Internal Error","This community should already have been joined.",
|
||||
"comm/show.js.vs?cc=" + comm.communityID));
|
||||
vlib.done();
|
||||
|
||||
} // end if
|
||||
|
||||
// Get the "join key" dialog.
|
||||
dlg = rinput.getDialog("join");
|
||||
op = dlg.whichButton(rinput) + "";
|
||||
|
||||
if (op=="cancel")
|
||||
{ // cancel the join and bounce back to the profile
|
||||
vlib.output(new Redirect("comm/show.js.vs?cc=" + comm.communityID,LinkTypes.SERVLET));
|
||||
vlib.done();
|
||||
|
||||
} // end if
|
||||
|
||||
rc = null;
|
||||
if (op=="join_now")
|
||||
{ // go ahead and join up, if we can
|
||||
dlg.load(rinput);
|
||||
|
||||
try
|
||||
{ // get the join key
|
||||
key = dlg.getValue("key");
|
||||
if (vlib.emptyString("key"))
|
||||
throw new ValidationException("No join key specified.");
|
||||
|
||||
comm.join(key); // join the community!
|
||||
|
||||
// force the menus to be redrawn
|
||||
rinput.setSessionAttribute(RequestInput.LEFT_MENU_SESSION_ATTR,null);
|
||||
|
||||
// create a return view
|
||||
rc = new JSPView("Welcome to " + comm.name,"comm/welcome.jsp");
|
||||
rc.menuSelector = Content.MENU_SELECTOR_COMMUNITY;
|
||||
|
||||
} // end try
|
||||
catch (e)
|
||||
{ // exception when we tried to join the community
|
||||
etype = vlib.exceptionType(e) + "";
|
||||
if (etype.match("ValidationException") || etype.match("AccessError"))
|
||||
{ // reset the dialog and try again
|
||||
dlg.setErrorMessage(e.message + " Please try again.");
|
||||
dlg.setValue("key",null);
|
||||
rc = dlg;
|
||||
|
||||
} // end if
|
||||
else if (etype.match("DataException"))
|
||||
rc = new ErrorBox("Database Error","Database error joining community: " + e.message,"top.js.vs");
|
||||
|
||||
} // end catch
|
||||
|
||||
} // end if
|
||||
else
|
||||
{ // we don't know what button was clicked
|
||||
logger.error("no known button click on POST to comm.join_key.js");
|
||||
rc = new ErrorBox("Internal Error","Unknown command button pressed","top.js.vs");
|
||||
|
||||
} // end else
|
||||
|
||||
vlib.output(rc);
|
||||
133
scripts/comm/members.js
Normal file
133
scripts/comm/members.js
Normal file
@@ -0,0 +1,133 @@
|
||||
// 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):
|
||||
|
||||
importPackage(java.util);
|
||||
importPackage(Packages.com.silverwrist.venice.core);
|
||||
importPackage(Packages.com.silverwrist.venice.except);
|
||||
importPackage(Packages.com.silverwrist.venice.ui);
|
||||
importPackage(Packages.com.silverwrist.venice.ui.helpers);
|
||||
importPackage(Packages.com.silverwrist.venice.ui.view);
|
||||
|
||||
// get the request object and the community
|
||||
rinput = bsf.lookupBean("request");
|
||||
comm = rinput.getCommunity(true,"top.js.vs");
|
||||
|
||||
// create the view object
|
||||
view = new MembersView(rinput.engine.getStdNumSearchResults(),comm.name);
|
||||
rc = null;
|
||||
try
|
||||
{ // set up the member list
|
||||
if ("GET"==rinput.verb)
|
||||
{ // initial GET of the member list - just get the start of the list
|
||||
mbr_list = comm.getMemberList();
|
||||
view.simple = true;
|
||||
view.results = mbr_list;
|
||||
view.findCount = mbr_list.size();
|
||||
|
||||
} // end if
|
||||
else
|
||||
{ // this is a more complicated operation...
|
||||
if ("1"==rinput.getParameter("sl"))
|
||||
{ // Set up some of the easy initial parameters.
|
||||
view.simple = true;
|
||||
|
||||
// Retrieve the offset and find count.
|
||||
view.offset = rinput.getParameterInt("ofs",0);
|
||||
view.findCount = rinput.getParameterInt("fcount",-1);
|
||||
|
||||
// Adjust the offset based on the button clicked.
|
||||
if (rinput.isImageButtonClicked("search"))
|
||||
throw new ValidationException("Invalid button clicked."); // can't happen
|
||||
else if (rinput.isImageButtonClicked("previous"))
|
||||
view.offset = Math.max(view.offset-view.maxResults,0);
|
||||
else if (rinput.isImageButtonClicked("next"))
|
||||
view.offset += view.maxResults;
|
||||
else
|
||||
throw new ValidationException("Unable to determine what action triggered the form.");
|
||||
|
||||
// Get the list and subset it if necessary.
|
||||
mbr_list = comm.getMemberList();
|
||||
if (view.findCount<0)
|
||||
view.findCount = mbr_list.size();
|
||||
if (view.offset==0)
|
||||
view.results = mbr_list;
|
||||
else
|
||||
view.results = mbr_list.subList(offset,mbr_list.size());
|
||||
|
||||
} // end if
|
||||
else
|
||||
{ // This is a search operation...
|
||||
view.simple = false;
|
||||
|
||||
// Get the search field parameter.
|
||||
x = rinput.getParameterInt("field",SearchMode.FIELD_USER_NAME);
|
||||
if ( (x!=SearchMode.FIELD_USER_NAME) && (x!=SearchMode.FIELD_USER_DESCRIPTION)
|
||||
&& (x!=SearchMode.FIELD_USER_GIVEN_NAME) && (x!=SearchMode.FIELD_USER_FAMILY_NAME))
|
||||
throw new ValidationException("The search field parameter is not valid.");
|
||||
view.field = x;
|
||||
|
||||
// Get the search mode parameter.
|
||||
x = rinput.getParameterInt("mode",SearchMode.SEARCH_PREFIX);
|
||||
if ( (x!=SearchMode.SEARCH_PREFIX) && (x!=SearchMode.SEARCH_SUBSTRING)
|
||||
&& (x!=SearchMode.SEARCH_REGEXP))
|
||||
throw new ValidationException("The search mode parameter is not valid.");
|
||||
view.mode = x;
|
||||
|
||||
// Get the search term parameter.
|
||||
view.term = rinput.getParameter("term");
|
||||
if (view.term==null)
|
||||
view.term = "";
|
||||
|
||||
// Retrieve the offset and find count.
|
||||
view.offset = rinput.getParameterInt("ofs",0);
|
||||
view.findCount = rinput.getParameterInt("fcount",-1);
|
||||
|
||||
// Adjust the offset based on the button clicked.
|
||||
if (rinput.isImageButtonClicked("search"))
|
||||
view.offset = 0; // begin a new search
|
||||
else if (rinput.isImageButtonClicked("previous"))
|
||||
view.offset = Math.max(view.offset-view.maxResults,0);
|
||||
else if (rinput.isImageButtonClicked("next"))
|
||||
view.offset += view.maxResults;
|
||||
else
|
||||
throw new ValidationException("Unable to determine what action triggered the form.");
|
||||
|
||||
// Perform the search!
|
||||
view.results = comm.searchForMembers(view.field,view.mode,view.term,view.offset,view.maxResults);
|
||||
if (view.findCount<0)
|
||||
view.findCount = comm.getSearchMemberCount(view.field,view.mode,view.term);
|
||||
|
||||
} // end else (search operation)
|
||||
|
||||
} // end else (POST)
|
||||
|
||||
rc = view;
|
||||
|
||||
} // end try
|
||||
catch (e)
|
||||
{ // exception in the find operation
|
||||
etype = vlib.exceptionType(e) + "";
|
||||
if (etype.match("ValidationException"))
|
||||
rc = new ErrorBox("Find Error",e.message,"comm/members.js.vs?cc=" + comm.communityID);
|
||||
else if (etype.match("DataException"))
|
||||
rc = new ErrorBox("Database Error","Database error getting member list: " + e.message,
|
||||
"community/" + comm.alias);
|
||||
else
|
||||
rc = e;
|
||||
|
||||
} // end catch
|
||||
|
||||
vlib.output(rc);
|
||||
136
scripts/comm/photo.js
Normal file
136
scripts/comm/photo.js
Normal file
@@ -0,0 +1,136 @@
|
||||
// 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):
|
||||
|
||||
importClass(java.awt.Dimension);
|
||||
importPackage(Packages.com.silverwrist.util);
|
||||
importPackage(Packages.com.silverwrist.util.image);
|
||||
importPackage(Packages.com.silverwrist.venice.core);
|
||||
importPackage(Packages.com.silverwrist.venice.except);
|
||||
importPackage(Packages.com.silverwrist.venice.ui);
|
||||
importPackage(Packages.com.silverwrist.venice.ui.helpers);
|
||||
importPackage(Packages.com.silverwrist.venice.ui.view);
|
||||
|
||||
// get the request object and the community
|
||||
rinput = bsf.lookupBean("request");
|
||||
comm = rinput.getCommunity(true,"top.js.vs");
|
||||
|
||||
if (!(comm.canModifyProfile()))
|
||||
{ // no access - sorry, dude
|
||||
logger.error("tried to call up community profile screen without access...naughty naughty!");
|
||||
vlib.output(new ErrorBox("Unauthorized","You do not have access to modify this community's profile.",
|
||||
"comm/admin_menu.js.vs?cc=" + comm.communityID));
|
||||
vlib.done();
|
||||
|
||||
} // end if
|
||||
|
||||
rc = null;
|
||||
if ("GET"==rinput.verb)
|
||||
{ // create a PhotoUploader to do the photo uploading
|
||||
try
|
||||
{ // create and initialize the PhotoUploader
|
||||
rc = new PhotoUploader("Upload Community Logo","comm/photo.js.vs",LinkTypes.SERVLET);
|
||||
rc.addHiddenParameter("cc",comm.communityID);
|
||||
rc.photoTag = rinput.getCommunityLogoTag(comm.getContactInfo().photoURL);
|
||||
rc.label = "New community logo";
|
||||
|
||||
} // end try
|
||||
catch (e)
|
||||
{ // an exception in the output...
|
||||
etype = vlib.exceptionType(e) + "";
|
||||
if (etype.match("DataException"))
|
||||
rc = new ErrorBox("Database Error","Database error generating display: " + e.message,
|
||||
"comm/profile.js.vs?cc=" + comm.communityID);
|
||||
else if (etype.match("Access Error"))
|
||||
rc = new ErrorBox("Access Error",e.message,"comm/profile.js.vs?cc=" + comm.communityID);
|
||||
else
|
||||
rc = e;
|
||||
|
||||
} // end catch
|
||||
|
||||
vlib.output(rc);
|
||||
vlib.done();
|
||||
|
||||
} // end if
|
||||
|
||||
// If the cancel button was clicked, bounce out of here.
|
||||
if (rinput.isImageButtonClicked("cancel"))
|
||||
{ // user elected to cancel upload - bounce us out of here
|
||||
vlib.output(new Redirect("comm/profile.js.vs?cc=" + comm.communityID,LinkTypes.SERVLET));
|
||||
vlib.done();
|
||||
|
||||
} // end if
|
||||
|
||||
if (rinput.isImageButtonClicked("upload"))
|
||||
{ // do some shorts-checking in the parameters
|
||||
if (!(rinput.isFileParam("thepic")))
|
||||
{ // bogus file parameter
|
||||
logger.error("Internal Error: 'thepic' should be a file param");
|
||||
vlib.output(new ErrorBox(null,"Internal Error: 'thepic' should be a file param",
|
||||
"comm/profile.js.vs?cc=" + comm.communityID));
|
||||
vlib.done();
|
||||
|
||||
} // end if
|
||||
|
||||
mimetype = rinput.getParameterType("thepic") + "";
|
||||
if (!(mimetype.match("image/")))
|
||||
{ // not an image file type that got uploaded
|
||||
logger.error("Error: 'thepic' not an image type");
|
||||
vlib.output(new ErrorBox(null,"You did not upload an image file. Try again.",
|
||||
"comm/photo.js.vs?cc=" + comm.communityID));
|
||||
vlib.done();
|
||||
|
||||
} // end if
|
||||
|
||||
try
|
||||
{ // normalize the photo to 100x100 pixels
|
||||
real_pic = ImageNormalizer.normalizeImage(rinput.getParameterDataStream("thepic"),
|
||||
rinput.engine.getCommunityLogoSize(),"jpeg");
|
||||
|
||||
// set the community logo data!
|
||||
ci = comm.getContactInfo();
|
||||
ci.setPhotoData(rinput.contextPath + "/imagedata/","image/jpeg",real_pic.length,real_pic.data);
|
||||
comm.putContactInfo(ci);
|
||||
|
||||
// Jump back to the profile form.
|
||||
rinput.setSessionAttribute(RequestInput.LEFT_MENU_SESSION_ATTR,null);
|
||||
rc = new Redirect("comm/profile.js.vs?cc=" + comm.communityID,LinkTypes.SERVLET);
|
||||
|
||||
} // end try
|
||||
catch (e)
|
||||
{ // exception while setting community logo
|
||||
etype = vlib.exceptionType(e) + "";
|
||||
if (etype.match("ServletMultipartException"))
|
||||
rc = new ErrorBox(null,"Internal Error: " + e.message,"comm/profile.js.vs?cc=" + comm.communityID);
|
||||
else if (etype.match("ImageNormalizerException"))
|
||||
rc = new ErrorBox(null,e.message,"comm/photo.js.vs?cc=" + comm.communityID);
|
||||
else if (etype.match("DataException"))
|
||||
rc = new ErrorBox("Database Error","Database error storing community logo: " + e.message,
|
||||
"comm/profile.js.vs?cc=" + comm.communityID);
|
||||
else
|
||||
rc = e;
|
||||
|
||||
} // end catch
|
||||
|
||||
} // end if
|
||||
else
|
||||
{ // don't know the command button!
|
||||
logger.error("no known button click on POST to comm/photo.js");
|
||||
rc = new ErrorBox("Internal Error","Unknown command button pressed",
|
||||
"comm/profile.js.vs?cc=" + comm.communityID);
|
||||
|
||||
} // end else
|
||||
|
||||
vlib.output(rc); // all done!
|
||||
237
scripts/comm/profile.js
Normal file
237
scripts/comm/profile.js
Normal file
@@ -0,0 +1,237 @@
|
||||
// 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):
|
||||
|
||||
importPackage(Packages.com.silverwrist.venice.core);
|
||||
importPackage(Packages.com.silverwrist.venice.except);
|
||||
importPackage(Packages.com.silverwrist.venice.ui);
|
||||
importPackage(Packages.com.silverwrist.venice.ui.dlg);
|
||||
importPackage(Packages.com.silverwrist.venice.ui.helpers);
|
||||
|
||||
// Define a simple function to set up the dialog stuff.
|
||||
function setupDialog(dlg,comm)
|
||||
{
|
||||
dlg.setSubtitle(comm.name);
|
||||
dlg.sendMessage("logo","setLinkURL","comm/photo.js.vs?cc=" + comm.communityID);
|
||||
sinf = comm.securityInfo;
|
||||
dlg.sendMessage("read_lvl","setRoleList",sinf.getRoleList("Community.Read"));
|
||||
dlg.sendMessage("write_lvl","setRoleList",sinf.getRoleList("Community.Write"));
|
||||
dlg.sendMessage("create_lvl","setRoleList",sinf.getRoleList("Community.Create"));
|
||||
dlg.sendMessage("delete_lvl","setRoleList",sinf.getRoleList("Community.Delete"));
|
||||
dlg.sendMessage("join_lvl","setRoleList",sinf.getRoleList("Community.Join"));
|
||||
|
||||
if (comm.isAdminCommunity())
|
||||
{ // need to disable a bunch of crap if this is the admin community
|
||||
dlg.setEnabled("comtype",false);
|
||||
dlg.setEnabled("joinkey",false);
|
||||
dlg.setEnabled("membersonly",false);
|
||||
dlg.setEnabled("hidemode",false);
|
||||
dlg.setEnabled("read_lvl",false);
|
||||
dlg.setEnabled("write_lvl",false);
|
||||
dlg.setEnabled("create_lvl",false);
|
||||
dlg.setEnabled("delete_lvl",false);
|
||||
dlg.setEnabled("join_lvl",false);
|
||||
|
||||
} // end if
|
||||
|
||||
} // end setupDialog
|
||||
|
||||
// get the request object and the community
|
||||
rinput = bsf.lookupBean("request");
|
||||
comm = rinput.getCommunity(true,"top.js.vs");
|
||||
|
||||
if (!(comm.canModifyProfile()))
|
||||
{ // no access - sorry, dude
|
||||
logger.error("tried to call up community profile screen without access...naughty naughty!");
|
||||
vlib.output(new ErrorBox("Unauthorized","You do not have access to modify this community's profile.",
|
||||
"comm/admin_menu.js.vs?cc=" + comm.communityID));
|
||||
vlib.done();
|
||||
|
||||
} // end if
|
||||
|
||||
dlg = rinput.getDialog("community.profile");
|
||||
|
||||
rc = null;
|
||||
if ("GET"==rinput.verb)
|
||||
{ // set up the dialog and return
|
||||
setupDialog(dlg,comm);
|
||||
dlg.setValue("cc",comm.communityID + "");
|
||||
|
||||
try
|
||||
{ // load the parameters of the dialog
|
||||
ci = comm.getContactInfo();
|
||||
props = comm.properties;
|
||||
dlg.setValue("name",comm.name);
|
||||
dlg.setValue("alias",comm.alias);
|
||||
dlg.setValue("synopsis",comm.synopsis);
|
||||
dlg.setValue("rules",comm.rules);
|
||||
dlg.setValue("language",comm.getLanguageCode());
|
||||
dlg.setValue("url",ci.URL);
|
||||
dlg.setValue("logo",ci.photoURL);
|
||||
dlg.setValue("company",ci.company);
|
||||
dlg.setValue("addr1",ci.addressLine1);
|
||||
dlg.setValue("addr2",ci.addressLine2);
|
||||
dlg.setValue("loc",ci.locality);
|
||||
dlg.setValue("reg",ci.region);
|
||||
dlg.setValue("pcode",ci.postalCode);
|
||||
dlg.setValue("country",ci.country);
|
||||
if (comm.isPublicCommunity())
|
||||
{ // public community - has no join key
|
||||
dlg.setValue("comtype","0");
|
||||
dlg.setValue("joinkey","");
|
||||
|
||||
} // end if
|
||||
else
|
||||
{ // private community - display the join key
|
||||
dlg.setValue("comtype","1");
|
||||
dlg.setValue("joinkey",comm.joinKey);
|
||||
|
||||
} // end else
|
||||
|
||||
if (comm.membersOnly)
|
||||
dlg.setValue("membersonly",1);
|
||||
dlg.setValue("hidemode",comm.hideMode);
|
||||
dlg.setValue("read_lvl",comm.readLevel);
|
||||
dlg.setValue("write_lvl",comm.writeLevel);
|
||||
dlg.setValue("create_lvl",comm.createLevel);
|
||||
dlg.setValue("delete_lvl",comm.deleteLevel);
|
||||
dlg.setValue("join_lvl",comm.joinLevel);
|
||||
if (props.displayPostPictures)
|
||||
dlg.setValue("pic_in_post",1);
|
||||
|
||||
rc = dlg;
|
||||
|
||||
} // end try
|
||||
catch (e)
|
||||
{ // exception in dialog initialization
|
||||
etype = vlib.exceptionType(e) + "";
|
||||
if (etype.match("DataException"))
|
||||
rc = new ErrorBox("Database Error","Database error retrieving profile: " + e.message,
|
||||
"comm/admin_menu.js.vs?cc=" + comm.communityID);
|
||||
else if (etype.match("AccessError"))
|
||||
rc = new ErrorBox("Unauthorized","You do not have access to modify this community's profile.",
|
||||
"comm/admin_menu.js.vs?cc=" + comm.communityID);
|
||||
else
|
||||
rc = e;
|
||||
|
||||
} // end catch
|
||||
|
||||
vlib.output(rc);
|
||||
vlib.done();
|
||||
|
||||
} // end if
|
||||
|
||||
// everything that follows is for a POST operation
|
||||
op = dlg.whichButton(rinput) + "";
|
||||
if (op=="cancel")
|
||||
{ // user cancelled profile update - bounce back to the target
|
||||
vlib.output(new Redirect("comm/admin_menu.js.vs?cc=" + comm.communityID,LinkTypes.SERVLET));
|
||||
vlib.done();
|
||||
|
||||
} // end if
|
||||
|
||||
if (op=="update")
|
||||
{ // OK, we can update the dialog!
|
||||
dlg.load(rinput); // load the dialog parameters
|
||||
|
||||
try
|
||||
{ // start by validating the dialog
|
||||
dlg.validate();
|
||||
|
||||
// validate some other stuff we didn't pick up in the fixed validation
|
||||
if (rinput.engine.aliasExists(dlg.getValue("alias"),comm.communityID))
|
||||
throw new ValidationException("That alias is already used by another community on the system.");
|
||||
|
||||
if ("1"==dlg.getValue("comtype"))
|
||||
{ // make sure if they flagged it as Private that they specified a join key
|
||||
if (vlib.emptyString(dlg.getValue("joinkey")))
|
||||
throw new ValidationException("Private communities must specify a join key value.");
|
||||
|
||||
} // end if
|
||||
|
||||
// save off the ContactInfo-related fields first
|
||||
ci = comm.getContactInfo();
|
||||
ci.URL = dlg.getValue("url");
|
||||
ci.company = dlg.getValue("company");
|
||||
ci.addressLine1 = dlg.getValue("addr1");
|
||||
ci.addressLine2 = dlg.getValue("addr2");
|
||||
ci.locality = dlg.getValue("loc");
|
||||
ci.region = dlg.getValue("reg");
|
||||
ci.postalCode = dlg.getValue("pcode");
|
||||
ci.country = dlg.getValue("country");
|
||||
comm.putContactInfo(ci);
|
||||
|
||||
// now save off the property-related fields
|
||||
props = comm.properties;
|
||||
props.displayPostPictures = dlg.getValue("pic_in_post").booleanValue();
|
||||
comm.properties = props;
|
||||
|
||||
// now save the big text fields
|
||||
comm.name = dlg.getValue("name");
|
||||
comm.alias = dlg.getValue("alias");
|
||||
comm.synopsis = dlg.getValue("synopsis");
|
||||
comm.rules = dlg.getValue("rules");
|
||||
comm.setLanguage(dlg.getValue("language"));
|
||||
|
||||
if (!(comm.isAdminCommunity()))
|
||||
{ // save off the security information
|
||||
if ("1"==dlg.getValue("comtype"))
|
||||
comm.joinKey = dlg.getValue("joinkey");
|
||||
else
|
||||
comm.joinKey = null;
|
||||
|
||||
comm.membersOnly = dlg.getValue("membersonly").booleanValue();
|
||||
comm.setHideMode(parseInt(dlg.getValue("hidemode"),10));
|
||||
comm.setSecurityLevels(parseInt(dlg.getValue("read_lvl"),10),parseInt(dlg.getValue("write_lvl"),10),
|
||||
parseInt(dlg.getValue("create_lvl"),10),parseInt(dlg.getValue("delete_lvl"),10),
|
||||
parseInt(dlg.getValue("join_lvl"),10));
|
||||
|
||||
} // end if
|
||||
|
||||
// bounce back to the admin menu
|
||||
rinput.setSessionAttribute(RequestInput.LEFT_MENU_SESSION_ATTR,null);
|
||||
rc = new Redirect("comm/admin_menu.js.vs?cc=" + comm.communityID,LinkTypes.SERVLET);
|
||||
|
||||
} // end try
|
||||
catch (e)
|
||||
{ // exception setting the profile
|
||||
etype = vlib.exceptionType(e) + "";
|
||||
if (etype.match("ValidationException"))
|
||||
{ // validation error - redisplay the dialog
|
||||
dlg.setErrorMessage(e.message + " Please try again.");
|
||||
setupDialog(dlg,comm);
|
||||
rc = dlg;
|
||||
|
||||
} // end if
|
||||
else if (etype.match("DataException"))
|
||||
rc = new ErrorBox("Database Error","Database error updating community: " + e.message,
|
||||
"comm/admin_menu.js.vs?cc=" + comm.communityID);
|
||||
else if (etype.match("AccessError"))
|
||||
rc = new ErrorBox("Access Error",e.message,"comm/admin_menu.js.vs?cc=" + comm.communityID);
|
||||
else
|
||||
rc = e;
|
||||
|
||||
} // end catch
|
||||
|
||||
} // end try
|
||||
else
|
||||
{ // what the hell was that button?
|
||||
logger.error("no known button click on POST to comm/profile.js");
|
||||
rc = new ErrorBox("Internal Error","Unknown command button pressed",
|
||||
"comm/admin_menu.js.vs?cc=" + comm.communityID);
|
||||
|
||||
} // end else
|
||||
|
||||
vlib.output(rc);
|
||||
46
scripts/comm/sb_list.js
Normal file
46
scripts/comm/sb_list.js
Normal file
@@ -0,0 +1,46 @@
|
||||
// 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):
|
||||
|
||||
importPackage(java.util);
|
||||
importPackage(Packages.com.silverwrist.venice.core);
|
||||
importPackage(Packages.com.silverwrist.venice.except);
|
||||
importPackage(Packages.com.silverwrist.venice.ui);
|
||||
importPackage(Packages.com.silverwrist.venice.ui.helpers);
|
||||
importPackage(Packages.com.silverwrist.venice.ui.view);
|
||||
|
||||
// get the request object
|
||||
rinput = bsf.lookupBean("request");
|
||||
|
||||
rc = null;
|
||||
try
|
||||
{ // get and save the member communities list
|
||||
rinput.setRequestAttribute("communities.list",rinput.user.getMemberCommunities());
|
||||
|
||||
rc = new JSPView("Your Communities","comm/sb_list.jsp");
|
||||
rc.menuSelector = Content.MENU_SELECTOR_TOP;
|
||||
|
||||
} // end try
|
||||
catch (e)
|
||||
{ // try to catch an exception
|
||||
etype = vlib.exceptionType(e) + "";
|
||||
if (etype.match("DataException"))
|
||||
rc = new ErrorBox("Database Error","Error getting communities list: " + e.message,"top.js.vs");
|
||||
else
|
||||
rc = e;
|
||||
|
||||
} // end catch
|
||||
|
||||
vlib.output(rc);
|
||||
72
scripts/comm/sb_unjoin.js
Normal file
72
scripts/comm/sb_unjoin.js
Normal file
@@ -0,0 +1,72 @@
|
||||
// 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):
|
||||
|
||||
importPackage(Packages.com.silverwrist.venice.core);
|
||||
importPackage(Packages.com.silverwrist.venice.except);
|
||||
importPackage(Packages.com.silverwrist.venice.ui);
|
||||
importPackage(Packages.com.silverwrist.venice.ui.helpers);
|
||||
|
||||
// get the request object and the community
|
||||
rinput = bsf.lookupBean("request");
|
||||
comm = rinput.getCommunity(true,"comm/sb_list.js.vs");
|
||||
|
||||
if (!(comm.canUnjoin()))
|
||||
{ // you can't unjoin the community
|
||||
vlib.output(new ErrorBox("Community Error","You are not permitted to unjoin this community.",
|
||||
"comm/sb_list.js.vs"));
|
||||
vlib.done();
|
||||
|
||||
} // end if
|
||||
|
||||
// the names of the confirmation attribute and parameter
|
||||
CONFIRM_attr = "confirmbox.unjoin";
|
||||
CONFIRM_param = "confirm";
|
||||
|
||||
rc = null;
|
||||
if (ConfirmBox.isConfirmed(rinput,CONFIRM_attr,CONFIRM_param))
|
||||
{ // we are confirmed - unjoin us!
|
||||
try
|
||||
{ // do the unjoin
|
||||
comm.unjoin();
|
||||
|
||||
// force the menus to be redrawn
|
||||
rinput.setSessionAttribute(RequestInput.LEFT_MENU_SESSION_ATTR,null);
|
||||
|
||||
// after which, return to the top
|
||||
rc = new Redirect("comm/sb_list.js.vs",LinkTypes.SERVLET);
|
||||
|
||||
} // end try
|
||||
catch (e)
|
||||
{ // caught an exception while unjoining
|
||||
etype = vlib.exceptionType(e) + "";
|
||||
if (etype.match("AccessError"))
|
||||
rc = new ErrorBox("Access Error","Unable to unjoin community: " + e.message,"comm/sb_list.js.vs");
|
||||
else if (etype.match("DataException"))
|
||||
rc = new ErrorBox("Database Error","Database error unjoining community: " + e.message,
|
||||
"comm/sb_list.js.vs");
|
||||
else
|
||||
rc = e;
|
||||
|
||||
} // end catch
|
||||
|
||||
} // end if
|
||||
else // not yet confirmed - display the confirmation box
|
||||
rc = new ConfirmBox(rinput,CONFIRM_attr,CONFIRM_param,"Unjoining Community",
|
||||
"Are you sure you want to unjoin the '" + comm.name + "' community?",
|
||||
"comm/sb_unjoin.js.vs?cc=" + comm.communityID,LinkTypes.SERVLET,
|
||||
"comm/sb_list.js.vs",LinkTypes.SERVLET);
|
||||
|
||||
vlib.output(rc);
|
||||
219
scripts/comm/set_member.js
Normal file
219
scripts/comm/set_member.js
Normal file
@@ -0,0 +1,219 @@
|
||||
// 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):
|
||||
|
||||
importPackage(java.util);
|
||||
importPackage(Packages.com.silverwrist.venice.core);
|
||||
importPackage(Packages.com.silverwrist.venice.except);
|
||||
importPackage(Packages.com.silverwrist.venice.ui);
|
||||
importPackage(Packages.com.silverwrist.venice.ui.helpers);
|
||||
importPackage(Packages.com.silverwrist.venice.ui.view);
|
||||
|
||||
// Function which sets the correct community access level onto each entry of the input list.
|
||||
function augmentList(comm,list)
|
||||
{
|
||||
var rl = new ArrayList(list.size());
|
||||
var it = list.iterator();
|
||||
while (it.hasNext())
|
||||
{ // get the community level and add it to the UserFound object
|
||||
var uf = vlib.castUserFound(it.next());
|
||||
var level = comm.getMemberLevel(uf.UID);
|
||||
rl.add(uf.createNewLevel(level));
|
||||
|
||||
} // end while
|
||||
|
||||
return rl;
|
||||
|
||||
} // end augmentList
|
||||
|
||||
// get the request object and the community
|
||||
rinput = bsf.lookupBean("request");
|
||||
comm = rinput.getCommunity(true,"top.js.vs");
|
||||
|
||||
if (!(comm.canModifyProfile()))
|
||||
{ // no access - sorry, dude
|
||||
logger.error("tried to call up membership screen without access...naughty naughty!");
|
||||
vlib.output(new ErrorBox("Unauthorized","You do not have access to modify this community's membership.",
|
||||
"comm/admin_menu.js.vs?cc=" + comm.communityID));
|
||||
vlib.done();
|
||||
|
||||
} // end if
|
||||
|
||||
// create the view object
|
||||
view = new SetMemberView(rinput.engine.getStdNumSearchResults(),comm);
|
||||
|
||||
rc = null;
|
||||
if ("GET"==rinput.verb)
|
||||
{ // set up the initial state of the view
|
||||
try
|
||||
{ // get the community membership list
|
||||
mbr_list = comm.getMemberList();
|
||||
view.simple = true;
|
||||
view.results = mbr_list;
|
||||
view.findCount = mbr_list.size();
|
||||
rc = view;
|
||||
|
||||
} // end try
|
||||
catch (e)
|
||||
{ // we can get at least one exception here
|
||||
etype = vlib.exceptionType(e) + "";
|
||||
if (etype.match("DataException"))
|
||||
rc = new ErrorBox("Database Error","Database error retrieving membership list: " + e.message,
|
||||
"comm/admin_menu.js.vs?cc=" + comm.communityID);
|
||||
else
|
||||
rc = e;
|
||||
|
||||
} // end catch
|
||||
|
||||
vlib.output(rc);
|
||||
vlib.done();
|
||||
|
||||
} // end if
|
||||
|
||||
if (rinput.isImageButtonClicked("update"))
|
||||
{ // do an update of privileges in this community
|
||||
list_uids = vlib.splitList(rinput.getParameter("listuids"),":");
|
||||
try
|
||||
{ // loop through the defined UIDs and check the level...
|
||||
it = list_uids.iterator();
|
||||
while (it.hasNext())
|
||||
{ // get the current and new levels, compare them, and reset if needed
|
||||
x = it.next();
|
||||
cur_level = rinput.getParameterInt("zxcur_" + x,-1);
|
||||
new_level = rinput.getParameterInt("zxnew_" + x,-1);
|
||||
if (cur_level!=new_level)
|
||||
comm.setMembership(parseInt(x,10),new_level);
|
||||
|
||||
} // end while
|
||||
|
||||
} // end try
|
||||
catch (e)
|
||||
{ // the update might throw an error message
|
||||
etype = vlib.exceptionType(e) + "";
|
||||
if (etype.match("DataException"))
|
||||
rc = new ErrorBox("Database Error","Database error adjusting permissions: " + e.message,
|
||||
"comm/set_member.js.vs?cc=" + comm.communityID);
|
||||
else if (etype.match("AccessError"))
|
||||
rc = new ErrorBox("Access Error",e.message,"comm/set_member.js.vs?cc=" + comm.communityID);
|
||||
else
|
||||
rc = e;
|
||||
|
||||
vlib.output(rc); // bail out now with the error message
|
||||
vlib.done();
|
||||
|
||||
} // end catch
|
||||
|
||||
} // end if
|
||||
|
||||
// Carry on with the search operation now.
|
||||
try
|
||||
{ // handle the actual search
|
||||
if ("1"==rinput.getParameter("sl"))
|
||||
{ // Set up some of the easy initial parameters.
|
||||
view.simple = true;
|
||||
|
||||
// Retrieve the offset and find count.
|
||||
view.offset = rinput.getParameterInt("ofs",0);
|
||||
// view.findCount = rinput.getParameterInt("fcount",-1); (N.B.: will get reassigned below)
|
||||
|
||||
// Adjust the offset based on the button clicked.
|
||||
if (rinput.isImageButtonClicked("search"))
|
||||
throw new ValidationException("Invalid button clicked."); // can't happen
|
||||
else if (rinput.isImageButtonClicked("previous"))
|
||||
view.offset = Math.max(view.offset-view.maxResults,0);
|
||||
else if (rinput.isImageButtonClicked("next"))
|
||||
view.offset += view.maxResults;
|
||||
else if (!(rinput.isImageButtonClicked("update")))
|
||||
throw new ValidationException("Unable to determine what action triggered the form.");
|
||||
|
||||
// Get the list and subset it if necessary.
|
||||
// N.B.: Since the update function can reduce the size of the member list, we need to take into account
|
||||
// that the find count will need updating and the offset may be in the wrong place for the list now.
|
||||
mbr_list = comm.getMemberList();
|
||||
view.findCount = mbr_list.size();
|
||||
while ((view.offset>0) && (view.offset>=view.findCount))
|
||||
view.offset = Math.max(view.offset-view.maxResults,0);
|
||||
if (view.offset==0)
|
||||
view.results = mbr_list;
|
||||
else
|
||||
view.results = mbr_list.subList(offset,mbr_list.size());
|
||||
|
||||
} // end if
|
||||
else
|
||||
{ // This is a search operation...
|
||||
view.simple = false;
|
||||
|
||||
// Get the search field parameter.
|
||||
x = rinput.getParameterInt("field",SearchMode.FIELD_USER_NAME);
|
||||
if ( (x!=SearchMode.FIELD_USER_NAME) && (x!=SearchMode.FIELD_USER_DESCRIPTION)
|
||||
&& (x!=SearchMode.FIELD_USER_GIVEN_NAME) && (x!=SearchMode.FIELD_USER_FAMILY_NAME))
|
||||
throw new ValidationException("The search field parameter is not valid.");
|
||||
view.field = x;
|
||||
|
||||
// Get the search mode parameter.
|
||||
x = rinput.getParameterInt("mode",SearchMode.SEARCH_PREFIX);
|
||||
if ( (x!=SearchMode.SEARCH_PREFIX) && (x!=SearchMode.SEARCH_SUBSTRING)
|
||||
&& (x!=SearchMode.SEARCH_REGEXP))
|
||||
throw new ValidationException("The search mode parameter is not valid.");
|
||||
view.mode = x;
|
||||
|
||||
// Get the search term parameter.
|
||||
view.term = rinput.getParameter("term");
|
||||
if (view.term==null)
|
||||
view.term = "";
|
||||
|
||||
// Retrieve the offset and find count.
|
||||
view.offset = rinput.getParameterInt("ofs",0);
|
||||
view.findCount = rinput.getParameterInt("fcount",-1);
|
||||
|
||||
// Adjust the offset based on the button clicked.
|
||||
if (rinput.isImageButtonClicked("search"))
|
||||
view.offset = 0; // begin a new search
|
||||
else if (rinput.isImageButtonClicked("previous"))
|
||||
view.offset = Math.max(view.offset-view.maxResults,0);
|
||||
else if (rinput.isImageButtonClicked("next"))
|
||||
view.offset += view.maxResults;
|
||||
else if (!(rinput.isImageButtonClicked("update")))
|
||||
throw new ValidationException("Unable to determine what action triggered the form.");
|
||||
|
||||
// Perform the search! (Note that we search on USERS, not MEMBERS, as this is the way that we
|
||||
// add additional members to a community.)
|
||||
tmp_results = rinput.engine.searchForUsers(view.field,view.mode,view.term,view.offset,view.maxResults);
|
||||
view.results = augmentList(comm,tmp_results);
|
||||
if (view.findCount<0)
|
||||
view.findCount = rinput.engine.getSearchUserCount(view.field,view.mode,view.term);
|
||||
|
||||
} // end else (search operation)
|
||||
|
||||
rc = view;
|
||||
|
||||
} // end try
|
||||
catch (e)
|
||||
{ // handle an error in search
|
||||
etype = vlib.exceptionType(e) + "";
|
||||
if (etype.match("ValidationException"))
|
||||
rc = new ErrorBox("Find Error",e.message + " Please try again.",
|
||||
"comm/set_member.js.vs?cc=" + comm.communityID);
|
||||
else if (etype.match("DataException"))
|
||||
rc = new ErrorBox("Database Error","Database error getting member list: " + e.message,
|
||||
"comm/set_member.js.vs?cc=" + comm.communityID);
|
||||
else if (etype.match("AccessError"))
|
||||
rc = new ErrorBox("Access Error",e.message,"comm/set_member.js.vs?cc=" + comm.communityID);
|
||||
else
|
||||
rc = e;
|
||||
|
||||
} // end catch
|
||||
|
||||
vlib.output(rc); // all done!
|
||||
88
scripts/comm/show.js
Normal file
88
scripts/comm/show.js
Normal file
@@ -0,0 +1,88 @@
|
||||
// The contents of this file are subject to the Mozilla Public License Version 1.1
|
||||
// (the "License"); you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at <http://www.mozilla.org/MPL/>.
|
||||
//
|
||||
// Software distributed under the License is distributed on an "AS IS" basis, WITHOUT
|
||||
// WARRANTY OF ANY KIND, either express or implied. See the License for the specific
|
||||
// language governing rights and limitations under the License.
|
||||
//
|
||||
// The Original Code is the Venice Web Communities System.
|
||||
//
|
||||
// The Initial Developer of the Original Code is Eric J. Bowersox <erbo@silcom.com>,
|
||||
// for Silverwrist Design Studios. Portions created by Eric J. Bowersox are
|
||||
// Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved.
|
||||
//
|
||||
// Contributor(s):
|
||||
|
||||
importPackage(Packages.com.silverwrist.venice.core);
|
||||
importPackage(Packages.com.silverwrist.venice.except);
|
||||
importPackage(Packages.com.silverwrist.venice.ui);
|
||||
importPackage(Packages.com.silverwrist.venice.ui.helpers);
|
||||
importPackage(Packages.com.silverwrist.venice.ui.view);
|
||||
|
||||
// get the request object and the community
|
||||
rinput = bsf.lookupBean("request");
|
||||
comm = rinput.getCommunity(true,"top.js.vs");
|
||||
|
||||
rc = null;
|
||||
try
|
||||
{ // retrieve certain possibly problematic data items and save them as attributes
|
||||
ci = comm.getContactInfo();
|
||||
rinput.setRequestAttribute("contact.info",ci);
|
||||
rinput.setRequestAttribute("host.profile",comm.getHostProfile());
|
||||
rinput.setRequestAttribute("category",comm.getCategory());
|
||||
|
||||
// determine the last line of the address and save it off
|
||||
buf = null;
|
||||
if (vlib.emptyString(ci.locality))
|
||||
{ // allocate stringbuffer based on region
|
||||
if (vlib.emptyString(ci.region))
|
||||
buf = new java.lang.StringBuffer();
|
||||
else
|
||||
buf = new java.lang.StringBuffer(ci.region);
|
||||
|
||||
} // end if
|
||||
else if (vlib.emptyString(ci.region))
|
||||
buf = new java.lang.StringBuffer(ci.locality);
|
||||
else
|
||||
{ // tack together both locality and region
|
||||
buf = new java.lang.StringBuffer(ci.locality);
|
||||
buf.append(", ");
|
||||
buf.append(ci.region);
|
||||
|
||||
} // end else
|
||||
|
||||
if (!(vlib.emptyString(ci.postalCode)))
|
||||
{ // append the postal code
|
||||
buf.append(" ");
|
||||
buf.append(ci.postalCode);
|
||||
|
||||
} // end if
|
||||
|
||||
rinput.setRequestAttribute("address.lastline",buf.toString());
|
||||
|
||||
// get the full country name and save it off
|
||||
ce = Packages.com.silverwrist.util.International.get().getCountryForCode(ci.country);
|
||||
if (ce!=null)
|
||||
rinput.setRequestAttribute("address.country",ce.name);
|
||||
|
||||
// Save off the community logo tag.
|
||||
rinput.setRequestAttribute("community.logo",rinput.getCommunityLogoTag(ci.photoURL));
|
||||
|
||||
// create the view object
|
||||
rc = new JSPView("Community Profile: " + comm.name,"comm/profile.jsp");
|
||||
rc.menuSelector = Content.MENU_SELECTOR_COMMUNITY;
|
||||
rc.pageQID = "go/" + comm.alias + "!";
|
||||
|
||||
} // end try
|
||||
catch (e)
|
||||
{ // handle an exception thrown by the profile code
|
||||
etype = vlib.exceptionType(e) + "";
|
||||
if (etype.match("DataException"))
|
||||
rc = new ErrorBox("Database Error","Database error accessing community: " + e.message,"top.js.vs");
|
||||
else
|
||||
rc = e;
|
||||
|
||||
} // end catch
|
||||
|
||||
vlib.output(rc); // all done!
|
||||
70
scripts/comm/unjoin.js
Normal file
70
scripts/comm/unjoin.js
Normal file
@@ -0,0 +1,70 @@
|
||||
// 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):
|
||||
|
||||
importPackage(Packages.com.silverwrist.venice.core);
|
||||
importPackage(Packages.com.silverwrist.venice.except);
|
||||
importPackage(Packages.com.silverwrist.venice.ui);
|
||||
importPackage(Packages.com.silverwrist.venice.ui.helpers);
|
||||
|
||||
// get the request object and the community
|
||||
rinput = bsf.lookupBean("request");
|
||||
comm = rinput.getCommunity(true,"top.js.vs");
|
||||
|
||||
if (!(comm.canUnjoin()))
|
||||
{ // you can't unjoin the community
|
||||
vlib.output(new ErrorBox("Community Error","You are not permitted to unjoin this community.","top.js.vs"));
|
||||
vlib.done();
|
||||
|
||||
} // end if
|
||||
|
||||
// the names of the confirmation attribute and parameter
|
||||
CONFIRM_attr = "confirmbox.unjoin";
|
||||
CONFIRM_param = "confirm";
|
||||
|
||||
rc = null;
|
||||
if (ConfirmBox.isConfirmed(rinput,CONFIRM_attr,CONFIRM_param))
|
||||
{ // we are confirmed - unjoin us!
|
||||
try
|
||||
{ // do the unjoin
|
||||
comm.unjoin();
|
||||
|
||||
// force the menus to be redrawn
|
||||
rinput.setSessionAttribute(RequestInput.LEFT_MENU_SESSION_ATTR,null);
|
||||
|
||||
// after which, return to the top
|
||||
rc = new Redirect("top.js.vs",LinkTypes.SERVLET);
|
||||
|
||||
} // end try
|
||||
catch (e)
|
||||
{ // caught an exception while unjoining
|
||||
etype = vlib.exceptionType(e) + "";
|
||||
if (etype.match("AccessError"))
|
||||
rc = new ErrorBox("Access Error","Unable to unjoin community: " + e.message,"top.js.vs");
|
||||
else if (etype.match("DataException"))
|
||||
rc = new ErrorBox("Database Error","Database error unjoining community: " + e.message,"top.js.vs");
|
||||
else
|
||||
rc = e;
|
||||
|
||||
} // end catch
|
||||
|
||||
} // end if
|
||||
else // not yet confirmed - display the confirmation box
|
||||
rc = new ConfirmBox(rinput,CONFIRM_attr,CONFIRM_param,"Unjoining Community",
|
||||
"Are you sure you want to unjoin the '" + comm.name + "' community?",
|
||||
"comm/unjoin.js.vs?cc=" + comm.communityID,LinkTypes.SERVLET,
|
||||
"community/" + comm.alias,LinkTypes.SERVLET);
|
||||
|
||||
vlib.output(rc);
|
||||
53
scripts/conf/add_to_hotlist.js
Normal file
53
scripts/conf/add_to_hotlist.js
Normal file
@@ -0,0 +1,53 @@
|
||||
// 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):
|
||||
|
||||
importPackage(java.util);
|
||||
importPackage(Packages.com.silverwrist.venice.core);
|
||||
importPackage(Packages.com.silverwrist.venice.except);
|
||||
importPackage(Packages.com.silverwrist.venice.ui);
|
||||
importPackage(Packages.com.silverwrist.venice.ui.conf);
|
||||
importPackage(Packages.com.silverwrist.venice.ui.helpers);
|
||||
importPackage(Packages.com.silverwrist.venice.ui.view);
|
||||
|
||||
// get the request object and the community
|
||||
rinput = bsf.lookupBean("request");
|
||||
comm = rinput.getCommunity(true,"top.js.vs");
|
||||
|
||||
// get the current conference
|
||||
currc = new CurrentConference(rinput);
|
||||
conf = currc.getConference(true,"conf/conferences.js.vs?cc=" + comm.communityID);
|
||||
|
||||
rc = null;
|
||||
try
|
||||
{ // add to the hotlist
|
||||
conf.addToHotlist();
|
||||
|
||||
// trap back to the topics list
|
||||
rc = new Redirect("conf/topics.js.vs?cc=" + comm.communityID + "&conf=" + conf.confID);
|
||||
|
||||
} // end try
|
||||
catch (e)
|
||||
{ // error doing the add
|
||||
etype = vlib.exceptionType(e) + "";
|
||||
if (etype.match("DataException"))
|
||||
rc = new ErrorBox("Database Error","Database error adding to hotlist: " + e.message,
|
||||
"conf/conferences.js.vs?cc=" + comm.communityID);
|
||||
else
|
||||
rc = e;
|
||||
|
||||
} // end catch
|
||||
|
||||
vlib.output(rc); // all done...
|
||||
79
scripts/conf/alias_add.js
Normal file
79
scripts/conf/alias_add.js
Normal file
@@ -0,0 +1,79 @@
|
||||
// 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):
|
||||
|
||||
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);
|
||||
importPackage(Packages.com.silverwrist.venice.ui.view);
|
||||
|
||||
// get the request object and the community
|
||||
rinput = bsf.lookupBean("request");
|
||||
comm = rinput.getCommunity(true,"top.js.vs");
|
||||
|
||||
// get the current conference
|
||||
currc = new CurrentConference(rinput);
|
||||
conf = currc.getConference(true,"conf/conferences.js.vs?cc=" + comm.communityID);
|
||||
on_error = "conf/aliases.js.vs?cc=" + comm.communityID + "&conf=" + conf.confID;
|
||||
|
||||
if (!(conf.canChangeConference()))
|
||||
{ // you can't fiddle with this conference
|
||||
vlib.output(new ErrorBox("Access Error",
|
||||
"You do not have permission to change this conference's aliases.",on_error));
|
||||
vlib.done();
|
||||
|
||||
} // end if
|
||||
|
||||
alias = rinput.getParameter("alias");
|
||||
if (vlib.emptyString(alias))
|
||||
{ // this is a no-op
|
||||
vlib.output(new NullResponse());
|
||||
vlib.done();
|
||||
|
||||
} // end if
|
||||
|
||||
if (!(vlib.validVeniceID(alias)))
|
||||
{ // we're not a valid Venice ID
|
||||
on_error += ("&errmsg="
|
||||
+ vlib.encodeURL("The alias you have entered is not a valid identifier. Please try again."));
|
||||
vlib.output(new Redirect(on_error,LinkTypes.SERVLET));
|
||||
vlib.done();
|
||||
|
||||
} // end if
|
||||
|
||||
rc = null;
|
||||
try
|
||||
{ // add the alias
|
||||
conf.addAlias(alias);
|
||||
|
||||
// bounce back to the aliases display
|
||||
rc = new Redirect(on_error,LinkTypes.SERVLET);
|
||||
|
||||
} // end try
|
||||
catch (e)
|
||||
{ // error in the alias definitions
|
||||
etype = vlib.exceptionType(e) + "";
|
||||
if (etype.match("DataException"))
|
||||
rc = new ErrorBox("Database Error","Database error adding alias: " + e.message,on_error);
|
||||
else if (etype.match("AccessError"))
|
||||
rc = new ErrorBox("Access Error",e.message,on_error);
|
||||
else
|
||||
rc = e;
|
||||
|
||||
} // end catch
|
||||
|
||||
vlib.output(rc); // all done...
|
||||
70
scripts/conf/alias_remove.js
Normal file
70
scripts/conf/alias_remove.js
Normal file
@@ -0,0 +1,70 @@
|
||||
// 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):
|
||||
|
||||
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);
|
||||
importPackage(Packages.com.silverwrist.venice.ui.view);
|
||||
|
||||
// get the request object and the community
|
||||
rinput = bsf.lookupBean("request");
|
||||
comm = rinput.getCommunity(true,"top.js.vs");
|
||||
|
||||
// get the current conference
|
||||
currc = new CurrentConference(rinput);
|
||||
conf = currc.getConference(true,"conf/conferences.js.vs?cc=" + comm.communityID);
|
||||
on_error = "conf/aliases.js.vs?cc=" + comm.communityID + "&conf=" + conf.confID;
|
||||
|
||||
if (!(conf.canChangeConference()))
|
||||
{ // you can't fiddle with this conference
|
||||
vlib.output(new ErrorBox("Access Error",
|
||||
"You do not have permission to change this conference's aliases.",on_error));
|
||||
vlib.done();
|
||||
|
||||
} // end if
|
||||
|
||||
alias = rinput.getParameter("alias");
|
||||
if (vlib.emptyString(alias))
|
||||
{ // this is a no-op
|
||||
vlib.output(new NullResponse());
|
||||
vlib.done();
|
||||
|
||||
} // end if
|
||||
|
||||
rc = null;
|
||||
try
|
||||
{ // remove the alias
|
||||
conf.removeAlias(alias);
|
||||
|
||||
// bounce back to the aliases display
|
||||
rc = new Redirect(on_error,LinkTypes.SERVLET);
|
||||
|
||||
} // end try
|
||||
catch (e)
|
||||
{ // error in the alias definitions
|
||||
etype = vlib.exceptionType(e) + "";
|
||||
if (etype.match("DataException"))
|
||||
rc = new ErrorBox("Database Error","Database error removing alias: " + e.message,on_error);
|
||||
else if (etype.match("AccessError"))
|
||||
rc = new ErrorBox("Access Error",e.message,on_error);
|
||||
else
|
||||
rc = e;
|
||||
|
||||
} // end catch
|
||||
|
||||
vlib.output(rc); // all done...
|
||||
62
scripts/conf/aliases.js
Normal file
62
scripts/conf/aliases.js
Normal file
@@ -0,0 +1,62 @@
|
||||
// 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):
|
||||
|
||||
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);
|
||||
importPackage(Packages.com.silverwrist.venice.ui.view);
|
||||
|
||||
// get the request object and the community
|
||||
rinput = bsf.lookupBean("request");
|
||||
comm = rinput.getCommunity(true,"top.js.vs");
|
||||
|
||||
// get the current conference
|
||||
currc = new CurrentConference(rinput);
|
||||
conf = currc.getConference(true,"conf/conferences.js.vs?cc=" + comm.communityID);
|
||||
on_error = "conf/manage_conf.js.vs?cc=" + comm.communityID + "&conf=" + conf.confID;
|
||||
|
||||
if (!(conf.canChangeConference()))
|
||||
{ // you can't fiddle with this conference
|
||||
vlib.output(new ErrorBox("Access Error",
|
||||
"You do not have permission to change this conference's aliases.",on_error));
|
||||
vlib.done();
|
||||
|
||||
} // end if
|
||||
|
||||
rc = null;
|
||||
try
|
||||
{ // get the aliases list
|
||||
rinput.setRequestAttribute("conference.aliases.list",conf.aliases);
|
||||
rinput.setRequestAttribute("conference.aliases.error_message",rinput.getParameter("errmsg"));
|
||||
|
||||
// create the resulting view
|
||||
rc = new JSPView("Manage Conference Aliases: " + conf.name,"conf/aliases.jsp");
|
||||
rc.menuSelector = Content.MENU_SELECTOR_COMMUNITY;
|
||||
|
||||
} // end try
|
||||
catch (e)
|
||||
{ // error in the alias definitions
|
||||
etype = vlib.exceptionType(e) + "";
|
||||
if (etype.match("DataException"))
|
||||
rc = new ErrorBox("Database Error","Database error getting aliases: " + e.message,on_error);
|
||||
else
|
||||
rc = e;
|
||||
|
||||
} // end catch
|
||||
|
||||
vlib.output(rc); // all done...
|
||||
56
scripts/conf/archive_topic.js
Normal file
56
scripts/conf/archive_topic.js
Normal file
@@ -0,0 +1,56 @@
|
||||
// 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):
|
||||
|
||||
importPackage(java.util);
|
||||
importPackage(Packages.com.silverwrist.venice.core);
|
||||
importPackage(Packages.com.silverwrist.venice.except);
|
||||
importPackage(Packages.com.silverwrist.venice.ui);
|
||||
importPackage(Packages.com.silverwrist.venice.ui.conf);
|
||||
importPackage(Packages.com.silverwrist.venice.ui.helpers);
|
||||
|
||||
// get the request object and the community
|
||||
rinput = bsf.lookupBean("request");
|
||||
comm = rinput.getCommunity(true,"top.js.vs");
|
||||
|
||||
// get the current conference
|
||||
currc = new CurrentConference(rinput);
|
||||
conf = currc.getConference(true,"conf/conferences.js.vs?cc=" + comm.communityID);
|
||||
|
||||
// get the current topic
|
||||
topic = currc.getTopic(true,"conf/topics.js.vs?cc=" + comm.communityID + "&conf=" + conf.confID);
|
||||
on_error = "conf/posts.js.vs?cc=" + comm.communityID + "&conf=" + conf.confID + "&top=" + topic.topicNumber;
|
||||
|
||||
rc = null;
|
||||
try
|
||||
{ // get the flag and set the archived status
|
||||
flag = rinput.getParameterInt("flag",0);
|
||||
topic.setArchived(flag==1);
|
||||
rc = new Redirect(on_error,LinkTypes.SERVLET);
|
||||
|
||||
} // end try
|
||||
catch (e)
|
||||
{ // error setting the hide topic
|
||||
etype = vlib.exceptionType(e) + "";
|
||||
if (etype.match("DataException"))
|
||||
rc = new ErrorBox("Database Error","Database error setting archived status: " + e.message,on_error);
|
||||
else if (etype.match("AccessError"))
|
||||
rc = new ErrorBox("Access Error",e.message,on_error);
|
||||
else
|
||||
rc = e;
|
||||
|
||||
} // end catch
|
||||
|
||||
vlib.output(rc); // all done!
|
||||
57
scripts/conf/conf_reports.js
Normal file
57
scripts/conf/conf_reports.js
Normal file
@@ -0,0 +1,57 @@
|
||||
// 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):
|
||||
|
||||
importPackage(java.util);
|
||||
importPackage(Packages.com.silverwrist.venice.core);
|
||||
importPackage(Packages.com.silverwrist.venice.except);
|
||||
importPackage(Packages.com.silverwrist.venice.ui);
|
||||
importPackage(Packages.com.silverwrist.venice.ui.conf);
|
||||
importPackage(Packages.com.silverwrist.venice.ui.helpers);
|
||||
importPackage(Packages.com.silverwrist.venice.ui.view);
|
||||
|
||||
// get the request object and the community
|
||||
rinput = bsf.lookupBean("request");
|
||||
comm = rinput.getCommunity(true,"top.js.vs");
|
||||
|
||||
// get the current conference
|
||||
currc = new CurrentConference(rinput);
|
||||
conf = currc.getConference(true,"conf/conferences.js.vs?cc=" + comm.communityID);
|
||||
on_error = "conf/manage_conf.js.vs?cc=" + comm.communityID + "&conf=" + conf.confID;
|
||||
|
||||
rc = null;
|
||||
try
|
||||
{ // get a topic list from the conference
|
||||
topics = conf.getTopicList(ConferenceContext.GET_ALL,ConferenceContext.SORT_NUMBER);
|
||||
rinput.setRequestAttribute("conference.reports.topiclist",topics);
|
||||
|
||||
// create the result view
|
||||
rc = new JSPView("Conference Reports: " + conf.name,"conf/report_menu.jsp");
|
||||
rc.menuSelector = Content.MENU_SELECTOR_COMMUNITY;
|
||||
|
||||
} // end try
|
||||
catch (e)
|
||||
{ // error generating the topic list
|
||||
etype = vlib.exceptionType(e) + "";
|
||||
if (etype.match("AccessError"))
|
||||
rc = new ErrorBox("Access Error",e.message,on_error);
|
||||
else if (etype.match("DataException"))
|
||||
rc = new ErrorBox("Database Error","Database error listing topics: " + e.message,on_error);
|
||||
else
|
||||
rc = e;
|
||||
|
||||
} // end catch
|
||||
|
||||
vlib.output(rc); // all done...
|
||||
71
scripts/conf/conferences.js
Normal file
71
scripts/conf/conferences.js
Normal file
@@ -0,0 +1,71 @@
|
||||
// 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):
|
||||
|
||||
importPackage(java.util);
|
||||
importPackage(Packages.com.silverwrist.venice.core);
|
||||
importPackage(Packages.com.silverwrist.venice.except);
|
||||
importPackage(Packages.com.silverwrist.venice.ui);
|
||||
importPackage(Packages.com.silverwrist.venice.ui.helpers);
|
||||
importPackage(Packages.com.silverwrist.venice.ui.view);
|
||||
|
||||
// get the request object and the community
|
||||
rinput = bsf.lookupBean("request");
|
||||
comm = rinput.getCommunity(true,"top.js.vs");
|
||||
|
||||
rc = null;
|
||||
try
|
||||
{ // generate the conference listing
|
||||
clist = comm.conferences;
|
||||
|
||||
// get the list of hosts for each conference
|
||||
hlist = new ArrayList(clist.size());
|
||||
for (i=0; i<clist.size(); i++)
|
||||
{ // load the hosts
|
||||
c = vlib.castConferenceContext(clist.get(i));
|
||||
hlist.add(c.hosts);
|
||||
|
||||
} // end for
|
||||
|
||||
// save them off as request attributes
|
||||
rinput.setRequestAttribute("conferences.list",clist);
|
||||
rinput.setRequestAttribute("conferences.hosts.list",hlist);
|
||||
|
||||
// create the JSP view
|
||||
rc = new JSPView("Conference Listing: " + comm.name,"conf/conferences.jsp");
|
||||
rc.menuSelector = Content.MENU_SELECTOR_COMMUNITY;
|
||||
rc.pageQID = "go/" + comm.alias + "!";
|
||||
|
||||
} // end try
|
||||
catch (e)
|
||||
{ // do something with the exception
|
||||
etype = vlib.exceptionType(e) + "";
|
||||
if (etype.match("DataException"))
|
||||
rc = new ErrorBox("Database Error","Database error finding conferences: " + e.message,
|
||||
"comm/show.js.vs?cc=" + comm.communityID);
|
||||
else if (etype.match("AccessError"))
|
||||
{ // an Access Error might be because we aren't logged in
|
||||
if (rinput.user.isLoggedIn())
|
||||
rc = new ErrorBox("Access Error",e.message,"comm/show.js.vs?cc=" + comm.communityID);
|
||||
else
|
||||
rc = new LogInOrCreate();
|
||||
|
||||
} // end else if
|
||||
else
|
||||
rc = e;
|
||||
|
||||
} // end catch
|
||||
|
||||
vlib.output(rc); // all done!
|
||||
106
scripts/conf/create.js
Normal file
106
scripts/conf/create.js
Normal file
@@ -0,0 +1,106 @@
|
||||
// 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):
|
||||
|
||||
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.dlg);
|
||||
importPackage(Packages.com.silverwrist.venice.ui.helpers);
|
||||
|
||||
// get the request object and the community
|
||||
rinput = bsf.lookupBean("request");
|
||||
comm = rinput.getCommunity(true,"top.js.vs");
|
||||
|
||||
if (!(comm.canCreateConference()))
|
||||
{ // can't create a conference
|
||||
vlib.output(new ErrorBox("Access Error","You are not permitted to create conferences in this community.",
|
||||
"conf/conferences.js.vs?cc=" + comm.communityID));
|
||||
vlib.done();
|
||||
|
||||
} // end if
|
||||
|
||||
dlg = rinput.getDialog("conf.create");
|
||||
|
||||
if ("GET"==rinput.verb)
|
||||
{ // return the dialog to be filled in
|
||||
dlg.setSubtitle("in Community: " + comm.name);
|
||||
dlg.setValue("cc",comm.communityID + "");
|
||||
vlib.output(dlg);
|
||||
vlib.done();
|
||||
|
||||
} // end if
|
||||
|
||||
op = dlg.whichButton(rinput) + "";
|
||||
if (op=="cancel")
|
||||
{ // they canceled - redirect back to the conferences list
|
||||
vlib.output(new Redirect("conf/conferences.js.vs?cc=" + comm.communityID,LinkTypes.SERVLET));
|
||||
vlib.done();
|
||||
|
||||
} // end if
|
||||
|
||||
dlg.load(rinput); // load the dialog
|
||||
|
||||
rc = null;
|
||||
if (op=="create")
|
||||
{ // we actually want to create the conference...
|
||||
try
|
||||
{ // first validate the dialog
|
||||
dlg.validate();
|
||||
|
||||
// now validate that the alias doesn't exist yet
|
||||
if (rinput.engine.confAliasExists(dlg.getValue("alias")))
|
||||
throw new ValidationException("That alias is already used by another conference on the system.");
|
||||
|
||||
// OK, create the conference!
|
||||
pvt = ("1"==dlg.getValue("ctype"));
|
||||
conf = comm.createConference(dlg.getValue("name"),dlg.getValue("alias"),dlg.getValue("descr"),pvt,
|
||||
dlg.getValue("hide").booleanValue());
|
||||
|
||||
// now bounce to the new conference's topic list so we can start setting it up
|
||||
rc = new Redirect("conf/topics.js.vs?cc=" + comm.communityID + "&conf=" + conf.confID,LinkTypes.SERVLET);
|
||||
|
||||
} // end try
|
||||
catch (e)
|
||||
{ // error creating the conference
|
||||
etype = vlib.exceptionType(e) + "";
|
||||
if (etype.match("ValidationException"))
|
||||
{ // reset the dialog and try again
|
||||
dlg.setErrorMessage(e.message + " Please try again.");
|
||||
dlg.setSubtitle("in Community: " + comm.name);
|
||||
rc = dlg;
|
||||
|
||||
} // end if
|
||||
else if (etype.match("AccessError"))
|
||||
rc = new ErrorBox("Access Error",e.message,"conf/conferences.js.vs?cc=" + comm.communityID);
|
||||
else if (etype.match("DataException"))
|
||||
rc = new ErrorBox("Database Error","Database error creating conference: " + e.message,
|
||||
"conf/conferences.js.vs?cc=" + comm.communityID);
|
||||
else
|
||||
rc = e;
|
||||
|
||||
} // end catch
|
||||
|
||||
} // end if
|
||||
else
|
||||
{ // error - don't know what button was clicked
|
||||
logger.error("no known button click on POST to conf/create.js");
|
||||
rc = new ErrorBox("Internal Error","Unknown command button pressed",
|
||||
"conf/conferences.js.vs?cc=" + comm.communityID);
|
||||
|
||||
} // end else
|
||||
|
||||
vlib.output(rc); // all done!
|
||||
111
scripts/conf/custom.js
Normal file
111
scripts/conf/custom.js
Normal file
@@ -0,0 +1,111 @@
|
||||
// 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):
|
||||
|
||||
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);
|
||||
importPackage(Packages.com.silverwrist.venice.ui.view);
|
||||
|
||||
// get the request object and the community
|
||||
rinput = bsf.lookupBean("request");
|
||||
comm = rinput.getCommunity(true,"top.js.vs");
|
||||
|
||||
// get the current conference
|
||||
currc = new CurrentConference(rinput);
|
||||
conf = currc.getConference(true,"conf/conferences.js.vs?cc=" + comm.communityID);
|
||||
on_error = "conf/manage_conf.js.vs?cc=" + comm.communityID + "&conf=" + conf.confID;
|
||||
|
||||
if (!(conf.canChangeConference()))
|
||||
{ // you can't fiddle with this conference
|
||||
vlib.output(new ErrorBox("Access Error",
|
||||
"You do not have permission to change this conference's customizations.",on_error));
|
||||
vlib.done();
|
||||
|
||||
} // end if
|
||||
|
||||
rc = null;
|
||||
if ("GET"==rinput.verb)
|
||||
{ // display the customization dialog
|
||||
try
|
||||
{ // retrieve the existing customizations
|
||||
tmp = conf.getCustomBlock(ConferenceContext.CUST_BLOCK_TOP);
|
||||
if (tmp==null)
|
||||
tmp = "";
|
||||
rinput.setRequestAttribute("conference.custom.top",tmp);
|
||||
tmp = conf.getCustomBlock(ConferenceContext.CUST_BLOCK_BOTTOM);
|
||||
if (tmp==null)
|
||||
tmp = "";
|
||||
rinput.setRequestAttribute("conference.custom.bottom",tmp);
|
||||
|
||||
// create the view
|
||||
rc = new JSPView("Customize Conference: " + conf.name,"conf/custom.jsp");
|
||||
rc.menuSelector = Content.MENU_SELECTOR_COMMUNITY;
|
||||
|
||||
} // end try
|
||||
catch (e)
|
||||
{ // error in getting custom blocks
|
||||
etype = vlib.exceptionType(e) + "";
|
||||
if (etype.match("DataException"))
|
||||
rc = new ErrorBox("Database Error","Database error getting customization blocks: " + e.message,on_error);
|
||||
else
|
||||
rc = e;
|
||||
|
||||
} // end catch
|
||||
|
||||
vlib.output(rc);
|
||||
vlib.done();
|
||||
|
||||
} // end if
|
||||
|
||||
if (rinput.isImageButtonClicked("cancel"))
|
||||
{ // cancelled - bail out!
|
||||
vlib.output(new Redirect(on_error,LinkTypes.SERVLET));
|
||||
vlib.done();
|
||||
|
||||
} // end if
|
||||
|
||||
if (!(rinput.isImageButtonClicked("update")))
|
||||
{ // what button got pressed?!?!?
|
||||
logger.error("no known button click on POST to conf/custom.js");
|
||||
vlib.output(new ErrorBox("Internal Error","Unknown command button pressed",on_error));
|
||||
vlib.done();
|
||||
|
||||
} // end if
|
||||
|
||||
try
|
||||
{ // reset the custom blocks
|
||||
conf.setCustomBlock(ConferenceContext.CUST_BLOCK_TOP,rinput.getParameter("tx"));
|
||||
conf.setCustomBlock(ConferenceContext.CUST_BLOCK_BOTTOM,rinput.getParameter("bx"));
|
||||
|
||||
// bounce back to the manage conference menu
|
||||
rc = new Redirect(on_error,LinkTypes.SERVLET);
|
||||
|
||||
} // end try
|
||||
catch (e)
|
||||
{ // error changing customizations
|
||||
etype = vlib.exceptionType(e) + "";
|
||||
if (etype.match("DataException"))
|
||||
rc = new ErrorBox("Database Error","Database error setting customizations: " + e.message,on_error);
|
||||
else if (etype.match("AccessError"))
|
||||
rc = new ErrorBox("Access Error",e.message,on_error);
|
||||
else
|
||||
rc = e;
|
||||
|
||||
} // end catch
|
||||
|
||||
vlib.output(rc); // all done...
|
||||
62
scripts/conf/custom_remove.js
Normal file
62
scripts/conf/custom_remove.js
Normal file
@@ -0,0 +1,62 @@
|
||||
// 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):
|
||||
|
||||
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);
|
||||
importPackage(Packages.com.silverwrist.venice.ui.view);
|
||||
|
||||
// get the request object and the community
|
||||
rinput = bsf.lookupBean("request");
|
||||
comm = rinput.getCommunity(true,"top.js.vs");
|
||||
|
||||
// get the current conference
|
||||
currc = new CurrentConference(rinput);
|
||||
conf = currc.getConference(true,"conf/conferences.js.vs?cc=" + comm.communityID);
|
||||
on_error = "conf/manage_conf.js.vs?cc=" + comm.communityID + "&conf=" + conf.confID;
|
||||
|
||||
if (!(conf.canChangeConference()))
|
||||
{ // you can't fiddle with this conference
|
||||
vlib.output(new ErrorBox("Access Error",
|
||||
"You do not have permission to change this conference's customizations.",on_error));
|
||||
vlib.done();
|
||||
|
||||
} // end if
|
||||
|
||||
rc = null;
|
||||
try
|
||||
{ // clear the custom blocks
|
||||
conf.removeCustomBlocks();
|
||||
|
||||
// bounce back to the manage conference menu
|
||||
rc = new Redirect(on_error,LinkTypes.SERVLET);
|
||||
|
||||
} // end try
|
||||
catch (e)
|
||||
{ // error changing customizations
|
||||
etype = vlib.exceptionType(e) + "";
|
||||
if (etype.match("DataException"))
|
||||
rc = new ErrorBox("Database Error","Database error removing customizations: " + e.message,on_error);
|
||||
else if (etype.match("AccessError"))
|
||||
rc = new ErrorBox("Access Error",e.message,on_error);
|
||||
else
|
||||
rc = e;
|
||||
|
||||
} // end catch
|
||||
|
||||
vlib.output(rc); // all done...
|
||||
84
scripts/conf/delete.js
Normal file
84
scripts/conf/delete.js
Normal file
@@ -0,0 +1,84 @@
|
||||
// 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):
|
||||
|
||||
importPackage(Packages.com.silverwrist.venice.core);
|
||||
importPackage(Packages.com.silverwrist.venice.except);
|
||||
importPackage(Packages.com.silverwrist.venice.ui);
|
||||
importPackage(Packages.com.silverwrist.venice.ui.conf);
|
||||
importPackage(Packages.com.silverwrist.venice.ui.helpers);
|
||||
|
||||
// get the request object and the community
|
||||
rinput = bsf.lookupBean("request");
|
||||
comm = rinput.getCommunity(true,"top.js.vs");
|
||||
|
||||
if (!(comm.canManageConferences()))
|
||||
{ // can't manage conferences, bail out
|
||||
vlib.output(new ErrorBox("Access Error","You are not permitted to manage conferences in this community.",
|
||||
"conf/conferences.js.vs?cc=" + comm.communityID));
|
||||
vlib.done();
|
||||
|
||||
} // end if
|
||||
|
||||
// get the current conference
|
||||
currc = new CurrentConference(rinput);
|
||||
conf = currc.getConference(true,"conf/conferences.js.vs?cc=" + comm.communityID);
|
||||
|
||||
if (!(conf.canDeleteConference()))
|
||||
{ // you can't fiddle with this conference
|
||||
vlib.output(new ErrorBox("Access Error","You do not have permission to delete this conference.",
|
||||
"conf/manage_conf.js.vs?cc=" + comm.communityID + "&conf=" + conf.confID));
|
||||
vlib.done();
|
||||
|
||||
} // end if
|
||||
|
||||
CONFIRM_attr = "conferences.manage.delete.ConfirmBox";
|
||||
CONFIRM_param = "confirm";
|
||||
|
||||
rc = null;
|
||||
if (ConfirmBox.isConfirmed(rinput,CONFIRM_attr,CONFIRM_param))
|
||||
{ // it is confirmed - we want to delete the conference!
|
||||
try
|
||||
{ // delete the conference (using the alias function to avoid using the delete keyword)
|
||||
conf.deleteConference();
|
||||
|
||||
// trap back to the conferences list
|
||||
rc = new Redirect("conf/conferences.js.vs?cc=" + comm.communityID,LinkTypes.SERVLET);
|
||||
|
||||
} // end try
|
||||
catch (e)
|
||||
{ // handle error in deletion
|
||||
etype = vlib.exceptionType(e) + "";
|
||||
if (etype.match("DataException"))
|
||||
rc = new ErrorBox("Database Error","Database error deleting conference: " + e.message,
|
||||
"conf/manage_conf.js.vs?cc=" + comm.communityID + "&conf=" + conf.confID);
|
||||
else if (etype.match("AccessError"))
|
||||
rc = new ErrorBox("Access Error",e.message,
|
||||
"conf/manage_conf.js.vs?cc=" + comm.communityID + "&conf=" + conf.confID);
|
||||
else
|
||||
rc = e;
|
||||
|
||||
} // end catch
|
||||
|
||||
} // end if
|
||||
else // come up with the confirm box
|
||||
rc = new ConfirmBox(rinput,CONFIRM_attr,CONFIRM_param,"Delete Conference",
|
||||
"You are about to permanently delete the '" + conf.name
|
||||
+ "' conference! Are you sure you want to do this?",
|
||||
"conf/delete.js.vs?cc=" + comm.communityID + "&conf=" + conf.confID,LinkTypes.SERVLET,
|
||||
"conf/manage_conf.js.vs?cc=" + comm.communityID + "&conf=" + conf.confID,
|
||||
LinkTypes.SERVLET);
|
||||
|
||||
vlib.output(rc); // all done!
|
||||
70
scripts/conf/delete_topic.js
Normal file
70
scripts/conf/delete_topic.js
Normal file
@@ -0,0 +1,70 @@
|
||||
// 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):
|
||||
|
||||
importPackage(java.util);
|
||||
importPackage(Packages.com.silverwrist.venice.core);
|
||||
importPackage(Packages.com.silverwrist.venice.except);
|
||||
importPackage(Packages.com.silverwrist.venice.ui);
|
||||
importPackage(Packages.com.silverwrist.venice.ui.conf);
|
||||
importPackage(Packages.com.silverwrist.venice.ui.helpers);
|
||||
|
||||
// get the request object and the community
|
||||
rinput = bsf.lookupBean("request");
|
||||
comm = rinput.getCommunity(true,"top.js.vs");
|
||||
|
||||
// get the current conference
|
||||
currc = new CurrentConference(rinput);
|
||||
conf = currc.getConference(true,"conf/conferences.js.vs?cc=" + comm.communityID);
|
||||
|
||||
// get the current topic
|
||||
topic = currc.getTopic(true,"conf/topics.js.vs?cc=" + comm.communityID + "&conf=" + conf.confID);
|
||||
on_error = "conf/posts.js.vs?cc=" + comm.communityID + "&conf=" + conf.confID + "&top=" + topic.topicNumber;
|
||||
|
||||
CONFIRM_attr = "conferences.topic.delete.ConfirmBox";
|
||||
CONFIRM_param = "confirm";
|
||||
|
||||
rc = null;
|
||||
if (ConfirmBox.isConfirmed(rinput,CONFIRM_attr,CONFIRM_param))
|
||||
{ // it is confirmed - we want to delete the topic!
|
||||
try
|
||||
{ // delete the bloody thing!
|
||||
topic.deleteTopic();
|
||||
|
||||
// bounce back to the topic list on success
|
||||
rc = new Redirect("conf/topics.js.vs?cc=" + comm.communityID + "&conf=" + conf.confID,LinkTypes.SERVLET);
|
||||
|
||||
} // end try
|
||||
catch (e)
|
||||
{ // error deleting
|
||||
etype = vlib.exceptionType(e) + "";
|
||||
if (etype.match("DataException"))
|
||||
rc = new ErrorBox("Database Error","Database error deleting topic: " + e.message,on_error);
|
||||
else if (etype.match("AccessError"))
|
||||
rc = new ErrorBox("Access Error",e.message,on_error);
|
||||
else
|
||||
rc = e;
|
||||
|
||||
} // end catch
|
||||
|
||||
} // end if
|
||||
else // come up with the confirm box
|
||||
rc = new ConfirmBox(rinput,CONFIRM_attr,CONFIRM_param,"Delete Topic",
|
||||
"You are about to delete topic " + topic.topicNumber + " ('" + topic.name
|
||||
+ "') from the '" + conf.name + "' conference! Are you sure you want to do this?",
|
||||
"conf/delete_topic.js.vs?cc=" + comm.communityID + "&conf=" + conf.confID + "&top="
|
||||
+ topic.topicNumber,LinkTypes.SERVLET,on_error,LinkTypes.SERVLET);
|
||||
|
||||
vlib.output(rc); // all done...
|
||||
171
scripts/conf/edit.js
Normal file
171
scripts/conf/edit.js
Normal file
@@ -0,0 +1,171 @@
|
||||
// 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):
|
||||
|
||||
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.dlg);
|
||||
importPackage(Packages.com.silverwrist.venice.ui.helpers);
|
||||
|
||||
// Define a simple function to set up the dialog stuff.
|
||||
function setupDialog(dlg,conf)
|
||||
{
|
||||
dlg.setSubtitle(conf.name);
|
||||
sinf = conf.securityInfo;
|
||||
dlg.sendMessage("read_lvl","setRoleList",sinf.getRoleList("Conference.Read"));
|
||||
dlg.sendMessage("post_lvl","setRoleList",sinf.getRoleList("Conference.Post"));
|
||||
dlg.sendMessage("create_lvl","setRoleList",sinf.getRoleList("Conference.Create"));
|
||||
dlg.sendMessage("hide_lvl","setRoleList",sinf.getRoleList("Conference.Hide"));
|
||||
dlg.sendMessage("nuke_lvl","setRoleList",sinf.getRoleList("Conference.Nuke"));
|
||||
dlg.sendMessage("change_lvl","setRoleList",sinf.getRoleList("Conference.Change"));
|
||||
dlg.sendMessage("delete_lvl","setRoleList",sinf.getRoleList("Conference.Delete"));
|
||||
dlg.setEnabled("hide",conf.canSetHideList());
|
||||
|
||||
} // end setupDialog
|
||||
|
||||
// get the request object and the community
|
||||
rinput = bsf.lookupBean("request");
|
||||
comm = rinput.getCommunity(true,"top.js.vs");
|
||||
|
||||
// get the current conference
|
||||
currc = new CurrentConference(rinput);
|
||||
conf = currc.getConference(true,"conf/conferences.js.vs?cc=" + comm.communityID);
|
||||
on_error = "conf/manage_conf.js.vs?cc=" + comm.communityID + "&conf=" + conf.confID;
|
||||
|
||||
if (!(conf.canChangeConference()))
|
||||
{ // you can't fiddle with this conference
|
||||
vlib.output(new ErrorBox("Access Error","You do not have permission to change this conference's attributes.",
|
||||
on_error));
|
||||
vlib.done();
|
||||
|
||||
} // end if
|
||||
|
||||
dlg = rinput.getDialog("conf.edit");
|
||||
|
||||
rc = null;
|
||||
if ("GET"==rinput.verb)
|
||||
{ // set up the dialog
|
||||
setupDialog(dlg,conf);
|
||||
|
||||
try
|
||||
{ // fill the dialog with the conference information
|
||||
dlg.setValue("cc",comm.communityID + "");
|
||||
dlg.setValue("conf",conf.confID + "");
|
||||
dlg.setValue("name",conf.name);
|
||||
dlg.setValue("descr",conf.description);
|
||||
if (conf.canSetHideList() && conf.getHideList())
|
||||
dlg.setValue("hide",1);
|
||||
dlg.setValue("read_lvl",conf.getReadLevel() + "");
|
||||
dlg.setValue("post_lvl",conf.getPostLevel() + "");
|
||||
dlg.setValue("create_lvl",conf.getCreateLevel() + "");
|
||||
dlg.setValue("hide_lvl",conf.getHideLevel() + "");
|
||||
dlg.setValue("nuke_lvl",conf.getNukeLevel() + "");
|
||||
dlg.setValue("change_lvl",conf.getChangeLevel() + "");
|
||||
dlg.setValue("delete_lvl",conf.getDeleteLevel() + "");
|
||||
|
||||
props = conf.properties;
|
||||
if (props.displayPostPictures)
|
||||
dlg.setValue("pic_in_post",1);
|
||||
|
||||
rc = dlg;
|
||||
|
||||
} // end try
|
||||
catch (e)
|
||||
{ // error initializing dialog
|
||||
etype = vlib.exceptionType(e) + "";
|
||||
if (etype.match("DataException"))
|
||||
rc = new ErrorBox("Database Error","Database error setting up dialog: " + e.message,on_error);
|
||||
else if (etype.match("AccessError"))
|
||||
rc = new ErrorBox("Access Error",e.message,on_error);
|
||||
else
|
||||
rc = e;
|
||||
|
||||
} // end catch
|
||||
|
||||
vlib.output(rc);
|
||||
vlib.done();
|
||||
|
||||
} // end if
|
||||
|
||||
// everything that follows is for a POST operation
|
||||
op = dlg.whichButton(rinput) + "";
|
||||
if (op=="cancel")
|
||||
{ // user cancelled profile update - bounce back to the target
|
||||
vlib.output(new Redirect(on_error,LinkTypes.SERVLET));
|
||||
vlib.done();
|
||||
|
||||
} // end if
|
||||
|
||||
if (op!="update")
|
||||
{ // what the hell was that button?
|
||||
logger.error("no known button click on POST to conf/edit.js");
|
||||
vlib.output(new ErrorBox("Internal Error","Unknown command button pressed",on_error));
|
||||
vlib.done();
|
||||
|
||||
} // end if
|
||||
|
||||
dlg.load(rinput); // load the values into the dialog
|
||||
|
||||
try
|
||||
{ // validate the dialog
|
||||
dlg.validate();
|
||||
|
||||
// get all the levels out of the dialog
|
||||
read_lvl = dlg.getValue("read_lvl").intValue();
|
||||
post_lvl = dlg.getValue("post_lvl").intValue();
|
||||
create_lvl = dlg.getValue("create_lvl").intValue();
|
||||
hide_lvl = dlg.getValue("hide_lvl").intValue();
|
||||
nuke_lvl = dlg.getValue("nuke_lvl").intValue();
|
||||
change_lvl = dlg.getValue("change_lvl").intValue();
|
||||
delete_lvl = dlg.getValue("delete_lvl").intValue();
|
||||
|
||||
// set the various conference attributes
|
||||
conf.setSecurityLevels(read_lvl,post_lvl,create_lvl,hide_lvl,nuke_lvl,change_lvl,delete_lvl);
|
||||
conf.name = dlg.getValue("name");
|
||||
conf.description = dlg.getValue("descr");
|
||||
if (conf.canSetHideList())
|
||||
conf.setHideList(dlg.getValue("hide").booleanValue());
|
||||
|
||||
// set the conference properties
|
||||
props = conf.properties;
|
||||
props.displayPostPictures = dlg.getValue("pic_in_post").booleanValue();
|
||||
conf.properties = props;
|
||||
|
||||
// bounce back to the manage display
|
||||
rc = new Redirect(on_error,LinkTypes.SERVLET);
|
||||
|
||||
} // end try
|
||||
catch (e)
|
||||
{ // error editing the conference
|
||||
etype = vlib.exceptionType(e) + "";
|
||||
if (etype.match("ValidationException"))
|
||||
{ // reset the dialog and try again
|
||||
dlg.setErrorMessage(e.message + " Please try again.");
|
||||
setupDialog(dlg,conf);
|
||||
rc = dlg;
|
||||
|
||||
} // end if
|
||||
else if (etype.match("AccessError"))
|
||||
rc = new ErrorBox("Access Error",e.message,on_error);
|
||||
else if (etype.match("DataException"))
|
||||
rc = new ErrorBox("Database Error","Database error editing conference: " + e.message,on_error);
|
||||
else
|
||||
rc = e;
|
||||
|
||||
} // end catch
|
||||
|
||||
vlib.output(rc); // all done...
|
||||
113
scripts/conf/email.js
Normal file
113
scripts/conf/email.js
Normal file
@@ -0,0 +1,113 @@
|
||||
// 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):
|
||||
|
||||
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);
|
||||
importPackage(Packages.com.silverwrist.venice.ui.view);
|
||||
|
||||
// get the request object and the community
|
||||
rinput = bsf.lookupBean("request");
|
||||
comm = rinput.getCommunity(true,"top.js.vs");
|
||||
|
||||
// get the current conference
|
||||
currc = new CurrentConference(rinput);
|
||||
conf = currc.getConference(true,"conf/conferences.js.vs?cc=" + comm.communityID);
|
||||
on_error = "conf/manage_conf.js.vs?cc=" + comm.communityID + "&conf=" + conf.confID;
|
||||
|
||||
rc = null;
|
||||
if ("GET"==rinput.verb)
|
||||
{ // display the dialog
|
||||
try
|
||||
{ // we need the topic list
|
||||
tlist = conf.getTopicList(ConferenceContext.DISPLAY_ALL,ConferenceContext.SORT_NAME);
|
||||
rinput.setRequestAttribute("topic.email.list",tlist);
|
||||
|
||||
// create the dialog
|
||||
rc = new JSPView("Conference E-Mail: " + conf.name,"conf/email.jsp");
|
||||
rc.menuSelector = Content.MENU_SELECTOR_COMMUNITY;
|
||||
|
||||
} // end try
|
||||
catch (e)
|
||||
{ // unable to get topic list
|
||||
etype = vlib.exceptionType(e) + "";
|
||||
if (etype.match("DataException"))
|
||||
rc = new ErrorBox("Database Error","Database error setting up dialog: " + e.message,on_error);
|
||||
else if (etype.match("AccessError"))
|
||||
rc = new ErrorBox("Access Error",e.message,on_error);
|
||||
else
|
||||
rc = e;
|
||||
|
||||
} // end catch
|
||||
|
||||
vlib.output(rc);
|
||||
vlib.done();
|
||||
|
||||
} // end if
|
||||
|
||||
if (rinput.isImageButtonClicked("cancel"))
|
||||
{ // cancelled - bail out!
|
||||
vlib.output(new Redirect(on_error,LinkTypes.SERVLET));
|
||||
vlib.done();
|
||||
|
||||
} // end if
|
||||
|
||||
if (!(rinput.isImageButtonClicked("send")))
|
||||
{ // what button got pressed?!?!?
|
||||
logger.error("no known button click on POST to conf/email.js");
|
||||
vlib.output(new ErrorBox("Internal Error","Unknown command button pressed",on_error));
|
||||
vlib.done();
|
||||
|
||||
} // end if
|
||||
|
||||
try
|
||||
{ // retrieve the topic we want to send to
|
||||
topic = null;
|
||||
tnum = rinput.getParameterShort("top",0);
|
||||
if (tnum>0)
|
||||
topic = conf.getTopic(tnum);
|
||||
|
||||
// retrieve other parameters
|
||||
posters = (rinput.getParameterInt("porl",0)==0)
|
||||
ndays = -1;
|
||||
if ("Y"==rinput.getParameter("xday"))
|
||||
ndays = rinput.getParameterInt("day",-1);
|
||||
|
||||
// send the E-mail!
|
||||
if (topic!=null)
|
||||
topic.sendMailToParticipants(posters,ndays,rinput.getParameter("subj"),rinput.getParameter("pb"));
|
||||
else
|
||||
conf.sendMailToParticipants(posters,ndays,rinput.getParameter("subj"),rinput.getParameter("pb"));
|
||||
|
||||
// bounce back to the manage conference menu
|
||||
rc = new Redirect(on_error,LinkTypes.SERVLET);
|
||||
|
||||
} // end try
|
||||
catch (e)
|
||||
{ // exception sending the E-mail
|
||||
etype = vlib.exceptionType(e) + "";
|
||||
if (etype.match("DataException"))
|
||||
rc = new ErrorBox("Database Error","Database error sending E-mail: " + e.message,on_error);
|
||||
else if (etype.match("AccessError"))
|
||||
rc = new ErrorBox("Access Error",e.message,on_error);
|
||||
else
|
||||
rc = e;
|
||||
|
||||
} // end catch
|
||||
|
||||
vlib.output(rc); // all done....
|
||||
117
scripts/conf/find.js
Normal file
117
scripts/conf/find.js
Normal file
@@ -0,0 +1,117 @@
|
||||
// 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):
|
||||
|
||||
importPackage(java.util);
|
||||
importPackage(Packages.com.silverwrist.venice.core);
|
||||
importPackage(Packages.com.silverwrist.venice.except);
|
||||
importPackage(Packages.com.silverwrist.venice.ui);
|
||||
importPackage(Packages.com.silverwrist.venice.ui.conf);
|
||||
importPackage(Packages.com.silverwrist.venice.ui.helpers);
|
||||
importPackage(Packages.com.silverwrist.venice.ui.view);
|
||||
|
||||
// get the request object and the community
|
||||
rinput = bsf.lookupBean("request");
|
||||
comm = rinput.getCommunity(true,"top.js.vs");
|
||||
on_error = "conf/conferences.js.vs?cc=" + comm.communityID;
|
||||
|
||||
// get the current conference
|
||||
currc = new CurrentConference(rinput);
|
||||
conf = currc.getConference(false,"conf/conferences.js.vs?cc=" + comm.communityID);
|
||||
|
||||
// get the topic
|
||||
topic = null;
|
||||
if (conf!=null)
|
||||
{ // get the topic
|
||||
on_error = "conf/topics.js.vs?cc=" + comm.communityID + "&conf=" + conf.confID;
|
||||
topic = currc.getTopic(false,"conf/topics.js.vs?cc=" + comm.communityID + "&conf=" + conf.confID);
|
||||
if (topic!=null)
|
||||
on_error = "conf/posts.js.vs?cc=" + comm.communityID + "&conf=" + conf.confID + "&top="
|
||||
+ topic.topicNumber;
|
||||
|
||||
} // end if
|
||||
|
||||
view = new FindPostsView(comm,conf,topic);
|
||||
view.maxResults = rinput.engine.getStdNumSearchResults();
|
||||
|
||||
if ("GET"==rinput.verb)
|
||||
{ // display the find dialog
|
||||
vlib.output(view);
|
||||
vlib.done();
|
||||
|
||||
} // end if
|
||||
|
||||
// Retrieve the search term parameter.
|
||||
tmp = rinput.getParameter("term");
|
||||
if (tmp==null)
|
||||
view.term = "";
|
||||
else
|
||||
view.term = tmp;
|
||||
|
||||
// Retrieve the offset and find count parameters.
|
||||
view.offset = rinput.getParameterInt("ofs",0);
|
||||
view.findCount = rinput.getParameterInt("fcount",-1);
|
||||
|
||||
// Adjust the search return offset based on the command button click.
|
||||
if (rinput.isImageButtonClicked("search"))
|
||||
view.offset = 0;
|
||||
else if (rinput.isImageButtonClicked("previous"))
|
||||
view.offset = Math.max(view.offset - view.maxResults,0); // go backwards
|
||||
else if (rinput.isImageButtonClicked("next"))
|
||||
view.offset += view.maxResults; // go forwards instead
|
||||
else
|
||||
throw new InternalStateError("Unable to determine what action triggered the form.");
|
||||
|
||||
rc = null;
|
||||
try
|
||||
{ // do the search
|
||||
if (topic!=null)
|
||||
{ // search the topic
|
||||
view.results = topic.searchPosts(term,offset,view.maxResults);
|
||||
if (view.findCount<0)
|
||||
view.findCount = topic.getSearchPostCount(term);
|
||||
|
||||
} // end if
|
||||
else if (conf!=null)
|
||||
{ // search the conference
|
||||
view.results = conf.searchPosts(term,offset,view.maxResults);
|
||||
if (view.findCount<0)
|
||||
view.findCount = conf.getSearchPostCount(term);
|
||||
|
||||
} // end else if
|
||||
else
|
||||
{ // search the community
|
||||
view.results = comm.searchPosts(term,offset,view.maxResults);
|
||||
if (view.findCount<0)
|
||||
view.findCount = comm.getSearchPostCount(term);
|
||||
|
||||
} // end else
|
||||
|
||||
rc = view;
|
||||
|
||||
} // end try
|
||||
catch (e)
|
||||
{ // error doing the find
|
||||
etype = vlib.exceptionType(e) + "";
|
||||
if (etype.match("DataException"))
|
||||
rc = new ErrorBox("Database Error","Database error on find: " + e.message,on_error);
|
||||
else if (etype.match("AccessError"))
|
||||
rc = new ErrorBox("Access Error",e.message,on_error);
|
||||
else
|
||||
rc = e;
|
||||
|
||||
} // end catch
|
||||
|
||||
vlib.output(rc);
|
||||
54
scripts/conf/fixseen.js
Normal file
54
scripts/conf/fixseen.js
Normal 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):
|
||||
|
||||
importPackage(Packages.com.silverwrist.venice.core);
|
||||
importPackage(Packages.com.silverwrist.venice.except);
|
||||
importPackage(Packages.com.silverwrist.venice.ui);
|
||||
importPackage(Packages.com.silverwrist.venice.ui.conf);
|
||||
importPackage(Packages.com.silverwrist.venice.ui.helpers);
|
||||
|
||||
// get the request object and the community
|
||||
rinput = bsf.lookupBean("request");
|
||||
comm = rinput.getCommunity(true,"top.js.vs");
|
||||
|
||||
// get the current conference
|
||||
currc = new CurrentConference(rinput);
|
||||
conf = currc.getConference(true,"conf/manage_conf.js.vs?cc=" + comm.communityID);
|
||||
|
||||
rc = null;
|
||||
try
|
||||
{ // the dreaded fixseen :-)
|
||||
conf.fixSeen();
|
||||
|
||||
// don't change the current view
|
||||
rc = new NullResponse();
|
||||
|
||||
} // end try
|
||||
catch (e)
|
||||
{ // error resetting the pseud
|
||||
etype = vlib.exceptionType(e) + "";
|
||||
if (etype.match("DataException"))
|
||||
rc = new ErrorBox("Database Error","Database error catching up conference: " + e.message,
|
||||
"conf/manage_conf.js.vs?cc=" + comm.communityID + "&conf=" + conf.confID);
|
||||
else if (etype.match("AccessError"))
|
||||
rc = new ErrorBox("Access Error",e.message,
|
||||
"conf/manage_conf.js.vs?cc=" + comm.communityID + "&conf=" + conf.confID);
|
||||
else
|
||||
rc = e;
|
||||
|
||||
} // end catch
|
||||
|
||||
vlib.output(rc); // all done!
|
||||
56
scripts/conf/freeze_topic.js
Normal file
56
scripts/conf/freeze_topic.js
Normal file
@@ -0,0 +1,56 @@
|
||||
// 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):
|
||||
|
||||
importPackage(java.util);
|
||||
importPackage(Packages.com.silverwrist.venice.core);
|
||||
importPackage(Packages.com.silverwrist.venice.except);
|
||||
importPackage(Packages.com.silverwrist.venice.ui);
|
||||
importPackage(Packages.com.silverwrist.venice.ui.conf);
|
||||
importPackage(Packages.com.silverwrist.venice.ui.helpers);
|
||||
|
||||
// get the request object and the community
|
||||
rinput = bsf.lookupBean("request");
|
||||
comm = rinput.getCommunity(true,"top.js.vs");
|
||||
|
||||
// get the current conference
|
||||
currc = new CurrentConference(rinput);
|
||||
conf = currc.getConference(true,"conf/conferences.js.vs?cc=" + comm.communityID);
|
||||
|
||||
// get the current topic
|
||||
topic = currc.getTopic(true,"conf/topics.js.vs?cc=" + comm.communityID + "&conf=" + conf.confID);
|
||||
on_error = "conf/posts.js.vs?cc=" + comm.communityID + "&conf=" + conf.confID + "&top=" + topic.topicNumber;
|
||||
|
||||
rc = null;
|
||||
try
|
||||
{ // get the flag and set the frozen status
|
||||
flag = rinput.getParameterInt("flag",0);
|
||||
topic.setFrozen(flag==1);
|
||||
rc = new Redirect(on_error,LinkTypes.SERVLET);
|
||||
|
||||
} // end try
|
||||
catch (e)
|
||||
{ // error setting the hide topic
|
||||
etype = vlib.exceptionType(e) + "";
|
||||
if (etype.match("DataException"))
|
||||
rc = new ErrorBox("Database Error","Database error setting frozen status: " + e.message,on_error);
|
||||
else if (etype.match("AccessError"))
|
||||
rc = new ErrorBox("Access Error",e.message,on_error);
|
||||
else
|
||||
rc = e;
|
||||
|
||||
} // end catch
|
||||
|
||||
vlib.output(rc); // all done!
|
||||
61
scripts/conf/hide_message.js
Normal file
61
scripts/conf/hide_message.js
Normal 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):
|
||||
|
||||
importPackage(java.util);
|
||||
importPackage(Packages.com.silverwrist.venice.core);
|
||||
importPackage(Packages.com.silverwrist.venice.except);
|
||||
importPackage(Packages.com.silverwrist.venice.ui);
|
||||
importPackage(Packages.com.silverwrist.venice.ui.conf);
|
||||
importPackage(Packages.com.silverwrist.venice.ui.helpers);
|
||||
|
||||
// get the request object and the community
|
||||
rinput = bsf.lookupBean("request");
|
||||
comm = rinput.getCommunity(true,"top.js.vs");
|
||||
|
||||
// get the current conference
|
||||
currc = new CurrentConference(rinput);
|
||||
conf = currc.getConference(true,"conf/conferences.js.vs?cc=" + comm.communityID);
|
||||
|
||||
// get the current topic
|
||||
topic = currc.getTopic(true,"conf/topics.js.vs?cc=" + comm.communityID + "&conf=" + conf.confID);
|
||||
|
||||
// get the message under consideration
|
||||
msg = currc.getTopicMessageParam("msg",true,"conf/posts.js.vs?cc=" + comm.communityID + "&conf="
|
||||
+ conf.confID + "&top=" + topic.topicNumber);
|
||||
on_error = "conf/posts.js.vs?cc=" + comm.communityID + "&conf=" + conf.confID + "&top=" + topic.topicNumber
|
||||
+ "&p1=" + msg.getPostNumber() + "&shac=1";
|
||||
|
||||
rc = null;
|
||||
try
|
||||
{ // get the flag and set the hide status
|
||||
flag = rinput.getParameterInt("flag",0);
|
||||
msg.setHidden(flag==1);
|
||||
rc = new Redirect(on_error,LinkTypes.SERVLET);
|
||||
|
||||
} // end try
|
||||
catch (e)
|
||||
{ // error setting the hide topic
|
||||
etype = vlib.exceptionType(e) + "";
|
||||
if (etype.match("DataException"))
|
||||
rc = new ErrorBox("Database Error","Database error setting hide status: " + e.message,on_error);
|
||||
else if (etype.match("AccessError"))
|
||||
rc = new ErrorBox("Access Error",e.message,on_error);
|
||||
else
|
||||
rc = e;
|
||||
|
||||
} // end catch
|
||||
|
||||
vlib.output(rc); // all done!
|
||||
56
scripts/conf/hide_topic.js
Normal file
56
scripts/conf/hide_topic.js
Normal file
@@ -0,0 +1,56 @@
|
||||
// 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):
|
||||
|
||||
importPackage(java.util);
|
||||
importPackage(Packages.com.silverwrist.venice.core);
|
||||
importPackage(Packages.com.silverwrist.venice.except);
|
||||
importPackage(Packages.com.silverwrist.venice.ui);
|
||||
importPackage(Packages.com.silverwrist.venice.ui.conf);
|
||||
importPackage(Packages.com.silverwrist.venice.ui.helpers);
|
||||
|
||||
// get the request object and the community
|
||||
rinput = bsf.lookupBean("request");
|
||||
comm = rinput.getCommunity(true,"top.js.vs");
|
||||
|
||||
// get the current conference
|
||||
currc = new CurrentConference(rinput);
|
||||
conf = currc.getConference(true,"conf/conferences.js.vs?cc=" + comm.communityID);
|
||||
|
||||
// get the current topic
|
||||
topic = currc.getTopic(true,"conf/topics.js.vs?cc=" + comm.communityID + "&conf=" + conf.confID);
|
||||
on_error = "conf/posts.js.vs?cc=" + comm.communityID + "&conf=" + conf.confID + "&top=" + topic.topicNumber;
|
||||
|
||||
rc = null;
|
||||
try
|
||||
{ // get the flag and set the hide status
|
||||
flag = rinput.getParameterInt("flag",0);
|
||||
topic.setHidden(flag==1);
|
||||
rc = new Redirect(on_error,LinkTypes.SERVLET);
|
||||
|
||||
} // end try
|
||||
catch (e)
|
||||
{ // error setting the hide topic
|
||||
etype = vlib.exceptionType(e) + "";
|
||||
if (etype.match("DataException"))
|
||||
rc = new ErrorBox("Database Error","Database error setting hide status: " + e.message,on_error);
|
||||
else if (etype.match("AccessError"))
|
||||
rc = new ErrorBox("Access Error",e.message,on_error);
|
||||
else
|
||||
rc = e;
|
||||
|
||||
} // end catch
|
||||
|
||||
vlib.output(rc); // all done!
|
||||
47
scripts/conf/hotlist.js
Normal file
47
scripts/conf/hotlist.js
Normal file
@@ -0,0 +1,47 @@
|
||||
// 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):
|
||||
|
||||
importPackage(java.util);
|
||||
importPackage(Packages.com.silverwrist.venice.core);
|
||||
importPackage(Packages.com.silverwrist.venice.except);
|
||||
importPackage(Packages.com.silverwrist.venice.ui);
|
||||
importPackage(Packages.com.silverwrist.venice.ui.helpers);
|
||||
importPackage(Packages.com.silverwrist.venice.ui.view);
|
||||
|
||||
// get the request object
|
||||
rinput = bsf.lookupBean("request");
|
||||
|
||||
rc = null;
|
||||
try
|
||||
{ // get the hotlist and save it off for the display
|
||||
rinput.setRequestAttribute("user.conf.hotlist",rinput.user.getConferenceHotlist());
|
||||
|
||||
// create a JSPView with the hot list
|
||||
rc = new JSPView("Your Conference Hotlist","conf/hotlist.jsp");
|
||||
rc.menuSelector = Content.MENU_SELECTOR_TOP;
|
||||
|
||||
} // end try
|
||||
catch (e)
|
||||
{ // unable to get the hotlist
|
||||
etype = vlib.exceptionType(e) + "";
|
||||
if (etype.match("DataException"))
|
||||
rc = new ErrorBox("Database Error","Error getting hotlist: " + e.message,"top.js.vs");
|
||||
else
|
||||
rc = e;
|
||||
|
||||
} // end catch
|
||||
|
||||
vlib.output(rc);
|
||||
64
scripts/conf/hotlist_delete.js
Normal file
64
scripts/conf/hotlist_delete.js
Normal file
@@ -0,0 +1,64 @@
|
||||
// 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):
|
||||
|
||||
importPackage(java.util);
|
||||
importPackage(Packages.com.silverwrist.venice.core);
|
||||
importPackage(Packages.com.silverwrist.venice.except);
|
||||
importPackage(Packages.com.silverwrist.venice.ui);
|
||||
importPackage(Packages.com.silverwrist.venice.ui.helpers);
|
||||
importPackage(Packages.com.silverwrist.venice.ui.view);
|
||||
|
||||
// get the request object
|
||||
rinput = bsf.lookupBean("request");
|
||||
|
||||
// get the two index values
|
||||
ndx = rinput.getParameterInt("ndx",-1);
|
||||
if (ndx<0)
|
||||
{ // index values out of range
|
||||
vlib.output(new ErrorBox(null,"Invalid index parameter.","conf/hotlist.js.vs"));
|
||||
vlib.done();
|
||||
|
||||
} // end if
|
||||
|
||||
rc = null;
|
||||
try
|
||||
{ // get the hotlist and further check the parameters
|
||||
hotlist = rinput.user.getConferenceHotlist();
|
||||
if (ndx>=hotlist.size())
|
||||
throw new ErrorBox(null,"Invalid index parameter.","conf/hotlist.js.vs");
|
||||
|
||||
// get the hotlist entry and conference
|
||||
ntry = vlib.castConferenceHotlistEntry(hotlist.get(ndx));
|
||||
conf = ntry.getConference();
|
||||
|
||||
// remove the conference
|
||||
conf.removeFromHotlist();
|
||||
|
||||
// bounce back to the hotlist screen
|
||||
rc = new Redirect("conf/hotlist.js.vs",LinkTypes.SERVLET);
|
||||
|
||||
} // end try
|
||||
catch (e)
|
||||
{ // error adjusting the hotlist sequence
|
||||
etype = vlib.exceptionType(e) + "";
|
||||
if (etype.match("DataException"))
|
||||
rc = new ErrorBox("Database Error","Error adjusting hotlist: " + e.message,"conf/hotlist.js.vs");
|
||||
else
|
||||
rc = e;
|
||||
|
||||
} // end catch
|
||||
|
||||
vlib.output(rc); // all done
|
||||
82
scripts/conf/hotlist_move.js
Normal file
82
scripts/conf/hotlist_move.js
Normal file
@@ -0,0 +1,82 @@
|
||||
// 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):
|
||||
|
||||
importPackage(java.util);
|
||||
importPackage(Packages.com.silverwrist.venice.core);
|
||||
importPackage(Packages.com.silverwrist.venice.except);
|
||||
importPackage(Packages.com.silverwrist.venice.ui);
|
||||
importPackage(Packages.com.silverwrist.venice.ui.helpers);
|
||||
importPackage(Packages.com.silverwrist.venice.ui.view);
|
||||
|
||||
// get the request object
|
||||
rinput = bsf.lookupBean("request");
|
||||
|
||||
// get the two index values
|
||||
ndx = rinput.getParameterInt("ndx",-1);
|
||||
ndx2 = rinput.getParameterInt("ndx2",-1);
|
||||
if ((ndx<0) || (ndx2<0) || (ndx==ndx2))
|
||||
{ // index values out of range
|
||||
vlib.output(new ErrorBox(null,"Invalid index parameters.","conf/hotlist.js.vs"));
|
||||
vlib.done();
|
||||
|
||||
} // end if
|
||||
|
||||
rc = null;
|
||||
try
|
||||
{ // get the hotlist and further check the parameters
|
||||
hotlist = rinput.user.getConferenceHotlist();
|
||||
if ((ndx>=hotlist.size()) || (ndx2>=hotlist.size()))
|
||||
throw new ErrorBox(null,"Invalid index parameters.","conf/hotlist.js.vs");
|
||||
|
||||
// get the hotlist entries
|
||||
entry1 = vlib.castConferenceHotlistEntry(hotlist.get(ndx));
|
||||
entry2 = vlib.castConferenceHotlistEntry(hotlist.get(ndx2));
|
||||
|
||||
// get the sequence numbers
|
||||
seq1 = entry1.getSequence();
|
||||
seq2 = entry2.getSequence();
|
||||
|
||||
// now reassign the sequences
|
||||
entry1.setHotlistSequence(seq2);
|
||||
restore = true;
|
||||
try
|
||||
{ // set the second sequence
|
||||
entry2.setHotlistSequence(seq1);
|
||||
restore = false;
|
||||
|
||||
} // end try
|
||||
finally
|
||||
{ // restore the first sequence on error
|
||||
if (restore)
|
||||
entry1.setHotlistSequence(seq1);
|
||||
|
||||
} // end finally
|
||||
|
||||
// bounce back to the hotlist screen
|
||||
rc = new Redirect("conf/hotlist.js.vs",LinkTypes.SERVLET);
|
||||
|
||||
} // end try
|
||||
catch (e)
|
||||
{ // error adjusting the hotlist sequence
|
||||
etype = vlib.exceptionType(e) + "";
|
||||
if (etype.match("DataException"))
|
||||
rc = new ErrorBox("Database Error","Error adjusting hotlist: " + e.message,"conf/hotlist.js.vs");
|
||||
else
|
||||
rc = e;
|
||||
|
||||
} // end catch
|
||||
|
||||
vlib.output(rc); // all done
|
||||
96
scripts/conf/invite_conf.js
Normal file
96
scripts/conf/invite_conf.js
Normal file
@@ -0,0 +1,96 @@
|
||||
// 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):
|
||||
|
||||
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);
|
||||
importPackage(Packages.com.silverwrist.venice.ui.view);
|
||||
|
||||
// get the request object and the community
|
||||
rinput = bsf.lookupBean("request");
|
||||
comm = rinput.getCommunity(true,"top.js.vs");
|
||||
|
||||
// get the current conference
|
||||
currc = new CurrentConference(rinput);
|
||||
conf = currc.getConference(true,"conf/conferences.js.vs?cc=" + comm.communityID);
|
||||
on_error = "conf/manage_conf.js.vs?cc=" + comm.communityID + "&conf=" + conf.confID;
|
||||
|
||||
if (!(conf.canSendInvitation()))
|
||||
{ // you can't send an invitation
|
||||
vlib.output(new ErrorBox("Conference Error","You are not permitted to send an invitation.",on_error));
|
||||
vlib.done();
|
||||
|
||||
} // end if
|
||||
|
||||
if ("GET"==rinput.verb)
|
||||
{ // set up the invitation screen parameters
|
||||
rinput.setRequestAttribute("invitation.title","Send Conference Invitation:");
|
||||
rinput.setRequestAttribute("invitation.subtitle",conf.name);
|
||||
rinput.setRequestAttribute("invitation.action",rinput.formatURL("conf/invite_conf.js.vs",LinkTypes.SERVLET));
|
||||
rinput.setRequestAttribute("invitation.params",
|
||||
"<INPUT TYPE=\"HIDDEN\" NAME=\"cc\" VALUE=\"" + comm.communityID
|
||||
+ "\"><INPUT TYPE=\"HIDDEN\" NAME=\"conf\" VALUE=\"" + conf.confID + "\">");
|
||||
|
||||
// create the invitation and display it
|
||||
view = new JSPView("Send Invitation","comm/invite.jsp");
|
||||
view.menuSelector = Content.MENU_SELECTOR_COMMUNITY;
|
||||
view.pageQID = "conf/invite_conf.js.vs?cc=" + comm.communityID + "&conf=" + conf.confID;
|
||||
vlib.output(view);
|
||||
vlib.done();
|
||||
|
||||
} // end if
|
||||
|
||||
if (rinput.isImageButtonClicked("cancel"))
|
||||
{ // bounce back to the base page
|
||||
vlib.output(new Redirect(on_error,LinkTypes.SERVLET));
|
||||
vlib.done();
|
||||
|
||||
} // end if
|
||||
|
||||
rc = null;
|
||||
if (rinput.isImageButtonClicked("send"))
|
||||
{ // do the actual send!
|
||||
try
|
||||
{ // send out the invitation and then redirect back
|
||||
conf.sendInvitation(rinput.getParameter("addr"),rinput.getParameter("pb"));
|
||||
rc = new Redirect(on_error,LinkTypes.SERVLET);
|
||||
|
||||
} // end try
|
||||
catch (e)
|
||||
{ // exception sending the invitation
|
||||
etype = vlib.exceptionType(e) + "";
|
||||
if (etype.match("AccessError"))
|
||||
rc = new ErrorBox("Access Error",e.message,on_error);
|
||||
else if (etype.match("DataException"))
|
||||
rc = new ErrorBox("Database Error","Database error sending invitation: " + e.message,on_error);
|
||||
else if (etype.match("EmailException"))
|
||||
rc = new ErrorBox("E-Mail Error","Error sending E-mail: " + e.message,on_error);
|
||||
else
|
||||
rc = e;
|
||||
|
||||
} // end catch
|
||||
|
||||
} // end if
|
||||
else
|
||||
{ // no known button pressed
|
||||
logger.error("no known button click on POST to conf/invite_conf.js");
|
||||
rc = new ErrorBox("Internal Error","Unknown command button pressed",on_error);
|
||||
|
||||
} // end else
|
||||
|
||||
vlib.output(rc);
|
||||
103
scripts/conf/invite_topic.js
Normal file
103
scripts/conf/invite_topic.js
Normal file
@@ -0,0 +1,103 @@
|
||||
// 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):
|
||||
|
||||
importPackage(java.util);
|
||||
importPackage(Packages.com.silverwrist.venice.core);
|
||||
importPackage(Packages.com.silverwrist.venice.except);
|
||||
importPackage(Packages.com.silverwrist.venice.ui);
|
||||
importPackage(Packages.com.silverwrist.venice.ui.conf);
|
||||
importPackage(Packages.com.silverwrist.venice.ui.helpers);
|
||||
|
||||
// get the request object and the community
|
||||
rinput = bsf.lookupBean("request");
|
||||
comm = rinput.getCommunity(true,"top.js.vs");
|
||||
|
||||
// get the current conference
|
||||
currc = new CurrentConference(rinput);
|
||||
conf = currc.getConference(true,"conf/conferences.js.vs?cc=" + comm.communityID);
|
||||
|
||||
// get the current topic
|
||||
topic = currc.getTopic(true,"conf/topics.js.vs?cc=" + comm.communityID + "&conf=" + conf.confID);
|
||||
on_error = "conf/manage_topic.js.vs?cc=" + comm.communityID + "&conf=" + conf.confID + "&top="
|
||||
+ topic.topicNumber;
|
||||
|
||||
if (!(topic.canSendInvitation()))
|
||||
{ // you can't send an invitation
|
||||
vlib.output(new ErrorBox("Conference Error","You are not permitted to send an invitation.",on_error));
|
||||
vlib.done();
|
||||
|
||||
} // end if
|
||||
|
||||
if ("GET"==rinput.verb)
|
||||
{ // set up the invitation screen parameters
|
||||
rinput.setRequestAttribute("invitation.title","Send Topic Invitation:");
|
||||
rinput.setRequestAttribute("invitation.subtitle",topic.name);
|
||||
rinput.setRequestAttribute("invitation.action",
|
||||
rinput.formatURL("conf/invite_topic.js.vs",LinkTypes.SERVLET));
|
||||
rinput.setRequestAttribute("invitation.params",
|
||||
"<INPUT TYPE=\"HIDDEN\" NAME=\"cc\" VALUE=\"" + comm.communityID
|
||||
+ "\"><INPUT TYPE=\"HIDDEN\" NAME=\"conf\" VALUE=\"" + conf.confID
|
||||
+ "\"><INPUT TYPE=\"HIDDEN\" NAME=\"top\" VALUE=\"" + topic.topicNumber + "\">");
|
||||
|
||||
// create the invitation and display it
|
||||
view = new JSPView("Send Invitation","comm/invite.jsp");
|
||||
view.menuSelector = Content.MENU_SELECTOR_COMMUNITY;
|
||||
view.pageQID = "conf/invite_topic.js.vs?cc=" + comm.communityID + "&conf=" + conf.confID + "&top="
|
||||
+ topic.topicNumber;
|
||||
vlib.output(view);
|
||||
vlib.done();
|
||||
|
||||
} // end if
|
||||
|
||||
if (rinput.isImageButtonClicked("cancel"))
|
||||
{ // bounce back to the base page
|
||||
vlib.output(new Redirect(on_error,LinkTypes.SERVLET));
|
||||
vlib.done();
|
||||
|
||||
} // end if
|
||||
|
||||
rc = null;
|
||||
if (rinput.isImageButtonClicked("send"))
|
||||
{ // do the actual send!
|
||||
try
|
||||
{ // send out the invitation and then redirect back
|
||||
topic.sendInvitation(rinput.getParameter("addr"),rinput.getParameter("pb"));
|
||||
rc = new Redirect(on_error,LinkTypes.SERVLET);
|
||||
|
||||
} // end try
|
||||
catch (e)
|
||||
{ // exception sending the invitation
|
||||
etype = vlib.exceptionType(e) + "";
|
||||
if (etype.match("AccessError"))
|
||||
rc = new ErrorBox("Access Error",e.message,on_error);
|
||||
else if (etype.match("DataException"))
|
||||
rc = new ErrorBox("Database Error","Database error sending invitation: " + e.message,on_error);
|
||||
else if (etype.match("EmailException"))
|
||||
rc = new ErrorBox("E-Mail Error","Error sending E-mail: " + e.message,on_error);
|
||||
else
|
||||
rc = e;
|
||||
|
||||
} // end catch
|
||||
|
||||
} // end if
|
||||
else
|
||||
{ // no known button pressed
|
||||
logger.error("no known button click on POST to conf/invite_topic.js");
|
||||
rc = new ErrorBox("Internal Error","Unknown command button pressed",on_error);
|
||||
|
||||
} // end else
|
||||
|
||||
vlib.output(rc);
|
||||
90
scripts/conf/lurker_report.js
Normal file
90
scripts/conf/lurker_report.js
Normal file
@@ -0,0 +1,90 @@
|
||||
// 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):
|
||||
|
||||
importPackage(java.util);
|
||||
importPackage(Packages.com.silverwrist.venice.core);
|
||||
importPackage(Packages.com.silverwrist.venice.except);
|
||||
importPackage(Packages.com.silverwrist.venice.ui);
|
||||
importPackage(Packages.com.silverwrist.venice.ui.conf);
|
||||
importPackage(Packages.com.silverwrist.venice.ui.helpers);
|
||||
importPackage(Packages.com.silverwrist.venice.ui.view);
|
||||
|
||||
// get the request object and the community
|
||||
rinput = bsf.lookupBean("request");
|
||||
comm = rinput.getCommunity(true,"top.js.vs");
|
||||
|
||||
// get the current conference
|
||||
currc = new CurrentConference(rinput);
|
||||
conf = currc.getConference(true,"conf/conferences.js.vs?cc=" + comm.communityID);
|
||||
on_error = "conf/conf_reports.js.vs?cc=" + comm.communityID + "&conf=" + conf.confID;
|
||||
|
||||
// get the current topic (where applicable)
|
||||
topic = currc.getTopic(false,on_error);
|
||||
|
||||
rc = null;
|
||||
try
|
||||
{ // construct the activity list
|
||||
my_list = null;
|
||||
my_title = null;
|
||||
title1 = null;
|
||||
title2 = null;
|
||||
nullmsg = null;
|
||||
if (topic!=null)
|
||||
{ // get the reader list from the topic
|
||||
my_list = topic.getActiveReaders();
|
||||
if (my_list.isEmpty())
|
||||
nullmsg = "No readers in topic \"" + topic.name + "\" found.";
|
||||
my_title = "Users Reading Topic " + topic.name;
|
||||
title1 = "Readers in Topic:";
|
||||
title2 = topic.name;
|
||||
|
||||
} // end if
|
||||
else
|
||||
{ // get the reader list from the conference
|
||||
my_list = conf.getActiveReaders();
|
||||
if (my_list.isEmpty())
|
||||
nullmsg = "No readers in conference \"" + vlib.encodeHTML(conf.name) + "\" found.";
|
||||
my_title = "Users Reading Conference " + conf.name;
|
||||
title1 = "Readers in Conference:";
|
||||
title2 = conf.name;
|
||||
|
||||
} // end else
|
||||
|
||||
// save off the attributes
|
||||
rinput.setRequestAttribute("conference.activity.list",my_list);
|
||||
rinput.setRequestAttribute("conference.activity.nullmessage",nullmsg);
|
||||
rinput.setRequestAttribute("conference.activity.posters",Boolean.FALSE);
|
||||
rinput.setRequestAttribute("conference.activity.title",title1);
|
||||
rinput.setRequestAttribute("conference.activity.subtitle",title2);
|
||||
|
||||
// create the view
|
||||
rc = new JSPView(my_title,"conf/activity_report.jsp");
|
||||
rc.menuSelector = Content.MENU_SELECTOR_COMMUNITY;
|
||||
|
||||
} // end try
|
||||
catch (e)
|
||||
{ // error getting the list of readers
|
||||
etype = vlib.exceptionType(e) + "";
|
||||
if (etype.match("DataException"))
|
||||
rc = new ErrorBox("Database Error","Database error getting reader list: " + e.message,on_error);
|
||||
else if (etype.match("AccessError"))
|
||||
rc = new ErrorBox("Access Error",e.message,on_error);
|
||||
else
|
||||
rc = e;
|
||||
|
||||
} // end catch
|
||||
|
||||
vlib.output(rc); // all done...
|
||||
86
scripts/conf/manage.js
Normal file
86
scripts/conf/manage.js
Normal file
@@ -0,0 +1,86 @@
|
||||
// The contents of this file are subject to the Mozilla Public License Version 1.1
|
||||
// (the "License"); you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at <http://www.mozilla.org/MPL/>.
|
||||
//
|
||||
// Software distributed under the License is distributed on an "AS IS" basis, WITHOUT
|
||||
// WARRANTY OF ANY KIND, either express or implied. See the License for the specific
|
||||
// language governing rights and limitations under the License.
|
||||
//
|
||||
// The Original Code is the Venice Web Communities System.
|
||||
//
|
||||
// The Initial Developer of the Original Code is Eric J. Bowersox <erbo@silcom.com>,
|
||||
// for Silverwrist Design Studios. Portions created by Eric J. Bowersox are
|
||||
// Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved.
|
||||
//
|
||||
// Contributor(s):
|
||||
|
||||
importPackage(java.util);
|
||||
importPackage(Packages.com.silverwrist.venice.core);
|
||||
importPackage(Packages.com.silverwrist.venice.except);
|
||||
importPackage(Packages.com.silverwrist.venice.ui);
|
||||
importPackage(Packages.com.silverwrist.venice.ui.conf);
|
||||
importPackage(Packages.com.silverwrist.venice.ui.helpers);
|
||||
importPackage(Packages.com.silverwrist.venice.ui.view);
|
||||
|
||||
// get the request object and the community
|
||||
rinput = bsf.lookupBean("request");
|
||||
comm = rinput.getCommunity(true,"top.js.vs");
|
||||
|
||||
if (!(comm.canManageConferences()))
|
||||
{ // can't manage conferences, bail out
|
||||
vlib.output(new ErrorBox("Access Error","You are not permitted to manage conferences in this community.",
|
||||
"conf/conferences.js.vs?cc=" + comm.communityID));
|
||||
vlib.done();
|
||||
|
||||
} // end if
|
||||
|
||||
rc = null;
|
||||
try
|
||||
{ // get the conference list
|
||||
conf_list = comm.getConferences();
|
||||
|
||||
// allocate arrays to hold the next/previous/hidden data
|
||||
a_next = vlib.createIntArray(conf_list.size());
|
||||
a_prev = vlib.createIntArray(conf_list.size());
|
||||
a_hidden = vlib.createBooleanArray(conf_list.size());
|
||||
|
||||
// determine the next/previous/hidden data in advance
|
||||
prev_id = -1;
|
||||
for (i=0; i<conf_list.size(); i++)
|
||||
{ // fill the various arrays
|
||||
conf = vlib.castConferenceContext(conf_list.get(i));
|
||||
a_hidden[i] = conf.hideList;
|
||||
a_prev[i] = prev_id;
|
||||
if (i>0)
|
||||
a_next[i-1] = conf.confID;
|
||||
prev_id = conf.confID;
|
||||
|
||||
} // end for
|
||||
|
||||
a_next[conf_list.size()-1] = -1;
|
||||
|
||||
// save off the data for the JSP page
|
||||
rinput.setRequestAttribute("conference.list",conf_list);
|
||||
rinput.setRequestAttribute("conference.prev.array",a_prev);
|
||||
rinput.setRequestAttribute("conference.next.array",a_next);
|
||||
rinput.setRequestAttribute("conference.hidden.array",a_hidden);
|
||||
|
||||
// create the return view
|
||||
rc = new JSPView("Manage Conference List","conf/manage_list.jsp");
|
||||
rc.menuSelector = Content.MENU_SELECTOR_COMMUNITY;
|
||||
|
||||
} // end try
|
||||
catch (e)
|
||||
{ // error in getting the conference sequence stuff
|
||||
etype = vlib.exceptionType(e) + "";
|
||||
if (etype.match("DataException"))
|
||||
rc = new ErrorBox("Database Error","Database error getting conference list: " + e.message,
|
||||
"conf/conferences.js.vs?cc=" + comm.communityID);
|
||||
else if (etype.match("AccessError"))
|
||||
rc = new ErrorBox("Access Error",e.message,"conf/conferences.js.vs?cc=" + comm.communityID);
|
||||
else
|
||||
rc = e;
|
||||
|
||||
} // end catch
|
||||
|
||||
vlib.output(rc); // all done!
|
||||
45
scripts/conf/manage_conf.js
Normal file
45
scripts/conf/manage_conf.js
Normal file
@@ -0,0 +1,45 @@
|
||||
// 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):
|
||||
|
||||
importPackage(java.util);
|
||||
importPackage(Packages.com.silverwrist.venice.core);
|
||||
importPackage(Packages.com.silverwrist.venice.except);
|
||||
importPackage(Packages.com.silverwrist.venice.ui);
|
||||
importPackage(Packages.com.silverwrist.venice.ui.conf);
|
||||
importPackage(Packages.com.silverwrist.venice.ui.helpers);
|
||||
importPackage(Packages.com.silverwrist.venice.ui.view);
|
||||
|
||||
// get the request object and the community
|
||||
rinput = bsf.lookupBean("request");
|
||||
comm = rinput.getCommunity(true,"top.js.vs");
|
||||
|
||||
// get the current conference
|
||||
currc = new CurrentConference(rinput);
|
||||
conf = currc.getConference(true,"conf/conferences.js.vs?cc=" + comm.communityID);
|
||||
|
||||
if (conf.canChangeConference() || conf.canDeleteConference())
|
||||
{ // create the host tools menu
|
||||
vars = new HashMap();
|
||||
vars.put("cid",comm.communityID + "");
|
||||
vars.put("confid",conf.confID + "");
|
||||
rinput.setRequestAttribute("conference.host.tools.menu",rinput.getMenu("conf.host.tools",vars));
|
||||
|
||||
} // end if
|
||||
|
||||
// create and output the view
|
||||
view = new JSPView("Manage Conference: " + conf.name,"conf/manage_conf.jsp");
|
||||
view.menuSelector = Content.MENU_SELECTOR_COMMUNITY;
|
||||
vlib.output(view);
|
||||
82
scripts/conf/manage_list_delete.js
Normal file
82
scripts/conf/manage_list_delete.js
Normal file
@@ -0,0 +1,82 @@
|
||||
// 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):
|
||||
|
||||
importPackage(Packages.com.silverwrist.venice.core);
|
||||
importPackage(Packages.com.silverwrist.venice.except);
|
||||
importPackage(Packages.com.silverwrist.venice.ui);
|
||||
importPackage(Packages.com.silverwrist.venice.ui.conf);
|
||||
importPackage(Packages.com.silverwrist.venice.ui.helpers);
|
||||
|
||||
// get the request object and the community
|
||||
rinput = bsf.lookupBean("request");
|
||||
comm = rinput.getCommunity(true,"top.js.vs");
|
||||
|
||||
if (!(comm.canManageConferences()))
|
||||
{ // can't manage conferences, bail out
|
||||
vlib.output(new ErrorBox("Access Error","You are not permitted to manage conferences in this community.",
|
||||
"conf/conferences.js.vs?cc=" + comm.communityID));
|
||||
vlib.done();
|
||||
|
||||
} // end if
|
||||
|
||||
// get the current conference
|
||||
currc = new CurrentConference(rinput);
|
||||
conf = currc.getConference(true,"conf/manage.js.vs?cc=" + comm.communityID);
|
||||
|
||||
if (!(conf.canDeleteConference()))
|
||||
{ // you can't fiddle with this conference
|
||||
vlib.output(new ErrorBox("Access Error","You do not have permission to delete this conference.",
|
||||
"conf/manage.js.vs?cc=" + comm.communityID));
|
||||
vlib.done();
|
||||
|
||||
} // end if
|
||||
|
||||
CONFIRM_attr = "conferences.manage_list.delete.ConfirmBox";
|
||||
CONFIRM_param = "confirm";
|
||||
|
||||
rc = null;
|
||||
if (ConfirmBox.isConfirmed(rinput,CONFIRM_attr,CONFIRM_param))
|
||||
{ // it is confirmed - we want to delete the conference!
|
||||
try
|
||||
{ // delete the conference (using the alias function to avoid using the delete keyword)
|
||||
conf.deleteConference();
|
||||
|
||||
// trap back to the manage display
|
||||
rc = new Redirect("conf/manage.js.vs?cc=" + comm.communityID,LinkTypes.SERVLET);
|
||||
|
||||
} // end try
|
||||
catch (e)
|
||||
{ // handle error in deletion
|
||||
etype = vlib.exceptionType(e) + "";
|
||||
if (etype.match("DataException"))
|
||||
rc = new ErrorBox("Database Error","Database error deleting conference: " + e.message,
|
||||
"conf/manage.js.vs?cc=" + comm.communityID);
|
||||
else if (etype.match("AccessError"))
|
||||
rc = new ErrorBox("Access Error",e.message,"conf/manage.js.vs?cc=" + comm.communityID);
|
||||
else
|
||||
rc = e;
|
||||
|
||||
} // end catch
|
||||
|
||||
} // end if
|
||||
else // come up with the confirm box
|
||||
rc = new ConfirmBox(rinput,CONFIRM_attr,CONFIRM_param,"Delete Conference",
|
||||
"You are about to permanently delete the '" + conf.name
|
||||
+ "' conference! Are you sure you want to do this?",
|
||||
"conf/manage_list_delete.js.vs?cc=" + comm.communityID + "&conf=" + conf.confID,
|
||||
LinkTypes.SERVLET,"conf/manage.js.vs?cc=" + comm.communityID,LinkTypes.SERVLET);
|
||||
|
||||
vlib.output(rc); // all done!
|
||||
72
scripts/conf/manage_list_sethide.js
Normal file
72
scripts/conf/manage_list_sethide.js
Normal file
@@ -0,0 +1,72 @@
|
||||
// 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):
|
||||
|
||||
importPackage(Packages.com.silverwrist.venice.core);
|
||||
importPackage(Packages.com.silverwrist.venice.except);
|
||||
importPackage(Packages.com.silverwrist.venice.ui);
|
||||
importPackage(Packages.com.silverwrist.venice.ui.conf);
|
||||
importPackage(Packages.com.silverwrist.venice.ui.helpers);
|
||||
|
||||
// get the request object and the community
|
||||
rinput = bsf.lookupBean("request");
|
||||
comm = rinput.getCommunity(true,"top.js.vs");
|
||||
|
||||
if (!(comm.canManageConferences()))
|
||||
{ // can't manage conferences, bail out
|
||||
vlib.output(new ErrorBox("Access Error","You are not permitted to manage conferences in this community.",
|
||||
"conf/conferences.js.vs?cc=" + comm.communityID));
|
||||
vlib.done();
|
||||
|
||||
} // end if
|
||||
|
||||
// get the current conference
|
||||
currc = new CurrentConference(rinput);
|
||||
conf = currc.getConference(true,"conf/manage.js.vs?cc=" + comm.communityID);
|
||||
|
||||
if (!(conf.canChangeConference()))
|
||||
{ // you can't fiddle with this conference
|
||||
vlib.output(new ErrorBox("Access Error","You do not have permission to modify this conference.",
|
||||
"conf/manage.js.vs?cc=" + comm.communityID));
|
||||
vlib.done();
|
||||
|
||||
} // end if
|
||||
|
||||
// get the flag value
|
||||
hide_flag = (rinput.getParameterInt("flag",0)==1);
|
||||
|
||||
rc = null;
|
||||
try
|
||||
{ // set the hide flag
|
||||
conf.hideList = hide_flag;
|
||||
|
||||
// trap back to the manage display
|
||||
rc = new Redirect("conf/manage.js.vs?cc=" + comm.communityID,LinkTypes.SERVLET);
|
||||
|
||||
} // end try
|
||||
catch (e)
|
||||
{ // handle errors here
|
||||
etype = vlib.exceptionType(e) + "";
|
||||
if (etype.match("DataException"))
|
||||
rc = new ErrorBox("Database Error","Database error setting hide flag: " + e.message,
|
||||
"conf/manage.js.vs?cc=" + comm.communityID);
|
||||
else if (etype.match("AccessError"))
|
||||
rc = new ErrorBox("Access Error",e.message,"conf/manage.js.vs?cc=" + comm.communityID);
|
||||
else
|
||||
rc = e;
|
||||
|
||||
} // end catch
|
||||
|
||||
vlib.output(rc); // all done!
|
||||
89
scripts/conf/manage_list_swap.js
Normal file
89
scripts/conf/manage_list_swap.js
Normal file
@@ -0,0 +1,89 @@
|
||||
// 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):
|
||||
|
||||
importPackage(Packages.com.silverwrist.venice.core);
|
||||
importPackage(Packages.com.silverwrist.venice.except);
|
||||
importPackage(Packages.com.silverwrist.venice.ui);
|
||||
importPackage(Packages.com.silverwrist.venice.ui.conf);
|
||||
importPackage(Packages.com.silverwrist.venice.ui.helpers);
|
||||
|
||||
// get the request object and the community
|
||||
rinput = bsf.lookupBean("request");
|
||||
comm = rinput.getCommunity(true,"top.js.vs");
|
||||
|
||||
if (!(comm.canManageConferences()))
|
||||
{ // can't manage conferences, bail out
|
||||
vlib.output(new ErrorBox("Access Error","You are not permitted to manage conferences in this community.",
|
||||
"conf/conferences.js.vs?cc=" + comm.communityID));
|
||||
vlib.done();
|
||||
|
||||
} // end if
|
||||
|
||||
// get the current conference
|
||||
currc = new CurrentConference(rinput);
|
||||
conf = currc.getConference(true,"conf/manage.js.vs?cc=" + comm.communityID);
|
||||
|
||||
// we need another conference here - get that conference parameter
|
||||
other_conf = currc.getConferenceParam("other",true,"conf/manage.js.vs?cc=" + comm.communityID);
|
||||
|
||||
if (!(conf.canChangeConference()) || !(other_conf.canChangeConference()))
|
||||
{ // you can't fiddle with this conference
|
||||
vlib.output(new ErrorBox("Access Error","You do not have permission to modify this conference.",
|
||||
"conf/manage.js.vs?cc=" + comm.communityID));
|
||||
vlib.done();
|
||||
|
||||
} // end if
|
||||
|
||||
rc = null;
|
||||
try
|
||||
{ // get the two sequences for starters
|
||||
this_seq = conf.sequence;
|
||||
other_seq = other_conf.sequence;
|
||||
|
||||
// now exchange them
|
||||
conf.sequence = other_seq;
|
||||
restore = true;
|
||||
try
|
||||
{ // set the second conference sequence
|
||||
other_conf.sequence = this_seq;
|
||||
restore = false;
|
||||
|
||||
} // end try
|
||||
finally
|
||||
{ // undo first set on error
|
||||
if (restore)
|
||||
conf.sequence = this_seq;
|
||||
|
||||
} // end finally
|
||||
|
||||
// trap back to the manage display
|
||||
rc = new Redirect("conf/manage.js.vs?cc=" + comm.communityID,LinkTypes.SERVLET);
|
||||
|
||||
} // end try
|
||||
catch (e)
|
||||
{ // error in exchanging the conference positions
|
||||
etype = vlib.exceptionType(e) + "";
|
||||
if (etype.match("DataException"))
|
||||
rc = new ErrorBox("Database Error","Database error changing sequence: " + e.message,
|
||||
"conf/manage.js.vs?cc=" + comm.communityID);
|
||||
else if (etype.match("AccessError"))
|
||||
rc = new ErrorBox("Access Error",e.message,"conf/manage.js.vs?cc=" + comm.communityID);
|
||||
else
|
||||
rc = e;
|
||||
|
||||
} // end catch
|
||||
|
||||
vlib.output(rc); // all done...
|
||||
57
scripts/conf/manage_topic.js
Normal file
57
scripts/conf/manage_topic.js
Normal file
@@ -0,0 +1,57 @@
|
||||
// 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):
|
||||
|
||||
importPackage(java.util);
|
||||
importPackage(Packages.com.silverwrist.venice.core);
|
||||
importPackage(Packages.com.silverwrist.venice.except);
|
||||
importPackage(Packages.com.silverwrist.venice.ui);
|
||||
importPackage(Packages.com.silverwrist.venice.ui.conf);
|
||||
importPackage(Packages.com.silverwrist.venice.ui.helpers);
|
||||
importPackage(Packages.com.silverwrist.venice.ui.view);
|
||||
|
||||
// get the request object and the community
|
||||
rinput = bsf.lookupBean("request");
|
||||
comm = rinput.getCommunity(true,"top.js.vs");
|
||||
|
||||
// get the current conference
|
||||
currc = new CurrentConference(rinput);
|
||||
conf = currc.getConference(true,"conf/conferences.js.vs?cc=" + comm.communityID);
|
||||
|
||||
// get the current topic
|
||||
topic = currc.getTopic(true,"conf/topics.js.vs?cc=" + comm.communityID + "&conf=" + conf.confID);
|
||||
on_error = "conf/posts.js.vs?cc=" + comm.communityID + "&conf=" + conf.confID + "&top=" + topic.topicNumber;
|
||||
|
||||
rc = null;
|
||||
try
|
||||
{ // save off the attributes we require
|
||||
rinput.setRequestAttribute("topic.bozos.list",topic.getBozos());
|
||||
|
||||
// return the view
|
||||
rc = new JSPView("Manage Topic: " + topic.name,"conf/manage_topic.jsp");
|
||||
rc.menuSelector = Content.MENU_SELECTOR_COMMUNITY;
|
||||
|
||||
} // end try
|
||||
catch (e)
|
||||
{ // error in generating bozos list
|
||||
etype = vlib.exceptionType(e) + "";
|
||||
if (etype.match("DataException"))
|
||||
rc = new ErrorBox("Database Error","Database error getting filter list: " + e.message,on_error);
|
||||
else
|
||||
rc = e;
|
||||
|
||||
} // end catch
|
||||
|
||||
vlib.output(rc); // all done...
|
||||
222
scripts/conf/membership.js
Normal file
222
scripts/conf/membership.js
Normal file
@@ -0,0 +1,222 @@
|
||||
// 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):
|
||||
|
||||
importPackage(java.util);
|
||||
importPackage(Packages.com.silverwrist.venice.core);
|
||||
importPackage(Packages.com.silverwrist.venice.except);
|
||||
importPackage(Packages.com.silverwrist.venice.ui);
|
||||
importPackage(Packages.com.silverwrist.venice.ui.conf);
|
||||
importPackage(Packages.com.silverwrist.venice.ui.conf.view);
|
||||
importPackage(Packages.com.silverwrist.venice.ui.helpers);
|
||||
|
||||
// Function which sets the correct conference access level onto each entry of the input list.
|
||||
function augmentList(conf,list)
|
||||
{
|
||||
var rl = new ArrayList(list.size());
|
||||
var it = list.iterator();
|
||||
while (it.hasNext())
|
||||
{ // get the conference level and add it to the UserFound object
|
||||
var uf = vlib.castUserFound(it.next());
|
||||
var level = conf.getMemberLevel(uf.UID);
|
||||
rl.add(uf.createNewLevel(level));
|
||||
|
||||
} // end while
|
||||
|
||||
return rl;
|
||||
|
||||
} // end augmentList
|
||||
|
||||
// get the request object and the community
|
||||
rinput = bsf.lookupBean("request");
|
||||
comm = rinput.getCommunity(true,"top.js.vs");
|
||||
|
||||
// get the current conference
|
||||
currc = new CurrentConference(rinput);
|
||||
conf = currc.getConference(true,"conf/conferences.js.vs?cc=" + comm.communityID);
|
||||
on_error = "conf/manage_conf.js.vs?cc=" + comm.communityID + "&conf=" + conf.confID;
|
||||
|
||||
if (!(conf.canChangeConference()))
|
||||
{ // you can't fiddle with this conference
|
||||
vlib.output(new ErrorBox("Access Error","You do not have permission to change this conference's membership.",
|
||||
on_error));
|
||||
vlib.done();
|
||||
|
||||
} // end if
|
||||
|
||||
// create the view object
|
||||
view = new ConfMemberView(rinput.engine.getStdNumSearchResults(),conf);
|
||||
|
||||
rc = null;
|
||||
if ("GET"==rinput.verb)
|
||||
{ // set up the initial state of the view
|
||||
try
|
||||
{ // get the conference membership list
|
||||
mbr_list = conf.getMemberList();
|
||||
view.simple = true;
|
||||
view.results = mbr_list;
|
||||
view.findCount = mbr_list.size();
|
||||
rc = view;
|
||||
|
||||
} // end try
|
||||
catch (e)
|
||||
{ // we can get at least one exception here
|
||||
etype = vlib.exceptionType(e) + "";
|
||||
if (etype.match("DataException"))
|
||||
rc = new ErrorBox("Database Error","Database error retrieving membership list: " + e.message,on_error);
|
||||
else if (etype.match("AccessError"))
|
||||
rc = new ErrorBox("Access Error",e.message,on_error);
|
||||
else
|
||||
rc = e;
|
||||
|
||||
} // end catch
|
||||
|
||||
vlib.output(rc);
|
||||
vlib.done();
|
||||
|
||||
} // end if
|
||||
|
||||
if (rinput.isImageButtonClicked("update"))
|
||||
{ // do an update of privileges in this conference
|
||||
list_uids = vlib.splitList(rinput.getParameter("listuids"),":");
|
||||
try
|
||||
{ // loop through the defined UIDs and check the level...
|
||||
it = list_uids.iterator();
|
||||
while (it.hasNext())
|
||||
{ // get the current and new levels, compare them, and reset if needed
|
||||
x = it.next();
|
||||
cur_level = rinput.getParameterInt("zxcur_" + x,-1);
|
||||
new_level = rinput.getParameterInt("zxnew_" + x,-1);
|
||||
if (cur_level!=new_level)
|
||||
conf.setMembership(parseInt(x,10),new_level);
|
||||
|
||||
} // end while
|
||||
|
||||
} // end try
|
||||
catch (e)
|
||||
{ // the update might throw an error message
|
||||
etype = vlib.exceptionType(e) + "";
|
||||
if (etype.match("DataException"))
|
||||
rc = new ErrorBox("Database Error","Database error adjusting permissions: " + e.message,on_error);
|
||||
else if (etype.match("AccessError"))
|
||||
rc = new ErrorBox("Access Error",e.message,on_error);
|
||||
else
|
||||
rc = e;
|
||||
|
||||
vlib.output(rc); // bail out now with the error message
|
||||
vlib.done();
|
||||
|
||||
} // end catch
|
||||
|
||||
} // end if
|
||||
|
||||
// Carry on with the search operation now.
|
||||
try
|
||||
{ // handle the actual search
|
||||
if ("1"==rinput.getParameter("sl"))
|
||||
{ // Set up some of the easy initial parameters.
|
||||
view.simple = true;
|
||||
|
||||
// Retrieve the offset and find count.
|
||||
view.offset = rinput.getParameterInt("ofs",0);
|
||||
// view.findCount = rinput.getParameterInt("fcount",-1); (N.B.: will get reassigned below)
|
||||
|
||||
// Adjust the offset based on the button clicked.
|
||||
if (rinput.isImageButtonClicked("search"))
|
||||
throw new ValidationException("Invalid button clicked."); // can't happen
|
||||
else if (rinput.isImageButtonClicked("previous"))
|
||||
view.offset = Math.max(view.offset-view.maxResults,0);
|
||||
else if (rinput.isImageButtonClicked("next"))
|
||||
view.offset += view.maxResults;
|
||||
else if (!(rinput.isImageButtonClicked("update")))
|
||||
throw new ValidationException("Unable to determine what action triggered the form.");
|
||||
|
||||
// Get the list and subset it if necessary.
|
||||
// N.B.: Since the update function can reduce the size of the member list, we need to take into account
|
||||
// that the find count will need updating and the offset may be in the wrong place for the list now.
|
||||
mbr_list = conf.getMemberList();
|
||||
view.findCount = mbr_list.size();
|
||||
while ((view.offset>0) && (view.offset>=view.findCount))
|
||||
view.offset = Math.max(view.offset-view.maxResults,0);
|
||||
if (view.offset==0)
|
||||
view.results = mbr_list;
|
||||
else
|
||||
view.results = mbr_list.subList(offset,mbr_list.size());
|
||||
|
||||
} // end if
|
||||
else
|
||||
{ // This is a search operation...
|
||||
view.simple = false;
|
||||
|
||||
// Get the search field parameter.
|
||||
x = rinput.getParameterInt("field",SearchMode.FIELD_USER_NAME);
|
||||
if ( (x!=SearchMode.FIELD_USER_NAME) && (x!=SearchMode.FIELD_USER_DESCRIPTION)
|
||||
&& (x!=SearchMode.FIELD_USER_GIVEN_NAME) && (x!=SearchMode.FIELD_USER_FAMILY_NAME))
|
||||
throw new ValidationException("The search field parameter is not valid.");
|
||||
view.field = x;
|
||||
|
||||
// Get the search mode parameter.
|
||||
x = rinput.getParameterInt("mode",SearchMode.SEARCH_PREFIX);
|
||||
if ( (x!=SearchMode.SEARCH_PREFIX) && (x!=SearchMode.SEARCH_SUBSTRING)
|
||||
&& (x!=SearchMode.SEARCH_REGEXP))
|
||||
throw new ValidationException("The search mode parameter is not valid.");
|
||||
view.mode = x;
|
||||
|
||||
// Get the search term parameter.
|
||||
view.term = rinput.getParameter("term");
|
||||
if (view.term==null)
|
||||
view.term = "";
|
||||
|
||||
// Retrieve the offset and find count.
|
||||
view.offset = rinput.getParameterInt("ofs",0);
|
||||
view.findCount = rinput.getParameterInt("fcount",-1);
|
||||
|
||||
// Adjust the offset based on the button clicked.
|
||||
if (rinput.isImageButtonClicked("search"))
|
||||
view.offset = 0; // begin a new search
|
||||
else if (rinput.isImageButtonClicked("previous"))
|
||||
view.offset = Math.max(view.offset-view.maxResults,0);
|
||||
else if (rinput.isImageButtonClicked("next"))
|
||||
view.offset += view.maxResults;
|
||||
else if (!(rinput.isImageButtonClicked("update")))
|
||||
throw new ValidationException("Unable to determine what action triggered the form.");
|
||||
|
||||
// Perform the search! (Note that we search on COMMUNITY members, not CONFERENCE members, as this is the
|
||||
// way that we add additional members to a conference.)
|
||||
tmp_results = comm.searchForMembers(view.field,view.mode,view.term,view.offset,view.maxResults);
|
||||
view.results = augmentList(conf,tmp_results);
|
||||
if (view.findCount<0)
|
||||
view.findCount = comm.getSearchMemberCount(view.field,view.mode,view.term);
|
||||
|
||||
} // end else (search operation)
|
||||
|
||||
rc = view;
|
||||
|
||||
} // end try
|
||||
catch (e)
|
||||
{ // handle an error in search
|
||||
etype = vlib.exceptionType(e) + "";
|
||||
if (etype.match("ValidationException"))
|
||||
rc = new ErrorBox("Find Error",e.message + " Please try again.",on_error);
|
||||
else if (etype.match("DataException"))
|
||||
rc = new ErrorBox("Database Error","Database error getting member list: " + e.message,on_error);
|
||||
else if (etype.match("AccessError"))
|
||||
rc = new ErrorBox("Access Error",e.message,on_error);
|
||||
else
|
||||
rc = e;
|
||||
|
||||
} // end catch
|
||||
|
||||
vlib.output(rc); // all done!
|
||||
61
scripts/conf/message_bozo.js
Normal file
61
scripts/conf/message_bozo.js
Normal 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):
|
||||
|
||||
importPackage(java.util);
|
||||
importPackage(Packages.com.silverwrist.venice.core);
|
||||
importPackage(Packages.com.silverwrist.venice.except);
|
||||
importPackage(Packages.com.silverwrist.venice.ui);
|
||||
importPackage(Packages.com.silverwrist.venice.ui.conf);
|
||||
importPackage(Packages.com.silverwrist.venice.ui.helpers);
|
||||
|
||||
// get the request object and the community
|
||||
rinput = bsf.lookupBean("request");
|
||||
comm = rinput.getCommunity(true,"top.js.vs");
|
||||
|
||||
// get the current conference
|
||||
currc = new CurrentConference(rinput);
|
||||
conf = currc.getConference(true,"conf/conferences.js.vs?cc=" + comm.communityID);
|
||||
|
||||
// get the current topic
|
||||
topic = currc.getTopic(true,"conf/topics.js.vs?cc=" + comm.communityID + "&conf=" + conf.confID);
|
||||
|
||||
// get the message under consideration
|
||||
msg = currc.getTopicMessageParam("msg",true,"conf/posts.js.vs?cc=" + comm.communityID + "&conf="
|
||||
+ conf.confID + "&top=" + topic.topicNumber);
|
||||
on_error = "conf/posts.js.vs?cc=" + comm.communityID + "&conf=" + conf.confID + "&top=" + topic.topicNumber
|
||||
+ "&p1=" + msg.getPostNumber() + "&shac=1";
|
||||
|
||||
rc = null;
|
||||
try
|
||||
{ // get the flag and set the hide status
|
||||
flag = rinput.getParameterInt("flag",0);
|
||||
topic.setBozo(msg.creatorUID,(flag==1));
|
||||
rc = new Redirect(on_error,LinkTypes.SERVLET);
|
||||
|
||||
} // end try
|
||||
catch (e)
|
||||
{ // error setting the hide topic
|
||||
etype = vlib.exceptionType(e) + "";
|
||||
if (etype.match("DataException"))
|
||||
rc = new ErrorBox("Database Error","Database error setting hide status: " + e.message,on_error);
|
||||
else if (etype.match("AccessError"))
|
||||
rc = new ErrorBox("Access Error",e.message,on_error);
|
||||
else
|
||||
rc = e;
|
||||
|
||||
} // end catch
|
||||
|
||||
vlib.output(rc); // all done!
|
||||
145
scripts/conf/new_topic.js
Normal file
145
scripts/conf/new_topic.js
Normal file
@@ -0,0 +1,145 @@
|
||||
// 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):
|
||||
|
||||
importPackage(java.util);
|
||||
importPackage(Packages.com.silverwrist.venice.core);
|
||||
importPackage(Packages.com.silverwrist.venice.except);
|
||||
importPackage(Packages.com.silverwrist.venice.ui);
|
||||
importPackage(Packages.com.silverwrist.venice.ui.conf);
|
||||
importPackage(Packages.com.silverwrist.venice.ui.helpers);
|
||||
importPackage(Packages.com.silverwrist.venice.ui.view);
|
||||
|
||||
// get the request object and the community
|
||||
rinput = bsf.lookupBean("request");
|
||||
comm = rinput.getCommunity(true,"top.js.vs");
|
||||
|
||||
// get the current conference
|
||||
currc = new CurrentConference(rinput);
|
||||
conf = currc.getConference(true,"conf/conferences.js.vs?cc=" + comm.communityID);
|
||||
on_error = "conf/topics.js.vs?cc=" + comm.communityID + "&conf=" + conf.confID;
|
||||
|
||||
if ("GET"==rinput.verb)
|
||||
{ // create the blank "New Topic Form"
|
||||
rinput.setRequestAttribute("postbox.newtopic","");
|
||||
rinput.setRequestAttribute("postbox.pseud",conf.defaultPseud);
|
||||
rinput.setRequestAttribute("postbox.data","");
|
||||
view = new JSPView("Create New Topic","conf/new_topic.jsp");
|
||||
view.menuSelector = Content.MENU_SELECTOR_COMMUNITY;
|
||||
vlib.output(view);
|
||||
vlib.done();
|
||||
|
||||
} // end if
|
||||
|
||||
if (rinput.isImageButtonClicked("cancel"))
|
||||
{ // they cancelled - bail out
|
||||
vlib.output(new Redirect(on_error,LinkTypes.SERVLET));
|
||||
vlib.done();
|
||||
|
||||
} // end if
|
||||
|
||||
if (rinput.isImageButtonClicked("preview"))
|
||||
{ // generate a preview! start by passing all the data through the HTML checker as needed
|
||||
try
|
||||
{ // escape the title
|
||||
checker = rinput.engine.getEscapingChecker();
|
||||
checker.append(rinput.getParameter("title"));
|
||||
checker.finish();
|
||||
rinput.setRequestAttribute("postbox.newtopic",checker.getValue());
|
||||
|
||||
// escape the pseud
|
||||
checker.reset();
|
||||
checker.append(rinput.getParameter("pseud"));
|
||||
checker.finish();
|
||||
rinput.setRequestAttribute("postbox.pseud",checker.getValue());
|
||||
|
||||
// escape the data
|
||||
postdata = rinput.getParameter("pb");
|
||||
checker.reset();
|
||||
checker.append(postdata);
|
||||
checker.finish();
|
||||
rinput.setRequestAttribute("postbox.data",checker.getValue());
|
||||
|
||||
// run the preview
|
||||
checker = conf.getNewTopicPreviewChecker();
|
||||
checker.append(postdata);
|
||||
checker.finish();
|
||||
rinput.setRequestAttribute("preview.text",checker.getValue());
|
||||
rinput.setRequestAttribute("preview.num_errors",new java.lang.Integer(checker.getCounter("spelling")));
|
||||
|
||||
} // end try
|
||||
catch (e)
|
||||
{ // watch out for spurious HTMLCheckerExceptions
|
||||
etype = vlib.exceptionType(e) + "";
|
||||
if (etype.match("HTMLCheckerException"))
|
||||
throw new InternalStateError("spurious HTMLCheckerException thrown");
|
||||
else
|
||||
throw new InternalStateError("unknown exception thrown in new_topic.js preview: " + e);
|
||||
|
||||
} // end catch
|
||||
|
||||
// save off any additional parameters we need
|
||||
tmp = rinput.getParameter("attach");
|
||||
if (!(vlib.emptyString(tmp)))
|
||||
rinput.setRequestAttribute("postbox.attach","Y");
|
||||
|
||||
// create a JSPView for the preview and output it
|
||||
view = new JSPView("Preview New Topic","conf/new_topic.jsp");
|
||||
view.menuSelector = Content.MENU_SELECTOR_COMMUNITY;
|
||||
vlib.output(view);
|
||||
vlib.done();
|
||||
|
||||
} // end if
|
||||
|
||||
if (!(rinput.isImageButtonClicked("post1")))
|
||||
{ // there were only the three buttons - bug out!
|
||||
logger.error("no known button click on POST to conf/new_topic.js");
|
||||
vlib.output(new ErrorBox("Internal Error","Unknown command button pressed",on_error));
|
||||
vlib.done();
|
||||
|
||||
} // end if
|
||||
|
||||
rc = null;
|
||||
try
|
||||
{ // add the new topic!
|
||||
topic = conf.addTopic(rinput.getParameter("title"),rinput.getParameter("pseud"),rinput.getParameter("pb"));
|
||||
|
||||
// decide where we go from here
|
||||
if (vlib.emptyString(rinput.getParameter("attach")))
|
||||
rc = new Redirect(on_error,LinkTypes.SERVLET); // bounce straight to our new view!
|
||||
else
|
||||
{ // we need to display the attachment form
|
||||
msg = topic.getMessage(0); // the message the attachment gets hooked to
|
||||
rinput.setRequestAttribute("attachment.postid",msg.postID + "");
|
||||
rinput.setRequestAttribute("attachment.target",on_error);
|
||||
rc = new JSPView("Upload Attachment","conf/attachment.jsp");
|
||||
rc.menuSelector = Content.MENU_SELECTOR_COMMUNITY;
|
||||
|
||||
} // end else
|
||||
|
||||
} // end try
|
||||
catch (e)
|
||||
{ // new topic creation failed
|
||||
etype = vlib.exceptionType(e) + "";
|
||||
if (etype.match("DataException"))
|
||||
rc = new ErrorBox("Database Error","Database error creating topic: " + e.message,on_error);
|
||||
else if (etype.match("AccessError"))
|
||||
rc = new ErrorBox("Access Error",e.message,on_error);
|
||||
else
|
||||
rc = e;
|
||||
|
||||
} // end catch
|
||||
|
||||
vlib.output(rc); // all done!
|
||||
82
scripts/conf/nuke_message.js
Normal file
82
scripts/conf/nuke_message.js
Normal file
@@ -0,0 +1,82 @@
|
||||
// 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):
|
||||
|
||||
importPackage(java.util);
|
||||
importPackage(Packages.com.silverwrist.venice.core);
|
||||
importPackage(Packages.com.silverwrist.venice.except);
|
||||
importPackage(Packages.com.silverwrist.venice.ui);
|
||||
importPackage(Packages.com.silverwrist.venice.ui.conf);
|
||||
importPackage(Packages.com.silverwrist.venice.ui.helpers);
|
||||
|
||||
// get the request object and the community
|
||||
rinput = bsf.lookupBean("request");
|
||||
comm = rinput.getCommunity(true,"top.js.vs");
|
||||
|
||||
// get the current conference
|
||||
currc = new CurrentConference(rinput);
|
||||
conf = currc.getConference(true,"conf/conferences.js.vs?cc=" + comm.communityID);
|
||||
|
||||
// get the current topic
|
||||
topic = currc.getTopic(true,"conf/topics.js.vs?cc=" + comm.communityID + "&conf=" + conf.confID);
|
||||
|
||||
// get the message under consideration
|
||||
msg = currc.getTopicMessageParam("msg",true,"conf/posts.js.vs?cc=" + comm.communityID + "&conf="
|
||||
+ conf.confID + "&top=" + topic.topicNumber);
|
||||
on_error = "conf/posts.js.vs?cc=" + comm.communityID + "&conf=" + conf.confID + "&top=" + topic.topicNumber
|
||||
+ "&p1=" + msg.getPostNumber() + "&shac=1";
|
||||
|
||||
CONFIRM_attr = "conferences.message.nuke.ConfirmBox";
|
||||
CONFIRM_param = "confirm";
|
||||
|
||||
rc = null;
|
||||
try
|
||||
{ // do the nuke here...
|
||||
if (ConfirmBox.isConfirmed(rinput,CONFIRM_attr,CONFIRM_param))
|
||||
{ // it is confirmed - we want to nuke the message!
|
||||
msg.nuke();
|
||||
|
||||
// bounce back to the topic display afterwards
|
||||
rc = new Redirect("conf/posts.js.vs?cc=" + comm.communityID + "&conf=" + conf.confID + "&top="
|
||||
+ topic.topicNumber,LinkTypes.SERVLET);
|
||||
|
||||
} // end if
|
||||
else
|
||||
{ // come up with the confirm box (this may throw exceptions too)
|
||||
aliases = conf.aliases;
|
||||
rc = new ConfirmBox(rinput,CONFIRM_attr,CONFIRM_param,"Nuke Message",
|
||||
"You are about to nuke message <" + aliases.get(0).toString() + "." + topic.topicNumber
|
||||
+ "." + msg.postNumber + ">, originally composed by <" + msg.creatorName
|
||||
+ ">! Are you sure you want to do this?",
|
||||
"conf/nuke_message.js.vs?cc=" + comm.communityID + "&conf=" + conf.confID + "&top="
|
||||
+ topic.topicNumber + "&msg=" + msg.postNumber,LinkTypes.SERVLET,on_error,
|
||||
LinkTypes.SERVLET);
|
||||
|
||||
} // end else
|
||||
|
||||
} // end try
|
||||
catch (e)
|
||||
{ // error deleting
|
||||
etype = vlib.exceptionType(e) + "";
|
||||
if (etype.match("DataException"))
|
||||
rc = new ErrorBox("Database Error","Database error nuking message: " + e.message,on_error);
|
||||
else if (etype.match("AccessError"))
|
||||
rc = new ErrorBox("Access Error",e.message,on_error);
|
||||
else
|
||||
rc = e;
|
||||
|
||||
} // end catch
|
||||
|
||||
vlib.output(rc); // all done...
|
||||
227
scripts/conf/post_message.js
Normal file
227
scripts/conf/post_message.js
Normal file
@@ -0,0 +1,227 @@
|
||||
// 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):
|
||||
|
||||
importPackage(java.util);
|
||||
importPackage(Packages.com.silverwrist.venice.core);
|
||||
importPackage(Packages.com.silverwrist.venice.except);
|
||||
importPackage(Packages.com.silverwrist.venice.htmlcheck);
|
||||
importPackage(Packages.com.silverwrist.venice.ui);
|
||||
importPackage(Packages.com.silverwrist.venice.ui.conf);
|
||||
importPackage(Packages.com.silverwrist.venice.ui.helpers);
|
||||
importPackage(Packages.com.silverwrist.venice.ui.view);
|
||||
|
||||
// get the request object and the community
|
||||
rinput = bsf.lookupBean("request");
|
||||
comm = rinput.getCommunity(true,"top.js.vs");
|
||||
|
||||
// get the current conference
|
||||
currc = new CurrentConference(rinput);
|
||||
conf = currc.getConference(true,"conf/conferences.js.vs?cc=" + comm.communityID);
|
||||
|
||||
// get the current topic
|
||||
topic = currc.getTopic(true,"conf/topics.js.vs?cc=" + comm.communityID + "&conf=" + conf.confID);
|
||||
on_error = "conf/posts.js.vs?cc=" + comm.communityID + "&conf=" + conf.confID + "&top=" + topic.topicNumber;
|
||||
|
||||
if (rinput.isImageButtonClicked("cancel"))
|
||||
{ // cancelling - go back where we came from
|
||||
vlib.output(new Redirect(on_error,LinkTypes.SERVLET));
|
||||
vlib.done();
|
||||
|
||||
} // end if
|
||||
|
||||
// get the current post number
|
||||
post_num = rinput.getParameterInt("sd",-1);
|
||||
if (post_num<0)
|
||||
{ // this value is critical for slippage detection - we must have it
|
||||
vlib.output(new ErrorBox(null,"Invalid parameter.",on_error));
|
||||
vlib.done();
|
||||
|
||||
} // end if
|
||||
|
||||
// get the raw post data
|
||||
raw_postdata = rinput.getParameter("pb");
|
||||
if (raw_postdata==null)
|
||||
raw_postdata = "";
|
||||
|
||||
if (rinput.isImageButtonClicked("preview"))
|
||||
{ // generate a preview! start by passing all the data through the HTML checker as needed
|
||||
try
|
||||
{ // escape the pseud
|
||||
checker = rinput.engine.getEscapingChecker();
|
||||
checker.append(rinput.getParameter("pseud"));
|
||||
checker.finish();
|
||||
rinput.setRequestAttribute("postbox.pseud",checker.getValue());
|
||||
|
||||
// escape the data
|
||||
checker.reset();
|
||||
checker.append(raw_postdata);
|
||||
checker.finish();
|
||||
rinput.setRequestAttribute("postbox.data",checker.getValue());
|
||||
|
||||
// run the preview
|
||||
checker = topic.getPreviewChecker();
|
||||
checker.append(raw_postdata);
|
||||
checker.finish();
|
||||
rinput.setRequestAttribute("preview.text",checker.getValue());
|
||||
rinput.setRequestAttribute("preview.num_errors",new java.lang.Integer(checker.getCounter("spelling")));
|
||||
|
||||
} // end try
|
||||
catch (e)
|
||||
{ // watch out for spurious HTMLCheckerExceptions
|
||||
etype = vlib.exceptionType(e) + "";
|
||||
if (etype.match("HTMLCheckerException"))
|
||||
throw new InternalStateError("spurious HTMLCheckerException thrown");
|
||||
else
|
||||
throw new InternalStateError("unknown exception thrown in post_message.js preview: " + e);
|
||||
|
||||
} // end catch
|
||||
|
||||
// save off any additional parameters we need
|
||||
tmp = rinput.getParameter("next");
|
||||
if (tmp!=null)
|
||||
rinput.setRequestAttribute("postbox.hidden.next",tmp);
|
||||
rinput.setRequestAttribute("postbox.hidden.sd",post_num + "");
|
||||
tmp = rinput.getParameter("attach");
|
||||
if (!(vlib.emptyString(tmp)))
|
||||
rinput.setRequestAttribute("postbox.attach","Y");
|
||||
tmp = rinput.getParameter("slip");
|
||||
if (!(vlib.emptyString(tmp)))
|
||||
rinput.setRequestAttribute("postbox.hidden.slip","Y");
|
||||
|
||||
// create a JSPView for the preview and output it
|
||||
view = new JSPView("Previewing Message","conf/preview.jsp");
|
||||
view.menuSelector = Content.MENU_SELECTOR_COMMUNITY;
|
||||
vlib.output(view);
|
||||
vlib.done();
|
||||
|
||||
} // end if
|
||||
|
||||
if (!(rinput.isImageButtonClicked("post") || rinput.isImageButtonClicked("postnext")
|
||||
|| rinput.isImageButtonClicked("posttopics")))
|
||||
{ // one of the three POST buttons MUST have been checked!
|
||||
logger.error("no known button click on POST to conf/post_message.js");
|
||||
vlib.output(new ErrorBox("Internal Error","Unknown command button pressed",on_error));
|
||||
vlib.done();
|
||||
|
||||
} // end if
|
||||
|
||||
if (post_num!=topic.getTotalMessages())
|
||||
{ // slippage detected! generate parameters for the Slippage view
|
||||
rc = null;
|
||||
try
|
||||
{ // get the list of messages associated with the slippage
|
||||
rinput.setRequestAttribute("slippage.messages",topic.getMessages(post_num,topic.totalMessages-1));
|
||||
|
||||
// generate the topic stem
|
||||
aliases = conf.aliases;
|
||||
rinput.setRequestAttribute("slippage.topic_stem",
|
||||
aliases.get(0).toString() + "." + topic.topicNumber + ".");
|
||||
|
||||
// escape the pseud
|
||||
checker = rinput.engine.getEscapingChecker();
|
||||
checker.append(rinput.getParameter("pseud"));
|
||||
checker.finish();
|
||||
rinput.setRequestAttribute("postbox.pseud",checker.getValue());
|
||||
|
||||
// escape the data
|
||||
checker.reset();
|
||||
checker.append(raw_postdata);
|
||||
checker.finish();
|
||||
rinput.setRequestAttribute("postbox.data",checker.getValue());
|
||||
|
||||
// save off any additional parameters we need
|
||||
tmp = rinput.getParameter("next");
|
||||
if (tmp!=null)
|
||||
rinput.setRequestAttribute("postbox.hidden.next",tmp);
|
||||
rinput.setRequestAttribute("postbox.hidden.sd",topic.totalMessages + "");
|
||||
tmp = rinput.getParameter("attach");
|
||||
if (!(vlib.emptyString(tmp)))
|
||||
rinput.setRequestAttribute("postbox.attach","Y");
|
||||
|
||||
// create the slippage view
|
||||
rc = new JSPView("Slippage or Double-Click Detected","conf/slippage.jsp");
|
||||
rc.menuSelector = Content.MENU_SELECTOR_COMMUNITY;
|
||||
|
||||
} // end try
|
||||
catch (e)
|
||||
{ // handle an exception generating the slippage view
|
||||
etype = vlib.exceptionType(e) + "";
|
||||
if (etype.match("HTMLCheckerException"))
|
||||
throw new InternalStateError("spurious HTMLCheckerException thrown");
|
||||
else if (etype.match("DataException"))
|
||||
rc = new ErrorBox("Database Error","Database error generating slippage view: " + e.message,on_error);
|
||||
else if (etype.match("AccessError"))
|
||||
rc = new ErrorBox("Access Error",e.message,on_error);
|
||||
else
|
||||
rc = e;
|
||||
|
||||
} // end catch
|
||||
|
||||
vlib.output(rc);
|
||||
vlib.done();
|
||||
|
||||
} // end if
|
||||
|
||||
rc = null;
|
||||
try
|
||||
{ // actually post the darn thing!
|
||||
msg = topic.postNewMessage(0,rinput.getParameter("pseud"),raw_postdata);
|
||||
|
||||
// If there was no slippage, make sure we mark the new post as "read."
|
||||
if (!(rinput.hasParameter("slip")))
|
||||
topic.fixSeen();
|
||||
|
||||
// Where do we want to go now?
|
||||
tmp = "";
|
||||
if (rinput.isImageButtonClicked("posttopics"))
|
||||
tmp = "conf/topics.js.vs?cc=" + comm.communityID + "&conf=" + conf.confID;
|
||||
else
|
||||
{ // find the topic number to go to next and compute the new URL
|
||||
my_topicnum = -1;
|
||||
if (rinput.isImageButtonClicked("postnext"))
|
||||
my_topicnum = rinput.getParameterShort("next",topic.topicNumber);
|
||||
else
|
||||
my_topicnum = topic.topicNumber;
|
||||
tmp = "conf/posts.js.vs?cc=" + comm.communityID + "&conf=" + conf.confID + "&top=" + my_topicnum
|
||||
+ "&rnm=1";
|
||||
|
||||
} // end else
|
||||
|
||||
if (vlib.emptyString(rinput.getParameter("attach")))
|
||||
rc = new Redirect(tmp,LinkTypes.SERVLET); // bounce straight to our new view!
|
||||
else
|
||||
{ // we need to display the attachment form
|
||||
rinput.setRequestAttribute("attachment.postid",msg.postID + "");
|
||||
rinput.setRequestAttribute("attachment.target",tmp);
|
||||
rc = new JSPView("Upload Attachment","conf/attachment.jsp");
|
||||
rc.menuSelector = Content.MENU_SELECTOR_COMMUNITY;
|
||||
|
||||
} // end else
|
||||
|
||||
} // end try
|
||||
catch (e)
|
||||
{ // handle an error in doing the post
|
||||
etype = vlib.exceptionType(e) + "";
|
||||
if (etype.match("DataException"))
|
||||
rc = new ErrorBox("Database Error","Database error posting message: " + e.message,on_error);
|
||||
else if (etype.match("AccessError"))
|
||||
rc = new ErrorBox("Access Error",e.message,on_error);
|
||||
else
|
||||
rc = e;
|
||||
|
||||
} // end catch
|
||||
|
||||
vlib.output(rc); // all done!
|
||||
90
scripts/conf/poster_report.js
Normal file
90
scripts/conf/poster_report.js
Normal file
@@ -0,0 +1,90 @@
|
||||
// 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):
|
||||
|
||||
importPackage(java.util);
|
||||
importPackage(Packages.com.silverwrist.venice.core);
|
||||
importPackage(Packages.com.silverwrist.venice.except);
|
||||
importPackage(Packages.com.silverwrist.venice.ui);
|
||||
importPackage(Packages.com.silverwrist.venice.ui.conf);
|
||||
importPackage(Packages.com.silverwrist.venice.ui.helpers);
|
||||
importPackage(Packages.com.silverwrist.venice.ui.view);
|
||||
|
||||
// get the request object and the community
|
||||
rinput = bsf.lookupBean("request");
|
||||
comm = rinput.getCommunity(true,"top.js.vs");
|
||||
|
||||
// get the current conference
|
||||
currc = new CurrentConference(rinput);
|
||||
conf = currc.getConference(true,"conf/conferences.js.vs?cc=" + comm.communityID);
|
||||
on_error = "conf/conf_reports.js.vs?cc=" + comm.communityID + "&conf=" + conf.confID;
|
||||
|
||||
// get the current topic (where applicable)
|
||||
topic = currc.getTopic(false,on_error);
|
||||
|
||||
rc = null;
|
||||
try
|
||||
{ // construct the activity list
|
||||
my_list = null;
|
||||
my_title = null;
|
||||
title1 = null;
|
||||
title2 = null;
|
||||
nullmsg = null;
|
||||
if (topic!=null)
|
||||
{ // get the poster list from the topic
|
||||
my_list = topic.getActivePosters();
|
||||
if (my_list.isEmpty())
|
||||
nullmsg = "No posters to topic \"" + topic.name + "\" found.";
|
||||
my_title = "Users Posting in Topic " + topic.name;
|
||||
title1 = "Posters in Topic:";
|
||||
title2 = topic.name;
|
||||
|
||||
} // end if
|
||||
else
|
||||
{ // get the poster list from the conference
|
||||
my_list = conf.getActivePosters();
|
||||
if (my_list.isEmpty())
|
||||
nullmsg = "No posters to conference \"" + vlib.encodeHTML(conf.name) + "\" found.";
|
||||
my_title = "Users Posting in Conference " + conf.name;
|
||||
title1 = "Posters in Conference:";
|
||||
title2 = conf.name;
|
||||
|
||||
} // end else
|
||||
|
||||
// save off the attributes
|
||||
rinput.setRequestAttribute("conference.activity.list",my_list);
|
||||
rinput.setRequestAttribute("conference.activity.nullmessage",nullmsg);
|
||||
rinput.setRequestAttribute("conference.activity.posters",Boolean.TRUE);
|
||||
rinput.setRequestAttribute("conference.activity.title",title1);
|
||||
rinput.setRequestAttribute("conference.activity.subtitle",title2);
|
||||
|
||||
// create the view
|
||||
rc = new JSPView(my_title,"conf/activity_report.jsp");
|
||||
rc.menuSelector = Content.MENU_SELECTOR_COMMUNITY;
|
||||
|
||||
} // end try
|
||||
catch (e)
|
||||
{ // error getting the list of posters
|
||||
etype = vlib.exceptionType(e) + "";
|
||||
if (etype.match("DataException"))
|
||||
rc = new ErrorBox("Database Error","Database error getting poster list: " + e.message,on_error);
|
||||
else if (etype.match("AccessError"))
|
||||
rc = new ErrorBox("Access Error",e.message,on_error);
|
||||
else
|
||||
rc = e;
|
||||
|
||||
} // end catch
|
||||
|
||||
vlib.output(rc); // all done...
|
||||
143
scripts/conf/posts.js
Normal file
143
scripts/conf/posts.js
Normal file
@@ -0,0 +1,143 @@
|
||||
// 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):
|
||||
|
||||
importClass(java.awt.Dimension);
|
||||
importPackage(java.util);
|
||||
importPackage(Packages.com.silverwrist.venice.core);
|
||||
importPackage(Packages.com.silverwrist.venice.except);
|
||||
importPackage(Packages.com.silverwrist.venice.ui);
|
||||
importPackage(Packages.com.silverwrist.venice.ui.conf);
|
||||
importPackage(Packages.com.silverwrist.venice.ui.conf.view);
|
||||
importPackage(Packages.com.silverwrist.venice.ui.helpers);
|
||||
|
||||
SCALING_NUM = 1;
|
||||
SCALING_DENOM = 2;
|
||||
|
||||
// get the request object and the community
|
||||
rinput = bsf.lookupBean("request");
|
||||
comm = rinput.getCommunity(true,"top.js.vs");
|
||||
|
||||
// get the current conference
|
||||
currc = new CurrentConference(rinput);
|
||||
conf = currc.getConference(true,"conf/conferences.js.vs?cc=" + comm.communityID);
|
||||
|
||||
// get the current topic
|
||||
on_error = "conf/topics.js.vs?cc=" + comm.communityID + "&conf=" + conf.confID;
|
||||
topic = currc.getTopic(true,on_error);
|
||||
|
||||
// if we need to restore posts in another topic, do so
|
||||
read_new = true;
|
||||
if (rinput.hasParameter("rtop") && rinput.hasParameter("rct"))
|
||||
{ // retrieve the "other topic"
|
||||
other_topic = currc.getOptionalTopic("rtop");
|
||||
if (other_topic!=null)
|
||||
{ // get the number of unread messages
|
||||
nunread = rinput.getParameterInt("rct",0);
|
||||
if ((nunread>0) && (nunread<=other_topic.totalMessages))
|
||||
{ // set the unread message count
|
||||
try
|
||||
{ // reset the unread messages
|
||||
other_topic.unreadMessages = nunread;
|
||||
|
||||
} // end try
|
||||
catch (e)
|
||||
{ // it didn't work - ignore the error
|
||||
logger.warn("exception setting unread messages: " + e);
|
||||
|
||||
} // end catch
|
||||
|
||||
if (topic.topicID==other_topic.topicID)
|
||||
read_new = false; // don't do a read new if we just restored this topic
|
||||
|
||||
} // end if
|
||||
else // ignore this
|
||||
logger.warn("number of unread messages out of range");
|
||||
|
||||
} // end if
|
||||
|
||||
} // end if
|
||||
|
||||
// get the post interval
|
||||
piv = currc.getPostInterval(on_error);
|
||||
|
||||
// get the "read new" parameter
|
||||
if (read_new)
|
||||
read_new = rinput.hasParameter("rnm");
|
||||
|
||||
rc = null;
|
||||
try
|
||||
{ // create the view
|
||||
rc = new PostsView(comm,currc);
|
||||
logger.debug(rc.unread + " unread messages");
|
||||
|
||||
// fill in parameters
|
||||
rc.first = piv.first;
|
||||
rc.last = piv.last;
|
||||
rc.showAdvanced = rinput.hasParameter("shac");
|
||||
rc.noBozos = rinput.hasParameter("nbz");
|
||||
rc.messages = topic.getMessages(piv.first,piv.last);
|
||||
rc.topCustom = conf.getCustomBlock(ConferenceContext.CUST_BLOCK_TOP);
|
||||
rc.bottomCustom = conf.getCustomBlock(ConferenceContext.CUST_BLOCK_BOTTOM);
|
||||
rc.title = topic.name;
|
||||
rc.subtitle = topic.totalMessages + " Total; " + rc.unread + " New; Last: "
|
||||
+ rinput.formatDate(topic.lastUpdateDate);
|
||||
|
||||
// do a "read new" on this topic
|
||||
if (read_new)
|
||||
topic.unreadMessages = 0;
|
||||
|
||||
// visit the topic
|
||||
visit_order = currc.getTopicVisitOrder();
|
||||
if (visit_order!=null)
|
||||
visit_order.visit(topic.topicNumber);
|
||||
rc.topicVisitOrder = visit_order;
|
||||
|
||||
// get the aliases list and synthesize the topic stem and QID
|
||||
aliases = conf.aliases;
|
||||
tmp = aliases.get(0).toString() + "." + topic.topicNumber;
|
||||
rc.topicStem = tmp + ".";
|
||||
rc.pageQID = "go/" + comm.alias + "!" + tmp;
|
||||
|
||||
if (conf.displayPostPictures() && rinput.user.displayPostPictures())
|
||||
{ // set up the user p[hoto dimensions
|
||||
old_psz = rinput.engine.getUserPhotoSize();
|
||||
rc.photoDims = new Dimension((old_psz.width * SCALING_NUM) / SCALING_DENOM,
|
||||
(old_psz.height * SCALING_NUM) / SCALING_DENOM);
|
||||
|
||||
} // end if
|
||||
|
||||
rc.buildInternals(rinput.user); // build the bozo filter and user photo lists in compiled code
|
||||
|
||||
} // end try
|
||||
catch (e)
|
||||
{ // handle an exception here
|
||||
etype = vlib.exceptionType(e) + "";
|
||||
if (etype.match("DataException"))
|
||||
rc = new ErrorBox("Database Error","Database error listing messages: " + e.message,on_error);
|
||||
else if (etype.match("AccessError"))
|
||||
{ // unable to get message list - maybe we weren't logged in
|
||||
if (rinput.user.isLoggedIn())
|
||||
rc = new ErrorBox("Access Error",e.message,on_error);
|
||||
else
|
||||
rc = new LogInOrCreate();
|
||||
|
||||
} // end else if
|
||||
else
|
||||
rc = e;
|
||||
|
||||
} // end catch
|
||||
|
||||
vlib.output(rc); // all done!
|
||||
60
scripts/conf/publish_message.js
Normal file
60
scripts/conf/publish_message.js
Normal file
@@ -0,0 +1,60 @@
|
||||
// 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):
|
||||
|
||||
importPackage(java.util);
|
||||
importPackage(Packages.com.silverwrist.venice.core);
|
||||
importPackage(Packages.com.silverwrist.venice.except);
|
||||
importPackage(Packages.com.silverwrist.venice.ui);
|
||||
importPackage(Packages.com.silverwrist.venice.ui.conf);
|
||||
importPackage(Packages.com.silverwrist.venice.ui.helpers);
|
||||
|
||||
// get the request object and the community
|
||||
rinput = bsf.lookupBean("request");
|
||||
comm = rinput.getCommunity(true,"top.js.vs");
|
||||
|
||||
// get the current conference
|
||||
currc = new CurrentConference(rinput);
|
||||
conf = currc.getConference(true,"conf/conferences.js.vs?cc=" + comm.communityID);
|
||||
|
||||
// get the current topic
|
||||
topic = currc.getTopic(true,"conf/topics.js.vs?cc=" + comm.communityID + "&conf=" + conf.confID);
|
||||
|
||||
// get the message under consideration
|
||||
msg = currc.getTopicMessageParam("msg",true,"conf/posts.js.vs?cc=" + comm.communityID + "&conf="
|
||||
+ conf.confID + "&top=" + topic.topicNumber);
|
||||
on_error = "conf/posts.js.vs?cc=" + comm.communityID + "&conf=" + conf.confID + "&top=" + topic.topicNumber
|
||||
+ "&p1=" + msg.getPostNumber() + "&shac=1";
|
||||
|
||||
rc = null;
|
||||
try
|
||||
{ // publish it!
|
||||
msg.publish();
|
||||
rc = new Redirect(on_error,LinkTypes.SERVLET);
|
||||
|
||||
} // end try
|
||||
catch (e)
|
||||
{ // error publishing
|
||||
etype = vlib.exceptionType(e) + "";
|
||||
if (etype.match("DataException"))
|
||||
rc = new ErrorBox("Database Error","Database error publishing message: " + e.message,on_error);
|
||||
else if (etype.match("AccessError"))
|
||||
rc = new ErrorBox("Access Error",e.message,on_error);
|
||||
else
|
||||
rc = e;
|
||||
|
||||
} // end catch
|
||||
|
||||
vlib.output(rc); // all done!
|
||||
66
scripts/conf/read_new.js
Normal file
66
scripts/conf/read_new.js
Normal 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):
|
||||
|
||||
importPackage(java.util);
|
||||
importPackage(Packages.com.silverwrist.venice.core);
|
||||
importPackage(Packages.com.silverwrist.venice.except);
|
||||
importPackage(Packages.com.silverwrist.venice.ui);
|
||||
importPackage(Packages.com.silverwrist.venice.ui.conf);
|
||||
importPackage(Packages.com.silverwrist.venice.ui.helpers);
|
||||
|
||||
// get the request object and the community
|
||||
rinput = bsf.lookupBean("request");
|
||||
comm = rinput.getCommunity(true,"top.js.vs");
|
||||
|
||||
// get the current conference
|
||||
currc = new CurrentConference(rinput);
|
||||
conf = currc.getConference(true,"conf/conferences.js.vs?cc=" + comm.communityID);
|
||||
|
||||
rc = null;
|
||||
try
|
||||
{ // get the topic list, using the current view and sort options
|
||||
topic_list = conf.getTopicList(currc.viewOption,currc.sortOption);
|
||||
|
||||
// initialize and return the topic visit order
|
||||
ord = currc.newTopicVisitOrder(topic_list);
|
||||
|
||||
if (ord.isNext()) // retrieve the first topic number from the list and bounce directly there
|
||||
rc = new Redirect("conf/posts.js.vs?cc=" + comm.communityID + "&conf=" + conf.confID + "&top="
|
||||
+ ord.getNext() + "&rnm=1",LinkTypes.SERVLET);
|
||||
else // no unread messages - bounce to the topics list
|
||||
rc = new Redirect("conf/topics.js.vs?cc=" + comm.communityID + "&conf=" + conf.confID,LinkTypes.SERVLET);
|
||||
|
||||
} // end try
|
||||
catch (e)
|
||||
{ // error generating the topic list
|
||||
etype = vlib.exceptionType(e) + "";
|
||||
if (etype.match("DataException"))
|
||||
rc = new ErrorBox("Database Error","Database error listing topics: " + e.message,
|
||||
"conf/conferences.js.vs?cc=" + comm.communityID);
|
||||
else if (etype.match("AccessError"))
|
||||
{ // they might not be logged in, that's all
|
||||
if (rinput.user.isLoggedIn())
|
||||
rc = new ErrorBox("Access Error",e.message,"conf/conferences.js.vs?cc=" + comm.communityID);
|
||||
else
|
||||
rc = new LogInOrCreate();
|
||||
|
||||
} // end else if
|
||||
else
|
||||
rc = e;
|
||||
|
||||
} // end catch
|
||||
|
||||
vlib.output(rc);
|
||||
58
scripts/conf/remove_bozo.js
Normal file
58
scripts/conf/remove_bozo.js
Normal file
@@ -0,0 +1,58 @@
|
||||
// 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):
|
||||
|
||||
importPackage(java.util);
|
||||
importPackage(Packages.com.silverwrist.venice.core);
|
||||
importPackage(Packages.com.silverwrist.venice.except);
|
||||
importPackage(Packages.com.silverwrist.venice.ui);
|
||||
importPackage(Packages.com.silverwrist.venice.ui.conf);
|
||||
importPackage(Packages.com.silverwrist.venice.ui.helpers);
|
||||
|
||||
// get the request object and the community
|
||||
rinput = bsf.lookupBean("request");
|
||||
comm = rinput.getCommunity(true,"top.js.vs");
|
||||
|
||||
// get the current conference
|
||||
currc = new CurrentConference(rinput);
|
||||
conf = currc.getConference(true,"conf/conferences.js.vs?cc=" + comm.communityID);
|
||||
|
||||
// get the current topic
|
||||
topic = currc.getTopic(true,"conf/topics.js.vs?cc=" + comm.communityID + "&conf=" + conf.confID);
|
||||
on_error = "conf/manage_topic.js.vs?cc=" + comm.communityID + "&conf=" + conf.confID + "&top="
|
||||
+ topic.topicNumber;
|
||||
|
||||
rc = null;
|
||||
try
|
||||
{ // get the UID and clear the bozo status
|
||||
uid = rinput.getParameterInt("u",-1);
|
||||
if (uid>0)
|
||||
topic.setBozo(uid,false);
|
||||
|
||||
// bounce back to the Manage Topics display
|
||||
rc = new Redirect(on_error,LinkTypes.SERVLET);
|
||||
|
||||
} // end try
|
||||
catch (e)
|
||||
{ // handle an error message
|
||||
etype = vlib.exceptionType(e) + "";
|
||||
if (etype.match("DataException"))
|
||||
rc = new ErrorBox("Database Error","Database error setting filter: " + e.message,on_error);
|
||||
else
|
||||
rc = e;
|
||||
|
||||
} // end catch
|
||||
|
||||
vlib.output(rc); // all done
|
||||
60
scripts/conf/scribble_message.js
Normal file
60
scripts/conf/scribble_message.js
Normal file
@@ -0,0 +1,60 @@
|
||||
// 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):
|
||||
|
||||
importPackage(java.util);
|
||||
importPackage(Packages.com.silverwrist.venice.core);
|
||||
importPackage(Packages.com.silverwrist.venice.except);
|
||||
importPackage(Packages.com.silverwrist.venice.ui);
|
||||
importPackage(Packages.com.silverwrist.venice.ui.conf);
|
||||
importPackage(Packages.com.silverwrist.venice.ui.helpers);
|
||||
|
||||
// get the request object and the community
|
||||
rinput = bsf.lookupBean("request");
|
||||
comm = rinput.getCommunity(true,"top.js.vs");
|
||||
|
||||
// get the current conference
|
||||
currc = new CurrentConference(rinput);
|
||||
conf = currc.getConference(true,"conf/conferences.js.vs?cc=" + comm.communityID);
|
||||
|
||||
// get the current topic
|
||||
topic = currc.getTopic(true,"conf/topics.js.vs?cc=" + comm.communityID + "&conf=" + conf.confID);
|
||||
|
||||
// get the message under consideration
|
||||
msg = currc.getTopicMessageParam("msg",true,"conf/posts.js.vs?cc=" + comm.communityID + "&conf="
|
||||
+ conf.confID + "&top=" + topic.topicNumber);
|
||||
on_error = "conf/posts.js.vs?cc=" + comm.communityID + "&conf=" + conf.confID + "&top=" + topic.topicNumber
|
||||
+ "&p1=" + msg.getPostNumber() + "&shac=1";
|
||||
|
||||
rc = null;
|
||||
try
|
||||
{ // scribble it!
|
||||
msg.scribble();
|
||||
rc = new Redirect(on_error,LinkTypes.SERVLET);
|
||||
|
||||
} // end try
|
||||
catch (e)
|
||||
{ // error scribbling
|
||||
etype = vlib.exceptionType(e) + "";
|
||||
if (etype.match("DataException"))
|
||||
rc = new ErrorBox("Database Error","Database error scribbling message: " + e.message,on_error);
|
||||
else if (etype.match("AccessError"))
|
||||
rc = new ErrorBox("Access Error",e.message,on_error);
|
||||
else
|
||||
rc = e;
|
||||
|
||||
} // end catch
|
||||
|
||||
vlib.output(rc); // all done!
|
||||
53
scripts/conf/set_pseud.js
Normal file
53
scripts/conf/set_pseud.js
Normal file
@@ -0,0 +1,53 @@
|
||||
// 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):
|
||||
|
||||
importPackage(Packages.com.silverwrist.venice.core);
|
||||
importPackage(Packages.com.silverwrist.venice.except);
|
||||
importPackage(Packages.com.silverwrist.venice.ui);
|
||||
importPackage(Packages.com.silverwrist.venice.ui.conf);
|
||||
importPackage(Packages.com.silverwrist.venice.ui.helpers);
|
||||
|
||||
// get the request object and the community
|
||||
rinput = bsf.lookupBean("request");
|
||||
comm = rinput.getCommunity(true,"top.js.vs");
|
||||
|
||||
// get the current conference
|
||||
currc = new CurrentConference(rinput);
|
||||
conf = currc.getConference(true,"conf/manage_conf.js.vs?cc=" + comm.communityID);
|
||||
|
||||
rc = null;
|
||||
try
|
||||
{ // change the default pseud
|
||||
pseud = rinput.getParameter("pseud");
|
||||
if (pseud!=null)
|
||||
conf.defaultPseud = pseud;
|
||||
|
||||
// don't change the current view
|
||||
rc = new NullResponse();
|
||||
|
||||
} // end try
|
||||
catch (e)
|
||||
{ // error resetting the pseud
|
||||
etype = vlib.exceptionType(e) + "";
|
||||
if (etype.match("DataException"))
|
||||
rc = new ErrorBox("Database Error","Database error setting pseud: " + e.message,
|
||||
"conf/manage_conf.js.vs?cc=" + comm.communityID + "&conf=" + conf.confID);
|
||||
else
|
||||
rc = e;
|
||||
|
||||
} // end catch
|
||||
|
||||
vlib.output(rc); // all done!
|
||||
57
scripts/conf/subscribe_topic.js
Normal file
57
scripts/conf/subscribe_topic.js
Normal file
@@ -0,0 +1,57 @@
|
||||
// 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):
|
||||
|
||||
importPackage(java.util);
|
||||
importPackage(Packages.com.silverwrist.venice.core);
|
||||
importPackage(Packages.com.silverwrist.venice.except);
|
||||
importPackage(Packages.com.silverwrist.venice.ui);
|
||||
importPackage(Packages.com.silverwrist.venice.ui.conf);
|
||||
importPackage(Packages.com.silverwrist.venice.ui.helpers);
|
||||
|
||||
// get the request object and the community
|
||||
rinput = bsf.lookupBean("request");
|
||||
comm = rinput.getCommunity(true,"top.js.vs");
|
||||
|
||||
// get the current conference
|
||||
currc = new CurrentConference(rinput);
|
||||
conf = currc.getConference(true,"conf/conferences.js.vs?cc=" + comm.communityID);
|
||||
|
||||
// get the current topic
|
||||
topic = currc.getTopic(true,"conf/topics.js.vs?cc=" + comm.communityID + "&conf=" + conf.confID);
|
||||
on_error = "conf/manage_topic.js.vs?cc=" + comm.communityID + "&conf=" + conf.confID + "&top="
|
||||
+ topic.topicNumber;
|
||||
|
||||
rc = null;
|
||||
try
|
||||
{ // get the flag and set the archived status
|
||||
flag = rinput.getParameterInt("flag",0);
|
||||
topic.setSubscribed(flag==1);
|
||||
rc = new Redirect(on_error,LinkTypes.SERVLET);
|
||||
|
||||
} // end try
|
||||
catch (e)
|
||||
{ // error setting the hide topic
|
||||
etype = vlib.exceptionType(e) + "";
|
||||
if (etype.match("DataException"))
|
||||
rc = new ErrorBox("Database Error","Database error setting subscription status: " + e.message,on_error);
|
||||
else if (etype.match("AccessError"))
|
||||
rc = new ErrorBox("Access Error",e.message,on_error);
|
||||
else
|
||||
rc = e;
|
||||
|
||||
} // end catch
|
||||
|
||||
vlib.output(rc); // all done!
|
||||
125
scripts/conf/topics.js
Normal file
125
scripts/conf/topics.js
Normal file
@@ -0,0 +1,125 @@
|
||||
// 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):
|
||||
|
||||
importPackage(java.util);
|
||||
importPackage(Packages.com.silverwrist.venice.core);
|
||||
importPackage(Packages.com.silverwrist.venice.except);
|
||||
importPackage(Packages.com.silverwrist.venice.ui);
|
||||
importPackage(Packages.com.silverwrist.venice.ui.conf);
|
||||
importPackage(Packages.com.silverwrist.venice.ui.helpers);
|
||||
importPackage(Packages.com.silverwrist.venice.ui.view);
|
||||
|
||||
// get the request object and the community
|
||||
rinput = bsf.lookupBean("request");
|
||||
comm = rinput.getCommunity(true,"top.js.vs");
|
||||
|
||||
// get the current conference
|
||||
currc = new CurrentConference(rinput);
|
||||
conf = currc.getConference(true,"conf/conferences.js.vs?cc=" + comm.communityID);
|
||||
|
||||
// get the view option
|
||||
view_opt = currc.viewOption;
|
||||
if (rinput.hasParameter("view"))
|
||||
{ // get the new view option
|
||||
view_opt = rinput.getParameterInt("view",view_opt);
|
||||
if ( (view_opt!=ConferenceContext.DISPLAY_NEW) && (view_opt!=ConferenceContext.DISPLAY_ACTIVE)
|
||||
&& (view_opt!=ConferenceContext.DISPLAY_ALL) && (view_opt!=ConferenceContext.DISPLAY_HIDDEN)
|
||||
&& (view_opt!=ConferenceContext.DISPLAY_ARCHIVED))
|
||||
{ // the view option is invalid
|
||||
vlib.output(new ErrorBox(null,"Invalid view parameter.","conf/conferences.js.vs?cc=" + comm.communityID));
|
||||
vlib.done();
|
||||
|
||||
} // end if
|
||||
|
||||
currc.viewOption = view_opt; // save the changed view option
|
||||
|
||||
} // end if
|
||||
|
||||
// get the sort option
|
||||
sort_opt = currc.sortOption;
|
||||
if (rinput.hasParameter("sort"))
|
||||
{ // get and test the new sort option
|
||||
sort_opt = rinput.getParameterInt("sort",sort_opt);
|
||||
tmp_sort = ((sort_opt<0) ? -sort_opt : sort_opt);
|
||||
if ( (tmp_sort!=ConferenceContext.SORT_NUMBER) && (tmp_sort!=ConferenceContext.SORT_NAME)
|
||||
&& (tmp_sort!=ConferenceContext.SORT_UNREAD) && (tmp_sort!=ConferenceContext.SORT_TOTAL)
|
||||
&& (tmp_sort!=ConferenceContext.SORT_DATE))
|
||||
{ // the sort option is invalid
|
||||
vlib.output(new ErrorBox(null,"Invalid sort parameter.","conf/conferences.js.vs?cc=" + comm.communityID));
|
||||
vlib.done();
|
||||
|
||||
} // end if
|
||||
|
||||
currc.sortOption = sort_opt; // save the changed sort option
|
||||
|
||||
} // end if
|
||||
|
||||
rc = null;
|
||||
try
|
||||
{ // get the topic list
|
||||
topic_list = conf.getTopicList(view_opt,sort_opt);
|
||||
|
||||
// initialize the visit order
|
||||
ord = currc.newTopicVisitOrder(topic_list);
|
||||
|
||||
// get the aliases list...
|
||||
aliases = conf.aliases;
|
||||
|
||||
// set the attributes we want to carry into the page
|
||||
rinput.setRequestAttribute("topics.list",topic_list);
|
||||
tmp = conf.getCustomBlock(ConferenceContext.CUST_BLOCK_TOP);
|
||||
if (tmp==null)
|
||||
tmp = "";
|
||||
rinput.setRequestAttribute("conference.custom.top",tmp);
|
||||
tmp = conf.getCustomBlock(ConferenceContext.CUST_BLOCK_BOTTOM);
|
||||
if (tmp==null)
|
||||
tmp = "";
|
||||
rinput.setRequestAttribute("conference.custom.bottom",tmp);
|
||||
if (ord.isNext())
|
||||
{ // precalculate the "Read New" link and pass it to the page
|
||||
tmp = "conf/posts.js.vs?cc=" + comm.communityID + "&conf=" + conf.confID + "&top=" + ord.getNext()
|
||||
+ "&rnm=1";
|
||||
rinput.setRequestAttribute("conference.readnew",tmp);
|
||||
|
||||
} // end if
|
||||
|
||||
// create a JSPView to return
|
||||
rc = new JSPView("Topics in " + conf.name,"conf/topics.jsp");
|
||||
rc.menuSelector = Content.MENU_SELECTOR_COMMUNITY;
|
||||
rc.pageQID = "go/" + comm.alias + "!" + aliases.get(0);
|
||||
|
||||
} // end try
|
||||
catch (e)
|
||||
{ // error generating the topic list
|
||||
etype = vlib.exceptionType(e) + "";
|
||||
if (etype.match("DataException"))
|
||||
rc = new ErrorBox("Database Error","Database error listing topics: " + e.message,
|
||||
"conf/conferences.js.vs?cc=" + comm.communityID);
|
||||
else if (etype.match("AccessError"))
|
||||
{ // they might not be logged in, that's all
|
||||
if (rinput.user.isLoggedIn())
|
||||
rc = new ErrorBox("Access Error",e.message,"conf/conferences.js.vs?cc=" + comm.communityID);
|
||||
else
|
||||
rc = new LogInOrCreate();
|
||||
|
||||
} // end else if
|
||||
else
|
||||
rc = e;
|
||||
|
||||
} // end catch
|
||||
|
||||
vlib.output(rc);
|
||||
|
||||
84
scripts/conf/upload_attachment.js
Normal file
84
scripts/conf/upload_attachment.js
Normal file
@@ -0,0 +1,84 @@
|
||||
// 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):
|
||||
|
||||
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!
|
||||
56
scripts/conf/view_attachment.js
Normal file
56
scripts/conf/view_attachment.js
Normal file
@@ -0,0 +1,56 @@
|
||||
// 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):
|
||||
|
||||
importPackage(java.util);
|
||||
importPackage(Packages.com.silverwrist.venice.core);
|
||||
importPackage(Packages.com.silverwrist.venice.except);
|
||||
importPackage(Packages.com.silverwrist.venice.ui);
|
||||
importPackage(Packages.com.silverwrist.venice.ui.conf);
|
||||
importPackage(Packages.com.silverwrist.venice.ui.helpers);
|
||||
|
||||
// get the request object and the community
|
||||
rinput = bsf.lookupBean("request");
|
||||
comm = rinput.getCommunity(true,"top.js.vs");
|
||||
|
||||
// get the current conference
|
||||
currc = new CurrentConference(rinput);
|
||||
conf = currc.getConference(true,"conf/conferences.js.vs?cc=" + comm.communityID);
|
||||
|
||||
// get the message we're looking in
|
||||
msg = currc.getMessageParam("msg",true,"conf/topics.js.vs?cc=" + comm.communityID + "&conf=" + conf.confID);
|
||||
|
||||
rc = null;
|
||||
try
|
||||
{ // retrieve the attachment data and send it out
|
||||
if (msg.hasAttachment())
|
||||
rc = new AttachmentContent(msg);
|
||||
else
|
||||
rc = new ErrorBox(null,"This message has no attachment.",null);
|
||||
|
||||
} // end try
|
||||
catch (e)
|
||||
{ // failure in retrieving attachment
|
||||
etype = vlib.exceptionType(e) + "";
|
||||
if (etype.match("DataException"))
|
||||
rc = new ErrorBox("Database Error","Database error retrieving attachment: " + e.message,on_error);
|
||||
else if (etype.match("AccessError"))
|
||||
rc = new ErrorBox("Access Error",e.message,on_error);
|
||||
else
|
||||
rc = e;
|
||||
|
||||
} // end catch
|
||||
|
||||
vlib.output(rc); // all done!
|
||||
214
scripts/find.js
Normal file
214
scripts/find.js
Normal file
@@ -0,0 +1,214 @@
|
||||
// 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):
|
||||
|
||||
importPackage(Packages.com.silverwrist.venice.core);
|
||||
importPackage(Packages.com.silverwrist.venice.except);
|
||||
importPackage(Packages.com.silverwrist.venice.ui);
|
||||
importPackage(Packages.com.silverwrist.venice.ui.helpers);
|
||||
importPackage(Packages.com.silverwrist.venice.ui.view);
|
||||
|
||||
rinput = bsf.lookupBean("request");
|
||||
|
||||
// Determine which Find display needs to be brought up.
|
||||
disp = 0;
|
||||
if (rinput.hasParameter("disp"))
|
||||
{ // get the display parameter from the input
|
||||
disp = rinput.getParameterInt("disp",-1);
|
||||
if ( (disp!=FindView.FD_COMMUNITIES) && (disp!=FindView.FD_USERS) && (disp!=FindView.FD_CATEGORIES)
|
||||
&& (disp!=FindView.FD_POSTS))
|
||||
{ // the display parameter is not correct
|
||||
vlib.output(new ErrorBox(null,"Invalid display parameter.","top.js.vs"));
|
||||
vlib.done();
|
||||
|
||||
} // end if
|
||||
|
||||
// save off the session attribute
|
||||
rinput.setSessionAttribute(FindView.DISPLAY_PARAM_ATTRIBUTE,new java.lang.Integer(disp));
|
||||
|
||||
} // end if
|
||||
else
|
||||
{ // get the display parameter from the session attributes
|
||||
tmp_disp = rinput.getSessionAttribute(FindView.DISPLAY_PARAM_ATTRIBUTE);
|
||||
if (tmp_disp==null)
|
||||
{ // make a new entry and set it
|
||||
tmp_disp = new java.lang.Integer(FindView.FD_COMMUNITIES);
|
||||
rinput.setSessionAttribute(FindView.DISPLAY_PARAM_ATTRIBUTE,tmp_disp);
|
||||
|
||||
} // end if
|
||||
|
||||
disp = tmp_disp.intValue();
|
||||
|
||||
} // end else
|
||||
|
||||
max_results = rinput.engine.getStdNumSearchResults();
|
||||
view = new FindView(disp,max_results); // create the view object
|
||||
|
||||
rc = null;
|
||||
if ("GET"==rinput.verb)
|
||||
{ // set up the category parameter
|
||||
catid = -1;
|
||||
if (disp==FindView.FD_COMMUNITIES)
|
||||
catid = rinput.getParameterInt("cat",-1);
|
||||
|
||||
try
|
||||
{ // prep the view fields
|
||||
if (disp==FindView.FD_COMMUNITIES)
|
||||
{ // set the category (which also sets up the subcategory list and contained communities)
|
||||
view.category = rinput.user.getCategoryDescriptor(catid);
|
||||
if (view.category.categoryID>=0)
|
||||
{ // fill in the communities that are in this category
|
||||
view.results = rinput.user.getCommunitiesInCategory(view.category,view.offset,max_results);
|
||||
view.findCount = rinput.user.getNumCommunitiesInCategory(view.category);
|
||||
|
||||
} // end if
|
||||
|
||||
view.field = SearchMode.FIELD_COMMUNITY_NAME;
|
||||
|
||||
} // end if
|
||||
else if (disp==FindView.FD_USERS)
|
||||
view.field = SearchMode.FIELD_USER_NAME;
|
||||
view.mode = SearchMode.SEARCH_PREFIX;
|
||||
view.term = "";
|
||||
rc = view;
|
||||
|
||||
} // end try
|
||||
catch (e)
|
||||
{ // exception in initializing the view...
|
||||
etype = vlib.exceptionType(e) + "";
|
||||
if (etype.match("DataException"))
|
||||
rc = new ErrorBox("Database Error","Database error accessing category data: " + e.message,"top.js.vs");
|
||||
else
|
||||
rc = e;
|
||||
|
||||
} // end catch
|
||||
|
||||
vlib.output(rc);
|
||||
vlib.done();
|
||||
|
||||
} // end if ("GET" operation)
|
||||
|
||||
// Set up the form for a POST.
|
||||
try
|
||||
{ // load some of the parameters
|
||||
catid = -1;
|
||||
|
||||
if (disp==FindView.FD_COMMUNITIES)
|
||||
{ // load the category ID and field parameters
|
||||
catid = rinput.getParameterInt("cat",-1);
|
||||
if (!(rinput.engine.isValidCategoryID(catid)))
|
||||
throw new ValidationException("The category ID parameter is not valid.");
|
||||
x = rinput.getParameterInt("field",SearchMode.FIELD_COMMUNITY_NAME);
|
||||
if ((x!=SearchMode.FIELD_COMMUNITY_NAME) && (x!=SearchMode.FIELD_COMMUNITY_SYNOPSIS))
|
||||
throw new ValidationException("The search field parameter is not valid.");
|
||||
view.field = x;
|
||||
|
||||
} // end if
|
||||
else if (disp==FindView.FD_USERS)
|
||||
{ // load the field parameter
|
||||
x = rinput.getParameterInt("field",SearchMode.FIELD_USER_NAME);
|
||||
if ( (x!=SearchMode.FIELD_USER_NAME) && (x!=SearchMode.FIELD_USER_DESCRIPTION)
|
||||
&& (x!=SearchMode.FIELD_USER_GIVEN_NAME) && (x!=SearchMode.FIELD_USER_FAMILY_NAME))
|
||||
throw new ValidationException("The search field parameter is not valid.");
|
||||
view.field = x;
|
||||
|
||||
} // end else if
|
||||
|
||||
if (disp!=FindView.FD_POSTS)
|
||||
{ // load the search mode parameter
|
||||
x = rinput.getParameterInt("mode",SearchMode.SEARCH_PREFIX);
|
||||
if ((x!=SearchMode.SEARCH_PREFIX) && (x!=SearchMode.SEARCH_SUBSTRING) && (x!=SearchMode.SEARCH_REGEXP))
|
||||
throw new ValidationException("The search mode parameter is not valid.");
|
||||
view.mode = x;
|
||||
|
||||
} // end if
|
||||
|
||||
// load the search term, offset and find count
|
||||
view.term = rinput.getParameter("term");
|
||||
view.offset = rinput.getParameterInt("ofs",0);
|
||||
view.findCount = rinput.getParameterInt("fcount",-1);
|
||||
|
||||
// adjust the offset based on the command button click
|
||||
if (rinput.isImageButtonClicked("search"))
|
||||
view.offset = 0;
|
||||
else if (rinput.isImageButtonClicked("previous"))
|
||||
view.offset = Math.max(view_offset - max_results,0);
|
||||
else if (rinput.isImageButtonClicked("next"))
|
||||
view.offset = view.offset + max_results;
|
||||
else
|
||||
throw new ValidationException("Unable to determine what action triggered the form.");
|
||||
|
||||
// run the actual search!
|
||||
if (disp==FindView.FD_COMMUNITIES)
|
||||
{ // need to work it differently if there's a category ID
|
||||
if (catid>=0)
|
||||
{ // set up the category
|
||||
view.category = rinput.user.getCategoryDescriptor(catid);
|
||||
if (view.category.categoryID>=0)
|
||||
{ // fill in the communities that are in this category
|
||||
view.results = rinput.user.getCommunitiesInCategory(view.category,view.offset,max_results);
|
||||
view.findCount = rinput.user.getNumCommunitiesInCategory(view.category);
|
||||
|
||||
} // end if
|
||||
|
||||
} // end if
|
||||
else
|
||||
{ // set the results as the community search data
|
||||
view.results = rinput.user.searchForCommunities(view.field,view.mode,view.term,view.offset,max_results);
|
||||
if (view.findCount<0)
|
||||
view.findCount = rinput.user.getSearchCommunityCount(view.field,view.mode,view.term);
|
||||
|
||||
} // end else
|
||||
|
||||
} // end if
|
||||
else if (disp==FindView.FD_USERS)
|
||||
{ // search for users
|
||||
view.results = rinput.engine.searchForUsers(view.field,view.mode,view.term,view.offset,max_results);
|
||||
if (view.findCount<0)
|
||||
view.findCount = rinput.engine.getSearchUserCount(view.field,view.mode,view.term);
|
||||
|
||||
} // end else if
|
||||
else if (disp==FindView.FD_CATEGORIES)
|
||||
{ // search for categories
|
||||
view.results = rinput.user.searchForCategories(view.mode,view.term,view.offset,max_results);
|
||||
if (view.findCount<0)
|
||||
view.findCount = rinput.user.getSearchCategoryCount(view.mode,view.term);
|
||||
|
||||
} // end else if
|
||||
else if (disp==FindView.FD_POSTS)
|
||||
{ // search for posts
|
||||
view.results = rinput.user.searchPosts(view.term,view.offset,max_results);
|
||||
if (view.findCount<0)
|
||||
view.findCount = rinput.user.getSearchPostCount(view.term);
|
||||
|
||||
} // end else if
|
||||
|
||||
rinput.location = "find.js.vs?disp=" + disp; // reset location for the POST
|
||||
rc = view;
|
||||
|
||||
} // end try
|
||||
catch (e)
|
||||
{ // exception thrown somewhere in the POST operation
|
||||
etype = vlib.exceptionType(e) + "";
|
||||
if (etype.match("ValidationException"))
|
||||
rc = new ErrorBox("Find Error",e.message,"top.js.vs");
|
||||
else if (etype.match("DataException"))
|
||||
rc = new ErrorBox("Database Error","Database error on find: " + e.message,"top.js.vs");
|
||||
else
|
||||
rc = e;
|
||||
|
||||
} // end catch
|
||||
|
||||
vlib.output(rc); // all done!
|
||||
137
scripts/login.js
Normal file
137
scripts/login.js
Normal file
@@ -0,0 +1,137 @@
|
||||
// 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):
|
||||
|
||||
importPackage(Packages.com.silverwrist.venice.core);
|
||||
importPackage(Packages.com.silverwrist.venice.except);
|
||||
importPackage(Packages.com.silverwrist.venice.ui);
|
||||
importPackage(Packages.com.silverwrist.venice.ui.dlg);
|
||||
importPackage(Packages.com.silverwrist.venice.ui.helpers);
|
||||
|
||||
// Get the request object and the target URI.
|
||||
rinput = bsf.lookupBean("request");
|
||||
target = rinput.getParameter("tgt");
|
||||
if (target==null)
|
||||
target = "top.js.vs";
|
||||
|
||||
// If the user is already logged in, this script is a no-op - just bounce to the specified target.
|
||||
user = rinput.user;
|
||||
if (user.isLoggedIn())
|
||||
{ // user already logged in - just bail on this
|
||||
vlib.output(new Redirect(target,LinkTypes.SERVLET));
|
||||
vlib.done();
|
||||
|
||||
} // end if
|
||||
|
||||
dlg = rinput.getDialog("login");
|
||||
|
||||
if ("GET"==rinput.verb)
|
||||
{ // display the dialog and have done with it
|
||||
dlg.setValue("tgt",target);
|
||||
rinput.location = target;
|
||||
vlib.output(dlg);
|
||||
vlib.done();
|
||||
|
||||
} // end if
|
||||
|
||||
// everything that follows is for a POST operation
|
||||
op = dlg.whichButton(rinput) + "";
|
||||
if (op=="cancel")
|
||||
{ // user cancelled login - bounce back to the target
|
||||
vlib.output(new Redirect(target,LinkTypes.SERVLET));
|
||||
vlib.done();
|
||||
|
||||
} // end if
|
||||
|
||||
dlg.load(rinput); // load the dialog parameters
|
||||
rc = null; // return from this script
|
||||
if (op=="remind")
|
||||
{ // send the login reminder
|
||||
try
|
||||
{ // perform the reminder operation
|
||||
rinput.engine.sendPasswordReminder(dlg.getValue("user"));
|
||||
|
||||
// recycle the dialog and output it again
|
||||
dlg.setErrorMessage("Password reminder has been sent to your e-mail address.");
|
||||
dlg.setValue("pass",null);
|
||||
rinput.location = target;
|
||||
rc = dlg;
|
||||
|
||||
} // end try
|
||||
catch (e)
|
||||
{ // caught an exception here - what do we do about it?
|
||||
etype = vlib.exceptionType(e) + "";
|
||||
if (etype.match("DataException"))
|
||||
rc = new ErrorBox("Database Error","Database error finding user: " + e.getMessage(),target);
|
||||
else if (etype.match("AccessError"))
|
||||
rc = new ErrorBox("User E-mail Address Not Found",e.getMessage(),target);
|
||||
else if (etype.match("EmailException"))
|
||||
rc = new ErrorBox("E-mail Error","E-mail error sending reminder: " + e.getMessage(),target);
|
||||
else
|
||||
rc = e;
|
||||
|
||||
} // end catch
|
||||
|
||||
} // end if
|
||||
else if (op=="login")
|
||||
{ // actually log in!
|
||||
try
|
||||
{ // authenticate the user
|
||||
user.authenticate(dlg.getValue("user"),dlg.getValue("pass"));
|
||||
|
||||
logger.debug("User \"" + user.userName + "\" logged in successfully");
|
||||
|
||||
// If the user wants a cookie, give it to them!
|
||||
if (dlg.getValue("saveme").booleanValue())
|
||||
rinput.savePersistentCookie(RequestInput.LOGIN_COOKIE,user.getAuthenticationToken(),
|
||||
RequestInput.LOGIN_COOKIE_AGE);
|
||||
|
||||
// Clear the left menus (to force recomputation) and bounce us back to whereever we were
|
||||
// supposed to go.
|
||||
logger.debug("Ready to bounce to \"" + target + "\"");
|
||||
rinput.setSessionAttribute(RequestInput.LEFT_MENU_SESSION_ATTR,null);
|
||||
if (user.isEmailVerified())
|
||||
rc = new Redirect(target,LinkTypes.SERVLET);
|
||||
else // jump to the Verify dialog before we do anything else
|
||||
rc = new Redirect("verify_email.js.vs?tgt=" + vlib.encodeURL(target),LinkTypes.SERVLET);
|
||||
|
||||
} // end try
|
||||
catch (e)
|
||||
{ // caught an exception here - what do we do about it?
|
||||
etype = vlib.exceptionType(e) + "";
|
||||
if (etype.match("DataException"))
|
||||
rc = new ErrorBox("Database Error","Database error logging in: " + e.message,target);
|
||||
else if (etype.match("AccessError"))
|
||||
{ // this indicates a problem with the user account or password
|
||||
dlg.setErrorMessage(e.message);
|
||||
dlg.setValue("pass",null);
|
||||
rinput.location = target;
|
||||
rc = dlg;
|
||||
|
||||
} // end else if
|
||||
else
|
||||
rc = e;
|
||||
|
||||
} // end catch
|
||||
|
||||
} // end else if
|
||||
else
|
||||
{ // unknown button pressed!
|
||||
logger.error("no known button click on POST to login.js");
|
||||
rc = new ErrorBox("Internal Error","Unknown command button pressed",target);
|
||||
|
||||
} // end else
|
||||
|
||||
vlib.output(rc); // all done!
|
||||
41
scripts/logout.js
Normal file
41
scripts/logout.js
Normal file
@@ -0,0 +1,41 @@
|
||||
// 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):
|
||||
|
||||
importPackage(Packages.com.silverwrist.venice.core);
|
||||
importPackage(Packages.com.silverwrist.venice.except);
|
||||
importPackage(Packages.com.silverwrist.venice.ui);
|
||||
importPackage(Packages.com.silverwrist.venice.ui.helpers);
|
||||
|
||||
// Get the request object and the target URI.
|
||||
rinput = bsf.lookupBean("request");
|
||||
target = rinput.getParameter("tgt");
|
||||
if (target==null)
|
||||
target = "top.js.vs";
|
||||
|
||||
// If the user is not logged in, this script is a no-op - just bounce to the specified target.
|
||||
user = rinput.user;
|
||||
if (user.isLoggedIn())
|
||||
{ // user is logged in - we want to log out
|
||||
// TODO: only remove the login cookie if it was actually set!
|
||||
rinput.deleteCookie(RequestInput.LOGIN_COOKIE); // remove the login cookie
|
||||
rinput.replaceUser(null); // no more user context
|
||||
rinput.setSessionAttribute(RequestInput.LEFT_MENU_SESSION_ATTR,null); // and clear menus too
|
||||
|
||||
target = "top.js.vs"; // take 'em back to the top
|
||||
|
||||
} // end if
|
||||
|
||||
vlib.output(new Redirect(target,LinkTypes.SERVLET)); // do the redirect!
|
||||
47
scripts/new_account.js
Normal file
47
scripts/new_account.js
Normal file
@@ -0,0 +1,47 @@
|
||||
// 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):
|
||||
|
||||
importPackage(Packages.com.silverwrist.venice.core);
|
||||
importPackage(Packages.com.silverwrist.venice.ui);
|
||||
importPackage(Packages.com.silverwrist.venice.ui.helpers);
|
||||
importPackage(Packages.com.silverwrist.venice.ui.view);
|
||||
|
||||
// Get the request object and the target URI.
|
||||
rinput = bsf.lookupBean("request");
|
||||
target = rinput.getParameter("tgt");
|
||||
if (target==null)
|
||||
target = "top.js.vs";
|
||||
|
||||
// If the user is already logged in, this is an error.
|
||||
user = rinput.user;
|
||||
if (user.isLoggedIn())
|
||||
{ // user already logged in - just bail on this
|
||||
vlib.output(new ErrorBox(null,"You cannot create a new account while logged in on an existing one. "
|
||||
+ "You must log out first.",target));
|
||||
vlib.done();
|
||||
|
||||
} // end if
|
||||
|
||||
// Return the text of the User Agreement.
|
||||
rinput.displayLogin = false;
|
||||
rc = new TextMessage(rinput.getStockMessage("user-agreement-title"),
|
||||
rinput.getStockMessage("user-agreement-subtitle"));
|
||||
rc.text = rinput.getStockMessage("user-agreement");
|
||||
rc.addButton(LinkTypes.SERVLET,"new_account_2.js.vs?tgt=" + vlib.encodeURL(target),"ua_accept");
|
||||
rc.addButton(LinkTypes.SERVLET,"top.js.vs","ua_decline");
|
||||
vlib.output(rc);
|
||||
|
||||
|
||||
146
scripts/new_account_2.js
Normal file
146
scripts/new_account_2.js
Normal file
@@ -0,0 +1,146 @@
|
||||
// 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):
|
||||
|
||||
importPackage(Packages.com.silverwrist.venice.core);
|
||||
importPackage(Packages.com.silverwrist.venice.except);
|
||||
importPackage(Packages.com.silverwrist.venice.ui);
|
||||
importPackage(Packages.com.silverwrist.venice.ui.dlg);
|
||||
importPackage(Packages.com.silverwrist.venice.ui.helpers);
|
||||
|
||||
// Get the request object and the target URI.
|
||||
rinput = bsf.lookupBean("request");
|
||||
target = rinput.getParameter("tgt");
|
||||
if (target==null)
|
||||
target = "top.js.vs";
|
||||
|
||||
// If the user is already logged in, this is an error.
|
||||
user = rinput.user;
|
||||
if (user.isLoggedIn())
|
||||
{ // user already logged in - just bail on this
|
||||
vlib.output(new ErrorBox(null,"You cannot create a new account while logged in on an existing one. "
|
||||
+ "You must log out first.",target));
|
||||
vlib.done();
|
||||
|
||||
} // end if
|
||||
|
||||
// create the new account dialog
|
||||
dlg = rinput.getDialog("newacct");
|
||||
|
||||
if ("GET"==rinput.verb)
|
||||
{ // display the dialog and have done with it
|
||||
dlg.setValue("tgt",target);
|
||||
rinput.location = target;
|
||||
rinput.displayLogin = false;
|
||||
vlib.output(dlg);
|
||||
vlib.done();
|
||||
|
||||
} // end if
|
||||
|
||||
// everything that follows is for a POST operation
|
||||
op = dlg.whichButton(rinput) + "";
|
||||
if (op=="cancel")
|
||||
{ // user cancelled create - bounce back to the target
|
||||
vlib.output(new Redirect(target,LinkTypes.SERVLET));
|
||||
vlib.done();
|
||||
|
||||
} // end if
|
||||
|
||||
rc = null;
|
||||
if (op=="create")
|
||||
{ // we actually want to create the new account
|
||||
dlg.load(rinput);
|
||||
|
||||
try
|
||||
{ // start by validating the dialog
|
||||
dlg.validate();
|
||||
|
||||
// validate a couple of other issues
|
||||
if (!(dlg.getValue("pass1").equals(dlg.getValue("pass2"))))
|
||||
throw new ValidationException("The typed passwords do not match.");
|
||||
if (rinput.engine.isEmailAddressBanned(dlg.getValue("email")))
|
||||
throw new ValidationException("This email address may not register a new account.");
|
||||
|
||||
// Create the new user account and set up its initial context.
|
||||
uc = rinput.engine.createNewAccount(rinput.sourceAddress,dlg.getValue("user"),dlg.getValue("pass1"),
|
||||
dlg.getValue("remind"));
|
||||
|
||||
// Set up the account's contact info.
|
||||
ci = uc.getContactInfo();
|
||||
ci.namePrefix = dlg.getValue("prefix");
|
||||
ci.givenName = dlg.getValue("first");
|
||||
blort = dlg.getValue("mid") + "";
|
||||
if (blort.length<1)
|
||||
ci.middleInitial = " ";
|
||||
else
|
||||
ci.middleInitial = blort.substring(0,1);
|
||||
ci.familyName = dlg.getValue("last");
|
||||
ci.nameSuffix = dlg.getValue("suffix");
|
||||
ci.locality = dlg.getValue("loc");
|
||||
ci.region = dlg.getValue("reg");
|
||||
ci.postalCode = dlg.getValue("pcode");
|
||||
ci.country = dlg.getValue("country");
|
||||
ci.email = dlg.getValue("email");
|
||||
|
||||
// save the contact info for the user (this also sends email confirmation messages as needed)
|
||||
uc.putContactInfo(ci);
|
||||
|
||||
rinput.replaceUser(uc); // this is now the user for this session!
|
||||
|
||||
// Now bounce us immediately to the Verification dialog.
|
||||
rc = new Redirect("verify_email.js.vs?tgt=" + vlib.encodeURL(target),LinkTypes.SERVLET);
|
||||
|
||||
} // end try
|
||||
catch (e)
|
||||
{ // we caught some sort of exception...but what is it?
|
||||
etype = vlib.exceptionType(e) + "";
|
||||
if (etype.match("ValidationException"))
|
||||
{ // put the dialog back up on a validation error
|
||||
dlg.setErrorMessage(e.message + " Please try again.");
|
||||
dlg.setValue("pass1",null);
|
||||
dlg.setValue("pass2",null);
|
||||
rinput.location = target;
|
||||
rinput.displayLogin = false;
|
||||
rc = dlg;
|
||||
|
||||
} // end if
|
||||
else if (etype.match("DataException"))
|
||||
rc = new ErrorBox("Database Error","Database error creating account: " + e.message,target);
|
||||
else if (etype.match("AccessError"))
|
||||
{ // put the dialog back up on an access error
|
||||
dlg.setErrorMessage(e.message);
|
||||
dlg.setValue("pass1",null);
|
||||
dlg.setValue("pass2",null);
|
||||
rinput.location = target;
|
||||
rinput.displayLogin = false;
|
||||
rc = dlg;
|
||||
|
||||
} // end if
|
||||
else if (etype.match("EmailException"))
|
||||
rc = new ErrorBox("E-mail Error","E-mail error creating account: " + e.message,target);
|
||||
else
|
||||
rc = e;
|
||||
|
||||
} // end catch
|
||||
|
||||
} // end if
|
||||
else
|
||||
{ // no dialog present
|
||||
logger.error("no known button click on POST to new_account_2.js");
|
||||
rc = new ErrorBox("Internal Error","Unknown command button pressed",target);
|
||||
|
||||
} // end else
|
||||
|
||||
vlib.output(rc);
|
||||
223
scripts/profile.js
Normal file
223
scripts/profile.js
Normal file
@@ -0,0 +1,223 @@
|
||||
// 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):
|
||||
|
||||
importPackage(Packages.com.silverwrist.venice.core);
|
||||
importPackage(Packages.com.silverwrist.venice.except);
|
||||
importPackage(Packages.com.silverwrist.venice.ui);
|
||||
importPackage(Packages.com.silverwrist.venice.ui.dlg);
|
||||
importPackage(Packages.com.silverwrist.venice.ui.helpers);
|
||||
|
||||
// Get the request object and the target URI.
|
||||
rinput = bsf.lookupBean("request");
|
||||
target = rinput.getParameter("tgt");
|
||||
if (target==null)
|
||||
target = "top.js.vs";
|
||||
|
||||
// If the user is not logged in, this is an error.
|
||||
user = rinput.user;
|
||||
if (!(user.isLoggedIn()))
|
||||
{ // user not logged in - just bail on this
|
||||
vlib.output(new ErrorBox(null,"You must log in before you can modify the profile on your account."));
|
||||
vlib.done();
|
||||
|
||||
} // end if
|
||||
|
||||
dlg = rinput.getDialog("profile");
|
||||
|
||||
rc = null;
|
||||
if ("GET"==rinput.verb)
|
||||
{ // set up the dialog
|
||||
dlg.setValue("tgt",target);
|
||||
|
||||
try
|
||||
{ // pull the user data...
|
||||
ci = user.getContactInfo(); // get the main contact info
|
||||
props = user.properties; // get the properties
|
||||
|
||||
dlg.setEnabled("photo",ci.canSetPhoto());
|
||||
dlg.setValue("prefix",ci.namePrefix);
|
||||
dlg.setValue("first",ci.givenName);
|
||||
if (ci.middleInitial!=' ')
|
||||
dlg.setValue("mid",String.fromCharCode(ci.middleInitial));
|
||||
dlg.setValue("last",ci.familyName);
|
||||
dlg.setValue("suffix",ci.nameSuffix);
|
||||
dlg.setValue("company",ci.company);
|
||||
dlg.setValue("addr1",ci.addressLine1);
|
||||
dlg.setValue("addr2",ci.addressLine2);
|
||||
if (ci.privateAddress)
|
||||
dlg.setValue("pvt_addr",1);
|
||||
dlg.setValue("loc",ci.locality);
|
||||
dlg.setValue("reg",ci.region);
|
||||
dlg.setValue("pcode",ci.postalCode);
|
||||
dlg.setValue("country",ci.country);
|
||||
dlg.setValue("phone",ci.phone);
|
||||
dlg.setValue("mobile",ci.mobile);
|
||||
if (ci.privatePhone)
|
||||
dlg.setValue("pvt_phone",1);
|
||||
dlg.setValue("fax",ci.fax);
|
||||
if (ci.privateFax)
|
||||
dlg.setValue("pvt_fax",1);
|
||||
dlg.setValue("email",ci.email);
|
||||
if (ci.privateEmail)
|
||||
dlg.setValue("pvt_email",1);
|
||||
dlg.setValue("url",ci.URL);
|
||||
dlg.setValue("descr",user.description);
|
||||
dlg.setValue("photo",ci.photoURL);
|
||||
dlg.sendMessage("photo","setLinkURL","profile_photo.js.vs?tgt=" + vlib.encodeURL(target));
|
||||
if (props.displayPostPictures)
|
||||
dlg.setValue("pic_in_post",1);
|
||||
if (props.massMailOptOut)
|
||||
dlg.setValue("no_mass_mail",1);
|
||||
dlg.setValue("locale",user.locale);
|
||||
dlg.setValue("tz",user.timeZone);
|
||||
rinput.displayLogin = false;
|
||||
rc = dlg;
|
||||
|
||||
} // end try
|
||||
catch (e)
|
||||
{ // exception setting up the dialog
|
||||
etype = vlib.exceptionType(e) + "";
|
||||
if (etype.match("DataException"))
|
||||
rc = new ErrorBox("Database Error","Database error retrieving profile: " + e.message,target);
|
||||
else
|
||||
rc = e;
|
||||
|
||||
} // end catch
|
||||
|
||||
vlib.output(rc);
|
||||
vlib.done();
|
||||
|
||||
} // end if
|
||||
|
||||
// everything that follows is for a POST operation
|
||||
op = dlg.whichButton(rinput) + "";
|
||||
if (op=="cancel")
|
||||
{ // user cancelled profile update - bounce back to the target
|
||||
vlib.output(new Redirect(target,LinkTypes.SERVLET));
|
||||
vlib.done();
|
||||
|
||||
} // end if
|
||||
|
||||
dlg.load(rinput); // load the dialog parameters
|
||||
|
||||
if (op=="update")
|
||||
{ // attempt to update the user profile
|
||||
try
|
||||
{ // start by validating the dialog
|
||||
dlg.validate(); // validate the dialog
|
||||
|
||||
// check the passwords
|
||||
pass1 = dlg.getValue("pass1") + "";
|
||||
pass2 = dlg.getValue("pass2") + "";
|
||||
|
||||
if (vlib.emptyString(pass1))
|
||||
{ // empty must match empty
|
||||
if (!(vlib.emptyString(pass2)))
|
||||
throw new ValidationException("The typed passwords do not match.");
|
||||
|
||||
} // end if
|
||||
else
|
||||
{ // the two passwords must match
|
||||
if (pass1!=pass2)
|
||||
throw new ValidationException("The typed passwords do not match.");
|
||||
|
||||
} // end else
|
||||
|
||||
ci = user.getContactInfo(); // get the main contact info
|
||||
props = user.properties; // get the properties
|
||||
|
||||
// Reset the contact info fields.
|
||||
ci.namePrefix = dlg.getValue("prefix");
|
||||
ci.givenName = dlg.getValue("first");
|
||||
blort = dlg.getValue("mid") + "";
|
||||
if (blort.length<1)
|
||||
ci.middleInitial = " ";
|
||||
else
|
||||
ci.middleInitial = blort.substring(0,1);
|
||||
ci.familyName = dlg.getValue("last");
|
||||
ci.nameSuffix = dlg.getValue("suffix");
|
||||
ci.company = dlg.getValue("company");
|
||||
ci.addressLine1 = dlg.getValue("addr1");
|
||||
ci.addressLine2 = dlg.getValue("addr2");
|
||||
ci.privateAddress = dlg.getValue("pvt_addr").booleanValue();
|
||||
ci.locality = dlg.getValue("loc");
|
||||
ci.region = dlg.getValue("reg");
|
||||
ci.postalCode = dlg.getValue("pcode");
|
||||
ci.country = dlg.getValue("country");
|
||||
ci.phone = dlg.getValue("phone");
|
||||
ci.mobile = dlg.getValue("mobile");
|
||||
ci.privatePhone = dlg.getValue("pvt_phone").booleanValue();
|
||||
ci.fax = dlg.getValue("fax");
|
||||
ci.privateFax = dlg.getValue("pvt_fax").booleanValue();
|
||||
ci.email = dlg.getValue("email");
|
||||
ci.privateEmail = dlg.getValue("pvt_email").booleanValue();
|
||||
ci.URL = dlg.getValue("url");
|
||||
|
||||
// Store the completed contact info.
|
||||
need_verify = user.putContactInfo(ci);
|
||||
|
||||
// Save off the properties.
|
||||
props.displayPostPictures = dlg.getValue("pic_in_post").booleanValue();
|
||||
props.massMailOptOut = dlg.getValue("no_mass_mail").booleanValue();
|
||||
user.properties = props;
|
||||
|
||||
// Save off the user's description and preferences.
|
||||
user.description = dlg.getValue("descr");
|
||||
user.locale = dlg.getValue("locale");
|
||||
user.timeZone = dlg.getValue("tz");
|
||||
|
||||
// Finally, change the password if applicable.
|
||||
if (!(vlib.emptyString(pass1)))
|
||||
user.setPassword(pass1,dlg.getValue("remind"));
|
||||
|
||||
// Bounce back to our desired target.
|
||||
if (need_verify)
|
||||
rc = new Redirect("verify_email.js.vs?tgt=" + vlib.encodeURL(target),LinkTypes.SERVLET);
|
||||
else
|
||||
rc = new Redirect(target,LinkTypes.SERVLET);
|
||||
|
||||
} // end try
|
||||
catch (e)
|
||||
{ // exception changing the user profile
|
||||
etype = vlib.exceptionType(e) + "";
|
||||
if (etype.match("ValidationException"))
|
||||
{ // redisplay the dialog on validation error
|
||||
dlg.setErrorMessage(e.message + " Please try again.");
|
||||
dlg.setEnabled("photo",user.canSetUserPhoto());
|
||||
dlg.setValue("pass1",null);
|
||||
dlg.setValue("pass2",null);
|
||||
rinput.displayLogin = false;
|
||||
rc = dlg;
|
||||
|
||||
} // end if
|
||||
else if (etype.match("DataException"))
|
||||
rc = new ErrorBox("Database Error","Database error updating profile: " + e.message,target);
|
||||
else if (etype.match("EmailException"))
|
||||
rc = new ErrorBox("E-mail Error","E-mail error sending confirmation: " + e.message,target);
|
||||
else
|
||||
rc = e;
|
||||
|
||||
} // end catch
|
||||
|
||||
} // end if
|
||||
else
|
||||
{ // unknown button pressed...
|
||||
logger.error("no known button click on POST to profile.js");
|
||||
rc = new ErrorBox("Internal Error","Unknown command button pressed",target);
|
||||
|
||||
} // end else
|
||||
|
||||
vlib.output(rc); // all done!
|
||||
137
scripts/profile_photo.js
Normal file
137
scripts/profile_photo.js
Normal file
@@ -0,0 +1,137 @@
|
||||
// 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):
|
||||
|
||||
importClass(java.awt.Dimension);
|
||||
importPackage(Packages.com.silverwrist.util);
|
||||
importPackage(Packages.com.silverwrist.util.image);
|
||||
importPackage(Packages.com.silverwrist.venice.core);
|
||||
importPackage(Packages.com.silverwrist.venice.except);
|
||||
importPackage(Packages.com.silverwrist.venice.ui);
|
||||
importPackage(Packages.com.silverwrist.venice.ui.helpers);
|
||||
importPackage(Packages.com.silverwrist.venice.ui.view);
|
||||
|
||||
// Get the request object and the target URI.
|
||||
rinput = bsf.lookupBean("request");
|
||||
target = rinput.getParameter("tgt");
|
||||
if (target==null)
|
||||
target = "top.js.vs";
|
||||
|
||||
// If the user is not logged in, this is an error.
|
||||
user = rinput.user;
|
||||
if (!(user.isLoggedIn()))
|
||||
{ // user not logged in - just bail on this
|
||||
vlib.output(new ErrorBox(null,"You must log in before you can modify the profile on your account."));
|
||||
vlib.done();
|
||||
|
||||
} // end if
|
||||
|
||||
rc = null;
|
||||
if ("GET"==rinput.verb)
|
||||
{ // create a PhotoUploader to do the photo uploading
|
||||
try
|
||||
{ // create and initialize the PhotoUploader
|
||||
rc = new PhotoUploader("Upload User Photo","profile_photo.js.vs",LinkTypes.SERVLET);
|
||||
rc.addHiddenParameter("tgt",target);
|
||||
rc.photoTag = rinput.getUserPhotoTag(user.getContactInfo().photoURL);
|
||||
rc.label = "New user photo";
|
||||
rinput.displayLogin = false;
|
||||
|
||||
} // end try
|
||||
catch (e)
|
||||
{ // an exception in the output...
|
||||
etype = vlib.exceptionType(e) + "";
|
||||
if (etype.match("DataException"))
|
||||
rc = new ErrorBox("Database Error","Database error generating display: " + e.message,target);
|
||||
else
|
||||
rc = e;
|
||||
|
||||
} // end catch
|
||||
|
||||
vlib.output(rc);
|
||||
vlib.done();
|
||||
|
||||
} // end if
|
||||
|
||||
// If the cancel button was clicked, bounce out of here.
|
||||
if (rinput.isImageButtonClicked("cancel"))
|
||||
{ // user elected to cancel upload - bounce us out of here
|
||||
vlib.output(new Redirect("profile.js.vs?tgt=" + vlib.encodeURL(target),LinkTypes.SERVLET));
|
||||
vlib.done();
|
||||
|
||||
} // end if
|
||||
|
||||
if (rinput.isImageButtonClicked("upload"))
|
||||
{ // do some shorts-checking in the parameters
|
||||
if (!(rinput.isFileParam("thepic")))
|
||||
{ // bogus file parameter
|
||||
logger.error("Internal Error: 'thepic' should be a file param");
|
||||
vlib.output(new ErrorBox(null,"Internal Error: 'thepic' should be a file param",
|
||||
"profile.js.vs?tgt=" + vlib.encodeURL(target)));
|
||||
vlib.done();
|
||||
|
||||
} // end if
|
||||
|
||||
mimetype = rinput.getParameterType("thepic") + "";
|
||||
if (!(mimetype.match("image/")))
|
||||
{ // not an image file type that got uploaded
|
||||
logger.error("Error: 'thepic' not an image type");
|
||||
vlib.output(new ErrorBox(null,"You did not upload an image file. Try again.",
|
||||
"profile_photo.js.vs?tgt=" + vlib.encodeURL(target)));
|
||||
vlib.done();
|
||||
|
||||
} // end if
|
||||
|
||||
try
|
||||
{ // normalize the photo to 100x100 pixels
|
||||
real_pic = ImageNormalizer.normalizeImage(rinput.getParameterDataStream("thepic"),
|
||||
rinput.engine.getUserPhotoSize(),"jpeg");
|
||||
|
||||
// set the user photo data!
|
||||
ci = user.getContactInfo();
|
||||
ci.setPhotoData(rinput.contextPath + "/imagedata/","image/jpeg",real_pic.length,real_pic.data);
|
||||
user.putContactInfo(ci);
|
||||
|
||||
// Jump back to the profile form.
|
||||
rc = new Redirect("profile.js.vs?tgt=" + vlib.encodeURL(target),LinkTypes.SERVLET);
|
||||
|
||||
} // end try
|
||||
catch (e)
|
||||
{ // exception while setting user photo
|
||||
etype = vlib.exceptionType(e) + "";
|
||||
if (etype.match("ServletMultipartException"))
|
||||
rc = new ErrorBox(null,"Internal Error: " + e.message,"profile.js.vs?tgt=" + vlib.encodeURL(target));
|
||||
else if (etype.match("ImageNormalizerException"))
|
||||
rc = new ErrorBox(null,e.message,"profile_photo.js.vs?tgt=" + vlib.encodeURL(target));
|
||||
else if (etype.match("DataException"))
|
||||
rc = new ErrorBox("Database Error","Database error storing user photo: " + e.message,
|
||||
"profile.js.vs?tgt=" + vlib.encodeURL(target));
|
||||
else if (etype.match("EmailException"))
|
||||
rc = new ErrorBox(null,"Internal Error: " + e.message,"profile.js.vs?tgt=" + vlib.encodeURL(target));
|
||||
else
|
||||
rc = e;
|
||||
|
||||
} // end catch
|
||||
|
||||
} // end if
|
||||
else
|
||||
{ // don't know the command button!
|
||||
logger.error("no known button click on POST to profile_photo.js");
|
||||
rc = new ErrorBox("Internal Error","Unknown command button pressed",
|
||||
"profile.js.vs?tgt=" + vlib.encodeURL(target));
|
||||
|
||||
} // end else
|
||||
|
||||
vlib.output(rc); // all done!
|
||||
62
scripts/quick_email.js
Normal file
62
scripts/quick_email.js
Normal file
@@ -0,0 +1,62 @@
|
||||
// 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):
|
||||
|
||||
importPackage(Packages.com.silverwrist.venice.core);
|
||||
importPackage(Packages.com.silverwrist.venice.except);
|
||||
importPackage(Packages.com.silverwrist.venice.ui);
|
||||
importPackage(Packages.com.silverwrist.venice.ui.helpers);
|
||||
importPackage(Packages.com.silverwrist.venice.ui.view);
|
||||
|
||||
rinput = bsf.lookupBean("request");
|
||||
|
||||
to_uid = rinput.getParameterInt("to_uid",-1);
|
||||
if (to_uid<=0)
|
||||
{ // the user ID is not present
|
||||
vlib.output(new ErrorBox(null,"Invalid user ID parameter.",null));
|
||||
vlib.done();
|
||||
|
||||
} // end if
|
||||
|
||||
rc = null;
|
||||
on_error = "top.js.vs";
|
||||
try
|
||||
{ // retrieve the user profile
|
||||
prof = rinput.user.getProfile(to_uid);
|
||||
on_error = "user/" + prof.userName;
|
||||
logger.debug("sending quick email message to " + prof.userName);
|
||||
|
||||
// send the actual E-mail message
|
||||
prof.sendQuickEmail(rinput.getParameter("subj"),rinput.getParameter("pb"));
|
||||
|
||||
// redirect to the user profile page
|
||||
rc = new Redirect("user/" + prof.userName,LinkTypes.SERVLET);
|
||||
|
||||
} // end try
|
||||
catch (e)
|
||||
{ // determine what to do with an exception
|
||||
etype = vlib.exceptionType(e) + "";
|
||||
if (etype.match("DataException"))
|
||||
rc = new ErrorBox("Database Error","Database error sending message: " + e.message,on_error);
|
||||
else if (etype.match("AccessError"))
|
||||
rc = new ErrorBox("Access Error",e.message,on_error);
|
||||
else if (etype.match("EmailException"))
|
||||
rc = new ErrorBox("E-Mail Error","Error sending e-mail: " + e.message,on_error);
|
||||
else
|
||||
rc = e;
|
||||
|
||||
} // end catch
|
||||
|
||||
vlib.output(rc); // all done!
|
||||
107
scripts/showuser.js
Normal file
107
scripts/showuser.js
Normal file
@@ -0,0 +1,107 @@
|
||||
// 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):
|
||||
|
||||
importPackage(Packages.com.silverwrist.venice.core);
|
||||
importPackage(Packages.com.silverwrist.venice.except);
|
||||
importPackage(Packages.com.silverwrist.venice.ui);
|
||||
importPackage(Packages.com.silverwrist.venice.ui.helpers);
|
||||
importPackage(Packages.com.silverwrist.venice.ui.view);
|
||||
|
||||
// get the request object and the username
|
||||
rinput = bsf.lookupBean("request");
|
||||
username = rinput.getRequestAttribute("username");
|
||||
|
||||
rc = null;
|
||||
try
|
||||
{ // retrieve the user profile and save it off
|
||||
prof = rinput.user.getProfile(username);
|
||||
rinput.setRequestAttribute("profile",prof);
|
||||
|
||||
// determine the full name of the user and save it off
|
||||
buf = new java.lang.StringBuffer(prof.givenName);
|
||||
if (!(vlib.emptyString(prof.namePrefix)))
|
||||
{ // insert the prefix at the beginning of the string
|
||||
buf.insert(0," ");
|
||||
buf.insert(0,prof.namePrefix);
|
||||
|
||||
} // end if
|
||||
|
||||
tmp = String.fromCharCode(prof.middleInitial);
|
||||
if (tmp!=" ")
|
||||
{ // append the middle initial
|
||||
buf.append(" ");
|
||||
buf.append(tmp);
|
||||
buf.append(".");
|
||||
|
||||
} // end if
|
||||
|
||||
buf.append(" ");
|
||||
buf.append(prof.familyName);
|
||||
if (!(vlib.emptyString(prof.nameSuffix)))
|
||||
{ // append the name suffix
|
||||
buf.append(" ");
|
||||
buf.append(prof.nameSuffix);
|
||||
|
||||
} // end if
|
||||
|
||||
rinput.setRequestAttribute("fullname",buf.toString());
|
||||
|
||||
// determine the last line of the address and save it off
|
||||
if (vlib.emptyString(prof.locality))
|
||||
{ // allocate stringbuffer based on region
|
||||
if (vlib.emptyString(prof.region))
|
||||
buf = new java.lang.StringBuffer();
|
||||
else
|
||||
buf = new java.lang.StringBuffer(prof.region);
|
||||
|
||||
} // end if
|
||||
else if (vlib.emptyString(prof.region))
|
||||
buf = new java.lang.StringBuffer(prof.locality);
|
||||
else
|
||||
{ // tack together both locality and region
|
||||
buf = new java.lang.StringBuffer(prof.locality);
|
||||
buf.append(", ");
|
||||
buf.append(prof.region);
|
||||
|
||||
} // end else
|
||||
|
||||
if (!(vlib.emptyString(prof.postalCode)))
|
||||
{ // append the postal code
|
||||
buf.append(" ");
|
||||
buf.append(prof.postalCode);
|
||||
|
||||
} // end if
|
||||
|
||||
rinput.setRequestAttribute("address.lastline",buf.toString());
|
||||
|
||||
// Save off the user photo tag.
|
||||
rinput.setRequestAttribute("user.photo",rinput.getUserPhotoTag(prof.photoURL));
|
||||
|
||||
// Create a view object and send it out.
|
||||
rc = new JSPView("User Profile - " + username,"user_profile.jsp");
|
||||
|
||||
} // end try
|
||||
catch (e)
|
||||
{ // handle an exception thrown by the profile code
|
||||
etype = vlib.exceptionType(e) + "";
|
||||
if (etype.match("DataException"))
|
||||
rc = new ErrorBox("Database Error","Database error finding user: " + e.message,"top.js.vs");
|
||||
else
|
||||
rc = e;
|
||||
|
||||
} // end catch
|
||||
|
||||
vlib.output(rc); // all done!
|
||||
59
scripts/sysadmin/audit.js
Normal file
59
scripts/sysadmin/audit.js
Normal 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):
|
||||
|
||||
importPackage(java.util);
|
||||
importPackage(Packages.com.silverwrist.venice.core);
|
||||
importPackage(Packages.com.silverwrist.venice.except);
|
||||
importPackage(Packages.com.silverwrist.venice.ui);
|
||||
importPackage(Packages.com.silverwrist.venice.ui.helpers);
|
||||
importPackage(Packages.com.silverwrist.venice.ui.view);
|
||||
|
||||
// get the request object
|
||||
rinput = bsf.lookupBean("request");
|
||||
|
||||
rc = null;
|
||||
try
|
||||
{ // get the admin interface
|
||||
adm = rinput.user.adminInterface;
|
||||
|
||||
// read off the offset parameter
|
||||
offset = rinput.getParameterInt("ofs",0);
|
||||
|
||||
// generate the audit lists
|
||||
audit_list = adm.getAuditRecords(offset,rinput.engine.getNumAuditRecordsPerPage());
|
||||
audit_count = adm.getAuditRecordCount();
|
||||
|
||||
// output the audit data view
|
||||
rc = new AuditView(rinput.engine,audit_list,offset,audit_count,"System Audit Records",
|
||||
"sysadmin/audit.js.vs?ofs=${offset}","sysadmin/menu.js.vs",
|
||||
"Return to System Administration Menu");
|
||||
rc.menuSelector = Content.MENU_SELECTOR_NOCHANGE;
|
||||
|
||||
} // end try
|
||||
catch (e)
|
||||
{ // display an error
|
||||
etype = vlib.exceptionType(e) + "";
|
||||
if (etype.match("DataException"))
|
||||
rc = new ErrorBox("Database Error","Database error getting audit records: " + e.message,
|
||||
"sysadmin/menu.js.vs");
|
||||
else if (etype.match("AccessError"))
|
||||
rc = new ErrorBox("Access Error",e.message,"sysadmin/menu.js.vs");
|
||||
else
|
||||
rc = e;
|
||||
|
||||
} // end catch
|
||||
|
||||
vlib.output(rc);
|
||||
96
scripts/sysadmin/find_user.js
Normal file
96
scripts/sysadmin/find_user.js
Normal file
@@ -0,0 +1,96 @@
|
||||
// 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):
|
||||
|
||||
importPackage(Packages.com.silverwrist.venice.core);
|
||||
importPackage(Packages.com.silverwrist.venice.except);
|
||||
importPackage(Packages.com.silverwrist.venice.ui);
|
||||
importPackage(Packages.com.silverwrist.venice.ui.helpers);
|
||||
importPackage(Packages.com.silverwrist.venice.ui.view);
|
||||
|
||||
rinput = bsf.lookupBean("request");
|
||||
|
||||
if (!(rinput.user.hasAdminAccess()))
|
||||
{ // no admin access - we can't do this
|
||||
vlib.output(new ErrorBox("Access Error","You do not have permission to administer the system.",null));
|
||||
vlib.done();
|
||||
|
||||
} // end if
|
||||
|
||||
// Create the new view.
|
||||
view = new AdminFindUserView(rinput.engine.getStdNumSearchResults());
|
||||
|
||||
if ("GET"==rinput.verb)
|
||||
{ // initialize the field, mode, and term and do the search
|
||||
view.field = SearchMode.FIELD_USER_NAME;
|
||||
view.mode = SearchMode.SEARCH_PREFIX;
|
||||
view.term = "";
|
||||
vlib.output(view);
|
||||
vlib.done();
|
||||
|
||||
} // end if
|
||||
|
||||
// everything here on is for a POST
|
||||
rc = null;
|
||||
try
|
||||
{ // load the search field parameter
|
||||
x = rinput.getParameterInt("field",SearchMode.FIELD_USER_NAME);
|
||||
if ( (x!=SearchMode.FIELD_USER_NAME) && (x!=SearchMode.FIELD_USER_DESCRIPTION)
|
||||
&& (x!=SearchMode.FIELD_USER_GIVEN_NAME) && (x!=SearchMode.FIELD_USER_FAMILY_NAME))
|
||||
throw new ValidationException("The search field parameter is not valid.");
|
||||
view.field = x;
|
||||
|
||||
// load the search mode parameter
|
||||
x = rinput.getParameterInt("mode",SearchMode.SEARCH_PREFIX);
|
||||
if ((x!=SearchMode.SEARCH_PREFIX) && (x!=SearchMode.SEARCH_SUBSTRING) && (x!=SearchMode.SEARCH_REGEXP))
|
||||
throw new ValidationException("The search mode parameter is not valid.");
|
||||
view.mode = x;
|
||||
|
||||
// load the search term, offset, and find count
|
||||
view.term = rinput.getParameter("term");
|
||||
view.offset = rinput.getParameterInt("ofs",0);
|
||||
view.findCount = rinput.getParameterInt("fcount",-1);
|
||||
|
||||
// adjust the offset based on the command button click
|
||||
if (rinput.isImageButtonClicked("search"))
|
||||
view.offset = 0;
|
||||
else if (rinput.isImageButtonClicked("previous"))
|
||||
view.offset = Math.max(view_offset - view.maxResults,0);
|
||||
else if (rinput.isImageButtonClicked("next"))
|
||||
view.offset += view.maxResults;
|
||||
else
|
||||
throw new ValidationException("Unable to determine what action triggered the form.");
|
||||
|
||||
// get the user results
|
||||
view.results = rinput.engine.searchForUsers(view.field,view.mode,view.term,view.offset,view.maxResults);
|
||||
if (view.findCount<0)
|
||||
view.findCount = rinput.engine.getSearchUserCount(view.field,view.mode,view.term);
|
||||
|
||||
rc = view;
|
||||
|
||||
} // end try
|
||||
catch (e)
|
||||
{ // get the exception type
|
||||
etype = vlib.exceptionType(e) + "";
|
||||
if (etype.match("DataException"))
|
||||
rc = new ErrorBox("Database Error","Database error on find: " + e.message,"sysadmin/find_user.js.vs");
|
||||
else if (etype.match("ValidationException"))
|
||||
rc = new ErrorBox("Find Error",e.message,"sysadmin/find_user.js.vs");
|
||||
else
|
||||
rc = e;
|
||||
|
||||
} // end catch
|
||||
|
||||
vlib.output(rc);
|
||||
137
scripts/sysadmin/global.js
Normal file
137
scripts/sysadmin/global.js
Normal file
@@ -0,0 +1,137 @@
|
||||
// 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):
|
||||
|
||||
importPackage(java.util);
|
||||
importPackage(Packages.com.silverwrist.venice.core);
|
||||
importPackage(Packages.com.silverwrist.venice.except);
|
||||
importPackage(Packages.com.silverwrist.venice.ui);
|
||||
importPackage(Packages.com.silverwrist.venice.ui.dlg);
|
||||
importPackage(Packages.com.silverwrist.venice.ui.helpers);
|
||||
|
||||
// small function to setup the global properties dialog
|
||||
function setupDialog(dlg,engine)
|
||||
{
|
||||
sinf = engine.securityInfo;
|
||||
dlg.sendMessage("create_lvl","setRoleList",sinf.getRoleList("Global.CreateCommunity"));
|
||||
|
||||
} // end setupDialog
|
||||
|
||||
// get the request object
|
||||
rinput = bsf.lookupBean("request");
|
||||
|
||||
dlg = rinput.getDialog("global.properties");
|
||||
rc = null;
|
||||
if ("GET"==rinput.verb)
|
||||
{ // set up the dialog
|
||||
setupDialog(dlg,rinput.engine);
|
||||
|
||||
try
|
||||
{ // get the administrative interface
|
||||
adm = user.adminInterface;
|
||||
props = adm.properties;
|
||||
dlg.setValue("search_items",props.searchItemsPerPage);
|
||||
dlg.setValue("fp_posts",props.postsOnFrontPage);
|
||||
dlg.setValue("audit_recs",props.auditRecordsPerPage);
|
||||
dlg.setValue("create_lvl",props.communityCreateLevel);
|
||||
dlg.setValue("comm_mbrs",props.communityMembersPerPage);
|
||||
dlg.setValue("posts_page",props.postsPerPage);
|
||||
dlg.setValue("old_posts",props.oldPostsAtTop);
|
||||
dlg.setValue("conf_mbrs",props.conferenceMembersPerPage);
|
||||
if (props.displayPostPictures)
|
||||
dlg.setValue("pic_in_post",1);
|
||||
|
||||
rc = dlg;
|
||||
|
||||
} // end try
|
||||
catch (e)
|
||||
{ // exception setting up dialog
|
||||
etype = vlib.exceptionType(e) + "";
|
||||
if (etype.match("AccessError"))
|
||||
rc = new ErrorBox("Access Error","You do not have permission to administer the system.",null);
|
||||
else
|
||||
rc = e;
|
||||
|
||||
} // end catch
|
||||
|
||||
vlib.output(rc);
|
||||
vlib.done();
|
||||
|
||||
} // end if
|
||||
|
||||
// everything that follows is for a POST operation
|
||||
op = dlg.whichButton(rinput) + "";
|
||||
if (op=="cancel")
|
||||
{ // user cancelled profile update - bounce back to the menu
|
||||
vlib.output(new Redirect("sysadmin/menu.js.vs",LinkTypes.SERVLET));
|
||||
vlib.done();
|
||||
|
||||
} // end if
|
||||
|
||||
if (op=="update")
|
||||
{ // load the values from the dialog
|
||||
dlg.load(rinput);
|
||||
|
||||
try
|
||||
{ // validate the dialog first
|
||||
dlg.validate();
|
||||
|
||||
// set all the properties correctly
|
||||
adm = user.adminInterface;
|
||||
props = adm.properties;
|
||||
props.searchItemsPerPage = dlg.getValue("search_items").intValue();
|
||||
props.postsOnFrontPage = dlg.getValue("fp_posts").intValue();
|
||||
props.auditRecordsPerPage = dlg.getValue("audit_recs").intValue();
|
||||
props.communityCreateLevel = dlg.getValue("create_lvl").intValue();
|
||||
props.communityMembersPerPage = dlg.getValue("comm_mbrs").intValue();
|
||||
props.postsPerPage = dlg.getValue("posts_page").intValue();
|
||||
props.oldPostsAtTop = dlg.getValue("old_posts").intValue();
|
||||
props.conferenceMembersPerPage = dlg.getValue("conf_mbrs").intValue();
|
||||
props.displayPostPictures = dlg.getValue("pic_in_post").booleanValue();
|
||||
adm.properties = props;
|
||||
|
||||
// done - bounce back to the menu
|
||||
rc = new Redirect("sysadmin/menu.js.vs",LinkTypes.SERVLET);
|
||||
|
||||
} // end try
|
||||
catch (e)
|
||||
{ // caught an exception - figure out what to do
|
||||
etype = vlib.exceptionType(e) + "";
|
||||
if (etype.match("ValidationException"))
|
||||
{ // validation error - reset the dialog and try again
|
||||
dlg.setErrorMessage(e.message + " Please try again.");
|
||||
setupDialog(dlg,rinput.engine);
|
||||
rc = dlg;
|
||||
|
||||
} // end if
|
||||
else if (etype.match("AccessError"))
|
||||
rc = new ErrorBox("Access Error","You do not have permission to administer the system.",null);
|
||||
else if (etype.match("DataException"))
|
||||
rc = new ErrorBox("Database Error","Unable to update global properties: " + e.message,
|
||||
"sysadmin/menu.js.vs");
|
||||
else
|
||||
rc = e;
|
||||
|
||||
} // end catch
|
||||
|
||||
} // end if
|
||||
else
|
||||
{ // what the hell got clicked?
|
||||
logger.error("no known button click on POST to sysadmin/global.js");
|
||||
rc = new ErrorBox("Internal Error","Unknown command button pressed","sysadmin/menu.js.vs");
|
||||
|
||||
} // end else
|
||||
|
||||
vlib.output(rc);
|
||||
85
scripts/sysadmin/import.js
Normal file
85
scripts/sysadmin/import.js
Normal file
@@ -0,0 +1,85 @@
|
||||
// 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):
|
||||
|
||||
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.helpers);
|
||||
importPackage(Packages.com.silverwrist.venice.ui.view);
|
||||
|
||||
rinput = bsf.lookupBean("request");
|
||||
|
||||
if (!(rinput.user.hasAdminAccess()))
|
||||
{ // no admin access - we can't do this
|
||||
vlib.output(new ErrorBox("Access Error","You do not have permission to administer the system.",null));
|
||||
vlib.done();
|
||||
|
||||
} // end if
|
||||
|
||||
if ("GET"==rinput.verb)
|
||||
{ // build a JSPView to hold the upload form
|
||||
vlib.output(new JSPView("Import User Accounts","sysadmin/import_form.jsp"));
|
||||
vlib.done();
|
||||
|
||||
} // end if
|
||||
|
||||
// the following assumes a POST
|
||||
if (rinput.isImageButtonClicked("cancel"))
|
||||
{ // redirect back to the admin menu
|
||||
vlib.output(new Redirect("sysadmin/menu.js.vs",LinkTypes.SERVLET));
|
||||
vlib.done();
|
||||
|
||||
} // end if
|
||||
|
||||
if (!(rinput.isImageButtonClicked("upload")))
|
||||
{ // the buttons must be wrong!
|
||||
logger.error("no known button click on POST, to sysadmin/import.js");
|
||||
vlib.output(new ErrorBox("Internal Error","Unknown command button pressed","sysadmin/menu.js.vs"));
|
||||
vlib.done();
|
||||
|
||||
} // end if
|
||||
|
||||
if (!(rinput.isFileParam("idata")))
|
||||
{ // the idata parameter MUST be a file parameter!
|
||||
vlib.output(new ErrorBox("Internal Error","Invalid input file parameter.","sysadmin/menu.js.vs"));
|
||||
vlib.done();
|
||||
|
||||
} // end if
|
||||
|
||||
rc = null;
|
||||
try
|
||||
{ // prepare and load the XML file
|
||||
ihelper = new ImportHelper(rinput.user.adminInterface,rinput.getParameterDataStream("idata"));
|
||||
|
||||
// set up the return value
|
||||
rinput.setRequestAttribute("import.helper",ihelper);
|
||||
rc = new JSPView("Import User Accounts","sysadmin/import_results.jsp");
|
||||
|
||||
} // end try
|
||||
catch (e)
|
||||
{ // translate the various exception types here
|
||||
etype = vlib.exceptionType(e) + "";
|
||||
if (etype.match("ServletMultipartException"))
|
||||
rc = new ErrorBox("Internal Error","Error loading post data: " + e.message,"sysadmin/menu.js.vs");
|
||||
else if (etype.match("AccessError"))
|
||||
rc = new ErrorBox("Access Error","You do not have permission to administer the system.",null);
|
||||
else
|
||||
rc = e;
|
||||
|
||||
} // end catch
|
||||
|
||||
vlib.output(rc); // all done!
|
||||
37
scripts/sysadmin/menu.js
Normal file
37
scripts/sysadmin/menu.js
Normal file
@@ -0,0 +1,37 @@
|
||||
// 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):
|
||||
|
||||
importPackage(java.util);
|
||||
importPackage(Packages.com.silverwrist.venice.core);
|
||||
importPackage(Packages.com.silverwrist.venice.except);
|
||||
importPackage(Packages.com.silverwrist.venice.ui);
|
||||
importPackage(Packages.com.silverwrist.venice.ui.helpers);
|
||||
importPackage(Packages.com.silverwrist.venice.ui.view);
|
||||
|
||||
// get the request object
|
||||
rinput = bsf.lookupBean("request");
|
||||
|
||||
if (!(rinput.user.hasAdminAccess()))
|
||||
{ // you don't have permission to administer the system
|
||||
vlib.output(new ErrorBox("Access Error","You do not have permission to administer the system.",null));
|
||||
vlib.done();
|
||||
|
||||
} // end if
|
||||
|
||||
// build a view around it and return it
|
||||
rc = new MenuView(rinput.getMenu("system.admin"));
|
||||
rc.menuSelector = Content.MENU_SELECTOR_COMMUNITY;
|
||||
vlib.output(rc);
|
||||
148
scripts/sysadmin/modify_photo.js
Normal file
148
scripts/sysadmin/modify_photo.js
Normal file
@@ -0,0 +1,148 @@
|
||||
// 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):
|
||||
|
||||
importClass(java.awt.Dimension);
|
||||
importPackage(Packages.com.silverwrist.util);
|
||||
importPackage(Packages.com.silverwrist.util.image);
|
||||
importPackage(Packages.com.silverwrist.venice.core);
|
||||
importPackage(Packages.com.silverwrist.venice.except);
|
||||
importPackage(Packages.com.silverwrist.venice.ui);
|
||||
importPackage(Packages.com.silverwrist.venice.ui.helpers);
|
||||
importPackage(Packages.com.silverwrist.venice.ui.view);
|
||||
|
||||
// Get the request object.
|
||||
rinput = bsf.lookupBean("request");
|
||||
|
||||
if (!(rinput.user.hasAdminAccess()))
|
||||
{ // no admin access - we can't do this
|
||||
vlib.output(new ErrorBox("Access Error","You do not have permission to administer the system.",null));
|
||||
vlib.done();
|
||||
|
||||
} // end if
|
||||
|
||||
uid = rinput.getParameterInt("uid",0);
|
||||
if (uid==0)
|
||||
{ // user ID not found
|
||||
vlib.output(new ErrorBox(null,"User ID parameter not found.","sysadmin/find_user.js.vs"));
|
||||
vlib.done();
|
||||
|
||||
} // end if
|
||||
|
||||
rc = null;
|
||||
if ("GET"==rinput.verb)
|
||||
{ // create a PhotoUploader to do the photo uploading
|
||||
try
|
||||
{ // create and initialize the PhotoUploader
|
||||
adm = rinput.user.adminInterface;
|
||||
admuser = adm.getUserContext(uid);
|
||||
rc = new PhotoUploader("Upload User Photo","sysadmin/modify_photo.js.vs",LinkTypes.SERVLET);
|
||||
rc.addHiddenParameter("uid",uid);
|
||||
rc.photoTag = rinput.getUserPhotoTag(admuser.getContactInfo().photoURL);
|
||||
rc.label = "New user photo";
|
||||
|
||||
} // end try
|
||||
catch (e)
|
||||
{ // an exception in the output...
|
||||
etype = vlib.exceptionType(e) + "";
|
||||
if (etype.match("DataException"))
|
||||
rc = new ErrorBox("Database Error","Database error generating display: " + e.message,
|
||||
"sysadmin/find_user.js.vs");
|
||||
else if (etype.match("AccessError"))
|
||||
rc = new ErrorBox(null,"User ID parameter not found.","sysadmin/find_user.js.vs");
|
||||
else
|
||||
rc = e;
|
||||
|
||||
} // end catch
|
||||
|
||||
vlib.output(rc);
|
||||
vlib.done();
|
||||
|
||||
} // end if
|
||||
|
||||
// If the cancel button was clicked, bounce out of here.
|
||||
if (rinput.isImageButtonClicked("cancel"))
|
||||
{ // user elected to cancel upload - bounce us out of here
|
||||
vlib.output(new Redirect("sysadmin/modify_user.js.vs?uid=" + uid,LinkTypes.SERVLET));
|
||||
vlib.done();
|
||||
|
||||
} // end if
|
||||
|
||||
if (rinput.isImageButtonClicked("upload"))
|
||||
{ // do some shorts-checking in the parameters
|
||||
if (!(rinput.isFileParam("thepic")))
|
||||
{ // bogus file parameter
|
||||
logger.error("Internal Error: 'thepic' should be a file param");
|
||||
vlib.output(new ErrorBox(null,"Internal Error: 'thepic' should be a file param",
|
||||
"sysadmin/modify_user.js.vs?uid=" + uid));
|
||||
vlib.done();
|
||||
|
||||
} // end if
|
||||
|
||||
mimetype = rinput.getParameterType("thepic") + "";
|
||||
if (!(mimetype.match("image/")))
|
||||
{ // not an image file type that got uploaded
|
||||
logger.error("Error: 'thepic' not an image type");
|
||||
vlib.output(new ErrorBox(null,"You did not upload an image file. Try again.",
|
||||
"sysadmin/modify_photo.js.vs?uid=" + uid));
|
||||
vlib.done();
|
||||
|
||||
} // end if
|
||||
|
||||
try
|
||||
{ // normalize the photo to 100x100 pixels
|
||||
real_pic = ImageNormalizer.normalizeImage(rinput.getParameterDataStream("thepic"),
|
||||
rinput.engine.getUserPhotoSize(),"jpeg");
|
||||
|
||||
// set the user photo data!
|
||||
adm = rinput.user.adminInterface;
|
||||
admuser = adm.getUserContext(uid);
|
||||
ci = admuser.getContactInfo();
|
||||
ci.setPhotoData(rinput.contextPath + "/imagedata/","image/jpeg",real_pic.length,real_pic.data);
|
||||
admuser.putContactInfo(ci);
|
||||
|
||||
// Jump back to the profile form.
|
||||
rc = new Redirect("sysadmin/modify_user.js.vs?uid=" + uid,LinkTypes.SERVLET);
|
||||
|
||||
} // end try
|
||||
catch (e)
|
||||
{ // exception while setting user photo
|
||||
etype = vlib.exceptionType(e) + "";
|
||||
if (etype.match("ServletMultipartException"))
|
||||
rc = new ErrorBox(null,"Internal Error: " + e.message,"sysadmin/modify_user.js.vs?uid=" + uid);
|
||||
else if (etype.match("ImageNormalizerException"))
|
||||
rc = new ErrorBox(null,e.message,"sysadmin/modify_photo.js.vs?uid=" + uid);
|
||||
else if (etype.match("DataException"))
|
||||
rc = new ErrorBox("Database Error","Database error storing user photo: " + e.message,
|
||||
"sysadmin/modify_user.js.vs?uid=" + uid);
|
||||
else if (etype.match("EmailException"))
|
||||
rc = new ErrorBox(null,"Internal Error: " + e.message,"sysadmin/modify_user.js.vs?uid=" + uid);
|
||||
else if (etype.match("AccessError"))
|
||||
rc = new ErrorBox("Access Error","You do not have permission to administer the system.",null);
|
||||
else
|
||||
rc = e;
|
||||
|
||||
} // end catch
|
||||
|
||||
} // end if
|
||||
else
|
||||
{ // don't know the command button!
|
||||
logger.error("no known button click on POST to sysadmin/modify_photo.js");
|
||||
rc = new ErrorBox("Internal Error","Unknown command button pressed",
|
||||
"sysadmin/modify_user.js.vs?uid=" + uid);
|
||||
|
||||
} // end else
|
||||
|
||||
vlib.output(rc); // all done!
|
||||
283
scripts/sysadmin/modify_user.js
Normal file
283
scripts/sysadmin/modify_user.js
Normal file
@@ -0,0 +1,283 @@
|
||||
// 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):
|
||||
|
||||
importPackage(java.util);
|
||||
importPackage(Packages.com.silverwrist.venice.core);
|
||||
importPackage(Packages.com.silverwrist.venice.except);
|
||||
importPackage(Packages.com.silverwrist.venice.ui);
|
||||
importPackage(Packages.com.silverwrist.venice.ui.dlg);
|
||||
importPackage(Packages.com.silverwrist.venice.ui.helpers);
|
||||
|
||||
function setupDialog(dlg,adm,user)
|
||||
{
|
||||
dlg.setSubtitle("User: " + user.userName);
|
||||
var role_list = adm.getAllowedRoleList();
|
||||
dlg.sendMessage("base_lvl","setRoleList",role_list);
|
||||
|
||||
// See if this level was found on the list.
|
||||
var my_role = user.baseRole;
|
||||
var found = false;
|
||||
var it = role_list.iterator();
|
||||
while (it.hasNext())
|
||||
{ // seek each role in turn
|
||||
var r = it.next();
|
||||
if (r.equals(my_role))
|
||||
{ // found it!
|
||||
found = true;
|
||||
break;
|
||||
|
||||
} // end if
|
||||
|
||||
} // end while
|
||||
|
||||
if (!found) // role not found - set the defined role list to be a singleton
|
||||
dlg.sendMessage("base_lvl","setRoleList",Collections.singletonList(my_role));
|
||||
dlg.sendMessage("photo","setLinkURL","sysadmin/modify_photo.js.vs?uid=" + admuser.UID);
|
||||
|
||||
} // end setupDialog
|
||||
|
||||
rinput = bsf.lookupBean("request");
|
||||
|
||||
if (!(rinput.user.hasAdminAccess()))
|
||||
{ // no admin access - we can't do this
|
||||
vlib.output(new ErrorBox("Access Error","You do not have permission to administer the system.",null));
|
||||
vlib.done();
|
||||
|
||||
} // end if
|
||||
|
||||
dlg = rinput.getDialog("admin.modify.user");
|
||||
|
||||
rc = null;
|
||||
if ("GET"==rinput.verb)
|
||||
{ // set up the dialog
|
||||
uid = rinput.getParameterInt("uid",0);
|
||||
if (uid==0)
|
||||
{ // user ID not found
|
||||
vlib.output(new ErrorBox(null,"User ID parameter not found.","sysadmin/find_user.js.vs"));
|
||||
vlib.done();
|
||||
|
||||
} // end if
|
||||
|
||||
try
|
||||
{ // load the user's data and populate the dialog box
|
||||
adm = rinput.user.adminInterface;
|
||||
admuser = adm.getUserContext(uid);
|
||||
setupDialog(dlg,adm,admuser); // set up the dialog box
|
||||
dlg.setValue("uid",admuser.UID);
|
||||
|
||||
dlg.setValue("base_lvl",admuser.baseLevel);
|
||||
if (admuser.isEmailVerified())
|
||||
dlg.setValue("verify_email",1);
|
||||
if (admuser.isLockedOut())
|
||||
dlg.setValue("lockout",1);
|
||||
|
||||
ci = admuser.getContactInfo(); // get the main contact info
|
||||
props = admuser.properties;
|
||||
|
||||
if (props.disallowPhoto)
|
||||
dlg.setValue("nophoto",1);
|
||||
dlg.setValue("prefix",ci.namePrefix);
|
||||
dlg.setValue("first",ci.givenName);
|
||||
if (ci.middleInitial!=' ')
|
||||
dlg.setValue("mid",String.fromCharCode(ci.middleInitial));
|
||||
dlg.setValue("last",ci.familyName);
|
||||
dlg.setValue("suffix",ci.nameSuffix);
|
||||
dlg.setValue("company",ci.company);
|
||||
dlg.setValue("addr1",ci.addressLine1);
|
||||
dlg.setValue("addr2",ci.addressLine2);
|
||||
if (ci.privateAddress)
|
||||
dlg.setValue("pvt_addr",1);
|
||||
dlg.setValue("loc",ci.locality);
|
||||
dlg.setValue("reg",ci.region);
|
||||
dlg.setValue("pcode",ci.postalCode);
|
||||
dlg.setValue("country",ci.country);
|
||||
dlg.setValue("phone",ci.phone);
|
||||
dlg.setValue("mobile",ci.mobile);
|
||||
if (ci.privatePhone)
|
||||
dlg.setValue("pvt_phone",1);
|
||||
dlg.setValue("fax",ci.fax);
|
||||
if (ci.privateFax)
|
||||
dlg.setValue("pvt_fax",1);
|
||||
dlg.setValue("email",ci.email);
|
||||
if (ci.privateEmail)
|
||||
dlg.setValue("pvt_email",1);
|
||||
dlg.setValue("url",ci.URL);
|
||||
dlg.setValue("descr",admuser.description);
|
||||
dlg.setValue("photo",ci.photoURL);
|
||||
if (props.displayPostPictures)
|
||||
dlg.setValue("pic_in_post",1);
|
||||
if (props.massMailOptOut)
|
||||
dlg.setValue("no_mass_mail",1);
|
||||
dlg.setValue("locale",admuser.locale);
|
||||
dlg.setValue("tz",admuser.timeZone);
|
||||
|
||||
rc = dlg;
|
||||
|
||||
} // end try
|
||||
catch (e)
|
||||
{ // exception initializing dialog
|
||||
etype = vlib.exceptionType(e) + "";
|
||||
if (etype.match("DataException"))
|
||||
rc = new ErrorBox("Database Error","Unable to retrieve user information: " + e.message,
|
||||
"sysadmin/find_user.js.vs");
|
||||
else if (etype.match("AccessError"))
|
||||
rc = new ErrorBox("Access Error","You do not have permission to administer the system.",null);
|
||||
else
|
||||
rc = e;
|
||||
|
||||
} // end catch
|
||||
|
||||
vlib.output(rc);
|
||||
vlib.done();
|
||||
|
||||
} // end if
|
||||
|
||||
// everything that follows is for a POST operation
|
||||
op = dlg.whichButton(rinput) + "";
|
||||
if (op=="cancel")
|
||||
{ // user cancelled profile update - bounce back to the target
|
||||
vlib.output(new Redirect("sysadmin/find_user.js.vs",LinkTypes.SERVLET));
|
||||
vlib.done();
|
||||
|
||||
} // end if
|
||||
|
||||
dlg.load(rinput); // load the dialog parameters
|
||||
|
||||
if (op=="update")
|
||||
{ // we're updating the user
|
||||
try
|
||||
{ // get the admin interface and the user information
|
||||
uid = parseInt(dlg.getValue("uid"),10);
|
||||
adm = rinput.user.adminInterface;
|
||||
admuser = adm.getUserContext(uid);
|
||||
|
||||
try
|
||||
{ // validate the dialog
|
||||
dlg.validate();
|
||||
|
||||
// check the passwords
|
||||
pass1 = dlg.getValue("pass1") + "";
|
||||
pass2 = dlg.getValue("pass2") + "";
|
||||
|
||||
if (vlib.emptyString(pass1))
|
||||
{ // empty must match empty
|
||||
if (!(vlib.emptyString(pass2)))
|
||||
throw new ValidationException("The typed passwords do not match.");
|
||||
|
||||
} // end if
|
||||
else
|
||||
{ // the two passwords must match
|
||||
if (pass1!=pass2)
|
||||
throw new ValidationException("The typed passwords do not match.");
|
||||
|
||||
} // end else
|
||||
|
||||
// reset the base level
|
||||
admuser.baseLevel = dlg.getValue("base_lvl").intValue();
|
||||
|
||||
// Change the password if applicable.
|
||||
if (!(vlib.emptyString(pass1)))
|
||||
admuser.setPassword(pass1,dlg.getValue("remind"));
|
||||
|
||||
admuser.setEmailVerified(dlg.getValue("verify_email").booleanValue());
|
||||
admuser.setLockedOut(dlg.getValue("lockout").booleanValue());
|
||||
|
||||
ci = admuser.getContactInfo(); // get the main contact info
|
||||
props = admuser.properties;
|
||||
|
||||
// Reset all the contact info fields.
|
||||
props.disallowPhoto = dlg.getValue("nophoto").booleanValue();
|
||||
ci.namePrefix = dlg.getValue("prefix");
|
||||
ci.givenName = dlg.getValue("first");
|
||||
blort = dlg.getValue("mid") + "";
|
||||
if (blort.length<1)
|
||||
ci.middleInitial = " ";
|
||||
else
|
||||
ci.middleInitial = blort.substring(0,1);
|
||||
ci.familyName = dlg.getValue("last");
|
||||
ci.nameSuffix = dlg.getValue("suffix");
|
||||
ci.company = dlg.getValue("company");
|
||||
ci.addressLine1 = dlg.getValue("addr1");
|
||||
ci.addressLine2 = dlg.getValue("addr2");
|
||||
ci.privateAddress = dlg.getValue("pvt_addr").booleanValue();
|
||||
ci.locality = dlg.getValue("loc");
|
||||
ci.region = dlg.getValue("reg");
|
||||
ci.postalCode = dlg.getValue("pcode");
|
||||
ci.country = dlg.getValue("country");
|
||||
ci.phone = dlg.getValue("phone");
|
||||
ci.mobile = dlg.getValue("mobile");
|
||||
ci.privatePhone = dlg.getValue("pvt_phone").booleanValue();
|
||||
ci.fax = dlg.getValue("fax");
|
||||
ci.privateFax = dlg.getValue("pvt_fax").booleanValue();
|
||||
ci.email = dlg.getValue("email");
|
||||
ci.privateEmail = dlg.getValue("pvt_email").booleanValue();
|
||||
ci.URL = dlg.getValue("url");
|
||||
props.displayPostPictures = dlg.getValue("pic_in_post").booleanValue();
|
||||
props.massMailOptOut = dlg.getValue("no_mass_mail").booleanValue();
|
||||
|
||||
// Store the completed contact info.
|
||||
admuser.putContactInfo(ci);
|
||||
admuser.properties = props;
|
||||
|
||||
// Save off the user's description and preferences.
|
||||
admuser.description = dlg.getValue("descr");
|
||||
admuser.locale = dlg.getValue("locale");
|
||||
admuser.timeZone = dlg.getValue("tz");
|
||||
|
||||
// redirect back to the Find User page
|
||||
rc = new Redirect("sysadmin/find_user.js.vs",LinkTypes.SERVLET);
|
||||
|
||||
} // end try
|
||||
catch (e)
|
||||
{ // catch ValidationExceptions here and redisplay the dialog
|
||||
etype = vlib.exceptionType(e) + "";
|
||||
if (etype.match("ValidationException"))
|
||||
{ // on a ValidationException, redisplay the dialog and try again
|
||||
dlg.setErrorMessage(e.message + " Please try again.");
|
||||
setupDialog(dlg,adm,admuser); // set up the dialog box
|
||||
dlg.setValue("pass1",null);
|
||||
dlg.setValue("pass2",null);
|
||||
rc = dlg;
|
||||
|
||||
} // end if
|
||||
else // propagate other types of exceptions
|
||||
throw e;
|
||||
|
||||
} // end catch
|
||||
|
||||
} // end try
|
||||
catch (e)
|
||||
{ // this is used to catch the hard exceptions
|
||||
etype = vlib.exceptionType(e) + "";
|
||||
if (etype.match("AccessError"))
|
||||
rc = new ErrorBox("Access Error","You do not have permission to administer the system.",null);
|
||||
else if (etype.match("DataException"))
|
||||
rc = new ErrorBox("Database Error","Unable to retrieve user information: " + e.message,
|
||||
"sysadmin/find_user.js.vs");
|
||||
else
|
||||
rc = e;
|
||||
|
||||
} // end catch
|
||||
|
||||
} // end if
|
||||
else
|
||||
{ // bogus button indicated
|
||||
logger.error("no known button click on POST to sysadmin/modify_user.js");
|
||||
rc = new ErrorBox("Internal Error","Unknown command button pressed","sysadmin/find_user.js.vs");
|
||||
|
||||
} // end else
|
||||
|
||||
vlib.output(rc); // all done!
|
||||
14
scripts/test/test1.jacl
Normal file
14
scripts/test/test1.jacl
Normal file
@@ -0,0 +1,14 @@
|
||||
# Script for testing the new UI framework
|
||||
package require java
|
||||
|
||||
set request [bsf lookupBean "request"]
|
||||
|
||||
if {[$request hasParameter "p"]} {
|
||||
$logger debug "Got the parameter value!"
|
||||
set tmp [$request getParameter "p"]
|
||||
set part1 "Requested parameter: $tmp<P>"
|
||||
} else {
|
||||
set part1 ""
|
||||
} ;# end if
|
||||
|
||||
$vlib output "$part1 <B>In the house!</B>"
|
||||
10
scripts/test/test2.jacl
Normal file
10
scripts/test/test2.jacl
Normal file
@@ -0,0 +1,10 @@
|
||||
# Script for testing the View mechanism
|
||||
package require java
|
||||
java::import com.silverwrist.venice.ui.LinkTypes
|
||||
|
||||
set rc [java::new com.silverwrist.venice.ui.view.TextMessage "Test Display" "subtitle"]
|
||||
set blort "If this had been an actual emergency we would all be dead by now."
|
||||
java::prop $rc text "This is a test.<BR>This is only a test.<BR>$blort"
|
||||
$rc addButton [java::field LinkTypes ABSOLUTE] "TODO" "ok"
|
||||
$rc addButton [java::field LinkTypes ABSOLUTE] "TODO" "cancel"
|
||||
$vlib output $rc
|
||||
12
scripts/test/test2.js
Normal file
12
scripts/test/test2.js
Normal file
@@ -0,0 +1,12 @@
|
||||
// Script for testing the View mechanism
|
||||
// Translation of test2.jacl
|
||||
|
||||
importPackage(Packages.com.silverwrist.venice.ui);
|
||||
importClass(Packages.com.silverwrist.venice.ui.view.TextMessage);
|
||||
|
||||
rc = new TextMessage("Test Display","JavaScript subtitle");
|
||||
blort = "If this had been an actual emergency we would all be dead by now."
|
||||
rc.text = "This is a test.<BR>This is only a test.<BR>" + blort;
|
||||
rc.addButton(LinkTypes.ABSOLUTE,"TODO","ok");
|
||||
rc.addButton(LinkTypes.ABSOLUTE,"TODO","cancel");
|
||||
vlib.output(rc);
|
||||
17
scripts/test/test3.jacl
Normal file
17
scripts/test/test3.jacl
Normal file
@@ -0,0 +1,17 @@
|
||||
# Script for testing the sidebox framework
|
||||
# Translated from test3.js
|
||||
|
||||
package require java
|
||||
java::import com.silverwrist.venice.ui.LinkTypes
|
||||
java::import com.silverwrist.venice.ui.view.SideBoxNestedView
|
||||
java::import com.silverwrist.venice.ui.view.TextMessage
|
||||
|
||||
set rinput [bsf lookupBean "request"]
|
||||
set rc [java::new TextMessage "Test Display" "Jacl subtitle"]
|
||||
set blort "If this had been an actual emergency we would all be dead by now."
|
||||
java::prop $rc text "This is a test.<BR>This is only a test.<BR>$blort"
|
||||
$rc addButton [java::field LinkTypes ABSOLUTE] "TODO" "ok"
|
||||
$rc addButton [java::field LinkTypes ABSOLUTE] "TODO" "cancel"
|
||||
|
||||
set rc2 [java::new SideBoxNestedView $rinput $rc]
|
||||
$vlib output $rc2
|
||||
13
scripts/test/test3.js
Normal file
13
scripts/test/test3.js
Normal file
@@ -0,0 +1,13 @@
|
||||
// Script for testing the sidebox framework
|
||||
|
||||
importPackage(Packages.com.silverwrist.venice.ui);
|
||||
importPackage(Packages.com.silverwrist.venice.ui.view);
|
||||
|
||||
rinput = bsf.lookupBean("request");
|
||||
rc = new TextMessage("Test Display","JavaScript subtitle");
|
||||
blort = "If this had been an actual emergency we would all be dead by now."
|
||||
rc.text = "This is a test.<BR>This is only a test.<BR>" + blort;
|
||||
rc.addButton(LinkTypes.ABSOLUTE,"TODO","ok");
|
||||
rc.addButton(LinkTypes.ABSOLUTE,"TODO","cancel");
|
||||
rc2 = new SideBoxNestedView(rinput,rc);
|
||||
vlib.output(rc2);
|
||||
73
scripts/top.js
Normal file
73
scripts/top.js
Normal file
@@ -0,0 +1,73 @@
|
||||
// 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):
|
||||
|
||||
importPackage(java.util);
|
||||
importPackage(Packages.com.silverwrist.venice.except);
|
||||
importPackage(Packages.com.silverwrist.venice.ui);
|
||||
importPackage(Packages.com.silverwrist.venice.ui.helpers);
|
||||
importPackage(Packages.com.silverwrist.venice.ui.view);
|
||||
|
||||
rinput = bsf.lookupBean("request");
|
||||
rc = null;
|
||||
try
|
||||
{ // get the list of front page posts!
|
||||
post_list = rinput.engine.getPublishedMessages(false);
|
||||
|
||||
// precalculate the message text and poster names of the front-page messages
|
||||
poster_names = new ArrayList(post_list.size());
|
||||
message_text = new ArrayList(post_list.size());
|
||||
topic_names = new ArrayList(post_list.size());
|
||||
topic_links = new ArrayList(post_list.size());
|
||||
for (i=0; i<post_list.size(); i++)
|
||||
{ // get the message text and creator name
|
||||
msg = vlib.castTopicMessageContext(post_list.get(i));
|
||||
poster_names.add(msg.getCreatorName());
|
||||
message_text.add(msg.getBodyText());
|
||||
topic = msg.getEnclosingTopic();
|
||||
topic_names.add(topic.getName());
|
||||
topic_links.add(topic.getPostLink());
|
||||
|
||||
} // end for
|
||||
|
||||
// save the lists as request variables so we can find them again
|
||||
rinput.setRequestAttribute("top.fp_posts",post_list);
|
||||
rinput.setRequestAttribute("top.fp_posts.names",poster_names);
|
||||
rinput.setRequestAttribute("top.fp_posts.text",message_text);
|
||||
rinput.setRequestAttribute("top.fp_posts.topics.names",topic_names);
|
||||
rinput.setRequestAttribute("top.fp_posts.topics.links",topic_links);
|
||||
|
||||
// create a JSP view object that'll display all this
|
||||
view = new JSPView("My Front Page","top_content.jsp");
|
||||
view.menuSelector = Content.MENU_SELECTOR_TOP;
|
||||
view.pageQID = "top";
|
||||
|
||||
// wrap the JSP view in our sidebox view for return
|
||||
rc = new SideBoxNestedView(rinput,view);
|
||||
|
||||
} // end try
|
||||
catch (e)
|
||||
{ // we caught something here - figure out what kind of error it is
|
||||
etype = vlib.exceptionType(e) + "";
|
||||
if (etype.match("DataException"))
|
||||
rc = new ErrorBox("Database Error","Error loading front page: " + e.getMessage(),null);
|
||||
else if (etype.match("AccessError"))
|
||||
rc = new ErrorBox("Access Error",e.getMessage(),null);
|
||||
else
|
||||
rc = e;
|
||||
|
||||
} // end catch
|
||||
|
||||
vlib.output(rc); // all done!
|
||||
76
scripts/usr/sidebox.js
Normal file
76
scripts/usr/sidebox.js
Normal file
@@ -0,0 +1,76 @@
|
||||
// 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):
|
||||
|
||||
importPackage(java.util);
|
||||
importPackage(Packages.com.silverwrist.venice.core);
|
||||
importPackage(Packages.com.silverwrist.venice.except);
|
||||
importPackage(Packages.com.silverwrist.venice.ui);
|
||||
importPackage(Packages.com.silverwrist.venice.ui.helpers);
|
||||
importPackage(Packages.com.silverwrist.venice.ui.view);
|
||||
|
||||
rinput = bsf.lookupBean("request");
|
||||
|
||||
rc = null;
|
||||
try
|
||||
{ // generate the list of sideboxes we have
|
||||
in_list = rinput.user.getSideBoxList();
|
||||
ids = new HashSet(in_list.size());
|
||||
it = in_list.iterator();
|
||||
while (it.hasNext())
|
||||
{ // add the IDs of all the sideboxes to the set
|
||||
descr = vlib.castSideBoxDescriptor(it.next());
|
||||
ids.add(descr.sideBoxID);
|
||||
|
||||
} // end for
|
||||
|
||||
all_list = rinput.engine.getMasterSideBoxList();
|
||||
out_list = null;
|
||||
if (all_list.size()>in_list.size())
|
||||
{ // allocate an ArrayList to hold the sideboxes
|
||||
out_list = new ArrayList(all_list.size()-in_list.size());
|
||||
it = all_list.iterator();
|
||||
while (it.hasNext())
|
||||
{ // get all sideboxes not on the "in" list and put them on the "out" list
|
||||
descr = vlib.castSideBoxDescriptor(it.next());
|
||||
if (!(ids.contains(descr.sideBoxID)))
|
||||
out_list.add(descr);
|
||||
|
||||
} // end while
|
||||
|
||||
} // end if
|
||||
else // nothing in the "out list"
|
||||
out_list = Collections.EMPTY_LIST;
|
||||
|
||||
// save off the two lists as request parameters
|
||||
rinput.setRequestAttribute("sideboxes.included",in_list);
|
||||
rinput.setRequestAttribute("sideboxes.excluded",out_list);
|
||||
|
||||
// create a new JSPView for this
|
||||
rc = new JSPView("Your Front Page Configuration","user/sidebox.jsp");
|
||||
rc.menuSelector = Content.MENU_SELECTOR_TOP;
|
||||
|
||||
} // end try
|
||||
catch (e)
|
||||
{ // we got some sort of exception here
|
||||
etype = vlib.exceptionType(e) + "";
|
||||
if (etype.match("DataException"))
|
||||
rc = new ErrorBox("Database Error","Error getting sidebox list: " + e.message(),"top.js.vs");
|
||||
else
|
||||
rc = e;
|
||||
|
||||
} // end catch
|
||||
|
||||
vlib.output(rc); // all done!
|
||||
52
scripts/usr/sidebox_add.js
Normal file
52
scripts/usr/sidebox_add.js
Normal file
@@ -0,0 +1,52 @@
|
||||
// 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):
|
||||
|
||||
importPackage(Packages.com.silverwrist.venice.core);
|
||||
importPackage(Packages.com.silverwrist.venice.except);
|
||||
importPackage(Packages.com.silverwrist.venice.ui);
|
||||
importPackage(Packages.com.silverwrist.venice.ui.helpers);
|
||||
|
||||
rinput = bsf.lookupBean("request");
|
||||
|
||||
boxid = rinput.getParameterInt("box",0);
|
||||
if (boxid==0)
|
||||
{ // the box ID parameter is invalid
|
||||
vlib.output(new ErrorBox(null,"Box parameter invalid!","usr/sidebox.js.vs"));
|
||||
vlib.done();
|
||||
|
||||
} // end if
|
||||
|
||||
rc = null;
|
||||
try
|
||||
{ // add the sidebox
|
||||
rinput.user.addSideBox(boxid);
|
||||
|
||||
// now execute the "sidebox.js" script to do the redisplay
|
||||
rc = vlib.exec("usr/sidebox.js");
|
||||
rinput.location = "usr/sidebox.js.vs";
|
||||
|
||||
} // end try
|
||||
catch (e)
|
||||
{ // exception adding to the sidebox list
|
||||
etype = vlib.exceptionType(e) + "";
|
||||
if (etype.match("DataException"))
|
||||
rc = new ErrorBox("Database Error","Error adding to sidebox list: " + e.message,"usr/sidebox.js.vs");
|
||||
else
|
||||
rc = e;
|
||||
|
||||
} // end catch
|
||||
|
||||
vlib.output(rc);
|
||||
65
scripts/usr/sidebox_delete.js
Normal file
65
scripts/usr/sidebox_delete.js
Normal file
@@ -0,0 +1,65 @@
|
||||
// The contents of this file are subject to the Mozilla Public License Version 1.1
|
||||
// (the "License"); you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at <http://www.mozilla.org/MPL/>.
|
||||
//
|
||||
// Software distributed under the License is distributed on an "AS IS" basis, WITHOUT
|
||||
// WARRANTY OF ANY KIND, either express or implied. See the License for the specific
|
||||
// language governing rights and limitations under the License.
|
||||
//
|
||||
// The Original Code is the Venice Web Communities System.
|
||||
//
|
||||
// The Initial Developer of the Original Code is Eric J. Bowersox <erbo@silcom.com>,
|
||||
// for Silverwrist Design Studios. Portions created by Eric J. Bowersox are
|
||||
// Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved.
|
||||
//
|
||||
// Contributor(s):
|
||||
|
||||
importPackage(Packages.com.silverwrist.venice.core);
|
||||
importPackage(Packages.com.silverwrist.venice.except);
|
||||
importPackage(Packages.com.silverwrist.venice.ui);
|
||||
importPackage(Packages.com.silverwrist.venice.ui.helpers);
|
||||
|
||||
rinput = bsf.lookupBean("request");
|
||||
|
||||
boxid = rinput.getParameterInt("box",0);
|
||||
if (boxid==0)
|
||||
{ // the box ID parameter is invalid
|
||||
vlib.output(new ErrorBox(null,"Box parameter invalid!","usr/sidebox.js.vs"));
|
||||
vlib.done();
|
||||
|
||||
} // end if
|
||||
|
||||
rc = null;
|
||||
try
|
||||
{ // locate the specified sidebox in the list
|
||||
sidebox_list = rinput.user.getSideBoxList();
|
||||
curr = null;
|
||||
it = sidebox_list.iterator();
|
||||
found = false;
|
||||
while (!found && it.hasNext())
|
||||
{ // look for the right descriptor
|
||||
curr = vlib.castUserSideBoxDescriptor(it.next());
|
||||
if (boxid==curr.sideBoxID) // found the current one
|
||||
found = true;
|
||||
|
||||
} // end while
|
||||
|
||||
if (found)
|
||||
curr.remove(); // remove the sidebox
|
||||
|
||||
// now execute the "sidebox.js" script to do the redisplay
|
||||
rc = vlib.exec("usr/sidebox.js");
|
||||
rinput.location = "usr/sidebox.js.vs";
|
||||
|
||||
} // end try
|
||||
catch (e)
|
||||
{ // exception modifying the sidebox list
|
||||
etype = vlib.exceptionType(e) + "";
|
||||
if (etype.match("DataException"))
|
||||
rc = new ErrorBox("Database Error","Error adjusting sidebox list: " + e.message,"usr/sidebox.js.vs");
|
||||
else
|
||||
rc = e;
|
||||
|
||||
} // end catch
|
||||
|
||||
vlib.output(rc);
|
||||
90
scripts/usr/sidebox_down.js
Normal file
90
scripts/usr/sidebox_down.js
Normal file
@@ -0,0 +1,90 @@
|
||||
// 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):
|
||||
|
||||
importPackage(Packages.com.silverwrist.venice.core);
|
||||
importPackage(Packages.com.silverwrist.venice.except);
|
||||
importPackage(Packages.com.silverwrist.venice.ui);
|
||||
importPackage(Packages.com.silverwrist.venice.ui.helpers);
|
||||
|
||||
rinput = bsf.lookupBean("request");
|
||||
|
||||
boxid = rinput.getParameterInt("box",0);
|
||||
if (boxid==0)
|
||||
{ // the box ID parameter is invalid
|
||||
vlib.output(new ErrorBox(null,"Box parameter invalid!","usr/sidebox.js.vs"));
|
||||
vlib.done();
|
||||
|
||||
} // end if
|
||||
|
||||
rc = null;
|
||||
try
|
||||
{ // locate the specified sidebox in the list
|
||||
sidebox_list = rinput.user.getSideBoxList();
|
||||
next = null;
|
||||
curr = null;
|
||||
it = sidebox_list.iterator();
|
||||
found = false;
|
||||
while (!found && it.hasNext())
|
||||
{ // look for the right descriptor
|
||||
curr = vlib.castUserSideBoxDescriptor(it.next());
|
||||
if (boxid==curr.sideBoxID)
|
||||
{ // found the current one - get the next one as well
|
||||
found = true;
|
||||
if (it.hasNext())
|
||||
next = vlib.castUserSideBoxDescriptor(it.next());
|
||||
|
||||
} // end if
|
||||
|
||||
} // end while
|
||||
|
||||
if (found && (next!=null))
|
||||
{ // exchange sequence numbers between curr and next
|
||||
seq_curr = curr.sequence;
|
||||
seq_next = next.sequence;
|
||||
curr.sequence = seq_next; // first "set"
|
||||
restore = true;
|
||||
try
|
||||
{ // do the second "set"
|
||||
next.sequence = seq_curr;
|
||||
restore = false;
|
||||
|
||||
} // end try
|
||||
finally
|
||||
{ // restore first if second failed
|
||||
if (restore)
|
||||
curr.sequence = seq_curr;
|
||||
|
||||
} // end finally
|
||||
|
||||
} // end if
|
||||
// else just fall out and don't do anything
|
||||
|
||||
// now execute the "sidebox.js" script to do the redisplay
|
||||
rc = vlib.exec("usr/sidebox.js");
|
||||
rinput.location = "usr/sidebox.js.vs";
|
||||
|
||||
} // end try
|
||||
catch (e)
|
||||
{ // exception modifying the sidebox list
|
||||
etype = vlib.exceptionType(e) + "";
|
||||
if (etype.match("DataException"))
|
||||
rc = new ErrorBox("Database Error","Error adjusting sidebox list: " + e.message,"usr/sidebox.js.vs");
|
||||
else
|
||||
rc = e;
|
||||
|
||||
} // end catch
|
||||
|
||||
vlib.output(rc);
|
||||
87
scripts/usr/sidebox_up.js
Normal file
87
scripts/usr/sidebox_up.js
Normal file
@@ -0,0 +1,87 @@
|
||||
// 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):
|
||||
|
||||
importPackage(Packages.com.silverwrist.venice.core);
|
||||
importPackage(Packages.com.silverwrist.venice.except);
|
||||
importPackage(Packages.com.silverwrist.venice.ui);
|
||||
importPackage(Packages.com.silverwrist.venice.ui.helpers);
|
||||
|
||||
rinput = bsf.lookupBean("request");
|
||||
|
||||
boxid = rinput.getParameterInt("box",0);
|
||||
if (boxid==0)
|
||||
{ // the box ID parameter is invalid
|
||||
vlib.output(new ErrorBox(null,"Box parameter invalid!","usr/sidebox.js.vs"));
|
||||
vlib.done();
|
||||
|
||||
} // end if
|
||||
|
||||
rc = null;
|
||||
try
|
||||
{ // locate the specified sidebox in the list
|
||||
sidebox_list = rinput.user.getSideBoxList();
|
||||
prev = null;
|
||||
current = null;
|
||||
it = sidebox_list.iterator();
|
||||
found = false;
|
||||
while (!found && it.hasNext())
|
||||
{ // look for the right descriptor
|
||||
prev = current;
|
||||
current = vlib.castUserSideBoxDescriptor(it.next());
|
||||
if (boxid==current.sideBoxID) // found the current one
|
||||
found = true;
|
||||
|
||||
} // end while
|
||||
|
||||
if (found && (prev!=null))
|
||||
{ // exchange sequence numbers between current and prev
|
||||
seq_curr = current.sequence;
|
||||
seq_prev = prev.sequence;
|
||||
current.sequence = seq_prev; // first "set"
|
||||
restore = true;
|
||||
try
|
||||
{ // do the second "set"
|
||||
prev.sequence = seq_curr;
|
||||
restore = false;
|
||||
|
||||
} // end try
|
||||
finally
|
||||
{ // restore first if second failed
|
||||
if (restore)
|
||||
current.sequence = seq_curr;
|
||||
|
||||
} // end finally
|
||||
|
||||
} // end if
|
||||
else
|
||||
logger.debug("sidebox_up.js not doing anything");
|
||||
|
||||
// now execute the "sidebox.js" script to do the redisplay
|
||||
rc = vlib.exec("usr/sidebox.js");
|
||||
rinput.location = "usr/sidebox.js.vs";
|
||||
|
||||
} // end try
|
||||
catch (e)
|
||||
{ // exception modifying the sidebox list
|
||||
etype = vlib.exceptionType(e) + "";
|
||||
if (etype.match("DataException"))
|
||||
rc = new ErrorBox("Database Error","Error adjusting sidebox list: " + e.message,"usr/sidebox.js.vs");
|
||||
else
|
||||
rc = e;
|
||||
|
||||
} // end catch
|
||||
|
||||
vlib.output(rc);
|
||||
145
scripts/verify_email.js
Normal file
145
scripts/verify_email.js
Normal file
@@ -0,0 +1,145 @@
|
||||
// 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):
|
||||
|
||||
importPackage(Packages.com.silverwrist.venice.core);
|
||||
importPackage(Packages.com.silverwrist.venice.except);
|
||||
importPackage(Packages.com.silverwrist.venice.ui);
|
||||
importPackage(Packages.com.silverwrist.venice.ui.dlg);
|
||||
importPackage(Packages.com.silverwrist.venice.ui.helpers);
|
||||
|
||||
// Get the request object and the target URI.
|
||||
rinput = bsf.lookupBean("request");
|
||||
target = rinput.getParameter("tgt");
|
||||
if (target==null)
|
||||
target = "top.js.vs";
|
||||
|
||||
// If the user is not logged in, this is an error.
|
||||
user = rinput.user;
|
||||
if (!(user.isLoggedIn()))
|
||||
{ // user not logged in - just bail on this
|
||||
vlib.output(new ErrorBox(null,"You must log in before you can verify your account's email address."));
|
||||
vlib.done();
|
||||
|
||||
} // end if
|
||||
|
||||
// If the user's E-mail address is already verified, this is a no-op.
|
||||
if (user.isEmailVerified())
|
||||
{ // user already verified - just bail on this
|
||||
vlib.output(new Redirect(target,LinkTypes.SERVLET));
|
||||
vlib.done();
|
||||
|
||||
} // end if
|
||||
|
||||
dlg = rinput.getDialog("verify"); // retrieve the verification dialog
|
||||
|
||||
if ("GET"==rinput.verb)
|
||||
{ // display the dialog and have done with it
|
||||
dlg.setValue("tgt",target);
|
||||
rinput.location = target;
|
||||
rinput.displayLogin = false;
|
||||
vlib.output(dlg);
|
||||
vlib.done();
|
||||
|
||||
} // end if
|
||||
|
||||
// everything that follows is for a POST operation
|
||||
op = dlg.whichButton(rinput) + "";
|
||||
if (op=="cancel")
|
||||
{ // user cancelled verify - bounce back to the target
|
||||
vlib.output(new Redirect(target,LinkTypes.SERVLET));
|
||||
vlib.done();
|
||||
|
||||
} // end if
|
||||
|
||||
dlg.load(rinput); // load the dialog parameters
|
||||
rc = null; // return from this script
|
||||
if (op=="sendagain")
|
||||
{ // we want to resend the E-mail confirmation
|
||||
try
|
||||
{ // do the resend!
|
||||
user.resendEmailConfirmation();
|
||||
|
||||
// now display the dialog again
|
||||
dlg.clear();
|
||||
dlg.setValue("tgt",target);
|
||||
rinput.location = target;
|
||||
rinput.displayLogin = false;
|
||||
rc = dlg;
|
||||
|
||||
} // end try
|
||||
catch (e)
|
||||
{ // exception when resending the email confirmation
|
||||
etype = vlib.exceptionType(e) + "";
|
||||
if (etype.match("DataException"))
|
||||
rc = new ErrorBox("Database Error","Database error sending confirmation: " + e.message,target);
|
||||
else if (etype.match("EmailException"))
|
||||
rc = new ErrorBox("E-mail Error","E-mail error sending confirmation: " + e.message,target);
|
||||
else
|
||||
rc = e;
|
||||
|
||||
} // end catch
|
||||
|
||||
} // end if
|
||||
else if (op=="ok")
|
||||
{ // actually perform the confirmation
|
||||
try
|
||||
{ // validate the dialog first
|
||||
dlg.validate();
|
||||
|
||||
// now attempt the confirmation
|
||||
user.confirmEmail(dlg.getValue("num"));
|
||||
|
||||
// all done - go back to where we want to be
|
||||
rc = new Redirect(target,LinkTypes.SERVLET);
|
||||
|
||||
} // end try
|
||||
catch (e)
|
||||
{ // exception when confirming...
|
||||
etype = vlib.exceptionType(e) + "";
|
||||
if (etype.match("ValidationException"))
|
||||
{ // validation error thrown by dialog
|
||||
dlg.setErrorMessage(e.message + " Please try again.");
|
||||
dlg.setValue("num",null);
|
||||
rinput.location = target;
|
||||
rinput.displayLogin = false;
|
||||
rc = dlg;
|
||||
|
||||
} // end if
|
||||
else if (etype.match("DataException"))
|
||||
rc = new ErrorBox("Database Error","Database error verifying email: " + e.message,target);
|
||||
else if (etype.match("AccessError"))
|
||||
{ // invalid confirmation number, perhaps?
|
||||
dlg.setErrorMessage(e.message);
|
||||
dlg.setValue("num",null);
|
||||
rinput.location = target;
|
||||
rinput.displayLogin = false;
|
||||
rc = dlg;
|
||||
|
||||
} // end if
|
||||
else
|
||||
rc = e;
|
||||
|
||||
} // end catch
|
||||
|
||||
} // end else if
|
||||
else
|
||||
{ // button not found...
|
||||
logger.error("no known button click on POST to verify_email.js");
|
||||
rc = new ErrorBox("Internal Error","Unknown command button pressed",target);
|
||||
|
||||
} // end else
|
||||
|
||||
vlib.output(rc); // all done!
|
||||
Reference in New Issue
Block a user