[pLog-svn] r3550 - in plog/trunk: class/action/admin js/ui
templates/admin
mark at devel.lifetype.net
mark at devel.lifetype.net
Wed Jun 7 10:04:15 GMT 2006
Author: mark
Date: 2006-06-07 10:04:15 +0000 (Wed, 07 Jun 2006)
New Revision: 3550
Modified:
plog/trunk/class/action/admin/adminaddpostaction.class.php
plog/trunk/js/ui/autosave.js
plog/trunk/templates/admin/newpost.template
Log:
1. If the validate failed. We need to delete the cookie. Because the action will bring the value back to the from. We don't the autosave here.
2. Remove the annoying popup dialog to ask you save the post or not. It is really feel bad if the dialog ask again and again.
Modified: plog/trunk/class/action/admin/adminaddpostaction.class.php
===================================================================
--- plog/trunk/class/action/admin/adminaddpostaction.class.php 2006-06-07 09:59:28 UTC (rev 3549)
+++ plog/trunk/class/action/admin/adminaddpostaction.class.php 2006-06-07 10:04:15 UTC (rev 3550)
@@ -50,6 +50,18 @@
/**
* @private
*
+ * If the form is not validate, we need to clean the autosave cookie
+ */
+ function validate()
+ {
+ $validateOk = parent::validate();
+ if( !$validateOk )
+ $this->clearAutoSaveCookie();
+ }
+
+ /**
+ * @private
+ *
* returns the id of the post or 'false' if it couldn't be saved
*/
function _savePostData( $article )
Modified: plog/trunk/js/ui/autosave.js
===================================================================
--- plog/trunk/js/ui/autosave.js 2006-06-07 09:59:28 UTC (rev 3549)
+++ plog/trunk/js/ui/autosave.js 2006-06-07 10:04:15 UTC (rev 3550)
@@ -112,8 +112,6 @@
function initialAutoSave()
{
- window.onbeforeunload = beforeUnload;
-
postNotSaved = getCookie( postNotSavedCookieName );
if ( postNotSaved == 1 )
{
@@ -161,13 +159,4 @@
$('autoSaveMessage').innerHTML = '';
Element.hide($('autoSaveMessage'));
-}
-
-function beforeUnload()
-{
- postNotSaved = getCookie( postNotSavedCookieName );
- if ( postNotSaved ) {
- restartAutoSave();
- return msgBeforeUnloadMessage.replace( "restart-seconds", backupInterval * 2 );
- }
}
\ No newline at end of file
Modified: plog/trunk/templates/admin/newpost.template
===================================================================
--- plog/trunk/templates/admin/newpost.template 2006-06-07 09:59:28 UTC (rev 3549)
+++ plog/trunk/templates/admin/newpost.template 2006-06-07 10:04:15 UTC (rev 3550)
@@ -190,7 +190,7 @@
<input type="button" name="saveDraftAndContinue" value="{$locale->tr("save_draft_and_continue")}" onclick="javascript:saveDraftArticleAjax()" />
{/if}
<input type="button" name="previewPost" value="{$locale->tr("preview")}" onclick="javascript:previewNewPost()" />
- <input type="button" name="addPost" value="{$locale->tr("add_post")}" onclick="window.onbeforeunload = null; this.form.submit();"/>
+ <input type="submit" name="addPost" value="{$locale->tr("add_post")}" />
<input type="hidden" name="isDraft" value="" />
<input type="hidden" name="op" value="addPost"/>
<input type="hidden" name="postId" id="postId" value="{$postId}" />
More information about the pLog-svn
mailing list