Welcome, Guest. Please login or register.
May 16, 2008, 12:52:13 PM

Login with username, password and session length
Search:     Advanced search
Website Baker 2.7.0 (stable) released!
For more information look here.
The announcement board can be found here.
54064 Posts in 8761 Topics by 5066 Members
Latest Member: asterix
* Home Help Search Login Register
+  Website Baker Community Forum
|-+  English
| |-+  Modules
| | |-+  New Module: Javascript Admin
Pages: [1] 2 3 4 Go Down Print
Author Topic: New Module: Javascript Admin  (Read 14865 times)
nonplus
Pending Apprentice Baker
**
Offline Offline

Posts: 10


« on: April 17, 2006, 08:51:07 AM »

Module Javascript Admin - for WB 2.6.x

Download:  http://www.nonplus.net/software/download/wb/jsadmin-1.0.2.zip (~44KB)
05/05/2006: Version 1.0.2 fixes style sheet to display "hand" cursor over links inside draggable rows
04/20/2006: Version 1.0.1  fixes problem with most hosting setups


Purpose:  This modules fixes some pet peeves I have with WB.  cool It enhances the Website Baker administration, rather than a WB site.  Using Javascript (and AJAX) it makes certain administration tasks more pleasant.  The current version supports the following features, each of which can be turned on or off.

  • Remembering Expanded Pages: Enables WB to maintain which pages are expaned on the "Pages" page. Uses a cookie to persist this information.
  • Reorder pages using drag-and-drop: Implements drag'n'drop reordering on the "Pages" page using AJAX.
  • Reorder sections using drag-and-drop: Implements drag'n'drop reordering on the "Sections" page using AJAX.

Installation: Download the ZIP and install it in the Websitebaker Administration (Add-ons -> Modules -> Install Module). To activate this module, you will have to edit the WB source:
  • In a text editor, open the file wb/framework/class.admin.php
  • Find the function print_footer()
  • Add the following line to it:
    @include(WB_PATH.'/modules/jsadmin/footer.php');

The modified function should end up looking like this:
Code:
        function print_footer() {
                @include(WB_PATH.'/modules/jsadmin/footer.php');
                $footer_template = new Template(ADMIN_PATH."/interface");
                $footer_template->set_file('page', 'footer.html');
                $footer_template->set_block('page', 'footer_block', 'header');
                $footer_template->parse('header', 'footer_block', false);
                $footer_template->pparse('output', 'page');
        }

Configuration: Go to "Settings", click "Show Advanced Options" at the bottom of the page, click "Javascript Admin" at the bottom of next page.

Usage: "Remembering Expanded Pages" does what it says: it remembers and restores which pages were expanded.  When you have drag-and-drop enabled, clicking on a row and dragging it it to another row will reorder the rows using AJAX.  You don't have to wait for the page to be saved or reloaded.

Compatibility: I've tested it on IE 6 on Windows, in FF 1.5.0.1 on Windows and MacOS and in Safari 2.0.3 on MacOS. It should really work with any current browser, though.
Addendum: I tested it with Opera and the drag-and-drop does not work.  But then again, WB looks a bit messed up in Opera, anyway.

License: BSD license.  The Javascript files in the /modules/jsadmin/js/yui directory are from the Yahoo! User Interface Library, which also carries a BSD license.
« Last Edit: May 05, 2006, 01:26:05 PM by nonplus » Logged
maxbrax
Pending Apprentice Baker
**
Offline Offline

Posts: 34



WWW Email
« Reply #1 on: April 17, 2006, 10:59:38 AM »

 undecided
sorry i have installed this module but it not work sad

the administation setting respond with this message:

--------------------------------------------------------------------------------------------------------------
The module has not yet been integrated into Website Baker. Use to following steps to activate the module:

1. In a text editor, open the file wb/framework/class.admin.php
2. Find the function print_footer()
2. Add the following line to it:
   @include(WB_PATH.'/modules/jsadmin/footer.php');
