[LON-CAPA-cvs] cvs: loncom /interface lonpreferences.pm
raeburn
raeburn at source.lon-capa.org
Sat Mar 2 13:47:15 EST 2024
raeburn Sat Mar 2 18:47:15 2024 EDT
Modified files:
/loncom/interface lonpreferences.pm
Log:
- Move code to check LON-CAPA version on user's homeserver to a subroutine
to facilitate reuse.
Index: loncom/interface/lonpreferences.pm
diff -u loncom/interface/lonpreferences.pm:1.243 loncom/interface/lonpreferences.pm:1.244
--- loncom/interface/lonpreferences.pm:1.243 Sat Nov 11 03:13:07 2023
+++ loncom/interface/lonpreferences.pm Sat Mar 2 18:47:15 2024
@@ -1,7 +1,7 @@
# The LearningOnline Network
# Preferences
#
-# $Id: lonpreferences.pm,v 1.243 2023/11/11 03:13:07 raeburn Exp $
+# $Id: lonpreferences.pm,v 1.244 2024/03/02 18:47:15 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -2080,12 +2080,7 @@
if (keys(%author_roles) > 0) {
my ($showdomdefs,$js,$args, at items);
my $returnurl = &HTML::Entities::encode($env{'form.returnurl'},'"<>&\'');
- my $reqdmajor = 2;
- my $reqdminor = 12;
- my $loncaparev = &Apache::lonnet::get_server_loncaparev($env{'user.domain'},$env{'user.home'});
- my ($major,$minor) = ($loncaparev =~ /^\'?(\d+)\.(\d+)\.[\w.\-]+\'?$/);
- unless (($major eq '' && $minor eq '') ||
- ($reqdmajor > $major) || (($reqdmajor == $major) && ($reqdminor > $minor))) {
+ if (&expanded_authoring_settings()) {
@items = ('nocodemirror','copyright','sourceavail');
$showdomdefs = 1;
$js = &toggle_options_js();
@@ -2197,12 +2192,7 @@
my %author_roles = &Apache::lonnet::get_my_roles($user,$domain,'userroles','',['au','ca','aa']);
if (keys(%author_roles) > 0) {
my $message;
- my $reqdmajor = 2;
- my $reqdminor = 12;
- my $loncaparev = &Apache::lonnet::get_server_loncaparev($env{'user.domain'},$env{'user.home'});
- my ($major,$minor) = ($loncaparev =~ /^\'?(\d+)\.(\d+)\.[\w.\-]+\'?$/);
- if (($major eq '' && $minor eq '') ||
- ($reqdmajor > $major) || (($reqdmajor == $major) && ($reqdminor > $minor))) {
+ if (!&expanded_authoring_settings()) {
my %ausettings=('environment.nocodemirror' => '');
if ($env{'form.cmoff'}) { $ausettings{'environment.nocodemirror'}='yes'; }
&Apache::lonnet::put('environment',\%ausettings);
@@ -2345,6 +2335,18 @@
);
}
+sub expanded_authoring_settings {
+ my $reqdmajor = 2;
+ my $reqdminor = 12;
+ my $loncaparev = &Apache::lonnet::get_server_loncaparev($env{'user.domain'},$env{'user.home'});
+ my ($major,$minor) = ($loncaparev =~ /^\'?(\d+)\.(\d+)\.[\w.\-]+\'?$/);
+ unless (($major eq '' && $minor eq '') ||
+ ($reqdmajor > $major) || (($reqdmajor == $major) && ($reqdminor > $minor))) {
+ return 1;
+ }
+ return;
+}
+
sub lockednameschanger {
my $r = shift;
my %userenv = &Apache::lonnet::get('environment',['lockedname']);
More information about the LON-CAPA-cvs
mailing list