[LON-CAPA-cvs] cvs: loncom /homework edit.pm /xml scripttag.pm

matthew lon-capa-cvs@mail.lon-capa.org
Thu, 14 Nov 2002 16:47:41 -0000


matthew		Thu Nov 14 11:47:41 2002 EDT

  Modified files:              
    /loncom/homework	edit.pm 
    /loncom/xml	scripttag.pm 
  Log:
  Fix bug 888 by adding a 'browse' link for <scriptlib> and <import>.
  
  
Index: loncom/homework/edit.pm
diff -u loncom/homework/edit.pm:1.41 loncom/homework/edit.pm:1.42
--- loncom/homework/edit.pm:1.41	Mon Nov 11 17:37:23 2002
+++ loncom/homework/edit.pm	Thu Nov 14 11:47:41 2002
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA 
 # edit mode helpers
 #
-# $Id: edit.pm,v 1.41 2002/11/11 22:37:23 www Exp $
+# $Id: edit.pm,v 1.42 2002/11/14 16:47:41 matthew Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -518,9 +518,15 @@
 #----------------------------------------------------- browse
 sub browse {
     # insert a link to call up the filesystem browser (lonindexer)
-    $_ = shift;
+    my ($id, $mode) = @_;
     my $form    = 'lonhomework';
-    my $element = &Apache::lonnet::escape("$Apache::lonxml::curdepth.$_");
+    my $element;
+    if (! defined($mode) || $mode eq 'attribute') {
+        $element = &Apache::lonnet::escape("$Apache::lonxml::curdepth.$id");
+    } elsif ($mode eq 'textnode') {  # for data between <tag> ... </tag>
+        $element = &Apache::lonnet::escape('homework_edit_'.
+                                           $Apache::lonxml::curdepth);
+    }
     my $result = <<"ENDBUTTON";
 <a href=\"javascript:openbrowser('$form','$element')\"\>Browse</a>
 ENDBUTTON
Index: loncom/xml/scripttag.pm
diff -u loncom/xml/scripttag.pm:1.82 loncom/xml/scripttag.pm:1.83
--- loncom/xml/scripttag.pm:1.82	Wed Nov 13 18:15:40 2002
+++ loncom/xml/scripttag.pm	Thu Nov 14 11:47:41 2002
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # <script> definiton
 #
-# $Id: scripttag.pm,v 1.82 2002/11/13 23:15:40 albertel Exp $
+# $Id: scripttag.pm,v 1.83 2002/11/14 16:47:41 matthew Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -176,7 +176,8 @@
   if ($target eq "edit" ) {
     $result=
       &Apache::edit::tag_start($target,$token,'New Script Functions').
-	&Apache::edit::editline($token->[1],$bodytext,'',40).
+	&Apache::edit::editline($token->[1],$bodytext,'scriptlib',40).
+            &Apache::edit::browse(undef,'textnode').
 	  $error.'</td></tr>'.
 	    &Apache::edit::end_table();
   }
@@ -295,6 +296,7 @@
   } elsif ($target eq "edit" ) {
     $result.=&Apache::edit::tag_start($target,$token);
     $result.=&Apache::edit::editline($token->[1],$bodytext,'',40);
+    $result.=&Apache::edit::browse(undef,'textnode');
     #FIXME this need to convert $bodytext to be a contruction space reference
     #my $location=&Apache::lonnet::filelocation($Apache::lonxml::pwd['-1'],$bodytext);
     #$result.="Click<a href=\"$location\">here</a> to edit<br />"