<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:xi="http://www.w3.org/2001/XInclude" xmlns:py="http://genshi.edgewall.org/">
  <xi:include href="discussion-macros.html"/>
  <xi:include href="layout.html"/>
  <head>
    <title>Add Topic</title>
  </head>

  <body>
    <xi:include href="discussion-header.html"/>

    <div id="content" class="discussion">
      <div id="${discussion.mode}" class="${discussion.mode}">

        <h1>Add Topic</h1>

        <div py:if="req.args.preview" class="message-list">
          <div class="topic">
            <div class="header">
              <div class="subject">
                ${discussion.subject or '&nbsp;'}
              </div>
              <div class="body">
                ${discussion.body or '&nbsp;'}
              </div>
              <div class="footer">
                <div class="author">
                  ${discussion.author}
                </div>
                <div class="time">
                  ${discussion.time}
                </div>
              </div>
            </div>
          </div>
        </div>

        <form class="add_form" method="post" action="${href.discussion(discussion.forum.id)}">
          <fieldset>

            <legend>
              Add Topic:
            </legend>

            <div class="field">
              <label for="author">Author:</label><br/>
              <py:choose>
                <input py:when="discussion.authname == 'anonymous'" type="text" id="author" name="author" value="${req.args.author or 'anonymous'}"/>
                <input py:otherwise="" type="text" id="author" name="author" value="${discussion.authname}" readonly="readonly"/>
              </py:choose><br/>
            </div>

            <div class="field">
              <label for="subject">Subject:</label><br/>
              <input type="text" id="subject" name="subject" value="${req.args.subject}"/><br/>
            </div>

            <div class="field">
              <label for="body">Body:</label><br/>
              <py:choose>
                <py:when test="req.args.preview">
                  <textarea id="body" class="wikitext" name="body" cols="80" rows="20">${req.args.body}</textarea><br/>
                </py:when>
                <py:otherwise>
                  <textarea id="body" class="wikitext" name="body" cols="80" rows="20">Enter your message here...</textarea><br/>
                </py:otherwise>
              </py:choose>
            </div>

            <div class="buttons">
              <input type="submit" name="preview" value="Preview"/>
              <input type="submit" name="submit" value="Submit"/>
              <input type="button" name="cancel" value="Cancel" onclick="location.href = '${href.discussion(discussion.forum.id)}'"/>
              <input type="hidden" name="discussion_action" value="post-add"/>
            </div>

          </fieldset>
        </form>

      </div>
    </div>

    <xi:include href="discussion-footer.html"/>
  </body>
</html>
