Gossamer Forum
Home : Products : Gossamer Links : Discussions :

excluding category in dropdown menu

(Page 1 of 2)
> >
Quote Reply
excluding category in dropdown menu
How to limit users from submitting to main/root category or selected categories?
I read a method of doing this few months back, was not successful with it...
http://gossamer-threads.com/...search_string=canAdd

where you add "canAdd" field in Category in database with value Yes/No

if anyone able to make it work in 3.0.0, please let me know...
I remember Andy helped out with that last time. Smile
Quote Reply
Re: [jasy007] excluding category in dropdown menu In reply to
btw, I am also looking for a way to allow user to suggested for new category... while adding new link if he does not find any suitable category.

I think both features should have been included with LinkSQL 3.0.0 Unsure

Last edited by:

jasy007: Apr 9, 2005, 10:39 AM
Quote Reply
Re: [jasy007] excluding category in dropdown menu In reply to
3rd recommend feature would be in 3.0.0 to have verify automatically email users after checking their links & finding any problem with problem status like say...
link is 404
Subject: unable to find the page
message: your... xxx.com is having problem... it showed page not found etc..etc...etc.. please login & fix it or will be deleted.
here is your userid/password for login.

.... something on this line.
Quote Reply
Re: [jasy007] excluding category in dropdown menu In reply to
I was looking in Plugin section of LinkSQL 3.0.0. Can someone please check the available plugins as some may not be relevant for 3.X version. if would be great, if LinkSQL only shows plugins compatible with the version of LinkSQL running... instead of everything listed.
Quote Reply
Re: [jasy007] excluding category in dropdown menu In reply to
Good wishes & suggestions.
Might be possible that some features was already implemented in some earlier plugins.

Category exclude was one of the features I wanted to include into my future plugins.
Also a complex category suggestion system could be implemented in the future into one of my plugins.
Unfortunately I'm busy until the end of summer, so I rarely take new jobs.

I can tell you, that my DirName converter plugin is incompatible with LinksSSQL v3.0.0, as an important feature was removed/changed so the plugin will need to be updated. The license will change to commercial. I will update it, if there will be a demand for update.

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: [jasy007] excluding category in dropdown menu In reply to
This is much simpler in 3.0 than it used to be. Place <%if canAdd eq 'Yes'%> around your category loop in include_form.html
Quote Reply
Re: [Alba] excluding category in dropdown menu In reply to
In Reply To:
This is much simpler in 3.0 than it used to be. Place <%if canAdd eq 'Yes'%> around your category loop in include_form.html
Hi can you be more descriptive as I am not a pro... what exact line I need to replace... other than adding "canAdd" as a new field in database.

Thanks!Crazy
Quote Reply
Re: [jasy007] excluding category in dropdown menu In reply to
Sorry- was tired when I wrote that.

Look at the include_form.html template & add the lines in bold as below

<%loop category_loop%>
<%if canAdd eq 'Yes'%>
<option value="<%ID%>"<%if selected%> selected="selected"<%endif%>><%'&nbsp;&nbsp;' x $CatDepth%> <%Name%> </option>
<%endif%>
<%endloop%>


If you have a lot of same-name subcategories, you may need to replace <%Name%> with <%Full_Name%>
Quote Reply
Re: [Alba] excluding category in dropdown menu In reply to
Sorry, I was unable to find... my templete says...


<%--
File : include_form.html
Description : This is an included file that displays an add
or modify link form. You will need to update this
if you add a custom column to the Links table that you
want users to be able to submit.
Tags : All the tags on the add/modify page are available
here.
--%>
<tr><td valign="top"><%body_font%>Title: </font></td>
<td>
<input class="button" name="Title" value="<%if Title%><%Title%><%endif%>" size="50">
</td></tr>
<tr><td valign="top"><%body_font%>URL: </font></td>
<td>
<input class="button" name="URL" value="<%if URL%><%URL%><%else%>http://<%endif%>" size="50">
</td></tr>
<tr><td valign="top"><%body_font%>Category: </font></td>
<td>
<%Category%>
</td></tr>
<tr><td valign="top"><%body_font%>Description: </font></td>
<td>
<%body_font%><textarea class="button" name="Description" rows="3" cols="42"><%if Description%><%Description%><%endif%></textarea></font>
</td></tr>
<tr><td valign="top"><%body_font%>Contact Name: </font></td>
<td>
<input class="button" name="Contact_Name" value="<%if Contact_Name%><%Contact_Name%><%endif%>" size="40">
</td></tr>
<tr><td valign="top"><%body_font%>Contact Email: </font></td>
<td>
<input class="button" name="Contact_Email" value="<%if Contact_Email%><%Contact_Email%><%endif%>" size="40">
</td></tr>


