117 lines
4.0 KiB
Java
117 lines
4.0 KiB
Java
/*
|
|
* The contents of this file are subject to the Mozilla Public License Version 1.1
|
|
* (the "License"); you may not use this file except in compliance with the License.
|
|
* You may obtain a copy of the License at <http://www.mozilla.org/MPL/>.
|
|
*
|
|
* Software distributed under the License is distributed on an "AS IS" basis, WITHOUT
|
|
* WARRANTY OF ANY KIND, either express or implied. See the License for the specific
|
|
* language governing rights and limitations under the License.
|
|
*
|
|
* The Original Code is the Venice Web Communities System.
|
|
*
|
|
* The Initial Developer of the Original Code is Eric J. Bowersox <erbo@silcom.com>,
|
|
* for Silverwrist Design Studios. Portions created by Eric J. Bowersox are
|
|
* Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved.
|
|
*
|
|
* Contributor(s):
|
|
*/
|
|
package com.silverwrist.venice.servlets.format;
|
|
|
|
import java.util.*;
|
|
import com.silverwrist.venice.ValidationException;
|
|
import com.silverwrist.venice.core.*;
|
|
|
|
public class CreateConferenceDialog extends ContentDialog
|
|
{
|
|
/*--------------------------------------------------------------------------------
|
|
* Attributes
|
|
*--------------------------------------------------------------------------------
|
|
*/
|
|
|
|
private VeniceEngine engine;
|
|
|
|
/*--------------------------------------------------------------------------------
|
|
* Constructors
|
|
*--------------------------------------------------------------------------------
|
|
*/
|
|
|
|
public CreateConferenceDialog()
|
|
{
|
|
super("Create New Conference",null,"newconfform","confops");
|
|
setHiddenField("cmd","C");
|
|
setHiddenField("sig","");
|
|
|
|
Vector vec_pubpriv = new Vector(2);
|
|
vec_pubpriv.add("0|Public");
|
|
vec_pubpriv.add("1|Private");
|
|
vec_pubpriv.trimToSize();
|
|
|
|
addFormField(new CDTextFormField("name","Conference Name",null,true,32,128));
|
|
addFormField(new CDVeniceIDFormField("alias","Conference Alias",null,true,32,64));
|
|
addFormField(new CDTextFormField("descr","Description",null,false,32,255));
|
|
addFormField(new CDSimplePickListFormField("ctype","Conference type",null,true,vec_pubpriv,'|'));
|
|
addFormField(new CDCheckBoxFormField("hide","Hide conference in the SIG's conference list",null,"Y"));
|
|
addCommandButton(new CDImageButton("create","bn_create.gif","Create",80,24));
|
|
addCommandButton(new CDImageButton("cancel","bn_cancel.gif","Cancel",80,24));
|
|
|
|
} // end constructor
|
|
|
|
protected CreateConferenceDialog(CreateConferenceDialog other)
|
|
{
|
|
super(other);
|
|
|
|
} // end constructor
|
|
|
|
/*--------------------------------------------------------------------------------
|
|
* Overrides from class ContentDialog
|
|
*--------------------------------------------------------------------------------
|
|
*/
|
|
|
|
protected void validateWholeForm() throws ValidationException
|
|
{
|
|
if (engine.confAliasExists(getFieldValue("alias")))
|
|
throw new ValidationException("That alias is already used by another conference on the system.");
|
|
|
|
} // end validateWholeForm
|
|
|
|
/*--------------------------------------------------------------------------------
|
|
* External operations
|
|
*--------------------------------------------------------------------------------
|
|
*/
|
|
|
|
public void setupDialog(VeniceEngine engine, SIGContext sig)
|
|
{
|
|
this.engine = engine;
|
|
setHiddenField("sig",String.valueOf(sig.getSIGID()));
|
|
|
|
} // end setupDialog
|
|
|
|
public ConferenceContext doDialog(SIGContext sig) throws ValidationException, DataException, AccessError
|
|
{
|
|
validate(); // validate the form
|
|
|
|
// Convert a couple of fields to Booleans, which we need.
|
|
final String yes = "Y";
|
|
boolean pvt = getFieldValue("ctype").equals("1");
|
|
boolean hide_list = yes.equals(getFieldValue("hide"));
|
|
|
|
// create the conference!
|
|
return sig.createConference(getFieldValue("name"),getFieldValue("alias"),getFieldValue("descr"),pvt,
|
|
hide_list);
|
|
|
|
} // end if
|
|
|
|
public void resetOnError(String message)
|
|
{
|
|
setErrorMessage(message);
|
|
|
|
} // end resetOnError
|
|
|
|
public Object clone()
|
|
{
|
|
return new CreateConferenceDialog(this);
|
|
|
|
} // end clone
|
|
|
|
} // end class CreateConferenceDialog
|