Invading the Client-Side Antranig Basman, CARET, University of Cambridge Colin Clark, Fluid Project, University of Toronto.

Slides:



Advertisements
Similar presentations
Other Web Application Development Technologies. PHP.
Advertisements

JavaScript and AJAX Jonathan Foss University of Warwick
1 CSC 551: Web Programming Spring 2004 client-side programming with JavaScript  scripts vs. programs  JavaScript vs. JScript vs. VBScript  common tasks.
Introduction to JavaScript Module 1 Client Side JS Programming M-GO Sponsored By
June 28 th – July 1 st 2006 Implementing Usability: Insights to improve your chances  CFUnited 2007.
Antranig Basman, CARET, University of Cambridge Aaron Zeckoski, CARET, University of Cambridge Josh Ryan, Arizona State University Colin Clark, Adaptive.
ProJAX An AJAX Framework for Progress Tom Bascom President Greenfield Technologies
ExtJS 4.0 JavaScript MVC Framework. Who ExtJS is provided by Sencha ( o Sencha Touch o GWT o CSS Animator o IO (Cloud Data Management)
AJAX & By – Anupama Sharma. Defining Ajax Ajax isn’t a technology. It’s really several technologies, each flourishing in its own right, coming together.
Microsoft ASP.NET AJAX - AJAX as it has to be Presented by : Rana Vijayasimha Nalla CSCE Grad Student.
© 2006 by IBM 1 How to use Eclipse to Build Rich Internet Applications With PHP and AJAX Phil Berkland IBM Software Group Emerging.
Reasonable Sakai Widgets Aaron Zeckoski Gonzalo Silverio Antranig Basman
JQuery CS 268. What is jQuery? From their web site:
Accessibility for Rich Internet Applications: Colin Clark, Fluid Project Technical Lead, Adaptive Technology Resource Centre Techniques & Toolkits.
JavaServer Faces: The Fundamentals Compiled from Sun TechDays workshops (JSF Basics, Web-Tier Codecamp: JavaServer Faces, Java Studio Creator; IBM RAD)
DHTML. What is DHTML?  DHTML is the combination of several built-in browser features in fourth generation browsers that enable a web page to be more.
NextGen Technology upgrade – Synerizip - Sandeep Kamble.
Pittsburgh Java User Group– Dec Java PureFaces: A JSF Framework Extension.
Architecture Of ASP.NET. What is ASP?  Server-side scripting technology.  Files containing HTML and scripting code.  Access via HTTP requests.  Scripting.
CSCI 224 Introduction to Java Programming. Course Objectives  Learn the Java programming language: Syntax, Idioms Patterns, Styles  Become comfortable.
JavaScript Teppo Räisänen LIIKE/OAMK HTML, CSS, JavaScript HTML defines the structure CSS defines the layout JavaScript is used for scripting It.
5/5/2005Toni Räikkönen Internet based data collection from enterprises using XML questionnaires and XCola engine CoRD Meeting May 11th 2005.
XForms: A case study Rajiv Shivane & Pavitar Singh.
Yahoo! User Interface (YUI) Library Natly Mekdara.
Ajax Runtime Toolkits IBM Emerging Technologies. What is an AJAX Toolkit/Framework? An AJAX Toolkit/Runtime is more than just XMLHTTPRequest Should includes:
CNIT 133 Interactive Web Pags – JavaScript and AJAX JavaScript Environment.
JSP Java Server Pages Softsmith Infotech.
13. jQuery See the official documentation at  See the terse API documentation at
JAVA SERVER PAGES. 2 SERVLETS The purpose of a servlet is to create a Web page in response to a client request Servlets are written in Java, with a little.
© 2006 IBM Corporation Agile Planning Web UI. © 2006 IBM Corporation Agenda  Overview of APT Web UI  Current Issues  Required Infrastructure  API.
Eagle: Maturation and Evolution 17th Annual Tcl Conference Joe Mistachkin.
240-Current Research Easily Extensible Systems, Octave, Input Formats, SOA.
Client-side processing in JavaScript.... JavaScript history Motivations –lack of “dynamic content” on web pages animations etc user-customised displays.
JavaScript - Basic Concepts Prepared and Presented by Hienvinh Nguyen, Afshin Tiraie.
Chính phủ điện tử TS. Phạm Văn Tính Khoa CNTT, ĐH Nông Lâm TP.HCM
ASP.NET in Definition: 1.ASP.NET is a web application framework developed and marketed by Microsoft to allow programmers to build dynamic web sites,
ASP.NET 4 Unleashed Chapter 1. .aspx page: contains C# script and HTML code including tags. Listing 1.1 FirstPage.aspx.
David Lawrence 7/8/091Intro. to PHP -- David Lawrence.
JQuery JavaScript is a powerful language but it is not always easy to work with. jQuery is a JavaScript library that helps with: – HTML document traversal.
JavaScript Introduction. Slide 2 Lecture Overview JavaScript background The purpose of JavaScript A first JavaScript example Introduction to getElementById.
Using RSF to Develop a Sakai Tool – Lessons Learned Mark Norton, Nolaria Consulting.
Web Components with Polymer Jeff Tapper Digital
Rich Internet Applications 2. Core JavaScript. The importance of JavaScript Many choices open to the developer for server-side Can choose server technology.
Understanding JavaScript and Coding Essentials Lesson 8.
Introduction to JavaScript MIS 3502, Spring 2016 Jeremy Shafer Department of MIS Fox School of Business Temple University 2/2/2016.
Learning Aim C.  In this section we will look at some simple client-side scripts, browser compatibility, exporting and compressing and suitable file.
1 CSC160 Chapter 1: Introduction to JavaScript Chapter 2: Placing JavaScript in an HTML File.
JavaScript and Ajax (JavaScript Environment) Week 6 Web site:
Customizing Share Document Previews Will Abson Senior Integrations Engineer and Share Extras Project Lead
JavaScript Invented 1995 Steve, Tony & Sharon. A Scripting Language (A scripting language is a lightweight programming language that supports the writing.
Ext JS - Direct Bridging The Gap A DMSBT Presentation By Timothy Chandler.
Introduction to JavaScript MIS 3502, Fall 2016 Jeremy Shafer Department of MIS Fox School of Business Temple University 9/29/2016.
Angular 4 + TypeScript Getting Started
Michael Robertson Yuta Takayama Google Closure Tools.
Introduction to JavaScript
JavaScript Introduction
A second look at JavaScript
JQuery with ASP.NET.
Introduction to JavaScript
Modern web applications
JavaServer Faces: The Fundamentals
Modern web applications
Eagle: Maturation and Evolution
Introduction to JavaScript
JavaScript CS 4640 Programming Languages for Web Applications
CNIT 133 Interactive Web Pags – JavaScript and AJAX
Web Client Side Technologies Raneem Qaddoura
Bootstrap Direct quote from source: bootstrap/
Review We've seen that a module is a file that can contain classes as well as its own variables. We've seen that you need to import it to access the code,
Web Application Development Using PHP
Presentation transcript:

Invading the Client-Side Antranig Basman, CARET, University of Cambridge Colin Clark, Fluid Project, University of Toronto

Javascript challenges Sakai is a uniquely challenging environment for Javascript (as is any portal) Problems occur under two main headings – namespacing, and startup Name collisions are considerably exacerbated since Javascript is a crazed language that allows one to assign to language primitives such as Object.prototype and Array.prototype Need to carefully select libraries for mutual compatibility Libraries situation is a seething tumult and changing every day

Javascript coding observations Javascript is the greatest undetected jewel in the browser universe (no, really!) The “Object-Oriented” features are bit of a botch forced by dogmatism onto an already complete language A central preoccupation of most libraries is getting the “this” reference to momentarily coincide with something relevant –My advice – don’t bother –Treating plain functions (1 st -order and higher) is a great approach to ensuring name isolation and allowing code reuse –It is also a lot of fun

Namespacing in Javascript The first of the essential issues to be tackled in aggregating JS in a portal environment Like everything else in Javascript, best done in terms of function()s! // RSF.js - primitive definitions for parsing RSF-rendered forms and bindings // definitions placed in RSF namespace, following approach recommended in // var RSF = function() { function invalidate(invalidated, EL, entry) {... other private definitions here... return { addEvent: function (element, type, handler) {... other public definitions here (both “methods” and “members”)... }; // end return internal "Object" }(); // end namespace RSF

Javascript startup approaches A core and perennial issue is how to package initialisation code on the client side Two main approaches –An onload handler which trawls over the document, probably driven by CSS classes, initialising for components it recognises –An explicitly rendered tag in the document body which initialises a local component –Also with the Dojo framework we are seeing a new custom approach (more later)

Javascript startup issues Gaining access to onload in different environments (esp. portals) may be error-prone, and also mandates a specific onload aggregation strategy (and hence possibly choice of JS framework) body tags are globally criticised on formal grounds. However they DO work portably onload scheme will probably also be a lot slower, especially as page size and number of widgets increases For RSF, for now, I have chosen the option Good practice is to slim down this init code as much as possible (a single function call) To make this easy, there is standard utility emitJavascriptCall in PonderUtilCore – an RSF example: String js = HTMLUtil.emitJavascriptCall("setupRSFFormattedTextarea", new String[] {toevolve.getFullID(), collectionID}); UIVerbatim.make(joint, "textarea-js", js);

Render Single Javascript Call In Script The RSF preferred approach, but easily applicable in other frameworks Every browser so far investigated has consistent behaviour – a block is executed during buildup of the DOM, and does have access to all so far constructed elements of the DOM

RSJCIS Example From the template: This enables the behaviour to be previewed in the filesystem At runtime, the Javascript one-line call is replaced by one with different (and more) arguments to account for changes in the location (and number!) of the markup block... remainder of implementation DoubleList.init_DoubleList("input-doublelist:");

Choices on the Client Side Prototype.js –Influenced by (generated by) Ruby –Lots of “functional” tricks –Has spawned a whole tree of dependent libraries (rico, scriptaculous, etc.) –Is pretty darn rude since it assigns to all sorts of JS primitives –Is *probably* unacceptable for widespread use in Sakai, although sufficiently widespread that compatibility is not a dead loss Yahoo UI Library –Written by “grownups” – all properly namespaced –Lots of useful widgets and libaries –Is pretty bulky and clunky –Is certainly safe for Sakai

Choices on the Client Side II JQuery –Interesting “continuation” style of invoking –Cross-library safety needs to be vetted –Fairly convenient to use Dojo –Supported by IBM and others –A growing collection of widgets –Currently front runner choice of Fluid project –Rapid version evolution with some breakage –Has a very slick but perhaps over-ambitious "modules" system for auto-loading libraries

Dojo's approach to autoloading – "dojo.require" The system will resolve references to js file assuming a correspondence between file structure and package structure (a la Java) The "parser" will automatically scan the page for Dojo classes and instantiate them dojo.require("fluid.Lightbox"); dojo.require("dojo._base.event"); dojo.require("dijit.util.parser");

Issues with Dojo startup Whilst this works slickly in a simple application, lack of control over timings would be much more concerning in a portal, especially an AJAX portal Parse errors in auto-loaded files currently cause an opaque exception Dojo *does* permit and support explicit instantiation of widgets, which we are currently exploring

Implementation of the Date Widget Key strategy is to leverage Java-side comprehensive information on Locales Huge variety of date formats made a simpler initial strategy to do all date conversion on the server via AJAX –This implementation work is “amortised” by creation of UVB, an AJAX view and client-side code that can be used for ALL RSF components A more efficient approach to port some of this logic to Javascript –However this would make the algorithms less testable and maintainable Package components in as tech-neutral manner as possible Since