--- loncom/interface/loncommon.pm 2006/07/03 13:39:16 1.418
+++ loncom/interface/loncommon.pm 2006/08/04 18:56:20 1.442
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# a pile of common routines
#
-# $Id: loncommon.pm,v 1.418 2006/07/03 13:39:16 albertel Exp $
+# $Id: loncommon.pm,v 1.442 2006/08/04 18:56:20 albertel Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -285,7 +285,7 @@ sub browser_and_searcher_javascript {
}
url += 'element=' + elementname + '';
var title = 'Browser';
- var options = 'scrollbars=1,resizable=1,menubar=1,location=1';
+ var options = 'scrollbars=1,resizable=1,menubar=0,toolbar=1,location=1';
options += ',width=700,height=600';
editbrowser = open(url,title,options,'1');
editbrowser.focus();
@@ -306,7 +306,7 @@ sub browser_and_searcher_javascript {
}
url += 'element=' + elementname + '';
var title = 'Search';
- var options = 'scrollbars=1,resizable=1,menubar=0';
+ var options = 'scrollbars=1,resizable=1,menubar=0,toolbar=1,location=1';
options += ',width=700,height=600';
editsearcher = open(url,title,options,'1');
editsearcher.focus();
@@ -672,14 +672,14 @@ sub help_open_topic {
{
$template .=
"
".
- "$text";
+ " | $text";
}
# Add the graphic
my $title = &mt('Online Help');
my $helpicon=&lonhttpdurl("/adm/help/gif/smallHelp.gif");
$template .= <<"ENDTEMPLATE";
-
+
ENDTEMPLATE
if ($text ne '') { $template.=' |
' };
return $template;
@@ -706,39 +706,95 @@ sub helpLatexCheatsheet {
.'';
}
-sub help_open_menu {
- my ($topic,$component_help,$faq,$bug,$stayOnPage,$width,$height,$text) = @_;
- $text = "" if (not defined $text);
- $stayOnPage = 0 if (not defined $stayOnPage);
- if ($env{'browser.interface'} eq 'textual' ||
- $env{'environment.remote'} eq 'off' ) {
- $stayOnPage=1;
+sub general_help {
+ my $helptopic='Student_Intro';
+ if ($env{'request.role'}=~/^(ca|au)/) {
+ $helptopic='Authoring_Intro';
+ } elsif ($env{'request.role'}=~/^cc/) {
+ $helptopic='Course_Coordination_Intro';
}
- $width = 620 if (not defined $width);
- $height = 600 if (not defined $height);
- my $link='';
- my $title = &mt('Get help');
+ return $helptopic;
+}
+
+sub update_help_link {
+ my ($topic,$component_help,$faq,$bug,$stayOnPage) = @_;
my $origurl = $ENV{'REQUEST_URI'};
$origurl=~s|^/~|/priv/|;
my $timestamp = time;
foreach my $datum (\$topic,\$component_help,\$faq,\$bug,\$origurl) {
$$datum = &escape($$datum);
}
- if (!$stayOnPage) {
- $link = "javascript:helpMenu('open')";
- } else {
- $link = "javascript:helpMenu('display')";
- }
+
my $banner_link = "/adm/helpmenu?page=banner&topic=$topic&component_help=$component_help&faq=$faq&bug=$bug&origurl=$origurl&stamp=$timestamp&stayonpage=$stayOnPage";
- my $details_link = "/adm/helpmenu?page=body&topic=$topic&component_help=$component_help&faq=$faq&bug=$bug&origurl=$origurl&stamp=$timestamp";
- my $template;
- if ($text ne "") {
- $template .=
- "".
- "$text";
+ my $output .= <<"ENDOUTPUT";
+
+ENDOUTPUT
+ return $output;
+}
+
+# now just updates the help link and generates a blue icon
+sub help_open_menu {
+ my ($topic,$component_help,$faq,$bug,$stayOnPage,$width,$height,$text)
+ = @_;
+
+ $stayOnPage = 0 if (not defined $stayOnPage);
+ if ($env{'browser.interface'} eq 'textual' ||
+ $env{'environment.remote'} eq 'off' ) {
+ $stayOnPage=1;
+ }
+ my $output;
+ if ($component_help) {
+ if (!$text) {
+ $output=&help_open_topic($component_help,undef,$stayOnPage,
+ $width,$height);
+ } else {
+ my $help_text;
+ $help_text=&unescape($topic);
+ $output=''.
+ &help_open_topic($component_help,$help_text,$stayOnPage,
+ $width,$height).' | ';
+ }
}
+ my $banner_link = &update_help_link($topic,$component_help,$faq,$bug,$stayOnPage);
+ return $output.$banner_link;
+}
+
+sub top_nav_help {
+ my ($text) = @_;
+
+ $text = &mt($text);
+
+ my $stayOnPage =
+ ($env{'browser.interface'} eq 'textual' ||
+ $env{'environment.remote'} eq 'off' );
+ my $link= ($stayOnPage) ? "javascript:helpMenu('display')"
+ : "javascript:helpMenu('open')";
+ my $banner_link = &update_help_link(undef,undef,undef,undef,$stayOnPage);
+
+ my $title = &mt('Get help');
+
+ return <<"END";
+$banner_link
+ $text
+END
+}
+
+sub help_menu_js {
+ my ($text) = @_;
+
+ my $stayOnPage =
+ ($env{'browser.interface'} eq 'textual' ||
+ $env{'environment.remote'} eq 'off' );
+
+ my $width = 620;
+ my $height = 600;
+ my $helptopic=&general_help();
+ my $details_link = '/adm/help/'.$helptopic.'.hlp';
my $nothing=&Apache::lonhtmlcommon::javascript_nothing();
- my $helpicon=&lonhttpdurl("/adm/lonIcons/helpgateway.gif");
my $start_page =
&Apache::loncommon::start_page('Help Menu', undef,
{'frameset' => 1,
@@ -750,10 +806,11 @@ sub help_open_menu {
&Apache::loncommon::end_page({'frameset' => 1,
'js_ready' => 1,});
- $template .= <<"ENDTEMPLATE";
-
-
+
ENDTEMPLATE
- if ($component_help) {
- if (!$text) {
- $template=&help_open_topic($component_help,undef,$stayOnPage,
- $width,$height).' '.$template;
- } else {
- my $help_text;
- $help_text=&unescape($topic);
- $template=''.
- &help_open_topic($component_help,$help_text,$stayOnPage,
- $width,$height).' | '.$template.
- ' | ';
- }
- }
- if ($text ne '') { $template.=' |
' };
return $template;
}
@@ -830,14 +872,14 @@ sub help_open_bug {
{
$template .=
"".
- "$text";
+ " | $text";
}
# Add the graphic
my $title = &mt('Report a Bug');
my $bugicon=&lonhttpdurl("/adm/lonMisc/smallBug.gif");
$template .= <<"ENDTEMPLATE";
-
+
ENDTEMPLATE
if ($text ne '') { $template.=' |
' };
return $template;
@@ -875,14 +917,14 @@ sub help_open_faq {
{
$template .=
"".
- "$text";
+ " | $text";
}
# Add the graphic
my $title = &mt('View the FAQ');
my $faqicon=&lonhttpdurl("/adm/lonMisc/smallFAQ.gif");
$template .= <<"ENDTEMPLATE";
-
+
ENDTEMPLATE
if ($text ne '') { $template.=' |
' };
return $template;
@@ -1918,12 +1960,20 @@ sub get_related_words {
return ();
}
my @Words=();
+ my $count=0;
if (exists($thesaurus_db{$keyword})) {
# The first element is the number of times
# the word appears. We do not need it now.
- (undef,@Words) = (split(/:/,$thesaurus_db{$keyword}));
- for (my $i=0;$i<=$#Words;$i++) {
- ($Words[$i],undef)= split(/\,/,$Words[$i]);
+ my (undef,@RelatedWords) = (split(/:/,$thesaurus_db{$keyword}));
+ my (undef,$mostfrequentcount)=split(/\,/,$RelatedWords[0]);
+ my $threshold=$mostfrequentcount/10;
+ foreach my $possibleword (@RelatedWords) {
+ my ($word,$wordcount)=split(/\,/,$possibleword);
+ if ($wordcount>$threshold) {
+ push(@Words,$word);
+ $count++;
+ if ($count>10) { last; }
+ }
}
}
untie %thesaurus_db;
@@ -2002,6 +2052,9 @@ sub nickname {
sub getnames {
my ($uname,$udom)=@_;
+ if ($udom eq 'public' && $uname eq 'public') {
+ return ('lastname' => &mt('Public'));
+ }
my $id=$uname.':'.$udom;
my ($names,$cached)=&Apache::lonnet::is_cached_new('namescache',$id);
if ($cached) {
@@ -2039,9 +2092,9 @@ sub screenname {
sub messagewrapper {
my ($link,$username,$domain,$subject,$text)=@_;
return
- ''.$link.'';
}
# --------------------------------------------------------------- Notes Wrapper
@@ -2822,7 +2875,7 @@ sub bodytag {
'alink' => &designparm($function.'.alink',$domain),
'vlink' => &designparm($function.'.vlink',$domain),
'link' => &designparm($function.'.link',$domain),);
- @$addentries{keys(%design)} = @design{keys(%design)};
+ @design{keys(%$addentries)} = @$addentries{keys(%$addentries)};
# role and realm
my ($role,$realm) = split(/\./,$env{'request.role'},2);
@@ -2839,6 +2892,7 @@ sub bodytag {
} else {
$role = &Apache::lonnet::plaintext($role);
}
+
if (!$realm) { $realm=' '; }
# Set messages
my $messages=&domainlogo($domain);
@@ -2846,7 +2900,7 @@ sub bodytag {
my $lonhttpdPort=$Apache::lonnet::perlvar{'lonhttpdPort'};
if (!defined($lonhttpdPort)) { $lonhttpdPort='8080'; }
- my $extra_body_attr = &make_attr_string($forcereg,$addentries);
+ my $extra_body_attr = &make_attr_string($forcereg,\%design);
# construct main body tag
my $bodytag = "".
@@ -2867,6 +2921,11 @@ sub bodytag {
}
my $name = &plainname($env{'user.name'},$env{'user.domain'});
+ if ($env{'user.name'} eq 'public' && $env{'user.domain'} eq 'public') {
+ undef($role);
+ } else {
+ $name = &aboutmewrapper($name,$env{'user.name'},$env{'user.domain'});
+ }
my $roleinfo=(<
@@ -3107,6 +3166,7 @@ sub standard_css {
my $data_table_head = $tabbg;
my $data_table_light = '#EEEEEE';
my $data_table_dark = '#DDD';
+ my $data_table_darker = '#CCC';
my $data_table_highlight = '#FFFF00';
my $mail_new = '#FFBB77';
my $mail_new_hover = '#DD9955';
@@ -3124,7 +3184,9 @@ sub standard_css {
h1, h2, h3, th { font-family: $sans }
a:focus { color: red; background: yellow }
table.thinborder { border-collapse: collapse; }
-table.thinborder tr th, table.thinborder tr td { border-style: solid; border-width: 1px}
+table.thinborder tr th { border-style: solid; border-width: 1px; background: $tabbg;}
+table.thinborder tr td { border-style: solid; border-width: 1px}
+
form, .inline { display: inline; }
.center { text-align: center; }
.LC_filename {font-family: $mono;}
@@ -3138,6 +3200,9 @@ form, .inline { display: inline; }
.LC_success {
color: green;
}
+.LC_icon {
+ border: 0px;
+}
table#LC_top_nav, table#LC_menubuttons {
width: 100%;
@@ -3175,7 +3240,7 @@ table#LC_title_bar td {
table#LC_title_bar td.LC_title_bar_who {
background: $tabbg;
color: $font;
- font: medium $sans;
+ font: small $sans;
text-align: right;
}
span.LC_title_bar_title {
@@ -3213,14 +3278,22 @@ table#LC_top_nav td a, div#LC_top_nav a
}
table#LC_top_nav td.LC_top_nav_logo {
background: $tabbg;
- text-align: right;
+ text-align: left;
white-space: nowrap;
- font-weight: bold;
+ width: 31px;
}
table#LC_top_nav td.LC_top_nav_logo img {
- margin-left: 0.2em;
+ border: 0px;
vertical-align: bottom;
}
+table#LC_top_nav td.LC_top_nav_exit,
+table#LC_top_nav td.LC_top_nav_help {
+ width: 2.0em;
+}
+table#LC_top_nav td.LC_top_nav_login {
+ width: 4.0em;
+ text-align: center;
+}
table.LC_breadcrumbs td, table.LC_docs_path td {
background: $tabbg;
color: $font;
@@ -3261,22 +3334,42 @@ td.LC_menubuttons_img {
font-weight: bold;
}
+table.LC_aboutme_port {
+ border: 0px;
+ border-collapse: collapse;
+ border-spacing: 0px;
+}
table.LC_data_table, table.LC_mail_list {
border: 1px solid #000000;
border-collapse: separate;
+ border-spacing: 1px;
+}
+.LC_data_table_dense {
+ font-size: small;
}
table.LC_data_table tr th, table.LC_calendar tr th, table.LC_mail_list tr th {
font-weight: bold;
background-color: $data_table_head;
+ font-size: smaller;
}
-table.LC_data_table tr td {
+table.LC_data_table tr td,
+table.LC_aboutme_port tr td {
background-color: $data_table_light;
+ padding: 2px;
}
-table.LC_data_table tr.LC_even_row td {
+table.LC_data_table tr.LC_even_row td,
+table.LC_aboutme_port tr.LC_even_row td {
background-color: $data_table_dark;
}
-table.LC_data_table tr.LC_empty td {
+table.LC_data_table tr.LC_data_table_highlight td {
+ background-color: $data_table_darker;
+}
+table.LC_data_table tr.LC_empty_row td {
background-color: #FFFFFF;
+ font-weight: bold;
+ font-style: italic;
+ text-align: center;
+ padding: 8px;
}
table.LC_calendar {
@@ -3474,6 +3567,97 @@ table#LC_helpmenu_links a:hover {
background: #CCCCFF;
}
+table.LC_pick_box {
+ width: 100%;
+ border-collapse: separate;
+ background: white;
+ border: 1px solid black;
+ border-spacing: 1px;
+}
+table.LC_pick_box td.LC_pick_box_title {
+ background: $tabbg;
+ font-weight: bold;
+ text-align: right;
+ width: 184px;
+ padding: 8px;
+}
+table.LC_pick_box td.LC_pick_box_separator {
+ padding: 0px;
+ height: 1px;
+ background: black;
+}
+table.LC_pick_box td.LC_pick_box_submit {
+ text-align: right;
+}
+
+table.LC_group_priv_box {
+ background: white;
+ border: 1px solid black;
+ border-spacing: 1px;
+}
+table.LC_group_priv_box td.LC_pick_box_title {
+ background: $tabbg;
+ font-weight: bold;
+ text-align: right;
+ width: 184px;
+}
+table.LC_group_priv_box td.LC_groups_fixed {
+ background: $data_table_light;
+ text-align: center;
+}
+table.LC_group_priv_box td.LC_groups_optional {
+ background: $data_table_dark;
+ text-align: center;
+}
+table.LC_group_priv_box td.LC_groups_functionality {
+ background: $data_table_darker;
+ text-align: center;
+ font-weight: bold;
+}
+table.LC_group_priv td {
+ text-align: left;
+ padding: 0px;
+}
+
+table.LC_notify_front_page {
+ background: white;
+ border: 1px solid black;
+ padding: 8px;
+}
+table.LC_notify_front_page td {
+ padding: 8px;
+}
+.LC_navbuttons {
+ margin: 2ex 0ex 2ex 0ex;
+}
+.LC_topic_bar {
+ font-family: $sans;
+ font-weight: bold;
+ width: 100%;
+ background: $tabbg;
+ vertical-align: middle;
+ margin: 2ex 0ex 2ex 0ex;
+}
+.LC_topic_bar span {
+ vertical-align: middle;
+}
+.LC_topic_bar img {
+ vertical-align: bottom;
+}
+table.LC_course_group_status {
+ margin: 20px;
+}
+table.LC_status_selector td {
+ vertical-align: top;
+ text-align: center;
+ padding: 4px;
+}
+table.LC_descriptive_input td.LC_description {
+ vertical-align: top;
+ text-align: right;
+ font-weight: bold;
+}
+
END
}
@@ -3527,6 +3711,11 @@ sub headtag {
if ($args->{'force_register'}) {
$result .= &Apache::lonmenu::registerurl(1);
}
+ if (!$args->{'no_nav_bar'}
+ && !$args->{'only_body'}
+ && !$args->{'frameset'}) {
+ $result .= &help_menu_js();
+ }
if (ref($args->{'redirect'})) {
my ($time,$url,$inhibit_continue) = @{$args->{'redirect'}};
@@ -3696,7 +3885,7 @@ sub start_page {
#&Apache::lonnet::logthis("start_page ".join(':',caller(0)));
my %head_args;
foreach my $arg ('redirect','force_register','domain','function',
- 'bgcolor') {
+ 'bgcolor','frameset','no_nav_bar','only_body') {
if (defined($args->{$arg})) {
$head_args{$arg} = $args->{$arg};
}
@@ -3844,8 +4033,10 @@ sub simple_error_page {
{
my $row_count;
sub start_data_table {
+ my ($add_class) = @_;
+ my $css_class = (join(' ','LC_data_table',$add_class));
undef($row_count);
- return ''."\n";
+ return ''."\n";
}
sub end_data_table {
@@ -3854,14 +4045,26 @@ sub simple_error_page {
}
sub start_data_table_row {
+ my ($add_class) = @_;
$row_count++;
- return ''."\n";;
+ my $css_class = ($row_count % 2)?'':'LC_even_row';
+ $css_class = (join(' ',$css_class,$add_class));
+ return '
'."\n";;
}
sub end_data_table_row {
return '
'."\n";;
}
+ sub start_data_table_empty_row {
+ $row_count++;
+ return ''."\n";;
+ }
+
+ sub end_data_table_empty_row {
+ return '
'."\n";;
+ }
+
sub start_data_table_header_row {
return '