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

sakharuk lon-capa-cvs@mail.lon-capa.org
Tue, 11 Nov 2003 16:53:48 -0000


sakharuk		Tue Nov 11 11:53:48 2003 EDT

  Modified files:              
    /loncom/interface	lonprintout.pm 
  Log:
  Style file can be added (from the construction space). Javascript function for the choice of style file is working. Continue to work with making this choice persistent.
  
  
Index: loncom/interface/lonprintout.pm
diff -u loncom/interface/lonprintout.pm:1.263 loncom/interface/lonprintout.pm:1.264
--- loncom/interface/lonprintout.pm:1.263	Mon Nov 10 18:26:42 2003
+++ loncom/interface/lonprintout.pm	Tue Nov 11 11:53:48 2003
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # Printout
 #
-# $Id: lonprintout.pm,v 1.263 2003/11/10 23:26:42 albertel Exp $
+# $Id: lonprintout.pm,v 1.264 2003/11/11 16:53:48 sakharuk Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -654,6 +654,30 @@
     my $bodytag=&Apache::loncommon::bodytag('Preparing Printout');
     $r->print(<<ENDPART);
 <html>
+<script type="text/javascript" language="Javascript" >
+    var editbrowser;
+    function openbrowser(formname,elementname,only,omit) {
+        var url = '/res/?';
+        if (editbrowser == null) {
+            url += 'launch=1&';
+        }
+        url += 'catalogmode=interactive&';
+        url += 'mode=parmset&';
+        url += 'form=' + formname + '&';
+        if (only != null) {
+            url += 'only=' + only + '&';
+        } 
+        if (omit != null) {
+            url += 'omit=' + omit + '&';
+        }
+        url += 'element=' + elementname + '';
+        var title = 'Browser';
+        var options = 'scrollbars=1,resizable=1,menubar=0';
+        options += ',width=700,height=600';
+        editbrowser = open(url,title,options,'1');
+        editbrowser.focus();
+    }
+</script>
 <head>
 <title>LON-CAPA output for printing</title>
 </head>
@@ -701,7 +725,7 @@
 	    if ($helper->{'VARS'}->{'ANSWER_TYPE'} ne 'only') {
 		my %moreenv;
 		$moreenv{'request.filename'}=$currentURL;
-		if ($helper->{'VARS'}->{'style_file'}=~/\w/) {$moreenv{'construction_space_style'}=$helper->{'VARS'}->{'style_file'};}
+		if ($helper->{'VARS'}->{'style_file'}=~/\w/) {$moreenv{'construct.style'}=$helper->{'VARS'}->{'style_file'};}
 		my %form;
 		$form{'grade_target'}='tex';
 		$form{'textwidth'}=$LaTeXwidth;	
@@ -1088,7 +1112,7 @@
 	return SERVER_ERROR; 
     }
 
-    my $identifier = &Apache::loncommon::get_cgi_id();
+    my $identifier = time.'_'.int(rand(1000));
     &Apache::lonnet::appenv('cgi.'.$identifier.'.file'   => $filename,
                             'cgi.'.$identifier.'.layout'  => $laystyle,
                             'cgi.'.$identifier.'.numcol'  => $numberofcolumns,
@@ -1130,6 +1154,9 @@
 #	foreach $key (keys %{$helper->{'VARS'}}) {
 #	    $r->print(' '.$key.'->'.$helper->{'VARS'}->{$key}.'<-<br />');
 #	}
+#	foreach $key (keys %ENV) {
+#	    $r->print(' '.$key.'->'.$ENV{$key}.'<-<br />');
+#	}
 #	return OK;
 
     my %parmhash=&Apache::lonnet::coursedescription($ENV{'request.course.id'});
@@ -1526,17 +1553,6 @@
 	    addMessage("</td></tr>");
 	}
 
-	if ($helper->{VARS}->{'construction'}) {
-	    addMessage("<tr><td align='right'>Print With URL: </td><td>");
-	    $paramHash = Apache::lonhelper::getParamHash();
-	    $paramHash->{'variable'} = 'CONSTR_RESOURSE_URL';   
-	    $helper->declareVar('CONSTR_RESOURSE_URL');         
-	    $paramHash->{CHOICES} = [
-				     ['No', 'no'],
-				     ['Yes', 'yes'] ];
-	    Apache::lonhelper::dropdown->new();
-	    addMessage("</td></tr>");
-	}
 	if ($helper->{'VARS'}->{'construction'}) { 
 	    my $xmlfrag .= <<'RNDSEED';
 	    <message><tr><td align='right'>Use random seed: </td><td></message>
@@ -1545,14 +1561,17 @@
 	            return $helper->{VARS}->{'curseed'};
 	        </defaultvalue>
 	    </string>
-	     <message></td></tr><tr><td align="right">Use style file: </td><td></message>
-	    <string variable="style_file" size="25" maxlength="50">
-	    </string>
+	     <message></td></tr><tr><td align="right">Use style file:</td><td></message>
+             <message><input type="text" size="40" name="style_file_value" value=""  /><a href="javascript:openbrowser('helpform','style_file','sty')">&nbsp; Select style file</a> </td><td></message>
              <message></td></tr></message>
 RNDSEED
             &Apache::lonxml::xmlparse($r, 'helper', $xmlfrag);
+	    $helper->{'VARS'}->{'style_file'}=$ENV{'form.style_file_value'};
 	}
     }
+
+
+
 
     if ($startedTable) {
 	addMessage("</table>");