форум vBSupport.ru > vBulletin > Old vB versions (3.0.x & 2.x.x) > vBulletin 3.7.x > Hacks, mods and scripts [3.7.x]
  • »
VBsupport перешел с домена .ORG на родной .RU Ура! Пожалуйста, обновите свои закладки - VBsupport.ru
 
 
 
 
ssmol
Специалист
 
ssmol's Avatar
Default Adding EditArea for Template & Plugin Editing
3

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/
Edit area
Here is EditArea, a free javascript editor for source code. (That is no way a WYSIWYG editor).
This editor is designed to edit souce code files in a textarea. The main goal is to allow text formatting, search and replace and real-time syntax highlight (for small text).
Download the zip file from the website above and unpack the zip file. Upload the edit_area folder into your /clientscript/ directory in your vbb installation. (See additional instructions at the bottom). You should now have a /clientscript/edit_area folder with files such as edit_area.css , edit_area.js and so on in it. Be sure that you also uploaded the images, langs, plugs and reg_syntax folders.


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
PHP Code:
<script type=\"text/javascript\"> 
It should be around line 295.

Before that line, add
PHP Code:
<script language=\"Javascript\" type=\"text/javascript\" src=\"../clientscript/edit_area/edit_area_full.js\"></script> 
*Read http://cdolivet.net/editarea/editarea/docs/include.html for advanced options.

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)
PHP 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>"
And then add the following code after the line you just commented out.
PHP 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>
        '
;
    } 
Please read up on http://cdolivet.net/editarea/editare...iguration.html to adjust some of the settings to your new editor interface

The last change in this file is a few lines down from the code you just pasted. Should be line 943.

Add
PHP Code:
$javascript_source
to the begining of the following line
PHP 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=&quot;$name&quot;\"") . ">" iif($htmlisehtmlspecialchars_uni($value), $value) . "</textarea>$resizer</div>"
It should look like
PHP Code:
 $javascript_source "<div id=\"ctrl_$name\"> ... 
Save and close this file!

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,
PHP Code:
opener.document.getElementsByName('<?php echo $vbulletin->GPC['name']; ?>')[0].value = textarea.value;
PHP Code:
opener.document.getElementsByName('<?php echo $vbulletin->GPC['name']; ?>')[0].value = editAreaLoader.getValue("popuptextarea");
Before the closing </head> tag, add
PHP Code:
<script language="Javascript" type="text/javascript" src="/clientscript/edit_area/edit_area_full.js"></script> 
*Read http://cdolivet.net/editarea/editarea/docs/include.html for advanced options.

Replace the existing <body> tag (the entire line) with the following
PHP 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>
**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
PHP Code:
editAreaLoader.setValue('popuptextarea', 
opener.editAreaLoader.getValue('<?php echo $vbulletin->GPC['name']; ?>'))
works, the reverse
PHP Code:
opener.editAreaLoader.setValue('<?php echo $vbulletin->GPC['name']; ?>',
editAreaLoader.getValue('popuptextarea'));
does not, if anyone knows the secret to getting this to work, please post here!
Attached Thumbnails
template_editor.jpg   plugin_editor_fullscreen.jpg  
Bot
Yandex Bot Yandex Bot is online now
 
Join Date: 05.05.2005
Реклама на форуме А что у нас тут интересного? =)
 
 
shpunsetoy
Эксперт
 
shpunsetoy's Avatar
Default
0

очень полезная в принципе системга...но только совершенно непонятно???...нельзя было перевести на русский язык описание?...просто тупо скопировать с орга - огромного ума ненадо...кстати во всём разделе эта порочная практика приживаетсо...проще наверное настроить RSS и просто тупо дёргать с орга раздел.
 
 
ssmol
Специалист
 
ssmol's Avatar
Default
2

shpunsetoy,
имхо те кто сейчас ставят версию 3.7 поймут и по английски а вот доступ к оргу есть тут не у многих.
да и описание установки хака это не худ литература большого знания энглиша для этого ненужно
 
 
Orfo
Знаток
Default
1

вот последняя версия, жаль что пока никто не перевёл
Attached Files
File Type: zip editarea_0_7_2_3.zip (294.8 KB, 3 views)
 
 
maJic
В Черном списке
 
maJic's Avatar
Default
0

Orfo, там перевод не столь важен, там функционал главное.

maJic добавил 01.02.2009 в 22:30
Хм... только что поставил, подправил как и надо 2 файла, includes/adminfunctions.php и textarea.php, но редактор не изменился :( Может кто подсказать что я неправильно делал?

Last edited by maJic : 02-01-2009 at 11:30 PM. Reason: Добавлено сообщение
 


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




All times are GMT +4. The time now is 09:44 AM.


Powered by vBulletin® Version Ъ Edition
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Loading...