rave-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From zh...@apache.org
Subject svn commit: r1087520 [32/35] - in /incubator/rave/donations/ogce-gadget-container: ./ config/ config/shindig-1.1-BETA5/ config/shindig-2.0.0/ db-cleaner/ examples/ examples/src/ examples/src/main/ examples/src/main/java/ examples/src/main/java/cgl/ exa...
Date Fri, 01 Apr 2011 00:29:38 GMT
Added: incubator/rave/donations/ogce-gadget-container/third-party-gadgets/picasa.xml
URL: http://svn.apache.org/viewvc/incubator/rave/donations/ogce-gadget-container/third-party-gadgets/picasa.xml?rev=1087520&view=auto
==============================================================================
--- incubator/rave/donations/ogce-gadget-container/third-party-gadgets/picasa.xml (added)
+++ incubator/rave/donations/ogce-gadget-container/third-party-gadgets/picasa.xml Fri Apr
 1 00:29:22 2011
@@ -0,0 +1,196 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<Module>
+<ModulePrefs title="__UP_title__"
+             directory_title="Picasa Web Photos"
+             title_url="__UP_gallery__"
+             author="Sophia B.; George R."
+             author_location="Mountain View, CA; Cambridge, MA"
+             author_affiliation="Google Inc."
+             author_email="George.Feedback+Picasa@gmail.com"
+             screenshot="/ig/modules/picasa.png"
+             thumbnail="/ig/modules/picasa-thm.png"
+             render_inline="optional"
+             description="Browse your Picasa Web Photos on your homepage.">
+</ModulePrefs>
+<UserPref name="feed" display_name="Picasa Web RSS Feed" 
+          default_value="http://picasaweb.google.com/data/feed/base/user/picasateam/albumid/5114659638793351217?kind=photo&amp;alt=rss&amp;hl=en_US"

