Diff for /loncom/interface/loncommon.pm between versions 1.692.4.26 and 1.706

version 1.692.4.26, 2010/01/19 16:42:15 version 1.706, 2008/12/04 13:39:47
Line 271  BEGIN { Line 271  BEGIN {
         }          }
     }      }
     &Apache::lonnet::logthis(      &Apache::lonnet::logthis(
               "<font color=yellow>INFO: Read file types</font>");               "<span style='color:yellow;'>INFO: Read file types</span>");
     $readit=1;      $readit=1;
     }  # end of unless($readit)       }  # end of unless($readit) 
           
Line 406  sub studentbrowser_javascript { Line 406  sub studentbrowser_javascript {
          || ($env{'request.role'}=~/^(au|dc|su)/)           || ($env{'request.role'}=~/^(au|dc|su)/)
           ) { return ''; }              ) { return ''; }  
    return (<<'ENDSTDBRW');     return (<<'ENDSTDBRW');
 <script type="text/javascript" language="Javascript">  <script type="text/javascript" language="Javascript" >
 // <![CDATA[  
     var stdeditbrowser;      var stdeditbrowser;
     function openstdbrowser(formname,uname,udom,roleflag,ignorefilter,courseadvonly) {      function openstdbrowser(formname,uname,udom,roleflag,ignorefilter) {
         var url = '/adm/pickstudent?';          var url = '/adm/pickstudent?';
         var filter;          var filter;
  if (!ignorefilter) {   if (!ignorefilter) {
Line 423  sub studentbrowser_javascript { Line 422  sub studentbrowser_javascript {
         url += 'form=' + formname + '&unameelement='+uname+          url += 'form=' + formname + '&unameelement='+uname+
                                     '&udomelement='+udom;                                      '&udomelement='+udom;
  if (roleflag) { url+="&roles=1"; }   if (roleflag) { url+="&roles=1"; }
         if (courseadvonly) { url+="&courseadvonly=1"; }  
         var title = 'Student_Browser';          var title = 'Student_Browser';
         var options = 'scrollbars=1,resizable=1,menubar=0';          var options = 'scrollbars=1,resizable=1,menubar=0';
         options += ',width=700,height=600';          options += ',width=700,height=600';
         stdeditbrowser = open(url,title,options,'1');          stdeditbrowser = open(url,title,options,'1');
         stdeditbrowser.focus();          stdeditbrowser.focus();
     }      }
 // ]]>  
 </script>  </script>
 ENDSTDBRW  ENDSTDBRW
 }  }
   
 sub selectstudent_link {  sub selectstudent_link {
    my ($form,$unameele,$udomele,$courseadvonly)=@_;     my ($form,$unameele,$udomele)=@_;
    my $callargs = "'".$form."','".$unameele."','".$udomele."'";  
    if ($env{'request.course.id'}) {       if ($env{'request.course.id'}) {  
        if (!&Apache::lonnet::allowed('srm',$env{'request.course.id'})         if (!&Apache::lonnet::allowed('srm',$env{'request.course.id'})
    && !&Apache::lonnet::allowed('srm',$env{'request.course.id'}.     && !&Apache::lonnet::allowed('srm',$env{'request.course.id'}.
  '/'.$env{'request.course.sec'})) {   '/'.$env{'request.course.sec'})) {
    return '';     return '';
        }         }
        if ($courseadvonly)  {         return "<a href='".'javascript:openstdbrowser("'.$form.'","'.$unameele.
            $callargs .= ",'',1,1";          '","'.$udomele.'");'."'>".&mt('Select User')."</a>";
        }  
        return '<span class="LC_nobreak">'.  
               '<a href="javascript:openstdbrowser('.$callargs.');">'.  
               &mt('Select User').'</a></span>';  
    }     }
    if ($env{'request.role'}=~/^(au|dc|su)/) {     if ($env{'request.role'}=~/^(au|dc|su)/) {
        $callargs .= ",1";         return "<a href='".'javascript:openstdbrowser("'.$form.'","'.$unameele.
        return '<span class="LC_nobreak">'.          '","'.$udomele.'",1);'."'>".&mt('Select User')."</a>";
               '<a href="javascript:openstdbrowser('.$callargs.');">'.  
               &mt('Select User').'</a></span>';  
    }     }
    return '';     return '';
 }  }
Line 463  sub selectstudent_link { Line 453  sub selectstudent_link {
 sub authorbrowser_javascript {  sub authorbrowser_javascript {
     return <<"ENDAUTHORBRW";      return <<"ENDAUTHORBRW";
 <script type="text/javascript">  <script type="text/javascript">
 // <![CDATA[  
 var stdeditbrowser;  var stdeditbrowser;
   
 function openauthorbrowser(formname,udom) {  function openauthorbrowser(formname,udom) {
Line 475  function openauthorbrowser(formname,udom Line 464  function openauthorbrowser(formname,udom
     stdeditbrowser = open(url,title,options,'1');      stdeditbrowser = open(url,title,options,'1');
     stdeditbrowser.focus();      stdeditbrowser.focus();
 }  }
 // ]]>  
 </script>  </script>
 ENDAUTHORBRW  ENDAUTHORBRW
 }  }
   
 sub coursebrowser_javascript {  sub coursebrowser_javascript {
     my ($domainfilter,$sec_element,$formname,$role_element,$crstype) = @_;      my ($domainfilter,$sec_element,$formname)=@_;
     my $wintitle = 'Course_Browser';      my $crs_or_grp_alert = &mt('Please select the type of LON-CAPA entity - Course or Group - for which you wish to add/modify a user role');
     if ($crstype eq 'Community') {     my $output = '
         $wintitle = 'Community_Browser';  <script type="text/javascript">
     }  
     my $id_functions = &javascript_index_functions();  
     my $output = '  
 <script type="text/javascript" language="JavaScript">  
 // <![CDATA[  
     var stdeditbrowser;'."\n";      var stdeditbrowser;'."\n";
      $output .= <<"ENDSTDBRW";
     $output .= <<"ENDSTDBRW";      function opencrsbrowser(formname,uname,udom,desc,extra_element,multflag,crstype) {
     function opencrsbrowser(formname,uname,udom,desc,extra_element,multflag,type,type_elem) {  
         var url = '/adm/pickcourse?';          var url = '/adm/pickcourse?';
           var domainfilter = '';
         var formid = getFormIdByName(formname);          var formid = getFormIdByName(formname);
         var domainfilter = getDomainFromSelectbox(formname,udom);          if (formid > -1) {
               var domid = getIndexByName(formid,udom);
               if (domid > -1) {
                   if (document.forms[formid].elements[domid].type == 'select-one') {
                       domainfilter=document.forms[formid].elements[domid].options[document.forms[formid].elements[domid].selectedIndex].value;
                   }
                   if (document.forms[formid].elements[domid].type == 'hidden') {
                       domainfilter=document.forms[formid].elements[domid].value;
                   }
               }
           }
         if (domainfilter != null) {          if (domainfilter != null) {
            if (domainfilter != '') {             if (domainfilter != '') {
                url += 'domainfilter='+domainfilter+'&';                 url += 'domainfilter='+domainfilter+'&';
Line 515  sub coursebrowser_javascript { Line 509  sub coursebrowser_javascript {
             else {              else {
                 if (formname == 'portform') {                  if (formname == 'portform') {
                     url += '&setroles='+extra_element;                      url += '&setroles='+extra_element;
                 } else {  
                     if (formname == 'rules') {  
                         url += '&fixeddom='+extra_element;  
                     }  
                 }                  }
             }                   }     
         }          }
         if (type != null && type != '') {  
             url += '&type='+type;  
         }  
         if (type_elem != null && type_elem != '') {  
             url += '&typeelement='+type_elem;  
         }  
         if (formname == 'ccrs') {  
             var ownername = document.forms[formid].ccuname.value;  
             var ownerdom =  document.forms[formid].ccdomain.options[document.forms[formid].ccdomain.selectedIndex].value;  
             url += '&cloner='+ownername+':'+ownerdom;  
         }  
         if (multflag !=null && multflag != '') {          if (multflag !=null && multflag != '') {
             url += '&multiple='+multflag;              url += '&multiple='+multflag;
         }          }
         var title = '$wintitle';          if (crstype == 'Course/Group') {
               if (formname == 'cu') {
                   crstype = document.cu.crstype.options[document.cu.crstype.selectedIndex].value; 
                   if (crstype == "") {
                       alert("$crs_or_grp_alert");
                       return;
                   }
               }
           }
           if (crstype !=null && crstype != '') {
               url += '&type='+crstype;
           }
           var title = 'Course_Browser';
         var options = 'scrollbars=1,resizable=1,menubar=0';          var options = 'scrollbars=1,resizable=1,menubar=0';
         options += ',width=700,height=600';          options += ',width=700,height=600';
         stdeditbrowser = open(url,title,options,'1');          stdeditbrowser = open(url,title,options,'1');
         stdeditbrowser.focus();          stdeditbrowser.focus();
     }      }
 $id_functions  
 ENDSTDBRW  
     if (($sec_element ne '') || ($role_element ne '')) {  
         $output .= &setsec_javascript($sec_element,$formname,$role_element);  
     }  
     $output .= '  
 // ]]>  
 </script>';  
     return $output;  
 }  
   
 sub javascript_index_functions {  
     return <<"ENDJS";  
   
 function getFormIdByName(formname) {  
     for (var i=0;i<document.forms.length;i++) {  
         if (document.forms[i].name == formname) {  
             return i;  
         }  
     }  
     return -1;  
 }  
   
 function getIndexByName(formid,item) {  
     for (var i=0;i<document.forms[formid].elements.length;i++) {  
         if (document.forms[formid].elements[i].name == item) {  
             return i;  
         }  
     }  
     return -1;  
 }  
   
 function getDomainFromSelectbox(formname,udom) {      function getFormIdByName(formname) {
     var userdom;          for (var i=0;i<document.forms.length;i++) {
     var formid = getFormIdByName(formname);              if (document.forms[i].name == formname) {
     if (formid > -1) {                  return i;
         var domid = getIndexByName(formid,udom);  
         if (domid > -1) {  
             if (document.forms[formid].elements[domid].type == 'select-one') {  
                 userdom=document.forms[formid].elements[domid].options[document.forms[formid].elements[domid].selectedIndex].value;  
             }  
             if (document.forms[formid].elements[domid].type == 'hidden') {  
                 userdom=document.forms[formid].elements[domid].value;  
             }              }
         }          }
           return -1; 
     }      }
     return userdom;  
 }  
   
 ENDJS  
   
 }  
   
 sub userbrowser_javascript {  
     my $id_functions = &javascript_index_functions();  
     return <<"ENDUSERBRW";  
   
 function openuserbrowser(formname,uname,udom,ulast,ufirst,uemail,hideudom,crsdom,caller) {  
     var url = '/adm/pickuser?';  
     var userdom = getDomainFromSelectbox(formname,udom);  
     if (userdom != null) {  
        if (userdom != '') {  
            url += 'srchdom='+userdom+'&';  
        }  
     }  
     url += 'form=' + formname + '&unameelement='+uname+  
                                 '&udomelement='+udom+  
                                 '&ulastelement='+ulast+  
                                 '&ufirstelement='+ufirst+  
                                 '&uemailelement='+uemail+  
                                 '&hideudomelement='+hideudom+  
                                 '&coursedom='+crsdom;  
     if ((caller != null) && (caller != undefined)) {  
         url += '&caller='+caller;  
     }  
     var title = 'User_Browser';  
     var options = 'scrollbars=1,resizable=1,menubar=0';  
     options += ',width=700,height=600';  
     var stdeditbrowser = open(url,title,options,'1');  
     stdeditbrowser.focus();  
 }  
   
 function fix_domain (formname,udom,origdom,uname) {      function getIndexByName(formid,item) {
     var formid = getFormIdByName(formname);          for (var i=0;i<document.forms[formid].elements.length;i++) {
     if (formid > -1) {              if (document.forms[formid].elements[i].name == item) {
         var unameid = getIndexByName(formid,uname);                  return i;
         var domid = getIndexByName(formid,udom);  
         var hidedomid = getIndexByName(formid,origdom);  
         if (hidedomid > -1) {  
             var fixeddom = document.forms[formid].elements[hidedomid].value;  
             var unameval = document.forms[formid].elements[unameid].value;  
             if ((fixeddom != '') && (fixeddom != undefined) && (fixeddom != null) && (unameval != '') && (unameval != undefined) && (unameval != null)) {  
                 if (domid > -1) {  
                     var slct = document.forms[formid].elements[domid];  
                     if (slct.type == 'select-one') {  
                         var i;  
                         for (i=0;i<slct.length;i++) {  
                             if (slct.options[i].value==fixeddom) { slct.selectedIndex=i; }  
                         }  
                     }  
                     if (slct.type == 'hidden') {  
                         slct.value = fixeddom;  
                     }  
                 }  
             }              }
         }          }
           return -1;
     }      }
     return;  ENDSTDBRW
 }      if ($sec_element ne '') {
           $output .= &setsec_javascript($sec_element,$formname);
 $id_functions      }
 ENDUSERBRW      $output .= '
   </script>';
       return $output;
 }  }
   
   
 sub setsec_javascript {  sub setsec_javascript {
     my ($sec_element,$formname,$role_element) = @_;      my ($sec_element,$formname) = @_;
     my (@courserolenames,@communityrolenames,$rolestr,$courserolestr,  
         $communityrolestr);  
     if ($role_element ne '') {  
         my @allroles = ('st','ta','ep','in','ad');  
         foreach my $crstype ('Course','Community') {  
             if ($crstype eq 'Community') {  
                 foreach my $role (@allroles) {  
                     push(@communityrolenames,&Apache::lonnet::plaintext($role,$crstype));  
                 }  
                 push(@communityrolenames,&Apache::lonnet::plaintext('co'));  
             } else {  
                 foreach my $role (@allroles) {  
                     push(@courserolenames,&Apache::lonnet::plaintext($role,$crstype));  
                 }  
                 push(@courserolenames,&Apache::lonnet::plaintext('cc'));  
             }  
         }  
         $rolestr = '"'.join('","',@allroles).'"';  
         $courserolestr = '"'.join('","',@courserolenames).'"';  
         $communityrolestr = '"'.join('","',@communityrolenames).'"';  
     }  
     my $setsections = qq|      my $setsections = qq|
 function setSect(sectionlist) {  function setSect(sectionlist) {
     var sectionsArray = new Array();      var sectionsArray = new Array();
Line 713  function setSect(sectionlist) { Line 595  function setSect(sectionlist) {
         }          }
     }      }
 }  }
   
 function setRole(crstype) {  
 |;  
     if ($role_element eq '') {  
         $setsections .= '    return;  
 }  
 ';  
     } else {  
         $setsections .= qq|  
     var elementLength = document.$formname.$role_element.length;  
     var allroles = Array($rolestr);  
     var courserolenames = Array($courserolestr);  
     var communityrolenames = Array($communityrolestr);  
     if (elementLength != undefined) {  
         if (document.$formname.$role_element.options[5].value == 'cc') {  
             if (crstype == 'Course') {  
                 return;  
             } else {  
                 allroles[5] = 'co';  
                 for (var i=0; i<6; i++) {  
                     document.$formname.$role_element.options[i].value = allroles[i];  
                     document.$formname.$role_element.options[i].text = communityrolenames[i];  
                 }  
             }  
         } else {  
             if (crstype == 'Community') {  
                 return;  
             } else {  
                 allroles[5] = 'cc';  
                 for (var i=0; i<6; i++) {  
                     document.$formname.$role_element.options[i].value = allroles[i];  
                     document.$formname.$role_element.options[i].text = courserolenames[i];  
                 }  
             }  
         }  
     }  
     return;  
 }  
 |;  |;
     }  
     return $setsections;      return $setsections;
 }  }
   
   
 sub selectcourse_link {  sub selectcourse_link {
    my ($form,$unameele,$udomele,$desc,$extra_element,$multflag,$selecttype,     my ($form,$unameele,$udomele,$desc,$extra_element,$multflag,$selecttype)=@_;
        $typeelement) = @_;     return "<a href='".'javascript:opencrsbrowser("'.$form.'","'.$unameele.
    my $type = $selecttype;          '","'.$udomele.'","'.$desc.'","'.$extra_element.'","'.$multflag.'","'.$selecttype.'");'."'>".&mt('Select Course')."</a>";
    my $linktext = &mt('Select Course');  
    if ($selecttype eq 'Community') {  
        $linktext = &mt('Select Community');  
    } elsif ($selecttype eq 'Course/Community') {  
        $linktext = &mt('Select Course/Community');  
        $type = '';  
    }  
    return '<span class="LC_nobreak">'  
          ."<a href='"  
          .'javascript:opencrsbrowser("'.$form.'","'.$unameele  
          .'","'.$udomele.'","'.$desc.'","'.$extra_element  
          .'","'.$multflag.'","'.$type.'","'.$typeelement.'");'  
          ."'>".$linktext.'</a>'  
          .'</span>';  
 }  }
   
 sub selectauthor_link {  sub selectauthor_link {
Line 782  sub selectauthor_link { Line 612  sub selectauthor_link {
           &mt('Select Author').'</a>';            &mt('Select Author').'</a>';
 }  }
   
 sub selectuser_link {  
     my ($form,$unameelem,$domelem,$lastelem,$firstelem,$emailelem,$hdomelem,  
         $coursedom,$linktext,$caller) = @_;  
     return '<a href="javascript:openuserbrowser('."'$form','$unameelem','$domelem',".  
            "'$lastelem','$firstelem','$emailelem','$hdomelem','$coursedom','$caller'".  
            ');">'.$linktext.'</a>';  
 }  
   
 sub check_uncheck_jscript {  sub check_uncheck_jscript {
     my $jscript = <<"ENDSCRT";      my $jscript = <<"ENDSCRT";
 function checkAll(field) {  function checkAll(field) {
Line 888  sub select_datelocale { Line 710  sub select_datelocale {
     return $output;      return $output;
 }  }
   
 sub select_language {  
     my ($name,$selected,$includeempty) = @_;  
     my %langchoices;  
     if ($includeempty) {  
         %langchoices = ('' => 'No language preference');  
     }  
     foreach my $id (&languageids()) {  
         my $code = &supportedlanguagecode($id);  
         if ($code) {  
             $langchoices{$code} = &plainlanguagedescription($id);  
         }  
     }  
     return &select_form($selected,$name,%langchoices);  
 }  
   
 =pod  =pod
   
 =item * &linked_select_forms(...)  =item * &linked_select_forms(...)
Line 989  sub linked_select_forms { Line 796  sub linked_select_forms {
     my $first = "document.$formname.$firstselectname";      my $first = "document.$formname.$firstselectname";
     # output the javascript to do the changing      # output the javascript to do the changing
     my $result = '';      my $result = '';
     $result.='<script type="text/javascript" language="JavaScript">'."\n";      $result.="<script type=\"text/javascript\">\n";
     $result.="// <![CDATA[\n";  
     $result.="var select2data = new Object();\n";      $result.="var select2data = new Object();\n";
     $" = '","';      $" = '","';
     my $debug = '';      my $debug = '';
Line 1036  function select1_changed() { Line 842  function select1_changed() {
         }          }
     }      }
 }  }
 // ]]>  
 </script>  </script>
 END  END
     # output the initial values for the selection lists      # output the initial values for the selection lists
Line 1121  sub help_open_topic { Line 926  sub help_open_topic {
     if ($text ne "") {      if ($text ne "") {
  $template .=    $template .= 
             "<table bgcolor='#3333AA' cellspacing='1' cellpadding='1' border='0'><tr>".              "<table bgcolor='#3333AA' cellspacing='1' cellpadding='1' border='0'><tr>".
             "<td bgcolor='#5555FF'><span class=\"LC_nobreak\"><a target=\"_top\" href=\"$link\"><font color='#FFFFFF' size='2'>$text</font></a>";              "<td bgcolor='#5555FF'><a target=\"_top\" href=\"$link\"><span style=\"color:#FFFFFF;font-size:10pt;\">$text</span></a>";
     }      }
   
     # Add the graphic      # Add the graphic
     my $title = &mt('Online Help');      my $title = &mt('Online Help');
     my $helpicon=&lonhttpdurl("/adm/help/help.png");      my $helpicon=&lonhttpdurl("/adm/help/help.png");
     $template .= '<a target="_top" href="'.$link.'" title="'.$title.'">'.      $template .= <<"ENDTEMPLATE";
                  '<img src="'.$helpicon.'" border="0" alt="'.&mt('Help: [_1]',$topic).   <a target="_top" href="$link" title="$title"><img src="$helpicon" border="0" alt="(Help: $topic)" /></a>
                  '" title="'.$title.'" /></a>';  ENDTEMPLATE
     if ($text ne '') {      if ($text ne '') { $template.='</td></tr></table>' };
         $template.='</span></td></tr></table>';  
     }  
     return $template;      return $template;
   
 }  }
Line 1140  sub help_open_topic { Line 943  sub help_open_topic {
 # This is a quicky function for Latex cheatsheet editing, since it   # This is a quicky function for Latex cheatsheet editing, since it 
 # appears in at least four places  # appears in at least four places
 sub helpLatexCheatsheet {  sub helpLatexCheatsheet {
     my ($topic,$text,$not_author) = @_;      my $other = shift;
     my $out;  
     my $addOther = '';      my $addOther = '';
     if ($topic) {      if ($other) {
  $addOther = &Apache::loncommon::help_open_topic($topic,$text,   $addOther = Apache::loncommon::help_open_topic($other, shift,
        undef, undef, 600) .         undef, undef, 600) .
    '</td><td>';     '</td><td>';
     }      }
     $out = '<table><tr><td>'.      return '<table><tr><td>'.
            $addOther .   $addOther .
            &Apache::loncommon::help_open_topic("Greek_Symbols",&mt('Greek Symbols'),   &Apache::loncommon::help_open_topic("Greek_Symbols",&mt('Greek Symbols'),
                                                undef,undef,600).      undef,undef,600)
            '</td><td>'.   .'</td><td>'.
            &Apache::loncommon::help_open_topic("Other_Symbols",&mt('Other Symbols'),   &Apache::loncommon::help_open_topic("Other_Symbols",&mt('Other Symbols'),
                                                undef,undef,600).      undef,undef,600)
            '</td>';   .'</td><td>'.
     unless ($not_author) {   &Apache::loncommon::help_open_topic("Authoring_Output_Tags",&mt('Output Tags'),
         $out .= '<td>'.                                      undef,undef,600)
                 &Apache::loncommon::help_open_topic("Authoring_Output_Tags",&mt('Output Tags'),   .'</td></tr></table>';
                                                     undef,undef,600).  
                 '</td>';  
     }  
     $out .= '</tr></table>';  
     return $out;  
 }  }
   
 sub general_help {  sub general_help {
     my $helptopic='Student_Intro';      my $helptopic='Student_Intro';
     if ($env{'request.role'}=~/^(ca|au)/) {      if ($env{'request.role'}=~/^(ca|au)/) {
  $helptopic='Authoring_Intro';   $helptopic='Authoring_Intro';
     } elsif ($env{'request.role'}=~/^(cc|co)/) {      } elsif ($env{'request.role'}=~/^cc/) {
  $helptopic='Course_Coordination_Intro';   $helptopic='Course_Coordination_Intro';
     } elsif ($env{'request.role'}=~/^dc/) {      } elsif ($env{'request.role'}=~/^dc/) {
         $helptopic='Domain_Coordination_Intro';          $helptopic='Domain_Coordination_Intro';
Line 1190  sub update_help_link { Line 987  sub update_help_link {
     my $banner_link = "/adm/helpmenu?page=banner&amp;topic=$topic&amp;component_help=$component_help&amp;faq=$faq&amp;bug=$bug&amp;origurl=$origurl&amp;stamp=$timestamp&amp;stayonpage=$stayOnPage";      my $banner_link = "/adm/helpmenu?page=banner&amp;topic=$topic&amp;component_help=$component_help&amp;faq=$faq&amp;bug=$bug&amp;origurl=$origurl&amp;stamp=$timestamp&amp;stayonpage=$stayOnPage";
     my $output .= <<"ENDOUTPUT";      my $output .= <<"ENDOUTPUT";
 <script type="text/javascript">  <script type="text/javascript">
 // <![CDATA[  
 banner_link = '$banner_link';  banner_link = '$banner_link';
 // ]]>  
 </script>  </script>
 ENDOUTPUT  ENDOUTPUT
     return $output;      return $output;
Line 1269  sub help_menu_js { Line 1064  sub help_menu_js {
   
     my $template .= <<"ENDTEMPLATE";      my $template .= <<"ENDTEMPLATE";
 <script type="text/javascript">  <script type="text/javascript">
 // <![CDATA[  
 // <!-- BEGIN LON-CAPA Internal  // <!-- BEGIN LON-CAPA Internal
   // <![CDATA[
 var banner_link = '';  var banner_link = '';
 function helpMenu(target) {  function helpMenu(target) {
     var caller = this;      var caller = this;
Line 1295  function writeHelp(caller) { Line 1090  function writeHelp(caller) {
     caller.document.close()      caller.document.close()
     caller.focus()      caller.focus()
 }  }
 // END LON-CAPA Internal -->  
 // ]]>  // ]]>
   // END LON-CAPA Internal -->
 </script>  </script>
 ENDTEMPLATE  ENDTEMPLATE
     return $template;      return $template;
Line 1333  sub help_open_bug { Line 1128  sub help_open_bug {
     {      {
  $template .=    $template .= 
   "<table bgcolor='#AA3333' cellspacing='1' cellpadding='1' border='0'><tr>".    "<table bgcolor='#AA3333' cellspacing='1' cellpadding='1' border='0'><tr>".
   "<td bgcolor='#FF5555'><a target=\"_top\" href=\"$link\"><font color='#FFFFFF' size='2'>$text</font></a>";    "<td bgcolor='#FF5555'><a target=\"_top\" href=\"$link\"><span style=\"color:#FFFFFF;font-size:10pt;\">$text</span></a>";
     }      }
   
     # Add the graphic      # Add the graphic
Line 1378  sub help_open_faq { Line 1173  sub help_open_faq {
     {      {
  $template .=    $template .= 
   "<table bgcolor='#337733' cellspacing='1' cellpadding='1' border='0'><tr>".    "<table bgcolor='#337733' cellspacing='1' cellpadding='1' border='0'><tr>".
   "<td bgcolor='#448844'><a target=\"_top\" href=\"$link\"><font color='#FFFFFF' size='2'>$text</font></a>";    "<td bgcolor='#448844'><a target=\"_top\" href=\"$link\"><span style=\"color:#FFFFFF; font-size:10pt;\">$text</span></a>";
     }      }
   
     # Add the graphic      # Add the graphic
Line 1564  sub resize_textarea_js { Line 1359  sub resize_textarea_js {
     my $geometry = &viewport_geometry_js();      my $geometry = &viewport_geometry_js();
     return <<"RESIZE";      return <<"RESIZE";
     <script type="text/javascript">      <script type="text/javascript">
 // <![CDATA[  
 $geometry  $geometry
   
 function getX(element) {  function getX(element) {
Line 1603  function resize_textarea(textarea_id,bot Line 1397  function resize_textarea(textarea_id,bot
     }      }
     textarea.style.height=new_height+'px';      textarea.style.height=new_height+'px';
 }  }
 // ]]>  
 </script>  </script>
 RESIZE  RESIZE
   
Line 1836  sub multiple_select_form { Line 1629  sub multiple_select_form {
             $size = scalar(keys(%$hash));              $size = scalar(keys(%$hash));
         }          }
     }      }
     $output.="\n".'<select name="'.$name.'" size="'.$size.'" multiple="multiple">';      $output.="\n<select name='$name' size='$size' multiple='1'>";
     my @order;      my @order;
     if (ref($order) eq 'ARRAY')  {      if (ref($order) eq 'ARRAY')  {
         @order = @{$order};          @order = @{$order};
Line 1893  sub select_form { Line 1686  sub select_form {
 sub display_filter {  sub display_filter {
     if (!$env{'form.show'}) { $env{'form.show'}=10; }      if (!$env{'form.show'}) { $env{'form.show'}=10; }
     if (!$env{'form.displayfilter'}) { $env{'form.displayfilter'}='currentfolder'; }      if (!$env{'form.displayfilter'}) { $env{'form.displayfilter'}='currentfolder'; }
     return '<span class="LC_nobreak"><label>'.&mt('Records [_1]',      return '<nobr><label>'.&mt('Records [_1]',
        &Apache::lonmeta::selectbox('show',$env{'form.show'},undef,         &Apache::lonmeta::selectbox('show',$env{'form.show'},undef,
    (&mt('all'),10,20,50,100,1000,10000))).     (&mt('all'),10,20,50,100,1000,10000))).
    '</label></span> <span class="LC_nobreak">'.     '</label></nobr> <nobr>'.
            &mt('Filter [_1]',             &mt('Filter [_1]',
    &select_form($env{'form.displayfilter'},     &select_form($env{'form.displayfilter'},
  'displayfilter',   'displayfilter',
  ('currentfolder' => 'Current folder/page',   ('currentfolder' => 'Current folder/page',
  'containing' => 'Containing phrase',   'containing' => 'Containing phrase',
  'none' => 'None'))).   'none' => 'None'))).
  '<input type="text" name="containingphrase" size="30" value="'.&HTML::Entities::encode($env{'form.containingphrase'}).'" /></span>';   '<input type="text" name="containingphrase" size="30" value="'.&HTML::Entities::encode($env{'form.containingphrase'}).'" /></nobr>';
 }  }
   
 sub gradeleveldescription {  sub gradeleveldescription {
Line 1947  sub select_level_form { Line 1740  sub select_level_form {
   
 =pod  =pod
   
 =item * &select_dom_form($defdom,$name,$includeempty,$showdomdesc,$onchange,$incdoms)  =item * &select_dom_form($defdom,$name,$includeempty,$showdomdesc)
   
 Returns a string containing a <select name='$name' size='1'> form to   Returns a string containing a <select name='$name' size='1'> form to 
 allow a user to select the domain to preform an operation in.    allow a user to select the domain to preform an operation in.  
Line 1956  See loncreateuser.pm for an example invo Line 1749  See loncreateuser.pm for an example invo
 If the $includeempty flag is set, it also includes an empty choice ("no domain  If the $includeempty flag is set, it also includes an empty choice ("no domain
 selected");  selected");
   
 If the $showdomdesc flag is set, the domain name is followed by the domain description.  If the $showdomdesc flag is set, the domain name is followed by the domain description. 
   
 The optional $onchange argument specifies what should occur if the domain selector is changed, e.g., 'this.form.submit()' if the form is to be automatically submitted.  
   
 The optional $incdoms is a reference to an array of domains which will be the only available options.  
   
 =cut  =cut
   
 #-------------------------------------------  #-------------------------------------------
 sub select_dom_form {  sub select_dom_form {
     my ($defdom,$name,$includeempty,$showdomdesc,$onchange,$incdoms) = @_;      my ($defdom,$name,$includeempty,$showdomdesc) = @_;
     if ($onchange) {      my @domains = sort {lc($a) cmp lc($b)} (&Apache::lonnet::all_domains());
         $onchange = ' onchange="'.$onchange.'"';  
     }  
     my @domains;  
     if (ref($incdoms) eq 'ARRAY') {  
         @domains = sort {lc($a) cmp lc($b)} (@{$incdoms});  
     } else {  
         @domains = sort {lc($a) cmp lc($b)} (&Apache::lonnet::all_domains());  
     }  
     if ($includeempty) { @domains=('',@domains); }      if ($includeempty) { @domains=('',@domains); }
     my $selectdomain = "<select name=\"$name\" size=\"1\"$onchange>\n";      my $selectdomain = "<select name=\"$name\" size=\"1\">\n";
     foreach my $dom (@domains) {      foreach my $dom (@domains) {
         $selectdomain.="<option value=\"$dom\" ".          $selectdomain.="<option value=\"$dom\" ".
             ($dom eq $defdom ? 'selected="selected" ' : '').'>'.$dom;              ($dom eq $defdom ? 'selected="selected" ' : '').'>'.$dom;
Line 2033  sub home_server_form_item { Line 1814  sub home_server_form_item {
     if ($numlib > 1) {      if ($numlib > 1) {
         $result .= '<select name="'.$name.'" />'."\n";          $result .= '<select name="'.$name.'" />'."\n";
         if ($default) {          if ($default) {
             $result .= '<option value="default" selected="selected">'.&mt('default').              $result .= '<option value="default" selected>'.&mt('default').
                        '</option>'."\n";                         '</option>'."\n";
         }          }
         foreach my $hostid (sort(keys(%servers))) {          foreach my $hostid (sort(keys(%servers))) {
Line 2328  sub authform_kerberos { Line 2109  sub authform_kerberos {
         $autharg,$jscall);          $autharg,$jscall);
     my ($authnum,%can_assign) =  &get_assignable_auth($in{'domain'});      my ($authnum,%can_assign) =  &get_assignable_auth($in{'domain'});
     if ($in{'kerb_def_auth'} eq 'krb5') {      if ($in{'kerb_def_auth'} eq 'krb5') {
        $check5 = ' checked="checked"';         $check5 = ' checked="on"';
     } else {      } else {
        $check4 = ' checked="checked"';         $check4 = ' checked="on"';
     }      }
     $krbarg = $in{'kerb_def_dom'};      $krbarg = $in{'kerb_def_dom'};
     if (defined($in{'curr_authtype'})) {      if (defined($in{'curr_authtype'})) {
         if ($in{'curr_authtype'} eq 'krb') {          if ($in{'curr_authtype'} eq 'krb') {
             $krbcheck = ' checked="checked"';              $krbcheck = ' checked="on"';
             if (defined($in{'mode'})) {              if (defined($in{'mode'})) {
                 if ($in{'mode'} eq 'modifyuser') {                  if ($in{'mode'} eq 'modifyuser') {
                     $krbcheck = '';                      $krbcheck = '';
Line 2343  sub authform_kerberos { Line 2124  sub authform_kerberos {
             }              }
             if (defined($in{'curr_kerb_ver'})) {              if (defined($in{'curr_kerb_ver'})) {
                 if ($in{'curr_krb_ver'} eq '5') {                  if ($in{'curr_krb_ver'} eq '5') {
                     $check5 = ' checked="checked"';                      $check5 = ' checked="on"';
                     $check4 = '';                      $check4 = '';
                 } else {                  } else {
                     $check4 = ' checked="checked"';                      $check4 = ' checked="on"';
                     $check5 = '';                      $check5 = '';
                 }                  }
             }              }
Line 2367  sub authform_kerberos { Line 2148  sub authform_kerberos {
         }          }
     } else {      } else {
         if ($authnum == 1) {          if ($authnum == 1) {
             $authtype = '<input type="hidden" name="login" value="krb" />';              $authtype = '<input type="hidden" name="login" value="krb">';
         }          }
     }      }
     if (!$can_assign{'krb4'} && !$can_assign{'krb5'}) {      if (!$can_assign{'krb4'} && !$can_assign{'krb5'}) {
Line 2376  sub authform_kerberos { Line 2157  sub authform_kerberos {
         if (defined($in{'mode'})) {          if (defined($in{'mode'})) {
             if ($in{'mode'} eq 'modifycourse') {              if ($in{'mode'} eq 'modifycourse') {
                 if ($authnum == 1) {                  if ($authnum == 1) {
                     $authtype = '<input type="hidden" name="login" value="krb" />';                      $authtype = '<input type="hidden" name="login" value="krb">';
                 }                  }
             }              }
         }          }
Line 2437  sub authform_internal{ Line 2218  sub authform_internal{
     if (defined($in{'curr_authtype'})) {      if (defined($in{'curr_authtype'})) {
         if ($in{'curr_authtype'} eq 'int') {          if ($in{'curr_authtype'} eq 'int') {
             if ($can_assign{'int'}) {              if ($can_assign{'int'}) {
                 $intcheck = 'checked="checked" ';                  $intcheck = 'checked="on" ';
                 if (defined($in{'mode'})) {                  if (defined($in{'mode'})) {
                     if ($in{'mode'} eq 'modifyuser') {                      if ($in{'mode'} eq 'modifyuser') {
                         $intcheck = '';                          $intcheck = '';
Line 2453  sub authform_internal{ Line 2234  sub authform_internal{
         }          }
     } else {      } else {
         if ($authnum == 1) {          if ($authnum == 1) {
             $authtype = '<input type="hidden" name="login" value="int" />';              $authtype = '<input type="hidden" name="login" value="int">';
         }          }
     }      }
     if (!$can_assign{'int'}) {      if (!$can_assign{'int'}) {
Line 2462  sub authform_internal{ Line 2243  sub authform_internal{
         if (defined($in{'mode'})) {          if (defined($in{'mode'})) {
             if ($in{'mode'} eq 'modifycourse') {              if ($in{'mode'} eq 'modifycourse') {
                 if ($authnum == 1) {                  if ($authnum == 1) {
                     $authtype = '<input type="hidden" name="login" value="int" />';                      $authtype = '<input type="hidden" name="login" value="int">';
                 }                  }
             }              }
         }          }
Line 2477  sub authform_internal{ Line 2258  sub authform_internal{
     $result = &mt      $result = &mt
         ('[_1] Internally authenticated (with initial password [_2])',          ('[_1] Internally authenticated (with initial password [_2])',
          '<label>'.$authtype,'</label>'.$autharg);           '<label>'.$authtype,'</label>'.$autharg);
     $result.="<label><input type=\"checkbox\" name=\"visible\" onclick='if (this.checked) { this.form.intarg.type=\"text\" } else { this.form.intarg.type=\"password\" }' />".&mt('Visible input').'</label>';      $result.="<label><input type=\"checkbox\" name=\"visible\" onClick='if (this.checked) { this.form.intarg.type=\"text\" } else { this.form.intarg.type=\"password\" }' />".&mt('Visible input').'</label>';
     return $result;      return $result;
 }  }
   
Line 2492  sub authform_local{ Line 2273  sub authform_local{
     if (defined($in{'curr_authtype'})) {      if (defined($in{'curr_authtype'})) {
         if ($in{'curr_authtype'} eq 'loc') {          if ($in{'curr_authtype'} eq 'loc') {
             if ($can_assign{'loc'}) {              if ($can_assign{'loc'}) {
                 $loccheck = 'checked="checked" ';                  $loccheck = 'checked="on" ';
                 if (defined($in{'mode'})) {                  if (defined($in{'mode'})) {
                     if ($in{'mode'} eq 'modifyuser') {                      if ($in{'mode'} eq 'modifyuser') {
                         $loccheck = '';                          $loccheck = '';
Line 2508  sub authform_local{ Line 2289  sub authform_local{
         }          }
     } else {      } else {
         if ($authnum == 1) {          if ($authnum == 1) {
             $authtype = '<input type="hidden" name="login" value="loc" />';              $authtype = '<input type="hidden" name="login" value="loc">';
         }          }
     }      }
     if (!$can_assign{'loc'}) {      if (!$can_assign{'loc'}) {
Line 2517  sub authform_local{ Line 2298  sub authform_local{
         if (defined($in{'mode'})) {          if (defined($in{'mode'})) {
             if ($in{'mode'} eq 'modifycourse') {              if ($in{'mode'} eq 'modifycourse') {
                 if ($authnum == 1) {                  if ($authnum == 1) {
                     $authtype = '<input type="hidden" name="login" value="loc" />';                      $authtype = '<input type="hidden" name="login" value="loc">';
                 }                  }
             }              }
         }          }
Line 2546  sub authform_filesystem{ Line 2327  sub authform_filesystem{
     if (defined($in{'curr_authtype'})) {      if (defined($in{'curr_authtype'})) {
         if ($in{'curr_authtype'} eq 'fsys') {          if ($in{'curr_authtype'} eq 'fsys') {
             if ($can_assign{'fsys'}) {              if ($can_assign{'fsys'}) {
                 $fsyscheck = 'checked="checked" ';                  $fsyscheck = 'checked="on" ';
                 if (defined($in{'mode'})) {                  if (defined($in{'mode'})) {
                     if ($in{'mode'} eq 'modifyuser') {                      if ($in{'mode'} eq 'modifyuser') {
                         $fsyscheck = '';                          $fsyscheck = '';
Line 2559  sub authform_filesystem{ Line 2340  sub authform_filesystem{
         }          }
     } else {      } else {
         if ($authnum == 1) {          if ($authnum == 1) {
             $authtype = '<input type="hidden" name="login" value="fsys" />';              $authtype = '<input type="hidden" name="login" value="fsys">';
         }          }
     }      }
     if (!$can_assign{'fsys'}) {      if (!$can_assign{'fsys'}) {
Line 2568  sub authform_filesystem{ Line 2349  sub authform_filesystem{
         if (defined($in{'mode'})) {          if (defined($in{'mode'})) {
             if ($in{'mode'} eq 'modifycourse') {              if ($in{'mode'} eq 'modifycourse') {
                 if ($authnum == 1) {                  if ($authnum == 1) {
                     $authtype = '<input type="hidden" name="login" value="fsys" />';                      $authtype = '<input type="hidden" name="login" value="fsys">';
                 }                  }
             }              }
         }          }
Line 2936  sub flush_email_cache { Line 2717  sub flush_email_cache {
     &Apache::lonnet::devalidate_cache_new('emailscache',$id);      &Apache::lonnet::devalidate_cache_new('emailscache',$id);
 }  }
   
 # -------------------------------------------------------------------- getlangs  
   
 =pod  
   
 =item * &getlangs($uname,$udom)  
   
 Gets a user's language preference and returns it as a hash with key:  
 language.  
   
 =cut  
   
   
 sub getlangs {  
     my ($uname,$udom) = @_;  
     if (!$udom)  { $udom =$env{'user.domain'}; }  
     if (!$uname) { $uname=$env{'user.name'};   }  
     my $id=$uname.':'.$udom;  
     my ($langs,$cached)=&Apache::lonnet::is_cached_new('userlangs',$id);  
     if ($cached) {  
         return %{$langs};  
     } else {  
         my %loadlangs=&Apache::lonnet::get('environment',['languages'],  
                                            $udom,$uname);  
         &Apache::lonnet::do_cache_new('userlangs',$id,\%loadlangs);  
         return %loadlangs;  
     }  
 }  
   
 sub flush_langs_cache {  
     my ($uname,$udom)=@_;  
     if (!$udom)  { $udom =$env{'user.domain'}; }  
     if (!$uname) { $uname=$env{'user.name'};   }  
     return if ($udom eq 'public' && $uname eq 'public');  
     my $id=$uname.':'.$udom;  
     &Apache::lonnet::devalidate_cache_new('userlangs',$id);  
 }  
   
 # ------------------------------------------------------------------ Screenname  # ------------------------------------------------------------------ Screenname
   
 =pod  =pod
Line 2991  sub screenname { Line 2735  sub screenname {
     return $names{'screenname'};      return $names{'screenname'};
 }  }
   
 # ------------------------------------------------------------- Confirm Wrapper  
 =pod  
   
 =item confirmwrapper  
   
 Wrap messages about completion of operation in box  
   
 =cut  
   
 sub confirmwrapper {  
     my ($message)=@_;  
     if ($message) {  
         return "\n".'<div class="LC_confirm_box">'."\n"  
                .$message."\n"  
                .'</div>'."\n";  
     } else {  
         return $message;  
     }  
 }  
   
 # ------------------------------------------------------------- Message Wrapper  # ------------------------------------------------------------- Message Wrapper
   
Line 3036  sub aboutmewrapper { Line 2761  sub aboutmewrapper {
         return;          return;
     }      }
     return '<a href="/adm/'.$domain.'/'.$username.'/aboutme"'.      return '<a href="/adm/'.$domain.'/'.$username.'/aboutme"'.
  ($target?' target="$target"':'').' title="'.&mt("View this user's personal information page").'">'.$link.'</a>';   ($target?' target="$target"':'').' title="'.&mt("View this user's personal page").'">'.$link.'</a>';
 }  }
   
 # ------------------------------------------------------------ Syllabus Wrapper  # ------------------------------------------------------------ Syllabus Wrapper
Line 3045  sub aboutmewrapper { Line 2770  sub aboutmewrapper {
 sub syllabuswrapper {  sub syllabuswrapper {
     my ($linktext,$coursedir,$domain,$fontcolor)=@_;      my ($linktext,$coursedir,$domain,$fontcolor)=@_;
     if ($fontcolor) {       if ($fontcolor) { 
         $linktext='<font color="'.$fontcolor.'">'.$linktext.'</font>';           $linktext='<span style="color:'.$fontcolor.';">'.$linktext.'</span>'; 
     }      }
     return qq{<a href="/public/$domain/$coursedir/syllabus">$linktext</a>};      return qq{<a href="/public/$domain/$coursedir/syllabus">$linktext</a>};
 }  }
   
 sub track_student_link {  sub track_student_link {
     my ($linktext,$sname,$sdom,$target,$start,$only_body) = @_;      my ($linktext,$sname,$sdom,$target,$start) = @_;
     my $link ="/adm/trackstudent?";      my $link ="/adm/trackstudent?";
     my $title = 'View recent activity';      my $title = 'View recent activity';
     if (defined($sname) && $sname !~ /^\s*$/ &&      if (defined($sname) && $sname !~ /^\s*$/ &&
Line 3065  sub track_student_link { Line 2790  sub track_student_link {
         $target = '';          $target = '';
     }      }
     if ($start) { $link.='&amp;start='.$start; }      if ($start) { $link.='&amp;start='.$start; }
     if ($only_body) { $link .= '&amp;only_body=1'; }  
     $title = &mt($title);      $title = &mt($title);
     $linktext = &mt($linktext);      $linktext = &mt($linktext);
     return qq{<a href="$link" title="$title" $target>$linktext</a>}.      return qq{<a href="$link" title="$title" $target>$linktext</a>}.
  &help_open_topic('View_recent_activity');   &help_open_topic('View_recent_activity');
 }  }
   
 sub slot_reservations_link {  
     my ($linktext,$sname,$sdom,$target) = @_;  
     my $link ="/adm/slotrequest?command=showresv&amp;origin=aboutme";  
     my $title = 'View slot reservation history';  
     if (defined($sname) && $sname !~ /^\s*$/ &&  
         defined($sdom)  && $sdom  !~ /^\s*$/) {  
         $link .= "&amp;uname=$sname&amp;udom=$sdom";  
         $title .= ' of this student';  
     }  
     if (defined($target) && $target !~ /^\s*$/) {  
         $target = qq{target="$target"};  
     } else {  
         $target = '';  
     }  
     $title = &mt($title);  
     $linktext = &mt($linktext);  
     return qq{<a href="$link" title="$title" $target>$linktext</a>};  
 # FIXME uncomment when help item created: &help_open_topic('Slot_Reservation_History');  
   
 }  
   
 # ===================================================== Display a student photo  # ===================================================== Display a student photo
   
   
Line 3330  sub languages { Line 3033  sub languages {
     return $preferred_possibilities[0];      return $preferred_possibilities[0];
 }  }
   
 sub user_lang {  
     my ($touname,$toudom,$fromcid) = @_;  
     my @userlangs;  
     if (($fromcid ne '') && ($env{'course.'.$fromcid.'.languages'} ne '')) {  
         @userlangs=(@userlangs,split(/\s*(\,|\;|\:)\s*/,  
                     $env{'course.'.$fromcid.'.languages'}));  
     } else {  
         my %langhash = &getlangs($touname,$toudom);  
         if ($langhash{'languages'} ne '') {  
             @userlangs = split(/\s*(\,|\;|\:)\s*/,$langhash{'languages'});  
         } else {  
             my %domdefs = &Apache::lonnet::get_domain_defaults($toudom);  
             if ($domdefs{'lang_def'} ne '') {  
                 @userlangs = ($domdefs{'lang_def'});  
             }  
         }  
     }  
     my @languages=&Apache::lonlocal::get_genlanguages(@userlangs);  
     my $user_lh = Apache::localize->get_handle(@languages);  
     return $user_lh;  
 }  
   
 ###############################################################  ###############################################################
 ##               Student Answer Attempts                     ##  ##               Student Answer Attempts                     ##
 ###############################################################  ###############################################################
Line 3490  sub relative_to_absolute { Line 3171  sub relative_to_absolute {
     }      }
     $thisdir=~s-/[^/]*$--;      $thisdir=~s-/[^/]*$--;
     foreach my $link (@rlinks) {      foreach my $link (@rlinks) {
  unless (($link=~/^https?\:\/\//i) ||   unless (($link=~/^http:\/\//i) ||
  ($link=~/^\//) ||   ($link=~/^\//) ||
  ($link=~/^javascript:/i) ||   ($link=~/^javascript:/i) ||
  ($link=~/^mailto:/i) ||   ($link=~/^mailto:/i) ||
Line 3741  sub findallcourses { Line 3422  sub findallcourses {
         if (!%roles) {          if (!%roles) {
             %roles = (              %roles = (
                        cc => 1,                         cc => 1,
                        co => 1,  
                        in => 1,                         in => 1,
                        ep => 1,                         ep => 1,
                        ta => 1,                         ta => 1,
Line 4068  sub blocking_status { Line 3748  sub blocking_status {
                              &Apache::lonnet::coursedescription($course);                               &Apache::lonnet::coursedescription($course);
                         $coursedesc = $courseinfo{'description'};                          $coursedesc = $courseinfo{'description'};
                     }                      }
                     $category = "Group portfolio files in the course '$coursedesc'";                      $category = "Group files in the course '$coursedesc'";
                 } else {                  } else {
                     $category = 'Portfolio files belonging to ';                      $category = 'Portfolio files belonging to ';
                     if ($env{'user.name'} eq 'public' &&                       if ($env{'user.name'} eq 'public' && 
Line 4171  sub determinedomain { Line 3851  sub determinedomain {
     my $domain=shift;      my $domain=shift;
     if (! $domain) {      if (! $domain) {
         # Determine domain if we have not been given one          # Determine domain if we have not been given one
         $domain = &Apache::lonnet::default_login_domain();          $domain = $Apache::lonnet::perlvar{'lonDefDomain'};
         if ($env{'user.domain'}) { $domain=$env{'user.domain'}; }          if ($env{'user.domain'}) { $domain=$env{'user.domain'}; }
         if ($env{'request.role.domain'}) {           if ($env{'request.role.domain'}) { 
             $domain=$env{'request.role.domain'};               $domain=$env{'request.role.domain'}; 
Line 4202  sub get_domainconf { Line 3882  sub get_domainconf {
                 foreach my $key (keys(%{$domconfig{'login'}})) {                  foreach my $key (keys(%{$domconfig{'login'}})) {
                     if (ref($domconfig{'login'}{$key}) eq 'HASH') {                      if (ref($domconfig{'login'}{$key}) eq 'HASH') {
                         foreach my $img (keys(%{$domconfig{'login'}{$key}})) {                          foreach my $img (keys(%{$domconfig{'login'}{$key}})) {
                             $designhash{$udom.'.login.'.$key.'_'.$img} =                              $designhash{$udom.'.login.'.$key.'_'.$img} = 
                                 $domconfig{'login'}{$key}{$img};                                  $domconfig{'login'}{$key}{$img};
                         }                          }
                     } else {                      } else {
Line 4429  sub bodytag { Line 4109  sub bodytag {
     my $font =   &designparm($function.'.font',$domain);      my $font =   &designparm($function.'.font',$domain);
     my $pgbg   = $bgcolor || &designparm($function.'.pgbg',$domain);      my $pgbg   = $bgcolor || &designparm($function.'.pgbg',$domain);
   
     my %design = ( 'style'   => 'margin-top: 0',      my %design = ( 'style'   => 'margin-top: 0px',
    'bgcolor' => $pgbg,     'bgcolor' => $pgbg,
    'text'    => $font,     'text'    => $font,
                    'alink'   => &designparm($function.'.alink',$domain),                     'alink'   => &designparm($function.'.alink',$domain),
Line 4540  ENDROLE Line 4220  ENDROLE
  .'<b>'.&mt('Construction Space').'</b>:&nbsp;'   .'<b>'.&mt('Construction Space').'</b>:&nbsp;'
  .'<form name="dirs" method="post" action="'.$formaction   .'<form name="dirs" method="post" action="'.$formaction
  .'" target="_top"><tt><b>'   .'" target="_top"><tt><b>'
  .&Apache::lonhtmlcommon::crumbs($uname.'/'.$parentpath,'_top','/priv','','+1',1)."<font size=\"+1\">$lastitem</font></b></tt><br />"   .&Apache::lonhtmlcommon::crumbs($uname.'/'.$parentpath,'_top','/priv','','+1',1)."<span class=\"LC_fontsize_big\">$lastitem</span></b></tt><br />"
  .&Apache::lonhtmlcommon::select_recent('construct','recent','this.form.action=this.form.recent.value;this.form.submit()')   .&Apache::lonhtmlcommon::select_recent('construct','recent','this.form.action=this.form.recent.value;this.form.submit()')
  .'</form>'   .'</form>'
  .&Apache::lonmenu::constspaceform();   .&Apache::lonmenu::constspaceform();
Line 4714  sub standard_css { Line 4394  sub standard_css {
     my $vlink  = &designparm($function.'.vlink', $domain);      my $vlink  = &designparm($function.'.vlink', $domain);
     my $link   = &designparm($function.'.link',  $domain);      my $link   = &designparm($function.'.link',  $domain);
   
       my $loginbg = &designparm('login.sidebg',$domain);
   
     my $sans                 = 'Verdana,Arial,Helvetica,sans-serif';      my $sans                 = 'Verdana,Arial,Helvetica,sans-serif';
     my $mono                 = 'monospace';      my $mono                 = 'monospace';
     my $data_table_head      = $tabbg;      my $data_table_head      = $tabbg;
     my $data_table_light     = '#FAFAFA';      my $data_table_light     = '#EEEEEE';
     my $data_table_dark      = '#F0F0F0';      my $data_table_dark      = '#DDDDDD';
     my $data_table_darker    = '#CCCCCC';      my $data_table_darker    = '#CCCCCC';
     my $data_table_highlight = '#FFFF00';      my $data_table_highlight = '#FFFF00';
     my $mail_new             = '#FFBB77';      my $mail_new             = '#FFBB77';
Line 4731  sub standard_css { Line 4413  sub standard_css {
     my $mail_other_hover     = '#669999';      my $mail_other_hover     = '#669999';
     my $table_header         = '#DDDDDD';      my $table_header         = '#DDDDDD';
     my $feedback_link_bg     = '#BBBBBB';      my $feedback_link_bg     = '#BBBBBB';
     my $lg_border_color      = '#C8C8C8';      my $lg_border_color     = '#C8C8C8';
   
     my $border = ($env{'browser.type'} eq 'explorer' ||      my $border = ($env{'browser.type'} eq 'explorer' ||
   $env{'browser.type'} eq 'safari'     ) ? '0 2px 0 2px'    $env{'browser.type'} eq 'safari'     ) ? '0px 2px 0px 2px'
                                                  : '0 3px 0 4px';                                                   : '0px 3px 0px 4px';
   
   
     return <<END;      return <<END;
 h1, h2, h3, th { font-family: $sans }  body{
 a:focus { color: red; background: yellow }        font-family: $sans;
        line-height:130%;
 hr {       font-size:0.83em;
   clear: both;       color:$font;
   color: $tabbg;    }
   background-color: $tabbg;  a:link, a:visited { font-size:100%; }
   height: 3px;  
   border: none;  
 }  
   
   a:focus { color: red; background: yellow } 
 table.thinborder,  table.thinborder,
   
 table.thinborder tr th {  table.thinborder tr th {
   border-style: solid;    border-style: solid;
   border-width: 1px;    border-width: 1px;
     border-color: $lg_border_color;
   background: $tabbg;    background: $tabbg;
 }  }
 table.thinborder tr td {  table.thinborder tr td {
   border-style: solid;    border-style: solid;
   border-width: 1px    border-width: 1px;
     border-color: $lg_border_color;
 }  }
   
 form, .inline { display: inline; }  form, .inline { display: inline; }
 .center { text-align: center; }  .center { text-align: center; }
   .left { text-align:left; }
   .right {text-align:right;}
   .middle {vertical-align:middle;}
   .top {vertical-align:top;}
   .bottom {vertical-align:bottom;}
 .LC_filename {font-family: $mono; white-space:pre;}  .LC_filename {font-family: $mono; white-space:pre;}
 .LC_error {  .LC_error {
   color: red;    color: red;
Line 4779  form, .inline { display: inline; } Line 4465  form, .inline { display: inline; }
 .LC_diff_added {  .LC_diff_added {
   color: green;    color: green;
 }  }
   .LC_unknown {
 div.LC_confirm_box {    color: yellow;
   background-color: #FAFAFA;  
   border: 1px solid $lg_border_color;  
   margin-right: 0;  
   padding: 5px;  
 }  
   
 div.LC_confirm_box .LC_error img,  
 div.LC_confirm_box .LC_success img {  
   vertical-align: middle;  
 }  }
   
 .LC_icon {  .LC_icon {
   border: none;    border: 0px;
 }  }
 .LC_indexer_icon {  .LC_indexer_icon {
   border: 0;    border: 0px;
   height: 22px;    height: 22px;
 }  }
 .LC_docs_spacer {  .LC_docs_spacer {
   width: 25px;    width: 25px;
   height: 1px;    height: 1px;
   border: none;    border: 0px;
 }  }
   
 .LC_internal_info {  .LC_internal_info {
   color: #999999;    color: #999;
 }  
   
 .LC_discussion {  
    background: $tabbg;  
    border: 1px solid black;  
    margin: 2px;  
 }  
   
 .LC_disc_action_links_bar {  
    background: $tabbg;  
    border: none;  
    margin: 4px;  
 }  
   
 .LC_disc_action_left {  
    text-align: left;  
 }  
   
 .LC_disc_action_right {  
    text-align: right;  
 }  
   
 .LC_disc_new_item {  
    background: white;  
    border: 2px solid red;  
    margin: 2px;  
 }  
   
 .LC_disc_old_item {  
    background: white;  
    border: 1px solid black;  
    margin: 2px;  
 }  }
   
 table.LC_pastsubmission {  table.LC_pastsubmission {
Line 4851  table#LC_top_nav, table#LC_menubuttons,t Line 4496  table#LC_top_nav, table#LC_menubuttons,t
   background: $pgbg;    background: $pgbg;
   border: 2px;    border: 2px;
   border-collapse: separate;    border-collapse: separate;
   padding: 0;    padding: 0px;
 }  }
   
 table#LC_title_bar, table.LC_breadcrumbs,   table#LC_title_bar, table.LC_breadcrumbs, 
Line 4864  table#LC_title_bar.LC_with_remote { Line 4509  table#LC_title_bar.LC_with_remote {
   background: $pgbg;    background: $pgbg;
   font-family: $sans;    font-family: $sans;
   border-collapse: collapse;    border-collapse: collapse;
   padding: 0;    padding: 0px;
 }  }
   
 table.LC_docs_path {  table.LC_docs_path {
   width: 100%;    width: 100%;
   border: 0;    border: 0;
   background: $pgbg;    background: $pgbg;
   font-family: $sans;    font-family: $sans;
   border-collapse: collapse;    border-collapse: collapse;
   padding: 0;    padding: 0px;
 }  }
   
 table#LC_title_bar td {  table#LC_title_bar td {
Line 4894  span.LC_title_bar_title { Line 4538  span.LC_title_bar_title {
 table#LC_title_bar td.LC_title_bar_domain_logo {  table#LC_title_bar td.LC_title_bar_domain_logo {
   background: $sidebg;    background: $sidebg;
   text-align: right;    text-align: right;
   padding: 0;    padding: 0px;
 }  }
 table#LC_title_bar td.LC_title_bar_role_logo {  table#LC_title_bar td.LC_title_bar_role_logo {
   background: $sidebg;    background: $sidebg;
   padding: 0;    padding: 0px;
 }  }
   
 table#LC_menubuttons_mainmenu {  table#LC_menubuttons img{
   width: 100%;    border: 0px;
   border: 0;  
   border-spacing: 1px;  
   padding: 0 1px;  
   margin: 0;  
   border-collapse: separate;  
 }  
 table#LC_menubuttons img, table#LC_menubuttons_mainmenu img {  
   border: none;  
 }  }
 table#LC_top_nav td {  table#LC_top_nav td {
   background: $tabbg;    background: $tabbg;
   border: none;    border: 0px;
   font-size: small;    font-size: small;
     vertical-align:top;
     padding:2px 5px 2px 5px;
 }  }
 table#LC_top_nav td a, div#LC_top_nav a {  table#LC_top_nav td a, div#LC_top_nav a {
   color: $font;    color: $font;
Line 4928  table#LC_top_nav td.LC_top_nav_logo { Line 4566  table#LC_top_nav td.LC_top_nav_logo {
   width: 31px;    width: 31px;
 }  }
 table#LC_top_nav td.LC_top_nav_logo img {  table#LC_top_nav td.LC_top_nav_logo img {
   border: none;    border: 0px;
   vertical-align: bottom;    vertical-align: bottom;
 }  }
 table#LC_top_nav td.LC_top_nav_exit,  table#LC_top_nav td.LC_top_nav_exit,
Line 4960  table#LC_mainmenu td.LC_mainmenu_column Line 4598  table#LC_mainmenu td.LC_mainmenu_column
     vertical-align: top;      vertical-align: top;
 }  }
   
   .LC_fontsize_small
   {
    font-size: 70%;
   }
   
   .LC_fontsize_medium
   {
    font-size: 85%;
   }
   
   .LC_fontsize_large
   {
    font-size: 120%;
   }
   
   .LC_fontcolor_red
   {
    color: #FF0000;
   }
   
 .LC_menubuttons_inline_text {  .LC_menubuttons_inline_text {
   color: $font;    color: $font;
   font-family: $sans;    font-family: $sans;
   font-size: smaller;    font-size: 90%;
     padding-left:3px;
 }  }
   
 .LC_menubuttons_link {  .LC_menubuttons_link {
Line 4979  table#LC_mainmenu td.LC_mainmenu_column Line 4638  table#LC_mainmenu td.LC_mainmenu_column
 }  }
   
 td.LC_menubuttons_text {  td.LC_menubuttons_text {
   width: 90%;    color: $font;
   color: $font;  
   font-family: $sans;  
 }  }
   
 td.LC_menubuttons_img {  
 }  
   
 .LC_current_location {  .LC_current_location {
   font-family: $sans;    font-family: $sans;
Line 4997  td.LC_menubuttons_img { Line 4653  td.LC_menubuttons_img {
   font-weight: bold;    font-weight: bold;
 }  }
   
   .LC_rolesmenu_is {
     font-family: $sans;
   }
   
   .LC_rolesmenu_selected {
     font-family: $sans;
   }
   
   .LC_rolesmenu_future {
     font-family: $sans;
   }
   
   
   .LC_rolesmenu_will {
     font-family: $sans;
   }
   
   .LC_rolesmenu_will_not {
     font-family: $sans;
   }
   
   .LC_rolesmenu_expired {
     font-family: $sans;
   }
   
   .LC_rolesinfo {
     font-family: $sans;
   }
   
 .LC_dropadd_labeltext {  .LC_dropadd_labeltext {
   font-family: $sans;    font-family: $sans;
   text-align: right;    text-align: right;
Line 5008  td.LC_menubuttons_img { Line 4693  td.LC_menubuttons_img {
 }  }
   
 .LC_roleslog_note {  .LC_roleslog_note {
   font-size: smaller;    font-size: small;
 }  
   
 .LC_mail_functions {  
     font-weight: bold;  
 }  }
   
 table.LC_aboutme_port {  table.LC_aboutme_port {
   border: none;    border: 0px;
   border-collapse: collapse;    border-collapse: collapse;
   border-spacing: 0;    border-spacing: 0px;
 }  }
 table.LC_data_table, table.LC_mail_list {  table.LC_data_table, table.LC_mail_list {
   border: 1px solid #000000;    border: 1px solid #000000;
Line 5032  table.LC_data_table, table.LC_mail_list Line 4713  table.LC_data_table, table.LC_mail_list
 table.LC_nested_outer {  table.LC_nested_outer {
   border: 1px solid #000000;    border: 1px solid #000000;
   border-collapse: collapse;    border-collapse: collapse;
   border-spacing: 0;    border-spacing: 0px;
   width: 100%;    width: 100%;
 }  }
 table.LC_innerpickbox,  
 table.LC_nested {  table.LC_nested {
   border: none;    border: 0px;
   border-collapse: collapse;    border-collapse: collapse;
   border-spacing: 0;    border-spacing: 0px;
   width: 100%;    width: 100%;
 }  }
 table.LC_data_table tr th, table.LC_calendar tr th, table.LC_mail_list tr th,  table.LC_data_table tr th, table.LC_calendar tr th, table.LC_mail_list tr th,
 table.LC_prior_tries tr th,  table.LC_prior_tries tr th {
 table.LC_innerpickbox tr th {  
   font-weight: bold;    font-weight: bold;
   background-color: $data_table_head;    background-color: $data_table_head;
   font-size: smaller;    font-size:90%;
 }  
 table.LC_innerpickbox tr th,  
 table.LC_innerpickbox tr td {  
   vertical-align: top;  
 }  
 table.LC_data_table tr.LC_info_row > td {  
   background-color: #CCCCCC;  
   font-weight: bold;  
   text-align: left;  
 }  }
 table.LC_data_table tr.LC_odd_row > td,   table.LC_data_table tr.LC_odd_row > td, 
 table.LC_pick_box tr > td.LC_odd_row,  
 table.LC_aboutme_port tr td {  table.LC_aboutme_port tr td {
   background-color: $data_table_light;    background-color: $data_table_light;
   padding: 2px;    padding: 2px;
 }  }
 table.LC_data_table tr.LC_even_row > td,  table.LC_data_table tr.LC_even_row > td,
 table.LC_pick_box tr > td.LC_even_row,  
 table.LC_aboutme_port tr.LC_even_row td {  table.LC_aboutme_port tr.LC_even_row td {
   background-color: $data_table_dark;    background-color: $data_table_dark;
   padding: 2px;  
 }  }
 table.LC_data_table tr.LC_data_table_highlight td {  table.LC_data_table tr.LC_data_table_highlight td {
   background-color: $data_table_darker;    background-color: $data_table_darker;
Line 5091  table.LC_nested tr.LC_empty_row td { Line 4758  table.LC_nested tr.LC_empty_row td {
 table.LC_nested_outer tr th {  table.LC_nested_outer tr th {
   font-weight: bold;    font-weight: bold;
   background-color: $data_table_head;    background-color: $data_table_head;
   font-size: smaller;    font-size: small;
   border-bottom: 1px solid #000000;    border-bottom: 1px solid #000000;
 }  }
 table.LC_nested_outer tr td.LC_subheader {  table.LC_nested_outer tr td.LC_subheader {
Line 5102  table.LC_nested_outer tr td.LC_subheader Line 4769  table.LC_nested_outer tr td.LC_subheader
   text-align: right;    text-align: right;
 }  }
 table.LC_nested tr.LC_info_row td {  table.LC_nested tr.LC_info_row td {
   background-color: #CCCCCC;    background-color: #CCC;
   font-weight: bold;    font-weight: bold;
   font-size: small;    font-size: small;
   text-align: center;    text-align: center;
Line 5112  table.LC_nested_outer tr th.LC_left_item Line 4779  table.LC_nested_outer tr th.LC_left_item
   text-align: left;    text-align: left;
 }  }
 table.LC_nested td {  table.LC_nested td {
   background-color: #FFFFFF;    background-color: #FFF;
   font-size: small;    font-size: small;
 }  }
 table.LC_nested_outer tr th.LC_right_item,  table.LC_nested_outer tr th.LC_right_item,
Line 5123  table.LC_nested tr td.LC_right_item { Line 4790  table.LC_nested tr td.LC_right_item {
 }  }
   
 table.LC_nested tr.LC_odd_row td {  table.LC_nested tr.LC_odd_row td {
   background-color: #EEEEEE;    background-color: #EEE;
 }  }
   
 table.LC_createuser {  table.LC_createuser {
 }  }
   
 table.LC_createuser tr.LC_section_row td {  table.LC_createuser tr.LC_section_row td {
   font-size: smaller;    font-size: small;
 }  }
   
 table.LC_createuser tr.LC_info_row td  {  table.LC_createuser tr.LC_info_row td  {
   background-color: #CCCCCC;    background-color: #CCC;
   font-weight: bold;    font-weight: bold;
   text-align: center;    text-align: center;
 }  }
Line 5186  table.LC_mail_list tr.LC_mail_even { Line 4853  table.LC_mail_list tr.LC_mail_even {
 table.LC_mail_list tr.LC_mail_odd {  table.LC_mail_list tr.LC_mail_odd {
 }  }
   
   
 table#LC_portfolio_actions {  
   width: auto;  
   background: $pgbg;  
   border: none;  
   border-spacing: 2px 2px;  
   padding: 0;  
   margin: 0;  
   border-collapse: separate;  
 }  
 table#LC_portfolio_actions td.LC_label {  
   background: $tabbg;  
   text-align: right;  
 }  
 table#LC_portfolio_actions td.LC_value {  
   background: $tabbg;  
 }  
   
 table#LC_cstr_controls {  table#LC_cstr_controls {
   width: 100%;    width: 100%;
   border-collapse: collapse;    border-collapse: collapse;
Line 5222  table#LC_cstr_controls tr th { Line 4871  table#LC_cstr_controls tr th {
   font-size: smaller;    font-size: smaller;
 }  }
   
 table#LC_browser {  table.LC_data_table tr > td.LC_browser_file,
    table.LC_data_table tr > td.LC_browser_file_published {
 }  
 table#LC_browser tr th {  
   background: $table_header;  
 }  
 table#LC_browser tr td {  
   padding: 2px;  
 }  
 table#LC_browser tr.LC_browser_file,  
 table#LC_browser tr.LC_browser_file_published {  
   background: #CCFF88;    background: #CCFF88;
 }  }
 table#LC_browser tr.LC_browser_file_locked,  table.LC_data_table tr > td.LC_browser_file_locked,
 table#LC_browser tr.LC_browser_file_unpublished {  table.LC_data_table tr > td.LC_browser_file_unpublished {
   background: #FFAA99;    background: #FFAA99;
 }  }
 table#LC_browser tr.LC_browser_file_obsolete {  table.LC_data_table tr > td.LC_browser_file_obsolete {
   background: #AAAAAA;    background: #AAAAAA;
 }  }
 table#LC_browser tr.LC_browser_file_modified,  table.LC_data_table tr > td.LC_browser_file_modified,
 table#LC_browser tr.LC_browser_file_metamodified {  table.LC_data_table tr > td.LC_browser_file_metamodified {
   background: #FFFF77;    background: #FFFF77;
 }  }
 table#LC_browser tr.LC_browser_folder {  table.LC_data_table tr.LC_browser_folder > td {
   background: #CCCCFF;    background: #CCCCFF;
 }  }
   
 table.LC_data_table tr > td.LC_roles_is {  
 /*  background: #77FF77; */  
 }  
 table.LC_data_table tr > td.LC_roles_future {  
   background: #FFFF77;  
 }  
 table.LC_data_table tr > td.LC_roles_will {  
   background: #FFAA77;  
 }  
 table.LC_data_table tr > td.LC_roles_expired {  
   background: #FF7777;  
 }  
 table.LC_data_table tr > td.LC_roles_will_not {  
   background: #AAFF77;  
 }  
 table.LC_data_table tr > td.LC_roles_selected {  
   background: #11CC55;  
 }  
   
 span.LC_current_location {  span.LC_current_location {
   font-size: x-large;    font-size:larger;
   background: $pgbg;    background: $pgbg;
 }  }
   
Line 5314  table.LC_parm_overview_restrictions th { Line 4935  table.LC_parm_overview_restrictions th {
   border-color: $pgbg;    border-color: $pgbg;
 }  }
 table#LC_helpmenu {  table#LC_helpmenu {
   border: none;    border: 0px;
   height: 55px;    height: 55px;
   border-spacing: 0;    border-spacing: 0px;
 }  }
   
 table#LC_helpmenu fieldset legend {  table#LC_helpmenu fieldset legend {
Line 5327  table#LC_helpmenu_links { Line 4948  table#LC_helpmenu_links {
   width: 100%;    width: 100%;
   border: 1px solid black;    border: 1px solid black;
   background: $pgbg;    background: $pgbg;
   padding: 0;    padding: 0px;
   border-spacing: 1px;    border-spacing: 1px;
 }  }
 table#LC_helpmenu_links tr td {  table#LC_helpmenu_links tr td {
Line 5369  table.LC_pick_box td.LC_pick_box_title { Line 4990  table.LC_pick_box td.LC_pick_box_title {
   background: $tabbg;    background: $tabbg;
   font-weight: bold;    font-weight: bold;
   text-align: right;    text-align: right;
   vertical-align: top;  
   width: 184px;    width: 184px;
   padding: 8px;    padding: 8px;
 }  }
Line 5390  table.LC_pick_box td.LC_pick_box_select Line 5010  table.LC_pick_box td.LC_pick_box_select
   padding: 8px;    padding: 8px;
 }  }
 table.LC_pick_box td.LC_pick_box_separator {  table.LC_pick_box td.LC_pick_box_separator {
   padding: 0;    padding: 0px;
   height: 1px;    height: 1px;
   background: black;    background: black;
 }  }
Line 5432  table.LC_helpform_receipt td.LC_oddrow_v Line 5052  table.LC_helpform_receipt td.LC_oddrow_v
   background-color: $data_table_light;    background-color: $data_table_light;
 }  }
 table.LC_helpform_receipt td.LC_pick_box_separator {  table.LC_helpform_receipt td.LC_pick_box_separator {
   padding: 0;    padding: 0px;
   height: 1px;    height: 1px;
   background: black;    background: black;
 }  }
Line 5465  table.LC_group_priv_box td.LC_groups_fun Line 5085  table.LC_group_priv_box td.LC_groups_fun
 }  }
 table.LC_group_priv td {  table.LC_group_priv td {
   text-align: left;    text-align: left;
   padding: 0;    padding: 0px;
 }  }
   
 table.LC_notify_front_page {  table.LC_notify_front_page {
Line 5486  table.LC_notify_front_page td { Line 5106  table.LC_notify_front_page td {
   background: $tabbg;    background: $tabbg;
   vertical-align: middle;    vertical-align: middle;
   margin: 2ex 0ex 2ex 0ex;    margin: 2ex 0ex 2ex 0ex;
   padding: 3px;  
 }  }
 .LC_topic_bar span {  .LC_topic_bar span {
   vertical-align: middle;    vertical-align: middle;
Line 5603  span.LC_cusr_subheading { Line 5222  span.LC_cusr_subheading {
   
 table.LC_docs_documents {  table.LC_docs_documents {
   background: #BBBBBB;    background: #BBBBBB;
   border-width: 0;    border-width: 0px;
   border-collapse: collapse;    border-collapse: collapse;
 }  }
   
Line 5620  table.LC_docs_documents td.LC_docs_docum Line 5239  table.LC_docs_documents td.LC_docs_docum
 }  }
   
 .LC_docs_entry_move {  .LC_docs_entry_move {
   border: none;    border: 0px;
   border-collapse: collapse;    border-collapse: collapse;
 }  }
   
Line 5676  table.LC_sty_end { Line 5295  table.LC_sty_end {
 }  }
   
 table.LC_double_column {  table.LC_double_column {
   border-width: 0;    border-width: 0px;
   border-collapse: collapse;    border-collapse: collapse;
   width: 100%;    width: 100%;
   padding: 2px;    padding: 2px;
Line 5727  div.LC_grade_select_mode_selector { Line 5346  div.LC_grade_select_mode_selector {
   float: left;    float: left;
 }  }
 div.LC_grade_select_mode_selector_header {  div.LC_grade_select_mode_selector_header {
   font: bold medium $sans;    font-weight: bold;
     font-size: medium;
 }  }
 div.LC_grade_select_mode_type {  div.LC_grade_select_mode_type {
   clear: left;    clear: left;
Line 5740  div.LC_grade_show_user { Line 5360  div.LC_grade_show_user {
 div.LC_grade_user_name {  div.LC_grade_user_name {
   background: #DDDDEE;    background: #DDDDEE;
   border-bottom: 1px solid black;    border-bottom: 1px solid black;
   font: bold large $sans;    font-weight: bold;
     font-size: large;
 }  }
 div.LC_grade_show_user_odd_row div.LC_grade_user_name {  div.LC_grade_show_user_odd_row div.LC_grade_user_name {
   background: #DDEEDD;    background: #DDEEDD;
Line 5759  div.LC_grade_show_problem_header, Line 5380  div.LC_grade_show_problem_header,
 div.LC_grade_submissions_header,  div.LC_grade_submissions_header,
 div.LC_grade_message_center_header,  div.LC_grade_message_center_header,
 div.LC_grade_assign_header {  div.LC_grade_assign_header {
   font: bold large $sans;    font-weight: bold;
     font-size: large;
 }  }
 div.LC_grade_show_problem_problem,  div.LC_grade_show_problem_problem,
 div.LC_grade_submissions_body,  div.LC_grade_submissions_body,
Line 5770  div.LC_grade_assign_body { Line 5392  div.LC_grade_assign_body {
   background: #FFFFFF;    background: #FFFFFF;
 }  }
 span.LC_grade_check_note {  span.LC_grade_check_note {
   font: normal medium $sans;    font-weight: normal;
     font-size: medium;
   display: inline;    display: inline;
   position: absolute;    position: absolute;
   right: 1em;    right: 1em;
Line 5780  table.LC_scantron_action { Line 5403  table.LC_scantron_action {
   width: 100%;    width: 100%;
 }  }
 table.LC_scantron_action tr th {  table.LC_scantron_action tr th {
   font: normal bold $sans;    font-weight:bold;
     font-style:normal;
 }  }
   .LC_edit_problem_header, 
 div.LC_edit_problem_header,   
 div.LC_edit_problem_footer {  div.LC_edit_problem_footer {
   font: normal medium $sans;    font-weight: normal;
     font-size:  medium;
   margin: 2px;    margin: 2px;
 }  }
 div.LC_edit_problem_header,  div.LC_edit_problem_header,
Line 5802  div.LC_edit_problem_header_edit_row { Line 5426  div.LC_edit_problem_header_edit_row {
   margin-bottom: 5px;    margin-bottom: 5px;
 }  }
 div.LC_edit_problem_header_title {  div.LC_edit_problem_header_title {
   font: larger bold $sans;    font-weight: bold;
     font-size: larger;
   background: $tabbg;    background: $tabbg;
   padding: 3px;    padding: 3px;
 }  }
 table.LC_edit_problem_header_title {  table.LC_edit_problem_header_title {
   font: larger bold $sans;    font-size: larger;
     font-weight:  bold;
   width: 100%;    width: 100%;
   border-color: $pgbg;    border-color: $pgbg;
   border-style: solid;    border-style: solid;
Line 5815  table.LC_edit_problem_header_title { Line 5441  table.LC_edit_problem_header_title {
   
   background: $tabbg;    background: $tabbg;
   border-collapse: collapse;    border-collapse: collapse;
   padding: 0;    padding: 0px
 }  }
   
 div.LC_edit_problem_discards {  div.LC_edit_problem_discards {
Line 5831  hr.LC_edit_problem_divide { Line 5457  hr.LC_edit_problem_divide {
   color: $tabbg;    color: $tabbg;
   background-color: $tabbg;    background-color: $tabbg;
   height: 3px;    height: 3px;
   border: none;    border: 0px;
 }  }
 img.stift{  img.stift{
   border-width:0;    border-width:0;
Line 5855  table#LC_mainmenu td.LC_mainmenu_col_fie Line 5481  table#LC_mainmenu td.LC_mainmenu_col_fie
   font-size: small;    font-size: small;
   font-weight: bold;    font-weight: bold;
 }  }
 fieldset#LC_mainmenu_fieldset {  
   margin:0 10px 10px 0;  
   
   /* ---- Remove when done ----
   # The following styles is part of the redesign of LON-CAPA and are
   # subject to change during this project.
   # Don't rely on their current functionality as they might be 
   # changed or removed.
   # --------------------------*/
   
   a:hover,
   ol.smallMenu a:hover,
   ol#MenuBreadcrumbs a:hover,
   ul#TabMainMenuContent a:hover,
   .FormSectionClearButton input:hover{
    color:#BF2317;
           text-decoration:none;
   }
   
   h1 { 
    padding:5px 10px 5px 0px;
    line-height:130%;
   }
   
   h2,h3,h4,h5,h6
   {
   margin:5px 0px 5px 0px;
   line-height:130%;
   }
   .hcell{
           padding:3px 15px 3px 15px;
           margin:0px;
    background-color:$tabbg;
    border-bottom:solid 1px $lg_border_color;       
   }
   .noBorder {
           border:0px;
   }
   /*
   .bgLightGrey { background:URL(images/TabMenuBG.png) repeat-x left top; }
   .bgLightGreyYellow {background-color:#EFECE0;}
   */
   
   
   /* Main Header with discription of Person, Course, etc. */
   .HeadRight {
    text-align: right;
    float: right;
    margin: 0px;
    padding: 0px;
           right:0;
           position:absolute;
           overflow:hidden;
   }
   
   p {
    padding: 10px;
   
   }
   .FormSectionClearButton input {
           background-color:transparent;
           border:0px;
           cursor:pointer;
           text-decoration:underline;
   }
   
   
   dl,ul,div,fieldset {
    margin: 10px 10px 10px 0px;
    overflow:hidden;
   }
   ol.smallMenu {
    margin: 0px;
   }
   
   ol.smallMenu li {
    display: inline;
    padding: 5px 5px 0px 10px;
    vertical-align: top;
   }
   
   ol.smallMenu li img {
    vertical-align: bottom;
   }
   
   ol.smallMenu a {
    font-size: 90%;
    color: RGB(80, 80, 80);
    text-decoration: none;
   }
   
   ol#TabMainMenuContent {
   
    margin: 0px 0px 10px 0px;
    padding: 0px;
   }
   
   ol#TabMainMenuContent li {
    display: inline;
    vertical-align: bottom;
    border-bottom: solid 1px RGB(175, 175, 175);
    border-right: solid 1px RGB(175, 175, 175);
    padding: 5px 15px 5px 15px;
    margin-right:4px;
    line-height: 140%;
    font-weight: bold;
    overflow:hidden;
   /* background: RGB(211, 206, 205) URL(images/TabMenuBG.png) repeat-x left top;*/
   }
   
   ol#TabMainMenuContent li a{
    color: RGB(47, 47, 47);
    text-decoration: none;
   }
   
   ol#TabMainMenuContent div.columnSection {
    margin-bottom: 0px;
   }
   
   ol#MenuBreadcrumbs, ol#PathBreadcrumbs {
    border-top: solid 1px RGB(255, 255, 255);
    height: 20px;
    line-height: 20px;
    vertical-align: bottom;
    margin: 0px 0px 30px 0px;
    padding-left: 10px;
    list-style-position: inside;
   /* background: RGB(211, 206, 205) URL(images/TabMenuBG.png) repeat-x left
    top;*/
   }
   
   ol#MenuBreadcrumbs li, ol#PathBreadcrumbs li {
   /* background: url(images/pfeil_white.png) no-repeat left center;*/
    display: inline;
    padding: 0px 0px 0px 10px;
    vertical-align: bottom;
    overflow:hidden;
   }
   
   ol#MenuBreadcrumbs li a {
    text-decoration: none;
    font-size:90%;
   }
   ol#PathBreadcrumbs li a{
    text-decoration:none;
    font-size:100%;
    font-weight:bold;
   }
   
   .ContentBoxSpecial
   {
    border: solid 1px $lg_border_color;
   }
   .ContentBox {
    padding:10px;
   }
   .PopUp
   {
    padding:10px;
    border-left:solid 1px $lg_border_color;
     border-top:solid 1px $lg_border_color;
    border-bottom:outset 1px $lg_border_color;
    border-right:outset 1px $lg_border_color;
    display:none;
    position:absolute;
    right:0;
    background-color:white;
    z-index:5;
   }
   
   dl.ListStyleClean dt {
    padding-right: 5px;
    display: table-header-group;
   }
   
   dl.ListStyleClean dd {
    display: table-row;
   }
   
   .ListStyleClean,
   .ListStyleSimple,
   .ListStyleNormal,
   .ListStyleNormal_Border,
   .ListStyleSpecial
    {
    /*display:block; */
    list-style-position: inside;
    list-style-type: none;
    overflow: hidden;
    padding: 0px;
   }
   
   .ListStyleSimple li,
   .ListStyleSimple dd,
   .ListStyleNormal li,
   .ListStyleNormal dd,
   .ListStyleSpecial li,
   .ListStyleSpecial dd
    {
    margin: 0px;
    padding: 5px 5px 5px 10px;
    clear: both;
   }
   
   .ListStyleClean li,
   .ListStyleClean dd {
    padding-top: 0px;
    padding-bottom: 0px;
   }
   
   .ListStyleSimple dd,
   .ListStyleSimple li{
    border-bottom: solid 1px $lg_border_color;
   }
   
   .ListStyleSpecial li,
   .ListStyleSpecial dd {
    list-style-type: none;
    background-color: RGB(220, 220, 220);
    margin-bottom: 4px;
   }
   
   table.SimpleTable {
    margin:5px;
    border:solid 1px $lg_border_color;
    }
   
   table.SimpleTable tr {
    padding:0px;
    border:solid 1px $lg_border_color;
   }
   table.SimpleTable thead{
    background:rgb(220,220,220);
   }
   
   div.columnSection {
    display: block;
    clear: both;
    overflow: hidden;
    margin:0px;
   }
   
   div.columnSection>* {
    float: left;
    margin: 10px 20px 10px 0px;
    overflow:hidden;
   }
   div.columnSection > .ContentBox,
   div.columnSection > .ContentBoxSpecial
    {
    width: 400px;
   
   }
   
   .LC_loginpage_container {
    text-align:left;
    margin : 0 auto;
    width:65%;
    padding: 10px;
    height: auto;
   # background-color:#FFFFFF;
    background-color:$loginbg;
    border:1px solid #CCCCCC;
   }
   
   
   .LC_loginpage_loginContainer {
    float:left;
    width:60%;
   }
   
   .LC_loginpage_loginInfo {
    margin-top:20px;
    margin-left:20px;
    float:left;
    width:30%;
    border:1px solid #CCCCCC;
    padding:10px;
   }
   
   .LC_loginpage_space {
    clear:both;
    margin-bottom:20px;
    border-bottom: 1px solid #CCCCCC;
   }
   
   .LC_loginpage_fieldset{
    border: 1px solid #CCCCCC;
    margin: 0 auto;
 }  }
   
 div.LC_createcourse {  .LC_loginpage_legend{
     margin: 10px 10px 10px 10px;   padding: 2px;
    margin: 0px;
    font-size:14px;
    font-weight:bold;
 }  }
   
   
   
 END  END
 }  }
   
Line 5991  sub xml_begin { Line 5906  sub xml_begin {
             .'<html xmlns:math="http://www.w3.org/1998/Math/MathML" '               .'<html xmlns:math="http://www.w3.org/1998/Math/MathML" ' 
     .'xmlns="http://www.w3.org/1999/xhtml">';      .'xmlns="http://www.w3.org/1999/xhtml">';
     } else {      } else {
  $output='<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">'.   $output='<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html>';
             '<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">';  
     }      }
     return $output;      return $output;
 }  }
Line 6133  sub start_page { Line 6047  sub start_page {
     if ($args->{'html_encode'}) {      if ($args->{'html_encode'}) {
  $result = &html_encode($result);   $result = &html_encode($result);
     }      }
     #Breadcrumbs  
     if (exists($args->{'bread_crumbs'}) or exists($args->{'bread_crumbs_component'})) {  
         &Apache::lonhtmlcommon::clear_breadcrumbs();  
         #if any br links exists, add them to the breadcrumbs  
         if (exists($args->{'bread_crumbs'}) and ref($args->{'bread_crumbs'}) eq 'ARRAY') {  
             foreach my $crumb (@{$args->{'bread_crumbs'}}){  
                 &Apache::lonhtmlcommon::add_breadcrumb($crumb);  
             }  
         }  
   
         #if bread_crumbs_component exists show it as headline else show only the breadcrumbs  
         if (exists($args->{'bread_crumbs_component'})){  
             $result .= &Apache::lonhtmlcommon::breadcrumbs($args->{'bread_crumbs_component'});  
         } else {  
             $result .= &Apache::lonhtmlcommon::breadcrumbs();  
         }  
     }  
     return $result;      return $result;
 }  }
   
   
 =pod  =pod
   
 =item * &head()  =item * &head()
Line 6377  Returns either 'student','coordinator',' Line 6275  Returns either 'student','coordinator','
 ###############################################  ###############################################
 sub get_users_function {  sub get_users_function {
     my $function = 'student';      my $function = 'student';
     if ($env{'request.role'}=~/^(cc|co|in|ta|ep)/) {      if ($env{'request.role'}=~/^(cc|in|ta|ep)/) {
         $function='coordinator';          $function='coordinator';
     }      }
     if ($env{'request.role'}=~/^(su|dc|ad|li)/) {      if ($env{'request.role'}=~/^(su|dc|ad|li)/) {
         $function='admin';          $function='admin';
     }      }
     if (($env{'request.role'}=~/^(au|ca|aa)/) ||      if (($env{'request.role'}=~/^(au|ca)/) ||
         ($ENV{'REQUEST_URI'}=~/^(\/priv|\~)/)) {          ($ENV{'REQUEST_URI'}=~/^(\/priv|\~)/)) {
         $function='author';          $function='author';
     }      }
Line 6394  sub get_users_function { Line 6292  sub get_users_function {
   
 =pod  =pod
   
 =item * &show_course()  
   
 Used by lonmenu.pm and lonroles.pm to determine whether to use the word  
 'Courses' or 'Roles' in inline navigation and on screen displaying user's roles.  
 Inputs:  
 None  
   
 Outputs:  
 Scalar: 1 if 'Course' to be used, 0 otherwise.  
   
 =cut  
   
 ###############################################  
 sub show_course {  
     my $course = !$env{'user.adv'};  
     if (!$env{'user.adv'}) {  
         foreach my $env (keys(%env)) {  
             next if ($env !~ m/^user\.priv\./);  
             if ($env !~ m/^user\.priv\.(?:st|cm)/) {  
                 $course = 0;  
                 last;  
             }  
         }  
     }  
     return $course;  
 }  
   
 ###############################################  
   
 =pod  
   
 =item * &check_user_status()  =item * &check_user_status()
   
 Determines current status of supplied role for a  Determines current status of supplied role for a
Line 6447  sub check_user_status { Line 6314  sub check_user_status {
     my $active_chk = 'none';      my $active_chk = 'none';
     my $now = time;      my $now = time;
     if (@uroles > 0) {      if (@uroles > 0) {
         if (($role eq 'cc') || ($role eq 'co') || ($sec eq '') || (!defined($sec))) {          if (($role eq 'cc') || ($sec eq '') || (!defined($sec))) {
             $srchstr = '/'.$cdom.'/'.$crs.'_'.$role;              $srchstr = '/'.$cdom.'/'.$crs.'_'.$role;
         } else {          } else {
             $srchstr = '/'.$cdom.'/'.$crs.'/'.$sec.'_'.$role;              $srchstr = '/'.$cdom.'/'.$crs.'/'.$sec.'_'.$role;
Line 6928  If the user's status includes multiple t Line 6795  If the user's status includes multiple t
 the largest default quota which applies to the user determines the  the largest default quota which applies to the user determines the
 default quota returned.  default quota returned.
   
 =back  
   
 =cut  =cut
   
 ###############################################  ###############################################
Line 6942  sub default_quota { Line 6807  sub default_quota {
                                             ['quotas'],$udom);                                              ['quotas'],$udom);
     if (ref($quotahash{'quotas'}) eq 'HASH') {      if (ref($quotahash{'quotas'}) eq 'HASH') {
         if ($inststatus ne '') {          if ($inststatus ne '') {
             my @statuses = map { &unescape($_); } split(/:/,$inststatus);              my @statuses = split(/:/,$inststatus);
             foreach my $item (@statuses) {              foreach my $item (@statuses) {
                 if (ref($quotahash{'quotas'}{'defaultquota'}) eq 'HASH') {                  if ($quotahash{'quotas'}{$item} ne '') {
                     if ($quotahash{'quotas'}{'defaultquota'}{$item} ne '') {                      if ($defquota eq '') {
                         if ($defquota eq '') {                          $defquota = $quotahash{'quotas'}{$item};
                             $defquota = $quotahash{'quotas'}{'defaultquota'}{$item};                          $settingstatus = $item;
                             $settingstatus = $item;                      } elsif ($quotahash{'quotas'}{$item} > $defquota) {
                         } elsif ($quotahash{'quotas'}{'defaultquota'}{$item} > $defquota) {                          $defquota = $quotahash{'quotas'}{$item};
                             $defquota = $quotahash{'quotas'}{'defaultquota'}{$item};                          $settingstatus = $item;
                             $settingstatus = $item;  
                         }  
                     }  
                 } else {  
                     if ($quotahash{'quotas'}{$item} ne '') {  
                         if ($defquota eq '') {  
                             $defquota = $quotahash{'quotas'}{$item};  
                             $settingstatus = $item;  
                         } elsif ($quotahash{'quotas'}{$item} > $defquota) {  
                             $defquota = $quotahash{'quotas'}{$item};  
                             $settingstatus = $item;  
                         }  
                     }                      }
                 }                  }
             }              }
         }          }
         if ($defquota eq '') {          if ($defquota eq '') {
             if (ref($quotahash{'quotas'}{'defaultquota'}) eq 'HASH') {              $defquota = $quotahash{'quotas'}{'default'};
                 $defquota = $quotahash{'quotas'}{'defaultquota'}{'default'};  
             } else {  
                 $defquota = $quotahash{'quotas'}{'default'};  
             }  
             $settingstatus = 'default';              $settingstatus = 'default';
         }          }
     } else {      } else {
Line 7078  sub user_picker { Line 6927  sub user_picker {
         #       loncreateuser::print_user_query_page()          #       loncreateuser::print_user_query_page()
         #       has been completed.          #       has been completed.
         next if ($option eq 'alc');          next if ($option eq 'alc');
         next if (($option eq 'crs') && ($env{'form.form'} eq 'requestcrs'));  
         next if ($option eq 'crs' && !$env{'request.course.id'});          next if ($option eq 'crs' && !$env{'request.course.id'});
         if ($curr_selected{'srchin'} eq $option) {          if ($curr_selected{'srchin'} eq $option) {
             $srchinsel .= '               $srchinsel .= ' 
Line 7122  sub user_picker { Line 6970  sub user_picker {
                 if ($cancreate) {                  if ($cancreate) {
                     $new_user_create = '<p> <input type="submit" name="forcenew" value="'.&HTML::Entities::encode(&mt('Make new user "[_1]"',$srchterm),'<>&"').'" onclick="javascript:setSearch(\'1\','.$caller.');" /> </p>';                      $new_user_create = '<p> <input type="submit" name="forcenew" value="'.&HTML::Entities::encode(&mt('Make new user "[_1]"',$srchterm),'<>&"').'" onclick="javascript:setSearch(\'1\','.$caller.');" /> </p>';
                 } else {                  } else {
                     my $helplink = 'javascript:helpMenu('."'display'".')';                      my $helplink = ' href="javascript:helpMenu('."'display'".')"';
                     my %usertypetext = (                      my %usertypetext = (
                         official   => 'institutional',                          official   => 'institutional',
                         unofficial => 'non-institutional',                          unofficial => 'non-institutional',
                     );                      );
                     $new_user_create = '<p class="LC_warning">'.                      $new_user_create = '<br /><span class="LC_warning">'.&mt("You are not authorized to create new $usertypetext{$usertype} users in this domain.").' '.&mt('Contact the <a[_1]>helpdesk</a> for assistance.',$helplink).'</span><br /><br />';
                                        &mt("You are not authorized to create new $usertypetext{$usertype} users in this domain.").' '.  
                                        &mt('Please contact the [_1]helpdesk[_2] for assistance.','<a href="'.$helplink.'">','</a>').'</p><br />';  
                 }                  }
             }              }
         }          }
Line 7166  ENDSCRIPT Line 7012  ENDSCRIPT
   
     my $output = <<"END_BLOCK";      my $output = <<"END_BLOCK";
 <script type="text/javascript">  <script type="text/javascript">
 // <![CDATA[  
 function validateEntry(callingForm) {  function validateEntry(callingForm) {
   
     var checkok = 1;      var checkok = 1;
Line 7235  function validateEntry(callingForm) { Line 7080  function validateEntry(callingForm) {
   
 $newuserscript  $newuserscript
   
 // ]]>  
 </script>  </script>
   
 $new_user_create  $new_user_create
   
   <table>
    <tr>
     <td>$lt{'doma'}:</td>
     <td>$domform</td>
     </td>
    </tr>
    <tr>
     <td>$lt{'usr'}:</td>
     <td>$srchbysel
         $srchtypesel 
         <input type="text" size="15" name="srchterm" value="$srchterm" />
         $srchinsel 
     </td>
    </tr>
   </table>
   <br />
 END_BLOCK  END_BLOCK
   
     $output .= &Apache::lonhtmlcommon::start_pick_box().  
                &Apache::lonhtmlcommon::row_title($lt{'doma'}).  
                $domform.  
                &Apache::lonhtmlcommon::row_closure().  
                &Apache::lonhtmlcommon::row_title($lt{'usr'}).  
                $srchbysel.  
                $srchtypesel.  
                '<input type="text" size="15" name="srchterm" value="'.$srchterm.'" />'.  
                $srchinsel.  
                &Apache::lonhtmlcommon::row_closure(1).  
                &Apache::lonhtmlcommon::end_pick_box().  
                '<br />';  
     return $output;      return $output;
 }  }
   
Line 7409  sub personal_data_fieldtitles { Line 7257  sub personal_data_fieldtitles {
                         middlename => 'Middle Name',                          middlename => 'Middle Name',
                         generation => 'Generation',                          generation => 'Generation',
                         gen => 'Generation',                          gen => 'Generation',
                         inststatus => 'Affiliation',  
                    );                     );
     return %fieldtitles;      return %fieldtitles;
 }  }
Line 7479  sub get_institutional_codes { Line 7326  sub get_institutional_codes {
   
 =pod  =pod
   
 =head1 Slot Helpers  
   
 =over 4  
   
 =item * sorted_slots()  
   
 Sorts an array of slot names in order of slot start time (earliest first).  
   
 Inputs:  
   
 =over 4  
   
 slotsarr  - Reference to array of unsorted slot names.  
   
 slots     - Reference to hash of hash, where outer hash keys are slot names.  
   
 =back  
   
 Returns:  
   
 =over 4  
   
 sorted   - An array of slot names sorted by the start time of the slot.  
   
 =back  
   
 =back  =back
   
 =cut  
   
   
 sub sorted_slots {  
     my ($slotsarr,$slots) = @_;  
     my @sorted;  
     if ((ref($slotsarr) eq 'ARRAY') && (ref($slots) eq 'HASH')) {  
         @sorted =  
             sort {  
                      if (ref($slots->{$a}) && ref($slots->{$b})) {  
                          return $slots->{$a}{'starttime'} <=> $slots->{$b}{'starttime'}  
                      }  
                      if (ref($slots->{$a})) { return -1;}  
                      if (ref($slots->{$b})) { return 1;}  
                      return 0;  
                  } @{$slotsarr};  
     }  
     return @sorted;  
 }  
   
 =pod  
   
 =head1 HTTP Helpers  =head1 HTTP Helpers
   
 =over 4  =over 4
Line 7818  sub upload_embedded { Line 7617  sub upload_embedded {
                                    '&nbsp;<a href="'.$url.'">'.                                     '&nbsp;<a href="'.$url.'">'.
                                    $orig_uploaded_filename.'</a><br />';                                     $orig_uploaded_filename.'</a><br />';
                     } else {                      } else {
                         $output .= '<font size="+2">'.                          $output .= '<span class=\"LC_fontsize_large\">'.
                                    &mt('View embedded file: [_1]','<a href="'.$url.'">'.                                     &mt('View embedded file: [_1]','<a href="'.$url.'">'.
                                    $orig_uploaded_filename.'</a>').'</font><br />';                                     $orig_uploaded_filename.'</a>').'</span><br />';
                     }                      }
                 }                  }
                 close($fh);                  close($fh);
Line 8079  sub upfile_select_html { Line 7878  sub upfile_select_html {
 #                 xml   => &mt('HTML/XML'),  #                 xml   => &mt('HTML/XML'),
                  );                   );
     my $Str = '<input type="file" name="upfile" size="50" />'.      my $Str = '<input type="file" name="upfile" size="50" />'.
         '<br />'.&mt('Type').': <select name="upfiletype">';          '<br />Type: <select name="upfiletype">';
     foreach my $type (sort(keys(%Types))) {      foreach my $type (sort(keys(%Types))) {
         $Str .= '<option value="'.$type.'" >'.$Types{$type}."</option>\n";          $Str .= '<option value="'.$type.'" >'.$Types{$type}."</option>\n";
     }      }
Line 8125  sub csv_print_samples { Line 7924  sub csv_print_samples {
     $r->print(&mt('Samples').'<br />'.&start_data_table().      $r->print(&mt('Samples').'<br />'.&start_data_table().
               &start_data_table_header_row());                &start_data_table_header_row());
     foreach my $sample (sort({$a <=> $b} keys(%{ $samples->[0] }))) {       foreach my $sample (sort({$a <=> $b} keys(%{ $samples->[0] }))) { 
         $r->print('<th>'.&mt('Column [_1]',($sample+1)).'</th>');          $r->print('<th>'.&mt('Column&nbsp;[_1]',($sample+1)).'</th>'); }
     }  
     $r->print(&end_data_table_header_row());      $r->print(&end_data_table_header_row());
     foreach my $hash (@$samples) {      foreach my $hash (@$samples) {
  $r->print(&start_data_table_row());   $r->print(&start_data_table_row());
Line 8168  sub csv_print_select_table { Line 7966  sub csv_print_select_table {
               &end_data_table_header_row()."\n");                &end_data_table_header_row()."\n");
     foreach my $array_ref (@$d) {      foreach my $array_ref (@$d) {
  my ($value,$display,$defaultcol)=@{ $array_ref };   my ($value,$display,$defaultcol)=@{ $array_ref };
  $r->print(&start_data_table_row().'<td>'.$display.'</td>');   $r->print(&start_data_table_row().'<tr><td>'.$display.'</td>');
   
  $r->print('<td><select name"f'.$i.'"'.   $r->print('<td><select name=f'.$i.
   ' onchange="javascript:flip(this.form,'.$i.');">');    ' onchange="javascript:flip(this.form,'.$i.');">');
  $r->print('<option value="none"></option>');   $r->print('<option value="none"></option>');
  foreach my $sample (sort({$a <=> $b} keys(%{ $samples->[0] }))) {   foreach my $sample (sort({$a <=> $b} keys(%{ $samples->[0] }))) {
Line 8824  sub restore_settings { Line 8622  sub restore_settings {
   
 =item * &build_recipient_list()  =item * &build_recipient_list()
   
 Build recipient lists for five types of e-mail:  Build recipient lists for three types of e-mail:
 (a) Error Reports, (b) Package Updates, (c) lonstatus warnings/errors  (a) Error Reports, (b) Package Updates, (c) Help requests, generated by
 (d) Help requests, (e) Course requests needing approval,  generated by  lonerrorhandler.pm, CHECKRPMS and lonsupportreq.pm respectively.
 lonerrorhandler.pm, CHECKRPMS, loncron, lonsupportreq.pm and  
 loncoursequeueadmin.pm respectively.  
   
 Inputs:  Inputs:
 defmail (scalar - email address of default recipient),   defmail (scalar - email address of default recipient), 
Line 8852  sub build_recipient_list { Line 8648  sub build_recipient_list {
     my %domconfig =      my %domconfig =
          &Apache::lonnet::get_dom('configuration',['contacts'],$defdom);           &Apache::lonnet::get_dom('configuration',['contacts'],$defdom);
     if (ref($domconfig{'contacts'}) eq 'HASH') {      if (ref($domconfig{'contacts'}) eq 'HASH') {
         if (exists($domconfig{'contacts'}{$mailing})) {          if (ref($domconfig{'contacts'}{$mailing}) eq 'HASH') {
             if (ref($domconfig{'contacts'}{$mailing}) eq 'HASH') {              my @contacts = ('adminemail','supportemail');
                 my @contacts = ('adminemail','supportemail');              foreach my $item (@contacts) {
                 foreach my $item (@contacts) {                  if ($domconfig{'contacts'}{$mailing}{$item}) {
                     if ($domconfig{'contacts'}{$mailing}{$item}) {                      my $addr = $domconfig{'contacts'}{$item}; 
                         my $addr = $domconfig{'contacts'}{$item};                      if (!grep(/^\Q$addr\E$/,@recipients)) {
                         if (!grep(/^\Q$addr\E$/,@recipients)) {                          push(@recipients,$addr);
                             push(@recipients,$addr);  
                         }  
                     }                      }
                     $otheremails = $domconfig{'contacts'}{$mailing}{'others'};  
                 }                  }
                   $otheremails = $domconfig{'contacts'}{$mailing}{'others'};
             }              }
         } elsif ($origmail ne '') {  
             push(@recipients,$origmail);  
         }          }
     } elsif ($origmail ne '') {      } elsif ($origmail ne '') {
         push(@recipients,$origmail);          push(@recipients,$origmail);
Line 8998  sub extract_categories { Line 8790  sub extract_categories {
                 my $trailstr;                  my $trailstr;
                 if ($name eq 'instcode') {                  if ($name eq 'instcode') {
                     $trailstr = &mt('Official courses (with institutional codes)');                      $trailstr = &mt('Official courses (with institutional codes)');
                 } elsif ($name eq 'communities') {  
                     $trailstr = &mt('Communities');  
                 } else {                  } else {
                     $trailstr = $name;                      $trailstr = $name;
                 }                  }
Line 9110  Inputs: Line 8900  Inputs:
 cathash - reference to hash of categories defined for the domain (from  cathash - reference to hash of categories defined for the domain (from
           configuration.db)            configuration.db)
   
 currcat - scalar with an & separated list of categories assigned to a course.  currcat - scalar with an & separated list of categories assigned to a course. 
   
 type    - scalar contains course type (Course or Community).  
   
 Returns: $output (markup to be displayed)   Returns: $output (markup to be displayed) 
   
 =cut  =cut
   
 sub assign_categories_table {  sub assign_categories_table {
     my ($cathash,$currcat,$type) = @_;      my ($cathash,$currcat) = @_;
     my $output;      my $output;
     if (ref($cathash) eq 'HASH') {      if (ref($cathash) eq 'HASH') {
         my (@cats,@trails,%allitems,%idx,@jsarray,@path,$maxdepth);          my (@cats,@trails,%allitems,%idx,@jsarray,@path,$maxdepth);
Line 9128  sub assign_categories_table { Line 8916  sub assign_categories_table {
         if (@cats > 0) {          if (@cats > 0) {
             my $itemcount = 0;              my $itemcount = 0;
             if (ref($cats[0]) eq 'ARRAY') {              if (ref($cats[0]) eq 'ARRAY') {
                   $output = &Apache::loncommon::start_data_table();
                 my @currcategories;                  my @currcategories;
                 if ($currcat ne '') {                  if ($currcat ne '') {
                     @currcategories = split('&',$currcat);                      @currcategories = split('&',$currcat);
                 }                  }
                 my $table;  
                 for (my $i=0; $i<@{$cats[0]}; $i++) {                  for (my $i=0; $i<@{$cats[0]}; $i++) {
                     my $parent = $cats[0][$i];                      my $parent = $cats[0][$i];
                     next if ($parent eq 'instcode');  
                     if ($type eq 'Community') {  
                         next unless ($parent eq 'communities');  
                     } else {  
                         next if ($parent eq 'communities');  
                     }  
                     my $css_class = $itemcount%2?' class="LC_odd_row"':'';                      my $css_class = $itemcount%2?' class="LC_odd_row"':'';
                       next if ($parent eq 'instcode');
                     my $item = &escape($parent).'::0';                      my $item = &escape($parent).'::0';
                     my $checked = '';                      my $checked = '';
                     if (@currcategories > 0) {                      if (@currcategories > 0) {
Line 9149  sub assign_categories_table { Line 8932  sub assign_categories_table {
                             $checked = ' checked="checked" ';                              $checked = ' checked="checked" ';
                         }                          }
                     }                      }
                     my $parent_title = $parent;                      $output .= '<tr '.$css_class.'><td><span class="LC_nobreak">'.
                     if ($parent eq 'communities') {                                 '<input type="checkbox" name="usecategory" value="'.
                         $parent_title = &mt('Communities');                                 $item.'"'.$checked.' />'.$parent.'</span>'.
                     }                                 '<input type="hidden" name="catname" value="'.$parent.'" /></td>';
                     $table .= '<tr '.$css_class.'><td><span class="LC_nobreak">'.  
                               '<input type="checkbox" name="usecategory" value="'.  
                               $item.'"'.$checked.' />'.$parent_title.'</span>'.  
                               '<input type="hidden" name="catname" value="'.$parent.'" /></td>';  
                     my $depth = 1;                      my $depth = 1;
                     push(@path,$parent);                      push(@path,$parent);
                     $table .= &assign_category_rows($itemcount,\@cats,$depth,$parent,\@path,\@currcategories);                      $output .= &assign_category_rows($itemcount,\@cats,$depth,$parent,\@path,\@currcategories);
                     pop(@path);                      pop(@path);
                     $table .= '</tr><tr><td colspan="'.$maxdepth.'" class="LC_row_separator"></td></tr>';                      $output .= '</tr><tr><td colspan="'.$maxdepth.'" class="LC_row_separator"></td></tr>';
                     $itemcount ++;                      $itemcount ++;
                 }                  }
                 if ($itemcount) {                  $output .= &Apache::loncommon::end_data_table();
                     $output = &Apache::loncommon::start_data_table().  
                               $table.  
                               &Apache::loncommon::end_data_table();  
                 }  
             }              }
         }          }
     }      }
Line 9413  sub check_clone { Line 9188  sub check_clone {
     my $clonehome=&Apache::lonnet::homeserver($clonecrsunum,$clonecrsudom);      my $clonehome=&Apache::lonnet::homeserver($clonecrsunum,$clonecrsudom);
     my $clonemsg;      my $clonemsg;
     my $can_clone = 0;      my $can_clone = 0;
     my $lctype = lc($args->{'type'});  
     if ($lctype ne 'community') {  
         $lctype = 'course';  
     }  
     if ($clonehome eq 'no_host') {      if ($clonehome eq 'no_host') {
         if ($args->{'type'} eq 'Community') {          $clonemsg = &mt('No new course created.').$linefeed.&mt('A new course could not be cloned from the specified original - [_1] - because it is a non-existent course.',$args->{'clonecourse'}.':'.$args->{'clonedomain'});     
             $clonemsg = &mt('No new community created.').$linefeed.&mt('A new community could not be cloned from the specified original - [_1] - because it is a non-existent community.',$args->{'clonecourse'}.':'.$args->{'clonedomain'});  
         } else {  
             $clonemsg = &mt('No new course created.').$linefeed.&mt('A new course could not be cloned from the specified original - [_1] - because it is a non-existent course.',$args->{'clonecourse'}.':'.$args->{'clonedomain'});  
         }  
     } else {      } else {
  my %clonedesc = &Apache::lonnet::coursedescription($cloneid,{'one_time' => 1});   my %clonedesc = &Apache::lonnet::coursedescription($cloneid,{'one_time' => 1});
         if ($args->{'type'} eq 'Community') {   if ($env{'request.role.domain'} eq $args->{'clonedomain'}) {
             if ($clonedesc{'type'} ne 'Community') {      $can_clone = 1;
                  $clonemsg = &mt('No new community created.').$linefeed.&mt('A new community could not be cloned from the specified original - [_1] - because it is a course not a community.',$args->{'clonecourse'}.':'.$args->{'clonedomain'});   } else {
                 return ($can_clone, $clonemsg, $cloneid, $clonehome);      my %clonehash = &Apache::lonnet::get('environment',['cloners'],
             }   $args->{'clonedomain'},$args->{'clonecourse'});
         }      my @cloners = split(/,/,$clonehash{'cloners'});
         if (($env{'request.role.domain'} eq $args->{'clonedomain'}) &&  
             (&Apache::lonnet::allowed('ccc',$env{'request.role.domain'}))) {  
             $can_clone = 1;  
         } else {  
             my %clonehash = &Apache::lonnet::get('environment',['cloners'],  
                                                  $args->{'clonedomain'},$args->{'clonecourse'});  
             my @cloners = split(/,/,$clonehash{'cloners'});  
             if (grep(/^\*$/,@cloners)) {              if (grep(/^\*$/,@cloners)) {
                 $can_clone = 1;                  $can_clone = 1;
             } elsif (grep(/^\*\:\Q$args->{'ccdomain'}\E$/,@cloners)) {              } elsif (grep(/^\*\:\Q$args->{'ccdomain'}\E$/,@cloners)) {
                 $can_clone = 1;                  $can_clone = 1;
             } else {              } else {
                 my $ccrole = 'cc';          my %roleshash =
                 if ($args->{'type'} eq 'Community') {      &Apache::lonnet::get_my_roles($args->{'ccuname'},
                     $ccrole = 'co';   $args->{'ccdomain'},
                 }                                           'userroles',['active'],['cc'],
                 my %roleshash =   [$args->{'clonedomain'}]);
                     &Apache::lonnet::get_my_roles($args->{'ccuname'},          if (($roleshash{$args->{'clonecourse'}.':'.$args->{'clonedomain'}.':cc'}) || (grep(/^\Q$args->{'ccuname'}\E:\Q$args->{'ccdomain'}\E$/,@cloners))) {
                                          $args->{'ccdomain'},      $can_clone = 1;
                                          'userroles',['active'],[$ccrole],          } else {
                                          [$args->{'clonedomain'}]);                      $clonemsg = &mt('No new course created.').$linefeed.&mt('The new course could not be cloned from the existing course because the new course owner ([_1]) does not have cloning rights in the existing course ([_2]).',$args->{'ccuname'}.':'.$args->{'ccdomain'},$clonedesc{'description'});
                 if (($roleshash{$args->{'clonecourse'}.':'.$args->{'clonedomain'}.':'.$ccrole}) || (grep(/^\Q$args->{'ccuname'}\E:\Q$args->{'ccdomain'}\E$/,@cloners))) {          }
                     $can_clone = 1;      }
                 } else {  
                     if ($args->{'type'} eq 'Community') {  
                         $clonemsg = &mt('No new community created.').$linefeed.&mt('The new community could not be cloned from the existing community because the new community owner ([_1]) does not have cloning rights in the existing community ([_2]).',$args->{'ccuname'}.':'.$args->{'ccdomain'},$clonedesc{'description'});  
                     } else {  
                         $clonemsg = &mt('No new course created.').$linefeed.&mt('The new course could not be cloned from the existing course because the new course owner ([_1]) does not have cloning rights in the existing course ([_2]).',$args->{'ccuname'}.':'.$args->{'ccdomain'},$clonedesc{'description'});  
                     }  
                 }  
             }  
         }          }
     }      }
     return ($can_clone, $clonemsg, $cloneid, $clonehome);      return ($can_clone, $clonemsg, $cloneid, $clonehome);
 }  }
   
 sub construct_course {  sub construct_course {
     my ($args,$logmsg,$courseid,$crsudom,$crsunum,$udom,$uname,$context,$cnum,$category) = @_;      my ($args,$logmsg,$courseid,$crsudom,$crsunum,$udom,$uname,$context) = @_;
     my $outcome;      my $outcome;
     my $linefeed =  '<br />'."\n";      my $linefeed =  '<br />'."\n";
     if ($context eq 'auto') {      if ($context eq 'auto') {
Line 9506  sub construct_course { Line 9259  sub construct_course {
                                              $args->{'crscode'},                                               $args->{'crscode'},
                                              $args->{'ccuname'}.':'.                                               $args->{'ccuname'}.':'.
                                              $args->{'ccdomain'},                                               $args->{'ccdomain'},
                                              $args->{'crstype'},                                               $args->{'crstype'});
                                              $cnum,$context,$category);  
   
   
     # Note: The testing routines depend on this being output; see       # Note: The testing routines depend on this being output; see 
     # Utils::Course. This needs to at least be output as a comment      # Utils::Course. This needs to at least be output as a comment
Line 9551  sub construct_course { Line 9302  sub construct_course {
                    'policy.email',                     'policy.email',
                    'comment.email',                     'comment.email',
                    'pch.users.denied',                     'pch.users.denied',
                    'plc.users.denied',                     'plc.users.denied'],
                    'hidefromcat',  
                    'categories'],  
                    $$crsudom,$$crsunum);                     $$crsudom,$$crsunum);
     }      }
   
Line 9816  sub course_type { Line 9565  sub course_type {
 sub group_term {  sub group_term {
     my $crstype = &course_type();      my $crstype = &course_type();
     my %names = (      my %names = (
                   'Course'    => 'group',                    'Course' => 'group',
                   'Community' => 'group',                    'Group' => 'team',
                 );                  );
     return $names{$crstype};      return $names{$crstype};
 }  }
   
 sub course_types {  
     my @types = ('official','unofficial','community');  
     my %typename = (  
                          official   => 'Official course',  
                          unofficial => 'Unofficial course',  
                          community  => 'Community',  
                    );  
     return (\@types,\%typename);  
 }  
   
 sub icon {  sub icon {
     my ($file)=@_;      my ($file)=@_;
     my $curfext = lc((split(/\./,$file))[-1]);      my $curfext = lc((split(/\./,$file))[-1]);
Line 9891  sub escape_url { Line 9630  sub escape_url {
     return join('/',@urlslices).'/'.$lastitem;      return join('/',@urlslices).'/'.$lastitem;
 }  }
   
 sub compare_arrays {  
     my ($arrayref1,$arrayref2) = @_;  
     my (@difference,%count);  
     @difference = ();  
     %count = ();  
     if ((ref($arrayref1) eq 'ARRAY') && (ref($arrayref2) eq 'ARRAY')) {  
         foreach my $element (@{$arrayref1}, @{$arrayref2}) { $count{$element}++; }  
         foreach my $element (keys(%count)) {  
             if ($count{$element} == 1) {  
                 push(@difference,$element);  
             }  
         }  
     }  
     return @difference;  
 }  
   
 # -------------------------------------------------------- Initliaze user login  # -------------------------------------------------------- Initliaze user login
 sub init_user_environment {  sub init_user_environment {
     my ($r, $username, $domain, $authhost, $form, $args) = @_;      my ($r, $username, $domain, $authhost, $form, $args) = @_;
Line 10037  sub init_user_environment { Line 9760  sub init_user_environment {
     }      }
  }   }
   
         foreach my $tool ('aboutme','blog','portfolio') {  
             $userenv{'availabletools.'.$tool} =  
                 &Apache::lonnet::usertools_access($username,$domain,$tool,'reload');  
         }  
   
         foreach my $crstype ('official','unofficial','community') {  
             $userenv{'canrequest.'.$crstype} =  
                 &Apache::lonnet::usertools_access($username,$domain,$crstype,  
                                                   'reload','requestcourses');  
         }  
   
  $env{'user.environment'} = "$lonids/$cookie.id";   $env{'user.environment'} = "$lonids/$cookie.id";
   
  if (tie(my %disk_env,'GDBM_File',"$lonids/$cookie.id",   if (tie(my %disk_env,'GDBM_File',"$lonids/$cookie.id",
Line 10060  sub init_user_environment { Line 9772  sub init_user_environment {
     }      }
     untie(%disk_env);      untie(%disk_env);
  } else {   } else {
     &Apache::lonnet::logthis("<font color=\"blue\">WARNING: ".      &Apache::lonnet::logthis("<span style=\"color:blue;\">WARNING: ".
    'Could not create environment storage in lonauth: '.$!.'</font>');     'Could not create environment storage in lonauth: '.$!.'</span>');
     return 'error: '.$!;      return 'error: '.$!;
  }   }
     }      }
Line 10086  sub _add_to_env { Line 9798  sub _add_to_env {
 # --- Get the symbolic name of a problem and the url  # --- Get the symbolic name of a problem and the url
 sub get_symb {  sub get_symb {
     my ($request,$silent) = @_;      my ($request,$silent) = @_;
     (my $url=$env{'form.url'}) =~ s-^https?\://($ENV{'SERVER_NAME'}|$ENV{'HTTP_HOST'})--;      (my $url=$env{'form.url'}) =~ s-^http://($ENV{'SERVER_NAME'}|$ENV{'HTTP_HOST'})--;
     my $symb=($env{'form.symb'} ne '' ? $env{'form.symb'} : (&Apache::lonnet::symbread($url)));      my $symb=($env{'form.symb'} ne '' ? $env{'form.symb'} : (&Apache::lonnet::symbread($url)));
     if ($symb eq '') {      if ($symb eq '') {
         if (!$silent) {          if (!$silent) {
Line 10113  sub get_annotation { Line 9825  sub get_annotation {
 }  }
   
 sub clean_symb {  sub clean_symb {
     my ($symb,$delete_enc) = @_;      my ($symb) = @_;
   
     &Apache::lonenc::check_decrypt(\$symb);      &Apache::lonenc::check_decrypt(\$symb);
     my $enc = $env{'request.enc'};      my $enc = $env{'request.enc'};
     if ($delete_enc) {      delete($env{'request.enc'});
         delete($env{'request.enc'});  
     }  
   
     return ($symb,$enc);      return ($symb,$enc);
 }  }

Removed from v.1.692.4.26  
changed lines
  Added in v.1.706


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