venice-main-classic/scripts/conf/manage.js
2002-01-07 02:05:37 +00:00

87 lines
3.1 KiB
JavaScript

// 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!