PDA

View Full Version : WYSIWYG New thread/Reply


eiSecure
06-21-2002, 10:00 PM
This is sorta neat... everything, instead of having the old-school type-in text box for replies and new threads, you have a Frontpage-like visual editor for your replies!:)

Supports colors, and everything!:) Here's how to install...

1. Back up your newreply and newthread templates, just in case.:) (I'm not responsible if you screw up and blow up your house.:D)

2. Instead of me giving you pieces of the templates to modify, since there are huge modifications, I'll just give you the templates themselves. You usually won't have to change anything, unless you installed some hacks that modify the newreply or newthread templates.:)

3. When people are posting/replying, be sure to let them know that before they can submit the form, they have to press the 'save' button that's on the toolbar.:)

4. Upload the images attached to forums/images/toolbar directory.

5. Enjoy!:bunny:

New version available here (https://vborg.vbsupport.ru/showthread.php?s=&threadid=40283).

If I left out anything...let me know. ^_^

eiSecure
06-21-2002, 11:41 PM
Demo here: http://forums.eisecure.com

You have to register to see it, but it's real cool when you reply/post new thread!:D

EDIT: Also...forgot this attachment... ^_^

Just plop it in your forum directory.:)

RDX1
06-22-2002, 12:39 AM
haha, nice try, i say make a guets account or a screen shot

Slynderdale
06-22-2002, 12:40 AM
I simply must say, wow, this is a great hack, a must to install, it remeinds me alot od wordpad and other text editors, i like it, i signed up to your forums, im attaching a screenshot below.

eiSecure
06-22-2002, 12:44 AM
Oh, yeah, one more thing...

Be sure to enable HTML when posting, or else much of the effects (such as tabs) won't work.

Don't worry...the risk isn't as big as with a plaintext editor... everything is wrapped in tags, so it shouldn't be a big problem.:)

Slynderdale
06-22-2002, 12:50 AM
hmm, looking over it, this isnt considered a hack, its a template edit, so it shouldnt be here, but its great though

bandersen
06-22-2002, 12:55 AM
I looked at it... very nice!

eiSecure
06-22-2002, 01:07 AM
Originally posted by NerdNations
haha, nice try, i say make a guets account or a screen shot Well, I'm not forcing anyone to register and see it -- it's completely optional.

Now, why do you have to get that kind of attitude? Believe it or not, you're actually making me rethink wether to continue work on this hack, or take everything down. :tired:

Superman53142
06-22-2002, 01:15 AM
Originally posted by eiSecure
Well, I'm not forcing anyone to register and see it -- it's completely optional.

Now, why do you have to get that kind of attitude? Believe it or not, you're actually making me rethink wether to continue work on this hack, or take everything down. :tired:

I like the hack :) One thing, though, is that now that it uses an iframe for the textarea, how do I capture the value of said iframe for the spell checker?

eiSecure
06-22-2002, 01:17 AM
With a little tweaking of the Javascript, you can get it to work.:)

When the user presses the 'save' button, the contents of the iframe (in HTML format) is passed to a hidden form field called 'message'.

That's just a regular input box that's hidden... you can probably make the spell check work through there.:):bunny:

Superman53142
06-22-2002, 01:22 AM
Originally posted by eiSecure
With a little tweaking of the Javascript, you can get it to work.:)

When the user presses the 'save' button, the contents of the iframe (in HTML format) is passed to a hidden form field called 'message'.

That's just a regular input box that's hidden... you can probably make the spell check work through there.:):bunny:

Indeed. Then I'd just have to reverse the process to make idContent.document.body.innerHTML = vbform.message.value. You are smart :)

And to think I was going to try to grab idContent.document.body.innerHTML :cool:

eiSecure
06-22-2002, 01:27 AM
Originally posted by Superman53142


Indeed. Then I'd just have to reverse the process to make idContent.document.body.innerHTML = vbform.message.value. You are smart :)

And to think I was going to try to grab idContent.document.body.innerHTML :cool: Thanks.https://vborg.vbsupport.ru/external/2009/06/7.gifhttps://vborg.vbsupport.ru/external/2011/01/19.gif

Superman53142
06-22-2002, 01:32 AM
Another thing; I'm not looking at the script right now, but why can't Save() be run when Submit is pressed?

eiSecure
06-22-2002, 01:35 AM
Because I suck at Javascript.:p

If anybody is willing to work with me to enhance the hack, just shoot me a PM.:)

WallStreat
06-22-2002, 01:38 AM
Well done, eiSecure.

