[LON-CAPA-cvs] cvs: loncom /publisher lonpubdir.pm
raeburn
raeburn at source.lon-capa.org
Fri Jul 14 14:01:23 EDT 2023
raeburn Fri Jul 14 18:01:23 2023 EDT
Modified files:
/loncom/publisher lonpubdir.pm
Log:
- Remove trailing whitespace. No code changes.
-------------- next part --------------
Index: loncom/publisher/lonpubdir.pm
diff -u loncom/publisher/lonpubdir.pm:1.179 loncom/publisher/lonpubdir.pm:1.180
--- loncom/publisher/lonpubdir.pm:1.179 Thu Jul 13 21:41:40 2023
+++ loncom/publisher/lonpubdir.pm Fri Jul 14 18:01:23 2023
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Authoring Space Directory Lister
#
-# $Id: lonpubdir.pm,v 1.179 2023/07/13 21:41:40 raeburn Exp $
+# $Id: lonpubdir.pm,v 1.180 2023/07/14 18:01:23 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -48,7 +48,7 @@
# Validate access to the construction space and get username:domain.
- my ($uname,$udom)=&Apache::lonnet::constructaccess($r->uri);
+ my ($uname,$udom)=&Apache::lonnet::constructaccess($r->uri);
unless (($uname) && ($udom)) {
return HTTP_NOT_ACCEPTABLE;
}
@@ -105,7 +105,7 @@
my $disk_quota = &Apache::loncommon::get_user_quota($uname,$udom,
$cstr,$crstype); # expressed in MB
# Put out the start of page.
-
+
&startpage($r, $uname, $udom, $thisdisfn, $current_disk_usage, $disk_quota, $crsauthor);
if (!-d $fn) {
@@ -133,7 +133,7 @@
my $numdir = 0;
my $numres = 0;
-
+
if ((@files == 0) && ($thisdisfn =~ m{^/$match_domain/$match_username})) {
if ($thisdisfn =~ m{^/$match_domain/$match_username$}) {
$r->print('<p class="LC_info">'.&mt('This Authoring Space is currently empty.').'</p>');
@@ -192,7 +192,7 @@
order => 'ascending',
text => &mt('Size').' (kB)',
},
- );
+ );
# Print column headers
my $output = '';
@@ -237,21 +237,21 @@
my ($cmode,$csize,$cmtime)=(stat($fn.'/'.$filename))[2,7,9];
my $linkfilename = &HTML::Entities::encode('/priv'.$thisdisfn.'/'.$filename,'<>&"');
# Identify type of file according to icon used
- my ($filetype) = (&Apache::loncommon::icon($filename) =~ m{/(\w+).gif$});
+ my ($filetype) = (&Apache::loncommon::icon($filename) =~ m{/(\w+).gif$});
my $cstr_dir = $r->dir_config('lonDocRoot').'/priv'.$thisdisfn;
my $meta_same = &isMetaSame($cstr_dir, $resdir, $filename);
-
+
# Store size, title, and status for files but not directories
my $size = (!($cmode&$dirptr)) ? $csize/1024. : 0;
my ($status, $pubstatus, $title, $fulltitle);
if (!($cmode&$dirptr)) {
- ($status, $pubstatus) = &getStatus($resdir, $targetdir, $cstr_dir,
+ ($status, $pubstatus) = &getStatus($resdir, $targetdir, $cstr_dir,
$filename, $linkfilename, $cmtime, $meta_same);
if (($crsauthor) && ($extension eq 'rights')) {
$title = &getTitleString($targetdir.'/'.$filename);
$fulltitle = $title;
} else {
- ($fulltitle, $title) = &getTitle($resdir, $targetdir, $filename,
+ ($fulltitle, $title) = &getTitle($resdir, $targetdir, $filename,
$linkfilename, $meta_same, \%bombs);
}
} else {
@@ -272,7 +272,7 @@
"linkfilename" => $linkfilename,
}
}
-
+
my @sorted_files;
# Sorting by something other than "Name". Name is the secondary key.
if ($sortby =~ m{cmtime|size}) { # Numeric fields
@@ -306,7 +306,7 @@
}
# Sort by "Name" is the default
- } else {
+ } else {
if ($sortorder eq "rev") {
@sorted_files = sort {uc($b) cmp uc($a)} (keys(%{$filehash}));
} else {
@@ -317,14 +317,14 @@
# Print the sorted resources
foreach my $filename (@sorted_files) {
if ($filehash->{$filename}->{"cmode"}&$dirptr) { # Directories
- &putdirectory($r, $thisdisfn, $linkdir, $filename,
- $filehash->{$filename}->{"cmtime"},
+ &putdirectory($r, $thisdisfn, $linkdir, $filename,
+ $filehash->{$filename}->{"cmtime"},
$targetdir, \%bombs, \$numdir);
} else { # Files
&putresource($r, $udom, $uname, $filename, $thisdisfn, $resdir,
- $targetdir, $linkdir, $crsauthor,
- $filehash->{$filename}->{"cmtime"},
- $filehash->{$filename}->{"size"}, \$numres,
+ $targetdir, $linkdir, $crsauthor,
+ $filehash->{$filename}->{"cmtime"},
+ $filehash->{$filename}->{"size"}, \$numres,
$filehash->{$filename}->{"linkfilename"},
$filehash->{$filename}->{"fulltitle"},
$filehash->{$filename}->{"status"},
@@ -348,13 +348,13 @@
.'</div>'
.&Apache::loncommon::end_page()
);
- return OK;
+ return OK;
}
# Output the header of the page. This includes:
-# - The HTML header
+# - The HTML header
# - The H1/H3 stuff which includes the directory.
#
# startpage($r, $uame, $udom, $thisdisfn, $current_disk_usage, $disk_quota);
@@ -387,11 +387,11 @@
'text' => $title,
'href' => &Apache::loncommon::authorspace($formaction),
});
- # breadcrumbs (and tools) will be created
+ # breadcrumbs (and tools) will be created
# in start_page->bodytag->innerregister
$env{'request.noversionuri'}=$formaction;
- my $js = '<script type="text/javascript"
+ my $js = '<script type="text/javascript"
src="/res/adm/includes/file_upload.js"></script>';
$r->print(&Apache::loncommon::start_page($title, $js));
@@ -423,9 +423,9 @@
function checkUpload(theform) {
if (theform.file == '') {
alert("Please use 'Browse..' to choose a file first, before uploading")
- return
+ return
}
- theform.submit()
+ theform.submit()
}
function SetPubDir(theform,printForm) {
@@ -511,7 +511,7 @@
pubr => 'Publish this Resource',
rtrv => 'Retrieve Old Version',
list => 'List Directory',
- uplo => 'Upload file',
+ uplo => 'Upload file',
dele => 'Delete',
sela => 'Select Action',
nfil => 'New file',
@@ -541,7 +541,7 @@
nanf => 'Name of New File',
nans => 'Name of New Subdirectory',
psfn => 'Please specify file name',
- );
+ );
&js_escape(\%js_lt);
my $mytype = $lt{'type'}; # avoid conflict with " and ' in javascript
# Calculate free space in bytes.
@@ -587,7 +587,7 @@
'newtaskfile','newlibraryfile',
'newdir'));
}
- my $selectbox = &Apache::loncommon::select_form('none','action',\%fileoptions);
+ my $selectbox = &Apache::loncommon::select_form('none','action',\%fileoptions);
$r->print(<<END);
<div style="padding-bottom: 2px">
<form name="upublisher" enctype="multipart/form-data" method="post" action="/adm/upload">
@@ -746,9 +746,9 @@
my ($r, $reqfile, $here, $dirname, $modtime, $targetdir, $bombs, $numdir) = @_;
# construct the display filename: the directory name unless ..:
-
+
my $actionitem;
-
+
my $disfilename = $dirname;
# Don't display directory itself, and there is no way up from root directory
unless ((($dirname eq '..') && ($reqfile=~/^\/[^\/]+\/[^\/]+$/)) || ($dirname eq '.')) {
@@ -771,7 +771,7 @@
$actionitem = &mt('Go to ...');
$disfilename = '<i>'.&mt('Parent Directory').'</i>';
} else {
- $actionitem =
+ $actionitem =
'<form name="dirselect_'.$$numdir.
'" action="/adm/publish">'.
'<select name="diraction" onchange="SetPubDir(this.form,document)">'.
@@ -825,7 +825,7 @@
&Apache::loncommon::modal_link(
'/adm/retrieve?filename='.$linkfilename.'.meta&inhibitmenu=yes&add_modal=yes',
&mt('Retrieve Metadata'),600,500);
- }
+ }
}
# Allow editing metadata of published and unpublished resources
$title .= "\n".'<br />' if ($title);
@@ -844,13 +844,12 @@
my $meta_cmtime = (stat($cstr_dir.'/'.$filename.'.meta'))[9];
my $meta_rmtime = (stat($resdir.'/'.$filename.'.meta'))[9];
return (&Apache::londiff::are_different_files($resdir.'/'.$filename.'.meta',
- $cstr_dir.'/'.$filename.'.meta') && $meta_rmtime < $meta_cmtime)
+ $cstr_dir.'/'.$filename.'.meta') && $meta_rmtime < $meta_cmtime)
? 0 : 1;
}
-
-sub getStatus {
- my ($resdir, $targetdir, $cstr_dir, $filename,
+sub getStatus {
+ my ($resdir, $targetdir, $cstr_dir, $filename,
$linkfilename, $crsauthor, $cmtime, $meta_same) = @_;
my $pubstatus = 'unpublished';
my $status = &mt('Unpublished');
@@ -924,7 +923,7 @@
sub putresource {
my ($r, $udom, $uname, $filename, $thisdisfn, $resdir,
$targetdir, $linkdir, $crsauthor, $cmtime, $size,
- $numres, $linkfilename, $title, $status, $pubstatus) = @_;
+ $numres, $linkfilename, $title, $status, $pubstatus) = @_;
&Apache::lonnet::devalidate_cache_new('meta',$targetdir.'/'.$filename);
my $editlink='';
@@ -979,7 +978,7 @@
<option>'.&mt('Select action').'</option>'.
'<option value="copy">'.&mt('Copy').'</option>';
if ($pubstatus eq 'obsolete' || $pubstatus eq 'unpublished') {
- $$pub_select .=
+ $$pub_select .=
'<option value="rename">'.&mt('Rename').'</option>'.
'<option value="move">'.&mt('Move').'</option>'.
'<option value="delete">'.&mt('Delete').'</option>';
@@ -1018,7 +1017,7 @@
opendir(DIR,$resdir);
while (my $filename=readdir(DIR)) {
if ($filename=~/^\Q$main\E\.(\d+)\.\Q$suffix\E$/) {
- $versions ++;
+ $versions ++;
}
}
closedir(DIR);
@@ -1026,7 +1025,7 @@
}
sub prepareJsonTranslations {
- my $json =
+ my $json =
'{"translations":{'.
'"edit":"'.&mt('Edit').'",'.
'"editxml":"'.&mt('EditXML').'",'.
@@ -1097,7 +1096,7 @@
closedir(DIR);
# nothing to do here if both lists are empty
return unless ( @dirs || @resources );
-
+
# Phase 2: Working
$$firstfile = 1;
@@ -1219,9 +1218,9 @@
=item startpage($r, $uame, $udom, $thisdisfn)
Output the header of the page. This includes:
- - The HTML header
+ - The HTML header
- The H1/H3 stuff which includes the directory.
-
+
startpage($r, $uame, $udom, $thisdisfn);
$r - The apache request object.
$uname - User name.
@@ -1234,7 +1233,7 @@
Without the latter substitution, it's impossible to examine metadata for
untitled resources. Resources may be legitimately untitled, to prevent
searches from locating them.
-
+
$str = getTitleString($fullname);
$fullname - Fully qualified filename to check.
@@ -1242,7 +1241,7 @@
$numdir)
Put out a directory table row:
-
+
$r - Apache request object.
$reqfile - File in request.
$here - Where we are in directory tree.
More information about the LON-CAPA-cvs
mailing list