Welcome, Guest. Please login or register.
March 17, 2010, 09:56:11 PM

Login with username, password and session length
Search:     Advanced search
WB 2.8.1 released!
Download and additional information are available here .
110308 Posts in 15930 Topics by 9286 Members
Latest Member: lorbas
* Home Help Search Login Register
+  WebsiteBaker Community Forum
|-+  English
| |-+  Archive (posts up to 2007) (Moderators: Argos, BerndJM)
| | |-+  EditArea (PHP HTML Syntax Highlighting for textareas)
Pages: [1] Go Down Print
Author Topic: EditArea (PHP HTML Syntax Highlighting for textareas)  (Read 5425 times)
tomhung

Offline Offline

Posts: 352



« on: December 05, 2006, 09:02:26 PM »

Ok.. Go easy on me here.  This is my first prerelease attempt at a module.  I know there are lots of thing wrong with it.  I'm sure I will actually get all the WB module functions added sometime.

The module:
I wanted to integrate EditArea (textarea syntax highlighting) http://www.cdolivet.net/index.php?page=editArea
into the textarea of the settings and other admin boxes.

Current state of edit_area module:
it installs (basically copies to /modules/edit_area/)

To get it working:
add to /admin/interface/header.html
Code:
<script language="javascript" type="text/javascript" src="/modules/edit_area/edit_area_full.js"></script>
<script language="javascript" type="text/javascript" src="/modules/edit_area/config.js"></script>

find / add the id's of the textareas you want to convert into syntax editors

edit /modules/edit_area/config.js
copy and paste
editAreaLoader.init function for each textarea specifying the syntax and options

*you will have to add the id attribute to the /admin/settings/template.html textarea elements

I included the docs and examples for Edit_Area they are not essential for the module.

File removed ... newer version below ....
« Last Edit: December 06, 2006, 04:08:04 PM by tomhung » Logged
tomhung

Offline Offline

Posts: 352



« Reply #1 on: December 06, 2006, 01:55:13 AM »

here is a much better version
edit_areav0.2.zip

Changelog:
Added uninstall script
Added admin tool
Added edit of config.js
Added edit of header.html (for adding to admin interface)
Tried to clean up little bugs and unnecessary code
Removed docs and examples (pointed to official site for docs)
Added example function call in config.js

« Last Edit: December 06, 2006, 02:08:21 AM by tomhung » Logged
tomhung

Offline Offline

Posts: 352



« Reply #2 on: December 06, 2006, 01:55:58 AM »

please test this and fix / comment if you find bugs.
Greg
Logged
kweitzel
Forum administrator
*****
Offline Offline

Posts: 5555


WWW
« Reply #3 on: December 06, 2006, 08:31:32 AM »

Only the version of 5th December available where edit-area is a page type?

Anyway, a bit of more instructions would be great. Any special requirements? You wrote, that it is now a admin-module, like template and laguage edit? Or a free texteditor?

Installing the "old" version did work fine, creating a page (only thing available to do with it) created following errors:

Quote
Warning: require(C:\Programme\xampp\htdocs\wb/modules/edit_area/view.php) [function.require]: failed to open stream: No such file or directory in C:\Programme\xampp\htdocs\wb\framework\frontend.functions.php on line 169

Fatal error: require() [function.require]: Failed opening required 'C:\Programme\xampp\htdocs\wb/modules/edit_area/view.php' (include_path='.;C:\Programme\xampp\php\pear\') in C:\Programme\xampp\htdocs\wb\framework\frontend.functions.php on line 169

That was on a XAMPP Installation. On a *nix machin I get the same. Anything which needs to be added to the installation? And I saw, that you have 2 times the "full download" package ... is this necessary?

cheers

Klaus
« Last Edit: December 06, 2006, 08:37:07 AM by kweitzel » Logged

http://www.weitzel.biz
PM has been disabled
tomhung

Offline Offline

Posts: 352



« Reply #4 on: December 06, 2006, 04:06:53 PM »

sorry i forgot to post files.

this version should help with instructions.

concept:
you install module, now you have the javascript area editor
you have to add the script tags to the header.html file so the admin template will include js
you may have to (i had to add alot) add id attributes to texareas you want to syntax highlight
you have to edit config.js to call the javascript on your id

thats it.

if you want to have a syntax highlighted public page you would have to add the header include lines to your template and edit the config.js to include the id's of your text areas.
« Last Edit: December 06, 2006, 04:09:44 PM by tomhung » Logged
kweitzel
Forum administrator
*****
Offline Offline

Posts: 5555


WWW
« Reply #5 on: December 13, 2006, 11:35:38 AM »

OK tested a bit and ... I see, currently not really easy to implement. Do you think, you can make a module out of it, where a 1 click installation (like the WYSIWYG Editor Modules) works?

cheers

Klaus
Logged

http://www.weitzel.biz
PM has been disabled
tomhung

Offline Offline

Posts: 352



« Reply #6 on: December 13, 2006, 07:04:36 PM »

there are a couple BIG issues....

1. lots / most of the admin textareas don't have ID attributes
2. you must include the javascript files in your header of the admin page
3. then you need to explicitly set a javascript initialization into the custom.js file (which points to the textarea by ID)

IF an core developer decided to add unique ID attributes to the textareas in the core admin section, and IF the module developers included ID attributes to their textareas then if would be alot easier.

I figure I can programmaticly insert the javascript includes if needed.

So the biggest problem is the lack of ID.  I think I can overcome the other issues.

Greg
Logged
kweitzel
Forum administrator
*****
Offline Offline

Posts: 5555


WWW
« Reply #7 on: December 13, 2006, 07:06:47 PM »

Yeah ... I thought so already. Why don't you post a ticket for this (feature request) on the project page?

Cheers

Klaus
Logged

http://www.weitzel.biz
PM has been disabled
pcwacht
Guest
« Reply #8 on: December 13, 2006, 09:13:42 PM »

One very good use for this addon is to integrate it in the template editor or the module editor

John
Logged
tomhung

Offline Offline

Posts: 352



« Reply #9 on: December 13, 2006, 11:52:50 PM »

i have integrated it to mine already!!  *wink.....

once you "install it"  all you have to do is initialize the js function with the textareas ID and give it your parameters.  Simple! 
Logged
Pages: [1] Go Up Print 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.11 | SMF © 2006-2009, Simple Machines LLC Valid XHTML 1.0! Valid CSS!