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

raeburn lon-capa-cvs@mail.lon-capa.org
Tue, 28 Nov 2006 22:27:57 -0000


raeburn		Tue Nov 28 17:27:57 2006 EDT

  Modified files:              
    /loncom/interface	lonfeedback.pm 
  Log:
  bug 3872.  Deleting a post now requires clicking a confirm button in the case where a user deletes his/her own post, and when a CC deletes another user's post.
  
  
Index: loncom/interface/lonfeedback.pm
diff -u loncom/interface/lonfeedback.pm:1.218 loncom/interface/lonfeedback.pm:1.219
--- loncom/interface/lonfeedback.pm:1.218	Tue Nov 28 16:44:37 2006
+++ loncom/interface/lonfeedback.pm	Tue Nov 28 17:27:56 2006
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # Feedback
 #
-# $Id: lonfeedback.pm,v 1.218 2006/11/28 21:44:37 albertel Exp $
+# $Id: lonfeedback.pm,v 1.219 2006/11/28 22:27:56 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -92,6 +92,7 @@
             return '';
         }
     }
+
     my @bgcols = ("#cccccc","#eeeeee");
     my $discussiononly=0;
     if ($mode eq 'board') { $discussiononly=1; }
@@ -392,15 +393,23 @@
             my $colspan=$maxdepth+1;
             $discussion.= qq|
 <script>
-   function studentdelete (symb,idx,newflag,previous) {
+   function verifydelete (caller,symb,idx,newflag,previous,groupparm) {
        var symbparm = symb+':::'+idx
        var prevparm = ""
        if (newflag == 1) {
            prevparm = "&previous="+previous
        }
-       if (confirm("Are you sure you want to delete this post?\\nDeleted posts will no longer be visible to you and other students,\\nbut will continue to be visible to your instructor")) {
-           document.location.href = "/adm/feedback?hide="+symbparm+prevparm
-       }  
+       if (caller == 'studentdelete') {
+           if (confirm("Are you sure you want to delete this post?\\nDeleted posts will no longer be visible to you and other students,\\nbut will continue to be visible to your instructor")) {
+               document.location.href = "/adm/feedback?hide="+symbparm+prevparm+groupparm
+           }
+       } else {
+           if (caller == 'seeiddelete') {
+               if (confirm("Are you sure you want to delete this post?\\nDeleted posts will no longer be visible to you or anyone else")) {
+                   document.location.href = "/adm/feedback?deldisc="+symbparm+prevparm+groupparm
+               }
+           }
+       }
    }
 </script>
             |;
@@ -982,7 +991,8 @@
                                     $sender .= '" '.$target.'>'.&mt('Edit').'</a>';
                                     
                                     unless ($seeid) {
-                                        $sender.=" <a href=\"javascript:studentdelete('$escsymb','$idx','$$newpostsflag','$prevread')";
+                                        my $grpargs = &group_args($group);
+                                        $sender.=" <a href=\"javascript:verifydelete('studentdelete','$escsymb','$idx','$$newpostsflag','$prevread','$grpargs')";
                                         $sender .= '">'.&mt('Delete').'</a>';
                                     }
                                 }
@@ -1005,14 +1015,11 @@
                                     }
 				    $sender .= &group_args($group);
                                     $sender .= '">'.&mt('Hide').'</a>';
-			        }                     
-			        $sender.=' <a href="/adm/feedback?deldisc='.
-				        $escsymb.':::'.$idx;
-                                if ($$newpostsflag) {
-                                    $sender .= '&previous='.$prevread;
-                                }
-				$sender .= &group_args($group);
-                                $sender .= '">'.&mt('Delete').'</a>';
+			        }
+                                my $grpargs = &group_args($group);
+			        $sender.= 
+                                    " <a href=\"javascript:verifydelete('seeiddelete','$escsymb','$idx','$$newpostsflag','$prevread','$grpargs')\">";
+                                $sender .= &mt('Delete').'</a>';
                             }
 		        } else {
 			    if ($screenname) {