Topic: Easy BBCode 1.0.1

##
##
##        Mod title:  Easy BBCode
##
##      Mod version:  1.0.1
##   Works on PunBB:  1.2, 1.2.1
##     Release date:  2005-02-06
##           Author:  Rickard Andersson
##
##      Description:  This mod adds buttons for easy insertion of BBCode and
##                    smilies when posting and editing messages.
##
##   Affected files:  post.php
##                    edit.php
##
##       Affects DB:  No
##
##            Notes:  By popular demand :)
##
##       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.
##
##

Download: http://www.punres.org/desc.php?pid=50

Edit: Updated zip to include a unified diff for those of you who prefer that.

Edit2: For info on how to apply this mod to the quick post form as well, have a look at this post.

Edit3: Bumped version up to 1.0.1 due to this problem being fixed.

"Programming is like sex: one mistake and you have to support it for the rest of your life."

2

Re: Easy BBCode 1.0.1

You
ARE
MY
GOD


Simply.


smile

3

Re: Easy BBCode 1.0.1

Ohhhhhhhhhh it was too easy !!! smile

Euh Rickard, ... another thing : is it possible to modify the mod ? In fact, the great thing would be this mod is appearing on "QUICK ANSWER BOX" ... (if possible, of course)

4 (edited by Widell 2005-02-05 16:46)

Re: Easy BBCode 1.0.1

Great! Thanks

Aah the quick answer box.. I would like it to smile

5

Re: Easy BBCode 1.0.1

i have do it but it was buggued big_smile

Greg Serveur : www.gregserveur.com

Re: Easy BBCode 1.0.1

First mod installed for me.

Go Rickard!

Indocron
$theQuestion = (2*b) || !(2*b);

7

Re: Easy BBCode 1.0.1

What is the .patch ?

Greg Serveur : www.gregserveur.com

Re: Easy BBCode 1.0.1

gregb wrote:

What is the .patch ?

Rickard wrote:

Edit: Updated zip to include a unified diff for those of you who prefer that.

Re: Easy BBCode 1.0.1

http://indocron.net/images/patch.PNG

Prettyful

Indocron
$theQuestion = (2*b) || !(2*b);

10

Re: Easy BBCode 1.0.1

so how can i use the file .patch ? it's a script to do the modification automatically i suppose ?

Greg Serveur : www.gregserveur.com

11

Re: Easy BBCode 1.0.1

Very nice. Thank you. smile

Re: Easy BBCode 1.0.1

gregb wrote:

so how can i use the file .patch ? it's a script to do the modification automatically i suppose ?

yes you use a program called patch but you need shell(ssh) access to your server

13 (edited by Ulph 2005-02-06 11:53)

Re: Easy BBCode 1.0.1

Connorhd wrote:

yes you use a program called patch but you need shell(ssh) access to your server

It is not necessary although it makes patching somewhat easier, you can download the punbb-files and then use diffutils on your local machine, and upload the files again. If you run unix locally, diffutils may already be installed, otherwise just install it. For windows there are a few alternatives, you could use the version from http://www.gnu.org/software/diffutils/diffutils.html or the version in the MinGW suite at http://www.mingw.org/download.shtml located in the MSYS module. I'm sure CygWin also includes a version of diffutils. The MinGW suite is truly nice - it provides a Unix-like environment with a good shell inside a nice terminal and it is not as bloated as CygWin. Highly recommended if you have to use Windows!

To apply the patch, enter the punbb-directory in a shell and type

/path/to/patch -p2 < /path/to/some.patch

If there are conflicts you will get .rej-files, and these you will have to examine and apply by hand, much the same way as you would usually go about applying a punbb-patch.

Ulf

14

Re: Easy BBCode 1.0.1

Connorhd wrote:
gregb wrote:

so how can i use the file .patch ? it's a script to do the modification automatically i suppose ?

yes you use a program called patch but you need shell(ssh) access to your server

my server is at home.. so.. all it's ok

