No more scrolling in order to post something!

No more scrolling in order to post something!

by George Kao -
Number of replies: 6

During the introductory Moodle faculty training this past week, I heard this complaint from several faculty members:

To post something (we use the forums heavily, by the way) we always have to scroll down and click "save changes".  Is it possible to make the posting (writing) window smaller so we don't have to scroll?

Instead of doing that, I came up with this solution (see attached image).

1. However, I'm not a good programmer (yet).  Can someone show me how to put this additional "save changes" button at the top of the interface?

2. Even better, can I make both buttons say "Post to forum" instead?

Thank you!

George

Attachment no_more_scrolling_to_post.png
Average of ratings: -
In reply to George Kao

Re: No more scrolling in order to post something!

by Rudy Scott -

Try pasting the following code into post.html in the /mod/forum folder.

  <td align=center>
    <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>

I pasted it directly after these lines:

<form name="theform" method="post" action="post.php" enctype="multipart/form-data">
<table border="0" cellpadding="5">
<tr valign="top">
    <td align=right><p><b><?php print_string("subject", "forum"); ?>:</b></p></td>
    <td>
        <input type="text" name="subject" size=60 value="<?php p($post->subject) ?>">
    </td>

To get the attached look.  (Note: your code may appear slightly different and require a different adaptation depending on the version of Moodle you are running).

--Rudy

Attachment post_forum.jpg
In reply to Rudy Scott

Re: No more scrolling in order to post something!

by George Kao -

Rudy, thank you for your inspiration & suggestion!

I took your code and was able to successfully paste it where I wanted the new button. (see attached picture)

I'm using Moodle 1.3.  I'll detail what I did for the other programming newbies like myself!

1. In the file moodle/mod/forum/post.html, towards the top, there is the following code:

    <td align=left rowspan=2>
    <?php print_textarea($usehtmleditor, 25, 65, 630, 400, "message", $post->message); ?>
    </td>
</tr>

I changed it to rowspan=3

2. Underneath that code, I pasted the following:

<tr valign="top">

 <td align="center" nowrap valign="top">
    <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>

 <tr valign="top">

 <td align="right" nowrap>

after this, the original code continues:

<font SIZE="1">
     <?php
        helpbutton
... etc.

3. I also went into moodle/lang/en_us/moodle.php and after

$string['popupwindow'] = 'Open file in new window';

I put:
$string['posttoforum'] = 'Post to forum';

4. However, as you will notice, I still have a strange thing going on with the posttoforum button.  Any suggestions?

Thanks for inspiring me to get in and experiment with the code smile

PHP newbie George

Attachment no_more_scrolling_to_post3.png
In reply to George Kao

Re: No more scrolling in order to post something!

by Rudy Scott -

Try adding the line:

$string['posttoforum'] = 'Post to forum';

to the lang/en/forum.php file.

--Rudy