Gossamer Forum
Home : Products : Gossamer Links : Discussions :

mods? Anyone trying yet?

Quote Reply
mods? Anyone trying yet?
I've been staring at this stuff for awhile, and I'm in the position of feeling suddenly very out of my comfortable pond.

By now I've figured out what is going on in most of the 1.1x modules, and program flow, but I am having trouble actually doing anything with it.

I figure, a good place to start is something really, really simple, but also useful.

For example, let's add back in the "Attachments".

To do that, the first step is to create a file upload routine.

Let's make it simple, and add it to the Admin area, so the Admin can attach a file (logo) to a link that has paid for one (or done whatever).

As simple as the first step will be, we have to do a few things that were not in the docs, such as add in user parameters.

1) We need to present the admin with a "setup" option, to pick the upload directory.
2) We need to then to install the module, and set up the "hooks" and interfaces on the admin screen.
3) We need an option to upload file (which will prompt with a box, and default file path)
4) We need the hook into the file upload routine (or we need to write a generic one if there isn't one).
5) We need to pass the file from the local disk, to the server, then into the upload directory.

That is the first step-- ie: setting up the module, and uploading the file.

Second step:

1) A routine to do the processing on the file --integrity, format, size, etc.
2) A routine to "move" the file to whatever directory we need it in.
3) A routine to re-name, delete, or otherwise modify the file.
4) A hook on the Add/Validate/Modify area to "attach" a file to a link.

Third Step:

Once the above is done, the skelleton exists. Then, actual features can be added. If I can get to this step, I'll be sooooooo happy!


PUGDOGŪ Enterprises, Inc.
FAQ: http://postcards.com/FAQ

Quote Reply
Re: mods? Anyone trying yet? In reply to
Step 1 would involve:

Adding a Admin Menu choice that said:

Attach File => admin.cgi?do=plugin&plugin=Attachments&func=attach

this will run the attach() function in your Attachments plug in.

The add a User Option:

upload_directory => ''

which will make an option available to the user to set the upload directory.

Then you just need to make two subroutines, an attach() which displays the form, and a process() (can be named anything) which will process the upload and return the results.

There are no hooks required for this, as you are not hooking into any Links SQL code.



Gossamer Threads Inc.
Quote Reply
Re: mods? Anyone trying yet? In reply to

That helped a lot :)

A question...on the installer.

What needs to be done to install it? What do I need to check for?

And, FWIW, I'm not running under mod_perl (it makes development more difficult) so all I need to do is update the modules, I don't have to worry about server and module reloads and restarts. Once the code is debugged, I'll try it under mod_perl, but it just seems too much complexity at first, and potential for bugs that go above and beyond getting the code to just work <G>

Also, the "AUTO GENERATE" for the "install" routine doesn't do anything.

PUGDOGŪ Enterprises, Inc.
FAQ: http://postcards.com/FAQ

Quote Reply
Re: mods? Anyone trying yet? In reply to
It would be great if the users could add/modify their own images for their link as well.

Jim Murray