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

raeburn lon-capa-cvs-allow@mail.lon-capa.org
Wed, 02 Jan 2008 09:01:04 -0000


raeburn		Wed Jan  2 04:01:04 2008 EDT

  Modified files:              
    /loncom/interface	lonuserutils.pm 
  Log:
  - Move "Proceed" button which executes the bulk action
  - Add a "go" button to the right of the select action pulldown menu to open the date/section pop-up window, or display an alert dialog if no date/section window needed for the currently selected action.  
  
  
Index: loncom/interface/lonuserutils.pm
diff -u loncom/interface/lonuserutils.pm:1.40 loncom/interface/lonuserutils.pm:1.41
--- loncom/interface/lonuserutils.pm:1.40	Wed Jan  2 03:01:22 2008
+++ loncom/interface/lonuserutils.pm	Wed Jan  2 04:01:02 2008
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Utility functions for managing LON-CAPA user accounts
 #
-# $Id: lonuserutils.pm,v 1.40 2008/01/02 08:01:22 raeburn Exp $
+# $Id: lonuserutils.pm,v 1.41 2008/01/02 09:01:02 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -2036,6 +2036,7 @@
                        'clicker'    => "clicker id",
                        'photo'      => "photo",
                        'extent'     => "extent",
+                       'go'         => "go",
                        'pr'         => "Proceed",
                        'ca'         => "check all",
                        'ua'         => "uncheck all",
@@ -2118,10 +2119,10 @@
                 $output .= &mt("Click on a username to view the user's personal page.").'<br />';
             }
             if ($actionselect) {
-                $output .= <<"END"; 
-$lt{'ac'}:&nbsp;$actionselect <input type="button" value="$lt{'pr'}" onclick="javascript:verify_action(document.studentform.actionlist)" /></p>
+                $output .= <<"END";
+$lt{'ac'}:&nbsp;$actionselect <input type="button" value="$lt{'go'}" onclick="javascript:opendatebrowser(this.form,'studentform','go')" /></p>
 <p><input type="button" value="$lt{'ca'}" onclick="javascript:checkAll(document.studentform.actionlist)" /> &nbsp;
-<input type="button" value="$lt{'ua'}" onclick="javascript:uncheckAll(document.studentform.actionlist)" />
+<input type="button" value="$lt{'ua'}" onclick="javascript:uncheckAll(document.studentform.actionlist)" /><br /><br /><input type="button" value="$lt{'pr'}" onclick="javascript:verify_action(document.studentform.actionlist)" />
 END
                 my @allroles;
                 if ($env{'form.showrole'} eq 'Any') {
@@ -2625,7 +2626,7 @@
         }
     }
     if ($options) {
-        $output = '<select name="bulkaction" onchange="javascript:opendatebrowser(this.form,'."'studentform'".')" />'."\n".
+        $output = '<select name="bulkaction" onchange="javascript:opendatebrowser(this.form,'."'studentform','change'".')" />'."\n".
                   '<option value="" selected="selected">'.
                   &mt('Please select').'</option>'."\n".$options."\n".'</select>';
         if ($choices{'dates'}) {
@@ -2662,13 +2663,29 @@
     } else {
         $title = &mt('Date selector');
     }
+    my %nopopup = &Apache::lonlocal::texthash (
+        revoke => "Check the boxes for any users for whom roles are to be revoked, and click 'Proceed'",
+        delete => "Check the boxes for any users for whom roles are to be deleted, and click 'Proceed'",
+        none   => "Choose an action to take for selected users",
+    );  
     my $output = '
 <script type="text/javascript">
     var stdeditbrowser;'."\n";
     $output .= <<"ENDONE";
-    function opendatebrowser(callingform,formname) {
+    function opendatebrowser(callingform,formname,calledby) {
         var bulkaction = callingform.bulkaction.options[callingform.bulkaction.selectedIndex].value;
         if (bulkaction == 'revoke' || bulkaction == 'delete' || bulkaction == '') {
+            if (calledby == 'go') {
+                if (bulkaction == 'revoke') {
+                    alert("$nopopup{'revoke'}");
+                }
+                if (bulkaction == 'delete') {
+                    alert("$nopopup{'delete'}"); 
+                }
+                if (bulkaction == '') {
+                    alert("$nopopup{'none'}");
+                }
+            }
             return;
         }
         var url = '/adm/createuser?';