[Building Sakai] Web Service - Change Page Tool Order?

Steve Swinsburg steve.swinsburg at gmail.com
Sun Jun 10 08:13:20 PDT 2012


The issue with refactoring them out is it will break for everyone.

So what we've been doing is creating separate jws files for new tools like Gradebook.jws, Portfolio.jws etc, but keeping the current ones in SakaiScript. Though new ones could certainly be added to different files.

So you could actually just modify SakaiScript.jws and go from there.

cheers,
Steve

On 10 Jun 2012, at 00:36, Benjamin Willard wrote:

> I see, that is what I was actually going to do so that I don’t have to loose my work if I accidently update sakai or something…
>  
> Now your idea may work, but there should be like a central script so that we don’t have to target everything, unless they are specific, like Site.jws for handling all site stuff, User.jws for user, then that would make more sense…   Either way, I’ve actually made a PHP Wrapper that allows me to execute a call, with a session and a one time connect without having to login every time a call needs to be executed…
>  
> What I would really like to do is set the cookie to SAKAI so that a user is logged in…   Basically right now I am using the sakai.session as a parameter, which I am not to much savy for.  Cuz it could be a security thing???   Either way if there is a way to use Web Service to authenticate a user and create a JSESSIONID correctly without having to use sakai.session parameter… This is something I’m doing right now
>  
> // we do a silent HttpRequest to sakai so that it logs us in automatically
>               $httpClient = new Zend_Http_Client($config->sakai->portal->url, array('keepalive' => true));
>               $httpClient->setParameterGet('sakai.session', $sessionId);
>               $httpClient->setCookieJar();
>                     
>               $response = $httpClient->request(Zend_Http_Client::GET);
>               $cookieJar = $httpClient->getCookieJar();
>               $uri = Zend_Uri::factory($config->sakai->portal->url);
>               $jSession = $cookieJar->getCookie($uri,'JSESSIONID');
>               $cookieValue = $jSession->getValue();
>               setcookie('JSESSIONID', $cookieValue, 0, '/', '', false, true);
>  
> Basically it allows me to do a silent request to SAKAI to create the Session Cookie etc. then set it for the whole site…  It works really well but I wish I could do a more “Secure” way to do this…  IE maybe doing a POST to the /portal or something not sure if that would work…
>  
> Ben
>  
>  
> From: Matthew Jones [mailto:matthew at longsight.com] 
> Sent: Saturday, June 09, 2012 9:26 PM
> To: Benjamin Willard
> Cc: sakai-dev at collab.sakaiproject.org
> Subject: Re: [Building Sakai] Web Service - Change Page Tool Order?
>  
> Ideally, for custom stuff you'd create another jws file. Just dump all the imports on top you want, put it in a class with the same name as that file, have a constructor that uses ComponentManager to get whatever components you need and be off! You can put them right into this file too, but it can be more confusing for an updated.
>  
> If you did make good methods, you could file a jira on jira.sakaiproject.org then we could include them in the official script for later versions. I believe that ideally if there ever was a "Sakai Script 2.0" that some of these might be re-factored anyway into separate files. (Like Gradebook.jws, Assignment.jws, ContentManagement.jws, etc)
>  
> On Sun, Jun 10, 2012 at 12:21 AM, Benjamin Willard <developman at uniphix.com> wrote:
> So let me ask, I can add more Web Service calls to the SakaiScript? OR whatever???  Because then I would do a lot of custom stuff as I need to?
>  
> Basically If I add this method below and adjust it for Tools I should be able to do what I need?
>  
> Ben
>  
> From: Matthew Jones [mailto:matthew at longsight.com] 
> Sent: Saturday, June 09, 2012 9:13 PM
> To: Benjamin Willard
> Cc: sakai-dev at collab.sakaiproject.org
> Subject: Re: [Building Sakai] Web Service - Change Page Tool Order?
>  
> No, unfortunately I don't see a webservice for this already. It looks like a few functions setPosition, but none of them "setCustomPageOrdered".
>  
> It basically only should involve two calls, one of which is in addNewPageToSite and the other is similar to addNewToolToAllWorkspaces.
>  
> Maybe combine a few functions and set it up like
>  
> public String movePageinSite(String sessionid, String siteid, String pagetitle, int position) throws AxisFault
> {
>     Session session = establishSession(sessionid);
>  
>     try {
>  
>         Site siteEdit = siteService.getSite(siteid);
>         List pageEdits = siteEdit.getPages();
>         int numPages = pageEdits.size();
>         for (Iterator i = pageEdits.iterator(); i.hasNext();)
>         {
>             SitePage pageEdit = (SitePage) i.next();
>             if (pageEdit.getTitle().equals(pagetitle))
>             {
>                if(position > numPages) {
>                     position = numPages-1;
>                }
>                siteEdit.setCustomPageOrdered(true);
>                pageEdit.setPosition(position);
>             }
>         }
>         siteService.save(siteEdit)
>     }
>     catch (Exception e) {
>         LOG.error("WS  movePageinSite(): " + e.getClass().getName() + " : " + e.getMessage());
>         return e.getClass().getName() + " : " + e.getMessage();
>     }
>     return "success";
> }
>  
> On Sat, Jun 9, 2012 at 5:05 PM, Benjamin Willard <developman at uniphix.com> wrote:
> 
> 
> 
> -----Original Message-----
> From: Benjamin Willard [mailto:benw at needsmet.org]
> Sent: Saturday, June 09, 2012 1:32 PM
> To: 'sakai-dev at collab.sakaiproject.org'
> Cc: 'Steve Sasser'; 'Chris Maurer'; 'Tim Krauss'
> Subject: Web Service - Change Page Tool Order?
> 
> Is there a way to change the tool's page order using the Sakai Web Service?  I am doing an auto-generated copySite, and creating a special sakai.iframe content page, that I need positioned in a certain order on the Sakai Site...   How can I change the page order for this?
> 
> Ben
> 
> _______________________________________________
> 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"
>  
>  
> _______________________________________________
> 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"

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://collab.sakaiproject.org/pipermail/sakai-dev/attachments/20120610/a36183e6/attachment.html 


More information about the sakai-dev mailing list