var MSIE = false; var ver = 0; var indexOfMSIE = navigator.userAgent.indexOf("MSIE"); var indexOfTrident = navigator.userAgent.indexOf("Trident"); if(indexOfMSIE != -1) { MSIE = true; ver = parseFloat(navigator.userAgent.substring(indexOfMSIE + 5, navigator.userAgent.indexOf(";", indexOfMSIE))); } // Internet Explorer, from IE11 onwards will no longer supports the user Agent MSIE. // Alternative is to query the UA string for "Trident". // More information at : http://msdn.microsoft.com/en-us/library/ms537503(v=vs.85).aspx // Trident userAgent mapping: // Trident/7.0 IE11 // Trident/6.0 Internet Explorer 10 // Trident/5.0 Internet Explorer 9 // Trident/4.0 Internet Explorer 8 else if(indexOfTrident != -1) { MSIE = true; // UserAgent Trident can end with a ';' or a ')' ver = parseFloat(navigator.userAgent.substring(indexOfTrident + 8, navigator.userAgent.indexOf(";", indexOfTrident))); if(ver == NaN) { ver = parseFloat(navigator.userAgent.substring(indexOfTrident + 8, navigator.userAgent.indexOf(")", indexOfTrident))); } ver += 4; // version of trident is 4 less to IE version number } var slInstalled = false; try { var b = null; if (MSIE) { b = new ActiveXObject("AgControl.AgControl"); slInstalled = true; } else { var plugin = navigator.plugins["Silverlight Plug-In"]; if (plugin) { var version = plugin.description.split(".") if (parseInt(version[0]) >= 2) slInstalled = true; } } } catch(e) {} var isFirefox = navigator.userAgent.indexOf("Firefox") >= 0; var isMac = (navigator.appVersion.indexOf("Macintosh") >= 0); var vmlSupported = MSIE; var slSupported = (MSIE && ver >= 5 && !isMac) || isFirefox; var isUpLevel = vmlSupported || (slSupported && slInstalled); var fShowWidgets = (MSIE && ver >= 5 && !isMac) || isFirefox; var xmlData = XMLData("WirtualnaUczelnia_files/data.xml"); var g_RowStyleList = new Array( "propViewerEvenRow", "propViewerOddRow" ); var strShape = "Shape Name:"; // START ----- cross-browser event manipulation helpers --------------------------- function getEvent(event) { // Retrieve the event in IE if (!event) return window.event; // Return the passed event for everything else return event; } function getSrcElem(event) { var event = getEvent(event); // Reference the element howeaver this browser can var elem; if (event.target) // For Firefox elem = event.target; else if (event.srcElement) // For IE elem = event.srcElement; if (elem.nodeType == 3) // For Safari elem = elem.parentNode; return elem } function GetNSResolver(xml, xpath, xpathEval) { var nsResolver = null; try { // Check for HLURL namespace in xpath // if (xpath.indexOf("HLURL:") != -1) { // Build the temp document whose document element binds the prefix HLURL var namespaceHolder = document.implementation.createDocument( "urn:schemas-microsoft-com:office:visio:dghlinkext", "HLURL:namespaceMapping", null); // Get the root element of the document and set the namespace var root = namespaceHolder.documentElement; root.setAttributeNS( "http://www.w3.org/2000/xmlns/", "xmlns:HLURL", "urn:schemas-microsoft-com:office:visio:dghlinkext"); // Create the namespace resolver using the root element to do the namespace bindings nsResolver = xpathEval.createNSResolver(root); } else nsResolver = xpathEval.createNSResolver(xml.ownerDocument == null ? xml.documentElement : xml.ownerDocument.documentElement); } catch (e) { } return nsResolver; } // END ---------------------------------------------------------------------------- // START cross-browser xpath manipulation helpers --------------------------------- if (document.implementation.hasFeature("XPath", "3.0")) { Element.prototype.selectNodes = function (xpath) { var oEvaluator = new XPathEvaluator(); var nsResolver = GetNSResolver(this, xpath, oEvaluator); var oResult = oEvaluator.evaluate(xpath, this, nsResolver, XPathResult.ORDERED_NODE_SNAPSHOT_TYPE, null); var aResult = []; for( var i = 0; i < oResult.snapshotLength; i++) aResult[i] = oResult.snapshotItem(i); return aResult; }; Document.prototype.selectNodes = function(xpath) { return this.documentElement.selectNodes(xpath); } } function SelectSingleNode(xml, xpath) { if (MSIE) return xml.selectSingleNode(xpath); else { var xpe = new XPathEvaluator(); var nsResolver = GetNSResolver(this, xpath, xpe); var results = xpe.evaluate(xpath,xml,nsResolver,XPathResult.FIRST_ORDERED_NODE_TYPE, null); return results.singleNodeValue; } } function SelectNodes(xml, xpath) { return xml.selectNodes(xpath); } // END ---------------------------------------------------------------------------- function XMLData(file) { var temp = null; if(isUpLevel) { // for IE if (MSIE) { temp = CreateObject("Microsoft.XMLDOM"); if (temp == null) temp = CreateObject("Msxml2.DOMDocument.6.0"); } // for everything else else { try { temp = document.implementation.createDocument("", "", null); } catch(e) {} } if (temp != null) { temp.async = false; temp.load(file); if (MSIE && temp.parseError.errorCode != 0) temp = null; } } return temp; } function CreateObject (strObj) { var obj = null; eval ("try { obj = new ActiveXObject(strObj); } catch (e) {}"); return obj; } function doVersion() { if(isUpLevel) { frmToolbar.divDownLevel.innerHTML = ""; frmToolbar.divUpLevel.innerHTML = frmWidgets.divData.innerHTML; } } function FindShapeXML (pageID, shapeID) { var shapeObj = null; if (xmlData != null) { var pagesObj = SelectSingleNode(xmlData, "VisioDocument/Pages"); if(!pagesObj) { return null; } var pageQuerryString = './/Page[@ID = "' + pageID + '"]'; var pageObj = SelectSingleNode(pagesObj, pageQuerryString); if(pageObj == null) { return null; } var shapeQuerryString = './/Shape[@ID = "' + shapeID + '"]'; shapeObj = SelectSingleNode(pageObj, shapeQuerryString); } return shapeObj; } function OnShapeKey(pageID, shapeID, event) { var e = event; if (MSIE) e = window.frmDrawing.event; if(e.keyCode == 13 && e.ctrlKey) //ctrl + enter { UpdateProps (pageID, shapeID); } else if (e.keyCode == 13) { OnShapeClick (pageID, shapeID, e); } } function OnShapeClick (pageID, shapeID, jsEvent, slEvent) // slEvent - Required for Silverlight only { if (isUpLevel) { var e = jsEvent; if (MSIE) e = frmDrawing.window.event; if (frmToolbar.widgets && frmToolbar.widgets.Details && ((e != null && e.ctrlKey) || (e == null && slEvent.Ctrl))) // DOM or Silverlight events { UpdateProps (pageID, shapeID); } else { var shapeNode = FindShapeXML (pageID, shapeID); var hlObj = GetHLAction (shapeNode, pageID, shapeID); if (hlObj != null) { if (hlObj.DoFunction.length > 0) { eval (hlObj.DoFunction); } else if (hlObj.Hyperlink.length > 0) { if (hlObj.NewWindow) { window.open (hlObj.Hyperlink); } else { top.location.href = hlObj.Hyperlink.substr (0, 510); } } else if (e != null && getSrcElem(e) != null) { var elem = e.srcElement; var href = elem.origHref; if (href == null) { href = elem.href; } var target = elem.origTarget; if (target == null) { target = elem.target; } if (href && href.length > 0) { href = HTMLEscape (href); if (target && target == "_blank") { window.open (href); } else { top.location.href = href.substr (0, 510); } } } } } } return (!isUpLevel); } function UpdateProps(pageID, shapeID) { var shape = FindShapeXML (pageID, shapeID); FillPropPane(shape, frmToolbar.hideDetails); } function UpdatePropsByShapeName(pageName, shapeName) { var shape = FindShapeXMLByName (pageName, shapeName); FillPropPane(shape, frmToolbar.hideDetails); } function FillPropPane (shapeNode, outputDivObj ) { if (shapeNode != null && outputDivObj != null) { if(outputDivObj.style.display == "none") { frmToolbar.ToggleWidget(outputDivObj); } var strCPHTML = ""; var shapeNameAttr = shapeNode.attributes.getNamedItem ("Name"); if (shapeNameAttr) { strCPHTML += "" + strShape + " " + HTMLEscape(shapeNameAttr.value) + ""; } var strTableHTML = CreatePropTable (shapeNode); if(strTableHTML.indexOf("
Label | Value | "; var strEndTable = "
---|