[LON-CAPA-cvs] cvs: loncom /homework daxesave.pm /interface loncommon.pm
raeburn
raeburn at source.lon-capa.org
Sun Nov 26 15:47:16 EST 2023
raeburn Sun Nov 26 20:47:16 2023 EDT
Modified files:
/loncom/homework daxesave.pm
/loncom/interface loncommon.pm
Log:
- Support checking of available editors when saving in Daxe, when current
role is a course role.
- Support localization.
Index: loncom/homework/daxesave.pm
diff -u loncom/homework/daxesave.pm:1.9 loncom/homework/daxesave.pm:1.10
--- loncom/homework/daxesave.pm:1.9 Sun Nov 19 21:28:17 2023
+++ loncom/homework/daxesave.pm Sun Nov 26 20:47:15 2023
@@ -1,7 +1,7 @@
# The LearningOnline Network
# Convert and save a problem from Daxe.
#
-# $Id: daxesave.pm,v 1.9 2023/11/19 21:28:17 raeburn Exp $
+# $Id: daxesave.pm,v 1.10 2023/11/26 20:47:15 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -38,13 +38,14 @@
use Apache::lonacc;
use Apache::loncommon;
use Apache::xml_to_loncapa;
+use Apache::lonlocal;
sub handler {
my $request = shift;
$request->content_type('text/plain');
- my %editors = &Apache::loncommon::permitted_editors();
+ my %editors = &Apache::loncommon::permitted_editors($request->uri);
unless ($editors{'daxe'}) {
$request->content_type('text/plain');
$request->print(&mt('Daxe editor not enabled for this Authoring Space'));
Index: loncom/interface/loncommon.pm
diff -u loncom/interface/loncommon.pm:1.1421 loncom/interface/loncommon.pm:1.1422
--- loncom/interface/loncommon.pm:1.1421 Sun Nov 19 21:28:17 2023
+++ loncom/interface/loncommon.pm Sun Nov 26 20:47:16 2023
@@ -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.1422 2023/11/26 20:47:16 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -6590,7 +6590,7 @@
=item * &permitted_editors()
-Input: None
+Input: $uri (optional)
Returns: %editors hash in which keys are editors
permitted in current Authoring Space.
@@ -6605,6 +6605,7 @@
=cut
sub permitted_editors {
+ my ($uri) = @_;
my ($is_author,$is_coauthor,$auname,$audom,%editors);
if ($env{'request.role'} =~ m{^au\./}) {
$is_author = 1;
@@ -6623,6 +6624,9 @@
($audom,$auname) = ($1,$2);
} elsif ($env{'request.uri'} =~ m{^/priv/($match_domain)/($match_username)/}) {
($audom,$auname) = ($1,$2);
+ } elsif (($uri eq '/daxesave') &&
+ ($env{'form.path'} =~ m{^/daxeopen/priv/($match_domain)/($match_username)/})) {
+ ($audom,$auname) = ($1,$2);
}
if (($audom ne '') && ($auname ne '')) {
if (($env{'user.domain'} eq $audom) &&
More information about the LON-CAPA-cvs
mailing list