--- loncom/interface/londocs.pm 2012/08/27 15:58:05 1.484.2.8 +++ loncom/interface/londocs.pm 2012/09/25 23:44:34 1.484.2.9 @@ -1,7 +1,7 @@ # The LearningOnline Network # Documents # -# $Id: londocs.pm,v 1.484.2.8 2012/08/27 15:58:05 raeburn Exp $ +# $Id: londocs.pm,v 1.484.2.9 2012/09/25 23:44:34 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -2184,6 +2184,7 @@ sub entryline { 'cp' => 'Copy'); my $nocopy=0; my $nocut=0; + my $noremove=0; if ($url=~ m{^/res/.+\.(page|sequence)$}) { # no copy for published maps $nocopy=1; @@ -2192,8 +2193,58 @@ sub entryline { $nocopy=1; $nocut=1; } + my $cdom = $env{'course.'.$env{'request.course.id'}.'.domain'}; + my $cnum = $env{'course.'.$env{'request.course.id'}.'.num'}; + if ($url eq "/uploaded/$cdom/$cnum/group_allfolders.sequence") { + if ($env{'form.folderpath'} =~ /^default&[^\&]+$/) { + my %curr_groups = &Apache::longroup::coursegroups(); + if (keys(%curr_groups) > 0) { + $noremove=1; + } + $nocut=1; + $nocopy=1; + } + } elsif ($url =~ m{^\Q/uploaded/$cdom/$cnum/group_folder_\E(\w+)\.sequence$}) { + my $group = $1; + if ($env{'form.folderpath'} =~ /^default&[^\&]+\&group_allfolders\&[^\&]+$/) { + my %curr_group = &Apache::longroup::coursegroups($cdom,$cnum,$group); + if (keys(%curr_group) > 0) { + $noremove=1; + } + } + $nocut=1; + $nocopy=1; + } elsif ($url =~ m{^\Q/adm/$cdom/$cnum/\E(\w+)/smppg$}) { + my $group = $1; + if ($env{'form.folderpath'} =~ /^default&[^\&]+\&group_allfolders\&[^\&]+\&\Qgroup_folder_$group\E\&[^\&]+$/) { + my %curr_group = &Apache::longroup::coursegroups($cdom,$cnum,$group); + my %groupsettings = &Apache::longroup::get_group_settings($curr_group{$group}); + if (keys(%groupsettings) > 0) { + $noremove=1; + } + $nocut=1; + $nocopy=1; + } + } elsif ($env{'form.folderpath'} =~ /^default&[^\&]+\&group_allfolders\&[^\&]+\&group_folder_(\w+)\&/) { + my $group = $1; + my %curr_group = &Apache::longroup::coursegroups($cdom,$cnum,$group); + if ($url =~ /group_boards_\Q$group\E/) { + my %curr_group = &Apache::longroup::coursegroups($cdom,$cnum,$group); + my %groupsettings = &Apache::longroup::get_group_settings($curr_group{$group}); + if (keys(%groupsettings) > 0) { + if (ref($groupsettings{'functions'}) eq 'HASH') { + if ($groupsettings{'functions'}{'discussion'} eq 'on') { + $noremove=1; + } + } + } + $nocut=1; + $nocopy=1; + } + } my $copylink=' '; my $cutlink=' '; + my $removelink=' '; my $skip_confirm = 0; if ( $folder =~ /^supplemental/ @@ -2217,6 +2268,11 @@ ENDCOPY $lt{'ct'} ENDCUT } + if (!$noremove) { + $removelink=(<$lt{'rm'} +ENDREM + } $form_start = ' '; @@ -2247,7 +2303,7 @@ END $form_end - $lt{'rm'} +$removelink $cutlink $lt{'rn'} $copylink