From: Sam H. v. a. <we...@ma...> - 2006-01-20 00:22:24
|
Log Message: ----------- forward-port to head (partial clean up rendering of the info box. it will now not show up unless it has content, and the headings will be rendered more nicely.) Modified Files: -------------- webwork2/conf/templates/math: system.template webwork2/conf/templates/ur: system.template webwork2/htdocs: site_info.txt webwork2/htdocs/css: math.css ur.css webwork2/lib/WeBWorK/ContentGenerator: Home.pm Login.pm LoginProctor.pm ProblemSet.pm ProblemSets.pm Revision Data ------------- Index: system.template =================================================================== RCS file: /webwork/cvs/system/webwork2/conf/templates/ur/system.template,v retrieving revision 1.1 retrieving revision 1.2 diff -Lconf/templates/ur/system.template -Lconf/templates/ur/system.template -u -r1.1 -r1.2 --- conf/templates/ur/system.template +++ conf/templates/ur/system.template @@ -127,9 +127,9 @@ </td> <!--#if can="info"--> <td class="InfoPanel"> - <div class="Info"> + <!--<div class="Info">--> <!--#info--> - </div> + <!--</div>--> </td> <!--#endif--> </tr> Index: system.template =================================================================== RCS file: /webwork/cvs/system/webwork2/conf/templates/math/system.template,v retrieving revision 1.2 retrieving revision 1.3 diff -Lconf/templates/math/system.template -Lconf/templates/math/system.template -u -r1.2 -r1.3 --- conf/templates/math/system.template +++ conf/templates/math/system.template @@ -39,21 +39,23 @@ <div id="content"> <!--#if can="info"--> - <div id="page-info"> - <div class="info-box" id="fisheye"> - <h2>Info</h2> + <!--<div id="page-info">--> + <!--<div class="info-box" id="fisheye">--> <!--#info--> - </div> - </div> + <!--</div>--> + <!--</div>--> <!--#endif--> + <!--#if can="nav"--> <div class="Nav"> <!--#nav style="images" imageprefix="/webwork2_files/images/nav" imagesuffix=".gif" separator=" "--> </div> <!--#endif--> + <!--#if can="title"--> <h1><!--#title--></h1> <!--#endif--> + <!--#if can="message"--> <div class="Message"> <!--#message--> @@ -65,12 +67,14 @@ <!--#body--> </div> <!--#endif--> + <!--#if warnings="1"--> <hr> <div class="Warnings"> <!--#warnings--> </div> <!--#endif--> + <!--#if can="message"--> <div class="Message"> <!--#message--> Index: site_info.txt =================================================================== RCS file: /webwork/cvs/system/webwork2/htdocs/site_info.txt,v retrieving revision 1.3 retrieving revision 1.4 diff -Lhtdocs/site_info.txt -Lhtdocs/site_info.txt -u -r1.3 -r1.4 --- htdocs/site_info.txt +++ htdocs/site_info.txt @@ -0,0 +1,3 @@ +<strong>This is not a public web site. Unauthorized access is +prohibited.</strong> + Index: ur.css =================================================================== RCS file: /webwork/cvs/system/webwork2/htdocs/css/ur.css,v retrieving revision 1.16 retrieving revision 1.17 diff -Lhtdocs/css/ur.css -Lhtdocs/css/ur.css -u -r1.16 -r1.17 --- htdocs/css/ur.css +++ htdocs/css/ur.css @@ -51,6 +51,7 @@ /* (shuld have Message here) */ /* contains info */ +/* FIXME: this is erroniously used by SetMaker.pm. */ td.InfoPanel { background-color: #DDDDDD; color: black; width: 30% } td.InfoPanel h2 { font-size: 120% } td.InfoPanel a:link, @@ -63,6 +64,10 @@ /* WeBWorK classes: These classes are emitted by WeBWorK code and should * appear in ANY WeBWorK template. */ +/* the info escape emits a DIV with this class and id. */ +.info-box { } +#InfoPanel { font-size: smaller; } + /* tables used for laying out form fields shouldn't have a border */ table.FormLayout { border: 0; } table.FormLayout tr { vertical-align: top; } Index: math.css =================================================================== RCS file: /webwork/cvs/system/webwork2/htdocs/css/math.css,v retrieving revision 1.2 retrieving revision 1.3 diff -Lhtdocs/css/math.css -Lhtdocs/css/math.css -u -r1.2 -r1.3 --- htdocs/css/math.css +++ htdocs/css/math.css @@ -50,13 +50,15 @@ /* --- Compound titles (class) ---------------------------------------------- */ +/* WeBWorK is not using this, but it might be nice to have it around later */ + /* "Split" title, with main heading left-aligned above a horizontal line, * and subheading right-aligned below the line. Usage: * * <h1 class="compound">Alumni Newsletter</h1> * <h2 class="compound">Spring '00</h2> */ -/* [ww] not using this, but it might be nice to have it around later */ + /*h1.compound { border-bottom: 1px solid #559; text-align: left; @@ -67,6 +69,10 @@ /* --- Info box (class) ----------------------------------------------------- */ +/* FIXME as a quick hack, the info() escape outputs a DIV with this class. + * don't let the placement of these styles fool you -- <div style="info-box"> + * is output by WeBWorK! */ + /* Common style for a small box to hold supplemental info; typically this * box will appear in a sidebar. Sample usage: * @@ -78,6 +84,7 @@ * <a class="more" href="bar">Older announcements...</a> * </div> */ + .info-box { border: 1px solid #559; border-radius-topright: 1.5ex; border-radius-topleft: 1.5ex; @@ -142,6 +149,7 @@ * appear within the #site-navigation div. Inherits many of its attributes * from class info-box, and overrides some. */ + #mini-sitemap, #fisheye { font-family: Trebuchet MS, Arial, Helvetica, sans-serif; @@ -362,15 +370,6 @@ border-bottom: 1px solid #559; } -/* --- Additional template classes added for WW elements -------------------- */ - -#page-info { - font-size: smaller; - float: right; - width: 40%; - padding-left: 1em; -} - /* --- WeBWorK classes ------------------------------------------------------ */ /* These classes are emitted by WeBWorK code and should appear in ANY WeBWorK @@ -378,6 +377,11 @@ * (These are mostly copied from ur.css right atm.) */ +/* the info escape emits a DIV with this id. (not that the same DIV has class + * "info-box" which is given above in the "template styles" section. Regardless, + * it is emitted by WW code! */ +#InfoPanel { font-size: smaller; float: right; max-width: 40%; } + /* tables used for laying out form fields shouldn't have a border */ table.FormLayout { border: 0; } table.FormLayout tr { vertical-align: top; } Index: ProblemSets.pm =================================================================== RCS file: /webwork/cvs/system/webwork2/lib/WeBWorK/ContentGenerator/ProblemSets.pm,v retrieving revision 1.67 retrieving revision 1.68 diff -Llib/WeBWorK/ContentGenerator/ProblemSets.pm -Llib/WeBWorK/ContentGenerator/ProblemSets.pm -u -r1.67 -r1.68 --- lib/WeBWorK/ContentGenerator/ProblemSets.pm +++ lib/WeBWorK/ContentGenerator/ProblemSets.pm @@ -48,7 +48,10 @@ if (defined $course_info and $course_info) { my $course_info_path = $ce->{courseDirs}->{templates} . "/$course_info"; + print CGI::h2("Course Info"); + # deal with instructor crap + my $editorURL; if ($authz->hasPermissions($user, "access_instructor_tools")) { if (defined $r->param("editMode") and $r->param("editMode") eq "temporaryFile") { $course_info_path = $r->param("sourceFilePath"); @@ -56,13 +59,9 @@ } my $editorPage = $urlpath->newFromModule("WeBWorK::ContentGenerator::Instructor::PGProblemEditor", courseID => $courseID); - my $editorURL = $self->systemLink($editorPage, params => { file_type => "course_info" }); - - print CGI::p(CGI::b("Course Info"), " ", - CGI::a({href=>$editorURL, target=>"WW_Editor"}, "[edit]")); - } else { - print CGI::p(CGI::b("Course Info")); + $editorURL = $self->systemLink($editorPage, params => { file_type => "course_info" }); } + unless (-e $course_info_path) { # FIXME `echo "" >$course_info_path`; # we seem to need to have this file # around to prevent @@ -78,6 +77,10 @@ print $text; } } + + if ($editorURL) { + print CGI::div(CGI::a({href=>$editorURL, target=>"WW_Editor"}, "[edit]")); + } return ""; } Index: ProblemSet.pm =================================================================== RCS file: /webwork/cvs/system/webwork2/lib/WeBWorK/ContentGenerator/ProblemSet.pm,v retrieving revision 1.72 retrieving revision 1.73 diff -Llib/WeBWorK/ContentGenerator/ProblemSet.pm -Llib/WeBWorK/ContentGenerator/ProblemSet.pm -u -r1.72 -r1.73 --- lib/WeBWorK/ContentGenerator/ProblemSet.pm +++ lib/WeBWorK/ContentGenerator/ProblemSet.pm @@ -243,15 +243,13 @@ }, ); + print CGI::p(CGI::b("Set Info")); + + my $editURL; if (defined($set) and $authz->hasPermissions($userID, "modify_problem_sets")) { my $editorPage = $urlpath->newFromModule("WeBWorK::ContentGenerator::Instructor::PGProblemEditor", courseID => $courseID, setID => $set->set_id, problemID => 0); - my $editorURL = $self->systemLink($editorPage, params => { file_type => 'set_header'}); - - print CGI::p(CGI::b("Set Info"), " ", - CGI::a({href=>$editorURL, target=>"WW_Editor"}, "[edit]")); - } else { - print CGI::p(CGI::b("Set Info")); + $editorURL = $self->systemLink($editorPage, params => { file_type => 'set_header'}); } if ($pg->{flags}->{error_flag}) { @@ -260,6 +258,10 @@ print $pg->{body_text}; } + if ($editURL) { + print CGI::div(CGI::a({href=>$editorURL, target=>"WW_Editor"}, "[edit]")); + } + return ""; } Index: LoginProctor.pm =================================================================== RCS file: /webwork/cvs/system/webwork2/lib/WeBWorK/ContentGenerator/LoginProctor.pm,v retrieving revision 1.2 retrieving revision 1.3 diff -Llib/WeBWorK/ContentGenerator/LoginProctor.pm -Llib/WeBWorK/ContentGenerator/LoginProctor.pm -u -r1.2 -r1.3 --- lib/WeBWorK/ContentGenerator/LoginProctor.pm +++ lib/WeBWorK/ContentGenerator/LoginProctor.pm @@ -64,7 +64,8 @@ CGI::p("$@"), ); } else { - print CGI::p(CGI::b("Login Info")), $text; + print CGI::h2("Login Info"); + print $text; } } Index: Login.pm =================================================================== RCS file: /webwork/cvs/system/webwork2/lib/WeBWorK/ContentGenerator/Login.pm,v retrieving revision 1.35 retrieving revision 1.36 diff -Llib/WeBWorK/ContentGenerator/Login.pm -Llib/WeBWorK/ContentGenerator/Login.pm -u -r1.35 -r1.36 --- lib/WeBWorK/ContentGenerator/Login.pm +++ lib/WeBWorK/ContentGenerator/Login.pm @@ -40,58 +40,54 @@ my $r = $self->r; my $ce = $r->ce; + my $result; + # This section should be kept in sync with the Home.pm version my $site_info = $ce->{webworkFiles}->{site_info}; - if (defined $site_info and $site_info) { - my $site_info_path = $site_info; - # deal with previewing a temporary file if (defined $r->param("editMode") and $r->param("editMode") eq "temporaryFile" and defined $r->param("editFileSuffix")) { - $site_info_path .= $r->param("editFileSuffix"); + $site_info .= $r->param("editFileSuffix"); } - if (-f $site_info_path) { - my $text = eval { readFile($site_info_path) }; + if (-f $site_info) { + my $text = eval { readFile($site_info) }; if ($@) { - print CGI::div({class=>"ResultsWithError"}, - CGI::p("$@"), - ); - } elsif($text) { - print CGI::p(CGI::b("Important Message")), $text,CGI::hr(); + $result .= CGI::h2("Site Information"); + $result .= CGI::div({class=>"ResultsWithError"}, $@); + } elsif ($text =~ /\S/) { + $result .= CGI::h2("Site Information"); + $result .= $text; } } - - } - my $login_info = $ce->{courseFiles}->{login_info}; + # FIXME this is basically the same code as above... TIME TO REFACTOR! + my $login_info = $ce->{courseFiles}->{login_info}; if (defined $login_info and $login_info) { - my $login_info_path = $ce->{courseDirs}->{templates} . "/$login_info"; + # login info is relative to the templates directory, apparently + $login_info = $ce->{courseDirs}->{templates} . "/$login_info"; # deal with previewing a temporary file if (defined $r->param("editMode") and $r->param("editMode") eq "temporaryFile" and defined $r->param("editFileSuffix")) { - $login_info_path .= $r->param("editFileSuffix"); + $login_info .= $r->param("editFileSuffix"); } - if (-f $login_info_path) { - my $text = eval { readFile($login_info_path) }; + if (-f $login_info) { + my $text = eval { readFile($login_info) }; if ($@) { - print CGI::div({class=>"ResultsWithError"}, - CGI::p("$@"), - ); - } else { - print CGI::p(CGI::b("Login Info")), $text; + $result .= CGI::h2("Login Info"); + $result .= CGI::div({class=>"ResultsWithError"}, $@); + } elsif ($text =~ /\S/) { + $result .= CGI::h2("Login Info"); + $result .= $text; } } - - } - - return ""; + return CGI::div({class=>"info-box", id=>"InfoPanel"}, $result); } sub body { Index: Home.pm =================================================================== RCS file: /webwork/cvs/system/webwork2/lib/WeBWorK/ContentGenerator/Home.pm,v retrieving revision 1.13 retrieving revision 1.14 diff -Llib/WeBWorK/ContentGenerator/Home.pm -Llib/WeBWorK/ContentGenerator/Home.pm -u -r1.13 -r1.14 --- lib/WeBWorK/ContentGenerator/Home.pm +++ lib/WeBWorK/ContentGenerator/Home.pm @@ -34,33 +34,32 @@ my $r = $self->r; my $ce = $r->ce; - my $site_info = $ce->{webworkFiles}->{site_info}; + my $result; + # This section should be kept in sync with the Login.pm version + my $site_info = $ce->{webworkFiles}->{site_info}; if (defined $site_info and $site_info) { - my $site_info_path = $site_info; - # deal with previewing a temporary file if (defined $r->param("editMode") and $r->param("editMode") eq "temporaryFile" and defined $r->param("editFileSuffix")) { - $site_info_path .= $r->param("editFileSuffix"); + $site_info .= $r->param("editFileSuffix"); } - if (-f $site_info_path) { - my $text = eval { readFile($site_info_path) }; + if (-f $site_info) { + $result .= CGI::h2("Site Information"); + + my $text = eval { readFile($site_info) }; if ($@) { - print CGI::div({class=>"ResultsWithError"}, - CGI::p("$@"), - ); - } elsif ($text) { - print CGI::p(CGI::b("Important Message")), $text,CGI::hr(); + $result .= CGI::div({class=>"ResultsWithError"}, $@); + } elsif ($text =~ /\S/) { + $result .= $text; } } - - } - return ""; - + + return CGI::div({class=>"info-box", id=>"InfoPanel"}, $result); } + sub body { my ($self) = @_; my $r = $self->r; |