[LON-CAPA-cvs] cvs: loncom /homework inputtags.pm /interface loncommon.pm

www www at source.lon-capa.org
Wed Dec 7 21:59:37 EST 2011


www		Thu Dec  8 02:59:37 2011 EDT

  Modified files:              
    /loncom/homework	inputtags.pm 
    /loncom/interface	loncommon.pm 
  Log:
  Bug #5590: Previous tries window. Also tested with JSMath.
  
  
Index: loncom/homework/inputtags.pm
diff -u loncom/homework/inputtags.pm:1.296 loncom/homework/inputtags.pm:1.297
--- loncom/homework/inputtags.pm:1.296	Tue Nov 29 13:24:38 2011
+++ loncom/homework/inputtags.pm	Thu Dec  8 02:59:34 2011
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # input  definitons
 #
-# $Id: inputtags.pm,v 1.296 2011/11/29 13:24:38 raeburn Exp $
+# $Id: inputtags.pm,v 1.297 2011/12/08 02:59:34 www Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -1647,12 +1647,12 @@
 	'<tr>'.'<th>'.&mt('Submission #').'</th><th>'.&mt('Try').
 	'</th><th colspan="'.scalar(@Apache::inputtags::response).'">'.
 	&mt('Submitted Answer').'</th>';
-    $output ='<table class="LC_prior_tries">'.$headers.$output.'</table>';
+    $output =&Apache::loncommon::start_scrollbox('420px','400px','400px').
+             '<table class="LC_prior_tries">'.$headers.$output.'</table>'.
+             &Apache::loncommon::end_scrollbox();
     #return $output;
     $output = &Apache::loncommon::js_ready($output); 
-    $output.='<br /><form action=""><center><input type="button" name="close" value="'.&mt('Close Window').'" onClick="window.close()" /></center></form>';
 
-    my $windowopen=&Apache::lonhtmlcommon::javascript_docopen();
     my $tries_text = &get_tries_text('link');
     my $start_page =
 	&Apache::loncommon::start_page($tries_text, undef,
@@ -1666,13 +1666,8 @@
     $prefix =~ tr{.}{_};
     my $function_name = "LONCAPA_previous_tries_".$prefix.
 	$Apache::lonxml::curdepth.'_'.$env{'form.counter'};
-    my $result ="<script type=\"text/javascript\">
-// <![CDATA[
-    function $function_name() {newWindow=open('','new_W','width=500,height=500,scrollbars=1,resizable=yes');newWindow.$windowopen;newWindow.document.writeln('$start_page $output $end_page');newWindow.document.close();newWindow.focus()}
-// ]]>
-</script><a href=\"javascript:$function_name();void(0);\">".&mt($tries_text)."</a><br />";
-    #use Data::Dumper;
-    #&Apache::lonnet::logthis(&Dumper(\%Apache::inputtags::submission_display));
+    my $result = &Apache::loncommon::modal_adhoc_script($function_name,420,410,$start_page.$output.$end_page).
+    "<a href=\"javascript:$function_name();void(0);\">".&mt($tries_text)."</a><br />";
     return $result;
 }
 
Index: loncom/interface/loncommon.pm
diff -u loncom/interface/loncommon.pm:1.1031 loncom/interface/loncommon.pm:1.1032
--- loncom/interface/loncommon.pm:1.1031	Thu Dec  8 01:34:50 2011
+++ loncom/interface/loncommon.pm	Thu Dec  8 02:59:37 2011
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # a pile of common routines
 #
-# $Id: loncommon.pm,v 1.1031 2011/12/08 01:34:50 www Exp $
+# $Id: loncommon.pm,v 1.1032 2011/12/08 02:59:37 www Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -6739,8 +6739,8 @@
 	&& !$args->{'only_body'}
 	&& !$args->{'frameset'}) {
 	$result .= &help_menu_js();
+        $result.=&modal_window();
     }
-    $result.=&modal_window();
     if (ref($args->{'redirect'})) {
 	my ($time,$url,$inhibit_continue) = @{$args->{'redirect'}};
 	$url = &Apache::lonenc::check_encrypt($url);
@@ -7008,6 +7008,24 @@
            $linktext.'</a>';
 }
 
+sub modal_adhoc_script {
+    my ($funcname,$width,$height,$content)=@_;
+    return (<<ENDADHOC);
+<script type="text/javascript" lang="javascript">
+// <![CDATA[
+        var $funcname = function()
+        {
+                modalWindow.windowId = "myModal";
+                modalWindow.width = $width;
+                modalWindow.height = $height;
+                modalWindow.content = '$content';
+                modalWindow.open();
+        };  
+// ]]>
+</script>
+ENDADHOC
+}
+
 sub html_encode {
     my ($result) = @_;
 




More information about the LON-CAPA-cvs mailing list