[LON-CAPA-cvs] cvs: loncom /interface lonsyllabus.pm
raeburn
lon-capa-cvs-allow@mail.lon-capa.org
Tue, 15 Jul 2008 19:50:40 -0000
raeburn Tue Jul 15 15:50:40 2008 EDT
Modified files:
/loncom/interface lonsyllabus.pm
Log:
When syllabus page was reached from link in Course Catalog, display breadcrumbs to facilitate return to the Course Catalog after viewing the syllabus.
- javascript function: ToCatalog(caller) added in called from Course Catalog.
- backtocat form (which includes course catalog search settings as hidden input) included if called from Course Catalog.
Index: loncom/interface/lonsyllabus.pm
diff -u loncom/interface/lonsyllabus.pm:1.64 loncom/interface/lonsyllabus.pm:1.65
--- loncom/interface/lonsyllabus.pm:1.64 Fri Jul 11 10:55:21 2008
+++ loncom/interface/lonsyllabus.pm Tue Jul 15 15:50:39 2008
@@ -1,7 +1,7 @@
# The LearningOnline Network
# Syllabus
#
-# $Id: lonsyllabus.pm,v 1.64 2008/07/11 14:55:21 raeburn Exp $
+# $Id: lonsyllabus.pm,v 1.65 2008/07/15 19:50:39 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -110,14 +110,58 @@
# ----------------------------------------------------------------- Make header
if ($target ne 'tex') {
my $rss_link = &Apache::lonrss::rss_link($cnum,$cdom);
+ my $js;
+ if ($env{'form.backto'} eq 'coursecatalog') {
+ $js .= <<"ENDSCRIPT";
+
+<script type="text/javascript">
+function ToCatalog(caller) {
+ numidx = getIndexByName('coursenum');
+ if (numidx > -1) {
+ if (caller != 'details') {
+ document.backtocat.elements[numidx].value = '';
+ }
+ }
+ document.backtocat.submit();
+}
+
+function getIndexByName(item) {
+ for (var i=0;i<document.backtocat.elements.length;i++) {
+ if (document.backtocat.elements[i].name == item) {
+ return i;
+ }
+ }
+ return -1;
+}
+
+</script>
+
+ENDSCRIPT
+ }
my $start_page =
- &Apache::loncommon::start_page("Syllabus", $rss_link,
+ &Apache::loncommon::start_page("Syllabus", $rss_link.$js,
{'function' => $forcestudent,
'domain' => $cdom,
'force_register' =>
$env{'form.register'},});
- $r->print($start_page.'<h1>'.$courseenv{'description'}.'</h1><h3>'.
+ $r->print($start_page);
+ if ($env{'form.backto'} eq 'coursecatalog') {
+ &Apache::lonhtmlcommon::clear_breadcrumbs();
+ &Apache::lonhtmlcommon::add_breadcrumb
+ ({href=>"javascript:ToCatalog()",
+ text=>"Course Catalog"});
+ if ($env{'form.coursenum'} ne '') {
+ &Apache::lonhtmlcommon::add_breadcrumb
+ ({href=>"javascript:ToCatalog('details')",
+ text=>"Course details"});
+ }
+ &Apache::lonhtmlcommon::add_breadcrumb
+ ({href=>$r->uri,
+ text=>"Course syllabus"});
+ $r->print(&Apache::lonhtmlcommon::breadcrumbs());
+ }
+ $r->print('<h1>'.$courseenv{'description'}.'</h1><h3>'.
&Apache::lonnet::domain($cdom,'description').'</h3>');
} else {
$r->print('\noindent{\large\textbf{'.$courseenv{'description'}.'}}\\\\\\\\\textbf{'.
@@ -347,6 +391,11 @@
if ($target ne 'tex') {$r->print('</p>');}
}
if ($target ne 'tex') {
+ if ($env{'form.backto'} eq 'coursecatalog') {
+ $r->print('<form name="backtocat" method="post" action="/adm/coursecatalog">'.
+ &Apache::lonhtmlcommon::echo_form_input(['backto']).
+ '</form>');
+ }
$r->print(&Apache::loncommon::end_page());
} else {
$r->print('\end{document}');