home *** CD-ROM | disk | FTP | other *** search
/ IRIX 6.4 Applications 1997 August / SGI IRIX 6.4 Applications 1997 August.iso / dist / dynaweb.idb / usr / lib / Insight / data / config / colltoc.dwc.z / colltoc.dwc
Encoding:
Text File  |  1997-07-30  |  5.6 KB  |  186 lines

  1.  
  2. #####################################################################
  3. #####################################################################
  4. ##                                                                 ##
  5. ##             COLLECTION TOC VIEW CREATION                        ##
  6. ##                                                                 ##
  7. #####################################################################
  8. #####################################################################
  9.  
  10. dwTemplate Generic__CollectionTocView {
  11. $[dwCall dwMakeUrlParts]
  12. <HTML>
  13.    <HEAD>
  14.       <BASE HREF="$[dwGet BaseUrl]@Generic__CollectionTocView">
  15.    </HEAD>
  16.    <BODY BGCOLOR=#FFFBF0 LINK=#000000 ALINK=#008000 VLINK=#800080>
  17.       <H3>$[dwGetRootTitle]</H3>
  18.       <HR>
  19.       $[dwCall Generic__GenerateCollectionViewBody]
  20.       <HR>
  21.    </BODY>
  22. </HTML>
  23. }
  24.  
  25.  
  26. dwScript Generic__GenerateCollectionViewBody {
  27.     dwInitTocLineGenerator  BooksAndCollections [dwGet State__CollTocDepth]
  28.     dwCall                  Generic__GenerateCollectionTocLines
  29. }
  30.  
  31.  
  32. dwScript Generic__CollTocView {
  33.     if {[dwGet State__Frames] == 1} {
  34.         dwProcessTemplate Frames__CollTocView
  35.     } else {
  36.         dwProcessTemplate NoFrames__CollTocView
  37.     }
  38. }
  39.  
  40. dwTemplate Frames__CollTocView {
  41. $[dwCall dwMakeUrlParts]
  42. <HTML>
  43.    <HEAD>
  44.       <TITLE>$[dwGetRootTitle]: Table of Contents</TITLE>
  45.       <BASE HREF="$[dwGet BaseUrl]@Generic__CollTocView">
  46.    </HEAD>
  47.       <BODY BGCOLOR=#FFFBF0 LINK=#000000 ALINK=#008000 VLINK=#800080>
  48.       <H3>$[dwGetRootTitle]</H3>
  49.       $[dwCall Generic__ShowSearchResult]
  50.       <HR>
  51.       $[dwCall Generic__GenerateBookTocViewBody]
  52.       <HR>
  53.    </BODY>
  54. </HTML>
  55. }
  56.  
  57. dwTemplate NoFrames__CollTocView {
  58. $[dwCall dwMakeUrlParts]
  59. <HTML>
  60.    <HEAD>
  61.       <TITLE>$[dwGetRootTitle]: Table of Contents</TITLE>
  62.       <BASE HREF="$[dwGet BaseUrl]@Generic__CollTocView">
  63.    </HEAD>
  64.       <BODY BGCOLOR=#FFFBF0 LINK=#000000 ALINK=#008000 VLINK=#800080>
  65.       $[dwCall Generic__BookButtonBarView]
  66.       <HR>      
  67.       <H3>Table of contents for $[dwGetRootTitle]</H3>
  68.       $[dwCall Generic__ShowSearchResult]
  69.       <HR>
  70.       $[dwCall Generic__GenerateCollTocViewBody]
  71.         <HR>
  72.    </BODY>
  73. </HTML>
  74. }
  75.  
  76. dwScript Generic__GenerateCollectionTocLines {
  77.   dwCall dwMakeUrlParts
  78.   if {[dwGet ActiveQuery] != ""} {set checkHits 1} else {set checkHits 0}
  79.  
  80.   set root    [dwGet RootAbsUrlPath]
  81.   set params  [dwGet UrlParamString]    
  82.   set query   [dwGet UrlQueryString]    
  83.   set icondir [dwGetParam IconDir]
  84.  
  85.   while {[dwNewTocLine]} {
  86.     set item [dwGetTocItemPath]
  87.     switch -exact [dwGetTocItemType] {
  88.       collection {
  89.         dwSet TocLineIcon  [dwGetParam graphic_image_srcmap collection]
  90.         dwSet TocLinePath "$root/$item/@Generic__CollectionView$params$query"
  91.         dwSet TocLinePathTarget " TARGET=_top"
  92.       }
  93.       book {
  94.         dwSet TocLineIcon [dwGetParam graphic_image_srcmap book]
  95.         dwSet TocLinePath "$root/$item/@Generic__BookView$params$query"
  96.         dwSet TocLinePathTarget " TARGET=_top"
  97.       }
  98.       default {
  99.         dwSet TocLineUrl    \
  100.                 "@Generic__BookTextView/[dwGetTocItemPath]$params$query"
  101.         dwSet TocIconUrl    \
  102.                 "@Generic__BookTocView/[dwGetTocItemPath]$params$query"
  103.         dwSet TocIconExpUrl \
  104.                 "@Generic__BookTocView/[dwGetTocItemExpansionPath]$params$query"
  105.         
  106.         if {[dwGet State__Frames] == 1} {
  107.             dwSet TocLineTarget " TARGET=\"dynaweb_content\""
  108.         } else {
  109.             dwSet TocLineTarget ""
  110.         }
  111.         dwCall Tables__ShowCurrentTocLine
  112.         continue
  113.       }
  114.     }
  115.     if {$checkHits} {
  116.       set hitCount [dwGetTocItemHitCount]
  117.       if {$hitCount < 0} {
  118.         dwSet TocLineHitCount "<FONT COLOR=#FF0000>---</FONT>"
  119.       } else {
  120.         dwSet TocLineHitCount "<FONT COLOR=#FF0000><B>$hitCount</B></FONT>"
  121.       }
  122.     }
  123.     dwCall Generic__GenerateCollectionTocLine
  124.   }
  125. }
  126.  
  127. dwScript Generic__GenerateCollectionTocLine {
  128.     if {[dwGet State__Tables] == 1} {
  129.  
  130.            ## width of indent from one TOC item level to the next
  131.       ## if there's a query, this also holds the hit count
  132.        if {[dwGet ActiveQuery] == ""} {
  133.           dwSet IndentWidth 10
  134.       } else { 
  135.           dwSet IndentWidth 45
  136.        }
  137.  
  138.        ## width of collection/book icon
  139.        dwSet ArrowWidth 22
  140.  
  141.        ## width of TOC item text
  142.        dwSet TextWidth 800
  143.  
  144.        ## width of TOC line   
  145.         dwSet LineWidth 867
  146.  
  147.  
  148.         dwProcessTemplate Tables__CollectionTocLine
  149.     } else {
  150.         set icondir  [dwGetParam IconDir]
  151.         set hitCount [dwGet TocLineHitCount]
  152.         set tocLine  $hitCount
  153.         set loop     [expr 6 - [string length $hitCount]]
  154.         while {$loop > 0} {
  155.             set tocLine "$tocLine$[dwGetParam graphic_image_srcmap spacer]"
  156.             incr loop -1
  157.         }
  158.         set tocLine  "$tocLine[dwGet TocLineIcon]"
  159.         set loop     2
  160.         while {$loop > 0} {
  161.             set tocLine "$tocLine$[dwGetParam graphic_image_srcmap spacer]"
  162.             incr loop -1
  163.         }
  164.         set tocLine "$tocLine<A HREF=\"[dwGet TocLinePath]\"[dwGet TocLinePathTarget]>[dwGetTocItemTitle]</A><BR>"
  165.         dwSend $tocLine
  166.     }
  167. }
  168.  
  169. dwTemplate Tables__CollectionTocLine {
  170. <TABLE CELLPADDING=0 BORDER=0 WIDTH=$[dwGet LineWidth]>
  171.    <TR><NOBR>
  172.        <TD ALIGN=RIGHT VALIGN=TOP WIDTH=$[expr [dwGetTocItemLevel] * [dwGet IndentWidth]]>
  173.           $[dwGet TocLineHitCount]
  174.        </TD>
  175.        <TD ALIGN=CENTER VALIGN=TOP WIDTH=$[dwGet ArrowWidth]>
  176.           <A HREF="$[dwGet TocLinePath]"$[dwGet TocLinePathTarget]>$[dwGet TocLineIcon]</A>
  177.        </TD>
  178.        <TD ALIGN=LEFT VALIGN=TOP WIDTH=$[dwGet TextWidth] NOWRAP>
  179.           <A HREF="$[dwGet TocLinePath]"$[dwGet TocLinePathTarget]>$[dwGetTocItemTitle]</A>
  180.        </TD>
  181.    </NOBR></TR>
  182. </TABLE>
  183. }
  184.  
  185.  
  186.