source: ISOcat/trunk/mod-ISOcat-interface-gi/interface/JSXAPPS/launcher_ide.html @ 2029

Last change on this file since 2029 was 2029, checked in by mwindhouwer, 12 years ago

Initial import of all the *cats, i.e., ISOcat, RELcat and SCHEMAcat.

File size: 3.1 KB
Line 
1<!--
2  ~ Copyright (c) 2001-2011, TIBCO Software Inc.
3  ~ Use, modification, and distribution subject to terms of license.
4  -->
5<html>
6  <head>
7    <title>General Interface Builder Launcher</title>
8    <script type="text/javascript">
9     
10function launchApp() {
11  var builderURL = "file:///D:/user/menwin/projects/ISOcat/src/mod-gi-1.0.0/gi/tibco-gi/GI_Builder.html";
12 
13  try {
14    var url = decodeURI(window.location.href);
15    url = url.replace(/\\/g, "/");
16   
17    var appPath = getURIParam(url, "jsxapppath");
18    if (appPath) {
19      if (getURIParam(url, "xhtml") == "true")
20        builderURL = builderURL.replace(".html", ".xhtml");
21     
22      url = url.substring(0, url.indexOf("?"));
23      url = url.substring(0, url.lastIndexOf("/JSXAPPS/") + 1);
24      var relPath = relativizeURI(builderURL.substring(0, builderURL.lastIndexOf("/")), url);
25      window.location.href = builderURL + "?jsxproject=" + encodeURI(appPath) + "&jsxhome=" + encodeURI(relPath);
26    } else {
27      window.alert("Error: no application specified.");
28    }
29  } catch (e) {
30    window.alert("Error: " + e.description);
31  }
32}
33 
34function getURIParam(url, strParam) {
35  var regex = new RegExp("[\\?&]" + strParam + "=([^&]+)");
36  if (url.match(regex))
37    return RegExp.$1;
38  return null;
39};
40       
41function relativizeURI(from, to) {
42  var regex = /^(\w+):\/\/?\/?/;
43  if (from.match(regex)) {
44    var scheme = RegExp.$1;
45    if (to.match(regex)) {
46      if (scheme == RegExp.$1) {
47        from = from.replace(regex, "");
48        to = to.replace(regex, "");
49      }
50    }
51  }
52 
53  var thisTokens = from.split("/");
54  var thatTokens = to.split("/");
55 
56  var newTokens = [];
57   
58  var i = 0;
59  while (i < thisTokens.length && i < thatTokens.length) {
60    if (thisTokens[i] != thatTokens[i]) break;
61    i++;
62  }
63  for (var j = i; j < thisTokens.length; j++)
64    newTokens.push("..");
65   
66  for (var j = i; j < thatTokens.length; j++)
67    newTokens.push(thatTokens[j]);
68   
69  return newTokens.join("/");
70}
71function decodeURI(uri) {
72  var length = uri.length;
73  var decoded = new Array(length);
74  var j = 0;
75   
76  for (var i = 0; i < uri.length; i++) {
77    var chr = uri.charAt(i);
78    if (chr == "%") {
79      var octet = uri.substring(i+1, i+3);
80      decoded[j++] = String.fromCharCode(parseInt(octet, 16));
81      i += 2;
82    } else {
83      decoded[j++] = chr;
84    }
85  }
86   
87  return decoded.join(""); 
88}
89function encodeURI(uri) {
90  var strChars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789_-!.~'()*%";
91  var length = uri.length;
92  var encoded = new Array(length);
93 
94  for (var i = 0; i < length; i++) {
95    var chr = uri.charAt(i);
96   
97    if (strChars.indexOf(chr) < 0) {
98      var code = chr.charCodeAt(0);
99     
100      if (code < 16) {
101        encoded[i] = "%" + "0" + code.toString(16).toUpperCase();
102      } else if (code < 256) {
103        encoded[i] = "%" + code.toString(16).toUpperCase();
104      } else {
105        encoded[i] = chr;
106      }
107    } else {
108      encoded[i] = chr;
109    }
110  }
111 
112  return encoded.join("");   
113}
114     
115    </script>
116  </head>
117  <body onload="launchApp();">
118 
119  <div id="title">
120 
121  </div>
122  <div id="error"> 
123 
124  </div>
125 
126  </body>
127</html>
Note: See TracBrowser for help on using the repository browser.