Annotation of loncom/interface/coursecatalog.pm, revision 1.72
1.17 albertel 1: # The LearningOnline Network with CAPA
2: # Handler for displaying the course catalog interface
3: #
1.72 ! raeburn 4: # $Id: coursecatalog.pm,v 1.71 2012/10/04 13:41:10 bisitz Exp $
1.1 raeburn 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: #
28:
29: package Apache::coursecatalog;
30:
31: use strict;
32: use lib qw(/home/httpd/lib/perl);
33: use Apache::Constants qw(:common);
34: use Apache::loncommon;
1.7 raeburn 35: use Apache::lonhtmlcommon;
1.1 raeburn 36: use Apache::lonnet;
37: use Apache::lonlocal;
1.6 raeburn 38: use Apache::courseclassifier;
1.1 raeburn 39: use Apache::lonacc;
40: use LONCAPA;
41:
42: sub handler {
43: my ($r) = @_;
44: &Apache::loncommon::content_type($r,'text/html');
45: $r->send_http_header;
46: if ($r->header_only) {
47: return OK;
48: }
1.21 albertel 49: my $handle = &Apache::lonnet::check_for_valid_session($r);
1.8 raeburn 50: my $lonidsdir=$r->dir_config('lonIDsDir');
1.21 albertel 51: if ($handle ne '') {
1.8 raeburn 52: &Apache::lonnet::transfer_profile_to_env($lonidsdir,$handle);
53: }
1.1 raeburn 54: &Apache::lonacc::get_posted_cgi($r);
55: &Apache::lonlocal::get_language_handle($r);
1.38 raeburn 56: &Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},
57: ['sortby','showdom']);
1.28 raeburn 58:
59: my $codedom = &Apache::lonnet::default_login_domain();
1.19 raeburn 60:
61: if (($env{'user.domain'} ne '') && ($env{'user.domain'} ne 'public')) {
62: $codedom = $env{'user.domain'};
63: if ($env{'request.role.domain'} ne '') {
64: $codedom = $env{'request.role.domain'};
65: }
66: }
1.7 raeburn 67: my $formname = 'coursecatalog';
1.28 raeburn 68: if ($env{'form.showdom'} ne '') {
69: if (&Apache::lonnet::domain($env{'form.showdom'}) ne '') {
70: $codedom = $env{'form.showdom'};
71: }
72: }
1.20 albertel 73: my $domdesc = &Apache::lonnet::domain($codedom,'description');
1.7 raeburn 74: &Apache::lonhtmlcommon::clear_breadcrumbs();
1.35 raeburn 75:
76: my %domconfig =
77: &Apache::lonnet::get_dom('configuration',['coursecategories'],$codedom);
1.36 raeburn 78: my (@cats,@trails,%allitems,%idx,@jsarray,%subcathash,$cathash);
1.35 raeburn 79: if (ref($domconfig{'coursecategories'}) eq 'HASH') {
80: $cathash = $domconfig{'coursecategories'}{'cats'};
81: } else {
82: $cathash = {};
83: }
1.36 raeburn 84: my $subcats;
85: if ($env{'form.withsubcats'}) {
86: $subcats = \%subcathash;
87: }
1.35 raeburn 88: &Apache::loncommon::extract_categories($cathash,\@cats,\@trails,\%allitems,
1.36 raeburn 89: \%idx,\@jsarray,$subcats);
1.63 raeburn 90: my ($numtitles,@codetitles);
1.8 raeburn 91: if ($env{'form.coursenum'} ne '' && &user_is_known()) {
1.63 raeburn 92: &course_details($r,$codedom,$formname,$domdesc,\@trails,\%allitems,\@codetitles);
1.7 raeburn 93: } else {
1.46 raeburn 94: my ($catlinks,$has_subcats,$selitem) = &category_breadcrumbs($codedom,@cats);
1.72 ! raeburn 95: my $wasacctext = &get_wasactive_text();
1.28 raeburn 96: my $catjs = <<"ENDSCRIPT";
97:
98: function setCatDepth(depth) {
99: document.coursecats.catalog_maxdepth.value = depth;
1.36 raeburn 100: if (depth == '') {
101: document.coursecats.currcat_0.value = '';
102: }
1.28 raeburn 103: document.coursecats.submit();
104: return;
105: }
106:
1.33 raeburn 107: function changeSort(caller) {
108: document.$formname.sortby.value = caller;
109: document.$formname.submit();
110: }
1.40 raeburn 111:
1.33 raeburn 112: function setCourseId(caller) {
113: document.$formname.coursenum.value = caller;
114: document.$formname.submit();
1.37 raeburn 115: }
116:
117: ENDSCRIPT
1.72 ! raeburn 118: $catjs .= &courselink_javascript();
! 119: if (&user_is_dc($codedom)) {
! 120: $catjs .= <<ENDTOGGJS
! 121:
! 122: function toggleStatuses() {
! 123: if (document.$formname.showdetails.checked) {
! 124: document.getElementById('statuschoice').style.display='block';
! 125: document.getElementById('statuscell').style.borderLeft='1px solid';
! 126: } else {
! 127: document.getElementById('statuschoice').style.display='none';
! 128: document.getElementById('statuscell').style.borderLeft='0px';
! 129: }
! 130: return;
! 131: }
! 132:
! 133: function toggleWasActive() {
! 134: if (document.getElementById('counts_Previous')) {
! 135: if (document.getElementById('counts_Previous').checked) {
! 136: document.getElementById('choosewasactive').style.display='block';
! 137: document.getElementById('choosewasacctext').innerHTML = '$wasacctext';
! 138: } else {
! 139: document.getElementById('choosewasactive').style.display='none';
! 140: document.getElementById('choosewasacctext').innerHTML = '';
! 141: }
! 142: }
! 143: return;
! 144: }
! 145:
! 146: ENDTOGGJS
! 147: }
1.28 raeburn 148: if ($env{'form.currcat_0'} eq 'instcode::0') {
149: $numtitles = &instcode_course_selector($r,$codedom,$formname,$domdesc,
1.63 raeburn 150: $catlinks,$catjs,\@codetitles);
1.28 raeburn 151: if ($env{'form.state'} eq 'listing') {
1.63 raeburn 152: $r->print(&print_course_listing($codedom,$numtitles,undef,undef,undef,
153: \@codetitles));
1.28 raeburn 154: }
155: } else {
156: my (%add_entries);
1.50 raeburn 157: my ($currdepth,$deeper) = &get_depth_values();
1.46 raeburn 158: if ($selitem) {
1.50 raeburn 159: my $alert = &mt('Choose a subcategory to display');
160: if (!$deeper) {
161: $alert = &mt('Choose a category to display');
162: }
1.46 raeburn 163: $catjs .= <<ENDJS;
164: function check_selected() {
165: if (document.coursecats.$selitem.options[document.coursecats.$selitem.selectedIndex].value == "") {
1.50 raeburn 166: alert('$alert');
1.46 raeburn 167: return false;
168: }
169: }
170: ENDJS
171: }
1.28 raeburn 172: $catjs = '<script type="text/javascript">'."\n".$catjs."\n".'</script>';
173: &cat_header($r,$codedom,$catjs,\%add_entries,$catlinks);
174: if ($env{'form.currcat_0'} ne '') {
1.33 raeburn 175: $r->print('<form name="'.$formname.
176: '" method="post" action="/adm/coursecatalog">'.
1.36 raeburn 177: &additional_filters($codedom,$has_subcats)."\n");
1.33 raeburn 178: $r->print('<input type="hidden" name="catalog_maxdepth" value="'.
179: $deeper.'" />'."\n");
180: for (my $i=0; $i<$deeper; $i++) {
181: $r->print('<input type="hidden" name="currcat_'.$i.'" value="'.$env{'form.currcat_'.$i}.'" />'."\n");
182: }
1.57 raeburn 183: my $display_button;
184: if ($env{'form.currcat_0'} eq 'communities::0') {
185: $display_button = &mt('Display communities');
186: } else {
187: $display_button = &mt('Display courses');
188: }
1.33 raeburn 189: $r->print('<input type="hidden" name="coursenum" value="" />'."\n".
190: '<input type="hidden" name="sortby" value="" />'."\n".
191: '<input type="hidden" name="state" value="listing" />'."\n".
192: '<input type="hidden" name="showdom" value="'.
193: $env{'form.showdom'}.'" />'.
194: '<input type="submit" name="catalogfilter" value="'.
1.57 raeburn 195: $display_button.'" /></form><br /><br />');
1.33 raeburn 196: }
197: if ($env{'form.state'} eq 'listing') {
1.63 raeburn 198: $r->print(&print_course_listing($codedom,undef,\@trails,\%allitems,$subcats,\@codetitles));
1.28 raeburn 199: }
1.18 raeburn 200: }
1.7 raeburn 201: }
1.32 raeburn 202: $r->print('<br />'.&Apache::loncommon::end_page());
1.7 raeburn 203: return OK;
204: }
205:
206: sub course_details {
1.63 raeburn 207: my ($r,$codedom,$formname,$domdesc,$trails,$allitems,$codetitles) = @_;
1.7 raeburn 208: my $output;
209: my %add_entries = (topmargin => "0",
210: marginheight => "0",);
1.40 raeburn 211: my $js = '<script type="text/javascript">'."\n".
1.41 raeburn 212: &courselink_javascript().'</script>'."\n";
1.7 raeburn 213: my $start_page =
1.56 bisitz 214: &Apache::loncommon::start_page('Course/Community Catalog',$js,
1.72 ! raeburn 215: {'add_entries' => \%add_entries, });
1.7 raeburn 216: $r->print($start_page);
1.19 raeburn 217: if ($env{'form.numtitles'} > 0) {
218: &Apache::lonhtmlcommon::add_breadcrumb
219: ({href=>"/adm/coursecatalog",
1.56 bisitz 220: text=>"Course/Community Catalog"});
1.19 raeburn 221: }
1.60 raeburn 222: my $brtextone = 'Course listing';
223: my $brtexttwo = 'Course details';
224: if ($env{'form.currcat_0'} eq 'communities::0') {
225: $brtextone = 'Community listing';
1.61 raeburn 226: $brtexttwo = 'Community details';
1.60 raeburn 227: }
1.7 raeburn 228: &Apache::lonhtmlcommon::add_breadcrumb
1.19 raeburn 229: ({href=>"javascript:document.$formname.submit()",
1.60 raeburn 230: text=>$brtextone},
231: {text=>$brtexttwo});
1.55 raeburn 232: $r->print(&Apache::lonhtmlcommon::breadcrumbs('Course/Community Catalog'));
1.60 raeburn 233: $r->print('<br />');
234: if ($env{'form.currcat_0'} eq 'communities::0') {
235: $r->print(&mt('Detailed community information:'));
236: } else {
237: $r->print(&mt('Detailed course information:'));
238: }
239: $r->print('<br /><br />'.
1.63 raeburn 240: &print_course_listing($codedom,undef,$trails,$allitems,undef,$codetitles).
1.35 raeburn 241: '<br /><br />');
1.40 raeburn 242: $r->print('<form name="'.$formname.'" method="post" action="/adm/coursecatalog">'.
1.60 raeburn 243: '<a href = "javascript:document.coursecatalog.submit()">');
244: if ($env{'form.currcat_0'} eq 'communities::0') {
245: $r->print(&mt('Back to community listing'));
246: } else {
247: $r->print(&mt('Back to course listing'));
248: }
249: $r->print('</a>'.
1.41 raeburn 250: &Apache::lonhtmlcommon::echo_form_input(['coursenum','catalogfilter',
251: 'showdetails','courseid']).'</form>');
1.40 raeburn 252: return;
253: }
254:
1.41 raeburn 255: sub courselink_javascript {
1.40 raeburn 256: return <<"END";
257:
258: function ToSyllabus(cdom,cnum) {
259: if (cdom == '' || cdom == null) {
260: return;
261: }
262: if (cnum == '' || cnum == null) {
263: return;
264: }
1.41 raeburn 265: document.linklaunch.action = "/public/"+cdom+"/"+cnum+"/syllabus";
266: document.linklaunch.submit();
267: }
268:
269: function ToSelfenroll(courseid) {
270: if (courseid == '') {
271: return;
272: }
273: document.linklaunch.action = "/adm/selfenroll";
274: document.linklaunch.courseid.value = courseid;
275: document.linklaunch.submit();
1.40 raeburn 276: }
277:
278: END
1.7 raeburn 279: }
280:
1.28 raeburn 281: sub instcode_course_selector {
1.63 raeburn 282: my ($r,$codedom,$formname,$domdesc,$catlinks,$catjs,$codetitles) = @_;
1.1 raeburn 283: my %coursecodes = ();
284: my %codes = ();
285: my %cat_titles = ();
286: my %cat_order = ();
1.6 raeburn 287: my %cat_items;
1.1 raeburn 288: my $caller = 'global';
289: my $format_reply;
1.30 raeburn 290: my %add_entries = (topmargin => "0",
291: marginheight => "0",);
1.51 raeburn 292: my ($jscript,$totcodes,$numtitles,$lasttitle) =
293: &Apache::courseclassifier::instcode_selectors_data($codedom,$formname,
1.63 raeburn 294: \%cat_items,$codetitles,\%cat_titles,\%cat_order);
1.51 raeburn 295: my $js = '<script type"text/javascript">'."\n$jscript\n$catjs\n".
1.30 raeburn 296: '</script>';
1.51 raeburn 297: if ($totcodes) {
1.18 raeburn 298: if (($env{'form.state'} eq 'listing') && ($numtitles > 0)) {
1.72 ! raeburn 299: $add_entries{'onLoad'} = 'setElements();';
! 300: }
! 301: if (&user_is_dc($codedom)) {
! 302: $add_entries{'onLoad'} .= ' toggleStatuses();toggleWasActive();'
1.7 raeburn 303: }
1.28 raeburn 304: &cat_header($r,$codedom,$js,\%add_entries,$catlinks,$numtitles);
305: my $cat_maxdepth = $env{'form.catalog_maxdepth'};
306: $r->print('<form name="'.$formname.'" method="post" action="/adm/coursecatalog">'.
1.32 raeburn 307: '<input type="hidden" name="catalog_maxdepth" value="'.$cat_maxdepth.'" />'."\n".
308: '<input type="hidden" name="showdom" value="'.$env{'form.showdom'}.'" />'."\n".
309: '<input type="hidden" name="currcat_0" value="instcode::0" />'.
1.33 raeburn 310: &additional_filters($codedom));
1.1 raeburn 311: if ($numtitles > 0) {
1.51 raeburn 312: $r->print('<b>'.&mt('Choose which course(s) to list.').'</b><br />'.
313: &Apache::courseclassifier::build_instcode_selectors($numtitles,
1.63 raeburn 314: $lasttitle,\%cat_items,$codetitles,\%cat_titles,\%cat_order));
1.18 raeburn 315: }
1.33 raeburn 316: $r->print('<input type="hidden" name="coursenum" value="" />'."\n".
317: '<input type="hidden" name="sortby" value="" />'."\n".
318: '<input type="hidden" name="state" value="listing" />'."\n".
319: '<input type="submit" name="catalogfilter" value="'.
320: &mt('Display courses').'" />'.
321: '<input type="hidden" name="numtitles" value="'.$numtitles.
1.37 raeburn 322: '" /></form><br /><br />');
1.5 raeburn 323: } else {
1.45 raeburn 324: $js = '<script type"text/javascript">'."\n$catjs\n".'</script>';
1.30 raeburn 325: &cat_header($r,$codedom,$js,\%add_entries,$catlinks,$numtitles);
326: my $cat_maxdepth = $env{'form.catalog_maxdepth'};
327: $r->print('<form name="'.$formname.'" method="post" action="/adm/coursecatalog">'.
328: '<input type="hidden" name="catalog_maxdepth" value="'.$cat_maxdepth.'" />'.
329: '<input type="hidden" name="showdom" value="'.$env{'form.showdom'}.'" />'.
330: '<input type="hidden" name="currcat_0" value="instcode::0" />');
331: $r->print('<br />'.&mt('No official courses to display for [_1].',$domdesc).'</form>');
1.1 raeburn 332: }
1.18 raeburn 333: return $numtitles;
1.1 raeburn 334: }
335:
1.28 raeburn 336: sub cat_header {
337: my ($r,$codedom,$js,$add_entries,$catlinks,$numtitles) = @_;
338: my $start_page =
1.72 ! raeburn 339: &Apache::loncommon::start_page('Course/Community Catalog',$js,
1.59 droeschl 340: { 'add_entries' => $add_entries, });
1.28 raeburn 341: $r->print($start_page);
1.60 raeburn 342: my $brtext = 'Course listing';
343: if ($env{'form.currcat_0'} eq 'communities::0') {
344: $brtext = 'Community listing';
345: }
1.28 raeburn 346: if ($env{'form.state'} eq 'listing') {
347: if ($numtitles > 0) {
348: &Apache::lonhtmlcommon::add_breadcrumb
349: ({href=>"/adm/coursecatalog",
1.56 bisitz 350: text=>"Course/Community Catalog"},
1.60 raeburn 351: {text=>$brtext});
1.28 raeburn 352: } else {
353: &Apache::lonhtmlcommon::add_breadcrumb
1.60 raeburn 354: ({text=>$brtext});
1.28 raeburn 355: }
356: } else {
357: &Apache::lonhtmlcommon::add_breadcrumb
358: ({href=>"/adm/coursecatalog",
1.56 bisitz 359: text=>"Course/Community Catalog"});
1.28 raeburn 360: }
1.55 raeburn 361: $r->print(&Apache::lonhtmlcommon::breadcrumbs('Course/Community Catalog'));
1.62 bisitz 362: my $onchange = 'this.form.submit()';
1.34 raeburn 363: $r->print('<form name="coursecatdom" method="post" action="/adm/coursecatalog">'.
364: '<table border="0"><tr><td><b>'.&mt('Domain:').'</b></td><td>'.
1.47 raeburn 365: &Apache::loncommon::select_dom_form($codedom,'showdom','',1,$onchange));
366: if (!$onchange) {
367: $r->print(' <input type="submit" name="godom" value="'.&mt('Change').'" />');
368: }
369: $r->print('</td></tr></table></form>'.
1.46 raeburn 370: '<form name="coursecats" method="post" action="/adm/coursecatalog"'.
1.48 raeburn 371: ' onsubmit="return check_selected();">'.
1.34 raeburn 372: '<table border="0"><tr>'.$catlinks.'</tr></table></form>');
1.28 raeburn 373: return;
374: }
375:
376: sub category_breadcrumbs {
1.35 raeburn 377: my ($dom,@cats) = @_;
1.44 raeburn 378: my $crumbsymbol = ' ▶ ';
1.33 raeburn 379: my ($currdepth,$deeper) = &get_depth_values();
1.57 raeburn 380: my $currcat_str =
381: '<input type="hidden" name="catalog_maxdepth" value="'.$deeper.'" />'.
382: '<input type="hidden" name="showdom" value="'.$dom.'" />';
1.58 raeburn 383: my $catlinks = '<td valign="top"><b>'.&mt('Catalog:').'</b></td><td><table><tr><td>';
1.36 raeburn 384: my $has_subcats;
1.46 raeburn 385: my $selitem;
1.58 raeburn 386: if (ref($cats[0]) eq 'ARRAY') {
387: if (@{$cats[0]} == 0) {
388: $catlinks .= &mt('No categories defined in this domain');
389: } elsif (@{$cats[0]} == 1) {
390: if ($cats[0][0] eq 'instcode') {
391: $catlinks .= &mt('Official courses (with institutional codes)');
392: $env{'form.currcat_0'} = 'instcode::0';
393: } elsif ($cats[0][0] eq 'communities') {
394: $catlinks .= &mt('Communities');
395: $env{'form.currcat_0'} = 'communities::0';
396: } else {
397: my $name = $cats[0][0];
398: my $item = &escape($name).'::0';
399: $catlinks .= $name;
400: $env{'form.currcat_0'} = $item;
1.46 raeburn 401: }
1.58 raeburn 402: $currcat_str .= '<input type="hidden" name="currcat_0" value="'.$env{'form.currcat_0'}.'" />';
1.28 raeburn 403: } else {
1.58 raeburn 404: $catlinks .= &main_category_selector(@cats);
405: if (($env{'form.currcat_0'} ne '') &&
406: ($env{'form.currcat_0'} ne 'instcode::0')) {
407: $catlinks .= $crumbsymbol;
408: } else {
409: $catlinks .= '</td>';
410: }
411: }
412: } else {
413: $catlinks .= &mt('Official courses (with institutional codes)');
414: $env{'form.currcat_0'} = 'instcode::0';
415: $currcat_str .= '<input type="hidden" name="currcat_0" value="'.$env{'form.currcat_0'}.'" />';
416: }
417: if ($deeper) {
418: for (my $i=1; $i<=$deeper; $i++) {
419: my $shallower = $i-1;
420: next if ($shallower == 0);
1.28 raeburn 421: my ($cat,$container,$depth) = map { &unescape($_); } split(/:/,$env{'form.currcat_'.$shallower});
1.58 raeburn 422: if ($cat ne '') {
423: $catlinks .= '<td valign="top">'.
424: '<select name="currcat_'.$shallower.'" onchange="'.
425: 'setCatDepth('."'$shallower'".');this.form.submit();">';
426: if (ref($cats[$shallower]{$container}) eq 'ARRAY') {
427: $catlinks .= '<option value="">'.&mt('De-select').'</option>';
428: for (my $j=0; $j<@{$cats[$shallower]{$container}}; $j++) {
429: my $name = $cats[$shallower]{$container}[$j];
1.65 raeburn 430: my $item = &escape($name).':'.&escape($container).':'.$shallower;
1.58 raeburn 431: my $selected = '';
432: if ($item eq $env{'form.currcat_'.$shallower}) {
433: $selected = ' selected="selected"';
434: }
435: $catlinks .=
436: '<option value="'.$item.'"'.$selected.'>'.$name.'</option>';
1.28 raeburn 437: }
438: }
1.58 raeburn 439: $catlinks .= '</select>';
1.28 raeburn 440: }
1.58 raeburn 441: unless ($i == $deeper) {
442: $catlinks .= $crumbsymbol;
443: }
1.28 raeburn 444: }
1.29 raeburn 445: my ($cat,$container,$depth);
446: if ($env{'form.currcat_'.$currdepth} eq '') {
447: my $shallower = $currdepth - 1;
448: ($cat,$container,$depth) = map { &unescape($_); } split(/:/,$env{'form.currcat_'.$shallower});
449: } else {
450: ($cat,$container,$depth) = map { &unescape($_); } split(/:/,$env{'form.currcat_'.$currdepth});
451: }
1.58 raeburn 452: my $deeperlevel = $depth +1;
453: if (ref($cats[$deeperlevel]{$cat}) eq 'ARRAY') {
1.36 raeburn 454: $has_subcats = 1;
1.46 raeburn 455: my $buttontext = &mt('Show subcategories');
1.58 raeburn 456: my $selitem = 'currcat_'.$deeperlevel;
457: $catlinks .= ' <select name="'.$selitem.'" onchange="this.form.submit()">';
458: if (@{$cats[$deeperlevel]{$cat}}) {
1.46 raeburn 459: $catlinks .= '<option value="" selected="selected">'.
1.58 raeburn 460: &mt('Subcategory ...').'</option>';
1.46 raeburn 461: }
1.58 raeburn 462: for (my $k=0; $k<@{$cats[$deeperlevel]{$cat}}; $k++) {
463: my $name = $cats[$deeperlevel]{$cat}[$k];
464: my $item = &escape($name).':'.&escape($cat).':'.$deeperlevel;
1.28 raeburn 465: $catlinks .= '<option value="'.$item.'">'.$name.'</option>'."\n";
466: }
1.58 raeburn 467: $catlinks .= '</select>'."\n";
1.46 raeburn 468: } elsif ($cat ne 'instcode') {
469: $catlinks .= ' '.&mt('(No subcategories)');
1.28 raeburn 470: }
1.58 raeburn 471: } else {
472: $selitem = 'currcat_0';
1.28 raeburn 473: }
474: $catlinks .= $currcat_str.'</td></tr></table></td>';
1.46 raeburn 475: return ($catlinks,$has_subcats,$selitem);
1.28 raeburn 476: }
477:
1.58 raeburn 478: sub main_category_selector {
479: my (@cats) = @_;
480: my $maincatlinks = '<select name="currcat_0" onchange="setCatDepth('."'0'".');this.form.submit();">'."\n";
481: if (ref($cats[0]) eq 'ARRAY') {
482: if (@{$cats[0]} > 1) {
483: my $selected = '';
484: if ($env{'form.currcat_0'} eq '') {
485: $selected = ' selected="selected"';
486: }
487: $maincatlinks .=
488: '<option value=""'.$selected.'>'.&mt('Select').'</option>'."\n";
489: }
490: for (my $i=0; $i<@{$cats[0]}; $i++) {
491: my $name = $cats[0][$i];
492: my $item = &escape($name).'::0';
493: my $selected;
494: if ($env{'form.currcat_0'} eq $item) {
495: $selected = ' selected="selected"';
496: }
497: $maincatlinks .= '<option value="'.$item.'"'.$selected.'>';
498: if ($name eq 'instcode') {
499: $maincatlinks .= &mt('Official courses (with institutional codes)');
500: } elsif ($name eq 'communities') {
501: $maincatlinks .= &mt('Communities');
502: } else {
503: $maincatlinks .= $name;
504: }
505: $maincatlinks .= '</option>'."\n";
506: }
507: $maincatlinks .= '</select>'."\n";
508: }
509: return $maincatlinks;
510: }
511:
1.33 raeburn 512: sub get_depth_values {
513: my $currdepth = 0;
514: my $deeper = 0;
515: if ($env{'form.catalog_maxdepth'} ne '') {
516: $currdepth = $env{'form.catalog_maxdepth'};
517: if ($env{'form.currcat_'.$currdepth} eq '') {
518: $deeper = $currdepth;
519: } else {
520: $deeper = $currdepth + 1;
521: }
522: }
523: return ($currdepth,$deeper);
524: }
525:
526: sub additional_filters {
1.36 raeburn 527: my ($codedom,$has_subcats) = @_;
1.72 ! raeburn 528: my $is_dc = &user_is_dc($codedom);
! 529: my $output = '<div class="LC_left_float">';
! 530: if ($is_dc) {
! 531: $output .= '<fieldset><legend>'.&mt('Options').'</legend>';
! 532: }
! 533: $output .= '<table><tr><td valign="top">';
! 534: if (($env{'form.currcat_0'} ne 'instcode::0') &&
1.36 raeburn 535: ($env{'form.currcat_0'} ne '') && ($has_subcats)) {
536: my $include_subcat_status;
537: if ($env{'form.withsubcats'}) {
538: $include_subcat_status = 'checked="checked" ';
539: }
540: my $counter = $env{'form.catalog_maxdepth'};
541: if ($counter > 0) {
542: if ($env{'form.state'} eq 'listing') {
543: $counter --;
544: } elsif ($env{'form.currcat_'.$counter} eq '') {
545: $counter --;
546: }
547: }
548: my ($catname) = split(/:/,$env{'form.currcat_'.$counter});
549: if ($catname ne '') {
1.72 ! raeburn 550: $output .= '<span class="LC_nobreak"><label>'.
1.36 raeburn 551: '<input type="checkbox" name="withsubcats" value="1" '.
552: $include_subcat_status.'/>'.
1.38 raeburn 553: &mt('Include subcategories within "[_1]"',
1.72 ! raeburn 554: &unescape($catname)).'</label></span><br />';
1.36 raeburn 555: }
556: }
1.33 raeburn 557: my $show_selfenroll_status;
558: if ($env{'form.showselfenroll'}) {
559: $show_selfenroll_status = 'checked="checked" ';
560: }
1.57 raeburn 561: my $selfenroll_text;
562: if ($env{'form.currcat_0'} eq 'communities::0') {
1.69 raeburn 563: $selfenroll_text = &mt('Only show communities which currently allow self-enrollment (or will allow it in the future)');
1.57 raeburn 564: } else {
1.69 raeburn 565: $selfenroll_text = &mt('Only show courses which currently allow self-enrollment (or will allow it in the future)');
1.57 raeburn 566: }
1.72 ! raeburn 567: $output .= '<span class="LC_nobreak">'.
1.36 raeburn 568: '<label><input type="checkbox" name="showselfenroll" value="1" '.
1.57 raeburn 569: $show_selfenroll_status.'/>'.$selfenroll_text.
1.72 ! raeburn 570: '</label></span><br />';
! 571: if ($is_dc) {
! 572: my ($titlesref,$orderref) = &get_statustitles('filters');
1.33 raeburn 573: my $showdetails_status;
574: if ($env{'form.showdetails'}) {
575: $showdetails_status = 'checked="checked" ';
576: }
577: my $showhidden_status;
578: if ($env{'form.showhidden'}) {
1.72 ! raeburn 579: $showhidden_status = 'checked="checked" ';
1.33 raeburn 580: }
1.72 ! raeburn 581: my @currstatuses = &Apache::loncommon::get_env_multiple('form.showcounts');
1.33 raeburn 582: my $dc_title = &Apache::lonnet::plaintext('dc');
1.72 ! raeburn 583: my ($details_text,$hidden_text,$statusdisplay,$cellborder);
! 584: my $wasactivedisplay = 'none';
! 585: if ($env{'form.showdetails'}) {
! 586: $statusdisplay = 'block';
! 587: $cellborder = 'border-left: 1px solid;';
! 588: if (grep(/^Previous$/,@currstatuses)) {
! 589: $wasactivedisplay = 'block';
! 590: }
! 591: } else {
! 592: $statusdisplay = 'none';
! 593: $cellborder = 'border-left: 0px';
! 594: }
1.57 raeburn 595: if ($env{'form.currcat_0'} eq 'communities::0') {
596: $details_text = &mt('Show full details for each community ([_1] only)',$dc_title);
597: $hidden_text = &mt('Include communities set to be hidden from catalog ([_1] only)',$dc_title);
598: } else {
599: $details_text = &mt('Show full details for each course ([_1] only)',$dc_title);
600: $hidden_text = &mt('Include courses set to be hidden from catalog ([_1] only)',$dc_title);
601: }
1.72 ! raeburn 602: $output .= '<span class="LC_nobreak">'.
1.33 raeburn 603: '<label><input type="checkbox" name="showhidden" value="1" '.
1.57 raeburn 604: $showhidden_status.'/>'.$hidden_text.
1.72 ! raeburn 605: '</label></span><br />'."\n".
! 606: '<span class="LC_nobreak">'.
! 607: '<label><input type="checkbox" name="showdetails" value="1" '.
! 608: $showdetails_status.'onclick="toggleStatuses();" />'.
! 609: $details_text.'</label></span></td>'."\n".
! 610: '<td id="statuscell" valign="top" style="'.$cellborder.'">'.
! 611: '<div id="statuschoice" style="display:'.$statusdisplay.'">';
! 612: if (ref($orderref) eq 'ARRAY') {
! 613: if (@{$orderref} > 0) {
! 614: foreach my $type (@{$orderref}) {
! 615: my $checked;
! 616: if (grep(/^\Q$type\E$/,@currstatuses)) {
! 617: $checked = ' checked="checked"';
! 618: }
! 619: my $title;
! 620: if (ref($titlesref) eq 'HASH') {
! 621: $title = $titlesref->{$type};
! 622: }
! 623: unless ($title) {
! 624: $title = &mt($type);
! 625: }
! 626: my $onclick;
! 627: if ($type eq 'Previous') {
! 628: $onclick = ' onclick="toggleWasActive();"';
! 629: }
! 630: $output .= '<span class="LC_nobreak">'.
! 631: '<label><input type="checkbox" id="counts_'.$type.'"'.
! 632: ' name="showcounts" value="'.$type.'"'.$checked.$onclick.
! 633: ' />'.$title.'</label></span>';
! 634: if ($type eq 'Previous') {
! 635: my %milestonetext = &Apache::lonlocal::texthash (
! 636: accessend => 'prior to default end access date',
! 637: enrollend => 'prior to end date for auto-enrollment',
! 638: date => 'prior to specific date:',
! 639: );
! 640: my @statuses = &Apache::loncommon::get_env_multiple('form.showcounts');
! 641: $output .= '<span id="choosewasacctext">';
! 642: if ($checked) {
! 643: $output .= &get_wasactive_text();
! 644: }
! 645: $output .= '</span>'.
! 646: '<div id="choosewasactive" style="display:'.$wasactivedisplay.'">'.
! 647: '<table>';
! 648: my @milestones = ('accessend');
! 649: if (&Apache::lonnet::auto_run(undef,$codedom)) {
! 650: push(@milestones,'enrollend');
! 651: }
! 652: push(@milestones,'date');
! 653: foreach my $item (@milestones) {
! 654: my $checked;
! 655: if ($env{'form.state'} eq 'listing') {
! 656: if ($env{'form.wasactive'} eq $item) {
! 657: $checked = ' checked="checked"';
! 658: }
! 659: } elsif ($item eq 'accessend') {
! 660: $checked = ' checked="checked"';
! 661: }
! 662: $output .=
! 663: '<tr><td width="10"> </td><td>'.
! 664: '<span class="LC_nobreak"><label>'.
! 665: '<input type="radio" value="'.$item.'" name="wasactive"'.$checked.' />'.
! 666: $milestonetext{$item}.'</label></span>';
! 667: if ($item eq 'date') {
! 668: my $wasactiveon;
! 669: if (grep(/^Previous$/,@currstatuses)) {
! 670: $wasactiveon =
! 671: &Apache::lonhtmlcommon::get_date_from_form('wasactiveon');
! 672: } else {
! 673: $wasactiveon = 'now';
! 674: }
! 675: $output .= ' '.
! 676: &Apache::lonhtmlcommon::date_setter('coursecatalog',
! 677: 'wasactiveon',
! 678: $wasactiveon,
! 679: '','','',1,'',
! 680: '','',1);
! 681: }
! 682: $output .= '</td></tr>';
! 683: }
! 684: $output .= '</table></div>';
! 685: }
! 686: $output .= '<br />';
! 687: }
! 688: }
! 689: }
! 690: $output .= '</div></td>';
! 691: } else {
! 692: $output .= '</td>';
1.33 raeburn 693: }
1.72 ! raeburn 694: $output .= '</tr></table></fieldset></div>'.
! 695: '<div style="clear:both;margin:0;"></div>';
1.33 raeburn 696: return $output;
697: }
698:
1.16 raeburn 699: sub user_is_dc {
700: my ($codedom) = @_;
701: if (exists($env{'user.role.dc./'.$codedom.'/'})) {
702: my $livedc = 1;
703: my $now = time;
704: my ($start,$end)=split(/\./,$env{'user.role.dc./'.$codedom.'/'});
705: if ($start && $start>$now) { $livedc = 0; }
706: if ($end && $end <$now) { $livedc = 0; }
707: return $livedc;
708: }
709: return;
710: }
1.7 raeburn 711:
1.72 ! raeburn 712: sub get_statustitles {
! 713: my ($caller) = @_;
! 714: my @status_order = ('Active','Future','Previous');
! 715: my %status_title;
! 716: if ($caller eq 'filters') {
! 717: %status_title = &Apache::lonlocal::texthash(
! 718: Previous => 'Show count for past access',
! 719: Active => 'Show count for current student access',
! 720: Future => 'Show count for future student access',
! 721: );
! 722: if ($env{'form.currcat_0'} eq 'communities::0') {
! 723: $status_title{'Active'} = 'Show count for current member access';
! 724: $status_title{'Future'} = 'Show count for future member access';
! 725: }
! 726: } else {
! 727: %status_title = &Apache::lonlocal::texthash(
! 728: Previous => 'Previous access',
! 729: Active => 'Current access',
! 730: Future => 'Future access',
! 731: );
! 732: }
! 733: return (\%status_title,\@status_order);
! 734: }
! 735:
! 736: sub get_wasactive_text {
! 737: my $wasacctext = ' -- ';
! 738: if ($env{'form.currcat_0'} eq 'communities::0') {
! 739: $wasacctext .= &mt('where members had access ...');
! 740: } else {
! 741: $wasacctext .= &mt('where students had access ...');
! 742: }
! 743: $wasacctext .= '<br />';
! 744: return $wasacctext;
! 745: }
! 746:
1.28 raeburn 747: sub search_official_courselist {
1.63 raeburn 748: my ($domain,$numtitles,$codetitles) = @_;
749: my $instcode = &Apache::courseclassifier::instcode_search_str($domain,$numtitles,$codetitles);
1.32 raeburn 750: my $showhidden;
751: if (&user_is_dc($domain)) {
752: $showhidden = $env{'form.showhidden'};
753: }
754: my %courses =
755: &Apache::lonnet::courseiddump($domain,'.',1,$instcode,'.','.',undef,undef,
756: 'Course',1,$env{'form.showselfenroll'},undef,
757: $showhidden,'coursecatalog');
1.7 raeburn 758: return %courses;
759: }
760:
1.28 raeburn 761: sub search_courselist {
1.36 raeburn 762: my ($domain,$subcats) = @_;
1.28 raeburn 763: my $cat_maxdepth = $env{'form.catalog_maxdepth'};
764: my $filter = $env{'form.currcat_'.$cat_maxdepth};
1.29 raeburn 765: if (($filter eq '') && ($cat_maxdepth > 0)) {
766: my $shallower = $cat_maxdepth - 1;
767: $filter = $env{'form.currcat_'.$shallower};
768: }
1.28 raeburn 769: my %courses;
1.36 raeburn 770: my $filterstr;
1.28 raeburn 771: if ($filter ne '') {
1.36 raeburn 772: if ($env{'form.withsubcats'}) {
773: if (ref($subcats) eq 'HASH') {
774: if (ref($subcats->{$filter}) eq 'ARRAY') {
775: $filterstr = join('&',@{$subcats->{$filter}});
776: if ($filterstr ne '') {
777: $filterstr = $filter.'&'.$filterstr;
778: }
779: } else {
780: $filterstr = $filter;
781: }
782: } else {
783: $filterstr = $filter;
784: }
785: } else {
786: $filterstr = $filter;
787: }
1.57 raeburn 788: my ($showhidden,$typefilter);
1.32 raeburn 789: if (&user_is_dc($domain)) {
790: $showhidden = $env{'form.showhidden'};
791: }
1.57 raeburn 792: if ($env{'form.currcat_0'} eq 'communities::0') {
793: $typefilter = 'Community';
794: } else {
795: $typefilter = '.';
796: }
1.32 raeburn 797: %courses =
798: &Apache::lonnet::courseiddump($domain,'.',1,'.','.','.',undef,undef,
1.57 raeburn 799: $typefilter,1,$env{'form.showselfenroll'},
1.36 raeburn 800: $filterstr,$showhidden,'coursecatalog');
1.28 raeburn 801: }
802: return %courses;
803: }
1.6 raeburn 804:
1.1 raeburn 805: sub print_course_listing {
1.63 raeburn 806: my ($domain,$numtitles,$trails,$allitems,$subcats,$codetitles) = @_;
1.1 raeburn 807: my $output;
1.7 raeburn 808: my %courses;
1.15 raeburn 809: my $knownuser = &user_is_known();
1.16 raeburn 810: my $details = $env{'form.coursenum'};
811: if (&user_is_dc($domain)) {
812: if ($env{'form.showdetails'}) {
813: $details = 1;
814: }
815: }
1.7 raeburn 816: if ($env{'form.coursenum'} ne '') {
817: %courses = &Apache::lonnet::courseiddump($domain,'.',1,'.','.',
818: $env{'form.coursenum'},
1.33 raeburn 819: undef,undef,'.',1);
1.7 raeburn 820: if (keys(%courses) == 0) {
1.60 raeburn 821: if ($env{'form.currcat_0'} eq 'communities::0') {
822: $output .= &mt('The courseID provided does not match a community in this domain.');
823: } else {
824: $output .= &mt('The courseID provided does not match a course in this domain.');
825: }
1.7 raeburn 826: return $output;
827: }
1.6 raeburn 828: } else {
1.28 raeburn 829: if ($env{'form.currcat_0'} eq 'instcode::0') {
1.63 raeburn 830: %courses = &search_official_courselist($domain,$numtitles,$codetitles);
1.28 raeburn 831: } else {
1.36 raeburn 832: %courses = &search_courselist($domain,$subcats);
1.28 raeburn 833: }
1.7 raeburn 834: if (keys(%courses) == 0) {
1.57 raeburn 835: if ($env{'form.currcat_0'} eq 'communities::0') {
1.71 bisitz 836: $output =
837: '<p class="LC_info">'
838: .&mt('No communities match the criteria you selected.')
839: .'</p>';
1.57 raeburn 840: } else {
1.71 bisitz 841: $output =
842: '<p class="LC_info">'
843: .&mt('No courses match the criteria you selected.')
844: .'</p>';
1.57 raeburn 845: }
1.7 raeburn 846: return $output;
847: }
1.32 raeburn 848: if (($knownuser) && (!$env{'form.showdetails'}) && (!&user_is_dc($domain))) {
1.31 bisitz 849: $output = '<b>'.&mt('Note for students:').'</b> '
850: .&mt('If you are officially enrolled in a course but the course is not listed in your LON-CAPA courses, click the "Show more details" link for the specific course and check the default access dates and/or automated enrollment settings.')
851: .'<br /><br />';
1.8 raeburn 852: }
1.7 raeburn 853: }
1.27 raeburn 854: my $now = time;
855: my %domconfig =
856: &Apache::lonnet::get_dom('configuration',['usercreation'],$domain);
1.72 ! raeburn 857: $output .= &construct_data_table($knownuser,$domain,\%courses,$details,undef,
! 858: $now,\%domconfig,$trails,$allitems);
1.41 raeburn 859: $output .= "\n".'<form name="linklaunch" method="post" action="">'.
1.40 raeburn 860: '<input type="hidden" name="backto" value="coursecatalog" />'.
1.41 raeburn 861: '<input type="hidden" name="courseid" value="" />'.
862: &Apache::lonhtmlcommon::echo_form_input(['catalogfilter','courseid']).'</form>';
1.15 raeburn 863: return $output;
864: }
865:
866: sub construct_data_table {
1.72 ! raeburn 867: my ($knownuser,$domain,$courses,$details,$usersections,$now,$domconfig,
! 868: $trails,$allitems) = @_;
1.7 raeburn 869: my %sortname;
1.16 raeburn 870: if (($details eq '') || ($env{'form.showdetails'})) {
1.7 raeburn 871: $sortname{'Code'} = 'code';
1.35 raeburn 872: $sortname{'Categories'} = 'cats';
1.7 raeburn 873: $sortname{'Title'} = 'title';
1.70 raeburn 874: $sortname{'Owner & Co-owner(s)'} = 'owner';
1.7 raeburn 875: }
1.15 raeburn 876: my $output = &Apache::loncommon::start_data_table().
877: &Apache::loncommon::start_data_table_header_row();
1.35 raeburn 878: my @coltitles = ('Count');
879: if ($env{'form.currcat_0'} eq 'instcode::0') {
880: push(@coltitles,'Code');
881: } else {
882: push(@coltitles,'Categories');
883: }
1.70 raeburn 884: push(@coltitles,('Sections','Crosslisted','Title','Owner & Co-owner(s)'));
1.15 raeburn 885: if (ref($usersections) eq 'HASH') {
886: $coltitles[1] = 'Your Section';
887: }
1.7 raeburn 888: foreach my $item (@coltitles) {
889: $output .= '<th>';
890: if (defined($sortname{$item})) {
891: $output .= '<a href="javascript:changeSort('."'$sortname{$item}'".')">'.&mt($item).'</a>';
1.24 raeburn 892: } elsif ($item eq 'Count') {
893: $output .= ' ';
1.7 raeburn 894: } else {
895: $output .= &mt($item);
896: }
897: $output .= '</th>';
1.1 raeburn 898: }
1.72 ! raeburn 899: my (@fields,%fieldtitles,$wasactiveon);
1.15 raeburn 900: if ($knownuser) {
901: if ($details) {
1.60 raeburn 902: if ($env{'form.currcat_0'} eq 'communities::0') {
1.72 ! raeburn 903: $output .= '<th>'.&mt('Default Access Dates for Members').'</th>'.
! 904: '<th>'.&mt('Member Counts').'</th>';
1.60 raeburn 905: } else {
906: $output .=
907: '<th>'.&mt('Default Access Dates for Students').'</th>'.
908: '<th>'.&mt('Student Counts').'</th>'.
909: '<th>'.&mt('Auto-enrollment of[_1]registered students','<br />').'</th>';
910: }
1.72 ! raeburn 911: my ($titlesref,$orderref) = &get_statustitles();
! 912: my @statuses;
! 913: if (&user_is_dc($domain)) {
! 914: @statuses = &Apache::loncommon::get_env_multiple('form.showcounts');
! 915: if (grep(/^Previous$/,@statuses)) {
! 916: if ($env{'form.wasactive'} eq 'date') {
! 917: $wasactiveon =
! 918: &Apache::lonhtmlcommon::get_date_from_form('wasactiveon');
! 919: } else {
! 920: $wasactiveon = $env{'form.wasactive'};
! 921: }
! 922: }
! 923: if (ref($orderref) eq 'ARRAY') {
! 924: foreach my $status (@{$orderref}) {
! 925: if (grep(/^\Q$status\E$/,@statuses)) {
! 926: push(@fields,$status);
! 927: }
! 928: }
! 929: }
! 930: } else {
! 931: @fields = ('Active','Future');
! 932: }
! 933: foreach my $status (@fields) {
! 934: my $title;
! 935: if (ref($titlesref) eq 'HASH') {
! 936: $title = $titlesref->{$status};
! 937: }
! 938: unless ($title) {
! 939: $title = &mt($status);
! 940: }
! 941: $fieldtitles{$status} = $title;
! 942: }
1.15 raeburn 943: } else {
1.27 raeburn 944: $output .= '<th>'.&mt('Details').'</th>';
1.8 raeburn 945: }
1.1 raeburn 946: }
1.27 raeburn 947: $output .= '<th>'.&mt('Self-enroll (if permitted)').'</th>';
1.7 raeburn 948: &Apache::loncommon::end_data_table_header_row();
1.72 ! raeburn 949: my %numbers;
! 950: my %courseinfo = &build_courseinfo_hash($courses,$knownuser,$domain,$details,
! 951: $usersections,\@fields,\%fieldtitles,
! 952: $wasactiveon,\%numbers);
1.7 raeburn 953: my %Sortby;
1.15 raeburn 954: foreach my $course (sort(keys(%{$courses}))) {
1.7 raeburn 955: if ($env{'form.sortby'} eq 'code') {
956: push(@{$Sortby{$courseinfo{$course}{'code'}}},$course);
1.35 raeburn 957: } elsif ($env{'form.sortby'} eq 'cats') {
958: push(@{$Sortby{$courseinfo{$course}{'categories'}}},$course);
1.7 raeburn 959: } elsif ($env{'form.sortby'} eq 'owner') {
1.22 raeburn 960: push(@{$Sortby{$courseinfo{$course}{'ownerlastnames'}}},$course);
1.7 raeburn 961: } else {
1.25 raeburn 962: my $clean_title = $courseinfo{$course}{'title'};
963: $clean_title =~ s/\W+//g;
964: if ($clean_title eq '') {
965: $clean_title = $courseinfo{$course}{'title'};
966: }
967: push(@{$Sortby{$clean_title}},$course);
1.7 raeburn 968: }
969: }
970: my @sorted_courses;
1.35 raeburn 971: if (($env{'form.sortby'} eq 'code') || ($env{'form.sortby'} eq 'owner') ||
972: ($env{'form.sortby'} eq 'cats')) {
1.7 raeburn 973: @sorted_courses = sort(keys(%Sortby));
1.6 raeburn 974: } else {
1.7 raeburn 975: @sorted_courses = sort { lc($a) cmp lc($b) } (keys(%Sortby));
1.1 raeburn 976: }
1.24 raeburn 977: my $count = 1;
1.72 ! raeburn 978: my $totalsec = 0;
1.7 raeburn 979: foreach my $item (@sorted_courses) {
980: foreach my $course (@{$Sortby{$item}}) {
981: $output.=&Apache::loncommon::start_data_table_row();
1.35 raeburn 982: $output.=&courseinfo_row($courseinfo{$course},$knownuser,$details,
1.72 ! raeburn 983: \$count,$now,$course,$trails,$allitems,\%numbers);
1.7 raeburn 984: $output.=&Apache::loncommon::end_data_table_row();
985: }
1.1 raeburn 986: }
1.72 ! raeburn 987: if (($knownuser) && ($count > 1) && $env{'form.showdetails'}) {
! 988: if (&user_is_dc($domain)) {
! 989: my %lt = &Apache::lonlocal::texthash (
! 990: 'Active' => 'Total current students',
! 991: 'Future' => 'Total future students',
! 992: 'Previous' => 'Total previous students',
! 993: 'courses' => 'Total unique codes and courses without codes',
! 994: 'sections' => 'Total sections',
! 995: 'xlists' => 'Total cross-listings',
! 996: );
! 997: if ($env{'form.currcat_0'} eq 'communities::0') {
! 998: $lt{'courses'} = &mt('Total communities');
! 999: $lt{'Active'} = &mt('Total current members');
! 1000: $lt{'Future'} = &mt('Total future members');
! 1001: $lt{'Previous'} = &mt('Total previous members');
! 1002: }
! 1003: $output .= '<tr class="LC_footer_row">'.
! 1004: '<td colspan="2"> </td>'.
! 1005: '<td colspan="8">'.
! 1006: '<table border="0">';
! 1007: foreach my $item ('courses','sections','xlists') {
! 1008: $output .= '<tr>'.
! 1009: '<td>'.$lt{$item}.'</td>'.
! 1010: '<td align="right">'.$numbers{$item}.'</td>'.
! 1011: '</tr>'."\n";
! 1012: }
! 1013: if (@fields > 0) {
! 1014: foreach my $status (@fields) {
! 1015: $output .= '<tr>'.
! 1016: '<td>'.$lt{$status}.'</td>'.
! 1017: '<td align="right">'.$numbers{$status}.'</td>'.
! 1018: '</tr>'."\n";
! 1019: }
! 1020: }
! 1021: $output .= '</table></td></tr>';
! 1022: }
! 1023: }
1.7 raeburn 1024: $output .= &Apache::loncommon::end_data_table();
1025: return $output;
1026: }
1027:
1028: sub build_courseinfo_hash {
1.72 ! raeburn 1029: my ($courses,$knownuser,$domain,$details,$usersections,$fields,$fieldtitles,
! 1030: $wasactiveon,$numbers) = @_;
1.1 raeburn 1031: my %courseinfo;
1.7 raeburn 1032: my $now = time;
1.72 ! raeburn 1033: my $gettotals;
! 1034: if ((keys(%{$courses}) > 0) && (&user_is_dc($domain)) && ($details)) {
! 1035: $gettotals = 1;
! 1036: }
! 1037: my (%uniquecodes,$nocodes),;
1.15 raeburn 1038: foreach my $course (keys(%{$courses})) {
1.1 raeburn 1039: my $descr;
1.22 raeburn 1040: if (ref($courses->{$course}) eq 'HASH') {
1041: $descr = $courses->{$course}{'description'};
1.1 raeburn 1042: }
1043: my $cleandesc=&HTML::Entities::encode($descr,'<>&"');
1044: $cleandesc=~s/'/\\'/g;
1.10 raeburn 1045: $cleandesc =~ s/^\s+//;
1.1 raeburn 1046: my ($cdom,$cnum)=split(/\_/,$course);
1.39 raeburn 1047: my ($instcode,$singleowner,$ttype,$selfenroll_types,
1.35 raeburn 1048: $selfenroll_start,$selfenroll_end,@owners,%ownernames,$categories);
1.22 raeburn 1049: if (ref($courses->{$course}) eq 'HASH') {
1050: $descr = $courses->{$course}{'description'};
1.23 raeburn 1051: $instcode = $courses->{$course}{'inst_code'};
1.22 raeburn 1052: $singleowner = $courses->{$course}{'owner'};
1053: $ttype = $courses->{$course}{'type'};
1.27 raeburn 1054: $selfenroll_types = $courses->{$course}{'selfenroll_types'};
1055: $selfenroll_start = $courses->{$course}{'selfenroll_start_date'};
1056: $selfenroll_end = $courses->{$course}{'selfenroll_end_date'};
1.35 raeburn 1057: $categories = $courses->{$course}{'categories'};
1.22 raeburn 1058: push(@owners,$singleowner);
1.67 raeburn 1059: if ($courses->{$course}{'co-owners'} ne '') {
1060: foreach my $item (split(/,/,$courses->{$course}{'co-owners'})) {
1.22 raeburn 1061: push(@owners,$item);
1062: }
1063: }
1064: }
1.72 ! raeburn 1065: if ($instcode ne '') {
! 1066: $uniquecodes{$instcode} = 1;
! 1067: } else {
! 1068: $nocodes ++;
! 1069: }
1.22 raeburn 1070: foreach my $owner (@owners) {
1.54 raeburn 1071: my ($ownername,$ownerdom);
1.22 raeburn 1072: if ($owner =~ /:/) {
1073: ($ownername,$ownerdom) = split(/:/,$owner);
1074: } else {
1075: $ownername = $owner;
1076: if ($owner ne '') {
1077: $ownerdom = $cdom;
1078: }
1079: }
1080: if ($ownername ne '' && $ownerdom ne '') {
1081: my %namehash=&Apache::loncommon::getnames($ownername,$ownerdom);
1082: $ownernames{$ownername.':'.$ownerdom} = \%namehash;
1.1 raeburn 1083: }
1084: }
1085: $courseinfo{$course}{'cdom'} = $cdom;
1086: $courseinfo{$course}{'cnum'} = $cnum;
1087: $courseinfo{$course}{'code'} = $instcode;
1.22 raeburn 1088: my @lastnames;
1089: foreach my $owner (keys(%ownernames)) {
1090: if (ref($ownernames{$owner}) eq 'HASH') {
1091: push(@lastnames,$ownernames{$owner}{'lastname'});
1092: }
1093: }
1094: $courseinfo{$course}{'ownerlastnames'} = join(', ',sort(@lastnames));
1.1 raeburn 1095: $courseinfo{$course}{'title'} = $cleandesc;
1.22 raeburn 1096: $courseinfo{$course}{'owner'} = $singleowner;
1.27 raeburn 1097: $courseinfo{$course}{'selfenroll_types'} = $selfenroll_types;
1098: $courseinfo{$course}{'selfenroll_start'} = $selfenroll_start;
1099: $courseinfo{$course}{'selfenroll_end'} = $selfenroll_end;
1.35 raeburn 1100: $courseinfo{$course}{'categories'} = $categories;
1.7 raeburn 1101:
1102: my %coursehash = &Apache::lonnet::dump('environment',$cdom,$cnum);
1103: my @classids;
1104: my @crosslistings;
1.15 raeburn 1105: my ($seclist,$numsec) =
1106: &identify_sections($coursehash{'internal.sectionnums'});
1.7 raeburn 1107: $courseinfo{$course}{'seclist'} = $seclist;
1.15 raeburn 1108: my ($xlist_items,$numxlist) =
1109: &identify_sections($coursehash{'internal.crosslistings'});
1.72 ! raeburn 1110: if (ref($numbers) eq 'HASH') {
! 1111: $numbers->{'sections'} += $numsec;
! 1112: $numbers->{'xlists'} += $numxlist;
! 1113: }
1.7 raeburn 1114: my $showsyllabus = 1; # default is to include a syllabus link
1115: if (defined($coursehash{'showsyllabus'})) {
1116: $showsyllabus = $coursehash{'showsyllabus'};
1117: }
1118: $courseinfo{$course}{'showsyllabus'} = $showsyllabus;
1.15 raeburn 1119: if (((defined($env{'form.coursenum'}) && ($cnum eq $env{'form.coursenum'}))) ||
1.22 raeburn 1120: ($knownuser && ($details == 1))) {
1.72 ! raeburn 1121: my $milestone;
! 1122: if ($wasactiveon eq 'accessend') {
! 1123: if ($coursehash{'default_enrollment_end_date'}) {
! 1124: $milestone = $coursehash{'default_enrollment_end_date'};
! 1125: } else {
! 1126: $milestone = time;
! 1127: }
! 1128: } elsif ($wasactiveon eq 'enrollend') {
! 1129: if ($coursehash{'internal.autoend'}) {
! 1130: $milestone = $coursehash{'internal.autoend'};
! 1131: } else {
! 1132: $milestone = time;
! 1133: }
! 1134: } else {
! 1135: $milestone = $wasactiveon;
! 1136: }
! 1137: $courseinfo{$course}{'counts'} =
! 1138: &count_students($cdom,$cnum,$numsec,$fields,$fieldtitles,$gettotals,
! 1139: $numbers,$milestone);
! 1140: if ($instcode ne '') {
! 1141: $courseinfo{$course}{'autoenrollment'} =
! 1142: &autoenroll_info(\%coursehash,$now,$seclist,$xlist_items,
! 1143: $instcode,\@owners,$cdom,$cnum);
! 1144: }
1.15 raeburn 1145: my $startaccess = '';
1146: my $endaccess = '';
1147: my $accessdates;
1148: if ( defined($coursehash{'default_enrollment_start_date'}) ) {
1149: $startaccess = &Apache::lonlocal::locallocaltime($coursehash{'default_enrollment_start_date'});
1150: }
1151: if ( defined($coursehash{'default_enrollment_end_date'}) ) {
1152: $endaccess = &Apache::lonlocal::locallocaltime($coursehash{'default_enrollment_end_date'});
1153: if ($coursehash{'default_enrollment_end_date'} == 0) {
1.34 raeburn 1154: $endaccess = &mt('No ending date');
1.15 raeburn 1155: }
1156: }
1157: if ($startaccess) {
1.42 bisitz 1158: $accessdates .= '<i>'.&mt('From:[_1]','</i> '.$startaccess).'<br />';
1.7 raeburn 1159: }
1.15 raeburn 1160: if ($endaccess) {
1.42 bisitz 1161: $accessdates .= '<i>'.&mt('To:[_1]','</i> '.$endaccess).'<br />';
1.15 raeburn 1162: }
1.34 raeburn 1163: if (($selfenroll_types ne '') &&
1164: ($selfenroll_end > 0 && $selfenroll_end > $now)) {
1165: my ($selfenroll_start_access,$selfenroll_end_access);
1166: if (($coursehash{'default_enrollment_start_date'} ne
1167: $coursehash{'internal.selfenroll_start_access'}) ||
1168: ($coursehash{'default_enrollment_end_date'} ne
1169: $coursehash{'internal.selfenroll_end_access'})) {
1170: if ( defined($coursehash{'internal.selfenroll_start_access'}) ) {
1171: $selfenroll_start_access = &Apache::lonlocal::locallocaltime($coursehash{'internal.selfenroll_start_access'});
1172: }
1173: if ( defined($coursehash{'default_enrollment_end_date'}) ) {
1174: $selfenroll_end_access = &Apache::lonlocal::locallocaltime($coursehash{'internal.selfenroll_end_access'});
1175: if ($coursehash{'internal.selfenroll_end_access'} == 0) {
1176: $selfenroll_end_access = &mt('No ending date');
1177: }
1178: }
1179: if ($selfenroll_start_access || $selfenroll_end_access) {
1180: $accessdates .= '<br/><br /><i>'.&mt('Self-enrollers:').'</i><br />';
1181: if ($selfenroll_start_access) {
1.42 bisitz 1182: $accessdates .= '<i>'.&mt('From:[_1]','</i> '.$selfenroll_start_access).'<br />';
1.34 raeburn 1183: }
1184: if ($selfenroll_end_access) {
1.42 bisitz 1185: $accessdates .= '<i>'.&mt('To:[_1]','</i> '.$selfenroll_end_access).'<br />';
1.34 raeburn 1186: }
1187: }
1188: }
1189: }
1.15 raeburn 1190: $courseinfo{$course}{'access'} = $accessdates;
1.1 raeburn 1191: }
1.7 raeburn 1192: if ($xlist_items eq '') {
1193: $xlist_items = &mt('No');
1.1 raeburn 1194: }
1.7 raeburn 1195: $courseinfo{$course}{'xlist'} = $xlist_items;
1.1 raeburn 1196: }
1.72 ! raeburn 1197: if (ref($numbers) eq 'HASH') {
! 1198: $numbers->{'courses'} = $nocodes + scalar(keys(%uniquecodes));
! 1199: }
1.7 raeburn 1200: return %courseinfo;
1.1 raeburn 1201: }
1202:
1.7 raeburn 1203: sub count_students {
1.72 ! raeburn 1204: my ($cdom,$cnum,$numsec,$fieldsref,$titlesref,$getcounts,$numbers,$wasactiveon) = @_;
! 1205: my $countslist = '<span class="LC_nobreak">'.
! 1206: &mt('[quant,_1,section,sections,No sections]',$numsec).'</span>';
! 1207: my (@fields,%titles,$showexpired);
! 1208: if ((ref($fieldsref) eq 'ARRAY') && (ref($titlesref) eq 'HASH') &&
! 1209: (ref($numbers) eq 'HASH')) {
! 1210: @fields = @{$fieldsref};
! 1211: %titles = %{$titlesref};
! 1212: if (grep(/^Previous$/,@fields)) {
! 1213: $showexpired = 1;
! 1214: }
! 1215: } else {
! 1216: return;
! 1217: }
1.1 raeburn 1218: my $classlist = &Apache::loncoursedata::get_classlist($cdom,$cnum);
1.7 raeburn 1219: my %student_count = (
1.72 ! raeburn 1220: Active => 0,
! 1221: Future => 0,
! 1222: Previous => 0,
1.7 raeburn 1223: );
1.1 raeburn 1224: my %idx;
1225: $idx{'status'} = &Apache::loncoursedata::CL_STATUS();
1.72 ! raeburn 1226: $idx{'end'} = &Apache::loncoursedata::CL_END();
1.4 albertel 1227: while (my ($student,$data) = each(%$classlist)) {
1.72 ! raeburn 1228: my $status = $data->[$idx{'status'}];
! 1229: if ($status eq 'Expired') {
! 1230: if (($showexpired) &&
! 1231: ($data->[$idx{'end'}] >= $wasactiveon)) {
! 1232: $student_count{'Previous'} ++;
! 1233: }
! 1234: } else {
! 1235: $student_count{$status} ++;
! 1236: }
1.1 raeburn 1237: }
1.72 ! raeburn 1238: if (@fields) {
! 1239: $countslist .= ':<br />';
! 1240: foreach my $status (@fields) {
! 1241: $countslist .= '<span class="LC_nobreak">'.$titles{$status}.': '.
! 1242: $student_count{$status}.'</span><br />';
! 1243: $numbers->{$status} += $student_count{$status};
! 1244: }
1.1 raeburn 1245: }
1.7 raeburn 1246: return $countslist;
1247: }
1248:
1249: sub courseinfo_row {
1.72 ! raeburn 1250: my ($info,$knownuser,$details,$countref,$now,$course,$trails,$allitems,$numbers) = @_;
1.7 raeburn 1251: my ($cdom,$cnum,$title,$ownerlast,$code,$owner,$seclist,$xlist_items,
1.35 raeburn 1252: $accessdates,$showsyllabus,$counts,$autoenrollment,$output,$categories);
1.7 raeburn 1253: if (ref($info) eq 'HASH') {
1254: $cdom = $info->{'cdom'};
1255: $cnum = $info->{'cnum'};
1256: $title = $info->{'title'};
1.22 raeburn 1257: $ownerlast = $info->{'ownerlastnames'};
1.7 raeburn 1258: $code = $info->{'code'};
1259: $owner = $info->{'owner'};
1260: $seclist = $info->{'seclist'};
1261: $xlist_items = $info->{'xlist'};
1262: $accessdates = $info->{'access'};
1263: $counts = $info->{'counts'};
1264: $autoenrollment = $info->{'autoenrollment'};
1265: $showsyllabus = $info->{'showsyllabus'};
1.35 raeburn 1266: $categories = $info->{'categories'};
1.7 raeburn 1267: } else {
1268: $output = '<td colspan="8">'.&mt('No information available for [_1].',
1269: $code).'</td>';
1270: return $output;
1.2 raeburn 1271: }
1.35 raeburn 1272: $output .= '<td>'.$$countref.'</td>';
1273: if ($env{'form.currcat_0'} eq 'instcode::0') {
1274: $output .= '<td>'.$code.'</td>';
1275: } else {
1276: my ($categorylist,@cats);
1277: if ($categories ne '') {
1278: @cats = split('&',$categories);
1279: }
1280: if ((ref($trails) eq 'ARRAY') && (ref($allitems) eq 'HASH')) {
1281: my @categories = map { $trails->[$allitems->{$_}]; } @cats;
1282: $categorylist = join('<br />',@categories);
1283: }
1284: if ($categorylist eq '') {
1285: $categorylist = ' ';
1286: }
1287: $output .= '<td>'.$categorylist.'</td>';
1288: }
1289: $output .= '<td>'.$seclist.'</td>'.
1.7 raeburn 1290: '<td>'.$xlist_items.'</td>'.
1291: '<td>'.$title.' <font size="-2">';
1.2 raeburn 1292: if ($showsyllabus) {
1.40 raeburn 1293: $output .= '<a href="javascript:ToSyllabus('."'$cdom','$cnum'".')">'.&mt('Syllabus').'</a>';
1.7 raeburn 1294: } else {
1295: $output .= ' ';
1.2 raeburn 1296: }
1297: $output .= '</font></td>'.
1.7 raeburn 1298: '<td>'.$ownerlast.'</td>';
1.15 raeburn 1299: if ($knownuser) {
1300: if ($details) {
1.72 ! raeburn 1301: $output .=
! 1302: '<td>'.$accessdates.'</td>'.
! 1303: '<td>'.$counts.'</td>';
! 1304: unless ($env{'form.currcat_0'} eq 'communities::0') {
! 1305: $output .= '<td>'.$autoenrollment.'</td>';
1.60 raeburn 1306: }
1.15 raeburn 1307: } else {
1308: $output .= "<td><a href=\"javascript:setCourseId('$cnum')\">".&mt('Show more details').'</a></td>';
1.8 raeburn 1309: }
1.7 raeburn 1310: }
1.27 raeburn 1311: my $selfenroll;
1312: if ($info->{'selfenroll_types'}) {
1313: my $showstart = &Apache::lonlocal::locallocaltime($info->{'selfenroll_start'});
1314: my $showend = &Apache::lonlocal::locallocaltime($info->{'selfenroll_end'});
1315: if (($info->{'selfenroll_end'} > 0) && ($info->{'selfenroll_end'} > $now)) {
1316: if (($info->{'selfenroll_start'} > 0) && ($info->{'selfenroll_start'} > $now)) {
1317: $output .= '<td>'.&mt('Starts: [_1]','<span class="LC_cusr_emph">'.$showstart.'</span>').'<br />'.&mt('Ends: [_1]','<span class="LC_cusr_emph">'.$showend.'</span>').'</td>';
1318: } else {
1.66 raeburn 1319: $output .= '<td><a href="javascript:ToSelfenroll('."'$course'".')">'.&mt('Enroll in course').'</a><br />';
1320: if ($info->{'selfenroll_end'} == 0) {
1321: $output .= &mt('Available permanently');
1322: } elsif ($info->{'selfenroll_end'} > $now) {
1323: $output .= &mt('Self-enrollment ends: [_1]','<span class="LC_cusr_emph">'.$showend.'</span>');
1324: }
1325: $output .= '</td>';
1.27 raeburn 1326: }
1327: $selfenroll = 1;
1328: }
1329: }
1330: if (!$selfenroll) {
1331: $output .= '<td> </td>';
1332: }
1.24 raeburn 1333: $$countref ++;
1.1 raeburn 1334: return $output;
1335: }
1336:
1337: sub identify_sections {
1338: my ($seclist) = @_;
1339: my @secnums;
1340: if ($seclist =~ /,/) {
1.4 albertel 1341: my @sections = split(/,/,$seclist);
1.1 raeburn 1342: foreach my $sec (@sections) {
1343: $sec =~ s/:[^:]*$//;
1344: push(@secnums,$sec);
1345: }
1346: } else {
1347: if ($seclist =~ m/^([^:]+):/) {
1348: my $sec = $1;
1.4 albertel 1349: if (!grep(/^\Q$sec\E$/,@secnums)) {
1350: push(@secnums,$sec);
1.1 raeburn 1351: }
1352: }
1353: }
1354: @secnums = sort {$a <=> $b} @secnums;
1.39 raeburn 1355: $seclist = join(', ',@secnums);
1.15 raeburn 1356: my $numsec = @secnums;
1357: return ($seclist,$numsec);
1.1 raeburn 1358: }
1359:
1.2 raeburn 1360: sub get_valid_classes {
1.22 raeburn 1361: my ($seclist,$xlist_items,$crscode,$owners,$cdom,$cnum) = @_;
1.2 raeburn 1362: my $response;
1363: my %validations;
1364: @{$validations{'sections'}} = ();
1365: @{$validations{'xlists'}} = ();
1366: my $totalitems = 0;
1367: if ($seclist) {
1.13 raeburn 1368: foreach my $sec (split(/, /,$seclist)) {
1.2 raeburn 1369: my $class = $crscode.$sec;
1.22 raeburn 1370: if (&Apache::lonnet::auto_validate_class_sec($cdom,$cnum,$owners,
1.3 albertel 1371: $class) eq 'ok') {
1.2 raeburn 1372: if (!grep(/^\Q$sec$\E/,@{$validations{'sections'}})) {
1.4 albertel 1373: push(@{$validations{'sections'}},$sec);
1.2 raeburn 1374: $totalitems ++;
1375: }
1376: }
1377: }
1378: }
1379: if ($xlist_items) {
1.13 raeburn 1380: foreach my $item (split(/, /,$xlist_items)) {
1.22 raeburn 1381: if (&Apache::lonnet::auto_validate_class_sec($cdom,$cnum,$owners,
1.3 albertel 1382: $item) eq 'ok') {
1.2 raeburn 1383: if (!grep(/^\Q$item$\E/,@{$validations{'xlists'}})) {
1.4 albertel 1384: push(@{$validations{'xlists'}},$item);
1.2 raeburn 1385: $totalitems ++;
1386: }
1387: }
1388: }
1389: }
1390: if ($totalitems > 0) {
1391: if (@{$validations{'sections'}}) {
1.42 bisitz 1392: $response = &mt('Sections:').' '.
1.14 raeburn 1393: join(', ',@{$validations{'sections'}}).'<br />';
1.2 raeburn 1394: }
1395: if (@{$validations{'xlists'}}) {
1.42 bisitz 1396: $response .= &mt('Courses:').' '.
1.14 raeburn 1397: join(', ',@{$validations{'xlists'}});
1.2 raeburn 1398: }
1399: }
1400: return $response;
1401: }
1402:
1.7 raeburn 1403: sub autoenroll_info {
1.22 raeburn 1404: my ($coursehash,$now,$seclist,$xlist_items,$code,$owners,$cdom,$cnum) = @_;
1.7 raeburn 1405: my $autoenrolldates = &mt('Not enabled');
1406: if (defined($coursehash->{'internal.autoadds'}) && $coursehash->{'internal.autoadds'} == 1) {
1407: my ($autostart,$autoend);
1408: if ( defined($coursehash->{'internal.autostart'}) ) {
1409: $autostart = &Apache::lonlocal::locallocaltime($coursehash->{'internal.autostart'});
1410: }
1411: if ( defined($coursehash->{'internal.autoend'}) ) {
1412: $autoend = &Apache::lonlocal::locallocaltime($coursehash->{'internal.autoend'});
1413: }
1414: if ($coursehash->{'internal.autostart'} > $now) {
1415: if ($coursehash->{'internal.autoend'} && $coursehash->{'internal.autoend'} < $now) {
1416: $autoenrolldates = &mt('Not enabled');
1417: } else {
1418: my $valid_classes =
1419: &get_valid_classes($seclist,$xlist_items,$code,
1.22 raeburn 1420: $owners,$cdom,$cnum);
1.7 raeburn 1421: if ($valid_classes ne '') {
1.42 bisitz 1422: $autoenrolldates = &mt('Not enabled').'<br />'
1423: .&mt('Starts: [_1]',$autostart)
1424: .'<br />'.$valid_classes;
1425: }
1.7 raeburn 1426: }
1427: } else {
1428: if ($coursehash->{'internal.autoend'} && $coursehash->{'internal.autoend'} < $now) {
1.42 bisitz 1429: $autoenrolldates = &mt('Not enabled').'<br />'
1430: .&mt('Ended: [_1]',$autoend);
1.7 raeburn 1431: } else {
1432: my $valid_classes = &get_valid_classes($seclist,$xlist_items,
1.22 raeburn 1433: $code,$owners,$cdom,$cnum);
1.7 raeburn 1434: if ($valid_classes ne '') {
1.42 bisitz 1435: $autoenrolldates = &mt('Currently enabled').'<br />'.
1.7 raeburn 1436: $valid_classes;
1437: }
1438: }
1439: }
1440: }
1441: return $autoenrolldates;
1442: }
1443:
1.8 raeburn 1444: sub user_is_known {
1445: my $known = 0;
1446: if ($env{'user.name'} ne '' && $env{'user.name'} ne 'public'
1447: && $env{'user.domain'} ne '' && $env{'user.domain'} ne 'public') {
1448: $known = 1;
1449: }
1450: return $known;
1451: }
1452:
1.1 raeburn 1453: 1;
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>