+          datatype="string" required="true"/>
+<UserPref name="title" display_name="Title" default_value="My Picasa Photos"
+          datatype="string" required="true"/>
+<UserPref name="gallery" display_name="Title URL" default_value=""
+          datatype="string" required="false"/>
+<UserPref name="desc" display_name="Show description" default_value="true"
+          datatype="bool"/>
+<Content type="html">
+<![CDATA[
+<style>
+  .img__MODULE_ID__ {
+    border-width:1px;
+  }
+  .arrow__MODULE_ID__ {
+    text-decoration:none;
+    cursor:pointer;
+    font-size:20px;
+    color:#3366cc;
+    vertical-align:top;
+    padding-bottom:4px;
+  }
+  .sourceLink__MODULE_ID__ A:link {
+    color:#7777cc;
+  }
+  .sourceLink__MODULE_ID__ A:visited {
+    color:#7777cc;
+  }
+  #photoDiv__MODULE_ID__ {
+  }
+  #description__MODULE_ID__ {
+    padding-top:4px;
+    font-size:11px;
+    text-align:center;
+  }
+  #photoNum__MODULE_ID__ {
+    font-size:smaller;
+    padding-right:6px;
+    padding-left:6px;
+  }
+</style>
+
+<script type="text/javascript" src="gadget-migration.js"></script>
+
+<div id="photoDiv__MODULE_ID__">
+  <table cellpadding="0" cellspacing="0" width="100%" class="photoTable__MODULE_ID__">
+    <tr>
+      <td width="50%" align="right">
+        <div class="arrow__MODULE_ID__" onclick="prevPhoto__MODULE_ID__()">&laquo;</div>
+      </td>
+      <td align="center" id="photoNum__MODULE_ID__">
+      </td>
+      <td width="50%">
+        <div class="arrow__MODULE_ID__" onclick="nextPhoto__MODULE_ID__()">&raquo;</div>
+      </td>
+    </tr>
+    <tr>
+      <td colspan="3" align="center" width="100%">
+        <div id="photo__MODULE_ID__">
+        <a href="" id="picasa_link__MODULE_ID__"><img id="picasa_img__MODULE_ID__"
class="img__MODULE_ID__" src=""/></a>
+        </div>
+      </td>
+    </tr>
+  </table>
+  <div id="description__MODULE_ID__"></div>
+</div>
+
+<script>
+  var prefs__MODULE_ID__;
+  var index__MODULE_ID__;
+  var photoObjects__MODULE_ID__;
+  var xml__MODULE_ID__;
+
+  function loadPhotos__MODULE_ID__() {
+    prefs__MODULE_ID__ = new _IG_Prefs(__MODULE_ID__);
+    index__MODULE_ID__ = prefs__MODULE_ID__.getInt('index');
+    var feed = prefs__MODULE_ID__.getString('feed');
+    feed = feed.replace(/\/base\//g, '/api/');
+    feed = feed.replace(/&amp;/g, '&');
+    _IG_FetchXmlContent(feed, parseAndDisplayPhotos__MODULE_ID__);
+  }
+
+  function value__MODULE_ID__(parent, tag) {
+    return _hesc(parent.getElementsByTagName(tag).item(0).firstChild.nodeValue);
+  }
+
+  function photoObject__MODULE_ID__(photosrc, photolink, description) {
+    this.photoSrc = photosrc;
+    this.photoLink = photolink;
+    this.description = description;
+  }
+
+  function parseAndDisplayPhotos__MODULE_ID__(xmlDoc) {
+    var items = xmlDoc.getElementsByTagName('item');
+    var body = document.getElementsByTagName('body')[0];
+    var maxAllowedWidth = body.scrollWidth;
+    var maxAllowedHeight = body.scrollHeight - 24;
+    // IE workaround
+    if (maxAllowedHeight < 100) {
+      maxAllowedHeight = maxAllowedWidth; 
+    }
+    if (prefs__MODULE_ID__.getBool('desc')) {
+      maxAllowedHeight -= 20;
+    }
+    photoObjects__MODULE_ID__ = new Array(items.length);
+    for (var i = 0; i < items.length; i++) {
+      var item = items.item(i);
+      var description = '';
+      if (item.getElementsByTagName('description').length > 0 &&
+          item.getElementsByTagName('description').item(0).firstChild) {
+        description = value__MODULE_ID__(item, 'description');
+      }
+      var photolink = value__MODULE_ID__(item, 'link');
+      var photosrc = '';
+
+      // Picasa RSS XML format changed: try them all, be permissive
+      var thumbnails = item.getElementsByTagName('media:thumbnail');
+      if (thumbnails.length == 0) {
+        thumbnails = item.getElementsByTagName('thumbnail');
+      }
+      if (thumbnails.length > 0) {
+        var biggest = 0;
+        for (var j = 0; j < thumbnails.length; ++j){
+          var thumb = thumbnails.item(j);
+          var width  = parseInt(thumb.getAttribute('width'));
+          var height = parseInt(thumb.getAttribute('height'));
+          if (width > biggest && width < maxAllowedWidth &&
+              height < maxAllowedHeight ) {
+            biggest = width;
+            photosrc = thumbnails.item(j).getAttribute('url');
+          }
+        }
+        if (photosrc == null) {
+          photosrc = value__MODULE_ID__(item, 'thumbnail');
+        }
+      } else {
+         photosrc = value__MODULE_ID__(item, 'photo:thumbnail');
+      }
+      photoObjects__MODULE_ID__[i] = 
+        new photoObject__MODULE_ID__(photosrc, photolink, description);
+    }
+    loadPhoto__MODULE_ID__(index__MODULE_ID__);
+  }
+
+  function nextPhoto__MODULE_ID__() {
+    ++index__MODULE_ID__;
+    if (index__MODULE_ID__ >= photoObjects__MODULE_ID__.length) {
+      index__MODULE_ID__ = 0;
+    }
+    loadPhoto__MODULE_ID__(index__MODULE_ID__);
+  }
+
+  function prevPhoto__MODULE_ID__ () {
+    --index__MODULE_ID__;
+    if (index__MODULE_ID__ < 0) {
+      index__MODULE_ID__ = photoObjects__MODULE_ID__.length - 1;
+    }
+    loadPhoto__MODULE_ID__(index__MODULE_ID__);
+    prefs__MODULE_ID__.set('index', index__MODULE_ID__);
+  }
+
+  // IE6 bug: if this is invoked through an <a onclick>, 
+  // it doesn't load the image, if through a <div onclick>, it does.
+  function loadPhoto__MODULE_ID__(index) {
+    _gel('photoNum__MODULE_ID__').innerHTML = Number(index + 1) +
+         '&nbsp;of&nbsp;' + photoObjects__MODULE_ID__.length;
+    var photoObject = photoObjects__MODULE_ID__[index];
+    _gel('picasa_img__MODULE_ID__').src = photoObject.photoSrc;
+    _gel('picasa_link__MODULE_ID__').href = photoObject.photoLink;
+    if (prefs__MODULE_ID__.getBool('desc')) {
+      _gel('description__MODULE_ID__').innerHTML = photoObject.description;
+    }
+  }
+
+  _IG_RegisterOnloadHandler(loadPhotos__MODULE_ID__);
+
+</script>
+
+]]>
+</Content>
+</Module>

