# file: product.html
# Copyright (c) 1996-1999 Cuesta Technologies, LLC
# All rights reserved.
# This document contains confidential and/or proprietary information
# beloging to Cuesta Technologies, LLC.
# Package: hkrc
#
# Purpose:
#
# Requires:
#
set pageID PG_117
if {![info exists cw_args(record)]} {
cw redirect search.html$nocache+prod@noid force
} else {
set record $cw_args(record)
}
# fetch the product record from the product database
openPdb_r
closePdb
if {[info exist cw_val(addtoloan)]} {
if {![info exists cw_vals(loanlist)]} {
set mark(loanlist) 1
lappend complaints "Please select the item(s) you wish to borrow, then click the Add to Loan List button below."
} else {
set loanlist {}
set fields {Title Item_ID Materials_Type Special_Features}
foreach rec $cw_vals(loanlist) {
GrokFields $pdb($rec) tmpArr $cw_tablepath $fields
if {[regexp -nocase {(heavy|ordersized)} $tmpArr(Special_Features)]} {
set note heavy
} else {
set note ""
}
lappend loanlist [list $tmpArr(Item_ID) $tmpArr(Title) $tmpArr(Materials_Type) $rec $note]
}
set sdb(loanList) $loanlist
cw redirect bag.html$nocache+from@$record+frompg@product force
}
}
if {[info exists cw_args(research)]} {
set sdb(researchVar) $cw_args(research)
} else {
if {![info exists sdb(researchVar)]} {
set sdb(researchVar) "hide"
}
}
# Figure out the previous and next pages
if {[info exists sdb(search_result_list)]} {
set l $sdb(search_result_list)
cw log 3 "***list is $l"
set i [lsearch $l $record]
if {$i > 0} {
set prev [lindex $l [expr $i-1]]
}
if {$i >= 0 && $i < [expr [llength $l] - 1]} {
set next [lindex $l [expr $i+1]]
}
}
if {[info exists pdb($record)]} {
GrokRec $pdb($record) prod $cw_tablepath {} $cw_datadir
cw stats PRODUCT "$prod(Record_ID)\t$prod(Title)"
} else {
cw redirect search.html$nocache+prod@noext force
}
####################this product##################################
if {[string length $sdb(bag)] } {
set baglist $sdb(bag)
} else {
set baglist {}
}
if {[string length $prod(Picture_File)] > 2} {
set tableWidth 90%
} else {
set tableWidth 80%
}
## Oct 25 02 Cindy: Setting for rollover "Add to Loan List" image button.
## Since we display the this rollover iamge button in two place in this page,
## we need to generate two set images to make both rollover work correctly.
set addllro "onMouseOver=\"imgOn('$gifs/','borrowingmaterials'); return true;\" onMouseOut=\"imgOff('$gifs/','borrowingmaterials')\""
set addllro2 "onMouseOver=\"imgOn('$gifs/','borrowingmaterials2'); return true;\" onMouseOut=\"imgOff('$gifs/','borrowingmaterials2')\""
#set addllurl bag.html$nocache+from@$record
set addllurl "#viewBorrow"
set addllimg "
"
set addllimg2 "
"
cw source $new_cw_templatePath/templateTop.tcl
if {[llength $sdb(search_result_list)] == 1 && [string match $record $sdb(search_result_list)]} {
puts "
| $sdb(listcriteria) |
|
1 item matches your request. |
"
}
# Define the Previous Button
if {[string match No $sdb(printer)]} {
if {[info exists prev]} {
set Button_Prev "
"
} else {
set Button_Prev "
"
}
# Define the Next Button
if {[info exists next]} {
set Button_Next "
"
} else {
set Button_Next "
"
}
} else {
set Button_Prev ""
set Button_Next ""
}
|
$Button_Prev
|
####################### -- Title -- ###########################
if {[regexp -nocase {research(.)+validated} $prod(Special_Features)]} {
set iconStr "
"
} else {
set iconStr ""
}
if {[regexp {^S} $prod(Item_ID)]} {
set numStr ""
} else {
regsub M $prod(Item_ID) {} itemid
set numStr "(#$itemid)"
}
puts "
$prod(Title) $numStr$iconStr |
$Button_Next |
"
if { [string length $prod(Publication_Date)] } {
puts "
| Publication Year: $prod(Publication_Date)
|
"
}
puts "
"
set fieldslist {}
set item {"Subject Area"}
set newList {}
foreach eitem $cdb(Subject_Area_hardcode) {
if {[lsearch $prod(Subject_Area) $eitem] > -1} {
lappend newList $eitem
}
}
lappend item $newList
lappend item mult
lappend fieldslist $item
set item {"Audience"}
set newList {}
### 3.20.08 mes: don't compare to cdb value
### and use catalog_audience instead of audience
lappend newList $prod(Catalog_Audience)
lappend item $newList
lappend item mult
lappend fieldslist $item
set item {"Material Type"}
#lappend item [lsort -dictionary $prod(Materials_Type)]
set newList {}
foreach eitem $cdb(Materials_Type_hardcode) {
if {[lsearch $prod(Materials_Type) $eitem] > -1} {
lappend newList $eitem
}
}
lappend item $newList
lappend item mult
lappend fieldslist $item
set item {"Special Population"}
#lappend item [lsort -dictionary $prod(Special_Populations)]
set newList {}
foreach eitem $cdb(Special_Populations_hardcode) {
if {[lsearch $prod(Special_Populations) $eitem] > -1} {
lappend newList $eitem
}
}
lappend item $newList
lappend item mult
lappend fieldslist $item
#set item {"Key Skill Building Components"}
#lappend item $prod(Key_Skill_Building_Components)
#lappend fieldslist $item
### 3.13.08 mes: fixed for language
set item {Language}
#lappend item [lsort -dictionary $prod(Language)]
set newList {}
foreach eitem $cdb(Language_hardcode) {
if {[lsearch $prod(Language) $eitem] > -1} {
lappend newList $eitem
}
}
lappend item $newList
lappend item mult
lappend fieldslist $item
set item {"Special Features"}
#lappend item [lsort -dictionary $prod(Special_Features)]
set newList {}
foreach eitem $cdb(Special_Features_hardcode) {
if {[lsearch $prod(Special_Features) $eitem] > -1} {
lappend newList $eitem
}
}
lappend item $newList
lappend item mult
lappend fieldslist $item
set item {"Computer Platform"}
lappend item [lsort -dictionary $prod(Computer_Platform)]
lappend item mult
lappend fieldslist $item
set item {"Publisher"}
lappend item [lsort -dictionary $prod(Publisher_Name)]
lappend item mult
lappend fieldslist $item
set fieldno 2
set idno 0
foreach field $fieldslist {
if { [string length [lindex $field 1]] > 2 } {
set idno [expr $idno + 1]
}
}
if { $idno > 0 } {
puts ""
}
foreach field $fieldslist {
set field0 [lindex $field 0]
set field1 [lindex $field 1]
set field2 [lindex $field 2]
if { [string length $field1] > 2 } {
if { $fieldno == 2 } {
set fieldno 1
} elseif { $idno > 1 && $fieldno == 0 } {
set fieldno 1
puts " "
} else {
set fieldno 0
puts " "
}
set print_$fieldno {}
set disStr "| $field0: | "
if {[string match Publisher $field0]} {
openBdbDb $cw_publisher_datadir prod pubdb
closeBdbDb pubdb
if {[info exists pubdb($prod(Item_Publisher_Record_ID))]} {
append disStr "$prod(Publisher_Name) | "
} else {
set disStr ""
}
} else {
if {[string match "Special Features" $field0]} {
set displayColor ""
} else {
set displayColor ""
}
if {[string match mult $field2]} {
append disStr "$displayColor[join $field1 " " ] | "
} else {
append disStr "$displayColor$field1"
}
}
puts $disStr
}
}
if { $fieldno == 1 && $idno > 1 } {
puts "
| "
}
puts " "
|
# --PICTURE IMAGE--
# --The following graphic is conditonal on Picture_File being defined --
# --The image file name is Picture_File appended with '.jpg' or '.gif' --
if {[string length $prod(Picture_File)] } {
if { [file exists $itemimagesDir/$prod(Picture_File)\.jpg] } {
set picture $itemimages/$prod(Picture_File)\.jpg
} elseif { [file exists $itemimagesDir/$prod(Picture_File)\.gif] } {
set picture $itemimages/$prod(Picture_File)\.gif
} else {
set picture ""
}
if { [string length $picture] } {
puts " "
}
}
if {[string match No $sdb(printer)]} {
puts " $addllimg2 "
}
puts " |
"
###################### Cost ##############################
if {[string length $prod(Cost)]} {
puts "
"
}
###################### Description #######################
if { [string length $prod(Description)] } {
puts "
|
Description:
|
"
if {[regexp "Description/" $prod(Description)]} {
puts [tlob $prod(Description) ]
} else {
puts "
$prod(Description)
"
}
puts "
|
"
}
######################### Research ######################
if { [string length $prod(Research)]} {
puts "
Research: "
if {[string match show $sdb(researchVar)]} {
puts -nonewline "Hide"
} else {
puts -nonewline "Show"
}
puts "
|
"
if {[string match show $sdb(researchVar)]} {
puts $prod(Research)
}
puts " |
"
}
#########################Reviewers Notes ######################
if { [string length $prod(Reviewers_Notes)] } {
puts "
|
Reviewers' Notes:
|
"
if {[regexp "Reviewers' Notes/" $prod(Reviewers_Notes)]} {
puts [tlob $prod(Reviewers_Notes) ]
} else {
puts "$prod(Reviewers_Notes)"
}
puts "
|
"
}
################ Display Image Buttons #################
if {[string match No $sdb(printer)]} {
puts "
"
set hkrcsid [string range $cw_sessionID 1 end]
# set query "HKRC_SID@$hkrcsid"
### 9/9/02 mes: need to add record, if there, for product pages.
### Need to take care of other types of pages - laws db, etc.
set query "HKRC_SID@$hkrcsid+HKRC_From@$pagename+record@$record"
if {[string length $prod(Sample_Pages)]} {
## Sept30 2002 Cindy: add img roll over
puts "
"
}
cw log 2 "length of Implementation_Sites:::> [llength $prod(Implementation_Sites)]"
if {[llength $prod(Implementation_Sites)]} {
## 11/16/02 Cindy: change the link to training product
## 7/28/05 Cindy: link to results list of all trainings listed in
## Implementation_Sites mult field. If only one result, go to rproduct.html
set len [llength $prod(Implementation_Sites)]
if {$len == 1} {
set trecord [lindex $prod(Implementation_Sites) 0]
set url $cw_pageURL/rproduct.html$nocache+record@$trecord
} else {
set sdb(research_search_result_list) $prod(Implementation_Sites)
set url $cw_pageURL/rlist.html$nocache
}
puts "
"
}
set resbutton "
"
## Sept30 2002 Cindy: add img roll over
set rollover "onMouseOver=\"imgOn('$gifs/','moreresearch'); return true;\" onMouseOut=\"imgOff('$gifs/','moreresearch')\""
if {[string length $prod(Research_Getting_Results_Page)]} {
if {[string length $sdb(HEC_SID)]} {
set id $sdb(HEC_SID)
} else {
set id 0
}
## 10/17/02 Cindy: remove #nnn in the end of link
## which come from database.
## since in IE, 2chapter6.html#12?HKRC_SID@267KK...
## cannot work correctly.
set link $prod(Research_Getting_Results_Page)
set idx [string first .html $link]
set link [string range $link 0 [expr $idx + 4]]
set url http://www.gettingresults.org/c/@$id$cw_proot/Pages/$link?$query
puts "$resbutton"
} elseif {[string length $prod(Research_HKRC_Page)]} {
puts "$resbutton"
}
puts ""
}
puts ""
#####################Series and Supplemenary###############
puts ""
complain_mark loanlist *
if {![string match Yes $sdb(printer)]} {
include_file product_directions.txt
puts "
"
if {[llength $baglist] > 0} {
set baglink "Cart"
} else {
set orderlink "Order"
set baglink "Cart"
}
puts "
$Button_Prev
|
$Button_Next
|
"
puts ""
cw source $new_cw_templatePath/templateBottom.tcl