Sample Web Application

At this page, we have a sample application that people can try out the functionality of GreenJab, mainly sending a message.

We thought we would share the source for this application since it is quite simple. It does use the eRPG SDK and GreenJab application libraries.

Here is the RPG source for the JABTEST e-RPG Program:

H DFTACTGRP(*NO) BNDDIR('ERPGSDK')
 ****************************************************************
 * Prototypes                                                   *
 ****************************************************************
 /COPY QCOPYSRC,P.ERPGSDK
 /COPY QCOPYSRC,P.GREENJAB
 /COPY QCOPYSRC,P.LIBL
 ****************************************************************
D msgTo           S            256
D msgText         S          32766
 *
D rc              S             10i 0
 ****************************************************************
 /free
  #startup();
  #addlible('GREENJAB':'*LAST');
  #gj_setFromID('greenjabtest@gmail.com');
  #gj_setKey('JABTEST');
  msgTo = #getData('msgto');
  msgText = #getData('msgtext');
  #writeTemplate('stdhtmlheader.erpg');
  #loadTemplate('jabtest1.erpg');
  #loadSection('section1');
  #writeSection();
  #loadSection('section2');
  if (#gj_isActive() > 0);
    #replaceData('/%status%/':'ONLINE!');
      if (msgTo <> ' ') and (msgText <> ' ') and (#gj_isActive() > 0);
        eval rc = #gj_enqMsg(msgTo:msgText);
      endif;
  else;
    #replaceData('/%status%/':'offline');
  endif;
  #writeSection();
  #writeThisSec('section3');
  #cleanup();
  *INLR = *ON;
  #popLib('GREENJAB');
 /end-free

The source for the template is as follows:

 /$section1
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
<html>
<head>
<link href="/stylesheets/standard.css" rel=stylesheet type=text/css>
<script src="/javascript/standard.js"></script>
<script src="/javascript/bvsgetfile.js"></script>
<title>BVS/Tools - GREENJAB Test</title>
</head>
<body>
<table class="main" cellpadding="0" cellspacing="1" border="0">
  <tr>
    <td>
      <!--#include virtual="/ifshtml/header.html" -->
    </td>
  </tr>
  <tr>
    <td class="border">
      <table cellpadding="3" cellspacing="1" border="0" width="100%">
        <tr>
        
/$section2
          <td width="65%">
            <table border="0">
              <tr>
                <td class="heading">
                  GreenJab Test - The server is /%status%/
                </td>
              </tr>
              <tr>
                <td>
                <br>
                Step 1 - In your Google Talk account invite GreenJabTest@gmail.com to be your friend (if you have done this previously you shouldn't need to do it again).<br><br>
                Step 2 - Enter a TO address, and a message and click Submit.<br><br>
                Step 3 - Check your chat client for a message from GreenJabTest@gmail.com!<Br><br>
                
                <b>Note:</b> GreenJabTest will appear offline to your chat client until the invite is accepted, but you should still be able to send messages to your chat client from this page. <br><br>
             <!--Begin Form-->
                 <form name="getfile" action="/cgi-bin/jabtest" method="POST">
                  <table cellpadding="2" cellspacing="0" border="0">
                    <tr>
                      <td>
                        Send to E-Mail:
                      </td>
                      <td>
                        <input type="text" size="50" maxlength="50" name="msgto">
                      </td>
                    </tr>
                    <tr>
                      <td >
                        Message:
                      </td>
                      <td>
                        <textarea rows="5" cols="30" name="msgtext"></textarea>
                      </td>
                    </tr>
                    <tr>
                      <td ></td>
                      <td>
                        <input name="continuebutton" type="submit" value="Submit">
                      </td>
                    </tr>
                  </table>
                  </form>
               <!--End Form-->
                  </td>
              </tr>
            </table>
          </td>
/$section3
          <td class="rightcontent"><!--#include virtual="/ifshtml/whatsnew.html"--></td>
        </tr>
      </table>
    </td>
  </tr>
  <tr>
    <td>
      <!--#include virtual="/ifshtml/footer.html"-->
    </td>
  </tr>
</table>
</body>
</html>