[Building Sakai] Create a site by Sakai API
Phuc Bui
phucbui2006 at yahoo.com.vn
Sun Jul 12 10:11:00 PDT 2009
That's great !!!
But why there's no effect ?
I'll try again. J
Would you please tell me how to add some default tools (Home, SiteInfo,
Announcement, Schedule.) ? Because when I've created a site, it displayed
"SiteUnavailable" on the left panel where is the location of tools, until I
added some tools (edit that site in Admin Workspace).
Thanks,
Phuc Bui
From: Steve Swinsburg [mailto:s.swinsburg at lancaster.ac.uk]
Sent: Sunday, July 12, 2009 5:09 PM
To: Phuc Bui
Cc: 'Sakai Mailing List'
Subject: Re: [Building Sakai] Create a site by Sakai API
Hi Phuc,
This all looks good. You want:
addedSite.setPublished(true);
to publish the site.
You could take a look at how the webservices do it, they are a pretty good
example of some clean concise code. Reproduced below:
Site siteEdit = null;
siteEdit = SiteService.addSite(siteid, type);
siteEdit.setTitle(title);
siteEdit.setDescription(description);
siteEdit.setShortDescription(shortdesc);
siteEdit.setIconUrl(iconurl);
siteEdit.setInfoUrl(infourl);
siteEdit.setJoinable(joinable);
siteEdit.setJoinerRole(joinerrole);
siteEdit.setPublished(published);
siteEdit.setPubView(publicview);
siteEdit.setSkin(skin);
siteEdit.setType(type);
SiteService.save(siteEdit);
cheers,
Steve
On 11 Jul 2009, at 22:05, Phuc Bui wrote:
Dear all,
I use class org.sakaiproject.site.api.SiteService to create a site.
But I do not know how to publish this site, and add some default tool for it
(ex: Home, SiteInfo, Announcement .) (of course, all works should be done by
Sakai API). I tried this class - org.sakaiproject.tool.api.ToolManager, and
see the methodregister(Tool tool), but I don't know how to use it ?
I have a part of code:
Site addedSite = siteService.addSite(siteId, siteType);
addedSite.setDescription("create by NLU Tool as a demo");
addedSite.setJoinable(true);
addedSite.setJoinerRole("student");
addedSite.setTitle("Demo site created by NLU Tool");
siteService.allowAccessSite(addedSite.getId());
siteService.save(addedSite);
I did it, but the site that was created by this method did not have the
title and description like this ?
Looking forward to your replies,
Thanks,
Phuc Bui
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://collab.sakaiproject.org/pipermail/sakai-dev/attachments/20090713/61a7d42c/attachment.html
More information about the sakai-dev
mailing list