Adding a Home button to the WebWorks Help 5.0 Page Navigation Tools

Here's how to add a Home button to the page navigation toolbar in a WebWorks Help 5.0 system.

An example of this can be seen here:

http://download.autodesk.com/us/maya/2008help/wwhelp/wwhimpl/js/html/wwhelp.htm

To add the button, you need to create overrides for the following files:

Refer to the ePublisher Pro online help for instructions on how to create overrides.

Open your override version of controls.js

Locate this line:

function WWHControls_LeftHTML()

Scroll through the WWHControls_LeftHTML() function until you find these lines:

    // Emit HTML for controls
    //
    VarHTML += this.fTopSpacerHTML();
    if (VarEnabledControls.length > 0)
    {
      VarHTML += "<table border=\"0\" cellspacing=\"0\" cellpadding=\"0\">\n";
      VarHTML += " <tr>\n";

      VarHTML += "  <td><div><img src=\"" + WWHFrame.WWHHelp.mHelpURLPrefix + "wwhelp/wwhimpl/common/images/spc_tb_l.gif" + "\" alt=\"\"></div></td>\n";

      for (VarMaxIndex = VarEnabledControls.length, VarIndex = 0 ; VarIndex < VarMaxIndex ; VarIndex++)
      {
        VarHTML += VarEnabledControls[VarIndex].fGetHTML();
        if ((VarIndex + 1) < VarMaxIndex)
        {
          VarHTML += "  <td><div><img src=\"" + WWHFrame.WWHHelp.mHelpURLPrefix + "wwhelp/wwhimpl/common/images/spc_tb_m.gif" + "\" alt=\"\"></div></td>\n";
        }
      }

      VarHTML += " </tr>\n";
      VarHTML += "</table>\n";
    }
  }
  return VarHTML;
}

Immediately before the for command, add these lines to the WWHControls_LeftHTML() function:

      VarHTML += "<td width=\"23\"><a href=\"" + WWHFrame.WWHHelp.mHelpURLPrefix + "MYFILENAME.html\" target=\"_top\" title=\"Home\"><img src=\"" + WWHFrame.WWHHelp.mHelpURLPrefix + "wwhelp/wwhimpl/common/images/MYHOMEICON.gif\" border=\"0\" height=\"21\" width=\"23\" alt=\"Home\" /></a></td>";

      VarHTML += "<td><div><img src=\"" + WWHFrame.WWHHelp.mHelpURLPrefix + "wwhelp/wwhimpl/common/images/spc_tb_m.gif" + "\" alt=\"\"></div></td>\n";

-- and change the MYFILENAME.html and MYHOMEICON.gif text in the lines as needed.

The first line inserts your Home icon and link.

The second line inserts a space between the Home icon and the next button.

The edited function should look like this:

    // Emit HTML for controls
    //
    VarHTML += this.fTopSpacerHTML();
    if (VarEnabledControls.length > 0)
    {
      VarHTML += "<table border=\"0\" cellspacing=\"0\" cellpadding=\"0\">\n";
      VarHTML += " <tr>\n";

      VarHTML += "  <td><div><img src=\"" + WWHFrame.WWHHelp.mHelpURLPrefix + "wwhelp/wwhimpl/common/images/spc_tb_l.gif" + "\" alt=\"\"></div></td>\n";

      VarHTML += "<td width=\"23\"><a href=\"" + WWHFrame.WWHHelp.mHelpURLPrefix + "index.html\" target=\"_top\" title=\"Home\"><img src=\"" + WWHFrame.WWHHelp.mHelpURLPrefix + "wwhelp/wwhimpl/common/images/homeicon.gif\" border=\"0\" height=\"21\" width=\"23\" alt=\"Home\" /></a></td>";

      VarHTML += "<td><div><img src=\"" + WWHFrame.WWHHelp.mHelpURLPrefix + "wwhelp/wwhimpl/common/images/spc_tb_m.gif" + "\" alt=\"\"></div></td>\n";

      for (VarMaxIndex = VarEnabledControls.length, VarIndex = 0 ; VarIndex < VarMaxIndex ; VarIndex++)
      {
        VarHTML += VarEnabledControls[VarIndex].fGetHTML();
        if ((VarIndex + 1) < VarMaxIndex)
        {
          VarHTML += "  <td><div><img src=\"" + WWHFrame.WWHHelp.mHelpURLPrefix + "wwhelp/wwhimpl/common/images/spc_tb_m.gif" + "\" alt=\"\"></div></td>\n";
        }
      }

      VarHTML += " </tr>\n";
      VarHTML += "</table>\n";
    }
  }
  return VarHTML;
}

Save the override file. Make sure you have created the wwhelp/wwhimpl/common/images/ folder structure in your override directory and have placed your home button image in the images directory.

Open your override version of pagenav.htm

Locate this line:

<frameset cols="87,*,160" border="0" frameborder="0" framespacing="0" onkeydown="WWHPageNavFrame_HandleKeyDown((document.all||document.getElementById||document.layers)?event:null);" onkeypress="WWHPageNavFrame_HandleKeyPress((document.all||document.getElementById||document.layers)?event:null);" onkeyup="WWHPageNavFrame_HandleKeyUp((document.all||document.getElementById||document.layers)?event:null);">

Change the 87 in the frameset cols specification to a width that allows for your new button and the space between it and the following button.

Save the override files.

Regenerate your help output and test it -- the home icon should now appear in the topic toolbars.

You should note some limitations to this approach:

HelpCenter/Tips/Adding a Home button to the WebWorks Help 5.0 Page Navigation Tools (last edited 2010-02-06 04:56:45 by BenAllums)