--- loncom/interface/londocs.pm 2014/12/21 16:26:31 1.591
+++ loncom/interface/londocs.pm 2015/06/18 20:19:06 1.595
@@ -1,7 +1,7 @@
# The LearningOnline Network
# Documents
#
-# $Id: londocs.pm,v 1.591 2014/12/21 16:26:31 raeburn Exp $
+# $Id: londocs.pm,v 1.595 2015/06/18 20:19:06 musolffc Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -1353,29 +1353,34 @@ sub supp_pasteable {
}
sub paste_popup_js {
- my %lt = &Apache::lonlocal::texthash(
+ my %html_js_lt = &Apache::lonlocal::texthash(
show => 'Show Options',
hide => 'Hide Options',
+ );
+ my %js_lt = &Apache::lonlocal::texthash(
none => 'No items selected from clipboard.',
);
+ &html_escape(\%html_js_lt);
+ &js_escape(\%html_js_lt);
+ &js_escape(\%js_lt);
return <<"END";
function showPasteOptions(suffix) {
document.getElementById('pasteoptions_'+suffix).style.display='block';
- document.getElementById('pasteoptionstext_'+suffix).innerHTML = ' ';
+ document.getElementById('pasteoptionstext_'+suffix).innerHTML = ' ';
return;
}
function hidePasteOptions(suffix) {
document.getElementById('pasteoptions_'+suffix).style.display='none';
- document.getElementById('pasteoptionstext_'+suffix).innerHTML =' ';
+ document.getElementById('pasteoptionstext_'+suffix).innerHTML =' ';
return;
}
function showOptions(caller,suffix) {
if (document.getElementById('pasteoptionstext_'+suffix)) {
if (caller.checked) {
- document.getElementById('pasteoptionstext_'+suffix).innerHTML =' ';
+ document.getElementById('pasteoptionstext_'+suffix).innerHTML =' ';
} else {
document.getElementById('pasteoptionstext_'+suffix).innerHTML ='';
}
@@ -1404,7 +1409,7 @@ function validateClipboard() {
if (numchk > 0) {
return true;
} else {
- alert("$lt{'none'}");
+ alert("$js_lt{'none'}");
return false;
}
}
@@ -2806,7 +2811,7 @@ sub editor {
# Rename, cut, copy or remove a single resource
if (&handle_edit_cmd()) {
my $contentchg;
- if ($env{'form.cmd'} =~ m{^(del|cut)_}) {
+ if ($env{'form.cmd'} =~ m{^(remove|cut)_}) {
$contentchg = 1;
}
($errtext,$fatal)=&storemap($coursenum,$coursedom,$folder.'.'.$container,$contentchg);
@@ -3892,7 +3897,7 @@ sub new_timebased_suffix {
'
'.
&mt('A lockfile was not released when you added content to the clipboard earlier in this session.').' '.
- &mt('As a result addition of items to the clipboard wll be unavailable until your next log-in.');
+ &mt('As a result addition of items to the clipboard will be unavailable until your next log-in.');
} else {
$locknotfreed .=
&mt('This will prevent addition of items to the clipboard until your next log-in.');
@@ -4764,7 +4769,9 @@ sub handler {
.'// '."\n"
- .''."\n";
+ .''."\n"
+ .''."\n";
# Breadcrumbs
&Apache::lonhtmlcommon::clear_breadcrumbs();
@@ -4894,9 +4901,30 @@ sub handler {
'webctce4' => 'WebCT 4 Campus Edition',
);
# -----------------------------------------------------------------------------
+
+ # Calculate free quota space for a user or course. A javascript function checks
+ # file size to determine if upload should be allowed.
+ my $quotatype = 'unofficial';
+ if ($crstype eq 'Community') {
+ $quotatype = 'community';
+ } elsif ($env{'course.'.$coursedom.'_'.$coursenum.'.internal.coursecode'}) {
+ $quotatype = 'official';
+ } elsif ($env{'course.'.$coursedom.'_'.$coursenum.'.internal.textbook'}) {
+ $quotatype = 'textbook';
+ }
+ my $disk_quota = &Apache::loncommon::get_user_quota($coursenum,$coursedom,
+ 'course',$quotatype); # expressed in MB
+ my $current_disk_usage = 0;
+ foreach my $subdir ('docs','supplemental') {
+ $current_disk_usage += &Apache::lonnet::diskusage($coursedom,$coursenum,
+ "userfiles/$subdir",1); # expressed in kB
+ }
+ my $free_space = 1024 * ((1024 * $disk_quota) - $current_disk_usage);
+
my $fileupload=(<
-
+
+
FIUP
my $checkbox=(<
- $fileupload
+ $fileupload
$lt{'title'}:
@@ -5794,7 +5822,7 @@ END
sub editing_js {
my ($udom,$uname,$supplementalflag) = @_;
- my %lt = &Apache::lonlocal::texthash(
+ my %js_lt = &Apache::lonlocal::texthash(
p_mnf => 'Name of New Folder',
t_mnf => 'New Folder',
p_mnp => 'Name of New Page',
@@ -5832,7 +5860,7 @@ sub editing_js {
noch => 'No changes to settings specified.',
noac => 'No actions selected.',
);
-
+ &js_escape(\%js_lt);
my $crstype = &Apache::loncommon::course_type();
my $docs_folderpath = &HTML::Entities::encode($env{'environment.internal.'.$env{'request.course.id'}.'.docs_folderpath.folderpath'},'<>&"');
my $main_container_page;
@@ -5877,7 +5905,7 @@ sub editing_js {
return <$lt{'more'}';
+ document.getElementById('more'+caller).innerHTML = ' $js_lt{'more'}';
} else {
document.getElementById('more'+caller).innerHTML = '';
}
@@ -6440,10 +6468,10 @@ function togglePick(caller,value) {
function toggleCheckUncheck(caller,more) {
if (more == 1) {
- document.getElementById('more'+caller).innerHTML = ' $lt{'less'}';
+ document.getElementById('more'+caller).innerHTML = ' $js_lt{'less'}';
document.getElementById('allfields'+caller).style.display='block';
} else {
- document.getElementById('more'+caller).innerHTML = ' $lt{'more'}';
+ document.getElementById('more'+caller).innerHTML = ' $js_lt{'more'}';
document.getElementById('allfields'+caller).style.display='none';
}
resize_scrollbox('contentscroll','1','1');
@@ -6599,12 +6627,12 @@ function checkSubmits() {
if (numchanges > 0) {
if ((cutwarnings > 0) || (remwarnings > 0)) {
if (remwarnings > 0) {
- if (!confirm('$lt{"p_rmr1"}\\n\\n$lt{"p_rmr3a"} '+remwarnings+' $lt{"p_rmr3b"}')) {
+ if (!confirm('$js_lt{"p_rmr1"}\\n\\n$js_lt{"p_rmr3a"} '+remwarnings+' $js_lt{"p_rmr3b"}')) {
return false;
}
}
if (cutwarnings > 0) {
- if (!confirm('$lt{"p_ctr1a"}\\n$lt{"p_ctr1b"}\\n\\n$lt{"p_ctr3a"} '+cutwarnings+' $lt{"p_ctr3b"}')) {
+ if (!confirm('$js_lt{"p_ctr1a"}\\n$js_lt{"p_ctr1b"}\\n\\n$js_lt{"p_ctr3a"} '+cutwarnings+' $js_lt{"p_ctr3b"}')) {
return false;
}
}
@@ -6620,12 +6648,12 @@ function checkSubmits() {
}
}
if ((dosettings == 1) && (doactions == 1)) {
- alert("$lt{'noor'}");
+ alert("$js_lt{'noor'}");
} else {
if (dosettings == 1) {
- alert("$lt{'noch'}");
+ alert("$js_lt{'noch'}");
} else {
- alert("$lt{'noac'}");
+ alert("$js_lt{'noac'}");
}
}
return false;
@@ -6740,13 +6768,19 @@ ENDINJECT
sub dump_switchserver_js {
my @hosts = @_;
- my %lt = &Apache::lonlocal::texthash(
+ my %js_lt = &Apache::lonlocal::texthash(
dump => 'Copying content to Authoring Space requires switching server.',
swit => 'Switch server?',
+ );
+ my %html_js_lt = &Apache::lonlocal::texthash(
+ swit => 'Switch server?',
duco => 'Copying Content to Authoring Space',
yone => 'You need to switch to a server housing an Authoring Space for which you are author or co-author.',
chos => 'Choose server',
);
+ &js_escape(\%js_lt);
+ &html_escape(\%html_js_lt);
+ &js_escape(\%html_js_lt);
my $role = $env{'request.role'};
my $js = <<"ENDSWJS";