Skip to content
Snippets Groups Projects
Commit 97cdff34 authored by Ruben Jesus Garcia Hernandez's avatar Ruben Jesus Garcia Hernandez
Browse files

CGI scripts for setting up the VR config files

parent 32ec4e46
Branches
No related tags found
No related merge requests found
#!/bin/bash
if ["$QUERY_STRING" eq ""]
then
#echo Location: /NOMAD/
echo Location:http://mrs-srv.srv.lrz.de/NOMAD/
echo ''
else
#http://stackoverflow.com/questions/3919755/how-to-parse-query-string-from-a-bash-cgi-script
saveIFS=$IFS
IFS='=&'
parm=($QUERY_STRING)
IFS=$saveIFS
#material 1
Mat=${parm[1]}
if ["$Mat" eq ""]
then
echo "Content-type: text-plain"
echo ''
echo Missing material
exit
fi
#RGB 3,5,7,
Col=`echo ${parm[3]} ${parm[5]} ${parm[7]}`
#repetitions 9 11 13
Rep=`echo ${parm[9]} ${parm[11]} ${parm[13]}`
#traj 15
Traj=${parm[15]}
#screenshot 17
#encoded http://unix.stackexchange.com/questions/159253/decoding-url-encoding-percent-encoding
Shot=$(printf '%b' "${parm[17]//%/\\x}")
echo "Content-type: text-plain"
echo "Content-disposition: attachment; filename=${Mat}.ncfg"
echo ''
echo -e \# Material $Mat \\r\\n
echo -e baseurl \"http://enc-testing-nomad.esc.rzg.mpg.de/v1.0/materials/\" \\r\\n
echo -e jsonurl \"$Mat\" \\r\\n
echo -e repetitions $Rep \\r\\n
echo -e trajectories $Traj \\r\\n
echo -e background $Col \\r\\n
echo screenshot \"$Shot\"
echo -e \\r\\n
echo -e atomscaling 0.5 \\r\\n
fi
\ No newline at end of file
#!/bin/bash
echo "Content-type: application/xhtml+xml"
echo ''
cat <<ENDA
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
<title>Material configurator for VR viewing
</title>
</head>
<body>
<form action="/cgi-bin/NOMAD/configuredmaterial">
<fieldset>
Material Number from NOMAD encyclopaedia <input type="text" name="material"
ENDA
echo value=\"$QUERY_STRING\"
cat <<ENDB
/><br/>
Background Color (RGB, 0-1)
<input type="text" name="R" value="0"/>
<input type="text" name="G" value="0"/>
<input type="text" name="B" value="0"/><br/>
Repetitions along a,b,c vectors of the unit cell
<input type="text" name="Ra" value="1"/>
<input type="text" name="Rb" value="1"/>
<input type="text" name="Rc" value="1"/><br/>
Show Trajectory of atoms (-1: all; otherwise empty or space separarated list of numbers)
<input type="text" name="Traj" value=""/><br/>
Screenshot Basename
<input type="text" name="Shot" value="C:\\temp\\frame"/><br/>
<input type="submit" name="submit" value="Get Material"/>
</fieldset>
</form>
<p>
<a href="http://validator.w3.org/check?uri=referer"><img
src="/w3.org/valid-xhtml11.png"
alt="Valid XHTML 1.1" height="31" width="88" /></a>
</p>
</body>
</html>
ENDB
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment