[LON-CAPA-cvs] cvs: loncom /homework structuretags.pm /xml londefdef.pm lonxml.pm
raeburn
raeburn at source.lon-capa.org
Mon Nov 27 23:48:15 EST 2023
raeburn Tue Nov 28 04:48:15 2023 EDT
Modified files:
/loncom/xml londefdef.pm lonxml.pm
/loncom/homework structuretags.pm
Log:
- If Daxe available in current Authoring Space, include "Edit with Daxe"
buttons to switch to Daxe when editing an assessment item with colorful
editor or with XML (text) editor or an html file with standard editor.
Index: loncom/xml/londefdef.pm
diff -u loncom/xml/londefdef.pm:1.473 loncom/xml/londefdef.pm:1.474
--- loncom/xml/londefdef.pm:1.473 Wed Sep 27 14:52:27 2023
+++ loncom/xml/londefdef.pm Tue Nov 28 04:48:14 2023
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Tags Default Definition Module
#
-# $Id: londefdef.pm,v 1.473 2023/09/27 14:52:27 raeburn Exp $
+# $Id: londefdef.pm,v 1.474 2023/11/28 04:48:14 raeburn Exp $
#
#
# Copyright Michigan State University Board of Trustees
@@ -658,9 +658,9 @@
sub edit_controls {
my ($nochgview) = @_;
- my $result .= '
+ my $result = &Apache::lonxml::seteditor_javascript().'
<form method="post" action="">
-<div class="LC_edit_problem_header">';
+<div class="LC_edit_problem_header">'."\n";
unless ($nochgview) {
$result .= '
<div class="LC_edit_problem_header_row1">'.
@@ -669,12 +669,20 @@
</div>';
}
$result .= '
-<div><input type="submit" name="editmode" accesskey="e" value="'.&mt('Edit').'" />';
+<div>
+<input type="hidden" name="editmode" value="" />
+<input type="button" name="editordefault" accesskey="e" value="'.&mt('Edit').
+'" onclick="seteditmode(this.form,'."'edit'".');" />'."\n";
if ($env{'browser.type'} ne 'explorer' || $env{'browser.version'} > 9) {
my $uri = $env{'request.uri'};
- my $daxeurl = '/daxepage'.$uri;
- $result .= '<input type="button" value="'.&mt('Edit with Daxe').'" '.
- 'onclick="window.open(\''.$daxeurl.'\',\'_blank\');" />';
+ if ($uri =~ /\.(xml|html|htm|xhtml|xhtm)$/) {
+ my %editors = &Apache::loncommon::permitted_editors();
+ if ($editors{'daxe'}) {
+ my $daxeurl = '/daxepage'.$uri;
+ $result .= '<input type="button" name="editordaxe" value="'.&mt('Edit with Daxe').
+ '" onclick="seteditmode(this.form,'."'daxe'".');" />'."\n";
+ }
+ }
}
if (($env{'request.course.id'}) && ($env{'form.forceedit'})) {
my $url=&Apache::lonnet::hreflocation('',$env{'request.filename'});
Index: loncom/xml/lonxml.pm
diff -u loncom/xml/lonxml.pm:1.566 loncom/xml/lonxml.pm:1.567
--- loncom/xml/lonxml.pm:1.566 Tue Nov 28 02:39:01 2023
+++ loncom/xml/lonxml.pm Tue Nov 28 04:48:14 2023
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# XML Parser Module
#
-# $Id: lonxml.pm,v 1.566 2023/11/28 02:39:01 raeburn Exp $
+# $Id: lonxml.pm,v 1.567 2023/11/28 04:48:14 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -1613,8 +1613,9 @@
my %lt=&Apache::lonlocal::texthash('st' => 'Save and Edit',
'vi' => 'Save and View',
'dv' => 'Discard Edits and View',
- 'un' => 'undo',
- 'ed' => 'Edit');
+ 'un' => 'Undo',
+ 'ed' => 'Edit',
+ 'ew' => 'Edit with Daxe');
my $spelllink = &Apache::lonhtmlcommon::spelllink('xmledit','filecont');
my $textarea_events = &Apache::edit::element_change_detection();
my $form_events = &Apache::edit::form_change_detection();
@@ -1630,8 +1631,8 @@
}
}
}
- my ($undo,%onclick);
- foreach my $item ('discard','undo') {
+ my ($undo,$daxebutton,%onclick);
+ foreach my $item ('discard','undo','daxe') {
$onclick{$item} = 'onclick="still_ask=true;setmode(this.form,'."'$item'".')"';
}
foreach my $item ('saveedit','saveview') {
@@ -1642,6 +1643,13 @@
$onclick{'undo'}.' />'."\n";
}
$initialize .= &setmode_javascript();
+ if ($filetype eq 'html') {
+ my %editors = &Apache::loncommon::permitted_editors();
+ if ($editors{'daxe'}) {
+ $daxebutton = '<input type="button" name="editwithdaxe" accesskey="w" value="'.$lt{'ew'}.'" '.
+ $onclick{'daxe'}.' />'."\n";
+ }
+ }
my $editfooter=(<<ENDFOOTER);
$initialize
<a name="editsection" />
@@ -1660,7 +1668,7 @@
</div>
<div>
<input type="button" name="discardview" accesskey="d" value="$lt{'dv'}" $onclick{'discard'} />
- $undo $htmlerror $deps_button $dragmath_button
+ $undo $htmlerror $deps_button $daxebutton $dragmath_button
</div>
</div>
<textarea $textarea_events style="width:100%" cols="80" rows="44" name="filecont" id="filecont" $textareaclass>$filecontents</textarea><br />$spelllink
Index: loncom/homework/structuretags.pm
diff -u loncom/homework/structuretags.pm:1.581 loncom/homework/structuretags.pm:1.582
--- loncom/homework/structuretags.pm:1.581 Mon Nov 27 22:44:20 2023
+++ loncom/homework/structuretags.pm Tue Nov 28 04:48:15 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.581 2023/11/27 22:44:20 raeburn Exp $
+# $Id: structuretags.pm,v 1.582 2023/11/28 04:48:15 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -842,6 +842,9 @@
if ($editors{'edit'}) {
$result.=&problem_edit_action_button('subedit','edit','e','Edit',1);
}
+ if ($editors{'daxe'}) {
+ $result.=&problem_edit_action_button('subdaxe','daxe','w','Edit with Daxe',1);
+ }
$result.=&problem_edit_action_button('subundo','undoxml','u','Undo',1);
if (&Apache::loncommon::nocodemirror()) {
$result.=&Apache::lonhtmlcommon::dragmath_button("LC_editxmltext",1);
@@ -850,6 +853,9 @@
if ($editors{'xml'}) {
$result.=&problem_edit_action_button('subeditxml','editxml','x','EditXML',1);
}
+ if ($editors{'daxe'}) {
+ $result.=&problem_edit_action_button('subdaxe','daxe','w','Edit with Daxe',1);
+ }
$result.=&problem_edit_action_button('subundo','undo','u','Undo',1);
}
$result.="\n</div>";
@@ -1063,8 +1069,8 @@
($env{'browser.type'} ne 'explorer' || $env{'browser.version'} > 9)) {
my $uri = $env{'request.uri'};
my $daxeurl = '/daxepage'.$uri;
- $result .= '<input type="button" value="'.&mt('Edit with Daxe').'" '.
- 'onclick="window.open(\''.$daxeurl.'\',\'_blank\');" />';
+ $result .= '<input type="button" accesskey="w" value="'.&mt('Edit with Daxe').'" '.
+ 'onclick="javascript:setmode(this.form,'."'daxe'".')" />';
}
$result.='
</div>
More information about the LON-CAPA-cvs
mailing list