Gossamer Forum
Home : Products : Gossamer Links : Discussions :

multiple category selection

Quote Reply
multiple category selection
how can i manage, that the owners of new entries have the ability to submit their link in up to three categories/subcategories in one process.

i really need this !!!!!!!!

can anybody help ?


Regards,
Manu

Shopping Portal Shop-Netz.de® | Partnerprogramme | Flugreisen & Billigflüge | KESTERMEDIA e.K. | European Affiliate Marketing Forum.
Quote Reply
Re: [ManuGermany] multiple category selection In reply to
Without changing the code, I _think_ this could be done in javascript, where you would want to change the drop-down box to a multi-select field, (that might need a code change) then use a javascript routine to do it.

I really don't use javascript (except what is provided to me) so I really can't help, but a good example implementation for large sites, would be how ebay does it.

You use several linked windows to click successively deeper until you get to a "node". Each window loads only what it has to, for that level, rather than the whole database.

You would use one window per catagory you allow -- ie: 3 categories, would need 3 "top level" windows.

On submit, the javascript stuffs them into the links variable for the back-end processing.

Over simplified, this is way down on my list of things to do ... it was added over a year ago <G> and because I don't do much JS, I don't know when I'll get to it.

Hopefully, someone else will :)


PUGDOG� Enterprises, Inc.

The best way to contact me is to NOT use Email.
Please leave a PM here.
Quote Reply
Re: [ManuGermany] multiple category selection In reply to
You have to change a line of code in add.cgi to have a multiselect category form in add.html:

in sub _category_list some lines below the following line

if ($CFG->{db_gen_category_list}) {

look for

Code:
$category = $html->get_all_categories(\@ids, 'CatLinks.CategoryID', 1);

and change it to

Code:
$category = $html->get_all_categories(\@ids, 'CatLinks.CategoryID', 5);

The '5' will provide a multiselect field with 5 lines.

Unfortunately you'll have to do this after every upgrade unless GT provides a builtin method to do this (or someone may write a plugin...)

Andreas
-------------------------------------------------
http://www.archaeologie-online.de
Quote Reply
Re: [Digger] multiple category selection In reply to
unfortunately this doesn't work no longer because the add.cgi and modify.cgi have been changed completely in LinksSQL 2.1.0

here is for example the complete add.cgi-content :

Quote:


#!/usr/bin/perl

# ==================================================================

# Links SQL - enhanced directory management system

#

# Website : http://gossamer-threads.com/

# Support : http://gossamer-threads.com/scripts/support/

# CVS Info : 087,070,084,086,086

# Revision : $Id: add.cgi,v 1.48 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 '/htdocs/.........../admin';

use Links qw/$CFG/;

use Links::User::Add;

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

Links::init('/htdocs/........../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_add', \&Links::User::Add::handle);

}



what can i do ?

i really need the multiple category-option by adding & modifing new links!

Regards,
Manu

Shopping Portal Shop-Netz.de® | Partnerprogramme | Flugreisen & Billigflüge | KESTERMEDIA e.K. | European Affiliate Marketing Forum.

Last edited by:

ManuGermany: Mar 3, 2002, 4:21 AM
Quote Reply
Re: [ManuGermany] multiple category selection In reply to
Sorry - the modification has to be done in /cgi-bin/links/admin/Links/User/Add.pm

Sly

Andreas
-------------------------------------------------
http://www.archaeologie-online.de
Quote Reply
Re: [Digger] multiple category selection In reply to
Cool Thanks, that`s it !

If someone else is going to do that changes, don't forget to change .../modify.pm

Regards,
Manu

Shopping Portal Shop-Netz.de® | Partnerprogramme | Flugreisen & Billigflüge | KESTERMEDIA e.K. | European Affiliate Marketing Forum.

Last edited by:

ManuGermany: Mar 6, 2002, 10:34 AM
Quote Reply
Re: [Digger] multiple category selection In reply to
While this generates the multi-select box, how does it limit it to 3 selections, not more?


PUGDOG� Enterprises, Inc.

The best way to contact me is to NOT use Email.
Please leave a PM here.
Quote Reply
Re: [pugdog] multiple category selection In reply to
Well, it doesn't Angelic

It does just what I said: allow selection of multiple categories when adding a link. Theoretically a user can select all categories, but anyway - you have to check if the user selected the right categories when you validate the link...

I do it this way for over a year now and in that time had really just a couple of submissions where users tried to add their link to much more categories than it would fit into. Smile

Andreas
-------------------------------------------------
http://www.archaeologie-online.de
Quote Reply
Re: [pugdog] multiple category selection In reply to
Perhaps with javascript you could check if a user selected mor than 3 items from the list on clicking the submit button.

If there are more than 3 items selected, display an error message to tell the user that he exceeded the allowed number of categories and don't allow him to proceed until he changed his selection.

That's just a quick idea I had after writing my last message, didn't try it Wink

Andreas
-------------------------------------------------
http://www.archaeologie-online.de
Quote Reply
Re: [Digger] multiple category selection In reply to
Of course, not foul-proof, if the user has disabled javascript...which there are more users than you think that do this...
========================================
Buh Bye!

Cheers,
Me
Quote Reply
Re: [Heckler] multiple category selection In reply to
This is why it would be cool if Alex would make the change in the central code :)

Make it a definable parameter -- Category_Submit_Limit -- 1 is normal, 2 or more creates the drop down multi select list.


PUGDOG� Enterprises, Inc.

The best way to contact me is to NOT use Email.
Please leave a PM here.
Quote Reply
Re: [Digger] multiple category selection In reply to
In Reply To:

$category = $html->get_all_categories(\@ids, 'CatLinks.CategoryID', 5);[/code] This creates the multiselect-field and I can select the categories, but when I later edit this link, there is only one category selected, so I need to select again each time I modify the link. Any idea?

--
Michael Skaide

http://www.cycle24.de

Quote Reply
Re: [Michael Skaide] multiple category selection In reply to
Hi.

This can be done by using a global.

Call it something like <%selected_cats%>

It will replace <%Category%> in include_form.html

sub {
my ($rec) = @_;
my $id = $rec->{ID};
my $db = $DB->table('CatLinks');
my @sids = $db->select ( ['CategoryID'], { 'LinkID' => $id } )->fetchall_list;
my $cat_db = $DB->table('Category');
$cat_db->select_options ('ORDER BY Full_Name ASC');
my $sth = $cat_db->select ( { 'Description' => 'SUB1' }, ['ID', 'Full_Name'] );
my $output;
$output .= "<SELECT MULTIPLE SIZE='5' name='CatLinks.CategoryID'>";
$output .= "<option value=''>-------</option>";
while (my ($cid,$name) = $sth->fetchrow_array) {
$output .= "<option value='$cid'";
foreach my $sid (@sids) {
if ($sid eq $cid) {
$output .= " selected";
}
}
$output .= ">$name</option>";
}
$output .= "</SELECT>";
return $output;
}

Cool

Warwick Evans

http://www.humorlinks.com