added the first real front page sidebox, the community membership list
This commit is contained in:
parent
cd52993fba
commit
2e395d636a
|
@ -383,7 +383,8 @@ INSERT INTO namespaces (nsid, namespace) VALUES
|
||||||
(15, 'http://www.silverwrist.com/NS/venice/2003/05/29/community.profile' ),
|
(15, 'http://www.silverwrist.com/NS/venice/2003/05/29/community.profile' ),
|
||||||
(16, 'http://www.silverwrist.com/NS/venice/2003/05/30/community.globals' ),
|
(16, 'http://www.silverwrist.com/NS/venice/2003/05/30/community.globals' ),
|
||||||
(17, 'http://www.silverwrist.com/NS/venice/2003/05/31/sidebox.context.ids' ),
|
(17, 'http://www.silverwrist.com/NS/venice/2003/05/31/sidebox.context.ids' ),
|
||||||
(18, 'http://www.silverwrist.com/NS/venice/2003/05/31/test.sideboxes' );
|
(18, 'http://www.silverwrist.com/NS/venice/2003/05/31/test.sideboxes' ),
|
||||||
|
(19, 'http://www.silverwrist.com/NS/venice/2003/06/03/standard.sideboxes' );
|
||||||
|
|
||||||
# Initial global properties setup
|
# Initial global properties setup
|
||||||
INSERT INTO globalprop (nsid, prop_name, prop_value) VALUES
|
INSERT INTO globalprop (nsid, prop_name, prop_value) VALUES
|
||||||
|
@ -625,48 +626,53 @@ INSERT INTO groups (gid, groupname) VALUES (3, 'Verified_Users');
|
||||||
INSERT INTO groupmembers (gid, uid) VALUES (3, 2);
|
INSERT INTO groupmembers (gid, uid) VALUES (3, 2);
|
||||||
|
|
||||||
# Create the global ACL. This ACL is owned by the Administrator and grants
|
# Create the global ACL. This ACL is owned by the Administrator and grants
|
||||||
# permissions to the site administration group and to the Administrator specifically.
|
# permissions to the "all verified users" group, to the site administration group,
|
||||||
# (ACL 2, ACEs 2 and 3)
|
# and to the Administrator specifically.
|
||||||
|
# (ACL 2, ACEs 2, 3, 4)
|
||||||
INSERT INTO acl (aclid, aclname) VALUES (2, 'Global_Permissions');
|
INSERT INTO acl (aclid, aclname) VALUES (2, 'Global_Permissions');
|
||||||
INSERT INTO aclowner (aclid, ownerid, flags) VALUES (2, 2, 0);
|
INSERT INTO aclowner (aclid, ownerid, flags) VALUES (2, 2, 0);
|
||||||
INSERT INTO ace (aceid, pri, flags) VALUES (2, 1, 1);
|
INSERT INTO ace (aceid, pri, flags) VALUES (2, 3, 1);
|
||||||
INSERT INTO acldata (aclid, seq, aceid) VALUES (2, 0, 2);
|
INSERT INTO acldata (aclid, seq, aceid) VALUES (2, 0, 2);
|
||||||
INSERT INTO acedata (aceid, perm_nsid, perm_name) VALUES
|
INSERT INTO acedata (aceid, perm_nsid, perm_name) VALUES
|
||||||
(2, 1, 'set.property' ),
|
(2, 14, 'create.new');
|
||||||
(2, 1, 'set.block' ),
|
INSERT INTO ace (aceid, pri, flags) VALUES (3, 1, 1);
|
||||||
(2, 2, 'set.property' ),
|
|
||||||
(2, 3, 'edit.all' ),
|
|
||||||
(2, 3, 'bypass.email.verify' ),
|
|
||||||
(2, 3, 'view.all' ),
|
|
||||||
(2, 5, 'set.property' ),
|
|
||||||
(2, 5, 'set.block' ),
|
|
||||||
(2, 6, 'set.property' ),
|
|
||||||
(2, 6, 'set.block' ),
|
|
||||||
(2, 7, 'set.property' ),
|
|
||||||
(2, 10, 'set.property' ),
|
|
||||||
(2, 10, 'remove.property' ),
|
|
||||||
(2, 11, 'set.property' ),
|
|
||||||
(2, 11, 'remove.property' ),
|
|
||||||
(2, 12, 'set.property' ),
|
|
||||||
(2, 12, 'set.block' ),
|
|
||||||
(2, 13, 'show.admin.menu' ),
|
|
||||||
(2, 14, 'see.member.community.lists'),
|
|
||||||
(2, 14, 'community.directory.all' ),
|
|
||||||
(2, 14, 'community.search.all' ),
|
|
||||||
(2, 14, 'join.any' );
|
|
||||||
INSERT INTO ace (aceid, pri, flags) VALUES (3, 2, 0);
|
|
||||||
INSERT INTO acldata (aclid, seq, aceid) VALUES (2, 1, 3);
|
INSERT INTO acldata (aclid, seq, aceid) VALUES (2, 1, 3);
|
||||||
INSERT INTO acedata (aceid, perm_nsid, perm_name) VALUES
|
INSERT INTO acedata (aceid, perm_nsid, perm_name) VALUES
|
||||||
(3, 1, 'remove.property'),
|
(3, 1, 'set.property' ),
|
||||||
(3, 1, 'remove.block' ),
|
(3, 1, 'set.block' ),
|
||||||
(3, 2, 'remove.property'),
|
(3, 2, 'set.property' ),
|
||||||
(3, 5, 'remove.property'),
|
(3, 3, 'edit.all' ),
|
||||||
(3, 5, 'remove.block' ),
|
(3, 3, 'bypass.email.verify' ),
|
||||||
(3, 6, 'remove.property'),
|
(3, 3, 'view.all' ),
|
||||||
(3, 6, 'remove.block' ),
|
(3, 5, 'set.property' ),
|
||||||
(3, 7, 'remove.property'),
|
(3, 5, 'set.block' ),
|
||||||
(3, 12, 'remove.property'),
|
(3, 6, 'set.property' ),
|
||||||
(3, 12, 'remove.block' );
|
(3, 6, 'set.block' ),
|
||||||
|
(3, 7, 'set.property' ),
|
||||||
|
(3, 10, 'set.property' ),
|
||||||
|
(3, 10, 'remove.property' ),
|
||||||
|
(3, 11, 'set.property' ),
|
||||||
|
(3, 11, 'remove.property' ),
|
||||||
|
(3, 12, 'set.property' ),
|
||||||
|
(3, 12, 'set.block' ),
|
||||||
|
(3, 13, 'show.admin.menu' ),
|
||||||
|
(3, 14, 'see.member.community.lists'),
|
||||||
|
(3, 14, 'community.directory.all' ),
|
||||||
|
(3, 14, 'community.search.all' ),
|
||||||
|
(3, 14, 'join.any' );
|
||||||
|
INSERT INTO ace (aceid, pri, flags) VALUES (4, 2, 0);
|
||||||
|
INSERT INTO acldata (aclid, seq, aceid) VALUES (2, 2, 4);
|
||||||
|
INSERT INTO acedata (aceid, perm_nsid, perm_name) VALUES
|
||||||
|
(4, 1, 'remove.property'),
|
||||||
|
(4, 1, 'remove.block' ),
|
||||||
|
(4, 2, 'remove.property'),
|
||||||
|
(4, 5, 'remove.property'),
|
||||||
|
(4, 5, 'remove.block' ),
|
||||||
|
(4, 6, 'remove.property'),
|
||||||
|
(4, 6, 'remove.block' ),
|
||||||
|
(4, 7, 'remove.property'),
|
||||||
|
(4, 12, 'remove.property'),
|
||||||
|
(4, 12, 'remove.block' );
|
||||||
|
|
||||||
# Create the entries in the global security table.
|
# Create the entries in the global security table.
|
||||||
INSERT INTO globalsec (admin_uid, admin_gid, global_aclid, alluser_gid, verified_gid)
|
INSERT INTO globalsec (admin_uid, admin_gid, global_aclid, alluser_gid, verified_gid)
|
||||||
|
@ -700,61 +706,61 @@ INSERT INTO groupmembers (gid, uid) VALUES (5, 2);
|
||||||
|
|
||||||
# Create the ACL for the initial community members group. Only the community hosts and
|
# Create the ACL for the initial community members group. Only the community hosts and
|
||||||
# system administrators can add or remove members (without going through the "join" process).
|
# system administrators can add or remove members (without going through the "join" process).
|
||||||
# (ACL 3, ACEs 4 and 5)
|
# (ACL 3, ACEs 5 and 6)
|
||||||
INSERT INTO acl (aclid, aclname) VALUES (3, 'Members:piazza');
|
INSERT INTO acl (aclid, aclname) VALUES (3, 'Members:piazza');
|
||||||
INSERT INTO aclowner (aclid, ownerid, flags) VALUES (3, 2, 0);
|
INSERT INTO aclowner (aclid, ownerid, flags) VALUES (3, 2, 0);
|
||||||
INSERT INTO ace (aceid, pri, flags) VALUES (4, 5, 1);
|
INSERT INTO ace (aceid, pri, flags) VALUES (5, 5, 1);
|
||||||
INSERT INTO acldata (aclid, seq, aceid) VALUES (3, 0, 4);
|
INSERT INTO acldata (aclid, seq, aceid) VALUES (3, 0, 5);
|
||||||
INSERT INTO acedata (aceid, perm_nsid, perm_name) VALUES
|
|
||||||
(4, 4, 'add.member' ),
|
|
||||||
(4, 4, 'remove.member');
|
|
||||||
INSERT INTO ace (aceid, pri, flags) VALUES (5, 1, 1);
|
|
||||||
INSERT INTO acldata (aclid, seq, aceid) VALUES (3, 1, 5);
|
|
||||||
INSERT INTO acedata (aceid, perm_nsid, perm_name) VALUES
|
INSERT INTO acedata (aceid, perm_nsid, perm_name) VALUES
|
||||||
(5, 4, 'add.member' ),
|
(5, 4, 'add.member' ),
|
||||||
(5, 4, 'remove.member');
|
(5, 4, 'remove.member');
|
||||||
|
INSERT INTO ace (aceid, pri, flags) VALUES (6, 1, 1);
|
||||||
|
INSERT INTO acldata (aclid, seq, aceid) VALUES (3, 1, 6);
|
||||||
|
INSERT INTO acedata (aceid, perm_nsid, perm_name) VALUES
|
||||||
|
(6, 4, 'add.member' ),
|
||||||
|
(6, 4, 'remove.member');
|
||||||
UPDATE groups SET gaclid = 3 WHERE gid = 4;
|
UPDATE groups SET gaclid = 3 WHERE gid = 4;
|
||||||
|
|
||||||
# Create the ACL for the initial community hosts group. Only the community "main host"
|
# Create the ACL for the initial community hosts group. Only the community "main host"
|
||||||
# and system administrators can add or remove members.
|
# and system administrators can add or remove members.
|
||||||
# (ACL 4, ACEs 6 and 7)
|
# (ACL 4, ACEs 7 and 8)
|
||||||
INSERT INTO acl (aclid, aclname) VALUES (4, 'Hosts:piazza');
|
INSERT INTO acl (aclid, aclname) VALUES (4, 'Hosts:piazza');
|
||||||
INSERT INTO aclowner (aclid, ownerid, flags) VALUES (4, 2, 0);
|
INSERT INTO aclowner (aclid, ownerid, flags) VALUES (4, 2, 0);
|
||||||
INSERT INTO ace (aceid, pri, flags) VALUES (6, 2, 0);
|
INSERT INTO ace (aceid, pri, flags) VALUES (7, 2, 0);
|
||||||
INSERT INTO acldata (aclid, seq, aceid) VALUES (4, 0, 6);
|
INSERT INTO acldata (aclid, seq, aceid) VALUES (4, 0, 7);
|
||||||
INSERT INTO acedata (aceid, perm_nsid, perm_name) VALUES
|
|
||||||
(6, 4, 'add.member' ),
|
|
||||||
(6, 4, 'remove.member');
|
|
||||||
INSERT INTO ace (aceid, pri, flags) VALUES (7, 1, 1);
|
|
||||||
INSERT INTO acldata (aclid, seq, aceid) VALUES (4, 1, 7);
|
|
||||||
INSERT INTO acedata (aceid, perm_nsid, perm_name) VALUES
|
INSERT INTO acedata (aceid, perm_nsid, perm_name) VALUES
|
||||||
(7, 4, 'add.member' ),
|
(7, 4, 'add.member' ),
|
||||||
(7, 4, 'remove.member');
|
(7, 4, 'remove.member');
|
||||||
|
INSERT INTO ace (aceid, pri, flags) VALUES (8, 1, 1);
|
||||||
|
INSERT INTO acldata (aclid, seq, aceid) VALUES (4, 1, 8);
|
||||||
|
INSERT INTO acedata (aceid, perm_nsid, perm_name) VALUES
|
||||||
|
(8, 4, 'add.member' ),
|
||||||
|
(8, 4, 'remove.member');
|
||||||
UPDATE groups SET gaclid = 4 WHERE gid = 5;
|
UPDATE groups SET gaclid = 4 WHERE gid = 5;
|
||||||
|
|
||||||
# Create the ACL for the initial community.
|
# Create the ACL for the initial community.
|
||||||
# (ACL 5, ACEs 8, 9)
|
# (ACL 5, ACEs 9, 10)
|
||||||
INSERT INTO acl (aclid, aclname) VALUES (5, 'ACL:piazza');
|
INSERT INTO acl (aclid, aclname) VALUES (5, 'ACL:piazza');
|
||||||
INSERT INTO aclowner (aclid, ownerid, flags) VALUES (5, 5, 1);
|
INSERT INTO aclowner (aclid, ownerid, flags) VALUES (5, 5, 1);
|
||||||
INSERT INTO ace (aceid, pri, flags) VALUES (8, 2, 0);
|
INSERT INTO ace (aceid, pri, flags) VALUES (9, 2, 0);
|
||||||
INSERT INTO acldata (aclid, seq, aceid) VALUES (5, 0, 8);
|
INSERT INTO acldata (aclid, seq, aceid) VALUES (5, 0, 9);
|
||||||
INSERT INTO acedata (aceid, perm_nsid, perm_name) VALUES
|
|
||||||
(8, 14, 'grant.revoke.access'),
|
|
||||||
(8, 15, 'set.category' ),
|
|
||||||
(8, 15, 'set.visibility' ),
|
|
||||||
(8, 15, 'set.name' ),
|
|
||||||
(8, 15, 'set.alias' ),
|
|
||||||
(8, 15, 'set.property' ),
|
|
||||||
(8, 15, 'remove.property' );
|
|
||||||
INSERT INTO ace (aceid, pri, flags) VALUES (9, 5, 1);
|
|
||||||
INSERT INTO acldata (aclid, seq, aceid) VALUES (5, 1, 9);
|
|
||||||
INSERT INTO acedata (aceid, perm_nsid, perm_name) VALUES
|
INSERT INTO acedata (aceid, perm_nsid, perm_name) VALUES
|
||||||
(9, 14, 'grant.revoke.access'),
|
(9, 14, 'grant.revoke.access'),
|
||||||
(9, 15, 'set.category' ),
|
(9, 15, 'set.category' ),
|
||||||
(9, 15, 'set.visibility' ),
|
(9, 15, 'set.visibility' ),
|
||||||
(9, 15, 'set.name' ),
|
(9, 15, 'set.name' ),
|
||||||
(9, 15, 'set.alias' ),
|
(9, 15, 'set.alias' ),
|
||||||
(9, 15, 'set.property' );
|
(9, 15, 'set.property' ),
|
||||||
|
(9, 15, 'remove.property' );
|
||||||
|
INSERT INTO ace (aceid, pri, flags) VALUES (10, 5, 1);
|
||||||
|
INSERT INTO acldata (aclid, seq, aceid) VALUES (5, 1, 10);
|
||||||
|
INSERT INTO acedata (aceid, perm_nsid, perm_name) VALUES
|
||||||
|
(10, 14, 'grant.revoke.access'),
|
||||||
|
(10, 15, 'set.category' ),
|
||||||
|
(10, 15, 'set.visibility' ),
|
||||||
|
(10, 15, 'set.name' ),
|
||||||
|
(10, 15, 'set.alias' ),
|
||||||
|
(10, 15, 'set.property' );
|
||||||
|
|
||||||
#### following this line is initialization of Venice-specific tables ####
|
#### following this line is initialization of Venice-specific tables ####
|
||||||
|
|
||||||
|
@ -1196,14 +1202,26 @@ UPDATE menuitems SET ifdef_var = 'use_categories' WHERE menuid = 4 AND sequence
|
||||||
|
|
||||||
# Create the sideboxes tables.
|
# Create the sideboxes tables.
|
||||||
INSERT INTO sbox_master (sbid, sb_nsid, sb_name, type_nsid, type_name, descr) VALUES
|
INSERT INTO sbox_master (sbid, sb_nsid, sb_name, type_nsid, type_name, descr) VALUES
|
||||||
(1, 18, 'test1', 18, 'test', 'Test Sidebox #1'),
|
(1, 19, 'community.list', 19, 'community.list', 'Community Membership List'),
|
||||||
(2, 18, 'test2', 18, 'test', 'Test Sidebox #2');
|
(2, 18, 'test1', 18, 'test', 'Test Sidebox #1' ),
|
||||||
|
(3, 18, 'test2', 18, 'test', 'Test Sidebox #2' );
|
||||||
|
|
||||||
INSERT INTO sbox_context (sbid, ctx_nsid, ctx_name) VALUES
|
INSERT INTO sbox_context (sbid, ctx_nsid, ctx_name) VALUES
|
||||||
(1, 17, 'top'),
|
(1, 17, 'top'),
|
||||||
(2, 17, 'top');
|
(2, 17, 'top'),
|
||||||
|
(3, 17, 'top');
|
||||||
|
|
||||||
|
INSERT INTO sbox_props (sbid, nsid, prop_name, prop_value) VALUES
|
||||||
|
(1, 6, 'normal.title', '!Your Communities' ),
|
||||||
|
(1, 6, 'anon.title', '!Featured Communities' ),
|
||||||
|
(1, 6, 'velocity.template', '!sideboxes/community-list.vm'),
|
||||||
|
(1, 7, 'community.provider', '!communities' ),
|
||||||
|
(1, 7, 'security.provider', '!srm' );
|
||||||
|
|
||||||
INSERT INTO sbox_deploy (uid, ctx_nsid, ctx_name, param, seq, sbid) VALUES
|
INSERT INTO sbox_deploy (uid, ctx_nsid, ctx_name, param, seq, sbid) VALUES
|
||||||
(1, 17, 'top', NULL, 0, 1),
|
(1, 17, 'top', NULL, 0, 1),
|
||||||
(1, 17, 'top', NULL, 1, 2),
|
(1, 17, 'top', NULL, 1, 2),
|
||||||
|
(1, 17, 'top', NULL, 2, 3),
|
||||||
(2, 17, 'top', NULL, 0, 1),
|
(2, 17, 'top', NULL, 0, 1),
|
||||||
(2, 17, 'top', NULL, 1, 2);
|
(2, 17, 'top', NULL, 1, 2),
|
||||||
|
(2, 17, 'top', NULL, 2, 3);
|
||||||
|
|
|
@ -1047,4 +1047,22 @@ class CommunityImpl implements VeniceCommunity
|
||||||
|
|
||||||
} // end join
|
} // end join
|
||||||
|
|
||||||
|
public boolean isAdministrator(DynamoUser user)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{ // must be either the host UID or a member of the admin group
|
||||||
|
if (user.getUID()==m_host_uid)
|
||||||
|
return true;
|
||||||
|
return m_users.getGroup(m_host_gid).isMember(user);
|
||||||
|
|
||||||
|
} // end try
|
||||||
|
catch (DatabaseException e)
|
||||||
|
{ // gotta catch it, even if we can't do anything with it
|
||||||
|
logger.warn("CommunityImpl.isAdministrator caught DatabaseException",e);
|
||||||
|
return false;
|
||||||
|
|
||||||
|
} // end catch
|
||||||
|
|
||||||
|
} // end isAdministrator
|
||||||
|
|
||||||
} // end class CommunityImpl
|
} // end class CommunityImpl
|
||||||
|
|
|
@ -603,6 +603,12 @@ abstract class CommunityProxy implements VeniceCommunity, DynamicWrapper
|
||||||
|
|
||||||
} // end join
|
} // end join
|
||||||
|
|
||||||
|
public boolean isAdministrator(DynamoUser user)
|
||||||
|
{
|
||||||
|
return getRealCommunity().isAdministrator(user);
|
||||||
|
|
||||||
|
} // end isAdministrator
|
||||||
|
|
||||||
/*--------------------------------------------------------------------------------
|
/*--------------------------------------------------------------------------------
|
||||||
* Implementations from interface DynamicWrapper
|
* Implementations from interface DynamicWrapper
|
||||||
*--------------------------------------------------------------------------------
|
*--------------------------------------------------------------------------------
|
||||||
|
|
|
@ -311,4 +311,6 @@ public interface VeniceCommunity extends NamedObject, SecureObjectStore
|
||||||
|
|
||||||
public boolean join(DynamoUser joiner) throws DatabaseException, DynamoSecurityException;
|
public boolean join(DynamoUser joiner) throws DatabaseException, DynamoSecurityException;
|
||||||
|
|
||||||
|
public boolean isAdministrator(DynamoUser user);
|
||||||
|
|
||||||
} // end interface VeniceCommunity
|
} // end interface VeniceCommunity
|
||||||
|
|
|
@ -0,0 +1,192 @@
|
||||||
|
/*
|
||||||
|
* 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.sidebox;
|
||||||
|
|
||||||
|
import java.util.*;
|
||||||
|
import com.silverwrist.dynamo.Namespaces;
|
||||||
|
import com.silverwrist.dynamo.except.*;
|
||||||
|
import com.silverwrist.dynamo.iface.*;
|
||||||
|
import com.silverwrist.dynamo.security.SecurityReferenceMonitor;
|
||||||
|
import com.silverwrist.dynamo.util.*;
|
||||||
|
import com.silverwrist.dynamo.velocity.VelocityParamSupplier;
|
||||||
|
import com.silverwrist.dynamo.velocity.VelocityRenderable;
|
||||||
|
import com.silverwrist.venice.VeniceNamespaces;
|
||||||
|
import com.silverwrist.venice.community.CommunityService;
|
||||||
|
import com.silverwrist.venice.except.*;
|
||||||
|
import com.silverwrist.venice.iface.*;
|
||||||
|
import com.silverwrist.venice.session.SessionInfoParams;
|
||||||
|
|
||||||
|
class CommunityListSidebox implements SideboxFactory
|
||||||
|
{
|
||||||
|
/*--------------------------------------------------------------------------------
|
||||||
|
* Internal class that implements the actual sidebox
|
||||||
|
*--------------------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
|
||||||
|
private class MyBox implements Sidebox, VelocityRenderable
|
||||||
|
{
|
||||||
|
/*====================================================================
|
||||||
|
* Attributes
|
||||||
|
*====================================================================
|
||||||
|
*/
|
||||||
|
|
||||||
|
private HashMap m_params = new HashMap();
|
||||||
|
private String m_title_keyname;
|
||||||
|
|
||||||
|
/*====================================================================
|
||||||
|
* Constructor
|
||||||
|
*====================================================================
|
||||||
|
*/
|
||||||
|
|
||||||
|
MyBox(DynamoUser user, List communities, boolean can_create)
|
||||||
|
{
|
||||||
|
m_params.put("user",user);
|
||||||
|
m_params.put("communities",communities);
|
||||||
|
if (can_create)
|
||||||
|
m_params.put("can_create",Boolean.TRUE);
|
||||||
|
if (user.isAnonymous())
|
||||||
|
m_title_keyname = "anon.title";
|
||||||
|
else
|
||||||
|
m_title_keyname = "normal.title";
|
||||||
|
|
||||||
|
} // end constructor
|
||||||
|
|
||||||
|
/*====================================================================
|
||||||
|
* Implementations from interface Sidebox
|
||||||
|
*====================================================================
|
||||||
|
*/
|
||||||
|
|
||||||
|
public String getSideboxTitle()
|
||||||
|
{
|
||||||
|
return m_props.getObject(VeniceNamespaces.CONTENT_LAF_NAMESPACE,m_title_keyname).toString();
|
||||||
|
|
||||||
|
} // end getSideboxTitle
|
||||||
|
|
||||||
|
/*====================================================================
|
||||||
|
* Implementations from interface VelocityParamSupplier
|
||||||
|
*====================================================================
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the value of a parameter set on the object.
|
||||||
|
*
|
||||||
|
* @param key The name of the parameter to look up.
|
||||||
|
* @return The parameter's value, or <CODE>null</CODE> if the parameter was not set.
|
||||||
|
*/
|
||||||
|
public Object getParameter(String key)
|
||||||
|
{
|
||||||
|
return m_params.get(key);
|
||||||
|
|
||||||
|
} // end getParameter
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns a <CODE>java.util.Collection</CODE> of all parameter names currently defined on this object.
|
||||||
|
*
|
||||||
|
* @return A collection of all parameter names currently defined.
|
||||||
|
*/
|
||||||
|
public Collection getParameterNames()
|
||||||
|
{
|
||||||
|
return Collections.unmodifiableSet(m_params.keySet());
|
||||||
|
|
||||||
|
} // end getParameterNames
|
||||||
|
|
||||||
|
/*====================================================================
|
||||||
|
* Implementations from interface VelocityRenderable
|
||||||
|
*====================================================================
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the MIME type of the output to be rendered. Usually, this will be "text/html".
|
||||||
|
*
|
||||||
|
* @return The MIME type of the output.
|
||||||
|
*/
|
||||||
|
public String getMimeType()
|
||||||
|
{
|
||||||
|
return "text/html";
|
||||||
|
|
||||||
|
} // end getMimeType
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the resource name of the Velocity template to be used in rendering this object. This pathname
|
||||||
|
* is interpreted relative to the "resource root path" specified in the Velocity renderer's configuration.
|
||||||
|
* The template engine loads it via the standard
|
||||||
|
* {@link com.silverwrist.dynamo.iface.ResourceProvider ResourceProvider}, and then applies the parameters
|
||||||
|
* contained in this object to it.
|
||||||
|
*
|
||||||
|
* @return The resource pathname of the Velocity template to use.
|
||||||
|
*/
|
||||||
|
public String getTemplateName()
|
||||||
|
{
|
||||||
|
return m_props.getObject(VeniceNamespaces.CONTENT_LAF_NAMESPACE,"velocity.template").toString();
|
||||||
|
|
||||||
|
} // end getTemplateName
|
||||||
|
|
||||||
|
} // end class MyBox
|
||||||
|
|
||||||
|
/*--------------------------------------------------------------------------------
|
||||||
|
* Attributes
|
||||||
|
*--------------------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
|
||||||
|
private ObjectProvider m_props; // properties provider
|
||||||
|
|
||||||
|
/*--------------------------------------------------------------------------------
|
||||||
|
* Constructor
|
||||||
|
*--------------------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
|
||||||
|
CommunityListSidebox(ObjectProvider properties)
|
||||||
|
{
|
||||||
|
m_props = properties;
|
||||||
|
|
||||||
|
} // end constructor
|
||||||
|
|
||||||
|
/*--------------------------------------------------------------------------------
|
||||||
|
* Implementations from interface SideboxFactory
|
||||||
|
*--------------------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
|
||||||
|
public Sidebox createSidebox(Request req) throws DynamoException
|
||||||
|
{
|
||||||
|
// Get the user associated with this request.
|
||||||
|
SessionInfoProvider prov = (SessionInfoProvider)(req.queryService(SessionInfoProvider.class));
|
||||||
|
SessionInfo session = prov.getSessionInfo();
|
||||||
|
DynamoUser user = (DynamoUser)(session.getObject(SessionInfoParams.NAMESPACE,SessionInfoParams.ATTR_USER));
|
||||||
|
|
||||||
|
// Get the list of the user's communities.
|
||||||
|
String tmp_name = m_props.getObject(VeniceNamespaces.SESSION_CONTROL_NAMESPACE,"community.provider").toString();
|
||||||
|
ObjectProvider op = (ObjectProvider)(req.queryService(ObjectProvider.class));
|
||||||
|
CommunityService commsvc = (CommunityService)(op.getObject(Namespaces.DYNAMO_OBJECT_NAMESPACE,tmp_name));
|
||||||
|
List communities = commsvc.getMemberCommunities(user,user);
|
||||||
|
|
||||||
|
// Determine whether the user can actually create a community.
|
||||||
|
tmp_name = m_props.getObject(VeniceNamespaces.SESSION_CONTROL_NAMESPACE,"security.provider").toString();
|
||||||
|
SecurityReferenceMonitor srm = (SecurityReferenceMonitor)(op.getObject(Namespaces.DYNAMO_OBJECT_NAMESPACE,
|
||||||
|
tmp_name));
|
||||||
|
boolean can_create = false;
|
||||||
|
if (user.equals(srm.getAdminUser()))
|
||||||
|
can_create = true;
|
||||||
|
else
|
||||||
|
can_create = srm.getGlobalAcl().testPermission(user,VeniceNamespaces.COMMUNITY_PERMS_NAMESPACE,"create.new");
|
||||||
|
|
||||||
|
// We now have all the info we need to create the sidebox.
|
||||||
|
return new MyBox(user,communities,can_create);
|
||||||
|
|
||||||
|
} // end createSidebox
|
||||||
|
|
||||||
|
} // end class CommunityListSidebox
|
|
@ -155,6 +155,7 @@ public class SideboxManager implements NamedObject, ComponentInitialize, Compone
|
||||||
m_pk_to_fact = new ReferenceMap(ReferenceMap.HARD,ReferenceMap.SOFT);
|
m_pk_to_fact = new ReferenceMap(ReferenceMap.HARD,ReferenceMap.SOFT);
|
||||||
m_id_to_type = new ReferenceMap(ReferenceMap.HARD,ReferenceMap.SOFT);
|
m_id_to_type = new ReferenceMap(ReferenceMap.HARD,ReferenceMap.SOFT);
|
||||||
m_id_to_name = new ReferenceMap(ReferenceMap.HARD,ReferenceMap.SOFT);
|
m_id_to_name = new ReferenceMap(ReferenceMap.HARD,ReferenceMap.SOFT);
|
||||||
|
m_ns_to_tf.put(StandardSideboxes.NAMESPACE,new StandardSideboxes());
|
||||||
m_ns_to_tf.put(TestSideboxes.NAMESPACE,new TestSideboxes());
|
m_ns_to_tf.put(TestSideboxes.NAMESPACE,new TestSideboxes());
|
||||||
|
|
||||||
} // end constructor
|
} // end constructor
|
||||||
|
|
|
@ -22,3 +22,5 @@ no.sbtype=Unable to find sidebox type factory for type namespace {0}, name {1}.
|
||||||
sbox.not.in.list=The sidebox with ID #{0} does not exist in the current list.
|
sbox.not.in.list=The sidebox with ID #{0} does not exist in the current list.
|
||||||
sbox.already.in.list=The sidebox with ID #{0} already exists in the current list.
|
sbox.already.in.list=The sidebox with ID #{0} already exists in the current list.
|
||||||
sbox.impermissible=The sidebox with ID #{0} is not permitted in the current list.
|
sbox.impermissible=The sidebox with ID #{0} is not permitted in the current list.
|
||||||
|
std.badNamespace=The standard sidebox factory was called with an invalid type namespace "{0}."
|
||||||
|
std.badName=The standard sidebox factory was called with an invalid type name "{0}."
|
||||||
|
|
|
@ -0,0 +1,70 @@
|
||||||
|
/*
|
||||||
|
* 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.sidebox;
|
||||||
|
|
||||||
|
import com.silverwrist.dynamo.except.*;
|
||||||
|
import com.silverwrist.dynamo.iface.*;
|
||||||
|
import com.silverwrist.venice.except.*;
|
||||||
|
import com.silverwrist.venice.iface.*;
|
||||||
|
|
||||||
|
class StandardSideboxes implements SideboxTypeFactory
|
||||||
|
{
|
||||||
|
/*--------------------------------------------------------------------------------
|
||||||
|
* Static data members
|
||||||
|
*--------------------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
|
||||||
|
static final String NAMESPACE = "http://www.silverwrist.com/NS/venice/2003/06/03/standard.sideboxes";
|
||||||
|
|
||||||
|
/*--------------------------------------------------------------------------------
|
||||||
|
* Constructor
|
||||||
|
*--------------------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
|
||||||
|
StandardSideboxes()
|
||||||
|
{ // do nothing
|
||||||
|
} // end constructor
|
||||||
|
|
||||||
|
/*--------------------------------------------------------------------------------
|
||||||
|
* Implementations from interface SideboxTypeFactory
|
||||||
|
*--------------------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
|
||||||
|
public SideboxFactory createFactory(String type_namespace, String type_name, String box_namespace, String box_name,
|
||||||
|
ObjectProvider properties) throws DynamoException
|
||||||
|
{
|
||||||
|
if (!(NAMESPACE.equals(type_namespace)))
|
||||||
|
{ // wrong sidebox type namespace!
|
||||||
|
SideboxException ee = new SideboxException(StandardSideboxes.class,"SideboxMessages","std.badNamespace");
|
||||||
|
ee.setParameter(0,type_namespace);
|
||||||
|
throw ee;
|
||||||
|
|
||||||
|
} // end if
|
||||||
|
|
||||||
|
// Determine which kind of sidebox factory to create.
|
||||||
|
if (type_name.equals("community.list"))
|
||||||
|
return new CommunityListSidebox(properties);
|
||||||
|
|
||||||
|
// Cannot find sidebox factory for type: throw an exception.
|
||||||
|
SideboxException e = new SideboxException(StandardSideboxes.class,"SideboxMessages","std.badName");
|
||||||
|
e.setParameter(0,type_name);
|
||||||
|
throw e;
|
||||||
|
|
||||||
|
} // end createFactory
|
||||||
|
|
||||||
|
} // end class StandardSideboxes
|
51
venice-data/velocity/sideboxes/community-list.vm
Normal file
51
venice-data/velocity/sideboxes/community-list.vm
Normal file
|
@ -0,0 +1,51 @@
|
||||||
|
#*
|
||||||
|
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:
|
||||||
|
user = The current user.
|
||||||
|
communities = List of member communities.
|
||||||
|
can_create = True (set) if the user can create a community.
|
||||||
|
*#
|
||||||
|
#if( $communities.size() > 0 )
|
||||||
|
<div align="left"><table border="0" cellpadding="0" cellspacing="2">
|
||||||
|
#foreach( $c in $communities )
|
||||||
|
<tr valign="middle">
|
||||||
|
<td align="center" width="14">#bullet()</td>
|
||||||
|
<td align="left">
|
||||||
|
<b><a href="#formatURL( "SERVLET" "TODO" )">#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" />
|
||||||
|
#end
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
#end
|
||||||
|
</table></div>
|
||||||
|
#else
|
||||||
|
<p><em>You are not a member of any communities.</em></p>
|
||||||
|
#end
|
||||||
|
|
||||||
|
#if( !${user.isAnonymous()} )
|
||||||
|
<br />
|
||||||
|
<div class="sideboxfooter"><b>[
|
||||||
|
<a href="#formatURL( "SERVLET" "TODO" )">Manage</a>
|
||||||
|
#if( $can_create )
|
||||||
|
| <a href="#formatURL( "SERVLET" "TODO" )">Create New</a>
|
||||||
|
#end
|
||||||
|
]</b></div>
|
||||||
|
#end
|
|
@ -80,6 +80,13 @@ body td.sideboxtop, body div.sideboxtop, body p.sideboxtop {
|
||||||
font-size: medium;
|
font-size: medium;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
body td.sideboxfooter, body div.sideboxfooter, body p.sideboxfooter {
|
||||||
|
font-size: xx-small;
|
||||||
|
voice-family: "\"}\"";
|
||||||
|
voice-family: inherit;
|
||||||
|
font-size: x-small;
|
||||||
|
}
|
||||||
|
|
||||||
html>body, html>body div, html>body p, html>body th, html>body td, html>body li, html>body dd {
|
html>body, html>body div, html>body p, html>body th, html>body td, html>body li, html>body dd {
|
||||||
font-size: small; /* be nice to Opera */
|
font-size: small; /* be nice to Opera */
|
||||||
}
|
}
|
||||||
|
@ -116,6 +123,10 @@ html>body td.sideboxtop, html>body div.sideboxtop, html>body p.sideboxtop {
|
||||||
font-size: medium;
|
font-size: medium;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
html>body td.sideboxfooter, html>body div.sideboxfooter, html>body p.sideboxfooter {
|
||||||
|
font-size: x-small;
|
||||||
|
}
|
||||||
|
|
||||||
## these are styles for inline menu lists
|
## these are styles for inline menu lists
|
||||||
div.imenu {
|
div.imenu {
|
||||||
padding: 5px;
|
padding: 5px;
|
||||||
|
|
|
@ -129,6 +129,12 @@ td.sidebox {
|
||||||
padding: 2px;
|
padding: 2px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.sideboxfooter {
|
||||||
|
color: #000000;
|
||||||
|
background-color: #9999ff;
|
||||||
|
font-size: 9px;
|
||||||
|
}
|
||||||
|
|
||||||
.formerror {
|
.formerror {
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
font-color: red;
|
font-color: red;
|
||||||
|
|
BIN
venice-web/images/tag_host.gif
Normal file
BIN
venice-web/images/tag_host.gif
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.0 KiB |
Loading…
Reference in New Issue
Block a user