<form name="theform" method="post" action="post.php" enctype="multipart/form-data">
<table border="0" cellpadding="5">
<tr valign="top">
    <td align="right"><b><?php print_string("subject", "forum"); ?>:</b></td>
    <td>
        <input type="text" name="subject" size="60" value="<?php p($post->subject) ?>" alt="<?php print_string("subject", "forum"); ?>" />
    </td>
</tr>
<tr valign="top">
    <td align="right"><b><?php print_string("message", "forum"); ?>:</b>
    <br /><br />
      <?php
        helpbutton("reading", get_string("helpreading"), "moodle", true, true);
        echo "<br />";
        helpbutton("writing", get_string("helpwriting"), "moodle", true, true);
        echo "<br />";
        helpbutton("questions", get_string("helpquestions"), "moodle", true, true);
        echo "<br />";
        if ($usehtmleditor) {
           helpbutton("richtext", get_string("helprichtext"), "moodle", true, true);
        } else {
           emoticonhelpbutton("theform", "message");
        } 
        echo "<br />";
      ?>
    </td>
    <td align="left">
    <?php print_textarea($usehtmleditor, 25, 65, 630, 400, "message", $post->message); ?>
    </td>
</tr>

<tr valign="top">
    <td align="right"><b><?php print_string("formattexttype"); ?>:</b></td>
    <td>
    <?php 
        if ($usehtmleditor) {   /// Trying this out for a while
            print_string('formathtml');
            echo '<input type="hidden" name="format" value="'.FORMAT_HTML.'" />';
        } else {
            choose_from_menu(format_text_menu(), "format", $post->format, "");
        }
        helpbutton("textformat", get_string("helpformatting"));
     ?>
    </td>
</tr>


<tr valign="top">
    <td align="right"><b><?php print_string("subscription", "forum") ?>:</b></td>
    <td>
    <?php 
       if (forum_is_forcesubscribed($forum->id)) {
           print_string("everyoneissubscribed", "forum");
       } else {
           unset($options);
           if (forum_is_subscribed($USER->id, $post->forum)) {
               $options[0] = get_string("subscribestart", "forum");
               $options[1] = get_string("subscribestop", "forum");
               choose_from_menu($options, "unsubscribe", 0, "");
           } else {
               $default = 0;
               if (!empty($USER->autosubscribe)) {
                   $default = 1;
               }
               $options[0] = get_string("subscribestop", "forum");
               $options[1] = get_string("subscribestart", "forum");
               choose_from_menu($options, "subscribe", $default, "");
           }
       }
       helpbutton("subscription", get_string("subscription", "forum"), "forum"); 
    ?>
    </td>
</tr>


<?php if ($forum->maxbytes != 1) {  //  1 = No attachments at all  ?>

<tr valign="top">
    <td align="right"><b><?php print_string("attachment", "forum") ?>:<br />(<?php print_string("optional") ?>)&nbsp;</b></td>
    <td>
    <?php $maxbytes = get_max_upload_file_size($CFG->maxbytes, $course->maxbytes, $forum->maxbytes); ?>
    <input type="hidden" name="MAX_FILE_SIZE" value="<?php echo $maxbytes ?>" />
    <input type="file" name="attachment" size="40" alt="<?php print_string("attachment", "forum") ?>" />
    <?php
    helpbutton("attachment", get_string("attachment", "forum"), "forum");
    echo '&nbsp;';
    print_string("maxsize", "", display_size($maxbytes)); 
    ?>
    </td>
</tr>

<?php } ?>


<tr>
    <td align="center" colspan="2">
    <input type="hidden" name="course"     value="<?php p($post->course) ?>" />
    <input type="hidden" name="forum"      value="<?php p($post->forum) ?>" />
    <input type="hidden" name="discussion" value="<?php p($post->discussion) ?>" />
    <input type="hidden" name="parent"     value="<?php p($post->parent) ?>" />
    <input type="hidden" name="userid"     value="<?php p($post->userid) ?>" />
    <input type="hidden" name="groupid"    value="<?php p($post->groupid) ?>" />
    <input type="hidden" name="edit"       value="<?php p($post->edit) ?>" />
    <input type="submit" value="<?php p(($post->edit) ? get_string('savechanges') : get_string('posttoforum', 'forum')); ?>" />
    </td>

</tr>
</table>
</form>
