--- loncom/interface/loncommon.pm 2006/03/21 20:36:15 1.317
+++ loncom/interface/loncommon.pm 2006/04/18 19:18:17 1.339
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# a pile of common routines
#
-# $Id: loncommon.pm,v 1.317 2006/03/21 20:36:15 albertel Exp $
+# $Id: loncommon.pm,v 1.339 2006/04/18 19:18:17 albertel Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -58,10 +58,11 @@ use strict;
use Apache::lonnet;
use GDBM_File;
use POSIX qw(strftime mktime);
-use Apache::Constants qw(:common :http :methods);
use Apache::lonmenu();
use Apache::lonlocal;
use HTML::Entities;
+use Apache::lonhtmlcommon();
+use Apache::loncoursedata();
my $readit;
@@ -721,8 +722,18 @@ sub help_open_menu {
"
$text";
}
my $nothing=&Apache::lonhtmlcommon::javascript_nothing();
- my $html=&Apache::lonxml::xmlbegin();
my $helpicon=&lonhttpdurl("/adm/lonIcons/helpgateway.gif");
+ my $start_page =
+ &Apache::loncommon::start_page('Help Menu', undef,
+ {'frameset' => 1,
+ 'js_ready' => 1,
+ 'add_entries' => {
+ 'border' => '0',
+ 'rows' => "105,*",},});
+ my $end_page =
+ &Apache::loncommon::end_page({'frameset' => 1,
+ 'js_ready' => 1,});
+
$template .= <<"ENDTEMPLATE";
}{}xmsg;
return $result;
}
@@ -3138,11 +3295,13 @@ sub validate_page {
if ( exists($env{'internal.start_page'})
&& $env{'internal.start_page'} > 1) {
&Apache::lonnet::logthis('start_page called multiple times '.
+ $env{'internal.start_page'}.' '.
$ENV{'request.filename'});
}
if ( exists($env{'internal.end_page'})
&& $env{'internal.end_page'} > 1) {
&Apache::lonnet::logthis('end_page called multiple times '.
+ $env{'internal.end_page'}.' '.
$env{'request.filename'});
}
if ( exists($env{'internal.start_page'})
@@ -3157,6 +3316,18 @@ sub validate_page {
}
}
+sub simple_error_page {
+ my ($r,$title,$msg) = @_;
+ my $page =
+ &Apache::loncommon::start_page($title).
+ &mt($msg).
+ &Apache::loncommon::end_page();
+ if (ref($r)) {
+ $r->print($page);
+ return;
+ }
+ return $page;
+}
###############################################
=pod
@@ -3575,78 +3746,6 @@ sub get_user_info {
return;
}
-###############################################
-
-sub get_posted_cgi {
- my $r=shift;
-
- my $buffer;
- if ($r->header_in('Content-length')) {
- $r->read($buffer,$r->header_in('Content-length'),0);
- }
- unless ($buffer=~/^(\-+\w+)\s+Content\-Disposition\:\s*form\-data/si) {
- my @pairs=split(/&/,$buffer);
- my $pair;
- foreach $pair (@pairs) {
- my ($name,$value) = split(/=/,$pair);
- $value =~ tr/+/ /;
- $value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C",hex($1))/eg;
- $name =~ tr/+/ /;
- $name =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C",hex($1))/eg;
- &add_to_env("form.$name",$value);
- }
- } else {
- my $contentsep=$1;
- my @lines = split (/\n/,$buffer);
- my $name='';
- my $value='';
- my $fname='';
- my $fmime='';
- my $i;
- for ($i=0;$i<=$#lines;$i++) {
- if ($lines[$i]=~/^$contentsep/) {
- if ($name) {
- chomp($value);
- if ($fname) {
- $env{"form.$name.filename"}=$fname;
- $env{"form.$name.mimetype"}=$fmime;
- } else {
- $value=~s/\s+$//s;
- }
- &add_to_env("form.$name",$value);
- }
- if ($i<$#lines) {
- $i++;
- $lines[$i]=~
- /Content\-Disposition\:\s*form\-data\;\s*name\=\"([^\"]+)\"/i;
- $name=$1;
- $value='';
- if ($lines[$i]=~/filename\=\"([^\"]+)\"/i) {
- $fname=$1;
- if
- ($lines[$i+1]=~/Content\-Type\:\s*([\w\-\/]+)/i) {
- $fmime=$1;
- $i++;
- } else {
- $fmime='';
- }
- } else {
- $fname='';
- $fmime='';
- }
- $i++;
- }
- } else {
- $value.=$lines[$i]."\n";
- }
- }
- }
- $env{'request.method'}=$ENV{'REQUEST_METHOD'};
- $r->method_number(M_GET);
- $r->method('GET');
- $r->headers_in->unset('Content-length');
-}
-
=pod
=item * get_unprocessed_cgi($query,$possible_names)
|