;;; identity.mhtml: -*- Meta-HTML -*-  DESCRIPTIVE TEXT.

;;;  Copyright (c) 1996 Brian J. Fox
;;;  Author: Brian J. Fox (bfox@ai.mit.edu) Sun Jul 14 18:34:50 1996.
<set-var title="Change Server Identity">
<include header.mhtml>

<if <string-eq <get-var posted::action> Cancel>
    <redirect <get-var mhtml::url-to-dir>/>>

<if <not <get-var posted::name>>
    <set-var name=<get-var admin::server-name>>>

<if <not <get-var posted::port>>
    <set-var port=<get-var admin::server-port>>>

<when <string-eq <get-var posted::action> "Change Identity">>
  ;;; Write the identity.local file.
  <with-open-stream dest <get-var mhtml::server-root>/conf/identity.local
		    type=file mode=write-create>
    <with-open-stream s <get-var mhtml::include-prefix>/includes/warning.txt
		      type=file mode=read>
      <stream-get-contents s contents>
      <stream-put-contents dest contents>
      <stream-put-contents dest "\n">
    </with-open-stream>

    <stream-put-contents dest "\n">
    <stream-put dest "<">
    <stream-put dest "defvar mhtml::server-name <get-var name>>\n">
    <stream-put dest "<">
    <stream-put dest "defvar mhtml::server-port <get-var port>>\n">
  </with-open-stream>
  <message The Server Identity/Port has been changed.>
  <redirect <get-var mhtml::url-to-dir>/>
</when>

<layout::page>
  <center>
    <form method=post action="<thisdoc>">
      <table>
	<tr>
	  <td align=right><b>Server Name:</b></td>
	  <td align=left>
	    <input type=text name=name value="<get-var name>" size=30>
	  </td>
	</tr>
	<tr>
	  <td align=right><b>Server Port:</b></td>
	  <td align=left>
	    <input type=text name=port value="<get-var port>" size=30>
	  </td>
	</tr>
      </table>
      <p>
      <input type=submit name=action value="Change Identity">
      <input type=submit name=action value="Cancel">
    </form>
  </center>
</layout::page>

<include footer.mhtml>
