--- loncom/interface/loncommon.pm 2023/11/28 17:53:15 1.1424
+++ loncom/interface/loncommon.pm 2024/03/23 22:05:16 1.1428
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# a pile of common routines
#
-# $Id: loncommon.pm,v 1.1424 2023/11/28 17:53:15 raeburn Exp $
+# $Id: loncommon.pm,v 1.1428 2024/03/23 22:05:16 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -1764,8 +1764,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 {
@@ -2439,10 +2437,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 +2514,6 @@ END
# do not obscure the Functions menu.
#
-=back
-
-=cut
-
-
sub iframe_wrapper_headjs {
return <<"ENDJS";