<!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">
  <%If System.RightToLeft Then%><link rel="stylesheet" href="<%/%>/style-rtl.css">
  <%Endif%><%If Not Request.Exist("nh") Then%><link rel="stylesheet" href="<%/%>/style-dark.css">
  <%Endif%><link rel="stylesheet" href="<%/%>/split.css">
  <link rel="icon" href="<%/%>/logo.png" type="image/png">
  <title><%_PrintTitle%> - <%=("Gambas Documentation")%></title>
  <script type="text/javascript" src="<%/%>/common.js"></script>
  <script type="text/javascript" src="<%/%>/split.js"></script>
  <script type="text/javascript" src="<%/%>/playground.js?l=<%=Request["l"]%>"></script>
  <%If Request["ht"]%><script type="text/javascript" src="<%/%>/highlight.js"></script><%Endif%>
</head>

<body<%If Main.Edit Then%> style="overflow:hidden;"<%Endif%><%If Not Main.Edit And If Request["ht"]%> onload="highlight_check()"<%Endif%>>

<%If Request.Exist("nt")%>
<style type="text/css">
H1 { display: none; }
</style>
<%Endif%>

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

<div class="view-frame">

<%If Not Main.Edit And If Request["ident"] Then%>
  <%If Not Session.Id Then%>
    <input type="submit" name="ok" value="<%=("OK")%>" style="position:absolute;width:0px;height:0px;margin:0px;padding:0px;outline:none;border:none;">
  <%Endif%>
<%Endif%>

<%If Request.Exist("v") Or If Request.Exist("nh") Then%>

  <div class="page-frame" style="flex-grow:1;">
  <div class="page">
  
<%Else If Request.Exist("w") Then%>
  
  <div class="page-frame">
  <div class="page">

<%Else%>

<div class="index-frame" id="index-frame">
  
  <!--<div class="root-title"><%=("Gambas Documentation")%></div>-->
  
  <div class="page-index">
  <%_PrintIndex()%>
  <script type="text/javascript">
  try { document.getElementById('current-entry').scrollIntoView({'block':'center'}); } catch(e) {}
  </script>
  </div>
  
</div>

<div class="page-frame" id="page-frame">

<%If Not Request.Exist("nl") And If Not Request.Exist("nh") Then%>

  <%If Session.Id Then%>
  <div class="header<%If Main.Edit Then%> header-edit<%Endif%>">
  <%Else%>
  <div class="header header-small">
  <%Endif%>
  
    <div class="header-inside">
    
      <div class="header-bar">
        <%If Main.Edit Then%>
          <div class="command">
            <input type="submit" class="header-button" id="preview" name="preview" value="<%=("Preview")%>">
            <input type="submit" class="header-button" id="save" name="save" value="<%=("Save")%>" style="display:none;">
            <input type="submit" class="header-button" name="cancel" value="<%=("Cancel")%>">
          </div>
        <%Else If Main.Preview Then%>
          <div class="command">
            <input type="submit" class="header-button" id="save" name="save" value="<%=("Save")%>">
            <input type="submit" class="header-button" name="cancel-preview" value="<%=("Cancel")%>">
          </div>
        <%Else If Session.Id Then%>
          <div class="command">
            <%If Main.Exist Then%>
              <%If Main.History Then%>
                <%If Main.History < GetMaxHistory() Then%>
                  <input type="submit" class="header-button" name="prev" value="<%= ("<")%>">
                <%Else%>
                  <input type="submit" class="header-button" name="prev" value="<%= ("<")%>" disabled>
                <%Endif%>
                <%If Main.History > 1 Then%>
                  <input type="submit" class="header-button" name="next" value="<%= (">")%>">
                <%Else%>
                  <input type="submit" class="header-button" name="next" value="<%= (">")%>" disabled>
                <%Endif%>
                <input type="submit" class="header-button" name="exit" value="<%= ("Exit")%>">
              <%Else%>
                <input type="submit" class="header-button" name="edit" value="<%= ("Edit")%>">
                <input type="submit" class="header-button" name="delete" value="<%= ("Delete")%>">
                <input type="submit" class="header-button" name="undo" value="<%= ("Undo")%>">
                <%If GetMaxHistory() > 0 Then%>
                  <input type="submit" class="header-button" name="historic" value="<%= ("Historic")%>">
                <%Endif%>
              <%Endif%>
            <%Else%>
              <input type="submit" class="header-button" name="create" value="<%=("Create")%>">
              <input type="submit" class="header-button" name="undo" value="<%=("Undo")%>">
              <%If Exist(File.Dir(Main.GetPagePath())) Then%>
                <input type="submit" class="header-button" name="purge" value="<%=("Purge")%>">
              <%Endif%>
            <%Endif%>
            <%If Main.History = 0 Then%>
              <%If Main.Path Then%>
                <input type="submit" class="header-button" name="select" value="<%=("Select")%><%_PrintSelectionCount%>" title="<%_PrintSelectionList%>">
              <%Endif%>
              <%If Main.HasSelection() Then%>
                <input type="submit" class="header-button" name="unselect" value="<%=("Unselect")%>">
                <input type="submit" class="header-button" name="move" value="<%=("Move selection")%>">
              <%Endif%>
            <%Endif%>
          </div>
        <%Endif%>
        <div class="header-expand"></div>
        <%If Session.Id Then%>
          <div class="last-modified"><%_PrintLastModified%></div>
        <%Endif%>
        <div class="header-right">
        <%If Session.Id Then%>
          <div class="user-name"><%=Main.FullName%></div>
          <div class="command"><input type="submit" class="header-button" name="logout" value="<%= ("Logout")%>"></div>
        <%Else%>
          <div class="command"><input type="submit" class="header-button" name="ident" value="<%=("Login")%>"></div>
        <%Endif%>
        <%_PrintLang%>
        </div>
      </div>
    </div>
  
  </div>

