1
jegelstaff
Perl script for cloning WF-Channel

Hi all,

My company really likes the WF-Channel module. It's got the simplicity of something like TinyContent/TinyD, but it's got the group permissions structure that more heavy duty modules have too. Basically it's a great way to embed HTML pages in a XOOPS site when you aren't looking for article management and just want the content up there on the screen.

But there is one big problem: You can't have more than one Main Menu entry; all your pages are part of the same series of pages. For example, you can't have some pages that are part of a section called "How to use this site" and have some other pages that are part of a different section called "Information About Giaks"

The solution would be to clone the module. But that takes some time and care, right? All that file renaming and search and replace operations in multiple files....

Enter clone.pl

clone.pl is a simple little perl script that will make a copy of the wfchannel module that is ready to be uploaded to your server and run as a separate module from any other copy of wfchannel that you might have running already.

You can grab a copy of the script here: (right-click and select Save link target)
http://www.freeformsolutions.ca/clone.pl

Here's how to use it (there are a few things that you have to get right or else it won't work).

1. Make a copy of the wfchannel folder on your local computer (the idea is the modify this copy and then upload it to your server).

2. Rename the copy of the wfchannel folder that you just made. Don't forget what you renamed it to!

3. Put a copy of clone.pl inside the renamed wfchannel folder you just made.

4. Run clone.pl with two command line arguments. The first argument is the name of the folder (it must be the exact name of the folder), the second is a human-readable form of the module name. For example:

perl clone.pl aboutus "About Us"

5. If all goes according to plan, you'll get a message like this: "Cloning complete. About Us module ready for upload."

That's it. Upload the new module and install it and away you go. Don't forget to CHMOD the permissions on the folders that require that, as per the wfchannel readme.

If you have any questions or run into trouble, please reply to this post. Thanks and good luck!

--Julian

============

Notes:

This script was written using ActivePerl for Windows. I think it will run okay on Linux, but I can't say for sure. If you have problems, it's probably related to the syntax for the paths to files, which should be easy enough to modify and fix.

If you want to run this on a Windows computer and aren't sure how, get a copy of ActivePerl here:
http://www.activestate.com/Products/ActivePerl/

Install that and then you will be able to run perl scripts from a DOS Prompt box (not sure how that works on XP, sorry).

This script is meant to be run from the new folder you make. I believe if you run it from another location, the paths will be screwed up, depending on your operating system, version of perl, etc. What this means is, make sure the new folder that you made is the active folder when you run the script, ie: if the folder you made is called c:\xoops\modules\aboutus then make sure the DOS prompt is c:\xoops\modules\aboutus> when you run the script.

Or to put it another way, this is good:

c:\xoops\modules\aboutus>perl clone.pl aboutus "About Us"

While this is bad:

c:\>perl c:\xoops\modules\aboutus\clone.pl aboutus "About Us"

This script does not do anything with the upgrade folder since the idea is that you're starting a new wfchannel module from scratch.

Of course, make sure that your new folder name has no spaces!

The admin icon for the module looks exactly like the wfchannel icon, and says wfchannel on it. Not much a perl script can do about that (without all kinds of extra work), but the module name does change to reflect the human readable name you pass in at the command line so that makes it a little easier to tell your different copies apart.

To make a new icon, get a copy of the Bit3 font that is used for the XOOPS module icon text (or if you don't care about it matching, use any old font), and open up the .png file that contains the icon and edit it.

Login

Who's Online

217 user(s) are online (148 user(s) are browsing Support Forums)


Members: 0


Guests: 217


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: May 31
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits