Annotation of loncom/publisher/lonpubdir.pm, revision 1.160.2.5
1.1 www 1: # The LearningOnline Network with CAPA
1.145 raeburn 2: # Authoring Space Directory Lister
1.16 albertel 3: #
1.160.2.5! raeburn 4: # $Id: lonpubdir.pm,v 1.160.2.4 2019/08/13 17:01:24 raeburn Exp $
1.16 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/
1.1 www 27: #
1.17 harris41 28: ###
1.1 www 29:
30: package Apache::lonpubdir;
31:
32: use strict;
33: use Apache::File;
34: use File::Copy;
35: use Apache::Constants qw(:common :http :methods);
1.17 harris41 36: use Apache::loncommon();
1.48 www 37: use Apache::lonhtmlcommon();
1.91 www 38: use Apache::londiff();
1.39 www 39: use Apache::lonlocal;
1.50 www 40: use Apache::lonmsg;
1.64 raeburn 41: use Apache::lonmenu;
42: use Apache::lonnet;
1.154 raeburn 43: use LONCAPA qw(:DEFAULT :match);
1.1 www 44:
45: sub handler {
46:
1.152 musolffc 47: my $r=shift;
1.1 www 48:
1.152 musolffc 49: # Validate access to the construction space and get username:domain.
1.6 www 50:
1.153 raeburn 51: my ($uname,$udom)=&Apache::lonnet::constructaccess($r->uri);
1.152 musolffc 52: unless (($uname) && ($udom)) {
53: return HTTP_NOT_ACCEPTABLE;
54: }
1.23 foxr 55:
1.127 www 56: # ----------------------------------------------------------- Start page output
1.23 foxr 57:
1.152 musolffc 58: my $fn=$r->filename;
59: $fn=~s/\/$//;
60: my $thisdisfn=$fn;
1.1 www 61:
1.152 musolffc 62: my $docroot=$r->dir_config('lonDocRoot'); # Apache londocument root.
1.155 raeburn 63: if ($thisdisfn eq "$docroot/priv/$udom") {
64: if ((-d "/home/$uname/public_html/") && (!-e "$docroot/priv/$udom/$uname")) {
65: my ($version) = ($r->dir_config('lonVersion') =~ /^\'?(\d+\.\d+)\./);
66: &Apache::loncommon::content_type($r,'text/html');
67: $r->send_http_header;
68:
69: &Apache::lonhtmlcommon::clear_breadcrumbs();
70: $r->print(&Apache::loncommon::start_page('Authoring Space').
71: '<div class="LC_error">'.
72: '<br /><p>'.
73: &mt('Your Authoring Space is currently in the location used by LON-CAPA version 2.10 and older, but your domain is using a newer LON-CAPA version ([_1]).',$version).'</p>'.
74: '<p>'.
75: &mt('Please ask your Domain Coordinator to move your Authoring Space to the new location.').
76: '</p>'.
77: '</div>'.
78: &Apache::loncommon::end_page());
79: return OK;
80: }
81: }
1.152 musolffc 82: $thisdisfn=~s/^\Q$docroot\E\/priv//;
1.160.2.4 raeburn 83:
1.152 musolffc 84: my $resdir=$docroot.'/res'.$thisdisfn; # Resource directory
85: my $targetdir='/res'.$thisdisfn; # Publication target directory.
86: my $linkdir='/priv'.$thisdisfn; # Full URL name of constr space.
87:
88: my %bombs=&Apache::lonmsg::all_url_author_res_msg($uname,$udom);
89:
1.160.2.4 raeburn 90: my $londocroot = $Apache::lonnet::perlvar{'lonDocRoot'};
91: my $current_disk_usage = &Apache::lonnet::diskusage($udom,$uname,
92: "$londocroot/priv/$udom/$uname"); # expressed in kB
93: my $disk_quota = &Apache::loncommon::get_user_quota($uname,$udom,
1.160.2.5! raeburn 94: 'author'); # expressed in MB
1.160.2.4 raeburn 95:
96: # Put out the start of page.
1.160.2.5! raeburn 97: &startpage($r, $uname, $udom, $thisdisfn, $current_disk_usage, $disk_quota);
1.157 raeburn 98:
99: if (!-d $fn) {
100: if (-e $fn) {
101: $r->print('<p class="LC_info">'.&mt('Requested item is a file not a directory.').'</p>');
102: } else {
103: $r->print('<p class="LC_info">'.&mt('The requested subdirectory does not exist.').'</p>');
104: }
105: $r->print(&Apache::loncommon::end_page());
106: return OK;
107: }
108: my @files;
109: if (opendir(DIR,$fn)) {
1.158 raeburn 110: @files = grep(!/^\.+$/,readdir(DIR));
1.157 raeburn 111: closedir(DIR);
112: } else {
113: $r->print('<p class="LC_error">'.&mt('Could not open directory.').'</p>');
114: $r->print(&Apache::loncommon::end_page());
115: return OK;
116: }
117:
1.160.2.4 raeburn 118: # Put out actions for directory, browse/upload + new file page.
119: &dircontrols($r,$uname,$udom,$thisdisfn, $current_disk_usage, $disk_quota);
1.152 musolffc 120: &resourceactions($r,$uname,$udom,$thisdisfn); # Put out form used for printing/deletion etc.
1.64 raeburn 121:
1.152 musolffc 122: my $numdir = 0;
123: my $numres = 0;
1.6 www 124:
1.160 musolffc 125: if ((@files == 0) && ($thisdisfn =~ m{^/$match_domain/$match_username})) {
126: if ($thisdisfn =~ m{^/$match_domain/$match_username$}) {
127: $r->print('<p class="LC_info">'.&mt('This Authoring Space is currently empty.').'</p>');
128: } else {
129: $r->print('<p class="LC_info">'.&mt('This subdirectory is currently empty.').'</p>');
130: }
131: $r->print(&Apache::loncommon::end_page());
132: return OK;
133: }
134:
1.152 musolffc 135: # Retrieving value for "sortby" and "sortorder" from QUERY_STRING
136: &Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},
137: ['sortby','sortorder']);
138:
139: # Sort by name as default, not reversed
140: if (! exists($env{'form.sortby'})) { $env{'form.sortby'} = 'filename' }
141: if (! exists($env{'form.sortorder'})) { $env{'form.sortorder'} = '' }
142: my $sortby = $env{'form.sortby'};
143: my $sortorder = $env{'form.sortorder'};
144:
1.160 musolffc 145: # Order in which columns are displayed from left to right
146: my @order = ('filetype','actions','filename','title',
147: 'pubstatus','cmtime','size');
148:
149: # Up and down arrows to indicate sort order
150: my @arrows = (' ▲',' ▼','');
151:
152: # Default sort order and column title
153: my %columns = (
154: filetype => {
155: order => 'ascending',
156: text => &mt('Type'),
157: },
158: actions => {
159: # Not sortable
160: text => &mt('Actions'),
161: },
162: filename => {
163: order => 'ascending',
164: text => &mt('Name'),
165: },
166: title => {
167: order => 'ascending',
168: text => &mt('Title'),
169: },
170: pubstatus => {
171: order => 'ascending',
172: text => &mt('Status'),
173: colspan => '2',
174: },
175: cmtime => {
176: order => 'descending',
177: text => &mt('Last Modified'),
178: },
179: size => {
180: order => 'ascending',
181: text => &mt('Size').' (kB)',
182: },
183: );
184:
185: # Print column headers
186: my $output = '';
187: foreach my $key (@order) {
188: my $idx;
189: # Append an up or down arrow to sorted column
190: if ($sortby eq $key) {
191: $idx = ($columns{$key}{order} eq 'ascending') ? 0:1;
192: if ($sortorder eq 'rev') { $idx ++; }
193: $idx = $idx%2;
194: } else { $idx = 2; } # No arrow if column is not sorted
195: $output .= (($columns{$key}{order}) ?
196: '<th'.($columns{$key}{colspan} ? ' colspan="'.$columns{$key}{colspan}.'"' : '')
1.160.2.4 raeburn 197: .'><a href="'.$linkdir.'/?sortby='.$key.'&sortorder='
1.160 musolffc 198: .((($sortby eq $key) && ($sortorder ne 'rev')) ? 'rev' : '').'">'
199: .$columns{$key}{text}.$arrows[$idx].'</a></th>' :
200: '<th>'.$columns{$key}{text}.'</th>');
1.154 raeburn 201: }
1.152 musolffc 202: $r->print(&Apache::loncommon::start_data_table()
1.160 musolffc 203: .&Apache::loncommon::start_data_table_header_row() . $output
1.152 musolffc 204: .&Apache::loncommon::end_data_table_header_row()
205: );
206:
207: my $dirptr=16384; # Mask indicating a directory in stat.cmode.
208: my $filehash = {};
209: foreach my $filename (@files) {
1.159 musolffc 210: # Skip .DS_Store, .DAV and hidden files
1.152 musolffc 211: my ($extension) = ($filename=~/\.(\w+)$/);
1.156 raeburn 212: next if (($filename eq '.DS_Store')
1.159 musolffc 213: || ($filename eq '.DAV')
1.156 raeburn 214: || (&Apache::loncommon::fileembstyle($extension) eq 'hdn')
215: || ($filename =~ /^\._/));
1.152 musolffc 216:
217: my ($cmode,$csize,$cmtime)=(stat($fn.'/'.$filename))[2,7,9];
218: my $linkfilename = &HTML::Entities::encode('/priv'.$thisdisfn.'/'.$filename,'<>&"');
219: # Identify type of file according to icon used
220: my ($filetype) = (&Apache::loncommon::icon($filename) =~ m{/(\w+).gif$});
221: my $cstr_dir = $r->dir_config('lonDocRoot').'/priv'.$thisdisfn;
222: my $meta_same = &isMetaSame($cstr_dir, $resdir, $filename);
223:
224: # Store size, title, and status for files but not directories
225: my $size = (!($cmode&$dirptr)) ? $csize/1024. : 0;
226: my ($status, $pubstatus, $title, $fulltitle);
227: if (!($cmode&$dirptr)) {
228: ($status, $pubstatus) = &getStatus($resdir, $targetdir, $cstr_dir,
229: $filename, $linkfilename, $cmtime, $meta_same);
230: ($fulltitle, $title) = &getTitle($resdir, $targetdir, $filename,
231: $linkfilename, $meta_same, \%bombs);
232: } else {
233: ($status, $pubstatus) = ('','');
234: ($fulltitle, $title) = ('','');
235: }
1.150 musolffc 236:
1.152 musolffc 237: # This hash will allow sorting
238: $filehash->{ $filename } = {
239: "cmtime" => $cmtime,
240: "size" => $size,
241: "cmode" => $cmode,
242: "filetype" => $filetype,
243: "title" => $title,
244: "fulltitle" => $fulltitle,
245: "status" => $status,
246: "pubstatus" => $pubstatus,
247: "linkfilename" => $linkfilename,
248: }
249: }
250:
251: my @sorted_files;
252: # Sorting by something other than "Name". Name is the secondary key.
253: if ($sortby =~ m{cmtime|size}) { # Numeric fields
254: # First check if order should be reversed
255: if ($sortorder eq "rev") {
256: @sorted_files = sort {
257: $filehash->{$a}->{$sortby} <=> $filehash->{$b}->{$sortby}
258: or
259: uc($a) cmp uc($b)
260: } (keys(%{$filehash}));
261: } else {
262: @sorted_files = sort {
263: $filehash->{$b}->{$sortby} <=> $filehash->{$a}->{$sortby}
264: or
265: uc($a) cmp uc($b)
266: } (keys(%{$filehash}));
267: }
268: } elsif ($sortby =~ m{filetype|title|status}) { # String fields
269: if ($sortorder eq "rev") {
270: @sorted_files = sort {
271: $filehash->{$b}->{$sortby} cmp $filehash->{$a}->{$sortby}
272: or
273: uc($a) cmp uc($b)
274: } (keys(%{$filehash}));
275: } else {
276: @sorted_files = sort {
277: $filehash->{$a}->{$sortby} cmp $filehash->{$b}->{$sortby}
278: or
279: uc($a) cmp uc($b)
280: } (keys(%{$filehash}));
281: }
282:
283: # Sort by "Name" is the default
284: } else {
285: if ($sortorder eq "rev") {
286: @sorted_files = sort {uc($b) cmp uc($a)} (keys(%{$filehash}));
287: } else {
288: @sorted_files = sort {uc($a) cmp uc($b)} (keys(%{$filehash}));
289: }
290: }
291:
292: # Print the sorted resources
293: foreach my $filename (@sorted_files) {
294: if ($filehash->{$filename}->{"cmode"}&$dirptr) { # Directories
295: &putdirectory($r, $thisdisfn, $linkdir, $filename,
296: $filehash->{$filename}->{"cmtime"},
297: $targetdir, \%bombs, \$numdir);
298: } else { # Files
299: &putresource($r, $udom, $uname, $filename, $thisdisfn, $resdir,
300: $targetdir, $linkdir, $filehash->{$filename}->{"cmtime"},
301: $filehash->{$filename}->{"size"}, \$numres,
302: $filehash->{$filename}->{"linkfilename"},
303: $filehash->{$filename}->{"fulltitle"},
304: $filehash->{$filename}->{"status"},
305: $filehash->{$filename}->{"pubstatus"});
306: }
307: }
308:
309: $r->print( &Apache::loncommon::end_data_table()
310: .&Apache::loncommon::end_page() );
1.2 www 311:
1.154 raeburn 312: return OK;
1.1 www 313: }
1.127 www 314:
1.152 musolffc 315:
316:
1.23 foxr 317: # Output the header of the page. This includes:
318: # - The HTML header
319: # - The H1/H3 stuff which includes the directory.
320: #
1.160.2.4 raeburn 321: # startpage($r, $uame, $udom, $thisdisfn, $current_disk_usage, $disk_quota);
1.23 foxr 322: # $r - The apache request object.
323: # $uname - User name.
324: # $udom - Domain name the user is logged in under.
325: # $thisdisfn - Displayable version of the filename.
1.160.2.4 raeburn 326: # $current_disk_usage - User's current disk usage (in kB).
327: # $disk_quota - Disk quota for user's authoring space (in MB).
328: # $crstype - Course type, if this is for "course author"
1.26 www 329:
1.23 foxr 330: sub startpage {
1.160.2.4 raeburn 331: my ($r, $uname, $udom, $thisdisfn, $current_disk_usage, $disk_quota) = @_;
1.39 www 332: &Apache::loncommon::content_type($r,'text/html');
1.23 foxr 333: $r->send_http_header;
1.64 raeburn 334:
1.132 www 335: my $formaction='/priv'.$thisdisfn.'/';
1.89 albertel 336: $formaction=~s|/+|/|g;
1.66 raeburn 337: &Apache::lonhtmlcommon::store_recent('construct',$formaction,$formaction);
1.121 bisitz 338:
1.125 droeschl 339: &Apache::lonhtmlcommon::clear_breadcrumbs();
340: &Apache::lonhtmlcommon::add_breadcrumb({
1.145 raeburn 341: 'text' => 'Authoring Space',
1.137 raeburn 342: 'href' => &Apache::loncommon::authorspace($formaction),
1.125 droeschl 343: });
344: # breadcrumbs (and tools) will be created
345: # in start_page->bodytag->innerregister
346:
1.132 www 347: $env{'request.noversionuri'}=$formaction;
1.153 raeburn 348: $r->print(&Apache::loncommon::start_page('Authoring Space'));
1.90 albertel 349:
1.147 raeburn 350: my $londocroot = $Apache::lonnet::perlvar{'lonDocRoot'};
351: my $current_disk_usage = &Apache::lonnet::diskusage($udom,$uname,"$londocroot/priv/$udom/$uname");
1.153 raeburn 352: my $disk_quota = &Apache::loncommon::get_user_quota($uname,$udom,'author'); #expressed in MB
1.160.2.4 raeburn 353: $disk_quota = 1024 * $disk_quota; # convert from MB to kB
1.147 raeburn 354:
1.121 bisitz 355: $r->print(&Apache::loncommon::head_subbox(
1.147 raeburn 356: '<div style="float:right;padding-top:0;margin-top;0">'
1.160.2.1 raeburn 357: .&Apache::lonhtmlcommon::display_usage($current_disk_usage,
358: $disk_quota,'authoring')
1.147 raeburn 359: .'</div>'
360: .&Apache::loncommon::CSTR_pageheader()));
1.121 bisitz 361:
1.101 albertel 362: my $esc_thisdisfn = &Apache::loncommon::escape_single($thisdisfn);
1.145 raeburn 363: my $doctitle = 'LON-CAPA '.&mt('Authoring Space');
1.109 bisitz 364: my $newname = &mt('New Name');
1.29 www 365: my $pubdirscript=(<<ENDPUBDIRSCRIPT);
1.77 albertel 366: <script type="text/javascript">
1.107 bisitz 367: top.document.title = '$esc_thisdisfn/ - $doctitle';
1.37 www 368: // Store directory location for menu bar to find
369:
1.132 www 370: parent.lastknownpriv='/priv$esc_thisdisfn/';
1.37 www 371:
372: // Confirmation dialogues
373:
1.64 raeburn 374: function currdiract(theform) {
375: if (theform.dirtask.options[theform.dirtask.selectedIndex].value == 'publish') {
1.79 www 376: document.publishdir.filename.value = theform.filename.value;
377: document.publishdir.submit();
1.64 raeburn 378: }
1.113 schafran 379: if (theform.dirtask.options[theform.dirtask.selectedIndex].value == 'editmeta') {
1.66 raeburn 380: top.location=theform.filename.value+'default.meta'
1.64 raeburn 381: }
382: if (theform.dirtask.options[theform.dirtask.selectedIndex].value == 'printdir' ) {
383: document.printdir.postdata.value=theform.filename.value
384: document.printdir.submit();
385: }
1.88 raeburn 386: if (theform.dirtask.options[theform.dirtask.selectedIndex].value == "delete") {
387: var delform = document.delresource
388: delform.filename.value = theform.filename.value
389: delform.submit()
390: }
1.64 raeburn 391: }
392:
393: function checkUpload(theform) {
394: if (theform.file == '') {
395: alert("Please use 'Browse..' to choose a file first, before uploading")
396: return
397: }
398: theform.submit()
399: }
400:
401: function SetPubDir(theform,printForm) {
402: if (theform.diraction.options[theform.diraction.selectedIndex].value == "open") {
1.75 albertel 403: top.location = theform.openname.value
1.64 raeburn 404: return
405: }
406: if (theform.diraction.options[theform.diraction.selectedIndex].value == "publish") {
1.79 www 407: theform.submit();
1.64 raeburn 408: }
1.113 schafran 409: if (theform.diraction.options[theform.diraction.selectedIndex].value == "editmeta") {
1.66 raeburn 410: top.location=theform.filename.value+'default.meta'
1.64 raeburn 411: }
1.68 raeburn 412: if (theform.diraction.options[theform.diraction.selectedIndex].value == "printdir") {
1.64 raeburn 413: theform.action = '/adm/printout'
414: theform.postdata.value = theform.filename.value
415: theform.submit()
416: }
1.88 raeburn 417: if (theform.diraction.options[theform.diraction.selectedIndex].value == "delete") {
418: var delform = document.delresource
419: delform.filename.value = theform.filename.value
420: delform.submit()
421: }
1.64 raeburn 422: return
423: }
424: function SetResChoice(theform) {
425: var activity = theform.reschoice.options[theform.reschoice.selectedIndex].value
426: if ((activity == 'rename') || (activity == 'copy') || (activity == 'move')) {
427: changename(theform,activity)
428: }
429: if (activity == 'publish') {
430: var pubform = document.pubresource
431: pubform.filename.value = theform.filename.value
432: pubform.submit()
433: }
434: if (activity == 'delete') {
435: var delform = document.delresource
436: delform.filename.value = theform.filename.value
1.71 raeburn 437: delform.submit()
1.64 raeburn 438: }
439: if (activity == 'obsolete') {
1.68 raeburn 440: var pubform = document.pubresource
441: pubform.filename.value = theform.filename.value
1.80 www 442: pubform.makeobsolete.value=1;
1.68 raeburn 443: pubform.submit()
1.64 raeburn 444: }
445: if (activity == 'print') {
1.68 raeburn 446: document.printresource.postdata.value = theform.filename.value
1.64 raeburn 447: document.printresource.submit()
448: }
449: if (activity == 'retrieve') {
1.68 raeburn 450: document.retrieveres.filename.value = theform.filename.value
451: document.retrieveres.submit()
1.64 raeburn 452: }
1.82 www 453: if (activity == 'cleanup') {
454: document.cleanup.filename.value = theform.filename.value
455: document.cleanup.submit()
456: }
1.64 raeburn 457: return
458: }
459: function changename(theform,activity) {
1.96 banghart 460: var oldname=theform.dispfilename.value;
1.109 bisitz 461: var newname=prompt('$newname',oldname);
1.97 banghart 462: if (newname == "" || !newname || newname == oldname) {
1.64 raeburn 463: return
464: }
465: document.moveresource.newfilename.value = newname
466: document.moveresource.filename.value = theform.filename.value
467: document.moveresource.action.value = activity
468: document.moveresource.submit();
469: }
1.29 www 470: </script>
471: ENDPUBDIRSCRIPT
1.64 raeburn 472: $r->print($pubdirscript);
473: }
474:
475: sub dircontrols {
1.160.2.4 raeburn 476: my ($r,$uname,$udom,$thisdisfn, $current_disk_usage, $disk_quota) = @_;
1.84 www 477: my %lt=&Apache::lonlocal::texthash(
478: cnpd => 'Cannot publish directory',
479: cnrd => 'Cannot retrieve directory',
480: mcdi => 'Must create new subdirectory inside a directory',
481: pubr => 'Publish this Resource',
482: pubd => 'Publish this Directory',
1.88 raeburn 483: dedr => 'Delete Directory',
1.84 www 484: rtrv => 'Retrieve Old Version',
485: list => 'List Directory',
486: uplo => 'Upload file',
487: dele => 'Delete',
1.113 schafran 488: edit => 'Edit Metadata',
1.84 www 489: sela => 'Select Action',
490: nfil => 'New file',
491: nhtm => 'New HTML file',
492: nprb => 'New problem',
493: npag => 'New assembled page',
494: nseq => 'New assembled sequence',
495: ncrf => 'New custom rights file',
496: nsty => 'New style file',
497: nlib => 'New library file',
1.103 albertel 498: nbt => 'New bridgetask file',
1.84 www 499: nsub => 'New subdirectory',
500: renm => 'Rename current file to',
501: move => 'Move current file to',
502: copy => 'Copy current file to',
503: type => 'Type Name Here',
1.105 albertel 504: go => 'Go',
1.84 www 505: prnt => 'Print contents of directory',
506: crea => 'Create a new directory or LON-CAPA document',
507: acti => 'Actions for current directory',
1.105 albertel 508: updc => 'Upload a new document',
509: pick => 'Please select an action to perform using the new filename',
1.84 www 510: );
1.106 bisitz 511: my $mytype = $lt{'type'}; # avoid conflict with " and ' in javascript
1.160.2.4 raeburn 512: # Calculate free space in bytes.
513: # $disk_quota is in MB and $current_disk_usage is in kB
514: my $free_space = 1024 * ((1024 * $disk_quota) - $current_disk_usage);
1.64 raeburn 515: $r->print(<<END);
1.117 harmsja 516: <div class="LC_columnSection">
1.116 bisitz 517: <div>
518: <form name="curractions" method="post" action="">
519: <fieldset>
520: <legend>$lt{'acti'}</legend>
521: <select name="dirtask" onchange="currdiract(this.form)">
1.84 www 522: <option>$lt{'sela'}</option>
523: <option value="publish">$lt{'pubd'}</option>
1.113 schafran 524: <option value="editmeta">$lt{'edit'}</option>
1.84 www 525: <option value="printdir">$lt{'prnt'}</option>
1.88 raeburn 526: <option value="delete">$lt{'dedr'}</option>
1.116 bisitz 527: </select>
1.132 www 528: <input type="hidden" name="filename" value="/priv$thisdisfn/" />
1.116 bisitz 529: </fieldset>
530: </form>
531: <form name="publishdir" method="post" action="/adm/publish" target="_parent">
532: <input type="hidden" name="pubrec" value="" />
533: <input type="hidden" name="filename" value="" />
534: </form>
535: <form name="printdir" method="post" action="/adm/printout" target="_parent">
536: <input type="hidden" name="postdata" value="" />
537: </form>
538: </div>
539:
1.160.2.3 raeburn 540: <div style="padding-bottom: 2px">
1.116 bisitz 541: <form name="upublisher" enctype="multipart/form-data" method="post" action="/adm/upload" target="_parent">
542: <fieldset>
543: <legend>$lt{'updc'}</legend>
1.132 www 544: <input type="hidden" name="filename" value="/priv$thisdisfn/" />
1.160.2.4 raeburn 545: <input type="file" name="upfile" class="LC_flUpload" size="20" />
546: <input type="hidden" id="LC_free_space" value="$free_space" />
1.116 bisitz 547: <input type="button" value="$lt{'uplo'}" onclick="checkUpload(this.form)" />
548: </fieldset>
549: </form>
550: </div>
551:
552: <div>
553: <form name="fileaction" method="post" action="/adm/cfile" target="_parent">
554: <fieldset>
555: <legend>$lt{'crea'}</legend>
556: <span class="LC_nobreak">
1.132 www 557: <input type="hidden" name="filename" value="/priv$thisdisfn/" />
1.105 albertel 558: <script type="text/javascript">
559: function validate_go() {
560: var selected = document.fileaction.action.selectedIndex;
561: if (selected == 0) {
562: alert('$lt{'pick'}');
563: } else {
564: document.fileaction.submit();
565: }
566: }
567: </script>
568: <select name="action">
569: <option value="none">$lt{'sela'}</option>
570: <option value="newfile">$lt{'nfil'}:</option>
571: <option value="newhtmlfile">$lt{'nhtm'}:</option>
572: <option value="newproblemfile">$lt{'nprb'}:</option>
573: <option value="newpagefile">$lt{'npag'}:</option>
574: <option value="newsequencefile">$lt{'nseq'}:</option>
575: <option value="newrightsfile">$lt{'ncrf'}:</option>
576: <option value="newstyfile">$lt{'nsty'}:</option>
577: <option value="newtaskfile">$lt{'nbt'}:</option>
578: <option value="newlibraryfile">$lt{'nlib'}:</option>
579: <option value="newdir">$lt{'nsub'}:</option>
1.160.2.2 raeburn 580: </select> <input type="text" name="newfilename" placeholder="$lt{'type'}" value="" onfocus="if (this.value == is.empty()) this.value=''" /> <input type="button" value="Go" onclick="validate_go();" />
581: <br />
582: <span>Quickactions:
583: <input type="hidden" name="mode"/>
584: <a href="javascript:void(0)" onclick="javascript:validate_action('blank')">
585: <img src="/adm/lonIcons/unknown.gif" title="Create blank problem file"></a>
586: <a href="javascript:void(0)" onclick="javascript:validate_action('problemtempl')">
587: <img src="/adm/lonIcons/problem.gif" title="Create new problem from template"></a>
588: <a href="javascript:void(0)" onclick="javascript:validate_action('blankhtml')">
589: <img src="/adm/lonIcons/html.gif" title="Create new blank HTML file"></a>
590: <a href="javascript:void(0)" onclick="javascript:validate_action('folder')">
591: <img src="/adm/lonIcons/navmap.folder.closed.gif" title="Create new subdirectory"></a>
592: </span>
593: <script type="text/javascript">
594: function validate_action(action){
595:
596: if (document.getElementsByName(\'newfilename\')[0].value != \'\'){
597: if (action == "blank") {
598: document.fileaction.action.value=\'newproblemfile\';
599: document.fileaction.mode.value=\'blank\';
600: } else if (action == "problemtempl") {
601: document.fileaction.action.value=\'newproblemfile\';
602: validate_go();
603: } else if (action == "blankhtml") {
604: document.fileaction.action.value=\'newhtmlfile\';
605: validate_go();
606: } else if (action == "folder") {
607: document.fileaction.action.value=\'newdir\';
608: document.fileaction.mode.value=\'folder\';
609: }
610: fileaction.submit();
611: } else {
612: alert(\'Please specify file name.\');
613: // TODO: ask for filename? if so, do some refactoring
614:
615: }
616: }
617: </script>
1.92 albertel 618: </span>
1.116 bisitz 619: </fieldset>
620: </form>
621: </div>
622: </div>
1.64 raeburn 623: END
624: }
625:
626: sub resourceactions {
627: my ($r,$uname,$udom,$thisdisfn) = @_;
628: $r->print(<<END);
629: <form name="moveresource" action="/adm/cfile" target="_parent" method="post">
630: <input type="hidden" name="filename" value="" />
631: <input type="hidden" name="newfilename" value="" />
632: <input type="hidden" name="action" value="" />
633: </form>
634: <form name="delresource" action="/adm/cfile" target="_parent" method="post">
635: <input type="hidden" name="filename" value="" />
636: <input type="hidden" name="action" value="delete" />
637: </form>
638: <form name="pubresource" action="/adm/publish" target="_parent" method="post">
639: <input type="hidden" name="filename" value="" />
1.80 www 640: <input type="hidden" name="makeobsolete" value="0" />
1.64 raeburn 641: </form>
642: <form name="printresource" action="/adm/printout" target="_parent" method="post">
643: <input type="hidden" name="postdata" value="" />
644: </form>
645: <form name="retrieveres" action="/adm/retrieve" target="_parent" method="post">
646: <input type="hidden" name="filename" value="" />
647: </form>
1.82 www 648: <form name="cleanup" action="/adm/cleanup" target="_parent" method="post">
649: <input type="hidden" name="filename" value="" />
650: </form>
1.64 raeburn 651: END
1.23 foxr 652: }
653:
654: #
655: # Get the title string or "[untitled]" if the file has no title metadata:
656: # Without the latter substitution, it's impossible to examine metadata for
657: # untitled resources. Resources may be legitimately untitled, to prevent
658: # searches from locating them.
659: #
660: # $str = getTitleString($fullname);
661: # $fullname - Fully qualified filename to check.
662: #
663: sub getTitleString {
664: my $fullname = shift;
665: my $title = &Apache::lonnet::metadata($fullname, 'title');
666:
667: unless ($title) {
1.40 www 668: $title = "[".&mt('untitled')."]";
1.23 foxr 669: }
670: return $title;
671: }
672:
1.55 www 673: sub getCopyRightString {
674: my $fullname = shift;
675: return &Apache::lonnet::metadata($fullname, 'copyright');
676: }
1.61 www 677:
678: sub getSourceRightString {
679: my $fullname = shift;
680: return &Apache::lonnet::metadata($fullname, 'sourceavail');
681: }
1.23 foxr 682: #
1.21 foxr 683: # Put out a directory table row:
1.134 raeburn 684: # putdirectory(r, base, here, dirname, modtime, targetdir, bombs, numdir)
685: # r - Apache request object.
686: # reqfile - File in request.
687: # here - Where we are in directory tree.
688: # dirname - Name of directory special file.
689: # modtime - Encoded modification time.
690: # targetdir - Publication target directory.
691: # bombs - Reference to hash of URLs with runtime error messages.
692: # numdir - Reference to scalar used to track number of sub-directories
693: # in directory (used in form name for each "actions" dropdown).
694: #
1.21 foxr 695: sub putdirectory {
1.134 raeburn 696: my ($r, $reqfile, $here, $dirname, $modtime, $targetdir, $bombs, $numdir) = @_;
1.129 www 697:
698: # construct the display filename: the directory name unless ..:
1.133 www 699:
700: my $actionitem;
701:
1.21 foxr 702: my $disfilename = $dirname;
1.130 www 703: # Don't display directory itself, and there is no way up from root directory
1.133 www 704: unless ((($dirname eq '..') && ($reqfile=~/^\/[^\/]+\/[^\/]+$/)) || ($dirname eq '.')) {
1.143 bisitz 705: my $kaputt=0;
1.134 raeburn 706: if (ref($bombs) eq 'HASH') {
1.143 bisitz 707: foreach my $key (keys(%{$bombs})) {
708: my $currentdir = &Apache::lonnet::declutter("$targetdir/$disfilename");
709: if (($key) =~ m{^\Q$currentdir\E/}) { $kaputt=1; last; }
710: }
1.134 raeburn 711: }
1.129 www 712: #
713: # Get the metadata from that directory's default.meta to display titles
714: #
1.52 www 715: %Apache::lonpublisher::metadatafields=();
716: %Apache::lonpublisher::metadatakeys=();
1.129 www 717: &Apache::lonpublisher::metaeval(
718: &Apache::lonnet::getfile($r->dir_config('lonDocRoot').$here.'/'.$dirname.'/default.meta')
719: );
1.133 www 720: if ($dirname eq '..') {
1.109 bisitz 721: $actionitem = &mt('Go to ...');
1.133 www 722: $disfilename = '<i>'.&mt('Parent Directory').'</i>';
1.64 raeburn 723: } else {
724: $actionitem =
725: '<form name="dirselect_'.$$numdir.
726: '" action="/adm/publish" target="_parent">'.
1.85 albertel 727: '<select name="diraction" onchange="SetPubDir(this.form,document)">'.
1.64 raeburn 728: '<option selected="selected">'.&mt('Select action').'</option>'.
729: '<option value="open">'.&mt('Open').'</option>'.
730: '<option value="publish">'.&mt('Publish').'</option>'.
1.113 schafran 731: '<option value="editmeta">'.&mt('Edit Metadata').'</option>'.
1.77 albertel 732: '<option value="printdir">'.&mt('Print directory').'</option>'.
1.88 raeburn 733: '<option value="delete">'.&mt('Delete directory').'</option>'.
1.64 raeburn 734: '</select>'.
1.129 www 735: '<input type="hidden" name="filename" value="'.&HTML::Entities::encode($here.'/'.$dirname,'<>&"').'/" />'.
1.75 albertel 736: '<input type="hidden" name="openname" value="'.$here.'/'.$dirname.'/" />'.
1.64 raeburn 737: '<input type="hidden" name="postdata" value="" />'.
738: '</form>';
739: $$numdir ++;
740: }
1.92 albertel 741: $r->print('<tr class="LC_browser_folder">'.
1.53 www 742: '<td><img src="'.
1.123 bisitz 743: $Apache::lonnet::perlvar{'lonIconsURL'}.'/navmap.folder.closed.gif" alt="folder" /></td>'.
1.64 raeburn 744: '<td>'.$actionitem.'</td>'.
1.92 albertel 745: '<td><span class="LC_filename"><a href="'.&HTML::Entities::encode($here.'/'.$dirname,'<>&"').'/" target="_parent">'.
746: $disfilename.'</a></span></td>'.
1.134 raeburn 747: '<td colspan="3">'.($kaputt?&Apache::lonhtmlcommon::authorbombs($targetdir.'/'.$disfilename.'/'):'').$Apache::lonpublisher::metadatafields{'title'});
1.92 albertel 748: if ($Apache::lonpublisher::metadatafields{'subject'} ne '') {
749: $r->print(' <i>'.
750: $Apache::lonpublisher::metadatafields{'subject'}.
751: '</i> ');
752: }
753: $r->print($Apache::lonpublisher::metadatafields{'keywords'}.'</td>'.
1.42 www 754: '<td>'.&Apache::lonlocal::locallocaltime($modtime).'</td>'.
1.152 musolffc 755: '<td></td>'.
1.25 www 756: "</tr>\n");
1.64 raeburn 757: }
1.154 raeburn 758: return;
1.21 foxr 759: }
1.152 musolffc 760:
761: sub getTitle {
762: my ($resdir, $targetdir, $filename, $linkfilename, $meta_same, $bombs) = @_;
763: my $title='';
764: my $titleString = &getTitleString($targetdir.'/'.$filename);
765: if (-e $resdir.'/'.$filename) {
766: $title = '<a href="'.$targetdir.'/'.$filename.
767: '.meta" target="cat">'.$titleString.'</a>';
768: if (!$meta_same) {
769: $title = &mt('Metadata Modified').'<br />'.$title.
770: '<br />'.
771: &Apache::loncommon::modal_link(
772: '/adm/diff?filename='.$linkfilename.'.meta'.'&versiontwo=priv',
773: &mt('Metadata Diffs'),600,500);
774: $title.="\n".'<br />'.
775: &Apache::loncommon::modal_link(
776: '/adm/retrieve?filename='.$linkfilename.'.meta&inhibitmenu=yes&add_modal=yes',
777: &mt('Retrieve Metadata'),600,500);
778: }
779: }
780: # Allow editing metadata of published and unpublished resources
781: $title .= "\n".'<br />' if ($title);
782: $title .= '<a href="'.$linkfilename.'.meta">'.
783: ($$bombs{&Apache::lonnet::declutter($targetdir.'/'.$filename)}?
784: '<img src="/adm/lonMisc/bomb.gif" border="0" alt="'.&mt('bomb').'" />':
785: &mt('Edit Metadata')).
786: '</a>';
787:
788: return ($title, $titleString);
789: }
790:
791:
792: sub isMetaSame {
793: my ($cstr_dir, $resdir, $filename) = @_;
794: my $meta_cmtime = (stat($cstr_dir.'/'.$filename.'.meta'))[9];
795: my $meta_rmtime = (stat($resdir.'/'.$filename.'.meta'))[9];
796: return (&Apache::londiff::are_different_files($resdir.'/'.$filename.'.meta',
797: $cstr_dir.'/'.$filename.'.meta') && $meta_rmtime < $meta_cmtime)
798: ? 0 : 1;
799: }
800:
801:
802: sub getStatus {
803: my ($resdir, $targetdir, $cstr_dir, $filename,
804: $linkfilename, $cmtime, $meta_same) = @_;
1.64 raeburn 805: my $pubstatus = 'unpublished';
1.152 musolffc 806: my $status = &mt('Unpublished');
1.129 www 807:
1.22 foxr 808: if (-e $resdir.'/'.$filename) {
1.152 musolffc 809: my $same = 0;
810: if ((stat($resdir.'/'.$filename))[9] >= $cmtime) {
811: $same = 1;
1.91 www 812: } else {
813: if (&Apache::londiff::are_different_files($resdir.'/'.$filename,
1.95 albertel 814: $cstr_dir.'/'.$filename)) {
1.152 musolffc 815: $same = 0;
1.91 www 816: } else {
1.152 musolffc 817: $same = 1;
1.91 www 818: }
819: }
1.124 bisitz 820:
821: my $rights_status =
822: &mt(&getCopyRightString($targetdir.'/'.$filename)).', ';
823:
824: my %lt_SourceRight = &Apache::lonlocal::texthash(
825: 'open' => 'Source: open',
826: 'closed' => 'Source: closed',
827: );
828: $rights_status .=
829: $lt_SourceRight{&getSourceRightString($targetdir.'/'.$filename)};
830:
1.91 www 831: if ($same) {
1.40 www 832: if (&Apache::lonnet::metadata($targetdir.'/'.$filename,'obsolete')) {
1.64 raeburn 833: $pubstatus = 'obsolete';
1.41 www 834: $status=&mt('Obsolete');
1.95 albertel 835: } else {
836: if (!$meta_same) {
837: $pubstatus = 'metamodified';
838: } else {
839: $pubstatus = 'published';
840: }
841: $status=&mt('Published').
842: '<br />'. $rights_status;
843: }
1.22 foxr 844: } else {
1.64 raeburn 845: $pubstatus = 'modified';
1.95 albertel 846: $status=&mt('Modified').
847: '<br />'. $rights_status;
1.22 foxr 848: if (&Apache::loncommon::fileembstyle(($filename=~/\.(\w+)$/)) eq 'ssi') {
1.139 www 849: $status.='<br />'.
850: &Apache::loncommon::modal_link(
851: '/adm/diff?filename='.$linkfilename.'&versiontwo=priv',
852: &mt('Diffs'),600,500);
1.22 foxr 853: }
1.95 albertel 854: }
1.152 musolffc 855:
1.140 www 856: $status.="\n".'<br />'.
857: &Apache::loncommon::modal_link(
858: '/adm/retrieve?filename='.$linkfilename.'&inhibitmenu=yes&add_modal=yes',&mt('Retrieve'),600,500);
1.22 foxr 859: }
1.152 musolffc 860:
861: return ($status, $pubstatus);
862: }
863:
864:
865: #
866: # Put a table row for a file resource.
867: #
868: sub putresource {
869: my ($r, $udom, $uname, $filename, $thisdisfn, $resdir, $targetdir,
870: $linkdir, $cmtime, $size, $numres, $linkfilename, $title,
871: $status, $pubstatus) = @_;
872: &Apache::lonnet::devalidate_cache_new('meta',$targetdir.'/'.$filename);
1.143 bisitz 873:
1.33 www 874: my $editlink='';
1.38 taceyjo1 875: my $editlink2='';
1.36 www 876: if ($filename=~/\.(xml|html|htm|xhtml|xhtm|sty)$/) {
1.146 raeburn 877: $editlink=' <br />(<a href="'.$linkdir.'/'.$filename.'?editmode=Edit&problemmode=edit">'.&mt('Edit').'</a>)';
1.34 www 878: }
1.136 www 879: if ($filename=~/$LONCAPA::assess_re/) {
1.146 raeburn 880: $editlink=' (<a href="'.$linkdir.'/'.$filename.'?editmode=Edit&problemmode=editxml">'.&mt('EditXML').'</a>)';
881: $editlink2=' <br />(<a href="'.$linkdir.'/'.$filename.'?editmode=Edit&problemmode=edit">'.&mt('Edit').'</a>)';
1.43 taceyjo1 882: }
1.82 www 883: if ($filename=~/\.(problem|exam|quiz|assess|survey|form|library|xml|html|htm|xhtml|xhtm|sty)$/) {
1.129 www 884: $editlink.=' (<a href="/adm/cleanup?filename='.$linkfilename.'" target="_parent">'.&mt('Clean Up').')</a>';
1.82 www 885: }
1.43 taceyjo1 886: if ($filename=~/\.(zip|tar|bz2|gz|tar.gz|tar.bz2|tgz)$/) {
1.129 www 887: $editlink=' (<a target="_parent" href="/adm/cfile?decompress='.$linkfilename.'">'.&mt('Decompress').'</a>)';
1.33 www 888: }
1.152 musolffc 889: my $publish_button = (-e $resdir.'/'.$filename) ? &mt('Re-publish') : &mt('Publish');
1.64 raeburn 890: my $pub_select = '';
891: &create_pubselect($r,\$pub_select,$udom,$uname,$thisdisfn,$filename,$resdir,$pubstatus,$publish_button,$numres);
1.115 bisitz 892: $r->print(&Apache::loncommon::start_data_table_row().
1.53 www 893: '<td>'.($filename=~/[\#\~]$/?' ':
1.86 albertel 894: '<img src="'.&Apache::loncommon::icon($filename).'" alt="" />').'</td>'.
1.64 raeburn 895: '<td>'.$pub_select.'</td>'.
1.104 albertel 896: '<td><span class="LC_filename">'.
1.64 raeburn 897: '<a href="'.$linkdir.'/'.$filename.'" target="_parent">'.
1.92 albertel 898: $filename.'</a></span>'.$editlink2.$editlink.
1.22 foxr 899: '</td>'.
900: '<td>'.$title.'</td>'.
1.115 bisitz 901: '<td class="LC_browser_file_'.$pubstatus.'"> </td>'. # Display publication status
902: '<td>'.$status.'</td>'.
1.42 www 903: '<td>'.&Apache::lonlocal::locallocaltime($cmtime).'</td>'.
1.153 raeburn 904: '<td>'.sprintf("%.1f",$size).'</td>'.
1.115 bisitz 905: &Apache::loncommon::end_data_table_row()
906: );
1.154 raeburn 907: return;
1.23 foxr 908: }
1.64 raeburn 909:
910: sub create_pubselect {
911: my ($r,$pub_select,$udom,$uname,$thisdisfn,$filename,$resdir,$pubstatus,$publish_button,$numres) = @_;
912: $$pub_select = '
913: <form name="resselect_'.$$numres.'" action="">
1.85 albertel 914: <select name="reschoice" onchange="SetResChoice(this.form)">
1.77 albertel 915: <option>'.&mt('Select action').'</option>'.
916: '<option value="copy">'.&mt('Copy').'</option>';
1.68 raeburn 917: if ($pubstatus eq 'obsolete' || $pubstatus eq 'unpublished') {
918: $$pub_select .=
1.77 albertel 919: '<option value="rename">'.&mt('Rename').'</option>'.
920: '<option value="move">'.&mt('Move').'</option>'.
921: '<option value="delete">'.&mt('Delete').'</option>';
1.64 raeburn 922: } else {
923: $$pub_select .= '
1.77 albertel 924: <option value="obsolete">'.&mt('Mark obsolete').'</option>';
1.64 raeburn 925: }
926: # check for versions
927: my $versions = &check_for_versions($r,'/'.$filename,$udom,$uname);
928: if ($versions > 0) {
929: $$pub_select .='
1.77 albertel 930: <option value="retrieve">'.&mt('Retrieve old version').'</option>';
1.64 raeburn 931: }
932: $$pub_select .= '
1.77 albertel 933: <option value="publish">'.$publish_button.'</option>'.
1.82 www 934: '<option value="cleanup">'.&mt('Clean up').'</option>'.
1.77 albertel 935: '<option value="print">'.&mt('Print').'</option>'.
1.68 raeburn 936: '</select>
1.131 www 937: <input type="hidden" name="filename" value="/priv'.
938: &HTML::Entities::encode($thisdisfn.'/'.$filename,'<>&"').'" />
1.96 banghart 939: <input type="hidden" name="dispfilename" value="'.
1.99 albertel 940: &HTML::Entities::encode($filename).'" /></form>';
1.64 raeburn 941: $$numres ++;
942: }
943:
944: sub check_for_versions {
945: my ($r,$fn,$udom,$uname) = @_;
946: my $versions = 0;
947: my $docroot=$r->dir_config('lonDocRoot');
948: my $resfn=$docroot.'/res/'.$udom.'/'.$uname.$fn;
949: my $resdir=$resfn;
950: $resdir=~s/\/[^\/]+$/\//;
951: $fn=~/\/([^\/]+)\.(\w+)$/;
952: my $main=$1;
953: my $suffix=$2;
954: opendir(DIR,$resdir);
955: while (my $filename=readdir(DIR)) {
956: if ($filename=~/^\Q$main\E\.(\d+)\.\Q$suffix\E$/) {
957: $versions ++;
958: }
959: }
1.154 raeburn 960: closedir(DIR);
1.64 raeburn 961: return $versions;
962: }
963:
1.4 www 964: 1;
965: __END__
1.17 harris41 966:
967:
1.114 jms 968: =head1 NAME
969:
1.145 raeburn 970: Apache::lonpubdir - Authoring space directory lister
1.114 jms 971:
972: =head1 SYNOPSIS
973:
974: Invoked (for various locations) by /etc/httpd/conf/srm.conf:
975:
1.134 raeburn 976: <LocationMatch "^/+priv.*/$">
1.114 jms 977: PerlAccessHandler Apache::loncacc
978: SetHandler perl-script
979: PerlHandler Apache::lonpubdir
980: ErrorDocument 403 /adm/login
981: ErrorDocument 404 /adm/notfound.html
982: ErrorDocument 406 /adm/unauthorized.html
983: ErrorDocument 500 /adm/errorhandler
984: </LocationMatch>
985:
986: <Location /adm/pubdir>
987: PerlAccessHandler Apache::lonacc
988: SetHandler perl-script
989: PerlHandler Apache::lonpubdir
990: ErrorDocument 403 /adm/login
991: ErrorDocument 404 /adm/notfound.html
992: ErrorDocument 406 /adm/unauthorized.html
993: ErrorDocument 500 /adm/errorhandler
994: </Location>
995:
996: =head1 INTRODUCTION
997:
998: This module publishes a directory of files.
999:
1000: This is part of the LearningOnline Network with CAPA project
1001: described at http://www.lon-capa.org.
1002:
1003: =head1 HANDLER SUBROUTINE
1004:
1005: This routine is called by Apache and mod_perl.
1006:
1007: =over 4
1008:
1009: =item *
1010:
1011: read in information
1012:
1013: =item *
1014:
1015: start page output
1016:
1017: =item *
1018:
1019: run through list of files and attempt to publish unhidden files
1020:
1021: =back
1022:
1023: =head1 SUBROUTINES:
1024:
1025: =over
1026:
1027: =item startpage($r, $uame, $udom, $thisdisfn)
1028:
1029: Output the header of the page. This includes:
1030: - The HTML header
1031: - The H1/H3 stuff which includes the directory.
1032:
1033: startpage($r, $uame, $udom, $thisdisfn);
1034: $r - The apache request object.
1035: $uname - User name.
1036: $udom - Domain name the user is logged in under.
1037: $thisdisfn - Displayable version of the filename.
1038:
1039: =item getTitleString($fullname)
1040:
1041: Get the title string or "[untitled]" if the file has no title metadata:
1042: Without the latter substitution, it's impossible to examine metadata for
1043: untitled resources. Resources may be legitimately untitled, to prevent
1044: searches from locating them.
1045:
1046: $str = getTitleString($fullname);
1047: $fullname - Fully qualified filename to check.
1048:
1.134 raeburn 1049: =item putdirectory($r, $base, $here, $dirname, $modtime, $targetdir, $bombs,
1050: $numdir)
1.114 jms 1051:
1052: Put out a directory table row:
1053:
1.134 raeburn 1054: $r - Apache request object.
1055: $reqfile - File in request.
1056: $here - Where we are in directory tree.
1057: $dirname - Name of directory special file.
1058: $modtime - Encoded modification time.
1059: targetdir - Publication target directory.
1060: bombs - Reference to hash of URLs with runtime error messages.
1061: numdir - Reference to scalar used to track number of sub-directories
1062: in directory (used in form name for each "actions" dropdown).
1.114 jms 1063:
1064: =back
1065:
1066: =cut
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>