--- loncom/interface/loncommon.pm 2023/11/19 21:28:17 1.1421
+++ loncom/interface/loncommon.pm 2025/02/03 22:52:36 1.1450
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# a pile of common routines
#
-# $Id: loncommon.pm,v 1.1421 2023/11/19 21:28:17 raeburn Exp $
+# $Id: loncommon.pm,v 1.1450 2025/02/03 22:52:36 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -1174,7 +1174,8 @@ sub linked_select_forms {
$menuorder,
$onchangefirst,
$onchangesecond,
- $suffix
+ $suffix,
+ $haslabel
) = @_;
my $second = "document.$formname.$secondselectname";
my $first = "document.$formname.$firstselectname";
@@ -1240,6 +1241,9 @@ END
$result.=">".&mt($hashref->{$value}->{'text'})."\n";
}
$result .= "\n";
+ if ($haslabel) {
+ $result .= '';
+ }
my %select2;
if (ref($hashref->{$firstdefault}) eq 'HASH') {
if (ref($hashref->{$firstdefault}->{'select2'}) eq 'HASH') {
@@ -1247,6 +1251,9 @@ END
}
}
$result .= $middletext;
+ if ($middletext ne '') {
+ $result .= '';
+ }
# return $debug;
return $result;
} # end of sub linked_select_forms {
@@ -1372,7 +1382,7 @@ sub helpLatexCheatsheet {
$out .= ''
.&help_open_topic('Authoring_Output_Tags',&mt('Output Tags'),$stayOnPage,undef,600)
.''
- .&help_open_topic('Authoring_Multilingual_Problems',&mt('How to create problems in different languages'),$stayOnPage,undef,600)
+ .&help_open_topic('Authoring_Multilingual_Problems',&mt('Languages'),$stayOnPage,undef,600)
.'';
}
$out .= ''; # End cheatsheet
@@ -1764,8 +1774,6 @@ the id of the element to resize, second
surrounds everything that comes after the textarea, this routine needs
to be attached to the
for the onload and onresize events.
-=back
-
=cut
sub resize_textarea_js {
@@ -2302,7 +2310,7 @@ sub import_crsauthor_form {
dire => 'Directory',
se => 'Select',
);
- $output = $lt{'dire'}.': '.
+ $output = ' '."\n".
'';
return ($numdirs,$output);
}
@@ -2439,10 +2447,76 @@ sub show_crsfiles_js {
END
}
+sub crsauthor_rights {
+ my ($rightsfile,$path,$docroot,$cnum,$cdom) = @_;
+ my $sourcerights = "$path/$rightsfile";
+ my $now = time;
+ if (!-e $sourcerights) {
+ my $cid = $cdom.'_'.$cnum;
+ if (!-e "$docroot/priv/$cdom") {
+ mkdir("$docroot/priv/$cdom",0755);
+ }
+ if (!-e "$docroot/priv/$cdom/$cnum") {
+ mkdir("$docroot/priv/$cdom/$cnum",0755);
+ }
+ if (open(my $fh,">$sourcerights")) {
+ print $fh <
+
+END
+ close($fh);
+ }
+ }
+ if (!-e "$sourcerights.meta") {
+ if (open(my $fh,">$sourcerights.meta")) {
+ my $author=$env{'environment.firstname'}.' '.
+ $env{'environment.middlename'}.' '.
+ $env{'environment.lastname'}.' '.
+ $env{'environment.generation'};
+ $author =~ s/\s+$//;
+ print $fh <<"END";
+
+
+$author
+$cnum:$cdom
+private
+$now
+
+
+$cdom
+0
+
+notset
+$now
+0
+rights
+$env{'user.name'}:$env{'user.domain'}
+
+
+
+$cnum:$cdom
+deny:::course,allow:$cid::course
+
+
+
+Course Authoring Rights
+END
+ close($fh);
+ }
+ }
+ return;
+}
+
=pod
=item * &iframe_wrapper_headjs()
+emits javascript containing two global vars to facilitate handling of resizing
+by code in iframe_wrapper_resizejs() used when an iframe is present in a page
+with standard LON-CAPA menus.
+
+=cut
+
#
# Where iframe is in use, if window.onload() executes before the custom resize function
# has been defined (jQuery), two global javascript vars (LCnotready and LCresizedef)
@@ -2450,11 +2524,6 @@ END
# do not obscure the Functions menu.
#
-=back
-
-=cut
-
-
sub iframe_wrapper_headjs {
return <<"ENDJS";