[LON-CAPA-cvs] cvs: loncom /interface lonrequestcourse.pm
raeburn
raeburn@source.lon-capa.org
Wed, 05 Aug 2009 12:46:44 -0000
raeburn Wed Aug 5 12:46:44 2009 EDT
Modified files:
/loncom/interface lonrequestcourse.pm
Log:
- Add breadcrumbs.
Index: loncom/interface/lonrequestcourse.pm
diff -u loncom/interface/lonrequestcourse.pm:1.2 loncom/interface/lonrequestcourse.pm:1.3
--- loncom/interface/lonrequestcourse.pm:1.2 Tue Aug 4 20:15:50 2009
+++ loncom/interface/lonrequestcourse.pm Wed Aug 5 12:46:44 2009
@@ -1,7 +1,7 @@
# The LearningOnline Network
# Request a course
#
-# $Id: lonrequestcourse.pm,v 1.2 2009/08/04 20:15:50 raeburn Exp $
+# $Id: lonrequestcourse.pm,v 1.3 2009/08/05 12:46:44 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -112,7 +112,18 @@
}
}
+ my %trail = (
+ crstype => 'Pick Action',
+ codepick => 'Pick Category',
+ courseinfo => 'Information',
+ enrollment => 'Enrollment',
+ personnel => 'Personnel',
+ review => 'Review',
+ process => 'Result',
+ );
+
my $page = 0;
+ my $crumb;
if (defined($action)) {
my $done = 0;
my $i=0;
@@ -125,6 +136,28 @@
$i++;
}
}
+ for (my $i=0; $i<@{$states{$action}}; $i++) {
+ if ($state eq $states{$action}[$i]) {
+ &Apache::lonhtmlcommon::add_breadcrumb(
+ {text=>"$trail{$state}"});
+ $crumb = &Apache::lonhtmlcommon::breadcrumbs('Course Requests','Course_Requests');
+ last;
+ } else {
+ if (($state eq 'process') && ($i > 0)) {
+ &Apache::lonhtmlcommon::add_breadcrumb(
+ {href=>"javascript:backPage(document.requestcrs,'$states{$action}[0]')",
+ text=>"$trail{$states{$action}[$i]}"});
+ } else {
+ &Apache::lonhtmlcommon::add_breadcrumb(
+ {href=>"javascript:backPage(document.requestcrs,'$states{$action}[$i]')",
+ text=>"$trail{$states{$action}[$i]}"});
+ }
+ }
+ }
+ } else {
+ &Apache::lonhtmlcommon::add_breadcrumb(
+ {text=>'Pick Action'});
+ $crumb = &Apache::lonhtmlcommon::breadcrumbs('Course Requests','Course_Requests');
}
my %can_request;
@@ -132,23 +165,24 @@
if ($action eq 'new') {
if ($canreq) {
if ($state eq 'crstype') {
- &print_main_menu($r,\%can_request,\%states,$dom,$jscript,$loaditems);
+ &print_main_menu($r,\%can_request,\%states,$dom,$jscript,$loaditems,
+ $crumb);
} else {
&request_administration($r,$action,$state,$page,\%states,$dom,$jscript,
- $loaditems);
+ $loaditems,$crumb);
}
} else {
- $r->print(&header('Course Requests').
+ $r->print(&header('Course Requests').$crumb.
'<div class="LC_warning">'.
&mt('You do not have privileges to request creation of courses.').
'</div>'.&Apache::loncommon::end_page());
}
} elsif ($action eq 'view') {
- &print_request_status($jscript,$loaditems);
+ &print_request_status($jscript,$loaditems,$crumb);
} elsif ($action eq 'log') {
- &print_request_logs($jscript,$loaditems);
+ &print_request_logs($jscript,$loaditems,$crumb);
} else {
- &print_main_menu($r,\%can_request,\%states,$dom,$jscript);
+ &print_main_menu($r,\%can_request,\%states,$dom,$jscript,'',$crumb);
}
return OK;
}
@@ -160,9 +194,11 @@
$jscript.'</script>'."\n";
}
if ($loaditems) {
- $loaditems = {'add_entries' => $loaditems,};
- }
- return &Apache::loncommon::start_page($bodytitle,$jscript.$jsextra,$loaditems);
+ $loaditems = {'add_entries' => $loaditems,};
+ return &Apache::loncommon::start_page($bodytitle,$jscript.$jsextra,$loaditems);
+ } else {
+ return &Apache::loncommon::start_page($bodytitle,$jscript.$jsextra);
+ }
}
sub form_elements {
@@ -331,7 +367,7 @@
}
sub print_main_menu {
- my ($r,$can_request,$states,$dom,$jscript,$loaditems) = @_;
+ my ($r,$can_request,$states,$dom,$jscript,$loaditems,$crumb) = @_;
my $onchange;
unless ($env{'form.interface'} eq 'textual') {
$onchange = 1;
@@ -415,8 +451,8 @@
END
- $r->print(&header('Course Requests',$js.$jscript,$loaditems).
- '<p><div>'.
+ $r->print(&header('Course Requests',$js.$jscript,$loaditems).$crumb.
+ '<div>'.
'<form name="domforcourse" method="post" action="/adm/requestcourse">'.
&Apache::lonhtmlcommon::start_pick_box().
&Apache::lonhtmlcommon::row_title('Domain').
@@ -457,7 +493,7 @@
}
sub request_administration {
- my ($r,$action,$state,$page,$states,$dom,$jscript,$loaditems) = @_;
+ my ($r,$action,$state,$page,$states,$dom,$jscript,$loaditems,$crumb) = @_;
my $js;
if (($action eq 'new') || ($action eq 'view')) {
$js = <<END;
@@ -478,7 +514,7 @@
unless (($state eq 'review') || ($state eq 'process')) {
$jsextra = "\n".&Apache::loncommon::coursebrowser_javascript($dom);
}
- $r->print(&header('Request a course',$js.$jscript,$loaditems,$jsextra));
+ $r->print(&header('Request a course',$js.$jscript,$loaditems,$jsextra).$crumb);
if ($state eq 'review') {
&print_review($r,$state,$dom);
} elsif ($state eq 'process') {
@@ -487,9 +523,9 @@
&print_request_form($r,$action,$state,$page,$states,$dom);
}
} elsif ($action eq 'view') {
- $r->print(&header('Manage course requests',$js.$jscript,$loaditems));
+ $r->print(&header('Manage course requests',$js.$jscript,$loaditems).$crumb);
} elsif ($action eq 'log') {
- $r->print(&coursereq_log('View request log',$jscript,$loaditems));
+ $r->print(&coursereq_log('View request log',$jscript,$loaditems).$crumb);
}
$r->print(&Apache::loncommon::end_page());
return;