if different from above for mint... please post the whole templete... i am using 3.0.0 version.


Thanks!

Last edited by:

jasy007: Apr 10, 2005, 8:16 PM
Quote Reply
Re: [jasy007] excluding category in dropdown menu In reply to
Admin path: templates/mint/include_form.html
File size: 1404 bytes
Status: Default system template
Last modified: Sat Jan 11 2003 12:01:31

Last edited by:

jasy007: Apr 10, 2005, 8:17 PM
Quote Reply
Re: [jasy007] excluding category in dropdown menu In reply to
I suppose Alba was pointing to replace <%Category%> with loop code.

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] excluding category in dropdown menu In reply to
sorry... still missing out... can you please modify the above templete & post the whole.

Thanks!
Quote Reply
Re: [jasy007] excluding category in dropdown menu In reply to
I understood you were using GLinks 3.0- but the template you show is 2.x This template needs a global.

I suggest you have a look at the 3.0 templates and decide if you want to switch to the new template set for include_form.html or stick to the 2.x set before making any changes.
Quote Reply
Re: [Alba] excluding category in dropdown menu In reply to
thanks, I most likely start customizing & copying over my settings from old 2.X (current) templates to new 3.X ones... it may be days...

btw... thanks... it makes sense NOW... as I was unable to find those in my current templates...

Smile

Last edited by:

jasy007: Apr 11, 2005, 4:19 PM
Quote Reply
Re: [jasy007] excluding category in dropdown menu In reply to
Sorry to bring up a three year old thread.
I'm now on Links v.3.2.0 and love the new Ajax method of selecting the categories when adding a link i.e. I have db_gen_category_list set to generate the fancy Ajax category tree.

I already have in each of the 4,000 categories the variable: 'Can_add' with Yes or No to restrict users from adding their link (legacy from Links v.2.2)

I have added these tags into two places (at a guess) to restrict the categories shown into the template 'include_form.html', but this has no affect on the Ajax tree. Could anybody help? Below is a cut from the relevant part of the 'include_form.html';


Code:
<div class="row<%unless category_loop_selected%> required<%endunless%> clear">
<label for="CatLinks.CategoryID" class="name">Category:<%unless category_loop_selected%> <span>*</span><%endunless%></label>
<div class="value wrappedtext">
<%~if config.db_gen_category_list == 2%>
<script type="text/javascript" src="<%config.build_static_url%>/treecats.js"></script>
<%~set selected_cats = Links::Tools::category_list_selected%>
<%~loop selected_cats%>
<input type="hidden" name="CatLinks.CategoryID" value="<%escape_html ID%>" />
<%~endloop%>
<noscript>
<ul class="categories">
<%~loop selected_cats%>
<li><%Full_Name%></li>
<%~endloop%>
<%~if not selected_cats.length%>
<li><%Links::language('ADD_SELCAT')%></li>
<%~endif%>
</ul>
</noscript>
<div id="treecats"></div>
<script type="text/javascript">
var tc = new treecats({ <%-- selectionMode : 'multiple', --%> cgiURL : '<%config.db_cgi_url%>', imageURL : '<%config.build_static_url%>/<%t%>/images' });
tc.load();
</script>
<%~elsif category_loop_selected%>
<%~if category_loop.length > 1%>
<ul class="categories"><%loop category_loop%><li><%Full_Name%><input type="hidden" name="CatLinks.CategoryID" value="<%escape_html ID%>" /></li><%endloop%></ul>
<%~else%>
<%if Can_add eq 'Yes'%>
<%loop category_loop%><%Full_Name%><input type="hidden" name="CatLinks.CategoryID" value="<%escape_html ID%>" /><%endloop%>
<%endif%>
<%~endif%>
<%~else%>
<select id="CatLinks.CategoryID" name="CatLinks.CategoryID">
<%~loop category_loop%>
<%if Can_add eq 'Yes'%>
<option value="<%escape_html ID%>"<%if selected%> selected="selected"<%endif%>><%'&nbsp;&nbsp;' x $CatDepth%><%Name%></option>
<%endif%>
<%~endloop%>
</select>
<%~endif%>
</div>
</div>
Quote Reply
Re: [Piers1] excluding category in dropdown menu In reply to
Hi,

