[LON-CAPA-cvs] cvs: loncom /homework edit.pm lonhomework.pm structuretags.pm

albertel lon-capa-cvs@mail.lon-capa.org
Thu, 22 Dec 2005 22:06:54 -0000


albertel		Thu Dec 22 17:06:54 2005 EDT

  Modified files:              
    /loncom/homework	lonhomework.pm structuretags.pm edit.pm 
  Log:
  - BUG #4515
  
  
Index: loncom/homework/lonhomework.pm
diff -u loncom/homework/lonhomework.pm:1.231 loncom/homework/lonhomework.pm:1.232
--- loncom/homework/lonhomework.pm:1.231	Wed Dec 21 14:05:05 2005
+++ loncom/homework/lonhomework.pm	Thu Dec 22 17:06:54 2005
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # The LON-CAPA Homework handler
 #
-# $Id: lonhomework.pm,v 1.231 2005/12/21 19:05:05 albertel Exp $
+# $Id: lonhomework.pm,v 1.232 2005/12/22 22:06:54 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -765,7 +765,7 @@
 	    &Apache::structuretags::remember_problem_state().'
             <input type="hidden" name="problemmode" value="'.&mt('EditXML').'" />
             <input type="submit" name="problemmode" accesskey="d" value="'.&mt('Discard Edits and View').'" />
-            <input type="submit" name="problemmode" accesskey="e" value="'.&mt('Edit').'" />
+            <input type="submit" '.&Apache::edit::submit_ask_anyway().'name="problemmode" accesskey="e" value="'.&mt('Edit').'" />
             <input type="submit" name="Undo" accesskey="u" value="'.&mt('undo').'" />
             <hr />
             <input type="submit" name="submit" accesskey="s" value="'.&mt('Submit Changes').'" />
Index: loncom/homework/structuretags.pm
diff -u loncom/homework/structuretags.pm:1.327 loncom/homework/structuretags.pm:1.328
--- loncom/homework/structuretags.pm:1.327	Thu Dec 15 18:20:55 2005
+++ loncom/homework/structuretags.pm	Thu Dec 22 17:06:54 2005
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA 
 # definition of tags that give a structure to a document
 #
-# $Id: structuretags.pm,v 1.327 2005/12/15 23:20:55 albertel Exp $
+# $Id: structuretags.pm,v 1.328 2005/12/22 22:06:54 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -232,7 +232,7 @@
 	&Apache::structuretags::remember_problem_state().'
        <input type="hidden" name="problemmode" value="'.&mt('Edit').'" />
        <input type="submit" name="problemmode" accesskey="d" value="'.&mt('Discard Edits and View').'" />
-       <input type="submit" name="problemmode" accesskey="x" value="'.&mt('EditXML').'" />
+       <input '.&Apache::edit::submit_ask_anyway().' type="submit" name="problemmode" accesskey="x" value="'.&mt('EditXML').'" />
        <input type="submit" name="Undo" accesskey="u" value="'.&mt('undo').'" /> <hr />
        <input type="submit" name="submit" accesskey="s" value="'.&mt('Submit Changes and Edit').'" />
        <input type="submit" name="submit" accesskey="v" value="'.&mt('Submit Changes and View').'" /><table><tr><td>'.
Index: loncom/homework/edit.pm
diff -u loncom/homework/edit.pm:1.98 loncom/homework/edit.pm:1.99
--- loncom/homework/edit.pm:1.98	Thu Dec 15 18:20:55 2005
+++ loncom/homework/edit.pm	Thu Dec 22 17:06:54 2005
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA 
 # edit mode helpers
 #
-# $Id: edit.pm,v 1.98 2005/12/15 23:20:55 albertel Exp $
+# $Id: edit.pm,v 1.99 2005/12/22 22:06:54 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -504,11 +504,14 @@
 <script type="text/javascript">
 var clean = true;
 var is_submit = false;
+var still_ask = false;
 function compareForm(event_) {
         if (!event_ && window.event) {
           event_ = window.event;
         }
-	if (!is_submit && !clean) {
+	if ((!is_submit || (is_submit && still_ask)) && !clean) {
+	    still_ask = false;
+	    is_submit = false;
             event_.returnValue = "$unsaved";
             return "$unsaved";
         }
@@ -529,6 +532,10 @@
     return ' onchange="unClean();" ';
 }
 
+sub submit_ask_anyway {
+    return ' onclick="still_ask=true;" ';
+}
+
 sub textarea_sizes {
     my ($data)=@_;
     my $count=0;