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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user