Mmm.. I'm not sure exaclty how that could be done via the tempalte code - what may be a better option, is a plugin - which hooks in on the PRE add_link hook, and then checks the category ID(s) they selected - and if any of those categoires, are not allowed to be selected - it gives them an error message on the add page, telling them they can't select that category.

If thats ok, I'll see if I can put a simple plugin together to do that for you =) (free of course, assuming I can get it working =))

Cheers

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: [Piers1] excluding category in dropdown menu In reply to
Hi,

Well, I had a bit of free time - so thought I would just write it anyway - even if you don't use it, I'm sure someone will Tongue

Find it attached (just install, and then any categories with Can_Add => 0 will not let them add to that category (will show them an error message, and let them choose a new category)

Hopefully it will work for you (even just as an intermeriory, until you get it working on the AJAX stuff itself Smile)

Cheers

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] excluding category in dropdown menu In reply to
Andy,

Oddly that was the idea I had been thinking about.
I think you are right, you need to see ALL of the categories to make browsing the tree understandable, and having an error message appear for the ones that are forbidden would work well - so I'd love to see this.

Would there be anyway of changing the colours of the tree to show restricted categories? This would be an aid to allow people to easily see which ones they could add to.

Cheers,

Piers
Quote Reply
Re: [Piers1] excluding category in dropdown menu In reply to
Hi,

Quote:
Oddly that was the idea I had been thinking about.
I think you are right, you need to see ALL of the categories to make browsing the tree understandable, and having an error message appear for the ones that are forbidden would work well - so I'd love to see this.

Its in my post above =) (only took about 10 mins to write LOL)

Quote:
Would there be anyway of changing the colours of the tree to show restricted categories? This would be an aid to allow people to easily see which ones they could add to.

I think Adrain may be able to help on the color thing - I'm afraid I havn't really played around too much with the AJX stuff, in terms of changing stuff in it (I've used it, but just never had a need to edit the output =))

Cheers

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] excluding category in dropdown menu In reply to
Hi Andy,

Plugin worked well - thank you.

Cheers,

Piers
Quote Reply
Re: [Piers1] excluding category in dropdown menu In reply to
Yikes, a little premature perhaps.

The plugin stops all categories from being added to. I edited all references I could see in the Plugin from 'Can_Add' to 'Can_add' (as this is what my column is called) but no luck.

The error message flags up ok.

Do I need to add anything into the templates or should this be plug and forget?

Cheers,
Piers
Quote Reply
Re: [Piers1] excluding category in dropdown menu In reply to
Hi,

I think its cos you are using Can_add => Yes/No, where as I am using 0/1 .. try changing:

Code:
Can_Add => 1

..to:

Code:
Can_add => 'Yes'

That should sort it =)

Cheers

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] excluding category in dropdown menu In reply to
I promise I've tested it this time properly and it does work,
Thank you again for your patience,

Best wishes,
Piers
Quote Reply
Re: [Piers1] excluding category in dropdown menu In reply to
Hi Andy,

The plugin works ok when a user calls up the form, but when I try and add a link from the admin form it crashes.....

I get this error message:

Undefined subroutine &Links::SiteHTML::display called at /home/stagelink/public_html/cgi-bin/admin/Plugins/Check_If_Allowed.pm line 52.

Line 52 from the plugin is the print Links::SiteHTML::display as below;

Code:
if ($errors[0]) {
print $IN->header;
print Links::SiteHTML::display('add',{ error => qq|<ul><li>| . join('</li>',@errors) . q|</ul>| } );
exit;
}

I add quite a few links from the admin forms, is there anything I can change to stop this crashing?

Cheers,

Piers
Quote Reply
Re: [Piers1] excluding category in dropdown menu In reply to
Hi,

Do you want to be allowed to add links to restricted categoies from the admin panel?\

If so, just add this:

Code:
use Links::SiteHTML;

..right after:

Code:
use Links qw/:objects/;

If you want to stop it checking from the admin panel, try adding this:

Code:
if (!$N->param('add')) {
return @args;
}

...right before:

Code:
my @cats = $IN->param('CatLinks.CategoryID');

Hopefully one of those will work for you =)

Cheers

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!
> >