/* strings used in administrative pages to send requests to the server */                                                        
/* Note: svyUserServerHeaders.js contains other headers used in administrative pages */

/* dsurveyVersion (admin):
    The dsurvey version (admin side). 
*/
dsurveyVersionAdmin='SREHTTP2 29March2011'


/* getInstrumentsURL: the URL that   will return a list of instruments.    */
getInstrumentsURL='/dsurvey/dsurvey?todo=1';


/* getInstrumentURL : the basic URL to use to request the contents of an instrument file . 
   Note that a xml file name (of the instrument file) will be added at the end of this.
   Thus, if an instrument stored in myInst.xml is desired, and the url is /dsurvey/dsurvey?todo=2&file='
   then the requested URL will be:  /dsurvey/dsurvey?todo=2&file=myInst.xml
*/
getInstrumentURL='/dsurvey/dsurvey?todo=2&file=';


/* getSessionExistsURL : the basic URL to use to request if a session file exists. 
   Note that a xml file name will be added at the end of this.
   Thus, if a sessionName of  mySession is desired, and the url is /dsurvey/dsurvey?todo=3&name='
   then the requested URL will be:  /dsurvey/dsurvey?todo=3&name=mySession
   The server should return a 0 if no such session file exists, a 1 if it does exist
*/
getSessionExistsURL='/dsurvey/dsurvey?todo=31&name=';

/*  postFileURL : 
      The basic url to use to "post" an XML file to the server to be saved as a session-descriptor file.
      Used with both postSessionFilesHeader and postFileHeader
      This is used as the URL in POST request, hence should NOT contain ?arguments.

   postSessionFilesHeader: Used to instruct save session descriptor file, and to copy a list of  "instrument default" files to "session specific files".
                          These files will NOT be modified -- they will just be copied.
      The body of the POST will look like:
         postSessionFilesHeader&name=sessionName&instName=iName&file=filename&doScenarios=1&content=escaped_verbatim_xmlFile
      where "postSessionFilesHeader" is the contents of the postSessionFilesHeader variable
                sessionName = the session name you enter
                iName = the instrument name
                doScenarios=1 : copy SC_*.XML files (from instrument to session directory)
                FileList =  a comma delimited list of filenames, that has been "escaped" (%2c used instead of comma)
                ovewrite=1 : optional -- force overwrite of session descriptor file
                escaped_verbatim_xmlFile = the contents of the session specific "instrument" xmlFile, 'escaped' for safe transmission
       Note that the instrument name is used to find the instrument's directory


  postInstrumentFileHeader: used to instrument specific XML parameters  (that may have been modified).

     The body of the POST will look like:
         postInstrumentFileHeader&name=instrumentName&file=iFileName&content=escaped_verbatim_xmlFile
      where "postInstrumentFileHeader" is the contents of the postInstrumentFileHeader variable
                instrumentName = the instrument's name
                iFileName = the  xml file ( observation, general parameters, or other) file to create (or overwrite)
                escaped_verbatim_xmlFile = the contents of the xmlFile, 'escaped' for safe transmission


  postFileHeader: used to session specific XML parameters  (that may have been modified).
                  These will overwrite session specific files of the same name

     The body of the POST will look like:
         postFileHeader&name=sessionName&file=iFileName&content=escaped_verbatim_xmlFile
      where "postFileHeader" is the contents of the postFileHeader variable
                sessionName = the session name
                iFileName = the  xml file ( observation, general parameters, or other) file to create (or overwrite)
                escaped_verbatim_xmlFile = the contents of the xmlFile, 'escaped' for safe transmission





*/
postFileURL='/dsurvey/dsurvey';
postSessionFilesHeader='todo=4';

postScenarioFilesHeader='todo=41';


postFileHeader='todo=7';

postInstrumentFileHeader='todo=76';

/* getSessionDataURL:   the basic URL to use to request the contents of one of a session's data file  (such as a general parameters file)
   a "name=sessionName&file=Params_FILE" are added  */
getSessionDataURL='/dsurvey/dsurvey?todo=6&';

