[Building Sakai] Need help setting a tool title in 2.6

Steve Swinsburg steve.swinsburg at gmail.com
Sun Jan 9 18:46:37 PST 2011


Hi Seth,

Is there a chance this is related somehow to tool/page localisation work? The same thing happens when trying to set the title of the Home page using a web service call so it sounds like it is further down the stack.

cheers,
s


On 31/12/2010, at 3:10 AM, Seth Theriault wrote:

> Hello,
> 
> I am doing some local work on an automated site feed in 2.6. One 
> of the requirements is to set the title of the "Site Information 
> Display" tool (sakai.iframe.site) that sits on the site's Home 
> page.
> 
> I tried this code (courseID is the siteId), but I can't for the 
> life of me get it to work:
> 
> String iframeToolId = "sakai.iframe.site";
> 
> ToolConfiguration toolConfig = SiteService.getSite(courseID).getToolForCommonId(iframeToolId);
> if (toolConfig == null) {
>    LOG.error("Failed to find tool for siteId: " + courseID + " and toolId: " + iframeToolId );
>  } else {
>    LOG.debug("Setting title..... " );
>    toolConfig.setTitle("Seth Testing");
>    toolConfig.save();
>    SiteService.save(site);
>  }
> 
> At the time I set the title, I will have just created a site, so 
> I know its siteId and that the sakai.iframe.site toolId is unique 
> to the site.
> 
> Since setting it from the GUI works just fine, I took a look at 
> that code in:
> 
> web/web-tool/tool/src/java/org/sakaiproject/web/tool/IFrameAction.java 
> 
> This code uses a Placement object to make the change:
> 
>  Placement placement = ToolManager.getCurrentPlacement();
> [...]
>  // title
>  String title = data.getParameters().getString(TITLE);
>  // state.setAttribute(TITLE, title);
>  if (StringUtil.trimToNull(title) == null)
>  {
>    addAlert(state, rb.getString("gen.tootit"));
>    return;
>  }
>  placement.setTitle(title);
> 
> [...]
> 
>  // save
>  // TODO: we might have just saved the entire site, so this would not be needed -ggolden
>  placement.save();
> 
> I know I am missing something, so help anyone?
> 
> Seth
> 
> _______________________________________________
> sakai-dev mailing list
> sakai-dev at collab.sakaiproject.org
> http://collab.sakaiproject.org/mailman/listinfo/sakai-dev
> 
> TO UNSUBSCRIBE: send email to sakai-dev-unsubscribe at collab.sakaiproject.org with a subject of "unsubscribe"



More information about the sakai-dev mailing list