added the functionality required to power the Sidebox Configure button on
the Front Page
This commit is contained in:
@@ -10,7 +10,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):
|
||||
|
||||
@@ -115,6 +115,11 @@ if (op=="create")
|
||||
udpns = vcast.queryUserDefaultPropertyNamespace(req);
|
||||
umgmt.loadUserDefaults(new_user,udpns.getDefaultPropertyNamespaces());
|
||||
|
||||
// Copy the default sidebox configuration for this user.
|
||||
sideboxes = vcast.querySideboxService(req_help.getRequestObject(Namespaces.DYNAMO_OBJECT_NAMESPACE,
|
||||
"venice-sidebox"));
|
||||
sideboxes.copyUserConfig(umgmt.getAnonymousUser(),new_user);
|
||||
|
||||
// Set the "profile last updated" date for the user.
|
||||
temp_profile.setObject(VeniceNamespaces.USER_PROFILE_NAMESPACE,"last.update",new_user.getCreationDate());
|
||||
|
||||
|
||||
71
venice-data/scripts/sidebox_config.js
Normal file
71
venice-data/scripts/sidebox_config.js
Normal file
@@ -0,0 +1,71 @@
|
||||
// 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.util);
|
||||
importClass(Packages.com.silverwrist.dynamo.Namespaces);
|
||||
importPackage(Packages.com.silverwrist.dynamo.iface);
|
||||
importPackage(Packages.com.silverwrist.dynamo.util);
|
||||
importClass(Packages.com.silverwrist.venice.VeniceNamespaces);
|
||||
importPackage(Packages.com.silverwrist.venice.content);
|
||||
importPackage(Packages.com.silverwrist.venice.iface);
|
||||
importPackage(Packages.com.silverwrist.venice.sidebox);
|
||||
|
||||
req = bsf.lookupBean("request"); // get request
|
||||
rhelp = bsf.lookupBean("request_help"); // get request helper
|
||||
user = vlib.getUser(req); // get user
|
||||
|
||||
// Get the list of the user's sideboxes.
|
||||
sideboxes = vcast.querySideboxService(req_help.getRequestObject(Namespaces.DYNAMO_OBJECT_NAMESPACE,"venice-sidebox"));
|
||||
list = sideboxes.getSideboxDescriptors(user,VeniceNamespaces.SIDEBOX_CONTEXT_NAMESPACE,"top",null);
|
||||
|
||||
// Create a set that contains all the IDs of the sideboxes.
|
||||
matchset = new HashSet();
|
||||
it = list.iterator();
|
||||
while (it.hasNext())
|
||||
{ // add the IDs to the set
|
||||
d = vcast.toSideboxDescriptor(it.next());
|
||||
matchset.add(cast.toIntegerObject(d.getID()));
|
||||
|
||||
} // end while
|
||||
|
||||
// Get the list of all possible sideboxes.
|
||||
all_list = sideboxes.getAllSideboxDescriptors(VeniceNamespaces.SIDEBOX_CONTEXT_NAMESPACE,"top");
|
||||
|
||||
// Use that list and the match set to generate the "not list".
|
||||
not_list = null;
|
||||
if (list.size()==all_list.size())
|
||||
not_list = Collections.EMPTY_LIST;
|
||||
else if (list.size()==0)
|
||||
not_list = all_list;
|
||||
else
|
||||
{ // need to generate the "not list"
|
||||
not_list = new ArrayList(all_list.size());
|
||||
it = all_list.iterator();
|
||||
while (it.hasNext())
|
||||
{ // check the list...
|
||||
d = vcast.toSideboxDescriptor(it.next());
|
||||
if (!(matchset.contains(cast.toIntegerObject(d.getID()))))
|
||||
not_list.add(d);
|
||||
|
||||
} // end while
|
||||
|
||||
} // end else
|
||||
|
||||
// Generate the output object.
|
||||
rc = new VelocityView("Your Sidebox Configuration: Front Page","sidebox_config.vm");
|
||||
rc.setParameter("list",list);
|
||||
rc.setParameter("notlist",not_list);
|
||||
dynamo.scriptOutput(rc);
|
||||
36
venice-data/scripts/sidebox_config_add.js
Normal file
36
venice-data/scripts/sidebox_config_add.js
Normal file
@@ -0,0 +1,36 @@
|
||||
// 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):
|
||||
|
||||
importClass(Packages.com.silverwrist.dynamo.Namespaces);
|
||||
importPackage(Packages.com.silverwrist.dynamo.iface);
|
||||
importPackage(Packages.com.silverwrist.dynamo.util);
|
||||
importClass(Packages.com.silverwrist.venice.VeniceNamespaces);
|
||||
importPackage(Packages.com.silverwrist.venice.iface);
|
||||
importPackage(Packages.com.silverwrist.venice.sidebox);
|
||||
|
||||
req = bsf.lookupBean("request"); // get request
|
||||
rhelp = bsf.lookupBean("request_help"); // get request helper
|
||||
user = vlib.getUser(req); // get user
|
||||
|
||||
// Get the parameters.
|
||||
sbid = rhelp.getParameterInt("sbid",-1);
|
||||
|
||||
// Execute the operation.
|
||||
sideboxes = vcast.querySideboxService(req_help.getRequestObject(Namespaces.DYNAMO_OBJECT_NAMESPACE,"venice-sidebox"));
|
||||
sideboxes.addSidebox(user,VeniceNamespaces.SIDEBOX_CONTEXT_NAMESPACE,"top",null,sbid);
|
||||
|
||||
// Redisplay the standard context display.
|
||||
dynamo.scriptOutput(dynamo.exec("/scripts/sidebox_config.js"));
|
||||
36
venice-data/scripts/sidebox_config_del.js
Normal file
36
venice-data/scripts/sidebox_config_del.js
Normal file
@@ -0,0 +1,36 @@
|
||||
// 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):
|
||||
|
||||
importClass(Packages.com.silverwrist.dynamo.Namespaces);
|
||||
importPackage(Packages.com.silverwrist.dynamo.iface);
|
||||
importPackage(Packages.com.silverwrist.dynamo.util);
|
||||
importClass(Packages.com.silverwrist.venice.VeniceNamespaces);
|
||||
importPackage(Packages.com.silverwrist.venice.iface);
|
||||
importPackage(Packages.com.silverwrist.venice.sidebox);
|
||||
|
||||
req = bsf.lookupBean("request"); // get request
|
||||
rhelp = bsf.lookupBean("request_help"); // get request helper
|
||||
user = vlib.getUser(req); // get user
|
||||
|
||||
// Get the parameters.
|
||||
sbid = rhelp.getParameterInt("sbid",-1);
|
||||
|
||||
// Execute the operation.
|
||||
sideboxes = vcast.querySideboxService(req_help.getRequestObject(Namespaces.DYNAMO_OBJECT_NAMESPACE,"venice-sidebox"));
|
||||
sideboxes.removeSidebox(user,VeniceNamespaces.SIDEBOX_CONTEXT_NAMESPACE,"top",null,sbid);
|
||||
|
||||
// Redisplay the standard context display.
|
||||
dynamo.scriptOutput(dynamo.exec("/scripts/sidebox_config.js"));
|
||||
37
venice-data/scripts/sidebox_config_move.js
Normal file
37
venice-data/scripts/sidebox_config_move.js
Normal file
@@ -0,0 +1,37 @@
|
||||
// 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):
|
||||
|
||||
importClass(Packages.com.silverwrist.dynamo.Namespaces);
|
||||
importPackage(Packages.com.silverwrist.dynamo.iface);
|
||||
importPackage(Packages.com.silverwrist.dynamo.util);
|
||||
importClass(Packages.com.silverwrist.venice.VeniceNamespaces);
|
||||
importPackage(Packages.com.silverwrist.venice.iface);
|
||||
importPackage(Packages.com.silverwrist.venice.sidebox);
|
||||
|
||||
req = bsf.lookupBean("request"); // get request
|
||||
rhelp = bsf.lookupBean("request_help"); // get request helper
|
||||
user = vlib.getUser(req); // get user
|
||||
|
||||
// Get the parameters.
|
||||
sbid = rhelp.getParameterInt("sbid",-1);
|
||||
new_pos = rhelp.getParameterInt("to",-1);
|
||||
|
||||
// Execute the operation.
|
||||
sideboxes = vcast.querySideboxService(req_help.getRequestObject(Namespaces.DYNAMO_OBJECT_NAMESPACE,"venice-sidebox"));
|
||||
sideboxes.moveSideboxItemToPosition(user,VeniceNamespaces.SIDEBOX_CONTEXT_NAMESPACE,"top",null,sbid,new_pos);
|
||||
|
||||
// Redisplay the standard context display.
|
||||
dynamo.scriptOutput(dynamo.exec("/scripts/sidebox_config.js"));
|
||||
@@ -64,8 +64,8 @@ rc.pageTitle = globals.getObject(VeniceNamespaces.FRAME_LAF_NAMESPACE,"frontpage
|
||||
rc.pageQID = "top";
|
||||
if (!(user.isAnonymous()))
|
||||
{ // they only get to configure if they're logged in
|
||||
rc.configureURL = "TODO";
|
||||
rc.configureURLType = "ABSOLUTE";
|
||||
rc.configureURL = "sidebox_config.js.vs";
|
||||
rc.configureURLType = "SERVLET";
|
||||
|
||||
} // end if
|
||||
|
||||
|
||||
109
venice-data/velocity/sidebox_config.vm
Normal file
109
venice-data/velocity/sidebox_config.vm
Normal file
@@ -0,0 +1,109 @@
|
||||
#*
|
||||
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:
|
||||
list = List of sidebox descriptors on our front page
|
||||
notlist = List of sidebox descriptors not on our Front Page
|
||||
*#
|
||||
#header2( "Your Sidebox Configuration:" "Front Page" )
|
||||
<div align="left">
|
||||
<a href="#formatURL( "SERVLET" "top.js.vs" )">Return to Front Page</a>
|
||||
</div>
|
||||
|
||||
#if( $list.size() > 0 )
|
||||
#comment( "List of sideboxes" )
|
||||
<p align="center"><table border="0" cellpadding="0" cellspacing="3">
|
||||
#set( $max_i = $list.size() - 1 )
|
||||
#set( $i = 0 )
|
||||
#foreach( $d in $list )
|
||||
<tr valign="middle">
|
||||
<td align="center" width="16">
|
||||
#if( $i < $max_i )
|
||||
#set( $ix = $i + 1 )
|
||||
<a href="#formatURL( "SERVLET" "sidebox_config_move.js.vs?sbid=${d.getID()}&to=$ix" )"><img
|
||||
src="#formatURL( "IMAGE" "icn_down.gif" )" alt="[Down]" title="[Down]" width="16" height="16"
|
||||
border="0" /></a>
|
||||
#else
|
||||
|
||||
#end
|
||||
</td>
|
||||
<td align="center" width="16">
|
||||
#if( $i > 0 )
|
||||
#set( $ix = $i - 1 )
|
||||
<a href="#formatURL( "SERVLET" "sidebox_config_move.js.vs?sbid=${d.getID()}&to=$ix" )"><img
|
||||
src="#formatURL( "IMAGE" "icn_up.gif" )" alt="[Up]" title="[Up]" width="16" height="16"
|
||||
border="0" /></a>
|
||||
#else
|
||||
|
||||
#end
|
||||
</td>
|
||||
<td align="center" width="16">
|
||||
<a href="#formatURL( "SERVLET" "sidebox_config_del.js.vs?sbid=${d.getID()}" )"><img
|
||||
src="#formatURL( "IMAGE" "icn_x.gif" )" alt="[Remove]" title="[Remove]" width="16" height="16"
|
||||
border="0" /></a>
|
||||
</td>
|
||||
<td align="left" class="content"><b>#encodeHTML( ${d.getDescription()} )</b></td>
|
||||
</tr>
|
||||
#set( $i = $i + 1 )
|
||||
#end
|
||||
</table></p>
|
||||
|
||||
#comment( "Explanation of the sidebox icons" )
|
||||
<p><table border="0" cellpadding="2" cellspacing="0">
|
||||
<tr valign="middle">
|
||||
<td align="center" width="16">
|
||||
<img src="#formatURL( "IMAGE" "icn_down.gif" )" alt="[Down]" title="[Down]" width="16" height="16"
|
||||
border="0" />
|
||||
</td>
|
||||
<td align="left" class="content">
|
||||
Click this symbol to move the specified sidebox down on your Front Page.
|
||||
<td>
|
||||
</tr>
|
||||
<tr valign="middle">
|
||||
<td align="center" width="16">
|
||||
<img src="#formatURL( "IMAGE" "icn_up.gif" )" alt="[Up]" title="[Up]" width="16" height="16" border="0" />
|
||||
</td>
|
||||
<td align="left" class="content">
|
||||
Click this symbol to move the specified sidebox up on your Front Page.
|
||||
<td>
|
||||
</tr>
|
||||
<tr valign="middle">
|
||||
<td align="center" width="16">
|
||||
<img src="#formatURL( "IMAGE" "icn_x.gif" )" alt="[Remove]" title="[Remove]" width="16" height="16"
|
||||
border="0" />
|
||||
</td>
|
||||
<td align="left" class="content">
|
||||
Click this symbol to remove the specified sidebox from your Front Page.
|
||||
<td>
|
||||
</tr>
|
||||
</table></p>
|
||||
#else
|
||||
<p align="center"><em>No sideboxes currently defined.</em></p>
|
||||
#end
|
||||
|
||||
#if( $notlist.size() > 0 )
|
||||
<div align="left"><form method="POST" action="#formatURL( "SERVLET" "sidebox_config_add.js.vs" )">
|
||||
<b>Add new sidebox:</b>
|
||||
<select name="sbid" size="1">
|
||||
#foreach( $d in $notlist )
|
||||
<option value="${d.getID()}">#encodeHTML( $d.getDescription() )</option>
|
||||
#end
|
||||
</select>
|
||||
#button( "INPUT" "add" )
|
||||
</form></div>
|
||||
#end
|
||||
Reference in New Issue
Block a user