tcl-to-exe.rvt at [92a34120b9]

File client/web/tcl-to-exe.rvt artifact aecea58e24 part of check-in 92a34120b9


<?

# This file has no license.  It is in the public domain.
# -- Roy Keene <tcl@rkeene.org> [20081025T1400Q]

if {[var exists source]} {
        headers type "text/plain; charset=us-ascii"
        rivet_flush

        set fd [open $::env(PATH_TRANSLATED) r]
        fcopy $fd stdout
        close $fd

        abort_page
        exit 0
}

source [file join [file dirname [info script]] common.tcl]

if {[var exists starkit] && [var exists starpack_platform]} {
	headers type "text/plain"

	puts "[var get starkit]"
	puts "--"
	puts "[var get starpack_platform]"
	puts "--"
	puts "OK"
} else {
	# Set content-type
	headers type "text/html; charset=us-ascii"

?><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
  <head>
    <title>Starpacker <? puts -nonewline "[var exists starkit][var get starpack_platform {-}]" ?></title>
  </head>
  <body>
<?
	if {$::env(REQUEST_METHOD) == "POST"} {
		foreach {var val} [array get ::env] {
			puts "$var = \"$val\"<br>"
		}
	}
?>
    <form action="<? puts -nonewline $::env(REQUEST_URI) ?>" method="post" enctype="multipart/form-data">
      <table>
        <tr>
          <td>Upload file:</td>
          <td><input type="file" name="starkit"> (ZIP file, Tarball, Starkit, or Single Tcl File)</td>
        </tr>
        <tr>
          <td>Target Platform:</td>
          <td>
            <select name="starpack_platform">
<?
	set descs [::customkit::get_descs_from_mapping]

	foreach desckey [lsort -dictionary $descs] {
		set desc [lindex $desckey 0]
		set key [lindex $desckey 1]
		puts "              <option value=\"$key\">$desc</option>"
	}
?>            </select>
          </td>
        </tr>
        <tr>
          <td colspan="2">
            <input type="submit" name="submit_upload" value="Create">
          </td>
        </tr>
        <tr>
          <td colspan="2">
<?
	puts "$::env(REQUEST_METHOD)"
?>
          </td>
        </tr>
      </table>
    </form>
    <div>
      <a href="?source=1">Source</a>
    </div>
  </body>
</html><?
}
?>