';
- } elsif (&Apache::loncommon::is_archive_file($mimetype)) {
+ } elsif ((&Apache::loncommon::is_archive_file($mimetype)) &&
+ ($env{'form.uploaddoc.filename'} =~ /\.(zip|tar|bz2|gz|tar.gz|tar.bz2|tgz)$/i)) {
$nextphase = 'decompress_uploaded';
my $position = scalar(@LONCAPA::map::order)-1;
my $noextract = &return_to_editor();
@@ -2995,8 +3651,9 @@ sub is_supplemental_title {
sub entryline {
my ($index,$title,$url,$folder,$allowed,$residx,$coursenum,$coursedom,
- $crstype,$pathitem,$supplementalflag,$container,$filtersref,$currgroups)=@_;
- my ($foldertitle,$renametitle);
+ $crstype,$pathitem,$supplementalflag,$container,$filtersref,$currgroups,
+ $ltitoolsref)=@_;
+ my ($foldertitle,$renametitle,$oldtitle);
if (&is_supplemental_title($title)) {
($title,$foldertitle,$renametitle) = &Apache::loncommon::parse_supplemental_title($title);
} else {
@@ -3009,7 +3666,10 @@ sub entryline {
$renametitle=~s/\\/\\\\/g;
$renametitle=~s/\"\;/\\\"/g;
+ $renametitle=~s/"/%22/g;
$renametitle=~s/ /%20/g;
+ $oldtitle = $renametitle;
+ $renametitle=~s/\'/\\\'/g;
my $line=&Apache::loncommon::start_data_table_row();
my ($form_start,$form_end,$form_common,$form_param);
# Edit commands
@@ -3083,6 +3743,7 @@ END
'rn' => 'Rename',
'cp' => 'Copy',
'ex' => 'External Resource',
+ 'et' => 'External Tool',
'ed' => 'Edit',
'pr' => 'Preview',
'sv' => 'Save',
@@ -3094,16 +3755,22 @@ END
$currgroups);
my ($copylink,$cutlink,$removelink);
my $skip_confirm = 0;
+ my $confirm_removal = 0;
if ( $folder =~ /^supplemental/
|| ($url =~ m{( /smppg$
|/syllabus$
|/aboutme$
|/navmaps$
|/bulletinboard$
+ |/exttools?$
|\.html$)}x)
|| $isexternal) {
$skip_confirm = 1;
}
+ if (($url=~m|/+uploaded/\Q$coursedom\E/\Q$coursenum\E/|) &&
+ ($url!~/$LONCAPA::assess_page_seq_re/)) {
+ $confirm_removal = 1;
+ }
if ($denied{'copy'}) {
$copylink=(<
$form_common
+
$lt{'rm'}
$form_end
ENDREM
@@ -3159,7 +3827,7 @@ ENDREM
}
}
$renamelink=(<$lt{'rn'}
+$lt{'rn'}
ENDREN
$line.=(<
@@ -3236,7 +3904,9 @@ END
}
} elsif ($url=~m|^/ext/|) {
$url='/adm/wrapper'.$url;
- }
+ } elsif ($url=~m{^/adm/$coursedom/$coursenum/\d+/exttools?$}) {
+ $url='/adm/wrapper'.$url;
+ }
if (&Apache::lonnet::symbverify($symb,$url)) {
$url.=(($url=~/\?/)?'&':'?').'symb='.&escape($symb);
} else {
@@ -3302,12 +3972,17 @@ $form_common."\n".
$form_end;
}
} elsif ($supplementalflag && !$allowed) {
+ my $isexttool;
+ if ($url=~m{^/adm/$coursedom/$coursenum/\d+/exttools?$}) {
+ $url='/adm/wrapper'.$url;
+ $isexttool = 1;
+ }
$url .= ($url =~ /\?/) ? '&':'?';
$url .= 'folderpath='.&HTML::Entities::encode($esc_path,'<>&"');
if ($title) {
$url .= '&title='.&HTML::Entities::encode($renametitle,'<>&"');
}
- if ($isexternal && $orderidx) {
+ if ((($isexternal) || ($isexttool)) && $orderidx) {
$url .= '&idx='.$orderidx;
}
}
@@ -3318,6 +3993,11 @@ $form_end;
if ($isexternal) {
($editlink,$extresform) =
&Apache::lonextresedit::extedit_form(0,$residx,$orig_url,$title,$pathitem);
+ } elsif ($orig_url =~ m{^/adm/$coursedom/$coursenum/\d+/exttools?$}) {
+ ($editlink,$extresform) =
+ &Apache::lonextresedit::extedit_form(0,$residx,$orig_url,$title,$pathitem,
+ undef,undef,undef,'tool',$coursedom,
+ $coursenum,$ltitoolsref);
} elsif (!$isfolder && !$ispage) {
my ($cfile,$home,$switchserver,$forceedit,$forceview) =
&Apache::lonnet::can_edit_resource($fileloc,$coursenum,$coursedom,$orig_url);
@@ -3416,9 +4096,11 @@ sub action_restrictions {
if ($url=~ m{^/res/.+\.(page|sequence)$}) {
# no copy for published maps
$denied{'copy'} = 1;
- } elsif ($url=~m{^/res/lib/templates/}) {
- $denied{'copy'} = 1;
- $denied{'cut'} = 1;
+ } elsif ($url=~m{^/res/lib/templates/([^/]+)\.problem$}) {
+ unless ($1 eq 'simpleproblem') {
+ $denied{'copy'} = 1;
+ }
+ $denied{'cut'} = 1;
} elsif ($url eq "/uploaded/$cdom/$cnum/group_allfolders.sequence") {
if ($folderpath =~ /^default&[^\&]+$/) {
if ((ref($currgroups) eq 'HASH') && (keys(%{$currgroups}) > 0)) {
@@ -3474,6 +4156,7 @@ sub new_timebased_suffix {
if ($type eq 'paste') {
$prefix = $type;
$namespace = 'courseeditor';
+ $idtype = 'addcode';
} elsif ($type eq 'map') {
$prefix = 'docs';
if ($area eq 'supplemental') {
@@ -3485,9 +4168,8 @@ sub new_timebased_suffix {
$prefix = $type;
$namespace = 'templated';
}
- $idtype = 'concat';
my ($suffix,$freedlock,$error) =
- &Apache::lonnet::get_timebased_id($prefix,'num',$namespace,$dom,$num);
+ &Apache::lonnet::get_timebased_id($prefix,'num',$namespace,$dom,$num,$idtype);
if (!$suffix) {
if ($type eq 'paste') {
$errtext = &mt('Failed to acquire a unique timestamp-based suffix when adding to the paste buffer.');
@@ -3496,7 +4178,7 @@ sub new_timebased_suffix {
} elsif ($type eq 'smppg') {
$errtext = &mt('Failed to acquire a unique timestamp-based suffix for the new simple page.');
} else {
- $errtext = &mt('Failed to acquire a unique timestamp-based suffix for the new bulletin board.');
+ $errtext = &mt('Failed to acquire a unique timestamp-based suffix for the new discussion board.');
}
if ($error) {
$errtext .= ' '.$error;
@@ -3507,15 +4189,25 @@ sub new_timebased_suffix {
'
'.
&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 =
+ '
'.
+ &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 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.');
+ }
} 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.');
} else {
$locknotfreed .=
- &mt('This will prevent creation of additional bulletin boards in this course.');
+ &mt('This will prevent creation of additional discussion boards in this course.');
}
unless ($type eq 'paste') {
$locknotfreed .=
@@ -3722,8 +4414,8 @@ sub devalidateversioncache {
sub checkversions {
my ($r) = @_;
my $crstype = &Apache::loncommon::course_type();
- $r->print(&Apache::loncommon::start_page("Check $crstype Document Versions"));
- $r->print(&Apache::lonhtmlcommon::breadcrumbs("Check $crstype Document Versions"));
+ $r->print(&Apache::loncommon::start_page("Check $crstype Resource Versions"));
+ $r->print(&Apache::lonhtmlcommon::breadcrumbs("Check $crstype Resource Versions"));
$r->print(&startContentScreen('tools'));
my $header='';
@@ -3879,10 +4571,30 @@ $lt{'sc'}:
$lt{'vers'}
-
ENDHEADERS
#number of columns for version history
+ my %changedbytime;
+ foreach my $key (keys(%changes)) {
+ #excludes not versionable problems from resource version history:
+ next if ($key =~ /^\/res\/lib\/templates/);
+ my $chg;
+ if ($env{'form.timerange'} eq 'all') {
+ my ($root,$extension)=($key=~/^(.*)\.(\w+)$/);
+ $chg = &Apache::lonnet::metadata($root.'.'.$extension,'lastrevisiondate');
+ } else {
+ $chg = $changes{$key};
+ next if ($chg < $starttime);
+ }
+ push(@{$changedbytime{$chg}},$key);
+ }
+ if (keys(%changedbytime) == 0) {
+ &untiehash();
+ $r->print(&mt('No content changes in imported content in specified time frame').
+ &endContentScreen());
+ return;
+ }
$r->print(
+ ''.
&Apache::loncommon::start_data_table().
&Apache::loncommon::start_data_table_header_row().
'
'.&mt('Resources').'
'.
@@ -3892,26 +4604,25 @@ ENDHEADERS
'
'.&mt('History').'
'.
&Apache::loncommon::end_data_table_header_row()
);
- foreach my $key (sort(keys(%changes))) {
- #excludes not versionable problems from resource version history:
- next unless ($changes{$key}>$starttime && $key !~ /^\/res\/lib\/templates/);
- my ($root,$extension)=($key=~/^(.*)\.(\w+)$/);
- my $currentversion=&Apache::lonnet::getversion($key);
- if ($currentversion<0) {
- $currentversion=''.&mt('Could not be determined.').'';
- }
- my $linkurl=&Apache::lonnet::clutter($key);
- $r->print(
- &Apache::loncommon::start_data_table_row().
- '
'
- );
- # Used in course
- my $usedversion=$hash{'version_'.$linkurl};
- if (($usedversion) && ($usedversion ne 'mostrecent')) {
+ foreach my $chg (sort {$b <=> $a } keys(%changedbytime)) {
+ foreach my $key (sort(@{$changedbytime{$chg}})) {
+ my ($root,$extension)=($key=~/^(.*)\.(\w+)$/);
+ my $currentversion=&Apache::lonnet::getversion($key);
+ if ($currentversion<0) {
+ $currentversion=''.&mt('Could not be determined.').'';
+ }
+ my $linkurl=&Apache::lonnet::clutter($key);
+ $r->print(
+ &Apache::loncommon::start_data_table_row().
+ '