home *** CD-ROM | disk | FTP | other *** search
/ Thomson (Residential) / TGSTPv7203.iso / mac / Documentation / HTML / TG546v-v7_en / wwhelp / wwhimpl / js / scripts / outlfast.js < prev    next >
Text File  |  2007-10-04  |  7KB  |  235 lines

  1. // Copyright (c) 2000-2001 Quadralay Corporation.  All rights reserved.
  2. //
  3.  
  4. function  WWHOutlineImagingFast_Object()
  5. {
  6.   this.mIterator      = new WWHOutlineIterator_Object(true);
  7.   this.mImageSrcDir   = WWHOutlineImaging_ImageSrcDir();
  8.   this.mEventString   = WWHPopup_EventString();
  9.   this.mHTMLSegment   = new WWHStringBuffer_Object();
  10.  
  11.   this.fGetIconURL     = WWHOutlineImaging_GetIconURL;
  12.   this.fGetPopupAction = WWHOutlineImaging_GetPopupAction;
  13.   this.fGetLink        = WWHOutlineImaging_GetLink;
  14.   this.fGetLink2       = WWHOutlineImaging_GetLink2;
  15.  
  16.   this.fGenerateStyles = WWHOutlineImagingFast_GenerateStyles;
  17.   this.fReset          = WWHOutlineImagingFast_Reset;
  18.   this.fAdvance        = WWHOutlineImagingFast_Advance;
  19.   this.fOpenLevel      = WWHOutlineImagingFast_OpenLevel;
  20.   this.fCloseLevel     = WWHOutlineImagingFast_CloseLevel;
  21.   this.fSameLevel      = WWHOutlineImagingFast_SameLevel;
  22.   this.fDisplayEntry   = WWHOutlineImagingFast_DisplayEntry;
  23.   this.fUpdateEntry    = WWHOutlineImagingFast_UpdateEntry;
  24.   this.fRevealEntry    = WWHOutlineImagingFast_RevealEntry;
  25. }
  26.  
  27. function  WWHOutlineImagingFast_GenerateStyles()
  28. {
  29.   var  StyleBuffer = new WWHStringBuffer_Object();
  30.  
  31.  
  32.   StyleBuffer.fAppend("<style type=\"text/css\">\n");
  33.   StyleBuffer.fAppend(" <!--\n");
  34.   StyleBuffer.fAppend("  a  { text-decoration: none ;\n");
  35.   StyleBuffer.fAppend("       color: " + WWHFrame.WWHJavaScript.mSettings.mTOC.mEnabledColor + " }\n");
  36.   StyleBuffer.fAppend("  ul { list-style-type: none ;\n");
  37.   StyleBuffer.fAppend("       padding-left: 0pt ;\n");
  38.   StyleBuffer.fAppend("       margin-top: 1pt ;\n");
  39.   StyleBuffer.fAppend("       margin-bottom: 1pt ;\n");
  40.   StyleBuffer.fAppend("       margin-left: 0pt }\n");
  41.   StyleBuffer.fAppend("  li { margin-top: 1pt ;\n");
  42.   StyleBuffer.fAppend("       margin-bottom: 1pt ;\n");
  43.   StyleBuffer.fAppend("       " + WWHFrame.WWHJavaScript.mSettings.mTOC.mFontStyle + " ;\n");
  44.   StyleBuffer.fAppend("       margin-left: " + WWHFrame.WWHJavaScript.mSettings.mTOC.mIndent + "pt }\n");
  45.   StyleBuffer.fAppend("  li.book { margin-left: 0pt }\n");
  46.   StyleBuffer.fAppend(" -->\n");
  47.   StyleBuffer.fAppend("</style>\n");
  48.  
  49.   return StyleBuffer.fGetBuffer();
  50. }
  51.  
  52. function  WWHOutlineImagingFast_Reset()
  53. {
  54.   this.mIterator.fReset(WWHFrame.WWHOutline.mTopEntry);
  55. }
  56.  
  57. function  WWHOutlineImagingFast_Advance(ParamMaxHTMLSegmentSize)
  58. {
  59.   var  Entry;
  60.  
  61.  
  62.   this.mHTMLSegment.fReset();
  63.   while (((ParamMaxHTMLSegmentSize == -1) ||
  64.           (this.mHTMLSegment.fSize() < ParamMaxHTMLSegmentSize)) &&
  65.          (this.mIterator.fAdvance(this)))
  66.   {
  67.     Entry = this.mIterator.mEntry;
  68.  
  69.     // Process current entry
  70.     //
  71.     if (Entry.mbShow)
  72.     {
  73.       if (Entry.mLevel == 0)
  74.       {
  75.         this.mHTMLSegment.fAppend("<li class=book id=i" + Entry.mID + ">");
  76.       }
  77.       else
  78.       {
  79.         this.mHTMLSegment.fAppend("<li id=i" + Entry.mID + ">");
  80.       }
  81.       this.mHTMLSegment.fAppend(this.fDisplayEntry(Entry));
  82.     }
  83.   }
  84.  
  85.   return (this.mHTMLSegment.fSize() > 0);  // Return true if segment created
  86. }
  87.  
  88. function  WWHOutlineImagingFast_OpenLevel()
  89. {
  90.   this.mHTMLSegment.fAppend("<ul>\n");
  91. }
  92.  
  93. function  WWHOutlineImagingFast_CloseLevel()
  94. {
  95.   this.mHTMLSegment.fAppend("</li>\n");
  96.   this.mHTMLSegment.fAppend("</ul>\n");
  97. }
  98.  
  99. function  WWHOutlineImagingFast_SameLevel()
  100. {
  101.   this.mHTMLSegment.fAppend("</li>\n");
  102. }
  103.  
  104. function  WWHOutlineImagingFast_DisplayEntry(ParamEntry)
  105. {
  106.   var  EntryHTML = "";
  107.   var  IconURL = this.fGetIconURL(ParamEntry);
  108.  
  109.  
  110.   if (ParamEntry.mChildren == null)
  111.   {
  112. //    EntryHTML += "<nobr>";
  113.  
  114.     EntryHTML += this.fGetLink2(ParamEntry, "<img border=0 src=\"" + IconURL + "\">");
  115.  
  116.  
  117. //    EntryHTML += "</nobr>\n";
  118.   }
  119.   else
  120.   {
  121.     if (ParamEntry.mbExpanded)
  122.     {
  123. //      EntryHTML += "<nobr>";
  124.  
  125.       EntryHTML += "<table cellpadding=\"0\" cellspacing=\"0\" border=\"0\"><tr><td><table border=\"0\" cellpadding=\"0\" cellspacing=\"0\"><tr><td valign=\"top\">";
  126.  
  127. //      EntryHTML += "<a href=\"javascript:fC(" + ParamEntry.mID + ");\" " + this.fGetPopupAction(ParamEntry) + ">";
  128.       EntryHTML += "<a href=\"javascript:fC(" + ParamEntry.mID + ");\">";
  129.       EntryHTML += "<img border=0 src=\"" + IconURL + "\"></a></td><td valign=\"top\" class=\"enf1\">";
  130.       EntryHTML += this.fGetLink(ParamEntry, null);
  131.       
  132.       EntryHTML += "</td></tr></table></td></tr></table>";
  133.       
  134. //      EntryHTML += "</nobr>\n";
  135.     }
  136.     else
  137.     {
  138. //      EntryHTML += "<nobr>";
  139.  
  140.       EntryHTML += "<table cellpadding=\"0\" cellspacing=\"0\" border=\"0\"><tr><td><table border=\"0\" cellpadding=\"0\" cellspacing=\"0\"><tr><td valign=\"top\">";
  141.  
  142.       EntryHTML += "<a href=\"javascript:fE(" + ParamEntry.mID + ");\">";
  143.       EntryHTML += "<img border=0 src=\"" + IconURL + "\"></a></td><td valign=\"top\" class=\"enf1\">";
  144.       EntryHTML += this.fGetLink(ParamEntry, null);
  145. //      EntryHTML += "</nobr>\n";
  146.  
  147.       EntryHTML += "</td></tr></table></td></tr></table>";
  148.  
  149.     }
  150.   }
  151.  
  152.   return EntryHTML;
  153. }
  154.  
  155. function  WWHOutlineImagingFast_UpdateEntry(ParamEntry)
  156. {
  157.   var  ElementID = "i" + ParamEntry.mID;
  158.   var  EntryHTML = "";
  159.  
  160.  
  161.   // Get entry display
  162.   //
  163.   EntryHTML = this.fDisplayEntry(ParamEntry);
  164.  
  165.   // Reset iterator to process current entry's children
  166.   //
  167.   this.mIterator.fReset(ParamEntry);
  168.  
  169.   // Process display of children
  170.   //
  171.   if (this.fAdvance(-1))
  172.   {
  173.     // Result already stored in this.mHTMLSegment
  174.     //
  175.   }
  176.  
  177.   // Close down any popups we had going to prevent JavaScript errors
  178.   //
  179.   WWHFrame.WWHJavaScript.mPanels.mPopup.fHide();
  180.  
  181.   // Update HTML
  182.   //
  183.   if ((WWHFrame.WWHBrowserInfo.mBrowser == 2) ||  // Shorthand for IE
  184.       (WWHFrame.WWHBrowserInfo.mBrowser == 3))    // Shorthand for iCab
  185.   {
  186.     WWHFrame.WWHNavigationFrame.WWHPanelFrame.document.all[ElementID].innerHTML = EntryHTML + this.mHTMLSegment.fGetBuffer();
  187.   }
  188.   else if (WWHFrame.WWHBrowserInfo.mBrowser == 4)  // Shorthand for Netscape 6.0
  189.   {
  190.     WWHFrame.WWHNavigationFrame.WWHPanelFrame.document.getElementById(ElementID).innerHTML = EntryHTML + this.mHTMLSegment.fGetBuffer();
  191.   }
  192. }
  193.  
  194. function  WWHOutlineImagingFast_RevealEntry(ParamEntry,
  195.                                             bParamVisible)
  196. {
  197.   var  ParentEntry;
  198.   var  LastClosedParentEntry = null;
  199.  
  200.  
  201.   // Expand out enclosing entries
  202.   //
  203.   ParentEntry = ParamEntry.mParent;
  204.   while (ParentEntry != null)
  205.   {
  206.     if ( ! ParentEntry.mbExpanded)
  207.     {
  208.       ParentEntry.mbExpanded = true;
  209.       LastClosedParentEntry = ParentEntry;
  210.     }
  211.  
  212.     ParentEntry = ParentEntry.mParent;
  213.   }
  214.  
  215.   // Set target entry
  216.   //
  217.   WWHFrame.WWHOutline.mPanelAnchor = "t" + ParamEntry.mID;
  218.  
  219.   // Update display
  220.   //
  221.   if (bParamVisible)
  222.   {
  223.     // Expand parent entry to reveal target entry
  224.     //
  225.     if (LastClosedParentEntry != null)
  226.     {
  227.       this.fUpdateEntry(LastClosedParentEntry);
  228.     }
  229.  
  230.     // Display target
  231.     //
  232.     WWHFrame.WWHJavaScript.mPanels.fJumpToAnchor();
  233.   }
  234. }
  235.