#! /bin/sh

#|
 echo Content-type: text/html
 echo ""
 ":";exec /usr/local/bin/mzscheme -r "$0" "$@"
|#

; Copyright 2008 Christopher Michael Rasch
;
; This file is part of Wishforge.

; Wishforge is free software: you can redistribute it and/or modify
; it under the terms of the GNU Affero General Public License as published by
; the Free Software Foundation, either version 3 of the License, or
; (at your option) any later version.

; Wishforge is distributed in the hope that it will be useful,
; but WITHOUT ANY WARRANTY; without even the implied warranty of
; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
; GNU Affero General Public License for more details.

; You should have received a copy of the GNU Affero General Public License
; along with Wishforge.  If not, see <http://www.gnu.org/licenses/>.

(require (lib "cgi.ss" "net"))
(require (lib "xml.ss" "xml"))
(require (lib "md5.ss"))
(require (file "db.ss"))
(require (file "bindings.ss"))

(let ([login (ebs "login")]
      [symbol (ebs "symbol")]
      [summary (ebs "summary")]
      [description (ebs "description")]
      [spec1 (ebs "specification_1")]
      [spec2 (ebs "specification_2")]
      [spec3 (ebs "specification_3")]
      [spec4 (ebs "specification_4")]
      [spec5 (ebs "specification_5")] ; TODO - deal with optional specs
      [judge (ebs "judge")]
      [bond_amount (ebs "bond_amount")]
      [num_bonds (ebs "number_of_bonds")])
    (insert-wish
        login
	symbol
	summary
	description
	spec1 spec2 spec3 spec4 spec5
	judge
	bond_amount num_bonds)
    (write-xml/content 
     (xexpr->xml 
      `(HTML
	(HEAD 
	 (TITLE "Wishforge wish created"))
	(BODY
	 (H2 "Your wish has been created") ; TODO - go back to user page
	 (P)
	 (H3 "Go to the Wishforge " (A ((HREF "/wishforge.html"))
				       "login page")))))))



