implemented the "pics in posts" flag globally...it marks the first appearance

of "properties" storage and editing for conferences, communities, users, and
the global system.  In addition, the "global properties" editing screen got
implemented, because it wasn't there yet.
This commit is contained in:
Eric J. Bowersox
2001-11-11 01:22:07 +00:00
parent b105a43619
commit 070fd2c9e2
46 changed files with 2135 additions and 87 deletions

View File

@@ -369,8 +369,8 @@ public class ConfDisplay extends VeniceServlet
// Create the post display.
try
{ // create the display
return new TopicPosts(request,engine,comm,conf,topic,piv.getFirst(),piv.getLast(),read_new,show_adv,
no_bozos);
return new TopicPosts(request,engine,user,comm,conf,topic,piv.getFirst(),piv.getLast(),read_new,
show_adv,no_bozos);
} // end try
catch (DataException de)
@@ -430,7 +430,8 @@ public class ConfDisplay extends VeniceServlet
PostInterval piv = getInterval(engine,request,topic,on_error);
// create the topic posts view
return new TopicPosts(request,engine,comm,conf,topic,piv.getFirst(),piv.getLast(),true,false,false);
return new TopicPosts(request,engine,user,comm,conf,topic,piv.getFirst(),piv.getLast(),true,
false,false);
} // end try
catch (DataException de)

View File

