Skip to content
Permalink
Browse files

Removal of THEME, added some classes, general tidy up.

  • Loading branch information...
moodler
moodler committed Feb 17, 2005
1 parent 9056cec commit b8340d19380e47cde97cf8dafebc27ed90054b96
@@ -1,17 +1,15 @@
<form name="form" method="post" action="comment.php">
<table class=generalbox cellpadding=5 bgcolor="<?php p($THEME->cellheading)?>">
<tr valign=top>
<td align=right><p><b>
<table class="generalbox">
<tr valign="top">
<td align="right"><b>
<?php echo get_string("comment","glossary") ?>:
</b></p></td>
<td align="left" rowspan="2">
</b></td>
<td rowspan="2">
<?php print_textarea($usehtmleditor, 25, 65, 630, 400, "text", $form->text); ?>
</td>
</tr>
<tr valign="top">
<td align="right" valign="middle" nowrap="nowrap">

<font size="1">
<td align="right" nowrap="nowrap">
<?php
helpbutton("writing", get_string("helpwriting"), "moodle", true, true);
echo "<br />";
@@ -20,14 +18,12 @@
} else {
emoticonhelpbutton("form", "text");
}
echo "<br />";
?>
<br />
</font>

</td>
</tr>
<tr valign=top>
<td align=right><p><b><?php print_string("formattexttype"); ?>:</b></p></td>
<tr valign="top">
<td align="right"><b><?php print_string("formattexttype"); ?>:</b></td>
<td>
<?php
if ($usehtmleditor) { /// Trying this out for a while
@@ -44,24 +40,23 @@
</td>
</tr>
<tr>
<td colspan=2>
<p align=center>
<td colspan="2">
<center>
<?php
if (isset($comment->id)) {
echo "<input type=\"hidden\" name=cid value=\"$comment->id\" />";
echo "<input type=\"hidden\" name=\"cid\" value=\"$comment->id\" />";
}
?>
<input type="hidden" name=id value="<?php p($cm->id) ?>" />
<input type="hidden" name=eid value="<?php p($entry->id) ?>" />
<input type="hidden" name=action value="<?php p($action) ?>" />
<input type="hidden" name=confirm value="1">
<input type="hidden" name="id" value="<?php p($cm->id) ?>" />
<input type="hidden" name="eid" value="<?php p($entry->id) ?>" />
<input type="hidden" name="action" value="<?php p($action) ?>" />
<input type="hidden" name="confirm" value="1" />

<input type="submit" value="<?php print_string("savechanges") ?>" />
<input type="reset" value="<?php print_string("revert") ?>" />
</p>
</center>
</td>
</tr>
</table>
</p>

</form>
@@ -1,8 +1,8 @@
<?php // $Id$
/// This page prints a particular instance of glossary
require_once("../../config.php");
require_once("lib.php");
require_once('../../config.php');
require_once('lib.php');
require_variable($id); // Course Module ID
require_variable($eid); // Entry ID
@@ -14,98 +14,98 @@
$action = strtolower($action);
global $THEME, $USER, $CFG;
global $USER, $CFG;
if (! $cm = get_record("course_modules", "id", $id)) {
error("Course Module ID was incorrect");
if (! $cm = get_record('course_modules', 'id', $id)) {
error('Course Module ID was incorrect');
}
if (! $course = get_record("course", "id", $cm->course)) {
error("Course is misconfigured");
if (! $course = get_record('course', 'id', $cm->course)) {
error('Course is misconfigured');
}
if (! $glossary = get_record("glossary", "id", $cm->instance)) {
error("Course module is incorrect");
if (! $glossary = get_record('glossary', 'id', $cm->instance)) {
error('Course module is incorrect');
}
if (! $entry = get_record("glossary_entries", "id", $eid)) {
error("Entry is incorrect");
if (! $entry = get_record('glossary_entries', 'id', $eid)) {
error('Entry is incorrect');
}
if ( $cid ) {
if (! $comment = get_record("glossary_comments", "id", $cid)) {
error("Comment is incorrect");
if (! $comment = get_record('glossary_comments', 'id', $cid)) {
error('Comment is incorrect');
}
}
require_login($course->id, false, $cm);
if (isguest()) {
error("Guests are not allowed to post comments", $_SERVER["HTTP_REFERER"]);
error('Guests are not allowed to post comments', $_SERVER['HTTP_REFERER']);
}
add_to_log($course->id, "glossary", "view", "view.php?id=$cm->id", "$glossary->id",$cm->id);
add_to_log($course->id, 'glossary', 'view', "view.php?id=$cm->id", "$glossary->id",$cm->id);
switch ( $action ){
case "add":
$straction = get_string("addingcomment","glossary");
case 'add':
$straction = get_string('addingcomment','glossary');
break;
case "edit":
$straction = get_string("editingcomment","glossary");
case 'edit':
$straction = get_string('editingcomment','glossary');
break;
case "delete":
$straction = get_string("deletingcomment","glossary");
case 'delete':
$straction = get_string('deletingcomment','glossary');
break;
default:
$action = "add";
$straction = get_string("addingcomment","glossary");
$action = 'add';
$straction = get_string('addingcomment','glossary');
break;
}
$strglossaries = get_string("modulenameplural", "glossary");
$strglossary = get_string("modulename", "glossary");
$strcomments = get_string("comments", "glossary");
$strglossaries = get_string('modulenameplural', 'glossary');
$strglossary = get_string('modulename', 'glossary');
$strcomments = get_string('comments', 'glossary');
print_header_simple(strip_tags("$glossary->name"), "",
"<a href=index.php?id=$course->id>$strglossaries</a> -> <a href=view.php?id=$cm->id>$glossary->name</a> -> <a href=comments.php?id=$cm->id&amp;eid=$entry->id>$strcomments</a> -> " . $straction,
"", "", true, update_module_button($cm->id, $course->id, $strglossary),
print_header_simple(strip_tags("$glossary->name"), '',
"<a href=\"index.php?id=$course->id\">$strglossaries</a> -> <a href=\"view.php?id=$cm->id\">$glossary->name</a> -> <a href=\"comments.php?id=$cm->id&amp;eid=$entry->id\">$strcomments</a> -> " . $straction,
'', '', true, update_module_button($cm->id, $course->id, $strglossary),
navmenu($course, $cm));
echo "<center>";
echo '<center>';
/// Input section
if ( $action == "delete" ) {
if ( $action == 'delete' ) {
if (($comment->userid <> $USER->id) and !isteacher($glossary->course)) {
error("You can't delete other people's comments!");
error('You can\'t delete other people\'s comments!');
}
if (!$glossary->allowcomments && !isteacher($glossary->course)) {
error("You can't delete comments in this glossary!");
error('You can\'t delete comments in this glossary!');
}
if ( $confirm ) {
delete_records("glossary_comments","id", $cid);
delete_records('glossary_comments','id', $cid);
print_simple_box_start("center","40%", "#FFBBBB");
echo "<center>" . get_string("commentdeleted","glossary") . "</center>";
print_simple_box_start('center','40%', '#FFBBBB');
echo '<center>'.get_string('commentdeleted','glossary').'</center>';
print_simple_box_end();
print_footer($course);
add_to_log($course->id, "glossary", "delete comment", "comments.php?id=$cm->id&amp;eid=$entry->id", "$comment->id",$cm->id);
add_to_log($course->id, 'glossary', 'delete comment', "comments.php?id=$cm->id&amp;eid=$entry->id", "$comment->id",$cm->id);
redirect("comments.php?id=$cm->id&amp;eid=$entry->id");
} else {
glossary_print_comment($course, $cm, $glossary, $entry, $comment);
print_simple_box_start("center","40%", "#FFBBBB");
echo "<center><br />" . get_string("areyousuredeletecomment","glossary");
print_simple_box_start('center','40%', '#FFBBBB');
echo '<center><br />'.get_string('areyousuredeletecomment','glossary');
?>
<form name="form" method="post" action="comment.php">
<input type="hidden" name=id value="<?php p($id) ?>" />
<input type="hidden" name=eid value="<?php p($eid) ?>" />
<input type="hidden" name=cid value="<?php p($cid) ?>" />
<input type="hidden" name=action value="delete" />
<input type="hidden" name=confirm value="1" />
<input type="submit" value=" <?php print_string("yes")?> " />
<input type=button value=" <?php print_string("no")?> " onclick="javascript:history.go(-1);" />
<input type="hidden" name="id" value="<?php p($id) ?>" />
<input type="hidden" name="eid" value="<?php p($eid) ?>" />
<input type="hidden" name="cid" value="<?php p($cid) ?>" />
<input type="hidden" name="action" value="delete" />
<input type="hidden" name="confirm" value="1" />
<input type="submit" value="<?php print_string('yes')?>" />
<input type="button" value="<?php print_string('no')?>" onclick="javascript:history.go(-1);" />

</form>
</center>
@@ -114,9 +114,9 @@
}
} else {
if (!$glossary->allowcomments && !isteacher($glossary->course)) {
error("You can't add/edit comments to this glossary!");
error('You can\'t add/edit comments to this glossary!');
}
if ( $action == "edit" ) {
if ( $action == 'edit' ) {
if (!isset($comment->timemodified)) {
$timetocheck = 0;
} else {
@@ -125,9 +125,9 @@
$ineditperiod = ((time() - $timetocheck < $CFG->maxeditingtime) || $glossary->editalways);
if ( (!$ineditperiod || $USER->id != $comment->userid) and !isteacher($course->id) and $cid) {
if ( $USER->id != $comment->userid ) {
error("You can't edit other people's comments!");
error('You can\'t edit other people\'s comments!');
} elseif (!$ineditperiod) {
error("You can't edit this. Time expired!");
error('You can\'t edit this. Time expired!');
}
die;
}
@@ -141,26 +141,26 @@
$newentry->format = $form->format;
$newentry->timemodified = time();
if ( $action == "add" ) {
if ( $action == 'add' ) {
$newentry->userid = $USER->id;
if (! $newentry->id = insert_record("glossary_comments", $newentry)) {
error("Could not insert this new comment");
if (! $newentry->id = insert_record('glossary_comments', $newentry)) {
error('Could not insert this new comment');
} else {
add_to_log($course->id, "glossary", "add comment", "comments.php?id=$cm->id&amp;eid=$entry->id", "$newentry->id", $cm->id);
add_to_log($course->id, 'glossary', 'add comment', "comments.php?id=$cm->id&amp;eid=$entry->id", "$newentry->id", $cm->id);
}
} else {
$newentry->id = $form->cid;
$newentry->userid = $comment->userid;
if (! update_record("glossary_comments", $newentry)) {
error("Could not update this comment");
if (! update_record('glossary_comments', $newentry)) {
error('Could not update this comment');
} else {
add_to_log($course->id, "glossary", "update comment", "comments.php?id=$cm->id&amp;eid=$entry->id", "$newentry->id",$cm->id);
add_to_log($course->id, 'glossary', 'update comment', "comments.php?id=$cm->id&amp;eid=$entry->id", "$newentry->id",$cm->id);
}
}
print_simple_box_start("center","40%", "#FFBBBB");
echo "<center>" . get_string("commentupdated","glossary") . "</center>";
print_simple_box_start('center','40%', '#FFBBBB');
echo '<center>'.get_string('commentupdated','glossary').'</center>';
print_simple_box_end();
print_footer($course);
@@ -169,8 +169,8 @@
} else {
/// original glossary entry
glossary_print_entry($course, $cm, $glossary, $entry, "", "", false);
echo "<br />";
glossary_print_entry($course, $cm, $glossary, $entry, '', '', false);
echo '<br />';
if ($usehtmleditor = can_use_html_editor()) {
$defaultformat = FORMAT_HTML;
@@ -181,16 +181,19 @@
$form->text = $comment->comment;
$form->format = $comment->format;
} else {
$form->text = "";
$form->text = '';
$form->format = $defaultformat;
}
include("comment.html");
include('comment.html');
if ($usehtmleditor) {
use_html_editor("text");
use_html_editor('text');
}
}
}
echo '</center>';
/// Finish the page
print_footer($course);
?>
@@ -1,13 +1,13 @@
<?php // $Id$
/// This page prints a particular instance of glossary
require_once("../../config.php");
require_once("lib.php");
require_once('../../config.php');
require_once('lib.php');
require_variable($id); // Course Module ID
require_variable($eid); // Entry ID
global $THEME, $USER, $CFG;
global $USER, $CFG;
if (! $cm = get_record("course_modules", "id", $id)) {
error("Course Module ID was incorrect");
@@ -125,7 +125,7 @@ function glossary_upgrade($oldversion) {
}
if ( $oldversion < 2003103100 ) {
print_simple_box("This update might take several seconds.<p>The more glossaries, entries and categories you have created, the more it will take so please be patient.","center", "50%", "$THEME->cellheading", "20", "noticebox");
print_simple_box('This update might take several seconds.<br />The more glossaries, entries and categories you have created, the more it will take so please be patient.','center', '50%', '', '20', 'noticebox');
if ( $glossaries = get_records("glossary")) {
$gids = "";
foreach ( $glossaries as $glossary ) {
@@ -258,7 +258,7 @@ function glossary_upgrade($oldversion) {
if ( $oldversion < 2004051400 ) {
print_simple_box("This update might take several seconds.<p>The more glossaries, entries and aliases you have created, the more it will take so please be patient.","center", "50%", "$THEME->cellheading", "20", "noticebox");
print_simple_box("This update might take several seconds.<p>The more glossaries, entries and aliases you have created, the more it will take so please be patient.","center", "50%", '', "20", "noticebox");
if ( $entries = get_records("glossary_entries", '', '', '', 'id,concept')) {
foreach($entries as $entry) {
set_field("glossary_entries","concept",addslashes(trim($entry->concept)),"id",$entry->id);
@@ -20,7 +20,7 @@ function glossary_upgrade($oldversion) {
}
if ( $oldversion < 2004051400 ) {
print_simple_box("This update might take several seconds.<p>The more glossaries, entries and aliases you have created, the more it will take so please be patient.","center", "50%", "$THEME->cellheading", "20", "noticebox");
print_simple_box("This update might take several seconds.<p>The more glossaries, entries and aliases you have created, the more it will take so please be patient.","center", "50%", '', "20", "noticebox");
if ( $entries = get_records("glossary_entries", '', '', '', 'id,concept')) {
foreach($entries as $entry) {
set_field("glossary_entries","concept",addslashes(trim($entry->concept)),"id",$entry->id);
@@ -1,9 +1,9 @@
<?php // $Id$
require_once("../../config.php");
require_once("lib.php");
require_once('../../config.php');
require_once('lib.php');
global $CFG, $USER, $THEME;
global $CFG, $USER;
require_variable($id); // Course Module ID
optional_variable($e); // EntryID

0 comments on commit b8340d1

Please sign in to comment.
You can’t perform that action at this time.