Showing
2 changed files
with
0 additions
and
785 deletions
| 1 | - | ||
| 2 | -var MSIE = false; | ||
| 3 | -var ver = 0; | ||
| 4 | -var indexOfMSIE = navigator.userAgent.indexOf("MSIE"); | ||
| 5 | -var indexOfTrident = navigator.userAgent.indexOf("Trident"); | ||
| 6 | -if(indexOfMSIE != -1) | ||
| 7 | -{ | ||
| 8 | - MSIE = true; | ||
| 9 | - ver = parseFloat(navigator.userAgent.substring(indexOfMSIE + 5, navigator.userAgent.indexOf(";", indexOfMSIE))); | ||
| 10 | -} | ||
| 11 | -// O15 :3405219: Internet Explorer, from IE11 onwards will no longer supports the user Agent MSIE. | ||
| 12 | -// Alternative is to query the UA string for "Trident". | ||
| 13 | -// More information at : http://msdn.microsoft.com/en-us/library/ms537503(v=vs.85).aspx | ||
| 14 | -// Trident userAgent mapping: | ||
| 15 | -// Trident/7.0 IE11 | ||
| 16 | -// Trident/6.0 Internet Explorer 10 | ||
| 17 | -// Trident/5.0 Internet Explorer 9 | ||
| 18 | -// Trident/4.0 Internet Explorer 8 | ||
| 19 | -else if(indexOfTrident != -1) | ||
| 20 | -{ | ||
| 21 | - MSIE = true; | ||
| 22 | - // UserAgent Trident can end with a ';' or a ')' | ||
| 23 | - ver = parseFloat(navigator.userAgent.substring(indexOfTrident + 8, navigator.userAgent.indexOf(";", indexOfTrident))); | ||
| 24 | - if(ver == NaN) | ||
| 25 | - { | ||
| 26 | - ver = parseFloat(navigator.userAgent.substring(indexOfTrident + 8, navigator.userAgent.indexOf(")", indexOfTrident))); | ||
| 27 | - } | ||
| 28 | - ver += 4; // version of trident is 4 less to IE version number | ||
| 29 | -} | ||
| 30 | - | ||
| 31 | -var slInstalled = false; | ||
| 32 | -try | ||
| 33 | -{ | ||
| 34 | - var b = null; | ||
| 35 | - if (MSIE) | ||
| 36 | - { | ||
| 37 | - b = new ActiveXObject("AgControl.AgControl"); | ||
| 38 | - slInstalled = true; | ||
| 39 | - } | ||
| 40 | - else | ||
| 41 | - { | ||
| 42 | - var plugin = navigator.plugins["Silverlight Plug-In"]; | ||
| 43 | - if (plugin) | ||
| 44 | - { | ||
| 45 | - var version = plugin.description.split(".") | ||
| 46 | - if (parseInt(version[0]) >= 2) | ||
| 47 | - slInstalled = true; | ||
| 48 | - } | ||
| 49 | - } | ||
| 50 | -} | ||
| 51 | -catch(e) {} | ||
| 52 | - | ||
| 53 | -var isFirefox = navigator.userAgent.indexOf("Firefox") >= 0; | ||
| 54 | -var isMac = (navigator.appVersion.indexOf("Macintosh") >= 0); | ||
| 55 | - | ||
| 56 | -var vmlSupported = MSIE; | ||
| 57 | -var slSupported = (MSIE && ver >= 5 && !isMac) || isFirefox; | ||
| 58 | -var isUpLevel = vmlSupported || (slSupported && slInstalled); | ||
| 59 | -var fShowWidgets = (MSIE && ver >= 5 && !isMac) || isFirefox; | ||
| 60 | - | ||
| 61 | -var xmlData = XMLData("ILAP 2.5 Ontology Model - 20150418-filer/data.xml"); | ||
| 62 | - | ||
| 63 | -var g_RowStyleList = new Array( | ||
| 64 | - "propViewerEvenRow", | ||
| 65 | - "propViewerOddRow" | ||
| 66 | -); | ||
| 67 | - | ||
| 68 | -var strShape = "Figurnavn:"; | ||
| 69 | - | ||
| 70 | - | ||
| 71 | -// START ----- cross-browser event manipulation helpers --------------------------- | ||
| 72 | - | ||
| 73 | -function getEvent(event) | ||
| 74 | -{ | ||
| 75 | - // Retrieve the event in IE | ||
| 76 | - if (!event) | ||
| 77 | - return window.event; | ||
| 78 | - // Return the passed event for everything else | ||
| 79 | - return event; | ||
| 80 | -} | ||
| 81 | - | ||
| 82 | -function getSrcElem(event) | ||
| 83 | -{ | ||
| 84 | - var event = getEvent(event); | ||
| 85 | - | ||
| 86 | - // Reference the element howeaver this browser can | ||
| 87 | - var elem; | ||
| 88 | - if (event.target) // For Firefox | ||
| 89 | - elem = event.target; | ||
| 90 | - else if (event.srcElement) // For IE | ||
| 91 | - elem = event.srcElement; | ||
| 92 | - if (elem.nodeType == 3) // For Safari | ||
| 93 | - elem = elem.parentNode; | ||
| 94 | - | ||
| 95 | - | ||
| 96 | - return elem | ||
| 97 | -} | ||
| 98 | - | ||
| 99 | -function GetNSResolver(xml, xpath, xpathEval) | ||
| 100 | -{ | ||
| 101 | - var nsResolver = null; | ||
| 102 | - try | ||
| 103 | - { | ||
| 104 | - // Check for HLURL namespace in xpath | ||
| 105 | - // | ||
| 106 | - if (xpath.indexOf("HLURL:") != -1) | ||
| 107 | - { | ||
| 108 | - // Build the temp document whose document element binds the prefix HLURL | ||
| 109 | - var namespaceHolder = document.implementation.createDocument( | ||
| 110 | - "urn:schemas-microsoft-com:office:visio:dghlinkext", | ||
| 111 | - "HLURL:namespaceMapping", null); | ||
| 112 | - | ||
| 113 | - // Get the root element of the document and set the namespace | ||
| 114 | - var root = namespaceHolder.documentElement; | ||
| 115 | - root.setAttributeNS( | ||
| 116 | - "http://www.w3.org/2000/xmlns/", | ||
| 117 | - "xmlns:HLURL", "urn:schemas-microsoft-com:office:visio:dghlinkext"); | ||
| 118 | - | ||
| 119 | - // Create the namespace resolver using the root element to do the namespace bindings | ||
| 120 | - nsResolver = xpathEval.createNSResolver(root); | ||
| 121 | - } | ||
| 122 | - else | ||
| 123 | - nsResolver = xpathEval.createNSResolver(xml.ownerDocument == null ? xml.documentElement : xml.ownerDocument.documentElement); | ||
| 124 | - } | ||
| 125 | - catch (e) { } | ||
| 126 | - | ||
| 127 | - return nsResolver; | ||
| 128 | -} | ||
| 129 | - | ||
| 130 | -// END ---------------------------------------------------------------------------- | ||
| 131 | - | ||
| 132 | -// START cross-browser xpath manipulation helpers --------------------------------- | ||
| 133 | -if (document.implementation.hasFeature("XPath", "3.0")) | ||
| 134 | -{ | ||
| 135 | - Element.prototype.selectNodes = function (xpath) { | ||
| 136 | - var oEvaluator = new XPathEvaluator(); | ||
| 137 | - var nsResolver = GetNSResolver(this, xpath, oEvaluator); | ||
| 138 | - var oResult = oEvaluator.evaluate(xpath, this, nsResolver, XPathResult.ORDERED_NODE_SNAPSHOT_TYPE, null); | ||
| 139 | - | ||
| 140 | - var aResult = []; | ||
| 141 | - for( var i = 0; i < oResult.snapshotLength; i++) | ||
| 142 | - aResult[i] = oResult.snapshotItem(i); | ||
| 143 | - return aResult; | ||
| 144 | - }; | ||
| 145 | - Document.prototype.selectNodes = function(xpath) | ||
| 146 | - { | ||
| 147 | - return this.documentElement.selectNodes(xpath); | ||
| 148 | - } | ||
| 149 | -} | ||
| 150 | - | ||
| 151 | -function SelectSingleNode(xml, xpath) | ||
| 152 | -{ | ||
| 153 | - if (MSIE) | ||
| 154 | - return xml.selectSingleNode(xpath); | ||
| 155 | - else | ||
| 156 | - { | ||
| 157 | - var xpe = new XPathEvaluator(); | ||
| 158 | - var nsResolver = GetNSResolver(this, xpath, xpe); | ||
| 159 | - var results = xpe.evaluate(xpath,xml,nsResolver,XPathResult.FIRST_ORDERED_NODE_TYPE, null); | ||
| 160 | - return results.singleNodeValue; | ||
| 161 | - } | ||
| 162 | -} | ||
| 163 | - | ||
| 164 | -function SelectNodes(xml, xpath) | ||
| 165 | -{ | ||
| 166 | - return xml.selectNodes(xpath); | ||
| 167 | -} | ||
| 168 | -// END ---------------------------------------------------------------------------- | ||
| 169 | - | ||
| 170 | - | ||
| 171 | -function XMLData(file) | ||
| 172 | -{ | ||
| 173 | - var temp = null; | ||
| 174 | - if(isUpLevel) | ||
| 175 | - { | ||
| 176 | - // for IE | ||
| 177 | - if (MSIE) | ||
| 178 | - { | ||
| 179 | - temp = CreateObject("Microsoft.XMLDOM"); | ||
| 180 | - if (temp == null) | ||
| 181 | - temp = CreateObject("Msxml2.DOMDocument.6.0"); | ||
| 182 | - } | ||
| 183 | - // for everything else | ||
| 184 | - else | ||
| 185 | - { | ||
| 186 | - try | ||
| 187 | - { | ||
| 188 | - temp = document.implementation.createDocument("", "", null); | ||
| 189 | - } | ||
| 190 | - catch(e) {} | ||
| 191 | - } | ||
| 192 | - | ||
| 193 | - if (temp != null) | ||
| 194 | - { | ||
| 195 | - temp.async = false; | ||
| 196 | - | ||
| 197 | - temp.load(file); | ||
| 198 | - if (MSIE && temp.parseError.errorCode != 0) | ||
| 199 | - temp = null; | ||
| 200 | - } | ||
| 201 | - } | ||
| 202 | - | ||
| 203 | - return temp; | ||
| 204 | -} | ||
| 205 | - | ||
| 206 | -function CreateObject (strObj) | ||
| 207 | -{ | ||
| 208 | - var obj = null; | ||
| 209 | - eval ("try { obj = new ActiveXObject(strObj); } catch (e) {}"); | ||
| 210 | - return obj; | ||
| 211 | -} | ||
| 212 | - | ||
| 213 | -function doVersion() | ||
| 214 | -{ | ||
| 215 | - if(isUpLevel) | ||
| 216 | - { | ||
| 217 | - frmToolbar.divDownLevel.innerHTML = ""; | ||
| 218 | - frmToolbar.divUpLevel.innerHTML = frmWidgets.divData.innerHTML; | ||
| 219 | - } | ||
| 220 | -} | ||
| 221 | - | ||
| 222 | - | ||
| 223 | -function FindShapeXML (pageID, shapeID) | ||
| 224 | -{ | ||
| 225 | - var shapeObj = null; | ||
| 226 | - | ||
| 227 | - if (xmlData != null) | ||
| 228 | - { | ||
| 229 | - var pagesObj = SelectSingleNode(xmlData, "VisioDocument/Pages"); | ||
| 230 | - if(!pagesObj) | ||
| 231 | - { | ||
| 232 | - return null; | ||
| 233 | - } | ||
| 234 | - | ||
| 235 | - var pageQuerryString = './/Page[@ID = "' + pageID + '"]'; | ||
| 236 | - var pageObj = SelectSingleNode(pagesObj, pageQuerryString); | ||
| 237 | - if(pageObj == null) | ||
| 238 | - { | ||
| 239 | - return null; | ||
| 240 | - } | ||
| 241 | - | ||
| 242 | - var shapeQuerryString = './/Shape[@ID = "' + shapeID + '"]'; | ||
| 243 | - shapeObj = SelectSingleNode(pageObj, shapeQuerryString); | ||
| 244 | - } | ||
| 245 | - | ||
| 246 | - return shapeObj; | ||
| 247 | -} | ||
| 248 | - | ||
| 249 | -function OnShapeKey(pageID, shapeID, event) | ||
| 250 | -{ | ||
| 251 | - var e = event; | ||
| 252 | - if (MSIE) | ||
| 253 | - e = window.frmDrawing.event; | ||
| 254 | - | ||
| 255 | - if(e.keyCode == 13 && e.ctrlKey) //ctrl + enter | ||
| 256 | - { | ||
| 257 | - UpdateProps (pageID, shapeID); | ||
| 258 | - } | ||
| 259 | - else if (e.keyCode == 13) | ||
| 260 | - { | ||
| 261 | - OnShapeClick (pageID, shapeID, e); | ||
| 262 | - } | ||
| 263 | -} | ||
| 264 | - | ||
| 265 | -function OnShapeClick (pageID, shapeID, jsEvent, slEvent) // slEvent - Required for Silverlight only | ||
| 266 | -{ | ||
| 267 | - if (isUpLevel) | ||
| 268 | - { | ||
| 269 | - var e = jsEvent; | ||
| 270 | - if (MSIE) | ||
| 271 | - e = frmDrawing.window.event; | ||
| 272 | - if (frmToolbar.widgets && frmToolbar.widgets.Details && | ||
| 273 | - ((e != null && e.ctrlKey) || (e == null && slEvent.Ctrl))) // DOM or Silverlight events | ||
| 274 | - { | ||
| 275 | - UpdateProps (pageID, shapeID); | ||
| 276 | - } | ||
| 277 | - else | ||
| 278 | - { | ||
| 279 | - var shapeNode = FindShapeXML (pageID, shapeID); | ||
| 280 | - var hlObj = GetHLAction (shapeNode, pageID, shapeID); | ||
| 281 | - if (hlObj != null) | ||
| 282 | - { | ||
| 283 | - if (hlObj.DoFunction.length > 0) | ||
| 284 | - { | ||
| 285 | - eval (hlObj.DoFunction); | ||
| 286 | - } | ||
| 287 | - else if (hlObj.Hyperlink.length > 0) | ||
| 288 | - { | ||
| 289 | - if (hlObj.NewWindow) | ||
| 290 | - { | ||
| 291 | - window.open (hlObj.Hyperlink); | ||
| 292 | - } | ||
| 293 | - else | ||
| 294 | - { | ||
| 295 | - top.location.href = hlObj.Hyperlink.substr (0, 510); | ||
| 296 | - } | ||
| 297 | - } | ||
| 298 | - else if (e != null && getSrcElem(e) != null) | ||
| 299 | - { | ||
| 300 | - var elem = e.srcElement; | ||
| 301 | - var href = elem.origHref; | ||
| 302 | - if (href == null) | ||
| 303 | - { | ||
| 304 | - href = elem.href; | ||
| 305 | - } | ||
| 306 | - | ||
| 307 | - var target = elem.origTarget; | ||
| 308 | - if (target == null) | ||
| 309 | - { | ||
| 310 | - target = elem.target; | ||
| 311 | - } | ||
| 312 | - | ||
| 313 | - if (href && href.length > 0) | ||
| 314 | - { | ||
| 315 | - href = HTMLEscape (href); | ||
| 316 | - if (target && target == "_blank") | ||
| 317 | - { | ||
| 318 | - window.open (href); | ||
| 319 | - } | ||
| 320 | - else | ||
| 321 | - { | ||
| 322 | - top.location.href = href.substr (0, 510); | ||
| 323 | - } | ||
| 324 | - } | ||
| 325 | - } | ||
| 326 | - } | ||
| 327 | - } | ||
| 328 | - } | ||
| 329 | - | ||
| 330 | - return (!isUpLevel); | ||
| 331 | -} | ||
| 332 | - | ||
| 333 | -function UpdateProps(pageID, shapeID) | ||
| 334 | -{ | ||
| 335 | - var shape = FindShapeXML (pageID, shapeID); | ||
| 336 | - | ||
| 337 | - FillPropPane(shape, frmToolbar.hideDetails); | ||
| 338 | -} | ||
| 339 | - | ||
| 340 | -function UpdatePropsByShapeName(pageName, shapeName) | ||
| 341 | -{ | ||
| 342 | - var shape = FindShapeXMLByName (pageName, shapeName); | ||
| 343 | - | ||
| 344 | - FillPropPane(shape, frmToolbar.hideDetails); | ||
| 345 | -} | ||
| 346 | - | ||
| 347 | -function FillPropPane (shapeNode, outputDivObj ) | ||
| 348 | -{ | ||
| 349 | - if (shapeNode != null && outputDivObj != null) | ||
| 350 | - { | ||
| 351 | - if(outputDivObj.style.display == "none") | ||
| 352 | - { | ||
| 353 | - frmToolbar.ToggleWidget(outputDivObj); | ||
| 354 | - } | ||
| 355 | - | ||
| 356 | - var strCPHTML = ""; | ||
| 357 | - | ||
| 358 | - var shapeNameAttr = shapeNode.attributes.getNamedItem ("Name"); | ||
| 359 | - if (shapeNameAttr) | ||
| 360 | - { | ||
| 361 | - strCPHTML += "<span class='p2' style='padding-left:2px;'>" + strShape + " " + HTMLEscape(shapeNameAttr.value) + "</span>"; | ||
| 362 | - } | ||
| 363 | - | ||
| 364 | - var strTableHTML = CreatePropTable (shapeNode); | ||
| 365 | - if(strTableHTML.indexOf("<table") == -1) | ||
| 366 | - { | ||
| 367 | - strTableHTML = "<p class='p2' style='margin-left:1em;margin-top:0em;'>" + strTableHTML + "</p>"; | ||
| 368 | - } | ||
| 369 | - | ||
| 370 | - if (strTableHTML.length > 0) | ||
| 371 | - { | ||
| 372 | - strCPHTML += strTableHTML; | ||
| 373 | - } | ||
| 374 | - else | ||
| 375 | - { | ||
| 376 | - strCPHTML = strNoCustomPropertiesToDisplayText; | ||
| 377 | - } | ||
| 378 | - | ||
| 379 | - outputDivObj.innerHTML = strCPHTML; | ||
| 380 | - outputDivObj.minHeight = 75; | ||
| 381 | - } | ||
| 382 | -} | ||
| 383 | - | ||
| 384 | -function CreatePropTable (shapeNode) | ||
| 385 | -{ | ||
| 386 | - var strCPHTML = ""; | ||
| 387 | - var strStartTable = "<table class='propViewerTABLE' borderColor='#999999' cellPadding='2' width='95%' border='1' summary='Denne tabellen inneholder figurdetaljer'>"; | ||
| 388 | - strStartTable += "<THEAD class='propViewerTHEAD'><TH>Navn</TH><TH>Verdi</TH></THEAD>"; | ||
| 389 | - var strEndTable = "</TABLE>"; | ||
| 390 | - | ||
| 391 | - if (shapeNode != null) | ||
| 392 | - { | ||
| 393 | - var propColl = SelectNodes(shapeNode, "Prop"); | ||
| 394 | - | ||
| 395 | - var propCount = propColl.length; | ||
| 396 | - for (var count = 0; count < propCount; count++) | ||
| 397 | - { | ||
| 398 | - strCPHTML += "<TR class='" + g_RowStyleList[count % 2] + "'>"; | ||
| 399 | - | ||
| 400 | - var strLabelText = ""; | ||
| 401 | - oPropLabel = propColl.item(count).selectSingleNode("Label/textnode()"); | ||
| 402 | - if (oPropLabel != null) | ||
| 403 | - { | ||
| 404 | - strLabelText = HTMLEscape (oPropLabel.text); | ||
| 405 | - } | ||
| 406 | - else | ||
| 407 | - { | ||
| 408 | - oPropName = propColl.item(count).attributes.getNamedItem ("Name"); | ||
| 409 | - if (oPropName) | ||
| 410 | - { | ||
| 411 | - strLabelText = HTMLEscape (oPropName.text); | ||
| 412 | - } | ||
| 413 | - } | ||
| 414 | - | ||
| 415 | - if (strLabelText.length > 0) | ||
| 416 | - { | ||
| 417 | - strCPHTML += "<TD class='propViewerTD'>" + strLabelText + "</TD>"; | ||
| 418 | - strCPHTML += "<TD class='propViewerTD'>" | ||
| 419 | - | ||
| 420 | - var strValueText = " "; | ||
| 421 | - oPropValue = propColl.item(count).selectSingleNode("Value/textnode()"); | ||
| 422 | - if (oPropValue) | ||
| 423 | - { | ||
| 424 | - strValueText = HTMLEscape (oPropValue.text); | ||
| 425 | - } | ||
| 426 | - | ||
| 427 | - strCPHTML += strValueText + "</TD></TR>"; | ||
| 428 | - } | ||
| 429 | - } | ||
| 430 | - | ||
| 431 | - if(strCPHTML != "") | ||
| 432 | - { | ||
| 433 | - strCPHTML = strStartTable + strCPHTML + strEndTable; | ||
| 434 | - } | ||
| 435 | - else | ||
| 436 | - { | ||
| 437 | - strCPHTML = "Ingen detaljer er tilgjengelige."; | ||
| 438 | - } | ||
| 439 | - } | ||
| 440 | - | ||
| 441 | - return strCPHTML; | ||
| 442 | -} | ||
| 443 | - | ||
| 444 | -function keyHandler() | ||
| 445 | -{ | ||
| 446 | - var e = frmDrawing.window.event; | ||
| 447 | - if(e.keyCode == 13) //enter | ||
| 448 | - { | ||
| 449 | - e.srcElement.click(); | ||
| 450 | - } | ||
| 451 | -} | ||
| 452 | - | ||
| 453 | -function GoToPage(index) | ||
| 454 | -{ | ||
| 455 | - if (viewMgr) | ||
| 456 | - { | ||
| 457 | - viewMgr.loadPage (index); | ||
| 458 | - } | ||
| 459 | - else | ||
| 460 | - { | ||
| 461 | - DefPageLoad (index); | ||
| 462 | - } | ||
| 463 | -} | ||
| 464 | - | ||
| 465 | -function GoToPageByID(pageID) | ||
| 466 | -{ | ||
| 467 | - var pageIndex = PageIndexFromID (pageID); | ||
| 468 | - if (pageIndex >= 0) | ||
| 469 | - { | ||
| 470 | - GoToPage (pageIndex); | ||
| 471 | - } | ||
| 472 | -} | ||
| 473 | - | ||
| 474 | -function PageIndexFromID (pageID) | ||
| 475 | -{ | ||
| 476 | - if (g_FileList != null) | ||
| 477 | - { | ||
| 478 | - var entry; | ||
| 479 | - | ||
| 480 | - var count; | ||
| 481 | - var fileEntry; | ||
| 482 | - var bFoundEntry = false; | ||
| 483 | - for (count = 0; | ||
| 484 | - count < g_FileList.length && !bFoundEntry; | ||
| 485 | - count++) | ||
| 486 | - { | ||
| 487 | - if (pageID == g_FileList[count].PageID) | ||
| 488 | - { | ||
| 489 | - return count; | ||
| 490 | - } | ||
| 491 | - } | ||
| 492 | - } | ||
| 493 | - return -1; | ||
| 494 | -} | ||
| 495 | - | ||
| 496 | -function PageIndexFromName (strPageName) | ||
| 497 | -{ | ||
| 498 | - if (g_FileList != null) | ||
| 499 | - { | ||
| 500 | - var entry; | ||
| 501 | - | ||
| 502 | - var strPageNameLower = strPageName; | ||
| 503 | - strPageNameLower = strPageNameLower.toLowerCase (); | ||
| 504 | - | ||
| 505 | - var count; | ||
| 506 | - var fileEntry; | ||
| 507 | - var bFoundEntry = false; | ||
| 508 | - for (count = 0; | ||
| 509 | - count < g_FileList.length && !bFoundEntry; | ||
| 510 | - count++) | ||
| 511 | - { | ||
| 512 | - var strFileListPageName = g_FileList[count].PageName; | ||
| 513 | - strFileListPageName = HTMLUnescape (strFileListPageName); | ||
| 514 | - strFileListPageName = strFileListPageName.toLowerCase (); | ||
| 515 | - if (strPageNameLower == strFileListPageName) | ||
| 516 | - { | ||
| 517 | - return count; | ||
| 518 | - } | ||
| 519 | - } | ||
| 520 | - } | ||
| 521 | - return -1; | ||
| 522 | -} | ||
| 523 | - | ||
| 524 | -function PageIndexFromFileName (strFileName) | ||
| 525 | -{ | ||
| 526 | - if (g_FileList != null) | ||
| 527 | - { | ||
| 528 | - var entry; | ||
| 529 | - | ||
| 530 | - var strFileNameLower = strFileName; | ||
| 531 | - strFileNameLower = strFileNameLower.toLowerCase (); | ||
| 532 | - | ||
| 533 | - var count; | ||
| 534 | - var fileEntry; | ||
| 535 | - var bFoundEntry = false; | ||
| 536 | - for (count = 0; | ||
| 537 | - count < g_FileList.length && !bFoundEntry; | ||
| 538 | - count++) | ||
| 539 | - { | ||
| 540 | - var strFileListFileName = g_FileList[count].PriImage; | ||
| 541 | - strFileListFileName = strFileListFileName.toLowerCase (); | ||
| 542 | - if (strFileNameLower == strFileListFileName) | ||
| 543 | - { | ||
| 544 | - return count; | ||
| 545 | - } | ||
| 546 | - | ||
| 547 | - strFileListFileName = g_FileList[count].SecImage; | ||
| 548 | - strFileListFileName = strFileListFileName.toLowerCase (); | ||
| 549 | - if (strFileNameLower == strFileListFileName) | ||
| 550 | - { | ||
| 551 | - return count; | ||
| 552 | - } | ||
| 553 | - } | ||
| 554 | - } | ||
| 555 | - return -1; | ||
| 556 | -} | ||
| 557 | - | ||
| 558 | -function PageIndexFromVisioPageIndex (pageIndex) | ||
| 559 | -{ | ||
| 560 | - if (g_FileList != null) | ||
| 561 | - { | ||
| 562 | - var entry; | ||
| 563 | - | ||
| 564 | - var count; | ||
| 565 | - var fileEntry; | ||
| 566 | - var bFoundEntry = false; | ||
| 567 | - for (count = 0; | ||
| 568 | - count < g_FileList.length && !bFoundEntry; | ||
| 569 | - count++) | ||
| 570 | - { | ||
| 571 | - if (pageIndex == g_FileList[count].PageIndex) | ||
| 572 | - { | ||
| 573 | - return count; | ||
| 574 | - } | ||
| 575 | - } | ||
| 576 | - } | ||
| 577 | - return -1; | ||
| 578 | -} | ||
| 579 | - | ||
| 580 | -function FindShapeXMLByName (pageName, shapeName) | ||
| 581 | -{ | ||
| 582 | - var shapeObj = null; | ||
| 583 | - | ||
| 584 | - if (xmlData) | ||
| 585 | - { | ||
| 586 | - var pagesObj = SelectSingleNode(xmlData, "VisioDocument/Pages"); | ||
| 587 | - if(!pagesObj) | ||
| 588 | - { | ||
| 589 | - return null; | ||
| 590 | - } | ||
| 591 | - | ||
| 592 | - var pageQuerryString = './/Page[@Name $ieq$ "' + EscapeString (pageName) + '"]'; | ||
| 593 | - var pageObj = SelectSingleNode(pagesObj, pageQuerryString); | ||
| 594 | - if(!pageObj) | ||
| 595 | - { | ||
| 596 | - return null; | ||
| 597 | - } | ||
| 598 | - | ||
| 599 | - var shapeQuerryString = './/Shape[@Name $ieq$ "' + EscapeString (shapeName) + '"]'; | ||
| 600 | - shapeObj = SelectSingleNode(pageObj, shapeQuerryString); | ||
| 601 | - } | ||
| 602 | - | ||
| 603 | - return shapeObj; | ||
| 604 | -} | ||
| 605 | - | ||
| 606 | -function Unquote (str) | ||
| 607 | -{ | ||
| 608 | - var nStartIndex = 0; | ||
| 609 | - var nEndIndex = str.length; | ||
| 610 | - | ||
| 611 | - if (str.charAt (0) == '"') | ||
| 612 | - { | ||
| 613 | - nStartIndex = 1; | ||
| 614 | - } | ||
| 615 | - | ||
| 616 | - if (str.charAt (nEndIndex - 1) == '"') | ||
| 617 | - { | ||
| 618 | - nEndIndex -= 1; | ||
| 619 | - } | ||
| 620 | - | ||
| 621 | - return str.substring (nStartIndex, nEndIndex); | ||
| 622 | -} | ||
| 623 | - | ||
| 624 | -function ConvertXorYCoordinate(PosValue, OldMin, OldMax, NewMin, NewMax, MapBackwards) | ||
| 625 | -{ | ||
| 626 | - var OldMid = (OldMax - OldMin) / 2; | ||
| 627 | - var NewMid = (NewMax - NewMin) / 2; | ||
| 628 | - var ConvertResult = 1 * PosValue; | ||
| 629 | - ConvertResult = ConvertResult - (OldMin + OldMid); | ||
| 630 | - ConvertResult = ConvertResult / OldMid; | ||
| 631 | - if(MapBackwards != 0) | ||
| 632 | - { | ||
| 633 | - ConvertResult = 0 - ConvertResult; | ||
| 634 | - } | ||
| 635 | - ConvertResult = ConvertResult * NewMid; | ||
| 636 | - ConvertResult = ConvertResult + (NewMin + NewMid); | ||
| 637 | - return ConvertResult; | ||
| 638 | -} | ||
| 639 | - | ||
| 640 | -function showObject( divObject, divID ) | ||
| 641 | -{ | ||
| 642 | - if( divObject == null ) | ||
| 643 | - divObject = getObj( divID ); | ||
| 644 | - | ||
| 645 | - if( divObject != null ) | ||
| 646 | - { | ||
| 647 | - divObject.style.display = ""; | ||
| 648 | - divObject.style.visibility = "visible" | ||
| 649 | - } | ||
| 650 | - return divObject; | ||
| 651 | -} | ||
| 652 | - | ||
| 653 | -function hideObject( divObject, divID ) | ||
| 654 | -{ | ||
| 655 | - if( divObject == null ) | ||
| 656 | - divObject = getObj( divID ); | ||
| 657 | - | ||
| 658 | - if( divObject != null ) | ||
| 659 | - { | ||
| 660 | - divObject.style.visibility = "hidden"; | ||
| 661 | - divObject.style.display = "none"; | ||
| 662 | - } | ||
| 663 | - return divObject; | ||
| 664 | -} | ||
| 665 | - | ||
| 666 | -function EscapeString (str) | ||
| 667 | -{ | ||
| 668 | - var strResult = ""; | ||
| 669 | - | ||
| 670 | - for (var i = 0 ; i < str.length ; i++) | ||
| 671 | - { | ||
| 672 | - var curChar = str.charAt(i); | ||
| 673 | - if (curChar == '\\') | ||
| 674 | - { | ||
| 675 | - strResult += "\\\\"; | ||
| 676 | - } | ||
| 677 | - else if (curChar == "\"") | ||
| 678 | - { | ||
| 679 | - strResult += "\\\""; | ||
| 680 | - } | ||
| 681 | - else if (curChar == "\'") | ||
| 682 | - { | ||
| 683 | - strResult += "\\\'"; | ||
| 684 | - } | ||
| 685 | - else | ||
| 686 | - { | ||
| 687 | - strResult += curChar; | ||
| 688 | - } | ||
| 689 | - } | ||
| 690 | - | ||
| 691 | - return strResult; | ||
| 692 | -} | ||
| 693 | - | ||
| 694 | -function HTMLEscape (str) | ||
| 695 | -{ | ||
| 696 | - var strResult = ""; | ||
| 697 | - | ||
| 698 | - for (var i = 0 ; i < str.length ; i++) | ||
| 699 | - { | ||
| 700 | - var curChar = str.charAt(i); | ||
| 701 | - if (curChar == '\\') | ||
| 702 | - { | ||
| 703 | - strResult += "\"; | ||
| 704 | - } | ||
| 705 | - else if (curChar == '\"') | ||
| 706 | - { | ||
| 707 | - strResult += """; | ||
| 708 | - } | ||
| 709 | - else if (curChar == '\'') | ||
| 710 | - { | ||
| 711 | - strResult += "'"; | ||
| 712 | - } | ||
| 713 | - else if (curChar == '<') | ||
| 714 | - { | ||
| 715 | - strResult += "<"; | ||
| 716 | - } | ||
| 717 | - else if (curChar == '<') | ||
| 718 | - { | ||
| 719 | - strResult += ">"; | ||
| 720 | - } | ||
| 721 | - else if (curChar == '&') | ||
| 722 | - { | ||
| 723 | - strResult += "&"; | ||
| 724 | - } | ||
| 725 | - else | ||
| 726 | - { | ||
| 727 | - strResult += curChar; | ||
| 728 | - } | ||
| 729 | - } | ||
| 730 | - | ||
| 731 | - return strResult; | ||
| 732 | -} | ||
| 733 | - | ||
| 734 | -function HTMLUnescape (str) | ||
| 735 | -{ | ||
| 736 | - var strResult = ""; | ||
| 737 | - var strEscapePattern = "&#xx;"; | ||
| 738 | - | ||
| 739 | - for (var i = 0 ; i < str.length - strEscapePattern.length + 1; i++) | ||
| 740 | - { | ||
| 741 | - if (str.charAt(i) == '&' && | ||
| 742 | - str.charAt(i + 1) == '#' && | ||
| 743 | - str.charAt(i + 4) == ';') | ||
| 744 | - { | ||
| 745 | - var charCode = str.charAt(i + 2); | ||
| 746 | - charCode += str.charAt(i + 3); | ||
| 747 | - | ||
| 748 | - if (charCode == "34") | ||
| 749 | - { | ||
| 750 | - strResult += '"'; | ||
| 751 | - } | ||
| 752 | - else if (charCode == "39") | ||
| 753 | - { | ||
| 754 | - strResult += '\''; | ||
| 755 | - } | ||
| 756 | - else if (charCode == "60") | ||
| 757 | - { | ||
| 758 | - strResult += '<'; | ||
| 759 | - } | ||
| 760 | - else if (charCode == "62") | ||
| 761 | - { | ||
| 762 | - strResult += '>'; | ||
| 763 | - } | ||
| 764 | - else if (charCode == "92") | ||
| 765 | - { | ||
| 766 | - strResult += '\\'; | ||
| 767 | - } | ||
| 768 | - else if (charCode == "38") | ||
| 769 | - { | ||
| 770 | - strResult += '&'; | ||
| 771 | - } | ||
| 772 | - | ||
| 773 | - i = i + strEscapePattern.length - 1; | ||
| 774 | - } | ||
| 775 | - else | ||
| 776 | - { | ||
| 777 | - strResult += str.charAt(i); | ||
| 778 | - } | ||
| 779 | - } | ||
| 780 | - | ||
| 781 | - strResult += str.substring (i, str.length); | ||
| 782 | - | ||
| 783 | - return strResult; | ||
| 784 | -} | ||
| 785 | - |
-
Please register or login to post a comment