Added: incubator/rave/donations/ogce-gadget-container/third-party-gadgets/poll-fc.xml
URL: http://svn.apache.org/viewvc/incubator/rave/donations/ogce-gadget-container/third-party-gadgets/poll-fc.xml?rev=1087520&view=auto
==============================================================================
--- incubator/rave/donations/ogce-gadget-container/third-party-gadgets/poll-fc.xml (added)
+++ incubator/rave/donations/ogce-gadget-container/third-party-gadgets/poll-fc.xml Fri Apr
 1 00:29:22 2011
@@ -0,0 +1,74 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<Module>
+    <ModulePrefs
+        title="Event (CTS)"
+        author_email="jenvor@gmail.com"
+        description="" 
+        height="320">
+        <Require feature="opensocial-0.8" />
+        <Require feature="dynamic-height" />
+    </ModulePrefs>
+    <Content type="html" view="home">
+  <![CDATA[
+<!-- Include the Google Friend Connect javascript library. -->
+<script type="text/javascript" src="http://www.google.com/friendconnect/script/friendconnect.js"></script>
+<!-- Define the div tag where the gadget will be inserted. -->
+<div id="div-3041097120564904911" style="width:250px;border:1px solid #cccccc;"></div>
+<!-- Render the gadget into a div. -->
+<script type="text/javascript">
+var skin = {};
+skin['BORDER_COLOR'] = '#cccccc';
+skin['ENDCAP_BG_COLOR'] = '#e0ecff';
+skin['ENDCAP_TEXT_COLOR'] = '#333333';
+skin['ENDCAP_LINK_COLOR'] = '#0000cc';
+skin['ALTERNATE_BG_COLOR'] = '#e6e6e6';
+skin['CONTENT_BG_COLOR'] = '#ffffff';
+skin['CONTENT_LINK_COLOR'] = '#0000cc';
+skin['CONTENT_TEXT_COLOR'] = '#333333';
+skin['CONTENT_SECONDARY_LINK_COLOR'] = '#7777cc';
+skin['CONTENT_SECONDARY_TEXT_COLOR'] = '#666666';
+skin['CONTENT_HEADLINE_COLOR'] = '#333333';
+google.friendconnect.container.setParentUrl('/' /* location of rpc_relay.html and canvas.html
*/);
+google.friendconnect.container.renderOpenSocialGadget(
+ { id: 'div-3041097120564904911',
+   url:'http://www.google.com/friendconnect/gadgets/poll.xml',
+   site: '@friendConnectSiteID@'
+},
+  skin);
+</script>
+
+  ]]>
+</Content>
+
+    <Content type="html" view="canvas">
+  <![CDATA[
+<!-- Include the Google Friend Connect javascript library. -->
+<script type="text/javascript" src="http://www.google.com/friendconnect/script/friendconnect.js"></script>
+<!-- Define the div tag where the gadget will be inserted. -->
+<div id="div-3041097120564904911" style="width:100%;border:1px solid #cccccc;"></div>
+<!-- Render the gadget into a div. -->
+<script type="text/javascript">
+var skin = {};
+skin['BORDER_COLOR'] = '#cccccc';
+skin['ENDCAP_BG_COLOR'] = '#e0ecff';
+skin['ENDCAP_TEXT_COLOR'] = '#333333';
+skin['ENDCAP_LINK_COLOR'] = '#0000cc';
+skin['ALTERNATE_BG_COLOR'] = '#e6e6e6';
+skin['CONTENT_BG_COLOR'] = '#ffffff';
+skin['CONTENT_LINK_COLOR'] = '#0000cc';
+skin['CONTENT_TEXT_COLOR'] = '#333333';
+skin['CONTENT_SECONDARY_LINK_COLOR'] = '#7777cc';
+skin['CONTENT_SECONDARY_TEXT_COLOR'] = '#666666';
+skin['CONTENT_HEADLINE_COLOR'] = '#333333';
+google.friendconnect.container.setParentUrl('/' /* location of rpc_relay.html and canvas.html
*/);
+google.friendconnect.container.renderOpenSocialGadget(
+ { id: 'div-3041097120564904911',
+   url:'http://www.google.com/friendconnect/gadgets/poll.xml',
+   site: '@friendConnectSiteID@'
+},
+  skin);
+</script>
+  ]]>
+</Content>
+</Module>
+

