Annotation of loncom/publisher/lonpublisher.pm, revision 1.129
1.1 www 1: # The LearningOnline Network with CAPA
2: # Publication Handler
1.54 albertel 3: #
1.129 ! www 4: # $Id: lonpublisher.pm,v 1.128 2003/08/13 18:41:59 www Exp $
1.54 albertel 5: #
6: # Copyright Michigan State University Board of Trustees
7: #
8: # This file is part of the LearningOnline Network with CAPA (LON-CAPA).
9: #
10: # LON-CAPA is free software; you can redistribute it and/or modify
11: # it under the terms of the GNU General Public License as published by
12: # the Free Software Foundation; either version 2 of the License, or
13: # (at your option) any later version.
14: #
15: # LON-CAPA is distributed in the hope that it will be useful,
16: # but WITHOUT ANY WARRANTY; without even the implied warranty of
17: # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18: # GNU General Public License for more details.
19: #
20: # You should have received a copy of the GNU General Public License
21: # along with LON-CAPA; if not, write to the Free Software
22: # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
23: #
24: # /home/httpd/html/adm/gpl.txt
25: #
26: # http://www.lon-capa.org/
27: #
1.1 www 28: #
29: # (TeX Content Handler
30: #
31: # 05/29/00,05/30,10/11 Gerd Kortemeyer)
32: #
1.15 www 33: # 11/28,11/29,11/30,12/01,12/02,12/04,12/23 Gerd Kortemeyer
1.20 www 34: # 03/23 Guy Albertelli
1.23 www 35: # 03/24,03/29,04/03 Gerd Kortemeyer
1.27 www 36: # 05/03,05/05,05/07 Gerd Kortemeyer
1.51 www 37: # 06/23,08/07,08/11,8/13,8/17,8/18,8/24,9/26,10/16 Gerd Kortemeyer
1.58 www 38: # 12/04,12/05 Guy Albertelli
39: # 12/05 Gerd Kortemeyer
1.62 www 40: # 12/05 Guy Albertelli
1.64 www 41: # 12/06,12/07 Gerd Kortemeyer
1.67 www 42: # 12/25 Gerd Kortemeyer
1.71 www 43: # YEAR=2002
44: # 1/17 Gerd Kortemeyer
1.65 harris41 45: #
46: ###
47:
48: ###############################################################################
49: ## ##
50: ## ORGANIZATION OF THIS PERL MODULE ##
51: ## ##
52: ## 1. Modules used by this module ##
53: ## 2. Various subroutines ##
54: ## 3. Publication Step One ##
55: ## 4. Phase Two ##
56: ## 5. Main Handler ##
57: ## ##
58: ###############################################################################
1.1 www 59:
1.90 matthew 60:
61: ######################################################################
62: ######################################################################
63:
64: =pod
65:
1.94 harris41 66: =head1 NAME
1.90 matthew 67:
68: lonpublisher - LON-CAPA publishing handler
69:
1.94 harris41 70: =head1 SYNOPSIS
1.90 matthew 71:
1.94 harris41 72: B<lonpublisher> is used by B<mod_perl> inside B<Apache>. This is the
73: invocation by F<loncapa_apache.conf>:
74:
75: <Location /adm/publish>
76: PerlAccessHandler Apache::lonacc
77: SetHandler perl-script
78: PerlHandler Apache::lonpublisher
79: ErrorDocument 403 /adm/login
80: ErrorDocument 404 /adm/notfound.html
81: ErrorDocument 406 /adm/unauthorized.html
82: ErrorDocument 500 /adm/errorhandler
83: </Location>
1.127 bowersj2 84:
85: =head1 OVERVIEW
86:
87: Authors can only write-access the C</~authorname/> space. They can
88: copy resources into the resource area through the publication step,
89: and move them back through a recover step. Authors do not have direct
90: write-access to their resource space.
91:
92: During the publication step, several events will be
93: triggered. Metadata is gathered, where a wizard manages default
94: entries on a hierarchical per-directory base: The wizard imports the
95: metadata (including access privileges and royalty information) from
96: the most recent published resource in the current directory, and if
97: that is not available, from the next directory above, etc. The Network
98: keeps all previous versions of a resource and makes them available by
99: an explicit version number, which is inserted between the file name
100: and extension, for example C<foo.2.html>, while the most recent
101: version does not carry a version number (C<foo.html>). Servers
102: subscribing to a changed resource are notified that a new version is
103: available.
1.94 harris41 104:
105: =head1 DESCRIPTION
106:
107: B<lonpublisher> takes the proper steps to add resources to the LON-CAPA
1.90 matthew 108: digital library. This includes updating the metadata table in the
109: LON-CAPA database.
110:
1.94 harris41 111: B<lonpublisher> is many things to many people.
1.90 matthew 112:
113: This module publishes a file. This involves gathering metadata,
114: versioning the file, copying file from construction space to
115: publication space, and copying metadata from construction space
116: to publication space.
117:
1.94 harris41 118: =head2 SUBROUTINES
119:
120: Many of the undocumented subroutines implement various magical
121: parsing shortcuts.
1.90 matthew 122:
123: =over 4
124:
125: =cut
126:
127: ######################################################################
128: ######################################################################
129:
130:
1.1 www 131: package Apache::lonpublisher;
132:
1.65 harris41 133: # ------------------------------------------------- modules used by this module
1.1 www 134: use strict;
135: use Apache::File;
1.13 www 136: use File::Copy;
1.2 www 137: use Apache::Constants qw(:common :http :methods);
1.76 albertel 138: use HTML::LCParser;
1.4 www 139: use Apache::lonxml;
1.27 www 140: use Apache::loncacc;
1.24 harris41 141: use DBI;
1.65 harris41 142: use Apache::lonnet();
143: use Apache::loncommon();
1.89 matthew 144: use Apache::lonmysql;
1.105 www 145: use vars qw(%metadatafields %metadatakeys);
1.2 www 146:
1.3 www 147: my %addid;
1.5 www 148: my %nokey;
1.10 www 149:
1.12 www 150: my $docroot;
151:
1.27 www 152: my $cuname;
153: my $cudom;
154:
1.90 matthew 155: =pod
156:
1.94 harris41 157: =item B<metaeval>
158:
159: Evaluates a string that contains metadata. This subroutine
160: stores values inside I<%metadatafields> and I<%metadatakeys>.
161: The hash key is a I<$unikey> corresponding to a unique id
162: that is descriptive of the parser location inside the XML tree.
163:
164: Parameters:
165:
166: =over 4
1.90 matthew 167:
1.94 harris41 168: =item I<$metastring>
169:
170: A string that contains metadata.
171:
172: =back
173:
174: Returns:
175:
176: nothing
1.90 matthew 177:
178: =cut
179:
180: #########################################
181: #########################################
1.7 www 182: sub metaeval {
183: my $metastring=shift;
184:
1.76 albertel 185: my $parser=HTML::LCParser->new(\$metastring);
1.7 www 186: my $token;
187: while ($token=$parser->get_token) {
188: if ($token->[0] eq 'S') {
189: my $entry=$token->[1];
190: my $unikey=$entry;
1.32 www 191: if (defined($token->[2]->{'package'})) {
192: $unikey.='_package_'.$token->[2]->{'package'};
193: }
1.7 www 194: if (defined($token->[2]->{'part'})) {
195: $unikey.='_'.$token->[2]->{'part'};
196: }
1.32 www 197: if (defined($token->[2]->{'id'})) {
1.49 www 198: $unikey.='_'.$token->[2]->{'id'};
1.32 www 199: }
1.7 www 200: if (defined($token->[2]->{'name'})) {
201: $unikey.='_'.$token->[2]->{'name'};
202: }
1.65 harris41 203: foreach (@{$token->[3]}) {
1.7 www 204: $metadatafields{$unikey.'.'.$_}=$token->[2]->{$_};
205: if ($metadatakeys{$unikey}) {
206: $metadatakeys{$unikey}.=','.$_;
207: } else {
208: $metadatakeys{$unikey}=$_;
209: }
1.65 harris41 210: }
1.7 www 211: if ($metadatafields{$unikey}) {
1.8 www 212: my $newentry=$parser->get_text('/'.$entry);
1.122 albertel 213: unless (($metadatafields{$unikey}=~/\Q$newentry\E/) ||
1.41 www 214: ($newentry eq '')) {
1.8 www 215: $metadatafields{$unikey}.=', '.$newentry;
216: }
1.7 www 217: } else {
218: $metadatafields{$unikey}=$parser->get_text('/'.$entry);
219: }
220: }
221: }
222: }
223:
1.90 matthew 224: #########################################
225: #########################################
226:
227: =pod
228:
1.94 harris41 229: =item B<metaread>
1.90 matthew 230:
231: Read a metadata file
232:
1.94 harris41 233: Parameters:
234:
235: =over
236:
237: =item I<$logfile>
238:
239: File output stream to output errors and warnings to.
240:
241: =item I<$fn>
242:
243: File name (including path).
244:
245: =back
246:
247: Returns:
248:
249: =over 4
250:
251: =item Scalar string (if successful)
252:
253: XHTML text that indicates successful reading of the metadata.
254:
255: =back
256:
1.90 matthew 257: =cut
258:
259: #########################################
260: #########################################
1.7 www 261: sub metaread {
262: my ($logfile,$fn)=@_;
263: unless (-e $fn) {
1.94 harris41 264: print($logfile 'No file '.$fn."\n");
1.120 albertel 265: return '<br /><b>No file:</b> <tt>'.$fn.'</tt>';
1.7 www 266: }
1.94 harris41 267: print($logfile 'Processing '.$fn."\n");
1.7 www 268: my $metastring;
269: {
270: my $metafh=Apache::File->new($fn);
271: $metastring=join('',<$metafh>);
272: }
273: &metaeval($metastring);
1.120 albertel 274: return '<br /><b>Processed file:</b> <tt>'.$fn.'</tt>';
1.7 www 275: }
1.12 www 276:
1.90 matthew 277: #########################################
278: #########################################
279:
1.101 www 280: sub coursedependencies {
281: my $url=&Apache::lonnet::declutter(shift);
282: $url=~s/\.meta$//;
283: my ($adomain,$aauthor)=($url=~/^(\w+)\/(\w+)\//);
284: my $regexp=$url;
285: $regexp=~s/(\W)/\\$1/g;
286: $regexp='___'.$regexp.'___course';
287: my %evaldata=&Apache::lonnet::dump('nohist_resevaldata',$adomain,
288: $aauthor,$regexp);
289: my %courses=();
290: foreach (keys %evaldata) {
291: if ($_=~/^([a-zA-Z0-9]+_[a-zA-Z0-9]+)___.+___course$/) {
292: $courses{$1}=1;
293: }
294: }
295: return %courses;
296: }
297: #########################################
298: #########################################
299:
300:
1.90 matthew 301: =pod
302:
1.94 harris41 303: =item Form-field-generating subroutines.
304:
305: For input parameters, these subroutines take in values
306: such as I<$name>, I<$value> and other form field metadata.
307: The output (scalar string that is returned) is an XHTML
308: string which presents the form field (foreseeably inside
309: <form></form> tags).
1.90 matthew 310:
311: =over 4
312:
1.94 harris41 313: =item B<textfield>
1.90 matthew 314:
1.94 harris41 315: =item B<hiddenfield>
1.90 matthew 316:
1.94 harris41 317: =item B<selectbox>
1.90 matthew 318:
319: =back
320:
321: =cut
322:
323: #########################################
324: #########################################
1.8 www 325: sub textfield {
1.10 www 326: my ($title,$name,$value)=@_;
1.123 albertel 327: my $uctitle=uc($title);
328: return "\n<p><font color=\"#800000\" face=\"helvetica\"><b>$uctitle:".
329: "</b></font></p><br />".
1.94 harris41 330: '<input type="text" name="'.$name.'" size=80 value="'.$value.'" />';
1.11 www 331: }
332:
333: sub hiddenfield {
334: my ($name,$value)=@_;
1.94 harris41 335: return "\n".'<input type="hidden" name="'.$name.'" value="'.$value.'" />';
1.8 www 336: }
337:
1.9 www 338: sub selectbox {
1.65 harris41 339: my ($title,$name,$value,$functionref,@idlist)=@_;
340: my $uctitle=uc($title);
1.123 albertel 341: $value=(split(/\s*,\s*/,$value))[-1];
1.65 harris41 342: my $selout="\n<p><font color=\"#800000\" face=\"helvetica\"><b>$uctitle:".
1.123 albertel 343: '</b></font></p><br /><select name="'.$name.'">';
1.65 harris41 344: foreach (@idlist) {
345: $selout.='<option value=\''.$_.'\'';
346: if ($_ eq $value) {
347: $selout.=' selected>'.&{$functionref}($_).'</option>';
348: }
349: else {$selout.='>'.&{$functionref}($_).'</option>';}
350: }
1.10 www 351: return $selout.'</select>';
1.9 www 352: }
353:
1.90 matthew 354: #########################################
355: #########################################
356:
357: =pod
358:
1.94 harris41 359: =item B<urlfixup>
1.90 matthew 360:
361: Fix up a url? First step of publication
1.12 www 362:
1.90 matthew 363: =cut
364:
365: #########################################
366: #########################################
1.34 www 367: sub urlfixup {
1.35 www 368: my ($url,$target)=@_;
1.39 www 369: unless ($url) { return ''; }
1.68 albertel 370: #javascript code needs no fixing
371: if ($url =~ /^javascript:/i) { return $url; }
1.69 albertel 372: if ($url =~ /^mailto:/i) { return $url; }
1.68 albertel 373: #internal document links need no fixing
374: if ($url =~ /^\#/) { return $url; }
1.35 www 375: my ($host)=($url=~/(?:http\:\/\/)*([^\/]+)/);
1.65 harris41 376: foreach (values %Apache::lonnet::hostname) {
1.35 www 377: if ($_ eq $host) {
378: $url=~s/^http\:\/\///;
379: $url=~s/^$host//;
380: }
1.65 harris41 381: }
1.40 www 382: if ($url=~/^http\:\/\//) { return $url; }
1.35 www 383: $url=~s/\~$cuname/res\/$cudom\/$cuname/;
1.71 www 384: return $url;
385: }
386:
1.90 matthew 387: #########################################
388: #########################################
389:
390: =pod
391:
1.94 harris41 392: =item B<absoluteurl>
1.90 matthew 393:
1.94 harris41 394: Currently undocumented.
1.90 matthew 395:
396: =cut
1.71 www 397:
1.90 matthew 398: #########################################
399: #########################################
1.71 www 400: sub absoluteurl {
401: my ($url,$target)=@_;
402: unless ($url) { return ''; }
1.35 www 403: if ($target) {
404: $target=~s/\/[^\/]+$//;
405: $url=&Apache::lonnet::hreflocation($target,$url);
406: }
407: return $url;
1.34 www 408: }
409:
1.90 matthew 410: #########################################
411: #########################################
412:
413: =pod
414:
1.94 harris41 415: =item B<set_allow>
1.90 matthew 416:
417: Currently undocumented
418:
419: =cut
420:
421: #########################################
422: #########################################
1.81 albertel 423: sub set_allow {
424: my ($allow,$logfile,$target,$tag,$oldurl)=@_;
425: my $newurl=&urlfixup($oldurl,$target);
426: my $return_url=$oldurl;
427: print $logfile 'GUYURL: '.$tag.':'.$oldurl.' - '.$newurl."\n";
428: if ($newurl ne $oldurl) {
429: $return_url=$newurl;
430: print $logfile 'URL: '.$tag.':'.$oldurl.' - '.$newurl."\n";
431: }
432: if (($newurl !~ /^javascript:/i) &&
433: ($newurl !~ /^mailto:/i) &&
434: ($newurl !~ /^http:/i) &&
435: ($newurl !~ /^\#/)) {
436: $$allow{&absoluteurl($newurl,$target)}=1;
437: }
438: return $return_url
439: }
440:
1.90 matthew 441: #########################################
442: #########################################
443:
444: =pod
445:
1.94 harris41 446: =item B<get_subscribed_hosts>
1.90 matthew 447:
448: Currently undocumented
449:
450: =cut
451:
452: #########################################
453: #########################################
1.85 albertel 454: sub get_subscribed_hosts {
455: my ($target)=@_;
456: my @subscribed;
457: my $filename;
458: $target=~/(.*)\/([^\/]+)$/;
459: my $srcf=$2;
460: opendir(DIR,$1);
461: while ($filename=readdir(DIR)) {
1.118 albertel 462: if ($filename=~/\Q$srcf\E\.(\w+)$/) {
1.85 albertel 463: my $subhost=$1;
1.98 www 464: if (($subhost ne 'meta' && $subhost ne 'subscription') &&
465: ($subhost ne $Apache::lonnet::perlvar{'lonHostID'})) {
1.85 albertel 466: push(@subscribed,$subhost);
467: }
468: }
469: }
470: closedir(DIR);
471: my $sh;
472: if ( $sh=Apache::File->new("$target.subscription") ) {
473: &Apache::lonnet::logthis("opened $target.subscription");
474: while (my $subline=<$sh>) {
475: &Apache::lonnet::logthis("Trying $subline");
1.98 www 476: if ($subline =~ /(^\w+):/) {
477: if ($1 ne $Apache::lonnet::perlvar{'lonHostID'}) {
478: push(@subscribed,$1);
479: }
480: } else {
1.85 albertel 481: &Apache::lonnet::logthis("No Match for $subline");
482: }
483: }
484: } else {
1.94 harris41 485: &Apache::lonnet::logthis("Unable to open $target.subscription");
1.85 albertel 486: }
487: return @subscribed;
488: }
489:
1.86 albertel 490:
1.90 matthew 491: #########################################
492: #########################################
493:
494: =pod
495:
1.94 harris41 496: =item B<get_max_ids_indices>
1.90 matthew 497:
498: Currently undocumented
499:
500: =cut
501:
502: #########################################
503: #########################################
1.86 albertel 504: sub get_max_ids_indices {
505: my ($content)=@_;
506: my $maxindex=10;
507: my $maxid=10;
508: my $needsfixup=0;
1.106 albertel 509: my $duplicateids=0;
510:
511: my %allids;
512: my %duplicatedids;
1.86 albertel 513:
514: my $parser=HTML::LCParser->new($content);
515: my $token;
516: while ($token=$parser->get_token) {
517: if ($token->[0] eq 'S') {
518: my $counter;
519: if ($counter=$addid{$token->[1]}) {
520: if ($counter eq 'id') {
521: if (defined($token->[2]->{'id'})) {
522: $maxid=($token->[2]->{'id'}>$maxid)?$token->[2]->{'id'}:$maxid;
1.106 albertel 523: if (exists($allids{$token->[2]->{'id'}})) {
524: $duplicateids=1;
525: $duplicatedids{$token->[2]->{'id'}}=1;
526: } else {
527: $allids{$token->[2]->{'id'}}=1;
528: }
1.86 albertel 529: } else {
530: $needsfixup=1;
531: }
532: } else {
533: if (defined($token->[2]->{'index'})) {
534: $maxindex=($token->[2]->{'index'}>$maxindex)?$token->[2]->{'index'}:$maxindex;
535: } else {
536: $needsfixup=1;
537: }
538: }
539: }
540: }
541: }
1.106 albertel 542: return ($needsfixup,$maxid,$maxindex,$duplicateids,
543: (keys(%duplicatedids)));
1.86 albertel 544: }
545:
1.90 matthew 546: #########################################
547: #########################################
548:
549: =pod
550:
1.94 harris41 551: =item B<get_all_text_unbalanced>
1.90 matthew 552:
553: Currently undocumented
554:
555: =cut
556:
557: #########################################
558: #########################################
1.87 albertel 559: sub get_all_text_unbalanced {
560: #there is a copy of this in lonxml.pm
561: my($tag,$pars)= @_;
562: my $token;
563: my $result='';
564: $tag='<'.$tag.'>';
565: while ($token = $$pars[-1]->get_token) {
566: if (($token->[0] eq 'T')||($token->[0] eq 'C')||($token->[0] eq 'D')) {
567: $result.=$token->[1];
568: } elsif ($token->[0] eq 'PI') {
569: $result.=$token->[2];
570: } elsif ($token->[0] eq 'S') {
571: $result.=$token->[4];
572: } elsif ($token->[0] eq 'E') {
573: $result.=$token->[2];
574: }
1.107 albertel 575: if ($result =~ /(.*)\Q$tag\E(.*)/s) {
1.88 albertel 576: #&Apache::lonnet::logthis('Got a winner with leftovers ::'.$2);
577: #&Apache::lonnet::logthis('Result is :'.$1);
1.87 albertel 578: $result=$1;
579: my $redo=$tag.$2;
580: push (@$pars,HTML::LCParser->new(\$redo));
581: $$pars[-1]->xml_mode('1');
582: last;
583: }
584: }
585: return $result
586: }
587:
1.90 matthew 588: #########################################
589: #########################################
590:
591: =pod
592:
1.94 harris41 593: =item B<fix_ids_and_indices>
1.90 matthew 594:
595: Currently undocumented
596:
597: =cut
598:
599: #########################################
600: #########################################
1.87 albertel 601: #Arguably this should all be done as a lonnet::ssi instead
1.86 albertel 602: sub fix_ids_and_indices {
603: my ($logfile,$source,$target)=@_;
604:
605: my %allow;
606: my $content;
607: {
608: my $org=Apache::File->new($source);
609: $content=join('',<$org>);
610: }
611:
1.106 albertel 612: my ($needsfixup,$maxid,$maxindex,$duplicateids,@duplicatedids)=
613: &get_max_ids_indices(\$content);
1.86 albertel 614:
1.106 albertel 615: print $logfile ("Got $needsfixup,$maxid,$maxindex,$duplicateids--".
616: join(', ',@duplicatedids));
617: if ($duplicateids) {
618: print $logfile "Duplicate ID(s) exist, ".join(', ',@duplicatedids)."\n";
619: my $outstring='<font color="red">Unable to publish file, it contains duplicated ID(s), ID(s) need to be unique. The duplicated ID(s) are: '.join(', ',@duplicatedids).'</font>';
620: return ($outstring,1);
621: }
1.86 albertel 622: if ($needsfixup) {
623: print $logfile "Needs ID and/or index fixup\n".
624: "Max ID : $maxid (min 10)\n".
625: "Max Index: $maxindex (min 10)\n";
626: }
627: my $outstring='';
628: my @parser;
629: $parser[0]=HTML::LCParser->new(\$content);
630: $parser[-1]->xml_mode(1);
631: my $token;
632: while (@parser) {
633: while ($token=$parser[-1]->get_token) {
634: if ($token->[0] eq 'S') {
635: my $counter;
636: my $tag=$token->[1];
637: my $lctag=lc($tag);
638: if ($lctag eq 'allow') {
639: $allow{$token->[2]->{'src'}}=1;
640: next;
641: }
642: my %parms=%{$token->[2]};
643: $counter=$addid{$tag};
644: if (!$counter) { $counter=$addid{$lctag}; }
645: if ($counter) {
646: if ($counter eq 'id') {
647: unless (defined($parms{'id'})) {
648: $maxid++;
649: $parms{'id'}=$maxid;
650: print $logfile 'ID: '.$tag.':'.$maxid."\n";
651: }
652: } elsif ($counter eq 'index') {
653: unless (defined($parms{'index'})) {
654: $maxindex++;
655: $parms{'index'}=$maxindex;
656: print $logfile 'Index: '.$tag.':'.$maxindex."\n";
657: }
658: }
659: }
660: foreach my $type ('src','href','background','bgimg') {
661: foreach my $key (keys(%parms)) {
662: if ($key =~ /^$type$/i) {
663: $parms{$key}=&set_allow(\%allow,$logfile,
664: $target,$tag,
665: $parms{$key});
666: }
667: }
668: }
669: # probably a <randomlabel> image type <label>
670: if ($lctag eq 'label' && defined($parms{'description'})) {
671: my $next_token=$parser[-1]->get_token();
672: if ($next_token->[0] eq 'T') {
673: $next_token->[1]=&set_allow(\%allow,$logfile,
674: $target,$tag,
675: $next_token->[1]);
676: }
677: $parser[-1]->unget_token($next_token);
678: }
679: if ($lctag eq 'applet') {
680: my $codebase='';
681: if (defined($parms{'codebase'})) {
682: my $oldcodebase=$parms{'codebase'};
683: unless ($oldcodebase=~/\/$/) {
684: $oldcodebase.='/';
685: }
686: $codebase=&urlfixup($oldcodebase,$target);
687: $codebase=~s/\/$//;
688: if ($codebase ne $oldcodebase) {
689: $parms{'codebase'}=$codebase;
690: print $logfile 'URL codebase: '.$tag.':'.
691: $oldcodebase.' - '.
692: $codebase."\n";
693: }
694: $allow{&absoluteurl($codebase,$target).'/*'}=1;
695: } else {
696: foreach ('archive','code','object') {
697: if (defined($parms{$_})) {
698: my $oldurl=$parms{$_};
699: my $newurl=&urlfixup($oldurl,$target);
700: $newurl=~s/\/[^\/]+$/\/\*/;
701: print $logfile 'Allow: applet '.$_.':'.
702: $oldurl.' allows '.
703: $newurl."\n";
704: $allow{&absoluteurl($newurl,$target)}=1;
705: }
706: }
707: }
708: }
709: my $newparmstring='';
710: my $endtag='';
711: foreach (keys %parms) {
712: if ($_ eq '/') {
713: $endtag=' /';
714: } else {
715: my $quote=($parms{$_}=~/\"/?"'":'"');
716: $newparmstring.=' '.$_.'='.$quote.$parms{$_}.$quote;
717: }
718: }
719: if (!$endtag) { if ($token->[4]=~m:/>$:) { $endtag=' /'; }; }
720: $outstring.='<'.$tag.$newparmstring.$endtag.'>';
1.87 albertel 721: if ($lctag eq 'm') {
722: $outstring.=&get_all_text_unbalanced('/m',\@parser);
723: }
1.86 albertel 724: } elsif ($token->[0] eq 'E') {
725: if ($token->[2]) {
726: unless ($token->[1] eq 'allow') {
727: $outstring.='</'.$token->[1].'>';
728: }
729: }
730: } else {
731: $outstring.=$token->[1];
732: }
733: }
734: pop(@parser);
735: }
736:
737: if ($needsfixup) {
738: print $logfile "End of ID and/or index fixup\n".
739: "Max ID : $maxid (min 10)\n".
740: "Max Index: $maxindex (min 10)\n";
741: } else {
742: print $logfile "Does not need ID and/or index fixup\n";
743: }
744:
1.106 albertel 745: return ($outstring,0,%allow);
1.86 albertel 746: }
747:
1.89 matthew 748: #########################################
749: #########################################
750:
751: =pod
752:
1.94 harris41 753: =item B<store_metadata>
1.89 matthew 754:
755: Store the metadata in the metadata table in the loncapa database.
756: Uses lonmysql to access the database.
757:
758: Inputs: \%metadata
759:
760: Returns: (error,status). error is undef on success, status is undef on error.
761:
762: =cut
763:
764: #########################################
765: #########################################
766: sub store_metadata {
767: my %metadata = %{shift()};
768: my $error;
769: # Determine if the table exists
770: my $status = &Apache::lonmysql::check_table('metadata');
771: if (! defined($status)) {
772: $error='<font color="red">WARNING: Cannot connect to '.
773: 'database!</font>';
774: &Apache::lonnet::logthis($error);
775: return ($error,undef);
776: }
777: if ($status == 0) {
778: # It would be nice to actually create the table....
779: $error ='<font color="red">WARNING: The metadata table does not '.
780: 'exist in the LON-CAPA database.</font>';
781: &Apache::lonnet::logthis($error);
782: return ($error,undef);
783: }
784: # Remove old value from table
785: $status = &Apache::lonmysql::remove_from_table
786: ('metadata','url',$metadata{'url'});
787: if (! defined($status)) {
788: $error = '<font color="red">Error when removing old values from '.
789: 'metadata table in LON-CAPA database.</font>';
790: &Apache::lonnet::logthis($error);
791: return ($error,undef);
792: }
793: # Store data in table.
794: $status = &Apache::lonmysql::store_row('metadata',\%metadata);
795: if (! defined($status)) {
796: $error='<font color="red">Error occured storing new values in '.
797: 'metadata table in LON-CAPA database</font>';
798: &Apache::lonnet::logthis($error);
799: return ($error,undef);
800: }
801: return (undef,$status);
802: }
803:
1.90 matthew 804: #########################################
805: #########################################
806:
807: =pod
808:
1.94 harris41 809: =item B<publish>
810:
811: This is the workhorse function of this module. This subroutine generates
812: backup copies, performs any automatic processing (prior to publication,
813: especially for rat and ssi files),
1.90 matthew 814:
1.113 albertel 815: Returns a 2 element array, the first is the string to be shown to the
816: user, the second is an error code, either 1 (an error occured) or 0
817: (no error occurred)
818:
1.94 harris41 819: I<Additional documentation needed.>
1.90 matthew 820:
821: =cut
822:
823: #########################################
824: #########################################
1.2 www 825: sub publish {
1.50 www 826:
1.97 www 827: my ($source,$target,$style,$batch)=@_;
1.2 www 828: my $logfile;
1.4 www 829: my $scrout='';
1.23 www 830: my $allmeta='';
831: my $content='';
1.36 www 832: my %allow=();
1.4 www 833:
1.2 www 834: unless ($logfile=Apache::File->new('>>'.$source.'.log')) {
1.114 albertel 835: return ('<font color="red">No write permission to user directory, FAIL</font>',1);
1.2 www 836: }
837: print $logfile
1.125 www 838: "\n\n================= Publish ".localtime()." Phase One ================\n".$ENV{'user.name'}.'@'.$ENV{'user.domain'}."\n";
1.2 www 839:
1.119 www 840: if (($style eq 'ssi') || ($style eq 'rat') || ($style eq 'prv')) {
1.3 www 841: # ------------------------------------------------------- This needs processing
1.4 www 842:
843: # ----------------------------------------------------------------- Backup Copy
1.3 www 844: my $copyfile=$source.'.save';
1.13 www 845: if (copy($source,$copyfile)) {
1.3 www 846: print $logfile "Copied original file to ".$copyfile."\n";
847: } else {
1.13 www 848: print $logfile "Unable to write backup ".$copyfile.':'.$!."\n";
1.114 albertel 849: return ("<font color=\"red\">Failed to write backup copy, $!,FAIL</font>",1);
1.3 www 850: }
1.4 www 851: # ------------------------------------------------------------- IDs and indices
1.86 albertel 852:
1.106 albertel 853: my ($outstring,$error);
854: ($outstring,$error,%allow)=&fix_ids_and_indices($logfile,$source,
855: $target);
1.113 albertel 856: if ($error) { return ($outstring,$error); }
1.36 www 857: # ------------------------------------------------------------ Construct Allows
1.62 www 858:
1.44 www 859: $scrout.='<h3>Dependencies</h3>';
1.62 www 860: my $allowstr='';
1.73 albertel 861: foreach (sort(keys(%allow))) {
1.59 www 862: my $thisdep=$_;
1.73 albertel 863: if ($thisdep !~ /[^\s]/) { next; }
1.62 www 864: unless ($style eq 'rat') {
865: $allowstr.="\n".'<allow src="'.$thisdep.'" />';
866: }
1.120 albertel 867: $scrout.='<br />';
1.59 www 868: unless ($thisdep=~/\*/) {
869: $scrout.='<a href="'.$thisdep.'">';
1.44 www 870: }
1.59 www 871: $scrout.='<tt>'.$thisdep.'</tt>';
872: unless ($thisdep=~/\*/) {
1.44 www 873: $scrout.='</a>';
1.59 www 874: if (
875: &Apache::lonnet::getfile($Apache::lonnet::perlvar{'lonDocRoot'}.'/'.
876: $thisdep.'.meta') eq '-1') {
1.94 harris41 877: $scrout.= ' - <font color="red">Currently not available'.
878: '</font>';
1.59 www 879: } else {
880: my %temphash=(&Apache::lonnet::declutter($target).'___'.
881: &Apache::lonnet::declutter($thisdep).'___usage'
882: => time);
883: $thisdep=~/^\/res\/(\w+)\/(\w+)\//;
884: if ((defined($1)) && (defined($2))) {
1.92 albertel 885: &Apache::lonnet::put('nohist_resevaldata',\%temphash,
886: $1,$2);
1.59 www 887: }
888: }
1.44 www 889: }
1.65 harris41 890: }
1.83 www 891: $outstring=~s/\n*(\<\/[^\>]+\>)\s*$/$allowstr\n$1\n/s;
1.62 www 892:
1.76 albertel 893: #Encode any High ASCII characters
894: $outstring=&HTML::Entities::encode($outstring,"\200-\377");
1.94 harris41 895: # ------------------------------------------------------------- Write modified.
1.37 www 896:
1.4 www 897: {
898: my $org;
899: unless ($org=Apache::File->new('>'.$source)) {
900: print $logfile "No write permit to $source\n";
1.113 albertel 901: return ('<font color="red">No write permission to '.$source.
902: ', FAIL</font>',1);
1.4 www 903: }
1.94 harris41 904: print($org $outstring);
1.4 www 905: }
906: $content=$outstring;
1.34 www 907:
1.37 www 908: }
1.94 harris41 909: # -------------------------------------------- Initial step done, now metadata.
1.7 www 910:
1.94 harris41 911: # --------------------------------------- Storage for metadata keys and fields.
1.7 www 912:
1.8 www 913: %metadatafields=();
914: %metadatakeys=();
915:
916: my %oldparmstores=();
1.44 www 917:
1.97 www 918: unless ($batch) {
1.84 bowersj2 919: $scrout.='<h3>Metadata Information ' .
920: Apache::loncommon::help_open_topic("Metadata_Description")
921: . '</h3>';
1.97 www 922: }
1.7 www 923:
924: # ------------------------------------------------ First, check out environment
1.8 www 925: unless (-e $source.'.meta') {
1.7 www 926: $metadatafields{'author'}=$ENV{'environment.firstname'}.' '.
927: $ENV{'environment.middlename'}.' '.
928: $ENV{'environment.lastname'}.' '.
929: $ENV{'environment.generation'};
1.8 www 930: $metadatafields{'author'}=~s/\s+/ /g;
931: $metadatafields{'author'}=~s/\s+$//;
1.27 www 932: $metadatafields{'owner'}=$cuname.'@'.$cudom;
1.125 www 933: $metadatafields{'modifyinguser'}=$ENV{'user.name'}.'@'.
934: $ENV{'user.domain'};
935: $metadatafields{'authorspace'}=$cuname.'@'.$cudom;
1.7 www 936:
937: # ------------------------------------------------ Check out directory hierachy
938:
939: my $thisdisfn=$source;
1.122 albertel 940: $thisdisfn=~s/^\/home\/\Q$cuname\E\///;
1.7 www 941:
942: my @urlparts=split(/\//,$thisdisfn);
943: $#urlparts--;
944:
1.27 www 945: my $currentpath='/home/'.$cuname.'/';
1.7 www 946:
1.65 harris41 947: foreach (@urlparts) {
1.7 www 948: $currentpath.=$_.'/';
949: $scrout.=&metaread($logfile,$currentpath.'default.meta');
1.65 harris41 950: }
1.7 www 951:
952: # ------------------- Clear out parameters and stores (there should not be any)
953:
1.65 harris41 954: foreach (keys %metadatafields) {
1.7 www 955: if (($_=~/^parameter/) || ($_=~/^stores/)) {
956: delete $metadatafields{$_};
957: }
1.65 harris41 958: }
1.7 www 959:
1.8 www 960: } else {
1.7 www 961: # ---------------------- Read previous metafile, remember parameters and stores
962:
963: $scrout.=&metaread($logfile,$source.'.meta');
964:
1.65 harris41 965: foreach (keys %metadatafields) {
1.7 www 966: if (($_=~/^parameter/) || ($_=~/^stores/)) {
967: $oldparmstores{$_}=1;
968: delete $metadatafields{$_};
969: }
1.65 harris41 970: }
1.7 www 971:
1.8 www 972: }
1.7 www 973:
1.4 www 974: # -------------------------------------------------- Parse content for metadata
1.119 www 975: if (($style eq 'ssi') || ($style eq 'prv')) {
1.42 www 976: my $oldenv=$ENV{'request.uri'};
977:
978: $ENV{'request.uri'}=$target;
1.82 albertel 979: $allmeta=Apache::lonxml::xmlparse(undef,'meta',$content);
1.42 www 980: $ENV{'request.uri'}=$oldenv;
1.32 www 981:
1.19 albertel 982: &metaeval($allmeta);
1.37 www 983: }
1.7 www 984: # ---------------- Find and document discrepancies in the parameters and stores
985:
1.116 albertel 986: my $chparms='';
987: foreach (sort keys %metadatafields) {
988: if (($_=~/^parameter/) || ($_=~/^stores/)) {
989: unless ($_=~/\.\w+$/) {
990: unless ($oldparmstores{$_}) {
991: print $logfile 'New: '.$_."\n";
992: $chparms.=$_.' ';
993: }
994: }
995: }
996: }
997: if ($chparms) {
1.120 albertel 998: $scrout.='<p><b>New parameters or stored values:</b> '.$chparms.'</p>';
1.116 albertel 999: }
1.7 www 1000:
1.116 albertel 1001: $chparms='';
1002: foreach (sort keys %oldparmstores) {
1003: if (($_=~/^parameter/) || ($_=~/^stores/)) {
1004: unless (($metadatafields{$_.'.name'}) ||
1005: ($metadatafields{$_.'.package'}) || ($_=~/\.\w+$/)) {
1006: print $logfile 'Obsolete: '.$_."\n";
1007: $chparms.=$_.' ';
1008: }
1009: }
1010: }
1011: if ($chparms) {
1012: $scrout.='<p><b>Obsolete parameters or stored values:</b> '.
1.120 albertel 1013: $chparms.'</p>';
1.116 albertel 1014: }
1.37 www 1015:
1.8 www 1016: # ------------------------------------------------------- Now have all metadata
1.5 www 1017:
1.116 albertel 1018: my %keywords=();
1.97 www 1019:
1.116 albertel 1020: if (length($content)<500000) {
1021: my $textonly=$content;
1022: $textonly=~s/\<script[^\<]+\<\/script\>//g;
1023: $textonly=~s/\<m\>[^\<]+\<\/m\>//g;
1024: $textonly=~s/\<[^\>]*\>//g;
1025: $textonly=~tr/A-Z/a-z/;
1026: $textonly=~s/[\$\&][a-z]\w*//g;
1027: $textonly=~s/[^a-z\s]//g;
1028:
1029: foreach ($textonly=~m/(\w+)/g) {
1030: unless ($nokey{$_}) {
1031: $keywords{$_}=1;
1032: }
1033: }
1034: }
1.97 www 1035:
1036:
1.116 albertel 1037: foreach (split(/\W+/,$metadatafields{'keywords'})) {
1038: $keywords{$_}=1;
1039: }
1.97 www 1040: # --------------------------------------------------- Now we also have keywords
1041: # =============================================================================
1042: # INTERACTIVE MODE
1043: #
1.116 albertel 1044: unless ($batch) {
1.8 www 1045: $scrout.=
1.116 albertel 1046: '<form name="pubform" action="/adm/publish" method="post">'.
1047: '<p><input type="submit" value="Finalize Publication" /></p>'.
1048: &hiddenfield('phase','two').
1049: &hiddenfield('filename',$ENV{'form.filename'}).
1050: &hiddenfield('allmeta',&Apache::lonnet::escape($allmeta)).
1051: &hiddenfield('dependencies',join(',',keys %allow)).
1052: &textfield('Title','title',$metadatafields{'title'}).
1053: &textfield('Author(s)','author',$metadatafields{'author'}).
1054: &textfield('Subject','subject',$metadatafields{'subject'});
1.5 www 1055:
1056: # --------------------------------------------------- Scan content for keywords
1.7 www 1057:
1.84 bowersj2 1058: my $keywords_help = Apache::loncommon::help_open_topic("Publishing_Keywords");
1.77 matthew 1059: my $keywordout=<<"END";
1060: <script>
1.116 albertel 1061: function checkAll(field) {
1.77 matthew 1062: for (i = 0; i < field.length; i++)
1063: field[i].checked = true ;
1064: }
1065:
1.116 albertel 1066: function uncheckAll(field) {
1.77 matthew 1067: for (i = 0; i < field.length; i++)
1068: field[i].checked = false ;
1069: }
1070: </script>
1.123 albertel 1071: <p><font color="#800000" face="helvetica"><b>KEYWORDS:</b></font>
1072: $keywords_help</b>
1.120 albertel 1073: <input type="button" value="check all" onclick="javascript:checkAll(document.pubform.keywords)" />
1074: <input type="button" value="uncheck all" onclick="javascript:uncheckAll(document.pubform.keywords)" />
1075: </p>
1.77 matthew 1076: <br />
1.117 albertel 1077: END
1.120 albertel 1078: $keywordout.='<table border="2"><tr>';
1.116 albertel 1079: my $colcount=0;
1080:
1081: foreach (sort keys %keywords) {
1.120 albertel 1082: $keywordout.='<td><input type="checkbox" name="keywords" value="'.$_.'"';
1.116 albertel 1083: if ($metadatafields{'keywords'}) {
1.122 albertel 1084: if ($metadatafields{'keywords'}=~/\Q$_\E/) {
1.120 albertel 1085: $keywordout.=' checked="on"';
1.116 albertel 1086: }
1087: } elsif (&Apache::loncommon::keyword($_)) {
1.120 albertel 1088: $keywordout.=' checked="on"';
1.116 albertel 1089: }
1.120 albertel 1090: $keywordout.=' />'.$_.'</td>';
1.116 albertel 1091: if ($colcount>10) {
1092: $keywordout.="</tr><tr>\n";
1093: $colcount=0;
1094: }
1095: $colcount++;
1096: }
1097:
1.51 www 1098: $keywordout.='</tr></table>';
1099:
1.116 albertel 1100: $scrout.=$keywordout;
1.9 www 1101:
1.116 albertel 1102: $scrout.=&textfield('Additional Keywords','addkey','');
1.12 www 1103:
1.116 albertel 1104: $scrout.=&textfield('Notes','notes',$metadatafields{'notes'});
1.9 www 1105:
1.116 albertel 1106: $scrout.=
1.123 albertel 1107: "\n<p><font color=\"#800000\" face=\"helvetica\"><b>ABSTRACT:".
1108: "</b></font></p><br />".
1109: '<textarea cols="80" rows="5" name="abstract">'.
1.120 albertel 1110: $metadatafields{'abstract'}.'</textarea></p>';
1.9 www 1111:
1.11 www 1112: $source=~/\.(\w+)$/;
1113:
1114: $scrout.=&hiddenfield('mime',$1);
1115:
1.123 albertel 1116: my $defaultlanguage=$metadatafields{'language'};
1117: $defaultlanguage =~ s/\s*notset\s*//g;
1118: $defaultlanguage =~ s/^,\s*//g;
1119: $defaultlanguage =~ s/,\s*$//g;
1120:
1.116 albertel 1121: $scrout.=&selectbox('Language','language',
1.123 albertel 1122: $defaultlanguage,
1.70 harris41 1123: \&Apache::loncommon::languagedescription,
1.65 harris41 1124: (&Apache::loncommon::languageids),
1.116 albertel 1125: );
1.11 www 1126:
1.116 albertel 1127: unless ($metadatafields{'creationdate'}) {
1.11 www 1128: $metadatafields{'creationdate'}=time;
1.116 albertel 1129: }
1130: $scrout.=&hiddenfield('creationdate',
1131: &Apache::loncommon::unsqltime($metadatafields{'creationdate'}));
1132:
1133: $scrout.=&hiddenfield('lastrevisiondate',time);
1.11 www 1134:
1135:
1.10 www 1136: $scrout.=&textfield('Publisher/Owner','owner',
1.116 albertel 1137: $metadatafields{'owner'});
1.84 bowersj2 1138:
1.94 harris41 1139: # -------------------------------------------------- Correct copyright for rat.
1.121 www 1140: my $defaultoption=$metadatafields{'copyright'};
1141: unless ($defaultoption) { $defaultoption='default'; }
1.116 albertel 1142: unless ($style eq 'prv') {
1143: if ($style eq 'rat') {
1144: if ($metadatafields{'copyright'} eq 'public') {
1145: delete $metadatafields{'copyright'};
1.121 www 1146: $defaultoption='default';
1.116 albertel 1147: }
1148: $scrout.=&selectbox('Copyright/Distribution','copyright',
1.121 www 1149: $defaultoption,
1.116 albertel 1150: \&Apache::loncommon::copyrightdescription,
1151: (grep !/^public$/,(&Apache::loncommon::copyrightids)));
1152: } else {
1153: $scrout.=&selectbox('Copyright/Distribution','copyright',
1.121 www 1154: $defaultoption,
1.116 albertel 1155: \&Apache::loncommon::copyrightdescription,
1156: (&Apache::loncommon::copyrightids));
1157: }
1158:
1159: my $copyright_help =
1160: Apache::loncommon::help_open_topic('Publishing_Copyright');
1161: $scrout =~ s/DISTRIBUTION:/'DISTRIBUTION: ' . $copyright_help/ge;
1162: $scrout.=&textfield('Custom Distribution File','customdistributionfile',
1163: $metadatafields{'customdistributionfile'}).
1164: $copyright_help;
1165: } else {
1166: $scrout.=&hiddenfield('copyright','private');
1.65 harris41 1167: }
1.116 albertel 1168: return ($scrout.'<p><input type="submit" value="Finalize Publication" /></p></form>',0);
1.97 www 1169: # =============================================================================
1170: # BATCH MODE
1171: #
1.116 albertel 1172: } else {
1.97 www 1173: # Transfer metadata directly to environment for stage 2
1.116 albertel 1174: foreach (keys %metadatafields) {
1175: $ENV{'form.'.$_}=$metadatafields{$_};
1176: }
1177: $ENV{'form.addkey'}='';
1178: $ENV{'form.keywords'}='';
1179: foreach (keys %keywords) {
1180: if ($metadatafields{'keywords'}) {
1.122 albertel 1181: if ($metadatafields{'keywords'}=~/\Q$_\E/) {
1.116 albertel 1182: $ENV{'form.keywords'}.=$_.',';
1183: }
1184: } elsif (&Apache::loncommon::keyword($_)) {
1185: $ENV{'form.keywords'}.=$_.',';
1186: }
1187: }
1188: $ENV{'form.keywords'}=~s/\,$//;
1189: unless ($ENV{'form.creationdate'}) { $ENV{'form.creationdate'}=time; }
1190: $ENV{'form.lastrevisiondate'}=time;
1191: if ((($style eq 'rat') && ($ENV{'form.copyright'} eq 'public')) ||
1192: (!$ENV{'form.copyright'})) {
1193: $ENV{'form.copyright'}='default';
1194: }
1195: $ENV{'form.allmeta'}=&Apache::lonnet::escape($allmeta);
1196: return ($scrout,0);
1.97 www 1197: }
1.2 www 1198: }
1.1 www 1199:
1.90 matthew 1200: #########################################
1201: #########################################
1202:
1203: =pod
1204:
1.94 harris41 1205: =item B<phasetwo>
1.90 matthew 1206:
1207: Render second interface showing status of publication steps.
1208: This is publication step two.
1209:
1.94 harris41 1210: Parameters:
1211:
1212: =over 4
1213:
1214: =item I<$source>
1215:
1216: =item I<$target>
1217:
1218: =item I<$style>
1219:
1220: =item I<$distarget>
1221:
1222: =back
1223:
1224: Returns:
1225:
1226: =over 4
1227:
1228: =item Scalar string
1229:
1230: String contains status (errors and warnings) and information associated with
1.100 matthew 1231: the server's attempts at publication.
1.94 harris41 1232:
1.90 matthew 1233: =cut
1.12 www 1234:
1.100 matthew 1235: #'stupid emacs
1.90 matthew 1236: #########################################
1237: #########################################
1.11 www 1238: sub phasetwo {
1239:
1.100 matthew 1240: my ($r,$source,$target,$style,$distarget,$batch)=@_;
1.102 www 1241: $source=~s/\/+/\//g;
1242: $target=~s/\/+/\//g;
1.109 www 1243:
1244: if ($target=~/\_\_\_/) {
1.110 www 1245: $r->print(
1.114 albertel 1246: '<font color="red">Unsupported character combination "<tt>___</tt>" in filename, FAIL</font>');
1.110 www 1247: return 0;
1.109 www 1248: }
1.102 www 1249: $distarget=~s/\/+/\//g;
1.11 www 1250: my $logfile;
1251: unless ($logfile=Apache::File->new('>>'.$source.'.log')) {
1.110 www 1252: $r->print(
1.114 albertel 1253: '<font color="red">No write permission to user directory, FAIL</font>');
1.110 www 1254: return 0;
1.11 www 1255: }
1256: print $logfile
1.125 www 1257: "\n================= Publish ".localtime()." Phase Two ================\n".$ENV{'user.name'}.'@'.$ENV{'user.domain'}."\n";
1.100 matthew 1258:
1259: %metadatafields=();
1260: %metadatakeys=();
1261:
1262: &metaeval(&Apache::lonnet::unescape($ENV{'form.allmeta'}));
1263:
1264: $metadatafields{'title'}=$ENV{'form.title'};
1265: $metadatafields{'author'}=$ENV{'form.author'};
1266: $metadatafields{'subject'}=$ENV{'form.subject'};
1267: $metadatafields{'notes'}=$ENV{'form.notes'};
1268: $metadatafields{'abstract'}=$ENV{'form.abstract'};
1269: $metadatafields{'mime'}=$ENV{'form.mime'};
1270: $metadatafields{'language'}=$ENV{'form.language'};
1.103 www 1271: $metadatafields{'creationdate'}=$ENV{'form.creationdate'};
1272: $metadatafields{'lastrevisiondate'}=$ENV{'form.lastrevisiondate'};
1.100 matthew 1273: $metadatafields{'owner'}=$ENV{'form.owner'};
1274: $metadatafields{'copyright'}=$ENV{'form.copyright'};
1.115 www 1275: $metadatafields{'customdistributionfile'}=
1276: $ENV{'form.customdistributionfile'};
1.100 matthew 1277: $metadatafields{'dependencies'}=$ENV{'form.dependencies'};
1278:
1279: my $allkeywords=$ENV{'form.addkey'};
1280: if (exists($ENV{'form.keywords'})) {
1281: if (ref($ENV{'form.keywords'})) {
1282: $allkeywords .= ','.join(',',@{$ENV{'form.keywords'}});
1283: } else {
1284: $allkeywords .= ','.$ENV{'form.keywords'};
1285: }
1286: }
1287: $allkeywords=~s/\W+/\,/;
1288: $allkeywords=~s/^\,//;
1289: $metadatafields{'keywords'}=$allkeywords;
1290:
1291: {
1292: print $logfile "\nWrite metadata file for ".$source;
1293: my $mfh;
1294: unless ($mfh=Apache::File->new('>'.$source.'.meta')) {
1295: return
1.114 albertel 1296: '<font color="red">Could not write metadata, FAIL</font>';
1.100 matthew 1297: }
1298: foreach (sort keys %metadatafields) {
1299: unless ($_=~/\./) {
1300: my $unikey=$_;
1301: $unikey=~/^([A-Za-z]+)/;
1302: my $tag=$1;
1303: $tag=~tr/A-Z/a-z/;
1304: print $mfh "\n\<$tag";
1305: foreach (split(/\,/,$metadatakeys{$unikey})) {
1306: my $value=$metadatafields{$unikey.'.'.$_};
1307: $value=~s/\"/\'\'/g;
1308: print $mfh ' '.$_.'="'.$value.'"';
1309: }
1310: print $mfh '>'.
1311: &HTML::Entities::encode($metadatafields{$unikey})
1312: .'</'.$tag.'>';
1313: }
1314: }
1.120 albertel 1315: $r->print('<p>Wrote Metadata</p>');
1.100 matthew 1316: print $logfile "\nWrote metadata";
1317: }
1318:
1319: # -------------------------------- Synchronize entry with SQL metadata database
1.12 www 1320:
1.89 matthew 1321: $metadatafields{'url'} = $distarget;
1322: $metadatafields{'version'} = 'current';
1323: unless ($metadatafields{'copyright'} eq 'priv') {
1324: my ($error,$success) = &store_metadata(\%metadatafields);
1.91 matthew 1325: if ($success) {
1.120 albertel 1326: $r->print('<p>Synchronized SQL metadata database</p>');
1.89 matthew 1327: print $logfile "\nSynchronized SQL metadata database";
1328: } else {
1.100 matthew 1329: $r->print($error);
1.89 matthew 1330: print $logfile "\n".$error;
1331: }
1332: } else {
1.120 albertel 1333: $r->print('<p>Private Publication - did not synchronize database</p>');
1.89 matthew 1334: print $logfile "\nPrivate: Did not synchronize data into ".
1335: "SQL metadata database";
1.24 harris41 1336: }
1.12 www 1337: # ----------------------------------------------------------- Copy old versions
1338:
1.100 matthew 1339: if (-e $target) {
1340: my $filename;
1341: my $maxversion=0;
1342: $target=~/(.*)\/([^\/]+)\.(\w+)$/;
1343: my $srcf=$2;
1344: my $srct=$3;
1345: my $srcd=$1;
1346: unless ($srcd=~/^\/home\/httpd\/html\/res/) {
1347: print $logfile "\nPANIC: Target dir is ".$srcd;
1.114 albertel 1348: return "<font color=\"red\">Invalid target directory, FAIL</font>";
1.100 matthew 1349: }
1350: opendir(DIR,$srcd);
1351: while ($filename=readdir(DIR)) {
1352: if (-l $srcd.'/'.$filename) {
1353: unlink($srcd.'/'.$filename);
1354: unlink($srcd.'/'.$filename.'.meta');
1355: } else {
1.118 albertel 1356: if ($filename=~/\Q$srcf\E\.(\d+)\.\Q$srct\E$/) {
1.100 matthew 1357: $maxversion=($1>$maxversion)?$1:$maxversion;
1358: }
1359: }
1360: }
1361: closedir(DIR);
1362: $maxversion++;
1.120 albertel 1363: $r->print('<p>Creating old version '.$maxversion.'</p>');
1.125 www 1364: print $logfile "\nCreating old version ".$maxversion."\n";
1.100 matthew 1365:
1366: my $copyfile=$srcd.'/'.$srcf.'.'.$maxversion.'.'.$srct;
1367:
1.13 www 1368: if (copy($target,$copyfile)) {
1.12 www 1369: print $logfile "Copied old target to ".$copyfile."\n";
1.120 albertel 1370: $r->print('<p>Copied old target file</p>');
1.12 www 1371: } else {
1.13 www 1372: print $logfile "Unable to write ".$copyfile.':'.$!."\n";
1.114 albertel 1373: return "<font color=\"red\">Failed to copy old target, $!, FAIL</font>";
1.12 www 1374: }
1.100 matthew 1375:
1.12 www 1376: # --------------------------------------------------------------- Copy Metadata
1377:
1378: $copyfile=$copyfile.'.meta';
1.100 matthew 1379:
1.13 www 1380: if (copy($target.'.meta',$copyfile)) {
1.14 www 1381: print $logfile "Copied old target metadata to ".$copyfile."\n";
1.120 albertel 1382: $r->print('<p>Copied old metadata</p>')
1.12 www 1383: } else {
1.13 www 1384: print $logfile "Unable to write metadata ".$copyfile.':'.$!."\n";
1.14 www 1385: if (-e $target.'.meta') {
1.100 matthew 1386: return
1.114 albertel 1387: "<font color=\"red\">Failed to write old metadata copy, $!, FAIL</font>";
1.14 www 1388: }
1.12 www 1389: }
1.100 matthew 1390:
1391:
1392: } else {
1.120 albertel 1393: $r->print('<p>Initial version</p>');
1.100 matthew 1394: print $logfile "\nInitial version";
1395: }
1.12 www 1396:
1397: # ---------------------------------------------------------------- Write Source
1.100 matthew 1398: my $copyfile=$target;
1399:
1400: my @parts=split(/\//,$copyfile);
1401: my $path="/$parts[1]/$parts[2]/$parts[3]/$parts[4]";
1402:
1403: my $count;
1404: for ($count=5;$count<$#parts;$count++) {
1405: $path.="/$parts[$count]";
1406: if ((-e $path)!=1) {
1407: print $logfile "\nCreating directory ".$path;
1.120 albertel 1408: $r->print('<p>Created directory '.$parts[$count].'</p>');
1.100 matthew 1409: mkdir($path,0777);
1.12 www 1410: }
1.100 matthew 1411: }
1412:
1413: if (copy($source,$copyfile)) {
1414: print $logfile "\nCopied original source to ".$copyfile."\n";
1.120 albertel 1415: $r->print('<p>Copied source file</p>');
1.100 matthew 1416: } else {
1417: print $logfile "\nUnable to write ".$copyfile.':'.$!."\n";
1.114 albertel 1418: return "<font color=\"red\">Failed to copy source, $!, FAIL</font>";
1.100 matthew 1419: }
1420:
1.12 www 1421: # --------------------------------------------------------------- Copy Metadata
1422:
1.100 matthew 1423: $copyfile=$copyfile.'.meta';
1424:
1425: if (copy($source.'.meta',$copyfile)) {
1426: print $logfile "\nCopied original metadata to ".$copyfile."\n";
1.120 albertel 1427: $r->print('<p>Copied metadata</p>');
1.100 matthew 1428: } else {
1429: print $logfile "\nUnable to write metadata ".$copyfile.':'.$!."\n";
1430: return
1.114 albertel 1431: "<font color=\"red\">Failed to write metadata copy, $!, FAIL</font>";
1.100 matthew 1432: }
1433: $r->rflush;
1.12 www 1434: # --------------------------------------------------- Send update notifications
1435:
1.85 albertel 1436: my @subscribed=&get_subscribed_hosts($target);
1437: foreach my $subhost (@subscribed) {
1.100 matthew 1438: $r->print('<p>Notifying host '.$subhost.':');$r->rflush;
1.85 albertel 1439: print $logfile "\nNotifying host ".$subhost.':';
1440: my $reply=&Apache::lonnet::critical('update:'.$target,$subhost);
1.120 albertel 1441: $r->print($reply.'</p><br />');$r->rflush;
1.85 albertel 1442: print $logfile $reply;
1.20 www 1443: }
1.100 matthew 1444:
1.20 www 1445: # ---------------------------------------- Send update notifications, meta only
1446:
1.85 albertel 1447: my @subscribedmeta=&get_subscribed_hosts("$target.meta");
1448: foreach my $subhost (@subscribedmeta) {
1.100 matthew 1449: $r->print('<p>Notifying host for metadata only '.$subhost.':');$r->rflush;
1.85 albertel 1450: print $logfile "\nNotifying host for metadata only ".$subhost.':';
1451: my $reply=&Apache::lonnet::critical('update:'.$target.'.meta',
1452: $subhost);
1.120 albertel 1453: $r->print($reply.'</p><br />');$r->rflush;
1.85 albertel 1454: print $logfile $reply;
1.12 www 1455: }
1.100 matthew 1456:
1.101 www 1457: # --------------------------------------------------- Notify subscribed courses
1458: my %courses=&coursedependencies($target);
1459: my $now=time;
1460: foreach (keys %courses) {
1461: $r->print('<p>Notifying course '.$_.':');$r->rflush;
1462: print $logfile "\nNotifying host ".$_.':';
1463: my ($cdom,$cname)=split(/\_/,$_);
1464: my $reply=&Apache::lonnet::cput
1465: ('versionupdate',{$target => $now},$cdom,$cname);
1.120 albertel 1466: $r->print($reply.'</p><br />');$r->rflush;
1.101 www 1467: print $logfile $reply;
1468: }
1.12 www 1469: # ------------------------------------------------ Provide link to new resource
1.100 matthew 1470: unless ($batch) {
1471: my $thisdistarget=$target;
1.122 albertel 1472: $thisdistarget=~s/^\Q$docroot\E//;
1.100 matthew 1473:
1474: my $thissrc=$source;
1475: $thissrc=~s/^\/home\/(\w+)\/public_html/\/priv\/$1/;
1476:
1477: my $thissrcdir=$thissrc;
1478: $thissrcdir=~s/\/[^\/]+$/\//;
1479:
1480:
1481: $r->print(
1.120 albertel 1482: '<hr /><a href="'.$thisdistarget.'"><font size="+2">'.
1.100 matthew 1483: 'View Published Version</font></a>'.
1.120 albertel 1484: '<p><a href="'.$thissrc.'"><font size=+2>Back to Source</font></a></p>'.
1.100 matthew 1485: '<p><a href="'.$thissrcdir.
1.120 albertel 1486: '"><font size="+2">Back to Source Directory</font></a></p>');
1.100 matthew 1487: }
1.11 www 1488: }
1489:
1.95 www 1490: #########################################
1491:
1492: sub batchpublish {
1.97 www 1493: my ($r,$srcfile,$targetfile)=@_;
1.102 www 1494: $srcfile=~s/\/+/\//g;
1495: $targetfile=~s/\/+/\//g;
1.95 www 1496: my $thisdisfn=$srcfile;
1497: $thisdisfn=~s/\/home\/korte\/public_html\///;
1498: $srcfile=~s/\/+/\//g;
1.96 www 1499:
1.97 www 1500: my $docroot=$r->dir_config('lonDocRoot');
1501: my $thisdistarget=$targetfile;
1.122 albertel 1502: $thisdistarget=~s/^\Q$docroot\E//;
1.97 www 1503:
1.96 www 1504:
1505: undef %metadatafields;
1506: undef %metadatakeys;
1507: %metadatafields=();
1508: %metadatakeys=();
1.97 www 1509: $srcfile=~/\.(\w+)$/;
1510: my $thistype=$1;
1511:
1512:
1513: my $thisembstyle=&Apache::loncommon::fileembstyle($thistype);
1.96 www 1514:
1.95 www 1515: $r->print('<h2>Publishing <tt>'.$thisdisfn.'</tt></h2>');
1.97 www 1516:
1517: # phase one takes
1518: # my ($source,$target,$style,$batch)=@_;
1.113 albertel 1519: my ($outstring,$error)=&publish($srcfile,$targetfile,$thisembstyle,1);
1520: $r->print('<p>'.$outstring.'</p>');
1.96 www 1521: # phase two takes
1522: # my ($source,$target,$style,$distarget,batch)=@_;
1.97 www 1523: # $ENV{'form.allmeta'},$ENV{'form.title'},$ENV{'form.author'},...
1.113 albertel 1524: if (!$error) {
1525: $r->print('<p>');
1526: &phasetwo($r,$srcfile,$targetfile,$thisembstyle,$thisdistarget,1);
1527: $r->print('</p>');
1528: }
1.97 www 1529: return '';
1.95 www 1530: }
1.1 www 1531:
1.90 matthew 1532: #########################################
1.95 www 1533:
1534: sub publishdirectory {
1535: my ($r,$fn,$thisdisfn)=@_;
1.102 www 1536: $fn=~s/\/+/\//g;
1537: $thisdisfn=~s/\/+/\//g;
1.96 www 1538: my $resdir=
1.100 matthew 1539: $Apache::lonnet::perlvar{'lonDocRoot'}.'/res/'.$cudom.'/'.$cuname.'/'.
1.96 www 1540: $thisdisfn;
1.100 matthew 1541: $r->print('<h1>Directory <tt>'.$thisdisfn.'</tt></h1>'.
1.96 www 1542: 'Target: <tt>'.$resdir.'</tt><br />');
1.95 www 1543:
1544: my $dirptr=16384; # Mask indicating a directory in stat.cmode.
1545:
1546: opendir(DIR,$fn);
1547: my @files=sort(readdir(DIR));
1548: foreach my $filename (@files) {
1549: my ($cdev,$cino,$cmode,$cnlink,
1550: $cuid,$cgid,$crdev,$csize,
1551: $catime,$cmtime,$cctime,
1552: $cblksize,$cblocks)=stat($fn.'/'.$filename);
1553:
1554: my $extension='';
1555: if ($filename=~/\.(\w+)$/) { $extension=$1; }
1556: if ($cmode&$dirptr) {
1557: if (($filename!~/^\./) && ($ENV{'form.pubrec'})) {
1558: &publishdirectory($r,$fn.'/'.$filename,$thisdisfn.'/'.$filename);
1559: }
1560: } elsif ((&Apache::loncommon::fileembstyle($extension) ne 'hdn') &&
1561: ($filename!~/^[\#\.]/) && ($filename!~/\~$/)) {
1.96 www 1562: # find out publication status and/or exiting metadata
1563: my $publishthis=0;
1564: if (-e $resdir.'/'.$filename) {
1565: my ($rdev,$rino,$rmode,$rnlink,
1566: $ruid,$rgid,$rrdev,$rsize,
1567: $ratime,$rmtime,$rctime,
1568: $rblksize,$rblocks)=stat($resdir.'/'.$filename);
1.124 www 1569: if (($rmtime<$cmtime) || ($ENV{'form.forcerepub'})) {
1.96 www 1570: # previously published, modified now
1571: $publishthis=1;
1572: }
1573: } else {
1574: # never published
1575: $publishthis=1;
1576: }
1577: if ($publishthis) {
1.97 www 1578: &batchpublish($r,$fn.'/'.$filename,$resdir.'/'.$filename);
1.96 www 1579: } else {
1580: $r->print('<br />Skipping '.$filename.'<br />');
1581: }
1.95 www 1582: $r->rflush();
1583: }
1584: }
1585: closedir(DIR);
1586: }
1.90 matthew 1587: #########################################
1588:
1589: =pod
1590:
1.94 harris41 1591: =item B<handler>
1.90 matthew 1592:
1593: A basic outline of the handler subroutine follows.
1594:
1595: =over 4
1596:
1.94 harris41 1597: =item *
1598:
1599: Get query string for limited number of parameters.
1600:
1601: =item *
1602:
1603: Check filename.
1604:
1605: =item *
1606:
1607: File is there and owned, init lookup tables.
1608:
1609: =item *
1.90 matthew 1610:
1.94 harris41 1611: Start page output.
1.90 matthew 1612:
1.94 harris41 1613: =item *
1.90 matthew 1614:
1.94 harris41 1615: Evaluate individual file, and then output information.
1.90 matthew 1616:
1.94 harris41 1617: =item *
1.90 matthew 1618:
1.94 harris41 1619: Publishing from $thisfn to $thistarget with $thisembstyle.
1.90 matthew 1620:
1621: =back
1622:
1623: =cut
1624:
1625: #########################################
1626: #########################################
1.1 www 1627: sub handler {
1628: my $r=shift;
1.2 www 1629:
1630: if ($r->header_only) {
1631: $r->content_type('text/html');
1632: $r->send_http_header;
1633: return OK;
1634: }
1635:
1.43 www 1636: # Get query string for limited number of parameters
1637:
1.80 matthew 1638: &Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},
1639: ['filename']);
1.43 www 1640:
1.2 www 1641: # -------------------------------------------------------------- Check filename
1642:
1.113 albertel 1643: my $fn=&Apache::lonnet::unescape($ENV{'form.filename'});
1.2 www 1644:
1.27 www 1645:
1.2 www 1646: unless ($fn) {
1.27 www 1647: $r->log_reason($cuname.' at '.$cudom.
1.2 www 1648: ' trying to publish empty filename', $r->filename);
1649: return HTTP_NOT_FOUND;
1650: }
1.4 www 1651:
1.31 www 1652: ($cuname,$cudom)=
1653: &Apache::loncacc::constructaccess($fn,$r->dir_config('lonDefDomain'));
1654: unless (($cuname) && ($cudom)) {
1.27 www 1655: $r->log_reason($cuname.' at '.$cudom.
1.4 www 1656: ' trying to publish file '.$ENV{'form.filename'}.
1.27 www 1657: ' ('.$fn.') - not authorized',
1658: $r->filename);
1659: return HTTP_NOT_ACCEPTABLE;
1660: }
1661:
1662: unless (&Apache::lonnet::homeserver($cuname,$cudom)
1663: eq $r->dir_config('lonHostID')) {
1664: $r->log_reason($cuname.' at '.$cudom.
1665: ' trying to publish file '.$ENV{'form.filename'}.
1666: ' ('.$fn.') - not homeserver ('.
1667: &Apache::lonnet::homeserver($cuname,$cudom).')',
1.4 www 1668: $r->filename);
1669: return HTTP_NOT_ACCEPTABLE;
1670: }
1.2 www 1671:
1.43 www 1672: $fn=~s/^http\:\/\/[^\/]+//;
1673: $fn=~s/^\/\~(\w+)/\/home\/$1\/public_html/;
1.2 www 1674:
1675: my $targetdir='';
1.12 www 1676: $docroot=$r->dir_config('lonDocRoot');
1.27 www 1677: if ($1 ne $cuname) {
1678: $r->log_reason($cuname.' at '.$cudom.
1.2 www 1679: ' trying to publish unowned file '.$ENV{'form.filename'}.
1680: ' ('.$fn.')',
1681: $r->filename);
1682: return HTTP_NOT_ACCEPTABLE;
1683: } else {
1.27 www 1684: $targetdir=$docroot.'/res/'.$cudom;
1.2 www 1685: }
1686:
1687:
1688: unless (-e $fn) {
1.27 www 1689: $r->log_reason($cuname.' at '.$cudom.
1.2 www 1690: ' trying to publish non-existing file '.$ENV{'form.filename'}.
1691: ' ('.$fn.')',
1692: $r->filename);
1693: return HTTP_NOT_FOUND;
1694: }
1695:
1.11 www 1696: unless ($ENV{'form.phase'} eq 'two') {
1697:
1.94 harris41 1698: # -------------------------------- File is there and owned, init lookup tables.
1.2 www 1699:
1.3 www 1700: %addid=();
1701:
1702: {
1703: my $fh=Apache::File->new($r->dir_config('lonTabDir').'/addid.tab');
1704: while (<$fh>=~/(\w+)\s+(\w+)/) {
1705: $addid{$1}=$2;
1706: }
1.5 www 1707: }
1708:
1709: %nokey=();
1710:
1711: {
1712: my $fh=Apache::File->new($r->dir_config('lonIncludes').'/un_keyword.tab');
1.65 harris41 1713: while (<$fh>) {
1.5 www 1714: my $word=$_;
1715: chomp($word);
1716: $nokey{$word}=1;
1.65 harris41 1717: }
1.3 www 1718: }
1.11 www 1719:
1720: }
1721:
1.94 harris41 1722: # ---------------------------------------------------------- Start page output.
1.2 www 1723:
1.1 www 1724: $r->content_type('text/html');
1725: $r->send_http_header;
1726:
1727: $r->print('<html><head><title>LON-CAPA Publishing</title></head>');
1.95 www 1728: $r->print(&Apache::loncommon::bodytag('Resource Publication'));
1.101 www 1729:
1730:
1.2 www 1731: my $thisfn=$fn;
1.95 www 1732:
1733: my $thistarget=$thisfn;
1734:
1735: $thistarget=~s/^\/home/$targetdir/;
1736: $thistarget=~s/\/public\_html//;
1737:
1738: my $thisdistarget=$thistarget;
1.122 albertel 1739: $thisdistarget=~s/^\Q$docroot\E//;
1.95 www 1740:
1741: my $thisdisfn=$thisfn;
1.122 albertel 1742: $thisdisfn=~s/^\/home\/\Q$cuname\E\/public_html\///;
1.95 www 1743:
1744: if ($fn=~/\/$/) {
1745: # -------------------------------------------------------- This is a directory
1746: &publishdirectory($r,$fn,$thisdisfn);
1.128 www 1747: $r->print('<hr><font size="+2">Done</font><br><a href="/priv/'
1748: .$cuname.'/'.$thisdisfn
1749: .'">Return to Directory</a>');
1750:
1.95 www 1751:
1752: } else {
1.94 harris41 1753: # ---------------------- Evaluate individual file, and then output information.
1.2 www 1754: $thisfn=~/\.(\w+)$/;
1755: my $thistype=$1;
1.65 harris41 1756: my $thisembstyle=&Apache::loncommon::fileembstyle($thistype);
1.129 ! www 1757: $r->print('<h2>Publishing '.
! 1758: &Apache::loncommon::filedescription($thistype).' <tt>');
1.2 www 1759:
1.129 ! www 1760: $r->print(<<ENDCAPTION);
! 1761: <a href='javascript:void(window.open("/~$cuname/$thisdisfn","cat","height=300,width=500,scrollbars=1,resizable=1,menubar=0,location=1"))'>
! 1762: $thisdisfn</a>
! 1763: ENDCAPTION
! 1764: $r->print(
! 1765: '</tt></h2><b>Target:</b> <tt>'.$thisdistarget.'</tt><br />');
1.27 www 1766:
1.94 harris41 1767: if (($cuname ne $ENV{'user.name'}) || ($cudom ne $ENV{'user.domain'})) {
1768: $r->print('<h3><font color="red">Co-Author: '.$cuname.' at '.$cudom.
1769: '</font></h3>');
1.27 www 1770: }
1.26 www 1771:
1.65 harris41 1772: if (&Apache::loncommon::fileembstyle($thistype) eq 'ssi') {
1.129 ! www 1773: $r->print(<<ENDDIFF);
! 1774: <br />
! 1775: <a href='javascript:void(window.open("/adm/diff?filename=/~$cuname/$thisdisfn&versiontwo=priv","cat","height=300,width=500,scrollbars=1,resizable=1,menubar=0,location=1"))'>Diffs with Current Version</a><br />
! 1776: ENDDIFF
1.26 www 1777: }
1.11 www 1778:
1.94 harris41 1779: # ------------------ Publishing from $thisfn to $thistarget with $thisembstyle.
1.2 www 1780:
1.11 www 1781: unless ($ENV{'form.phase'} eq 'two') {
1.113 albertel 1782: my ($outstring,$error)=&publish($thisfn,$thistarget,$thisembstyle);
1783: $r->print('<hr />'.$outstring);
1.11 www 1784: } else {
1.100 matthew 1785: $r->print('<hr />');
1786: &phasetwo($r,$thisfn,$thistarget,$thisembstyle,$thisdistarget);
1.113 albertel 1787: }
1.11 www 1788: }
1.1 www 1789: $r->print('</body></html>');
1.15 www 1790:
1.1 www 1791: return OK;
1792: }
1793:
1794: 1;
1795: __END__
1796:
1.89 matthew 1797: =pod
1.126 bowersj2 1798:
1799: =back
1.66 harris41 1800:
1801: =back
1802:
1.89 matthew 1803: =cut
1.66 harris41 1804:
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>