Salome HOME
Fix problem with table of contents resizing
[modules/smesh.git] / doc / salome / gui / SMESH / whphost.js
index d4c80bb..1639132 100755 (executable)
@@ -1,3 +1,4 @@
+//     WebHelp 5.10.005\r
 var gaProj=new Array();\r
 var gnChecked=0;\r
 var gsProjName="";\r
@@ -87,7 +88,7 @@ function whCom(sName,sComFile)
                                var strFile= _getFullPath(getPath(), this.msComFile);\r
                                var oDiv=getElement(this.msDivId);\r
                                if(oDiv){\r
-                                       if(gbIE4){\r
+                                       if(gbIE4||gbOpera7){\r
                                                var nIFrameHeight=oDiv.style.pixelHeight;\r
                                                var nIFrameWidth=oDiv.style.pixelWidth;\r
                                                var sHTML="<IFRAME ID="+this.msIFrameId+" title=\"" + this.msName + "\" SRC=\""+strFile+"\" BORDER=0 FRAMEBORDER=no STYLE=\"width:";\r
@@ -98,8 +99,7 @@ function whCom(sName,sComFile)
                                                }\r
                                                oDiv.innerHTML=sHTML;\r
                                        }else if(gbNav6){\r
-                                               gsHTML="<IFRAME ID="+this.msIFrameId+" title=\"" + this.msName + "\" SRC=\""+strFile+"\" BORDER=0 FRAMEBORDER=no STYLE=\"width:100%;border:0;height:";\r
-                                               gsHTML+="100%;\"></IFRAME>";\r
+                                               gsHTML="<IFRAME ID="+this.msIFrameId+" title=\"" + this.msName + "\" SRC=\""+strFile+"\" BORDER=0 FRAMEBORDER=no STYLE=\"width:100%;border:0;height:100%;\"></IFRAME>";\r
                                                goDiv = oDiv;\r
                                                setTimeout("delayLoad()", 100);\r
                                        }\r
@@ -119,11 +119,12 @@ function whCom(sName,sComFile)
                var sHTML="";\r
                if(gbMac&&gbIE4)\r
                        sHTML+="<DIV ID="+this.msDivId+" ALIGN=left STYLE=\"position:absolute;z-index:1;left:0;top:0;width:100%;height:100%;margin:0;padding:0;border:0;\">";\r
+               else if(gbIE5)\r
+                       sHTML+="<DIV ID="+this.msDivId+" ALIGN=left STYLE=\"position:absolute;z-index:1;left:0;top:0;width:100%;height:100%;\">";\r
+               else if(gbIE4||gbWindows)\r
+                       sHTML+="<DIV ID="+this.msDivId+" ALIGN=left STYLE=\"position:absolute;z-index:1;left:0;top:0;width:100%;height:100%;visibility:hidden\">";\r
                else\r
-                       if (gbIE5)\r
-                               sHTML+="<DIV ID="+this.msDivId+" ALIGN=left STYLE=\"position:absolute;z-index:1;left:0;top:0;width:100%;height:100%;\">";\r
-                       else\r
-                               sHTML+="<DIV ID="+this.msDivId+" ALIGN=left STYLE=\"position:absolute;z-index:1;left:0;top:0;width:100%;height:100%;visibility:hidden\">";\r
+                       sHTML+="<DIV ID="+this.msDivId+" ALIGN=left STYLE=\"position:absolute;z-index:1;left:0;top:0;width:100%;height:100%;visibility:hidden\">";\r
                sHTML+="</DIV>";\r
                return sHTML;\r
        }\r
