<?xml version="1.0" encoding="UTF-8"?>
<Module>
<ModulePrefs
title="Insum Web 2.0 Demos - Weekly Release"
title_url="http://www.insum.ca/jquery"
description="Insum's Web 2.0 Demos - Weekly Release"
author="Louis-Guillaume Carrier-Bédard"
author_email="lgcarrier@insum.ca"
author_location="Montreal,Quebec,Canada"
author_affiliation="Insum Solutions"
author_link="http://lgcarrier.blogspot.com"
author_photo="http://1.bp.blogspot.com/_eGo1vRawUKs/STQuxPfS77I/AAAAAAAAAOI/eywUk9n6kls/S220-h/photo.jpg"
author_quote="There is no right way to do the wrong thing. If you do it, do it Béton!"
height="150"
width ="400">
<Require feature="minimessage"/>
<Require feature="setprefs"/>
<Require feature="views"/>
<Require feature="dynamic-height"/>
</ModulePrefs>
<UserPref name="itemCount" display_name="Item count: " datatype="enum" default_value="10">
<EnumValue value="1"/>
<EnumValue value="2"/>
<EnumValue value="3"/>
<EnumValue value="4"/>
<EnumValue value="5"/>
<EnumValue value="6"/>
<EnumValue value="7"/>
<EnumValue value="8"/>
<EnumValue value="9"/>
<EnumValue value="10"/>
</UserPref>
<UserPref name="fHeight" datatype="bool" default_value="1" display_name="Auto-Height"/>
<UserPref name="nHeight" datatype="string" default_value="150" display_name="Height"/>
<Content type="html"><![CDATA[
<script src="http://www.google.com/jsapi"></script>
<script>
    // Load jQuery
    google.load("jquery", "1.2.6", {uncompressed:true});

    // Load Google Visualization API
    google.load('visualization', '1', {packages: ['table']});
</script>
<script>
    var prefs = new _IG_Prefs(__MODULE_ID__);

    function setHeight() {
        _IG_AdjustIFrameHeight(prefs.getInt('fHeight') ? -1 : prefs.getInt('nHeight'));
    }

    function draw() {
        var url = "http://apex.oracle.com/pls/otn/f?p=987654321:204:0:APPLICATION_PROCESS=GET_WEEKLY_RELEASE:::P_REQUEST_ITEM_COUNT:"+prefs.getString('itemCount')+"";

        _IG_FetchContent(url, function(data) {
            data = eval(data);
            if ((nb_demo = data.length) > 0) {
                var table_data = new google.visualization.DataTable();
                table_data.addColumn('string', 'Title');
                table_data.addRows(nb_demo);

                for (i = 0; i < nb_demo; i++) {
                    table_data.setCell(i, 0, data[i].url, data[i].title);
                }

                table = new google.visualization.Table(document.getElementById('table_div'));
                table.draw(table_data, {showRowNumber: true});

                // Add our selection handler.
                google.visualization.events.addListener(table, 'select', function() {
                    var row = table.getSelection()[0].row;
                    window.open(table_data.getValue(row, 0));
                });

                setHeight();
            }
        },
        {refreshInterval: 0});
    }

    function initialize() {
        draw();
    }

    google.setOnLoadCallback(initialize);
</script>
<div id="table_div" />
]]></Content>
</Module>