I notice there's a insert image function...is it working?

Superman53142
06-22-2002, 01:39 AM
Finally, where is selcolor.html? :)

eiSecure
06-22-2002, 01:40 AM
The insert image function doesn't yet work. However, if somebody has a multiple-attachment hack installed, then I can easily get it to work.:)

eiSecure
06-22-2002, 01:41 AM
Originally posted by Superman53142
Finally, where is selcolor.html? :) I believe it's in post number 2, or something close to 2, like 3, or 4...:D

Xelation
06-22-2002, 01:43 AM
great hack!!

Superman53142
06-22-2002, 01:45 AM
Do you have to have HTML enabled for this to work? If so, where is that setting, LOL?

eiSecure
06-22-2002, 01:45 AM
Originally posted by Xelation
great hack!! Thanks.:):bunny:

...so it is a hack after all... :chinese: :cool: :lick:

eiSecure
06-22-2002, 01:47 AM
Originally posted by Superman53142
Do you have to have HTML enabled for this to work? If so, where is that setting, LOL? Yes. Like what was mentioned on the first page, HTML needs to be enabled.

It's in your admin cp, under Forums --> Modify --> Enable HTML in posts [o] yes [ ] no:)

Superman53142
06-22-2002, 01:48 AM
Originally posted by eiSecure
Yes. Like what was mentioned on the first page, HTML needs to be enabled.

It's in your admin cp, under Forums --> Modify --> Enable HTML in posts [o] yes [ ] no:)

Ah, crap. I gotta do that for every forum, eh?

eiSecure
06-22-2002, 01:50 AM
Originally posted by Superman53142


Ah, crap. I gotta do that for every forum, eh? Yes, but (hopefully.;)) it'll be worth it for you.:)

Superman53142
06-22-2002, 01:54 AM
OK, if you add onclick="Save();" to the Submit button it'll save when you click the button.

eiSecure
06-22-2002, 01:56 AM
Originally posted by Superman53142
OK, if you add onclick="Save();" to the Submit button it'll save when you click the button. Yes, but it'll run the save function, and not submit the form.

Superman53142
06-22-2002, 01:57 AM
Originally posted by eiSecure
Yes, but it'll run the save function, and not submit the form.

Does both for me.

Xelation
06-22-2002, 01:58 AM
well, its not a hack but more of template edit now that I think of it... just thought I would tell you when you click edit it doesnt bring you back to the WYSIWYG screen... This is a great hack - template edit but you have a lot to fix good luck :)

eiSecure
06-22-2002, 02:01 AM
Originally posted by Superman53142


Does both for me. hmmmn...


Yeah, Xelation, I just threw this one together in like 10 minutes, so there's lots more to be done.:p

Hopefully, if somebody out there is good enough with JavaScript, they may be able to help me, and get some 'compensation' in the process.;)


Hopefully, most everything will be fixed in v1.0, including BBCodes, smilies, etc.:)

bad_madman
06-22-2002, 02:02 AM
But the Smilies don't work?! :surprised:

edit:
You were faster... :o
Originally posted by eiSecure
...most everything will be fixed in v1.0, ... smilies ... :)

eiSecure
06-22-2002, 02:04 AM
Originally posted by bad_madman
But the Smilies don't work?! :surprised: Yeah... they don't, because they're still trying to add the smilie text to the 'message' input box, but that's hidden.


It just requires a few tweaks here and there to get it all working...

Superman53142
06-22-2002, 02:06 AM
Originally posted by eiSecure
hmmmn...


Yeah, Xelation, I just threw this one together in like 10 minutes, so there's lots more to be done.:p

Hopefully, if somebody out there is good enough with JavaScript, they may be able to help me, and get some 'compensation' in the process.;)


Hopefully, most everything will be fixed in v1.0, including BBCodes, smilies, etc.:)

Yo, I'll help you for free. I don't think the forum owner at which I admin would like having HTML on the forums (although it effectively blocks scripting with the <br />'s), and if we could get a BBCode and smilies version whipped up I'd be really cool.

BTW, I am proficient in JavaScript and PHP, regardless of whatever impression may have been left by my stupid questions earlier in the thread :)

eiSecure
06-22-2002, 02:07 AM
Originally posted by Superman53142


Yo, I'll help you for free. I don't think the forum owner at which I admin would like having HTML on the forums (although it effectively blocks scripting with the <br />'s), and if we could get a BBCode and smilies version whipped up I'd be really cool.

BTW, I am proficient in JavaScript and PHP, regardless of whatever impression may have been left by my stupid questions earlier in the thread :) My AIM is eiSecure. We'll talk.:)

