Gossamer Forum
Home : Products : Gossamer Links : Development, Plugins and Globals :

The USER is allowed to ADD CATEGORIES!!

Quote Reply
The USER is allowed to ADD CATEGORIES!!
I guess this the right forum for modifications.

I need to allow the USER, when logged in, to ADD CATEGORIES under the only category that I have; therefore, I created a file called addcategory.cgi, but the user still going through the Editor's Login checking when trying to add a category.

Can someone please tell me how to modify this file to allow the user to add categories:

Code:
#!/usr/local/bin/perl
# ==================================================================
# Links SQL - enhanced directory management system
#
# Website : http://gossamer-threads.com/
# Support : http://gossamer-threads.com/scripts/support/
# CVS Info : 087,071,086,094,085
# Revision : $Id: browser.cgi,v 1.22 2001/12/30 19:33:05 alex Exp $
#
# Copyright (c) 2001 Gossamer Threads Inc. All Rights Reserved.
# Redistribution in part or in whole strictly prohibited. Please
# see LICENSE file for full details.
# ==================================================================

use strict;
use lib '/home/www/mydomain/cgi-bin/links/admin';
use Links qw/$CFG/;
use Links::User::Editor;

local $SIG{__DIE__} = \&Links::fatal;

Links::init('/home/www/mydomain/cgi-bin/links/admin');
Links::init_user();

if (GT::Plugins->dispatch ($CFG->{admin_root_path} . '/Plugins', 'check_request', \&Links::check_request)) {
GT::Plugins->dispatch ($CFG->{admin_root_path} . '/Plugins', 'handle_editor', \&Links::User::Editor::handle);
}



Thank you for your help...

Mark
Quote Reply
Re: [Mark2] The USER is allowed to ADD CATEGORIES!! In reply to
Its not as easy as that...you need to add some hooks etc, .e it needs to be in a plugin. I'll see what I can knock up later today...

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [Andy] The USER is allowed to ADD CATEGORIES!! In reply to
Hello,
This what I am trying to accomplish. I think it will be a good idea to have
this blugin built into LINKS SQL and can be activated/deactivated by the Admin.

This is the algorithm that I am after.


Code:
1 - user logs in;

2 - from ANY CATEGORY menu bar, user clicks on "ADD CATEGORY" (new option);

3 - user fills out the Add Category form and submit it.

if (CATEGORY EXISTS) then
{
- (Fail) Page will appears with an Add Links hyperlink in it to allow
the user to add links to the EXISTING CATEGORY.
}

if (CATEGORY DOES NOT EXIST) then
{
- CATEGORY NAME will be created.
- (success) Page appears with Add Link hyberlink in it to allows user to add links
to the NEWLY CREATED CATEGORY.
}

NOTE:
The user does not need to the newly/existed category to add his/her
links into; instead the success/fail page of the ADD CATEGORY
submission form should have an ADD LINK HYPERLINK in it that if
clicked the ADD LINK FORM will be loaded with the CATEGORY NAME
that you are trying to add is displayed in it as the default category
in the add form.




Any help will be greatly appreciated.
Mark

Last edited by:

Paul: Sep 30, 2002, 7:56 AM
Quote Reply
Re: [Mark2] The USER is allowed to ADD CATEGORIES!! In reply to
Has a plug-in been developed for this yet?

I am also interested in letting people Add a category.


Sandra Roussel
Chonsa Group Design - Fresh Start Housing
Quote Reply
Re: [SandraR] The USER is allowed to ADD CATEGORIES!! In reply to
BUMP - looking for a solution please :D


Sandra Roussel
Chonsa Group Design - Fresh Start Housing
Quote Reply
Re: [SandraR] The USER is allowed to ADD CATEGORIES!! In reply to
Bump - still interested in this option


Sandra Roussel
Chonsa Group Design - Fresh Start Housing
Quote Reply
Re: [SandraR] The USER is allowed to ADD CATEGORIES!! In reply to
Hi,

Not sure if andy did this or not, but thinking about this, it shouldn't be too hard to have happen.

1) *ONLY* for registered users.

2) Keep track of the number of categories a user adds total, or per unit time, and limit it to maybe 5 per 24 or 48 hours _MINIMUM_

3) Give some users "Unlimited" add ability

4) Via a form, that mimics the add-new-category data, you take the submission to an add_cat.cgi script.
4a) That form takes the data and sends it to add_cat.cgi which formats it to the correct hash, then simply either inserts it, or calls the category_add routine in the GT code. From minor playing with the system, inserting a new category using "Insert" or "Add" seems to trigger the foreign key relations, and all the tables (tree, etc) are properly updated, automagically. When I did a category import from one table to another, I used "insert" (I think) and was surprised to see the Tree table updated along with it.


In its simplest form, it's only #4/4a, but that is a *bad* idea. Really.


PUGDOG� Enterprises, Inc.

The best way to contact me is to NOT use Email.
Please leave a PM here.
Quote Reply
Re: [pugdog] The USER is allowed to ADD CATEGORIES!! In reply to
Thanks Pupdog

Gonna give it a try.


Sandra Roussel
Chonsa Group Design - Fresh Start Housing
Quote Reply
Re: [SandraR] The USER is allowed to ADD CATEGORIES!! In reply to
Just thought I would let everyone know - I did get it to work using Andy's Multi-Categories Script.

I stripped the script to the bare bones and created different instructions, added a separate Password to access the feature.

Works like a charm.


