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

raeburn raeburn at source.lon-capa.org
Tue Apr 2 16:33:41 EDT 2013


raeburn		Tue Apr  2 20:33:41 2013 EDT

  Modified files:              
    /loncom/interface	londocs.pm 
  Log:
  - Bug 4900
    (Checkboxes for remove, or cut selectable for multiple items)
    - Show confirm pop-up if multiple cut or remove will resource(s) which might
      have grade data.
  
  
Index: loncom/interface/londocs.pm
diff -u loncom/interface/londocs.pm:1.541 loncom/interface/londocs.pm:1.542
--- loncom/interface/londocs.pm:1.541	Tue Apr  2 00:07:08 2013
+++ loncom/interface/londocs.pm	Tue Apr  2 20:33:41 2013
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # Documents
 #
-# $Id: londocs.pm,v 1.541 2013/04/02 00:07:08 raeburn Exp $
+# $Id: londocs.pm,v 1.542 2013/04/02 20:33:41 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -1066,7 +1066,6 @@
 
 }
 
-
 sub do_paste_from_buffer {
     my ($coursenum,$coursedom,$folder,$container,$errors) = @_;
 
@@ -3083,6 +3082,7 @@
 	    $cutlink=(<<ENDCUT);
 <form name="$formname" method="post" action="/adm/coursedocs">
 $form_common
+<input type="hidden" name="skip_$orderidx" id="skip_cut_$orderidx" value="$skip_confirm" />
 <input type="checkbox" name="cut" id="cut_$orderidx" value="$orderidx" onclick="javascript:singleCheck(this,'$orderidx','cut');" class="LC_hidden" /><a href="$js" class="LC_docs_cut">$lt{'ct'}</a>
 $form_end
 ENDCUT
@@ -3100,6 +3100,7 @@
             $removelink=(<<ENDREM);
 <form name="$formname" method="post" action="/adm/coursedocs">
 $form_common
+<input type="hidden" name="skip_$orderidx" id="skip_remove_$orderidx" value="$skip_confirm" />
 <input type="checkbox" name="remove" id="remove_$orderidx" value="$orderidx" onclick="javascript:singleCheck(this,'$orderidx','remove');" class="LC_hidden" /><a href="$js" class="LC_docs_remove">$lt{'rm'}</a>
 $form_end
 ENDREM
@@ -5306,10 +5307,14 @@
                                           p_rmr1 => 'WARNING: Removing a resource makes associated grades and scores inaccessible!',
                                           p_rmr2a => 'Remove[_99]',
                                           p_rmr2b => '?[_99]',
+                                          p_rmr3a => 'Remove those [_2]',
+                                          p_rmr3b => 'items?[_2]',
                                           p_ctr1a => 'WARNING: Cutting a resource makes associated grades and scores inaccessible!',
                                           p_ctr1b => 'Grades remain inaccessible if resource is pasted into another folder.',
                                           p_ctr2a => 'Cut[_98]',
                                           p_ctr2b => '?[_98]',
+                                          p_ctr3a => 'Cut those[_2]',
+                                          p_ctr3b => 'items?[_2]',
                                           rpck    => 'Enter number to pick (e.g., 3)',
                                           imsfile => 'You must choose an IMS package for import',
                                           imscms  => 'You must select which Course Management System was the source of the IMS package',
@@ -5950,6 +5955,8 @@
     var numchanges = 0;
     var form = document.saveactions;
     var doactions = multiActions();
+    var cutwarnings = 0;
+    var remwarnings = 0;
     if (doactions == 1) {
         var remidxlist = document.cumulativeactions.allremoveidx.value;
         if ((remidxlist != '') && (remidxlist != null)) {
@@ -5959,6 +5966,11 @@
                     if (document.getElementById('remove_'+remidxs[i]).checked) {
                         form.multiremove.value += remidxs[i]+',';
                         numchanges ++;
+                        if (document.getElementById('skip_remove_'+remidxs[i])) {
+                            if (document.getElementById('skip_remove_'+remidxs[i]).value == 0) {
+                                remwarnings ++;
+                            }
+                        }
                     }
                 }
             }
@@ -5971,6 +5983,11 @@
                     if (document.getElementById('cut_'+cutidxs[i]).checked == true) {
                         form.multicut.value += cutidxs[i]+',';
                         numchanges ++;
+                        if (document.getElementById('skip_cut_'+cutidxs[i])) {
+                            if (document.getElementById('skip_cut_'+cutidxs[i]).value == 0) {
+                                cutwarnings ++;
+                            }
+                        }
                     }
                 }
             }
@@ -6033,8 +6050,25 @@
         }
     }
     if ((numchanges > 0) || (dosettings == 1)) {
-        form.submit(); 
-        return true;
+        if (numchanges > 0) {
+            if ((cutwarnings > 0) || (remwarnings > 0)) {
+                if (remwarnings > 0) {
+                    if (!confirm('$lt{"p_rmr1"}\\n\\n$lt{"p_rmr3a"} '+remwarnings+' $lt{"p_rmr3b"}')) {
+                        return false;
+                    }
+                }
+                if (cutwarnings > 0) {
+                    if (!confirm('$lt{"p_ctr1a"}\\n$lt{"p_ctr1b"}\\n\\n$lt{"p_ctr3a"} '+cutwarnings+' $lt{"p_ctr3b"}')) {
+                        return false;
+                    }
+                }
+            }
+            form.submit();
+            return true;
+        } else {
+            form.submit();
+            return true;
+        }
     } 
     return false;
 }




More information about the LON-CAPA-cvs mailing list