Diff for /loncom/interface/lonhtmlcommon.pm between versions 1.35 and 1.40

version 1.35, 2003/12/29 17:11:53 version 1.40, 2004/01/15 20:22:47
Line 65  use strict; Line 65  use strict;
   
 =pod  =pod
   
   =item authorbombs
   
   =cut
   
   ##############################################
   ##############################################
   
   sub authorbombs {
       my $url=shift;
       $url=&Apache::lonnet::declutter($url);
       my ($udom,$uname)=($url=~/^(\w+)\/(\w+)\//);
       my %bombs=&Apache::lonmsg::all_url_author_res_msg($uname,$udom);
       foreach (keys %bombs) {
    if ($_=~/^$udom\/$uname\//) {
       return '<a href="/adm/bombs/'.$url.
    '"><img src="/adm/lonMisc/bomb.gif" border="0" /></a>'.
    &Apache::loncommon::help_open_topic('About_Bombs');
    }
       }
       return '';
   }
   
   ##############################################
   ##############################################
   
   =pod
   
 =item textbox  =item textbox
   
 =cut  =cut
Line 91  sub textbox { Line 118  sub textbox {
 ##############################################  ##############################################
 ##############################################  ##############################################
 sub checkbox {  sub checkbox {
     my ($name) = @_;      my ($name,$value) = @_;
     my $Str = '<input type="checkbox" name="'.$name.'" />';      my $Str = '<input type="checkbox" name="'.$name.'"'.
    ($value?' checked="1"':'').' />';
     return $Str;      return $Str;
 }  }
   
Line 141  The method used to restrict user input w Line 169  The method used to restrict user input w
 ##############################################  ##############################################
 ##############################################  ##############################################
 sub date_setter {  sub date_setter {
     my ($formname,$dname,$currentvalue,$special) = @_;      my ($formname,$dname,$currentvalue,$special,$includeempty) = @_;
     if (! defined($currentvalue) || $currentvalue eq 'now') {      if (! defined($currentvalue) || $currentvalue eq 'now') {
         $currentvalue = time;   unless ($includeempty) {
       $currentvalue = time;
    } else {
       $currentvalue = 0;
    }
     }      }
     # other potentially useful values:     wkday,yrday,is_daylight_savings      # other potentially useful values:     wkday,yrday,is_daylight_savings
     my ($sec,$min,$hour,$mday,$month,$year,undef,undef,undef) =       my ($sec,$min,$hour,$mday,$month,$year)=('','','','','','');
         localtime($currentvalue);      if ($currentvalue) {
     $year += 1900;   ($sec,$min,$hour,$mday,$month,$year,undef,undef,undef) = 
       localtime($currentvalue);
    $year += 1900;
       }
     my $result = "\n<!-- $dname date setting form -->\n";      my $result = "\n<!-- $dname date setting form -->\n";
     $result .= <<ENDJS;      $result .= <<ENDJS;
 <script language="Javascript">  <script language="Javascript">
Line 200  ENDJS Line 235  ENDJS
                     July    August    September October November December/;                      July    August    September October November December/;
     # Pad @Months with a bogus value to make indexing easier      # Pad @Months with a bogus value to make indexing easier
     unshift(@Months,'If you can read this an error occurred');      unshift(@Months,'If you can read this an error occurred');
       if ($includeempty) { $result.="<option value=''></option>"; }
     for(my $m = 1;$m <=$#Months;$m++) {      for(my $m = 1;$m <=$#Months;$m++) {
         $result .= "      <option value=\"$m\" ";          $result .= "      <option value=\"$m\" ";
         $result .= "selected " if ($m-1 == $month);          $result .= "selected " if ($m-1 eq $month);
         $result .= "> ".&mt($Months[$m])." </option>\n";          $result .= "> ".&mt($Months[$m])." </option>\n";
     }      }
     $result .= "  </select>\n";      $result .= "  </select>\n";
Line 214  ENDJS Line 250  ENDJS
             "onChange=\"javascript:$dname\_checkday()\" />\n";              "onChange=\"javascript:$dname\_checkday()\" />\n";
     $result .= "&nbsp;&nbsp;";      $result .= "&nbsp;&nbsp;";
     $result .= "  <select name=\"$dname\_hour\" ".$special." >\n";      $result .= "  <select name=\"$dname\_hour\" ".$special." >\n";
       if ($includeempty) { $result.="<option value=''></option>"; }
     for (my $h = 0;$h<24;$h++) {      for (my $h = 0;$h<24;$h++) {
         $result .= "      <option value=\"$h\" ";          $result .= "      <option value=\"$h\" ";
         $result .= "selected " if ($hour == $h);          $result .= "selected " if ($hour == $h);
Line 437  sub StatusOptions { Line 474  sub StatusOptions {
     $Str .= ' size="'.$size.'" ';      $Str .= ' size="'.$size.'" ';
     $Str .= '>'."\n";      $Str .= '>'."\n";
     $Str .= '<option value="Active" '.$OpSel1.'>'.      $Str .= '<option value="Active" '.$OpSel1.'>'.
         'Currently Enrolled</option>'."\n";          &mt('Currently Enrolled').'</option>'."\n";
     $Str .= '<option value="Expired" '.$OpSel2.'>'.      $Str .= '<option value="Expired" '.$OpSel2.'>'.
         'Previously Enrolled</option>'."\n";          &mt('Previously Enrolled').'</option>'."\n";
     $Str .= '<option value="Any" '.$OpSel3.'>'.      $Str .= '<option value="Any" '.$OpSel3.'>'.
         'Any Enrollment Status</option>'."\n";          &mt('Any Enrollment Status').'</option>'."\n";
     $Str .= '</select>'."\n";      $Str .= '</select>'."\n";
 }  }
   
Line 842  sub crumbs { Line 879  sub crumbs {
     my ($uri,$target,$prefix)=@_;      my ($uri,$target,$prefix)=@_;
     my $output='<br /><tt><b><font size="+2">'.$prefix.'/';      my $output='<br /><tt><b><font size="+2">'.$prefix.'/';
     if ($ENV{'user.adv'}) {      if ($ENV{'user.adv'}) {
  my $path=$prefix.'/';   my $path=$prefix;
  foreach (split('/',$uri)) {   foreach (split('/',$uri)) {
     unless ($_) { next; }      unless ($_) { next; }
     $path.=$_.'/';      $path.='/'.$_;
     $output.='<a href="'.$path.'"'.($target?' target="'.$target.'"':'').'>'.$_.'</a>/';      $output.='<a href="'.$path.'"'.($target?' target="'.$target.'"':'').'>'.$_.'</a>/';
  }   }
     } else {      } else {
  $output.=$uri;   $output.=$uri;
     }      }
       unless ($uri=~/\/$/) { $output=~s/\/$//; }
     return $output.'</font></b></tt><br />';      return $output.'</font></b></tt><br />';
 }  }
   

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


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