Go Back   vb.org Archive > vBulletin 3 Discussion > vB3 Programming Discussions
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #1  
Old 02-24-2007, 02:51 PM
sweede's Avatar
sweede sweede is offline
 
Join Date: Jan 2007
Posts: 391
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default WYSIWYG Template editor for Admin CP

-- edit
I suck at typing, title should be W not Q !!
-- edit

I have a few custom templates that i use on my forums and i was wondering if anyone has or if it is possible to add the WYSIWYG javascript editor to the template editor.

While i do realize that this would totally screw 99% of the normal templates in vbulletin, what i was thinking that could be done, is when you open a template to edit and the standard text editor comes up, there is the button that says "large edit box"

Well, we add another button below it that says "Edit with Advanced Editor" or whatever, and it opens up the ajax edit in a new window.

When you click "send" , it would insert the completed HTML code into the template where you can save it.

For possible protection on the non-custom templates, you could simply not show the "edit with adv. editor" button.

has this been done or even sound like a good idea ?

I figured out half of the problem so far. to add the button to click to open a new window, you need to edit the adminfunctions.php file and look for the print_textarea_row() function.

I copied the admin/textarea.php file too vbtextarea.php and now i need to add the ajax editor to that.

PHP Code:
<?php
error_reporting
(E_ALL & ~E_NOTICE);
define('CVS_REVISION''$RCSfile$ - $Revision: 14655 $');
$phrasegroups = array();
$specialtemplates = array();
require_once(
'./global.php');

$vbulletin->input->clean_array_gpc('r', array(
    
'name' => TYPE_STR,
    
'dir'  => TYPE_STR
));

$vbulletin->GPC['name'] = preg_replace('#[^a-z0-9_-]#'''$vbulletin->GPC['name']);

?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html dir="<?php echo $stylevar['textdirection']; ?>" lang="<?php echo $stylevar['languagecode']; ?>">
<head>
    <title><?php echo $vbulletin->options['bbtitle'] . " - vBulletin $vbphrase[control_panel]"?></title>
    <meta http-equiv="Content-Type" content="text/html; charset=<?php echo $stylevar['charset']; ?>" />
    <link rel="stylesheet" type="text/css" href="../cpstyles/<?php echo $vbulletin->options['cpstylefolder']; ?>/controlpanel.css" />
    <script type="text/javascript" src="../clientscript/vbulletin_global.js"></script>
    <script type="text/javascript">
    <!--
    function js_textarea_send(textarea,doclose)
    {
        opener.document.getElementsByName('<?php echo $vbulletin->GPC['name']; ?>')[0].value = textarea.value;
        if (doclose==1)
        {
            opener.focus();
            self.close();
        }
    }
    // -->
    </script>
</head>
<body onload="self.focus(); fetch_object('popuptextarea').value=opener.document.getElementsByName('<?php echo $vbulletin->GPC['name']; ?>')[0].value;" style="margin:0px">
<form name="popupform" tabindex="1">
<table cellpadding="4" cellspacing="0" border="0" width="100%" height="100%" class="tborder">
<tr>
    <td class="tcat" align="center"><b><?php echo $vbphrase['edit_text']; ?></b></td>
</tr>
<tr>
    <td class="alt1" align="center">

      <textarea name="popuptextarea" id="popuptextarea" class="code"
     style="width:95%; height:500px" 
     onkeydown="js_textarea_send(this, 0);" 
     onkeyup="js_textarea_send(this, 0);" dir="<?php echo ($vbulletin->GPC['dir'] ? 'ltr' 'rtl'?>"></textarea>
     
 
     </td>
</tr>
<tr>
    <td class="tfoot" align="center">
    <input type="button" class="button" value="<?php echo $vbphrase['send']; ?>" onclick="js_textarea_send(this.form.popuptextarea, 1);" accesskey="s" />
    </td>
</tr>
</table>
</form>
</body>
</html>

<?php

?>
the comments of the script took a lot of room so i removed them
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 11:55 AM.


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.05918 seconds
  • Memory Usage 2,178KB
  • Queries Executed 11 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (1)bbcode_php
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (1)post_thanks_box
  • (1)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (1)post_thanks_postbit_info
  • (1)postbit
  • (1)postbit_onlinestatus
  • (1)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.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/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.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
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete