[LON-CAPA-cvs] cvs: loncom /homework lonhomework.pm structuretags.pm /xml scripttag.pm
raeburn
raeburn at source.lon-capa.org
Tue Nov 7 07:26:01 EST 2023
raeburn Tue Nov 7 12:26:01 2023 EDT
Modified files:
/loncom/homework lonhomework.pm structuretags.pm
/loncom/xml scripttag.pm
Log:
- Support domain default or user override for activation or deactivation
of CodeMirror.
Index: loncom/homework/lonhomework.pm
diff -u loncom/homework/lonhomework.pm:1.378 loncom/homework/lonhomework.pm:1.379
--- loncom/homework/lonhomework.pm:1.378 Sun Jul 23 16:11:52 2023
+++ loncom/homework/lonhomework.pm Tue Nov 7 12:26:00 2023
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# The LON-CAPA Homework handler
#
-# $Id: lonhomework.pm,v 1.378 2023/07/23 16:11:52 raeburn Exp $
+# $Id: lonhomework.pm,v 1.379 2023/11/07 12:26:00 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -1227,7 +1227,8 @@
$result .= '<ol class="LC_primary_menu" style="display:inline-block;font-size:90%;vertical-align:middle;">';
- unless ($env{'environment.nocodemirror'}) {
+ my $nocodemirror = &Apache::loncommon::nocodemirror();
+ unless ($nocodemirror) {
# dropdown menus
$result .= Apache::lonmenu::create_submenu("#", "",
&mt("Problem Templates"), template_dropdown_datastructure());
@@ -1259,7 +1260,7 @@
'</textarea> <div id="LC_aftertextarea"> </div> </form>';
my $resource = $env{'request.ambiguous'};
- unless($env{'environment.nocodemirror'}){
+ unless ($nocodemirror) {
$result .= '<link rel="stylesheet" href="/adm/codemirror/codemirror-combined-xml.css">
<script src="/adm/codemirror/codemirror-compressed-xml.js"></script>
<script>
Index: loncom/homework/structuretags.pm
diff -u loncom/homework/structuretags.pm:1.578 loncom/homework/structuretags.pm:1.579
--- loncom/homework/structuretags.pm:1.578 Sun Sep 10 18:12:53 2023
+++ loncom/homework/structuretags.pm Tue Nov 7 12:26:00 2023
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# definition of tags that give a structure to a document
#
-# $Id: structuretags.pm,v 1.578 2023/09/10 18:12:53 raeburn Exp $
+# $Id: structuretags.pm,v 1.579 2023/11/07 12:26:00 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -445,7 +445,7 @@
if (&Apache::lonhtmlcommon::htmlareabrowser()) {
my %textarea_args;
if (($env{'request.state'} ne 'construct') ||
- ($env{'environment.nocodemirror'})) {
+ (&Apache::loncommon::nocodemirror())) {
%textarea_args = (
dragmath => 'math',
);
@@ -851,7 +851,7 @@
if ($mode eq 'editxml') {
$result.=&problem_edit_action_button('subedit','edit','e','Edit',1);
$result.=&problem_edit_action_button('subundo','undoxml','u','Undo',1);
- if ($env{'environment.nocodemirror'}) {
+ if (&Apache::loncommon::nocodemirror()) {
$result.=&Apache::lonhtmlcommon::dragmath_button("LC_editxmltext",1);
}
} else {
@@ -3375,7 +3375,7 @@
.&Apache::edit::deletelist($target,$token)
.'</span></td>'
.'<td><span id="math_'.$areaid.'">';
- if ($env{'environment.nocodemirror'}) {
+ if (&Apache::loncommon::nocodemirror()) {
$result.=&Apache::lonhtmlcommon::dragmath_button($areaid,1);
} else {
$result.=' ';
Index: loncom/xml/scripttag.pm
diff -u loncom/xml/scripttag.pm:1.175 loncom/xml/scripttag.pm:1.176
--- loncom/xml/scripttag.pm:1.175 Fri Jul 1 19:59:25 2016
+++ loncom/xml/scripttag.pm Tue Nov 7 12:26:01 2023
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# <script> definiton
#
-# $Id: scripttag.pm,v 1.175 2016/07/01 19:59:25 raeburn Exp $
+# $Id: scripttag.pm,v 1.176 2023/11/07 12:26:01 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -30,6 +30,7 @@
use strict;
use Apache::lonnet;
+use Apache::loncommon;
use Apache::lonlocal;
use Apache::lonxml();
use Apache::londefdef();
@@ -123,14 +124,15 @@
my $depth = $Apache::lonxml::curdepth;
$result.='<span id="LC_edit_problem_codemirror">';
- unless ($env{'environment.nocodemirror'}) {
+ my $nocodemirror = &Apache::loncommon::nocodemirror();
+ unless ($nocodemirror) {
# only show button if codemirror activated
$result.='<input type="button" id="fitsize'.$depth.'" value="'.&mt("Dynamic size").
'" onclick="autosize(\''.$depth.'\')" />';
}
$result.=&Apache::edit::editfield($token->[1],$bodytext,'',80,4).'</span>';
- unless ($env{'environment.nocodemirror'}) {
+ unless ($nocodemirror) {
$result.='<script type="text/javascript">
var cm'.$depth.' = CodeMirror.fromTextArea(document.getElementById("homework_edit_'.$depth.'"),
{
More information about the LON-CAPA-cvs
mailing list