Gossamer Forum
Home : Products : Gossamer Links : Discussions :

[SUGGESTION->GT] FORM FIELD HIDING

Quote Reply
[SUGGESTION->GT] FORM FIELD HIDING
This has been done by a plug-in (I understand) by Yogi, and others have been playing around with it.

I am posting a new thread, as I would like to offer a suggestion for inclusion in the the base Links code as the ultimate solution to hiding certain database fields from editors (such as custom advertising fields etc).
The changes need to take place in browser.pm. I'll use the link add form as an example, but the other forms are essentially the same (very easy change). Just to re-iterate, this is not a suggestion to change your code, but rather a suggestion to GT Staff to change browser.pm for future versions of Links SQL.

In this example (Link add form), line 890-900 of Browser.pm (v2.1.1):

Code:
$self->print_template ( "browser_link_add_form.html",
{
navbar => $navbar,
Name => $category_info->{Name},
category_id => $category_id,
form => $h->form ( { defaults => 1, skip => [ qw /CatLinks.LinkID Timestmp/ ],
hide => [qw/ID isNew isChanged isPopular Status Date_Checked Timestmp/],
file_field => 1, file_delete => 1
}) . "<input type=hidden name='CatLinks.CategoryID' value='$category_id'>"
} );
}
Above is the current code.

I suggest two additional admin settings be created, which allow a list of columns to be hidden in both the Links and Category tables. The idea comes from your plugin list Yogi (thanks).

Admin->Settings->Misc: Hide table fields from editors:

Links_Table_Hide_List : isPopular, Advertising_Money..... etc
Category_Table_Hide_List : ImageURL, etc

This also alows the plugin developer to use these $CFG->{*_Table_Hide_List} settings on clients sites, when displaying table data. A big plus for developement.

The code would simply have the line changed where the hidden list is being made:

Code:
$self->print_template ( "browser_link_add_form.html",
{
navbar => $navbar,
Name => $category_info->{Name},
category_id => $category_id,
form => $h->form ( { defaults => 1, skip => [ qw /CatLinks.LinkID Timestmp/ ],
hide => $CFG->{Links_Table_Hide_List},
file_field => 1, file_delete => 1
}) . "<input type=hidden name='CatLinks.CategoryID' value='$category_id'>"
} );
}


Now to me, this looks like such an easy solution, and much easier for GT to place this into the core Links code than for users to muck around with plug-ins, module changes or other methods. It is also apparent that this is a much wanted feature going by the posts in various threads, and requests I have personally received from users of my plug-ins.

Maybe my method above might be slightly incorrect, I am not sure. But the idea is certainly there.


http://www.iuni.com/...tware/web/index.html
Links Plugins

Last edited by:

Ian: Jul 18, 2002, 10:50 PM
Quote Reply
Re: [Ian] [SUGGESTION->GT] FORM FIELD HIDING In reply to
Good idea. You probably want to do some checks on $CFG->{Links_Table_HIde_List}, plus pass it to the $h->form in the correct way (as an arrayref), so you could do

hide => _normalize_hide_fields($CFG->{Links_Table_Hide_List} => 'ARRAY');

or something like that.

This will solve the hide fields from editors problem, but there should still be a better way to access browser-specific functions through a plugin.

Ivan
-----
Iyengar Yoga Resources / GT Plugins
Quote Reply
Re: [yogi] [SUGGESTION->GT] FORM FIELD HIDING In reply to
Quote:
hide => _normalize_hide_fields($CFG->{Links_Table_Hide_List} => 'ARRAY');


Yes, thanks for making it correctSmile.

I hope GT are receptive to this inclusion.

Quote:
but there should still be a better way to access browser-specific functions through a plugin.
Perhaps this still needs to be addressed then


http://www.iuni.com/...tware/web/index.html
Links Plugins
Quote Reply
Re: [Ian] [SUGGESTION->GT] FORM FIELD HIDING In reply to
Staff? Any comments? I know you guys are busyUnsure


http://www.iuni.com/...tware/web/index.html
Links Plugins