File:  [LON-CAPA] / loncom / interface / lonblockingmenu.pm
Revision 1.19: download - view: text, annotated - select for diffs
Sun Oct 16 21:49:51 2016 UTC (7 years, 7 months ago) by raeburn
Branches: MAIN
CVS tags: HEAD
- vpa privilege in a course allows Content Settings to be displayed, but
  not modified (which requires opa priv).
- vcb privilege in a course allows "Exam" Blocking items to be displayed,
  but not modified (which requires dcm priv).

    1: # The LearningOnline Network with CAPA
    2: # Routines for configuring blocking of access to collaborative functions, 
    3: # and specific resources during an exam
    4: #
    5: # $Id: lonblockingmenu.pm,v 1.19 2016/10/16 21:49:51 raeburn Exp $
    6: #
    7: # Copyright Michigan State University Board of Trustees
    8: #
    9: # This file is part of the LearningOnline Network with CAPA (LON-CAPA).
   10: #
   11: # LON-CAPA is free software; you can redistribute it and/or modify
   12: # it under the terms of the GNU General Public License as published by
   13: # the Free Software Foundation; either version 2 of the License, or
   14: # (at your option) any later version.
   15: #
   16: # LON-CAPA is distributed in the hope that it will be useful,
   17: # but WITHOUT ANY WARRANTY; without even the implied warranty of
   18: # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   19: # GNU General Public License for more details.
   20: #
   21: # You should have received a copy of the GNU General Public License
   22: # along with LON-CAPA; if not, write to the Free Software
   23: # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
   24: #
   25: # /home/httpd/html/adm/gpl.txt
   26: #
   27: # http://www.lon-capa.org/
   28: #
   29: ##############################################################
   30: ##############################################################
   31: 
   32: =pod
   33: 
   34: =head1 NAME
   35: 
   36: lonblockingmenu - Handler to set/modify exam blocks in a course.
   37: 
   38: =head1 SYNOPSIS
   39: 
   40: lonblockingmenu provides an interface for setting exam blocks in a course.  
   41: 
   42: =head1 DESCRIPTION
   43: 
   44: This module is used to configure blocking of access to collaborative tools
   45: and/or resources during an exam.
   46: 
   47: =head1 OVERVIEW
   48: 
   49: To support high-stakes testing, LON-CAPA provides Coordinators with the
   50: ability to disable communication and collaborative features within the
   51: system for the duration of an exam.
   52: 
   53: Features which can be disabled include:
   54: (a) those which a student could use to communicate with another student.
   55: Messaging, discussion, chat, blogs, and some functionality in groups fall 
   56: into this category.
   57: (b) those which a student could use to access materials prepared by the
   58: student in advance of an exam, (e.g., for use during an online exam, to
   59: gain an unfair advantage). Blogs and portfolio fall into this category.
   60: (c) those which a student could use to display or save content within
   61: the course itself (outside the exam folder). Printouts and resources
   62: fall into this category.
   63: 
   64: For communication blocking to be truly effective in preventing unwanted
   65: communication, or access to online materials, online testing needs to
   66: take place in a lab setting where use of tools outside LON-CAPA, and use
   67: of web sites beyond LON-CAPA are unavailable.
   68: 
   69: Access to specified folder(s) and/or resources in the course contents 
   70: can be restricted for the duration of an exam.
   71: 
   72: Exam blocks are of two types:
   73: (a) Blocks with a defined start and end date.
   74: (b) Blocks associated with a timed interval set for a specific folder,
   75: or resource.
   76: 
   77: When a student attempts to use a collaboration or communication feature
   78: which is currently blocked, information will be available about the
   79: duration of the block, and the identity of the Course Coordinator who
   80: set the block.
   81: 
   82: Although LON-CAPA communication can be blocked during an exam, course
   83: personnel with the 'evb' (evade blocking) privilege will continue to
   84: receive LON-CAPA messages sent from students in a course with an active
   85: block on messaging. Students will not be able to view messages sent by
   86: other students in the same course for the duration of the blocking event.
   87: 
   88: Because students may be enrolled in more than one LON-CAPA course at a time
   89: it is important to use reasonable time windows for blocking events, or, in
   90: the case of blocks triggered by clicking a button to start a timed quiz, 
   91: quiz durations that are of limited duration. This is especially important
   92: when blocking prtfolio access, as other courses may require students to use
   93: the portfolio as a mechanism for submitting assignments.
   94: 
   95: Information about blocks in a course will be cached for 10 minutes, so,
   96: as with parameters set for resources, it can take up to 10 minutes for
   97: new blocks, or changes to existing blocks, to propagate to other servers.
   98: 
   99: Changes to existing blocks on the server hosting your current session
  100: are available immediately, as cached data on blocks is devalidated
  101: automatically on the current server whenever a change is made to a 
  102: block (including deletion), or when a new block is added. 
  103: 
  104: =head1 INTERNAL SUBROUTINES
  105: 
  106: =over
  107: 
  108: =item &get_permission()
  109: 
  110: Returns information about permission user has to set/modify exam
  111: blocking events.
  112: 
  113: Inputs: None
  114: 
  115: Outputs: 2
  116:     $readonly - true if modification of blocking events is prohibited.
  117: 
  118:     $allowed  - true if blocking events information can be shown.
  119:  
  120: 
  121: =item &get_timed_items()
  122: 
  123: Provides perl data structure with information about timed interval
  124: parameters set in a course.
  125: 
  126: Inputs: 2 (optional)
  127:        $cdom - course's domain
  128: 
  129:        $cnum - course's ID
  130: 
  131: Output: 1 Hash 
  132:        nested hashes containing information about timed interval
  133:        parameters in course). Top level keys are type: course,
  134:        map, resource. Next inner keys are map or symb. Next
  135:        inner keys are scope (all, section, group, users).
  136:        Values are interval (in seconds).
  137: 
  138: =item &blockstore()
  139: 
  140: Stores changes to exam blocks in comm_block.db file for course.
  141: Processes deletions, modifications and additions.
  142: 
  143: Inputs: 4
  144:       $r = request object
  145: 
  146:       $crstype - Container type: Course or Community.
  147: 
  148:       $blockcount - Total number of blocking events in course.
  149: 
  150:       $currblockrecs - Ref to hash of current blocks in course.
  151: 
  152: Outputs: 2
  153:       $changestotal - Total number of changes made.
  154: 
  155:       $output - Information about changes made.
  156: 
  157: 
  158: =item &get_dates_from_form()
  159: 
  160: Extract start and end dates from web form input for blocks with
  161: defined start/end time.
  162: 
  163: Inputs: 1 - $item - numeric ID of current block.
  164: 
  165: Outputs: 2 - $startdate, $enddate (UNIX times for start and end times
  166:              for blocks with defined start/end   
  167: 
  168: 
  169: =item &get_blockdates()
  170: 
  171: Retrieves contents of comm_block.db file for a course.
  172: 
  173: Inputs: 1 - $records - reference to hash to contain blocks 
  174: 
  175: Outputs: 1 - $blockcount - number of blocks
  176: 
  177: Side Effects: populates records hashref.
  178: 
  179: 
  180: =item &get_block_choices()
  181: 
  182: Extract information from web form about which communication/
  183: collaboration features are to be blocked, for a particular event,
  184: and also which content areas will have access blocked for the
  185: duration of the block.
  186: 
  187: Inputs: 3 
  188:     - $item - numeric ID of current block 
  189: 
  190:     - $map_ref - reference to hash mapping numeric IDs to map urls 
  191: 
  192:     - $symb_ref - reference to hash mapping numeric IDs to symbs
  193: 
  194: Outputs: 2
  195:     - $blocktypes - reference to hash of features to be blocked
  196: 
  197:     - $blockdocs - boolean - 0 if no blocking of content, 1 if blocking 
  198:                              of content access 
  199: 
  200: 
  201: =item &check_release_required()
  202: 
  203: Update LON-CAPA version requirements for course if blocked items
  204: (content) or blocking type (triggered by student starting timer)
  205: require specific LON-CAPA version (i.e., 2.11).
  206: 
  207: Inputs: 3 - $value - type of constraint (currently: 'docs', 'printout' or 'timer'),
  208:             $chomemajor - course's home server LON-CAPA major version number.
  209:             $chomeminor - course's home server LON-CAPA minor version number.
  210: 
  211: Outputs: 2 - status ('ok' or 'fail') and LON-CAPA version needed.
  212: 
  213: =over
  214: 
  215:              A status of 'fail' will be returned if the 
  216:              LON-CAPA version installed on the course's 
  217:              home server is older than the version 
  218:              requirement for the blocking type.
  219:              For a trigger type event, the requested
  220:              blocking event will not be added if 
  221:              the course's home server version is old to
  222:              support that type of block.
  223: 
  224: =back
  225: 
  226: Side Effects: &update_released_required() called in lonnet, if
  227:               course's home server version is requied version or 
  228:               newer; will update version requirements for course to
  229:               a more recent version requirement than currently in
  230:               effect.
  231: 
  232: 
  233: =item &display_blocker_status()
  234: 
  235: Generates web form elements used to display, cancel, or modify 
  236: existing blocking events. 
  237: 
  238: Inputs: 8 
  239:       - $r - Apache request object
  240: 
  241:       - $records - Reference to hash of current blocks
  242: 
  243:       - $ltext - Reference to hash of phrases (localized)
  244: 
  245:       - $intervals - Reference to hash of parameters for timed intervals
  246: 
  247:       - $navmap - navmaps object.
  248: 
  249:       - $errormsg - error message for display, if navmaps object
  250:                     could not be instantiated
  251: 
  252:       - $blockcount - number of existing blocking events in course
  253: 
  254:       - $readonly - if true, modification not allowed.
  255:  
  256: 
  257: Output: None
  258: 
  259: Side Effects: prints web form elements (in a table) for current blocks. 
  260: 
  261: =item &convlim()
  262: 
  263: Convert a time interval used for a timed quiz (in seconds) to
  264: days, hours. minutes and seconds.
  265: 
  266: Inputs: 1 - $timelimit  - time interval in seconds
  267: 
  268: Outputs: 1 - $output - time in format: DD days, HH hours, MM minutes, SS seconds  
  269: 
  270: 
  271: =item &display_addblocker_table()
  272: 
  273: Generate web form elements used to define a new blocking event. 
  274: 
  275: Inputs: 6
  276:     - $r - Apache resource object
  277: 
  278:     - $parmcount - current ID for block (same as number of current blocks,
  279:                    block IDs in web form have zero-based index)
  280: 
  281:     - $ltext - reference to hash of phrases (localized)
  282: 
  283:     - $intervals - Reference to hash of parameters for timed intervals
  284: 
  285:     - $navmap - navmaps object
  286: 
  287:     - $errormsg - error message for display, if navmaps object
  288:                   could not be instantiated
  289: 
  290: Outputs: None
  291:  
  292: Side Effects: prints web form elements (in a table) for adding a new block.
  293: 
  294: 
  295: =item &blocker_checkboxes()
  296: 
  297: Generates web form elements in a table for checkboxes used to indicate
  298: which types of communication/collaboration and/or content should be blocked.
  299: 
  300: Inputs: 4 
  301:     - $parmcount - numeric ID of current block
  302: 
  303:     - $blocks - reference to hash of functionalities to block 
  304: 
  305:     - $jschg - text of javascript call to execute when checkbox clicked  
  306:                use within a box via 'onclick="$jchg"'
  307:  
  308:     - $lookups - reference to hash to map urls or symbs to numeric IDs
  309:                  used to populate hodden form elements containing list
  310:                  of resources and folders with access blocking currently set.
  311: 
  312: Output: 1 - HTML for table of checkboxes for current block  
  313: 
  314: 
  315: =item &create_interval_form()
  316: 
  317: Creates web form elements used to select one of the defined timed interval 
  318: items in the course for use in an exam block of type: "Triggered by 
  319: Activating Timer".
  320: 
  321: Inputs: 7 (three required, last four optional)
  322:    - $intervals - Reference to hash of parameters for timed intervals
  323: 
  324:    - $parmcount - numeric ID of current block
  325: 
  326:    - $navmap - navmaps object
  327: 
  328:    - $currkey - current interval (where this is a block already using
  329:                 an interval-based trigger).  
  330: 
  331:    - $jschg - text of javascript call to execute when radiobutton clicked
  332:               use within a box via 'onclick="$jchg"'
  333: 
  334:    - $itemname - name/scope of current interval used for this block 
  335: 
  336:    - $iteminfo - Expandable/collapsible block showing which users are
  337:                  able to activate the timer using the current trigger item.
  338: 
  339: Outputs: 1 - $intervalform - web form elements used to select a time interval
  340: 
  341: 
  342: =item &trigger_details_toggle()
  343:  
  344: Creates link used to expand item showing information about timer for current
  345: trigger for exam block. 
  346: 
  347: Inputs: 1 - $parmcount - numericID of exam block in web form. 
  348: 
  349: Outputs: 1 - returns HTML for link to display contents of information item 
  350: 
  351: =item &show_timer_path()
  352: 
  353: Display hierarchy of names of folders/sub-folders containing the current
  354: item identified as an item with an interval timer set.
  355: 
  356: Inputs: 3
  357:     - $type - map or resource
  358: 
  359:     - $item - map URL or resource symb
  360: 
  361:     - $navmap - navmaps object
  362: 
  363: Outputs: 1 - HTML containing hierarchy of folders/subfolders (raquo entity separated).  
  364: 
  365: 
  366: =item &blocktype_text()
  367: 
  368: Inputs: None
  369: 
  370: Output: 2 
  371:      - $typeorder - reference to array of blockable communication/collaboration/content
  372: 
  373:      - $types -reference to hash of descriptions (localized) of blockable types.
  374:  
  375: 
  376: =item &blockingmenu_javascript()
  377: 
  378: Create Javascript used to launch pop-up used for content selection, and to
  379: toggle visibility of a number of expandable/collapsible divs.
  380: 
  381: Inputs: 1 - $blockcount - Total number of blocks in course's comm_block.db
  382:                           database file. 
  383: 
  384: Output: 1 - Javascript (with <script></script> tags) for functions used to:
  385:             (a) launch pop-up window for selection of course content to which
  386:             access could be blocked. 
  387:             (b) toggle visibility of a number of divs:
  388: 
  389: =over 
  390: 
  391: =item *  for block type - defined dates or timer activated
  392: 
  393: =item *  for action to take -- add or modify block
  394: 
  395: =item *  for display of detailed information about intervals 
  396: 
  397: =back
  398: 
  399: 
  400: =back  
  401: 
  402: =cut
  403: 
  404: package Apache::lonblockingmenu;
  405: 
  406: use strict;
  407: use Apache::lonnet;
  408: use Apache::Constants qw(:common :http);
  409: use Apache::loncommon();
  410: use Apache::lonhtmlcommon();
  411: use Apache::lonparmset();
  412: use Apache::loncourserespicker();
  413: use HTML::Entities();
  414: use Apache::lonlocal;
  415: use lib '/home/httpd/lib/perl/';
  416: use LONCAPA qw(:DEFAULT :match);
  417: 
  418: my $registered_cleanup;
  419: my $modified_courses;
  420: 
  421: sub handler {
  422:     my $r=shift;
  423: 
  424: # ----------------------------------------------------------- Set document type
  425: 
  426:     &Apache::loncommon::content_type($r,'text/html');
  427:     $r->send_http_header;
  428: 
  429:     return OK if $r->header_only;
  430: 
  431:     #  Needs to be in a course
  432:     if (! ($env{'request.course.fn'})) {
  433:         # Not in a course
  434:         $env{'user.error.msg'}=
  435:      "/adm/setblock:dcm:0:0:Cannot set blocking of communications in a course";
  436:         return HTTP_NOT_ACCEPTABLE;
  437:     }
  438: 
  439: # ----------------------------------------------------------- Permissions check
  440: 
  441:     my ($readonly,$allowed) = &get_permission();
  442:     unless ($allowed) {
  443:         $env{'user.error.msg'}=
  444:      "/adm/setblock:dcm:0:0:Cannot view/set blocking of communications in a course";
  445:         return HTTP_NOT_ACCEPTABLE;
  446:     }
  447: 
  448: # -----------------------------Get action and calling context from query string
  449: 
  450:     $registered_cleanup=0;
  451:     @{$modified_courses}=();
  452: 
  453:     &Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},
  454:                                             ['action','caller','block']);
  455: 
  456:     my $crstype = &Apache::loncommon::course_type();
  457:     my $action = $env{'form.action'};
  458:     my %records = ();
  459:     my $blockcount = 0;
  460: 
  461: # ------------------------------------------------------ Retrieve current blocks
  462:     $blockcount = &get_blockdates(\%records);
  463: 
  464: # -------------------- Generate display for pop-up of Maps and Resources blocked   
  465:     if ($action eq 'showdocs') {
  466:         my ($navmap,$errormsg) = 
  467:             &Apache::loncourserespicker::get_navmap_object($crstype,'examblock');
  468:         if (ref($navmap)) {
  469:             my (%blockedmaps,%blockedresources);
  470:             if ($env{'form.block'} =~ /^\d+$/) {
  471:                 my @currblocks = sort(keys(%records));
  472:                 my $block = $currblocks[$env{'form.block'}];
  473:                 if (($block ne '') && (ref($records{$block}) eq 'HASH')) {
  474:                     if (ref($records{$block}{'blocks'}) eq 'HASH') {
  475:                         if (ref($records{$block}{'blocks'}{'docs'}) eq 'HASH') {
  476:                             if (ref($records{$block}{'blocks'}{'docs'}{'maps'}) eq 'HASH') {
  477:                                 %blockedmaps = %{$records{$block}{'blocks'}{'docs'}{'maps'}};
  478:                             }
  479:                             if (ref($records{$block}{'blocks'}{'docs'}{'resources'}) eq 'HASH') {
  480:                                 %blockedresources = %{$records{$block}{'blocks'}{'docs'}{'resources'}};
  481:                             }
  482:                         }
  483:                     }
  484:                 }
  485:             }
  486:             $r->print(&Apache::loncourserespicker::create_picker($navmap,
  487:                                      'examblock','resourceblocks',$crstype,
  488:                                      \%blockedmaps,\%blockedresources,
  489:                                      $env{'form.block'},'','',undef,$readonly));
  490:         } else {
  491:             $r->print($errormsg);
  492:         }
  493:         return OK;
  494:     }
  495: 
  496: # -------------------------- Store changes and retrieve latest block information
  497:     my $storeresult;
  498:     unless ($readonly) {
  499:         if ($env{'form.action'} eq 'store') {
  500:             (my $numchanges,$storeresult) = &blockstore($r,$crstype,$blockcount,\%records);
  501:             if ($numchanges > 0) {
  502:                 $blockcount = &get_blockdates(\%records);
  503:             }
  504:         }
  505:     }
  506: 
  507: # ------------------------------------------------------------------ Breadcrumbs
  508:     &Apache::lonhtmlcommon::clear_breadcrumbs();
  509:     if ($env{'form.caller'} eq 'email') {  
  510:         &Apache::lonhtmlcommon::add_breadcrumb
  511:             ({href=>'/adm/communicate',
  512:               text=>'Communication/Messages',
  513:               faq=>12,bug=>'Communication Tools',});
  514:     } else {
  515:         &Apache::lonhtmlcommon::add_breadcrumb
  516:             ({href=>'/adm/parmset',
  517:               text=>'Content and Problem Settings'});
  518:     }
  519:     &Apache::lonhtmlcommon::add_breadcrumb
  520:         ({href=>'/adm/setblock',
  521:           text=>'Blocking communication/content access'});
  522: 
  523:     my $js = &blockingmenu_javascript($blockcount);
  524: 
  525:     $r->print(
  526:         &Apache::loncommon::start_page('Blocking communication/content access',$js).
  527:         &Apache::lonhtmlcommon::breadcrumbs('Blocking communication/content access'));
  528: 
  529:     my $usertype;
  530:     if ($crstype eq 'Community') {
  531:         $usertype = 'members';
  532:     } else {
  533:         $usertype = 'students';
  534:     }
  535:     my $lctype = lc($crstype);
  536:     my %lt=&Apache::lonlocal::texthash (
  537:             'cbds' => 'Blocking communication and/or content access during exams',
  538:             'prev' => "For the duration of an exam, or a timed quiz, students in this course can be prevented from:",
  539:             'blca' => "Blocks can potentially interrupt legitimate communication between $usertype who are also both enrolled in a different LON-CAPA $lctype.",
  540:             'pobl' => "Portfolio blocking can impact a student's ability to complete assignments in courses besides your own. Please use this feature wisely.",
  541:             'actt' => "Action to take:",
  542:             'addn' => 'Add new blocking event',
  543:             'mexb' => 'Modify existing blocking event(s)', 
  544:             'ncbc' => 'There are no blocking events currently saved.',
  545:             'stor' => 'Save',
  546:     );
  547: 
  548:     my %ltext = &Apache::lonlocal::texthash(
  549:             'type' => 'Type',
  550:             'defs' => 'Defined Start/End',
  551:             'trig' => 'Triggered by Activating Timer', 
  552:             'setb' => 'Set by',
  553:             'even' => 'Event',
  554:             'blck' => 'Blocked?',
  555:             'star' => 'Start',
  556:             'endd' => 'End',
  557:             'chda' => 'Choose dates',
  558:             'chtr' => 'Choose trigger',
  559:             'when' => 'When using defined start/end times for an event, please set dates carefully.',
  560:             'yes'  => 'Yes',
  561:             'no'   => 'No',
  562:     );
  563: 
  564:     $r->print('<h3>'.$lt{'cbds'}.'</h3>');
  565: 
  566: # ---------------------------------------------------- Get Time Limit parameters
  567:     my %intervals = &get_timed_items();
  568: 
  569: # -------------------------------------------- Display information about changes 
  570:     if ($env{'form.action'} eq 'store') {
  571:         $r->print($storeresult);
  572:     } else {
  573:         $r->print(
  574:             $lt{'prev'}.
  575:             '<ul>'."\n".
  576:             '<li>'.&mt("displaying LON-CAPA messages sent by other $usertype in the $lctype").'</li>'."\n".
  577:             '<li>'.&mt("displaying or posting to LON-CAPA discussion boards or live chat in the $lctype").'</li>'."\n".
  578:             '<li>'.&mt('accessing content in LON-CAPA portfolios or blogs').'</li>'."\n".
  579:             '<li>'.&mt("generating printouts of $lctype content").'</li>'.
  580:             '<li>'.&mt("accessing $lctype content in specified folders or resources").'</li>'.
  581:             '<li>'.&mt("changing user's own password").'</li>'.
  582:             '</ul>'.
  583:             '<p class="LC_warning">'.$lt{'blca'}.'<br />'.$lt{'pobl'}.'</p>'
  584:         );
  585:     }
  586: 
  587: # ------------------------ Choose between modifying existing block or adding new
  588:     $r->print('<form name="blockform" method="post" action="/adm/setblock?action=store">');
  589:     
  590:     unless ($readonly) { 
  591:         if ($blockcount > 0) {
  592:             $r->print(<<"END");
  593: <div class="LC_left_float">
  594: <fieldset><legend>$lt{'actt'}</legend>
  595: <span class="LC_nobreak">
  596: <label><input type="radio" name="blockaction" value="modify" id="modifyaction" 
  597: onclick="toggleAddModify();" checked="checked" />$lt{'mexb'}</label>
  598: </span>
  599: <br />
  600: <span class="LC_nobreak">
  601: <label><input type="radio" name="blockaction" value="add" id="addaction" 
  602: onclick="toggleAddModify();" />$lt{'addn'}</label>
  603: </span>
  604: </fieldset>
  605: </div>
  606: <br clear="all" />
  607: <div id="showadd" style="display:none">
  608: END
  609:         } else {
  610:             $r->print($lt{'ncbc'}.'<br /><br />'.
  611:                       '<h4>'.$lt{'addn'}.'</h4>'.
  612:                       '<input type="hidden" name="blockaction" value="add" />');
  613:         }
  614:     }
  615:     my ($navmap,$errormsg) =
  616:         &Apache::loncourserespicker::get_navmap_object($crstype,'examblock');
  617: 
  618: # --------------------------------------------- Interface for adding a new block
  619:     if ($readonly) {
  620:         if (!$blockcount) {
  621:             $r->print($lt{'ncbc'}.'<br />');
  622:         }
  623:     } else {
  624:         &display_addblocker_table($r,$blockcount,\%ltext,\%intervals,
  625:                                   $navmap,$errormsg);
  626:         if ($blockcount > 0) {
  627:             $r->print('</div>');
  628:         }
  629:     }
  630: 
  631: # ------------------------------------------------ Interface for existing blocks
  632:     if ($blockcount > 0) {
  633:         &display_blocker_status($r,\%records,\%ltext,\%intervals,
  634:                                 $navmap,$errormsg,$blockcount,$readonly);
  635:     }
  636:     unless ($readonly) {
  637:         $r->print(<<"END");
  638: <br />
  639: <input type ="submit" value="$lt{'stor'}" />
  640: END
  641:     }
  642:     $r->print('</form>'.
  643:               &Apache::loncommon::end_page());
  644:     return OK;
  645: }
  646: 
  647: sub get_permission {
  648:     my %permission;
  649:     my $allowed = 0;
  650:     my $readonly = 0;
  651:     return ($readonly,$allowed) unless ($env{'request.course.id'});
  652:     if ((&Apache::lonnet::allowed('dcm',$env{'request.course.id'})) ||
  653:         (&Apache::lonnet::allowed('dcm',$env{'request.course.id'}.'/'.
  654:                   $env{'request.course.sec'}))) {
  655:         $allowed = 1;
  656:     } elsif ((&Apache::lonnet::allowed('vcb',$env{'request.course.id'})) ||
  657:              (&Apache::lonnet::allowed('vcb',$env{'request.course.id'}.'/'.
  658:                   $env{'request.course.sec'}))) {
  659:         $readonly = 1;
  660:         $allowed = 1;
  661:     }
  662:     return ($readonly,$allowed);
  663: }
  664: 
  665: sub get_timed_items {
  666:     my ($cdom,$cnum) = @_;
  667:     my ($cid,%intervals);
  668:     if ($cdom eq '' || $cnum eq '') {
  669:         $cid = $env{'request.course.id'};
  670:         $cdom = $env{'course.'.$cid.'.domain'};
  671:         $cnum = $env{'course.'.$cid.'.num'};
  672:     } else {
  673:         $cid = $cdom.'_'.$cnum;
  674:     }
  675:     if ($cid eq '') {
  676:         return %intervals;
  677:     }
  678:     my $resourcedata=&Apache::lonparmset::readdata($cnum,$cdom);
  679:     if (ref($resourcedata) eq 'HASH') {
  680:         foreach my $key (keys(%{$resourcedata})) {
  681:             if ($key =~ /^\Q$cid\E(.+)\.0\.interval$/) {
  682:                 my $middle = $1;
  683:                 if ($middle eq '') {
  684:                     $intervals{'course'}{'all'} = $resourcedata->{$key};
  685:                 } elsif ($middle =~ /^\.\[(\w+)\]$/) {
  686:                     $intervals{'course'}{'secgrp'}{$1} = $resourcedata->{$key};
  687:                 } elsif ($middle =~ /^\.\[useropt\:($match_username\:$match_domain)\]$/) {
  688:                     $intervals{'course'}{'users'}{$1} = $resourcedata->{$key};
  689:                 } elsif ($middle =~ /^\.(.+)\Q___(all)\E$/) {
  690:                     my $inner = $1;
  691:                     if ($inner =~ /^\[(\w+)\]\.([^\]]+)$/) {
  692:                         $intervals{'map'}{$2}{'secgrp'}{$1} = $resourcedata->{$key};
  693:                     } elsif ($inner =~ /^\[useropt\:($match_username\:$match_domain)\]\.([^\]]+)$/) {
  694:                         $intervals{'map'}{$2}{'users'}{$1} = $resourcedata->{$key};
  695:                     } else {
  696:                         $intervals{'map'}{$inner}{'all'} = $resourcedata->{$key};
  697:                     }
  698:                 } elsif ($middle =~ /^\.\[(\w+)\]\.([^\]]+)$/) {
  699:                     $intervals{'resource'}{$2}{'secgrp'}{$1} = $resourcedata->{$key}; 
  700:                 } elsif ($middle =~ /^\.\[useropt\:($match_username\:$match_domain)\]\.([^\]]+)$/) {
  701:                     $intervals{'resource'}{$2}{'users'}{$1} = $resourcedata->{$key};
  702:                 } else {
  703:                     my ($symb) = ($middle =~ /^\.(.+)$/);
  704:                     $intervals{'resource'}{$symb}{'all'} = $resourcedata->{$key};
  705:                 }
  706:             }
  707:         }
  708:     }
  709:     return %intervals;
  710: }
  711: 
  712: sub blockstore {
  713:     my ($r,$crstype,$blockcount,$currblockrecs) = @_;
  714:     my %lt=&Apache::lonlocal::texthash(
  715:             'tfcm' => 'The following changes were made',
  716:             'ncwm' => 'No changes were made.',
  717:             'unna' => 'Unable to retrieve contents of course.', 
  718:     );
  719:     my %adds = ();
  720:     my %removals = ();
  721:     my %cancels = ();
  722:     my $modtotal = 0;
  723:     my $canceltotal = 0;
  724:     my $addtotal = 0;
  725:     my $changestotal = 0;
  726:     my $addtimer = 0;
  727:     my %blocking = ();
  728:     my (%map_url,%resource_symb,%titles,$output);
  729:     $output = '<h3>'.$lt{'head'}.'</h3>';
  730:     if ($env{'form.blockaction'} eq 'modify') {
  731:         foreach my $envkey (keys(%env)) {
  732:             if ($envkey =~ m/^form\.action_(\d+)$/) {
  733:                 if ($env{$envkey} eq 'modify') {
  734:                     $adds{$1} = 1;
  735:                     $removals{$1} = 1;
  736:                 } elsif ($env{$envkey} eq 'cancel') {
  737:                     $cancels{$1} = $1;
  738:                     unless ( defined($removals{$1}) ) {
  739:                         $removals{$1} = 1;
  740:                         $canceltotal ++;
  741:                     }
  742:                 }
  743:             }
  744:         }
  745:     } elsif ($env{'form.blockaction'} eq 'add') {
  746:         $adds{$blockcount} = 1;
  747:     }
  748:     my ($navmap,$errormsg) =
  749:         &Apache::loncourserespicker::get_navmap_object($crstype,'examblock');
  750:     unless (ref($navmap)) {
  751:         $output = $lt{'unna'}.' '.$lt{'ncwm'}.'</br>';
  752:         return ($changestotal,$output);
  753:     }
  754:     &Apache::loncourserespicker::enumerate_course_contents($navmap,\%map_url,\%resource_symb,\%titles,'examblock');
  755:     my $do_releasereq_update;
  756:     my $cdom = $env{'course.'.$env{'request.course.id'}.'.domain'};
  757:     my $cnum = $env{'course.'.$env{'request.course.id'}.'.num'};
  758:     my $chome = $env{'course.'.$env{'request.course.id'}.'.home'};
  759:     my $chostname = &Apache::lonnet::hostname($chome);
  760:     my ($chomemajor,$chomeminor) =
  761:         split(/\./,&Apache::lonnet::get_server_loncaparev($cdom,$chome));
  762: 
  763: 
  764:     foreach my $key (keys(%removals)) {
  765:         my $hashkey = $env{'form.key_'.$key};
  766:         if ($hashkey =~ /firstaccess____/) {
  767:            $do_releasereq_update = 1;
  768:         }
  769:         if (ref($currblockrecs->{$hashkey}) eq 'HASH') {
  770:             if (ref($currblockrecs->{$hashkey}->{'blocks'}) eq 'HASH') {
  771:                 foreach my $type ('docs','printout') {
  772:                     if (exists($currblockrecs->{$hashkey}->{'blocks'}->{$type})) {
  773:                         $do_releasereq_update = 1;
  774:                     }
  775:                 }
  776:             }
  777:         }
  778:         &Apache::lonnet::del('comm_block',["$hashkey"],$cdom,$cnum);
  779:     }
  780:     if ($do_releasereq_update) {
  781:         push(@{$modified_courses},[$cdom,$cnum,$chome,$crstype]);
  782:         unless ($registered_cleanup) {
  783:             my $handlers = $r->get_handlers('PerlCleanupHandler');
  784:             $r->set_handlers('PerlCleanupHandler' => [\&update_releasereq,@{$handlers}]);
  785:             $registered_cleanup=1;
  786:         }
  787:     }
  788:     foreach my $key (keys(%adds)) {
  789:         unless ( defined($cancels{$key}) ) {
  790:             my ($newkey,$status,$needsrelease);;
  791:             if ($env{'form.firstaccess_'.$key}) {
  792:                 my $interval = 
  793:                     &HTML::Entities::decode($env{'form.firstaccess_'.$key});
  794:                 if ($interval ne '') {
  795:                     if ($interval eq 'course') {
  796:                         $newkey = 'firstaccess____'.$interval;
  797:                     } elsif ($interval =~ /___\d+___/) {
  798:                         my ($map,$resid,$url) = 
  799:                             &Apache::lonnet::decode_symb($interval);
  800:                         if (&Apache::lonnet::is_on_map($url)) {
  801:                             $newkey = 'firstaccess____'.$interval;
  802:                         }
  803:                     } elsif (&Apache::lonnet::is_on_map($interval)) {
  804:                         $newkey = 'firstaccess____'.$interval;
  805:                     }
  806:                     if ($newkey ne '') {
  807:                         unless (defined($removals{$key})) {
  808:                             ($status,$needsrelease) = &check_release_required('timer',$chomemajor,$chomeminor);
  809:                             if ($status eq 'fail') {
  810:                                 $newkey = '';
  811:                                 $output .= '<p class="LC_warning">'.
  812:                                            &mt('Triggering of blocking events not allowed for [_1]',
  813:                                                &escape($env{'form.title_'.$key})).'<br />';
  814:                             }
  815:                         }
  816:                     }
  817:                 }
  818:             } else {
  819:                 my ($newstart,$newend) = &get_dates_from_form($key);
  820:                 $newkey = $newstart.'____'.$newend;
  821:             }
  822:             if ($status eq 'fail') {
  823:                 $output .=  &mt('LON-CAPA version ([_1]) installed on home server ([_2]) does not meet version requirements ([_3] or newer).',
  824:                                 $chomemajor.'.'.$chomeminor,$chostname,$needsrelease).'</p>';
  825:             }
  826:             if ($newkey ne '') {
  827:                 my ($blocktypes,$blockdocs) = 
  828:                     &get_block_choices($key,\%map_url,\%resource_symb);
  829:                 if (ref($blocktypes) eq 'HASH') {
  830:                     if ($blocktypes->{'printout'} eq 'on') {
  831:                         ($status,$needsrelease) = &check_release_required('printout',$chomemajor,$chomeminor);
  832:                         if ($status eq 'fail') {
  833:                             $blocktypes->{'printout'} = 'off';
  834:                             $output .= '<p class="LC_warning">'.
  835:                                        &mt('Printout blocking not allowed for [_1]',
  836:                                            &escape($env{'form.title_'.$key})).'<br />';
  837:                         }
  838:                     }
  839:                 }
  840:                 if ($blockdocs) {
  841:                     ($status,$needsrelease) = &check_release_required('docs',$chomemajor,$chomeminor);
  842:                     if ($status eq 'fail') {
  843:                         delete($blocktypes->{'docs'});
  844:                         $output .= '<p class="LC_warning">'.
  845:                                    &mt('Content blocking not allowed for [_1]',
  846:                                        &escape($env{'form.title_'.$key})).'<br />';
  847:                     }
  848:                 }
  849:                 $blocking{$newkey} = {
  850:                           setter => $env{'user.name'}.':'.$env{'user.domain'},
  851:                           event  => &escape($env{'form.title_'.$key}),
  852:                           blocks => $blocktypes,
  853:                         };
  854:                 if (exists($removals{$key})) {
  855:                     $modtotal ++;
  856:                 } else {
  857:                     $addtotal ++;
  858:                 }
  859:             } else {
  860:                 if ($env{'form.toggle_'.$key} eq 'timer') {
  861:                     unless ($status eq 'fail') {
  862:                         $output .= '<p class="LC_warning">'.
  863:                                    &mt('Invalid trigger for new blocking event').
  864:                                    '</p>';
  865:                     }
  866:                 } else {
  867:                     $output .= '<p class="LC_warning">'.
  868:                                &mt('No date range found for new blocking event').
  869:                                '</p>';
  870:                 }
  871:             }
  872:         }
  873:     }
  874:     if ($addtotal + $modtotal > 0) {
  875:         &Apache::lonnet::put('comm_block',\%blocking,
  876:                      $env{'course.'.$env{'request.course.id'}.'.domain'},
  877:                      $env{'course.'.$env{'request.course.id'}.'.num'}
  878:                      );
  879:     }
  880:     $changestotal = $canceltotal + $modtotal + $addtotal;
  881:     if ($changestotal > 0) {
  882:         &Apache::lonnet::devalidate_cache_new('comm_block',
  883:                                               $env{'request.course.id'});
  884:         $output .= $lt{'tfcm'}.'<ul>';
  885:         if ($canceltotal > 0) {
  886:             $output .= '<li>'.
  887:                        &mt('[quant,_1,blocking event was,blocking events were] removed.',
  888:                            $canceltotal).
  889:                        '</li>';
  890:         }
  891:         if ($modtotal > 0) {
  892:             $output .= '<li>'.
  893:                        &mt('[quant,_1,blocking event was,blocking events were] modified.',
  894:                            $modtotal).
  895:                        '</li>';
  896:         }
  897:         if ($addtotal > 0) {
  898:             $output .= '<li>'.
  899:                        &mt('[quant,_1,blocking event was,blocking events were] added.',
  900:                            $addtotal).
  901:                        '</li>';
  902:         }
  903:         $output .= '</ul>';
  904:     } else {
  905:         $output .= $lt{'ncwm'};
  906:     }
  907:     $output .= '<br />';
  908:     return ($changestotal,$output);
  909: }
  910: 
  911: sub update_releasereq {
  912:     my $readmap = 1;
  913:     my $getrelreq = 1;
  914:     if (ref($modified_courses) eq 'ARRAY') {
  915:         foreach my $item (@{$modified_courses}) {
  916:             if (ref($item) eq 'ARRAY') {
  917:                 my ($cdom,$cnum,$chome,$crstype) = @{$item};
  918:                 &Apache::lonrelrequtils::modify_course_relreq(undef,undef,$cnum,$cdom,
  919:                                                               $chome,$crstype,$cdom.'_'.$cnum,
  920:                                                               $readmap,$getrelreq);
  921:             }
  922:         }
  923:         $modified_courses = [];
  924:     }
  925:     undef($registered_cleanup);
  926:     return;
  927: }
  928: 
  929: sub get_dates_from_form {
  930:     my $item = shift;
  931:     my $startdate = &Apache::lonhtmlcommon::get_date_from_form('startdate_'.$item);
  932:     my $enddate   = &Apache::lonhtmlcommon::get_date_from_form('enddate_'.$item);
  933:     return ($startdate,$enddate);
  934: }
  935: 
  936: sub get_blockdates {
  937:     my ($records) = @_;
  938:     my $blockcount = 0;
  939:     %{$records} = &Apache::lonnet::dump('comm_block',
  940:                          $env{'course.'.$env{'request.course.id'}.'.domain'},
  941:                          $env{'course.'.$env{'request.course.id'}.'.num'}
  942:                          );
  943:     $blockcount = keys(%{$records});
  944: 
  945:     if ((keys(%{$records}))[0] =~ /^error: 2 /) {
  946:         $blockcount = 0;
  947:     }
  948:     return $blockcount;
  949: }
  950: 
  951: sub get_block_choices {
  952:     my ($item,$map_ref,$symb_ref) = @_;
  953:     my $blocklist;
  954:     my $blockdocs;
  955:     my ($typeorder,$types) = &blocktype_text();
  956:     foreach my $type (@{$typeorder}) {
  957:         if ($type eq 'docs') {
  958:             if ($env{'form.'.$type.'_'.$item}) {
  959:                 $blocklist->{$type} = {};
  960:                 if ($env{'form.docs_resources_'.$item}) {
  961:                     $env{'form.docs_resources_'.$item} =~ s/,$//;
  962:                     if (ref($symb_ref) eq 'HASH') {
  963:                         my %resources = map { $symb_ref->{$_} => 1; } 
  964:                                             (split(/,/,$env{'form.docs_resources_'.$item}));
  965:                         if (exists($resources{''})) {
  966:                             delete($resources{''});
  967:                         }
  968:                         $blocklist->{$type}->{resources} = \%resources;
  969:                         if (keys(%resources) > 0) {
  970:                             $blockdocs = 1;
  971:                         }
  972:                     }
  973:                 }
  974:                 if ($env{'form.docs_maps_'.$item}) {
  975:                     $env{'form.docs_maps_'.$item} =~ s/,$//;
  976:                     if (ref($map_ref) eq 'HASH') {
  977:                         my %maps = map { $map_ref->{$_} => 1; }                             
  978:                                        (split(/,/,$env{'form.docs_maps_'.$item}));
  979:                         if (exists($maps{''})) {
  980:                             delete($maps{''});
  981:                         }
  982:                         $blocklist->{$type}->{maps} = \%maps;
  983:                         if (keys(%maps) > 0) {
  984:                             $blockdocs = 1;
  985:                         }
  986:                     }
  987:                 }
  988:             }
  989:         } else {
  990:             if ($env{'form.'.$type.'_'.$item}) {
  991:                 $blocklist->{$type} = 'on';
  992:             } else {
  993:                 $blocklist->{$type} = 'off';
  994:             }
  995:         }
  996:     }
  997:     return ($blocklist,$blockdocs);
  998: }
  999: 
 1000: sub check_release_required {
 1001:     my ($value,$chomemajor,$chomeminor) = @_; 
 1002:     my $needsrelease = $Apache::lonnet::needsrelease{'course:commblock:'.$value};
 1003:     if ($needsrelease) {
 1004:         my ($needsmajor,$needsminor) = split(/\./,$needsrelease);
 1005:         if (($chomemajor < $needsmajor) || 
 1006:             (($chomemajor == $needsmajor) && ($chomeminor < $needsminor))) {
 1007:             return ('fail',$needsrelease);
 1008:         }
 1009:         my $curr_required =
 1010:             $env{'course.'.$env{'request.course.id'}.'.internal.releaserequired'};
 1011:         if ($curr_required eq '') {
 1012:             &Apache::lonnet::update_released_required($needsrelease);
 1013:         } else {
 1014:             my ($currmajor,$currminor) = split(/\./,$curr_required);
 1015:             my ($needsmajor,$needsminor) = split(/\./,$needsrelease);
 1016:             if (($currmajor < $needsmajor) || 
 1017:                 ($currmajor == $needsmajor && $currminor < $needsminor)) {
 1018:                 &Apache::lonnet::update_released_required($needsrelease);
 1019:             }
 1020:         }
 1021:     }
 1022:     return ('ok',$needsrelease);
 1023: }
 1024: 
 1025: sub display_blocker_status {
 1026:     my ($r,$records,$ltext,$intervals,$navmap,$errormsg,$blockcount,$readonly) = @_;
 1027:     my $parmcount = 0;
 1028:     my (%map_url,%resource_symb,%titles,%lookups,$disabled);
 1029:     &Apache::loncourserespicker::enumerate_course_contents($navmap,\%map_url,\%resource_symb,\%titles,'examblock');
 1030:     %{$lookups{'maps'}} = reverse(%map_url);
 1031:     %{$lookups{'resources'}} = reverse(%resource_symb);
 1032:     my %lt = &Apache::lonlocal::texthash(
 1033:         'modi' => 'Modify',
 1034:         'dele' => 'Delete',
 1035:         'noch' => 'No change',
 1036:     );
 1037:     $r->print('<div id="showmodify" style="display:block">'.
 1038:               &Apache::loncommon::start_data_table().'<tr>');
 1039:     if ($readonly) {
 1040:         $disabled = ' disabled="disabled"';
 1041:     } else {
 1042:         $r->print('<th></th>');
 1043:     }
 1044:     $r->print(<<"END");
 1045:     <th>$ltext->{'type'}</th>
 1046:     <th>$ltext->{'even'}</th>
 1047:     <th>$ltext->{'blck'}</th>
 1048:   </tr>
 1049: END
 1050:     foreach my $record (sort(keys(%{$records}))) {
 1051:         my $jschg = 
 1052:             'javascript:window.document.forms['. "'blockform'".']'.
 1053:             '.elements['."'action_$parmcount'".'][0].checked=true;';
 1054:         my $onchange = 'onfocus="'.$jschg.'"';
 1055:         my ($setuname,$setudom,$title,$blocks) =
 1056:             &Apache::loncommon::parse_block_record($$records{$record});
 1057:         $title = &HTML::Entities::encode($title,'"<>&');
 1058:         my $blockid = &HTML::Entities::encode($record,'"<>&');
 1059:         my $settername =
 1060:            &Apache::loncommon::aboutmewrapper(
 1061:                            &Apache::loncommon::plainname($setuname,$setudom),
 1062:                            $setuname,$setudom);
 1063:         my $state = '';
 1064:         $r->print(&Apache::loncommon::start_data_table_row());
 1065:         if ($readonly) {
 1066:             $state = 'disabled';
 1067:         } else {
 1068:             $r->print(<<"ACT");
 1069: 
 1070:         <td valign="middle"><span class="LC_nobreak"><label>
 1071:         <input type="radio" name="action_$parmcount" value="modify" />$lt{'modi'}
 1072:         </label></span><br />
 1073:         <span class="LC_nobreak"><label>
 1074:         <input type="radio" name="action_$parmcount" value="cancel" />$lt{'dele'}
 1075:         </label></span><br />
 1076:         <span class="LC_nobreak"><label>
 1077:         <input type="radio" name="action_$parmcount" id="nochange_$parmcount" 
 1078:          value="nochange" checked="checked" />$lt{'noch'}
 1079:         </label></span>
 1080:         </td>
 1081: ACT
 1082:         }
 1083:         my ($start,$end,$startform,$endform); 
 1084:         if ($record =~ /^(\d+)____(\d+)$/) {
 1085:             ($start,$end) = split(/____/,$record);
 1086:             $startform = &Apache::lonhtmlcommon::date_setter('blockform','startdate_'.
 1087:                                                              $parmcount,$start,$onchange,
 1088:                                                              undef,$state);
 1089:             $endform = &Apache::lonhtmlcommon::date_setter('blockform','enddate_'.
 1090:                                                            $parmcount,$end,$onchange,
 1091:                                                            undef,$state);
 1092:             $r->print('<td><fieldset><legend>'.$ltext->{'defs'}.'</legend>'.
 1093:                       $ltext->{'star'}.':&nbsp;'.$startform.'<br />'.
 1094:                       $ltext->{'endd'}.':&nbsp;&nbsp;'.$endform.'</fieldset></td>');
 1095:         } elsif ($record =~ /^firstaccess____(.+)$/) {
 1096:             my $item = $1;
 1097:             my ($itemname,$iteminfo,$skipdetails);
 1098:             my $type = 'map';
 1099:             my $url;
 1100:             if ($item eq 'course') {
 1101:                 $type = 'course';
 1102:             } elsif ($item =~ /___\d+___/) {
 1103:                 $type = 'resource';
 1104:                 (my $map, my $resid, $url) = &Apache::lonnet::decode_symb($item);  
 1105:             } else {
 1106:                 $url = $item;
 1107:             }
 1108:             $r->print('<td><fieldset><legend>'.$ltext->{'trig'}.'</legend>');
 1109:             if ($type eq 'course') {
 1110:                 $itemname = &mt('Timer for all items in course.');
 1111:             } else {
 1112:                 if (&Apache::lonnet::is_on_map($url)) { 
 1113:                     if ($type eq 'map') {
 1114:                         if (ref($navmap)) {
 1115:                             my $title;
 1116:                             my $resobj = $navmap->getResourceByUrl($item);
 1117:                             if (ref($resobj)) { 
 1118:                                 $title = $resobj->compTitle();
 1119:                             } else {
 1120:                                 $title = &Apache::lonnet::gettitle($item);
 1121:                             }
 1122:                             $itemname = &mt('Timer for all items in folder: [_1]',
 1123:                                             '<span style="font-style:italic">'.
 1124:                                             $title.'</span>');
 1125:                         }
 1126:                     } else {
 1127:                         if (ref($navmap)) {
 1128:                             my $title;
 1129:                             my $resobj = $navmap->getBySymb($item);
 1130:                             if (ref($resobj)) {
 1131:                                 $title = $resobj->compTitle();
 1132:                             } else {
 1133:                                 $title = &Apache::lonnet::gettitle($item);
 1134:                             }
 1135:                             $itemname = &mt('Timer for resource: [_1]',
 1136:                                              '<span style="font-style:italic">'.
 1137:                                              $title.'</span>');
 1138:                         }
 1139:                     }
 1140:                     if (ref($navmap)) {
 1141:                         my $path = &show_timer_path($type,$item);
 1142:                         if ($path) {
 1143:                             $iteminfo  = ' <span style="font-size:90%;">'.
 1144:                                          &mt('(in: [_1])',$path).
 1145:                                          '</span>';
 1146:                         }
 1147:                     }
 1148:                 } else {
 1149:                     $skipdetails = 1;
 1150:                     $itemname = '<span style="LC_warning">'.
 1151:                                 &mt('Timer folder/resource not in course').
 1152:                                 '</span>';  
 1153:                 }
 1154:             }
 1155:             if ((!$skipdetails) && (ref($intervals) eq 'HASH')) {
 1156:                 if (ref($intervals->{$type}) eq 'HASH') {
 1157:                     $iteminfo .= &trigger_details_toggle($parmcount).
 1158:                                 '<ul id="trigdetails_'.$parmcount.'" style="display:none">';
 1159:                     if ($type eq 'course') {
 1160:                         foreach my $scope (keys(%{$intervals->{$type}})) {
 1161:                             if ($scope eq 'all') {
 1162:                                 $iteminfo .= '<li>'.&mt('All users -- time limit: [_1]',
 1163:                                          &convlim($intervals->{$type}->{$scope})).'</li>';
 1164:                             } elsif ($scope eq 'secgrp') {
 1165:                                 if (ref($intervals->{$type}->{$scope}) eq 'HASH') {
 1166:                                     $iteminfo .= '<li>'.&mt('Sections/groups').'<ul>';
 1167:                                     foreach my $item (sort(keys(%{$intervals->{$type}->{$scope}}))) {
 1168:                                         $iteminfo .= '<li>'.&mt('[_1] -- time limit: [_2]',$item,
 1169:                                                      &convlim($intervals->{$type}->{$scope}->{$item})).
 1170:                                                      '</li>';
 1171:                                     }
 1172:                                     $iteminfo .= '</ul></li>';
 1173:                                 }
 1174:                             } elsif ($scope eq 'users') {
 1175:                                 if (ref($intervals->{$type}->{$scope}) eq 'HASH') {
 1176:                                     $iteminfo .= '<li>'.&mt('Users').'<ul>'; 
 1177:                                     foreach my $item (sort(keys(%{$intervals->{$type}->{$scope}}))) {
 1178:                                         $iteminfo .= '<li>'.&mt('[_1] -- time limit: [_2]',
 1179:                                                      &convlim($item,$intervals->{$type}->{$scope}->{$item})).
 1180:                                                      '</li>';
 1181:                                     }
 1182:                                     $iteminfo .= '</ul></li>';
 1183:                                 }
 1184:                             }
 1185:                         }
 1186:                     } elsif (($type eq 'map') || ($type eq 'resource')) {
 1187:                         if (ref($intervals->{$type}->{$item}) eq 'HASH') { 
 1188:                             foreach my $scope (keys(%{$intervals->{$type}->{$item}})) {
 1189:                                 if ($scope eq 'all') {
 1190:                                     $iteminfo .= '<li>'.&mt('All users -- time limit: [_1]',
 1191:                                                   &convlim($intervals->{$type}->{$item}->{$scope})).
 1192:                                                   '</li>';
 1193:                                 } elsif ($scope eq 'secgrp') {
 1194:                                     if (ref($intervals->{$type}->{$item}->{$scope}) eq 'HASH') {
 1195:                                         $iteminfo .= '<li>'.&mt('Sections/groups').'<ul>';
 1196:                                         foreach my $sec (sort(keys(%{$intervals->{$type}->{$item}->{$scope}}))) {
 1197:                                             $iteminfo .= '<li>'.&mt('[_1] -- time limit: [_2]',$sec,
 1198:                                                          &convlim($intervals->{$type}->{$item}->{$scope}->{$sec})).
 1199:                                                          '</li>';
 1200:                                         }
 1201:                                         $iteminfo .= '</ul></li>'; 
 1202:                                     }
 1203:                                 } elsif ($scope eq 'users') {
 1204:                                     if (ref($intervals->{$type}->{$item}->{$scope}) eq 'HASH') {
 1205:                                         $iteminfo .= '<li>'.&mt('Users').'<ul>';
 1206:                                         foreach my $user (sort(keys(%{$intervals->{$type}->{$item}->{$scope}}))) {
 1207:                                             $iteminfo .= '<li>'.&mt('[_1] -- time limit: [_2]',$user,
 1208:                                                          &convlim($intervals->{$type}->{$item}->{$scope}->{$user})).
 1209:                                                          '</li>';
 1210:                                         }
 1211:                                         $iteminfo .= '</ul></li>';
 1212:                                     }
 1213:                                 }
 1214:                             }
 1215:                         }
 1216:                     }
 1217:                     $iteminfo .= '</ul>';
 1218:                 }
 1219:             }
 1220:             $r->print(&create_interval_form($intervals,$parmcount,$navmap,$item,$jschg,
 1221:                                             $itemname,$iteminfo,$disabled).'</fieldset></td>');
 1222:         }
 1223:         $r->print(<<"END");
 1224:         <td>
 1225:          <input type="text" name="title_$parmcount" size="15" value="$title" onfocus="$jschg" $disabled />
 1226:          <input type="hidden" name="key_$parmcount" value="$blockid" />
 1227:          <br />
 1228:          <br />
 1229:          $ltext->{'setb'}: $settername
 1230:         </td>
 1231: END
 1232:         $r->print('<td>'.&blocker_checkboxes($parmcount,$blocks,$jschg,\%lookups,$disabled).'</td>'.
 1233:                   &Apache::loncommon::end_data_table_row());
 1234:         $parmcount++;
 1235:     }
 1236:     $r->print(<<"END");
 1237: </table>
 1238: </div>
 1239: END
 1240:     return;
 1241: }
 1242: 
 1243: sub convlim {
 1244:     my ($timelimit) = @_;
 1245:     my @order = ('days','hours','minutes','seconds');
 1246:     my %catlimits = ( 
 1247:                       days    => 86400,
 1248:                       hours   => 3600,
 1249:                       minutes => 60,
 1250:                     );
 1251:     my @toshow;
 1252:     foreach my $cat (@order) {
 1253:         if ($cat eq 'seconds') {
 1254:             if ($timelimit > 0) {
 1255:                 push(@toshow,&mt("[_1] $cat",$timelimit));
 1256:             }
 1257:         } elsif ($timelimit >= $catlimits{$cat}) {
 1258:             my $val = int($timelimit/$catlimits{$cat});
 1259:             if ($val > 0) {
 1260:                 push(@toshow,&mt("[_1] $cat",$val));
 1261:             }
 1262:             $timelimit -= $val*$catlimits{$cat};
 1263:         }
 1264:     }
 1265:     my $output = join(', ',@toshow);
 1266:     return $output;
 1267: }
 1268: 
 1269: sub display_addblocker_table {
 1270:     my ($r,$parmcount,$ltext,$intervals,$navmap,$errormsg) = @_;
 1271:     return unless ((ref($ltext) eq 'HASH') && (ref($intervals) eq 'HASH'));
 1272:     my $start = time;
 1273:     my $end = $start + (60 * 60 * 2); #Default is an exam of 2 hours duration.
 1274:     my $onchange = 'onfocus="javascript:window.document.forms['.
 1275:                    "'blockform'].elements['addaction'].".
 1276:                    'checked=true;"';
 1277:     my $startform = &Apache::lonhtmlcommon::date_setter('blockform','startdate_'.
 1278:                                                         $parmcount,$start,$onchange);
 1279:     my $endform = &Apache::lonhtmlcommon::date_setter('blockform','enddate_'.
 1280:                                                       $parmcount,$end,$onchange);
 1281:     my %lt = &Apache::lonlocal::texthash(
 1282:         'exam' => 'e.g., Exam 1',
 1283:     );
 1284:     my $intervalform = &create_interval_form($intervals,$parmcount,$navmap);
 1285:     if ($intervalform ne '') {
 1286:         $intervalform = '<fieldset>'.
 1287:                         '<legend>'.$ltext->{'chtr'}.'</legend>'.
 1288:                         $intervalform.
 1289:                         '</fieldset>';
 1290:     }
 1291:     $r->print(&Apache::loncommon::start_data_table());
 1292:     $r->print(<<"END");
 1293:    <tr>
 1294:      <th>$ltext->{'type'}</th>
 1295:      <th>$ltext->{'even'} $lt{'exam'}</th>
 1296:      <th>$ltext->{'blck'}</th>
 1297:    </tr>
 1298: END
 1299:     $r->print(&Apache::loncommon::start_data_table_row().'<td>');
 1300:     $r->print(<<"END");
 1301:      <span class="LC_nobreak"><label><input type="radio" id="toggle_startstop" 
 1302:      name="toggle_$parmcount" value="startstop" onclick="showBlockType();" checked="checked" />
 1303:      $ltext->{'defs'}</label></span>&nbsp;&nbsp; 
 1304:      <span class="LC_nobreak"><label><input type="radio" id="toggle_timer" name="toggle_$parmcount" 
 1305:      value="timer" onclick="showBlockType();" />$ltext->{'trig'}</label></span><br />
 1306:      <div id="show_startstop" style="display:block">
 1307:      <fieldset><legend>$ltext->{'chda'}</legend>
 1308:      $ltext->{'star'}:&nbsp;$startform<br />$ltext->{'endd'}:&nbsp;&nbsp;$endform</fieldset>
 1309:      <span class="LC_warning">$ltext->{'when'}</span></div>
 1310:      <div id="show_timer" style="display:none">$intervalform</div>
 1311:      </td>
 1312:      <td><input type="text" name="title_$parmcount" size="15" value="" /></td>
 1313: END
 1314:     $r->print('<td>'.&blocker_checkboxes($parmcount).'</td>'.
 1315:               &Apache::loncommon::end_data_table_row().
 1316:               &Apache::loncommon::end_data_table()."\n".
 1317:               '<br />');
 1318:     return;
 1319: }
 1320: 
 1321: sub blocker_checkboxes {
 1322:     my ($parmcount,$blocks,$jschg,$lookups,$disabled) = @_;
 1323:     my ($typeorder,$types) = &blocktype_text();
 1324:     my $numinrow = 2;
 1325:     my %currdocs;
 1326:     my $output = '<table>';
 1327:     for (my $i=0; $i<@{$typeorder}; $i++) {
 1328:         my $block = $typeorder->[$i];
 1329:         my ($clickaction,$blockstatus);
 1330:         if ($jschg) {
 1331:             $clickaction = $jschg;
 1332:         } 
 1333:         if ($block eq 'docs') {
 1334:             if ((ref($blocks) eq 'HASH') && (ref($lookups) eq 'HASH')) {
 1335:                 if (ref($blocks->{$block}) eq 'HASH') {
 1336:                     if (keys(%{$blocks->{$block}}) > 0) {
 1337:                         $blockstatus = 'checked="checked"';
 1338:                         foreach my $key (sort(keys(%{$blocks->{$block}}))) {
 1339:                             if (ref($blocks->{$block}{$key}) eq 'HASH') {
 1340:                                 my @current = ();
 1341:                                 foreach my $item (keys(%{$blocks->{$block}{$key}})) {
 1342:                                     if ($lookups->{$key}{$item}) {
 1343:                                         push(@current,$lookups->{$key}{$item});
 1344:                                     }
 1345:                                 }
 1346:                                 if (@current > 0) {
 1347:                                     @current=sort { $a <=> $b } (@current);
 1348:                                     $currdocs{$key} = join(',',@current);
 1349:                                 }
 1350:                             }
 1351:                         }
 1352:                     }
 1353:                 }
 1354:             }
 1355:             $clickaction .= 'javascript:resblockinfo('."'$parmcount'".');';
 1356:         } else {
 1357:             if (ref($blocks) eq 'HASH') { 
 1358:                 if ($blocks->{$block} eq 'on') {
 1359:                     $blockstatus = 'checked="checked"';
 1360:                 }
 1361:             }
 1362:         }
 1363:         my $rem = $i%($numinrow);
 1364:         if ($rem == 0) {
 1365:             if ($i > 0) {
 1366:                 $output .= '</tr>';
 1367:             }
 1368:             $output .= '<tr>';
 1369:         }
 1370:         if ($i == scalar(@{$typeorder})-1) {
 1371:             my $colsleft = $numinrow-$rem;
 1372:             if ($colsleft > 1) {
 1373:                 $output .= '<td colspan="'.$colsleft.'">';
 1374:             } else {
 1375:                 $output .= '<td>';
 1376:             }
 1377:         } else {
 1378:             $output .= '<td>';
 1379:         }
 1380:         my $item = $block.'_'.$parmcount;
 1381:         if ($clickaction) {
 1382:             $clickaction = ' onclick="'.$clickaction.'"';
 1383:         }
 1384:         if ($blockstatus) {
 1385:             $blockstatus = ' '.$blockstatus;
 1386:         } 
 1387:         $output .= '<span class="LC_nobreak"><label>'."\n".
 1388:                    '<input type="checkbox" id="'.$item.'" name="'.$item.'"'.
 1389:                    $blockstatus.$clickaction.' value="1"'.$disabled.' />'.
 1390:                    $types->{$block}.'</label></span>'."\n";
 1391:         if ($block eq 'docs') {
 1392:             if ($blockstatus ne '') {
 1393:                 $output .= '&nbsp;<a href="javascript:resblockinfo('."'$parmcount'".')">'.
 1394:                             &mt('Details').'</a>';
 1395:             }
 1396:         }
 1397:         $output .= '<br /></td>';
 1398:     }
 1399:     $output .= '</tr></table>'.
 1400:                '<input type="hidden" name="docs_maps_'.$parmcount.'"'.
 1401:                ' id="docs_maps_'.$parmcount.'" value="'.$currdocs{'maps'}.'" />'.
 1402:                '<input type="hidden" name="docs_resources_'.$parmcount.'"'.
 1403:                ' id="docs_resources_'.$parmcount.'" value="'.$currdocs{'resources'}.'" />';
 1404:     return $output;
 1405: }
 1406: 
 1407: sub create_interval_form {
 1408:     my ($intervals,$parmcount,$navmap,$currkey,$jschg,$itemname,$iteminfo,$disabled) = @_;
 1409:     return unless ((ref($intervals) eq 'HASH') && (ref($navmap)));
 1410:     my $intervalform;
 1411:     if (keys(%{$intervals}) > 0) {
 1412:         foreach my $type (sort(keys(%{$intervals}))) {
 1413:             if ($type eq 'course') {
 1414:                 my ($checked,$clickaction);
 1415:                 if ($currkey eq 'course') {
 1416:                     $checked = ' checked="checked"';
 1417:                 } elsif ($jschg) {
 1418:                     $clickaction = ' onclick="'.$jschg.'"';
 1419:                 }
 1420:                 $intervalform .= '<label><input type="radio" name="firstaccess_'.$parmcount.
 1421:                                  '" value="course"'.$checked.$clickaction.$disabled.' />';
 1422:                 if ($currkey eq 'course') {
 1423:                     $intervalform .= $itemname;
 1424:                 } else {
 1425:                     $intervalform .= &mt('Timer for all items in course');
 1426:                 }
 1427:                 $intervalform .= '</label>';
 1428:                 if ($currkey eq 'course') {
 1429:                     $intervalform .= $iteminfo;
 1430:                 }
 1431:                 $intervalform .= '<br />';
 1432:             } elsif ($type eq 'map') {
 1433:                 if (ref($intervals->{$type}) eq 'HASH') {
 1434:                     if (ref($navmap)) {
 1435:                         foreach my $map (sort(keys(%{$intervals->{$type}}))) {
 1436:                             next if ((!&Apache::lonnet::is_on_map($map)) &&
 1437:                                      ($currkey ne $map));
 1438:                             my ($checked,$clickaction);
 1439:                             if ($currkey eq $map) {
 1440:                                 $checked = ' checked="checked"';
 1441:                             } elsif ($jschg) {
 1442:                                 $clickaction = ' onclick="'.$jschg.'"';
 1443:                             }
 1444:                             $intervalform .= '<label><input type="radio" name="firstaccess_'.$parmcount.
 1445:                                              '" value="'.&HTML::Entities::encode($map,'"<>&').'"'.
 1446:                                              $checked.$clickaction.$disabled.' />';
 1447:                             if ($currkey eq $map) {
 1448:                                 $intervalform .= $itemname.'</label>'.$iteminfo;
 1449:                             } else {
 1450:                                 my ($resobj,$title,$path,$hierarchy);
 1451:                                 $resobj = $navmap->getResourceByUrl($map);
 1452:                                 if (ref($resobj)) {
 1453:                                     $title = $resobj->compTitle();
 1454:                                 } else {
 1455:                                     $title = &Apache::lonnet::gettitle($map);
 1456:                                 }
 1457:                                 $hierarchy = &show_timer_path($type,$map,$navmap);
 1458:                                 if ($hierarchy) {
 1459:                                     $path = ' <span style="font-size:90%;">'.
 1460:                                             &mt('(in: [_1])',$hierarchy).
 1461:                                             '</span>';
 1462:                                 }
 1463:                                 $intervalform .= &mt('Timer for all items in folder: [_1]',
 1464:                                                      '<i>'.$title.'</i>').
 1465:                                                  '</label>'.$path;
 1466:                             }
 1467:                             $intervalform .= '<br />';
 1468:                         }
 1469:                     }
 1470:                 }
 1471:             } elsif ($type eq 'resource') {
 1472:                 if (ref($intervals->{$type}) eq 'HASH') {
 1473:                     if (ref($navmap)) {
 1474:                         foreach my $resource (sort(keys(%{$intervals->{$type}}))) {
 1475:                             my ($checked,$clickaction,$resobj);
 1476:                             if ($currkey eq $resource) {
 1477:                                 $checked = ' checked="checked"';
 1478:                             } else {
 1479:                                 $resobj = $navmap->getBySymb($resource);
 1480:                                 next unless(ref($resobj));
 1481:                                 if ($jschg) {
 1482:                                     $clickaction = ' onclick="'.$jschg.'"';
 1483:                                 }
 1484:                             }
 1485:                             $intervalform .= '<label><input type="radio" name="firstaccess_'.$parmcount.
 1486:                                              '" value="'.&HTML::Entities::encode($resource,'"<>&').'"'.
 1487:                                              $checked.$clickaction.$disabled.' />';
 1488:                             if ($currkey eq $resource) {
 1489:                                 $intervalform .= $itemname.'</label>'.$iteminfo;
 1490:                             } else {
 1491:                                 my ($title,$path,$hierarchy);
 1492:                                 if (ref($resobj)) {
 1493:                                     $title = $resobj->compTitle();
 1494:                                 } else {
 1495:                                     $title = &Apache::lonnet::gettitle($resource);
 1496:                                 }
 1497:                                 $hierarchy = &show_timer_path($type,$resource,$navmap);
 1498:                                 if ($hierarchy) {
 1499:                                     $path = ' <span style="font-size:90%;">'.
 1500:                                             &mt('(in: [_1])',$hierarchy).
 1501:                                             '</span>';
 1502:                                 }
 1503:                                 $intervalform .= &mt('Timer for resource: [_1]','<i>'.$title.'</i>').
 1504:                                                  '</label>'.
 1505:                                                  $path;
 1506:                             }
 1507:                             $intervalform .= '<br />';
 1508:                         }
 1509:                     }
 1510:                 }
 1511:             }
 1512:         }
 1513:     } else {
 1514:         if ($currkey ne '') {
 1515:             $intervalform = '<input type="radio" name="firstaccess_'.$parmcount.
 1516:                             '" checked="checked" value="'.
 1517:                             &HTML::Entities::encode($currkey,'"<>&').'"'.$disabled.' />'.
 1518:                             $itemname.'<br />';
 1519:         } else {
 1520:             $intervalform = &mt('No timed items defined.').' '.
 1521:                             &mt('Use [_1]Settings[_2] to assign a timer, then return here.',
 1522:                                 '<a href="/adm/parmset">','</a>');
 1523:         }
 1524:     }
 1525:     return $intervalform;
 1526: }
 1527: 
 1528: sub trigger_details_toggle {
 1529:     my ($parmcount) = @_;
 1530:     return ' <span id="toggletext_'.$parmcount.'" class="LC_cusr_subheading LC_nobreak">'.
 1531:            '<a href="javascript:showTriggerDetails('."'$parmcount'".');" '.
 1532:            'style="text-decoration: none;"><b>'.&mt('(More ...)').'</b></a></span>';
 1533: }
 1534: 
 1535: sub show_timer_path {
 1536:     my ($type,$item,$navmap) = @_;
 1537:     return unless(ref($navmap));
 1538:     my @pathitems;
 1539:     if ($type eq 'map') {
 1540:         @pathitems = 
 1541:             &Apache::loncommon::get_folder_hierarchy($navmap,$item);
 1542:     } elsif ($type eq 'resource') {
 1543:         my ($map,$id,$resource) = &Apache::lonnet::decode_symb($item);
 1544:         @pathitems = 
 1545:             &Apache::loncommon::get_folder_hierarchy($navmap,$map,1);
 1546:     }
 1547:     if (@pathitems) {
 1548:         return join(' &raquo; ',@pathitems);
 1549:     }
 1550:     return;
 1551: }
 1552: 
 1553: sub blocktype_text {
 1554:     my %types = &Apache::lonlocal::texthash(
 1555:         'com' => 'Messaging',
 1556:         'chat' => 'Chat Room',
 1557:         'boards' => 'Discussion',
 1558:         'port' => 'Portfolio',
 1559:         'groups' => 'Groups',
 1560:         'blogs' => 'Blogs',
 1561:         'docs' => 'Content',
 1562:         'printout' => 'Printouts',
 1563:         'passwd' => 'Change Password',
 1564:     );
 1565:     my $typeorder = ['com','chat','boards','port','groups','blogs','printout','docs','passwd'];
 1566:     return ($typeorder,\%types);
 1567: }
 1568: 
 1569: sub blockingmenu_javascript {
 1570:     my ($blockcount) = @_;
 1571:     my %lt = &Apache::lonlocal::texthash (
 1572:                                            more => 'More ...',
 1573:                                            less => 'Less ...',
 1574:                                          );
 1575:     return <<ENDSCRIPT;
 1576: <script type="text/javascript">
 1577: // <![CDATA[
 1578: function resblockinfo(blockid) {
 1579:     if (document.getElementById('docs_'+blockid).checked) {
 1580:         var resblockwin = null;
 1581:         var url = '/adm/setblock?action=showdocs&block='+blockid;
 1582:         if (!resblockwin || resblockwin.closed) {
 1583:             resblockwin=window.open(url,'blockingwin','height=480,width=600,resizable=yes,scrollbars=yes,location=no,menubar=no,toolbar=no');
 1584:         }
 1585:         resblockwin.focus();
 1586:     } else {
 1587:         document.getElementById('docs_resources_'+blockid).value = '';
 1588:         document.getElementById('docs_maps_'+blockid).value = '';
 1589:     }
 1590:     return;
 1591: }
 1592: 
 1593: function showBlockType() {
 1594:     if (document.getElementById('toggle_startstop').checked == true) {
 1595:         document.getElementById('show_startstop').style.display='block';
 1596:     } else {
 1597:         document.getElementById('show_startstop').style.display='none';
 1598:     }
 1599:     if (document.getElementById('toggle_timer').checked == true) {
 1600:         document.getElementById('show_timer').style.display='block';
 1601:     } else {
 1602:         document.getElementById('show_timer').style.display='none';
 1603:     }
 1604:     return;
 1605: }
 1606: 
 1607: function toggleAddModify() {
 1608:     for (var i=0; i<document.blockform.blockaction.length; i++) {
 1609:         if (document.blockform.blockaction[i].checked) {
 1610:             if (document.blockform.blockaction[i].value == 'add') {
 1611:                document.getElementById('showadd').style.display='block';
 1612:                document.getElementById('showmodify').style.display='none';
 1613:                var blocktotal = $blockcount;
 1614:                if (blocktotal > 0) {
 1615:                    for (var i=0; i<blocktotal; i++) {
 1616:                        document.getElementById('nochange_'+i).checked = true;
 1617:                    }
 1618:                }
 1619:                document.getElementById('showmodify').style.display='none';
 1620:                document.getElementById('showadd').style.display='block';
 1621:             } else {
 1622:                document.getElementById('showadd').style.display='none';
 1623:                document.getElementById('showmodify').style.display='block';
 1624:             }
 1625:         }
 1626:     }
 1627:     return;
 1628: }
 1629: 
 1630: function showTriggerDetails(item) {
 1631:     document.getElementById('trigdetails_'+item).style.display='block';
 1632:     document.getElementById('trigdetails_'+item).style.textAlign='left';
 1633:     document.getElementById('trigdetails_'+item).style.textFace='normal';
 1634:     document.getElementById('toggletext_'+item).innerHTML = '<a href="javascript:hideTriggerDetails('+item+');" style="text-decoration: none;"><b>($lt{'less'})</b></a>';
 1635:     return;
 1636: }
 1637: 
 1638: function hideTriggerDetails(item) {
 1639:     document.getElementById('trigdetails_'+item).style.display='none';
 1640:     document.getElementById('toggletext_'+item).innerHTML = '<a href="javascript:showTriggerDetails('+item+');" style="text-decoration: none;"><b>($lt{'more'})</b></a>';
 1641:     return;
 1642: }
 1643: 
 1644: // ]]>
 1645: </script>
 1646: ENDSCRIPT
 1647: 
 1648: }
 1649: 
 1650: 1;
 1651: 
 1652: __END__

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>