From: Sam H. v. a. <we...@ma...> - 2005-01-28 00:07:11
|
Log Message: ----------- Moved stylesheet into a separate file. Created new htdocs/css directory, added stylesheet to that directory (ur.css). Include stylesheet in ur.template with new "url" template escape: <!--#url type="webwork" name="stylesheet"--> This is 132 lines that Template.pm doesn't have to parse and 4368 bytes that don't have to get sent to the client with every request. Modified Files: -------------- webwork2/conf/templates: ur.template webwork2/lib/WeBWorK: ContentGenerator.pm Added Files: ----------- webwork2/htdocs/css: ur.css Revision Data ------------- --- /dev/null +++ htdocs/css/ur.css @@ -0,0 +1,132 @@ +/* hack to get around MSIE peekaboo bug */ +* {zoom: 1;} + +/********************/ +/* template classes */ +/********************/ + +body { margin: 0px; } + +/* left table cell, contains logo and menus */ +td.LeftPanel { background-color: #003366; color: white; white-space: nowrap; width: 1em; } +td.LeftPanel a:link, +td.LeftPanel a:visited { color: #FF9933; } + +div.Logo { } +div.Links { font-size: small; } +div.Siblings { font-size: small; } +div.Options { font-size: small; } + +/* top table cell, contains login message and path */ +td.TopPanel { background-color: #003366; color: white; height: 1; } +td.TopPanel a:link, +td.TopPanel a:visited { color: #FF9933; } + + +*.LoginStatus { text-align: right; font-size: small; position:absolute; right: 0; } +td.Timestamp { text-align: left; font-size: small; font-style: italic; } + +*.Path { } + +/* main content panel, contains body */ +td.ContentPanel { background-color: white; color: black; } +td.ContentPanel a:link, +td.ContentPanel a:visited { color: blue; } +td.ContentPanel a:active { color: red; } + +/* contains info */ +td.InfoPanel { background-color: #DDDDDD; color: black; width: 30% } +td.InfoPanel a:link, +td.InfoPanel a:visited { color: blue; } +td.InfoPanel a:active { color: red; } + +div.Info { } +div.Nav { } +div.Title { font-size: 16pt; } +div.SubmitError { color: red; font-style: italic; } +div.Message { font-style: italic; } +div.Body { } +div.Warnings { } + +/* background colors for success and failure messages */ +div.ResultsWithoutError { background-color: #66ff99 } /* light green */ +div.ResultsWithError { background-color: #ffcccc } /* light red */ + +div.NoFontMessage {padding: 10; border-style: solid; border-width:3; + border-color: #DD0000; background-color: #FFF8F8; + width: 75%; text-align: left; margin: 10px auto 10px 12%;} + +/* text colors for published and unpublished sets */ +font.Published { font-style: normal; font-weight: normal; color: #000000; } /* black */ +font.Unpublished { font-style: italic; font-weight: normal; color: #aaaaaa; } /* light grey */ + +/* styles used when editing a temporary file */ +div.temporaryFile { background-color: #ff9900 ; font-style: italic; } +p.temporaryFile { background-color: #ff9900 ; font-style: italic; } + + + +/* text colors for Auditing, Current, and Dropped students */ +div.Audit { font-style: normal; color: purple; } +div.Enrolled { font-weight: normal; color: black; } +div.Drop { font-style: italic; color: grey; } + +/*******************/ +/* general classes */ +/*******************/ + +p.emphasis { font-style:italic; } + +/************************/ +/* new standard classes */ +/************************/ + +/* tables used for laying out form fields shouldn't have a border */ +table.FormLayout { border: 0; } +table.FormLayout tr { vertical-align: top; } +table.FormLayout th.LeftHeader { text-align: right; white-space: nowrap; } +table.FormLayout tr.ButtonRow { text-align: left; } +table.FormLayout tr.ButtonRowCenter { text-align: center; } + +/* for problems which are rendered by themselves, e.g., by Set Maker */ +div.RenderSolo { background-color: #E0E0E0; color: black; } + +/* minimal style for lists of links (generated by the links escape) */ +ul.LinksMenu { list-style: none; margin-left: 0; padding-left: 0; } +ul.LinksMenu ul { list-style: none; margin-left: 0.5em; padding-left: 0; } + +/*************************/ +/* WeBWorK::HTML widgets */ +/*************************/ + +/* WeBWorK::HTML::ScrollingRecordList */ +div.ScrollingRecordList { padding: 1em; white-space: nowrap; border: thin solid gray; } +div.ScrollingRecordList select.ScrollingRecordList { width: 99%; } + +/*************************************************************************/ +/* classes used in Problem.pm (replace these with new standard classes?) */ +/*************************************************************************/ + +table.attemptResults { + border-style: outset; + border-width: 1px; + margin: 0px 10pt; + border-spacing: 1px; +} +table.attemptResults td, +table.attemptResults th { + border-style: inset; + border-width: 1px; + text-align: center; +# width: 15ex; + padding: 2px 5px 2px 5px; + background-color: #DDDDDD; +} +table.attemptResults td.Message { + text-align: left; + padding: 2px 5px 2px 5px; + width: auto; +} +div.problemHeader { float: left; } +div.problem { clear: both; background-color: #E0E0E0; color: black; } +.parsehilight { background-color:yellow; } Index: ur.template =================================================================== RCS file: /webwork/cvs/system/webwork2/conf/templates/ur.template,v retrieving revision 1.37 retrieving revision 1.38 diff -Lconf/templates/ur.template -Lconf/templates/ur.template -u -r1.37 -r1.38 --- conf/templates/ur.template +++ conf/templates/ur.template @@ -25,142 +25,7 @@ <head> <title><!--#path style="text" text=" : " textonly="1"--></title> <!--#head--> -<style type="text/css"> - -/* hack to get around MSIE peekaboo bug */ -* {zoom: 1;} - -/********************/ -/* template classes */ -/********************/ - -body { margin: 0px; } - -/* left table cell, contains logo and menus */ -td.LeftPanel { background-color: #003366; color: white; white-space: nowrap; width: 1em; } -td.LeftPanel a:link, -td.LeftPanel a:visited { color: #FF9933; } - -div.Logo { } -div.Links { font-size: small; } -div.Siblings { font-size: small; } -div.Options { font-size: small; } - -/* top table cell, contains login message and path */ -td.TopPanel { background-color: #003366; color: white; height: 1; } -td.TopPanel a:link, -td.TopPanel a:visited { color: #FF9933; } - - -*.LoginStatus { text-align: right; font-size: small; position:absolute; right: 0; } -td.Timestamp { text-align: left; font-size: small; font-style: italic; } - -*.Path { } - -/* main content panel, contains body */ -td.ContentPanel { background-color: white; color: black; } -td.ContentPanel a:link, -td.ContentPanel a:visited { color: blue; } -td.ContentPanel a:active { color: red; } - -/* contains info */ -td.InfoPanel { background-color: #DDDDDD; color: black; width: 30% } -td.InfoPanel a:link, -td.InfoPanel a:visited { color: blue; } -td.InfoPanel a:active { color: red; } - -div.Info { } -div.Nav { } -div.Title { font-size: 16pt; } -div.SubmitError { color: red; font-style: italic; } -div.Message { font-style: italic; } -div.Body { } -div.Warnings { } - -/* background colors for success and failure messages */ -div.ResultsWithoutError { background-color: #66ff99 } /* light green */ -div.ResultsWithError { background-color: #ffcccc } /* light red */ - -div.NoFontMessage {padding: 10; border-style: solid; border-width:3; - border-color: #DD0000; background-color: #FFF8F8; - width: 75%; text-align: left; margin: 10px auto 10px 12%;} - -/* text colors for published and unpublished sets */ -font.Published { font-style: normal; font-weight: normal; color: #000000; } /* black */ -font.Unpublished { font-style: italic; font-weight: normal; color: #aaaaaa; } /* light grey */ - -/* styles used when editing a temporary file */ -div.temporaryFile { background-color: #ff9900 ; font-style: italic; } -p.temporaryFile { background-color: #ff9900 ; font-style: italic; } - - - -/* text colors for Auditing, Current, and Dropped students */ -div.Audit { font-style: normal; color: purple; } -div.Enrolled { font-weight: normal; color: black; } -div.Drop { font-style: italic; color: grey; } - -/*******************/ -/* general classes */ -/*******************/ - -p.emphasis { font-style:italic; } - -/************************/ -/* new standard classes */ -/************************/ - -/* tables used for laying out form fields shouldn't have a border */ -table.FormLayout { border: 0; } -table.FormLayout tr { vertical-align: top; } -table.FormLayout th.LeftHeader { text-align: right; white-space: nowrap; } -table.FormLayout tr.ButtonRow { text-align: left; } -table.FormLayout tr.ButtonRowCenter { text-align: center; } - -/* for problems which are rendered by themselves, e.g., by Set Maker */ -div.RenderSolo { background-color: #E0E0E0; color: black; } - -/* minimal style for lists of links (generated by the links escape) */ -ul.LinksMenu { list-style: none; margin-left: 0; padding-left: 0; } -ul.LinksMenu ul { list-style: none; margin-left: 0.5em; padding-left: 0; } - -/*************************/ -/* WeBWorK::HTML widgets */ -/*************************/ - -/* WeBWorK::HTML::ScrollingRecordList */ -div.ScrollingRecordList { padding: 1em; white-space: nowrap; border: thin solid gray; } -div.ScrollingRecordList select.ScrollingRecordList { width: 99%; } - -/*************************************************************************/ -/* classes used in Problem.pm (replace these with new standard classes?) */ -/*************************************************************************/ - -table.attemptResults { - border-style: outset; - border-width: 1px; - margin: 0px 10pt; - border-spacing: 1px; -} -table.attemptResults td, -table.attemptResults th { - border-style: inset; - border-width: 1px; - text-align: center; -# width: 15ex; - padding: 2px 5px 2px 5px; - background-color: #DDDDDD; -} -table.attemptResults td.Message { - text-align: left; - padding: 2px 5px 2px 5px; - width: auto; -} -div.problemHeader { float: left; } -div.problem { clear: both; background-color: #E0E0E0; color: black; } -.parsehilight { background-color:yellow; } - -</style> +<style type="text/css" media="all">@import "<!--#url type="webwork" name="stylesheet"-->";</style> </head> <body> <table width="100%" cellpadding="10" cellspacing="0" border="0"> Index: ContentGenerator.pm =================================================================== RCS file: /webwork/cvs/system/webwork2/lib/WeBWorK/ContentGenerator.pm,v retrieving revision 1.131 retrieving revision 1.132 diff -Llib/WeBWorK/ContentGenerator.pm -Llib/WeBWorK/ContentGenerator.pm -u -r1.131 -r1.132 --- lib/WeBWorK/ContentGenerator.pm +++ lib/WeBWorK/ContentGenerator.pm @@ -958,6 +958,33 @@ $self->helpMacro($name); } +=item url($args) + +Defined in this package. + +Returns the specified URL from either %webworkURLs or %courseURLs in the course +environment. $args is a reference to a hash containing the following fields: + + type => type of URL: webwork|course + name => name of URL (key in URL hash) + +=cut + +sub url { + my ($self, $args) = @_; + my $ce = $self->r->ce; + my $type = $args->{type}; + my $name = $args->{name}; + + if ($type eq "webwork") { + return $ce->{webworkURLs}->{$name}; + } elsif ($type eq "course") { + return $ce->{courseURLs}->{$name}; + } else { + warn __PACKAGE__."::url: unrecognized type '$type'.\n"; + } +} + =back =cut |