eXtropia: the open web technology company
Technology | Support | Tutorials | Development | About Us | Users | Contact Us
Development resources
 ::   WebWare 2.1 (Perl)
 ::   WebWare 2.0 (Java)
 ::   Cool hacks
cool hacks
Address Book Search Enhancement  
sent in the following hack...

In short: the default view and Details of a view can use different display
fields.

The default view uses Address_book.cgi "-DISPLAY_FIELDS" to display fields
for the "search columns". Now, suppose you search, and use the "Comments"
field, and someone has added 4 pages of text to that textarea (or even 1
page).  Your default view will display that field, and in doing so, it
destroys the simple 1 line summary effect of the default view.

#1) Now, you remove the "comments" field (or any other field) from the
default "-DISPLAY_FIELDS"  so that it no longer diplays "Comments" field in
the "display columns".
#2) You add the removed fields to the new "-Details_Display_Fields" in cgi
and add the new parameters to the details view ("DetailsView.pm"), so these
fields will still display in "Details" view. That 4 pages of text will now
still display in "Details" view.



[in address_book.cgi I added "-DETAILS_DISPLAY_FIELDS"]
my @VIEW_DISPLAY_PARAMS =

-INPUT_WIDGET_DEFINITIONS =>etc., etc.,
-DISPLAY_FIELDS =>
( 
category 
bname 
url 
)], 
-DETAILS_DISPLAY_FIELDS => [qw( 
category 
bname 
merchandise 
)], 
etc., etc., etc., etc., 
[in DetailsView.pm I added "-DETAILS_DISPLAY_FIELDS" in:] 
package DetailsView; 
etc., etc., 
sub display { 
my $self = shift; 
my @display_params = @_; 

@_ = _rearrange([ 
-SESSION_OBJECT, 
etc., 
-DISPLAY_FIELDS, 
-DETAILS_DISPLAY_FIELDS, 
etc., 
-FIELDS_TO_BE_DISPLAYED_AS_IMAGES 
], 
[ 
-SESSION_OBJECT, 
etc., 
-DISPLAY_FIELDS, 
-DETAILS_DISPLAY_FIELDS, 
etc., 
-REQUIRE_MATCHING_GROUP_FOR_DELETIONS_FLAG, 
], 
@_); 

my $details_display_fields_ref = shift;