Diff for /loncom/interface/lonpopulate.pm between versions 1.44 and 1.48

version 1.44, 2006/07/27 23:24:19 version 1.48, 2006/08/10 22:05:18
Line 46  sub header { Line 46  sub header {
   
 sub choose_header {  sub choose_header {
     my ($action) = @_;      my ($action) = @_;
       my $notify_check = '/^note_[0-9]+$/';
     my $scripttag = qq|      my $scripttag = qq|
 <script language='javascript' type='text/javascript'>  <script language='javascript' type='text/javascript'>
 <!--  <!--
Line 111  function process(calling,numauto,nummanu Line 111  function process(calling,numauto,nummanu
          checker = 0           checker = 0
      }       }
  }   }
    if (calling == "notify") {
        var totalnote = 0;
        for (var i=0; i<formName.elements.length; i++) {
    var elementname = formName.elements[i].name;
    var check_name = elementname.match($notify_check);
    if (check_name != null) {
        if (formName.elements[i].checked) {
    totalnote ++;
        }
    } 
        }
        if (totalnote > 0) {
    if (formName.notify[1].checked == true) {
        if (confirm("You have indicated that you do not want notification of roster changes messages to be sent, but "+totalnote+" have been checked as recipients.\\nClick 'OK' to erase all recipients, or 'Cancel'.")) {
    checker  = 1;
        } else {
    checker = 0;
        }
    }
        } else {
    if (formName.notify[0].checked == true) {
        alert("You have indicated that you want notification of roster changes messages to be sent, but you have not selected any recipients.");
        checker = 0;
    }
        }
    }
  if (calling == "viewclass") {   if (calling == "viewclass") {
      var totcheck = 0       var totcheck = 0
      var numchk = 0       var numchk = 0
Line 494  ENDTWO Line 520  ENDTWO
           $noteset = "OFF";            $noteset = "OFF";
       }        }
       my %dompersonnel = &Apache::lonnet::get_domain_roles($dom,['dc']);        my %dompersonnel = &Apache::lonnet::get_domain_roles($dom,['dc']);
       foreach my $server (keys %dompersonnel) {        foreach my $server (keys(%dompersonnel)) {
           foreach my $user (sort(keys %{$dompersonnel{$server}})) {            foreach my $user (sort(keys(%{$dompersonnel{$server}}))) {
               my ($trole,$uname,$udom,$runame,$rudom,$rsec) = split(/:/,$user);                my ($trole,$uname,$udom,$runame,$rudom,$rsec) = split(/:/,$user);
               if (!grep/^$uname:$udom$/,@domcoord) {                if (!grep(/^$uname:$udom$/,@domcoord)) {
                   push(@domcoord,$uname.':'.$udom);                    push(@domcoord,$uname.':'.$udom);
               }                }
           }            }
Line 546  ENDTWO Line 572  ENDTWO
               next;                next;
           }            }
           if ($role eq 'cc')  {            if ($role eq 'cc')  {
               unless (grep/^$user$/,@ccs) {                unless (grep(/^$user$/,@ccs)) {
                   if ($end && $end < $now) {                    if ($end && $end < $now) {
                       $status{$user} = 'previous';                        $status{$user} = 'previous';
                   } elsif ($start > $now) {                    } elsif ($start > $now) {
Line 558  ENDTWO Line 584  ENDTWO
                   my ($uname,$udom) = split(/:/,$user);                    my ($uname,$udom) = split(/:/,$user);
                   $pname{$user} =                     $pname{$user} = 
                            &Apache::loncommon::plainname($uname,$udom);                             &Apache::loncommon::plainname($uname,$udom);
                   if (grep/^$user$/,@notified) {                    if (grep(/^$user$/,@notified)) {
                       $notifystate{$user} = 1;                        $notifystate{$user} = 1;
                   } else {                    } else {
                       $notifystate{$user} = 0;                        $notifystate{$user} = 0;
Line 566  ENDTWO Line 592  ENDTWO
               }                }
           }            }
       }        }
       my $notifyshow = @ccs;        my $notifyshow = 0; 
       my %lt = &Apache::lonlocal::texthash(        my %lt = &Apache::lonlocal::texthash(
                                   name => 'Name',                                    name => 'Name',
                                   usnm => 'username:domain',                                    usnm => 'username:domain',
Line 639  ENDTWO Line 665  ENDTWO
              </td>               </td>
           </tr>");            </tr>");
       }        }
       if ($notifycount || @showdom > 0) {        if (@ccs > 0 || @showdom > 0) {
           $r->print("<tr><td>&nbsp;</td></tr><tr><td>".            $r->print("<tr><td>&nbsp;</td></tr><tr><td>");
                 &mt("Uncheck the 'Notification?' checkbox for each person who is to be removed from the list of recipients who are currently informed of roster changes whenever any adds or drops occur during the nightly enrollment check.").' '.&mt("To include individuals who are not currently recipients, simply check the 'Notification?' checkbox. Click 'Go' to store your changes.")."            if ($notifycount) {
                 $r->print(&mt("Uncheck the checkbox(es) to terminate notification for people currently informed of roster changes from the nightly enrollment update.<br />"));
            }
            if ((@ccs + @showdom) > $notifycount) {
                $r->print(&mt("Check the checkbox(es) to initiate notification for people not currently informed of roster changes from the nightly enrollment update.<br />"));
            }
            $r->print(&mt("Click 'Go' to store your changes.")."
            <br/>             <br/>
            <table width=\"100%\" border=\"0\" cellspadding=\"2\" cellspacing=\"2\">             <table width=\"100%\" border=\"0\" cellspadding=\"2\" cellspacing=\"2\">
             <tr>              <tr>
Line 913  your changes.</td> Line 945  your changes.</td>
       my ($result,$perm_reqd)=&Apache::lonnet::auto_photo_permission($crs,$dom);        my ($result,$perm_reqd)=&Apache::lonnet::auto_photo_permission($crs,$dom);
       my $can_enable = 1;        my $can_enable = 1;
       my $institution = $Apache::lonnet::domaindescription{$dom};        my $institution = $Apache::lonnet::domaindescription{$dom};
       my $user;  
       if ($enrollvar{'courseowner'} =~ /^[^:]+:[^:]+$/) {  
           $user = $env{'user.name'}.':'.$env{'user.domain'};  
       } else {  
           $user = $env{'user.name'};  
       }  
       if ($result eq 'ok') {        if ($result eq 'ok') {
           if ($perm_reqd eq 'yes') {            if ($perm_reqd eq 'yes') {
               if (!($enrollvar{'photopermission'} eq 'yes')) {                if (!($enrollvar{'photopermission'} eq 'yes')) {
                   $can_enable = 0;                    $can_enable = 0;
               } else {                } else {
                   if ($user eq $enrollvar{'courseowner'}) {                    if (&user_is_courseowner($enrollvar{'courseowner'})) {
                       $r->print('                        $r->print('
                     <tr>                      <tr>
                      <td>'.                       <td>'.
Line 957  your changes.</td> Line 983  your changes.</td>
                     </tr>                      </tr>
 ');  ');
       } else {        } else {
           if ($user eq $enrollvar{'courseowner'}) {            if (&user_is_courseowner($enrollvar{'courseowner'})) {
               $r->print('                $r->print('
                     <tr>                      <tr>
                      <td>'.                       <td>'.
Line 1091  onclick="javascript:document.photoupdate Line 1117  onclick="javascript:document.photoupdate
       if (! exists($env{'form.sortby'})) {        if (! exists($env{'form.sortby'})) {
           $env{'form.sortby'} = 'username';            $env{'form.sortby'} = 'username';
       }        }
       if ($env{'form.Status'} !~ /^(Any|Expired|Active)$/) {        if ($env{'form.Status'} !~ /^(Any|Expired|Active|Future)$/) {
           $env{'form.Status'} = 'Active';            $env{'form.Status'} = 'Active';
       }        }
       my $status_select = &Apache::lonhtmlcommon::StatusOptions($env{'form.Status'});        my $status_select = &Apache::lonhtmlcommon::StatusOptions($env{'form.Status'});
Line 1761  sub print_crosslistings_menu () { Line 1787  sub print_crosslistings_menu () {
  if ($numcross > 0) {   if ($numcross > 0) {
     my @bgcolors=("#eeeeee","#cccccc");      my @bgcolors=("#eeeeee","#cccccc");
     $response .= qq(You indicated that you wish to add an additional $numcross crosslisting(s).  For each new crosslisting enter the insititutional course section code (e.g., fs03zol101001, for section 001 of zol101 for fs03 semester), and the LON-CAPA section ID you wish to assign to students who will be enrolled in your LON-CAPA class as a result of their registration in the crosslisted course section. The LON-CAPA section ID can be left blank, if you do not wish to tie a section ID to this crosslisting.  The institutional course section code should only contain letters and/or numbers, and must be consistent with the scheme adopted by your Domain Coordinator to map course codes (and section numbers) to your institution's student information system.<br/><br/>      $response .= qq(You indicated that you wish to add an additional $numcross crosslisting(s).  For each new crosslisting enter the insititutional course section code (e.g., fs03zol101001, for section 001 of zol101 for fs03 semester), and the LON-CAPA section ID you wish to assign to students who will be enrolled in your LON-CAPA class as a result of their registration in the crosslisted course section. The LON-CAPA section ID can be left blank, if you do not wish to tie a section ID to this crosslisting.  The institutional course section code should only contain letters and/or numbers, and must be consistent with the scheme adopted by your Domain Coordinator to map course codes (and section numbers) to your institution's student information system.<br/><br/>
            <form name="enter" method="post">);             <form name="enter" method="post">); #' stupid emacs
            $response .= &Apache::loncommon::start_data_table();             $response .= &Apache::loncommon::start_data_table();
            $response .= &Apache::loncommon::start_data_table_row();             $response .= &Apache::loncommon::start_data_table_row();
            $response .= qq(             $response .= qq(
Line 2251  sub photo_permission { Line 2277  sub photo_permission {
  $dom,$crs);   $dom,$crs);
     my ($showphotos,$response);      my ($showphotos,$response);
     if (exists($env{'form.cancel_agreement'})) {      if (exists($env{'form.cancel_agreement'})) {
         if ($env{'user.name'} eq $settings{'internal.courseowner'}) {          if (&user_is_courseowner($settings{'internal.courseowner'})) {
             my %cenv = (              my %cenv = (
                 'internal.photopermission' => 'no',                  'internal.photopermission' => 'no',
             );              );
Line 2321  sub print_photo_agreement { Line 2347  sub print_photo_agreement {
     my ($r,$realm,$dom,$crs,$action,$tasktitleref,$conditions,$courseowner)=@_;      my ($r,$realm,$dom,$crs,$action,$tasktitleref,$conditions,$courseowner)=@_;
     my $response;      my $response;
     my $institution = $Apache::lonnet::domaindescription{$dom};      my $institution = $Apache::lonnet::domaindescription{$dom};
     if ($env{'user.name'} eq $courseowner) {      if (&user_is_courseowner($courseowner)) {
         $response = '          $response = '
 <script type="text/javascript">  <script type="text/javascript">
 function agreement_result(caller) {  function agreement_result(caller) {
Line 2952  sub validate_lcsec { Line 2978  sub validate_lcsec {
     return 'ok';      return 'ok';
 }  }
   
   sub user_is_courseowner {
       my ($courseowner) = @_;
       my $user;
       if ($courseowner =~ /^[^:]+:[^:]+$/) {
    $user = $env{'user.name'}.':'.$env{'user.domain'};
       } else {
    $user = $env{'user.name'};
       }
       return ($user eq $courseowner);
   }
       
 ###################################################################  ###################################################################
 sub handler {  sub handler {
     my $r = shift;      my $r = shift;

Removed from v.1.44  
changed lines
  Added in v.1.48


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