<%Endif%>

<% If Not Main.Edit And If Request["ident"] Then%>
  <div class="login"><div>
    <%If Session.Id Then%>
      <div id="user" class="label-login" align="left"><%=Main.UserName%></div>
      <div class="command"><input type="submit" name="logout" value="<%=("Logout")%>"></div>
    <%Else%>
      <div id="welcome">Gambas Wiki</div>
      <div align="center"><img id="logo" src="<%/%>/gambas.png"></div>
      <div class="label-login" align="left"><%=("Login")%>&nbsp;</div>
      <input type="text" name="login" id="login" maxlength="16" tabindex="0"><br>
      <div class="label-login" align="left"><%=("Password")%>&nbsp;</div>
      <input type="password" name="password" id="password" maxlength="16"><br>
      <div id="login-buttons">
        <input class="header-button" type="submit" name="ok" id="ok" value="<%=("OK")%>">
        <input class="header-button" type="submit" id="cancel" value="<%=("Cancel")%>">
      </div>
    <%Endif%>
  </div></div>
<%Endif%>

<div id="page" class="page <%If Main.Edit Then%>page-edit<%Endif%>" tabindex="2">

<%Endif%>

<%_PrintMessage()%>

<%If Session.Id And If Not Main.Edit Then%>
<div class="page-link">
  <%If Main.Path Or If Main.Edit Then%>
    <div class="up">
      <%If Main.Edit Then%>
        <img src="<%/%>/edit.png">
      <%Else%>
        <a href="<%_PrintParent()%>"><img src="<%/%>/up.png"></a>
      <%Endif%>
    </div>
  <%Endif%>
  
  <%If Main.Path Then%>
  <div class="title">
    <%_PrintLink%>
  </div>
  <%Endif%>
</div>
<%Endif%>

<%If Main.Edit Then%>
  <div class="edit-frame">
  <%If Main.Image Then%>
    <div class="upload-frame">
      <div>
        <input type="file" id="upload-file" name="file">
        <input type="button" class="header-button upload-button" value="<%=("Select the image file to upload...")%>" onclick="$('upload-file').click();">
      </div>
    </div>
    <div class="edit">
      <%Print Main.GetImageHTML(Main.Path);%>
    </div>
  <%Else%>
    <textarea class="edit" id="page-editor" name="page" tabindex="1"><%_PrintPage%></textarea>
  <%Endif%>
 </div>
  <script type="text/javascript">
    document.getElementById('save').style.display = '';
  </script>
<%Else If Main.Preview Then%>
  <%_PrintPage%>
  <input type="hidden" name="page" value="<%=Request["page"]%>">
<%Else%>
  <%_PrintPage%>
  <p></p>
  <%If Not Session.Id Then%>
    <!--<script type="text/javascript">
      try { document.getElementById('login').focus(); } catch(e) {}
    </script>-->
  <%Endif%>
<%Endif%>

<div></div>

</div>
</div>

</div>

</form>

<script type="text/javascript">
  
  if (document.getElementById('index-frame'))
  {
    var sizes = localStorage.getItem('split-sizes');

    if (sizes)
      sizes = JSON.parse(sizes);
    else
      sizes = [15, 85];

    Split(['#index-frame','#page-frame'], 
      { 
        sizes: sizes, 
        maxSize: [512, Infinity], 
        gutterSize: 4,
        onDragEnd: function (sizes) { localStorage.setItem('split-sizes', JSON.stringify(sizes)); }
      });
  }
  
  try {
  <%If Main.Edit Then%>
  document.getElementById('page-editor').focus();
  <%Else If Request["ident"] Then%>
  document.getElementById('login').focus();
  <%Else%>
  document.getElementById('page').focus();
  <%Endif%>
  }
  catch(e) {}
</script>

</body>
</html>
