version 1.1075.2.11, 2012/08/01 04:34:00
|
version 1.1075.2.27, 2013/01/09 16:33:56
|
Line 67 use Apache::lonhtmlcommon();
|
Line 67 use Apache::lonhtmlcommon();
|
use Apache::loncoursedata(); |
use Apache::loncoursedata(); |
use Apache::lontexconvert(); |
use Apache::lontexconvert(); |
use Apache::lonclonecourse(); |
use Apache::lonclonecourse(); |
|
use Apache::lonuserutils(); |
|
use Apache::lonuserstate(); |
use LONCAPA qw(:DEFAULT :match); |
use LONCAPA qw(:DEFAULT :match); |
use DateTime::TimeZone; |
use DateTime::TimeZone; |
use DateTime::Locale::Catalog; |
use DateTime::Locale::Catalog; |
|
use Authen::Captcha; |
|
use Captcha::reCAPTCHA; |
|
|
# ---------------------------------------------- Designs |
# ---------------------------------------------- Designs |
use vars qw(%defaultdesign); |
use vars qw(%defaultdesign); |
Line 885 sub check_uncheck_jscript {
|
Line 889 sub check_uncheck_jscript {
|
function checkAll(field) { |
function checkAll(field) { |
if (field.length > 0) { |
if (field.length > 0) { |
for (i = 0; i < field.length; i++) { |
for (i = 0; i < field.length; i++) { |
field[i].checked = true ; |
if (!field[i].disabled) { |
|
field[i].checked = true; |
|
} |
} |
} |
} else { |
} else { |
field.checked = true |
if (!field.disabled) { |
|
field.checked = true; |
|
} |
} |
} |
} |
} |
|
|
Line 2475 END
|
Line 2483 END
|
return $result; |
return $result; |
} |
} |
|
|
sub authform_authorwarning{ |
sub authform_authorwarning { |
my $result=''; |
my $result=''; |
$result='<i>'. |
$result='<i>'. |
&mt('As a general rule, only authors or co-authors should be '. |
&mt('As a general rule, only authors or co-authors should be '. |
Line 2484 sub authform_authorwarning{
|
Line 2492 sub authform_authorwarning{
|
return $result; |
return $result; |
} |
} |
|
|
sub authform_nochange{ |
sub authform_nochange { |
my %in = ( |
my %in = ( |
formname => 'document.cu', |
formname => 'document.cu', |
kerb_def_dom => 'MSU.EDU', |
kerb_def_dom => 'MSU.EDU', |
@_, |
@_, |
); |
); |
my ($authnum,%can_assign) = &get_assignable_auth($in{'domain'}); |
my ($authnum,%can_assign) = &get_assignable_auth($in{'domain'}); |
my $result; |
my $result; |
if (keys(%can_assign) == 0) { |
if (!$authnum) { |
$result = &mt('Under you current role you are not permitted to change login settings for this user'); |
$result = &mt('Under your current role you are not permitted to change login settings for this user'); |
} else { |
} else { |
$result = '<label>'.&mt('[_1] Do not change login data', |
$result = '<label>'.&mt('[_1] Do not change login data', |
'<input type="radio" name="login" value="nochange" '. |
'<input type="radio" name="login" value="nochange" '. |
Line 2513 sub authform_kerberos {
|
Line 2521 sub authform_kerberos {
|
); |
); |
my ($check4,$check5,$krbcheck,$krbarg,$krbver,$result,$authtype, |
my ($check4,$check5,$krbcheck,$krbarg,$krbver,$result,$authtype, |
$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="checked"'; |
} else { |
} else { |
Line 2563 sub authform_kerberos {
|
Line 2571 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="radio" name="login" value="krb" />'; |
} |
} |
} |
} |
} |
} |
Line 2575 sub authform_kerberos {
|
Line 2583 sub authform_kerberos {
|
$krbcheck.' />'; |
$krbcheck.' />'; |
} |
} |
if (($can_assign{'krb4'} && $can_assign{'krb5'}) || |
if (($can_assign{'krb4'} && $can_assign{'krb5'}) || |
($can_assign{'krb4'} && !$can_assign{'krb5'} && |
($can_assign{'krb4'} && !$can_assign{'krb5'} && |
$in{'curr_authtype'} eq 'krb5') || |
$in{'curr_authtype'} eq 'krb5') || |
(!$can_assign{'krb4'} && $can_assign{'krb5'} && |
(!$can_assign{'krb4'} && $can_assign{'krb5'} && |
$in{'curr_authtype'} eq 'krb4')) { |
$in{'curr_authtype'} eq 'krb4')) { |
$result .= &mt |
$result .= &mt |
('[_1] Kerberos authenticated with domain [_2] '. |
('[_1] Kerberos authenticated with domain [_2] '. |
Line 2613 sub authform_kerberos {
|
Line 2621 sub authform_kerberos {
|
return $result; |
return $result; |
} |
} |
|
|
sub authform_internal{ |
sub authform_internal { |
my %in = ( |
my %in = ( |
formname => 'document.cu', |
formname => 'document.cu', |
kerb_def_dom => 'MSU.EDU', |
kerb_def_dom => 'MSU.EDU', |
@_, |
@_, |
); |
); |
my ($intcheck,$intarg,$result,$authtype,$autharg,$jscall); |
my ($intcheck,$intarg,$result,$authtype,$autharg,$jscall); |
my ($authnum,%can_assign) = &get_assignable_auth($in{'domain'}); |
my ($authnum,%can_assign) = &get_assignable_auth($in{'domain'}); |
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'}) { |
Line 2649 sub authform_internal{
|
Line 2657 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="radio" name="login" value="int" />'; |
} |
} |
} |
} |
} |
} |
Line 2668 sub authform_internal{
|
Line 2676 sub authform_internal{
|
return $result; |
return $result; |
} |
} |
|
|
sub authform_local{ |
sub authform_local { |
my %in = ( |
my %in = ( |
formname => 'document.cu', |
formname => 'document.cu', |
kerb_def_dom => 'MSU.EDU', |
kerb_def_dom => 'MSU.EDU', |
@_, |
@_, |
); |
); |
my ($loccheck,$locarg,$result,$authtype,$autharg,$jscall); |
my ($loccheck,$locarg,$result,$authtype,$autharg,$jscall); |
my ($authnum,%can_assign) = &get_assignable_auth($in{'domain'}); |
my ($authnum,%can_assign) = &get_assignable_auth($in{'domain'}); |
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'}) { |
Line 2704 sub authform_local{
|
Line 2712 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="radio" name="login" value="loc" />'; |
} |
} |
} |
} |
} |
} |
Line 2722 sub authform_local{
|
Line 2730 sub authform_local{
|
return $result; |
return $result; |
} |
} |
|
|
sub authform_filesystem{ |
sub authform_filesystem { |
my %in = ( |
my %in = ( |
formname => 'document.cu', |
formname => 'document.cu', |
kerb_def_dom => 'MSU.EDU', |
kerb_def_dom => 'MSU.EDU', |
@_, |
@_, |
); |
); |
my ($fsyscheck,$result,$authtype,$autharg,$jscall); |
my ($fsyscheck,$result,$authtype,$autharg,$jscall); |
my ($authnum,%can_assign) = &get_assignable_auth($in{'domain'}); |
my ($authnum,%can_assign) = &get_assignable_auth($in{'domain'}); |
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'}) { |
Line 2755 sub authform_filesystem{
|
Line 2763 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="radio" name="login" value="fsys" />'; |
} |
} |
} |
} |
} |
} |
Line 3226 sub aboutmewrapper {
|
Line 3234 sub aboutmewrapper {
|
if (!defined($username) && !defined($domain)) { |
if (!defined($username) && !defined($domain)) { |
return; |
return; |
} |
} |
return '<a href="/adm/'.$domain.'/'.$username.'/aboutme?forcestudent=1"'. |
return '<a href="/adm/'.$domain.'/'.$username.'/aboutme"'. |
($target?' target="'.$target.'"':'').($class?' class="'.$class.'"':'').' title="'.&mt("View this user's personal information page").'">'.$link.'</a>'; |
($target?' target="'.$target.'"':'').($class?' class="'.$class.'"':'').' title="'.&mt("View this user's personal information page").'">'.$link.'</a>'; |
} |
} |
|
|
Line 4954 Inputs:
|
Line 4962 Inputs:
|
|
|
=item * $bgcolor, used to override the bgcolor on a webpage to a specific value |
=item * $bgcolor, used to override the bgcolor on a webpage to a specific value |
|
|
|
=item * $no_inline_link, if true and in remote mode, don't show the |
|
'Switch To Inline Menu' link |
|
|
=item * $args, optional argument valid values are |
=item * $args, optional argument valid values are |
no_auto_mt_title -> prevents &mt()ing the title arg |
no_auto_mt_title -> prevents &mt()ing the title arg |
inherit_jsmath -> when creating popup window in a page, |
inherit_jsmath -> when creating popup window in a page, |
should it have jsmath forced on by the |
should it have jsmath forced on by the |
current page |
current page |
|
|
|
=item * $advtoolsref, optional argument, ref to an array containing |
|
inlineremote items to be added in "Functions" menu below |
|
breadcrumbs. |
|
|
=back |
=back |
|
|
Returns: A uniform header for LON-CAPA web pages. |
Returns: A uniform header for LON-CAPA web pages. |
Line 4971 other decorations will be returned.
|
Line 4986 other decorations will be returned.
|
|
|
sub bodytag { |
sub bodytag { |
my ($title,$function,$addentries,$bodyonly,$domain,$forcereg, |
my ($title,$function,$addentries,$bodyonly,$domain,$forcereg, |
$no_nav_bar,$bgcolor,$args)=@_; |
$no_nav_bar,$bgcolor,$no_inline_link,$args,$advtoolsref)=@_; |
|
|
my $public; |
my $public; |
if ((($env{'user.name'} eq 'public') && ($env{'user.domain'} eq 'public')) |
if ((($env{'user.name'} eq 'public') && ($env{'user.domain'} eq 'public')) |
Line 5047 sub bodytag {
|
Line 5062 sub bodytag {
|
$role = '<span class="LC_nobreak">('.$role.')</span>' if $role; |
$role = '<span class="LC_nobreak">('.$role.')</span>' if $role; |
&get_unprocessed_cgi($ENV{'QUERY_STRING'}, ['inhibitmenu']); |
&get_unprocessed_cgi($ENV{'QUERY_STRING'}, ['inhibitmenu']); |
|
|
if ($no_nav_bar || $env{'form.inhibitmenu'} eq 'yes') { |
if ($no_nav_bar || $env{'form.inhibitmenu'} eq 'yes') { |
return $bodytag; |
return $bodytag; |
} |
} |
|
|
if ($env{'request.state'} eq 'construct') { $forcereg=1; } |
if ($env{'request.state'} eq 'construct') { $forcereg=1; } |
|
|
|
my $funclist; |
|
if (($env{'environment.remote'} eq 'on') && ($env{'request.state'} ne 'construct')) { |
|
$bodytag .= Apache::lonhtmlcommon::scripttag(Apache::lonmenu::utilityfunctions(), 'start')."\n". |
|
Apache::lonmenu::serverform(); |
|
my $forbodytag; |
|
&Apache::lonmenu::prepare_functions($env{'request.noversionuri'}, |
|
$forcereg,$args->{'group'}, |
|
$args->{'bread_crumbs'}, |
|
$advtoolsref,'',\$forbodytag); |
|
unless (ref($args->{'bread_crumbs'}) eq 'ARRAY') { |
|
$funclist = $forbodytag; |
|
} |
|
} else { |
|
|
# if ($env{'request.state'} eq 'construct') { |
# if ($env{'request.state'} eq 'construct') { |
# $titleinfo = &CSTR_pageheader(); #FIXME: Will be removed once all scripts have their own calls |
# $titleinfo = &CSTR_pageheader(); #FIXME: Will be removed once all scripts have their own calls |
Line 5060 sub bodytag {
|
Line 5089 sub bodytag {
|
|
|
|
|
if ($env{'request.noversionuri'} =~ m{^/res/adm/pages/}) { |
if ($env{'request.noversionuri'} =~ m{^/res/adm/pages/}) { |
unless ($env{'request.noversionuri'} =~ m{/res/adm/pages/bookmarkmenu/}) { |
if ($dc_info) { |
if ($dc_info) { |
$dc_info = qq|<span class="LC_cusr_subheading">$dc_info</span>|; |
$dc_info = qq|<span class="LC_cusr_subheading">$dc_info</span>|; |
|
} |
|
$bodytag .= qq|<div id="LC_nav_bar">$name $role<br /> |
|
<em>$realm</em> $dc_info</div>|; |
|
} |
} |
|
$bodytag .= qq|<div id="LC_nav_bar">$name $role<br /> |
|
<em>$realm</em> $dc_info</div>|; |
return $bodytag; |
return $bodytag; |
} |
} |
|
|
Line 5093 sub bodytag {
|
Line 5120 sub bodytag {
|
$bodytag .= &Apache::lonmenu::innerregister($forcereg, |
$bodytag .= &Apache::lonmenu::innerregister($forcereg, |
$args->{'bread_crumbs'}); |
$args->{'bread_crumbs'}); |
} elsif ($forcereg) { |
} elsif ($forcereg) { |
$bodytag .= &Apache::lonmenu::innerregister($forcereg); |
$bodytag .= &Apache::lonmenu::innerregister($forcereg,undef, |
|
$args->{'group'}); |
|
} else { |
|
my $forbodytag; |
|
&Apache::lonmenu::prepare_functions($env{'request.noversionuri'}, |
|
$forcereg,$args->{'group'}, |
|
$args->{'bread_crumbs'}, |
|
$advtoolsref,'',\$forbodytag); |
|
unless (ref($args->{'bread_crumbs'}) eq 'ARRAY') { |
|
$bodytag .= $forbodytag; |
|
} |
} |
} |
}else{ |
}else{ |
# this is to seperate menu from content when there's no secondary |
# this is to seperate menu from content when there's no secondary |
Line 5103 sub bodytag {
|
Line 5140 sub bodytag {
|
} |
} |
|
|
return $bodytag; |
return $bodytag; |
|
} |
|
|
|
# |
|
# Top frame rendering, Remote is up |
|
# |
|
|
|
my $imgsrc = $img; |
|
if ($img =~ /^\/adm/) { |
|
$imgsrc = &lonhttpdurl($img); |
|
} |
|
my $upperleft='<img src="'.$imgsrc.'" alt="'.$function.'" />'; |
|
|
|
# Explicit link to get inline menu |
|
my $menu= ($no_inline_link?'' |
|
:'<a href="/adm/remote?action=collapse" target="_top">'.&mt('Switch to Inline Menu Mode').'</a>'); |
|
|
|
if ($dc_info) { |
|
$dc_info = qq|<span class="LC_cusr_subheading">($dc_info)</span>|; |
|
} |
|
|
|
unless ($env{'form.inhibitmenu'}) { |
|
$bodytag .= qq|<div id="LC_nav_bar">$name $role</div> |
|
<ol class="LC_primary_menu LC_right"> |
|
<li>$menu</li> |
|
</ol><div id="LC_realm"> $realm $dc_info</div>|; |
|
} |
|
if ($env{'request.state'} eq 'construct') { |
|
if (!$public){ |
|
if ($env{'request.state'} eq 'construct') { |
|
$funclist = &Apache::lonhtmlcommon::scripttag( |
|
&Apache::lonmenu::utilityfunctions(), 'start'). |
|
&Apache::lonhtmlcommon::scripttag('','end'). |
|
&Apache::lonmenu::innerregister($forcereg, |
|
$args->{'bread_crumbs'}); |
|
} |
|
} |
|
} |
|
return $bodytag."\n".$funclist; |
} |
} |
|
|
sub dc_courseid_toggle { |
sub dc_courseid_toggle { |
Line 5134 sub make_attr_string {
|
Line 5209 sub make_attr_string {
|
delete($attr_ref->{$key}); |
delete($attr_ref->{$key}); |
} |
} |
} |
} |
$attr_ref->{'onload'} = $on_load; |
if ($env{'environment.remote'} eq 'on') { |
$attr_ref->{'onunload'}= $on_unload; |
$attr_ref->{'onload'} = |
|
&Apache::lonmenu::loadevents(). $on_load; |
|
$attr_ref->{'onunload'}= |
|
&Apache::lonmenu::unloadevents().$on_unload; |
|
} else { |
|
$attr_ref->{'onload'} = $on_load; |
|
$attr_ref->{'onunload'}= $on_unload; |
|
} |
} |
} |
|
|
my $attr_string; |
my $attr_string; |
Line 5308 form, .inline {
|
Line 5390 form, .inline {
|
|
|
.LC_error { |
.LC_error { |
color: red; |
color: red; |
font-size: larger; |
|
} |
} |
|
|
.LC_warning, |
.LC_warning { |
|
color: darkorange; |
|
} |
|
|
.LC_diff_removed { |
.LC_diff_removed { |
color: red; |
color: red; |
} |
} |
Line 5474 td.LC_table_cell_checkbox {
|
Line 5558 td.LC_table_cell_checkbox {
|
text-align: left; |
text-align: left; |
} |
} |
|
|
.LC_head_subbox { |
.LC_head_subbox, .LC_actionbox { |
clear:both; |
clear:both; |
background: #F8F8F8; /* $sidebg; */ |
background: #F8F8F8; /* $sidebg; */ |
border: 1px solid $sidebg; |
border: 1px solid $sidebg; |
margin: 0 0 10px 0; |
margin: 0 0 10px 0; |
padding: 3px; |
padding: 3px; |
text-align: left; |
text-align: left; |
} |
} |
Line 6173 div.LC_docs_entry_move {
|
Line 6257 div.LC_docs_entry_move {
|
|
|
table.LC_data_table tr > td.LC_docs_entry_commands, |
table.LC_data_table tr > td.LC_docs_entry_commands, |
table.LC_data_table tr > td.LC_docs_entry_parameter { |
table.LC_data_table tr > td.LC_docs_entry_parameter { |
background: #DDDDDD; |
|
font-size: x-small; |
font-size: x-small; |
} |
} |
|
|
Line 6546 ol.LC_docs_parameters li.LC_docs_paramet
|
Line 6629 ol.LC_docs_parameters li.LC_docs_paramet
|
} |
} |
|
|
ul#LC_secondary_menu { |
ul#LC_secondary_menu { |
clear: both; |
clear: right; |
color: $fontmenu; |
color: $fontmenu; |
background: $tabbg; |
background: $tabbg; |
list-style: none; |
list-style: none; |
Line 7047 ul.LC_funclist li {
|
Line 7130 ul.LC_funclist li {
|
cursor:pointer; |
cursor:pointer; |
} |
} |
|
|
|
/* |
|
styles used by TTH when "Default set of options to pass to tth/m |
|
when converting TeX" in course settings has been set |
|
|
|
option passed: -t |
|
|
|
*/ |
|
|
|
td div.comp { margin-top: -0.6ex; margin-bottom: -1ex;} |
|
td div.comb { margin-top: -0.6ex; margin-bottom: -.6ex;} |
|
td div.hrcomp { line-height: 0.9; margin-top: -0.8ex; margin-bottom: -1ex;} |
|
td div.norm {line-height:normal;} |
|
|
|
/* |
|
option passed -y3 |
|
*/ |
|
|
|
span.roman {font-family: serif; font-style: normal; font-weight: normal;} |
|
span.overacc2 {position: relative; left: .8em; top: -1.2ex;} |
|
span.overacc1 {position: relative; left: .6em; top: -1.2ex;} |
|
|
END |
END |
} |
} |
|
|
Line 7100 sub headtag {
|
Line 7204 sub headtag {
|
if (!$args->{'frameset'}) { |
if (!$args->{'frameset'}) { |
$result .= &Apache::lonhtmlcommon::htmlareaheaders(); |
$result .= &Apache::lonhtmlcommon::htmlareaheaders(); |
} |
} |
if ($args->{'force_register'} && $env{'request.noversionuri'} !~ m{^/res/adm/pages/}) { |
if ($args->{'force_register'}) { |
$result .= Apache::lonxml::display_title(); |
$result .= &Apache::lonmenu::registerurl(1); |
} |
} |
if (!$args->{'no_nav_bar'} |
if (!$args->{'no_nav_bar'} |
&& !$args->{'only_body'} |
&& !$args->{'only_body'} |
Line 7310 $args - additional optional args support
|
Line 7414 $args - additional optional args support
|
skip_phases -> hash ref of |
skip_phases -> hash ref of |
head -> skip the <html><head> generation |
head -> skip the <html><head> generation |
body -> skip all <body> generation |
body -> skip all <body> generation |
|
no_inline_link -> if true and in remote mode, don't show the |
|
'Switch To Inline Menu' link |
no_auto_mt_title -> prevent &mt()ing the title arg |
no_auto_mt_title -> prevent &mt()ing the title arg |
inherit_jsmath -> when creating popup window in a page, |
inherit_jsmath -> when creating popup window in a page, |
should it have jsmath forced on by the |
should it have jsmath forced on by the |
current page |
current page |
bread_crumbs -> Array containing breadcrumbs |
bread_crumbs -> Array containing breadcrumbs |
bread_crumbs_component -> if exists show it as headline else show only the breadcrumbs |
bread_crumbs_component -> if exists show it as headline else show only the breadcrumbs |
|
group -> includes the current group, if page is for a |
|
specific group |
|
|
=back |
=back |
|
|
Line 7328 sub start_page {
|
Line 7436 sub start_page {
|
#&Apache::lonnet::logthis("start_page ".join(':',caller(0))); |
#&Apache::lonnet::logthis("start_page ".join(':',caller(0))); |
|
|
$env{'internal.start_page'}++; |
$env{'internal.start_page'}++; |
my $result; |
my ($result,@advtools); |
|
|
if (! exists($args->{'skip_phases'}{'head'}) ) { |
if (! exists($args->{'skip_phases'}{'head'}) ) { |
$result .= &xml_begin() . &headtag($title, $head_extra, $args); |
$result .= &xml_begin() . &headtag($title, $head_extra, $args); |
Line 7345 sub start_page {
|
Line 7453 sub start_page {
|
$args->{'function'}, $args->{'add_entries'}, |
$args->{'function'}, $args->{'add_entries'}, |
$args->{'only_body'}, $args->{'domain'}, |
$args->{'only_body'}, $args->{'domain'}, |
$args->{'force_register'}, $args->{'no_nav_bar'}, |
$args->{'force_register'}, $args->{'no_nav_bar'}, |
$args->{'bgcolor'}, $args); |
$args->{'bgcolor'}, $args->{'no_inline_link'}, |
|
$args, \@advtools); |
} |
} |
} |
} |
|
|
Line 7374 sub start_page {
|
Line 7483 sub start_page {
|
&Apache::lonhtmlcommon::add_breadcrumb($crumb); |
&Apache::lonhtmlcommon::add_breadcrumb($crumb); |
} |
} |
} |
} |
|
# if @advtools array contains items add then to the breadcrumbs |
|
if (@advtools > 0) { |
|
&Apache::lonmenu::advtools_crumbs(@advtools); |
|
} |
|
|
#if bread_crumbs_component exists show it as headline else show only the breadcrumbs |
#if bread_crumbs_component exists show it as headline else show only the breadcrumbs |
if(exists($args->{'bread_crumbs_component'})){ |
if(exists($args->{'bread_crumbs_component'})){ |
Line 7381 sub start_page {
|
Line 7494 sub start_page {
|
}else{ |
}else{ |
$result .= &Apache::lonhtmlcommon::breadcrumbs(); |
$result .= &Apache::lonhtmlcommon::breadcrumbs(); |
} |
} |
|
} elsif (($env{'environment.remote'} eq 'on') && |
|
($env{'form.inhibitmenu'} ne 'yes') && |
|
($env{'request.noversionuri'} =~ m{^/res/}) && |
|
($env{'request.noversionuri'} !~ m{^/res/adm/pages/})) { |
|
$result .= '<div style="padding:0;margin:0;clear:both"><hr /></div>'; |
} |
} |
return $result; |
return $result; |
} |
} |
Line 7769 sub simple_error_page {
|
Line 7887 sub simple_error_page {
|
my ($r,$title,$msg) = @_; |
my ($r,$title,$msg) = @_; |
my $page = |
my $page = |
&Apache::loncommon::start_page($title). |
&Apache::loncommon::start_page($title). |
&mt($msg). |
'<p class="LC_error">'.&mt($msg).'</p>'. |
&Apache::loncommon::end_page(); |
&Apache::loncommon::end_page(); |
if (ref($r)) { |
if (ref($r)) { |
$r->print($page); |
$r->print($page); |
Line 8886 sub user_rule_formats {
|
Line 9004 sub user_rule_formats {
|
my ($rules,$ruleorder) = &Apache::lonnet::inst_userrules($domain,$check); |
my ($rules,$ruleorder) = &Apache::lonnet::inst_userrules($domain,$check); |
if ((ref($rules) eq 'HASH') && (ref($ruleorder) eq 'ARRAY')) { |
if ((ref($rules) eq 'HASH') && (ref($ruleorder) eq 'ARRAY')) { |
if (@{$ruleorder} > 0) { |
if (@{$ruleorder} > 0) { |
$output = '<br />'.&mt("$text{$check} with the following format(s) may <span class=\"LC_cusr_emph\">only</span> be used for verified users at [_1]:",$domdesc).' <ul>'; |
$output = '<br />'. |
|
&mt($text{$check}.' with the following format(s) may [_1]only[_2] be used for verified users at [_3]:', |
|
'<span class="LC_cusr_emph">','</span>',$domdesc). |
|
' <ul>'; |
foreach my $rule (@{$ruleorder}) { |
foreach my $rule (@{$ruleorder}) { |
if (ref($curr_rules) eq 'ARRAY') { |
if (ref($curr_rules) eq 'ARRAY') { |
if (grep(/^\Q$rule\E$/,@{$curr_rules})) { |
if (grep(/^\Q$rule\E$/,@{$curr_rules})) { |
Line 11219 sub process_extracted_files {
|
Line 11340 sub process_extracted_files {
|
if ($env{'form.folderpath'}) { |
if ($env{'form.folderpath'}) { |
my @items = split('&',$env{'form.folderpath'}); |
my @items = split('&',$env{'form.folderpath'}); |
$folders{'0'} = $items[-2]; |
$folders{'0'} = $items[-2]; |
$containers{'0'}='sequence'; |
if ($env{'form.folderpath'} =~ /\:1$/) { |
} elsif ($env{'form.pagepath'}) { |
$containers{'0'}='page'; |
my @items = split('&',$env{'form.pagepath'}); |
} else { |
$folders{'0'} = $items[-2]; |
$containers{'0'}='sequence'; |
$containers{'0'}='page'; |
} |
} |
} |
my @archdirs = &get_env_multiple('form.archive_directory'); |
my @archdirs = &get_env_multiple('form.archive_directory'); |
if ($numitems) { |
if ($numitems) { |
Line 13151 sub commit_studentrole {
|
Line 13272 sub commit_studentrole {
|
$result = $modify_section_result; |
$result = $modify_section_result; |
} elsif ($secchange == 1) { |
} elsif ($secchange == 1) { |
if ($oldsec eq '') { |
if ($oldsec eq '') { |
$$logmsg .= &mt('Error when attempting to expire existing role without a section for [_1] in course [_3] -error: ',$uname,$cid).' '.$expire_role_result.$linefeed; |
$$logmsg .= &mt('Error when attempting to expire existing role without a section for [_1] in course [_2] -error: ',$uname,$cid).' '.$expire_role_result.$linefeed; |
} else { |
} else { |
$$logmsg .= &mt('Error when attempting to expire existing role for [_1] in section [_2] in course [_3] -error: ',$uname,$oldsec,$cid).' '.$expire_role_result.$linefeed; |
$$logmsg .= &mt('Error when attempting to expire existing role for [_1] in section [_2] in course [_3] -error: ',$uname,$oldsec,$cid).' '.$expire_role_result.$linefeed; |
} |
} |
Line 13177 sub commit_studentrole {
|
Line 13298 sub commit_studentrole {
|
return $result; |
return $result; |
} |
} |
|
|
|
sub show_role_extent { |
|
my ($scope,$context,$role) = @_; |
|
$scope =~ s{^/}{}; |
|
my @courseroles = &Apache::lonuserutils::roles_by_context('course',1); |
|
push(@courseroles,'co'); |
|
my @authorroles = &Apache::lonuserutils::roles_by_context('author'); |
|
if (($context eq 'course') || (grep(/^\Q$role\E/,@courseroles))) { |
|
$scope =~ s{/}{_}; |
|
return '<span class="LC_cusr_emph">'.$env{'course.'.$scope.'.description'}.'</span>'; |
|
} elsif (($context eq 'author') || (grep(/^\Q$role\E/,@authorroles))) { |
|
my ($audom,$auname) = split(/\//,$scope); |
|
return &mt('[_1] Author Space','<span class="LC_cusr_emph">'. |
|
&Apache::loncommon::plainname($auname,$audom).'</span>'); |
|
} else { |
|
$scope =~ s{/$}{}; |
|
return &mt('Domain: [_1]','<span class="LC_cusr_emph">'. |
|
&Apache::lonnet::domain($scope,'description').'</span>'); |
|
} |
|
} |
|
|
############################################################ |
############################################################ |
############################################################ |
############################################################ |
|
|
Line 13818 sub init_user_environment {
|
Line 13959 sub init_user_environment {
|
\%userenv,\%domdef,\%is_adv); |
\%userenv,\%domdef,\%is_adv); |
} |
} |
|
|
|
$userenv{'canrequest.author'} = |
|
&Apache::lonnet::usertools_access($username,$domain,'requestauthor', |
|
'reload','requestauthor', |
|
\%userenv,\%domdef,\%is_adv); |
|
my %reqauthor = &Apache::lonnet::get('requestauthor',['author_status','author'], |
|
$domain,$username); |
|
my $reqstatus = $reqauthor{'author_status'}; |
|
if ($reqstatus eq 'approval' || $reqstatus eq 'approved') { |
|
if (ref($reqauthor{'author'}) eq 'HASH') { |
|
$userenv{'requestauthorqueued'} = $reqstatus.':'. |
|
$reqauthor{'author'}{'timestamp'}; |
|
} |
|
} |
|
|
$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 13969 sub update_content_constraints {
|
Line 14124 sub update_content_constraints {
|
return; |
return; |
} |
} |
|
|
|
sub allmaps_incourse { |
|
my ($cdom,$cnum,$chome,$cid) = @_; |
|
if ($cdom eq '' || $cnum eq '' || $chome eq '' || $cid eq '') { |
|
$cid = $env{'request.course.id'}; |
|
$cdom = $env{'course.'.$cid.'.domain'}; |
|
$cnum = $env{'course.'.$cid.'.num'}; |
|
$chome = $env{'course.'.$cid.'.home'}; |
|
} |
|
my %allmaps = (); |
|
my $lastchange = |
|
&Apache::lonnet::get_coursechange($cdom,$cnum); |
|
if ($lastchange > $env{'request.course.tied'}) { |
|
my ($furl,$ferr) = &Apache::lonuserstate::readmap("$cdom/$cnum"); |
|
unless ($ferr) { |
|
&update_content_constraints($cdom,$cnum,$chome,$cid); |
|
} |
|
} |
|
my $navmap = Apache::lonnavmaps::navmap->new(); |
|
if (defined($navmap)) { |
|
foreach my $res ($navmap->retrieveResources(undef,sub { $_[0]->is_map() },1,0,1)) { |
|
$allmaps{$res->src()} = 1; |
|
} |
|
} |
|
return \%allmaps; |
|
} |
|
|
sub parse_supplemental_title { |
sub parse_supplemental_title { |
my ($title) = @_; |
my ($title) = @_; |
|
|
Line 13992 sub parse_supplemental_title {
|
Line 14173 sub parse_supplemental_title {
|
return $title; |
return $title; |
} |
} |
|
|
|
sub symb_to_docspath { |
|
my ($symb) = @_; |
|
return unless ($symb); |
|
my ($mapurl,$id,$resurl) = &Apache::lonnet::decode_symb($symb); |
|
if ($resurl=~/\.(sequence|page)$/) { |
|
$mapurl=$resurl; |
|
} elsif ($resurl eq 'adm/navmaps') { |
|
$mapurl=$env{'course.'.$env{'request.course.id'}.'.url'}; |
|
} |
|
my $mapresobj; |
|
my $navmap = Apache::lonnavmaps::navmap->new(); |
|
if (ref($navmap)) { |
|
$mapresobj = $navmap->getResourceByUrl($mapurl); |
|
} |
|
$mapurl=~s{^.*/([^/]+)\.(\w+)$}{$1}; |
|
my $type=$2; |
|
my $path; |
|
if (ref($mapresobj)) { |
|
my $pcslist = $mapresobj->map_hierarchy(); |
|
if ($pcslist ne '') { |
|
foreach my $pc (split(/,/,$pcslist)) { |
|
next if ($pc <= 1); |
|
my $res = $navmap->getByMapPc($pc); |
|
if (ref($res)) { |
|
my $thisurl = $res->src(); |
|
$thisurl=~s{^.*/([^/]+)\.\w+$}{$1}; |
|
my $thistitle = $res->title(); |
|
$path .= '&'. |
|
&Apache::lonhtmlcommon::entity_encode($thisurl).'&'. |
|
&Apache::lonhtmlcommon::entity_encode($thistitle). |
|
':'.$res->randompick(). |
|
':'.$res->randomout(). |
|
':'.$res->encrypted(). |
|
':'.$res->randomorder(). |
|
':'.$res->is_page(); |
|
} |
|
} |
|
} |
|
$path =~ s/^\&//; |
|
my $maptitle = $mapresobj->title(); |
|
if ($mapurl eq 'default') { |
|
$maptitle = 'Main Course Documents'; |
|
} |
|
$path .= (($path ne '')? '&' : ''). |
|
&Apache::lonhtmlcommon::entity_encode($mapurl).'&'. |
|
&Apache::lonhtmlcommon::entity_encode($maptitle). |
|
':'.$mapresobj->randompick(). |
|
':'.$mapresobj->randomout(). |
|
':'.$mapresobj->encrypted(). |
|
':'.$mapresobj->randomorder(). |
|
':'.$mapresobj->is_page(); |
|
} else { |
|
my $maptitle = &Apache::lonnet::gettitle($mapurl); |
|
my $ispage = (($type eq 'page')? 1 : ''); |
|
if ($mapurl eq 'default') { |
|
$maptitle = 'Main Course Documents'; |
|
} |
|
$path = &Apache::lonhtmlcommon::entity_encode($mapurl).'&'. |
|
&Apache::lonhtmlcommon::entity_encode($maptitle).':::::'.$ispage; |
|
} |
|
unless ($mapurl eq 'default') { |
|
$path = 'default&'. |
|
&Apache::lonhtmlcommon::entity_encode('Main Course Documents'). |
|
':::::&'.$path; |
|
} |
|
return $path; |
|
} |
|
|
|
sub captcha_display { |
|
my ($context,$lonhost) = @_; |
|
my ($output,$error); |
|
my ($captcha,$pubkey,$privkey) = &get_captcha_config($context,$lonhost); |
|
if ($captcha eq 'original') { |
|
$output = &create_captcha(); |
|
unless ($output) { |
|
$error = 'captcha'; |
|
} |
|
} elsif ($captcha eq 'recaptcha') { |
|
$output = &create_recaptcha($pubkey); |
|
unless ($output) { |
|
$error = 'recaptcha'; |
|
} |
|
} |
|
return ($output,$error); |
|
} |
|
|
|
sub captcha_response { |
|
my ($context,$lonhost) = @_; |
|
my ($captcha_chk,$captcha_error); |
|
my ($captcha,$pubkey,$privkey) = &get_captcha_config($context,$lonhost); |
|
if ($captcha eq 'original') { |
|
($captcha_chk,$captcha_error) = &check_captcha(); |
|
} elsif ($captcha eq 'recaptcha') { |
|
$captcha_chk = &check_recaptcha($privkey); |
|
} else { |
|
$captcha_chk = 1; |
|
} |
|
return ($captcha_chk,$captcha_error); |
|
} |
|
|
|
sub get_captcha_config { |
|
my ($context,$lonhost) = @_; |
|
my ($captcha,$pubkey,$privkey,$hashtocheck); |
|
my $hostname = &Apache::lonnet::hostname($lonhost); |
|
my $serverhomeID = &Apache::lonnet::get_server_homeID($hostname); |
|
my $serverhomedom = &Apache::lonnet::host_domain($serverhomeID); |
|
if ($context eq 'usercreation') { |
|
my %domconfig = &Apache::lonnet::get_dom('configuration',[$context],$serverhomedom); |
|
if (ref($domconfig{$context}) eq 'HASH') { |
|
$hashtocheck = $domconfig{$context}{'cancreate'}; |
|
if (ref($hashtocheck) eq 'HASH') { |
|
if ($hashtocheck->{'captcha'} eq 'recaptcha') { |
|
if (ref($hashtocheck->{'recaptchakeys'}) eq 'HASH') { |
|
$pubkey = $hashtocheck->{'recaptchakeys'}{'public'}; |
|
$privkey = $hashtocheck->{'recaptchakeys'}{'private'}; |
|
} |
|
if ($privkey && $pubkey) { |
|
$captcha = 'recaptcha'; |
|
} else { |
|
$captcha = 'original'; |
|
} |
|
} elsif ($hashtocheck->{'captcha'} ne 'notused') { |
|
$captcha = 'original'; |
|
} |
|
} |
|
} else { |
|
$captcha = 'captcha'; |
|
} |
|
} elsif ($context eq 'login') { |
|
my %domconfhash = &Apache::loncommon::get_domainconf($serverhomedom); |
|
if ($domconfhash{$serverhomedom.'.login.captcha'} eq 'recaptcha') { |
|
$pubkey = $domconfhash{$serverhomedom.'.login.recaptchakeys_public'}; |
|
$privkey = $domconfhash{$serverhomedom.'.login.recaptchakeys_private'}; |
|
if ($privkey && $pubkey) { |
|
$captcha = 'recaptcha'; |
|
} else { |
|
$captcha = 'original'; |
|
} |
|
} elsif ($domconfhash{$serverhomedom.'.login.captcha'} eq 'original') { |
|
$captcha = 'original'; |
|
} |
|
} |
|
return ($captcha,$pubkey,$privkey); |
|
} |
|
|
|
sub create_captcha { |
|
my %captcha_params = &captcha_settings(); |
|
my ($output,$maxtries,$tries) = ('',10,0); |
|
while ($tries < $maxtries) { |
|
$tries ++; |
|
my $captcha = Authen::Captcha->new ( |
|
output_folder => $captcha_params{'output_dir'}, |
|
data_folder => $captcha_params{'db_dir'}, |
|
); |
|
my $md5sum = $captcha->generate_code($captcha_params{'numchars'}); |
|
|
|
if (-e $Apache::lonnet::perlvar{'lonCaptchaDir'}.'/'.$md5sum.'.png') { |
|
$output = '<input type="hidden" name="crypt" value="'.$md5sum.'" />'."\n". |
|
&mt('Type in the letters/numbers shown below').' '. |
|
'<input type="text" size="5" name="code" value="" /><br />'. |
|
'<img src="'.$captcha_params{'www_output_dir'}.'/'.$md5sum.'.png" />'; |
|
last; |
|
} |
|
} |
|
return $output; |
|
} |
|
|
|
sub captcha_settings { |
|
my %captcha_params = ( |
|
output_dir => $Apache::lonnet::perlvar{'lonCaptchaDir'}, |
|
www_output_dir => "/captchaspool", |
|
db_dir => $Apache::lonnet::perlvar{'lonCaptchaDb'}, |
|
numchars => '5', |
|
); |
|
return %captcha_params; |
|
} |
|
|
|
sub check_captcha { |
|
my ($captcha_chk,$captcha_error); |
|
my $code = $env{'form.code'}; |
|
my $md5sum = $env{'form.crypt'}; |
|
my %captcha_params = &captcha_settings(); |
|
my $captcha = Authen::Captcha->new( |
|
output_folder => $captcha_params{'output_dir'}, |
|
data_folder => $captcha_params{'db_dir'}, |
|
); |
|
$captcha_chk = $captcha->check_code($code,$md5sum); |
|
my %captcha_hash = ( |
|
0 => 'Code not checked (file error)', |
|
-1 => 'Failed: code expired', |
|
-2 => 'Failed: invalid code (not in database)', |
|
-3 => 'Failed: invalid code (code does not match crypt)', |
|
); |
|
if ($captcha_chk != 1) { |
|
$captcha_error = $captcha_hash{$captcha_chk} |
|
} |
|
return ($captcha_chk,$captcha_error); |
|
} |
|
|
|
sub create_recaptcha { |
|
my ($pubkey) = @_; |
|
my $captcha = Captcha::reCAPTCHA->new; |
|
return $captcha->get_options_setter({theme => 'white'})."\n". |
|
$captcha->get_html($pubkey). |
|
&mt('If either word is hard to read, [_1] will replace them.', |
|
'<image src="/res/adm/pages/refresh.gif" alt="reCAPTCHA refresh" />'). |
|
'<br /><br />'; |
|
} |
|
|
|
sub check_recaptcha { |
|
my ($privkey) = @_; |
|
my $captcha_chk; |
|
my $captcha = Captcha::reCAPTCHA->new; |
|
my $captcha_result = |
|
$captcha->check_answer( |
|
$privkey, |
|
$ENV{'REMOTE_ADDR'}, |
|
$env{'form.recaptcha_challenge_field'}, |
|
$env{'form.recaptcha_response_field'}, |
|
); |
|
if ($captcha_result->{is_valid}) { |
|
$captcha_chk = 1; |
|
} |
|
return $captcha_chk; |
|
} |
|
|
=pod |
=pod |
|
|
=back |
=back |