Superman53142
06-22-2002, 02:08 AM
Originally posted by eiSecure
My AIM is eiSecure. We'll talk.:)

I'm, you guessed it, Superman53142 on AIM :)

Velocd
06-22-2002, 02:48 AM
Ah, looks like somebody read the WYSIWYG request thread ;)

I can't believe you implemented it, very nice!
Although it looks alittle funny, its still a great addition to VB.

One request though: How bout an option in the UserCp that allows members to choose which posting interface they want, then I would defiantly install this ^_^

eiSecure
06-22-2002, 03:19 AM
Originally posted by Velocd
Ah, looks like somebody read the WYSIWYG request thread ;)

I can't believe you implemented it, very nice!
Although it looks alittle funny, its still a great addition to VB.

One request though: How bout an option in the UserCp that allows members to choose which posting interface they want, then I would defiantly install this ^_^ Actually, I just put this together in like 10 minutes, so there's a few things that missing, and other things that aren't working.

I've already fixed the quote problem, but hopefully, I'll get a chance to fix the smilies tomorrow.

I'm thinking about removing the BBcode line, what do you all think? All the functions in the BBCodes, other than PHP, Code, and Quote are all in the toolbar.

Nobody misses those options anyways, right?;)

ZiRu$
06-22-2002, 03:22 AM
thanks but i wish they didn't have to press SAVE

eiSecure
06-22-2002, 03:23 AM
That's also fixed.:)

eiSecure
06-22-2002, 03:24 AM
I will always have the latest development version up at my forums, so if you just can't wait, you can always check it out there.;)

TECK
06-22-2002, 03:38 AM
i just got into your forums. i must say that this is the coolest thing i saw in a long time. i have office XP installed on my pc. the look is amasing. just make sure you also include the templates in the zip package.

great work alex. :)

TECK
06-22-2002, 04:04 AM
Originally posted by eiSecure
That's also fixed.:) is not. sorry, i will wait until you sort it out:

Admin
06-22-2002, 05:53 AM
Originally posted by eiSecure
Yes. Like what was mentioned on the first page, HTML needs to be enabled.
Thanks, but I rather have a secured forum. :) (no offence, good job nonetheless)

Velocd
06-22-2002, 05:53 AM
How goes the compatibility issues? Would people using an older Internet Explorer or browser still be able to use this? Or say, a user using another browser other than Internet Explorer?

Incase there are issues, that is one reason It would be nice to have a USER CP option for members to choose which posting/replying interface they would like ;)

PS: Don't forget to add it to the PM interface also

RDX1
06-22-2002, 07:21 AM
instead of making it so you have to have html enabled, why not either insert new tags into the database, or have the user put new tags in?

then html wont be on :)

N9ne
06-22-2002, 10:20 AM
I saw this hack working first :D he showed me first :D but he made me sign up for his forums lol

GameCrash
06-22-2002, 11:28 AM
Seems not to work with Mozilla 1.0 :( That is not really good as it is used by some of my users (including me).

Why do you create html and not just bbcode text? The vB-Code bar is just not working, so you don't need it anymore. And Enabling HTML means you can't let your users choose what interface they want because of security reasons. And enabling HTML is not secure only because this one interface parses html - just create another form on your computer and submit it...

Anyway, this is a great hack, as far as it works with Mozilla I's install it :)

bluecat
06-22-2002, 12:06 PM
Excellent idea. I'll be adding this later today. :)

GameCrash
06-22-2002, 12:50 PM
Hm, is it right that this does not take effect if you edit a message? That would be another security problem as then everyone can insert html code without problems...

Floris
06-22-2002, 02:20 PM
Originally posted by NerdNations
haha, nice try, i say make a guets account or a screen shot We were thinking the same, sorry. But I have no intention to register on your forum, just to check a feature. You are finding ways to *spam* your site don't ya. It is either a little bit to obvious to me, or it just damn sure looks to me that way.
Sorry if it isn't your intention. Thank you for sharing this hack. I will download the files, try them on my test server and see how it looks there :)

eiSecure
06-22-2002, 02:28 PM
Nakkid, by fixed, I meant fixed in my copy.

I will release a more updated version, that includes support for BBCodes and add in the interface for PMs.

Also, I'll see what I can do about making it use BBCode instead of HTML, but it will be kind of hard, as all the functions in Javascript are native to HTML...:\

Xiphoid, no, this isn't a scheme to get registrations and spam my forum. The only reason I said that you can check out my forum for it is because I have the hack installed there, and nobody else does.

Also, I'm planning on adding something like the BBCode enhanced/normal mode to it, where the user can choose WYSIWYG mode or plain-text mode.:)

eiSecure
06-22-2002, 03:14 PM
Okay, here's an updated version.

Bug Fixes:
- Ability to quote
- You can submit form without pressing 'save'

ToDo:
- Add BBCode support
- Hack vbcode.js to allow inserts of smilies and BBCode.
- Allow toggling of HTML/WYSIWYG mode.
- Add this hack to the edit and PM templates.

Just replace your existing newthread and newreply templates with your new ones.:)


