<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">

<head>
  <meta http-equiv="content-type" content="text/html; charset=utf-8">
  <link rel="stylesheet" href="<%/%>/style.css">
  <link rel="icon" href="<%/%>/logo.png" type="image/png">
  <title>Gambas SmallWiki - <%_PrintTitle%></title>
</head>

<body <%If Main.Edit Then%>style="background: #F0F0F0;"<%Endif%>>

<form method="post" enctype="multipart/form-data">

<%If Not Request.Exist("v") Then%>
<div class="header">
    <div class="up">
      <%If Main.Edit%>
        <img src="<%/%>/edit.png">
      <%Else%>
        <a href="<%_PrintParent()%>"><img src="<%/%>/up.png"></a>
      <%Endif%>
    </div>
    <div class="title">
      <%_PrintTitle%>
    </div>
    <%If Main.Edit Then%>
      <div class="command">
        <input type="submit" name="save" id="save" value="Save" style="display:none;">
        <input type="submit" name="cancel" value="Cancel">
      </div>
    <%Else If Session.Id Then%>
      <div class="command">
        <%If Main.Exist Then%>
          <input type="submit" name="edit" value="Edit">
          <input type="submit" name="delete" value="Delete">
          <input type="submit" name="undo" value="Undo">
        <%Else%>
          <input type="submit" name="create" value="Create">
          <input type="submit" name="undo" value="Undo">
        <%Endif%>
      </div>
    <%Endif%>
    <div class="login">
      <%If Session.Id Then%>
        <div class="label-login"><%=Session["login"]%></div>
        <div class="command"><input type="submit" name="logout" value="Logout"></div>
      <%Else%>
        <div class="label-login">Login</div>
        <input type="text" name="login" maxlength="16">
        <div class="label-login">Password</div>
        <input type="password" name="password" maxlength="16">
        <div class="command"><input type="submit" value="OK"></div>
      <%Endif%>
    </div>
</div>

<%If Session["message"] Then%>
<div class="message">
<%Print Session["message"];%>
</div>
<%Endif%>

<%Endif%>

<div class="page">
  <%If Main.Edit Then%>
    <%If Main.Image Then%>
      <p>Select the image file to upload...</p>
      <input type="file" name="file" />
    <%Else%>
      <div class="edit-frame">
      <textarea class="edit" id="page" name="page"><%_PrintPage%></textarea>
      </div>
      <script type="text/javascript">
        document.getElementById('page').focus();
      </script>
    <%Endif%>
    <script type="text/javascript">
      document.getElementById('save').style.display = '';
    </script>
  <%Else%>
    <%_PrintPage%>
  <%Endif%>
</div>

</form>
</body>
</html>
