2002-01-06 19:05:37 -07:00
|
|
|
// The contents of this file are subject to the Mozilla Public License Version 1.1
|
|
|
|
// (the "License"); you may not use this file except in compliance with the License.
|
|
|
|
// You may obtain a copy of the License at <http://www.mozilla.org/MPL/>.
|
|
|
|
//
|
|
|
|
// Software distributed under the License is distributed on an "AS IS" basis, WITHOUT
|
|
|
|
// WARRANTY OF ANY KIND, either express or implied. See the License for the specific
|
|
|
|
// language governing rights and limitations under the License.
|
|
|
|
//
|
|
|
|
// The Original Code is the Venice Web Communities System.
|
|
|
|
//
|
2006-01-25 21:40:34 -07:00
|
|
|
// The Initial Developer of the Original Code is Eric J. Bowersox <erbo@users.sf.net>,
|
2002-01-06 19:05:37 -07:00
|
|
|
// for Silverwrist Design Studios. Portions created by Eric J. Bowersox are
|
2002-01-16 16:23:57 -07:00
|
|
|
// Copyright (C) 2001-02 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved.
|
2002-01-06 19:05:37 -07:00
|
|
|
//
|
|
|
|
// 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);
|
2002-01-16 16:23:57 -07:00
|
|
|
if (rinput.engine.isValidCategoryID(catid))
|
2002-01-06 19:05:37 -07:00
|
|
|
{ // 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;
|
2002-01-16 16:23:57 -07:00
|
|
|
if (!(rinput.engine.isValidCategoryID(curr_catid)))
|
2002-01-06 19:05:37 -07:00
|
|
|
{ // 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);
|
|
|
|
|