vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   Programming Articles (https://vborg.vbsupport.ru/forumdisplay.php?f=188)
-   -   Adding New Buttons to the Editor Toolbar (https://vborg.vbsupport.ru/showthread.php?t=97295)

akanevsky 09-30-2005 10:00 PM

Adding New Buttons to the Editor Toolbar
 
Start by opening the editor_toolbar_on template.
That is the only template you need to edit, since in vBulletin this same template corresponds to both the standard editor and the wysiwig.

Find:
$vBeditTemplate[extrabuttons]

Before that row is where you should add buttons. However, you can add them anywhere you want if you know what you are doing.

Now about the buttons themselves:

Code:

<td><img src="$stylevar[imgdir_editor]/separator.gif" width="6" height="20" alt="" /></td>
Standard vBulletin Button Separator, does not do anything except separating buttons.

Code:

<td><div class="imagebutton" id="{$editorid}_cmd_wrap0_BBCODE"><img src="$stylevar[imgdir_editor]/YOURBUTTONIMAGE" width="21" height="20" alt="$vbphrase[YOURALTPHRASE]" /></div></td>
BBCODE - this part is what defines the bbcode to be insterted. Whatever you put instead of "BBCODE" goes into the square tag brackets.
YOURBUTTONIMAGE and YOURALTPHRASE are respectively the image and the descriptive phrase for that image.
You can also change the width of the image, but everything else should not be touched - esspecially the DIV ID (except the BBCODE part).

So far so good. But this does not allow a user to define a parameter for the bbcode tag.
To fix, open vbulletin_textedit.js located in clientscript folder, and find:

Code:

case 'PHP':
{
        this.apply_format('removeformat');
}

And below add:

Code:

case 'BBCODE':
{
        useoption = true;
}

Where BBCODE, of course, is the same bbcode you added earlier. Must be capitalized.

Done!

If anyone wants to add some information on how to make the buttons perform your own functions, do it.

Kirk Y 10-01-2005 05:29 PM

Excellent! I'll definately be using this! Will this affect the Quick Reply box or would something different need to be edited?

ProperMethodz 10-04-2005 03:57 AM

yay! I did this before and didn't know what the hell I was doing! I added a glow button.

Actually... If I remember correctly there is an area in the ADMINCP that allows you to do this automatically.

Regardless, this is sick because it now shows me the code effected.

Thanks!

o0Hubba0o 10-23-2005 02:34 AM

Quote:

Originally Posted by ProperMethodz
yay! I did this before and didn't know what the hell I was doing! I added a glow button.

When you add bbcode through the bbcode manager the last option is:
Quote:

Button Image (Optional) If you would like this bbcode to appear as a clickable button on the message editor toolbar, enter the URL of an image 21 x 20 pixels in size that will act as the button to insert this bbcode.
But like you said it's nice to where this is affected.

deathemperor 10-23-2005 09:28 AM

I thought when creating a new bbcode vbulletin let us insert a new button in the toolbar already ?

akanevsky 10-23-2005 10:47 AM

Yes, it does.

But:
- You cannot use it for pre-existing bbcodes, such as thread and post
- You cannot use it for CUSTOM hardcoded bbcodes, such as ones found in my [HIDE] hack.

Omranic 11-11-2005 11:13 AM

ok thats very nice
but how can I make my bbcode converted or displayed right in both standard & wysiwig editors ?
& is the bbcode manager in admincp can replace the js file editing ?

sory but i didn't understand the role of this file editing & i'm new to the tool box 3.5

akanevsky 11-11-2005 11:20 AM

The role of file editing: It tells the script that the tag has an OPTION, which makes it pop up the input box.
When you do the template edit, it works for both standard and wysiwyg editors.

Omranic 11-11-2005 12:15 PM

i do my best & try to make mmy own buttons & teel you the results ( am sure i'll need help :) )

BoYagoob 11-21-2005 10:25 AM

Great!
Thanks a lot :)


All times are GMT. The time now is 07:30 PM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01327 seconds
  • Memory Usage 1,736KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (4)bbcode_code_printable
  • (2)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (2)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (10)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete