--- loncom/interface/loncommon.pm 2013/09/07 00:46:18 1.1075.2.51
+++ loncom/interface/loncommon.pm 2012/05/24 14:20:53 1.1078
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# a pile of common routines
#
-# $Id: loncommon.pm,v 1.1075.2.51 2013/09/07 00:46:18 raeburn Exp $
+# $Id: loncommon.pm,v 1.1078 2012/05/24 14:20:53 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -67,13 +67,9 @@ use Apache::lonhtmlcommon();
use Apache::loncoursedata();
use Apache::lontexconvert();
use Apache::lonclonecourse();
-use Apache::lonuserutils();
-use Apache::lonuserstate();
use LONCAPA qw(:DEFAULT :match);
use DateTime::TimeZone;
use DateTime::Locale::Catalog;
-use Authen::Captcha;
-use Captcha::reCAPTCHA;
# ---------------------------------------------- Designs
use vars qw(%defaultdesign);
@@ -528,8 +524,7 @@ ENDAUTHORBRW
}
sub coursebrowser_javascript {
- my ($domainfilter,$sec_element,$formname,$role_element,$crstype,
- $credits_element) = @_;
+ my ($domainfilter,$sec_element,$formname,$role_element,$crstype) = @_;
my $wintitle = 'Course_Browser';
if ($crstype eq 'Community') {
$wintitle = 'Community_Browser';
@@ -592,9 +587,8 @@ sub coursebrowser_javascript {
}
$id_functions
ENDSTDBRW
- if (($sec_element ne '') || ($role_element ne '') || ($credits_element ne '')) {
- $output .= &setsec_javascript($sec_element,$formname,$role_element,
- $credits_element);
+ if (($sec_element ne '') || ($role_element ne '')) {
+ $output .= &setsec_javascript($sec_element,$formname,$role_element);
}
$output .= '
// ]]>
@@ -751,7 +745,7 @@ ENDUSERBRW
}
sub setsec_javascript {
- my ($sec_element,$formname,$role_element,$credits_element) = @_;
+ my ($sec_element,$formname,$role_element) = @_;
my (@courserolenames,@communityrolenames,$rolestr,$courserolestr,
$communityrolestr);
if ($role_element ne '') {
@@ -846,14 +840,6 @@ function setRole(crstype) {
}
|;
}
- if ($credits_element) {
- $setsections .= qq|
-function setCredits(defaultcredits) {
- document.$formname.$credits_element.value = defaultcredits;
- return;
-}
-|;
- }
return $setsections;
}
@@ -899,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
}
}
@@ -1008,7 +990,6 @@ sub select_language {
$langchoices{$code} = &plainlanguagedescription($id);
}
}
- %langchoices = &Apache::lonlocal::texthash(%langchoices);
return &select_form($selected,$name,\%langchoices);
}
@@ -1040,12 +1021,6 @@ linked_select_forms takes the following
=item * $menuorder, the order of values in the first menu
-=item * $onchangefirst, additional javascript call to execute for an onchange
- event for the first tag
-
-=item * $onchangesecond, additional javascript call to execute for an onchange
- event for the second tag
-
=back
Below is an example of such a hash. Only the 'text', 'default', and
@@ -1099,8 +1074,6 @@ sub linked_select_forms {
$secondselectname,
$hashref,
$menuorder,
- $onchangefirst,
- $onchangesecond
) = @_;
my $second = "document.$formname.$secondselectname";
my $first = "document.$formname.$firstselectname";
@@ -1157,7 +1130,7 @@ function select1_changed() {
END
# output the initial values for the selection lists
- $result .= "\n";
+ $result .= "\n";
my @order = sort(keys(%{$hashref}));
if (ref($menuorder) eq 'ARRAY') {
@order = @{$menuorder};
@@ -1170,11 +1143,7 @@ END
$result .= " \n";
my %select2 = %{$hashref->{$firstdefault}->{'select2'}};
$result .= $middletext;
- $result .= "\n";
my $seconddefault = $hashref->{$firstdefault}->{'default'};
my @secondorder = sort(keys(%select2));
@@ -1234,11 +1203,7 @@ sub help_open_topic {
$topic=~s/\W/\_/g;
if (!$stayOnPage) {
- if ($env{'browser.mobile'}) {
- $link = "javascript:openMyModal('/adm/help/${filename}.hlp',$width,$height,'yes');";
- } else {
- $link = "javascript:void(open('/adm/help/${filename}.hlp', 'Help_for_$topic', 'menubar=0,toolbar=1,scrollbars=1,width=$width,height=$height,resizable=yes'))";
- }
+ $link = "javascript:openMyModal('/adm/help/${filename}.hlp',$width,$height,'yes');";
} elsif ($stayOnPage eq 'popup') {
$link = "javascript:void(open('/adm/help/${filename}.hlp', 'Help_for_$topic', 'menubar=0,toolbar=1,scrollbars=1,width=$width,height=$height,resizable=yes'))";
} else {
@@ -2165,7 +2130,7 @@ sub select_level_form {
=pod
-=item * &select_dom_form($defdom,$name,$includeempty,$showdomdesc,$onchange,$incdoms,$excdoms)
+=item * &select_dom_form($defdom,$name,$includeempty,$showdomdesc,$onchange,$incdoms)
Returns a string containing a form to
allow a user to select the domain to preform an operation in.
@@ -2178,31 +2143,25 @@ If the $showdomdesc flag is set, the dom
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.
-
-The optional $excdoms is a reference to an array of domains which will be excluded from the available options.
+The optional $incdoms is a reference to an array of domains which will be the only available options.
=cut
#-------------------------------------------
sub select_dom_form {
- my ($defdom,$name,$includeempty,$showdomdesc,$onchange,$incdoms,$excdoms) = @_;
+ my ($defdom,$name,$includeempty,$showdomdesc,$onchange,$incdoms) = @_;
if ($onchange) {
$onchange = ' onchange="'.$onchange.'"';
}
- my (@domains,%exclude);
+ 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 (ref($excdoms) eq 'ARRAY') {
- map { $exclude{$_} = 1; } @{$excdoms};
- }
my $selectdomain = "\n";
foreach my $dom (@domains) {
- next if ($exclude{$dom});
$selectdomain.="'.$dom;
if ($showdomdesc) {
@@ -2323,10 +2282,6 @@ Outputs:
=item * $clientos
-=item * $clientmobile
-
-=item * $clientinfo
-
=back
=back
@@ -2345,7 +2300,6 @@ sub decode_user_agent {
my $clientversion='0';
my $clientmathml='';
my $clientunicode='0';
- my $clientmobile=0;
for (my $i=0;$i<=$#browsertype;$i++) {
my ($bname,$match,$notmatch,$vreg,$minv,$univ)=split(/\:/,$browsertype[$i]);
if (($httpbrowser=~/$match/i) && ($httpbrowser!~/$notmatch/i)) {
@@ -2357,7 +2311,6 @@ sub decode_user_agent {
}
}
my $clientos='unknown';
- my $clientinfo;
if (($httpbrowser=~/linux/i) ||
($httpbrowser=~/unix/i) ||
($httpbrowser=~/ux/i) ||
@@ -2369,16 +2322,8 @@ sub decode_user_agent {
($httpbrowser=~/powerpc/i)) { $clientos='mac'; }
if ($httpbrowser=~/win/i) { $clientos='win'; }
if ($httpbrowser=~/embed/i) { $clientos='pda'; }
- if ($httpbrowser=~/(Android|iPod|iPad|iPhone|webOS|Blackberry|Windows Phone|Opera m(?:ob|in)|Fennec)/i) {
- $clientmobile=lc($1);
- }
- if ($httpbrowser=~ m{Firefox/(\d+\.\d+)}) {
- $clientinfo = 'firefox-'.$1;
- } elsif ($httpbrowser=~ m{chromeframe/(\d+\.\d+)\.}) {
- $clientinfo = 'chromeframe-'.$1;
- }
return ($httpbrowser,$clientbrowser,$clientversion,$clientmathml,
- $clientunicode,$clientos,$clientmobile,$clientinfo);
+ $clientunicode,$clientos,);
}
###############################################################
@@ -2530,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 '.
@@ -2539,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 = ' ';
}
}
}
@@ -2630,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] '.
@@ -2668,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'}) {
@@ -2704,7 +2649,7 @@ sub authform_internal {
if (defined($in{'mode'})) {
if ($in{'mode'} eq 'modifycourse') {
if ($authnum == 1) {
- $authtype = ' ';
+ $authtype = ' ';
}
}
}
@@ -2723,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'}) {
@@ -2759,7 +2704,7 @@ sub authform_local {
if (defined($in{'mode'})) {
if ($in{'mode'} eq 'modifycourse') {
if ($authnum == 1) {
- $authtype = ' ';
+ $authtype = ' ';
}
}
}
@@ -2777,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'}) {
@@ -2810,7 +2755,7 @@ sub authform_filesystem {
if (defined($in{'mode'})) {
if ($in{'mode'} eq 'modifycourse') {
if ($authnum == 1) {
- $authtype = ' ';
+ $authtype = ' ';
}
}
}
@@ -3238,7 +3183,7 @@ sub screenname {
# ------------------------------------------------------------- Confirm Wrapper
=pod
-=item * &confirmwrapper($message)
+=item confirmwrapper
Wrap messages about completion of operation in box
@@ -3281,7 +3226,7 @@ sub aboutmewrapper {
if (!defined($username) && !defined($domain)) {
return;
}
- return ''.$link.' ';
}
@@ -4856,7 +4801,7 @@ sub designparm {
Inputs: $url (usually will be undef).
-Returns: Path to Authoring Space containing the resource or
+Returns: Path to Construction Space containing the resource or
directory being viewed (or for which action is being taken).
If $url is provided, and begins /priv//
the path will be that portion of the $context argument.
@@ -4919,7 +4864,7 @@ Input: (optional) filename from which br
is appropriate for use in building the breadcrumb trail.
Returns: HTML div with CSTR path and recent box
- To be included on Authoring Space pages
+ To be included on Construction Space pages
=cut
@@ -4934,7 +4879,7 @@ sub CSTR_pageheader {
my $londocroot = $Apache::lonnet::perlvar{'lonDocRoot'};
my ($udom,$uname,$thisdisfn)=
- ($trailfile =~ m{^\Q$londocroot\E/priv/([^/]+)/([^/]+)(?:|/(.*))$});
+ ($trailfile =~ m{^\Q$londocroot\E/priv/([^/]+)/([^/]+)/(.*)$});
my $formaction = "/priv/$udom/$uname/$thisdisfn";
$formaction =~ s{/+}{/}g;
@@ -4950,7 +4895,7 @@ sub CSTR_pageheader {
my $output =
''
.&Apache::loncommon::help_open_menu('','',3,'Authoring') #FIXME: Broken? Where is it?
- .'
'.&mt('Authoring Space:').' '
+ .'
'.&mt('Construction Space:').' '
.'
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
@@ -7503,7 +7281,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);
@@ -7520,8 +7298,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);
}
}
@@ -7550,10 +7327,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'})){
@@ -7561,11 +7334,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;
}
@@ -7587,9 +7355,7 @@ sub end_page {
} else {
$result .= &endbodytag($args);
}
- unless ($args->{'notbody'}) {
- $result .= "\n";
- }
+ $result .= "\n';
$endbodytag=&Apache::lontexconvert::jsMath_process()."\n".$endbodytag;
if ( exists( $env{'internal.head.redirect'} ) ) {
if (!(ref($args) eq 'HASH' && $args->{'noredirectlink'})) {
@@ -5400,14 +5265,6 @@ form, .inline {
vertical-align:middle;
}
-.LC_floatleft {
- float: left;
-}
-
-.LC_floatright {
- float: right;
-}
-
.LC_400Box {
width:400px;
}
@@ -5446,12 +5303,10 @@ form, .inline {
.LC_error {
color: red;
+ font-size: larger;
}
-.LC_warning {
- color: darkorange;
-}
-
+.LC_warning,
.LC_diff_removed {
color: red;
}
@@ -5614,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;
}
@@ -5751,8 +5606,7 @@ table.LC_nested tr.LC_empty_row td {
padding: 8px;
}
-table.LC_data_table tr.LC_empty_row td,
-table.LC_data_table tr.LC_footer_row td {
+table.LC_data_table tr.LC_empty_row td {
background-color: $sidebg;
}
@@ -6314,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;
}
@@ -6478,11 +6333,6 @@ div.LC_edit_problem_saves {
padding-bottom: 5px;
}
-.LC_edit_opt {
- padding-left: 1em;
- white-space: nowrap;
-}
-
img.stift {
border-width: 0;
vertical-align: middle;
@@ -6497,7 +6347,6 @@ div.LC_createcourse {
}
.LC_dccid {
- float: right;
margin: 0.2em 0 0 0;
padding: 0;
font-size: 90%;
@@ -6595,6 +6444,7 @@ fieldset > legend {
}
ol.LC_primary_menu {
+ float: right;
margin: 0;
padding: 0;
background-color: $pgbg_or_bgcolor;
@@ -6637,8 +6487,6 @@ ol.LC_primary_menu li:hover li, ol.LC_pr
font-size: 90%;
vertical-align: top;
float: none;
- border-left: 1px solid black;
- border-right: 1px solid black;
}
ol.LC_primary_menu li:hover li a, ol.LC_primary_menu li.hover li a {
@@ -6691,7 +6539,7 @@ ol.LC_docs_parameters li.LC_docs_paramet
}
ul#LC_secondary_menu {
- clear: right;
+ clear: both;
color: $fontmenu;
background: $tabbg;
list-style: none;
@@ -6699,53 +6547,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 {
@@ -7085,7 +6895,6 @@ ul#LC_toolbar {
list-style:none;
position:relative;
background-color:white;
- overflow: auto;
}
ul#LC_toolbar li {
@@ -7095,7 +6904,6 @@ ul#LC_toolbar li {
float: left;
display:inline;
vertical-align:middle;
- white-space: nowrap;
}
@@ -7192,27 +7000,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
}
@@ -7266,8 +7053,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'}
@@ -7310,11 +7097,6 @@ ADDMETA
.' '
.$inhibitprint
.$head_extra;
- if ($env{'browser.mobile'}) {
- $result .= '
-
- ';
- }
return $result.'';
}
@@ -7481,16 +7263,12 @@ $args - additional optional args support
skip_phases -> hash ref of
head -> skip the