@@ -203,29 +204,68 @@ function getPath()
 goMan=new whComMan();\r
 function addPane(sName,sFileName)\r
 {\r
-       goMan.addCom(sName,sFileName);  \r
+       var oParam=new Object();\r
+       oParam.sName=sName;\r
+       var oMsg=new whMessage(WH_MSG_GETPANE, this, 1, oParam);\r
+       if (SendMessage(oMsg))\r
+       {\r
+               if (oMsg.oParam.bEnable)\r
+                       goMan.addCom(sName,sFileName);\r
+       }\r
+       else\r
+               goMan.addCom(sName,sFileName);  \r
 }\r
 \r
 function setShowPane(sName, bForce)\r
 {\r
        if ((gsFirstPane == "") || bForce)\r
-               gsFirstPane=sName;\r
+       {\r
+               var oMsg=new whMessage(WH_MSG_GETDEFPANE, this, 1, null);\r
+               if (SendMessage(oMsg))\r
+               {\r
+                       if (oMsg.oParam)\r
+                               gsFirstPane = oMsg.oParam;\r
+                       else\r
+                               gsFirstPane=sName;\r
+               }\r
+               else\r
+                       gsFirstPane=sName;\r
+       }\r
 }\r
 \r
 function window_OnLoad()\r
 {\r
-       if(gsProjName!="")\r
+       var oMsg=new whMessage(WH_MSG_GETCMD,this,1,null);\r
+       var bHidePane=false;\r
+       if (SendMessage(oMsg))\r
        {\r
-               goMan.init();\r
-               if(gsFirstPane!="")\r
-                       goMan.show(gsFirstPane);\r
-               else\r
-                       goMan.showById(0);\r
-               loadData2(gsProjName);\r
+               if(oMsg.oParam>0)\r
+               {\r
+                       if(oMsg.oParam==1)\r
+                               gsFirstPane="toc";\r
+                       else if(oMsg.oParam==2)\r
+                               gsFirstPane="idx";\r
+                       else if(oMsg.oParam==3)\r
+                               gsFirstPane="fts";\r
+                       else if(oMsg.oParam==4)\r
+                               gsFirstPane="glo";\r
+               }\r
+               else if(oMsg.oParam==0)\r
+               {\r
+                       bHidePane=true;\r
+               }\r
        }\r
-       else if (gServerEnabled)\r
+       goMan.init();\r
+       if(gsProjName!="")                      \r
+               loadData2(gsProjName);  \r
+       if (bHidePane)\r
+       {\r
+               gsFirstPane="";\r
+               var oMsg1=new whMessage(WH_MSG_HIDEPANE, this, 1, null)\r
+               SendMessage(oMsg1);\r
+       }\r
+       else\r
        {\r
-               goMan.init();\r
                if(gsFirstPane!="")\r
                        goMan.show(gsFirstPane);\r
                else\r
@@ -249,7 +289,7 @@ function loadData2(strFile)
 function addProject(bPreferXML,sXMLName,sHTMLName)\r
 {\r
        var bLoadXML=bPreferXML;\r
-       if(!gbIE4&&!gbNav6)\r
+       if(!gbIE4&&!gbNav6&&!gbOpera7)\r
                return;\r
        if(gbIE4&&!gbIE5)\r
                bLoadXML=false;\r
@@ -257,6 +297,8 @@ function addProject(bPreferXML,sXMLName,sHTMLName)
                bLoadXML=true;\r
        if(gbIE55||gbNav6)\r
                bLoadXML=true;\r
+       if(gbOpera7)\r
+               bLoadXML=false;         \r
        if(bLoadXML)\r
                addProjectXML(sXMLName);\r
        else\r
@@ -316,6 +358,8 @@ function putDataXML(xmlDoc,sdocPath)
                                var sURL=RmtProject[i].getAttribute("url");\r
                                if(sURL)\r
                                {\r
+                                       if(sURL.lastIndexOf("/")!=sURL.length-1)\r
+                                               sURL+="/";\r
                                        aRProj[nCount]=new Object();\r
                                        aRProj[nCount++].sPPath=_getFullPath(aRProj[0].sPPath,sURL);\r
                                }\r
@@ -326,11 +370,23 @@ function putDataXML(xmlDoc,sdocPath)
                {\r
                        // on Netscape 6.0 under some situation the xml file cannot be loaded.\r
                        // so we use pure html instead.\r
-                       setTimeout("redirectToList();",100);\r
+                       if (gnChecked == 0)\r
+                               setTimeout("redirectToList();",100);\r
+                       else\r
+                       {\r
+                               gnChecked++;\r
+                               setTimeout("checkRemoteProject();", 1);\r
+                       }\r
                }\r
        }\r
 }\r
 \r
+function onLoadXMLError()\r
+{\r
+       gnChecked++;\r
+       setTimeout("checkRemoteProject();", 1);\r
+}\r
+\r
 function redirectToList()\r
 {\r
        if(gbReDirectThis)\r
@@ -346,7 +402,7 @@ function putProjectInfo(aRProj)
                if(gnChecked!=0)\r
                {\r
                        if(aRProj[0].sLangId!=gaProj[0].sLangId)\r
-                               alert("The project: "+aRProj[0].sPPath+" is using a different language to the main project, which will cause the index and full text search functionality to be disabled for this remote project.");\r
+                               alert("The merged Help system "+aRProj[0].sPPath+" is using a different language from the master Help system, which will cause the index and full-text search functionality to be disabled in the merged Help system.");\r
                }\r
                gaProj[gnChecked]=aRProj[0];\r
                for(var i=1;i<aRProj.length;i++)\r
@@ -366,7 +422,7 @@ function putProjectInfo(aRProj)
                        }\r
                }\r
                gnChecked++;\r
-               checkRemoteProject();\r
+               setTimeout("checkRemoteProject();", 1);\r
        }\r
        else\r
                alert("Could not load correctly, please click Refresh.");\r
@@ -395,9 +451,8 @@ function cancelProj(i)
 {\r
        if(i==gnChecked)\r
        {\r
-               alert("Can't load project::"+gaProj[i].sPPath);\r
                gnChecked++;\r
-               checkRemoteProject();\r
+               setTimeout("checkRemoteProject();", 1);\r
        }       \r
 }\r
 \r
@@ -508,7 +563,7 @@ if(window.gbWhUtil&&window.gbWhMsg&&window.gbWhVer&&window.gbWhProxy)
        RegisterListener2(this,WH_MSG_SHOWGLO);\r
        RegisterListener2(this,WH_MSG_GETPANEINFO);\r
 \r
-       if((gbMac&&gbIE4)||(gbSunOS&&gbIE5))\r
+       if((gbMac&&gbIE4)||(gbSunOS&&gbIE5)||gbOpera7)\r
        {\r
                window.onresize=window_resize;\r
        }\r