Update: New templates and instructions in post #79 (https://vborg.vbsupport.ru/showthread.php?postid=265348#post265348).

Vinney
06-22-2002, 05:50 PM
can create it so that it works when people want to edit there posts too ???

eiSecure
06-22-2002, 05:52 PM
Originally posted by Vinney
can create it so that it works when people want to edit there posts too ??? As I said in my previous post, I'm working on it...

Vinney
06-22-2002, 05:58 PM
i love this hack but there is a prob :

look my this thread on my forum

http://forum.peugeot-gti.net/showthread.php?threadid=10741

if some types, it goes scrolls way way to the right.

eiSecure
06-22-2002, 06:03 PM
It seems that that person added a few tags of his/her own to the post... when I go to view source, everything looks normal, except for the presence of some <xmp> tags...

eiSecure
06-22-2002, 06:04 PM
Okay... I found out the problem... it seems that there is a <pre> tag between the text...

It'll be fixed when I upload the next update.:)

Vinney
06-22-2002, 06:20 PM
cheers.

Martin CX
06-22-2002, 07:12 PM
When I click submit, it says "please complete message form"?

I've more or less cut&pasted the templates from post #51 (with slight alterations to make it fit the layout).

Some of the earlier posts mention a save-function, but where am I supposed to insert it in the template?

eiSecure
06-22-2002, 07:17 PM
Originally posted by Martin CX
When I click submit, it says "please complete message form"?

I've more or less cut&pasted the templates from post #51 (with slight alterations to make it fit the layout).

Some of the earlier posts mention a save-function, but where am I supposed to insert it in the template? When you modified it, did you change any of the javascript and/or input box code?

Martin CX
06-22-2002, 07:46 PM
Originally posted by eiSecure
When you modified it, did you change any of the javascript and/or input box code? I didn't think I had, but when I tried to run your template unaltered I had no problems. :surprised: Dayum. Now, I have to search through my modified template now to find the error. ;)

Martin CX
06-22-2002, 08:52 PM
OK. Now it works! Great hack... but before I'll implement on my boards there are a few hurdles: :)

1) How do you alter the style of the iFrame? It's a rather horrid darkish grey and the font is weird. I tried to put a ' style="background-color: #FFF" ' in the iFrame tag, but nothing happened?

2) It seems to make a <p> instead of a <br> when you hit ENTER, is it possible to change that?

3) Perhaps related to 2) - I've hacked the quote-function so I'm usually given an output that looks like this...

?skldfjsfd sdsf hh strh nnb sfdkjsdkfj
?
?skldfjsfd sfjjkdsf slfdkfsf sfdkjsdkfj
?dfjsdf dsgtretoi gjdfkgj sdf.

...when I quote. But now it seems to eat the <br>'s and output this...

?skldfjsfd sdsf hh strh nnb sfdkjsdkfj ? ?skldfjsfd sfjjkdsf slfdkfsf sfdkjsdkfj ?dfjsdf dsgtretoi gjdfkgj sdf.

...instead.

I hope somebody is able to help, thanks. :)

Vivi Ornitier
06-22-2002, 09:22 PM
hmm . ..this hack looks hella nice but I'm just confused on how to install it. I mean, you just gave us the two templates but my newthread and newreply are already edited a bit. So can you tell us what to edit specifically in the two templates or is that too much?

eiSecure
06-22-2002, 10:17 PM
Originally posted by Martin CX
OK. Now it works! Great hack... but before I'll implement on my boards there are a few hurdles: :)

1) How do you alter the style of the iFrame? It's a rather horrid darkish grey and the font is weird. I tried to put a ' style="background-color: #FFF" ' in the iFrame tag, but nothing happened?

