PDA

View Full Version : WYSIWYG editor


Mythotical
11-20-2009, 07:32 PM
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
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 :



<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



require_once(DIR . '/includes/functions_editor.php');
$editorid = construct_edit_toolbar('',1,'signature',1,1,($vbul letin->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
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
the template :



<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



require_once(DIR . '/includes/functions_editor.php');
$editorid = construct_edit_toolbar('',1,'signature',1,1,($vbul letin->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
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.

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/forum/showthread.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

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, $postattach, 0, $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'])) ? 0 : 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

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