%D \module
%D   [       file=x-e-0103,
%D        version=2002.12.16,
%D          title=\EXAMPLE\ Base Files,
%D       subtitle=Simple Status Report,
%D         author=Hans Hagen,
%D           date=\currentdate,
%D      copyright={PRAGMA / Hans Hagen \& Ton Otten}]
%C
%C This module is part of the \CONTEXT\ macro||package and is
%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
%C details.

%D This is experimental code. Don't change it, don't rely on
%D this interface remaining the same, don't use tricks used
%D here but not described in manuals, so: assume that this
%D file does not exists.
%D
%D Although \unknown\ this file may learn users a few style
%D tricks.
%D
%D \starttyping
%D texexec --use=e-0103 --pdf [--mode=error] report.exa
%D \stoptyping

%  todo: mode reposit: green

\usemodule[e-0100]

% \startmode[reposit]

%   \definecolor [MainColor] [g=.5]

% \stopmode

\setupwhitespace[none] \setuptabulate[before=,after=]

\defineXMLenvironment
  [exa:report]
  {\setups[report:start]}
  {\setups[report:stop]}

\defineXMLprocess[exa:application]
\defineXMLprocess[exa:client]
\defineXMLprocess[exa:server]

\defineXMLprocess[exa:request]

\defineXMLsavecontent [exa:time]        \unknown
\defineXMLsavecontent [exa:address]     \unknown
\defineXMLsavecontent [exa:port]        \unknown
\defineXMLsavecontent [exa:requestfile] \unknown
\defineXMLsavecontent [exa:replyfile]   \unknown
\defineXMLsavecontent [exa:comment]     \unknown

\defineXMLsavecontent [exa:command]     \unknown
\defineXMLsavecontent [exa:option]      \unknown
\defineXMLsavecontent [exa:output]      \unknown
\defineXMLsavecontent [exa:archive]     \unknown
\defineXMLsavecontent [exa:producer]    \unknown

\defineXMLsavecontent [exa:computer]    \unknown
\defineXMLsavecontent [exa:timestamp]   \unknown
\defineXMLsavecontent [exa:domain]      \unknown
\defineXMLsavecontent [exa:project]     \unknown
\defineXMLsavecontent [exa:username]    \unknown

\defineXMLsavecontent [exa:resulturl]       \empty
\defineXMLsavecontent [exa:resultfile]      \empty
\defineXMLsavecontent [exa:resultsize]      \unknown
\defineXMLsavecontent [exa:resultusername]  \empty
\defineXMLsavecontent [exa:resultpassword]  \empty

\startsetups [report:start]

  \starttext

  \startXMLignore

\stopsetups

\startsetups [report:stop]

  \setups[report:status]

  \expanded{\doiffileelse{\XMLflush{exa:requestfile}}}
     {\readlocfile{\XMLflush{exa:requestfile}}{}{}
      \setups[report:request]}
     {}

  \expanded{\doifsomething{\XMLflush{exa:resulturl}}}
    {\setups[report:result]}

  \stopXMLignore

  \stoptext

\stopsetups

\startsetups[report:status]

  \subject{Status}

  \starttabulate[|l|lpT|]
    \NC time      \NC \XMLflush {exa:time}        \NC \NR
    \NC address   \NC \XMLflush {exa:address}     \NC \NR
    \NC port      \NC \XMLflush {exa:port}        \NC \NR
    \NC version   \NC \contextversion             \NC \NR
    \NC request   \NC \XMLflush {exa:requestfile} \NC \NR
    \NC reply     \NC \XMLflush {exa:replyfile}   \NC \NR
    \NC comment   \NC \XMLflush {exa:comment}     \NC \NR
  \stoptabulate

\stopsetups

\startsetups[report:request]

  \subject{Request}

  \starttabulate[|l|lpT|]
    \NC command   \NC \XMLflush{exa:command}      \NC \NR
    \NC option    \NC \XMLflush{exa:option}       \NC \NR
    \NC output    \NC \XMLflush{exa:output}       \NC \NR
    \NC archive   \NC \XMLflush{exa:archive}      \NC \NR
    \NC producer  \NC \XMLflush{exa:producer}     \NC \NR
    \NC computer  \NC \XMLflush{exa:computer}     \NC \NR
    \NC timestamp \NC \XMLflush{exa:timestamp}    \NC \NR
    \NC domain    \NC \XMLflush{exa:domain}       \NC \NR
    \NC project   \NC \XMLflush{exa:project}      \NC \NR
    \NC username  \NC \XMLflush{exa:username}     \NC \NR
  \stoptabulate

\stopsetups


\startsetups[report:result]

  \subject{Result}

  \starttabulate[|l|lpT|]
    \NC download  \NC \goto {\XMLflush {exa:resultfile}} [url(\XMLflush {exa:resulturl})] \NC \NR
    \NC username  \NC \XMLflush{exa:resultusername} \NC \NR
    \NC password  \NC \XMLflush{exa:resultpassword} \NC \NR
  \stoptabulate

\stopsetups

\processXMLfile{\inputfilename}