@@ -75,6 +75,23 @@ public class SystemAdmin extends VeniceServlet
} // end makeAdminModifyUserDialog
private EditGlobalPropertiesDialog makeGlobalPropertiesDialog() throws ServletException
{
final String desired_name = "EditGlobalPropertiesDialog";
DialogCache cache = DialogCache.getDialogCache(getServletContext());
if (!(cache.isCached(desired_name)))
{ // create a template and save it off
EditGlobalPropertiesDialog template = new EditGlobalPropertiesDialog();
cache.saveTemplate(template);
} // end if
// return a new copy
return (EditGlobalPropertiesDialog)(cache.getNewDialog(desired_name));
} // end makeGlobalPropertiesDialog
/*--------------------------------------------------------------------------------
* Overrides from class HttpServlet
*--------------------------------------------------------------------------------
@@ -193,6 +210,25 @@ public class SystemAdmin extends VeniceServlet
} // end if ("UM" command)
if (cmd.equals("G"))
{ // "G" = Edit Global Properties
try
{ // get the global properties
AdminOperations adm = user.getAdminInterface();
EditGlobalPropertiesDialog dlg = makeGlobalPropertiesDialog();
dlg.setupDialog(adm);
setMyLocation(request,"sysadmin?cmd=G");
return dlg;
} // end try
catch (AccessError ae)
{ // an access error generally means we're not an administrator
return new ErrorBox("Access Error","You do not have permission to administer the system.",null);
} // end catch
} // end if
// TODO: other command handling
if (!(user.hasAdminAccess()))
@@ -274,7 +310,7 @@ public class SystemAdmin extends VeniceServlet
} // end if
else
{ // the button must be wrong!
logger.error("no known button click on Account.doPost, cmd=P");
logger.error("no known button click on SystemAdmin.doPost, cmd=UF");
return new ErrorBox("Internal Error","Unknown command button pressed","sysadmin?cmd=UF");
} // end else
@@ -299,6 +335,57 @@ public class SystemAdmin extends VeniceServlet
} // end if ("UM" command)
if (cmd.equals("G"))
{ // "G" - Edit Global Properties
try
{ // get the dialog box
EditGlobalPropertiesDialog dlg = makeGlobalPropertiesDialog();
if (dlg.isButtonClicked(request,"cancel"))
throw new RedirectResult("sysadmin"); // we decided not to bother - go back
if (dlg.isButtonClicked(request,"update"))
{ // update the system properties
AdminOperations adm = user.getAdminInterface();
dlg.loadValues(request);
try
{ // execute the dialog!
dlg.doDialog(adm);
throw new RedirectResult("sysadmin");
} // end try
catch (ValidationException ve)
{ // validation error - retry the dialog
dlg.setErrorMessage(ve.getMessage() + " Please try again.");
setMyLocation(request,"sysadmin?cmd=G");
return dlg;
} // end catch
} // end if
else
{ // the button must be wrong!
logger.error("no known button click on SystemAdmin.doPost, cmd=G");
return new ErrorBox("Internal Error","Unknown command button pressed","sysadmin?cmd=UF");
} // end else
} // end try
catch (AccessError ae)
{ // an access error generally means we're not an administrator
return new ErrorBox("Access Error","You do not have permission to administer the system.",null);
} // end catch
catch (DataException de)
{ // error pulling the audit records
return new ErrorBox("Database Error","Unable to update global properties: " + de.getMessage(),
"sysadmin");
} // end catch
} // end if ("G" command)
// TODO: other command handling
if (!(user.hasAdminAccess()))

View File

@@ -7,7 +7,7 @@
* 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 Community System.
* 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
@@ -24,6 +24,11 @@ import com.silverwrist.venice.ValidationException;
public abstract class CDBaseFormField implements CDFormField, ColorSelectors
{
/*--------------------------------------------------------------------------------
* Attributes
*--------------------------------------------------------------------------------
*/
private String name;
private String caption;
private String caption2;
@@ -31,6 +36,11 @@ public abstract class CDBaseFormField implements CDFormField, ColorSelectors
private String value = null;
private boolean enabled;
/*--------------------------------------------------------------------------------
* Constructors
*--------------------------------------------------------------------------------
*/
protected CDBaseFormField(String name, String caption, String caption2, boolean required)
{
this.name = name;
@@ -52,12 +62,10 @@ public abstract class CDBaseFormField implements CDFormField, ColorSelectors
} // end constructor
protected abstract void renderActualField(Writer out, RenderData rdat)
throws IOException;
protected void validateContents(String value) throws ValidationException
{ // this is a do-nothing value
} // end validateContents
/*--------------------------------------------------------------------------------
* Internal operations
*--------------------------------------------------------------------------------
*/
protected final String getCaption()
{
@@ -65,6 +73,28 @@ public abstract class CDBaseFormField implements CDFormField, ColorSelectors
} // end getCaption
/*--------------------------------------------------------------------------------
* Abstract functions which MUST be overriden
*--------------------------------------------------------------------------------
*/
protected abstract void renderActualField(Writer out, RenderData rdat)
throws IOException;
/*--------------------------------------------------------------------------------
* Overridable operations
*--------------------------------------------------------------------------------
*/
protected void validateContents(String value) throws ValidationException
{ // this is a do-nothing value
} // end validateContents
/*--------------------------------------------------------------------------------
* Implementations from interface ComponentRender
*--------------------------------------------------------------------------------
*/
public void renderHere(Writer out, RenderData rdat) throws IOException
{
out.write("<TR VALIGN=MIDDLE>\n<TD ALIGN=RIGHT CLASS=\"content\"><FONT COLOR=\""
@@ -81,6 +111,11 @@ public abstract class CDBaseFormField implements CDFormField, ColorSelectors
} // end renderHere
/*--------------------------------------------------------------------------------
* Implementations from interface CDFormField
*--------------------------------------------------------------------------------
*/
public String getName()
{
return name;
@@ -99,6 +134,18 @@ public abstract class CDBaseFormField implements CDFormField, ColorSelectors
} // end setValue
public Object getObjValue()
{
return value;
} // end getObjValue
public void setObjValue(Object obj)
{
this.value = obj.toString();
} // end setObjValue
public boolean isRequired()
{
return required;

View File

@@ -24,6 +24,11 @@ import com.silverwrist.venice.ValidationException;
public abstract class CDBaseFormFieldReverse implements CDFormField, ColorSelectors
{
/*--------------------------------------------------------------------------------
* Attributes
*--------------------------------------------------------------------------------
*/
private String name;
private String caption;
private String caption2;
@@ -31,6 +36,11 @@ public abstract class CDBaseFormFieldReverse implements CDFormField, ColorSelect
private String value = null;
private boolean enabled;
/*--------------------------------------------------------------------------------
* Constructors
*--------------------------------------------------------------------------------
*/
protected CDBaseFormFieldReverse(String name, String caption, String caption2, boolean required)
{
this.name = name;
@@ -52,12 +62,10 @@ public abstract class CDBaseFormFieldReverse implements CDFormField, ColorSelect
} // end constructor
protected abstract void renderActualField(Writer out, RenderData rdat)
throws IOException;
protected void validateContents(String value) throws ValidationException
{ // this is a do-nothing value
} // end validateContents
/*--------------------------------------------------------------------------------
* Internal operations
*--------------------------------------------------------------------------------
*/
protected final String getCaption()
{
@@ -65,6 +73,28 @@ public abstract class CDBaseFormFieldReverse implements CDFormField, ColorSelect
} // end getCaption
/*--------------------------------------------------------------------------------
* Abstract functions which MUST be overriden
*--------------------------------------------------------------------------------
*/
protected abstract void renderActualField(Writer out, RenderData rdat)
throws IOException;
/*--------------------------------------------------------------------------------
* Overridable operations
*--------------------------------------------------------------------------------
*/
protected void validateContents(String value) throws ValidationException
{ // this is a do-nothing value
} // end validateContents
/*--------------------------------------------------------------------------------
* Implementations from interface ComponentRender
*--------------------------------------------------------------------------------
*/
public void renderHere(Writer out, RenderData rdat) throws IOException
{
out.write("<TR VALIGN=MIDDLE>\n<TD ALIGN=RIGHT CLASS=\"content\">");
@@ -81,6 +111,11 @@ public abstract class CDBaseFormFieldReverse implements CDFormField, ColorSelect
} // end renderHere
/*--------------------------------------------------------------------------------
* Implementations from interface CDFormField
*--------------------------------------------------------------------------------
*/
public String getName()
{
return name;
@@ -99,6 +134,18 @@ public abstract class CDBaseFormFieldReverse implements CDFormField, ColorSelect
} // end setValue
public Object getObjValue()
{
return value;
} // end getObjValue
public void setObjValue(Object obj)
{
this.value = obj.toString();
} // end setObjValue
public boolean isRequired()
{
return required;

View File

@@ -7,7 +7,7 @@
* 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 Community System.
* 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
@@ -24,8 +24,25 @@ import com.silverwrist.venice.ValidationException;
public class CDCheckBoxFormField extends CDBaseFormFieldReverse
{
/*--------------------------------------------------------------------------------
* Static data members
*--------------------------------------------------------------------------------
*/
private static final String YES = "Y";
/*--------------------------------------------------------------------------------
* Attributes
*--------------------------------------------------------------------------------
*/
private String on_value;
/*--------------------------------------------------------------------------------
* Constructors
*--------------------------------------------------------------------------------
*/
public CDCheckBoxFormField(String name, String caption, String caption2, String on_value)
{
super(name,caption,caption2,false);
@@ -33,6 +50,13 @@ public class CDCheckBoxFormField extends CDBaseFormFieldReverse
} // end constructor
public CDCheckBoxFormField(String name, String caption, String caption2)
{
super(name,caption,caption2,false);
this.on_value = YES;
} // end constructor
protected CDCheckBoxFormField(CDCheckBoxFormField other)
{
super(other);
@@ -40,6 +64,11 @@ public class CDCheckBoxFormField extends CDBaseFormFieldReverse
} // end constructor
/*--------------------------------------------------------------------------------
* Overrides from class CDBaseFormFieldReverse
*--------------------------------------------------------------------------------
*/
protected void renderActualField(Writer out, RenderData rdat) throws IOException
{
out.write("<INPUT TYPE=CHECKBOX NAME=\"" + getName() + "\" VALUE=\"" + on_value + "\"");
@@ -51,6 +80,26 @@ public class CDCheckBoxFormField extends CDBaseFormFieldReverse
} // end renderActualField
/*--------------------------------------------------------------------------------
* Implementations from interface CDFormField
*--------------------------------------------------------------------------------
*/
public Object getObjValue()
{
return new Boolean(on_value.equals(getValue()));
} // end getObjValue
public void setObjValue(Object obj)
{
if (obj instanceof Boolean)
super.setValue(((Boolean)obj).booleanValue() ? on_value : "");
else
super.setObjValue(obj);
} // end setObjValue
public CDFormField duplicate()
{
return new CDCheckBoxFormField(this);

View File

@@ -7,7 +7,7 @@
* 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 Community System.
* 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
@@ -25,10 +25,20 @@ import com.silverwrist.venice.ValidationException;
public class CDFormCategoryHeader implements CDFormField, ColorSelectors
{
/*--------------------------------------------------------------------------------
* Attributes
*--------------------------------------------------------------------------------
*/
private String caption;
private String rtext;
private boolean enabled;
/*--------------------------------------------------------------------------------
* Constructors
*--------------------------------------------------------------------------------
*/
public CDFormCategoryHeader(String caption)
{
this.caption = caption;
@@ -53,6 +63,11 @@ public class CDFormCategoryHeader implements CDFormField, ColorSelectors
} // end constructor
/*--------------------------------------------------------------------------------
* Implementations from interface ComponentRender
*--------------------------------------------------------------------------------
*/
public void renderHere(Writer out, RenderData rdat) throws IOException
{
out.write("<TR VALIGN=MIDDLE><TD ALIGN=RIGHT CLASS=\"content\"><FONT COLOR=\""
@@ -67,6 +82,11 @@ public class CDFormCategoryHeader implements CDFormField, ColorSelectors
} // end renderHere
/*--------------------------------------------------------------------------------
* Implementations from interface CDFormField
*--------------------------------------------------------------------------------
*/
public String getName()
{
return null;
@@ -83,6 +103,16 @@ public class CDFormCategoryHeader implements CDFormField, ColorSelectors
{ // do nothing
} // end setValue
public Object getObjValue()
{
return null;
} // end getObjValue
public void setObjValue(Object obj)
{ // do nothing
} // end setObjValue
public boolean isRequired()
{
return false;

View File

@@ -7,7 +7,7 @@
* 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 Community System.
* 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
@@ -27,6 +27,10 @@ public interface CDFormField extends ComponentRender
public abstract void setValue(String value);
public abstract Object getObjValue();
public abstract void setObjValue(Object obj);
public abstract boolean isRequired();
public abstract void validate() throws ValidationException;

View File

@@ -0,0 +1,142 @@
/*
* 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.io.*;
import com.silverwrist.venice.ValidationException;
public class CDIntegerFormField extends CDTextFormField
{
/*--------------------------------------------------------------------------------
* Static data members
*--------------------------------------------------------------------------------
*/
private static final double LN10 = Math.log(10.0);
/*--------------------------------------------------------------------------------
* Attributes
*--------------------------------------------------------------------------------
*/
private int min_value;
private int max_value;
/*--------------------------------------------------------------------------------
* Constructors
*--------------------------------------------------------------------------------
*/
public CDIntegerFormField(String name, String caption, String caption2, int min, int max)
{
super(name,caption,caption2,true,numDigits(min,max),numDigits(min,max));
this.min_value = min;
this.max_value = max;
} // end constructor
protected CDIntegerFormField(CDIntegerFormField other)
{
super(other);
this.min_value = other.min_value;
this.max_value = other.max_value;
} // end constructor
/*--------------------------------------------------------------------------------
* Internal operations
*--------------------------------------------------------------------------------
*/
private static int numDigits(int v)
{
if (v==0)
return 1;
else if (v>0)
return 1 + (int)(Math.floor(Math.log((double)v) / LN10));
else
return 2 + (int)(Math.floor(Math.log((double)(-v)) / LN10));
} // end numDigits
private static int numDigits(int min, int max)
{
return Math.max(Math.max(numDigits(min),numDigits(max)),2);
} // end numDigits
/*--------------------------------------------------------------------------------
* Overrides from class CDTextFormField
*--------------------------------------------------------------------------------
*/
protected void renderActualField(Writer out, RenderData rdat) throws IOException
{
super.renderActualField(out,rdat);
out.write("&nbsp;(" + min_value + " - " + max_value + ")");
} // end renderActualField
protected void validateContents(String value) throws ValidationException
{
try
{ // convert to an integer and check against range
int x = Integer.parseInt(value);
if ((min_value>Integer.MIN_VALUE) && (x<min_value))
throw new ValidationException("The value of the '" + getCaption()
+ "' field must be greater than or equal to " + min_value + ".");
if ((max_value<Integer.MAX_VALUE) && (x>max_value))
throw new ValidationException("The value of the '" + getCaption()
+ "' field must be less than or equal to " + max_value + ".");
} // end try
catch (NumberFormatException nfe)
{ // integer conversion failed
throw new ValidationException("Invalid non-numeric character in the '" + getCaption() + "' field.");
} // end catch
} // end validateContents
/*--------------------------------------------------------------------------------
* Implementations from interface CDFormField
*--------------------------------------------------------------------------------
*/
public Object getObjValue()
{
try
{ // build an Integer and return it
return new Integer(getValue());
} // end try
catch (NumberFormatException nfe)
{ // shouldn't happen
return null;
} // end catch
} // end getObjValue
public CDFormField duplicate()
{
return new CDIntegerFormField(this);
} // end clone
} // end class CDIntegerFormField

View File

@@ -7,7 +7,7 @@
* 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 Community System.
* 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
@@ -25,6 +25,11 @@ import com.silverwrist.venice.security.Role;
public class CDRoleListFormField extends CDPickListFormField
{
/*--------------------------------------------------------------------------------
* Constructors
*--------------------------------------------------------------------------------
*/
public CDRoleListFormField(String name, String caption, String caption2, boolean required,
List role_list)
{
@@ -38,6 +43,11 @@ public class CDRoleListFormField extends CDPickListFormField
} // end constructor
/*--------------------------------------------------------------------------------
* Overrides from class CDPickListFormField
*--------------------------------------------------------------------------------
*/
protected void renderChoice(Writer out, RenderData rdat, Object obj, String my_value) throws IOException
{
Role r = (Role)obj;
@@ -48,6 +58,26 @@ public class CDRoleListFormField extends CDPickListFormField
} // end renderChoice
/*--------------------------------------------------------------------------------
* Implementations from class CDFormField
*--------------------------------------------------------------------------------
*/
public Object getObjValue()
{
try
{ // return value as Integer, for now
return new Integer(super.getValue());
} // end try
catch (NumberFormatException nfe)
{
return null;
} // end catch
} // end getObjValue
public CDFormField duplicate()
{
return new CDRoleListFormField(this);
@@ -55,3 +85,4 @@ public class CDRoleListFormField extends CDPickListFormField
} // end clone
} // end class CDRoleListFormField

View File

@@ -23,9 +23,19 @@ import com.silverwrist.venice.ValidationException;
public class CDTextFormField extends CDBaseFormField
{
/*--------------------------------------------------------------------------------
* Attributes
*--------------------------------------------------------------------------------
*/
private int size;
private int maxlength;
/*--------------------------------------------------------------------------------
* Constructors
*--------------------------------------------------------------------------------
*/
public CDTextFormField(String name, String caption, String caption2, boolean required,
int size, int maxlength)
{
@@ -43,6 +53,11 @@ public class CDTextFormField extends CDBaseFormField
} // end constructor
/*--------------------------------------------------------------------------------
* Overrides from class CDBaseFormField
*--------------------------------------------------------------------------------
*/
protected void renderActualField(Writer out, RenderData rdat) throws IOException
{
out.write("<SPAN CLASS=\"cinput\"><INPUT TYPE=TEXT CLASS=\"cinput\" NAME=\"" + getName() + "\" SIZE="
@@ -61,6 +76,11 @@ public class CDTextFormField extends CDBaseFormField
{ // this is a do-nothing value
} // end validateContents
/*--------------------------------------------------------------------------------
* Implementations from interface CDFormField
*--------------------------------------------------------------------------------
*/
public CDFormField duplicate()
{
return new CDTextFormField(this);

View File

@@ -22,8 +22,13 @@ import com.silverwrist.venice.ValidationException;
public class CDVeniceIDFormField extends CDTextFormField
{
/*--------------------------------------------------------------------------------
* Constructors
*--------------------------------------------------------------------------------
*/
public CDVeniceIDFormField(String name, String caption, String caption2, boolean required,
int size, int maxlength)
int size, int maxlength)
{
super(name,caption,caption2,required,size,maxlength);
@@ -35,6 +40,11 @@ public class CDVeniceIDFormField extends CDTextFormField
} // end constructor
/*--------------------------------------------------------------------------------
* Overrides from class CDTextFormField
*--------------------------------------------------------------------------------
*/
protected void validateContents(String value) throws ValidationException
{
if (!IDUtils.isValidVeniceID(value))

View File

@@ -398,6 +398,30 @@ public class ContentDialog implements Cloneable, ContentRender, ColorSelectors
} // end setFieldValue
public Object getFieldObjValue(String fieldname)
{
String value = (String)(hidden_fields.get(fieldname));
if (value!=null)
return value;
CDFormField fld = (CDFormField)(form_fields.get(fieldname));
if (fld!=null)
return fld.getObjValue();
else
return null;
} // end getFieldObjValue
public void setFieldObjValue(String fieldname, Object value)
{
CDFormField fld = (CDFormField)(form_fields.get(fieldname));
if (fld!=null)
fld.setObjValue(value);
else if (value!=null)
setHiddenField(fieldname,value.toString());
} // end setFieldObjValue
public boolean isFieldEnabled(String fieldname)
{
CDFormField fld = (CDFormField)(form_fields.get(fieldname));

View File

@@ -80,6 +80,13 @@ public class EditCommunityProfileDialog extends ContentDialog
} // end class CDCommunityLogoControl
/*--------------------------------------------------------------------------------
* Static data members
*--------------------------------------------------------------------------------
*/
private static final String YES = "Y";
/*--------------------------------------------------------------------------------
* Attributes
*--------------------------------------------------------------------------------
@@ -121,6 +128,7 @@ public class EditCommunityProfileDialog extends ContentDialog
addFormField(new CDTextFormField("url","Home page",null,false,32,255));
logo_control = new CDCommunityLogoControl("logo","Community logo","commlogo");
addFormField(logo_control);
addFormField(new CDFormCategoryHeader("Location"));
addFormField(new CDTextFormField("company","Company",null,false,32,255));
addFormField(new CDTextFormField("addr1","Address",null,false,32,255));
@@ -129,11 +137,12 @@ public class EditCommunityProfileDialog extends ContentDialog
addFormField(new CDTextFormField("reg","State/Province",null,false,32,64));
addFormField(new CDTextFormField("pcode","Zip/Postal Code",null,true,32,64));
addFormField(new CDCountryListFormField("country","Country",null,true,country_list));
addFormField(new CDFormCategoryHeader("Security"));
addFormField(new CDSimplePickListFormField("comtype","Communty type",null,true,vec_pubpriv,'|'));
addFormField(new CDTextFormField("joinkey","Join key","(for private communities)",false,32,64));
addFormField(new CDCheckBoxFormField("membersonly","Allow only members to access this community",
null,"Y"));
null,YES));
addFormField(new CDSimplePickListFormField("hidemode","Community visibility",null,true,vec_hidemode,'|'));
addFormField(new CDRoleListFormField("read_lvl","Security level required to read contents",null,true,
Role.getCommunityReadList()));
@@ -145,7 +154,11 @@ public class EditCommunityProfileDialog extends ContentDialog
Role.getCommunityDeleteList()));
addFormField(new CDRoleListFormField("join_lvl","Security level required to join community",null,true,
Role.getCommunityJoinList()));
// TODO: add logo selection/uploading method here
addFormField(new CDFormCategoryHeader("Conferencing Options"));
addFormField(new CDCheckBoxFormField("pic_in_post","Display user pictures next to posts in conferences",
"(by default; user can override)",YES));
addCommandButton(new CDImageButton("update","bn_update.gif","Update",80,24));
addCommandButton(new CDImageButton("cancel","bn_cancel.gif","Cancel",80,24));
@@ -216,6 +229,7 @@ public class EditCommunityProfileDialog extends ContentDialog
{
setupDialogBasic(engine,comm);
ContactInfo ci = comm.getContactInfo();
CommunityProperties props = comm.getProperties();
setHiddenField("sig",String.valueOf(comm.getCommunityID()));
setFieldValue("name",comm.getName());
@@ -247,13 +261,15 @@ public class EditCommunityProfileDialog extends ContentDialog
} // end else
if (comm.getMembersOnly())
setFieldValue("membersonly","Y");
setFieldValue("membersonly",YES);
setFieldValue("hidemode",String.valueOf(comm.getHideMode()));
setFieldValue("read_lvl",String.valueOf(comm.getReadLevel()));
setFieldValue("write_lvl",String.valueOf(comm.getWriteLevel()));
setFieldValue("create_lvl",String.valueOf(comm.getCreateLevel()));
setFieldValue("delete_lvl",String.valueOf(comm.getDeleteLevel()));
setFieldValue("join_lvl",String.valueOf(comm.getJoinLevel()));
if (props.getDisplayPostPictures())
setFieldValue("pic_in_post",YES);
doDisable(comm);
@@ -261,7 +277,6 @@ public class EditCommunityProfileDialog extends ContentDialog
public void doDialog(CommunityContext comm) throws ValidationException, DataException, AccessError
{
final String yes = "Y"; // the "yes" string
validate(); // validate the dialog entries
int hidemode, read_lvl, write_lvl, create_lvl, delete_lvl, join_lvl;
@@ -293,6 +308,11 @@ public class EditCommunityProfileDialog extends ContentDialog
ci.setCountry(getFieldValue("country"));
comm.putContactInfo(ci);
// now save off the property-related fields
CommunityProperties props = comm.getProperties();
props.setDisplayPostPictures(YES.equals(getFieldValue("pic_in_post")));
comm.setProperties(props);
// now save the big text fields
comm.setName(getFieldValue("name"));
comm.setAlias(getFieldValue("alias"));
@@ -308,7 +328,7 @@ public class EditCommunityProfileDialog extends ContentDialog
else
jkey = null;
comm.setJoinKey(jkey);
comm.setMembersOnly(yes.equals(getFieldValue("membersonly")));
comm.setMembersOnly(YES.equals(getFieldValue("membersonly")));
comm.setHideMode(hidemode);
comm.setSecurityLevels(read_lvl,write_lvl,create_lvl,delete_lvl,join_lvl);

View File

@@ -25,6 +25,13 @@ import com.silverwrist.venice.core.*;
public class EditConferenceDialog extends ContentDialog
{
/*--------------------------------------------------------------------------------
* Static data members
*--------------------------------------------------------------------------------
*/
private static final String YES = "Y";
/*--------------------------------------------------------------------------------
* Constructors
*--------------------------------------------------------------------------------
@@ -41,7 +48,7 @@ public class EditConferenceDialog extends ContentDialog
addFormField(new CDTextFormField("name","Conference Name",null,true,32,128));
addFormField(new CDTextFormField("descr","Description",null,false,32,255));
addFormField(new CDCheckBoxFormField("hide","Hide conference in the community's conference list",
null,"Y"));
null,YES));
addFormField(new CDFormCategoryHeader("Security Information"));
addFormField(new CDRoleListFormField("read_lvl","Security level required to read conference",null,true,
Role.getConferenceReadList()));
@@ -64,6 +71,9 @@ public class EditConferenceDialog extends ContentDialog
addFormField(new CDRoleListFormField("delete_lvl",
"Security level required to delete conference",null,true,
Role.getConferenceDeleteList()));
addFormField(new CDFormCategoryHeader("Conference Properties"));
addFormField(new CDCheckBoxFormField("pic_in_post","Display users' pictures next to their posts",
"(user can override)",YES));
addCommandButton(new CDImageButton("update","bn_update.gif","Update",80,24));
addCommandButton(new CDImageButton("cancel","bn_cancel.gif","Cancel",80,24));
@@ -88,7 +98,7 @@ public class EditConferenceDialog extends ContentDialog
setFieldValue("name",conf.getName());
setFieldValue("descr",conf.getDescription());
if (conf.getHideList())
setFieldValue("hide","Y");
setFieldValue("hide",YES);
else
setFieldValue("hide","");
setFieldValue("read_lvl",String.valueOf(conf.getReadLevel()));
@@ -98,14 +108,19 @@ public class EditConferenceDialog extends ContentDialog
setFieldValue("nuke_lvl",String.valueOf(conf.getNukeLevel()));
setFieldValue("change_lvl",String.valueOf(conf.getChangeLevel()));
setFieldValue("delete_lvl",String.valueOf(conf.getDeleteLevel()));
ConferenceProperties props = conf.getProperties();
if (props.getDisplayPostPictures())
setFieldValue("pic_in_post",YES);
else
setFieldValue("pic_in_post","");
} // end setupDialog
public void doDialog(ConferenceContext conf) throws ValidationException, DataException, AccessError
{
final String yes = "Y"; // the "yes" string
validate(); // validate the dialog entries
ConferenceProperties props = conf.getProperties();
int read_lvl, post_lvl, create_lvl, hide_lvl, nuke_lvl, change_lvl, delete_lvl;
try
{ // get all the security levels out of their form fields
@@ -127,9 +142,13 @@ public class EditConferenceDialog extends ContentDialog
// sweep through the conference and set the appropriate changes
conf.setName(getFieldValue("name"));
conf.setDescription(getFieldValue("descr"));
conf.setHideList(yes.equals(getFieldValue("hide")));
conf.setHideList(YES.equals(getFieldValue("hide")));
conf.setSecurityLevels(read_lvl,post_lvl,create_lvl,hide_lvl,nuke_lvl,change_lvl,delete_lvl);
// reset the properties
props.setDisplayPostPictures(YES.equals(getFieldValue("pic_in_post")));
conf.setProperties(props);
} // end doDialog
public void resetOnError(CommunityContext comm, ConferenceContext conf, String message)

View File

@@ -0,0 +1,128 @@
/*
* 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.io.*;
import java.util.*;
import com.silverwrist.util.StringUtil;
import com.silverwrist.venice.ValidationException;
import com.silverwrist.venice.security.Role;
import com.silverwrist.venice.core.*;
public class EditGlobalPropertiesDialog extends ContentDialog
{
/*--------------------------------------------------------------------------------
* Constructors
*--------------------------------------------------------------------------------
*/
public EditGlobalPropertiesDialog()
{
super("Edit Global Properties",null,"globpropform","sysadmin");
setHiddenField("cmd","G");
addFormField(new CDFormCategoryHeader("System Properties"));
addFormField(new CDIntegerFormField("search_items","Number of search items to display per page",
null,5,100));
addFormField(new CDIntegerFormField("fp_posts","Number of published posts to display on front page",
null,1,50));
addFormField(new CDIntegerFormField("audit_recs","Number of audit records to display per page",
null,10,500));
addFormField(new CDRoleListFormField("create_lvl","Security level required to create a new community",
null,true,Role.getNewCommunityLevelChoices()));
addFormField(new CDFormCategoryHeader("Community Properties"));
addFormField(new CDIntegerFormField("comm_mbrs","Number of community members to display per page",
null,10,100));
addFormField(new CDFormCategoryHeader("Conferencing Properties"));
addFormField(new CDIntegerFormField("posts_page","Maximum number of posts to display per page",
null,5,100));
addFormField(new CDIntegerFormField("old_posts","Number of \"old\" posts to display at top of page",
null,1,5));
addFormField(new CDIntegerFormField("conf_mbrs","Number of conference members to display per page",
null,10,100));
addFormField(new CDCheckBoxFormField("pic_in_post","Display user pictures next to posts in conferences",
"(by default; user can override)"));
addCommandButton(new CDImageButton("update","bn_update.gif","Update",80,24));
addCommandButton(new CDImageButton("cancel","bn_cancel.gif","Cancel",80,24));
} // end constructor
protected EditGlobalPropertiesDialog(EditGlobalPropertiesDialog other)
{
super(other);
} // end constructor
/*--------------------------------------------------------------------------------
* External operations
*--------------------------------------------------------------------------------
*/
public void setupDialog(AdminOperations adm)
{
GlobalProperties props = adm.getProperties();
setFieldObjValue("search_items",new Integer(props.getSearchItemsPerPage()));
setFieldObjValue("fp_posts",new Integer(props.getPostsOnFrontPage()));
setFieldObjValue("audit_recs",new Integer(props.getAuditRecordsPerPage()));
setFieldObjValue("create_lvl",new Integer(props.getCommunityCreateLevel()));
setFieldObjValue("comm_mbrs",new Integer(props.getCommunityMembersPerPage()));
setFieldObjValue("posts_page",new Integer(props.getPostsPerPage()));
setFieldObjValue("old_posts",new Integer(props.getOldPostsAtTop()));
setFieldObjValue("conf_mbrs",new Integer(props.getConferenceMembersPerPage()));
setFieldObjValue("pic_in_post",new Boolean(props.getDisplayPostPictures()));
} // end setupDialog
public void doDialog(AdminOperations adm) throws ValidationException, DataException
{
validate(); // validate the dialog
// Reset the global properties.
GlobalProperties props = adm.getProperties();
Integer iv = (Integer)(getFieldObjValue("search_items"));
props.setSearchItemsPerPage(iv.intValue());
iv = (Integer)(getFieldObjValue("fp_posts"));
props.setPostsOnFrontPage(iv.intValue());
iv = (Integer)(getFieldObjValue("audit_recs"));
props.setAuditRecordsPerPage(iv.intValue());
iv = (Integer)(getFieldObjValue("create_lvl"));
props.setCommunityCreateLevel(iv.intValue());
iv = (Integer)(getFieldObjValue("comm_mbrs"));
props.setCommunityMembersPerPage(iv.intValue());
iv = (Integer)(getFieldObjValue("posts_page"));
props.setPostsPerPage(iv.intValue());
iv = (Integer)(getFieldObjValue("old_posts"));
props.setOldPostsAtTop(iv.intValue());
iv = (Integer)(getFieldObjValue("conf_mbrs"));
props.setConferenceMembersPerPage(iv.intValue());
Boolean bv = (Boolean)(getFieldObjValue("pic_in_post"));
props.setDisplayPostPictures(bv.booleanValue());
adm.setProperties(props);
} // end doDialog
public Object clone()
{
return new EditGlobalPropertiesDialog(this);
} // end clone
} // end class EditGlobalPropertiesDialog

View File

@@ -81,6 +81,13 @@ public class EditProfileDialog extends ContentDialog
} // end class CDUserPhotoControl
/*--------------------------------------------------------------------------------
* Static data members
*--------------------------------------------------------------------------------
*/
private static final String YES = "Y";
/*--------------------------------------------------------------------------------
* Attributes
*--------------------------------------------------------------------------------
@@ -113,7 +120,7 @@ public class EditProfileDialog extends ContentDialog
addFormField(new CDTextFormField("company","Company",null,false,32,255));
addFormField(new CDTextFormField("addr1","Address",null,false,32,255));
addFormField(new CDTextFormField("addr2","Address","(line 2)",false,32,255));
addFormField(new CDCheckBoxFormField("pvt_addr","Hide address in profile",null,"Y"));
addFormField(new CDCheckBoxFormField("pvt_addr","Hide address in profile",null,YES));
addFormField(new CDTextFormField("loc","City",null,true,32,64));
addFormField(new CDTextFormField("reg","State/Province",null,true,32,64));
addFormField(new CDTextFormField("pcode","Zip/Postal Code",null,true,32,64));
@@ -121,18 +128,20 @@ public class EditProfileDialog extends ContentDialog
addFormField(new CDFormCategoryHeader("Phone Numbers"));
addFormField(new CDTextFormField("phone","Telephone",null,false,32,32));
addFormField(new CDTextFormField("mobile","Mobile/cellphone",null,false,32,32));
addFormField(new CDCheckBoxFormField("pvt_phone","Hide phone/mobile numbers in profile",null,"Y"));
addFormField(new CDCheckBoxFormField("pvt_phone","Hide phone/mobile numbers in profile",null,YES));
addFormField(new CDTextFormField("fax","Fax",null,false,32,32));
addFormField(new CDCheckBoxFormField("pvt_fax","Hide fax number in profile",null,"Y"));
addFormField(new CDCheckBoxFormField("pvt_fax","Hide fax number in profile",null,YES));
addFormField(new CDFormCategoryHeader("Internet"));
addFormField(new CDEmailAddressFormField("email","E-mail address",null,true,32,255));
addFormField(new CDCheckBoxFormField("pvt_email","Hide e-mail address in profile",null,"Y"));
addFormField(new CDCheckBoxFormField("pvt_email","Hide e-mail address in profile",null,YES));
addFormField(new CDTextFormField("url","Home page","(URL)",false,32,255));
addFormField(new CDFormCategoryHeader("Personal"));
addFormField(new CDTextFormField("descr","Personal description",null,false,32,255));
photo_control = new CDUserPhotoControl("photo","User Photo","userphoto");
addFormField(photo_control);
addFormField(new CDFormCategoryHeader("User Preferences"));
addFormField(new CDCheckBoxFormField("pic_in_post","Display user photos next to conference posts",
"(where applicable)",YES));
addFormField(new CDLocaleListFormField("locale","Default locale","(for formatting dates/times)",true));
addFormField(new CDTimeZoneListFormField("tz","Default time zone",null,true));
addCommandButton(new CDImageButton("update","bn_update.gif","Update",80,24));
@@ -198,6 +207,7 @@ public class EditProfileDialog extends ContentDialog
{
setTarget(target);
ContactInfo ci = uc.getContactInfo(); // get the main contact info
UserProperties props = uc.getProperties(); // get the properties
setFieldValue("prefix",ci.getNamePrefix());
setFieldValue("first",ci.getGivenName());
@@ -210,7 +220,7 @@ public class EditProfileDialog extends ContentDialog
setFieldValue("addr1",ci.getAddressLine1());
setFieldValue("addr2",ci.getAddressLine2());
if (ci.getPrivateAddress())
setFieldValue("pvt_addr","Y");
setFieldValue("pvt_addr",YES);
setFieldValue("loc",ci.getLocality());
setFieldValue("reg",ci.getRegion());
setFieldValue("pcode",ci.getPostalCode());
@@ -218,17 +228,19 @@ public class EditProfileDialog extends ContentDialog
setFieldValue("phone",ci.getPhone());
setFieldValue("mobile",ci.getMobile());
if (ci.getPrivatePhone())
setFieldValue("pvt_phone","Y");
setFieldValue("pvt_phone",YES);
setFieldValue("fax",ci.getFax());
if (ci.getPrivateFax())
setFieldValue("pvt_fax","Y");
setFieldValue("pvt_fax",YES);
setFieldValue("email",ci.getEmail());
if (ci.getPrivateEmail())
setFieldValue("pvt_email","Y");
setFieldValue("pvt_email",YES);
setFieldValue("url",ci.getURL());
setFieldValue("descr",uc.getDescription());
setFieldValue("photo",ci.getPhotoURL());
photo_control.setLinkURL("userphoto?tgt=" + URLEncoder.encode(target));
if (props.getDisplayPostPictures())
setFieldValue("pic_in_post",YES);
setFieldValue("locale",uc.getLocale().toString());
setFieldValue("tz",uc.getTimeZone().getID());
@@ -238,8 +250,8 @@ public class EditProfileDialog extends ContentDialog
{
validate(); // validate the dialog
final String yes = "Y"; // the "yes" string
ContactInfo ci = uc.getContactInfo(); // get the main contact info
UserProperties props = uc.getProperties();
// Reset all the contact info fields.
ci.setNamePrefix(getFieldValue("prefix"));
@@ -254,23 +266,27 @@ public class EditProfileDialog extends ContentDialog
ci.setCompany(getFieldValue("company"));
ci.setAddressLine1(getFieldValue("addr1"));
ci.setAddressLine2(getFieldValue("addr2"));
ci.setPrivateAddress(yes.equals(getFieldValue("pvt_addr")));
ci.setPrivateAddress(YES.equals(getFieldValue("pvt_addr")));
ci.setLocality(getFieldValue("loc"));
ci.setRegion(getFieldValue("reg"));
ci.setPostalCode(getFieldValue("pcode"));
ci.setCountry(getFieldValue("country"));
ci.setPhone(getFieldValue("phone"));
ci.setMobile(getFieldValue("mobile"));
ci.setPrivatePhone(yes.equals(getFieldValue("pvt_phone")));
ci.setPrivatePhone(YES.equals(getFieldValue("pvt_phone")));
ci.setFax(getFieldValue("fax"));
ci.setPrivateFax(yes.equals(getFieldValue("pvt_fax")));
ci.setPrivateFax(YES.equals(getFieldValue("pvt_fax")));
ci.setEmail(getFieldValue("email"));
ci.setPrivateEmail(yes.equals(getFieldValue("pvt_email")));
ci.setPrivateEmail(YES.equals(getFieldValue("pvt_email")));
ci.setURL(getFieldValue("url"));
// Store the completed contact info.
boolean retval = uc.putContactInfo(ci);
// Save off the properties.
props.setDisplayPostPictures(YES.equals(getFieldValue("pic_in_post")));
uc.setProperties(props);
// Save off the user's description and preferences.
uc.setDescription(getFieldValue("descr"));
uc.setLocale(LocaleFactory.createLocale(getFieldValue("locale")));

View File

@@ -31,7 +31,7 @@ public class SystemAdminTop extends ContentMenuPanel
public SystemAdminTop()
{
super("System Administration",null);
addChoice("Set Global Parameters","TODO");
addChoice("Edit Global Properties","sysadmin?cmd=G");
addChoice("View/Edit Banned Users","TODO");
addChoice("User Account Management","sysadmin?cmd=UF");
addChoice("System Audit Logs","sysadmin?cmd=A");

View File

@@ -17,6 +17,7 @@
*/
package com.silverwrist.venice.servlets.format;
import java.awt.Dimension;
import java.util.*;
import javax.servlet.*;
import javax.servlet.http.*;
@@ -56,13 +57,15 @@ public class TopicPosts implements JSPRender
private String topic_qid;
private String cache_locator = null;
private HashSet bozo_uids = new HashSet();
private Dimension photo_size = null;
private HashMap uid_photos = null;
/*--------------------------------------------------------------------------------
* Constructor
*--------------------------------------------------------------------------------
*/
public TopicPosts(HttpServletRequest request, VeniceEngine engine, CommunityContext comm,
public TopicPosts(HttpServletRequest request, VeniceEngine engine, UserContext user, CommunityContext comm,
ConferenceContext conf, TopicContext topic, int first, int last, boolean read_new,
boolean show_advanced, boolean no_bozos) throws DataException, AccessError
{
@@ -93,16 +96,38 @@ public class TopicPosts implements JSPRender
// build up the list of users IN THIS VIEW that are bozo-filtered
HashSet saw_users = new HashSet();
if (conf.displayPostPictures() && user.displayPostPictures())
{ // build up the mapping of UIDs to photo URLs
photo_size = engine.getUserPhotoSize();
uid_photos = new HashMap();
} // end if
Iterator it = messages.iterator();
while (it.hasNext())
{ // get the user IDs of all messages on this page
TopicMessageContext msg = (TopicMessageContext)(it.next());
Integer the_uid = new Integer(msg.getCreatorUID());
boolean get_photo;
if (!(saw_users.contains(the_uid)))
{ // only check user IDs once per display operation
saw_users.add(the_uid);
get_photo = true;
if (topic.isBozo(the_uid.intValue()))
{ // shall we get the user photo?
bozo_uids.add(the_uid);
get_photo = no_bozos;
} // end if
if (conf.displayPostPictures() && user.displayPostPictures() && get_photo)
{ // look up the user photo URL
UserProfile prof = user.getProfile(the_uid.intValue());
String url = prof.getPhotoURL();
if (url!=null)
uid_photos.put(the_uid,url);
} // end else if
} // end if
@@ -470,4 +495,24 @@ public class TopicPosts implements JSPRender
} // end showFilterButton
public String getUserPhotoTag(int uid, RenderData rdat)
{
if (photo_size==null)
return ""; // user photos not enabled
StringBuffer buf = new StringBuffer("<IMG SRC=\"");
String url = (String)(uid_photos.get(new Integer(uid)));
if (url==null)
url = rdat.getFullImagePath("photo_not_avail.gif");
buf.append(url).append("\" ALT=\"\" WIDTH=").append(photo_size.width).append(" HEIGHT=");
buf.append(photo_size.height).append(" ALIGN=LEFT BORDER=0 HSPACE=2 VSPACE=2>");
return buf.toString();
} // end getUserPhotoTag
public boolean displayPostPictures()
{
return (photo_size!=null);
} // end displayPostPictures
} // end class TopicPosts