/* getInstrumentDataURL:   the basic URL to use to request the contents of one of an instrument's data file  (such as a general parameters file)
   a "name=instrumentName&file=Params_FILE" are added  */
getInstrumentDataURL='/dsurvey/dsurvey?todo=61&';


/* getSuspendedDescriptorURL : the basic URL to use to request the contents of a suspended session-dsecriptor file (an XML file).
   Note that the session name will be added at the end of this.
*/
getSuspendedDescriptorURL='/dsurvey/dsurvey?todo=33&name=';



/* setServerVarURL: the base URL used to create a "session specific" variable. This variable will
   be queried for by clients. Ideally, it should be retained in form easily for quick delivery
   (as a plain text string.
   The following will be added to the setServerVarURL :     
       session=sessname&varname=aVarname&delim=adelim&value=Avalue
   where
        sessName: the survey session 
        varname: variable to be saved
        aValue : "escaped" value of the variable
        delim: a delimiter (used only if multiple varnames)
   The server should return an "ok" if the variable was properly saved.
   Otherwise, an error message that begins with a "-"
*/
setServerVarURL='/dsurvey/dsurvey?todo=121&' 


/* setServerStatusVarURL: the base URL used to create a "session specific" status variable. 
  This variable will be queried for by clients, such as when a participant is joining
  Ideally, it should be retained in form easily for quick delivery  (as a plain text string)
   The following will be added to the setServerVarURL :     
       session=sessname&varname=aVarname&value=Avalue
   where
        sessName: the survey session 
        varname: variable to be saved
        aValue :  value of the variable
   The server should return an "ok" if the variable was properly saved.
   Otherwise, an error message that begins with a "-"
*/
setServerStatusVarURL='/dsurvey/dsurvey?todo=131&' 


/* postClientFileBody: the body used to "post" a client-accessible file
   The following will be added to the postClientFileBody
        session=sessname&type=atype&contents=escapedXMLfile
     where atype is one of SESSION, ROUND, or OTHER
    Note: the URL will be postFileURL
*/
postClientFileBody='todo=124'


/* getUserStatusURL: get a string containing the status of the current participants.
    id, atime, message=amessage
 each on a seperate line
 session=sessionName will be appended
*/
getUserStatusURL='/dsurvey/dsurvey?todo=322&'


/* backupSessionURL: the base url to backup a sessions data files.
        a) session descriptor file
        a) submitted data
        b) list of participants
        c) history of submissions
        d) all session specific xml files (including reference data, user and general parameters, and control panel) 
   &session=sessName is added to the end
*/
backupSessionURL='/dsurvey/dsurvey?todo=421'; 

/*  getUserListURL: the base url to request a list of users (in an xml file )
  The following will be added to getUserListURL
        session=sessName

 The returned file syntax should be something like  (the session and created nodes are purely descriptive, 1 <user>
 note for every participant, name nickname and contact are always subnodes.)

 <?xml version="1.0" encoding="UTF-8" ?>
 <users>
    <session value="sessname" />
    <created>date and time </created>
     <user id="53301924269913"><name>A2</name><contact></contact><nickname></nickname><refid></refid></user>
     <user id="3871111421218145"><name>A3</name><contact></contact><nickname></nickname><refid></refid></user>
     <user id="7424969263627784"><name>A4</name><contact></contact><nickname></nickname><refid></refid></user>
 </users>


Note:
   name: 1-word name, provided when a user joins
   contact: contact info, provided when a user joins. This is optional-- if not provided, a '' is used
   nickname: a nickname, provided when a user joins. This is optional-- if not provided, a '' is used
*/
getUserListURL='/dsurvey/dsurvey?todo=202&'


/* postParticipantFile: post a quasi-XML file containing list of participants 
   The following "input" element is added to the form used to force this post request
        session=sessName&contents=escaped_xml_file
   Note: in the post request, uses postFileUrl
*/
postParticipantFile="todo=213&";
  

