Permalink
Browse files

- Now entries could be commented by other users.

- KNOWN BUG: It does not restore the comments even when userinfo is set... Eloy! I need your help! :)
  • Loading branch information...
1 parent b16f034 commit ed0201dd7f32299f8a5dee9d504b74b07149a4f8 willcast committed Oct 16, 2003
View
@@ -1,20 +1,29 @@
<?PHP // $Id$
// glossary.php - created with Moodle 1.1 Beta (2003082001)
+$string['addcomment'] = "Add comment";
$string['addentry'] = "Add a new entry";
$string['allentries'] = "ALL";
$string['allcategories'] = "All Categories";
+$string['allowcomments'] = "Allow comments on entries";
$string['allowduplicatedentries'] = "Duplicated entries allowed";
$string['alphabet'] = "A|B|C|D|E|F|G|H|I|J|K|L|M|N|O|P|Q|R|S|T|U|V|W|X|Y|Z";
$string['areyousuredelete'] = "Are you sure you want to delete this entry?";
+$string['areyousuredeletecomment'] = "Are you sure you want to delete this comment?";
$string['attachment'] = "Attachment";
$string['back'] = "Back";
$string['categories'] = "Categories";
$string['categoryview'] = "Browse by category";
$string['category'] = "Category";
$string['categorydeleted'] = "Category deleted";
+$string['comment'] = "Comment";
+$string['commentdeleted'] = "The comment has been deleted.";
+$string['commentupdated'] = "The comment has been updated.";
+$string['comments'] = "Comments";
+$string['commentson'] = "Comments on";
$string['concept'] = "Concept";
$string['concepts'] = "Concepts";
+$string['deletingcomment'] = "Deleting comment";
$string['definition'] = "Definition";
$string['definitions'] = "Definitions";
$string['deleteentry'] = "Delete entry";
@@ -24,8 +33,9 @@
$string['displayformat1'] = "Full without author";
$string['displayformat2'] = "Full with author";
$string['displayformat3'] = "Encyclopedia";
-$string['editentry'] = "Edit entry";
$string['editcategories'] = "Edit categories";
+$string['editentry'] = "Edit entry";
+$string['editingcomment'] = "Editing comment";
$string['entries'] = "Entries";
$string['entrieswithoutcategory'] = "Entries without category";
$string['entry'] = "Entry";
@@ -41,8 +51,11 @@
$string['mainglossary'] = "Main glossary";
$string['modulename'] = "Glossary";
$string['modulenameplural'] = "Glossaries";
+$string['maxtimehaspassed'] = "Sorry, but the maximum time for editing this comment (\$a) has passed!";
$string['newglossaryentries'] = "New glossary entries:";
$string['notcategorised'] = "Not categorised";
+$string['nocomment'] = "No comment found";
+$string['nocomments'] = "(No comments found on this entry)";
$string['noentries'] = "No entries found in this section";
$string['noentry'] = "No entry found.";
$string['searchindefinition'] = "Search definitions too";
@@ -55,5 +68,6 @@
$string['studentcanpost'] = "Students can add entries";
$string['warningstudentcapost'] = "(Applies only if the glossary is not the main one)";
$string['writtenby'] = "by";
+$string['youarenottheauthor'] = "You are not the author of this comment, therefore, you are not allowed to edit it.";
?>
@@ -0,0 +1,4 @@
+<P ALIGN=CENTER><B>Allow comments on entries</B></P>
+
+<P>You can specify if the system should or should not allow comments on glossary entries.
+
View
@@ -11,6 +11,12 @@
// | |
// glossary_entries -------------- glossary_entries_categories
// (UL,pk->id, fk->glossaryid, files) (UL, [pk->categoryid,entryid]
+ // |
+ // |
+ // |
+ // glossary_comments
+ // (UL,pk->id, fk->entryid)
+ //
//
// Meaning: pk->primary key field of the table
// fk->foreign key to link with parent
@@ -45,13 +51,17 @@ function glossary_backup_mods($bf,$preferences) {
fwrite ($bf,full_tag("SHOWSPECIAL",4,false,$glossary->showspecial));
fwrite ($bf,full_tag("SHOWALPHABET",4,false,$glossary->showalphabet));
fwrite ($bf,full_tag("SHOWALL",4,false,$glossary->showall));
+ fwrite ($bf,full_tag("ALLOWCOMMENTS",4,false,$glossary->allowcomments));
fwrite ($bf,full_tag("TIMECREATED",4,false,$glossary->timecreated));
fwrite ($bf,full_tag("TIMEMODIFIED",4,false,$glossary->timemodified));
backup_glossary_entries($bf,$preferences,$glossary->id, $preferences->mods["glossary"]->userinfo);
backup_glossary_categories($bf,$preferences,$glossary->id, $preferences->mods["glossary"]->userinfo);
+ if ( $preferences->mods["glossary"]->userinfo ) {
+ backup_glossary_comments($bf,$preferences,$glossary->id, $preferences->mods["glossary"]->userinfo);
+ }
//End mod
$status =fwrite ($bf,end_tag("MOD",3,true));
}
@@ -134,7 +144,26 @@ function backup_glossary_entries ($bf,$preferences,$glossary, $userinfo) {
fwrite ($bf,full_tag("TIMECREATED",6,false,$glo_ent->timecreated));
fwrite ($bf,full_tag("TIMEMODIFIED",6,false,$glo_ent->timemodified));
fwrite ($bf,full_tag("TEACHERENTRY",6,false,$glo_ent->teacherentry));
-
+/*
+ if ( $userinfo ) {
+ $comments = get_records("glossary_comments","entryid",$glo_ent->id);
+ if ( $comments ) {
+ $status =fwrite ($bf,start_tag("COMMENTS",6,true));
+ foreach ($comments as $comment) {
+ $status =fwrite ($bf,start_tag("COMMENT",7,true));
+
+ fwrite ($bf,full_tag("ID",6,false,$comment->id));
+ fwrite ($bf,full_tag("USERID",6,false,$comment->userid));
+ fwrite ($bf,full_tag("COMMENT",6,false,$comment->comment));
+ fwrite ($bf,full_tag("FORMAT",6,false,$comment->format));
+ fwrite ($bf,full_tag("TIMEMODIFIED",6,false,$comment->timemodified));
+
+ $status =fwrite ($bf,end_tag("COMMENT",7,true));
+ }
+ $status =fwrite ($bf,end_tag("COMMENTS",6,true));
+ }
+ }
+*/
$status =fwrite ($bf,end_tag("ENTRY",5,true));
//Now include entry attachment in backup (if it exists)
@@ -151,7 +180,6 @@ function backup_glossary_entries ($bf,$preferences,$glossary, $userinfo) {
return $status;
}
-
//Backup glossary files because we've selected to backup user info
//or current entry is a teacher entry
function backup_glossary_files($bf,$preferences,$glossary,$entry) {
View
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
@@ -0,0 +1,68 @@
+<?php
+ global $CFG, $THEME;
+ require_once("../../config.php");
+ require_once("lib.php");
+?>
+<FORM name="theform" method="post" <?=$onsubmit ?> action="comment.php">
+<table class=generalbox cellpadding=5 bgcolor="<?php p($THEME->cellheading)?>">
+<tr valign=top>
+ <td align=right><p><b><?php echo get_string("comment","glossary") ?>:</b></p>
+ <font size="1">
+ <?php
+ helpbutton("writing", get_string("helpwriting"), "moodle", true, true);
+ echo "<br />";
+ if ($usehtmleditor) {
+ helpbutton("richtext", get_string("helprichtext"), "moodle", true, true);
+ } else {
+ emoticonhelpbutton("form", "comment");
+ }
+ ?>
+ <br />
+ </font>
+ </td>
+ <td>
+ <?php
+ print_textarea($usehtmleditor, 20, 60, 680, 400, "text", $form->text);
+
+ echo "<p align=right>";
+ helpbutton("textformat", get_string("helpformatting"));
+ print_string("formattexttype");
+ echo ":&nbsp;";
+ if (!$form->format) {
+ $form->format = $defaultformat;
+ }
+ choose_from_menu(format_text_menu(), "format", $format->format, "");
+ echo "</p>";
+ ?>
+ </td>
+</tr>
+<tr>
+<td colspan=2>
+ <p align=center>
+ <?php
+ if ($comment->id) {
+ echo "<input type=\"hidden\" name=cid value=\"$comment->id\">";
+ }
+ ?>
+ <input type="hidden" name=id value="<?=$cm->id ?>">
+ <input type="hidden" name=eid value="<?=$entry->id ?>">
+ <input type="hidden" name=action value="<?=$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>
+</td>
+</tr>
+</table>
+</p>
+
+
+</form>
+
+<?PHP
+ if ($usehtmleditor) {
+ print_richedit_javascript("theform", "text", "no");
+ }
+?>
+
Oops, something went wrong.

0 comments on commit ed0201d

Please sign in to comment.