01-26-2011 10:34 AM
function main()
{
// Get clients json request as a "normal" js object literal
var clientRequest = json.toString();
var clientJSON = eval('(' + clientRequest + ')');
// Call the repo to create the site
var scriptRemoteConnector = remote.connect("alfresco");
var repoResponse;
if (clientJSON.ticket)
{
repoResponse=scriptRemoteConnector.post("/api/sites?alf_ticket="+clientJSON.ticket, clientRequest, "application/json");
}
else
{
repoResponse=scriptRemoteConnector.post("/api/sites", clientRequest, "application/json");
}
if (repoResponse.status == 401)
{
status.setCode(repoResponse.status, "error.loggedOut");
return;
}
else
{
var repoJSON = eval('(' + repoResponse + ')');
// Check if we got a positive result
if (repoJSON.shortName)
{
// Yes we did, now create the site in the webtier
var tokens = new Array();
tokens["siteid"] = repoJSON.shortName;
sitedata.newPreset(clientJSON.sitePreset, tokens);
model.success = true;
}
else if (repoJSON.status.code)
{
status.setCode(repoJSON.status.code, repoJSON.message);
return;
}
}
}
main();
var tokens = new Array();
tokens["siteid"] = repoJSON.shortName;
sitedata.newPreset(clientJSON.sitePreset, tokens);
02-08-2011 12:13 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.