4. The function should end up looking like this:
        function print_footer() {
                @include(WB_PATH.'/modules/jsadmin/footer.php');
                $footer_template = new Template(ADMIN_PATH."/interface");
                $footer_template->set_file('page', 'footer.html');
                $footer_template->set_block('page', 'footer_block', 'header');
                $footer_template->parse('header', 'footer_block', false);
                $footer_template->pparse('output', 'page');
        }
----------------------------------------------------------------------------------------------

i have made this changment but it not work.

please send your comments.

sorry fo my english.

« Last Edit: April 17, 2006, 11:01:19 AM by maxbrax » Logged

nonplus
Pending Apprentice Baker
**
Offline Offline

Posts: 10


« Reply #2 on: April 17, 2006, 05:14:01 PM »

The admin shows the instructions if it cannot detect that the module has been properly included - for example if you didn't specify the correct path.  It will also show this if you have JavaScript disabled (I should probably change the message for this).

Try removing the "@" from the include line.  You should then see some error messages at the bottom of the screen telling you why the include is failing.

Also, I've developed and tested this with the latest version (2.6.2) of WB.  I have no idea whether it will work with an older version...
« Last Edit: April 17, 2006, 05:21:55 PM by nonplus » Logged
Argos
Geek-Like Baker
*****
Offline Offline

Posts: 448


WWW Email
« Reply #3 on: April 18, 2006, 12:46:11 PM »

Sounds very nice! Will try it later today...
Logged

Jurgen Nijhuis
Argos Media
www.argosmedia.nl
WB sites: kwaliteitinklantcontact.nl, bruschke.nl, bereikbaarheid.nl, rondvaartijmuiden.nl, nvpit.nl, synergoscommunicatie.nl, kerncompany.nl, wijnenspijs.nl, almerehuren.nl, bakker-schilder.nl
bartvdb
Pending Apprentice Baker
**
Offline Offline

Posts: 6


« Reply #4 on: April 18, 2006, 03:07:52 PM »

undecided
sorry i have installed this module but it not work sad

the administation setting respond with this message:

--------------------------------------------------------------------------------------------------------------
The module has not yet been integrated into Website Baker. Use to following steps to activate the module:

1. In a text editor, open the file wb/framework/class.admin.php
2. Find the function print_footer()
2. Add the following line to it:
   @include(WB_PATH.'/modules/jsadmin/footer.php');
4. The function should end up looking like this:
        function print_footer() {
                @include(WB_PATH.'/modules/jsadmin/footer.php');
                $footer_template = new Template(ADMIN_PATH."/interface");
                $footer_template->set_file('page', 'footer.html');
                $footer_template->set_block('page', 'footer_block', 'header');
                $footer_template->parse('header', 'footer_block', false);
                $footer_template->pparse('output', 'page');
        }
----------------------------------------------------------------------------------------------

i have made this changment but it not work.

please send your comments.

sorry fo my english.



Well, I've tried to install this module also, and didn't get it to work either. Not in version 2.6.2 or 2.6.3
I've tried to remove the @ to get the errors, but even this didn't work.
Logged
valerie
Senior Baker
*****
Offline Offline

Posts: 151


WWW
« Reply #5 on: April 18, 2006, 09:09:13 PM »

@nonplus:

Not to be dense, but can you clarify on the installation instructions you added above (for the php challenged)--would the new line in class.admin.php be this?

Code:
print_footer() @include(WB_PATH.'/modules/jsadmin/footer.php');
or this?
Code:
print_footer()
@include(WB_PATH.'/modules/jsadmin/footer.php');
or something else?

This sounds like a fantastic module and I'd love to get it running.

Thanks!
Logged

http://www.robcomm.net
--editing and proofreading for American English
--print and web publication management
--graphic and web design, including original photography
nonplus
Pending Apprentice Baker
**
Offline Offline

Posts: 10


« Reply #6 on: April 18, 2006, 09:15:45 PM »

The line needs to go after the curly brace.  The modified print_footer function should end up looking like this:

Code:
        function print_footer() {
                @include(WB_PATH.'/modules/jsadmin/footer.php');
                $footer_template = new Template(ADMIN_PATH."/interface");
                $footer_template->set_file('page', 'footer.html');
                $footer_template->set_block('page', 'footer_block', 'header');
                $footer_template->parse('header', 'footer_block', false);
                $footer_template->pparse('output', 'page');
        }
