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