Added: incubator/rave/donations/ogce-gadget-container/third-party-gadgets/pom.xml
URL: http://svn.apache.org/viewvc/incubator/rave/donations/ogce-gadget-container/third-party-gadgets/pom.xml?rev=1087520&view=auto
==============================================================================
--- incubator/rave/donations/ogce-gadget-container/third-party-gadgets/pom.xml (added)
+++ incubator/rave/donations/ogce-gadget-container/third-party-gadgets/pom.xml Fri Apr  1
00:29:22 2011
@@ -0,0 +1,80 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+  <modelVersion>4.0.0</modelVersion>
+  <groupId>cgl.shindig</groupId>
+  <artifactId>third-party-gadgets</artifactId>
+  <packaging>pom</packaging>
+  <version>1.0</version>
+  <name>third-party-gadgets</name>
+  <parent>
+    <groupId>cgl.shindig</groupId>
+    <artifactId>gadget-container-main-driver</artifactId>
+    <version>0.1</version>
+    <relativePath>..</relativePath>
+  </parent>
+
+  <properties>
+    <main.basedir>${project.parent.basedir}</main.basedir>
+  </properties>
+
+  <build>
+    <plugins>
+      <plugin>
+        <artifactId>maven-antrun-plugin</artifactId>
+        <executions>
+          <execution>
+            <id>Clean</id>
+            <phase>clean</phase>
+            <configuration>
+              <tasks>
+                <delete failonerror="false">
+                  <fileset dir="${catalina.home}/webapps/gadgets-repo/"/>
+                </delete>
+              </tasks>
+            </configuration>
+            <goals>
+              <goal>run</goal>
+            </goals>
+          </execution>
+
+          <execution>
+            <id>Install</id>
+            <phase>install</phase>
+            <configuration>
+              <tasks>
+                <mkdir dir="${catalina.home}/webapps/gadgets-repo/"/>
+                <copy overwrite="true" filtering="true" todir="${catalina.home}/webapps/gadgets-repo/">
+                  <fileset dir="${basedir}">
+                    <exclude name="pom.xml"/>
+                    <include name="**/*.xml"/>
+                    <include name="**/*.html"/>
+                    <include name="**/*.js"/>
+                    <include name="**/*.gif"/>
+                    <include name="**/*.png"/>
+                    <include name="**/*.css"/>
+                  </fileset>
+                  <filterset>
+                    <filtersfile file="${basedir}/../config/ishindig.properties"/>
+                  </filterset>
+                  	<filterset>
+					      <filter token="friendConnectSiteID" value="${site.friendconnectID}"/>
+					      <filter token="gadgetServerLocation" value="${site.base}"/>
+				    </filterset>
+			    </copy>
+
+
+                <copy overwrite="true" filtering="false" 
+                  todir="${catalina.home}/webapps/gadgets-repo"
+                  file="${basedir}/../gadget-migration/gadget-migration.js">
+                </copy>
+              </tasks>
+            </configuration>
+            <goals>
+              <goal>run</goal>
+            </goals>
+          </execution>
+        </executions>       
+      </plugin>
+    </plugins>
+  </build>
+</project>
+

