Simple Machines Community Forum

SMF Development => Bug Reports => Fixed or Bogus Bugs => Topic started by: oaqm on January 21, 2013, 01:27:57 PM

Title: SMF 2.1 draft autosave not fuctioning
Post by: oaqm on January 21, 2013, 01:27:57 PM
(Moved here by request.....)

Under Members/Permissions/General Permissions I have "Save drafts of new posts" and "Automaticaly save drafts of new posts" (NOTE - "automaticaly" is misspelled, should be two L's) checked.
Under Configuration/Core Features I have Drafts activated, "Enable automatic saving of drafts" is checked and a value of 30 is entered for "How often should drafts be autosaved?"

I assume I have missed a step somewhere?
Title: Re: SMF 2.1 draft autosave not fuctioning
Post by: Suki on January 21, 2013, 01:38:38 PM
Can you please tell which browser(s) are you using.
Title: Re: SMF 2.1 draft autosave not fuctioning
Post by: oaqm on January 21, 2013, 02:42:22 PM
Sure, it's Seamonkey 2.15.
Title: Re: SMF 2.1 draft autosave not fuctioning
Post by: oaqm on January 21, 2013, 04:21:07 PM
Okay, some progress has been made on my end.

Under "Profile/Look and Layout" there is an "Enable automatic saving of drafts" option that I was unaware of. Once that was checked the autosave worked just fine in Seamonkey.

When testing using IE 8.0.7601.17514 I get the following:

(http://mullarea.com/piktarz/2point1_error_autosave.jpg)

The red X at the lower right hand corner of the attached image is the sm_loading.gif from the Themes/default/images directory. I don't know if the failure to load that image is triggering a failure in autosave or not, but at any rate the Error on Page notice comes up simultaneously in the lower left corner and the draft is not saved.
Title: Re: SMF 2.1 draft autosave not fuctioning
Post by: Suki on January 21, 2013, 04:31:40 PM
Well, it has been a while since last time I check 2.1's code but it seems more like a permission issue somewhere, I as an admin can autosave drafts in all browsers I checked this on, IE9, Opera and Firefox while as a regular user can't.

Firefox blames this line 107 on drafts.js:

if (document.getElementById('check_sticky').checked)

the "check_sticky" returns null somehow, I'm not familiar with any of the drafts code so I can't really offer a solution until I dig up a little more.

JavaScript is not my cup of tea, I assume by reading more of drafts.js that there must be some check for stickies and lock topics that gets fire up when it doesn't have to.
Title: Re: SMF 2.1 draft autosave not fuctioning
Post by: emanuele on January 21, 2013, 05:12:04 PM
Quote from: oaqm on January 21, 2013, 02:42:22 PM
Sure, it's Seamonkey 2.15.
WOW!
Another SeaMonkey user!! :D

ETA: sorry for the OT. :P
Title: Re: SMF 2.1 draft autosave not fuctioning
Post by: oaqm on January 21, 2013, 05:49:47 PM
Quote from: Suki on January 21, 2013, 04:31:40 PM
Well, it has been a while since last time I check 2.1's code but it seems more like a permission issue somewhere, I as an admin can autosave drafts in all browsers I checked this on, IE9, Opera and Firefox while as a regular user can't.

Same issue here. After I got it working in SeaMonkey as the admin, I decided to create a regular user account and no joy.

I have checked membergroup permissions and permissions by board, all are checked to allow autosave, but autosave is not working for the "regular" me, just the "admin" me.

@ emanuele, no problem. I got a bit leery of Firefox's 'New Version A Week' release schedule and went over to SeaMonkey. It reminds me of the good old Netscape days.
Title: Re: SMF 2.1 draft autosave not fuctioning
Post by: Matthew K. on January 22, 2013, 01:27:41 AM
// Get the locked an/or sticky values if they have been selected or set that is
if (this.opt.sType == 'post')
{
if (document.getElementById('check_lock').checked)
aSections[aSections.length] = 'lock=1';
if (document.getElementById('check_sticky').checked)
aSections[aSections.length] = 'sticky=1';
}

Both of those conditions should either be returning true or false, although I suppose we could verify that it wasn't null before checking for true false.
Title: Re: SMF 2.1 draft autosave not fuctioning
Post by: Suki on January 22, 2013, 10:44:50 AM
Well, it is checking if the radio/check box button is checked, if there is no radio button to check the it will indeed return null.

The bug is not on the JavaScript, drafts.js is only doing what was told it to do so, check for a radio button or a check box is indeed checked, if the radio button or the checkbox doesn't exists or has a different ID then drafts.js will act as its suppose to and return null.

In Post.template:


', $context['can_sticky'] ? '<li><input type="hidden" name="sticky" value="0" /><label for="check_sticky"><input type="checkbox" name="sticky" id="check_sticky"' . ($context['sticky'] ? ' checked="checked"' : '') . ' value="1" class="input_check" /> ' . $txt['sticky_after'] . '</label></li>' : '', '


$context['sticky'] is returning a vague or wrong value for regular users, same for $context['can_sticky']

I'm reticent to directly use the var to check for the var itself, unless you are absolutely sure that your var does exists, ie, you declared the var yourself, then don't directly use the var, use empty() or !empty()
Title: Re: SMF 2.1 draft autosave not fuctioning
Post by: Arantor on January 22, 2013, 01:13:48 PM
If you're using jQuery in 2.1, perhaps something like this?

if ($('#check_sticky').prop('checked'))
  aSections.push('sticky=1');
if ($('#check_lock').prop('checked'))
  aSections.push('lock=1');
Title: Re: SMF 2.1 draft autosave not fuctioning
Post by: Matthew K. on January 22, 2013, 02:58:55 PM
Suki - Well right...checking to make sure it isn't null is basically validating this on the JavaScript side to avoid a possible error.

Spuds - Yeah, exactly.

Arantor - Thanks for the suggestion, appreciate it.
Title: Autosave Draft
Post by: Road Rash Jr. on February 04, 2013, 05:39:36 PM
Autosave draft is not working, it is set to the default 30 seconds yet when you go to where it should be saved after the window is closed there is no draft.


Title: Re: Autosave Draft
Post by: emanuele on February 05, 2013, 03:33:13 AM
I think it's the same reported here:
http://www.simplemachines.org/community/index.php?action=search2;search=save+draft;brd=137

http://www.simplemachines.org/community/index.php?topic=495519.msg3474956#msg3474956
Title: Re: Autosave Draft
Post by: Road Rash Jr. on February 06, 2013, 10:44:11 PM
Thank you :)
Title: Re: SMF 2.1 draft autosave not fuctioning
Post by: FullyCreative on June 28, 2013, 10:57:40 AM
Hi All,

I use the mod too but it says 'Error in Package Install'

   1.   Execute Modification   ./Sources/ManagePermissions.php   Test successful
   2.   Execute Modification   ./Sources/Subs-Members.php   Test successful
   3.   Execute Modification   ./Themes/default/GenericControls.template.php   Test successful
   4.   Execute Modification   ./Sources/Display.php   Test successful
   5.   Execute Modification   ./Themes/default/Display.template.php   Test successful
   6.   Execute Modification   ./Sources/ManagePosts.php   Test successful
   7.   Execute Modification   ./Sources/Post.php   Test failed
   1.   Add Before   ./Sources/Post.php   Test successful
   2.   Replace   ./Sources/Post.php   Test failed
   3.   Add Before   ./Sources/Post.php   Test successful
   4.   Add Before   ./Sources/Post.php   Test successful
   5.   Add Before   ./Sources/Post.php   Test successful
   8.   Execute Modification   ./Themes/default/Post.template.php   Test successful
   9.   Execute Modification   ./Sources/Profile.php   Test successful
   10.   Execute Modification   ./Sources/Profile-View.php   Test successful
   11.   Execute Modification   ./Themes/default/Profile.template.php   Test successful
   12.   Execute Modification   ./Themes/default/languages/Modifications.english.php   Test successful
13.   Execute Modification   ./Themes/default/languages/Modifications.english-utf8.php   Skipping file
14.   Execute Modification   ./Themes/default/languages/Modifications.english_british.php   Skipping file
15.   Execute Modification   ./Themes/default/languages/Modifications.english_british-utf8.php   Skipping file
16.   Extract File   ./Themes/default/scripts/draft_autosave.js   
17.   Adapt Database   install.php   

Any suggestions as to why it won't work please?

My Forum is www.webplusdesigner.com


Thank you, Charlie
Title: Re: SMF 2.1 draft autosave not fuctioning
Post by: emanuele on June 28, 2013, 11:08:08 AM
FullyCreative welcome to sm.org.

This topic has nothing to do with mods, if you have problems with mod it's better to use the topic support for that specific mod (that you can find from the mod's page clicking on "Support and comments for this mod"). ;)
Title: Re: SMF 2.1 draft autosave not fuctioning
Post by: Illori on June 28, 2013, 11:55:10 AM
actually this issue should be solved in github so time to move it to fixed?
Title: Re: SMF 2.1 draft autosave not fuctioning
Post by: FullyCreative on June 28, 2013, 03:43:27 PM
Hi All,

Thank you for posting so quickly.
I will investigate your suggestions.

Many Thanks :)
Title: Re: SMF 2.1 draft autosave not fuctioning
Post by: Arantor on December 21, 2013, 01:24:59 PM
This issue does not persist in 2.1. Moving to fixed.