--- loncom/interface/loncommon.pm 2012/12/28 02:03:13 1.1075.2.24
+++ loncom/interface/loncommon.pm 2012/05/24 22:56:30 1.1079
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# a pile of common routines
#
-# $Id: loncommon.pm,v 1.1075.2.24 2012/12/28 02:03:13 raeburn Exp $
+# $Id: loncommon.pm,v 1.1079 2012/05/24 22:56:30 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -70,8 +70,6 @@ use Apache::lonclonecourse();
use LONCAPA qw(:DEFAULT :match);
use DateTime::TimeZone;
use DateTime::Locale::Catalog;
-use Authen::Captcha;
-use Captcha::reCAPTCHA;
# ---------------------------------------------- Designs
use vars qw(%defaultdesign);
@@ -887,14 +885,10 @@ sub check_uncheck_jscript {
function checkAll(field) {
if (field.length > 0) {
for (i = 0; i < field.length; i++) {
- if (!field[i].disabled) {
- field[i].checked = true;
- }
+ field[i].checked = true ;
}
} else {
- if (!field.disabled) {
- field.checked = true;
- }
+ field.checked = true
}
}
@@ -2481,7 +2475,7 @@ END
return $result;
}
-sub authform_authorwarning {
+sub authform_authorwarning{
my $result='';
$result=''.
&mt('As a general rule, only authors or co-authors should be '.
@@ -2490,16 +2484,16 @@ sub authform_authorwarning {
return $result;
}
-sub authform_nochange {
+sub authform_nochange{
my %in = (
formname => 'document.cu',
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;
- if (!$authnum) {
- $result = &mt('Under your current role you are not permitted to change login settings for this user');
+ if (keys(%can_assign) == 0) {
+ $result = &mt('Under you current role you are not permitted to change login settings for this user');
} else {
$result = ''.&mt('[_1] Do not change login data',
' ';
+ $authtype = ' ';
}
}
}
@@ -2581,9 +2575,9 @@ sub authform_kerberos {
$krbcheck.' />';
}
if (($can_assign{'krb4'} && $can_assign{'krb5'}) ||
- ($can_assign{'krb4'} && !$can_assign{'krb5'} &&
+ ($can_assign{'krb4'} && !$can_assign{'krb5'} &&
$in{'curr_authtype'} eq 'krb5') ||
- (!$can_assign{'krb4'} && $can_assign{'krb5'} &&
+ (!$can_assign{'krb4'} && $can_assign{'krb5'} &&
$in{'curr_authtype'} eq 'krb4')) {
$result .= &mt
('[_1] Kerberos authenticated with domain [_2] '.
@@ -2619,14 +2613,14 @@ sub authform_kerberos {
return $result;
}
-sub authform_internal {
+sub authform_internal{
my %in = (
formname => 'document.cu',
kerb_def_dom => 'MSU.EDU',
@_,
);
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 ($in{'curr_authtype'} eq 'int') {
if ($can_assign{'int'}) {
@@ -2655,7 +2649,7 @@ sub authform_internal {
if (defined($in{'mode'})) {
if ($in{'mode'} eq 'modifycourse') {
if ($authnum == 1) {
- $authtype = ' ';
+ $authtype = ' ';
}
}
}
@@ -2674,14 +2668,14 @@ sub authform_internal {
return $result;
}
-sub authform_local {
+sub authform_local{
my %in = (
formname => 'document.cu',
kerb_def_dom => 'MSU.EDU',
@_,
);
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 ($in{'curr_authtype'} eq 'loc') {
if ($can_assign{'loc'}) {
@@ -2710,7 +2704,7 @@ sub authform_local {
if (defined($in{'mode'})) {
if ($in{'mode'} eq 'modifycourse') {
if ($authnum == 1) {
- $authtype = ' ';
+ $authtype = ' ';
}
}
}
@@ -2728,14 +2722,14 @@ sub authform_local {
return $result;
}
-sub authform_filesystem {
+sub authform_filesystem{
my %in = (
formname => 'document.cu',
kerb_def_dom => 'MSU.EDU',
@_,
);
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 ($in{'curr_authtype'} eq 'fsys') {
if ($can_assign{'fsys'}) {
@@ -2761,7 +2755,7 @@ sub authform_filesystem {
if (defined($in{'mode'})) {
if ($in{'mode'} eq 'modifycourse') {
if ($authnum == 1) {
- $authtype = ' ';
+ $authtype = ' ';
}
}
}
@@ -3232,7 +3226,7 @@ sub aboutmewrapper {
if (!defined($username) && !defined($domain)) {
return;
}
- return ''.$link.' ';
}
@@ -4960,19 +4954,12 @@ Inputs:
=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
no_auto_mt_title -> prevents &mt()ing the title arg
inherit_jsmath -> when creating popup window in a page,
should it have jsmath forced on by the
current page
-=item * $advtoolsref, optional argument, ref to an array containing
- inlineremote items to be added in "Functions" menu below
- breadcrumbs.
-
=back
Returns: A uniform header for LON-CAPA web pages.
@@ -4984,7 +4971,7 @@ other decorations will be returned.
sub bodytag {
my ($title,$function,$addentries,$bodyonly,$domain,$forcereg,
- $no_nav_bar,$bgcolor,$no_inline_link,$args,$advtoolsref)=@_;
+ $no_nav_bar,$bgcolor,$args)=@_;
my $public;
if ((($env{'user.name'} eq 'public') && ($env{'user.domain'} eq 'public'))
@@ -5060,25 +5047,11 @@ sub bodytag {
$role = '('.$role.') ' if $role;
&get_unprocessed_cgi($ENV{'QUERY_STRING'}, ['inhibitmenu']);
- if ($no_nav_bar || $env{'form.inhibitmenu'} eq 'yes') {
- return $bodytag;
- }
-
- if ($env{'request.state'} eq 'construct') { $forcereg=1; }
+ if ($no_nav_bar || $env{'form.inhibitmenu'} eq 'yes') {
+ return $bodytag;
+ }
- 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') { $forcereg=1; }
# if ($env{'request.state'} eq 'construct') {
# $titleinfo = &CSTR_pageheader(); #FIXME: Will be removed once all scripts have their own calls
@@ -5087,11 +5060,11 @@ sub bodytag {
if ($env{'request.noversionuri'} =~ m{^/res/adm/pages/}) {
- if ($dc_info) {
+ if ($dc_info) {
$dc_info = qq|$dc_info |;
- }
- $bodytag .= qq|$name $role
- $realm $dc_info
|;
+ }
+ $bodytag .= qq|$name $role
+ $realm $dc_info
|;
return $bodytag;
}
@@ -5118,17 +5091,7 @@ sub bodytag {
$bodytag .= &Apache::lonmenu::innerregister($forcereg,
$args->{'bread_crumbs'});
} elsif ($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;
- }
+ $bodytag .= &Apache::lonmenu::innerregister($forcereg);
}
}else{
# this is to seperate menu from content when there's no secondary
@@ -5138,44 +5101,6 @@ sub bodytag {
}
return $bodytag;
- }
-
-#
-# Top frame rendering, Remote is up
-#
-
- my $imgsrc = $img;
- if ($img =~ /^\/adm/) {
- $imgsrc = &lonhttpdurl($img);
- }
- my $upperleft=' ';
-
- # Explicit link to get inline menu
- my $menu= ($no_inline_link?''
- :''.&mt('Switch to Inline Menu Mode').' ');
-
- if ($dc_info) {
- $dc_info = qq|($dc_info) |;
- }
-
- unless ($env{'form.inhibitmenu'}) {
- $bodytag .= qq|$name $role
- $realm $dc_info
|;
- }
- 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 {
@@ -5207,15 +5132,8 @@ sub make_attr_string {
delete($attr_ref->{$key});
}
}
- if ($env{'environment.remote'} eq 'on') {
- $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;
- }
+ $attr_ref->{'onload'} = $on_load;
+ $attr_ref->{'onunload'}= $on_unload;
}
my $attr_string;
@@ -5245,10 +5163,7 @@ i.e., $env{'internal.head.redirect'} exi
sub endbodytag {
my ($args) = @_;
- my $endbodytag;
- unless ((ref($args) eq 'HASH') && ($args->{'notbody'})) {
- $endbodytag='
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
inherit_jsmath -> when creating popup window in a page,
should it have jsmath forced on by the
current page
bread_crumbs -> Array containing 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
@@ -7434,7 +7283,7 @@ sub start_page {
#&Apache::lonnet::logthis("start_page ".join(':',caller(0)));
$env{'internal.start_page'}++;
- my ($result,@advtools);
+ my $result;
if (! exists($args->{'skip_phases'}{'head'}) ) {
$result .= &xml_begin() . &headtag($title, $head_extra, $args);
@@ -7451,8 +7300,7 @@ sub start_page {
$args->{'function'}, $args->{'add_entries'},
$args->{'only_body'}, $args->{'domain'},
$args->{'force_register'}, $args->{'no_nav_bar'},
- $args->{'bgcolor'}, $args->{'no_inline_link'},
- $args, \@advtools);
+ $args->{'bgcolor'}, $args);
}
}
@@ -7481,10 +7329,6 @@ sub start_page {
&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(exists($args->{'bread_crumbs_component'})){
@@ -7492,11 +7336,6 @@ sub start_page {
}else{
$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 .= '
';
}
return $result;
}
@@ -7518,9 +7357,7 @@ sub end_page {
} else {
$result .= &endbodytag($args);
}
- unless ($args->{'notbody'}) {
- $result .= "\n";
- }
+ $result .= "\n';
- }
+ my $endbodytag='';
$endbodytag=&Apache::lontexconvert::jsMath_process()."\n".$endbodytag;
if ( exists( $env{'internal.head.redirect'} ) ) {
if (!(ref($args) eq 'HASH' && $args->{'noredirectlink'})) {
@@ -5388,12 +5303,10 @@ form, .inline {
.LC_error {
color: red;
+ font-size: larger;
}
-.LC_warning {
- color: darkorange;
-}
-
+.LC_warning,
.LC_diff_removed {
color: red;
}
@@ -5556,11 +5469,11 @@ td.LC_table_cell_checkbox {
text-align: left;
}
-.LC_head_subbox, .LC_actionbox {
+.LC_head_subbox {
clear:both;
background: #F8F8F8; /* $sidebg; */
border: 1px solid $sidebg;
- margin: 0 0 10px 0;
+ margin: 0 0 10px 0;
padding: 3px;
text-align: left;
}
@@ -6255,6 +6168,7 @@ div.LC_docs_entry_move {
table.LC_data_table tr > td.LC_docs_entry_commands,
table.LC_data_table tr > td.LC_docs_entry_parameter {
+ background: #DDDDDD;
font-size: x-small;
}
@@ -6627,7 +6541,7 @@ ol.LC_docs_parameters li.LC_docs_paramet
}
ul#LC_secondary_menu {
- clear: right;
+ clear: both;
color: $fontmenu;
background: $tabbg;
list-style: none;
@@ -6635,53 +6549,15 @@ ul#LC_secondary_menu {
margin: 0;
width: 100%;
text-align: left;
- float: left;
}
ul#LC_secondary_menu li {
font-weight: bold;
line-height: 1.8em;
- border-right: 1px solid black;
- vertical-align: middle;
- float: left;
-}
-
-ul#LC_secondary_menu li.LC_hoverable:hover, ul#LC_secondary_menu li.hover {
- background-color: $data_table_light;
-}
-
-ul#LC_secondary_menu li a {
padding: 0 0.8em;
-}
-
-ul#LC_secondary_menu li ul {
- display: none;
-}
-
-ul#LC_secondary_menu li:hover ul, ul#LC_secondary_menu li.hover ul {
- display: block;
- position: absolute;
- margin: 0;
- padding: 0;
- list-style:none;
- float: none;
- background-color: $data_table_light;
- z-index: 2;
- margin-left: -1px;
-}
-
-ul#LC_secondary_menu li ul li {
- font-size: 90%;
- vertical-align: top;
- border-left: 1px solid black;
border-right: 1px solid black;
- background-color: $data_table_light
- list-style:none;
- float: none;
-}
-
-ul#LC_secondary_menu li ul li:hover, ul#LC_secondary_menu li ul li.hover {
- background-color: $data_table_dark;
+ display: inline;
+ vertical-align: middle;
}
ul.LC_TabContent {
@@ -7021,7 +6897,6 @@ ul#LC_toolbar {
list-style:none;
position:relative;
background-color:white;
- overflow: auto;
}
ul#LC_toolbar li {
@@ -7031,7 +6906,6 @@ ul#LC_toolbar li {
float: left;
display:inline;
vertical-align:middle;
- white-space: nowrap;
}
@@ -7128,27 +7002,6 @@ ul.LC_funclist li {
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
}
@@ -7202,8 +7055,8 @@ sub headtag {
if (!$args->{'frameset'}) {
$result .= &Apache::lonhtmlcommon::htmlareaheaders();
}
- if ($args->{'force_register'}) {
- $result .= &Apache::lonmenu::registerurl(1);
+ if ($args->{'force_register'} && $env{'request.noversionuri'} !~ m{^/res/adm/pages/}) {
+ $result .= Apache::lonxml::display_title();
}
if (!$args->{'no_nav_bar'}
&& !$args->{'only_body'}
@@ -7412,16 +7265,12 @@ $args - additional optional args support
skip_phases -> hash ref of
head -> skip the