2) It seems to make a <p> instead of a <br> when you hit ENTER, is it possible to change that?

3) Perhaps related to 2) - I've hacked the quote-function so I'm usually given an output that looks like this...

?skldfjsfd sdsf hh strh nnb sfdkjsdkfj
?
?skldfjsfd sfjjkdsf slfdkfsf sfdkjsdkfj
?dfjsdf dsgtretoi gjdfkgj sdf.

...when I quote. But now it seems to eat the <br>'s and output this...

?skldfjsfd sdsf hh strh nnb sfdkjsdkfj ? ?skldfjsfd sfjjkdsf slfdkfsf sfdkjsdkfj ?dfjsdf dsgtretoi gjdfkgj sdf.

...instead.

I hope somebody is able to help, thanks. :) As to the first problem with the background color of the iframe...

The background color is already white... what browser are you using it on?

As for the quote issue, that has already been fixed, and I'll release an update on Monday that will include support for BBCode as well.:)

eiSecure
06-22-2002, 10:18 PM
Originally posted by Vivi Ornitier
hmm . ..this hack looks hella nice but I'm just confused on how to install it. I mean, you just gave us the two templates but my newthread and newreply are already edited a bit. So can you tell us what to edit specifically in the two templates or is that too much? There are way too many modifications to list.

You are better off installing this postbit, and then applying the template modifications of your other hacks, since I doubt that there are other hacks that change these templates as much as this one.:bunny::)

Slynderdale
06-22-2002, 10:36 PM
These are nice template edits, not a hack, but i enjoy it, it could esily be made a hack if you have a user option where they can choose if they wanna use the new reply template or the old one when posting. Wouldnt be hard to do.

eiSecure
06-22-2002, 10:45 PM
The BBCode integration that i'm going to release later will put it in hack territory.:D

Paul
06-23-2002, 05:18 AM
Glad to see someone read my request (https://vborg.vbsupport.ru/showthread.php?s=&threadid=39964) ;) (I think)... or at least had the same idea! :D I look forward to your updated release, as html in postings simply *isn't* an option (my biggest hurdle in getting this to work for me was finding a way to replace the html tags IE5.x+ supports converted to vbcode :D)

Paul

Superman53142
06-23-2002, 05:39 AM
Originally posted by LoveShack
as html in postings simply *isn't* an option (my biggest hurdle in getting this to work for me was finding a way to replace the html tags IE5.x+ supports converted to vbcode :D)

Paul

If someone could get that worked out, it'd be pretty darn nice. I would, but I'm lazy. Did I mention I am brutally honest? :p :D

Erwin
06-23-2002, 12:22 PM
Nice.

As long as I don't have to enable HTML I will install this one. Do I have to enable HTML or not?

Admin
06-23-2002, 12:47 PM
Yes you do.

eiSecure
06-23-2002, 01:33 PM
Well, I'm working on a non-HTML version, but the problem is with the <a href> and the <img src> tags. They both have an ending tag (">), which makes it so much harder to do a search and replace using javascript.

Erwin
06-23-2002, 07:58 PM
Alright. Thanks. I will wait for the non-HTML version then. Keep up the great work, eiSecure. It's a great hack.

Keyser S?ze
06-23-2002, 08:45 PM
ok, installed this hack as it says to, and i post something and it does this

<PRE><EM><FONT face="Arial Narrow">test boom boom shake it baby </FONT></EM></PRE>

also when i click the color button i get a Not Found error

eiSecure
06-23-2002, 09:07 PM
Yes, those are known bugs, and they will be fixed in a patch that I will release tomorrow.:)

BigJohnson
06-24-2002, 04:15 PM
IS there any way you can just tell us what to add in the templates because i really supped up my templates and i don't feel like back tracking to see what to add back. Thanks so much that would help tremendously.

eiSecure
06-24-2002, 04:17 PM
I added in functions for the toolbar actions. I replaced the message box with the iframe and the toolbar. I added in a script to process submit events in the head.

You only have to change your newreply and newthread templates, not all the templates. Few people ever edit their newreply and newthread templates.:o

filburt1
06-24-2002, 04:30 PM
So is this a template edit or a hack?

eiSecure
06-24-2002, 04:43 PM
*sigh* Fine... if you wanna get technical, let me release the update so you can call it a hack...:o

eiSecure
06-24-2002, 04:49 PM
Update

This update fixes the following bugs:
- Problems with user quoting
- Smilies don't work
- BBCodes don't work
- User is required to press 'save' before submitting

