0 Replies Latest reply on Jan 13, 2014 5:20 AM by sven.vetter

    Jive7: Integrate outlook calendar in user profile page

    sven.vetter

      Result (click to enlarge):

      Screen Shot 2014-01-13 at 14.11.26 .png

       

      With the new app actions it is easy to integrate other information in existing pages. As an example I integrated the outlook calendar (via Outlook Web Access) in the user profile page.

      This need only some line of code...

       

      app.xml:

      • new action
      • a html page for this action

      <action id="com.trivadis.util.calendar" path="jive/tabs/profile" label="Calendar" view="embedded.calendar" />

      ...

      <Content view="embedded.calendar" type="html" href="calendar.html" preferred_width="800"/>

       

       

      calendar.html:

      • an easy html page with an empty iframe

      <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"

         "http://www.w3.org/TR/html4/strict.dtd">

       

      <html lang="en">

      <head>

         <meta charset="utf-8">

         <script type="text/javascript" charset="utf-8" src="javascripts/calendar.js"></script>

      </head>

      <body>

        <iframe width="100%" height="500" id="calFrame">  </iframe>

      </body>

      </html>

       

      calendar.js:

      • Line 5: read the context (= user id)
      • Line 7: read the mail adress
      • Line 12: create the outlook web access link (to be changed...)
      • Line 13: refresh the iframe

       

      // JavaScript to display the outlook calendar
      gadgets.util.registerOnLoadHandler(init);
      
      function init() {
        osapi.jive.core.container.getLaunchContext(function(response) { // get context (ID des Profiles)
          var vID = response.jive.content.id;
          osapi.jive.corev3.people.get({
            id: vID,
            fields: "emails"
          }).execute(function(response) { // get full profile
            var vMail = response.emails[0].value; // email auslesen
            var vLink = "https://intranet.trivadis.com/owa/" + vMail + "/?cmd=contents&module=calendar";
            $("#calFrame").attr('src', vLink); // iframe aktualisieren
            gadgets.window.adjustHeight();
          });
        });
      };