Greg Serveur : www.gregserveur.com

Re: Easy BBCode 1.0.1

In order to get the buttons to show up in the quick post form as well, you need to edit viewtopic.php. Look for:

<form method="post" action="post.php?tid=<?php echo $id ?>" onsubmit="this.submit.disabled=true;if(process_form(this)){return true;}else{this.submit.disabled=false;return false;}">

and replace it with

<form id="post" method="post" action="post.php?tid=<?php echo $id ?>" onsubmit="this.submit.disabled=true;if(process_form(this)){return true;}else{this.submit.disabled=false;return false;}">

Then look for

<label><textarea name="req_message" rows="7" cols="75" tabindex="1"></textarea></label>

and insert

<?php require PUN_ROOT.'mod_easy_bbcode.php'; ?>

right above it.

That should do it.

"Programming is like sex: one mistake and you have to support it for the rest of your life."

Re: Easy BBCode 1.0.1

i have a problem when i add a smilie, the scrollbar vertical up only

El Mejor Lugar de la Red - Corporación Azakur4

17

Re: Easy BBCode 1.0.1

Azakur4 wrote:

i have a problem when i add a smilie, the scrollbar vertical up only

i have the same problem

Greg Serveur : www.gregserveur.com

Re: Easy BBCode 1.0.1

Huh? What do you mean? Which browser?

"Programming is like sex: one mistake and you have to support it for the rest of your life."

19

Re: Easy BBCode 1.0.1

Firefox... http://gregb.no-ip.com/punbb ... test it

Greg Serveur : www.gregserveur.com

20 (edited by Talikar 2005-02-06 21:40)

Re: Easy BBCode 1.0.1

How can one change this to work correctly? On FireFox it works fine for the most part...

If you select one of the codes it works, places it where the cursor is, or around highlighted text, which is good.
However, if you select a smiley it will automatically scroll you up to the top of the page, rendering it a useless function for the "quick reply" box at the bottom of posts.

Thanks for the mod though, works perfectly for the most part smile

Edit:
I think the problem lies here:

        echo "\t\t\t\t\t\t\t".'<a href="#" onclick="insert_text(\''.$smiley_text[$i].'\', \'\')"><img src="img/smilies/'.$smiley_img[$i].'" width="15" height="15" alt="'.$smiley_text[$i].'" /></a>'."\n";

in the mod_easy_bbcode.php file. I think because it's set to a href "#" it automatically reloads the page you're currently on after adding the smily to the post, so it sets you back up at the top of the page.

21 (edited by Talikar 2005-02-06 22:38)

Re: Easy BBCode 1.0.1

ok I changed the line I said above to:

        echo "\t\t\t\t\t\t\t".'<a onclick="insert_text(\''.$smiley_text[$i].'\', \'\')"><img src="img/smilies/'.$smiley_img[$i].'" width="15" height="15" alt="'.$smiley_text[$i].'" /></a>'."\n";

and it works better now, but this isn't really a good way to do it I'm going to guess, I'll just use it for now until Rickard brings out a better fix.:P

Re: Easy BBCode 1.0.1

Rickard wrote:

Huh? What do you mean? Which browser?

Same here, with Safari.

Re: Easy BBCode 1.0.1

Ah, I see the problem. I've released a new version, 1.0.1 that should resolve the issue. Instead of leaving out the href and using onclick, I added the javascript to the href attribute. I think that's the best solution.

"Programming is like sex: one mistake and you have to support it for the rest of your life."

Re: Easy BBCode 1.0.1

With Safari, cursor remains to the left of the smiley after placing it (which is a little bit annoying)  whilst with IE and Firefox , cursor goes to the end of the smiley.

Re: Easy BBCode 1.0.1

Since I don't own a Mac, I can't test this on Safari and other Mac browsers. I doubt there's a solution to the problem, but if you find it, please let me know.

"Programming is like sex: one mistake and you have to support it for the rest of your life."