Gossamer Forum
Home : Products : DBMan SQL : Discussion :

Re: [kevinws] I see hidden fields

Quote Reply
Re: [kevinws] I see hidden fields In reply to
I want to suppress the display of some fields in the long display for default user trying to list all records. For a list all like

........db.cgi?do=search_results&db=mydb&keyword=*&fm=long&uid=default

I have two databases, in one all fields that I do not want to display are hidden, and in the second case the fields fall in three categories -

1. Timestamp field
2. Hidden Fields
3. Some fields that are not hidden

To make this work, it is being suggested in this old (2003) post that the templates needs to customized. Whereas reading through the code specifically of
package GT::SQL::Display::HTML (which is given in file /admin/GT/SQL/Display/html.pm), I find that probably this package has all the code required to achieve that I want. Refer to the attributes setting at the top of this file (I have pasted that below).

$ATTRIBS = {
db => undef,
input => undef,
mode => '',
code => {},
font => $FONT,
hide_timestamp => 0,
hide_download => 0,
file_field => 0,
file_delete => 0,
file_use_path => 0,
view_key => 0,
defaults => 0,
search_opts => 0,
values => {},
multiple => 0,
table => 'border=0 width=500',
tr => '',
td => 'valign=top align=left',
extra_table => 1,
col_font => $FONT,
val_font => $FONT,
hide => [],
skip => [],
view => [],
disp_form => 1,
disp_html => 0,
url => $ENV{REQUEST_URI},
};


Reading through this and the code right at the end - I felt that by changing some the following

hide_timestamp => 0,
hide => [],
skip => [],
view => [],

I might be able to achieve it without modifying any template at all, only by changing these setting. Also there is a sub _skip(), which is used to skip hidden fields etc. Here is the sub from this package-

sub _skip {
# -------------------------------------------------------------------
my ($self, $col) = @_;
# Skip timestamps, any fields requested to be skipped or any hidden fields (hidden forms appended at bottom).
return 1 if ($self->{hide_timestamp} and $self->{cols}->{$col}->{time_check});
return 1 if ($self->{skip} and (grep /^$col$/, @{$self->{skip}}));
return 1 if ($self->{hide} and (grep /^$col$/, @{$self->{hide}}));
return 0;
}

Has anyone used this approach to hide the display of hidden fields and timestamps fields. I thought this might be usefully to many users as most would not like to display hidden fields and timestamps. Moreover, this would be a much cleaner solution to this whole problem of hiding the Hidden Fields and timestamps, in comparison to template customization!!

I would appreciate if someone can help me in leveraging sub _skip() and other settings given above to achieve this, or share with us your experience if have tried this approach.

Thanks

TIF

Subject Author Views Date
Thread I see hidden fields jaspercram 11824 Oct 14, 2002, 4:07 AM
Thread Re: [jaspercram] I see hidden fields
timbo 11453 Aug 28, 2003, 8:36 AM
Post Re: [timbo] I see hidden fields
ecamty 11411 Sep 3, 2003, 11:10 AM
Thread Re: [jaspercram] I see hidden fields
YoYoYoYo 11453 Sep 3, 2003, 11:50 PM
Thread Re: [YoYoYoYo] I see hidden fields
timbo 11403 Sep 14, 2003, 2:30 AM
Post Re: [timbo] I see hidden fields
jai 11360 Sep 16, 2003, 4:10 PM
Thread Re: [YoYoYoYo] I see hidden fields
kevinws 11398 Sep 15, 2003, 1:03 PM
Thread Re: [kevinws] I see hidden fields
jai 11367 Sep 16, 2003, 3:57 PM
Post Re: [jai] I see hidden fields
kevinws 11346 Sep 17, 2003, 6:50 AM
Thread Re: [jai] I see hidden fields
kevinws 11341 Sep 17, 2003, 2:36 PM
Thread Re: [kevinws] I see hidden fields
kevinws 11356 Sep 17, 2003, 2:47 PM
Thread Re: [kevinws] I see hidden fields
jai 11374 Sep 17, 2003, 4:38 PM
Thread Re: [jai] I see hidden fields
kevinws 11341 Sep 18, 2003, 8:10 AM
Thread Re: [kevinws] I see hidden fields
jai 11351 Sep 18, 2003, 3:56 PM
Thread Re: [jai] I see hidden fields
kevinws 11316 Sep 19, 2003, 6:39 AM
Post Re: [kevinws] I see hidden fields
TIF 10837 Apr 3, 2006, 8:05 PM
Post Re: [jaspercram] I see hidden fields
kevinws 11377 Sep 15, 2003, 1:07 PM