Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 87c03b58 authored by Megha Joshi's avatar Megha Joshi Committed by Android Git Automerger
Browse files

am 7a1f15b1: Merge "Integrating webinar hosting with developer.android.com" into gingerbread

* commit '7a1f15b1':
  Integrating webinar hosting with developer.android.com
parents af22f4f1 7a1f15b1
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -29,6 +29,10 @@ techniques that you find in the samples!</dd>
<dd>Links to the Android discussion groups and information about other ways to
collaborate with other developers. </dd>

<dt><b>Webinars</b></dt>
<dd>Online training videos on wide range of Android topics
coupled with live IRC chat sessions for discussions. </dd>

<dt><b>More</b></dt>
<dd>Quick development tips, troubleshooting information, and frequently asked
questions (FAQs). </dd>
+12 −2
Original line number Diff line number Diff line
@@ -270,8 +270,18 @@
      </li>
    </ul>
  </li>


  <!-- Webinar section -->
  <li>
    <h2><span class="en">Webinars</span></h2>
    <ul>
      <li><a href="<?cs var:toroot ?>resources/webinars/webinar-watch.html">
            <span class="en">Watch a Webinar</span>
          </a></li>     
      <li><a href="<?cs var:toroot ?>resources/webinars/webinar-upcoming.html">
            <span class="en">Upcoming Schedule</span>
          </a></li>
    </ul>
  </li>

  <li>
    <h2><span class="en">More</span>
+100 −0
Original line number Diff line number Diff line
// Copyright 2009 Google Inc. All Rights Reserved.

/**
 * @fileoverview Utility functions for formating date.
 */

/**
 * Formats start date and end date in JSON format to string of format:
   "09/09/2010 20:00 PM to 22:00 PM PST"
 * @param {object} start date in JSON format.
 * @param {object} end date in JSON format.
 * @param {string} formatted date string.
 */
function formatDate(start,end) {
  var s_ampm = null;
  var e_ampm = null;

  var toStr = function (num) {
    if (num <= 12) {
      return "" + num;
    } else {
      return "" + (num - 12);
    }
  };

  var getMonthName = function (num) {
    switch(num) {
      case 1:
        return 'January';
      case 2:
        return 'February';
      case 3:
        return 'March';
      case 4:
        return 'April';
      case 5:
        return 'May';
      case 6:
        return 'June';
      case 7:
        return 'July';
      case 8:
        return 'August';
      case 9:
        return 'September';
      case 10:
        return 'October';
      case 11:
        return 'November';
      case 12:
        return 'December';
     }
  }

  var regex =  /(^\d{4})-(\d{2})-(\d{2})\s{1}(\d{2}):(\d{2}):(\d{2}$)/;
  var s_match = regex.exec(start.toString());

  if( s_match == null) {
   return '';
  }
  var yy = s_match[1];

  var mm = parseInt(s_match[2], 10 /** base 10 **/);
  var dd = s_match[3];

  var s_hh = parseInt(s_match[4], 10 /** base 10 **/);
 
  if (s_hh > 12) {
    s_ampm = "PM";
  } else {
    s_ampm = "AM";
  }
  s_hh = toStr(s_hh);
  var s_mi = s_match[5];


  var str =  getMonthName(mm) + " " +  dd + ", " + yy ;
  str += " " + s_hh + ":" + s_mi;
  str += " " + s_ampm;

  regex =  /(^\d{4})-(\d{2})-(\d{2})\s{1}(\d{2}):(\d{2}):(\d{2}$)/;
  var e_match = regex.exec(end.toString());
  if( e_match == null) {
   return str + ' PST';
  }
  var e_hh = parseInt(e_match[4], 10 /** base 10 **/);
  if (e_hh > 12) {
    e_ampm = "PM";
  } else {
    e_ampm = "AM";
  }
  e_hh = toStr(e_hh);
  var e_mi = e_match[5];

  str += " to " + e_hh + ":" + e_mi;
  str += " " + e_ampm;
  str += " PST";
  return str;

}
+53 −0
Original line number Diff line number Diff line
page.title=Upcoming Schedule
@jd:body

<script type="text/javascript">

/**
/* Draw all webinars from feed into a 'webinars' div
 * @param data  The feed data returned from the webinars request
 */