/* echoFileName and Value: used to echo a file back to browser, with a content-disposition: attachment; filename=...
   This is used as the header of the body of  a post to the server.
   The following "input" element is added to the form used to force this post request
        name="echoFileName" value=echoFileValue
   Note that
         a name="filename" input element will also be added -- default filename to use to save to disk (see viewSubmittedAsXML for details)
         a name="contents" input element will also be added  -- unescaped contents of file to save (see viewSubmittedAsXML for details)
*/
echoFileName='todo';
echoFileValue='500';


/* uploadFileName and Value: used to upload a file to browser
   This is used as input fields in an enctype of "multipart/form-data"
*/
uploadFileName='todo';
uploadFileValue='77';



/* getSubmittedDataURL: return an XML file containing all submitted data.
   session=sessName will be appended to the end of this 
*/
getSubmittedDataURL='/dsurvey/dsurvey?todo=403&';

/* updateSubmittedDataURL: tell server to append "current round" submitted data to "all round" submitted data, and to clear
  "current round" submitted
 session=sessName will be appended to the end of this 
 */
updateSubmittedDataURL='/dsurvey/dsurvey?todo=4031&';

/* getSubmitMessages: return a crlf delimited string containing the list of submit-messages
   session=sessName will be appended to the end of this 
*/
getSubmittedMessagesURL='/dsurvey/dsurvey?todo=405&';

/* killSessionURL: delete session specific files and directories.
        session=sessName&step=n&fake=k
    will be added,
        step=n  : with n=1,2,3, or 4 (descriptor, parameter and submitted data files, temporary data files, client-accessible files)
        fake=k:  k=1 means "don't actually delete, just report what would be deleted. k=0 means "do it!"
*/
killSessionURL='/dsurvey/dsurvey?todo=600&';


/* suspendSessionURL: suspend a session
   session=sessName will be added 
*/
suspendSessionURL='/dsurvey/dsurvey?todo=601&';

/* unSuspendSessionURL: unsuspend a session
   session=sessName will be added 
*/
unSuspendSessionURL='/dsurvey/dsurvey?todo=602&';


/* saveSelectionFile: save the dsurvey.htm file -- list of sessions to chose from 
  add contents=escaped_file
*/
saveSelectionFile='todo=802&';


/* svySetSMTP
   The header to use to set/retrieve SMTP parameters
   svySetSMTPtodo is used to append a "todo=svySetSMTPtodo" after svySetSMTP
 
   Thus, the url starts with: svySetSMTP+'?todo='+svySetSMTPtodo+'&'

   The following is appended (to set values):
       smtpGateway=ipAddress&smtpName=username&smtpPwd=passwrd&defaultFrom=emailAddress
   or (to retrieve values)
       read=1
*/
svySetSMTP='/dsurvey/dsurvey'
svySetSMTPtodo='561';

/*svySMTPsend 
  Used to start the body of a post that sends an email 
  Various stuff is appended to this: session,sendFrom,sendTo,subject,message
*/
svySMTPsend='todo=560';


/*  svyPost3URL : 
      The basic url to use to "post" submitted data, as an XML data row, to the server
      This is used with svyPostDataHeader -- svyPostSubmitURL is the request line, svyPostDataHeader is the start of the body of the post
*/
svyPost3URL='/dsurvey/dsurvey.cmd';


/*  svyPost3Header : 
      The header to use in the body of a a "post" of general, users, or results data
      The following is appended:
                session=sessname&type=atype&contents=EscapedXMLDataRows
*/
svyPost3Header='todo=431&' ;




/* postNoteHeader:
   The header to use to post a text note to this sessions notes file
   The following is appended:
                session=sessname&
   Note: postFileURL is used with this
*/
postNoteHeader="todo=711" ;


/* getScenarioList
   Request a list of scenario files
   The following is appended:
                session=sessname&
    or
                instrument=instname
*/
getScenarioListURL='/dsurvey/dsurvey?todo=901&';


/* getScenarioListsList
   Request a list of scenarioList files
   The following is appended:
                session=sessname&
    or
                instrument=instname
*/
getScenarioListsListURL='/dsurvey/dsurvey?todo=9011&';





