--- loncom/interface/loncommon.pm 2008/12/11 18:46:14 1.692.2.3
+++ loncom/interface/loncommon.pm 2009/08/14 03:50:09 1.692.4.5
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# a pile of common routines
#
-# $Id: loncommon.pm,v 1.692.2.3 2008/12/11 18:46:14 raeburn Exp $
+# $Id: loncommon.pm,v 1.692.4.5 2009/08/14 03:50:09 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -406,9 +406,10 @@ sub studentbrowser_javascript {
|| ($env{'request.role'}=~/^(au|dc|su)/)
) { return ''; }
return (<<'ENDSTDBRW');
-
ENDSTDBRW
}
sub selectstudent_link {
- my ($form,$unameele,$udomele)=@_;
+ my ($form,$unameele,$udomele,$courseadvonly)=@_;
+ my $callargs = "'".$form."','".$unameele."','".$udomele."'";
if ($env{'request.course.id'}) {
if (!&Apache::lonnet::allowed('srm',$env{'request.course.id'})
&& !&Apache::lonnet::allowed('srm',$env{'request.course.id'}.
'/'.$env{'request.course.sec'})) {
return '';
}
- return "".&mt('Select User')."";
+ if ($courseadvonly) {
+ $callargs .= ",'',1,1";
+ }
+ return ''.
+ ''.
+ &mt('Select User').'';
}
if ($env{'request.role'}=~/^(au|dc|su)/) {
- return "".&mt('Select User')."";
+ $callargs .= ",1";
+ return ''.
+ ''.
+ &mt('Select User').'';
}
return '';
}
@@ -453,6 +463,7 @@ sub selectstudent_link {
sub authorbrowser_javascript {
return <<"ENDAUTHORBRW";
ENDAUTHORBRW
}
@@ -473,7 +484,8 @@ sub coursebrowser_javascript {
my ($domainfilter,$sec_element,$formname)=@_;
my $crs_or_grp_alert = &mt('Please select the type of LON-CAPA entity - Course or Group - for which you wish to add/modify a user role');
my $output = '
-';
return $output;
}
@@ -602,8 +615,13 @@ function setSect(sectionlist) {
sub selectcourse_link {
my ($form,$unameele,$udomele,$desc,$extra_element,$multflag,$selecttype)=@_;
- return "".&mt('Select Course')."";
+ return ''
+ ."".&mt('Select Course').''
+ .'';
}
sub selectauthor_link {
@@ -710,6 +728,21 @@ sub select_datelocale {
return $output;
}
+sub select_language {
+ my ($name,$selected,$includeempty) = @_;
+ my %langchoices;
+ if ($includeempty) {
+ %langchoices = ('' => 'No language preference');
+ }
+ foreach my $id (&languageids()) {
+ my $code = &supportedlanguagecode($id);
+ if ($code) {
+ $langchoices{$code} = &plainlanguagedescription($id);
+ }
+ }
+ return &select_form($selected,$name,%langchoices);
+}
+
=pod
=item * &linked_select_forms(...)
@@ -796,7 +829,8 @@ sub linked_select_forms {
my $first = "document.$formname.$firstselectname";
# output the javascript to do the changing
my $result = '';
- $result.="
END
# output the initial values for the selection lists
@@ -932,10 +967,12 @@ sub help_open_topic {
# Add the graphic
my $title = &mt('Online Help');
my $helpicon=&lonhttpdurl("/adm/help/help.png");
- $template .= <<"ENDTEMPLATE";
-
-ENDTEMPLATE
- if ($text ne '') { $template.='' };
+ $template .= ''.
+ '';
+ if ($text ne '') {
+ $template.='';
+ }
return $template;
}
@@ -943,24 +980,30 @@ ENDTEMPLATE
# This is a quicky function for Latex cheatsheet editing, since it
# appears in at least four places
sub helpLatexCheatsheet {
- my $other = shift;
+ my ($topic,$text,$not_author) = @_;
+ my $out;
my $addOther = '';
- if ($other) {
- $addOther = Apache::loncommon::help_open_topic($other, shift,
+ if ($topic) {
+ $addOther = &Apache::loncommon::help_open_topic($topic,$text,
undef, undef, 600) .
'
';
}
- return ''.
- $addOther .
- &Apache::loncommon::help_open_topic("Greek_Symbols",&mt('Greek Symbols'),
- undef,undef,600)
- .' | '.
- &Apache::loncommon::help_open_topic("Other_Symbols",&mt('Other Symbols'),
- undef,undef,600)
- .' | '.
- &Apache::loncommon::help_open_topic("Authoring_Output_Tags",&mt('Output Tags'),
- undef,undef,600)
- .' | ';
+ $out = ''.
+ $addOther .
+ &Apache::loncommon::help_open_topic("Greek_Symbols",&mt('Greek Symbols'),
+ undef,undef,600).
+ ' | '.
+ &Apache::loncommon::help_open_topic("Other_Symbols",&mt('Other Symbols'),
+ undef,undef,600).
+ ' | ';
+ unless ($not_author) {
+ $out .= ''.
+ &Apache::loncommon::help_open_topic("Authoring_Output_Tags",&mt('Output Tags'),
+ undef,undef,600).
+ ' | ';
+ }
+ $out .= ' ';
+ return $out;
}
sub general_help {
@@ -987,7 +1030,9 @@ sub update_help_link {
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;
@@ -1359,6 +1404,7 @@ sub resize_textarea_js {
my $geometry = &viewport_geometry_js();
return <<"RESIZE";
RESIZE
@@ -1629,7 +1676,7 @@ sub multiple_select_form {
$size = scalar(keys(%$hash));
}
}
- $output.="\n |