PerlHoo, Part III | 4 | WebReference

PerlHoo, Part III | 4

PerlHoo, Part III

The Solution

So, what we really need is a Web based tool to manage the submission process and to manage the directory in general. I decided to use a scheme similar to the one used in PerlHoo. That is, append the Web Directory category to the end of the URL. So for example, to manage the Computers category, the URL might be:
https://www.webreference.com/cgi-bin/perl/phadmin.pl/Computers

In the script, this information is read in the $reldir at line 41 which is returned by the path_info method of the CGI module. The magic though is the list_categories which starts at line 191. It's a recursive function that not only lists all new and current entries in the category you specify in the URL, but it also recursively lists all sub-categories as well. So, if you click on the above URL, not only do you see a list of entries for the Computer category, but also for Computers/Dynamic_HTML, Computers/E-Commerce, Computers/Graphics, Computers/Internet, and Computers/Perl.

Let's take a closer look at the interface. Goto: https://www.webreference.com/cgi-bin/perl/phadmin.pl. As you're looking at the administration interface, you'll notice that the category headers, ie. Home : Computers: Dynamic_HTML, are also linked to their respective categories. This allows you to drill up and down the directory tree at will. Go ahead, try it out now.

Using the Interface

So you know how it works, under each category, there are 4 columns for each entry:

  1. The name of the site. This should be short. It's linked to the edit form.
  2. The site description
  3. The URL
  4. A link to delete the record.
Depending on what's currently in the directory, you may see that the background of some entries are red, others are light orange. The entries in red are those that have been submitted, but not yet approved (the entries in new_perlhoo.csv). Entries in light orange are those that are in production.

Submitting and Approving an Entry

Let's walk through the process. First, submit a new entry in PerlHoo at https://www.webreference.com/cgi-bin/perl/3/perlhoo.pl. Pick whichever category you like. Don't add an entry to the top level though. Now view the new entry in phadmin.pl at https://www.webreference.com/cgi-bin/perl/phadmin.pl. The entry you just added should be highlighted in red in its respective category. Now, click on the title. You should be taken to a PerlHoo Entry screen which lists the info about the entry. Make any necessary edits and click on the Save Entry button. You will be taken back to the admin screen for the category you just added an entry to. You should see the entry you just modified, except it's background is now light orange. If you go back to PerlHoo, you should see the link in the directory.

Deleting an Entry

Deleting a new or existing entry is simple. Just click on the Delete link and poof, it's gone.

Editing an Existing Entry

To edit an existing entry (light orange), simply click on the title link, make the changes, and submit them.


https://www.internet.com

Produced by Jonathan Eisenzopf and
Created: July 1, 1999
Revised: July 2, 1999

URL: https://www.webreference.com/perl/tutorial/5/