[LON-CAPA-cvs] cvs: loncom /interface loncommon.pm londocs.pm /lonnet/perl lonnet.pm
raeburn
raeburn at source.lon-capa.org
Sun Dec 21 11:26:38 EST 2014
raeburn Sun Dec 21 16:26:38 2014 EDT
Modified files:
/loncom/interface londocs.pm loncommon.pm
/loncom/lonnet/perl lonnet.pm
Log:
- Bug 6765
- If lock set when requesting unique time-based ID during copying to the
clipboard was not released for some reason, display appropriate warnings
in Course Editor, and remove lock on next log-in by user.
Index: loncom/interface/londocs.pm
diff -u loncom/interface/londocs.pm:1.590 loncom/interface/londocs.pm:1.591
--- loncom/interface/londocs.pm:1.590 Sat Dec 20 20:32:33 2014
+++ loncom/interface/londocs.pm Sun Dec 21 16:26:31 2014
@@ -1,7 +1,7 @@
# The LearningOnline Network
# Documents
#
-# $Id: londocs.pm,v 1.590 2014/12/20 20:32:33 raeburn Exp $
+# $Id: londocs.pm,v 1.591 2014/12/21 16:26:31 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -977,7 +977,7 @@
sub update_paste_buffer {
my ($coursenum,$coursedom,$folder) = @_;
- my (@possibles,%removals,%cuts);
+ my (@possibles,%removals,%cuts,$output);
if ($env{'form.multiremove'}) {
$env{'form.multiremove'} =~ s/,$//;
map { $removals{$_} = 1; } split(/,/,$env{'form.multiremove'});
@@ -1045,10 +1045,12 @@
next if (exists($pasteurls{$coursedom.'_'.$coursenum.'_'.$url}));
my ($suffix,$errortxt,$locknotfreed) =
&new_timebased_suffix($env{'user.domain'},$env{'user.name'},'paste');
- push(@newpaste,$suffix);
- if ($locknotfreed) {
- return $locknotfreed;
- last;
+ if ($suffix ne '') {
+ push(@newpaste,$suffix);
+ } else {
+ if ($locknotfreed) {
+ return $locknotfreed;
+ }
}
if (&is_supplemental_title($title)) {
&Apache::lonnet::appenv({'docs.markedcopy_supplemental_'.$suffix => $title});
@@ -1082,13 +1084,17 @@
}
}
}
+ if ($locknotfreed) {
+ $output = $locknotfreed;
+ last;
+ }
}
if (@newpaste) {
$addtoenv{'docs.markedcopies'} = join(',',(@currpaste, at newpaste));
}
&Apache::lonnet::appenv(\%addtoenv);
delete($env{'form.markcopy'});
- return;
+ return $output;
}
sub recurse_uploaded_maps {
@@ -3881,9 +3887,19 @@
'<div class="LC_error">'.
&mt('There was a problem removing a lockfile.').' ';
if ($type eq 'paste') {
- &mt('This will prevent use of the paste buffer until th next log-in.');
+ if ($freedlock eq 'nolock') {
+ $locknotfreed =
+ '<div class="LC_error">'.
+ &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.');
+ } else {
+ $locknotfreed .=
+ &mt('This will prevent addition of items to the clipboard until your next log-in.');
+ }
} elsif ($type eq 'map') {
- &mt('This will prevent creation of additional folders or composite pages in this course.');
+ $locknotfreed .=
+ &mt('This will prevent creation of additional folders or composite pages in this course.');
} elsif ($type eq 'smppg') {
$locknotfreed .=
&mt('This will prevent creation of additional simple pages in this course.');
Index: loncom/interface/loncommon.pm
diff -u loncom/interface/loncommon.pm:1.1203 loncom/interface/loncommon.pm:1.1204
--- loncom/interface/loncommon.pm:1.1203 Sat Dec 20 15:35:40 2014
+++ loncom/interface/loncommon.pm Sun Dec 21 16:26:31 2014
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# a pile of common routines
#
-# $Id: loncommon.pm,v 1.1203 2014/12/20 15:35:40 raeburn Exp $
+# $Id: loncommon.pm,v 1.1204 2014/12/21 16:26:31 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -14613,6 +14613,17 @@
}
}
closedir(DIR);
+# If there is a undeleted lockfile for the user's paste buffer remove it.
+ my $namespace = 'nohist_courseeditor';
+ my $lockingkey = 'paste'."\0".'locked_num';
+ my %lockhash = &Apache::lonnet::get($namespace,[$lockingkey],
+ $domain,$username);
+ if (exists($lockhash{$lockingkey})) {
+ my $delresult = &Apache::lonnet::del($namespace,[$lockingkey],$domain,$username);
+ unless ($delresult eq 'ok') {
+ &Apache::lonnet::logthis("Failed to delete paste buffer locking key in $namespace for ".$username.":".$domain." Result was: $delresult");
+ }
+ }
}
# Give them a new cookie
my $id = ($args->{'robot'} ? 'robot'.$args->{'robot'}
Index: loncom/lonnet/perl/lonnet.pm
diff -u loncom/lonnet/perl/lonnet.pm:1.1275 loncom/lonnet/perl/lonnet.pm:1.1276
--- loncom/lonnet/perl/lonnet.pm:1.1275 Tue Dec 16 19:57:56 2014
+++ loncom/lonnet/perl/lonnet.pm Sun Dec 21 16:26:36 2014
@@ -1,7 +1,7 @@
# The LearningOnline Network
# TCP networking package
#
-# $Id: lonnet.pm,v 1.1275 2014/12/16 19:57:56 musolffc Exp $
+# $Id: lonnet.pm,v 1.1276 2014/12/21 16:26:36 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -6040,6 +6040,9 @@
} else {
$error = "error: could not obtain lockfile\n";
$dellock = 'ok';
+ if (($prefix eq 'paste') && ($namespace eq 'courseeditor') && ($keyid eq 'num')) {
+ $dellock = 'nolock';
+ }
}
return ($newid,$dellock,$error);
}
More information about the LON-CAPA-cvs
mailing list