--- loncom/publisher/lonpubdir.pm 2011/10/21 17:51:23 1.127
+++ loncom/publisher/lonpubdir.pm 2014/04/06 19:39:04 1.151
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
-# Construction Space Directory Lister
+# Authoring Space Directory Lister
#
-# $Id: lonpubdir.pm,v 1.127 2011/10/21 17:51:23 www Exp $
+# $Id: lonpubdir.pm,v 1.151 2014/04/06 19:39:04 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -33,7 +33,6 @@ use strict;
use Apache::File;
use File::Copy;
use Apache::Constants qw(:common :http :methods);
-use Apache::loncacc;
use Apache::loncommon();
use Apache::lonhtmlcommon();
use Apache::londiff();
@@ -47,12 +46,12 @@ sub handler {
my $r=shift;
- # Validate access to the construction space and get username@domain.
+ # Validate access to the construction space and get username:domain.
my $uname;
my $udom;
- ($uname,$udom)=&Apache::loncacc::constructaccess($r->uri);
+ ($uname,$udom)=&Apache::lonnet::constructaccess($r->uri);
unless (($uname) && ($udom)) {
return HTTP_NOT_ACCEPTABLE;
}
@@ -60,19 +59,16 @@ sub handler {
# ----------------------------------------------------------- Start page output
my $fn=$r->filename;
+ $fn=~s/\/$//;
my $thisdisfn=$fn;
my $docroot=$r->dir_config('lonDocRoot'); # Apache londocument root.
$thisdisfn=~s/^\Q$docroot\E\/priv//;
-&Apache::lonnet::logthis("Thisdisfn: $thisdisfn");
-
my $resdir=$docroot.'/res'.$thisdisfn; # Resource directory
my $targetdir='/res'.$thisdisfn; # Publication target directory.
my $linkdir='/priv'.$thisdisfn; # Full URL name of constr space.
-&Apache::lonnet::logthis("Values: $resdir $targetdir $linkdir");
-
my %bombs=&Apache::lonmsg::all_url_author_res_msg($uname,$udom);
&startpage($r, $uname, $udom, $thisdisfn); # Put out the start of page.
@@ -83,15 +79,23 @@ sub handler {
my $numdir = 0;
my $numres = 0;
+ # Retrieving value for sortby from QUERY_STRING
+ &Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},['sortby']);
+
+ # Default sort by 'Name'
+ if (! exists($env{'form.sortby'})) {
+ $env{'form.sortby'} = 'filename';
+ }
+
# Start off the directory table.
$r->print(&Apache::loncommon::start_data_table()
.&Apache::loncommon::start_data_table_header_row()
.'