#
# WARNING: This type of command file is *only* meant to demonstrate
# the overall idea of proglets; you should not use this in production
# context as the CI variable dereferencing used here in the example
# is not safe against misuse by a malicious person at the browser,
# unless you take care to remove "special" characters from the input
# strings received from the browser request.
#
while setvar(http, input("HTTP> ")) <> "EXIT" do
  if http = "GET" then
    input pathinfo, "PATHINFO> "
    if pathinfo = "/showjob" then
      echo !<html!>
      echo !<title!>MPE Proglet Demo!</title!>
      echo !<h1!>ShowJob!</h1!>
      echo !<pre!>
      showjob
      echo !</pre!>
      echo !<address!>Lars Appel, March 2000!</address!>
      echo !</html!>
    elseif pathinfo = "/showme" then
      echo !<html!>
      echo !<title!>MPE Proglet Demo!</title!>
      echo !<h1!>ShowMe!</h1!>
      echo !<pre!>
      showme
      echo !</pre!>
      echo !<address!>Lars Appel, March 2000!</address!>
      echo !</html!>
    elseif pathinfo = "/pause" then
      setvar querystring "10"
      input querystring, "QUERYSTRING> "
      echo !<html!>
      echo !<title!>MPE Proglet Demo!</title!>
      echo !<h1!>Pause!</h1!>
      echo !<pre!>
      echo pause !querystring
      pause !querystring
      echo !</pre!>
      echo !<address!>Lars Appel, March 2000!</address!>
      echo !</html!>
    elseif pathinfo = "/listredo" then
      echo !<html!>
      echo !<title!>MPE Proglet Demo!</title!>
      echo !<h1!>ListRedo!</h1!>
      echo !<pre!>
      listredo
      echo !</pre!>
      echo !<address!>Lars Appel, March 2000!</address!>
      echo !</html!>
    else
      echo !<html!>
      echo !<title!>MPE Proglet Demo!</title!>
      echo !<h1!>Welcome to my 2nd CI Proglet!</h1!>
      echo !<ul!>
      echo !<li!>!<a href="/servlet/cmdfile2/showjob"!>ShowJob!</a!>
      echo !<li!>!<a href="/servlet/cmdfile2/showme"!>ShowMe!</a!>
      echo !<li!>!<a href="/servlet/cmdfile2/pause?20"!>Pause 20!</a!>
      echo !<li!>!<a href="/servlet/cmdfile2/listredo"!>ListRedo!</a!>
      echo !</ul!>
      echo !<address!>Lars Appel, March 2000!</address!>
      echo !</html!>
    endif
  else
    echo !<html!>
    echo !<title!>MPE Proglet Demo!</title!>
    echo !<p!>Method !http is not supported by this Proglet!</p!>
    echo !</html!>
  endif
endwhile
#
# Usage:
#   http://your3k/servlet/cmdfile2/menu
#
# Dirty:
#   http://your3k/servlet/cmdfile2/pause?60
#   http://your3k/servlet/cmdfile2/pause?ouch
#