[LON-CAPA-cvs] cvs: loncom /interface londocs.pm
www
lon-capa-cvs@mail.lon-capa.org
Wed, 04 Sep 2002 20:33:39 -0000
www Wed Sep 4 16:33:39 2002 EDT
Modified files:
/loncom/interface londocs.pm
Log:
Provides download Link for uploaded non-browser-displayable documents.
Index: loncom/interface/londocs.pm
diff -u loncom/interface/londocs.pm:1.18 loncom/interface/londocs.pm:1.19
--- loncom/interface/londocs.pm:1.18 Wed Sep 4 15:24:46 2002
+++ loncom/interface/londocs.pm Wed Sep 4 16:33:38 2002
@@ -1,7 +1,7 @@
# The LearningOnline Network
# Documents
#
-# $Id: londocs.pm,v 1.18 2002/09/04 19:24:46 www Exp $
+# $Id: londocs.pm,v 1.19 2002/09/04 20:33:38 www Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -232,6 +232,7 @@
my $script='';
my $allowed;
my $events='';
+ my $showdoc=0;
&Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},
['folder','foldername','showdoc']);
unless ($ENV{'form.showdoc'}) { # got called from remote
@@ -246,8 +247,7 @@
}
} else { # got called in sequence from course
$allowed=0;
- $forcestandard=1;
- $forcesupplement=0;
+ $showdoc=1;
$script=&Apache::lonxml::registerurl(1,undef);
$events='onLoad="'.&Apache::lonxml::loadevents.
'" onUnload="'.&Apache::lonxml::unloadevents.'"';
@@ -275,6 +275,10 @@
<title>The LearningOnline Network with CAPA</title>
<script>
$script
+</head>
+ENDDOCUMENT
+ if ($allowed) {
+ $r->print(<<ENDNEWSCRIPT);
function makenewfolder(targetform,folderseq) {
var foldername=prompt('Name of New Folder','New Folder');
@@ -298,9 +302,11 @@
'";this.document.forms.'+form+'.submit();');
}
</script>
-</head>
-ENDDOCUMENT
-$r->print(&Apache::loncommon::bodytag('Course Documents','',$events));
+ENDNEWSCRIPT
+ }
+# -------------------------------------------------------------------- Body tag
+ $r->print(&Apache::loncommon::bodytag('Course Documents','',$events));
+ unless ($showdoc) {
# --------------------------------------------------------- Standard documents
if (($standard) && ($allowed) && (!$forcesupplement)) {
$r->print('<h2>Main Course Documents</h2>');
@@ -454,8 +460,13 @@
if ($allowed) {
$r->print('<form name="extimport"><input type="hidden" name="title"><input type="hidden" name="url"><input type="hidden" name="useform"></form>');
}
- $r->print('</body></html>');
- return OK;
+ } else {
+# -------------------------------------------------------- This is showdoc mode
+ $r->print("<h1>Uploaded Document</h1><p>It is recommended that you use an up-to-date virus scanner before handling this file.</p><p><table>".
+ &entryline(0,"Click to download or use your browser's Save Link function",$ENV{'form.showdoc'}).'</table></p>');
+ }
+ $r->print('</body></html>');
+ return OK;
}
1;