mirror of
https://github.com/moodle/moodle.git
synced 2025-01-21 23:48:45 +01:00
Some improvements to the forum editing interface to make the buttons
hide/show appropriately
This commit is contained in:
parent
98914efdbe
commit
f2f564066b
@ -98,6 +98,7 @@ $string['ratingonlyteachers'] = "Only \$a can rate posts";
|
||||
$string['rating'] = "Rating";
|
||||
$string['ratings'] = "Ratings";
|
||||
$string['ratingssaved'] = "Ratings saved";
|
||||
$string['ratingsuse'] = "Use ratings";
|
||||
$string['ratingtime'] = "Restrict ratings to posts with dates in this range:";
|
||||
$string['re'] = "Re:"; // Put in front of subjects that are replies to another post
|
||||
$string['readtherest'] = "Read the rest of this topic";
|
||||
|
@ -51,6 +51,10 @@ function forum_add_instance($forum) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!$forum->userating) {
|
||||
$forum->assessed = 0;
|
||||
}
|
||||
|
||||
if (!empty($forum->ratingtime)) {
|
||||
$forum->assesstimestart = make_timestamp($forum->startyear, $forum->startmonth, $forum->startday,
|
||||
$forum->starthour, $forum->startminute, 0);
|
||||
@ -86,6 +90,10 @@ function forum_update_instance($forum) {
|
||||
$forum->timemodified = time();
|
||||
$forum->id = $forum->instance;
|
||||
|
||||
if (!$forum->userating) {
|
||||
$forum->assessed = 0;
|
||||
}
|
||||
|
||||
if (!empty($forum->ratingtime)) {
|
||||
$forum->assesstimestart = make_timestamp($forum->startyear, $forum->startmonth, $forum->startday,
|
||||
$forum->starthour, $forum->startminute, 0);
|
||||
|
@ -84,28 +84,43 @@
|
||||
<td align=right valign=top><p><b><?php print_string("allowratings", "forum") ?>:</b></p></td>
|
||||
<td>
|
||||
<?php
|
||||
echo "<script>";
|
||||
echo " var subitemstime = ['startday','startmonth','startyear','starthour', 'startminute',".
|
||||
"'finishday','finishmonth','finishyear','finishhour','finishminute'];";
|
||||
echo " var subitemsall = ['assessed', 'ratingtime', 'scale', 'startday','startmonth','startyear','starthour', 'startminute',".
|
||||
"'finishday','finishmonth','finishyear','finishhour','finishminute'];";
|
||||
echo "</script>";
|
||||
|
||||
echo "<input name=\"userating\" type=checkbox value=1 ";
|
||||
echo " onclick=\"return lockoptions('form','userating', subitemsall)\" ";
|
||||
if ($form->assessed) {
|
||||
echo " checked ";
|
||||
}
|
||||
echo ">";
|
||||
echo get_string("ratingsuse", "forum").":";
|
||||
echo "<br />";
|
||||
|
||||
// The odd order below was to maintain backward compatibility
|
||||
unset($options);
|
||||
$options[0] = get_string("ratingno", "forum");
|
||||
$options[2] = get_string("ratingonlyteachers", "forum", moodle_strtolower($course->teachers));
|
||||
$options[1] = get_string("ratingeveryone", "forum");
|
||||
|
||||
echo get_string("users").":";
|
||||
choose_from_menu($options, "assessed", $form->assessed, "");
|
||||
helpbutton("ratings", get_string("allowratings", "forum"), "forum");
|
||||
echo "<br />";
|
||||
|
||||
echo get_string("scale").":";
|
||||
print_scale_menu($course->id, "scale", $form->scale);
|
||||
echo "<br />";
|
||||
echo "<script>";
|
||||
echo " var subitems = ['startday','startmonth','startyear','starthour', 'startminute',".
|
||||
"'finishday','finishmonth','finishyear','finishhour','finishminute'];";
|
||||
echo "</script>";
|
||||
|
||||
echo "<input name=\"ratingtime\" type=checkbox value=1 ";
|
||||
echo " onclick=\"return lockoptions('form','ratingtime', subitems)\" ";
|
||||
echo " onclick=\"return lockoptions('form','ratingtime', subitemstime)\" ";
|
||||
if ($form->assesstimestart and $form->assesstimefinish and $form->assessed) {
|
||||
$form->ratingtime = 1;
|
||||
echo " checked ";
|
||||
}
|
||||
echo ">";
|
||||
|
||||
print_string("ratingtime", "forum");
|
||||
echo "<table align=left><tr><td align=right nowrap>";
|
||||
echo get_string("from").":";
|
||||
@ -117,6 +132,9 @@
|
||||
print_time_selector("finishhour", "finishminute", $form->assesstimefinish);
|
||||
echo "<br />";
|
||||
echo "</td></tr></table>";
|
||||
echo "<input type=\"hidden\" name=\"hratingtime\" value=0>";
|
||||
echo "<input type=\"hidden\" name=\"hassessed\" value=0>";
|
||||
echo "<input type=\"hidden\" name=\"hscale\" value=0>";
|
||||
echo "<input type=\"hidden\" name=\"hstartday\" value=0>";
|
||||
echo "<input type=\"hidden\" name=\"hstartmonth\" value=0>";
|
||||
echo "<input type=\"hidden\" name=\"hstartyear\" value=0>";
|
||||
@ -128,9 +146,13 @@
|
||||
echo "<input type=\"hidden\" name=\"hfinishhour\" value=0>";
|
||||
echo "<input type=\"hidden\" name=\"hfinishminute\" value=0>";
|
||||
|
||||
echo "<script>";
|
||||
echo "lockoptions('form','userating', subitemsall);";
|
||||
echo "</script>";
|
||||
|
||||
if (empty($form->ratingtime)) {
|
||||
echo "<script>";
|
||||
echo "lockoptions('form','ratingtime', subitems);";
|
||||
echo "lockoptions('form','ratingtime', subitemstime);";
|
||||
echo "</script>";
|
||||
}
|
||||
?>
|
||||
|
Loading…
x
Reference in New Issue
Block a user