--- loncom/interface/domainprefs.pm 2014/07/15 21:52:16 1.160.6.51 +++ loncom/interface/domainprefs.pm 2015/03/11 17:15:40 1.160.6.57 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Handler to set domain-wide configuration settings # -# $Id: domainprefs.pm,v 1.160.6.51 2014/07/15 21:52:16 raeburn Exp $ +# $Id: domainprefs.pm,v 1.160.6.57 2015/03/11 17:15:40 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -250,6 +250,8 @@ sub handler { header => [{col1 => 'Log-in Page Items', col2 => '',}, {col1 => 'Log-in Help', + col2 => 'Value'}, + {col1 => 'Custom HTML in document head', col2 => 'Value'}], print => \&print_login, modify => \&modify_login, @@ -412,7 +414,9 @@ sub handler { 'coursedefaults' => {text => 'Course/Community defaults', help => 'Domain_Configuration_Course_Defaults', - header => [{col1 => 'Defaults which can be overridden for each course by a DC', + header => [{col1 => 'Defaults which can be overridden in each course by a CC', + col2 => 'Value',}, + {col1 => 'Defaults which can be overridden for each course by a DC', col2 => 'Value',},], print => \&print_coursedefaults, modify => \&modify_coursedefaults, @@ -461,6 +465,8 @@ sub handler { {col1 => 'Log-in Page Items', col2 => ''}, {col1 => 'Log-in Help', + col2 => 'Value'}, + {col1 => 'Custom HTML in document head', col2 => 'Value'}], print => \&print_login, modify => \&modify_login, @@ -650,7 +656,7 @@ sub print_config_box { my $colspan = ''; my $rightcolspan = ''; if (($action eq 'rolecolors') || ($action eq 'defaults') || - (($action eq 'login') && ($numheaders < 3))) { + (($action eq 'login') && ($numheaders < 4))) { $colspan = ' colspan="2"'; } if ($action eq 'usersessions') { @@ -666,13 +672,13 @@ sub print_config_box { '; $rowtotal ++; if (($action eq 'autoupdate') || ($action eq 'usercreation') || ($action eq 'selfcreation') || - ($action eq 'usermodification') || ($action eq 'defaults') || + ($action eq 'usermodification') || ($action eq 'defaults') || ($action eq 'coursedefaults') || ($action eq 'selfenrollment') || ($action eq 'usersessions')) { $output .= $item->{'print'}->('top',$dom,$settings,\$rowtotal); } elsif ($action eq 'coursecategories') { $output .= $item->{'print'}->('top',$dom,$item,$settings,\$rowtotal); } elsif ($action eq 'login') { - if ($numheaders == 3) { + if ($numheaders == 4) { $colspan = ' colspan="2"'; $output .= &print_login('service',$dom,$confname,$phase,$settings,\$rowtotal); } else { @@ -721,10 +727,11 @@ sub print_config_box { $output .= $item->{'print'}->('bottom',$dom,$settings,\$rowtotal); } $rowtotal ++; - } elsif (($action eq 'usermodification') || ($action eq 'defaults')) { + } elsif (($action eq 'usermodification') || ($action eq 'coursedefaults') || + ($action eq 'defaults')) { $output .= $item->{'print'}->('bottom',$dom,$settings,\$rowtotal); } elsif ($action eq 'login') { - if ($numheaders == 3) { + if ($numheaders == 4) { $output .= &print_login('page',$dom,$confname,$phase,$settings,\$rowtotal).' @@ -740,6 +747,27 @@ sub print_config_box { } else { $output .= &print_login('help',$dom,$confname,$phase,$settings,\$rowtotal); } + $output .= ' + + + + + + + '; + if ($numheaders == 4) { + $output .= ' + + + '; + } else { + $output .= ' + + + '; + } + $rowtotal ++; + $output .= &print_login('headtag',$dom,$confname,$phase,$settings,\$rowtotal); } elsif ($action eq 'requestcourses') { $output .= &print_requestmail($dom,$action,$settings,\$rowtotal); $rowtotal ++; @@ -1162,6 +1190,57 @@ sub print_login { $itemcount ++; } $datatable .= &captcha_choice('login',$settings,$itemcount); + } elsif ($caller eq 'headtag') { + my %domservers = &Apache::lonnet::get_servers($dom); + my $choice = $choices{'headtag'}; + $css_class = ' class="LC_odd_row"'; + $datatable .= ''. + ''; } return $datatable; } @@ -1195,6 +1274,9 @@ sub login_choices { link => "Link", alink => "Active link", vlink => "Visited link", + headtag => "Custom markup", + action => "Action", + current => "Current", ); return %choices; } @@ -2746,7 +2828,7 @@ sub print_helpsettings { sub radiobutton_prefs { my ($settings,$toggles,$defaultchecked,$choices,$itemcount,$onclick, - $additional) = @_; + $additional,$align) = @_; return unless ((ref($toggles) eq 'ARRAY') && (ref($defaultchecked) eq 'HASH') && (ref($choices) eq 'HASH')); @@ -2780,8 +2862,14 @@ sub radiobutton_prefs { $datatable .= ''. - ''; + if ($align eq 'left') { + $datatable .= ''; + ''; my $rem = $i%($numinrow); if ($rem == 0) { if (($i > 0) && ($i < $numspares-1)) { @@ -3734,7 +3867,7 @@ sub loadbalancing_rules { if (ref($currrules) eq 'HASH') { $current = $currrules->{$type}; } - if (($type eq '_LC_external') || ($type eq '_LC_internetdom') || ($type eq '_LC_ipchange')) { + if (($type eq '_LC_external') || ($type eq '_LC_internetdom')) { if ($dom ne &Apache::lonnet::host_domain($lonhost)) { $current = ''; } @@ -3786,7 +3919,7 @@ sub loadbalance_rule_row { my @rulenames; my %ruletitles = &offloadtype_text(); if (($type eq '_LC_ipchangesso') || ($type eq '_LC_ipchange')) { - @rulenames = ('balancer','offloadedto'); + @rulenames = ('balancer','offloadedto','specific'); } else { @rulenames = ('default','homeserver'); if ($type eq '_LC_external') { @@ -3797,7 +3930,7 @@ sub loadbalance_rule_row { push(@rulenames,'none'); } my $style = $targets_div_style; - if (($type eq '_LC_external') || ($type eq '_LC_internetdom') || ($type eq '_LC_ipchange')) { + if (($type eq '_LC_external') || ($type eq '_LC_internetdom')) { $style = $homedom_div_style; } my $space; @@ -3848,8 +3981,13 @@ sub loadbalance_rule_row { ' '.$ruletitles{$rulenames[$i]}. - ''.$extra.'
'."\n"; + ')"'.$checked.' /> '; + if (($rulenames[$i] eq 'specific') && ($type =~ /^_LC_ipchange/)) { + $output .= $ruletitles{'particular'}; + } else { + $output .= $ruletitles{$rulenames[$i]}; + } + $output .= ''.$extra.'
'."\n"; } $output .= ''."\n"; return $output; @@ -3864,6 +4002,7 @@ sub offloadtype_text { 'none' => 'No offload', 'balancer' => 'Session hosted on Load Balancer, after re-authentication', 'offloadedto' => 'Session hosted on offload server, after re-authentication', + 'particular' => 'Session hosted (after re-auth) on server:', ); return %ruletitles; } @@ -5753,6 +5892,7 @@ sub modify_login { } my %servers = &Apache::lonnet::internet_dom_servers($dom); + my %domservers = &Apache::lonnet::get_servers($dom); my @loginvia_attribs = ('serverpath','custompath','exempt'); if (keys(%servers) > 1) { foreach my $lonhost (keys(%servers)) { @@ -5795,22 +5935,7 @@ sub modify_login { $changes{'loginvia'}{$lonhost} = 1; } if ($item eq 'exempt') { - $new =~ s/^\s+//; - $new =~ s/\s+$//; - my @poss_ips = split(/\s*[,:]\s*/,$new); - my @okips; - foreach my $ip (@poss_ips) { - if ($ip =~ /^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/) { - if (($1 <= 255) && ($2 <= 255) && ($3 <= 255) && ($4 <= 255)) { - push(@okips,$ip); - } - } - } - if (@okips > 0) { - $new = join(',',@okips); - } else { - $new = ''; - } + $new = &check_exempt_addresses($new); } $loginhash{login}{loginvia}{$lonhost}{$item} = $new; } @@ -5922,6 +6047,85 @@ sub modify_login { $errors .= '
  • '.$error.'
  • '; } } + + my (%currheadtagurls,%currexempt,@newhosts,%newheadtagurls,%possexempt); + if (ref($domconfig{'login'}) eq 'HASH') { + if (ref($domconfig{'login'}{'headtag'}) eq 'HASH') { + foreach my $lonhost (keys(%{$domconfig{'login'}{'headtag'}})) { + if ($domservers{$lonhost}) { + if (ref($domconfig{'login'}{'headtag'}{$lonhost}) eq 'HASH') { + $currheadtagurls{$lonhost} = $domconfig{'login'}{'headtag'}{$lonhost}{'url'}; + $currexempt{$lonhost} = $domconfig{'login'}{'headtagexempt'}{$lonhost}{'exempt'} + } + } + } + } + } + my @delheadtagurls = &Apache::loncommon::get_env_multiple('form.loginheadtag_del'); + foreach my $lonhost (sort(keys(%domservers))) { + if (grep(/^\Q$lonhost\E$/,@delheadtagurls)) { + $changes{'headtag'}{$lonhost} = 1; + } else { + if ($env{'form.loginheadtagexempt_'.$lonhost}) { + $possexempt{$lonhost} = &check_exempt_addresses($env{'form.loginheadtagexempt_'.$lonhost}); + } + if ($env{'form.loginheadtag_'.$lonhost.'.filename'}) { + push(@newhosts,$lonhost); + } elsif ($currheadtagurls{$lonhost}) { + $loginhash{'login'}{'headtag'}{$lonhost}{'url'} = $currheadtagurls{$lonhost}; + if ($currexempt{$lonhost}) { + if ((!exists($possexempt{$lonhost})) || ($possexempt{$lonhost} ne $currexempt{$lonhost})) { + $changes{'headtag'}{$lonhost} = 1; + } + } elsif ($possexempt{$lonhost}) { + $changes{'headtag'}{$lonhost} = 1; + } + if ($possexempt{$lonhost}) { + $loginhash{'login'}{'headtag'}{$lonhost}{'exempt'} = $possexempt{$lonhost}; + } + } + } + } + if (@newhosts) { + my $error; + my ($configuserok,$author_ok,$switchserver) = &config_check($dom,$confname,$servadm); + if ($configuserok eq 'ok') { + if ($switchserver) { + $error = &mt("Upload of custom markup is not permitted to this server: [_1]",$switchserver); + } elsif ($author_ok eq 'ok') { + foreach my $lonhost (@newhosts) { + my $formelem = 'loginheadtag_'.$lonhost; + (my $result,$newheadtagurls{$lonhost}) = &publishlogo($r,'upload',$formelem,$dom,$confname, + "login/headtag/$lonhost",'','', + $env{'form.loginheadtag_'.$lonhost.'.filename'}); + if ($result eq 'ok') { + $loginhash{'login'}{'headtag'}{$lonhost}{'url'} = $newheadtagurls{$lonhost}; + $changes{'headtag'}{$lonhost} = 1; + if ($possexempt{$lonhost}) { + $loginhash{'login'}{'headtag'}{$lonhost}{'exempt'} = $possexempt{$lonhost}; + } + } else { + my $puberror = &mt("Upload of [_1] failed because an error occurred publishing the file in RES space. Error was: [_2].", + $newheadtagurls{$lonhost},$result); + $errors .= '
  • '.$puberror.'
  • '; + if ((grep(/^\Q$lonhost\E$/,keys(%currheadtagurls))) && + (!grep(/^\Q$lonhost\E$/,@delheadtagurls))) { + $loginhash{'login'}{'headtag'}{$lonhost} = $currheadtagurls{$lonhost}; + } + } + } + } else { + $error = &mt("Upload of custom markup file(s) failed because an author role could not be assigned to a Domain Configuration user ([_1]) in domain: [_2]. Error was: [_3].",$confname,$dom,$author_ok); + } + } else { + $error = &mt("Upload of custom markup file(s) failed because a Domain Configuration user ([_1]) could not be created in domain: [_2]. Error was: [_3].",$confname,$dom,$configuserok); + } + if ($error) { + &Apache::lonnet::logthis($error); + $errors .= '
  • '.$error.'
  • '; + } + } + &process_captcha('login',\%changes,$loginhash{'login'},$domconfig{'login'}); my $defaulthelpfile = '/adm/loginproblems.html'; @@ -6022,6 +6226,25 @@ sub modify_login { } } } + } elsif ($item eq 'headtag') { + if (ref($changes{$item}) eq 'HASH') { + foreach my $lonhost (sort(keys(%{$changes{$item}}))) { + if (grep(/^\Q$lonhost\E$/,@delheadtagurls)) { + $resulttext .= '
  • '.&mt('custom markup file removed for [_1]',$domservers{$lonhost}).'
  • '; + } elsif (ref($loginhash{'login'}{'headtag'}{$lonhost}) eq 'HASH') { + $resulttext .= '
  • '.&mt('custom markup').' '.&mt('(for [_1])',$servers{$lonhost}).' '; + if ($possexempt{$lonhost}) { + $resulttext .= &mt('not included for client IP(s): [_1]',$possexempt{$lonhost}); + } else { + $resulttext .= &mt('included for any client IP'); + } + $resulttext .= '
  • '; + } + } + } } elsif ($item eq 'captcha') { if (ref($loginhash{'login'}) eq 'HASH') { my $chgtxt; @@ -6053,7 +6276,7 @@ sub modify_login { if (!$privkey) { $chgtxt .= '
  • '.&mt('Private key deleted').'
  • '; } else { - $chgtxt .= '
  • '.&mt('Private key set to [_1]',$pubkey).'
  • '; + $chgtxt .= '
  • '.&mt('Private key set to [_1]',$privkey).'
  • '; } $chgtxt .= ''; $resulttext .= '
  • '.$chgtxt.'
  • '; @@ -6077,6 +6300,27 @@ sub modify_login { return $resulttext; } +sub check_exempt_addresses { + my ($iplist) = @_; + $iplist =~ s/^\s+//; + $iplist =~ s/\s+$//; + my @poss_ips = split(/\s*[,:]\s*/,$iplist); + my (@okips,$new); + foreach my $ip (@poss_ips) { + if ($ip =~ /^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/) { + if (($1 <= 255) && ($2 <= 255) && ($3 <= 255) && ($4 <= 255)) { + push(@okips,$ip); + } + } + } + if (@okips > 0) { + $new = join(',',@okips); + } else { + $new = ''; + } + return $new; +} + sub color_font_choices { my %choices = &Apache::lonlocal::texthash ( @@ -9057,8 +9301,8 @@ sub process_captcha { if ($newsettings->{'captcha'} eq 'recaptcha') { $newpub = $env{'form.'.$container.'_recaptchapub'}; $newpriv = $env{'form.'.$container.'_recaptchapriv'}; - $newpub =~ s/\W//g; - $newpriv =~ s/\W//g; + $newpub =~ s/[^\w\-]//g; + $newpriv =~ s/[^\w\-]//g; $newsettings->{'recaptchakeys'} = { public => $newpub, private => $newpriv, @@ -9965,14 +10209,18 @@ sub modify_helpsettings { sub modify_coursedefaults { my ($dom,$lastactref,%domconfig) = @_; my ($resulttext,$errors,%changes,%defaultshash); - my %defaultchecked = ('canuse_pdfforms' => 'off'); - my @toggles = ('canuse_pdfforms'); + my %defaultchecked = ( + 'uselcmath' => 'on', + 'usejsme' => 'on' + ); + my @toggles = ('uselcmath','usejsme'); my @numbers = ('anonsurvey_threshold','uploadquota_official','uploadquota_unofficial', 'uploadquota_community','uploadquota_textbook'); my @types = ('official','unofficial','community','textbook'); my %staticdefaults = ( anonsurvey_threshold => 10, uploadquota => 500, + postsubmit => 60, ); $defaultshash{'coursedefaults'} = {}; @@ -10034,26 +10282,81 @@ sub modify_coursedefaults { } } - my $officialcreds = $env{'form.official_credits'}; - $officialcreds =~ s/[^\d.]+//g; - my $unofficialcreds = $env{'form.unofficial_credits'}; - $unofficialcreds =~ s/[^\d.]+//g; - my $textbookcreds = $env{'form.textbook_credits'}; - $textbookcreds =~ s/[^\d.]+//g; - if (ref($domconfig{'coursedefaults'}{'coursecredits'} ne 'HASH') && - ($env{'form.coursecredits'} eq '1')) { - $changes{'coursecredits'} = 1; - } else { - if (($domconfig{'coursedefaults'}{'coursecredits'}{'official'} ne $officialcreds) || - ($domconfig{'coursedefaults'}{'coursecredits'}{'unofficial'} ne $unofficialcreds) || - ($domconfig{'coursedefaults'}{'coursecredits'}{'textbook'} ne $textbookcreds)) { - $changes{'coursecredits'} = 1; - } - } - $defaultshash{'coursedefaults'}{'coursecredits'} = { - official => $officialcreds, - unofficial => $unofficialcreds, - textbook => $textbookcreds, + my %credits; + foreach my $type (@types) { + unless ($type eq 'community') { + $credits{$type} = $env{'form.'.$type.'_credits'}; + $credits{$type} =~ s/[^\d.]+//g; + } + } + if ((ref($domconfig{'coursedefaults'}{'coursecredits'}) ne 'HASH') && + ($env{'form.coursecredits'} eq '1')) { + $changes{'coursecredits'} = 1; + foreach my $type (keys(%credits)) { + $defaultshash{'coursedefaults'}{'coursecredits'}{$type} = $credits{$type}; + } + } else { + if ($env{'form.coursecredits'} eq '1') { + foreach my $type (@types) { + unless ($type eq 'community') { + if ($domconfig{'coursedefaults'}{'coursecredits'}{$type} ne $credits{$type}) { + $changes{'coursecredits'} = 1; + } + $defaultshash{'coursedefaults'}{'coursecredits'}{$type} = $credits{$type}; + } + } + } elsif (ref($domconfig{'coursedefaults'}{'coursecredits'}) eq 'HASH') { + foreach my $type (@types) { + unless ($type eq 'community') { + if ($domconfig{'coursedefaults'}{'coursecredits'}{$type}) { + $changes{'coursecredits'} = 1; + last; + } + } + } + } + } + if ($env{'form.postsubmit'} eq '1') { + $defaultshash{'coursedefaults'}{'postsubmit'}{'client'} = 'on'; + my %currtimeout; + if (ref($domconfig{'coursedefaults'}{'postsubmit'}) eq 'HASH') { + if ($domconfig{'coursedefaults'}{'postsubmit'}{'client'} eq 'off') { + $changes{'postsubmit'} = 1; + } + if (ref($domconfig{'coursedefaults'}{'postsubmit'}{'timeout'}) eq 'HASH') { + %currtimeout = %{$domconfig{'coursedefaults'}{'postsubmit'}{'timeout'}}; + } + } else { + $changes{'postsubmit'} = 1; + } + foreach my $type (@types) { + my $timeout = $env{'form.'.$type.'_timeout'}; + $timeout =~ s/\D//g; + if ($timeout == $staticdefaults{'postsubmit'}) { + $timeout = ''; + } elsif (($timeout eq '') || ($timeout =~ /^0+$/)) { + $timeout = '0'; + } + unless ($timeout eq '') { + $defaultshash{'coursedefaults'}{'postsubmit'}{'timeout'}{$type} = $timeout; + } + if (exists($currtimeout{$type})) { + if ($timeout ne $currtimeout{$type}) { + $changes{'postsubmit'} = 1; + } + } elsif ($timeout ne '') { + $changes{'postsubmit'} = 1; + } + } + } else { + $defaultshash{'coursedefaults'}{'postsubmit'}{'client'} = 'off'; + if (ref($domconfig{'coursedefaults'}{'postsubmit'}) eq 'HASH') { + if ($domconfig{'coursedefaults'}{'postsubmit'}{'client'} eq 'on') { + $changes{'postsubmit'} = 1; + } + } else { + $changes{'postsubmit'} = 1; + } } } my $putresult = &Apache::lonnet::put_dom('configuration',\%defaultshash, @@ -10061,19 +10364,30 @@ sub modify_coursedefaults { if ($putresult eq 'ok') { if (keys(%changes) > 0) { my %domdefaults = &Apache::lonnet::get_domain_defaults($dom,1); - if (($changes{'canuse_pdfforms'}) || ($changes{'coursecredits'}) || - ($changes{'uploadquota'})) { - if ($changes{'canuse_pdfforms'}) { - $domdefaults{'canuse_pdfforms'}=$defaultshash{'coursedefaults'}{'canuse_pdfforms'}; + if (($changes{'uploadquota'}) || ($changes{'postsubmit'}) || + ($changes{'coursecredits'}) || ($changes{'uselcmath'}) || ($changes{'usejsme'})) { + foreach my $item ('uselcmath','usejsme') { + if ($changes{$item}) { + $domdefaults{$item}=$defaultshash{'coursedefaults'}{$item}; + } } if ($changes{'coursecredits'}) { if (ref($defaultshash{'coursedefaults'}{'coursecredits'}) eq 'HASH') { - $domdefaults{'officialcredits'} = - $defaultshash{'coursedefaults'}{'coursecredits'}{'official'}; - $domdefaults{'unofficialcredits'} = - $defaultshash{'coursedefaults'}{'coursecredits'}{'unofficial'}; - $domdefaults{'textbookcredits'} = - $domdefaults{'coursedefaults'}{'coursecredits'}{'textbook'}; + foreach my $type (keys(%{$defaultshash{'coursedefaults'}{'coursecredits'}})) { + $domdefaults{$type.'credits'} = + $defaultshash{'coursedefaults'}{'coursecredits'}{$type}; + } + } + } + if ($changes{'postsubmit'}) { + if (ref($defaultshash{'coursedefaults'}{'postsubmit'}) eq 'HASH') { + $domdefaults{'postsubmit'} = $defaultshash{'coursedefaults'}{'postsubmit'}{'client'}; + if (ref($defaultshash{'coursedefaults'}{'postsubmit'}{'timeout'}) eq 'HASH') { + foreach my $type (keys(%{$defaultshash{'coursedefaults'}{'postsubmit'}{'timeout'}})) { + $domdefaults{$type.'postsubtimeout'} = + $defaultshash{'coursedefaults'}{'postsubmit'}{'timeout'}{$type}; + } + } } } if ($changes{'uploadquota'}) { @@ -10091,11 +10405,17 @@ sub modify_coursedefaults { } $resulttext = &mt('Changes made:').'
    '.&mt($item->{'header'}->[3]->{'col1'}).''.&mt($item->{'header'}->[3]->{'col2'}).'
    '.&mt($item->{'header'}->[2]->{'col1'}).''.&mt($item->{'header'}->[2]->{'col2'}).'
    '.$choice.''. + ''. + ''. + ''."\n"; + my (%currurls,%currexempt); + if (ref($settings) eq 'HASH') { + if (ref($settings->{'headtag'}) eq 'HASH') { + foreach my $lonhost (keys(%{$settings->{'headtag'}})) { + if (ref($settings->{'headtag'}{$lonhost}) eq 'HASH') { + $currurls{$lonhost} = $settings->{'headtag'}{$lonhost}{'url'}; + $currexempt{$lonhost} = $settings->{'headtag'}{$lonhost}{'exempt'}; + } + } + } + } + my %lt = &Apache::lonlocal::texthash( + del => 'Delete?', + rep => 'Replace:', + upl => 'Upload:', + curr => 'View contents', + none => 'None', + ); + my $switchserver = &check_switchserver($dom,$confname); + foreach my $lonhost (sort(keys(%domservers))) { + my $exempt = &check_exempt_addresses($currexempt{$lonhost}); + $datatable .= ''; + if ($currurls{$lonhost}) { + $datatable .= ''. + ''; + } + $datatable .= '
    '.$choices{'hostid'}.''.$choices{'current'}.''.$choices{'action'}.''.$choices{'exempt'}.'
    '.$domservers{$lonhost}.''.$lt{'curr'}.' '.$lt{'rep'}.''; + } else { + $datatable .= ''.$lt{'none'}.''.$lt{'upl'}; + } + $datatable .='
    '; + if ($switchserver) { + $datatable .= &mt('Upload to library server: [_1]',$switchserver); + } else { + $datatable .= ''; + } + $datatable .= '
    '. ''.$choices->{$item}. - ''. + ''; + } else { + $datatable .= ''; + } + $datatable .= + ''. '