Diff for /rat/lonsequence.pm between versions 1.32 and 1.40

version 1.32, 2007/12/01 01:59:54 version 1.40, 2010/02/23 05:00:16
Line 27 Line 27
 # http://www.lon-capa.org/  # http://www.lon-capa.org/
 #  #
   
   
   
 package Apache::lonsequence;  package Apache::lonsequence;
   
 use strict;  use strict;
Line 100  ENDSCRIPT Line 102  ENDSCRIPT
       '<h1>'.$url.'</h1>');        '<h1>'.$url.'</h1>');
 # ------------------ This is trying to select. Provide buttons and tie %selhash  # ------------------ This is trying to select. Provide buttons and tie %selhash
     if ($env{'form.forceselect'}) { $r->print(<<ENDSELECT);      if ($env{'form.forceselect'}) { $r->print(<<ENDSELECT);
 <form name=fileattr><input type=hidden name=acts value=''>  <form name="fileattr"><input type="hidden" name="acts" value="" />
 <input type="button" name="close" value='CLOSE' onClick="self.close()">  <input type="button" name="close" value="CLOSE" onClick="self.close()" />
 <input type="button" name="groupimport" value='GROUP IMPORT'  <input type="button" name="groupimport" value="GROUP IMPORT"
 onClick="javascript:select_group()">  onClick="javascript:select_group()" />
 </form>     </form>   
 ENDSELECT  ENDSELECT
     my $diropendb =       my $diropendb = 
Line 124  ENDSELECT Line 126  ENDSELECT
 # ----------------------------- successtied is now '1' if in working selectmode  # ----------------------------- successtied is now '1' if in working selectmode
     my ($errtext,$fatal)=&mapread(&Apache::lonnet::filelocation('',$url),'');      my ($errtext,$fatal)=&mapread(&Apache::lonnet::filelocation('',$url),'');
     if ($fatal==1) {      if ($fatal==1) {
        $r->print('<p><b><font color="red">'.&mt('Map contents are not shown in order.').'</font></b></p><br />');         $r->print('<p class="LC_warning">'
                   .&mt('Map contents are not shown in order.')
                   .'</p><br />');
     }      }
     my $idx=0;      my $idx=0;
     foreach (&attemptread(&Apache::lonnet::filelocation('',$url))) {      foreach (&attemptread(&Apache::lonnet::filelocation('',$url))) {
Line 147  ENDSELECT Line 151  ENDSELECT
  if ($successtied) {   if ($successtied) {
     my $checked='';      my $checked='';
            if ($selhash{'store_'.$url}) {             if ($selhash{'store_'.$url}) {
             $checked=" checked";              $checked=' checked="checked"';
            }             }
            $selhash{"pre_${idx}_link"}=$url;             $selhash{"pre_${idx}_link"}=$url;
            $selhash{"pre_${idx}_title"}=$title;             $selhash{"pre_${idx}_title"}=$title;
Line 166  ENDCHECKBOX Line 170  ENDCHECKBOX
             if ($successtied) {              if ($successtied) {
  $r->print('</form>');   $r->print('</form>');
             } else {              } else {
  $r->print('<br>');   $r->print('<br />');
             }              }
         }          }
     }      }
Line 213  sub handler { Line 217  sub handler {
   my $dismapid='';    my $dismapid='';
   my $exitdisid = '';    my $exitdisid = '';
   my $arrow_dir = '';    my $arrow_dir = '';
     my $is_encrypted = '';
   
   if (($env{'request.course.fn'}) && (!$env{'form.forceselect'})) {    if (($env{'request.course.fn'}) && (!$env{'form.forceselect'})) {
        my $last;         my $last;
Line 243  sub handler { Line 248  sub handler {
        if (!$env{'request.role.adv'}) {         if (!$env{'request.role.adv'}) {
    $randomout = $bighash{'randomout_'.$disid};     $randomout = $bighash{'randomout_'.$disid};
        }         }
                  if (!$env{'request.role.adv'}) {
                      $is_encrypted = $bighash{'encrypted_'.$disid};
                  }
            } elsif (tie(%hash,'GDBM_File',$env{'request.course.fn'}.'_symb.db',             } elsif (tie(%hash,'GDBM_File',$env{'request.course.fn'}.'_symb.db',
                     &GDBM_READER(),0640)) {                      &GDBM_READER(),0640)) {
                $last=$hash{'last_known'};                 $last=$hash{'last_known'};
Line 262  sub handler { Line 270  sub handler {
    if (!$env{'request.role.adv'}) {     if (!$env{'request.role.adv'}) {
        $randomout = $bighash{'randomout_'.$disid};         $randomout = $bighash{'randomout_'.$disid};
    }     }
                      if (!$env{'request.role.adv'}) {
                          $is_encrypted = $bighash{'encrypted_'.$disid};
                      }
                }                 }
     }      }
            $exitdisid = $disid;             $exitdisid = $disid;
Line 275  sub handler { Line 286  sub handler {
 # now either disurl is set (going to first page), or we need another display  # now either disurl is set (going to first page), or we need another display
    if ($disurl) {     if ($disurl) {
 # -------------------------------------------------- Has first or last resource  # -------------------------------------------------- Has first or last resource
         my $showdisurl = $disurl;
         if ($is_encrypted) {
             $showdisurl = &Apache::lonenc::encrypted($disurl);
         }
       &Apache::lonnet::symblist($requrl,$disurl => [$disurl,$dismapid],        &Apache::lonnet::symblist($requrl,$disurl => [$disurl,$dismapid],
  'last_known' => [$disurl,$dismapid]);    'last_known' => [$disurl,$dismapid]); 
       &Apache::loncommon::content_type($r,'text/html');        &Apache::loncommon::content_type($r,'text/html');
       $r->header_out(Location => 'http://'.$ENV{'HTTP_HOST'}.$disurl);        $r->header_out(Location => &Apache::lonnet::absolute_url($ENV{'SERVER_NAME'}).
                                    $showdisurl);
       return REDIRECT;        return REDIRECT;
    } else {     } else {
        &Apache::loncommon::content_type($r,'text/html');         &Apache::loncommon::content_type($r,'text/html');
Line 322  ENDNONE Line 338  ENDNONE
 1;  1;
 __END__  __END__
   
   =head1 NAME
   
   Apache::lonsequence
   
   =head1 SYNOPSIS
   
   Handler for showing sequence objects of
   educational resources.
   
   This is part of the LearningOnline Network with CAPA project
   described at http://www.lon-capa.org.
   
   =head1 SUBROUTINES
   
   =over
   
   =item handler()
   
   =item viewmap()
   
   =item attemptread()
   
   =item mapread()
   
   =item start_fresh_session()
   
   =back
   
   =cut
   
   
   

Removed from v.1.32  
changed lines
  Added in v.1.40


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