Added: incubator/rave/donations/ogce-gadget-container/third-party-gadgets/rpc_relay.html
URL: http://svn.apache.org/viewvc/incubator/rave/donations/ogce-gadget-container/third-party-gadgets/rpc_relay.html?rev=1087520&view=auto
==============================================================================
--- incubator/rave/donations/ogce-gadget-container/third-party-gadgets/rpc_relay.html (added)
+++ incubator/rave/donations/ogce-gadget-container/third-party-gadgets/rpc_relay.html Fri
Apr  1 00:29:22 2011
@@ -0,0 +1 @@
+<html><head><script type="text/javascript" src="http://www.google.com/friendconnect/script/rpc_relay.js"></script></head></html>
\ No newline at end of file

Added: incubator/rave/donations/ogce-gadget-container/third-party-gadgets/rpctest.xml
URL: http://svn.apache.org/viewvc/incubator/rave/donations/ogce-gadget-container/third-party-gadgets/rpctest.xml?rev=1087520&view=auto
==============================================================================
--- incubator/rave/donations/ogce-gadget-container/third-party-gadgets/rpctest.xml (added)
+++ incubator/rave/donations/ogce-gadget-container/third-party-gadgets/rpctest.xml Fri Apr
 1 00:29:22 2011
@@ -0,0 +1,114 @@
+<?xml version="1.0" encoding="UTF-8" ?> 
+<Module>
+  <ModulePrefs title="RPC test"
+     title_url=""
+     description="A gadget to test rpc between gadgets and container"
+     height="250" 
+     screenshot=""
+     thumbnail=""
+     scrolling="true"
+     author="Gerald Guo"
+     author_affiliation="CGL, IU"
+     author_email="zhguo@indiana.edu" 
+     author_location="Innovation Center, IU"
+	 category="tools"
+     author_link=""
+     author_photo=""
+     author_aboutme=""
+     author_quote="" >
+  <Require feature="rpc"/>
+  <Require feature="dynamic-height"/>
+  </ModulePrefs>
+
+  <UserPref name="action_domain" datatype="string" 
+    default_value="@gadgetServerLocation@"
+    display_name="Form Action Domain" />
+  <UserPref name="action_path" datatype="string" 
+    default_value="/test-myproxy-webapp/defaultcert"
+    display_name="Form Action Path" />
+
+  <Content type="html" view="home, canvas">
+     <![CDATA[
+     <!-- <script type="text/javascript" src="http://code.jquery.com/jquery-1.4.2.min.js"/>
-->
+     <script type="text/javascript">
+      function echoCb(msg) {
+        setMsg("message has been recieved from container:<br>" +
+          msg.replace(/\n/g, "<br>"));
+      }
+
+      function sendMsg() {
+        var form = document.getElementById("main_form");
+        var msg = form.msg.value;
+        gadgets.rpc.call("..", "echo", echoCb, msg);
+      }
+
+      function setMsg(msg) {
+        var ele = document.getElementById("resultDiv");
+        ele.innerHTML = msg;
+      }
+
+
+      function getUserInfoCB(msg) {
+        var obj = eval('('+msg+')');
+        var form = document.getElementById("get-default-cert-form");
+        form.username.value = obj.username;
+
+        // Form
+        // form.submit();
+
+        // Ajax version
+        var params = {};
+        params[gadgets.io.RequestParameters.AUTHORIZATION] = gadgets.io.AuthorizationType.NONE;
+        params[gadgets.io.RequestParameters.CONTENT_TYPE] = gadgets.io.ContentType.TEXT;
+        params[gadgets.io.RequestParameters.HEADERS] = {'Accept': 'application/json'};
+        params[gadgets.io.RequestParameters.REFRESH_INTERVAL] = 1;
+        var prefs = new gadgets.Prefs();
+        var url = prefs.getString('action_domain') + prefs.getString('action_path');
+        url += ';JSESSIONID=' + obj.sessionId +'?username='+obj.username;
+        url += '&myproxy_action=get-default-cert';
+
+        gadgets.io.makeRequest(url, htmlCallback, params);
+      }
+
+      function htmlCallback(result) {
+        var rawText = result.text;
+        var errors = result.errors;
+        if (errors.length > 0) {
+          alert("Error occurred during makerequest invocation");
+        } else {
+          var data = result.data;
+          setMsg(data);
+        }
+      }
+
+      function fetchInfoFromCt () {
+        gadgets.rpc.call("..", "getUserInfo", getUserInfoCB);
+      }
+    </script>
+
+    <div class="authsec">
+      <h2>RPC Test</h2>
+      <form method="POST" action="#" id="main_form">
+        <span class="fieldName">Message: </span>
+        <input type="text" name="msg"><br>
+        <input type="submit" onclick="javascript: sendMsg(); return false;" value="Submit">
+      </form>
+
+      <h2>MyProxy Cert Test</h2>
+      <form method="POST" action="/test-myproxy-webapp/defaultcert"
+        id="get-default-cert-form">
+        <input type="hidden" name="username" value="">
+        <input type="hidden" name="myproxy_action" value="get-default-cert">
+        <input type="Submit"
+          onclick="javascript: fetchInfoFromCt(); return false;"
+          value="Get default cert">
+      </form>
+
+      <div id="resultDiv" style="font-weight:bold">
+      </div>
+    </div>
+
+    ]]>
+  </Content> 
+</Module>
+

