Upload
lovemore
View
2.248
Download
1
Embed Size (px)
DESCRIPTION
This session will provide a technical overview on how to leverage Sakai’s REST creation abilities provided by EntityBroker to create ‘on-the-fly’ tools in just HTML, JavaScript and CSS. Sakai development time is grossly affected by the numerous UI rendering toolkits available out there. From RSF to JSF, tweaking the UI to do a simple thing can become time consuming. We will focus on moving UI development back to simple client-side coding and relying on the web services already in Sakai. REST enables you to run queries against a server and retrieve server/database specific information such as site identification or assignments results. Using this technique, UI developers can concentrate on UI and client-side development. A solid separation of concerns is created. Javascript will become the ‘link’ between server and UI. From this session, users will find out how to quickly code acceptable JavaScript applying proper anatomy, namespacing, scoping, dependency handling and error handling. Sample tools will focus on the work done by UCT on the Group Manager tool (http://tinyurl.com/yjtkafl), SMS Credits Transfer Tool, Course Evaluations and SMS Tool. ==================== VIEW VIDEOS CAST: http://www.ustream.tv/recorded/7723054
Citation preview
Quick Create Sakai Tools in Pure HTML and JavaScript
Lovemore NalubeDeveloper
University of Cape Town17 June 2010
Overview
• What you need• The JavaScript canvas• Sakai dependencies• Getting Sakai data• Dropping the app into a site• Demo
• Lets make a “Join a site widget”• A new Group Manager Interface for Sakai• SMS Credits Transfer tool
211th Sakai Conference - June 15-17, 2010
What you need
• jQuery – latest v 1.4.2• HTML• Firebug
• Pretty cool to use:• Fluid infusion – i18n, accessibility• QUnit – jQuery unit testing
311th Sakai Conference - June 15-17, 2010
The JavaScript canvas
• Namespace your code to avoid collisions and make code easy to understand.
411th Sakai Conference - June 15-17, 2010
var siteJoin = function($){
//private functions and vars var privateMe = {}; var privateFunction = function(){ };
//public functions return { init: function(){
} }}($);
Activate our namespace
• Namespace your code to avoid collisions and make code easy to understand.
511th Sakai Conference - June 15-17, 2010
$(document).ready(function() { siteJoin.init();});
Sakai dependencies
• REST webservices• Entity Broker
• Entity Provider
• Actions:• PUT, POST, GET, DELETE
611th Sakai Conference - June 15-17, 2010
-> sakai level
-> tool level
Getting Sakai data
• Use jQuery standards
711th Sakai Conference - June 15-17, 2010
$.ajax({ url: "/direct/membership/join/site/" + siteId, type: "POST", success: function(){ alert("You have joined!");
}, error: function(xhr){ alert("Sorry, you cannot join this site."); } });
Dropping the app into a site
• Put code into a static folder like /library/ so that it is accessible via a url like this: {server}/library/myApp/app.html
• Use the Web Content tool to pull it in.• Add any parameters needed eg:
• {server}/library/myApp/app.html?site=${SITE_ID}
811th Sakai Conference - June 15-17, 2010
Let’s make a toolGroup manager Demo
Fun
11th Sakai Conference - June 15-17, 2010 9
More Info
• http://confluence.sakaiproject.org/display/GRPMGR/
1011th Sakai Conference - June 15-17, 2010