04-01-2009 02:19 PM
var site = siteService.createSite(sitePreset, shortName, title, description, isPublic);
var sitePreset = "site-dashboard";
var tokens = new Array();
tokens["siteid"] = 'shortName';
sitedata.newPreset(sitePreset, tokens);
model.response = "ahhh";
No sites to display
Failed to retrieve site membership information for the current user. Join and Leave buttons will not be available
Wrapped Exception (with status template): Error during processing of the template 'Expression jsonUtils.encodeJSONString(x) is undefined on line 2, column 23 in org/alfresco/repository/site/site.lib.ftl.'. Please contact your system administrator.
//grab site, role and group args
var shortName = args.site;
var role = args.role;
var groupName = "GROUP_" + args.group;
var title = args.title;
var description = null;
var isPublic = false;
//see if site name passed through
if (shortName == null || shortName.length == 0)
{
status.code = 404;
status.message = "Shortname not specified";
status.redirect = true;
}
var site = siteService.getSite(shortName);
// See if the shortName is available
if (site != null)
{
status.code = 404;
status.message = "Shortname already in use";
status.redirect = true;
}
//preset ***dont think this is in use**** this is how Alfresco does it. looks like it is a "to-do"
//var sitePreset = args.preset;
var sitePreset = "site-dashboard";
if (shortName == null || shortName.length == 0)
{
status.code = 404;
status.message = "preset not real";
status.redirect = true;
}
//check if role is set
//**************validate to see if it is a reall one in the future***********
if (role == null || role == undefined)
{
status.code = 404;
status.message = "roll not defined";
status.redirect = true;
}
//see if group is real. if so, grab it, if not error 404
if (people.getGroup(groupName) != undefined)
{
var group = people.getGroup(groupName).properties["{http://www.alfresco.org/model/user/1.0}members"];
}
if (group == undefined)
{
status.code = 404;
status.message = "Group not found";
status.redirect = true;
}
else
{
var membersAdded ="";
//create site.
var site = siteService.createSite(sitePreset, shortName, title, description, isPublic);
// var tokens = new Array();
// tokens["siteid"] = shortName;
// sitedata.newPreset(sitePreset, tokens);
for (var i=0; i<group.length; i++)
{
//we have a valid username, just want to make sure they are a person
var person = people.getPerson(group[i]);
if (person == null)
{
status.setCode(status.STATUS_BAD_REQUEST, "The person with user name " + group[i] + " could not be found.");
//return;
}
//add them to the group
site.setMembership(group[i],role);
membersAdded += group[i] +"<br />";
}
model.group = group;
model.membersAdded = membersAdded;
model.siteName = shortName;
model.role = role;
}
function main()
{
var scriptRemoteConnector = remote.connect("alfresco");
var repoResponse = scriptRemoteConnector.get("/sample/createproject?group=someGroup&site=desiredSiteShortName&role=SiteContributor&preset=site-dashboard&title=titleOfSite");
model.response = repoResponse;
if (repoResponse.status == 401)
{
status.setCode(repoResponse.status, "error.loggedOut");
return;
}
else
{
var sitePreset = "site-dashboard";
var tokens = new Array();
tokens["siteid"] = 'desiredSiteShortName';
sitedata.newPreset(sitePreset, tokens);
model.response = "ahhh";
}
}
main();
04-02-2009 11:37 AM
06-26-2009 11:14 AM
01-07-2011 07:25 AM
I think i got this one figured out. I didnt pass it through site.lib.ftlWhat did you do to pass it through site.lib.ftl?
06-06-2012 06:59 AM
Tags
Find what you came for
We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.