diff options
author | defanor <defanor@uberspace.net> | 2019-02-05 05:14:26 +0300 |
---|---|---|
committer | defanor <defanor@uberspace.net> | 2019-02-05 05:14:26 +0300 |
commit | a5ffe01c8806b720a99569dd407a4b14a67693e3 (patch) | |
tree | 540006cd70fb07dc7af03b42b9673d83627a68f5 /example | |
parent | e180c98004e213ff99d963f391b5f973ce952f7a (diff) |
Use plain CGI
This eliminates the last of large Haskell dependencies.
The multipart enctype is not supported now.
Diffstat (limited to 'example')
-rw-r--r-- | example/README.md | 22 | ||||
-rw-r--r-- | example/list.xsl | 10 | ||||
-rw-r--r-- | example/view.xsl | 2 |
3 files changed, 24 insertions, 10 deletions
diff --git a/example/README.md b/example/README.md index d70b595..3aa50bf 100644 --- a/example/README.md +++ b/example/README.md @@ -14,10 +14,17 @@ them. `list.xsl` includes report and search forms, and lists the bugs. -To quickly try it, run `spawn-fcgi -p 5152 /bin/env pgxhtml` in this -directory, with database connection environment variables set if -needed, an `127.0.0.1 pgxhtml-test` entry in `/etc/hosts`, and a nginx -config akin to the following: +To quickly try the example after preparing a database, it can be +invoked directly in the `example` directory, e.g.: + +```sh +echo | QUERY_STRING="t=list&q=select+bug_search('','',10,0)" pgxhtml +``` + +To try it with a web server, ensure that `fcgiwrap` is running (e.g., +`fcgiwrap -s 'tcp:127.0.0.1:5152'`), database connection environment +variables are set if needed, an `127.0.0.1 pgxhtml-test` entry is in +`/etc/hosts`, and a nginx config akin to the following is set: ``` server { @@ -26,8 +33,13 @@ server { location / { include fastcgi_params; - fastcgi_param PATH_INFO $fastcgi_script_name; + fastcgi_param SCRIPT_FILENAME /home/defanor/.cabal/bin/pgxhtml; + fastcgi_param FCGI_CHDIR /home/defanor/proj/haskell/pgxhtml/example/; fastcgi_pass 127.0.0.1:5152; } } ``` + +Then +[http://pgxhtml-test/?t=list&q=select+bug_search('','',10,0)](http://pgxhtml-test/?t=list&q=select%20bug_search(%27%27,%27%27,10,0)) +should be available. diff --git a/example/list.xsl b/example/list.xsl index f229e3e..f4b0cf3 100644 --- a/example/list.xsl +++ b/example/list.xsl @@ -11,13 +11,14 @@ <xsl:include href="common.xsl"/> <xsl:param name="project" /> <xsl:param name="description" /> + <xsl:param name="auth" /> <xsl:param name="limit" select="10" /> <xsl:param name="offset" select="0" /> <xsl:template match="bugs:table"> <!-- Report form --> <h2>Report</h2> - <form method="post" action="view.xhtml?q=insert%20into%20bugs%20(%20:fields%20)%20values%20(%20:values%20)%20returning%20xmlelement(name%20table,xmlattributes('urn:x-bugs'%20as%20xmlns),xmlelement(name%20row,xmlelement(name%20id,id),xmlelement(name%20reported,reported),xmlelement(name%20reporter,reporter),xmlelement(name%20project,project),xmlelement(name%20description,description)))"> + <form method="post" action="?auth={$auth}&t=view&q=insert%20into%20bugs%20(%20:fields%20)%20values%20(%20:values%20)%20returning%20xmlelement(name%20table,xmlattributes('urn:x-bugs'%20as%20xmlns),xmlelement(name%20row,xmlelement(name%20id,id),xmlelement(name%20reported,reported),xmlelement(name%20reporter,reporter),xmlelement(name%20project,project),xmlelement(name%20description,description)))"> <dl> <dt><label for="report_project">Project</label></dt> <dd> @@ -37,7 +38,7 @@ <!-- Search form --> <h2>Search</h2> - <form method="get" action="list.xhtml"> + <form method="get"> <dl> <dt><label for="search_project">Project</label></dt> <dd> @@ -59,6 +60,7 @@ <input id="search_offset" type="number" name="offset" min="0" value="{$offset}" /> </dd> + <input type="hidden" name="t" value="list" /> <input type="hidden" name="q" value="select bug_search( q:project , q:description , q:limit , q:offset )" /> </dl> @@ -78,12 +80,12 @@ <td><xsl:copy-of select="bugs:reported/text()" /></td> <td><xsl:copy-of select="bugs:reporter/text()" /></td> <td> - <a href="list.xhtml?q=select%20bug_search(%20q:project%20,'',{$limit},{$offset})&project={str:encode-uri(bugs:project/text(), true())}"> + <a href="?auth={$auth}&t=list&q=select%20bug_search(%20q:project%20,'',{$limit},{$offset})&project={str:encode-uri(bugs:project/text(), true())}"> <xsl:copy-of select="bugs:project/text()" /> </a> </td> <td> - <a href="view.xhtml?q=select%20query_to_xml('select%20*%20from%20bugs%20where%20id=''{bugs:id}''',false,false,'urn:x-bugs')"> + <a href="?auth={$auth}&t=view&q=select%20query_to_xml('select%20*%20from%20bugs%20where%20id=''{bugs:id}''',false,false,'urn:x-bugs')"> <xsl:copy-of select="bugs:summary/text()" /> </a> </td> diff --git a/example/view.xsl b/example/view.xsl index 84a9d5a..8b5dde8 100644 --- a/example/view.xsl +++ b/example/view.xsl @@ -9,7 +9,7 @@ <xsl:include href="common.xsl"/> <xsl:template match="bugs:table/bugs:row"> - <a href="list.xhtml?q=select%20bug_search(%27%27,%20%27%27,%2010,%200)">back to listing</a> + <a href="?auth={$auth}&t=list&q=select%20bug_search(%27%27,%20%27%27,%2010,%200)">back to listing</a> <dl> <dt>ID</dt> <dd><xsl:copy-of select="bugs:id/text()" /></dd> |