added community home page - first step into community support
This commit is contained in:
parent
80d4ba4212
commit
96b6f27e2c
|
@ -57,6 +57,10 @@
|
|||
<database connection="data"/>
|
||||
</object>
|
||||
|
||||
<object name="index" classname="com.silverwrist.dynamo.index.IndexManagerObject" priority="1">
|
||||
<database connection="data" namespaces="nscache"/>
|
||||
</object>
|
||||
|
||||
<object name="srm" classname="com.silverwrist.dynamo.security.SRMObject" priority="1">
|
||||
<database connection="data" namespaces="nscache"/>
|
||||
<user-manager cpoint="srm_proxy"/>
|
||||
|
|
|
@ -164,6 +164,12 @@
|
|||
<servlet-class>com.silverwrist.venice.servlet.UserServlet</servlet-class>
|
||||
</servlet>
|
||||
|
||||
<servlet>
|
||||
<servlet-name>Community</servlet-name>
|
||||
<description>Displays the community homepage.</description>
|
||||
<servlet-class>com.silverwrist.venice.servlet.CommunityServlet</servlet-class>
|
||||
</servlet>
|
||||
|
||||
<!-- BEGIN SourceID-SSO Servlets -->
|
||||
|
||||
<!-- SourceID-SSO Manager Servlet (configuration is loaded here) -->
|
||||
|
@ -281,6 +287,16 @@
|
|||
<url-pattern>/user/*</url-pattern>
|
||||
</servlet-mapping>
|
||||
|
||||
<servlet-mapping>
|
||||
<servlet-name>Community</servlet-name>
|
||||
<url-pattern>/community/*</url-pattern>
|
||||
</servlet-mapping>
|
||||
|
||||
<servlet-mapping>
|
||||
<servlet-name>Community</servlet-name>
|
||||
<url-pattern>/sig/*</url-pattern> <!-- the backwards-compatible mapping -->
|
||||
</servlet-mapping>
|
||||
|
||||
<!-- BEGIN SourceID-SSO Servlet Mappings -->
|
||||
|
||||
<!-- Authenticator Servlet -->
|
||||
|
|
|
@ -40,6 +40,7 @@
|
|||
<username>veniceuser</username>
|
||||
<password>XYZZY0099</password>
|
||||
<connections initial="5" max="20" busywait="true"/>
|
||||
<initialize test="true"/>
|
||||
</dbconnection>
|
||||
|
||||
<!-- Infrastructure objects -->
|
||||
|
|
|
@ -1370,7 +1370,9 @@ INSERT INTO sbox_master (sbid, sb_nsid, sb_name, type_nsid, type_name, descr) VA
|
|||
INSERT INTO sbox_context (sbid, ctx_nsid, ctx_name) VALUES
|
||||
(1, 17, 'top' ),
|
||||
(2, 17, 'top' ),
|
||||
(3, 17, 'top');
|
||||
(2, 17, 'community'),
|
||||
(3, 17, 'top' ),
|
||||
(3, 17, 'community');
|
||||
|
||||
INSERT INTO sbox_props (sbid, nsid, prop_name, prop_value) VALUES
|
||||
(1, 6, 'normal.title', '!Your Communities' ),
|
||||
|
@ -1383,6 +1385,10 @@ INSERT INTO sbox_deploy (uid, ctx_nsid, ctx_name, param, seq, sbid) VALUES
|
|||
(1, 17, 'top', NULL, 0, 1),
|
||||
(1, 17, 'top', NULL, 1, 2),
|
||||
(1, 17, 'top', NULL, 2, 3),
|
||||
(1, 17, 'community', '.Community:1', 0, 2),
|
||||
(1, 17, 'community', '.Community:1', 1, 3),
|
||||
(2, 17, 'top', NULL, 0, 1),
|
||||
(2, 17, 'top', NULL, 1, 2),
|
||||
(2, 17, 'top', NULL, 2, 3);
|
||||
(2, 17, 'top', NULL, 2, 3),
|
||||
(2, 17, 'community', '.Community:1', 0, 2),
|
||||
(2, 17, 'community', '.Community:1', 1, 3);
|
||||
|
|
|
@ -12,7 +12,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):
|
||||
-->
|
||||
|
@ -157,6 +157,12 @@
|
|||
<servlet-class>com.silverwrist.venice.servlet.UserServlet</servlet-class>
|
||||
</servlet>
|
||||
|
||||
<servlet>
|
||||
<servlet-name>Community</servlet-name>
|
||||
<description>Displays the community homepage.</description>
|
||||
<servlet-class>com.silverwrist.venice.servlet.CommunityServlet</servlet-class>
|
||||
</servlet>
|
||||
|
||||
<!-- Servlet mappings -->
|
||||
|
||||
<servlet-mapping>
|
||||
|
@ -204,6 +210,16 @@
|
|||
<url-pattern>/user/*</url-pattern>
|
||||
</servlet-mapping>
|
||||
|
||||
<servlet-mapping>
|
||||
<servlet-name>Community</servlet-name>
|
||||
<url-pattern>/community/*</url-pattern>
|
||||
</servlet-mapping>
|
||||
|
||||
<servlet-mapping>
|
||||
<servlet-name>Community</servlet-name>
|
||||
<url-pattern>/sig/*</url-pattern> <!-- the backwards-compatible mapping -->
|
||||
</servlet-mapping>
|
||||
|
||||
<!-- Global parameters for the HTTP session -->
|
||||
<session-config>
|
||||
<session-timeout>60</session-timeout> <!-- 1 hour -->
|
||||
|
|
|
@ -313,6 +313,18 @@ public class StringUtils extends org.apache.commons.lang.StringUtils
|
|||
|
||||
} // end split1
|
||||
|
||||
/**
|
||||
* Returns the string equivalent of this object, or <CODE>null</CODE> if the specified object is <CODE>null</CODE>.
|
||||
*
|
||||
* @param obj The object to be converted to a string.
|
||||
* @return See above.
|
||||
*/
|
||||
public static final String stringize(Object obj)
|
||||
{
|
||||
return ((obj==null) ? null : obj.toString());
|
||||
|
||||
} // end stringize
|
||||
|
||||
/*--------------------------------------------------------------------------------
|
||||
* Static initializer
|
||||
*--------------------------------------------------------------------------------
|
||||
|
|
|
@ -179,6 +179,12 @@ public class ExternalException extends DynamoException
|
|||
*--------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
public String getMessageID()
|
||||
{
|
||||
return m_message_id;
|
||||
|
||||
} // end getMessageID
|
||||
|
||||
/**
|
||||
* Sets a replacement parameter for the message.
|
||||
*
|
||||
|
|
|
@ -162,6 +162,12 @@ public class ExternalRuntimeException extends DynamoRuntimeException
|
|||
*--------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
public String getMessageID()
|
||||
{
|
||||
return m_message_id;
|
||||
|
||||
} // end getMessageID
|
||||
|
||||
/**
|
||||
* Sets a replacement parameter for the message.
|
||||
*
|
||||
|
|
|
@ -70,4 +70,7 @@ public interface VeniceNamespaces
|
|||
public static final String SIDEBOX_CONTEXT_NAMESPACE =
|
||||
"http://www.silverwrist.com/NS/venice/2003/05/31/sidebox.context.ids";
|
||||
|
||||
public static final String COMMUNITY_NAMESPACE =
|
||||
"http://www.silverwrist.com/NS/venice/2003/06/15/community";
|
||||
|
||||
} // end interface VeniceNamespaces
|
||||
|
|
|
@ -0,0 +1,19 @@
|
|||
# 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):
|
||||
# ---------------------------------------------------------------------------------
|
||||
# This file has been localized for the en_US locale
|
||||
invalid.cid=The specified community ID "{0}" is not a valid integer.
|
||||
no.community=No community ID was specified for this operation.
|
|
@ -25,7 +25,9 @@ import com.silverwrist.dynamo.except.*;
|
|||
import com.silverwrist.dynamo.iface.*;
|
||||
import com.silverwrist.dynamo.util.*;
|
||||
import com.silverwrist.venice.VeniceNamespaces;
|
||||
import com.silverwrist.venice.community.CommunityService;
|
||||
import com.silverwrist.venice.content.*;
|
||||
import com.silverwrist.venice.iface.*;
|
||||
import com.silverwrist.venice.session.SessionInfoParams;
|
||||
|
||||
public class LibraryVenice
|
||||
|
@ -85,6 +87,37 @@ public class LibraryVenice
|
|||
|
||||
} // end constructor
|
||||
|
||||
/*--------------------------------------------------------------------------------
|
||||
* Internal operations
|
||||
*--------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
private final int getCommunityParameter(Request req) throws ValidationException
|
||||
{
|
||||
Map pmap = req.getParameters();
|
||||
String cparam = StringUtils.stringize(pmap.get("cid"));
|
||||
if (cparam==null)
|
||||
cparam = StringUtils.stringize(pmap.get("cc"));
|
||||
if (cparam==null)
|
||||
cparam = StringUtils.stringize(pmap.get("sig"));
|
||||
if (cparam==null)
|
||||
return -1; // completely not-specified
|
||||
|
||||
try
|
||||
{ // get the community ID
|
||||
return Integer.parseInt(cparam.trim());
|
||||
|
||||
} // end try
|
||||
catch (NumberFormatException e)
|
||||
{ // couldn't be parsed as an integer - damn!
|
||||
ValidationException ve = new ValidationException(LibraryVenice.class,"LibraryMessages","invalid.cid",e);
|
||||
ve.setParameter(0,cparam);
|
||||
throw ve;
|
||||
|
||||
} // end catch
|
||||
|
||||
} // end getCommunityParameter
|
||||
|
||||
/*--------------------------------------------------------------------------------
|
||||
* External operations
|
||||
*--------------------------------------------------------------------------------
|
||||
|
@ -101,6 +134,63 @@ public class LibraryVenice
|
|||
|
||||
} // end dialogFrameTitle
|
||||
|
||||
public VeniceCommunity getCommunity(Request req) throws DatabaseException, ValidationException
|
||||
{
|
||||
VeniceCommunity rc = (VeniceCommunity)(PropertyUtils.getPropertyNoErr(req,VeniceNamespaces.COMMUNITY_NAMESPACE,
|
||||
"current"));
|
||||
if (rc==null)
|
||||
{ // get the value of the community ID parameter
|
||||
int cid = getCommunityParameter(req);
|
||||
if (cid==-1)
|
||||
throw new ValidationException(LibraryVenice.class,"LibraryMessages","no.community");
|
||||
|
||||
// use that to get the community
|
||||
ObjectProvider op = (ObjectProvider)(req.queryService(ObjectProvider.class));
|
||||
CommunityService csvc = (CommunityService)(op.getObject(Namespaces.DYNAMO_OBJECT_NAMESPACE,"communities"));
|
||||
rc = csvc.getCommunity(cid);
|
||||
|
||||
// save community reference for next time
|
||||
req.setObject(VeniceNamespaces.COMMUNITY_NAMESPACE,"current",rc);
|
||||
|
||||
} // end if
|
||||
|
||||
return rc;
|
||||
|
||||
} // end getCommunity
|
||||
|
||||
public VeniceCommunity getCommunity(Request req, VeniceCommunity def) throws DatabaseException, ValidationException
|
||||
{
|
||||
VeniceCommunity rc = (VeniceCommunity)(PropertyUtils.getPropertyNoErr(req,VeniceNamespaces.COMMUNITY_NAMESPACE,
|
||||
"current"));
|
||||
if ((rc==null) && PropertyUtils.hasProperty(req,VeniceNamespaces.COMMUNITY_NAMESPACE,"is.null"))
|
||||
return null;
|
||||
if (rc==null)
|
||||
{ // get the value of the community ID parameter
|
||||
int cid = getCommunityParameter(req);
|
||||
if (cid!=-1)
|
||||
{ // use that to get the community
|
||||
ObjectProvider op = (ObjectProvider)(req.queryService(ObjectProvider.class));
|
||||
CommunityService csvc = (CommunityService)(op.getObject(Namespaces.DYNAMO_OBJECT_NAMESPACE,"communities"));
|
||||
rc = csvc.getCommunity(cid);
|
||||
|
||||
} // end if
|
||||
else
|
||||
{ // just employ the default community
|
||||
rc = def;
|
||||
if (rc==null)
|
||||
req.setObject(VeniceNamespaces.COMMUNITY_NAMESPACE,"is.null",Boolean.TRUE);
|
||||
|
||||
} // end else
|
||||
|
||||
if (rc!=null) // save community reference for next time
|
||||
req.setObject(VeniceNamespaces.COMMUNITY_NAMESPACE,"current",rc);
|
||||
|
||||
} // end if
|
||||
|
||||
return rc;
|
||||
|
||||
} // end getCommunity
|
||||
|
||||
public String getLocation(Request req)
|
||||
{
|
||||
return (String)(req.getObject(SessionInfoParams.REQ_NAMESPACE,SessionInfoParams.RATTR_LOCATION));
|
||||
|
|
|
@ -0,0 +1,63 @@
|
|||
/*
|
||||
* 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.venice.servlet;
|
||||
|
||||
import com.silverwrist.dynamo.HttpStatusCode;
|
||||
import com.silverwrist.dynamo.Namespaces;
|
||||
import com.silverwrist.dynamo.except.*;
|
||||
import com.silverwrist.dynamo.iface.*;
|
||||
import com.silverwrist.dynamo.servlet.ServletBase;
|
||||
import com.silverwrist.dynamo.util.*;
|
||||
import com.silverwrist.venice.VeniceNamespaces;
|
||||
import com.silverwrist.venice.community.CommunityService;
|
||||
import com.silverwrist.venice.iface.*;
|
||||
|
||||
public class CommunityServlet extends ServletBase
|
||||
{
|
||||
/*--------------------------------------------------------------------------------
|
||||
* Abstract implementations from class ServletBase
|
||||
*--------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
protected Object process(Request r, Application app) throws Exception
|
||||
{
|
||||
// Look up the community.
|
||||
ObjectProvider op = (ObjectProvider)(r.queryService(ObjectProvider.class));
|
||||
CommunityService csvc = (CommunityService)(op.getObject(Namespaces.DYNAMO_OBJECT_NAMESPACE,"communities"));
|
||||
VeniceCommunity comm = null;
|
||||
try
|
||||
{ // get the community by its alias
|
||||
comm = csvc.getCommunity(r.getExtraPath().substring(1));
|
||||
|
||||
} // end try
|
||||
catch (DatabaseException e)
|
||||
{ // handle "not-found" errors in a special way
|
||||
if (e.getMessageID().equals("cid.notFound"))
|
||||
return new HttpErrorMessage(HttpStatusCode.E_NOTFOUND);
|
||||
throw e;
|
||||
|
||||
} // end catch
|
||||
|
||||
// Execute the script that produces the value.
|
||||
r.setObject(VeniceNamespaces.COMMUNITY_NAMESPACE,"current",comm);
|
||||
ScriptExecute exec = (ScriptExecute)(r.queryService(ScriptExecute.class));
|
||||
return exec.executeScript(r,"/util/comm/homepage.js");
|
||||
|
||||
} // end process
|
||||
|
||||
} // end class CommunityServlet
|
66
venice-data/util/comm/homepage.js
Normal file
66
venice-data/util/comm/homepage.js
Normal file
|
@ -0,0 +1,66 @@
|
|||
// 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):
|
||||
|
||||
importPackage(Packages.com.silverwrist.dynamo.iface);
|
||||
importPackage(Packages.com.silverwrist.dynamo.util);
|
||||
importPackage(Packages.com.silverwrist.venice.iface);
|
||||
|
||||
req = bsf.lookupBean("request");
|
||||
req_help = bsf.lookupBean("request_help");
|
||||
user = vlib.getUser(req);
|
||||
comm = vlib.getCommunity(req);
|
||||
|
||||
// Create the page content.
|
||||
// BEGIN TEMPORARY STUFF
|
||||
|
||||
// Find the standard content supplier.
|
||||
scs = vcast.queryContentBlockProvider(req_help.getRequestObject(Namespaces.DYNAMO_OBJECT_NAMESPACE,"venice-content"));
|
||||
|
||||
// Get an instance of the content block representing the page title.
|
||||
cblk = scs.getContentBlock("content.header");
|
||||
cblk.setContentParameter("title","Home Page");
|
||||
cblk.setContentParameter("subtitle",comm.getName());
|
||||
|
||||
lipsum = "<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore "
|
||||
+ "et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut "
|
||||
+ "aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum "
|
||||
+ "dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui "
|
||||
+ "officia deserunt mollit anim id est laborum.</p>";
|
||||
|
||||
// Put together a list of objects to render in order.
|
||||
page_content = new ArrayList();
|
||||
page_content.add(cblk);
|
||||
page_content.add(lipsum);
|
||||
|
||||
// END TEMPORARY STUFF
|
||||
|
||||
// Create the sidebox list.
|
||||
sideboxes = vcast.querySideboxService(req_help.getRequestObject(Namespaces.DYNAMO_OBJECT_NAMESPACE,"venice-sidebox"));
|
||||
sidebox_list = sideboxes.getSideboxes(req,VeniceNamespaces.SIDEBOX_CONTEXT_NAMESPACE,"community",comm);
|
||||
|
||||
// Create the master view and return it.
|
||||
rc = new SideboxView(page_content,sidebox_list);
|
||||
//rc.menuSelector = "community";
|
||||
rc.pageTitle = comm.getName() + ": Home";
|
||||
rc.pageQID = "community/" + comm.getAlias();
|
||||
if (!(user.isAnonymous()))
|
||||
{ // they only get to configure if they're logged in
|
||||
rc.configureURL = "TODO";
|
||||
rc.configureURLType = "SERVLET";
|
||||
|
||||
} // end if
|
||||
|
||||
dynamo.scriptOutput(rc);
|
|
@ -27,7 +27,7 @@
|
|||
<tr valign="middle">
|
||||
<td align="center" width="14">#bullet()</td>
|
||||
<td align="left">
|
||||
<b><a href="#formatURL( "SERVLET" "TODO" )">#encodeHTML( ${c.Name} )</a></b>
|
||||
<b><a href="#formatURL( "SERVLET" "community/${c.Alias}" )">#encodeHTML( ${c.Name} )</a></b>
|
||||
#if( ${c.isAdministrator($user)} )
|
||||
## user is administrator, include the "Host!" graphic
|
||||
<img src="#formatURL( "IMAGE" "tag_host.gif" )" alt="Host!" width="40" height="20" border="0" />
|
||||
|
|
Loading…
Reference in New Issue
Block a user