--- loncom/xml/lonxml.pm 2002/06/14 19:56:57 1.177
+++ loncom/xml/lonxml.pm 2002/07/12 16:37:38 1.180
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# XML Parser Module
#
-# $Id: lonxml.pm,v 1.177 2002/06/14 19:56:57 www Exp $
+# $Id: lonxml.pm,v 1.180 2002/07/12 16:37:38 albertel Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -331,10 +331,15 @@ sub registerurl {
my $forcereg=shift;
my $target = shift;
my $result = '';
+ if ($target eq 'edit') {
+ $result .="\n";
+ }
if ((($ENV{'request.publicaccess'}) ||
(!&Apache::lonnet::is_on_map($ENV{'REQUEST_URI'}))) &&
(!$forcereg)) {
- return
+ return $result.
'';
}
if ($Apache::lonxml::registered && !$forcereg) { return ''; }
@@ -446,61 +451,6 @@ ENDREGTHIS
ENDDONOTREGTHIS
}
- if ($target eq 'edit') {
- # Javascript routines for construction space:
- # openbrowser and opensearcher will start the file browser
- # (lonindexer) and searcher (lonsearchcat) respectively.
- # Inputs are the name of the html form being used
- # and the name of the element the selected URL should
- # be placed in.
- # openbrowser also takes arguments only and omit, which are
- # comma deliminated lists of file extensions to (only) show
- # or omit.
- # Here we also set currentURL=null.
- $result .=<<"ENDBROWSERSCRIPT";
-
-ENDBROWSERSCRIPT
- }
return $result;
}
@@ -524,6 +474,23 @@ sub xmlparse {
my ($request,$target,$content_file_string,$safeinit,%style_for_target) = @_;
&setup_globals($request,$target);
+#
+# do we have a course style file?
+#
+
+ if ($ENV{'request.course.id'}) {
+ my $bodytext=
+ $ENV{'course.'.$ENV{'request.course.id'}.'.default_xml_style'};
+ if ($bodytext) {
+ my $location=&Apache::lonnet::filelocation('',$bodytext);
+ my $styletext=&Apache::lonnet::getfile($location);
+ if ($styletext ne '-1') {
+ %style_for_target = (%style_for_target,
+ &Apache::style::styleparser($target,$styletext));
+ }
+ }
+ }
+
#&printalltags();
my @pars = ();
my $pwd=$ENV{'request.filename'};
@@ -966,8 +933,34 @@ sub decreasedepth {
#print "
e $Apache::lonxml::depth : $Apache::lonxml::olddepth : $token->[1] : $curdepth\n";
}
-sub get_all_text {
+sub get_all_text_unbalanced {
+ my($tag,$pars)= @_;
+ my $token;
+ my $result='';
+ $tag='<'.$tag.'>';
+ while ($token = $$pars[-1]->get_token) {
+ if (($token->[0] eq 'T')||($token->[0] eq 'C')||($token->[0] eq 'D')) {
+ $result.=$token->[1];
+ } elsif ($token->[0] eq 'PI') {
+ $result.=$token->[2];
+ } elsif ($token->[0] eq 'S') {
+ $result.=$token->[4];
+ } elsif ($token->[0] eq 'E') {
+ $result.=$token->[2];
+ }
+ if ($result =~ /(.*)$tag(.*)/) {
+ &Apache::lonxml::debug('Got a winner with leftovers ::'.$2);
+ &Apache::lonxml::debug('Result is :'.$1);
+ $result=$1;
+ my $redo=$tag.$2;
+ &Apache::lonxml::newparser($pars,\$redo);
+ last;
+ }
+ }
+ return $result
+}
+sub get_all_text {
my($tag,$pars)= @_;
my $depth=0;
my $token;
@@ -1258,7 +1251,7 @@ ENDNOTFOUND
sub debug {
if ($Apache::lonxml::debug eq 1) {
$|=1;
- print("DEBUG:".join('
',@_)."
\n");
+ print("DEBUG:".&HTML::Entities::encode($_[0])."
\n");
}
}