home *** CD-ROM | disk | FTP | other *** search
- # $Id: Main.pl-raw,v 1.1 1996/07/26 05:17:04 pedja Exp $
- # Main.pl: converted from the original Main.wos
- # The original file contains the following notice:
- #
- # You may freely copy, distribute, and reuse the code in this example.
- # NeXT disclaims any warranty of any kind, expressed or implied, as to its
- # fitness for any particular use.
- #
- # Written by Jean-Marie Hullot
- #
- # The WebScript file for the Main component displays car information such
- # as price range, model name, and car types to allow the user to build
- # selection criteria.
-
- package WO::DodgeLite::Main;
- use WOPerl;
-
- @IVARS=qw(
- models model selectedModels
- prices price selectedPrices
- types type selectedTypes
- sortBys sortBy selectedSortOrder
- );
-
- %FLAGS=(
- 'rawSet' => 1,
- # 'traceSet' => 1,
- # 'traceGet' => 1,
- # 'traceInvoke' => 1,
- );
-
- # Initialize variables
- sub awake
- {
- print "Main awake (raw types)...\n";
- my $self=shift;
-
- $self->{'models'}=$WOApp->modelsDict->allValues;
- $self->{'types'}=$WOApp->typesDict->allValues;
- $self->{'prices'}=obj([8000, 10000, 12000, 14000, 16000,
- 18000, 20000, 25000, 30000, 50000, 90000]);
- $self->{'sortBys'}=obj(["Price", "Type", "Model"]);
- return nil;
- }
-
- # Formatter for price browser
- sub priceFormat
- {
- my $self=shift;
- return "\$ " . $self->{'price'};
- }
-
- sub displayCars
- {
- my $self=shift;
- # Create the second page that will display all the cars matching
- # the client's criteria
- my $selectedCarsPage = $WOApp->pageWithName("SelectedCars");
-
- $self->{'selectedModels'} = $self->{'models'}
- if !($self->{'selectedModels'}->count);
- $self->{'selectedTypes'}=$self->{'types'}
- if !($self->{'selectedTypes'}->count);
- $self->{'selectedPrices'}=$self->{'prices'}
- if !($self->{'selectedPrices'}->count);
- $self->{'selectedSortOrder'}=obj("Price")
- if nil($self->{'selectedSortOrder'});
-
- # Set the selection parameters expressed by the client
- # (car models, type, price range, ordering).
- # Notice that all these selections (selectedModels, selectedTypes,...)
- # are automatically filled by the declarations. (See Main.wod.)
-
- $selectedCarsPage->setModels($self->{'selectedModels'});
- $selectedCarsPage->setTypes($self->{'selectedTypes'});
- $selectedCarsPage->setPrices($self->{'selectedPrices'});
- $selectedCarsPage->setSortOrder($self->{'selectedSortOrder'});
- $selectedCarsPage->fetchSelectedCars;
-
- return $selectedCarsPage;
- }
-
- 'WO::DodgeLite::Main';
- # EOF
-