SF.net SVN: phpwiki:[10901] trunk

vargenau--- via phpwiki-checkins <[email protected]> Fri, 14 Jan 2022 14:41:07 +0000
Newsgroups gmane.comp.web.wiki.phpwiki.checkins
Message-ID <[email protected]>
Revision: 10901
          http://sourceforge.net/p/phpwiki/code/10901
Author:   vargenau
Date:     2022-01-14 14:41:07 +0000 (Fri, 14 Jan 2022)
Log Message:
-----------
Warn user that leaving the page will lose modifications: in all themes

Modified Paths:
--------------
    trunk/locale/it/pgsrc/NoteDiRilascio
    trunk/pgsrc/ReleaseNotes
    trunk/themes/Crao/templates/editpage.tmpl
    trunk/themes/Portland/templates/editpage.tmpl
    trunk/themes/Wordpress/templates/editpage.tmpl

Modified: trunk/locale/it/pgsrc/NoteDiRilascio
===================================================================
--- trunk/locale/it/pgsrc/NoteDiRilascio	2022-01-14 14:33:17 UTC (rev 10900)
+++ trunk/locale/it/pgsrc/NoteDiRilascio	2022-01-14 14:41:07 UTC (rev 10901)
@@ -1,4 +1,4 @@
-Date: Wed, 12 Jan 2022 14:33:19 +0000
+Date: Fri, 14 Jan 2022 15:40:31 +0000
 Mime-Version: 1.0 (Produced by PhpWiki 1.6.0)
 Content-Type: application/x-phpwiki;
   pagename=NoteDiRilascio;
@@ -19,6 +19,7 @@
 * Better handling of theme change in ~UserPreferences.
 
 === Changes ===
+* Warn user that leaving the page will lose modifications.
 * Remove ADODB DATABASE_TYPE. Use SQL (Pear) or PDO.
 * Add “Rename” tab in Sidebar theme.
 * Page locking and unlocking is now saved in page history (in Edit mode).

Modified: trunk/pgsrc/ReleaseNotes
===================================================================
--- trunk/pgsrc/ReleaseNotes	2022-01-14 14:33:17 UTC (rev 10900)
+++ trunk/pgsrc/ReleaseNotes	2022-01-14 14:41:07 UTC (rev 10901)
@@ -1,4 +1,4 @@
-Date: Wed, 12 Jan 2022 14:33:19 +0000
+Date: Fri, 14 Jan 2022 15:40:31 +0000
 Mime-Version: 1.0 (Produced by PhpWiki 1.6.0)
 Content-Type: application/x-phpwiki;
   pagename=ReleaseNotes;
@@ -19,6 +19,7 @@
 * Better handling of theme change in ~UserPreferences.
 
 === Changes ===
+* Warn user that leaving the page will lose modifications.
 * Remove ADODB DATABASE_TYPE. Use SQL (Pear) or PDO.
 * Add “Rename” tab in Sidebar theme.
 * Page locking and unlocking is now saved in page history (in Edit mode).

Modified: trunk/themes/Crao/templates/editpage.tmpl
===================================================================
--- trunk/themes/Crao/templates/editpage.tmpl	2022-01-14 14:33:17 UTC (rev 10900)
+++ trunk/themes/Crao/templates/editpage.tmpl	2022-01-14 14:41:07 UTC (rev 10901)
@@ -16,6 +16,35 @@
       <?php echo _("Saving this page will overwrite the current version.") ?>
       </p>
 <?php } ?>
+<script type="text/javascript">
+<!--//
+$(document).ready(function() {
+    ret=window.sessionStorage.getItem('wiki_modified');
+    if (ret) {
+        wiki_modified=ret;
+    } else {
+        wiki_modified=0;
+    }
+    sessionStorage.removeItem('wiki_modified');
+    $('form *').change(function(){
+        wiki_modified=1;
+    });
+    window.onbeforeunload = confirmExit;
+    function confirmExit() {
+        if (wiki_modified == 1) {
+            return "Warning: leaving the page will lose all your modifications!";
+        }
+    }
+    $("input[name='edit[save]']").click(function() {
+        wiki_modified=0;
+        sessionStorage.removeItem('wiki_modified');
+    });
+    $("input[name='edit[preview]'],input[name='edit[diff]']").click(function() {
+        window.sessionStorage.setItem('wiki_modified', wiki_modified);
+        wiki_modified=0;
+    });
+});
+// --></script>
 <form method="post" id="editpage" name="editpage"
       action="<?php echo $request->getPostURL() ?>"
       accept-charset="UTF-8">

Modified: trunk/themes/Portland/templates/editpage.tmpl
===================================================================
--- trunk/themes/Portland/templates/editpage.tmpl	2022-01-14 14:33:17 UTC (rev 10900)
+++ trunk/themes/Portland/templates/editpage.tmpl	2022-01-14 14:41:07 UTC (rev 10901)
@@ -13,6 +13,35 @@
       <?php echo _("Saving this page will overwrite the current version.") ?>
       </p>
 <?php } ?>
+<script type="text/javascript">
+<!--//
+$(document).ready(function() {
+    ret=window.sessionStorage.getItem('wiki_modified');
+    if (ret) {
+        wiki_modified=ret;
+    } else {
+        wiki_modified=0;
+    }
+    sessionStorage.removeItem('wiki_modified');
+    $('form *').change(function(){
+        wiki_modified=1;
+    });
+    window.onbeforeunload = confirmExit;
+    function confirmExit() {
+        if (wiki_modified == 1) {
+            return "Warning: leaving the page will lose all your modifications!";
+        }
+    }
+    $("input[name='edit[save]']").click(function() {
+        wiki_modified=0;
+        sessionStorage.removeItem('wiki_modified');
+    });
+    $("input[name='edit[preview]'],input[name='edit[diff]']").click(function() {
+        window.sessionStorage.setItem('wiki_modified', wiki_modified);
+        wiki_modified=0;
+    });
+});
+// --></script>
 </td>
 </tr>
 </table>

Modified: trunk/themes/Wordpress/templates/editpage.tmpl
===================================================================
--- trunk/themes/Wordpress/templates/editpage.tmpl	2022-01-14 14:33:17 UTC (rev 10900)
+++ trunk/themes/Wordpress/templates/editpage.tmpl	2022-01-14 14:41:07 UTC (rev 10901)
@@ -15,6 +15,35 @@
       <?php echo _("Saving this page will overwrite the current version.") ?>
       </p>
 <?php } ?>
+<script type="text/javascript">
+<!--//
+$(document).ready(function() {
+    ret=window.sessionStorage.getItem('wiki_modified');
+    if (ret) {
+        wiki_modified=ret;
+    } else {
+        wiki_modified=0;
+    }
+    sessionStorage.removeItem('wiki_modified');
+    $('form *').change(function(){
+        wiki_modified=1;
+    });
+    window.onbeforeunload = confirmExit;
+    function confirmExit() {
+        if (wiki_modified == 1) {
+            return "Warning: leaving the page will lose all your modifications!";
+        }
+    }
+    $("input[name='edit[save]']").click(function() {
+        wiki_modified=0;
+        sessionStorage.removeItem('wiki_modified');
+    });
+    $("input[name='edit[preview]'],input[name='edit[diff]']").click(function() {
+        window.sessionStorage.setItem('wiki_modified', wiki_modified);
+        wiki_modified=0;
+    });
+});
+// --></script>
 </td>
 <td>
 </td>

This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.



_______________________________________________
phpwiki-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/phpwiki-checkins