--- loncom/interface/lonwishlistdisplay.pm 2011/01/27 14:38:44 1.1 +++ loncom/interface/lonwishlistdisplay.pm 2012/05/15 14:13:14 1.3 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Routines to display the wishlist (handler) # -# $Id: lonwishlistdisplay.pm,v 1.1 2011/01/27 14:38:44 wenzelju Exp $ +# $Id: lonwishlistdisplay.pm,v 1.3 2012/05/15 14:13:14 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -29,7 +29,7 @@ package Apache::lonwishlistdisplay; use strict; -use Apache::Constants qw(:common); +use Apache::Constants qw(:common :http); use Apache::lonnet; use Apache::loncommon(); use Apache::lonhtmlcommon; @@ -48,8 +48,22 @@ my %TreeHash; # ----------------------------------------------------- Main Handler, package lonwishlistdisplay sub handler { my ($r) = @_; - &Apache::loncommon::content_type($r,'text/html'); - $r->send_http_header; + + if ($r->header_only) { + &Apache::loncommon::content_type($r,'text/html'); + $r->send_http_header; + return OK; + } + + if ((&Apache::lonnet::allowed('bre',"/res/$env{'user.domain'}/")) || + (&Apache::lonnet::allowed('bro',"/res/$env{'user.domain'}/"))) { + &Apache::loncommon::content_type($r,'text/html'); + $r->send_http_header; + } else { + $env{'user.error.msg'}= + "/adm/wishlist:bre:0:0:No rights to access Stored Links"; + return HTTP_NOT_ACCEPTABLE; + } if (&Apache::lonwishlist::getWishlist() ne 'error') { # get wishlist entries from user-data db-file and build a tree out of these entries @@ -64,7 +78,7 @@ sub handler { } # get unprocessed_cgi (i.e. marked entries, mode ...) - &Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},['action','mark','markedToMove','mode','newtitle','note','rat']); + &Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},['action','mark','markedToMove','mode','newtitle','note','rat','setTitle','setPath']); # change the order of entries within a level, that means sorting the entries my $changeOrder = 0; @@ -150,6 +164,12 @@ sub handler { elsif ($env{'form.mode'} eq 'import') { $page = &Apache::lonwishlist::makePageImport($root, $env{'form.rat'}); } + elsif ($env{'form.mode'} eq 'newLink') { + $page = &Apache::lonwishlist::makePopUpNewLink($env{'form.setTitle'},$env{'form.setPath'}); + } + elsif ($env{'form.mode'} eq 'newFolder') { + $page = &Apache::lonwishlist::makePopUpNewFolder(); + } elsif ($env{'form.mode'} eq 'set') { $page = &Apache::lonwishlist::makePageSet(); }