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

raeburn raeburn at source.lon-capa.org
Sat May 23 14:10:03 EDT 2015


raeburn		Sat May 23 18:10:03 2015 EDT

  Modified files:              
    /loncom/interface	lonsource.pm 
  Log:
  - Show only body in pop-up.
  - "Close Window" button form element needs to be inside <form></form>.
  
  
Index: loncom/interface/lonsource.pm
diff -u loncom/interface/lonsource.pm:1.32 loncom/interface/lonsource.pm:1.33
--- loncom/interface/lonsource.pm:1.32	Tue Feb 11 15:49:15 2014
+++ loncom/interface/lonsource.pm	Sat May 23 18:10:02 2015
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Source Code handler
 #
-# $Id: lonsource.pm,v 1.32 2014/02/11 15:49:15 bisitz Exp $
+# $Id: lonsource.pm,v 1.33 2015/05/23 18:10:02 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -52,7 +52,8 @@
 sub stage_2 {
     my ($r, $filename, $listname) = @_;
     my ($author)=($filename=~/\/res\/[^\/]+\/([^\/]+)\//);
-    $r->print(&Apache::loncommon::start_page('Copy Problem Source Code to Authoring Space')
+    $r->print(&Apache::loncommon::start_page('Copy Problem Source Code to Authoring Space',undef,
+                                             {'only_body' => 1,})
              .&mt('Please enter the directory that you would like the source code to go into.')
              .'<p>'
              .&mt('Note: the path is in reference to the root of your Authoring Space,'
@@ -64,7 +65,8 @@
               <input type="hidden" name="action" value="copy_stage" />
               <input type="text" size="50" name="newpath" value="/'.&mt('shared_source').'/'.$author.'" /> 
               <input type="submit" value="'.&mt('Copy').'" />
-              </form>');
+              </form>'.
+              &Apache::loncommon::end_page());
     return OK;
 }
 
@@ -101,14 +103,14 @@
     my ($uname,$udom)= &Apache::lonnet::constructaccess($path_to_new_file);
 
     if (!$uname || !$udom) {
-	$r->print(&Apache::loncommon::start_page('Not Allowed'));
+	$r->print(&Apache::loncommon::start_page('Not Allowed',undef,{'only_body' => 1}));
 	$r->print(&mt('Not allowed to create file [_1]', $path_to_new_file));
 	$r->print(&Apache::loncommon::end_page());
 	return;
     }
 
     #allowed
-    $r->print(&Apache::loncommon::start_page('Copying Source'));
+    $r->print(&Apache::loncommon::start_page('Copying Source',undef,{'only_body' => 1}));
     my $result = &Apache::loncfile::exists($uname, $udom, $path_to_new_file);
     $r->print($result);
     if(($result) && ($result =~ m|published|) ) {
@@ -143,20 +145,23 @@
                  .'</span><br />'
                  .&mt('Please use the code view in previous window to use shared code.')
                  .'<br /><br />');
-        $r->print('<input type="button" value="'.&mt('Close Window').'" name="close"'
+        $r->print('<form name="delete_done" action="/adm/source" target="_parent" method="post">'
+                 .'<input type="button" value="'.&mt('Close Window').'" name="close"'
                  .' onclick="window.close()" />'
                  .'</p>');
     } else {
+        $r->print(&Apache::loncommon::start_page('Copying Source',undef,{'only_body' => 1}));
         if(-e $path_to_new_file) {
             unless(unlink($path_to_new_file)) {
                 $r->print('<p class="LC_error"">'.&mt('Error:').' '.$!.'</p>');
                 return 0;
             }
         } else {
-            $r->print('<p class="LC_error">'.&mt('No such file').'</p></form>');
+            $r->print('<p class="LC_error">'.&mt('No such file').'</p>');
             return 0;
         }
         &copy_file($r, $newpath, $filename, $path_to_new_file);
+        $r->print(&Apache::loncommon::end_page());
     }
 }
 
@@ -196,7 +201,10 @@
         print $fs $file_output;
     }
     $r->print("<br /><br />");
-    $r->print('<input type="button" value="'.&mt('Close Window').'" name="close" onclick="window.close()" />');
+    $r->print('<form name="copied_file" action="/adm/source" target="_parent" method="post">'
+              .'<input type="button" value="'
+              .&mt('Close Window').'" name="close" onclick="window.close()" />'
+              .'</form>');
     #Some 1.3'ish feature is to include the derivative feature, will go here..'
 }
 




More information about the LON-CAPA-cvs mailing list