To Do:
- Extend this to newpm/replypm & edit templates
- Get BBCode to work in enhanced mode
- Make it output BBCode instead of HTML

Install Instruction:
1. Update your newthread and newreply templates with the attached copies.
2. Replace your existing vbcode.js file
3. Enjoy!:):bunny:

BigJohnson
06-24-2002, 07:01 PM
I think it would be really better if you could just tell us what to add instead of just telling us to replace everythng. Because that is what i look forward to noing that i don't no that much html so i look forward to instructions. and this hack looks nice. Please help osmeone out thanks.

eiSecure
06-24-2002, 07:02 PM
The are seriousely waay too many changes to list.

If you want to know exactly what was modified, you can use something like Beyond Compare or Araxis Merge.

Keyser S?ze
06-25-2002, 12:32 AM
where is the selcolor.htm? i can select a color without it :(

BigJohnson
06-25-2002, 12:40 AM
There is way to many changes in the Templates?
I would do anything and this hack is amazing.

eiSecure
06-25-2002, 01:47 AM
Originally posted by IceMalee
where is the selcolor.htm? i can select a color without it :( I believe it's located on the second page of this thread.:)

Superman53142
06-25-2002, 01:53 AM
Originally posted by eiSecure
The are seriousely waay too many changes to list.

If you want to know exactly what was modified, you can use something like Beyond Compare or Araxis Merge.

Yeah, this thing has been turned topsy-turvy many times.

BigJohnson
06-25-2002, 02:29 AM
Beyond Compare or Araxis Merge

What are these things?

Erwin
06-25-2002, 02:38 AM
Waiting for the BBCode version with anticipation... :)

eiSecure
06-25-2002, 02:42 AM
Originally posted by BigJohnson
Beyond Compare or Araxis Merge

What are these things? Those are programs for helping you compare and modify different versions of files.

Erwin
06-25-2002, 02:46 AM
Also, Firefly, if this thing works with no problems (and works without HTML), I suggest that you add this WYSIWYG feature into version 3 of vB. It really makes posting very user-friendly even for newbies.

eiSecure
06-25-2002, 03:05 AM
This is already going to be in v3

Keyser S?ze
06-25-2002, 03:50 AM
Originally posted by eiSecure
This is already going to be in v3

how do u know that?

Velocd
06-25-2002, 04:32 AM
I'm sure FireFly has contacted him someway about it, or maybe he suggested it to Firefly. Either way, as I've mentioned in another post, it would be most primitive not to use something like this in the new version.

Erwin
06-25-2002, 04:49 AM
Originally posted by eiSecure
This is already going to be in v3

Great to hear! I can't wait for v3 to come out...

Velocd
06-25-2002, 08:12 AM
I just made a mini-addition for this hack, giving the users an option in their UserCP --> options page to choose which posting engine they would like to use (WYSIWYG or default). If anybody else is interested give a shout can I'll post it up.

;)

edit:

I just started messing with this and I must say eiSecure, its amazing!!! So so much easier ;) Thank you again for making this hack!

Velocd
06-25-2002, 08:48 AM
One last little request. How about getting this to work with editpost? ;)

eiSecure
06-25-2002, 12:57 PM
hehehe... Sure. The only reason I didn't make it work with editpost and the PM templates is that I knew we were going to have bugs, so it would be a real pain to have to change 5 templates every time something is messed up. We had to rewrite the templates many times. :D

As to how I knew this was going to be in vB3... Kier told me.:)

Birdie501
06-25-2002, 02:42 PM
Originally posted by Velocd
I just made a mini-addition for this hack, giving the users an option in their UserCP --> options page to choose which posting engine they would like to use (WYSIWYG or default). If anybody else is interested give a shout can I'll post it up.

;)

edit:

I just started messing with this and I must say eiSecure, its amazing!!! So so much easier ;) Thank you again for making this hack!

can you post it?
Thanks
:smoke:

eiSecure
06-25-2002, 02:48 PM
Yeah, release it, so I can assimilate its technical and cultural distinctiveness into my own.;)

Paul
06-25-2002, 03:54 PM
Is this hack working fully yet with font/size stuff, etc? I saw the dicussion over on vb.com but wasn't sure what the latest status is.

Paul

eiSecure
06-25-2002, 04:53 PM
Everything is working, except for the HTML to BBCode conversion.

Velocd
06-25-2002, 06:21 PM
as requested...

Add-On: Allow users to choose which posting engine to use via UserCp Options
A nice addition by Velocd

