[LON-CAPA-cvs] cvs: loncom /interface lonrequestcourse.pm
raeburn
raeburn at source.lon-capa.org
Sun Jun 15 21:42:22 EDT 2014
raeburn Mon Jun 16 01:42:22 2014 EDT
Modified files:
/loncom/interface lonrequestcourse.pm
Log:
- Add missing subroutine: &textbook_request_disabled()
- In &get_breadcrumbs() sanity checking -- $states->{$action} needs to be
a ref to an ARRAY.
Index: loncom/interface/lonrequestcourse.pm
diff -u loncom/interface/lonrequestcourse.pm:1.84 loncom/interface/lonrequestcourse.pm:1.85
--- loncom/interface/lonrequestcourse.pm:1.84 Mon May 19 15:59:55 2014
+++ loncom/interface/lonrequestcourse.pm Mon Jun 16 01:42:22 2014
@@ -1,7 +1,7 @@
# The LearningOnline Network
# Request a course
#
-# $Id: lonrequestcourse.pm,v 1.84 2014/05/19 15:59:55 raeburn Exp $
+# $Id: lonrequestcourse.pm,v 1.85 2014/06/16 01:42:22 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -172,7 +172,7 @@
if ($can_request{'textbook'}) {
&process_textbook_request($r,$dom,$action,\%domdefs,\%domconfig,\%can_request);
} else {
- &textbook_request_disabled($r,$dom,\%can_request);
+ &textbook_request_disabled($r,$dom,$action,\%can_request);
}
} elsif ($action eq 'display') {
my ($uname,$udom,$result,$warning) = &domcoord_display($dom);
@@ -194,7 +194,7 @@
if ($can_request{'textbook'}) {
&print_textbook_form($r,$dom,\@incdoms,\%domdefs,$domconfig{'requestcourses'},\%can_request);
} else {
- &textbook_request_disabled($r,$dom,\%can_request);
+ &textbook_request_disabled($r,$dom,$action,\%can_request);
}
}
return OK;
@@ -476,27 +476,29 @@
}
}
}
- 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/Community Requests','Course_Requests');
- last;
- } else {
- if (($$state eq 'process') || ($$state eq 'removal') || ($$state eq 'reqauthor')) {
+ if (ref($states->{$action}) eq 'ARRAY') {
+ for (my $i=0; $i<@{$states->{$action}}; $i++) {
+ if ($$state eq $states->{$action}[$i]) {
&Apache::lonhtmlcommon::add_breadcrumb(
- { href => '/adm/requestcourse',
- text => "$trail->{$states->{$action}[$i]}",
- }
- );
+ {text=>"$trail->{$$state}"});
+ $crumb = &Apache::lonhtmlcommon::breadcrumbs('Course/Community Requests','Course_Requests');
+ last;
} else {
- &Apache::lonhtmlcommon::add_breadcrumb(
+ if (($$state eq 'process') || ($$state eq 'removal') || ($$state eq 'reqauthor')) {
+ &Apache::lonhtmlcommon::add_breadcrumb(
+ { href => '/adm/requestcourse',
+ 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'});
@@ -5014,6 +5016,33 @@
}
+sub textbook_request_disabled {
+ my ($r,$dom,$action,$can_request) = @_;
+ if (ref($can_request) eq 'HASH') {
+ if ($action eq 'process') {
+ unless ((scalar(keys(%{$can_request})) == 1)) {
+ &Apache::lonhtmlcommon::add_breadcrumb(
+ { href => '/adm/requestcourse',
+ text => 'Pick action',
+ });
+ }
+ }
+ }
+ $r->print(&header('Course Request'));
+ &Apache::lonhtmlcommon::add_breadcrumb({text=>'Course Request'});
+ $r->print(&Apache::lonhtmlcommon::breadcrumbs('Course Requests','Course_Requests').
+ '<div>'.
+ '<p class="LC_info">'.&mt('You do not have privileges to request creation of textbook courses.').'</p>');
+ if (ref($can_request) eq 'HASH') {
+ if (scalar(keys(%{$can_request})) > 1) {
+ $r->print('<a href="/adm/requestcourse">'.&mt('Go back').'</a>');
+ }
+ }
+ $r->print('</div>'.
+ &Apache::loncommon::end_page());
+ return;
+}
+
sub startContentScreen {
my ($r,$mode)=@_;
$r->print("\n".'<ul class="LC_TabContentBigger" id="textbookreq">'."\n");
More information about the LON-CAPA-cvs
mailing list