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 / tocutil.dwc.z / tocutil.dwc
Encoding:
Text File  |  1997-07-30  |  8.0 KB  |  218 lines

  1.  
  2.  
  3. #####################################################################
  4. #####################################################################
  5. ##                                                                 ##
  6. ##              TOC ENTRY CREATION                                 ##
  7. ##                                                                 ##
  8. #####################################################################
  9. #####################################################################
  10.  
  11. dwScript Tables__ShowCurrentTocLine {
  12.    if {[dwGet ActiveQuery] == ""} {
  13.       dwSet TocLineHitCount ""
  14.    } else {
  15.       dwSet TocLineHitCount [dwGetTocItemHitCount]
  16.       if {$TocLineHitCount <= 0} {dwSet TocLineHitCount ""}
  17.    }
  18.  
  19.    ## width of indent from one TOC item level to the next
  20.    ## if there's a query, this also holds the hit count
  21.    if {[dwGet ActiveQuery] == ""} {
  22.       dwSet IndentWidth 15
  23.    } else { 
  24.       dwSet IndentWidth 35
  25.    }
  26.  
  27.    ## width of expand/collapse arrow
  28.    dwSet ArrowWidth 10
  29.  
  30.    ## width of TOC item text
  31.    dwSet TextWidth 800
  32.  
  33.    ## width of TOC line
  34.    ## this allows for 6 TOC levels
  35.    ## 6 * IndentWidth w/Hit Counts = 210 + ArrowWidth + TextWidth = 1020   
  36.    dwSet LineWidth 1020
  37.  
  38.    set state [dwGetTocItemState]
  39.    if {$state == "expandable"} {
  40.     dwCall Tables__ExpandableTocLine
  41.    } elseif {$state == "expanded"} {
  42.     dwCall Tables__ExpandedTocLine
  43.    } elseif {$state == "elided"} {
  44.     if {$TocLineHitCount != 0} {
  45.        dwCall Tables__ElidedTocLine
  46.     }
  47.    } else {
  48.     dwCall Tables__NonExpandableTocLine
  49.    }
  50. }
  51.  
  52. dwScript Tables__ExpandedTocLine {
  53.     if {[dwGet State__Tables] == 1} {
  54.     if {[dwGet TocLineIsHilited] == 1} {
  55.        dwSet TocTextAttrBefore "<TABLE cellspacing=0 cellpadding=0 border=0><TR><TD bgcolor=#C0D8FF NOWRAP><B>"
  56.        dwSet TocTextAttrAfter "</B></TABLE>"
  57.     } else {
  58.        dwSet TocTextAttrBefore ""
  59.        dwSet TocTextAttrAfter ""
  60.     }
  61.         dwProcessTemplate Tables__ExpandedTocLineTableRow        
  62.     } else {
  63.         set icondir [dwGetParam IconDir]
  64.         set hits "<FONT COLOR=#FF0000><B>[dwGet TocLineHitCount]</B></FONT>"
  65.         set tocLine ""
  66.         set loop [expr 2 * [dwGetTocItemLevel]]
  67.         while {$loop > 0} {
  68.             set tocLine "$tocLine<IMG SRC=\"${icondir}spacer.gif\" ALT=\" \">"
  69.             incr loop -1
  70.         }
  71.         set tocLine "$tocLine<A HREF=\"[dwGet TocIconUrl]\">[dwGetParam graphic_image_srcmap collapse]</A>"
  72.         set tocLine "$tocLine<IMG SRC=\"${icondir}spacer.gif\" ALT=\" \">"
  73.         set tocLine "$tocLine<A HREF=\"[dwGet TocLineUrl]\">[dwGetTocItemTitle] </A>  $hits<BR>\n"
  74.         dwSend $tocLine
  75.     }
  76. }
  77.  
  78. dwTemplate Tables__ExpandedTocLineTableRow {
  79. <TABLE CELLPADDING=0 BORDER=0 WIDTH=$[dwGet LineWidth]>
  80.    <TR><NOBR>
  81.        <TD ALIGN=RIGHT VALIGN=TOP WIDTH=$[expr [dwGetTocItemLevel] * [dwGet IndentWidth]]>
  82.           <FONT COLOR=#FF0000><B>$[dwGet TocLineHitCount]</B></FONT>
  83.        </TD>
  84.        <TD ALIGN=CENTER VALIGN=BASELINE WIDTH=$[dwGet ArrowWidth]>
  85.           <A HREF="$[dwGet TocIconUrl]"$[dwGet TocIconTarget]>$[dwGetParam graphic_image_srcmap collapse]</A>
  86.        </TD>
  87.        <TD ALIGN=LEFT VALIGN=TOP WIDTH=$[dwGet TextWidth] NOWRAP>
  88.           $[dwGet TocTextAttrBefore]<A HREF="$[dwGet TocLineUrl]"$[dwGet ScrollAnchor]$[dwGet TocLineTarget]>$[dwGetTocItemTitle]</A>$[dwGet TocTextAttrAfter]
  89.        </TD>
  90.    </NOBR></TR>
  91. </TABLE>
  92. }
  93.  
  94. dwScript Tables__ExpandableTocLine {
  95.     if {[dwGet State__Tables] == 1} {
  96.     if {[dwGet TocLineIsHilited] == 1} {
  97.        dwSet TocTextAttrBefore "<TABLE cellspacing=0 cellpadding=0 border=0><TR><TD bgcolor=#C0D8FF NOWRAP><B>"
  98.        dwSet TocTextAttrAfter "</B></TABLE>"
  99.     } else {
  100.        dwSet TocTextAttrBefore ""
  101.        dwSet TocTextAttrAfter ""
  102.     }
  103.         dwProcessTemplate Tables__ExpandableTocLineTableRow
  104.     } else {
  105.         set icondir [dwGetParam IconDir]
  106.         set hits "<FONT COLOR=#FF0000><B>[dwGet TocLineHitCount]</B></FONT>"
  107.         set tocLine ""
  108.         set loop [expr 2 * [dwGetTocItemLevel]]
  109.         while {$loop > 0} {
  110.             set tocLine "$tocLine<IMG SRC=\"${icondir}spacer.gif\" ALT=\" \">"
  111.             incr loop -1
  112.         }
  113.         set tocLine "$tocLine<A HREF=\"[dwGet TocIconExpUrl]\">[dwGetParam graphic_image_srcmap expand]</A>"
  114.         set tocLine "$tocLine<IMG SRC=\"${icondir}spacer.gif\" ALT=\" \">"
  115.         set tocLine "$tocLine<A HREF=\"[dwGet TocLineUrl]\">[dwGetTocItemTitle] </A>  $hits<BR>\n"
  116.         dwSend $tocLine
  117.     }
  118. }
  119.  
  120. dwTemplate Tables__ExpandableTocLineTableRow {
  121. <TABLE CELLPADDING=0 BORDER=0 WIDTH=$[dwGet LineWidth]>
  122.    <TR><NOBR>
  123.        <TD ALIGN=RIGHT VALIGN=TOP WIDTH=$[expr [dwGetTocItemLevel] * [dwGet IndentWidth]]>
  124.         <FONT COLOR=#FF0000><B>$[dwGet TocLineHitCount]</B></FONT>
  125.        </TD>
  126.        <TD ALIGN=CENTER VALIGN=BASELINE WIDTH=$[dwGet ArrowWidth]>
  127.       <A HREF="$[dwGet TocIconExpUrl]"$[dwGet TocIconTarget]>$[dwGetParam graphic_image_srcmap expand]</A>
  128.        </TD>
  129.        <TD ALIGN=LEFT VALIGN=TOP WIDTH=$[dwGet TextWidth] NOWRAP>
  130.           $[dwGet TocTextAttrBefore]<A HREF="$[dwGet TocLineUrl]"$[dwGet ScrollAnchor]$[dwGet TocLineTarget]>$[dwGetTocItemTitle]</A>$[dwGet TocTextAttrAfter]
  131.        </TD>
  132.    </NOBR></TR>
  133. </TABLE>
  134. }
  135.  
  136.  
  137. dwScript Tables__ElidedTocLine {
  138.     set hits ""
  139.     if {[dwGet TocLineHitCount] > 0} {
  140.         set hits "<FONT COLOR=#FF0000><B>$TocLineHitCount</B></FONT>"
  141.     }
  142.     if {[dwGet State__Tables] == 1} {
  143.         dwProcessTemplate Tables__ElidedTocLineTableRow
  144.     } else {
  145.         set icondir [dwGetParam IconDir]
  146.         set tocLine ""
  147.         set loop [expr 2 * [dwGetTocItemLevel]]
  148.         while {$loop > 0} {
  149.             set tocLine "$tocLine<IMG SRC=\"${icondir}spacer.gif\" ALT=\" \">"
  150.             incr loop -1
  151.         }
  152.         set tocLine "$tocLine<A HREF=\"[dwGet TocIconUrl]\">[dwGetParam graphic_image_srcmap expand]</A>"
  153.         set tocLine "$tocLine<IMG SRC=\"${icondir}spacer.gif\" ALT=\" \">"
  154.         set tocLine "$tocLine<A HREF=\"[dwGet TocIconUrl]\">. . .</A>  $hits<BR>\n"
  155.         dwSend $tocLine
  156.     }
  157. }
  158.  
  159. dwTemplate Tables__ElidedTocLineTableRow {
  160. <TABLE CELLPADDING=0 BORDER=0 WIDTH=$[dwGet LineWidth]>
  161.    <TR><NOBR>
  162.        <TD ALIGN=RIGHT VALIGN=TOP WIDTH=$[expr [dwGetTocItemLevel] * [dwGet IndentWidth]]>
  163.           $[dwGet hits]
  164.        </TD>
  165.        <TD ALIGN=CENTER VALIGN=BASELINE WIDTH=$[dwGet ArrowWidth]>
  166.        </TD>
  167.        <TD ALIGN=LEFT VALIGN=TOP WIDTH=$[dwGet TextWidth]>
  168.          <A HREF="$[dwGet TocIconUrl]"$[dwGet ScrollAnchor]$[dwGet TocIconTarget]>. . .</A>
  169.        </TD>
  170.    </NOBR></TR>
  171. </TABLE>
  172. }
  173.  
  174. dwScript Tables__NonExpandableTocLine {
  175.     if {[dwGet State__Tables] == 1} {
  176.     if {[dwGet TocLineIsHilited] == 1} {
  177.        dwSet TocTextAttrBefore "<TABLE cellspacing=0 cellpadding=0 border=0><TR><TD bgcolor=#C0D8FF NOWRAP><B>"
  178.        dwSet TocTextAttrAfter "</B></TABLE>"
  179.     } else {
  180.        dwSet TocTextAttrBefore ""
  181.        dwSet TocTextAttrAfter ""
  182.     }
  183.         dwProcessTemplate Tables__NonExpandableTocLineTableRow
  184.     } else {
  185.         set icondir [dwGetParam IconDir]
  186.         set hits "<FONT COLOR=#FF0000><B>[dwGet TocLineHitCount]</B></FONT>"
  187.         set tocLine ""
  188.         set loop [expr 2 * [dwGetTocItemLevel]]
  189.         while {$loop > 0} {
  190.             set tocLine "$tocLine<IMG SRC=\"${icondir}spacer.gif\" ALT=\" \">"
  191.             incr loop -1
  192.         }
  193.         set loop 3
  194.         while {$loop > 0} {
  195.             set tocLine "$tocLine<IMG SRC=\"${icondir}spacer.gif\" ALT=\" \">"
  196.             incr loop -1
  197.         }
  198.         set tocLine "$tocLine<A HREF=\"[dwGet TocLineUrl]\">[dwGetTocItemTitle] </A>  $hits<BR>\n"
  199.         dwSend $tocLine
  200.     }
  201. }
  202.  
  203. dwTemplate Tables__NonExpandableTocLineTableRow {
  204. <TABLE CELLPADDING=0 BORDER=0 WIDTH=$[dwGet LineWidth]>
  205.    <TR><NOBR>
  206.        <TD ALIGN=RIGHT VALIGN=TOP WIDTH=$[expr [dwGetTocItemLevel] * [dwGet IndentWidth]]>
  207.           <FONT COLOR=#FF0000><B>$[dwGet TocLineHitCount]</B></FONT>
  208.        </TD>
  209.        <TD WIDTH=$[dwGet ArrowWidth]>
  210.        </TD>
  211.        <TD ALIGHT=RIGHT VALIGN=TOP WIDTH=$[dwGet TextWidth] NOWRAP>
  212.           $[dwGet TocTextAttrBefore]<A HREF="$[dwGet TocLineUrl]"$[dwGet ScrollAnchor]$[dwGet TocLineTarget]>$[dwGetTocItemTitle]</A>$[dwGet TocTextAttrAfter]
  213.        </TD>
  214.    </NOBR></TR>
  215. </TABLE>
  216. }
  217.  
  218.