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

  1. // Copyright (c) 2000-2001 Quadralay Corporation.  All rights reserved.
  2. //
  3.  
  4. function  WWHOutlineImagingSafe_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.fGetLink3       = WWHOutlineImaging_GetLink3;
  15.  
  16.   this.fGenerateStyles = WWHOutlineImagingSafe_GenerateStyles;
  17.   this.fReset          = WWHOutlineImagingSafe_Reset;
  18.   this.fAdvance        = WWHOutlineImagingSafe_Advance;
  19.   this.fOpenLevel      = WWHOutlineImagingSafe_OpenLevel;
  20.   this.fCloseLevel     = WWHOutlineImagingSafe_CloseLevel;
  21.   this.fSameLevel      = WWHOutlineImagingSafe_SameLevel;
  22.   this.fDisplayEntry   = WWHOutlineImagingSafe_DisplayEntry;
  23.   this.fUpdateEntry    = WWHOutlineImagingSafe_UpdateEntry;
  24.   this.fRevealEntry    = WWHOutlineImagingSafe_RevealEntry;
  25. }
  26.  
  27. function  WWHOutlineImagingSafe_GenerateStyles()
  28. {
  29.   var  StyleBuffer = new WWHStringBuffer_Object();
  30.   var  MaxLevel;
  31.   var  Level;
  32.  
  33.  
  34.   StyleBuffer.fAppend("<style type=\"text/css\">\n");
  35.   StyleBuffer.fAppend(" <!--\n");
  36.   StyleBuffer.fAppend("  a { text-decoration: none ;\n");
  37.   StyleBuffer.fAppend("      color: " + WWHFrame.WWHJavaScript.mSettings.mTOC.mEnabledColor + " }\n");
  38.   StyleBuffer.fAppend("  p { margin-top: 1pt ;\n");
  39.   StyleBuffer.fAppend("      margin-bottom: 1pt ;\n");
  40.   StyleBuffer.fAppend("      " + WWHFrame.WWHJavaScript.mSettings.mTOC.mFontStyle + " }\n");
  41.   for (MaxLevel = WWHFrame.WWHOutline.mMaxLevel, Level = 0 ; Level <= MaxLevel ; Level++)
  42.   {
  43.     StyleBuffer.fAppend("  p.l" + Level + " { margin-left: " + (WWHFrame.WWHJavaScript.mSettings.mTOC.mIndent * Level) + "pt }\n");
  44.   }
  45.   StyleBuffer.fAppend(" -->\n");
  46.   StyleBuffer.fAppend("</style>\n");
  47.  
  48.   return StyleBuffer.fGetBuffer();
  49. }
  50.  
  51. function  WWHOutlineImagingSafe_Reset()
  52. {
  53.   this.mIterator.fReset(WWHFrame.WWHOutline.mTopEntry);
  54. }
  55.  
  56. function  WWHOutlineImagingSafe_Advance(ParamMaxHTMLSegmentSize)
  57. {
  58.   var  Entry;
  59.  
  60.  
  61.   this.mHTMLSegment.fReset();
  62.   while (((ParamMaxHTMLSegmentSize == -1) ||
  63.           (this.mHTMLSegment.fSize() < ParamMaxHTMLSegmentSize)) &&
  64.          (this.mIterator.fAdvance(this)))
  65.   {
  66.     Entry = this.mIterator.mEntry;
  67.  
  68.     // Process current entry
  69.     //
  70.     if (Entry.mbShow)
  71.     {
  72.       this.mHTMLSegment.fAppend(this.fDisplayEntry(Entry));
  73.     }
  74.   }
  75.  
  76.   return (this.mHTMLSegment.fSize() > 0);  // Return true if segment created
  77. }
  78.  
  79. function  WWHOutlineImagingSafe_OpenLevel()
  80. {
  81. }
  82.  
  83. function  WWHOutlineImagingSafe_CloseLevel()
  84. {
  85. }
  86.  
  87. function  WWHOutlineImagingSafe_SameLevel()
  88. {
  89. }
  90.  
  91. function  WWHOutlineImagingSafe_DisplayEntry(ParamEntry)
  92. {
  93.   var  EntryHTML = "";
  94.   var  IconURL = this.fGetIconURL(ParamEntry);
  95.  
  96.  
  97.   if (ParamEntry.mChildren == null)
  98.   {
  99.  
  100.     EntryHTML += this.fGetLink3(ParamEntry, "<img width=20 height=16 border=0 src=\"" + IconURL + "\">");
  101.  
  102.   }
  103.   else
  104.   {
  105.     if (ParamEntry.mbExpanded)
  106.     {
  107. //      EntryHTML += "<p class=l" + ParamEntry.mLevel + ">";
  108.       EntryHTML += "<table cellpadding=\"0\" cellspacing=\"0\" border=\"0\"><tr><td><table border=\"0\" cellpadding=\"0\" cellspacing=\"0\"><tr><td valign=\"top\" class=l" + ParamEntry.mLevel + ">";
  109. //      EntryHTML += "<nobr>";
  110.       EntryHTML += "<a href=\"javascript:fC(" + ParamEntry.mID + ");\">";
  111.       EntryHTML += "<img border=0 src=\"" + IconURL + "\"></a></td><td valign=\"top\" class=l" + ParamEntry.mLevel + ">";
  112.       EntryHTML += this.fGetLink(ParamEntry, null);
  113. //      EntryHTML += "</nobr>";
  114.  
  115.  
  116. //      EntryHTML += "</p>\n";
  117.        
  118.       EntryHTML += "</td></tr></table></td></tr></table>\n";
  119.  
  120.  
  121.     }
  122.     else
  123.     {
  124. //      EntryHTML += "<p class=l" + ParamEntry.mLevel + ">";
  125.  
  126.       EntryHTML += "<table cellpadding=\"0\" cellspacing=\"0\" border=\"0\"><tr><td><table border=\"0\" cellpadding=\"0\" cellspacing=\"0\"><tr><td valign=\"top\" class=l" + ParamEntry.mLevel + ">";
  127.  
  128. //      EntryHTML += "<nobr>";
  129.       EntryHTML += "<a href=\"javascript:fE(" + ParamEntry.mID + ");\">";
  130.       EntryHTML += "<img border=0 src=\"" + IconURL + "\"></a></td><td valign=\"top\" class=l" + ParamEntry.mLevel + ">";
  131.       EntryHTML += this.fGetLink(ParamEntry, null);
  132. //      EntryHTML += "</nobr>";
  133.  
  134. //      EntryHTML += "</p>\n";
  135.  
  136.       EntryHTML += "</td></tr></table></td></tr></table>\n";
  137.  
  138.     }
  139.   }
  140.  
  141.   return EntryHTML;
  142. }
  143.  
  144. function  WWHOutlineImagingSafe_UpdateEntry(ParamEntry)
  145. {
  146.   var  EntryURL;
  147.  
  148.  
  149.   // Save/restore current position
  150.   //
  151.   WWHFrame.WWHJavaScript.mPanels.fSaveScrollPosition();
  152.  
  153.   // Close down any popups we had going to prevent JavaScript errors
  154.   //
  155.   WWHFrame.WWHJavaScript.mPanels.mPopup.fHide();
  156.  
  157.   // Reload page to display expanded/collapsed entry
  158.   //
  159.   WWHFrame.WWHJavaScript.mPanels.fDisplayPanel();
  160. }
  161.  
  162. function  WWHOutlineImagingSafe_RevealEntry(ParamEntry,
  163.                                             bParamVisible)
  164. {
  165.   var  ParentEntry;
  166.   var  LastClosedParentEntry = null;
  167.  
  168.  
  169.   // Expand out enclosing entries
  170.   //
  171.   ParentEntry = ParamEntry.mParent;
  172.   while (ParentEntry != null)
  173.   {
  174.     if ( ! ParentEntry.mbExpanded)
  175.     {
  176.       ParentEntry.mbExpanded = true;
  177.       LastClosedParentEntry = ParentEntry;
  178.     }
  179.  
  180.     ParentEntry = ParentEntry.mParent;
  181.   }
  182.  
  183.   // Set target entry
  184.   //
  185.   WWHFrame.WWHOutline.mPanelAnchor = "t" + ParamEntry.mID;
  186.  
  187.   // Update display
  188.   //
  189.   if (bParamVisible)
  190.   {
  191.     // Update display if entry not already visible
  192.     //
  193.     if (LastClosedParentEntry != null)
  194.     {
  195.       this.fUpdateEntry(ParamEntry);
  196.     }
  197.  
  198.     // Display target
  199.     //
  200.     WWHFrame.WWHJavaScript.mPanels.fJumpToAnchor();
  201.   }
  202. }
  203.