[LON-CAPA-cvs] cvs: loncom(version_2_11_X) /interface londocs.pm

raeburn raeburn at source.lon-capa.org
Tue Sep 25 19:44:34 EDT 2012


raeburn		Tue Sep 25 23:44:34 2012 EDT

  Modified files:              (Branch: version_2_11_X)
    /loncom/interface	londocs.pm 
  Log:
  - For 2.11.
    - Backport 1.495.
  
  
Index: loncom/interface/londocs.pm
diff -u loncom/interface/londocs.pm:1.484.2.8 loncom/interface/londocs.pm:1.484.2.9
--- loncom/interface/londocs.pm:1.484.2.8	Mon Aug 27 15:58:05 2012
+++ loncom/interface/londocs.pm	Tue Sep 25 23:44:34 2012
@@ -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 @@
 		'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 @@
            $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 @@
 <a href="javascript:cutres('$esc_path','$index','$renametitle','$container','$symb','$folder',$skip_confirm);" class="LC_docs_cut">$lt{'ct'}</a>
 ENDCUT
         }
+        if (!$noremove) {
+            $removelink=(<<ENDREM);
+<a href='javascript:removeres("$esc_path","$index","$renametitle","$container","$symb",$skip_confirm);' class="LC_docs_remove">$lt{'rm'}</a>
+ENDREM
+        }
 	$form_start = '
    <form action="/adm/coursedocs" method="post">
 ';
@@ -2247,7 +2303,7 @@
    $form_end
 </td>
 <td class="LC_docs_entry_commands">
-   <a href='javascript:removeres("$esc_path","$index","$renametitle","$container","$symb",$skip_confirm);' class="LC_docs_remove">$lt{'rm'}</a>
+$removelink
 $cutlink
    <a href='javascript:changename("$esc_path","$index","$renametitle","$container","$symb");' class="LC_docs_rename">$lt{'rn'}</a>
 $copylink




More information about the LON-CAPA-cvs mailing list