This will help users whose browser does not support the WYSIWYG editor, such as Mozilla 1.0 (stated by GameCrash earlier in this thread). Also, everything is about user preference so its good to give your members an option. ;)

Very easy to install, shouldn't take long at all. Although, if you currently have the WYSIWYG editor installed you will have to do a few things on your own.


--------------------------------------------------------------
Install Procedure:
--------------------------------------------------------------

1. Run the following query in PhpMyAdmin:

alter table user
add enablewysiwyg smallint(5) UNSIGNED not null default '0';


2. In member.php, find the following:

$showsignaturesnotchecked="checked";
}


Directly below it add:

if ($bbuserinfo[enablewysiwyg]) {
$enablewysiwygchecked="checked";
$enablewysiwygnotchecked="";
} else {
$enablewysiwygchecked="";
$enablewysiwygnotchecked="checked";
}


Now find:

$options=iif($showsignatures=="yes",1,0);


Below it add:

$enablewysiwyg=iif($enablewysiwyg=="yes",1,0);


Last but no least, find:

$DB_site->query("UPDATE user
SET ".$updatestyles."adminemail='$adminemail',enablewysiwyg='$enablewys iwyg',allowrate='$allowrate',
showemail='$showemail',invisible='$invisible',cook ieuser='$cookieuser',
maxposts='".addslashes($umaxposts)."',daysprune='".addslashes($prunedays)."',
timezoneoffset='".addslashes($timezoneoffset)."',emailnotification='$emailnotification',
startofweek='".addslashes($startofweek)."',options='$options',receivepm='$receivepm',
emailonpm='$emailonpm',pmpopup='$pmpopup',usergrou pid='$bbuserinfo[usergroupid]',
nosessionhash='$nosessionhash'
WHERE userid='$bbuserinfo[userid]'");


And see in that code on the 2nd line where I have:

enablewysiwyg='$enablewysiwyg',


You wanna add that too ;)
After your finish that, save member.php


3. Open newthread.php, and find the following:

eval("dooutput(\"".gettemplate("newthread")."\");");


Replace it with this code:

$threadengine = $DB_site->query_first("SELECT enablewysiwyg FROM user WHERE userid='$bbuserinfo[userid]'");

if($threadengine[enablewysiwyg]){ eval("dooutput(\"".gettemplate("newthread_wysiwyg")."\");");

} else { eval("dooutput(\"".gettemplate("newthread")."\");"); }


4. Open newreply.php, and find the following:

eval("dooutput(\"".gettemplate("newreply")."\");");


Replace it with this code:

$replyengine = $DB_site->query_first("SELECT enablewysiwyg FROM user WHERE userid='$bbuserinfo[userid]'");

if($replyengine[enablewysiwyg] == 1) { eval("dooutput(\"".gettemplate("newreply_wysiwyg")."\");");

} else { eval("dooutput(\"".gettemplate("newreply")."\");"); }


5. The same thing still needs to be done with the private.php and editpost.php, only problem is that their templates have not yet been implemented with the WYSIWYG system, so we will have to wait awhile...

6. Go into your admin/functions.php, find the following:

global $vbcodemode,$vbcode_smilies;


Replace it with:

global $DB_site,$vbcodemode,$vbcode_smilies;


Now find:

eval ("\$vbcode_buttons = \"".gettemplate("vbcode_buttons")."\";");


Place above it on a new line the following:

$vbcodetype = $DB_site->query_first("SELECT enablewysiwyg FROM user WHERE userid='$bbuserinfo[userid]'");
if($vbcodetype[enablewysiwyg]) { $vbcodetype = "vbcode2.js"; } else { $vbcodetype = "vbcode.js"; }


7.. Now to create new templates! In your Admin Cp, create the following template with its content:

newreply_wysiwyg:
newreply.txt that was provided in the hack zip needs to be in this template.

newthread_wysiwyg:
newthread.txt that was provided in the hack zip needs to be in this template.


8. Now you need to revert the templates, or change back to what you originally had, newthread and newreply.


9. Now to modify a couple templates, and then we're finished. In vbcode_buttons find the following:

<script language="Javascript" src="vbcode.js"></script>


Replace it with:

<script language="Javascript" src="$vbcodetype"></script>



10. In the template modifyoptions, find the following:

<input type="radio" name="pmpopup" $pmpopupnotchecked value="no"> no
</normalfont></td>
</tr>
<!-- *** -->


And just below it place:

