diff --git a/conf/venice-db-init-mysql.sql b/conf/venice-db-init-mysql.sql index 2105988..1bb0278 100644 --- a/conf/venice-db-init-mysql.sql +++ b/conf/venice-db-init-mysql.sql @@ -1375,7 +1375,7 @@ INSERT INTO menuvars (menuid, var_name, default_val) VALUES INSERT INTO menuitems (menuid, sequence, itemtype, text, linktype, link) VALUES (5, 0, 'TEXT', 'Home Page', 'SERVLET', 'community/${alias}' ), (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, 60300, 'SEPARATOR', NULL, NULL, NULL ), (5, 60400, 'TEXT', 'Unjoin', 'SERVLET', 'TODO' ); diff --git a/venice-data/scripts/comm/profile.js b/venice-data/scripts/comm/profile.js new file mode 100644 index 0000000..8918a42 --- /dev/null +++ b/venice-data/scripts/comm/profile.js @@ -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 . +// +// 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 , +// 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! diff --git a/venice-data/scripts/find_categories.js b/venice-data/scripts/find_categories.js index 4704287..5a96ea0 100644 --- a/venice-data/scripts/find_categories.js +++ b/venice-data/scripts/find_categories.js @@ -76,7 +76,7 @@ if (rhelp.isVerb("POST")) } // end catch -} // end else +} // end if if (rc==null) { // create the VelocityView for the output diff --git a/venice-data/velocity/comm/profile.vm b/venice-data/velocity/comm/profile.vm new file mode 100644 index 0000000..678dd89 --- /dev/null +++ b/venice-data/velocity/comm/profile.vm @@ -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 . + + 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 , + 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}" ) + + + +
+ #render( $logo )
+ Community created:
#formatDate( $community.CreationDate )
+ #if( $community.LastAccessDate ) + Last accessed:
#formatDate( $community.LastAccessDate )
+ #end + #if( $community.LastUpdateDate ) + Profile last updated:
#formatDate( $community.LastUpdateDate )
+ #end +
+ ## TODO: Reserved for Invite or Join button +
+
+ TODO: Type of Community + #if( $use_category ) + #set( $c = $community.CategoryID ) +
Category: + #encodeHTML( $community.Category.toString() ) + #end + #set( $u = $community.HostUser.Name ) +

Host: #encodeHTML( $u )

+

#encodeHTML( $synopsis )

+

+ Location:
+ #if( $location ) + #foreach( $t in $location ) + #encodeHTML( $t )
+ #end + #end +

+

Primary Language: #encodeHTML( $language.Name )

+

Standards of Conduct: #encodeHTML( $rules )

+