Author Topic: New Module: Javascript Admin  (Read 57445 times)

nonplus

  • Guest
New Module: Javascript Admin
« 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.  8-) It enhances the WebsiteBaker 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:
Only registered users can see contents. Please click here to Register or Login.
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 »

Offline maxbrax

  • Posts: 67
  • Gender: Male
Re: New Module: Javascript Admin
« Reply #1 on: April 17, 2006, 10:59:38 AM »
 :|
sorry i have installed this module but it not work :-(

the administation setting respond with this message:

--------------------------------------------------------------------------------------------------------------
The module has not yet been integrated into WebsiteBaker. 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 »

nonplus

  • Guest
Re: New Module: Javascript Admin
« 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 »

Offline Argos

  • Posts: 2542
  • Gender: Male
    • Argos Media
Re: New Module: Javascript Admin
« Reply #3 on: April 18, 2006, 12:46:11 PM »
Sounds very nice! Will try it later today...
Jurgen Nijhuis
Argos Media
Heiloo, The Netherlands
----------------------------------------------------------------
Please don't request personal support, use the forums!

Offline bartvdb

  • Posts: 6
Re: New Module: Javascript Admin
« Reply #4 on: April 18, 2006, 03:07:52 PM »
:|
sorry i have installed this module but it not work :-(

the administation setting respond with this message:

--------------------------------------------------------------------------------------------------------------
The module has not yet been integrated into WebsiteBaker. 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.

Offline valerie

  • Posts: 156
    • Robinson Communication Consultants
Re: New Module: Javascript Admin
« 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:
Only registered users can see contents. Please click here to Register or Login. or this?
Code:
Only registered users can see contents. Please click here to Register or Login. or something else?

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

Thanks!
http://www.robcomm.net
--editing and proofreading for American English
--print and web publication management
--graphic and web design, including original photography

nonplus

  • Guest
Re: New Module: Javascript Admin
« 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:
Only registered users can see contents. Please click here to Register or Login.

Offline Vincent

  • Posts: 376
  • Gender: Male
    • websites voor ondernemers
Re: New Module: Javascript Admin
« Reply #7 on: April 19, 2006, 01:28:24 PM »
Pity it doesn't work  :| in my 2.6.2 version, seems very promising. Hope you can make it work for all of us.
Vincent

Offline kickarse

  • Posts: 64
Re: New Module: Javascript Admin
« 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:
Only registered users can see contents. Please click here to Register or Login.
« Last Edit: April 19, 2006, 04:29:51 PM by kickarse »

Offline centran

  • Posts: 76
Re: New Module: Javascript Admin
« 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.

nonplus

  • Guest
Re: New Module: Javascript Admin
« 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.  :|

Is anyone (beside me, that is) having success with this module?

Offline centran

  • Posts: 76
Re: New Module: Javascript Admin
« 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 »

nonplus

  • Guest
Re: New Module: Javascript Admin
« 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:
Only registered users can see contents. Please click here to Register or Login.
with the following:

Code:
Only registered users can see contents. Please click here to Register or Login.
BTW, this should work in either 2.6.2 or 2.6.3 (I haven't tested it in anything older than that).

Offline Vincent

  • Posts: 376
  • Gender: Male
    • websites voor ondernemers
Re: New Module: Javascript Admin
« Reply #13 on: April 20, 2006, 09:09:42 AM »
The good news: it did the trick!  :-) :-) :-)
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 »

Offline maxbrax

  • Posts: 67
  • Gender: Male
Re: New Module: Javascript Admin
« Reply #14 on: April 20, 2006, 09:35:10 AM »
 :lol: :lol: :lol:

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

Offline kibmcz

  • Posts: 221
  • Gender: Male
    • KComputer  Zone
Re: New Module: Javascript Admin
« 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:
Only registered users can see contents. Please click here to Register or Login.
with the following:

Code:
Only registered users can see contents. Please click here to Register or Login.
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 »

nonplus

  • Guest
Re: New Module: Javascript Admin
« Reply #16 on: April 20, 2006, 01:36:24 PM »
Everyone - thanks for helping me fix this.  It was driving me nuts...   :-)

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.

Offline valerie

  • Posts: 156
    • Robinson Communication Consultants
Re: New Module: Javascript Admin
« 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!
http://www.robcomm.net
--editing and proofreading for American English
--print and web publication management
--graphic and web design, including original photography

Offline centran

  • Posts: 76
Re: New Module: Javascript Admin
« 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.

nonplus

  • Guest
Re: New Module: Javascript Admin
« 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.  8-)

Otherwise, drag-and-drop would have to be hand coded for each page, and that's definitely not something for the faint of heart...

pcwacht

  • Guest
Re: New Module: Javascript Admin
« Reply #20 on: April 20, 2006, 11:01:37 PM »
Since you allready master the trick

What are the requirements to 'easaly' integrate the ajax stuff?


Maybe if you can write some guidelines the core developers and the module makers can use it.


John

nonplus

  • Guest
Re: New Module: Javascript Admin
« Reply #21 on: April 21, 2006, 04:10:04 AM »
Maybe if you can write some guidelines the core developers and the module makers can use it.
I suppose I could tackle that.  I'm actually not all that familiar with what the "popular" modules are.  What are some of the most common ones that could benefit from drag-and-drop?  I'll take a look at their UI and try to come up with a common approach that would work for all (or most) of them.

   - Stepan

Offline centran

  • Posts: 76
Re: New Module: Javascript Admin
« Reply #22 on: April 21, 2006, 04:30:37 AM »
...  What are some of the most common ones that could benefit from drag-and-drop?  ...

The built in ones can benefit. The form module and the news.
There are upgraded verisions to those core modules that add some enhanced features. However, I am pretty sure the list generating code is the same between the core module and upgraded module. The upgrades had nothing to do with the list.

Other addon modules that I know have lists are
Download gallery and Image gallery.  I think the download gallery was modified off of the image gallery, so that code may be similar.

The modules are here.
http://addons.WebsiteBaker.org/modules/

I am not sure if there are any other that use lists.

nonplus

  • Guest
Re: New Module: Javascript Admin
« Reply #23 on: April 21, 2006, 04:47:01 AM »
I've checked some of them out.  It seems that most of them are pretty similar, just a flat table with a row per entry.  The only exceptions I noticed are the Manual (which uses a flat table to represents a 2-level hierarchy) and the main Pages (which uses nested lists).

I could generalize the drag-and-drop Javascript code for the common forms pretty easily.  The module developer would have to add a particular class name to the table (for example "wb_dragdrop") and implement a "move_to.php" script similar to the existing "move_up/down.php" scripts.  The move_to should be implemented in the class.order.php file.

Ryan, please PM me if you'd like me to work on this integration.

Stefan

  • Guest
Re: New Module: Javascript Admin
« Reply #24 on: April 21, 2006, 10:53:29 AM »
I have just now noticed this thread.
Fantastic work, nonplus! Unbelievable that this modification is possible with only a single line changed in the core files!
I'd love to see this integrated into 2.7.0 and I'd love to see you on the development team. Thanks for the contribution!