<tr>
<td bgcolor="#1D6AA0" colspan="2"><normalfont color="#EEEEFF"><b>New Thread, Reply & Personal Messaging Engine</b></normalfont></td>
</tr>
<tr>
<td bgcolor="#1C5780"><normalfont><b>Use the WYSIWYG enhanced HTML engine? *IS IN BETA*</b></normalfont><br>
<smallfont>Selecting yes will enable the new WYSIWYG posting engine, which does not require the use of some VBcode tags and has a typing interface similar to that of Microsoft Word. <br><b><u>Note:</u> May be incompatible with some internet browsers.</b><br><b><u>Note2:</u> To use such VBcodes as the [img] tag, you must first initialize <i>enhanced mode</i> on the posting screen. Then simply type in the tags and close them as you would normally do.</b>
</smallfont></td>
<td bgcolor="#1C5780"><normalfont>
<input type="radio" name="enablewysiwyg" value="yes" $enablewysiwygchecked> yes
<input type="radio" name="enablewysiwyg" value="no" $enablewysiwygnotchecked> no
</normalfont></td>
</tr>


When the WYSIWYG is out of beta, meaning fixed of bugs, you should probably reomve the *IS IN BETA* from the chunk above.

--------------------------------------------------------------

Well thats it! If I missed anything or there are problems be sure to let me know, but I'm fairly sure I got everything down.

;)


UPDATE:

To reduce the ues of extra queries, its always good to add the custom templates to the $templatesused = "" list.

1. In newthread.php, find:

$templatesused = "newpost_postpreview,


Replace it with this:

$templatesused = "newpost_postpreview, newthread_wysiwyg,


2. In newreply.php, find:

$templatesused = "quotereply,


Replace it with this:

$templatesused = "quotereply, newreply_wysiwyg,

eiSecure
06-25-2002, 06:28 PM
whoohoo! We've finished the HTML -> BBCode conversion code!:)

I will test it out to see how it works, and, if velocd lets me, I'll release everything as a complete package. (With credit given, of course.:))

:bunny:

Velocd
06-25-2002, 06:34 PM
Sounds like an excellent idea ^_^

eiSecure
06-25-2002, 06:47 PM
Velocd, just wondering...

...any chance you can make your addon autodetect if the user is using IE5.5 or above?

For example, if the user is using IE5.5, then WYSIWYG will automatically be default, but if the user is on Netscape/Mozilla, it will autodefault to regular mode, and not let them switch, because it won't be possible.

Paul
06-25-2002, 07:33 PM
Originally posted by eiSecure
Everything is working, except for the HTML to BBCode conversion.

Hah. That's the biggest part. Allowing HTML is like leaving your car keys in the ignition, the doors unlocked, and installing a big flashing neon sign on the roof of your car that blinks "STEAL ME" in bright pink.

;D

Velocd
06-25-2002, 08:06 PM
Originally posted by eiSecure
Velocd, just wondering...

...any chance you can make your addon autodetect if the user is using IE5.5 or above?

For example, if the user is using IE5.5, then WYSIWYG will automatically be default, but if the user is on Netscape/Mozilla, it will autodefault to regular mode, and not let them switch, because it won't be possible.

I have no idea how to do that, sorry eiSecure..:(
I'm sure it requires some javascript which I don't have much knowledge in..

eiSecure
06-25-2002, 08:06 PM
It's all fixed now.

It has almost no bugs now, and the only problem is compatibility.:)

Superman53142
06-25-2002, 08:08 PM
Originally posted by LoveShack


Hah. That's the biggest part. Allowing HTML is like leaving your car keys in the ignition, the doors unlocked, and installing a big flashing neon sign on the roof of your car that blinks "STEAL ME" in bright pink.

;D

It's done. We finished this afternoon. It will be officially released tomorrow. Don't ask me why :p

Superman53142
06-25-2002, 08:09 PM
Originally posted by Velocd


I have no idea how to do that, sorry eiSecure..:(
I'm sure it requires some javascript which I don't have much knowledge in..

I'll take a look at it after I get a snack. I'm pretty sure PHP grabs all the user variables when the user requests a page. Should be in there somewhere.

Admin
06-26-2002, 05:31 AM
Can I close this thread now that there's a new one?

Speak now or forever hold your peace. :)

Superman53142
06-26-2002, 05:33 AM
Originally posted by FireFly
Can I close this thread now that there's a new one?

Speak now or forever hold your peace. :)

Sounds good to me :)

Erwin
06-26-2002, 11:35 AM
Maybe merge the threads. :)