Added: incubator/rave/donations/ogce-gadget-container/third-party-gadgets/rssreader.xml
URL: http://svn.apache.org/viewvc/incubator/rave/donations/ogce-gadget-container/third-party-gadgets/rssreader.xml?rev=1087520&view=auto
==============================================================================
--- incubator/rave/donations/ogce-gadget-container/third-party-gadgets/rssreader.xml (added)
+++ incubator/rave/donations/ogce-gadget-container/third-party-gadgets/rssreader.xml Fri Apr
 1 00:29:22 2011
@@ -0,0 +1,220 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<Module>
+<ModulePrefs title="RSS reader" title_url="http://upper88.com" directory_title="RSS Reader"

+    render_inline="never" scrolling="false"
+    description="Feed Reader that handles multiple RSS feeds. Easy setup of feeds and an
expandable list of feeds. Feeds to show, number of days to list and title can all be set.
Mouseover showing start of text." 
+    screenshot="http://jubic.googlecode.com/svn/images/rssreaderdump.png" singleton="false"

+    thumbnail="http://jubic.googlecode.com/svn/images/rssreaderthumb.png" 
+    author="Erik Wetterberg" 
+    author_email="erik@upper88.com" author_affiliation="upper88.com" 
+    author_photo="http://jubic.googlecode.com/svn/images/Erik.jpg" 
+    author_aboutme="Gadget developer from Sweden. Send me an email if want your gadget idea
realized. Also knows MySql, Java, Ajax, PHP and XML." 
+    author_link="http://eriksdiary.blogspot.com/" author_quote="Experience is what makes
you recognize a mistake when you make it again."
+    author_location="Helsingborg, Sweden"  >
+<Require feature="dynamic-height" />
+<Require feature="setprefs"/>
+<Require feature="settitle"/>
+<Require feature="analytics"/>
+</ModulePrefs>
+<UserPref name="title" datatype="string" default_value="RSS reader" display_name="Title"
/>
+<UserPref name="days" datatype="string" default_value="360" display_name="Don't show entries
older than ... days" />
+<UserPref name="expand" datatype="bool" default_value="false" display_name="Auto-expand
feeds" />
+<UserPref name="setup" datatype="bool" default_value="true" display_name="Allow user to
change feeds" />
+<UserPref name="feeds" datatype="string" default_value="http://collab-ogce.blogspot.com/feeds/posts/default;http://news.teragrid.org/feeds/rss-gateways.rss;http://news.teragrid.org/feeds/rss-tg-wide.rss"/>
+<Content type="html">
+<![CDATA[
+<style type="text/css">
+        body { margin: 0px;font: arial; font-size: 8pt;} 	
+	a         { color: #596F3E; text-decoration: none;}	
+	a:visited { color: #C7CFA8; font-weight: normal; }	
+	a:hover   { color: #1C57A9; text-decoration: underline;}
+        a.item    { margin: 10px;}
+        a.title   { font-size: 9pt;font-weight: bold;}
+        a.title:visited {color: #596F3E;  text-decoration: none;}
+        a.tgl     { color: #596F3E; font-size: 12pt;font-weight: bold;}
+        a.switch, a.switch:visited { color: #596F3E; position:absolute; top:0px; right:0px;
font-weight: bold; padding-bottom:5px;}
+        td        { color: black; font-size: 8pt;}
+        td.date   { white-space:nowrap;}
+        img       {border-style: none;}
+ 
+</style>
+<script type="text/javascript" src="gadget-migration.js"></script> 
+
+<script type="text/javascript">
+    var month=new Array(12);
+    month[0]="Jan";
+    month[1]="Feb";
+    month[2]="Mar";
+    month[3]="Apr";
+    month[4]="May";
+    month[5]="Jun";
+    month[6]="Jul";
+    month[7]="Aug";
+    month[8]="Sep";
+    month[9]="Oct";
+    month[10]="Nov";
+    month[11]="Dec";
+    function tgl(e_id) {
+      var e = document.getElementById(e_id);
+      if (e.style.display == "none") {
+         e.style.display= "block";
+      } else {
+         e.style.display= "none";
+      }
+      _IG_AdjustIFrameHeight();
+      return true;
+    }
+    function setup(){
+      document.getElementById("main").style.display = "none";
+      document.getElementById("setup").style.display = "block";
+      var html = '<TABLE border="0" cellspacing="1" cellpadding="0" width="90%">';
+          html += '<TR><TD>&nbsp;</TD><TD><B>Add/Remove
feeds</B></TD></TR>';
+      for (var i = 0; i < feeds.length; i++) {
+         if(feeds[i].length > 0) {
+         html += '<TR>' + 
+           '<TD><a href="javascript:deleteFeed(' + i + ')\">'+
+              '<img title="Delete feed" src="http://jubic.googlecode.com/svn/images/del.gif">'
+
+            '</a></TD>' +
+             '<TD>'+feeds[i]+'</TD>'+
+            '</TR>';
+         }
+       }
+      html += '<TR><TD colspan="2">&nbsp;</TD></TR></TABLE>';
+      document.getElementById("setuptable").innerHTML = html;
+      _IG_AdjustIFrameHeight();
+    }
+    function addFeed(){
+       if(document.getElementById("newURL").value == "")
+          return;
+       var feedstring = prefs.getString("feeds");
+       if(feedstring.length > 0){
+         feedstring += ";";
+       }
+       feedstring +=  document.getElementById("newURL").value;
+       prefs.set("feeds", feedstring);
+       feeds = prefs.getString("feeds").split(";");
+       document.getElementById("newURL").value = "";
+       setup();
+    }
+    function deleteFeed(num){
+       var feedstring = "";
+       for (var i = 0; i < feeds.length; i++) {
+         if(i != num && feeds[i].length > 1){
+           if(feedstring.length > 0)
+              feedstring += ";";
+           feedstring +=  feeds[i];
+         }
+       }
+
+       prefs.set("feeds", feedstring);
+       feeds = prefs.getString("feeds").split(";");
+       setup();
+    }
+    function main(){
+      document.getElementById("setup").style.display = "none";
+      document.getElementById("main").style.display = "block";
+      document.getElementById("feeds").innerHTML = "";
+      for (var i = 0; i < feeds.length; i++) {
+          if(feeds[i].length > 1)
+            _IG_FetchFeedAsJSON(feeds[i], set_content, 20, true);
+      }
+      _IG_AdjustIFrameHeight();
+    }
+    function dateString(d){
+       if(d.getFullYear() == now.getFullYear() && 
+          d.getMonth() == now.getMonth()){
+          if(d.getDate() == now.getDate())
+             return d.getHours()+ ':'+pad(d.getMinutes());
+          else if (d.getDate() == now.getDate() -1)
+             return 'yesterday';
+       }
+       return pad(d.getDate()) + "-" + month[d.getMonth()];
+    }
+    function pad(num){
+      if(num < 10)
+          return "0"+num;
+      return num;
+    }
+    function unHtml(str){
+      return str.replace(/<br>/ig,'\n').replace(/<[^>]*>/ig,'').replace(/\n\n/g,'\n');
+    }
+    function set_content(feed){
+      var html = '';
+      var cnt = 0;
+      var tblid = "t" + feednum;
+      feednum ++;
+      var limitday = new Date();
+      limitday.setDate(limitday.getDate() - days);
+      for (var i = 0; i < feed.Entry.length; i++) 
+      {
+        var milliseconds = (feed.Entry[i].Date);  // * 1000; 
+        var date = new Date(milliseconds); 
+        if(date > limitday){
+          html += '<tr><td width="90%"><a class="item" href="' + _hesc(feed.Entry[i].Link)
+'" ' ; 
+          html += 'title="' + _hesc(unHtml(feed.Entry[i].Summary))  + '" target="_blank">';
+          html += _hesc(feed.Entry[i].Title) + '</a></td><td class="date"
width="100%">'+ dateString(date) + '</td></tr>';
+          cnt ++;
+        }
+      }
+      var head;
+      if(cnt > 0){
+        head = '<a class="tgl" href="#" onclick="return tgl(\'' + tblid + '\')">+&nbsp;&nbsp;</a>';
+      } else {
+        head = '&nbsp;&nbsp;&nbsp;';
+      }
+      var style = "display:none;";
+      if(prefs.getBool("expand")){
+          style = "display:block;";
+      }
+     document.getElementById("feeds").innerHTML +=  head +
+                                 '<a class="title" href="' + _hesc(feed.Link) + '" target="_blank">'
+
+                                 _hesc(feed.Title) + '</a> ('+cnt+' items)<br />'
+
+                                 '<TABLE id="'+ tblid +'" style="' + style + '" border="0"
cellspacing="0" cellpadding="0" width="100%">' + html + '</TABLE>';
+      _IG_AdjustIFrameHeight();
+    }
+    var now = new Date();
+    var feednum = 0;
+    var prefs = new _IG_Prefs(__MODULE_ID__);
+    var days = prefs.getString("days");
+    var title = prefs.getString("title");
+    var feeds = prefs.getString("feeds").split(";");
+_IG_RegisterOnloadHandler(
+  function loadRSSReader(){
+    if(!prefs.getBool("setup")){
+      document.getElementById("setuplink").style.display = "none";
+    }
+    _IG_SetTitle(title);
+    _IG_Analytics("UA-1752404-1", "/rssreader_view");
+    for (var i = 0; i < feeds.length; i++) {
+        if(feeds[i].length > 1)
+          _IG_FetchFeedAsJSON(feeds[i], set_content, 20, true);
+    }
+    _IG_AdjustIFrameHeight();
+  }
+)
+</script>
+		  <div id="main" style="display:block; padding-bottom:15px;">
+			 <div id="header" style="display:block; padding-bottom:5px;">
+				<a id="setuplink" class="switch" href="#" onclick="setup();">Feeds</a>
+			 </div>
+			 <p/>
+			 <div id="feeds" style="display:block"></div>
+		  </div>
+		  <div id="setup" style="display:none"><a class="switch" href="#" onclick="main();">Back</a>
+			 <form name = "setupRssReader" onsubmit="addFeed()">
+				<div id="setuptable"></div>
+				<table cellspacing=0 style='width:90%'>
+				  <tr>
+					 <td style='width:100%' >
+						<input id="newURL" type="text" style='width:100%'>
+						</td>
+						<td>
+						  <input type = "button" value="Add" onclick = "addFeed()">
+						  </td>
+						</tr>
+					 </table>
+				  </form>
+				</div>
+				]]>
+</Content>
+</Module>



Mime
View raw message