Log Message:
-----------
Implimentation of COMMENT for comments to appear in the library browser.
Modified Files:
--------------
pg/macros:
PG.pl
PGbasicmacros.pl
Revision Data
-------------
Index: PGbasicmacros.pl
===================================================================
RCS file: /webwork/cvs/system/pg/macros/PGbasicmacros.pl,v
retrieving revision 1.38
retrieving revision 1.39
diff -Lmacros/PGbasicmacros.pl -Lmacros/PGbasicmacros.pl -u -r1.38 -r1.39
--- macros/PGbasicmacros.pl
+++ macros/PGbasicmacros.pl
@@ -44,6 +44,7 @@
$SOL,
$SOLUTION,
$HINT,
+ $COMMENT,
$US,
$SPACE,
$BBOLD,
@@ -976,6 +977,31 @@
# End hints and solutions macros
#################################
+=head2 Comments to instructors
+
+ COMMENT('text','text2',...);
+
+Takes the text to be lines of a comment to be shown only
+in the Library Browser below the rendered problem.
+
+The function COMMENT stores the needed html in the variable
+pgComment, which gets transfered to the flag 'comment' in PG_FLAGS.
+
+=cut
+
+# Add a comment which will display in the Library browser
+# Currently, the only output is html
+
+sub COMMENT {
+ my @in = @_;
+ my $out = join("$BR", @in);
+ my $out = '<div class=\"AuthorComment\">'.$out.'</div>';
+
+ PG_restricted_eval(q!$main::pgComment = "!.$out.q!"!);
+ return('');
+}
+
+#################################
# Produces a random number between $begin and $end with increment 1.
# You do not have to worry about integer or floating point types.
Index: PG.pl
===================================================================
RCS file: /webwork/cvs/system/pg/macros/PG.pl,v
retrieving revision 1.21
retrieving revision 1.22
diff -Lmacros/PG.pl -Lmacros/PG.pl -u -r1.21 -r1.22
--- macros/PG.pl
+++ macros/PG.pl
@@ -137,6 +137,7 @@
$main::showHint = 1 unless defined($main::showHint);
$main::solutionExists =0;
$main::hintExists =0;
+ $main::pgComment = '';
%main::gifs_created = ();
!);
@@ -446,9 +447,10 @@
images are not used).
(4) solutionExits -- indicates the existence of a solution.
(5) hintExits -- indicates the existence of a hint.
- (6) showHintLimit -- determines the number of attempts after which hint(s) will be shown
+ (6) comment -- contents of COMMENT commands if any.
+ (7) showHintLimit -- determines the number of attempts after which hint(s) will be shown
- (7) PROBLEM_GRADER_TO_USE -- chooses the problem grader to be used in this order
+ (8) PROBLEM_GRADER_TO_USE -- chooses the problem grader to be used in this order
(a) A problem grader specified by the problem using:
install_problem_grader(\&grader);
(b) One of the standard problem graders defined in PGanswermacros.pl when set to
@@ -478,6 +480,7 @@
$main::PG_FLAGS{'showPartialCorrectAnswers'} = $main::showPartialCorrectAnswers;
$main::PG_FLAGS{'recordSubmittedAnswers'} = $main::recordSubmittedAnswers;
$main::PG_FLAGS{'refreshCachedImages'} = $main::refreshCachedImages;
+ $main::PG_FLAGS{'comment'} = $main::pgComment;
$main::PG_FLAGS{'hintExists'} = $main::hintExists;
$main::PG_FLAGS{'showHintLimit'} = $main::showHint;
$main::PG_FLAGS{'solutionExists'} = $main::solutionExists;
|