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

raeburn raeburn at source.lon-capa.org
Thu Sep 20 15:25:23 EDT 2012


raeburn		Thu Sep 20 19:25:23 2012 EDT

  Modified files:              
    /loncom/interface	londocs.pm 
  Log:
  - No cut/copy links for special folders created when using groups:
    Groups Folder, folder for each group, and Discussion Boards
    folder for each group.
  - No remove links for same special folders unless group deleted.
  - No cut/copy links for group homepage (simple document), and no
    remove link unless group deleted.
  
  
Index: loncom/interface/londocs.pm
diff -u loncom/interface/londocs.pm:1.494 loncom/interface/londocs.pm:1.495
--- loncom/interface/londocs.pm:1.494	Mon Aug 27 14:33:15 2012
+++ loncom/interface/londocs.pm	Thu Sep 20 19:25:22 2012
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # Documents
 #
-# $Id: londocs.pm,v 1.494 2012/08/27 14:33:15 raeburn Exp $
+# $Id: londocs.pm,v 1.495 2012/09/20 19:25:22 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