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

raeburn raeburn at source.lon-capa.org
Tue Dec 31 08:38:32 EST 2013


raeburn		Tue Dec 31 13:38:32 2013 EDT

  Modified files:              
    /loncom/interface	londocs.pm 
  Log:
  - "Check all" and "Uncheck all" buttons for clipboard, if there is more than
    one item.
  - Clarify purpose of main clipboard buttons by assigning more descriptive values.
  
  
Index: loncom/interface/londocs.pm
diff -u loncom/interface/londocs.pm:1.574 loncom/interface/londocs.pm:1.575
--- loncom/interface/londocs.pm:1.574	Mon Dec 30 21:10:36 2013
+++ loncom/interface/londocs.pm	Tue Dec 31 13:38:31 2013
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # Documents
 #
-# $Id: londocs.pm,v 1.574 2013/12/30 21:10:36 raeburn Exp $
+# $Id: londocs.pm,v 1.575 2013/12/31 13:38:31 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -1124,6 +1124,7 @@
 
     my @currpaste = split(/,/,$env{'docs.markedcopies'});
     my ($pasteitems, at pasteable);
+    my $clipboardcount = 0;
 
 # Construct identifiers for current contents of user's paste buffer
     foreach my $suffix (@currpaste) {
@@ -1132,6 +1133,7 @@
         my $url = $env{'docs.markedcopy_url_'.$suffix};
         if (($cid =~ /^$match_domain\_$match_courseid$/) &&
             ($url ne '')) {
+            $clipboardcount ++;
             my ($is_external,$othercourse,$fromsupp,$is_uploaded_map,$parent,
                 $canpaste,$nopaste,$othercrs,$areachange);
             my $extension = (split(/\./,$env{'docs.markedcopy_url_'.$suffix}))[-1];
@@ -1225,11 +1227,23 @@
         $pasteitems .= '<div style="padding:0;clear:both;margin:0;border:0"></div>';
         $form_start = '<form name="pasteform" action="/adm/coursedocs" method="post" onsubmit="return validateClipboard();">';
         if (@pasteable) {
-            $buttons = '<input type="submit" name="pastemarked" value="'.&mt('Paste selected').'" />'.(' 'x2);
+            my $value = &mt('Paste to current folder');
+            if ($container eq 'page') {
+                $value = &mt('Paste to current page');
+            } 
+            $buttons = '<input type="submit" name="pastemarked" value="'.$value.'" />'.(' 'x2);
         }
-        $buttons .= '<input type="submit" name="clearmarked" value="'.&mt('Clear selected').'" />'.
-                    '<input type="hidden" name="folderpath" value="'.&HTML::Entities::encode($env{'form.folderpath'},'<>&"').'" />';
-        $form_end = '</form>';
+        $buttons .= '<input type="submit" name="clearmarked" value="'.&mt('Remove from clipboard').'" />'.(' 'x2);
+        if ($clipboardcount > 1) {
+            $buttons .=
+                '<span style="text-decoration:line-through">'.(' 'x20).'</span>'.(' 'x2).
+                '<input type="button" name="checkallclip" value="'.&mt('Check all').'" style="height:20px;" onclick="checkClipboard();" />'.
+                (' 'x2).
+                '<input type="button" name="uncheckallclip" value="'.&mt('Uncheck all').'" style="height:20px;" onclick="uncheckClipboard();" />'.
+                (' 'x2);
+        }
+        $form_end = '<input type="hidden" name="folderpath" value="'.&HTML::Entities::encode($env{'form.folderpath'},'<>&"').'" />'.
+                    '</form>';
     } else {
         $pasteitems = &mt('Clipboard is empty');
     }
@@ -1383,6 +1397,24 @@
     }
 }
 
+function checkClipboard() {
+    if (document.pasteform.pasting.length > 1) {
+        for (var i=0; i<document.pasteform.pasting.length; i++) {
+            document.pasteform.pasting[i].checked = true;
+        } 
+    }
+    return;
+}
+
+function uncheckClipboard() {
+    if (document.pasteform.pasting.length >1) {
+        for (var i=0; i<document.pasteform.pasting.length; i++) {
+            document.pasteform.pasting[i].checked = false;
+        }
+    }
+    return;
+}
+
 END
 
 }




More information about the LON-CAPA-cvs mailing list