[LON-CAPA-cvs] cvs: loncom /xml lonxml.pm
banghart
lon-capa-cvs@mail.lon-capa.org
Thu, 23 Nov 2006 22:11:24 -0000
banghart Thu Nov 23 17:11:24 2006 EDT
Modified files:
/loncom/xml lonxml.pm
Log:
Bug 5081. Toward giving edit HTML the same functionality as
edit XML. Still need UNDO function.
Index: loncom/xml/lonxml.pm
diff -u loncom/xml/lonxml.pm:1.426 loncom/xml/lonxml.pm:1.427
--- loncom/xml/lonxml.pm:1.426 Wed Nov 22 21:26:43 2006
+++ loncom/xml/lonxml.pm Thu Nov 23 17:11:21 2006
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# XML Parser Module
#
-# $Id: lonxml.pm,v 1.426 2006/11/23 02:26:43 banghart Exp $
+# $Id: lonxml.pm,v 1.427 2006/11/23 22:11:21 banghart Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -1334,9 +1334,11 @@
my $titledisplay=&display_title();
my %lt=&Apache::lonlocal::texthash('st' => 'Save and Edit',
'vi' => 'Save and View',
+ 'dv' => 'Discard Edits and View',
'ed' => 'Edit');
my $buttons=(<<BUTTONS);
$cleanbut
+<input type="submit" name="discardview" accesskey="d" value="$lt{'dv'}" /><hr>
<input type="submit" name="savethisfile" accesskey="s" value="$lt{'st'}" />
<input type="submit" name="viewmode" accesskey="v" value="$lt{'vi'}" />
BUTTONS
@@ -1457,7 +1459,8 @@
&Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},
['editmode']);
}
- if (!$env{'form.editmode'} || $env{'form.viewmode'}) {
+ &Apache::lonnet::logthis("edit mode is ".$env{'form.editmode'});
+ if (!$env{'form.editmode'} || $env{'form.viewmode'} || $env{'form.discardview'}) {
$result = &Apache::lonxml::xmlparse($request,$target,$filecontents,
'',%mystyle);
undef($Apache::lonhomework::parsing_a_task);
@@ -1471,7 +1474,8 @@
# Edit action? Insert editing commands
#
unless ($env{'request.state'} eq 'published') {
- if ($env{'form.editmode'} && (!($env{'form.viewmode'}))) {
+ if ($env{'form.editmode'} && (!($env{'form.viewmode'})) && (!($env{'form.discardview'})))
+ {
my $displayfile=$request->uri;
$displayfile=~s/^\/[^\/]*//;
my %options = ();