--- loncom/interface/lonrequestcourse.pm 2014/05/19 15:59:55 1.84 +++ loncom/interface/lonrequestcourse.pm 2014/06/16 01:42:22 1.85 @@ -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 @@ sub handler { 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 @@ sub handler { 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 @@ sub get_breadcrumbs { } } } - 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 @@ ENDSCRIPT } +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'). + '
'. + '

'.&mt('You do not have privileges to request creation of textbook courses.').'

'); + if (ref($can_request) eq 'HASH') { + if (scalar(keys(%{$can_request})) > 1) { + $r->print(''.&mt('Go back').''); + } + } + $r->print('
'. + &Apache::loncommon::end_page()); + return; +} + sub startContentScreen { my ($r,$mode)=@_; $r->print("\n".'