vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB4 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=252)
-   -   WYSIWYG editor (https://vborg.vbsupport.ru/showthread.php?t=228476)

Mythotical 11-20-2009 07:32 PM

WYSIWYG editor
 
Has anyone figured out how to add the editor to 4.0 custom scripts? I am trying to figure out but why try to reinvent the wheel if someone already figured it out.

Thanks
Steve

micheal332001 11-23-2009 10:04 AM

1 Attachment(s)
i would like to know this as well.

I have it working on my scripts but its layout is all wrong.

xman_79 11-23-2009 01:25 PM

the template :

Code:


<script type="text/javascript" src="clientscript/vbulletin-editor.js?v={vb:raw vboptions.simpleversion}"></script>

<link rel="stylesheet" type="text/css" href="{vb:var vbcsspath}vbulletin-formcontrols.css" />
<link rel="stylesheet" type="text/css" href="{vb:var vbcsspath}editor.css" />
<link rel="stylesheet" type="text/css" href="{vb:var vbcsspath}bbcode.css" />

<form class="vbform block" action="file.php" method="post" name="vbform" onsubmit="return vB_Editor['{vb:raw editorid}'].prepare_submit(this.inputname.value, {vb:raw vboptions.postminchars})">

<div class="wysiwyg_block">
<div class="blockbody formcontrols">
<div class="blockrow">
        {vb:raw messagearea}
</div>
</div>
</div>

<div class="blockfoot actionbuttons">
<div class="group">
        <input type="hidden" name="s" value="{vb:raw session.sessionhash}" />
        <input type="hidden" name="securitytoken" value="{vb:raw bbuserinfo.securitytoken}" />
        <input type="hidden" name="do" value="mydo" />
        <input type="submit" class="button" name="sbutton" id="{vb:raw editorid}_save" value="{vb:rawphrase myphrase}" accesskey="s" tabindex="2" />
</div>
</div>

</form>

the php file

PHP Code:


require_once(DIR '/includes/functions_editor.php');
$editorid construct_edit_toolbar('',1,'signature',1,1,($vbulletin->userinfo['userid']));

In your $templater->register add

$templater
->register('editorid'$editorid);
$templater->register('messagearea'$messagearea); 


Mythotical 11-23-2009 01:43 PM

Well thank you xman_79. That will help quite a bit.

You can submit the article or I can submit an article, your call xman_79.

xman_79 11-23-2009 02:02 PM

Welcome ..

My problem is : I don't speack english :( ...

Mythotical 11-23-2009 02:11 PM

Quote:

Originally Posted by xman_79 (Post 1919507)
Welcome ..

My problem is : I don't speack english :( ...

No worries, I will put the article up then. I'm gonna test the code to make sure it works and test various ways but over all I'm confident it works.

micheal332001 11-23-2009 06:04 PM

Quote:

Originally Posted by xman_79 (Post 1919487)
the template :

Code:


<script type="text/javascript" src="clientscript/vbulletin-editor.js?v={vb:raw vboptions.simpleversion}"></script>

<link rel="stylesheet" type="text/css" href="{vb:var vbcsspath}vbulletin-formcontrols.css" />
<link rel="stylesheet" type="text/css" href="{vb:var vbcsspath}editor.css" />
<link rel="stylesheet" type="text/css" href="{vb:var vbcsspath}bbcode.css" />

<form class="vbform block" action="file.php" method="post" name="vbform" onsubmit="return vB_Editor['{vb:raw editorid}'].prepare_submit(this.inputname.value, {vb:raw vboptions.postminchars})">

<div class="wysiwyg_block">
<div class="blockbody formcontrols">
<div class="blockrow">
    {vb:raw messagearea}
</div>
</div>
</div>

<div class="blockfoot actionbuttons">
<div class="group">
    <input type="hidden" name="s" value="{vb:raw session.sessionhash}" />
    <input type="hidden" name="securitytoken" value="{vb:raw bbuserinfo.securitytoken}" />
    <input type="hidden" name="do" value="mydo" />
    <input type="submit" class="button" name="sbutton" id="{vb:raw editorid}_save" value="{vb:rawphrase myphrase}" accesskey="s" tabindex="2" />
</div>
</div>

</form>

the php file

PHP Code:


require_once(DIR '/includes/functions_editor.php');
$editorid construct_edit_toolbar('',1,'signature',1,1,($vbulletin->userinfo['userid']));

In your $templater->register add

$templater
->register('editorid'$editorid);
$templater->register('messagearea'$messagearea); 


Thankyou very much that worked great.

xman_79 11-23-2009 07:55 PM

Quote:

Originally Posted by Steve M (Post 1919499)
Well thank you xman_79. That will help quite a bit.

You can submit the article or I can submit an article, your call xman_79.

Quote:

Originally Posted by Steve M (Post 1919512)
No worries, I will put the article up then. I'm gonna test the code to make sure it works and test various ways but over all I'm confident it works.

If you want to publish this article you can also publish my article "How can I use the quick editor" published in the French-language in vbulletin-ressources.com .

My name is Suleiman .

http://www.vbulletin-ressources.com/...ad.php?t=17708

Mythotical 11-24-2009 02:29 AM

Done and done, thanks, I went off of your article on that site to finish up mine.

Lionel 11-24-2009 09:00 PM

abDoes anyone know how to activate the new attachment option in the code above?

I see this in newthread

PHP Code:

        require_once(DIR '/packages/vbattach/attach.php');
        
$values "values[f]=$foruminfo[forumid]";
        
$attach = new vB_Attach_Display_Content($vbulletin'vBForum_Post');
        
$attachmentoption $attach->fetch_edit_attachments($posthash

$poststarttime$postattach0$values$editorid$attachcount);
        
$contenttypeid $attach->fetch_contenttypeid();
    require_once(
DIR '/includes/functions_file.php');
    
$attachinfo = array(
        
'auth_type'     => (empty($_SERVER['AUTH_USER']) AND empty($_SERVER

['REMOTE_USER'])) ? 1,
        
'posthash'      => $posthash,
        
'poststarttime' => $poststarttime,
        
'userid'        => $vbulletin->userinfo['userid'],
        
'contenttypeid' => $contenttypeid,
        
'max_file_size' => fetch_max_upload_size(),
        
'values'        => array(
            
'f' => $foruminfo['forumid']
        ) 

and then

PHP Code:

require_once(DIR '/includes/functions_editor.php');
$editorid construct_edit_toolbar('',1,'nonforum',1,1,($vbulletin->userinfo['userid']),'fe','',$attachinfo); 



All times are GMT. The time now is 07:19 AM.

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

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01184 seconds
  • Memory Usage 1,763KB
  • 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
  • (2)bbcode_code_printable
  • (4)bbcode_php_printable
  • (4)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (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
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete