[LON-CAPA-cvs] cvs: loncom /interface londocs.pm
raeburn
raeburn at source.lon-capa.org
Fri Dec 29 11:01:33 EST 2017
raeburn Fri Dec 29 16:01:33 2017 EDT
Modified files:
/loncom/interface londocs.pm
Log:
- Pasting resources from Clipboard in Course Editor.
- When a folder is copied, external tools within it (or in sub-folders)
are copied (and receive new unique instance identifiers).
- When an external tool is pasted into Supplemental Content, any gradable
setting is removed.
Index: loncom/interface/londocs.pm
diff -u loncom/interface/londocs.pm:1.648 loncom/interface/londocs.pm:1.649
--- loncom/interface/londocs.pm:1.648 Fri Dec 29 15:55:21 2017
+++ loncom/interface/londocs.pm Fri Dec 29 16:01:33 2017
@@ -1,7 +1,7 @@
# The LearningOnline Network
# Documents
#
-# $Id: londocs.pm,v 1.648 2017/12/29 15:55:21 raeburn Exp $
+# $Id: londocs.pm,v 1.649 2017/12/29 16:01:33 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -1907,6 +1907,11 @@
cdom => $coursedom,
cnum => $coursenum,
);
+ if ($prefix eq 'ext.tool') {
+ if ($prefixchg{$suffix} eq 'docstosupp') {
+ $info{'delgradable'} = 1;
+ }
+ }
if (($srcdom{$suffix} =~ /^$match_domain$/) && ($srcnum{$suffix} =~ /^$match_courseid$/)) {
unless (($srcdom{$suffix} eq $coursedom) && ($srcnum{$suffix} eq $coursenum)) {
$fromothercrs = 1;
@@ -1998,6 +2003,18 @@
©_templated_files($url,$srcdom{$suffix},$srcnum{$suffix},$srcmapidx{$suffix},
$coursedom,$coursenum,$template,$newidx,"$folder.$container");
}
+ } elsif ($url =~ /ext\.tool$/) {
+ if (($newidx) && ($folder=~/^default/)) {
+ my $marker = (split(m{/},$url))[4];
+ my %toolsettings = &Apache::lonnet::dump('exttool_'.$marker,$coursedom,$coursenum);
+ my $val = 'no';
+ if ($toolsettings{'gradable'}) {
+ $val = 'yes';
+ }
+ &LONCAPA::map::storeparameter($newidx,'parameter_0_gradable',$val,
+ 'string_yesno');
+ &remember_parms($newidx,'gradable','set',$val);
+ }
}
$LONCAPA::map::resources[$newidx]=$title.':'.&LONCAPA::map::qtunescape($url).
':'.$ext.':normal:res';
@@ -2246,6 +2263,9 @@
}
}
$db_name =~ s{_\d*$ }{_$suffix}x;
+ if (($prefix eq 'exttool') && ($dbref->{'delgradable'}) && ($contents{'gradable'})) {
+ delete($contents{'gradable'});
+ }
$result=&Apache::lonnet::put($db_name,\%contents,
$coursedom,$coursenum);
if ($result eq 'ok') {
@@ -2530,16 +2550,38 @@
$changed = 1;
}
}
- } elsif ($ressrc =~ m{^/adm/($match_domain)/($match_courseid)/.+$}) {
+ } elsif ($ressrc =~ m{^/adm/($match_domain)/($match_courseid)/(.+)$}) {
next if ($skip);
my $srcdom = $1;
my $srcnum = $2;
+ my $rem = $3;
+ my ($is_exttool,$exttoolchg);
+ if ($rem =~ m{\d+/ext\.tool$}) {
+ $is_exttool = 1;
+ }
if (($srcdom ne $cdom) || ($srcnum ne $cnum)) {
$rewrites->{$oldurl}{$id} = $ressrc;
$dbcopies->{$oldurl}{$id}{'src'} = $ressrc;
$dbcopies->{$oldurl}{$id}{'cdom'} = $srcdom;
$dbcopies->{$oldurl}{$id}{'cnum'} = $srcnum;
$changed = 1;
+ if ($is_exttool) {
+ $exttoolchg = 1;
+ }
+ } elsif (($rem =~ m{\d+/ext\.tool$}) &&
+ ($env{'form.docs.markedcopy_options'} ne 'move')) {
+ $dbcopies->{$oldurl}{$id}{'src'} = $ressrc;
+ $dbcopies->{$oldurl}{$id}{'cdom'} = $srcdom;
+ $dbcopies->{$oldurl}{$id}{'cnum'} = $srcnum;
+ $changed = 1;
+ $exttoolchg = 1;
+ }
+ if (($is_exttool) && ($prefixchg)) {
+ if ($oldurl =~ m{^/uploaded/$match_domain/$match_courseid/default}) {
+ if ($exttoolchg) {
+ $dbcopies->{$oldurl}{$id}{'delgradable'} = 1;
+ }
+ }
}
} elsif ($ressrc =~ m{^/adm/$match_domain/$match_username/\d+/(smppg|bulletinboard)$}) {
if (($fromcdom ne $cdom) || ($fromcnum ne $cnum) ||
More information about the LON-CAPA-cvs
mailing list