--- loncom/interface/loncommon.pm 2006/07/07 16:48:21 1.423 +++ loncom/interface/loncommon.pm 2006/07/19 08:36:11 1.431 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # a pile of common routines # -# $Id: loncommon.pm,v 1.423 2006/07/07 16:48:21 albertel Exp $ +# $Id: loncommon.pm,v 1.431 2006/07/19 08:36:11 albertel Exp $ # # Copyright Michigan State University Board of Trustees # @@ -706,8 +706,68 @@ sub helpLatexCheatsheet { .''; } +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'; + } + 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); + } + + my $banner_link = "/adm/helpmenu?page=banner&topic=$topic&component_help=$component_help&faq=$faq&bug=$bug&origurl=$origurl&stamp=$timestamp&stayonpage=$stayOnPage"; + 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) = @_; + 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) = @_; + + my ($topic,$component_help,$faq,$bug,$stayOnPage,$width,$height); + $text = "" if (not defined $text); $stayOnPage = 0 if (not defined $stayOnPage); if ($env{'browser.interface'} eq 'textual' || @@ -718,25 +778,15 @@ sub help_open_menu { $height = 600 if (not defined $height); my $link=''; my $title = &mt('Get help'); - 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')"; + if ($stayOnPage) { + $link = "javascript:helpMenu('display')"; } else { - $link = "javascript:helpMenu('display')"; + $link = "javascript:helpMenu('open')"; } - 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 $helptopic=&general_help(); + my $banner_link = &update_help_link($topic,$component_help,$faq,$bug,$stayOnPage); + my $details_link = '/adm/help/'.$helptopic.'.hlp'; my $template; - if ($text ne "") { - $template .= - "". - "
$text"; - } my $nothing=&Apache::lonhtmlcommon::javascript_nothing(); my $helpicon=&lonhttpdurl("/adm/lonIcons/helpgateway.gif"); my $start_page = @@ -754,6 +804,7 @@ sub help_open_menu { - (Help Menu) +$banner_link + $text 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; } @@ -1918,12 +1956,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; @@ -3107,6 +3153,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 +3171,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;} @@ -3175,7 +3224,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 { @@ -3264,6 +3313,7 @@ td.LC_menubuttons_img { 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; @@ -3275,11 +3325,14 @@ table.LC_data_table tr th, table.LC_cale } table.LC_data_table tr td { background-color: $data_table_light; - padding: 1px; + padding: 2px; } table.LC_data_table tr.LC_even_row td { background-color: $data_table_dark; } +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; @@ -3495,11 +3548,9 @@ table.LC_pick_box td.LC_pick_box_title { font-weight: bold; text-align: right; width: 184px; -} -table.LC_pick_box td { padding: 8px; } -table.LC_pick_box td.LC_pick_box_seperator { +table.LC_pick_box td.LC_pick_box_separator { padding: 0px; height: 1px; background: black; @@ -3508,6 +3559,35 @@ 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; @@ -3516,6 +3596,9 @@ table.LC_notify_front_page { table.LC_notify_front_page td { padding: 8px; } +.LC_navbuttons { + margin: 2ex 0ex 2ex 0ex; +} .LC_topic_bar { font-family: $sans; font-weight: bold; @@ -3536,7 +3619,12 @@ table.LC_course_group_status { table.LC_status_selector td { vertical-align: top; text-align: center; - padding: 4px; + padding: 4px; +} +table.LC_descriptive_input td.LC_description { + vertical-align: top; + text-align: right; + font-weight: bold; } END @@ -3924,7 +4012,7 @@ sub simple_error_page { my ($add_class) = @_; $row_count++; my $css_class = ($row_count % 2)?'':'LC_even_row'; - my $css_class = (join(' ',$css_class,$add_class)); + $css_class = (join(' ',$css_class,$add_class)); return ''."\n";; }