Logged
Vincent
Senior Baker
*****
Offline Offline

Posts: 191


« Reply #7 on: April 19, 2006, 01:28:24 PM »

Pity it doesn't work  undecided in my 2.6.2 version, seems very promising. Hope you can make it work for all of us.
Vincent
Logged
kickarse
Apprentice Baker
***
Offline Offline

Posts: 64


« Reply #8 on: April 19, 2006, 04:16:57 PM »

Doesn't work for me either my code looks like this

Latest install of WB

Code:

function print_footer() {
@include(WB_PATH.'/modules/jsadmin/footer.php');
$footer_template = new Template(ADMIN_PATH."/interface");
$footer_template->set_file('page', 'footer.html');
$footer_template->set_block('page', 'footer_block', 'header');
$footer_template->parse('header', 'footer_block', false);
$footer_template->pparse('output', 'page');
}
« Last Edit: April 19, 2006, 04:29:51 PM by kickarse » Logged
centran
Apprentice Baker
***
Offline Offline

Posts: 60


Email
« Reply #9 on: April 20, 2006, 03:40:13 AM »

Still on 2.6.2 and this doesn't work.
When I click on Javascript Admin i get the error saying I didn't edit the file correctly.
The file was edited correctly.
I restarted my webserver just in case and still no luck.

My server is running on Linux. Maybe it is an OS thing.
Logged
nonplus
Pending Apprentice Baker
**
Offline Offline

Posts: 10


« Reply #10 on: April 20, 2006, 05:26:49 AM »

Well I'm not sure what the heck is going on with this.  I've been trying to debug this with kickarse with no good luck on my part.  I too am running it on Linux on Apache with PHP 4.x.  undecided

Is anyone (beside me, that is) having success with this module?
Logged
centran
Apprentice Baker
***
Offline Offline

Posts: 60


Email
« Reply #11 on: April 20, 2006, 07:15:13 AM »

Hopefully this works for someone else besides nonplus. Then we might be able to firgure out similarites and differences in our setups.

here is my phpinfo
http://calendar.stjosephat.com

Could this be a php4 or php5 problem? I would think that other errors would have been thrown.
« Last Edit: April 20, 2006, 07:19:06 AM by centran » Logged
nonplus
Pending Apprentice Baker
**
Offline Offline

Posts: 10


« Reply #12 on: April 20, 2006, 07:45:50 AM »

Thanks for the phpinfo.  I think I figured out the problem.  My setup uses phpsuexec (it's a security thing that lets PHP scripts run with a real userid rather than the web server's userid).  Anyway, the script is using the $_ENV variable which is initialized in phpsuexec, but not in a "standard" Apache setting.

If someone's willing to test the following change and let me know if it works, I'd appreciate it.  Instal JsAdmin as per instructions (including modifying the class.admin.php file)  Then change the /modules/jsadmin/footer.php file, by replacing line 8:

Code:
$script = $_ENV["SCRIPT_NAME"];

with the following:

Code:
$script = $_SERVER['SCRIPT_NAME'];
if(!$script)
$script = $PHP_SELF;