Sandra Roussel
Chonsa Group Design - Fresh Start Housing
Quote Reply
Re: [pugdog] The USER is allowed to ADD CATEGORIES!! In reply to
In general is not a bad idea.

The bad idea is to let the user add categories without validation.
But at the point, when the admin CAN VALIDATE the categories, the idea becomes very good...

So such plugin would be useful in following way:
1) user suggests a main category or a subcategory. A subcategory is suggested by selecting an existing category and typing the suggested subcategory name.
2) admin will be able to validate, deny, rename a suggested category through the admin interface

Best regards,
Webmaster33


Paid Support
from Webmaster33. Expert in Perl programming & Gossamer Threads applications. (click here for prices)
Webmaster33's products (upd.2004.09.26) | Private message | Contact me | Was my post helpful? Donate my help...
Quote Reply
Re: [webmaster33] The USER is allowed to ADD CATEGORIES!! In reply to
Quote:
The bad idea is to let the user add categories without validation.
But at the point, when the admin CAN VALIDATE the categories, the idea becomes very good...

I agree. Has anyone developed this yet?

Safe swoops
Sangiro
Quote Reply
Re: [sangiro] The USER is allowed to ADD CATEGORIES!! In reply to
Don't know any currently.

Best regards,
Webmaster33


Paid Support
from Webmaster33. Expert in Perl programming & Gossamer Threads applications. (click here for prices)
Webmaster33's products (upd.2004.09.26) | Private message | Contact me | Was my post helpful? Donate my help...
Quote Reply
Re: [sangiro] The USER is allowed to ADD CATEGORIES!! In reply to
I'm working on something like this for the Models & Photographers Lite/Pro version.

Right now, the way it works is that the user isEditor for a category, and they have the ability to add/move/rename/etc a certain amount of categories under their area.

As I work on this, and pull the routines away from the javascript interface (it's now tied to using the browser system, pretty exclusively) I will be breaking up the routines, so that a template/html interface is used.

At that point, it would be possible to allow a user to add a category to another category (especially if the category that they were allowed to add to was known), and apply any filters/rules to that add.

If you want to make it a little more clear what you are looking for and how you need it to work, I can keep an eye to it.

I've spent the last few weeks working on the advanced profile system, and last night started working on the last piece (the display-only code). The security is really tight, which is what is taking so long, and I've moved a lot of functionality to the templates, so you could override the way the system works by writing a global, or a new function, without actually editing any of the "core" profile code. Basically, I've said the GT template parser is as powerful as PHP, if not more so, and I think I'm starting to prove it <G>

The next thing I need to work on is the categories for the users.

1) user logs in, sets up an account. Is initially flagged as "guest".
2) they validate their account, and are upgraded to registered user/Guest
3) they can edit/update a basic profile page (plus what's in community)
4) they are offered a selection of other profile pages they can set up (or you expand the basic profile pages)
5) in this system, that is models, photographers, artists, etc. In your system, it could be seller, buyer or mechanic, detail, bodywork, etc. Or, maybe even for sports or different characters in a MUD/RPG
6) once the new profile is set up, an attached set of flags is set, and the user is set up as that sort of person. Veiwing their profile you can see their different profile pages. etc.
7) at this time, a category is set up with their username. Under it, two default categories are set up, Galleries and Portfolio. The portfolio has some restrictions based on my own annoyance with certain sites, while the galleries are more freeform. This is how the MPG system works. But, in the generalized plugin, you'd define some rules, in a form or hash, and the system would set up the categories and set flags based on that. This *is* complex, which is why it's taking time, but it's going a lot faster than might be expected, due to the huge amount of pre-planning.
8) at this time the user is made editor of the category with their username, so they have a set of defaults they can do to that category and below. A restriction will be imposed such that a user can't delete or change the name of the Galleries and Portfolio category, but that might be loosened as I play with it.

So, since I need the user to be able to add/delete/manage categories, and I don't like to use a segment of code I can't maintain (eg: the category browser) I need to find another way to do it.

That way, might be very much what you need , or are looking for.


PUGDOG� Enterprises, Inc.

The best way to contact me is to NOT use Email.
Please leave a PM here.
Quote Reply
Re: [pugdog] The USER is allowed to ADD CATEGORIES!! In reply to
Isn't it too complex plugin for such an small task?

Mainly just 2 features are needed:
1) user suggestion of categories
2) Admin approval of category suggestions

Best regards,
Webmaster33


Paid Support
from Webmaster33. Expert in Perl programming & Gossamer Threads applications. (click here for prices)
Webmaster33's products (upd.2004.09.26) | Private message | Contact me | Was my post helpful? Donate my help...
Quote Reply
Re: [webmaster33] The USER is allowed to ADD CATEGORIES!! In reply to
No, this has to be automated, and done according to a set of rules, so security isn't breached, and the site isn't spammed with unwanted categories.

It's not really simple.


PUGDOG� Enterprises, Inc.

The best way to contact me is to NOT use Email.
Please leave a PM here.
Quote Reply
Re: [pugdog] The USER is allowed to ADD CATEGORIES!! In reply to
You can add special spam filtering features if you wish, but personally I likely will not need such features.
I have only a few hundred categories, which can be still handled manually.

Best regards,
Webmaster33


Paid Support
from Webmaster33. Expert in Perl programming & Gossamer Threads applications. (click here for prices)
Webmaster33's products (upd.2004.09.26) | Private message | Contact me | Was my post helpful? Donate my help...