<!-- $Id: forum.txt v7.1 01/12/2023 00:17:17 $ -->
<!-- Copyright (c) 1998-2007 INRIA -->
<!DOCTYPE html>
<html lang="%lang;">
<head>
  <title>%nn;
    %if;(e.m = "FORUM_ADD" or e.m = "FORUM_ADD_OK")%nn;
      %if;can_post;
        [*add::message/previous message/previous messages/next message]0%nn;
      %else;
        [*incorrect request]%nn;
      %end;
    %elseif;(pos="")[*database forum]%nn;
    %elseif;(message.subject="" or message.subject="-")
      [*database forum]%nn;
    %else;
      %message.subject.cut.50;%nn;
    %end;
  </title>
  %if;(bvar.robot_index_forum="yes")<meta name="robots" content="index,follow">%else;<meta name="robots" content="none">%end;
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
  <link rel="shortcut icon" href="%images_prefix;favicon_gwd.png">
%include;css
<style>
  .clickable-row {
    cursor: pointer;
  }
/*  .clickable-row:hover {
    background-color: #f8f9fa;
  }*/
</style>
</head>
<body%body_prop;>
<div class="container">
%message_to_wizard;
%include;home
%include;hed
%if;(e.m!="FORUM" or e.p!="")
  <h1 class="ml-sm-2"> <a href="%prefix;m=FORUM" accesskey="F">[*database forum]</a></h1>
%else;
  <div class="d-flex align-items-center mt-1">
    <h1 class="ml-sm-2">[*database forum]</h1>
    %if;can_post;
      <a href="%apply;url_set%with;m%and;FORUM_ADD%end;" class="btn btn-primary ml-auto">
        [*add::message/previous message/previous messages/next message]0</a>
    %end;
  </div>
%end;
%define;search_form(xx)
  <form class="form-inline ml-sm-4 mt-2" method="get" action="%action;">
    %hidden;
    <input type="hidden" name="m" value="FORUM_SEARCH">
    %if;(xx=0)
      <input type="hidden" name="p" value="%pos;">
    %end;
    <label class="sr-only" for="fs">%e.s.ns;</label>
    <input class="form-control col-5" id="fs" name="s" placeholder="[*search/case sensitive]0">
    <div class="custom-control custom-checkbox ml-2">
      <input class="custom-control-input" type="checkbox" id="cs" name="c" value="on"
        %if;(xx=0 and e.c="on") checked%end;>
       <label class="custom-control-label" for="cs">[*search/case sensitive]1</label>
    </div>
    <button type="submit" class="btn btn-primary ml-3">[*search/case sensitive]0</button>
  </form>
%end;
%define;message()
  %if;supervisor;
    <b style="color:#999">-%sp;
    %if;(message.wizard!="")
      [wizard/wizards/friend/friends/exterior]0:%sp;
      <a href="%prefix;m=WIZNOTES&v=%message.wizard;" style="color:#999">%sq;
      %message.wizard;</a>%sp;
    %end;
    %if;(message.friend!="")
      [wizard/wizards/friend/friends/exterior]2: %message.friend;%sp;
    %end;
    …%message.from;</b>
  %end;
  <div>
    <b>[*ident/email/subject]0[:]</b> %message.ident;
  </div>
  %if;(message.email!="")%sp;
    <div>
     <b>[*ident/email/subject]1[:]</b> <a href="mailto:%message.email.v;">%message.email;</a>
   </div>
  %end;
  <div class="mt-2"><b>[*date/dates]0[:]</b> %message.time;</div>
  %if;(message.subject!="")
    <div><b>[*ident/email/subject]2[:]</b> %message.subject;</div>
  %end;

  %if;(message.access="priv")
    <div><b>[*access]0[:]</b> [private]</div>
  %end;
  <div class="mt-2"><b>[*message/previous message/previous messages/next message]0[:]</b>
    <div>
      %if;(e.m="FORUM_VIEW")
      <textarea class="form-control p-2" rows="15" cols="100" readonly>%message.text.raw;</textarea>
      %elseif;(message.wiki="on")%message.text.wiki;
      %else;%message.text.nowiki;%end;</div>
  </div>
%end;
%if;(e.m="FORUM_ADD" or e.m="FORUM_ADD_OK")
  %( Add or preview a message %)
  %if;(e.m="FORUM_ADD_OK")
    %apply;message()
    <hr class="mt-4">
  %end;
  %if;can_post;
    <div class="h2">[*add::message/previous message/previous messages/next message]0</div>
    <form method="POST" action="%action;">
      %hidden;
      <input type="hidden" name="m" value="FORUM_ADD_OK">
      <div class="form-group row mb-1">
        <label for="ident" class="col-sm-2 col-form-label">[*ident/email/subject]0</label>
        <input id="ident" tabindex="1" class="form-control col-3" name="Ident"%sp;
          value="%if;(user.name="")%user.ident;%else;%user.name;%end;" required>
      </div>
      <div class="form-group row mb-3">
        <label for="email" class="col-sm-2 col-form-label">[*ident/email/subject]1 ([optional])</label>
        <input id="email" tabindex="2" class="form-control col-3" name="Email"
        %if;(e.m="FORUM_ADD_OK" and message.email!="") value="%message.email;"%end;>
      </div>
      <div class="form-group row mb-1">
        <label for="subject" class="col-sm-2 col-form-label">[*ident/email/subject]2 ([optional])</label>
        <input id="subject" tabindex="3" class="form-control col-6" name="Subject"
        %if;(e.m="FORUM_ADD_OK" and message.subject!="") value="%message.subject;"%end;>
      </div>
      <div class="form-group row">
        <label for="message" class="col-sm-2 col-form-label">%nn;
          [*message/previous message/previous messages/next message]0</label>
        <div class="d-inline-flex col-9 px-0">
          <textarea id="message" tabindex="4" class="form-control col-8 py-2 insert-character-target" name="Text" required>%nn;
            %if;(e.m="FORUM_ADD_OK")%message.text;%end;
          </textarea>
          <div class="col-4 px-0 ml-3">
            %include;characters
          </div>
         </div>
       </div>
       <div class="row">
         <div class="col-2"></div>
         <button tabindex="5" type="submit" name="visu" class="btn btn-primary">[*visualize/show/hide/summary]0</button>
         %if;(e.m="FORUM_ADD_OK")
           %if;(wizard or friend)
             <button tabindex="6" type="submit" name="publ_acc" class="btn btn-primary ml-2">[*public]0</button>
             <button tabindex="7" type="submit" name="priv_acc" class="btn btn-primary ml-2">[*private]0</button>
           %else;
             <button tabindex="6" type="submit" class="btn btn-primary ml-2">[*validate/delete]0</button>
           %end;
         %end;
       </div>
       %if;is_moderated_forum;
         <span>([this forum is moderated])</span>
       %end;
    </form>
  %else;
    <div class="h2">[*incorrect request]</div>
  %end;
