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

www www@source.lon-capa.org
Sat, 21 May 2011 01:02:27 -0000


www		Sat May 21 01:02:27 2011 EDT

  Modified files:              
    /loncom/interface	lonpickresource.pm lonquickgrades.pm 
  Log:
  Continued work on picking resources
  
  
Index: loncom/interface/lonpickresource.pm
diff -u loncom/interface/lonpickresource.pm:1.1 loncom/interface/lonpickresource.pm:1.2
--- loncom/interface/lonpickresource.pm:1.1	Wed May  4 01:49:08 2011
+++ loncom/interface/lonpickresource.pm	Sat May 21 01:02:27 2011
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Pick resource or folder in the course
 #
-# $Id: lonpickresource.pm,v 1.1 2011/05/04 01:49:08 www Exp $
+# $Id: lonpickresource.pm,v 1.2 2011/05/21 01:02:27 www Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -52,15 +52,36 @@
                                              {'no_nav_bar' => 1}));
 
     &Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},['form','reslink']);
-    my $form='opener.document.'.$env{'form.form'};
+    my $form='opener.document.forms.'.$env{'form.form'};
     my $reslink=$env{'form.reslink'};
 
     $r->print('<form name="pickresource" action="/adm/pickresource">');
     $r->print(&Apache::lonstathelpers::problem_selector('.',undef,1,1,'resource'));
+    $r->print(<<ENDGETVALUE);
+<script type="text/javascript">
+function getCheckedValue(radioObj) {
+	if(!radioObj)
+		return "";
+	var radioLength = radioObj.length;
+	if(radioLength == undefined)
+		if(radioObj.checked)
+			return radioObj.value;
+		else
+			return "";
+	for(var i = 0; i < radioLength; i++) {
+		if(radioObj[i].checked) {
+			return radioObj[i].value;
+		}
+	}
+	return "";
+}
+</script>
+ENDGETVALUE
     $r->print('<input type="button" value="'.&mt('Pick').
-      '" onClick="if (this.form.resourcesymb.value!=null) { '.
-                    $form.'.resourcesymb.value=this.form.resourcesymb.value;'.
-                    $form.".cmd.value='".$reslink."';} window.close();".'" />');
+      '" onClick="val=getCheckedValue(this.form.resourcesymb);if (val) { '.
+                    $form.'.resourcesymb.value=val;'.
+                    $form.".cmd.value='".$reslink."';".
+                    $form.".submit();} window.close();".'" />');
     $r->print('</form>');
     $r->print(&Apache::loncommon::end_page());
     return OK;
Index: loncom/interface/lonquickgrades.pm
diff -u loncom/interface/lonquickgrades.pm:1.85 loncom/interface/lonquickgrades.pm:1.86
--- loncom/interface/lonquickgrades.pm:1.85	Wed May  4 01:49:08 2011
+++ loncom/interface/lonquickgrades.pm	Sat May 21 01:02:27 2011
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Quick Student Grades Display
 #
-# $Id: lonquickgrades.pm,v 1.85 2011/05/04 01:49:08 www Exp $
+# $Id: lonquickgrades.pm,v 1.86 2011/05/21 01:02:27 www Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -467,6 +467,7 @@
         $r->print(&Apache::loncommon::resourcebrowser_javascript().
                   '<input type="hidden" name="storemove" value="" />'.
                   '<input type="hidden" name="cmd" value="" />'.
+                  '<input type="hidden" name="resourcesymb" value="" />'.
                   '<input type="submit" name="storechanges" value="'.&mt("Save changes to grading categories").'" />'.
                   '<script>function storecmd (cmd) { document.quickform.cmd.value=cmd; document.quickform.submit(); }</script>');
     }
@@ -653,8 +654,7 @@
     }
     $r->print('</ul>');
     if ($cangrade) {
-        $r->print('<br />'.&Apache::loncommon::selectresource_link('quickform','addcont_'.$id,&mt('Add Problem or Folder')).'<br />'.
-                  '<input type="hidden" name="addcont_'.$id.'_res" onChange='."'".'this.form.cmd.value="addcont_'.$id.'";this.form.submit();'."' />");
+        $r->print('<br />'.&Apache::loncommon::selectresource_link('quickform','addcont_'.$id,&mt('Add Problem or Folder')).'<br />');
     }
     $r->print('</td>');