You are previewing Moodle JavaScript Cookbook.
O'Reilly logo
Moodle JavaScript Cookbook

Book Description

Make Moodle e-learning even more dynamic by learning to customize using JavaScript. With over 50 recipes, this Cookbook allows you to add effects, modify forms, include animations, and much more for an enhanced user experience.

  • Learn why, where, and how to add to add JavaScript to your Moodle site

  • Get the most out of Moodle's built-in extra—the Yahoo! User Interface Library (YUI)

  • Explore a wide range of modern interactive features, from AJAX to Animation

  • Integrate external libraries like jQuery framework with Moodle

  • In Detail

    Moodle is the best e-learning solution on the block and is revolutionizing courses on the Web. Using JavaScript in Moodle is very useful to administrators and dynamic developers as it uses built-in libraries to provide the modern and dynamic experience that is expected by web users today.

    The Moodle JavaScript Cookbook will take you through the basics of combining Moodle with JavaScript and its various libraries and explain how JavaScript can be used along with Moodle. It will explain how to integrate Yahoo! User Interface Library (YUI) with Moodle. YUI will be the main focus of the book, and is the key to implementing modern, dynamic feature-rich interfaces to help your users get a more satisfying and productive Moodle experience. It will enable you to add effects, make forms more responsive, use AJAX and animation, all to create a richer user experience. You will be able to work through a range of YUI features, such as pulling in and displaying information from other websites, enhancing existing UI elements to make users' lives easier, and even how to add animation to your pages for a nice finishing touch.

    A Cookbook filled with step by step recipes to enhance Moodle with JavaScript and the Yahoo! UI Library

    Table of Contents

    1. Moodle JavaScript Cookbook
      1. Moodle JavaScript Cookbook
      2. Credits
      3. About the Author
      4. About the Reviewers
      5. www.PacktPub.com
        1. Support files, eBooks, discount offers and more
          1. Why Subscribe?
          2. Free Access for Packt account holders
      6. Preface
        1. What this book covers
        2. What you need for this book
        3. Who this book is for
        4. Conventions
        5. Reader feedback
        6. Customer support
          1. Downloading the example code
          2. Errata
          3. Piracy
          4. Questions
      7. 1. Combining Moodle and JavaScript
        1. Introduction
        2. Creating a new Moodle PHP page
          1. Getting ready
          2. How to do it...
          3. How it works...
        3. Loading a JavaScript file
          1. Getting ready
          2. How to do it...
          3. How it works...
        4. Loading a JavaScript file in <head>
          1. Getting ready
          2. How to do it...
          3. How it works...
        5. Generating a JavaScript function call from PHP
          1. Getting ready
          2. How to do it...
          3. How it works…
        6. Passing variables from PHP to JavaScript
          1. Getting ready
          2. How to do it...
          3. How it works…
        7. Ensuring compliance with XHTML Strict
          1. Getting ready
          2. How to do it...
          3. How it works…
        8. Retrieving language strings from Moodle
          1. Getting ready
          2. How to do it...
          3. How it works…
      8. 2. Moodle and Yahoo! User Interface Library (YUI)
        1. Introduction
        2. Initializing the YUI 3 library
          1. Getting ready
          2. How to do it...
          3. How it works...
        3. Loading additional YUI modules
          1. How to do it...
        4. Loading YUI 2 modules from YUI 3
          1. Getting ready
          2. How to do it...
          3. How it works...
        5. Attaching basic event handlers
          1. Getting ready
          2. How to do it...
          3. How it works...
        6. Attaching advanced DOM event handlers
          1. Getting ready
          2. How to do it...
          3. How it works...
        7. Implementing event delegation
          1. Getting ready
          2. How to do it...
          3. How it works...
        8. Debugging with the YUI console
          1. Getting ready
          2. How to do it...
          3. How it works...
      9. 3. Moodle Forms Validation
        1. Introduction
        2. Adding a required field
          1. Getting ready
          2. How to do it...
          3. How it works...
        3. Adding a field with a maximum length
          1. Getting ready
          2. How to do it...
          3. How it works...
        4. Adding a field with a minimum length
          1. Getting ready
          2. How to do it...
          3. How it works...
        5. Adding a field length within in a specified range
          1. Getting ready
          2. How to do it...
          3. How it works...
        6. Adding a valid e-mail address field
          1. Getting ready
          2. How to do it...
          3. How it works...
        7. Adding custom validation with a Regular Expression
          1. Getting ready
          2. How to do it...
          3. How it works...
        8. Adding a field that accepts only alphabetic characters
          1. Getting ready
          2. How to do it...
          3. How it works...
        9. Adding a field that accepts only alphanumeric characters
          1. Getting ready
          2. How to do it...
          3. How it works...
        10. Adding a field that accepts only numeric characters
          1. Getting ready
          2. How to do it...
          3. How it works...
        11. Rejecting punctuation characters
          1. Getting ready
          2. How to do it...
          3. How it works...
        12. Rejecting input without a leading zero
          1. Getting ready
          2. How to do it...
          3. How it works...
        13. Comparing with another field
          1. Getting ready
          2. How to do it...
          3. How it works...
        14. Adding a custom JavaScript validation function callback
          1. Getting ready
          2. How to do it...
          3. How it works...
      10. 4. Manipulating Data with YUI 3
        1. Introduction
        2. Using IO to request a URI
          1. How to do it...
          2. How it works...
        3. Using IO's alternative transport method for requesting external URIs
          1. Getting ready
          2. How to do it...
          3. How it works...
        4. Using PHP as a proxy to load data from an external domain
          1. How to do it...
          2. How it works...
        5. Parsing XML with DataSource
          1. How to do it...
          2. How it works...
        6. Parsing JSON with DataSource
          1. Getting ready
            1. How to do it...
            2. How it works...
          2. Parsing CSV data with DataSource
            1. Getting ready
              1. How to do it...
              2. How it works...
            2. Retrieving data from a Moodle 2.0 web service
              1. Getting ready
              2. How to do it...
              3. How it works…
      11. 5. Working with Data Tables
        1. Introduction
        2. Initializing a YUI DataSource
          1. How to do it...
          2. How it works...
        3. Displaying data
          1. How to do it...
          2. How it works...
        4. Basic column sorting
          1. Getting ready
          2. How to do it...
          3. How it works...
        5. Adding paging
          1. Getting ready
          2. How to do it...
          3. How it works...
        6. Enabling scrolling
          1. Getting ready
          2. How to do it...
          3. How it works...
        7. Enabling editing
          1. Getting ready
          2. How to do it...
          3. How it works...
      12. 6. Enhancing Page Elements
        1. Introduction
        2. Adding a text box with auto-complete
          1. How to do it...
          2. How it works...
        3. Adding a combo box with auto-complete
          1. How to do it...
          2. How it works...
        4. Displaying auto-updating data
          1. How to do it...
          2. How it works...
        5. Enabling resizable elements
          1. How to do it...
          2. How it works...
        6. Adding custom tooltips
          1. How to do it...
          2. How it works...
        7. Adding custom button controls
          1. How to do it...
          2. How it works...
      13. 7. Advanced Layout Techniques
        1. Introduction
        2. Adding a fly-out navigation menu
          1. How to do it...
          2. How it works...
        3. Adding a drop-down navigation menu
          1. Getting ready
          2. How to do it...
          3. How it works...
        4. Displaying a tree-view navigation menu
          1. How to do it...
            1. How it works...
          2. Adding a tabbed content control
            1. How to do it...
              1. How it works...
            2. Displaying content in a modal window
              1. How to do it...
                1. How it works...
      14. 8. Animating Components
        1. Introduction
        2. Fading in an element
          1. How to do it...
          2. How it works...
        3. Fading out an element
          1. How to do it...
          2. How it works...
        4. Scrolling an element
          1. How to do it...
          2. How it works...
        5. Resizing an element
          1. How to do it...
          2. How it works...
        6. Animating with easing
          1. How to do it...
          2. How it works...
        7. Moving an element along a straight path
          1. How to do it...
          2. How it works...
        8. Moving an element along a curved path
          1. How to do it...
          2. How it works...
        9. Changing an element's color
          1. How to do it...
          2. How it works...
        10. Sequencing multiple animations
          1. How to do it...
          2. How it works...
      15. 9. Integrating External Libraries
        1. Introduction
        2. Adding the jQuery framework
          1. Getting ready
          2. How to do it...
          3. How it works...
        3. Adding the MooTools framework
          1. Getting ready
          2. How to do it...
          3. How it works...
        4. Adding the Dojo framework
          1. Getting ready
          2. How to do it...
          3. How it works...
        5. Adding the Prototype framework
          1. Getting ready
          2. How to do it...
          3. How it works...
        6. Adding the script.aculo.us add-on to Prototype
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more…
        7. Adding image enlargement with Lightbox 2
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more…