Well, I'm going to finish coding it in about a month, right now only the admin part in the CP is done, so I'll come back then and update you guys and maybe put up some code for download.
To answer the wysiwyg editor question, it looks like a lot of code, but since it's just recycled vB3 code, it wasn't hard to implement, mainly just cut and paste, with a little fixing and customization.
The code:
PHP Code:
// ############################################################################
// ############################################################################
// ############################# THE CAR'S STORY ##############################
// ############################################################################
// ############################################################################
// ############################ start edit owner_history ##########################
if ($_REQUEST['do'] == 'edit_story')
{
require_once('./includes/functions_newpost.php');
$htmlcodeon = iif($vboptions['allowhtml'], $vbphrase['on'], $vbphrase['off']);
$bbcodeon = iif($vboptions['allowbbcode'], $vbphrase['on'], $vbphrase['off']);
$imgcodeon = iif($vboptions['allowbbimagecode'], $vbphrase['on'], $vbphrase['off']);
$smilieson = iif($vboptions['allowsmilies'], $vbphrase['on'], $vbphrase['off']);
// only show posting code allowances in forum rules template
$show['codeonly'] = true;
eval('$forumrules = "' . fetch_template('forumrules') . '";');
if (!isset($preview))
{
$result = $DB_site->query("
SELECT story
FROM f6_car_owned WHERE car_owned_id=$car_owned_id
");
while ($car = mysql_fetch_array($result))
{
$story = $car[story];
}
}
require_once('./includes/functions_editor.php');
// set message box width to usercp size
$stylevar['messagewidth'] = $stylevar['messagewidth_usercp'];
construct_edit_toolbar(htmlspecialchars_uni($story), 0, 0, 0);
// draw cp nav bar
construct_usercp_nav('garage');
$navbits[''] = $vbphrase['edit_garage'];
$templatename = 'modify_story';
}
// ########################### start update owner_history #########################
if ($_POST['do'] == 'update_story')
{
globalize($_POST, array('WYSIWYG_HTML', 'message' => STR, 'preview'));
if (isset($WYSIWYG_HTML))
{
require_once('./includes/functions_wysiwyg.php');
$story = convert_wysiwyg_html_to_bbcode($WYSIWYG_HTML, $vboptions['allowhtml']);
}
else
{
$story = trim($message);
}
if (isset($preview))
{
if (is_array($errors))
{
$errorlist = '';
foreach ($errors AS $key => $errormessage)
{
eval('$errorlist .= "' . fetch_template('newpost_errormessage') . '";');
}
$show['errors'] = true;
}
require_once('./includes/functions_bbcodeparse.php');
$previewmessage = parse_bbcode2($story, $vboptions['allowhtml'], $vboptions['allowbbimagecode'], $vboptions['allowsmilies'], $vboptions['allowbbcode']);
// save a conditional by just overwriting the phrase
$vbphrase['submit_message'] = "Save Car's Story";
eval('$preview = "' . fetch_template('newpost_preview') . '";');
$_REQUEST['do'] = 'edit_story';
}
else
{
$DB_site->query("
UPDATE f6_car_owned
SET story = '" . addslashes($story) . "'
WHERE car_owned_id = $car_owned_id
");
$url = "garage.php?$session[sessionurl]do=garage_home";
eval(print_standard_redirect('redirect_updatethanks'));
}
}
And the template:
HTML Code:
<form action="garage.php" method="post" name="vbform"<if condition="!is_browser('webtv')"> onsubmit="return validatePost(this, 0, 0, 0);" onreset="vB_RESET(this);"</if>>
$preview
<table class="tborder" cellpadding="$stylevar[cellpadding]" cellspacing="$stylevar[cellspacing]" border="0" width="100%" align="center">
<tr>
<td class="tcat">Edit Car's Story</td>
</tr>
<tr>
<td class="panelsurround" align="center">
<div class="panel">
<div style="width:$stylevar[formwidth_usercp]" align="$stylevar[left]">
<!-- message area -->
<div class="smallfont">This is a story of how you got it, why you got it, what you're doing with it, and whatever else your creative mind wants to write about.<br /><br /></div>
$messagearea
<!-- / message area -->
</div>
</div>
<div style="margin-top:$stylevar[cellpadding]px">
<input type="hidden" name="s" value="$session[sessionhash]" />
<input type="hidden" name="do" value="update_story" />
<input type="submit" class="button" value="Save Car's Story" accesskey="s" tabindex="1" />
<input type="submit" class="button" value="Preview Car's Story" name="preview" accesskey="p" tabindex="1" />
</div>
</td>
</tr>
</table>
<br />
$forumrules
</form>