added community profile page
This commit is contained in:
parent
2aae5c47eb
commit
53dd5a6994
|
@ -1375,7 +1375,7 @@ INSERT INTO menuvars (menuid, var_name, default_val) VALUES
|
||||||
INSERT INTO menuitems (menuid, sequence, itemtype, text, linktype, link) VALUES
|
INSERT INTO menuitems (menuid, sequence, itemtype, text, linktype, link) VALUES
|
||||||
(5, 0, 'TEXT', 'Home Page', 'SERVLET', 'community/${alias}' ),
|
(5, 0, 'TEXT', 'Home Page', 'SERVLET', 'community/${alias}' ),
|
||||||
(5, 60000, 'TEXT', 'Members', 'SERVLET', 'TODO' ),
|
(5, 60000, 'TEXT', 'Members', 'SERVLET', 'TODO' ),
|
||||||
(5, 60100, 'TEXT', 'Profile', 'SERVLET', 'TODO' ),
|
(5, 60100, 'TEXT', 'Profile', 'SERVLET', 'comm/profile.js.vs?cc=${cid}' ),
|
||||||
(5, 60200, 'TEXT', 'Administration', 'SERVLET', 'comm/admin/main.js.vs?cc=${cid}'),
|
(5, 60200, 'TEXT', 'Administration', 'SERVLET', 'comm/admin/main.js.vs?cc=${cid}'),
|
||||||
(5, 60300, 'SEPARATOR', NULL, NULL, NULL ),
|
(5, 60300, 'SEPARATOR', NULL, NULL, NULL ),
|
||||||
(5, 60400, 'TEXT', 'Unjoin', 'SERVLET', 'TODO' );
|
(5, 60400, 'TEXT', 'Unjoin', 'SERVLET', 'TODO' );
|
||||||
|
|
107
venice-data/scripts/comm/profile.js
Normal file
107
venice-data/scripts/comm/profile.js
Normal file
|
@ -0,0 +1,107 @@
|
||||||
|
// 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(java.lang);
|
||||||
|
importPackage(java.util);
|
||||||
|
importPackage(Packages.com.silverwrist.util);
|
||||||
|
importClass(Packages.com.silverwrist.dynamo.Namespaces);
|
||||||
|
importPackage(Packages.com.silverwrist.dynamo.except);
|
||||||
|
importPackage(Packages.com.silverwrist.dynamo.iface);
|
||||||
|
importPackage(Packages.com.silverwrist.venice.content);
|
||||||
|
importPackage(Packages.com.silverwrist.venice.iface);
|
||||||
|
importPackage(Packages.com.silverwrist.venice.menu);
|
||||||
|
|
||||||
|
req = bsf.lookupBean("request");
|
||||||
|
req_help = bsf.lookupBean("request_help");
|
||||||
|
user = vlib.getUser(req);
|
||||||
|
comm = vlib.getCommunity(req);
|
||||||
|
|
||||||
|
// get the global properties store
|
||||||
|
globals = vcast.getGlobalPropertiesStore(req);
|
||||||
|
|
||||||
|
// Construct the VelocityView we want to use.
|
||||||
|
rc = new VelocityView(comm.getName() + ": Profile","comm/profile.vm");
|
||||||
|
rc.menuSelector = "community";
|
||||||
|
rc.pageQID = "comm/profile.js.vs?cc=" + comm.getCID();
|
||||||
|
rc.setParameter("community",comm);
|
||||||
|
|
||||||
|
// Get a rendering for the community logo.
|
||||||
|
logorender = vcast.queryRenderImage(req_help.getRequestObject(Namespaces.DYNAMO_OBJECT_NAMESPACE,
|
||||||
|
"venice-communitylogo"));
|
||||||
|
logo_url = PropertyUtils.getPropertyNoErr(comm,VeniceNamespaces.COMMUNITY_PROFILE_NAMESPACE,"url.logo");
|
||||||
|
if (logo_url==null)
|
||||||
|
{ // get the logo default
|
||||||
|
url = globals.getObject(VeniceNamespaces.COMMUNITY_GLOBALS_NAMESPACE,"community.nologo.url");
|
||||||
|
urltype = globals.getObject(VeniceNamespaces.COMMUNITY_GLOBALS_NAMESPACE,"community.nologo.url.type");
|
||||||
|
rewriter = cast.queryURLRewriter(req);
|
||||||
|
logo_url = rewriter.rewriteURL(urltype,url);
|
||||||
|
|
||||||
|
} // end if
|
||||||
|
|
||||||
|
rc.setParameter("logo",logorender.getRenderingObject(logo_url));
|
||||||
|
|
||||||
|
// Get the "use category" flag.
|
||||||
|
opts = cast.toOptionSet(globals.getObject(VeniceNamespaces.COMMUNITY_GLOBALS_NAMESPACE,"options"));
|
||||||
|
if (opts.get(0))
|
||||||
|
rc.setParameter("use_category",Boolean.TRUE);
|
||||||
|
|
||||||
|
// Set the parameters that correspond to single properties.
|
||||||
|
rc.setParameter("synopsis",PropertyUtils.getPropertyNoErr(comm,VeniceNamespaces.COMMUNITY_PROFILE_NAMESPACE,
|
||||||
|
"synopsis"));
|
||||||
|
rc.setParameter("rules",PropertyUtils.getPropertyNoErr(comm,VeniceNamespaces.COMMUNITY_PROFILE_NAMESPACE,"rules"));
|
||||||
|
rc.setParameter("language",comm.getObject(VeniceNamespaces.COMMUNITY_PROFILE_NAMESPACE,"language"));
|
||||||
|
|
||||||
|
// Fill in the location list.
|
||||||
|
locs = new ArrayList();
|
||||||
|
tmp = PropertyUtils.getPropertyNoErr(comm,VeniceNamespaces.COMMUNITY_PROFILE_NAMESPACE,"company.name");
|
||||||
|
if (stringutils.isNotEmpty(tmp))
|
||||||
|
locs.add(tmp);
|
||||||
|
tmp = PropertyUtils.getPropertyNoErr(comm,VeniceNamespaces.COMMUNITY_PROFILE_NAMESPACE,"address.1");
|
||||||
|
if (stringutils.isNotEmpty(tmp))
|
||||||
|
locs.add(tmp);
|
||||||
|
tmp = PropertyUtils.getPropertyNoErr(comm,VeniceNamespaces.COMMUNITY_PROFILE_NAMESPACE,"address.2");
|
||||||
|
if (stringutils.isNotEmpty(tmp))
|
||||||
|
locs.add(tmp);
|
||||||
|
tmp = "";
|
||||||
|
t_city = PropertyUtils.getPropertyNoErr(comm,VeniceNamespaces.COMMUNITY_PROFILE_NAMESPACE,"locality");
|
||||||
|
t_state = PropertyUtils.getPropertyNoErr(comm,VeniceNamespaces.COMMUNITY_PROFILE_NAMESPACE,"region");
|
||||||
|
if (stringutils.isNotEmpty(t_city))
|
||||||
|
{ // combine these in a proper manner
|
||||||
|
if (stringutils.isNotEmpty(t_state))
|
||||||
|
tmp = t_city + ", " + t_state;
|
||||||
|
else
|
||||||
|
tmp = t_city;
|
||||||
|
|
||||||
|
} // end if
|
||||||
|
else if (stringutils.isNotEmpty(t_state))
|
||||||
|
tmp = t_state;
|
||||||
|
t_zip = PropertyUtils.getPropertyNoErr(comm,VeniceNamespaces.COMMUNITY_PROFILE_NAMESPACE,"postal.code");
|
||||||
|
if (stringutils.isNotEmpty(t_zip))
|
||||||
|
{ // tack postal code on at the end
|
||||||
|
if (stringutils.isNotEmpty(tmp))
|
||||||
|
tmp += " ";
|
||||||
|
tmp += t_zip;
|
||||||
|
|
||||||
|
} // end if
|
||||||
|
|
||||||
|
if (stringutils.isNotEmpty(tmp))
|
||||||
|
locs.add(tmp);
|
||||||
|
tmp = PropertyUtils.getPropertyNoErr(comm,VeniceNamespaces.COMMUNITY_PROFILE_NAMESPACE,"country");
|
||||||
|
if (tmp!=null)
|
||||||
|
locs.add(tmp.getName());
|
||||||
|
rc.setParameter("location",locs);
|
||||||
|
|
||||||
|
dynamo.scriptOutput(rc); // all done!
|
|
@ -76,7 +76,7 @@ if (rhelp.isVerb("POST"))
|
||||||
|
|
||||||
} // end catch
|
} // end catch
|
||||||
|
|
||||||
} // end else
|
} // end if
|
||||||
|
|
||||||
if (rc==null)
|
if (rc==null)
|
||||||
{ // create the VelocityView for the output
|
{ // create the VelocityView for the output
|
||||||
|
|
65
venice-data/velocity/comm/profile.vm
Normal file
65
venice-data/velocity/comm/profile.vm
Normal file
|
@ -0,0 +1,65 @@
|
||||||
|
#*
|
||||||
|
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):
|
||||||
|
*#
|
||||||
|
#*
|
||||||
|
Parameters:
|
||||||
|
community = Community we're displaying the profile of.
|
||||||
|
logo = Community logo renderable object.
|
||||||
|
use_category = True (set) if we're using categories on this server.
|
||||||
|
synopsis = Community synopsis.
|
||||||
|
location = List of strings containing location information
|
||||||
|
language = Primary language for community (a com.silverwrist.util.Language object)
|
||||||
|
rules = Community rules/standards of conduct
|
||||||
|
*#
|
||||||
|
#comment( "Profile for community #${community.getCID()}" )
|
||||||
|
#header2( "Community Profile:" "${community.Name}" )
|
||||||
|
<table border="0" cellpadding="6" cellspacing="0"><tr valign="top">
|
||||||
|
<td align="left" class="smcontent">
|
||||||
|
#render( $logo )<br />
|
||||||
|
Community created:<br />#formatDate( $community.CreationDate )<br />
|
||||||
|
#if( $community.LastAccessDate )
|
||||||
|
Last accessed:<br />#formatDate( $community.LastAccessDate )<br />
|
||||||
|
#end
|
||||||
|
#if( $community.LastUpdateDate )
|
||||||
|
Profile last updated:<br />#formatDate( $community.LastUpdateDate )<br />
|
||||||
|
#end
|
||||||
|
<div align="center">
|
||||||
|
## TODO: Reserved for Invite or Join button
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
<td align="left" class="content">
|
||||||
|
<b><u>TODO: Type of Community</u></b>
|
||||||
|
#if( $use_category )
|
||||||
|
#set( $c = $community.CategoryID )
|
||||||
|
<br /><b>Category:</b>
|
||||||
|
<a href="#formatURL( "SERVLET" "find_communities.js.vs?cat=$c" )">#encodeHTML( $community.Category.toString() )</a>
|
||||||
|
#end
|
||||||
|
#set( $u = $community.HostUser.Name )
|
||||||
|
<p><b>Host:</b> <a href="#formatURL( "SERVLET" "user/$u" )">#encodeHTML( $u )</a></p>
|
||||||
|
<p><em>#encodeHTML( $synopsis )</em></p>
|
||||||
|
<p>
|
||||||
|
<b>Location:</b><br />
|
||||||
|
#if( $location )
|
||||||
|
#foreach( $t in $location )
|
||||||
|
#encodeHTML( $t )<br />
|
||||||
|
#end
|
||||||
|
#end
|
||||||
|
</p>
|
||||||
|
<p><b>Primary Language:</b> #encodeHTML( $language.Name )</p>
|
||||||
|
<p><b>Standards of Conduct:</b> #encodeHTML( $rules )</p>
|
||||||
|
</td>
|
||||||
|
</tr></table>
|
Loading…
Reference in New Issue
Block a user