home *** CD-ROM | disk | FTP | other *** search
/ business-86-101-185-173.business.broadband.hu / business-86-101-185-173.business.broadband.hu.zip / business-86-101-185-173.business.broadband.hu / trans / sqlncli2005_x64.msi / sqlncli.chm.91A5E41F_8A38_40FB_BC6E_28CA47D512BD / local / smplmgr.js < prev    next >
Text File  |  2005-08-01  |  21KB  |  636 lines

  1. //    Microsoft Visual Studio.NET Sample Viewer
  2. //    Copyright 2001 Microsoft
  3. //    Author:    Sean Gephardt
  4. //    Revision Date:    08/14/2001
  5. //    Revised 4/2/2003 by Syne Mitchell
  6.  
  7. // LOCALIZATION CONSTANTS
  8. // Load xml resource
  9. var xmldoc = new ActiveXObject("MSXML.DOMDocument");
  10. xmldoc.async = false;
  11. xmldoc.load(getScriptPath() + "\smplMgr.xml");
  12. var L_LoadSample_HTMLText = getXMLText('L_LoadSample_HTMLText');
  13. var L_CopyAll_HTMLText = getXMLText('L_CopyAll_HTMLText');
  14. var L_Help_HTMLText = getXMLText('L_Help_HTMLText');
  15. var L_GeneralInfoText_HTMLText = getXMLText('L_GeneralInfoText_HTMLText');
  16. var L_ErrFileExists0_HTMLText = getXMLText('L_ErrFileExists0_HTMLText');
  17. var L_ErrFileExists1_HTMLText = "\n" + getXMLText('L_ErrFileExists1_HTMLText');
  18. var L_SMTitle_HTMLText = getXMLText('L_SMTitle_HTMLText');
  19. var L_PopupMenuID1_HTMLText = getXMLText('L_PopupMenuID1_HTMLText');
  20. var L_PopupMenuID2_HTMLText = getXMLText('L_PopupMenuID2_HTMLText');
  21. var L_VisualNote_HTMLText = getXMLText('L_VisualNote_HTMLText');
  22. var L_VisualNote2_HTMLText = getXMLText('L_VisualNote2_HTMLText');
  23. var L_GenInfo_HTMLText = getXMLText('L_GenInfo_HTMLText');
  24. var L_ProjFileLoc_HTMLText = getXMLText('L_ProjFileLoc_HTMLText');
  25. var L_ProjFileLocCopy_HTMLText = "\n" + getXMLText('L_ProjFileLocCopy_HTMLText');
  26.  
  27. //    ERROR MESSAGE STRINGS
  28. var L_GenericHelpErr_HTMLText = getXMLText('L_GenericHelpErr_HTMLText');
  29. var L_HXDSSessionObjectError_HTMLText = getXMLText('L_HXDSSessionObjectError_HTMLText') + "\n" +  L_GenericHelpErr_HTMLText;
  30. var L_SessObjSampNavError_HTMLText = getXMLText('L_SessObjSampNavError_HTMLText') + "\n" +  L_GenericHelpErr_HTMLText;
  31. var L_ViewSampleError1_HTMLText = getXMLText('L_ViewSampleError1_HTMLText');
  32. var L_ViewSampleError2_HTMLText = getXMLText('L_ViewSampleError2_HTMLText') + "\n" +  L_GenericHelpErr_HTMLText;
  33. var L_CopySampleError1_HTMLText = getXMLText('L_CopySampleError1_HTMLText');
  34. var L_CopySampleLocationError_HTMLText = getXMLText('L_CopySampleLocationError_HTMLText');
  35. var L_CopyOverWriteError_HTMLText = getXMLText('L_CopyOverWriteError_HTMLText');
  36. var L_LoadSolFileError_HTMLText = getXMLText('L_LoadSolFileError_HTMLText');
  37. var L_LoadSolMainError_HTMLText = getXMLText('L_LoadSolMainError_HTMLText') + "\n" +  L_GenericHelpErr_HTMLText;
  38. var L_WSloadSampleError_HTMLText = getXMLText('L_WSloadSampleError_HTMLText');
  39. var L_ParseError_HTMLText = getXMLText('L_ParseError_HTMLText');
  40. var L_LocCssOne_HTMLText = getXMLText('L_LocCssOne_HTMLText');
  41.  
  42.  
  43. if (blnShowSmpMgr != false)
  44. {
  45.  
  46.     //    GLOBALS
  47.     var bAlert = false;
  48.     var sOrigDiv="";
  49.     var bRuntimeSnR = false;
  50.     
  51.     //This global variable tracks whether the placeholder text is currently being displayed, so the
  52.     //script can either replace or append new content, as appropriate.
  53.     var bPlaceholderDiv = true;
  54.     
  55.     //query: do aspx, asmx, and other QuickStart files have custom icons?  If so, need to be added to this list
  56.     //    track file types with custom icons
  57.     var sIcons = "sql asp bas bat bmp cdf c asa cls cs cpp css ctl def dob dsr ico frm gif h htc htm html jpg js odl png txt vbs vb xml xsl sln vcproj";
  58.     
  59.     //    VARS FOR TESTING
  60.     //    var L_defaultLocation_HTMLText = "";
  61.     //    var g_sPageLoc = "ms-help://MS.MSDNVS/vcsample/html/samp.htm";
  62.         var L_defaultLocation_HTMLText = "ms-help:../samp/";
  63.         var g_sPageLoc = unescape(location.href);
  64.     
  65.     //    CREATE HH 2.0 SESSION OBJECT
  66.     try
  67.     {
  68.         var oSessionObj = new ActiveXObject("Hxds.HxSession");
  69.         oSessionObj.Initialize(g_sPageLoc, 0);
  70.     }
  71.     catch(errSessionObject)
  72.     {        alert(errSessionObject.number + "\n" + errSessionObject.description + "\n" + L_HXDSSessionObjectError_HTMLText);    }
  73.     
  74.     //===
  75.     //    Get the Sample Information from the Session Object
  76.     try
  77.     {    var oSmpMgr = oSessionObj.GetNavigationObject("!SampleInfo", "");}
  78.     catch(errSessObjNav)
  79.     {    alert(errSessObjNav.number + "\n" + errSessObjNav.description + "\n" + L_SessObjSampNavError_HTMLText);    }
  80.     }    
  81.  
  82. function getScriptPath() {
  83. //Determine path to JS so we can retrieve our variables from within the xml file.
  84.     for (i=0; i < document.scripts.length; i++) {
  85.         var spath = document.scripts[i].src;
  86.         spath = spath.toLowerCase();
  87.         if (spath.indexOf("smplmgr.js")!=-1) return spath.replace("smplmgr.js", "");
  88.         }
  89. }
  90.  
  91. //Note: could improve performance some by using children instead of selectSingleNode
  92. function getXMLText(term) {
  93.     var out = xmldoc.selectSingleNode("/UI/String[@Id='" + term + "']").text;
  94.     return out;
  95. }
  96.  
  97.  
  98. //    DHTML for TOC tree menu
  99. function Toc_click()
  100. {
  101.     var eSrc = window.event.srcElement;
  102.     eLI = eSrc.parentElement;
  103.     var eUL = GetNextUL(eLI);
  104.     var eIMG = GetNextImg(eLI);
  105.     if(eUL && "kidShown" == eLI.className){    // hide on-page kids
  106.         eLI.className = "kid";
  107.         eUL.className = "clsHidden";
  108.         eIMG.src = L_defaultLocation_HTMLText + "greenfolder.gif";
  109.     }else if(eUL && eUL.all.length && "kid" == eLI.className){    // show on-page kids
  110.         eLI.className = "kidShown";
  111.         eUL.className = "clsShown";
  112.         eIMG.src = L_defaultLocation_HTMLText + "greenfoldero.gif";
  113.     }
  114. }
  115.  
  116. function GetNextUL(eSrc)
  117. {
  118.     var eRef = eSrc;
  119.     for(var i = 0; i < eRef.children.length; i++) if("UL" == eRef.children[i].tagName) return eRef.children[i];
  120.     return false;
  121. }
  122.  
  123. function GetNextImg(eSrc)
  124. {
  125.     var eRef = eSrc;
  126.     for(var i = 0; i < eRef.children.length; i++) if("IMG" == eRef.children[i].tagName) return eRef.children[i];
  127.     return false;
  128. }
  129.  
  130. //    FILTER KEYBOARD EVENTS
  131. function document.onkeydown()
  132. {
  133.     if (window.event.keyCode == 13 || window.event.keyCode == 32)
  134.     {    /*    document.onmouseup();        */    }
  135.     if(window.event.keyCode == 145)
  136.     {    bAlert = bAlert?false:true;    }
  137. }
  138.  
  139. // CHANGE CSS FOR ELEMENT HIGHLIGHTING
  140. function document.onclick()
  141. {
  142.     var oElement = window.event.srcElement;
  143.     var strEleID = oElement.id;
  144.  
  145.     // FOR LINKS
  146.     if (strEleID == L_PopupMenuID1_HTMLText)
  147.     {
  148.         for(i=0;i<document.all.item(L_PopupMenuID1_HTMLText).length;i++)
  149.         {
  150.             if(document.all.item(L_PopupMenuID1_HTMLText)[i].className == "clsNoView")
  151.             { document.all.item(L_PopupMenuID1_HTMLText)[i].className = "clsNoView";    }
  152.             else
  153.             {    document.all.item(L_PopupMenuID1_HTMLText)[i].className = String(L_VisualNote_HTMLText);    }
  154.         }
  155.         if (oElement.className == "clsNoView")
  156.         {    return;        }
  157.         else
  158.         {    oElement.className = String(L_VisualNote2_HTMLText);    }
  159.     }
  160.  
  161.     // FOR IMAGES
  162.     if (strEleID == L_PopupMenuID2_HTMLText)
  163.     {
  164.         for(i=0;i<document.all.item(L_PopupMenuID2_HTMLText).length;i++)
  165.         {
  166.             if(document.all.item(L_PopupMenuID2_HTMLText)[i].className == "clsNoView")
  167.             {    document.all.item(L_PopupMenuID2_HTMLText)[i].className = "clsNoView";    }
  168.             else
  169.             {    document.all.item(L_PopupMenuID2_HTMLText)[i].className = String(L_VisualNote_HTMLText);    }
  170.         }
  171.         if (window.event.srcElement.parentElement.children(1).className == "clsNoView")
  172.         {    return;    }
  173.         else
  174.         {    window.event.srcElement.parentElement.children(1).className = String(L_VisualNote2_HTMLText);    }
  175.     }
  176. }
  177.  
  178. //    VIEW THE SAMPLE ON THE PAGE
  179. function view(arrFileIndex,sID,sSFL,objID)
  180. {
  181.     try
  182.     {    var oSmp = oSmpMgr.GetSampleFromId(g_sPageLoc,sID,sSFL);        }
  183.     catch(errViewFileTextOne)
  184.     {    alert(errViewFileTextOne.number + "\n" + errViewFileTextOne.description + "\n"+ L_SessObjSampNavError_HTMLText);    }
  185.  
  186.     try{
  187.         if(sOrigDiv == "")
  188.         {    sOrigDiv = oSampDispDiv.innerHTML;    }
  189.         try{
  190.             var sFileText = oSmp.GetFileTextAtIndex(arrFileIndex);
  191.  
  192.             sFileText = sFileText.replace(/</gm, "<");
  193.             sFileText = sFileText.replace(/>/gm, ">");
  194.  
  195.             // SINGLE LINE COMMENTS
  196.             sFileText = sFileText.replace(/(\/\/)(.*)\n/g, "<font color='green'>$1$2</font><br>");
  197.  
  198.             // C STYLE COMMENTS
  199.             sFileText = sFileText.replace(/(\/)(\*)/gm, "<br><font color='green'>$1$2");
  200.             sFileText = sFileText.replace(/(\*\/)/gm, "$1</font><br>");
  201.  
  202.             // KEYWORDS
  203.             sFileText = sFileText.replace(/#ifdef/g, "<font color=blue>#ifdef</font>");
  204.             sFileText = sFileText.replace(/#ifndef/g, "<font color=blue>#ifndef</font>");
  205.             sFileText = sFileText.replace(/#else/g, "<font color=blue>#else</font>");
  206.             sFileText = sFileText.replace(/#endif/g, "<font color=blue>#endif</font>");
  207.             sFileText = sFileText.replace(/#include/g, "<font color=blue>#include</font>");
  208.             sFileText = sFileText.replace(/#define/g, "<font color=blue>#define</font>");
  209.             sFileText = sFileText.replace(/#pragma/g, "<font color=blue>#pragma</font>");
  210.  
  211.             // LINE BREAKS
  212.             sFileText = sFileText.replace(/\n/gmi, "<br>");
  213.  
  214.             var strInPageLink = "<p align=\"right\"><a href=\"javascript:FnGetBackTop();\">Back to top</a></p>";
  215.  
  216.             objSampleMgrCode.innerHTML = strInPageLink + sFileText + strInPageLink;
  217.             objSampleMgrCode.scrollIntoView(true);
  218.         }
  219.         catch(errViewFileTextTwo)
  220.         {    alert(errViewFileTextTwo.number + "\n" + errViewFileTextTwo.description + "\n" + L_ViewSampleError1_HTMLText);    }
  221.     }
  222.     catch(errViewFileTextThree)
  223.     {    alert(errViewFileTextThree.number + "\n" + errViewFileTextThree.description + "\n" + L_ViewSampleError2_HTMLText);    }
  224. }
  225. //===
  226. // TEST FUNCTION TO MIMIC ANCHOR BEHAVIOR
  227. function FnGetBackTop()
  228. {
  229.     smpMgrCell.scrollIntoView(true);
  230.     return;
  231. }
  232. //===
  233. //    GET THE DIRECTORY TO COPY PROJECT TO HARD DRIVE
  234. function fnGetDir(oSmp,iInt)
  235. {
  236.     var sDir = "My Documents";    // or "C:\\" or LOCAL PATH
  237.     if (iInt == 0)
  238.     {    sDir=oSmp.ChooseDirectory(sDir, L_ProjFileLoc_HTMLText);    }
  239.     else
  240.     {    sDir=oSmp.ChooseDirectory(sDir, L_ProjFileLoc_HTMLText + L_ProjFileLocCopy_HTMLText);    }
  241.     return sDir;
  242. }
  243.  
  244. //===
  245. //     COPY FILES TO LOCAL HARD DRIVE
  246. function copyAll(sID,sSFL)
  247. {
  248.     try
  249.     {    var oSmp = oSmpMgr.GetSampleFromId(g_sPageLoc,sID,sSFL);    }
  250.     catch(errCopyAllOne)
  251.     {    alert(errCopyAllOne.number + "\n" + errCopyAllOne.description + "\n" + L_SessObjSampNavError_HTMLText);    }
  252.  
  253.     try
  254.     {    var iNumFiles = oSmp.FileCount;    }
  255.     catch(errCopyAllTwo)
  256.     {    alert(errCopyAllTwo.number + "\n" + errCopyAllTwo.description + "n" + L_CopySampleError1_HTMLText);    }
  257.  
  258.     try
  259.     {
  260.         var sTempDir=oSmp.GetDestinationDir;
  261.         if(!sTempDir)
  262.         {    sTempDir = fnGetDir(oSmp,0);    }
  263.     }
  264.     catch(errCopyAllThree)
  265.     {    alert(errCopyAllThree.number + "\n" + errCopyAllThree.description + "\n" + L_CopySampleLocationError_HTMLText);    }
  266.  
  267.     if(sTempDir && sTempDir != "")
  268.     {
  269.         var bTmp = null;
  270.         var sWhy = "";
  271.         for(i=1;i<=iNumFiles;i++)
  272.         {
  273.             try
  274.             {    oSmp.CopyFileAtIndex(i,sTempDir,0);    }
  275.             catch(errCopyAllFour)
  276.             {
  277.                 if(errCopyAllFour.number==-2147220585)
  278.                 {
  279.                     bTmp = confirm(L_ErrFileExists0_HTMLText + L_ErrFileExists1_HTMLText);
  280.                     if (bTmp == true)
  281.                     {
  282.                         OverWriteAll(sID,sSFL,sTempDir);
  283.                         return;
  284.                     }
  285.                     else
  286.                     {    break;    }
  287.                 }
  288.                 else
  289.                 {
  290.                     alert(errCopyAllFour.number + "\n" + errCopyAllFour.description + "\n" + L_CopyOverWriteError_HTMLText);
  291.                     break;
  292.                 }
  293.             }
  294.         }
  295.     }
  296. }
  297.  
  298. //===
  299. //    OVERWRITE PREVIOUS SAMPLE LOCATION
  300. function OverWriteAll(sID,sSFL,sTempDir)
  301. {
  302.     var oSmp = oSmpMgr.GetSampleFromId(g_sPageLoc,sID,sSFL);
  303.     var iNumFiles = oSmp.FileCount;
  304.     for(i=1;i<=iNumFiles;i++)
  305.     {    oSmp.CopyFileAtIndex(i,sTempDir,1);    }
  306.     return;
  307. }
  308.  
  309. //===
  310. //    LOAD SAMPLE PROJECT INTO NEW INSTANCE OF VS.NET
  311. function LoadAll(sID,sSFL)
  312. {
  313.     var strTempProjExt = "";
  314.     var strFinalFullPath = "";
  315.     var strLoadFileFromHere = "";
  316.     var strTmpFileName = "";
  317.  
  318.     try
  319.     {
  320.         //Get the samples from the navigation object
  321.         var oSmp = oSmpMgr.GetSampleFromId(g_sPageLoc,sID,sSFL);
  322.         var strTempDestDir = oSmp.DestinationDir;    //    PATH FROM SFL file -- alert(strTempDestDir);
  323.         var iNumFiles = oSmp.FileCount;
  324.     }
  325.     catch(errLoadAllone)
  326.     {    alert(errLoadAllone.number + "\n" + errLoadAllone.description + L_SessObjSampNavError_HTMLText);    }
  327.  
  328.     try
  329.     {
  330.         for(i=1;i<=iNumFiles;i++)
  331.         {
  332.             strTmpFileName = oSmp.GetFileNameAtIndex(i);
  333.             if (strTmpFileName.lastIndexOf(".sln") != -1)
  334.             {    strTempProjExt = strTmpFileName;        }
  335.         }
  336.     }
  337.     catch(errLoadAllTwo)
  338.     {    alert(errLoadAllTwo.number + "\n" + errLoadAllTwo.description + "\n" + L_LoadSolFileError_HTMLText);    }
  339.  
  340.     // LOAD SAMPLE AFTER COPYING TO TEMP LOCATION
  341.     try
  342.     {
  343.         var sTempDir = oSmp.GetDestinationDir;
  344.  
  345.         if(!sTempDir)
  346.         {    sTempDir = fnGetDir(oSmp,1);        }
  347.  
  348.         if(sTempDir && sTempDir != "")
  349.         {
  350.             /*    oSmp.LoadProject(sTempDir);        */
  351.             for(i=1;i<=iNumFiles;i++)
  352.             {
  353.                 try
  354.                 {    oSmp.CopyFileAtIndex(i,sTempDir,0);    }
  355.                 catch(errCopy)
  356.                 {    //    alert(i + "\n" + errCopy.number + "\n" + errCopy.description);
  357.                     if (errCopy.number == -2147220585)
  358.                     {
  359.                         bTmp = confirm(L_ErrFileExists0_HTMLText + L_ErrFileExists1_HTMLText);
  360.                         if (bTmp == true)
  361.                         {
  362.                             OverWriteAll(sID,sSFL,sTempDir);
  363.                             break;
  364.                         }
  365.                         else
  366.                         {    return;    }
  367.                     }
  368.                 }
  369.             }
  370.             strLoadFileFromHere = strTempDestDir + "\\" + strTempProjExt;
  371.             strFinalFullPath = String("\"" + sTempDir + "\\" + strLoadFileFromHere + "\"");
  372.  
  373.             try
  374.             {
  375.                 var WshShell = new ActiveXObject("WScript.Shell");
  376.                 WshShell.Run("devenv " + strFinalFullPath, 1, true);
  377.             }
  378.             catch(errWSC)
  379.             {    alert(errWSC.number + "\n" + errWSC.description + "\n" + L_WSloadSampleError_HTMLText);    }
  380.         }
  381.     }
  382.     catch(errLoadAllThree)
  383.     {    alert(errLoadAllThree.number + "\n" + errLoadAllThree.description + "\n" + L_LoadSolMainError_HTMLText );    }
  384.     return;
  385. }
  386.  
  387. //===
  388. // INSERT TEXT STREAM INTO CURRENT PAGE
  389. //===
  390. function RuntimeSnR()
  391. {
  392.     try{
  393.         var oChild = null;
  394.         oChild = "<hr id='nDivider'><p> </p><div id='objSampleMgrCode' ></div><p> </p>";
  395.         nstext.insertAdjacentHTML("BeforeEnd",oChild);
  396.         sNST = "<DIV id=\"oSampDispDiv\">" + nstext.innerHTML + "</div>";
  397.         sNST.replace("<!--Footer Start-->", "</DIV><!--Footer Start-->");
  398.         nstext.innerHTML = sNST;                                
  399.     }
  400.     catch(errSNR){}
  401. }
  402.  
  403. //===
  404. //    ADD SAMPLE Viewer TO CURRENT PAGE
  405. //===
  406. function addSample(sID,sSFL)
  407. {
  408.     if(bRuntimeSnR ==  false)
  409.     {
  410.         //Append a call to RuntimeSnr() to the end of the
  411.         //window.onload event handler.
  412.         var sFnDef = new String(window.onload);
  413.         sFnDef = sFnDef.substring(sFnDef.indexOf("{")+1,sFnDef.length - 1) + "\nRuntimeSnR();\n";
  414.         fnOnLoad = new Function(sFnDef);
  415.         window.onload = fnOnLoad;
  416.         bRuntimeSnR = true;
  417.     }
  418.  
  419.     try
  420.     {
  421.         //Get the sample from the navigation object
  422.         var oSmp = oSmpMgr.GetSampleFromId(g_sPageLoc,sID,sSFL);
  423.         if (oSmp == null)
  424.         {    return;    }
  425.     }
  426.     catch(errAddSamp)
  427.     {
  428.         alert(L_SessObjSampNavError_HTMLText);
  429.         return;
  430.     }
  431.  
  432.  
  433.     try{
  434.         
  435.         //If placeholder text is displaying, overwrite it with innerHTML call
  436.         //otherwise, append new files to the end of the div, this enables Sample Manager to 
  437.         //display multiple instances.
  438.         if (bPlaceholderDiv)
  439.         {
  440.             smpMgrCell.innerHTML = "<div title=\""+ L_SMTitle_HTMLText +"\" class='oSampMgrTitle' oncontextmenu=\"return false;\">"+ L_SMTitle_HTMLText +":</div>";
  441.             bPlaceholderDiv = false;
  442.         }else{
  443.             smpMgrCell.insertAdjacentHTML("beforeEnd","<div title=\""+ L_SMTitle_HTMLText +"\" class='oSampMgrTitle' oncontextmenu=\"return false;\">"+ L_SMTitle_HTMLText +":</div>");
  444.         }
  445.         
  446.         
  447.         
  448.         var oSampleMgr = window.document.createElement("DIV");
  449.         var sSampleMgrID = document.uniqueID;
  450.         oSampleMgr.className = "sampleMgr";
  451.         oSampleMgr.id = sSampleMgrID;
  452.         oSampleMgr.onContextMenu = "return false;"
  453.         oSampleMgr.tabIndex=0;
  454.  
  455.     //    walk the sample
  456.         try
  457.         {    var iNumFiles = oSmp.FileCount;    }
  458.         catch(errAddSampCount)
  459.         {    alert(errAddSampCount.number + "\n" + errAddSampCount.description + "\n" + L_CopySampleError1_HTMLText);    }
  460.  
  461.         var oList = document.createElement("UL");
  462.         oList.ID = "ulRoot";
  463.         oList.style.display="block";
  464.         oList.onclick=Toc_click;
  465.  
  466.         for(i=1;i<=iNumFiles;i++)
  467.         {
  468.             try
  469.             {
  470.                 var sFileName = oSmp.GetFileNameAtIndex(i);
  471.                 find(sFileName, i, sID, sSFL, oList);
  472.             }
  473.             catch(errFileName)
  474.             {    alert(errFileName.number + "\n" + errFileName.description + "\n" + L_SessObjSampNavError_HTMLText);    }
  475.         }
  476.  
  477.         oSampleMgr.appendChild(oList);
  478.         oSampleMgr.bgColor="menu";
  479.         oSampleMgr.frColor="menutext";
  480.         smpMgrCell.insertAdjacentElement("beforeEnd",oSampleMgr);
  481.  
  482.         var oLinks = window.document.createElement("DIV");
  483.         var sFieldID =  "inp" + sSampleMgrID;
  484.         oLinks.className = "sampleLinks";
  485.  
  486.         var sLoadText ="";
  487.  
  488.         if(!sLoadText || sLoadText == "")
  489.         {    sLoadText = L_LoadSample_HTMLText;    }
  490.  
  491.         var sProjExt ="";
  492.  
  493.         try
  494.         {    sProjExt = oSmp.ProjectFileExt;        }
  495.         catch(err1)
  496.         {    alert(err1.number + "\n" + err1.description + "\n" + L_SessObjSampNavError_HTMLText);    }
  497.  
  498.         if(!sProjExt || sProjExt == "" || sProjExt == "exe")
  499.         {    sProjExt = "disabled=true";    }
  500.         else
  501.         {
  502.             try
  503.             {
  504.                 var WshShell = new ActiveXObject("WScript.Shell");
  505.                 var strTemp = WshShell.RegRead("HKEY_CLASSES_ROOT\\.sln\\");
  506.                 sProjExt = 'onclick="LoadAll(\''+sID+'\',\''+sSFL+'\');"';
  507.             }
  508.             catch(errNOVS)
  509.             {    sProjExt = "disabled=true";    }
  510.         }
  511.  
  512.         oLinks.innerHTML = "<DIV oncontextmenu=\"return false\" style='display: none;'><a href=\"javascript:\" title=\"" + sLoadText + "\" " + sProjExt + " >" + sLoadText + "</a></DIV>" +
  513.                 "<DIV oncontextmenu=\"return false\"><a href=\"javascript:\" title=\"" + L_CopyAll_HTMLText + "\" onclick=\"copyAll('" +sID+ "\','" + sSFL + "\');\" >" + L_CopyAll_HTMLText + "</a></DIV>" +
  514.                 "<DIV><MSHelp:link keywords=\"MSDN_Help_On_Sample_Manager\" TABINDEX=\"0\">" + L_Help_HTMLText + "</MSHelp:link></div><p>";
  515.  
  516.         oLinks.Sample=oSmp;
  517.         smpMgrCell.insertAdjacentElement("beforeEnd",oLinks);
  518.         smpMgrCell.style.display = "inline";
  519.     }
  520.     catch(err2)
  521.     {    alert(err2.number + "\n" + err2.description + "\n" + L_SessObjSampNavError_HTMLText);    }
  522. }
  523.  
  524. //Note: this recursive function searches through all the children of
  525. //the UL to find the folder to attach a file to.  It's inefficient code
  526. //since the more files, the longer each search, and recursion only makes it 
  527. //worse. Consider rewriting to improve performance.
  528.  
  529. function find(sPath, iFileIdx, sID, sSFL, oList)
  530. {    /* assumes that oList is an UL    */
  531.     var aFilePath = sPath.split("\\");
  532.     var bDo = true;
  533.  
  534.     for(var j = 0; j<oList.children.length;j++)
  535.     {
  536.         if(oList.children[j].innerText.indexOf(aFilePath[0])==0)
  537.         {
  538.             iPos = sPath.indexOf("\\");
  539.  
  540.             //Note: Added check on .children[j].children[2]
  541.             //to handle case where file occuring earlier in the 
  542.             //the file list has the same name as a directory.  
  543.  
  544.             if ((iPos!=-1) && (oList.children[j].children[2] != null))
  545.             {
  546.                 bDo = false;
  547.                 find(sPath.substring(iPos+1), iFileIdx, sID, sSFL, oList.children[j].children[2]);
  548.             }
  549.         }
  550.     }
  551.     if(bDo){
  552.         iPos = sPath.indexOf("\\");
  553.         if(iPos!=-1){
  554.             var oLI = document.createElement("LI");
  555.             var oLS = document.createElement("UL");
  556.             var oA = document.createElement("A");
  557.             var oIMG = document.createElement("IMG");
  558.  
  559.             oLS.className = "clsHidden";
  560.             oA.innerText = aFilePath[0];
  561.             oA.title = aFilePath[0];
  562.             oA.onClick = "javascript:void(0);Toc_click()";
  563.             oA.style.cursor = "hand";
  564.  
  565.             oIMG.onClick = "javascript:void(0);Toc_click()";
  566.             oIMG.alt = aFilePath[0];
  567.             oIMG.className = "clsHand";
  568.             oIMG.width = 16;
  569.             oIMG.height = 16;
  570.             oIMG.hspace = 4;
  571.             oIMG.src = L_defaultLocation_HTMLText + "greenfolder.gif";
  572.  
  573.             oLI.className = "kid";
  574.             find(sPath.substring(iPos+1), iFileIdx, sID, sSFL, oLS);
  575.             oLI.appendChild(oIMG);
  576.             oLI.appendChild(oA);
  577.             oLI.appendChild(oLS);
  578.             oList.appendChild(oLI);
  579.         }
  580.         else
  581.         {
  582.             var oLI = document.createElement("LI");
  583.             var oA = document.createElement("A");
  584.             var oIMG = document.createElement("IMG");
  585.             var iconType = aFilePath[0].substring(aFilePath[0].lastIndexOf(".")+1).toLowerCase();
  586.  
  587.             oA.innerText = aFilePath[0];
  588.             oA.id = L_PopupMenuID1_HTMLText;
  589.             oA.title = aFilePath[0];
  590.  
  591.             oIMG.alt = aFilePath[0];
  592.             oIMG.id = L_PopupMenuID2_HTMLText;
  593.             oIMG.width = 16;
  594.             oIMG.height = 16;
  595.             oIMG.hspace = 4;
  596.  
  597.             //    FOR ELEMENTS NOT CLICKABLE
  598.             if (iconType == "fts" || iconType == "hlp" || iconType == "hpj" || iconType == "dib" || iconType == "sdl" || iconType == "dll" || iconType == "licenses" || iconType == "projdata" || iconType == "doc" || iconType == "chm" || iconType == "mdb" || iconType == "exe" || iconType == "msi" || iconType == "cur" || iconType == "gif" || iconType == "png" || iconType == "bmp" || iconType == "ico" || iconType == "jpg" || iconType == "rle" || iconType == "avi" || iconType == "wav" || iconType == "wma" || iconType == "wmv")
  599.             {
  600.                 oA.className = "clsNoView";
  601.                 oIMG.className = "clsNoView";
  602.             }
  603.             else
  604.             {
  605.                 oA.className = L_VisualNote_HTMLText;    //    oA.href = "javascript:view(" + iFileIdx + ",'"+sID+"','"+sSFL+"','"+ oA.id+"');";
  606.                 oA.href = "javascript:";
  607.                 oA.onClick = "view(" + iFileIdx + ",'"+sID+"','"+sSFL+"','"+ oA.id+"');";
  608.                 oIMG.className = "clsNoHand";        //    oIMG.onClick = "javascript:view(" + iFileIdx + ",'"+sID+"','"+sSFL+"','"+ oA.id+"');";
  609.                 oIMG.onClick = "view(" + iFileIdx + ",'"+sID+"','"+sSFL+"','"+ oA.id+"');";
  610.             }
  611.  
  612.             if(sIcons.indexOf(iconType.toLowerCase())!=-1)
  613.             {    oIMG.src =  L_defaultLocation_HTMLText + iconType + "-icon.gif";    }
  614.             else
  615.             {    oIMG.src =  L_defaultLocation_HTMLText + "bluepage.gif";    }
  616.  
  617.             oLI.appendChild(oIMG);
  618.             oLI.appendChild(oA);
  619.  
  620.             var bDone = false;
  621.             for(var k = 0; k<oList.children.length;k++)
  622.             {
  623.                 if(oList.children[k].className=="kid")
  624.                 {
  625.                     oList.children[k].insertAdjacentElement("BeforeBegin",oLI);
  626.                     bDone = true;
  627.                     break;
  628.                 }
  629.             }
  630.             if(!bDone)
  631.             {    oList.appendChild(oLI);    }
  632.         }
  633.     }
  634. }
  635.  
  636.