function renderWebinar(data) {

  var entries = data.webinars || [];

  var resultsDiv = $('#resource-browser-results');
  var code = [];

  // Loop through each entry (each webinar) and add it to the 'webinars' list
  for (var i = 0; i < entries.length; i++) {
    var entry = entries[i];

    var title = entry.title;
    var description = entry.description;
    var url = entry.url;
    var start = entry.start;
    var end = entry.end;

    code.push('<div>');
    code.push('<h3>' + title + '</h3>');
    code.push('<p ><i>' + formatDate(start, end) + '</i>');
    code.push('<p>' + description);
    code.push('</div>');
  }

  var html = code.join('\n');
  resultsDiv.html(html);
}

/* Request the webinar feeds from webinarhosting server */
function showWebinars() {
  var script = "<script type='text/javascript' src='/resources/webinars/date.js'><\/script>";
  $("body").append(script);
  $.getJSON(
  'http://android-webinars.appspot.com/feeds/api/upcomingwebinars?callback=?',
  function(json){renderWebinar(json);});
}
// Initialization actions
showWebinars();           // load webinars

</script>


<div id="resource-browser-results">
  </div>
+106 −0
Original line number Diff line number Diff line
page.title=Watch A Webinar
@jd:body

<script type="text/javascript">

/**
 * Draw all webinars from feed into a 'live_webinar' div
 * @param data  The feed data returned from the live webinars request
 */
function renderLiveWebinar(data) {

  var entries = data.webinars || [];

  var resultsDiv = $('#live_webinar');
  var code = [];

  // Loop through each entry (each webinar) and add it to the 'webinars' list
  for (var i = 0; i < entries.length; i++) {
    var entry = entries[i];

    var title = entry.title;
    var description = entry.description;
    var url = entry.url;
    var start = entry.start;
    var end = entry.end;
    code.push('<div >');
    code.push('<h3><b>Live!</b><a href="' + url + '"  target="_blank" onClick=_gaq.push(["_trackEvent", "Live Webinar", "' + title + '"]);>' + title + '</a></h3>');
    code.push('<p ><i>' + formatDate(start, end) + '</i>');
    code.push('<p>' + description);
    code.push('</div>');
  }
  if (entries.length == 0) {
    code.push('<div >');
    code.push('<p>There is currently no live webinar. Watch one of the previous webinars from the list below and check the schedule for <a href="/resources/webinars/webinar-upcoming.html">Upcoming Webinars</a>.');
    code.push('</div>');
  }
  var html = code.join('\n');
  resultsDiv.html(html);
}

/* Request the webinar feeds from webinarhosting server */
function showLiveWebinars() {
  var script = "<script type='text/javascript' src='/resources/webinars/date.js'><\/script>";
  $("body").append(script);
  $.getJSON(
  'http://android-webinars.appspot.com/feeds/api/livewebinar?callback=?',
  function(json){renderLiveWebinar(json);});
}
// Initialization actions
showLiveWebinars();      // load webinars

/**
 * Draw all past webinars from feed into a 'webinars' div
 * @param data  The feed data returned from the webinars request
 */
function renderPastWebinar(data) {

  var entries = data.webinars || [];

  var resultsDiv = $('#past_webinars');
  var code = [];
  code.push('<h2> Past Webinars </h2>');
    
  // Loop through each entry (each webinar) and add it to the 'webinars' list
  for (var i = 0; i < entries.length; i++) {
    var entry = entries[i];

    var title = entry.title;
    var description = entry.description;
    var url = entry.url;
    var start = entry.start;
    var end = entry.end;
    code.push('<div >');
    code.push('<h3><a href="' + url + '"  target="_blank" onClick=_gaq.push(["_trackEvent", "Past Webinars", "' + title + '"]);>' + title + '</a></h3>');
    code.push('<p ><i>' + formatDate(start, end) + '</i>');
    code.push('<p>' + description);
    code.push('</div>');
  }
   if (entries.length == 0) {
    code.push('<div >');
    code.push('<p>There are no past webinars.');
    code.push('</div>');
  }
  var html = code.join('\n');
  resultsDiv.html(html);
}

/* Request the past webinar feeds from webinarhosting server */
function showPastWebinars() {
  var script = "<script type='text/javascript' src='/resources/webinars/date.js'><\/script>";
  $("body").append(script);
  $.getJSON(
  'http://android-webinars.appspot.com/feeds/api/pastwebinars?callback=?',
  function(json){renderPastWebinar(json);});
}
// Initialization actions
showPastWebinars();      // load webinars

</script>



<div id="live_webinar">
  </div>
<div id="past_webinars">
  </div>