[Building Sakai] Set Site Page Position

Paul Mungai paulwando at gmail.com
Fri Nov 8 00:52:55 PST 2013


Thanks for the response so far.

My implementation is as suggested by Steve but also enables setTitleCustom.

For some reason it completely disregards the custom position.


On Thu, Nov 7, 2013 at 10:30 PM, Steve Swinsburg
<steve.swinsburg at gmail.com>wrote:

> I think you are thinking of custom titles where you need to not only set
> the title, but also the flag (seems redundant, the setting of the custom
> title should also set the flag if its necessary).
>
> Anyway, the setPosition should work on its own. Here is a snippet directly
> from the web service call to add a page to a site:
>
> Site siteEdit = null;
>
> SitePage sitePageEdit = null;
>
> siteEdit = siteService.getSite(siteid);
>
> sitePageEdit = siteEdit.addPage();
>
> sitePageEdit.setTitle(pagetitle);
>
> sitePageEdit.setLayout(pagelayout);
>
>
> //KNL-250, SAK-16819 - if position too large, will throw
> ArrayIndexOutOfBoundsException
>
> //deal with this here and just set to the number of pages - 1 so its at
> the bottom.
>
> int numPages = siteEdit.getPages().size();
>
> if(position > numPages) {
>
> position = numPages-1;
>
> }
>
>
> sitePageEdit.setPosition(position);
>
> sitePageEdit.setPopup(popup);
>
> siteService.save(siteEdit);
>
>
> On Fri, Nov 8, 2013 at 3:05 AM, Charles Severance <csev at umich.edu> wrote:
>
>> Something in the back of my mind says that you need to enable custom
>> order as well.
>>
>> /Chuck
>>
>> On Nov 6, 2013, at 11:54 PM, Paul Mungai <paulwando at gmail.com> wrote:
>>
>> Any Leads?
>>
>>
>> On Wed, Nov 6, 2013 at 12:37 PM, Paul Mungai <paulwando at gmail.com> wrote:
>>
>>> Hi,
>>>
>>> Using the SitePage Api "org.sakaiproject.site.api.SitePage",
>>> setPosition() doesn't work - atleast in my context.
>>>
>>> Other SitePage methods work perfectly.
>>>
>>> Any leads?
>>>
>>> --
>>> Regards,
>>> Paul Mungai
>>>
>>>
>>
>>
>> --
>> Regards,
>> Paul Mungai
>>
>>
>>
>> _______________________________________________
>> 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"
>>
>
>


-- 
Regards,
Paul Mungai

"Ability is what youre capable of doing. Motivation determines what you do.
Attitude determines how well you do it" - Lou Holtz
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://collab.sakaiproject.org/pipermail/sakai-dev/attachments/20131108/a8bc52f1/attachment.html 


More information about the sakai-dev mailing list