The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
Adding EditArea for Template & Plugin Editing Details »» | ||||||||||||||||||||||||||||
Adding EditArea for Template & Plugin Editing
Developer Last Online: Jun 2014
This isnt a Plugin or Mod, but a collection of code changes to allow the use of Edit Area to edit vbulletin templates and in the plugin code editor areas.
http://cdolivet.net/editarea/ Quote:
This requires changes to two files, one of them being optional. The first file to edit is the includes/adminfunctions.php file Using the UNMODIFIED 3.7.0 beta 2 version (Unsure of actual locations of the code in 3.6.8 and ealier versions, but the edits are basicly the same) The first edit is adding the javascript to the page. Open up the file includes/adminfunctions.php and look for the first Code:
<script type=\"text/javascript\"> Before that line, add Code:
<script language=\"Javascript\" type=\"text/javascript\" src=\"../clientscript/edit_area/edit_area_full.js\"></script> Now, we will look for the function print_textarea_row which starts around line 894 This is where the majority of the code changes are. Comment out line 915 (add // infront of the line) Code:
$resizer = "<div class=\"smallfont\"><a href=\"#\" $ie_reflow_css onclick=\"return resize_textarea(1, '{$vbulletin->textarea_id}')\">$vbphrase[increase_size]</a> <a href=\"#\" $ie_reflow_css onclick=\"return resize_textarea(-1, '{$vbulletin->textarea_id}')\">$vbphrase[decrease_size]</a></div>"; Code:
if (!$doeditbutton OR strpos($name,'[') !== false) { $javascript_source = ''; } else { $javascript_source = ' <script language="Javascript" type="text/javascript"> // initialisation editAreaLoader.init({ id: "'.$vbulletin->textarea_id.'" ,language: "en" ,syntax: "html" ,start_highlight: true ,font_size: "8" ,font_family: "verdana, monospace" ,allow_resize: "both" ,allow_toggle: true ,replace_tab_by_spaces: 4 ,min_height: 350 ,syntax_selection_allow: "css,html,js,php,xml" ,toolbar: " search, go_to_line,fullscreen, |, undo, redo, |, select_font,|, syntax_selection, |, change_smooth_selection, highlight, reset_highlight, |, help" }); </script> '; } The last change in this file is a few lines down from the code you just pasted. Should be line 943. Add Code:
$javascript_source. Code:
"<div id=\"ctrl_$name\"><textarea name=\"$name\" id=\"{$vbulletin->textarea_id}\"" . iif($textareaclass, " class=\"$textareaclass\"") . " rows=\"$rows\" cols=\"$cols\" wrap=\"virtual\" dir=\"$direction\" tabindex=\"1\"" . iif($vbulletin->debug, " title=\"name="$name"\"") . ">" . iif($htmlise, htmlspecialchars_uni($value), $value) . "</textarea>$resizer</div>", Code:
$javascript_source . "<div id=\"ctrl_$name\"> ... Right now, the template editor usable and with a full screen option built into it, you shouldnt need a reason to use the Large Edit Box option. However, those changes are also quite easy to do so i will add those. Open up the file admincp/textarea.php On line 48, HTML Code:
opener.document.getElementsByName('<?php echo $vbulletin->GPC['name']; ?>')[0].value = textarea.value;
HTML Code:
opener.document.getElementsByName('<?php echo $vbulletin->GPC['name']; ?>')[0].value = editAreaLoader.getValue("popuptextarea");
HTML Code:
<script language="Javascript" type="text/javascript" src="/clientscript/edit_area/edit_area_full.js"></script> Replace the existing <body> tag (the entire line) with the following HTML Code:
<body onload="self.focus(); editAreaLoader.setValue('popuptextarea', opener.editAreaLoader.getValue('<?php echo $vbulletin->GPC['name']; ?>'));" style="margin:0px"> <script language="Javascript" type="text/javascript"> // initialisation editAreaLoader.init({ id: "popuptextarea" ,language: "en" ,syntax: "html" ,start_highlight: true ,font_size: "8" ,font_family: "verdana, monospace" ,allow_resize: "both" ,allow_toggle: true ,replace_tab_by_spaces: 4 ,syntax_selection_allow: "css,html,js,php,xml" ,toolbar: " search, go_to_line, fullscreen, |, undo, redo, |, select_font,|, syntax_selection, |, change_smooth_selection, highlight, reset_highlight, |, help" }); </script> Some screenshots of the result.. **Note: For whatever reason, you cannot save text from the Large Edit Box into the main window IF you have the Edit Area editor enabled! you MUST uncheck the Toggle Editor checkbox before clicking the Large Edit Box button. If you fail to do that, you may or may not save your changes and you may loose the textarea data all together. For whatever reasons, while Code:
editAreaLoader.setValue('popuptextarea', opener.editAreaLoader.getValue('<?php echo $vbulletin->GPC['name']; ?>')) Code:
opener.editAreaLoader.setValue('<?php echo $vbulletin->GPC['name']; ?>', editAreaLoader.getValue('popuptextarea')); --------------------------------------- **Addition In the adminfunctions.php file, the line that we added that says HTML Code:
,syntax: "html" HTML Code:
,syntax: "'.$syntax_type.'" HTML Code:
if (!$doeditbutton OR strpos($name,'[') !== false) HTML Code:
switch ($name) { case "installcode": $syntax_type = "php"; break; case "uninstallcode": $syntax_type = "php"; break; case "phpcode": $syntax_type = "php"; break; case "template": $syntax_type = "html"; break; default: $syntax_type = "html"; } you can also add other lines here that could disable the javascript editor from showing, one example is adding HTML Code:
case "searchstring": $doeditbutton = false; break; you can also prevent the Large Area Button from being displayed by adding HTML Code:
$openwindowbutton = '<div style="width: 150px"> </div>'; Show Your Support
|
Comments |
#22
|
|||
|
|||
one word FANTASTIC :P
|
#23
|
||||
|
||||
just wanted to say thanks. just installed this on 3.82 with no issues. (partial instalation)
I only installed it on textarea.php because I don't think I'll always need it. sometimes I'm just doing a quick edit and don't see the point in having all this. BUT if I want the full editor, I can click the "Large Edit Box" and get it. that gives me this editor on the template editor & the plugin editor while only having to edit 1 file. I just checked and there's a 'Large Edit Box' button on the email users page too which opens this. not sure I need it there but here, it's pretty cool. |
#24
|
|||
|
|||
Adding the AJAX save button would be very nice
|
#25
|
|||
|
|||
this is the greatest thing ever created! ever!
installed on vBulletin 3.8.3 using the latest release of the "Edit Area" component, which was 0.8.1.1, and no problems so far the original link given is no longer working, the component can now be found here: http://www.cdolivet.com/index.php?page=editArea or here: http://sourceforge.net/projects/editarea/files/ |
#26
|
|||
|
|||
I got all this working for vB4 and I'm sure it will still work for vB3. I got the editArea editor working in the large edit window and it returns the text to the main page. The large editor window is now larger too. See attached image.
After you upload editArea to forum/clientscript follow these steps:
Now you have the usual text editor in the aminCP page and a code editor in the large edit window. Test it out to be sure everything works. If you want editArea in the main page follow these additional steps:
You're done, no further editing required. |
#27
|
|||
|
|||
OOPS! There's a glitch with this file. This works fine for templates and plug-ins but for pages with multiple textarea inputs it converts only the last one to the code editor (products, custom profile fields, etc).
I'm working on a solution and will post when I get a fix. |
#28
|
|||
|
|||
File fixed. If you have already uploaded the file you need to upload the new version and edit the corrected function into adminfunctions.php.
Sorry for the bug. |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|