[LON-CAPA-cvs] cvs: loncom /interface lonindexer.pm
albertel
lon-capa-cvs@mail.lon-capa.org
Tue, 18 May 2004 15:53:58 -0000
albertel Tue May 18 11:53:58 2004 EDT
Modified files:
/loncom/interface lonindexer.pm
Log:
- since group sort gets titles, and we do a second pas to grab and set the tile, no need to ever preseed with titles, just slows us down
- fixes bug where if a title wasn't wanted in 'interactive' mode it would blow up
Index: loncom/interface/lonindexer.pm
diff -u loncom/interface/lonindexer.pm:1.107 loncom/interface/lonindexer.pm:1.108
--- loncom/interface/lonindexer.pm:1.107 Tue May 11 19:27:35 2004
+++ loncom/interface/lonindexer.pm Tue May 18 11:53:58 2004
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Directory Indexer
#
-# $Id: lonindexer.pm,v 1.107 2004/05/11 23:27:35 albertel Exp $
+# $Id: lonindexer.pm,v 1.108 2004/05/18 15:53:58 albertel Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -130,14 +130,20 @@
}
#Hijack lonindexer to verify a title and be close down.
if ($ENV{'form.launch'} eq '2') {
- #$r->content_type('text/html');
- my $verify_title = &Apache::lonnet::gettitle($ENV{'form.acts'});
- $r->print(<<ENDSUBM);
+ $r->content_type('text/html');
+ my $extra='';
+ if (defined($ENV{'form.titleelement'})) {
+ my $verify_title = &Apache::lonnet::gettitle($ENV{'form.acts'});
+ &Apache::lonnet::logthis("Hrrm $ENV{'form.acts'} -- $verify_title");
+ $verify_title=~s/'/\\'/g;
+ $extra='window.opener.document.forms["'.$ENV{'form.form'}.'"].elements["'.$ENV{'form.titleelement'}.'"].value=\''.$verify_title.'\';';
+ }
+ $r->print(<<ENDSUBM);
<html>
<script type="text/javascript">
function load() {
window.opener.document.forms["$ENV{'form.form'}"].elements["$ENV{'form.element'}"].value='$ENV{'form.acts'}';
- window.opener.document.forms["$ENV{'form.form'}"].elements["$ENV{'form.titleelement'}"].value='$verify_title';
+ $extra
window.close();
}
</script>
@@ -145,7 +151,7 @@
</body>
</html>
ENDSUBM
- return OK;
+ return OK;
}
# -------------------- refresh environment with user database values (in %hash)
@@ -227,21 +233,13 @@
$location .= "mode=".$mode."&";
$location .= "acts=";
$catalogmodefunctions=<<"END";
-function select_data(title,url) {
- changeTitle(title);
+function select_data(url) {
changeURL(url);
self.close();
}
function select_group() {
window.location="$location"+document.forms.fileattr.acts.value;
}
-function changeTitle(val) {
- if (opener.inf) {
- if (opener.inf.document.forms.resinfo.elements.t) {
- opener.inf.document.forms.resinfo.elements.t.value=val;
- }
- }
-}
function changeURL(val) {
if (opener.inf) {
if (opener.inf.document.forms.resinfo.elements.u) {
@@ -255,8 +253,8 @@
$location .= "form=$form&element=$element&mode=edit&acts=";
$catalogmodefunctions=<<END;
// mode = $mode
-function select_data(title,url) {
-var location = "/res/?launch=2&form=$form&element=$element&titleelement=$titleelement&acts=" + url;
+function select_data(url) {
+ var location = "/res/?launch=2&form=$form&element=$element&titleelement=$titleelement&acts=" + url;
window.location=location;
}
function select_group() {
@@ -289,7 +287,7 @@
$location .= "form=$form&element=$element&mode=parmset&acts=";
$catalogmodefunctions=<<END;
// mode = $mode
-function select_data(title,url) {
+function select_data(url) {
changeURL(url);
self.close();
}
@@ -867,25 +865,13 @@
} else {
$metafile=0;
}
- my $title;
if ($ENV{'form.catalogmode'} eq 'interactive') {
- $title=$listname;
- $title = &Apache::lonnet::metadata($filelink,'title')
- if ($metafile == 1);
- $title=$listname unless $title;
- my $titleesc=HTML::Entities::encode($title,'<>&"');
- $titleesc=~s/\'/\\'/; #' (clean up this spare quote)
$r->print("<a href=\"javascript:select_data(\'",
- $titleesc,"','",$filelink,"')\">");
+ $filelink,"')\">");
$r->print("<img src='",$iconpath,"select.gif' border='0' /></a>".
"\n");
$r->print("</td><td nowrap>");
} elsif ($ENV{'form.catalogmode'} eq 'groupimport') {
- $title=$listname;
- $title = &Apache::lonnet::metadata($filelink,'title')
- if ($metafile == 1);
- $title=$listname unless $title;
- my $titleesc=&HTML::Entities::encode($title,'<>&"');
$r->print("<form name='form$fnum'>\n");
$r->print("<input type='checkbox' name='filelink"."' ".
"value='$filelink' onClick='".
@@ -894,12 +880,9 @@
$r->print("checked");
}
$r->print(">\n");
- $r->print("<input type='hidden' name='title"."' ".
- "value='$titleesc'>\n");
$r->print("</form>\n");
$r->print("</td><td nowrap>");
$hash{"pre_${fnum}_link"}=$filelink;
- $hash{"pre_${fnum}_title"}=$titleesc;
$fnum++;
}
# Form to open or close sequences