--- rat/lonratedt.pm 2006/11/02 21:03:28 1.84
+++ rat/lonratedt.pm 2008/09/11 14:47:24 1.89
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Edit Handler for RAT Maps
#
-# $Id: lonratedt.pm,v 1.84 2006/11/02 21:03:28 albertel Exp $
+# $Id: lonratedt.pm,v 1.89 2008/09/11 14:47:24 bisitz Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -167,16 +167,13 @@ determined.>
use strict;
use Apache::Constants qw(:common);
use Apache::lonnet;
-use Apache::lonratsrv;
-use Apache::lonsequence;
-use Apache::loncommon;
+use Apache::lonsequence();
+use Apache::loncommon();
use Apache::lonlocal;
use LONCAPA::map();
use File::Copy;
-use lib '/home/httpd/lib/perl/';
use LONCAPA;
-
-
+use HTML::Entities();
# --------------------------------------------------------- Build up RAT screen
sub ratedt {
@@ -277,7 +274,7 @@ function idxopen(mode) {
var options="scrollbars=1,resizable=1,menubar=0,location=1,toolbar=1";
idxmode=mode;
idxflag=1;
- idx=open('$resurl/?launch=1&mode=$mode&catalogmode='+mode,'idxout',options);
+ idx=open('$resurl/?inhibitmenu=yes&launch=1&mode=$mode&catalogmode='+mode,'idxout',options);
idx.focus();
}
@@ -285,7 +282,7 @@ function idxopen(mode) {
function groupopen(url,recover,bookmarks) {
var options="scrollbars=1,resizable=1,menubar=0";
idxflag=1;
- idx=open("/adm/groupsort?mode=$mode&recover="+recover+"&readfile="+url+"&bookmarks="+bookmarks,"idxout",options);
+ idx=open("/adm/groupsort?inhibitmenu=yes&mode=$mode&recover="+recover+"&readfile="+url+"&bookmarks="+bookmarks,"idxout",options);
idx.focus();
}
@@ -294,7 +291,7 @@ function srchopen(mode) {
var options="scrollbars=1,resizable=1,menubar=0";
srchmode=mode;
srchflag=1;
- srch=open("/adm/searchcat?launch=1&mode=$mode&catalogmode="+mode,"srchout",options);
+ srch=open("/adm/searchcat?inhibitmenu=yes&launch=1&mode=$mode&catalogmode="+mode,"srchout",options);
srch.focus();
}
// ----------------------------------------------------- launch indexer browser
@@ -329,6 +326,7 @@ function idxcheck(mode) {
if (editbrowser == null) {
url += 'launch=1&';
}
+ url += 'inhibitmenu=yes&';
url += 'catalogmode=interactive&';
url += 'mode=edit&';
url += 'form=' + formname + '&';
@@ -362,7 +360,7 @@ sub smpedt {
unless ($fatal) {
$targetmsg=''.&mt('Saved.').'
';
} else {
- $targetmsg=''.&mt('An error occured while saving.').'
';
+ $targetmsg=''.&mt('An error occurred while saving.').'
';
}
}
if ($env{'form.revert'}) {
@@ -605,10 +603,12 @@ sub smpedt {
my ($name,$url)=split(/\:/,$LONCAPA::map::resources[$_]);
unless ($name) { $name=(split(/\//,$url))[-1]; }
unless ($name) { $name='EMPTY'; }
+ $name = &LONCAPA::map::qtescape($name);
+ $url = &LONCAPA::map::qtescape($url);
$targetdetail.='&'.&escape($name).'='.
&escape($url);
$idx++;
- $name=~s/\:/\:/g;
+ $name = &HTML::Entities::encode($name,'\'"<>&');
'';
} @LONCAPA::map::order);
@@ -645,8 +645,6 @@ sub smpedt {
function openview(entry) {
var url=unescape((entry.split('='))[1]);
var parts=new Array;
- parts=url.split(':');
- url=parts.join(':');
if (url) { open(url,'cat'); }
}
@@ -665,12 +663,6 @@ sub smpedt {
var entry=(document.forms.simpleedit.targetdetail.value.split('&'))
[selidx];
var oldname=unescape((entry.split('='))[0]);
- var nameparts=oldname.split(':');
- oldname=unescape(nameparts.join(':'));
- nameparts=oldname.split('"');
- oldname=unescape(nameparts.join('"'));
- nameparts=oldname.split(''');
- oldname=unescape(nameparts.join("'"));
newtitle=prompt('$lt{'nt'}',oldname);
if (newtitle) {
document.forms.simpleedit.renameres.value=1;
@@ -766,7 +758,7 @@ ENDSMPHEAD
# ----------------------------------------------------------------- No such dir
sub nodir {
my ($r,$dir)=@_;
- $dir=~s{^/home/\w+/public_html}{};
+ $dir=~s{^/home/$LONCAPA::username_re/public_html}{};
$r->print(&Apache::loncommon::start_page(undef,undef,
{'only_body' => 1,
'bgcolor' => '#FFFFFF',}).
@@ -803,11 +795,11 @@ sub viewmap {
$idx++;
my ($title,$url,$cond)=split(/\:/,$_);
if ($cond eq 'cond') { next; }
- $title=~s/\&colon\;/\:/g;
- $url=~s/\&colon\;/\:/g;
+ $title= &LONCAPA::map::qtescape($title);
+ $url = &LONCAPA::map::qtescape($url);
unless ($title) { $title=(split(/\//,$url))[-1] };
unless ($title) { $title=''.&mt('Empty').''; }
- my $resurl = &Apache::lonratsrv::qtescape($url);
+ my $resurl = $url;
my $resfilepath = $Apache::lonnet::perlvar{'lonDocRoot'}.$resurl;
my $filename;
if ($resurl =~ m#/([^/]+)$#) {
@@ -818,7 +810,7 @@ sub viewmap {
my $bgcol = $idx%2;
$r->print('