1 (edited by bedroom 2005-12-13 23:04)

Topic: AJAX post preview 1.0.1

##
##
##        Mod title:  AJAX post preview
##
##      Mod version:  1.0.1
##   Works on PunBB:  1.2, 1.2.10
##     Release date:  2005-12-08
##           Author:  bedroom
##
##      Description:  This mod uses the xajax library to quickly display the
##                    preview of a post (or errors in the post)
##
##                    (see: http://xajax.sourceforge.net)
##
##                    Nothing fancy, it does what the "Preview" button does,
##                    only without posting the form and reloading the page.
##
##                    Note that if javascript is disabled, the "Preview"
##                    button will still work the usual way (This is called 
##                    graceful degradation, folks :) )
##
##   Affected files:  header.php
##                    post.php
##                    edit.php
##
##       Affects DB:  No
##
##            Notes:  Tested with Firefox 1.5, Internet Explorer 6.0,
##                    Opera 8.51
##
##       DISCLAIMER:  Please note that "mods" are not officially supported by
##                    PunBB. Installation of this modification is done at your
##                    own risk. Backup your forum database and any and all
##                    applicable files before proceeding.
##
##

1.0.1 is the version you want !

This version has two bugfixes :

1. Added utf8_decode() and utf8_encode() going in and out of the getpreview() function in post.server.php. Special characters like the french "à" are now displayed correctly in the preview block.

2. Fixed a bug with single- and double-quotes displaying incorrectly when magic_quotes_gpc is enabled.

Furthermore, 7 additional steps were added to the readme, so that the mod is now applied to edit.php as well.

If you have version 1.0 installed and wish to upgrade, simply download the new files, upload the new post.server.php and follow steps 14 to 21 of the readme.

Thank you for using this mod ! smile

Download here

Demo here

2

Re: AJAX post preview 1.0.1

i will try that out. thanks for the great mod!

3

Re: AJAX post preview 1.0.1

I applied this (three times to be sure I did it right) and nothing happens in Safari.

sad

4

Re: AJAX post preview 1.0.1

demo?

-gezz

5

Re: AJAX post preview 1.0.1

I installed it, works well for me (IE and FF).  Thanks...

Re: AJAX post preview 1.0.1

I have the image upload mod installed. Can I combine the modded code and the ajax code? Some help would be awesome! Thanks

Original Code:
<p><input type="submit" name="submit" value="<?php echo $lang_common['Submit'] ?>" tabindex="<?php echo $cur_index++ ?>" accesskey="s" /><input type="submit" name="preview" value="<?php echo $lang_post['Preview'] ?>" tabindex="<?php echo $cur_index++ ?>" accesskey="p" /><a href="javascript:history.go(-1)"><?php echo $lang_common['Go back'] ?></a></p>

My Current Code:
<p><input type="submit" name="submit" value="<?php echo $lang_common['Submit'] ?>" tabindex="<?php echo $cur_index++ ?>" accesskey="s" /><input type="submit" name="preview" onclick="ClearUploadSlots();" value="<?php echo $lang_post['Preview'] ?>" tabindex="<?php echo $cur_index++ ?>" accesskey="p" /><a href="javascript:history.go(-1)"><?php echo $lang_common['Go back'] ?></a></p>

What it needs to be.
<p><input type="submit" name="submit" value="<?php echo $lang_common['Submit'] ?>" tabindex="<?php echo $cur_index++ ?>" accesskey="s" /><input type="submit" onclick="xajax_getpreview(xajax.getFormValues('post')); document.location.href='#ajaxpostpreview'; return false;" name="preview" value="<?php echo $lang_post['Preview'] ?>" tabindex="<?php echo $cur_index++ ?>" accesskey="p" /><a href="javascript:history.go(-1)"><?php echo $lang_common['Go back'] ?></a></p>

Re: AJAX post preview 1.0.1

[Again] Demo?  I would like to see it working before I try to install it...  I must say I am very interested.

Re: AJAX post preview 1.0.1

http://programming-designs.com/forums - I installed it on my forums, visit the suggestions forum and do a post preview (only forums where guests can post) to see it in action.

Re: AJAX post preview 1.0.1

really nice m8! smile

Re: AJAX post preview 1.0.1

This is the return... of the AJAX post preview developper ! smile

dss wrote:

I applied this (three times to be sure I did it right) and nothing happens in Safari.

I'm sorry to hear that, unfortunately I have no way to test this mod with Safari.

Folks, I'm sorry about popping in so late, I had kinda forgotten about posting this mod hmm I made it mainly for myself you see, so I wasn't too curious about what everybody else thought of it.

DENiAL, I guess you could try combining my mod and your image upload mod like this :

<p><input type="submit" name="submit" value="<?php echo $lang_common['Submit'] ?>" tabindex="<?php echo $cur_index++ ?>" accesskey="s" /><input type="submit" name="preview" onclick="ClearUploadSlots(); xajax_getpreview(xajax.getFormValues('post')); document.location.href='#ajaxpostpreview'; return false;" value="<?php echo $lang_post['Preview'] ?>" tabindex="<?php echo $cur_index++ ?>" accesskey="p" /><a href="javascript:history.go(-1)"><?php echo $lang_common['Go back'] ?></a></p>

I'll study the upload image mod just to check, but I don't think it could harm anything to do it this way.

I'll see if I can set up a demo sometime. Thanks to everyone who tried this mod out, I'm glad that some of you like it !

11

Re: AJAX post preview 1.0.1

bedroom wrote:

DENiAL, I guess you could try combining my mod and your image upload mod like this :

<p><input type="submit" name="submit" value="<?php echo $lang_common['Submit'] ?>" tabindex="<?php echo $cur_index++ ?>" accesskey="s" /><input type="submit" name="preview" onclick="ClearUploadSlots(); xajax_getpreview(xajax.getFormValues('post')); document.location.href='#ajaxpostpreview'; return false;" value="<?php echo $lang_post['Preview'] ?>" tabindex="<?php echo $cur_index++ ?>" accesskey="p" /><a href="javascript:history.go(-1)"><?php echo $lang_common['Go back'] ?></a></p>

I'll study the upload image mod just to check, but I don't think it could harm anything to do it this way.

I'll see if I can set up a demo sometime. Thanks to everyone who tried this mod out, I'm glad that some of you like it !

Thanks I will give it a shot, and let you all know how it turned out. smile

Re: AJAX post preview 1.0.1

hi,
I could not see anything in progress, what shall I do ?

The poor horseman without horses
www.galopp-sport.eu

http://claimid.com/jlangrock
[img]http://claimid.com/images/hcard.gif[/img]