WeBWorK Main Forum

course headers

course headers

by Zak Zarychta -
Number of replies: 4
How might one include information such as the course name and course number in the course header using the sort of thing in the set and hardcopy headers such as

\{ protect_underbar($courseNumber) \}
\{ protect_underbar($courseName) \}

Zak
In reply to Zak Zarychta

Re: course headers

by Arnold Pizer -
Hi Zak,  

I'm not sure what you want to do but many of the header files already do that, e.g. ASimpleHardCopyHeaderFile.pg.  ASimpleScreenHeaderFile.pg doesn't have the course name since it appears elsewhere on the page but you certainly could add it if you want.

My suggestion would be to look at the header files that exist and use them as samples.

Arnie
In reply to Arnold Pizer

Re: course headers

by Zak Zarychta -
It appears that the curse header files are read in a different way to the set header files for example pasting the contents of


ASimpleScreenHeaderFile.pg

into the course header does not yield the same result as it does for the set header

The output for the course header in the browser window is

##ASimpleScreenHeaderFile.pg DOCUMENT(); loadMacros( "PG.pl", "PGbasicmacros.pl", ); BEGIN_TEXT $BBOLD WeBWorK Assignment \{ protect_underbar($setNumber) \} is due : $formattedDueDate. $EBOLD $PAR Here's the list of \{ htmlLink(qq!http://webwork.maa.org/wiki/Available_Functions!,"functions and symbols") \} that WeBWorK understands. END_TEXT # Uncomment and edit the lines below if this course has a web page. Note that this is comment in Perl mode. #BEGIN_TEXT #$PAR #See the course web page for information \{ htmlLink(qq!http://yoururl/yourcourse!,"your course name") \} #END_TEXT ENDDOCUMENT();

whilst the set header yields

WeBWorK Assignment FYO_00053_set_0 is due : 09/16/2011 at 12:16pm BST.

Here's the list of functions and symbols that WeBWorK understands.

Now i understand that variables like $formattedDueDate & $setNumber are not really thing that i would want to include in the course header.

I was wondering why the course header and set header render the same file differently and if it is possible to include some of the descriptive course variables such as $courseName and $courseNumber which i've tried to include without success.


Zak

In reply to Zak Zarychta

Re: course headers

by Dick Lane -
Despite having a ".txt" extension, the files course_info.txt, login_info.txt, and site_info.txt (in webwork2/htdocs) are processed as html (or, perhaps, xml ??).  I am not sure where to find this info in the system documentation --- in particular, it is not clear whether they are processed in a context which includes access to any of the course configuration variables.

FWIW: a recent change to math2.css seems to have caused their contents to be displayed in a severely narrowed style (about 15% of window width) while the screen headers (which are written using pg markup and processed within the course's context) are shown more readably (about 40% of window width).

In reply to Dick Lane

Re: course headers

by Jason Aubrey -
Hi Zak and Dick,

The login page for courses is generated by Login.pm, and Login.pm does not use WeBWorK::PG, so does not have access to all of the pg code.

The content generator modules "inside" of webwork are subclasses of ContentGenerator.pm, and that's how they get WeBWorK::PG. I just quickly looked at this to answer your question, and I don't know how easy it would be to add this capability to Login.pm. I'm sure there was a reason it was done this way; perhaps there are permissions/security issues behind it.

Jason

Edit: On the other hand, you do get the $ce object in Login.pm, and that has a ton of information in it, and you can add to it in course.conf. So, you could edit Login.pm to get access to the information you want through $ce and then display that information somewhere on the page. You woudn't be able to do it through course_info.txt or using pg macros, but it might be an easy way to accomplish what you want to do.