BTW, this should work in either 2.6.2 or 2.6.3 (I haven't tested it in anything older than that).
Logged
Vincent
Senior Baker
*****
Offline Offline

Posts: 191


« Reply #13 on: April 20, 2006, 09:09:42 AM »

The good news: it did the trick!  smiley smiley smiley
More good news: it also works in 2.6.1
A very handy tool. So: great work, nonplus.

The bad news (maybe just for me): I can only make it work on my local server. On my webhost I can't change the CHMOD settings to execute... Very strange, never had this before. If you know the problem (and the solution), please let me know.

Vincent


added:
I made a new zip-file with the changed footer.php. It works. Great!
« Last Edit: April 20, 2006, 01:00:55 PM by vincent » Logged
maxbrax
Pending Apprentice Baker
**
Offline Offline

Posts: 34



WWW Email
« Reply #14 on: April 20, 2006, 09:35:10 AM »

 cheesy cheesy cheesy

ok the New Module: Javascript Admin work on WB 2.6.2 in local PC with Easy PHP 1.8 and on remote server WEB.

very good application thank nonplus
Logged

kibmcz
Semi-Master Baker
*****
Offline Offline

Posts: 205


kibmcz
WWW
« Reply #15 on: April 20, 2006, 09:40:43 AM »

Thanks for the phpinfo.  I think I figured out the problem.  My setup uses phpsuexec (it's a security thing that lets PHP scripts run with a real userid rather than the web server's userid).  Anyway, the script is using the $_ENV variable which is initialized in phpsuexec, but not in a "standard" Apache setting.

If someone's willing to test the following change and let me know if it works, I'd appreciate it.  Instal JsAdmin as per instructions (including modifying the class.admin.php file)  Then change the /modules/jsadmin/footer.php file, by replacing line 8:

Code:
$script = $_ENV["SCRIPT_NAME"];

with the following:

Code:
$script = $_SERVER['SCRIPT_NAME'];
if(!$script)
$script = $PHP_SELF;

BTW, this should work in either 2.6.2 or 2.6.3 (I haven't tested it in anything older than that).

Works for me on WB 2.6.3 on  my commercially hosted site... great job.
« Last Edit: April 20, 2006, 09:46:09 AM by kibmcz » Logged

Good artists copy, great artists steal. - Steve Jobs
Get Firefox Gmail invites available.
nonplus
Pending Apprentice Baker
**
Offline Offline

Posts: 10


« Reply #16 on: April 20, 2006, 01:36:24 PM »

Everyone - thanks for helping me fix this.  It was driving me nuts...   smiley

A new version 1.0.1 which contains this fix can be downloaded from http://www.nonplus.net/software/download/wb/jsadmin-1.0.1.zip.

I've also updated the download link and license info in the original post at the top of this page.
Logged
valerie
Senior Baker
*****
Offline Offline

Posts: 151


WWW
« Reply #17 on: April 20, 2006, 01:48:02 PM »

Works here too, though I had the same permissions problem and got php errors when I tried to uninstall through the wb interface.  For some reason I have that permissions problem with wb--I can't change files installed by wb except through the wb interface.

Anyway,  thanks for your work on this!
Logged

http://www.robcomm.net
--editing and proofreading for American English
--print and web publication management
--graphic and web design, including original photography
centran
Apprentice Baker
***
Offline Offline

Posts: 60


Email
« Reply #18 on: April 20, 2006, 08:54:51 PM »

awesome job. This should be added to WB.

However, how hard would it be to intergrate more fully. By that, I mean so modules can take advantage of the drag and drop.

This would have really helped when setting up forms. I would also like to use this for the download gallery.

Would be an easy fix like adding another pagetype or is there more coding envolved? I would try to firgure it out myself but no time right now and I firgured the programmer would know better then I.
Logged
nonplus
Pending Apprentice Baker
**
Offline Offline

Posts: 10


« Reply #19 on: April 20, 2006, 09:17:56 PM »

If this were properly integrated with WB, it could probably be designed in a fairly generic way to make it usable with other pages and modules, not unlike how the move up/down buttons work.  The beck-end is pretty trivial, it's the UI part of it thats's hard.

To make this feasible, it would require a common way of generating the HTML for tabular and hierarchical data.  I've looked at three areas: "Pages", "Sections" and "Chapters" (in the Manual module) and they all do it differently.  And the "Pages" HTML is malformed, to begin with (duplicate IDs, ULs that are direct descendants of other ULs, etc.) so my script first has to fix everything up before it can even start thinking about drag-and-drop.

Maybe the WB developer(s) can look at this as an incentive to design the WB3 UI in a more consistent and standards compliant way. It should then be AJAX-fiable without too much effort.  cool

Otherwise, drag-and-drop would have to be hand coded for each page, and that's definitely not something for the faint of heart...
Logged
Pages: [1] 2 3 4 Go Up Print 
Jump to:  

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