added sidebox view, prep for sysadmin menu stuff

This commit is contained in:
Eric J. Bowersox
2003-05-24 09:40:17 +00:00
parent f933e4f88c
commit 0c7f518f3e
19 changed files with 805 additions and 34 deletions

View File

@@ -0,0 +1,130 @@
/*
* 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) 2003 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved.
*
* Contributor(s):
*/
package com.silverwrist.dynamo.dialog;
import java.io.*;
import java.util.*;
import org.w3c.dom.*;
import com.silverwrist.util.*;
import com.silverwrist.dynamo.except.*;
import com.silverwrist.dynamo.iface.*;
import com.silverwrist.dynamo.util.*;
public class LinkTypeField extends BaseDialogField
{
/*--------------------------------------------------------------------------------
* Attributes
*--------------------------------------------------------------------------------
*/
private String m_value;
/*--------------------------------------------------------------------------------
* Constructors
*--------------------------------------------------------------------------------
*/
public LinkTypeField(Element elt) throws DialogException
{
super(false,elt);
m_value = null;
} // end constructor
protected LinkTypeField(LinkTypeField other)
{
super(other);
m_value = null;
} // end constructor
/*--------------------------------------------------------------------------------
* Abstract implementations from class BaseDialogField
*--------------------------------------------------------------------------------
*/
protected void renderField(TextRenderControl control, Map render_params)
throws IOException, RenderingException
{
PrintWriter wr = control.getWriter();
wr.write("<select name=\"" + getName() + "\" size=\"1\"");
if (!isEnabled())
wr.write(" disabled=\"disabled\"");
wr.write(">\n");
URLRewriter rewriter = (URLRewriter)(control.queryService(URLRewriter.class));
if (rewriter!=null)
{ // get the list of possible rewrite types and add them
Iterator it = rewriter.getRewriteTypes().iterator();
while (it.hasNext())
{ // render each choice name and display value in turn
String ch = (String)(it.next());
wr.write("<option value=\"" + ch + "\"");
if (ch.equals(m_value))
wr.write(" selected=\"selected\"");
wr.write(">" + StringUtils.encodeHTML(ch) + "</option>\n");
} // end while
} // end if
wr.write("</select>");
} // end renderField
protected void validateContents(Request r, Object data) throws ValidationException
{ // don't need to validate the contents on a pick list
} // end validateContents
public Object getValue()
{
return m_value;
} // end getValue
public boolean containsValue()
{
return (m_value!=null);
} // end containsValue
public void setValue(Object obj)
{
m_value = obj.toString();
} // end setValue
public void setValueFrom(Request r)
{
RequestHelper rh = new RequestHelper(r);
m_value = rh.getParameterString(getName());
} // end setValueFrom
public void reset()
{
m_value = null;
} // return reset
public Object clone()
{
return new LinkTypeField(this);
} // end clone
} // end class LinkTypeField

View File

@@ -11,7 +11,7 @@
*
* 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) 2002 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved.
* Copyright (C) 2002-03 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved.
*
* Contributor(s):
*/
@@ -64,6 +64,8 @@ class StdItemFactory implements DialogItemFactory
return new HiddenField(elt);
if (tagname.equals("int"))
return new IntegerField(elt);
if (tagname.equals("linktypelist"))
return new LinkTypeField(elt);
if (tagname.equals("localelist"))
return new LocaleListField(elt);
if (tagname.equals("password"))

View File

@@ -11,16 +11,20 @@
*
* 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) 2002 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved.
* Copyright (C) 2002-03 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved.
*
* Contributor(s):
*/
package com.silverwrist.dynamo.iface;
import java.util.List;
public interface URLRewriter
{
public String rewriteURL(String type, String url);
public String rewriteRedirectURL(String type, String url);
public List getRewriteTypes();
} // end interface URLRewriter

View File

@@ -34,6 +34,7 @@ class URLRewriterImpl implements URLRewriter
private HttpServletRequest m_req;
private HttpServletResponse m_resp;
private Map m_rewriter_map;
private List m_type_list = null;
/*--------------------------------------------------------------------------------
* Constructor
@@ -85,4 +86,19 @@ class URLRewriterImpl implements URLRewriter
} // end rewriteRedirectURL
public synchronized List getRewriteTypes()
{
if (m_type_list==null)
{ // create the type list
ArrayList tmp = new ArrayList(m_rewriter_map.size());
tmp.addAll(m_rewriter_map.keySet());
Collections.sort(tmp);
m_type_list = Collections.unmodifiableList(tmp);
} // end if
return m_type_list;
} // end getRewriteTypes
} // end class URLRewriterImpl