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

raeburn raeburn at source.lon-capa.org
Wed Nov 13 08:32:33 EST 2013


raeburn		Wed Nov 13 13:32:33 2013 EDT

  Modified files:              
    /loncom/interface	londocs.pm loncourserespicker.pm 
  Log:
  - Bug 6305.
    Where user has more than one authoring/co-authoring roles, default in 
    "Select the Authoring Space" is blank. 
     - Form validation requires selection of non-blank option.
     - If author, that authoring space is frst non-blank option in dropdown list. 
  
  
Index: loncom/interface/londocs.pm
diff -u loncom/interface/londocs.pm:1.568 loncom/interface/londocs.pm:1.569
--- loncom/interface/londocs.pm:1.568	Wed Nov 13 01:40:07 2013
+++ loncom/interface/londocs.pm	Wed Nov 13 13:32:33 2013
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # Documents
 #
-# $Id: londocs.pm,v 1.568 2013/11/13 01:40:07 raeburn Exp $
+# $Id: londocs.pm,v 1.569 2013/11/13 13:32:33 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -492,6 +492,9 @@
                     }
                 } 
             }
+            if ($home>1) {
+                $preamble .= '<option value="" selected="selected">'.&mt('Select').'</option>';
+            }
             foreach my $user (@orderspaces) {
 		if ($home==1) {
 		    $preamble .= '<input type="hidden" name="authorspace" value="'.$user.'" />';
Index: loncom/interface/loncourserespicker.pm
diff -u loncom/interface/loncourserespicker.pm:1.8 loncom/interface/loncourserespicker.pm:1.9
--- loncom/interface/loncourserespicker.pm:1.8	Wed Nov 13 01:40:07 2013
+++ loncom/interface/loncourserespicker.pm	Wed Nov 13 13:32:33 2013
@@ -1,6 +1,6 @@
 # The LearningOnline Network
 #
-# $Id: loncourserespicker.pm,v 1.8 2013/11/13 01:40:07 raeburn Exp $
+# $Id: loncourserespicker.pm,v 1.9 2013/11/13 13:32:33 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -466,7 +466,7 @@
     $display .= '</form>';
     my $scripttag = 
         &respicker_javascript($startcount,$numcount,$context,$formname,\%children,
-                              \%hierarchy,\@checked_maps);
+                              \%hierarchy,\@checked_maps,$numhome);
     if ($context eq 'dumpdocs') {
         return $scripttag.$display; 
     }
@@ -498,7 +498,7 @@
 
 sub respicker_javascript {
     my ($startcount,$numitems,$context,$formname,$children,$hierarchy,
-        $checked_maps) = @_;
+        $checked_maps,$numhome) = @_;
     return unless ((ref($children) eq 'HASH') && (ref($hierarchy) eq 'HASH')
                    && (ref($checked_maps) eq 'ARRAY'));
     my ($elem,$nested,$nameforelem);
@@ -591,11 +591,13 @@
     } elsif ($context eq 'dumpdocs') {
         my $blankmsg = &mt('An item selected has no filename set in the "Save as ..." column.');
         my $dupmsg = &mt('Items selected for copying need unique filenames in the "Save as ..." column.');
+        my $homemsg = &mt('An authoring space needs to be selected.');
         $scripttag .= <<"EXTRA";
 
 function checkUnique(form,field) {
     var duplicate = 0;
     var blank = 0;
+    var numhome = '$numhome';
     if (field.length > 0) {
         for (i=0; i<field.length; i++) {
             if (field[i].checked) {
@@ -635,6 +637,12 @@
         alert('$dupmsg');
         return false;
     }
+    if (numhome > 1) {
+        if (!form.authorspace.options[form.authorspace.selectedIndex].value) {
+            alert('$homemsg');
+            return false;
+        }
+    }
     return true;
 }
 




More information about the LON-CAPA-cvs mailing list