%elseif;(pos!="")
  %( display a message %)
  <ul class="mt-3">
    %if;(message.next_pos!="")
      <li>
       <a href="%prefix;m=FORUM&p=%message.next_pos;" accesskey="N">%nn;
         [*message/previous message/previous messages/next message]3%nn;
       </a>%nn;
      </li>
    %end;
    %if;(message.prev_pos!="")
      <li>
       <a href="%prefix;m=FORUM&p=%message.prev_pos;" accesskey="P">%nn;
         [*message/previous message/previous messages/next message]1%nn;
       </a>%nn;
      </li>
    %end;
  </ul>
  %let;col;%if;message.is_waiting; style="color:red"%end;%in;
  %if;message.is_waiting;
    %if;is_moderator;
      <form method="POST" action="%action;">
        %hidden;
        <input type="hidden" name="m" value="FORUM_VAL">
        <input type="hidden" name="p" value="%pos;">
        <button type="submit" name="v" value="yes" class="btn btn-primary">[*validate/delete]0</button>
        <button type="submit" name="d" value="yes" class="btn btn-primary">[*validate/delete]1</button>
      </form>
    %else;
      <span class="text-success">[*your message is waiting for validation]</span>
    %end;
  %end;
  %if;(e.m!="FORUM_VIEW")
    <div style="font-size:80%%;float:%right;;margin-%left;:3em">(<a%sp;
    href="%prefix;m=FORUM_VIEW&p=%message.pos;">[view source]</a>)</div>
  %end;
  <p%col;>
  %apply;message()
  %if;(message.wizard!="" and wizard and user.ident=message.wizard
        or manitou or supervisor)
    <form method="GET" action="%action;">
      %hidden;
      <input type="hidden" name="m" value="FORUM_P_P">
      <input type="hidden" name="p" value="%message.pos;">
      <button type="submit" class="btn btn-primary">[*public]/[*private]</button>
    </form>
    <form method="POST" action="%action;">
      %hidden;
      <input type="Hidden" name="m" value="FORUM_DEL">
      <input type="hidden" name="p" value="%message.pos;">
      <button type="submit" class="btn btn-primary">
        [*delete::message/previous message/previous messages/next message]0</button>
    </form>
  %end;
  %if;(e.m="FORUM_SEARCH")
    %apply;search_form(0)
  %end;
%else;
  %( display message headers %)
  %let;len;%if;(e.len!="")%e.len;%else;100%end;%in;
  %let;to;%if;(e.to!="")%e.to;%else;-1%end;%in;
  <table class="table table-responsive table-hover mt-3">
  %foreach;message(to, len)
    %let;col;%if;message.is_waiting; text-danger%end;%in;
    %if;(message.date!=message.prev_date)
      %if;(message.prev_date!="" and message.date.month!=message.prev_date.month)
        <tr><td colspan="4"></td></tr>
      %end;
      <thead class="thead-light mt-3">
        <tr align="%left;"><th></th><th colspan="3" class="border-top-0"><b>%message.date;</b></th></tr>
      </thead>
    %end;
    <tbody><tr align="%left;" class="clickable-row text-align %col" data-href="%prefix;m=FORUM&p=%message.pos;"
      %if;(message.prev_date="") accesskey="1"%end;>
      <td><samp>%if;(message.access="priv")*%end;</samp></td>
      <td><samp>%message.hour;</samp></td>
      <td class="%col;"><b>%message.ident.cut.26;</b></td>
      <td>%nn;
        %if;(message.subject="" or message.subject="-")
          <i>…&nbsp;%message.text.cut.80;</i>%nn;
        %else;
          %message.subject.cut.80;%nn;
        %end;
      </td>
    </tr></tbody>
  %end;
  </table>
  %if;(pos!="")
    <a class="btn btn-primary ml-sm-4 mb-2" href="%prefix&m=FORUM&len=%len;&to=%pos;">%nn;
      [*message/previous message/previous messages/next message]2</a>
  %end;
  %apply;search_form(1)
%end;
%base_trailer;
%include;copyr
</div>
%include;js
<script>
  //  Make table row clickable
  $(document).ready(function(){
    $(".clickable-row").click(function() {
      window.location = $(this).data("href");
    });
  });
</script>
</body>
</html>
