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

raeburn raeburn at source.lon-capa.org
Mon Oct 1 08:34:19 EDT 2012


raeburn		Mon Oct  1 12:34:19 2012 EDT

  Modified files:              
    /loncom/interface	londocs.pm 
  Log:
  - Restore rev. 1.495 changes removed in rev. 1.496 commit.
  
  
Index: loncom/interface/londocs.pm
diff -u loncom/interface/londocs.pm:1.496 loncom/interface/londocs.pm:1.497
--- loncom/interface/londocs.pm:1.496	Mon Oct  1 12:06:46 2012
+++ loncom/interface/londocs.pm	Mon Oct  1 12:34:18 2012
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # Documents
 #
-# $Id: londocs.pm,v 1.496 2012/10/01 12:06:46 goltermann Exp $
+# $Id: londocs.pm,v 1.497 2012/10/01 12:34:18 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