connections.js 98 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122
  1. // Licensed Materials - Property of IBM
  2. //
  3. // IBM Cognos Products: ps
  4. //
  5. // (C) Copyright IBM Corp. 2005, 2021
  6. //
  7. // US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
  8. // Copyright (C) 2008 Cognos ULC, an IBM Company. All rights reserved.
  9. // Cognos (R) is a trademark of Cognos ULC, (formerly Cognos Incorporated).
  10. var DUAL_CNX_STR_SEPARATOR = 'IBM_JD_CNX_STR:';
  11. function isDualStackConnectString(connectionString) {
  12. return (connectionString.indexOf(DUAL_CNX_STR_SEPARATOR) != -1) ? true : false ;
  13. }
  14. function buildConnectString(connectType, connectVariant) {
  15. // reset the connect string
  16. var f = document.pform;
  17. f.m_p_connectionString.value = '';
  18. var connectTypes = connectType.split(",");
  19. for (var i = 0; i < connectTypes.length; i++) {
  20. if (i != 0) {
  21. // append special separator
  22. f.m_p_connectionString.value += DUAL_CNX_STR_SEPARATOR;
  23. }
  24. // trim off the whitespace
  25. var type = connectTypes[i].replace(/^\s\s*/, '').replace(/\s\s*$/, '');
  26. f.m_p_connectionString.value += _buildConnectString(type, connectVariant);
  27. }
  28. }
  29. function parseConnectString(connectType, credentialNamespaces, connectVariant) {
  30. var connectTypes = connectType.split(",");
  31. var connectStrings = document.pform.m_p_connectionString.value.split(DUAL_CNX_STR_SEPARATOR);
  32. for (var i = 0; i < connectTypes.length; i++) {
  33. if (i < connectStrings.length) {
  34. // trim off the whitespace
  35. var type = connectTypes[i].replace(/^\s\s*/, '').replace(/\s\s*$/, '');
  36. _parseConnectString(type, connectStrings[i], credentialNamespaces, connectVariant);
  37. }
  38. }
  39. }
  40. function _buildConnectString(connectType, connectVariant)
  41. {
  42. var connectString = '';
  43. var f = document.pform;
  44. if (connectType == 'redbrick' || connectType == 'sybaseIQ' || connectType == 'openEdge')
  45. {
  46. connectString = ';LOCAL';
  47. var type = '';
  48. if (connectType == 'redbrick')
  49. {
  50. type = 'RB'
  51. }
  52. else if (connectType == 'sybaseIQ')
  53. {
  54. type = 'IQ';
  55. }
  56. else if (connectType == 'openEdge')
  57. {
  58. type = 'PG';
  59. }
  60. connectString += ';' + type;
  61. connectString += ';DSN=' + f.m_connection_database.value;
  62. if (f.m_connection_use_userid.checked)
  63. {
  64. var prefix = '^User ID:';
  65. connectString += ';UID=%s';
  66. if (f.m_connection_use_pword.checked)
  67. {
  68. prefix += '\^\?Password:';
  69. connectString += ';PWD=%s';
  70. }
  71. connectString = prefix + connectString;
  72. }
  73. connectString += ';' + f.m_connection_string.value;
  74. connectString += '@ASYNC=' + ((isCheckboxChecked(f.m_connection_use_async)) ? '1' : '0');
  75. connectString += '@' + f.m_connection_connect_time.value;
  76. connectString += '/' + f.m_connection_reply_time.value;
  77. if (connectType == 'openEdge' || connectType == 'sybaseIQ')
  78. {
  79. if (f.m_connection_odbc_access_mode.checked)
  80. connectString += '@UNICODE';
  81. }
  82. connectString += '@COLSEQ=' + f.m_connection_colseq.value;
  83. }
  84. else if (connectType == 'odbc' || connectType == 'composite' || connectType == 'virtualviewmanager' || connectType == 'sqlodbc' || connectType == 'teradata' || connectType == 'db2' || connectType == 'netezza')
  85. {
  86. connectString = ';LOCAL';
  87. var type = '';
  88. if (connectType == 'odbc')
  89. {
  90. type = 'OD';
  91. }
  92. else if (connectType == 'sqlodbc')
  93. {
  94. type = 'SS';
  95. }
  96. else if (connectType == 'db2')
  97. {
  98. type = 'D2';
  99. }
  100. else if (connectType == 'teradata')
  101. {
  102. type = 'TD';
  103. }
  104. else if (connectType == 'composite')
  105. {
  106. type = 'CS'; //Composite connection.
  107. }
  108. else if (connectType == 'netezza')
  109. {
  110. type = 'NZ';
  111. }
  112. else
  113. {
  114. type = 'VM'; //Virtual View Manager
  115. }
  116. connectString += ';' + type;
  117. connectString += ';DSN=' + f.m_connection_database.value;
  118. if (isRadioButtonSelected(f.authentication, 'namespace') || isRadioButtonSelected(f.authentication, 'signon'))
  119. {
  120. var prefix = '^User ID:';
  121. connectString += ';UID=%s';
  122. if (f.m_connection_use_pword.checked || isRadioButtonSelected(f.authentication, 'namespace'))
  123. {
  124. prefix += '\^\?Password:';
  125. connectString += ';PWD=%s';
  126. }
  127. // for third party namespace authentication we need to put Trusted_Connection=yes in the connection string
  128. if (isRadioButtonSelected(f.authentication, 'namespace') && connectType != 'teradata' && connectType != 'db2' && connectType != 'odbc' && connectType != 'netezza')
  129. {
  130. connectString += ';Trusted_Connection=yes';
  131. }
  132. connectString = prefix + connectString;
  133. }
  134. else if ((connectType == 'sqlodbc') && isRadioButtonSelected(f.authentication, 'windows'))
  135. {
  136. connectString += ';Trusted_Connection=yes';
  137. }
  138. connectString += ';' + f.m_connection_string.value;
  139. connectString += '@ASYNC=' + (isCheckboxChecked(f.m_connection_use_async) ? '1' : '0');
  140. connectString += '@' + f.m_connection_connect_time.value;
  141. connectString += '/' + f.m_connection_reply_time.value;
  142. if (connectType == 'odbc' || connectType == 'composite' || connectType == 'virtualviewmanager')
  143. {
  144. if (f.m_connection_odbc_access_mode.checked)
  145. connectString += '@UNICODE';
  146. }
  147. if (connectType == 'db2')
  148. {
  149. if (isCheckboxChecked(f.m_connection_trusted_context))
  150. { connectString += '@TRUSTED_CONTEXT';
  151. if (f.m_connection_identity_propagation && f.m_connection_identity_propagation.value!='')
  152. {
  153. connectString += '@REGISTRY_NAME=' + f.m_connection_identity_propagation.value;
  154. }
  155. }
  156. }
  157. if (isCheckboxChecked(f.m_transformUserIdentification)){
  158. connectString += '@TRANSFORMUID';
  159. }
  160. connectString += '@COLSEQ=' + f.m_connection_colseq.value;
  161. }
  162. else if (connectType == 'consolidation' || connectType == 'contributor' || connectType == 'contributorSeries7')
  163. {
  164. connectString = ';LOCAL';
  165. var type = '';
  166. var padid = '';
  167. if (connectType == 'consolidation')
  168. {
  169. type = 'CL';
  170. }
  171. else if (connectType == 'contributor')
  172. {
  173. type = 'CR';
  174. }
  175. else if (connectType == 'contributorSeries7')
  176. {
  177. type = 'CR';
  178. if (f.m_connection_padid && f.m_connection_padid.value != null)
  179. {
  180. padid = f.m_connection_padid.value;
  181. }
  182. }
  183. connectString += ';' + type;
  184. if (connectType == 'consolidation')
  185. {
  186. connectString += ';SERVER=' + f.m_connection_servername.value;
  187. connectString += ';PORT=' + f.m_connection_port.value;
  188. } else if (connectType == 'contributorSeries7') {
  189. connectString += ';SERVER=' + f.m_connection_servername.value;
  190. connectString += ';PORT=' + f.m_connection_port.value;
  191. if ( padid != '' )
  192. {
  193. connectString += ';PADID=' + padid + ';UID=%s;PWD=%s';
  194. }
  195. } else if (connectType == 'contributor')
  196. {
  197. if (f.m_p_credentialNamespaces && f.m_p_credentialNamespaces.options[f.m_p_credentialNamespaces.selectedIndex].value != '')
  198. {
  199. connectString += ';UID=%s;PWD=%s';
  200. }
  201. }
  202. if (connectType == 'consolidation')
  203. {
  204. connectString += ';UID=%s;PWD=%s';
  205. }
  206. }
  207. else if (connectType == 'dbtwoolap')
  208. {
  209. connectString = ';LOCAL';
  210. connectString += ';DO';
  211. connectString += ';SERVER=' + f.m_connection_servername.value;
  212. if (f.authentication[1].checked || f.authentication[2].checked)
  213. {
  214. var prefix = '^User ID:';
  215. connectString += ';UID=%s';
  216. if (f.m_connection_use_pword.checked || f.authentication[1].checked)
  217. {
  218. prefix += '\^\?Password:';
  219. connectString += ';PWD=%s';
  220. }
  221. connectString = prefix + connectString;
  222. }
  223. }
  224. else if (connectType == 'tm1')
  225. {
  226. connectString = ';LOCAL';
  227. connectString += ';TM';
  228. connectString += ';TM1AdminHost=' + f.m_connection_hostname.value;
  229. connectString += ';TM1ServerName=' + f.m_connection_servername.value;
  230. if (f.authentication[1].checked || f.authentication[2].checked)
  231. {
  232. var prefix = '^User ID:';
  233. connectString += ';UID=%s';
  234. if (f.m_connection_use_pword.checked || f.authentication[1].checked)
  235. {
  236. prefix += '\^\?Password:';
  237. connectString += ';PWD=%s';
  238. }
  239. connectString = prefix + connectString;
  240. }
  241. }
  242. else if (connectType == 'tm1R')
  243. {
  244. connectString = ';LOCAL';
  245. connectString += ';TMR;LCID=en-us';
  246. connectString += ';TM1AdminHost=' + f.m_connection_hostname.value;
  247. if (f.m_connection_use_ssl.checked){
  248. connectString += ';TM1Protocol=https';
  249. } else {
  250. connectString += ';TM1Protocol=http';
  251. }
  252. connectString += ';TM1ServerPort=' + f.m_connection_tm1port.value;
  253. connectString += ';TM1ServerName=TM1ServerName;CATALOG=CATALOG';
  254. if (f.authentication[1].checked || f.authentication[2].checked)
  255. {
  256. var prefix = '^User ID:';
  257. connectString += ';UID=%s';
  258. if (f.m_connection_use_pword.checked || f.authentication[1].checked)
  259. {
  260. prefix += '\^\?Password:';
  261. connectString += ';PWD=%s';
  262. }
  263. connectString += ";";
  264. connectString = prefix + connectString;
  265. }
  266. }
  267. else if (connectType == 'odata')
  268. {
  269. connectString = ';LOCAL';
  270. connectString += ';ODATA';
  271. connectString += ';URL=' + f.m_connection_service_root_URI.value;
  272. if (f.authentication[1].checked)
  273. {
  274. var prefix = '^User ID:';
  275. connectString += ';UID=%s';
  276. if (f.m_connection_use_pword.checked || f.authentication[1].checked)
  277. {
  278. prefix += '\^\?Password:';
  279. connectString += ';PWD=%s';
  280. }
  281. connectString = prefix + connectString;
  282. }
  283. }
  284. else if (connectType == 'json')
  285. {
  286. connectString = ';LOCAL';
  287. connectString += ';JSON';
  288. connectString += ';URL=' + f.m_connection_url.value;
  289. if(f.m_connection_subType) {
  290. connectString += ';SUBTYPE=' + f.m_connection_subType;
  291. }
  292. if(f.m_connection_assembly.checked) {
  293. connectString += ';ASSEMBLY=true';
  294. }
  295. if(!f.m_connection_schema.disabled && f.m_connection_schema.value) {
  296. connectString += ';SCHEMA=' + f.m_connection_schema.value;
  297. }
  298. if(!f.m_connection_http_method.disabled) {
  299. connectString += ';METHOD=' + f.m_connection_http_method.value;
  300. }
  301. if(f.m_connection_http_mime_type && !f.m_connection_http_mime_type.disabled && f.m_connection_http_mime_type.value) {
  302. connectString += ';MIME_TYPE=' + f.m_connection_http_mime_type.value;
  303. }
  304. if(f.m_connection_http_message_body && !f.m_connection_http_message_body.disabled && f.m_connection_http_message_body.value) {
  305. connectString += ';DATA=' + f.m_connection_http_message_body.value;
  306. }
  307. if(!f.m_connection_json_path.disabled && f.m_connection_json_path.value) {
  308. connectString += ';PATH=' + f.m_connection_json_path.value;
  309. }
  310. if(f.m_connection_authentication_type.value == 'OAuth1.0'){
  311. connectString += ';TEMPORARY_TOKEN_ENDPOINT=' + f.m_connection_temporary_token_endpoint.value;
  312. connectString += ';AUTHORIZATION_ENDPOINT=' + f.m_connection_authorization_endpoint.value;
  313. connectString += ';TOKEN_ENDPOINT=' + f.m_connection_token_endpoint.value;
  314. }
  315. if(f.m_connection_authentication_type.value == 'OAuth2.0'){
  316. connectString += ';AUTHORIZATION_ENDPOINT=' + f.m_connection_authorization_endpoint.value;
  317. connectString += ';TOKEN_ENDPOINT=' + f.m_connection_token_endpoint.value;
  318. if (f.m_connection_scope.value)
  319. {
  320. connectString += ';SCOPE=' + f.m_connection_scope.value;
  321. }
  322. }
  323. connectString += ';AUTHENTICATION_TYPE=' + f.m_connection_authentication_type.value;
  324. if (f.m_connection_authentication_type.value != 'None')
  325. {
  326. connectString += ';UID=%s';
  327. connectString += ';PWD=%s';
  328. }
  329. }
  330. else if (connectType == 'cognosnow')
  331. {
  332. connectString = ';LOCAL';
  333. connectString += ';LA';
  334. connectString += ';SERVER=' + f.m_connection_servername.value;
  335. if (f.m_connection_port.value != '')
  336. {
  337. connectString += ':' + f.m_connection_port.value;
  338. }
  339. connectString += f.m_connection_file.value;
  340. }
  341. else if (connectType == 'msas_xmla')
  342. {
  343. connectString = ';LOCAL';
  344. connectString += ';X8';
  345. connectString += ';SERVER=' + f.m_connection_servername.value;
  346. if (f.m_connection_locale)
  347. {
  348. connectString += ';LCID=' + f.m_connection_locale.value;
  349. }
  350. if (f.m_connection_use_userid.checked)
  351. {
  352. var prefix = '^User ID:';
  353. connectString += ';UID=%s';
  354. if (f.m_connection_use_pword.checked)
  355. {
  356. prefix += '\^\?Password:';
  357. connectString += ';PWD=%s';
  358. }
  359. connectString = prefix + connectString;
  360. }
  361. }
  362. else if (connectType == 'msanalysis2005' || connectType == 'msanalysis2008' || connectType == 'msanalysis2012' || connectType == 'msanalysis2014' || connectType == 'msanalysis2016' || connectType == 'msanalysis2017')
  363. {
  364. connectString = ';LOCAL';
  365. var type = '';
  366. if (connectType == 'msanalysis2005')
  367. {
  368. type = 'YK';
  369. }
  370. else if (connectType == 'msanalysis2008')
  371. {
  372. type = 'M8';
  373. }
  374. else if (connectType == 'msanalysis2012')
  375. {
  376. type = 'M12';
  377. }
  378. else if (connectType == 'msanalysis2014')
  379. {
  380. type = 'M14';
  381. }
  382. else if (connectType == 'msanalysis2016')
  383. {
  384. type = 'M16';
  385. }
  386. else if (connectType == 'msanalysis2017')
  387. {
  388. type = 'M17';
  389. }
  390. connectString += ';' + type;
  391. connectString += ';SERVER=' + f.m_connection_servername.value;
  392. if ( trim(f.m_connection_namedinstance.value) != '')
  393. {
  394. connectString += '\\' + f.m_connection_namedinstance.value;
  395. }
  396. if (f.authentication[1].checked || f.authentication[2].checked)
  397. {
  398. var prefix = '^User ID:';
  399. connectString += ';UID=%s';
  400. if (f.m_connection_use_pword.checked || f.authentication[1].checked)
  401. {
  402. prefix += '\^\?Password:';
  403. connectString += ';PWD=%s';
  404. }
  405. connectString = prefix + connectString;
  406. }
  407. if (f.authentication[0].checked)
  408. {
  409. connectString += ';Trusted_Connection=yes';
  410. }
  411. if (f.m_connection_locale)
  412. {
  413. connectString += ';LCID=' + f.m_connection_locale.value;
  414. }
  415. }
  416. else if (connectType == 'powercube')
  417. {
  418. connectString = ';LOCAL';
  419. connectString += ';PC';
  420. connectString += ';WIN_PATH=' + f.m_connection_windows_cube.value;
  421. connectString += ';UNIX_PATH=' + f.m_connection_unix_cube.value;
  422. if (f.m_connection_cache_size && f.m_connection_cache_size.value != '')
  423. {
  424. connectString += ';readCacheSize=' + f.m_connection_cache_size.value;
  425. }
  426. if (f.cube_password_checkbox && f.cube_password_checkbox.checked)
  427. {
  428. connectString = '^?Password:' + connectString;
  429. connectString += ';cubePassword=%s';
  430. }
  431. }
  432. else if (connectType == 'sql' || connectType == 'sql2005' || connectType == 'sql2008' || connectType == 'sql2012-2014')
  433. {
  434. if (connectType == 'sql')
  435. {
  436. connectString = ';LOCAL;OL;DBInfo_Type=MS;Provider=SQLOLEDB';
  437. }
  438. else if (connectType == 'sql2005')
  439. {
  440. connectString = ';LOCAL;OL;DBInfo_Type=MS;Provider=SQLNCLI';
  441. }
  442. else if (connectType == 'sql2008')
  443. {
  444. connectString = ';LOCAL;OL;DBInfo_Type=MS;Provider=SQLNCLI10';
  445. }
  446. else if (connectType == 'sql2012-2014')
  447. {
  448. connectString = ';LOCAL;OL;DBInfo_Type=MS;Provider=SQLNCLI11';
  449. }
  450. if (f.authentication[2].checked || f.authentication[3].checked)
  451. {
  452. var prefix = '^User ID:';
  453. connectString += ';User ID=%s';
  454. if (f.m_connection_use_pword.checked || f.authentication[2].checked)
  455. {
  456. prefix += '\^\?Password:';
  457. connectString += ';Password=%s';
  458. }
  459. connectString = prefix + connectString;
  460. }
  461. connectString += ';Data Source=' + f.m_connection_database.value;
  462. if (f.authentication[1].checked || f.authentication[2].checked)
  463. {
  464. connectString += ';Integrated Security=SSPI';
  465. }
  466. var cat = isRadioButtonSelected(f.m_connection_sql_database_choice, 'master') ? 'master' : f.m_connection_sql_database_name.value;
  467. connectString += ';Provider_String=Initial Catalog=' + cat;
  468. if (f.m_connection_sql_application.value != '')
  469. {
  470. connectString += ';Application=';
  471. connectString += f.m_connection_sql_application.value;
  472. }
  473. if (connectType == 'sql2005' || connectType == 'sql2008' || connectType == 'sql2012-2014')
  474. {
  475. if (isListItemSelected(f.m_connection_sql_marsconnection, 'YES'))
  476. {
  477. connectString += ';MarsConn=YES';
  478. }
  479. }
  480. if (f.m_connection_optional_parameters.value && f.m_connection_optional_parameters.value != '')
  481. {
  482. connectString += ';' + f.m_connection_optional_parameters.value;
  483. }
  484. connectString += ';';
  485. if (isCheckboxChecked(f.m_transformUserIdentification))
  486. {
  487. connectString += '@TRANSFORMUID';
  488. }
  489. connectString += '@COLSEQ=' + f.m_connection_colseq.value;
  490. }
  491. else if (connectType == 'oracle')
  492. {
  493. connectString = ';LOCAL;OR;ORACLE@';
  494. var prefix = '';
  495. if (f.m_connection_use_userid.checked || isRadioButtonSelected(f.authentication, 'namespace'))
  496. {
  497. prefix = '^User ID:';
  498. connectString += '%s';
  499. }
  500. connectString += '@' + f.m_connection_database.value + '/';
  501. if ((f.m_connection_use_userid.checked && f.m_connection_use_pword.checked) || isRadioButtonSelected(f.authentication, 'namespace'))
  502. {
  503. prefix += '^?Password:';
  504. connectString += '%s';
  505. }
  506. connectString = prefix + connectString;
  507. if (isCheckboxChecked(f.m_transformUserIdentification))
  508. {
  509. connectString += '@TRANSFORMUID';
  510. }
  511. connectString += '@COLSEQ=' + f.m_connection_colseq.value;
  512. }
  513. else if (connectType == 'sybase' || connectType == 'sybase_ct15')
  514. {
  515. connectString = ';LOCAL;';
  516. if (connectType == 'sybase')
  517. {
  518. connectString += 'CT;';
  519. } else
  520. {
  521. connectString += 'CT15;';
  522. }
  523. connectString += f.m_connection_database.value;
  524. connectString += '|';
  525. var cat;
  526. if (f.m_connection_sybase_database_choice[0].checked)
  527. {
  528. cat = 'master';
  529. }
  530. else
  531. {
  532. cat = f.m_connection_sybase_database_name.value;
  533. }
  534. connectString += cat;
  535. connectString += '@';
  536. if (f.m_connection_use_userid.checked)
  537. {
  538. var prefix = '^User ID:';
  539. connectString += '%s/';
  540. if (f.m_connection_use_pword.checked)
  541. {
  542. prefix += '^?Password:';
  543. connectString += '%s';
  544. }
  545. connectString = prefix + connectString;
  546. }
  547. connectString += '@';
  548. connectString += f.m_connection_connect_time.value;
  549. connectString += '/';
  550. connectString += f.m_connection_reply_time.value;
  551. connectString += '@';
  552. connectString += f.m_connection_packet.value;
  553. connectString += '@ASYNC=';
  554. connectString += f.m_connection_sybase_async.options[f.m_connection_sybase_async.selectedIndex].value;
  555. connectString += '@POLL=';
  556. connectString += f.m_connection_polling.value;
  557. connectString += '@APPNAME=';
  558. connectString += f.m_connection_sybase_application.value;
  559. connectString += '@COLSEQ=';
  560. connectString += f.m_connection_colseq.value;
  561. }
  562. else if (connectType == 'informix')
  563. {
  564. connectString = ';LOCAL;IF;';
  565. connectString += f.m_connection_database.value;
  566. connectString += '@';
  567. connectString += f.m_connection_hostname.value;
  568. connectString += ':';
  569. connectString += f.m_connection_servername.value;
  570. connectString += '|';
  571. if (f.m_connection_service[0].checked)
  572. {
  573. connectString += f.m_connection_service[0].value;
  574. }
  575. else if (f.m_connection_service[1].checked)
  576. {
  577. connectString += f.m_connection_service[1].value;
  578. }
  579. else
  580. {
  581. if (f.m_connection_service_name.value != '')
  582. {
  583. connectString += f.m_connection_service_name.value;
  584. }
  585. }
  586. if (f.m_connection_use_userid.checked)
  587. {
  588. var prefix = '^User ID:';
  589. connectString += '@%s';
  590. if (f.m_connection_use_pword.checked)
  591. {
  592. prefix += '^?Password:';
  593. connectString += '/%s';
  594. }
  595. connectString = prefix + connectString;
  596. }
  597. connectString += '@COLSEQ=';
  598. connectString += f.m_connection_colseq.value;
  599. }
  600. else if (connectType == 'sr3')
  601. {
  602. connectString = ';LOCAL;ERP-SAP;URL=sap:';
  603. var prefix = '^User ID:';
  604. if (f.m_connection_use_pword.checked || f.authentication[0].checked)
  605. {
  606. prefix += '\^\?Password:';
  607. }
  608. connectString = prefix + connectString;
  609. if (f.m_connection_use_loadbalancing_hidden.value == "true")
  610. {
  611. connectString += 'LB:' + f.m_connection_message_server.value + ':' + f.m_connection_system_id.value + ':' + f.m_connection_logon_group.value + ':';
  612. }
  613. else
  614. {
  615. connectString += f.m_connection_application_server.value + ':' + f.m_connection_system_number.value + ':';
  616. }
  617. connectString += 'ROUTER_STRING=' + f.m_connection_router_string.value;
  618. connectString += ':' + f.m_connection_client.value + ':' + f.m_connection_language.value + ';';
  619. connectString += 'MAX_CONN=' + f.m_connection_max_conn_in_pool.value + ';';
  620. connectString += 'ABAP_QUERY_DB_ACCESSES=' + f.m_connection_abap_query_db_access_limit.value + ';';
  621. connectString += 'TABLE_READ_COUNT=' + f.m_connection_table_row_count.value + ';';
  622. connectString += 'READ_TABLE_FUNCTION_NAME=' + f.m_connection_table_read_function.value + ';';
  623. connectString += 'DRIVER_NAME=com.cognos.jdbc.driver.sap.SAPJdbcDriver';
  624. }
  625. else if (connectType == 'sfdc')
  626. {
  627. connectString = ';LOCAL;ERP-SFDC;URL=sfdc:' + f.m_connection_url.value;
  628. var prefix = '^User ID:';
  629. if (f.m_connection_use_pword.checked || f.authentication[0].checked)
  630. {
  631. prefix += '\^\?Password:';
  632. }
  633. connectString = prefix + connectString;
  634. connectString += ';CONCURRENT_CALLS_LIMIT=' + f.m_connection_conc_calls_limit.value + ';USER_CONCURRENT_CALLS_LIMIT=';
  635. connectString += f.m_connection_user_conc_calls_limit.value + ';CONNECTION_TIMEOUT=';
  636. connectString += f.m_connection_timeout.value + ';QUERY_BATCH_SIZE=';
  637. connectString += f.m_connection_query_batch_size.value + ';MAX_RETRIES=';
  638. connectString += f.m_connection_max_retries.value + ';WAIT_BETWEEN_RETRIES=';
  639. connectString += f.m_connection_wait_between_retries.value + ';PROXY_ENABLED=';
  640. if (f.m_connection_proxy_enabled.value == "true")
  641. {
  642. connectString += f.m_connection_proxy_enabled.value + ';PROXY_HOST=';
  643. connectString += f.m_connection_proxy_host.value + ';PROXY_PORT=';
  644. connectString += f.m_connection_proxy_port.value;
  645. }
  646. else
  647. {
  648. connectString += 'false';
  649. }
  650. connectString += ';USE_REST_API=';
  651. connectString += 'FALSE;CLIENT_ID=';
  652. connectString += ';CLIENT_SECRET=';
  653. connectString += ';';
  654. connectString += 'DRIVER_NAME=com.cognos.jdbc.driver.sfdc.SFDCJdbcDriver';
  655. }
  656. else if (connectType == 'siebel')
  657. {
  658. connectString = ';LOCAL;ERP-SIEBEL;URL=Siebel.';
  659. var prefix = '^User ID:';
  660. if (f.m_connection_use_pword.checked || f.authentication[0].checked)
  661. {
  662. prefix += '\^\?Password:';
  663. }
  664. connectString = prefix + connectString;
  665. connectString += f.m_connection_transport.value + '.';
  666. connectString += f.m_connection_encryption.value + '.';
  667. connectString += f.m_connection_compression.value + ':';
  668. connectString += '//' + f.m_connection_gatewayserver.value + ':';
  669. connectString += f.m_connection_gatewayport.value + '/' + f.m_connection_enterprise_name.value + '/';
  670. connectString += f.m_connection_aom.value + '_' + f.m_connection_language.value + ';';
  671. if (f.m_connection_siebel_repo.value != "")
  672. {
  673. connectString += 'REPOSITORY_NAME=' + f.m_connection_siebel_repo.value + ';';
  674. }
  675. if (f.m_connection_login_retries.value != "")
  676. {
  677. connectString += 'LOGIN_RETRY_COUNT=' + f.m_connection_login_retries.value + ';';
  678. }
  679. if (f.m_connection_login_retry_delay.value != "")
  680. {
  681. connectString += 'LOGIN_RETRY_DELAY=' + f.m_connection_login_retry_delay.value + ';';
  682. }
  683. if (f.m_connection_local_sort.value != "")
  684. {
  685. connectString += 'LOCALSORT=' + f.m_connection_local_sort.value + ';';
  686. }
  687. if (f.m_connection_level.value != "")
  688. {
  689. connectString += 'LEVEL=' + f.m_connection_level.value + ';';
  690. }
  691. if (f.m_connection_charset.value != "")
  692. {
  693. connectString += 'CHARSET=' + f.m_connection_charset.value + ';';
  694. }
  695. if (f.m_connection_adv_parameters.value != "")
  696. {
  697. connectString += 'ADVANCED_PARAMETERS=' + f.m_connection_adv_parameters.value + ';';
  698. }
  699. connectString += 'DRIVER_NAME=com.cognos.jdbc.driver.siebel.SiebelJdbcDriver';
  700. }
  701. else if (connectType == 'sap')
  702. {
  703. var sapType = f.m_connection_sap_type.options[f.m_connection_sap_type.selectedIndex].value;
  704. connectString = '^User ID:^?Password:;LOCAL;BW;serverType=';
  705. connectString += sapType + ';';
  706. connectString += 'server=';
  707. connectString += f.m_connection_database.value + ';';
  708. if (sapType == 'applicationServer')
  709. {
  710. connectString += 'sysnr=';
  711. connectString += f.m_connection_sys_no.value + ';';
  712. }
  713. if (sapType == 'messageServer')
  714. {
  715. connectString += 'sysid=';
  716. connectString += f.m_connection_sys_id.value + ';';
  717. }
  718. connectString += 'client=';
  719. connectString += f.m_connection_client_no.value + ';';
  720. if (sapType == 'messageServer')
  721. {
  722. connectString += 'logonGroup=';
  723. connectString += f.m_connection_logon.value + ';';
  724. }
  725. if (f.m_connection_sap_codepage.value != '')
  726. {
  727. connectString += 'codePage=';
  728. connectString += f.m_connection_sap_codepage.value + ';';
  729. }
  730. connectString += 'UID=%s;PWD=%s;';
  731. if (f.m_connection_router_string && f.m_connection_router_string.value != '')
  732. {
  733. connectString += 'routerString=';
  734. connectString += f.m_connection_router_string.value + ';';
  735. }
  736. if (isCheckboxChecked(f.m_transformUserIdentification))
  737. {
  738. connectString += '@TRANSFORMUID=TRUE';
  739. }
  740. }
  741. else if (connectType == 'sapR3' || connectType == 'sapECC')
  742. {
  743. if (connectType == 'sapR3')
  744. {
  745. connectString = '^User ID:^?Password:;LOCAL;R3;hostname=';
  746. }
  747. else if (connectType == 'sapECC')
  748. {
  749. connectString = '^User ID:^?Password:;LOCAL;EC;hostname=';
  750. }
  751. connectString += f.m_connection_hostname.value + ';';
  752. connectString += 'sysnr=';
  753. connectString += f.m_connection_sys_no.value + ';';
  754. connectString += 'gateway_host=';
  755. connectString += f.m_connection_gateway_host.value + ';';
  756. connectString += 'gateway_service=';
  757. connectString += f.m_connection_gateway_service.value + ';';
  758. connectString += 'destination=';
  759. connectString += f.m_connection_destination.value + ';';
  760. connectString += 'client=';
  761. connectString += f.m_connection_client.value + ';';
  762. connectString += 'UID=%s;PWD=%s;';
  763. connectString += 'language=';
  764. connectString += f.m_connection_sap_language.value + ';';
  765. if (f.m_connection_dictionary && f.m_connection_dictionary.value != '')
  766. {
  767. connectString += 'dictionary=';
  768. connectString += f.m_connection_dictionary.value + ';';
  769. }
  770. connectString += 'background=';
  771. if (f.m_connection_background.checked)
  772. {
  773. connectString += 'ON;';
  774. }
  775. else
  776. {
  777. connectString += 'OFF;';
  778. }
  779. if (connectType == 'sapR3')
  780. {
  781. if (f.m_connection_cogudaouterjoin.options[f.m_connection_cogudaouterjoin.selectedIndex].value == 'ON')
  782. {
  783. //No need to add it when the value is off.
  784. connectString += 'cogudaouterjoin=ON;';
  785. }
  786. }
  787. connectString += '@COLSEQ=';
  788. connectString += f.m_connection_colseq.value;
  789. }
  790. else if (connectType == 'xml')
  791. {
  792. connectString = ';LOCAL;XML;';
  793. connectString += f.m_connection_database.value;
  794. }
  795. else if (connectType == 'jdbc-db2')
  796. {
  797. // [^User ID:][^?Password:];LOCAL;JD-D2;URL=<URLSPEC>;DRIVER_NAME=com.ibm.db2.jcc.DB2Driver[;CognosProperty1=value1[;...]]
  798. // where
  799. // URLSPEC = jdbc:db2://<SERVERNAME>:<PORT>/<DBNAME>[:[jdbcproperty1=jdbcvalue1][;jdbcproperty2=jdbcvalue2]...]
  800. // Authentication: [0] None, [1] Namespace, [2] Signon (User ID/[Password])
  801. if (f.authentication[1].checked || f.authentication[2].checked) {
  802. var prefix = '^User ID:';
  803. if (f.m_connection_use_pword.checked || f.authentication[1].checked){
  804. prefix += '\^\?Password:';
  805. }
  806. connectString = prefix + connectString;
  807. }
  808. connectString += ';LOCAL;JD-D2';
  809. connectString += ';URL=jdbc:db2://' + f.m_connection_servername.value + ':' + f.m_connection_port.value + '/' + f.m_connection_jdbc_database_name.value;
  810. if (f.m_connection_jdbc_parameters.value != '') {
  811. connectString += ':' + f.m_connection_jdbc_parameters.value;
  812. }
  813. connectString += ';DRIVER_NAME=com.ibm.db2.jcc.DB2Driver';
  814. if (isCheckboxChecked(f.m_transformUserIdentification)){
  815. connectString += '@TRANSFORMUID=TRUE';
  816. }
  817. if (f.m_connection_jdbc_sort_colseq.value != '') {
  818. connectString += ';LOCALSORT=' + f.m_connection_jdbc_sort_colseq.value + ';LEVEL=' + f.m_connection_jdbc_sort_level.value;
  819. }
  820. }
  821. else if (connectType == 'jdbc-oracle')
  822. {
  823. // [^User ID:][^?Password:];LOCAL;JD-OR;URL=<URLSPEC>;DRIVER_NAME=oracle.jdbc.OracleDriver [;CognosProperty1=value1[;...]]
  824. // where
  825. // URLSPEC = jdbc:oracle:thin:@//<SERVERNAME>:<PORT>/<SERVICE_D>
  826. // URLSPEC = jdbc:oracle:thin:@(DESCRIPTION=...)
  827. // URLSPEC = jdbc:oracle:thin:@(DESCRIPTION_LIST=...)
  828. // URLSPEC = jdbc:oracle:oci:@<TNS_NAME>
  829. // URLSPEC = jdbc:oracle:oci:@(DESCRIPTION=...)
  830. // or URLSPEC = jdbc:oracle:oci:@(DESCRIPTION_LIST=...)
  831. // Authentication: Signon (User ID/[Password])
  832. if (f.m_connection_use_userid.checked || isRadioButtonSelected(f.authentication, 'namespace')) {
  833. connectString += '^User ID:';
  834. }
  835. if ((f.m_connection_use_userid.checked && f.m_connection_use_pword.checked) || isRadioButtonSelected(f.authentication, 'namespace')) {
  836. connectString += '^?Password:';
  837. }
  838. connectString += ';LOCAL;JD-OR;URL=jdbc:oracle:';
  839. if (f.m_connection_jdbc_oracle_style[0].checked) {
  840. connectString += "thin:@//" + f.m_connection_servername.value + ":" + f.m_connection_port.value + "/" + f.m_connection_oracle_service_id.value;
  841. } else if (f.m_connection_jdbc_oracle_style[1].checked) {
  842. connectString += "oci:@" + f.m_connection_oracle_tns_name.value;
  843. } else {
  844. if (f.m_connection_jdbc_oracle_driver_type[0].checked) {
  845. connectString += "thin:@";
  846. } else {
  847. connectString += "oci:@";
  848. }
  849. connectString += stripSpecialCharsFromOracleNetDesc(f.m_connection_oracle_net_descriptor.value);
  850. }
  851. connectString += ';DRIVER_NAME=oracle.jdbc.OracleDriver';
  852. if (isCheckboxChecked(f.m_transformUserIdentification))
  853. {
  854. connectString += '@TRANSFORMUID=TRUE';
  855. }
  856. var properties = f.m_connection_jdbc_parameters.value;
  857. if (properties != '' )
  858. {
  859. connectString += ';'
  860. connectString += properties;
  861. }
  862. if (f.m_connection_jdbc_sort_colseq.value != '') {
  863. connectString += ';LOCALSORT=' + f.m_connection_jdbc_sort_colseq.value + ';LEVEL=' + f.m_connection_jdbc_sort_level.value;
  864. }
  865. }
  866. else if (connectType == 'jdbc-generic' || connectType == 'lob-jdbc')
  867. {
  868. // [^User ID:][^?Password:];LOCAL;JDBC-OR;URL=<URLSPEC>;DRIVER_NAME=<DRIVER_NAME>[;CognosProperty1=value1[;...]]
  869. // where
  870. // URLSPEC = specific to the driver
  871. var connectString = '';
  872. if (f.authentication[2].checked) {
  873. connectString += '^User ID:';
  874. if (f.m_connection_use_pword.checked) {
  875. connectString += '^?Password:';
  876. }
  877. }
  878. connectString += ';LOCAL;JDBC;URL=';
  879. var url = f.m_jdbc_connection_url.value;
  880. connectString += url;
  881. connectString += ';DRIVER_NAME=' + f.m_jdbc_driver_class.value + ';';
  882. if (isCheckboxChecked(f.m_transformUserIdentification)){
  883. connectString += '@TRANSFORMUID=TRUE';
  884. }
  885. var properties = f.m_jdbc_connection_properties.value;
  886. connectString += properties;
  887. if (properties != '' && properties.charAt(properties.length - 1) != ';')
  888. {
  889. connectString += ';';
  890. }
  891. if (f.m_connection_jdbc_sort_colseq.value != '') {
  892. connectString += 'LOCALSORT=' + f.m_connection_jdbc_sort_colseq.value + ';LEVEL=' + f.m_connection_jdbc_sort_level.value;
  893. }
  894. }
  895. else if (connectType == 'filenet')
  896. {
  897. // [^User ID:][^?Password:];LOCAL;RP-CMIS-FILENET;URL=<URLSPEC>;DRIVER_NAME=<DRIVER_NAME>[;CognosProperty1=value1[;...]]
  898. // where
  899. // URLSPEC = specific to the driver
  900. // Authentication: Signon (User ID/[Password])
  901. var repositoryPluginClass;
  902. var provider;
  903. if (f.m_connection_jdbc_driverclass.value.indexOf('CMIS_') == 0) {
  904. repositoryPluginClass = 'com.ibm.cognos.cm.CMISRepository.CMISRepositoryPlugin';
  905. provider = f.m_connection_jdbc_driverclass.value.substring(5);
  906. if (f.m_connection_use_userid.checked) {
  907. connectString += '^User ID:';
  908. }
  909. if (f.m_connection_use_userid.checked && f.m_connection_use_pword.checked) {
  910. connectString += '^?Password:';
  911. }
  912. }
  913. connectString += ';LOCAL;RP-CMIS-FILENET;URL=';
  914. if (f.m_connection_jdbc_driverclass.value == 'FileSystem') {
  915. repositoryPluginClass = 'com.ibm.cognos.cm.fileSystemPlugin.FileSystemArchivePlugin';
  916. connectString += "alias:"
  917. }
  918. connectString += f.m_connection_jdbc_url.value + ";DRIVER_NAME=" + repositoryPluginClass;
  919. if (f.m_connection_file.value != '') {
  920. connectString += ';ROOT=' + f.m_connection_file.value;
  921. }
  922. if (f.m_connection_jdbc_parameters.value != '') {
  923. providerIdx = f.m_connection_jdbc_parameters.value.indexOf('PROVIDER=');
  924. if (providerIdx < 0 && provider != null) {
  925. connectString += ';PROVIDER=' + provider;
  926. }
  927. connectString += ';' + f.m_connection_jdbc_parameters.value;
  928. } else {
  929. if (provider != null) {
  930. connectString += ';PROVIDER=' + provider;
  931. }
  932. }
  933. }
  934. else if (connectType == 'jdbc-sql')
  935. {
  936. // [^User ID:][^?Password:];LOCAL;JD-SS;URL=<URLSPEC>;DRIVER_NAME=com.microsoft.sqlserver.jdbc.SQLServerDriver[;CognosProperty1=value1[;...]]
  937. // where
  938. // URLSPEC = jdbc:sqlserver://<SERVERNAME>[:<PORT>][;INSTANCENAME=<INSTNAME>];DATABASE=<DB>[;LOGINTIMEOUT=<TIMEOUT>][;integratedSecurity=true][;[jdbcproperty1=jdbcvalue1][;jdbcproperty2=jdbcvalue2]...]
  939. // Authentication: [0] None, [1] C8 service creds, [2] Namespace, [3] Signon (User ID/[Password])
  940. if (f.authentication[2].checked || f.authentication[3].checked) {
  941. connectString = '^User ID:';
  942. if (f.m_connection_use_pword.checked || f.authentication[2].checked) {
  943. connectString += '\^\?Password:';
  944. }
  945. }
  946. connectString += ';LOCAL;JD-SS';
  947. connectString += ';URL=jdbc:sqlserver://' + f.m_connection_servername.value;
  948. if (f.m_connection_port.value != '') {
  949. connectString += ':' + f.m_connection_port.value;
  950. }
  951. connectString += ';DATABASE=' + f.m_connection_jdbc_database_name.value;
  952. if (f.m_connection_sql_instance_name.value != '') {
  953. connectString += ';INSTANCENAME=' + f.m_connection_sql_instance_name.value;
  954. }
  955. if (f.m_connection_jdbc_connect_time.value != '') {
  956. connectString += ';LOGINTIMEOUT=' + f.m_connection_jdbc_connect_time.value;
  957. }
  958. if (f.authentication[1].checked || f.authentication[2].checked) {
  959. connectString += ';integratedSecurity=true';
  960. }
  961. if (f.m_connection_jdbc_parameters.value != '') {
  962. connectString += ';' + f.m_connection_jdbc_parameters.value;
  963. }
  964. connectString += ';DRIVER_NAME=com.microsoft.sqlserver.jdbc.SQLServerDriver';
  965. if (isCheckboxChecked(f.m_transformUserIdentification)){
  966. connectString += '@TRANSFORMUID=TRUE';
  967. }
  968. if (f.m_connection_jdbc_sort_colseq.value != '') {
  969. connectString += ';LOCALSORT=' + f.m_connection_jdbc_sort_colseq.value + ';LEVEL=' + f.m_connection_jdbc_sort_level.value;
  970. }
  971. }
  972. else if (connectType == 'jdbc-teradata')
  973. {
  974. // [^User ID:][^?Password:];LOCAL;JD-TD;URL=<URLSPEC>;DRIVER_NAME=com.teradata.jdbc.TeraDriver[;CognosProperty1=value1[;...]]
  975. // where
  976. // URLSPEC = jdbc:teradata://<SERVERNAME>/DBS_PORT=<PORT>,DATABASE=<DBNAME>[,jdbcproperty1=jdbcvalue1][,jdbcproperty2=jdbcvalue2]...
  977. // Authentication: [0] None, [1] Namespace, [2] Signon (User ID/[Password])
  978. if (f.authentication[1].checked || f.authentication[2].checked) {
  979. var prefix = '^User ID:';
  980. if (f.m_connection_use_pword.checked || f.authentication[1].checked){
  981. prefix += '\^\?Password:';
  982. }
  983. connectString = prefix + connectString;
  984. }
  985. connectString += ';LOCAL;JD-TD';
  986. connectString += ';URL=jdbc:teradata://' + f.m_connection_servername.value;
  987. if (f.m_connection_port.value != '') {
  988. connectString += '/DBS_PORT=' + f.m_connection_port.value;
  989. }
  990. if (f.m_connection_jdbc_database_name.value != '') {
  991. connectString += ',DATABASE=' + f.m_connection_jdbc_database_name.value;
  992. }
  993. if (f.m_connection_jdbc_parameters.value != '') {
  994. connectString += ',' + f.m_connection_jdbc_parameters.value;
  995. }
  996. connectString += ';DRIVER_NAME=com.teradata.jdbc.TeraDriver';
  997. if (isCheckboxChecked(f.m_transformUserIdentification)){
  998. connectString += '@TRANSFORMUID=TRUE';
  999. }
  1000. if (f.m_connection_jdbc_sort_colseq.value != '') {
  1001. connectString += ';LOCALSORT=' + f.m_connection_jdbc_sort_colseq.value + ';LEVEL=' + f.m_connection_jdbc_sort_level.value;
  1002. }
  1003. }
  1004. else if (connectType == 'jdbc-netezza')
  1005. {
  1006. // [^User ID:][^?Password:];LOCAL;JD-NZ;URL=<URLSPEC>;DRIVER_NAME=org.netezza.Driver[;CognosProperty1=value1[;...]]
  1007. // where
  1008. // URLSPEC = jdbc:netezza://<SERVERNAME>[:<PORT>]/<DBNAME>[[;jdbcproperty1=jdbcvalue1][;jdbcproperty2=jdbcvalue2]...]
  1009. var isNamespaceAuthSelected = f.authentication[1].checked;
  1010. var isSignonsAuthSelected = f.authentication[2].checked;
  1011. if (isNamespaceAuthSelected || isSignonsAuthSelected) {
  1012. var prefix = '^User ID:';
  1013. if (f.m_connection_use_pword.checked || isNamespaceAuthSelected){
  1014. prefix += '\^\?Password:';
  1015. }
  1016. connectString = prefix + connectString;
  1017. }
  1018. connectString += ';LOCAL;JD-NZ';
  1019. portString = "";
  1020. if (f.m_connection_port.value != ""){
  1021. portString = ":" + f.m_connection_port.value;
  1022. }
  1023. connectString += ';URL=jdbc:netezza://' + f.m_connection_servername.value + portString + '/' + f.m_connection_jdbc_database_name.value;
  1024. if (f.m_connection_jdbc_parameters.value != '') {
  1025. connectString += ';' + f.m_connection_jdbc_parameters.value;
  1026. }
  1027. connectString += ';DRIVER_NAME=org.netezza.Driver';
  1028. if (isCheckboxChecked(f.m_transformUserIdentification)){
  1029. connectString += '@TRANSFORMUID=TRUE';
  1030. }
  1031. if (f.m_connection_jdbc_sort_colseq.value != '') {
  1032. connectString += ';LOCALSORT=' + f.m_connection_jdbc_sort_colseq.value + ';LEVEL=' + f.m_connection_jdbc_sort_level.value;
  1033. }
  1034. }
  1035. else if (connectType == 'other')
  1036. {
  1037. connectString = f.m_other_connectionString.value;
  1038. }
  1039. return connectString;
  1040. }
  1041. function _parseConnectString(connectType, cs, credentialNamespaces, connectVariant)
  1042. {
  1043. var f = document.pform;
  1044. if (connectType == 'composite' || connectType == 'virtualviewmanager' || connectType == 'db2' || connectType == 'odbc' || connectType == 'openEdge' || connectType == 'redbrick' || connectType == 'teradata' || connectType == 'sqlodbc' || connectType == 'sybaseIQ' || connectType == 'netezza')
  1045. {
  1046. var TRUSTED_CONNECTION = "Trusted_Connection=yes";
  1047. var indexOfTrustedConnection = cs.indexOf(TRUSTED_CONNECTION);
  1048. // Determine if a userid and password are required.
  1049. var start;
  1050. var end;
  1051. if (credentialNamespaces == 'true' && (connectType == 'composite' || connectType == 'virtualviewmanager' || connectType == 'sqlodbc' || connectType == 'teradata' || connectType == 'db2' || connectType == 'odbc' || connectType == 'netezza'))
  1052. {
  1053. selectRadioButton(f.authentication, 'namespace');
  1054. if (indexOfTrustedConnection != -1) {
  1055. cs = cs.substring(0, indexOfTrustedConnection - 1) + cs.substring(indexOfTrustedConnection + TRUSTED_CONNECTION.length);
  1056. }
  1057. if (cs.indexOf("^?Password:") != -1)
  1058. {
  1059. start = cs.indexOf("PWD=");
  1060. end = cs.indexOf(";", start + 5);
  1061. if (start != -1 && end != -1)
  1062. {
  1063. cs = cs.substring(0, start) + cs.substring(end + 1);
  1064. }
  1065. }
  1066. start = cs.indexOf("UID=");
  1067. end = cs.indexOf(";", start + 5);
  1068. if (start != -1 && end != -1)
  1069. {
  1070. cs = cs.substring(0, start) + cs.substring(end + 1);
  1071. }
  1072. }
  1073. else if (indexOfTrustedConnection != -1 && connectType == 'sqlodbc')
  1074. {
  1075. selectRadioButton(f.authentication, 'windows');
  1076. cs = cs.substring(0, indexOfTrustedConnection - 1) + cs.substring(indexOfTrustedConnection + TRUSTED_CONNECTION.length);
  1077. }
  1078. else if (cs.indexOf("^User ID:") != -1)
  1079. {
  1080. if (connectType == 'sqlodbc' || connectType == 'composite' || connectType == 'virtualviewmanager' || connectType == 'teradata' || connectType == 'db2' || connectType == 'odbc' || connectType == 'netezza')
  1081. {
  1082. selectRadioButton(f.authentication, 'signon');
  1083. }
  1084. else if (connectType == 'oracle') {
  1085. selectRadioButton(f.authentication, 'signon');
  1086. f.m_connection_use_userid.checked = true;
  1087. }
  1088. else
  1089. {
  1090. f.m_connection_use_userid.checked = true;
  1091. }
  1092. f.m_connection_use_pword.disabled = false;
  1093. if (cs.indexOf("^?Password:") != -1)
  1094. {
  1095. f.m_connection_use_pword.checked = true;
  1096. start = cs.indexOf("PWD=");
  1097. end = cs.indexOf(";", start + 5);
  1098. if (start != -1 && end != -1)
  1099. {
  1100. cs = cs.substring(0, start) + cs.substring(end + 1);
  1101. }
  1102. }
  1103. start = cs.indexOf("UID=");
  1104. end = cs.indexOf(";", start + 5);
  1105. if (start != -1 && end != -1)
  1106. {
  1107. cs = cs.substring(0, start) + cs.substring(end + 1);
  1108. }
  1109. }
  1110. else if (connectType == 'sqlodbc' || connectType == 'composite' || connectType == 'virtualviewmanager' || connectType == 'teradata' || connectType == 'db2' || connectType == 'odbc' || connectType == 'netezza' || connectType == 'oracle')
  1111. {
  1112. selectRadioButton(f.authentication, 'none');
  1113. }
  1114. // Strip everything up to and including the database code.
  1115. // The offset is 10 because 7 for ;LOCAL; and 3 for XX; which is the database code.
  1116. cs = cs.substring(cs.indexOf(";LOCAL;") + 10);
  1117. // Determine the datasource name.
  1118. start = cs.indexOf("DSN=");
  1119. if (start != -1)
  1120. {
  1121. var end = cs.indexOf(";", start + 4);
  1122. f.m_connection_database.value = cs.substring(start + 4, end);
  1123. // Strip off the datasource name.
  1124. cs = cs.substring(end + 1);
  1125. }
  1126. // Determine the collation sequence.
  1127. start = cs.indexOf("@COLSEQ=");
  1128. if (start != -1)
  1129. {
  1130. f.m_connection_colseq.value = cs.substring(start + 8);
  1131. }
  1132. // Determine the Async option.
  1133. start = cs.indexOf("@ASYNC=");
  1134. if (start != -1)
  1135. {
  1136. var useAsync = cs.substring(start + 7, start + 8);
  1137. f.m_connection_use_async.checked = (useAsync == "1" ? true : false);
  1138. }
  1139. // Determine the connect timeout and reply timeout.
  1140. start = cs.indexOf("@", start + 1);
  1141. mid = cs.indexOf("/", start + 1);
  1142. end = cs.indexOf("@", mid + 1);
  1143. if (start != -1 && mid != -1 && end != -1)
  1144. {
  1145. f.m_connection_connect_time.value = cs.substring(start + 1, mid);
  1146. f.m_connection_reply_time.value = cs.substring(mid + 1, end);
  1147. }
  1148. else
  1149. {
  1150. f.m_connection_connect_time.value = "0";
  1151. f.m_connection_reply_time.value = "0";
  1152. }
  1153. // Determine the datasource Unicode access.
  1154. start = cs.indexOf("@UNICODE");
  1155. if (start != -1 && f.m_connection_odbc_access_mode)
  1156. {
  1157. f.m_connection_odbc_access_mode.checked = true;
  1158. }
  1159. start = cs.indexOf("@ASYNC=");
  1160. if (start != -1)
  1161. {
  1162. f.m_connection_string.value = cs.substring(0, start);
  1163. }
  1164. else
  1165. {
  1166. f.m_connection_string.value = cs;
  1167. }
  1168. // Determine the User Identification Transform value.
  1169. start = cs.indexOf("@TRANSFORMUID");
  1170. if (start != -1)
  1171. {
  1172. f.m_transformUserIdentification.checked = true;
  1173. }
  1174. start = cs.indexOf("@TRUSTED_CONTEXT");
  1175. if (start != -1)
  1176. {
  1177. f.m_connection_trusted_context.checked = true;
  1178. start = cs.indexOf("@REGISTRY_NAME");
  1179. if (start != -1)
  1180. {
  1181. end = cs.indexOf("@", start+14)
  1182. f.m_connection_identity_propagation.value=cs.substring(start+15,end);
  1183. }
  1184. }
  1185. }
  1186. else if (connectType == 'oracle')
  1187. {
  1188. var start;
  1189. var end;
  1190. var bHasUserID = false;
  1191. var bHasPassword = false;
  1192. if (credentialNamespaces == 'true')
  1193. {
  1194. selectRadioButton(f.authentication, 'namespace');
  1195. var bHasUserID = true;
  1196. var bHasPassword = true;
  1197. } else {
  1198. if (cs.indexOf("^User ID:") != -1)
  1199. {
  1200. bHasUserID = true;
  1201. f.m_connection_use_userid.checked = true;
  1202. f.m_connection_use_pword.disabled = false;
  1203. if (cs.indexOf("^?Password:") != -1)
  1204. {
  1205. bHasPassword = true;
  1206. f.m_connection_use_pword.checked = true;
  1207. }
  1208. }
  1209. }
  1210. // Strip everything up to and including the ORACLE@ token.
  1211. cs = cs.substring(cs.indexOf(";ORACLE@") + 8);
  1212. if (bHasUserID == true)
  1213. {
  1214. // Strip off the user id placeholder.
  1215. cs = cs.substring(cs.indexOf("@") + 1);
  1216. }
  1217. // if we're left with an @ at the start then remove it. This should happen with Bering+ Oracle strings but not with Baltic strings
  1218. else if (cs.indexOf("@") == 0)
  1219. {
  1220. cs = cs.substring(1);
  1221. }
  1222. // Determine the User Identification Transform value.
  1223. start = cs.indexOf("@TRANSFORMUID");
  1224. if (start != -1)
  1225. {
  1226. f.m_transformUserIdentification.checked = true;
  1227. }
  1228. // Determine the collation sequence.
  1229. start = cs.indexOf("@COLSEQ=");
  1230. if (start != -1)
  1231. {
  1232. f.m_connection_colseq.value = cs.substring(start + 8);
  1233. // Strip off the collation sequence.
  1234. cs = cs.substring(0, start);
  1235. }
  1236. // Strip off the password placeholder and everything after it.
  1237. start = cs.indexOf("/");
  1238. if (start != -1)
  1239. {
  1240. cs = cs.substring(0, start);
  1241. }
  1242. // What remains of cs should be the SQL*Net connection string.
  1243. f.m_connection_database.value = cs;
  1244. }
  1245. else if (connectType == 'sql' || connectType == 'sql2005' || connectType == 'sql2008' || connectType == 'sql2012-2014')
  1246. {
  1247. // Determine if a userid and password are required.
  1248. var start;
  1249. var end;
  1250. if (credentialNamespaces == 'true')
  1251. {
  1252. f.authentication[2].checked='true';
  1253. }
  1254. else if (cs.indexOf("^User ID:") != -1)
  1255. {
  1256. f.authentication[3].checked = true;
  1257. f.m_connection_use_pword.disabled = false;
  1258. if (cs.indexOf("^?Password:") != -1)
  1259. {
  1260. f.m_connection_use_pword.checked = true;
  1261. }
  1262. }
  1263. else if (cs.indexOf(";Integrated Security=SSPI") != -1)
  1264. {
  1265. f.authentication[1].checked = true;
  1266. }
  1267. else
  1268. {
  1269. f.authentication[0].checked = true;
  1270. }
  1271. // Determine the database name.
  1272. f.m_connection_database.value = getField(cs, "Data Source=");
  1273. // Determine the collation sequence.
  1274. f.m_connection_colseq.value = getField(cs, "COLSEQ=");
  1275. start = cs.indexOf("Initial Catalog=");
  1276. if (-1 != start)
  1277. {
  1278. end = cs.indexOf(";", start + 16);
  1279. var cat = '';
  1280. if (end == -1)
  1281. {
  1282. cat = cs.substring(start + 16);
  1283. }
  1284. else
  1285. {
  1286. cat = cs.substring(start + 16, end);
  1287. }
  1288. if (cat == 'master')
  1289. {
  1290. f.m_connection_sql_database_choice[0].checked = true;
  1291. f.m_connection_sql_database_choice[1].checked = false;
  1292. f.m_connection_sql_database_name.value = '';
  1293. }
  1294. else
  1295. {
  1296. f.m_connection_sql_database_choice[0].checked = false;
  1297. f.m_connection_sql_database_choice[1].checked = true;
  1298. f.m_connection_sql_database_name.value = cat;
  1299. }
  1300. }
  1301. //Determine the MARS connection
  1302. if (connectType == 'sql2005' || connectType == 'sql2008' || connectType == 'sql2012-2014')
  1303. {
  1304. var marsconn = getField(cs, "MarsConn=");
  1305. if (marsconn == 'YES') {
  1306. f.m_connection_sql_marsconnection.value = 'YES' ;
  1307. }
  1308. }
  1309. // Determine the application string.
  1310. // Still waiting for the actual format (within the connect string) for this entry.
  1311. f.m_connection_sql_application.value = getField(cs, "Application=");
  1312. // last valid param can be either "MarsConn=" "Application=" or "Catalog="
  1313. startMarsConn = cs.indexOf("MarsConn=");
  1314. startApplication = cs.indexOf("Application=");
  1315. startCatalog = cs.indexOf("Catalog=");
  1316. last_valid_param = Math.max(startMarsConn, startApplication, startCatalog);
  1317. // Determine the User Identification Transform value.
  1318. start = cs.indexOf("@TRANSFORMUID");
  1319. if (start != -1)
  1320. {
  1321. f.m_transformUserIdentification.checked = true;
  1322. end = start;
  1323. }
  1324. else
  1325. {
  1326. end = cs.indexOf("@COLSEQ=");
  1327. }
  1328. // Determine optional params (if they exist)
  1329. var optional_params ='';
  1330. if (last_valid_param != -1)
  1331. {
  1332. start = cs.indexOf(";", last_valid_param);
  1333. if (start != -1)
  1334. {
  1335. optional_params = cs.substring (start+1,end);
  1336. }
  1337. }
  1338. f.m_connection_optional_parameters.value = optional_params;
  1339. }
  1340. else if (connectType == 'sybase' || connectType == 'sybase_ct15')
  1341. {
  1342. // Treat the prefixes
  1343. if (cs.indexOf("^User ID:") != -1)
  1344. {
  1345. f.m_connection_use_userid.checked = true;
  1346. f.m_connection_use_pword.disabled = false;
  1347. if (cs.indexOf("^?Password:") != -1)
  1348. {
  1349. f.m_connection_use_pword.checked = true;
  1350. }
  1351. }
  1352. if (connectType == 'sybase')
  1353. {
  1354. cs = cs.substring(cs.indexOf(";LOCAL;CT;") + 10);
  1355. } else
  1356. {
  1357. cs = cs.substring(cs.indexOf(";LOCAL;CT15;") + 12);
  1358. }
  1359. var tokens = cs.split("@");
  1360. var first = tokens[0];
  1361. var start = first.indexOf("|");
  1362. if (-1 != start)
  1363. {
  1364. var cat = first.substring(start+1);
  1365. f.m_connection_sybase_database_choice[0].checked = (cat == "master");
  1366. f.m_connection_sybase_database_choice[1].checked = (cat != "master");
  1367. if (cat != "master")
  1368. {
  1369. f.m_connection_sybase_database_name.value = cat;
  1370. }
  1371. first = first.substring(0, start);
  1372. }
  1373. f.m_connection_database.value = first;
  1374. var third = tokens[2];
  1375. start = third.indexOf("/");
  1376. if (-1 != start)
  1377. {
  1378. var value = third.substring(0, start);
  1379. value = (value == '') ? '0' : value;
  1380. f.m_connection_connect_time.value = value;
  1381. third = third.substring(start + 1);
  1382. }
  1383. f.m_connection_reply_time.value = (third == '') ? '0' : third;
  1384. var fourth = tokens[3];
  1385. f.m_connection_packet.value = (fourth == '') ? '512' : fourth;
  1386. var fifth = tokens[4];
  1387. start = fifth.indexOf("ASYNC=");
  1388. if (-1 != start)
  1389. {
  1390. var value = fifth.substring(start + 6);
  1391. value = (value == '') ? '0' : value;
  1392. var number = parseInt(value);
  1393. for (var i = 1; i < 4; i++)
  1394. {
  1395. f.m_connection_sybase_async.options[i].selected = (number == i) ? true : false;
  1396. }
  1397. }
  1398. var sixth = tokens[5];
  1399. start = sixth.indexOf("POLL=");
  1400. if (-1 != start)
  1401. {
  1402. var value = sixth.substring(start + 5);
  1403. value = (value == '') ? '100' : value;
  1404. f.m_connection_polling.value = value;
  1405. }
  1406. var seventh = tokens[6];
  1407. f.m_connection_sybase_application.value = getField(seventh , "APPNAME=");
  1408. var eigth = tokens[7];
  1409. f.m_connection_colseq.value = getField(eigth, "COLSEQ=");
  1410. }
  1411. else if (connectType == 'informix')
  1412. {
  1413. // Treat the prefixes
  1414. if (cs.indexOf("^User ID:") != -1)
  1415. {
  1416. f.m_connection_use_userid.checked = true;
  1417. f.m_connection_use_pword.disabled = false;
  1418. if (cs.indexOf("^?Password:") != -1)
  1419. {
  1420. f.m_connection_use_pword.checked = true;
  1421. }
  1422. }
  1423. cs = cs.substring(cs.indexOf(";LOCAL;IF;") + 10);
  1424. var colStart = cs.indexOf("@COLSEQ=");
  1425. if (-1 != colStart)
  1426. {
  1427. f.m_connection_colseq.value = cs.substring(colStart + 8);
  1428. cs = cs.substring(0, colStart);
  1429. }
  1430. var tokens = cs.split("@");
  1431. f.m_connection_database.value = tokens[0];
  1432. if (tokens.length > 1)
  1433. {
  1434. var middle = tokens[1];
  1435. var start = middle.indexOf("|");
  1436. if (-1 != start)
  1437. {
  1438. var service = middle.substring(start + 1);
  1439. f.m_connection_service[0].checked = (service == "sqlexec");
  1440. f.m_connection_service[1].checked = (service == "sqlturbo");
  1441. f.m_connection_service[2].checked = (service != "sqlexec" && service != "sqlturbo");
  1442. if (f.m_connection_service[2].checked)
  1443. {
  1444. f.m_connection_service_name.value = service;
  1445. }
  1446. middle = middle.substring(0, start);
  1447. }
  1448. start = middle.indexOf(":");
  1449. if (-1 != start)
  1450. {
  1451. f.m_connection_servername.value = middle.substring(start + 1);
  1452. middle = middle.substring(0, start);
  1453. }
  1454. f.m_connection_hostname.value = middle;
  1455. }
  1456. }
  1457. else if (connectType == 'consolidation' || connectType == 'contributorSeries7')
  1458. {
  1459. f.m_connection_servername.value = getField(cs, "SERVER=");
  1460. f.m_connection_port.value = getField(cs, "PORT=");
  1461. if (connectType == 'contributorSeries7')
  1462. {
  1463. if(f.m_connection_padid)
  1464. {
  1465. f.m_connection_padid.value = getField(cs, "PADID=");
  1466. }
  1467. }
  1468. }
  1469. else if (connectType == 'powercube')
  1470. {
  1471. // Determine if a userid and password are required.
  1472. var start;
  1473. var end;
  1474. if (credentialNamespaces == 'true')
  1475. {
  1476. f.authentication[1].checked = true;
  1477. }
  1478. else
  1479. {
  1480. f.authentication[0].checked = true;
  1481. }
  1482. // Determine the cache size.
  1483. if (getField(cs, "readCacheSize=") != '')
  1484. {
  1485. f.m_connection_cache_size.value = getField(cs, "readCacheSize=");
  1486. }
  1487. // Determine the Location string.
  1488. if (getField(cs, "WIN_PATH=") != '')
  1489. {
  1490. f.m_connection_windows_cube.value = getField(cs, "WIN_PATH=");
  1491. }
  1492. else
  1493. {
  1494. // upgrade old powercube connections to the new UI (WO 1116)
  1495. f.m_connection_windows_cube.value = getField(cs, "CUBE=");
  1496. }
  1497. f.m_connection_unix_cube.value = getField(cs, "UNIX_PATH=");
  1498. if (cs.indexOf("^?Password:") != -1 && f.cube_password_checkbox)
  1499. {
  1500. f.cube_password_checkbox.checked = true;
  1501. }
  1502. }
  1503. else if (connectType == 'msanalysis2005' || connectType == 'msanalysis2008' || connectType == 'msanalysis2012' || connectType == 'msanalysis2014' || connectType == 'msanalysis2016' || connectType == 'msanalysis2017')
  1504. {
  1505. // Determine if a userid and password are required.
  1506. if (credentialNamespaces == 'true')
  1507. {
  1508. f.authentication[1].checked = true;
  1509. }
  1510. else if (cs.indexOf("^User ID:") != -1)
  1511. {
  1512. f.authentication[2].checked = true;
  1513. f.m_connection_use_pword.disabled = false;
  1514. if (cs.indexOf("^?Password:") != -1)
  1515. {
  1516. f.m_connection_use_pword.checked = true;
  1517. }
  1518. }
  1519. else if (cs.indexOf("Trusted_Connection=yes") != -1)
  1520. {
  1521. f.authentication[0].checked = true;
  1522. }
  1523. // Determine the server name.
  1524. var serverField = getField(cs, "SERVER=");
  1525. var position = serverField.indexOf("\\");
  1526. if ( position != -1)
  1527. {
  1528. f.m_connection_servername.value = serverField.slice(0, position);
  1529. f.m_connection_namedinstance.value = serverField.slice(position+1);
  1530. }
  1531. else {
  1532. f.m_connection_servername.value = serverField;
  1533. f.m_connection_namedinstance.value = '';
  1534. }
  1535. }
  1536. else if (connectType == 'dbtwoolap')
  1537. {
  1538. // Determine if a userid and password are required.
  1539. if (credentialNamespaces == 'true')
  1540. {
  1541. f.authentication[1].checked='true';
  1542. }
  1543. else if (cs.indexOf("^User ID:") != -1)
  1544. {
  1545. f.authentication[2].checked = true;
  1546. f.m_connection_use_pword.disabled = false;
  1547. if (cs.indexOf("^?Password:") != -1)
  1548. {
  1549. f.m_connection_use_pword.checked = true;
  1550. }
  1551. }
  1552. else
  1553. {
  1554. f.authentication[0].checked = true;
  1555. }
  1556. // Determine the server name.
  1557. f.m_connection_servername.value = getField(cs, "SERVER=");
  1558. }
  1559. else if ((connectType == 'tm1'))
  1560. {
  1561. if (credentialNamespaces == 'true')
  1562. {
  1563. f.authentication[1].checked='true';
  1564. }
  1565. else if (cs.indexOf("^User ID:") != -1)
  1566. {
  1567. f.authentication[2].checked = true;
  1568. f.m_connection_use_pword.disabled = false;
  1569. if (cs.indexOf("^?Password:") != -1)
  1570. {
  1571. f.m_connection_use_pword.checked = true;
  1572. }
  1573. }
  1574. else
  1575. {
  1576. f.authentication[0].checked = true;
  1577. }
  1578. //Determine the TM1 hostname
  1579. f.m_connection_hostname.value = getField(cs, "TM1AdminHost=");
  1580. // Determine the TM1 server name.
  1581. f.m_connection_servername.value = getField(cs, "TM1ServerName=");
  1582. }
  1583. else if ((connectType == 'tm1R'))
  1584. {
  1585. if (credentialNamespaces == 'true')
  1586. {
  1587. f.authentication[1].checked='true';
  1588. }
  1589. else if (cs.indexOf("^User ID:") != -1)
  1590. {
  1591. f.authentication[2].checked = true;
  1592. f.m_connection_use_pword.disabled = false;
  1593. if (cs.indexOf("^?Password:") != -1)
  1594. {
  1595. f.m_connection_use_pword.checked = true;
  1596. }
  1597. }
  1598. else
  1599. {
  1600. f.authentication[0].checked = true;
  1601. }
  1602. //Determine the TM1 hostname
  1603. f.m_connection_hostname.value = getField(cs, "TM1AdminHost=");
  1604. // Determine the TM1 server name.
  1605. f.m_connection_tm1port.value = getField(cs, "TM1ServerPort=");
  1606. //determine the tm1 protocol
  1607. var protocol = getField(cs, "TM1Protocol=");
  1608. if (protocol === 'https') {
  1609. f.m_connection_use_ssl.checked = true;
  1610. }
  1611. }
  1612. else if (connectType == 'odata')
  1613. {
  1614. if (cs.indexOf("^User ID:") != -1)
  1615. {
  1616. f.authentication[1].checked = true;
  1617. f.m_connection_use_pword.disabled = false;
  1618. if (cs.indexOf("^?Password:") != -1)
  1619. {
  1620. f.m_connection_use_pword.checked = true;
  1621. }
  1622. }
  1623. else
  1624. {
  1625. f.authentication[0].checked = true;
  1626. }
  1627. //Determine the OData Service Root URI
  1628. f.m_connection_service_root_URI.value = getField(cs, ";URL=");
  1629. }
  1630. else if (connectType == 'json')
  1631. {
  1632. f.m_connection_subType = getField(cs, ";SUBTYPE=");
  1633. f.m_connection_url.value = getField(cs, ";URL=");
  1634. f.m_connection_assembly.checked = (getField(cs, ";ASSEMBLY=") == 'true');
  1635. if (f.m_connection_assembly.checked) {
  1636. f.m_connection_schema.disabled = true;
  1637. f.m_connection_http_method.disabled = true;
  1638. if (f.m_connection_http_message_body) {
  1639. f.m_connection_http_message_body.disabled = true;
  1640. }
  1641. f.m_connection_json_path.disabled = true;
  1642. } else {
  1643. f.m_connection_schema.value = getField(cs, ";SCHEMA=");
  1644. f.m_connection_http_method.value = getField(cs, ";METHOD=");
  1645. if(f.m_connection_http_method.value == 'POST'){
  1646. f.m_connection_http_mime_type.value = getField(cs, ";MIME_TYPE=");
  1647. f.m_connection_http_message_body.value = getField(cs, ";DATA=");
  1648. }
  1649. f.m_connection_json_path.value = getField(cs, ";PATH=");
  1650. }
  1651. f.m_connection_authentication_type.value = getField(cs,';AUTHENTICATION_TYPE=');
  1652. if(f.m_connection_authentication_type.value == 'OAuth1.0'){
  1653. f.m_connection_temporary_token_endpoint.value = getField(cs,';TEMPORARY_TOKEN_ENDPOINT=');
  1654. f.m_connection_authorization_endpoint.value = getField(cs,';AUTHORIZATION_ENDPOINT=');
  1655. f.m_connection_token_endpoint.value = getField(cs,';TOKEN_ENDPOINT=');
  1656. }
  1657. if(f.m_connection_authentication_type.value == 'OAuth2.0'){
  1658. f.m_connection_authorization_endpoint.value = getField(cs,';AUTHORIZATION_ENDPOINT=');
  1659. f.m_connection_token_endpoint.value = getField(cs,';TOKEN_ENDPOINT=');
  1660. f.m_connection_scope.value = getField(cs,';SCOPE=');
  1661. }
  1662. }
  1663. else if (connectType == 'cognosnow')
  1664. {
  1665. // Determine if a userid and password are required.
  1666. var start;
  1667. var end;
  1668. // Determine the CognosNow port.
  1669. start = cs.indexOf(":");
  1670. end = cs.indexOf("/", start + 1);
  1671. if (start != -1 && end != -1)
  1672. {
  1673. f.m_connection_port.value = cs.substring(start+1, end);
  1674. }
  1675. //Determine the CognosNow server
  1676. var startServer = cs.indexOf("SERVER=");
  1677. if (startServer != -1) {
  1678. if (start!=-1)
  1679. {
  1680. f.m_connection_servername.value = cs.substring(startServer+7, start);
  1681. }
  1682. else if (end!=-1)
  1683. {
  1684. f.m_connection_servername.value = cs.substring(startServer+7, end-1);
  1685. }
  1686. }
  1687. //Determine the file name and path.
  1688. start = cs.indexOf("/");
  1689. if (start != -1)
  1690. {
  1691. cs = cs.substring(start, cs.length-1);
  1692. }
  1693. }
  1694. else if (connectType == 'sap')
  1695. {
  1696. // Determine the server name.
  1697. f.m_connection_database.value = getField(cs, "server=");
  1698. // Determine the system number.
  1699. if (f.m_connection_sys_no)
  1700. {
  1701. f.m_connection_sys_no.value = getField(cs, "sysnr=");
  1702. }
  1703. // Determine the system id.
  1704. if (f.m_connection_sys_id)
  1705. {
  1706. f.m_connection_sys_id.value = getField(cs, "sysid=");
  1707. }
  1708. // Determine the logon group.
  1709. if (f.m_connection_logon)
  1710. {
  1711. f.m_connection_logon.value = getField(cs, "logonGroup=");
  1712. }
  1713. // Determine the client number.
  1714. f.m_connection_client_no.value = getField(cs, "client=");
  1715. // Determine the system number.
  1716. if (f.m_connection_sap_codepage)
  1717. {
  1718. var value = getField(cs, "codePage=")
  1719. if (value == '')
  1720. {
  1721. f.m_connection_sap_codepage.value = "4110";
  1722. }
  1723. else
  1724. {
  1725. f.m_connection_sap_codepage.value = value;
  1726. }
  1727. }
  1728. // default the signon section
  1729. if (f.authentication)
  1730. {
  1731. if (credentialNamespaces == 'true')
  1732. {
  1733. f.authentication[0].checked = true;
  1734. }
  1735. else
  1736. {
  1737. f.authentication[1].checked = true;
  1738. }
  1739. }
  1740. // Determine the router string.
  1741. if (f.m_connection_router_string)
  1742. {
  1743. f.m_connection_router_string.value = getField(cs, "routerString=");
  1744. }
  1745. // Determine the User Identification Transform value.
  1746. if (cs.indexOf("@TRANSFORMUID") != -1)
  1747. {
  1748. f.m_transformUserIdentification.checked = true;
  1749. }
  1750. }
  1751. else if (connectType == 'sapR3' || connectType == 'sapECC')
  1752. {
  1753. // Determine the server name.
  1754. f.m_connection_hostname.value = getField(cs, "hostname=");
  1755. f.m_connection_sys_no.value = getField(cs, "sysnr=");
  1756. f.m_connection_gateway_host.value = getField(cs, "gateway_host=");
  1757. f.m_connection_gateway_service.value = getField(cs, "gateway_service=");
  1758. f.m_connection_client.value = getField(cs, "client=");
  1759. f.m_connection_destination.value = getField(cs, "destination=");
  1760. f.m_connection_sap_language.value = getField(cs, "language=");
  1761. // Determine the background.
  1762. var value = getField(cs, "background=")
  1763. if (value == 'ON')
  1764. {
  1765. f.m_connection_background.checked=true;
  1766. }
  1767. else
  1768. {
  1769. f.m_connection_background.checked=false;
  1770. }
  1771. if (connectType == 'sapR3')
  1772. {
  1773. var cogudajoin = getField(cs, "cogudaouterjoin=");
  1774. if (cogudajoin == 'ON')
  1775. {
  1776. f.m_connection_cogudaouterjoin.value = cogudajoin;
  1777. }
  1778. }
  1779. // Determine the collation sequence.
  1780. f.m_connection_colseq.value = getField(cs, "COLSEQ=");
  1781. }
  1782. else if (connectType == 'jdbc-db2')
  1783. {
  1784. // [^User ID:][^?Password:];LOCAL;JD-D2;URL=<URLSPEC>;DRIVER_NAME=com.ibm.db2.jcc.DB2Driver[;CognosProperty1=value1[;...]]
  1785. // where
  1786. // URLSPEC = jdbc:db2://<SERVERNAME>:<PORT>/<DBNAME>[:[jdbcproperty1=jdbcvalue1][;jdbcproperty2=jdbcvalue2]...]
  1787. // Authentication: [0] None, [1] Namespace, [2] Signon (User ID/[Password])
  1788. if (credentialNamespaces == 'true') {
  1789. f.authentication[1].checked = true;
  1790. } else if (cs.indexOf("^User ID:") != -1) {
  1791. f.authentication[2].checked = 'true';
  1792. f.m_connection_use_pword.disabled = false;
  1793. if (cs.indexOf("^?Password:") != -1) {
  1794. f.m_connection_use_pword.checked = true;
  1795. }
  1796. } else {
  1797. f.authentication[0].checked = 'true';
  1798. }
  1799. var serverNameEnd;
  1800. var urlProtocol = "jdbc:db2://";
  1801. var urlStart = cs.indexOf(urlProtocol);
  1802. if (urlStart != -1) {
  1803. serverNameEnd = cs.indexOf(":", urlStart + urlProtocol.length);
  1804. if (serverNameEnd != -1) {
  1805. f.m_connection_servername.value = cs.substring(urlStart + urlProtocol.length, serverNameEnd);
  1806. }
  1807. }
  1808. var portEnd = cs.indexOf("/", serverNameEnd + 1);
  1809. if (portEnd != -1) {
  1810. f.m_connection_port.value = cs.substring(serverNameEnd + 1, portEnd);
  1811. }
  1812. var urlEnd;
  1813. var dbNameEnd = cs.indexOf(":", portEnd + 1);
  1814. if (dbNameEnd != -1) {
  1815. // has JDBC properties
  1816. f.m_connection_jdbc_database_name.value = cs.substring(portEnd + 1, dbNameEnd);
  1817. var urlEnd = cs.indexOf(";DRIVER_NAME", dbNameEnd + 1);
  1818. if (urlEnd != -1) {
  1819. f.m_connection_jdbc_parameters.value = cs.substring(dbNameEnd + 1, urlEnd);
  1820. }
  1821. } else {
  1822. var urlEnd = cs.indexOf(";DRIVER_NAME", portEnd + 1);
  1823. if (urlEnd != -1) {
  1824. f.m_connection_jdbc_database_name.value = cs.substring(portEnd + 1, urlEnd);
  1825. }
  1826. }
  1827. if (isCheckboxChecked(f.m_transformUserIdentification)){
  1828. connectString += '@TRANSFORMUID=TRUE';
  1829. }
  1830. f.m_connection_jdbc_sort_colseq.value = getFieldStartingAt(cs, urlEnd + 1, "LOCALSORT=", ";");
  1831. f.m_connection_jdbc_sort_level.value = getFieldStartingAt(cs, urlEnd + 1, "LEVEL=", ";");
  1832. }
  1833. else if (connectType == 'jdbc-oracle')
  1834. {
  1835. // [^User ID:][^?Password:];LOCAL;JD-OR;URL=<URLSPEC>;DRIVER_NAME=oracle.jdbc.OracleDriver [;CognosProperty1=value1[;...]]
  1836. // where
  1837. // URLSPEC = jdbc:oracle:thin:@//<SERVERNAME>:<PORT>/<SERVICE_D>
  1838. // URLSPEC = jdbc:oracle:thin:@(DESCRIPTION=...)
  1839. // URLSPEC = jdbc:oracle:thin:@(DESCRIPTION_LIST=...)
  1840. // URLSPEC = jdbc:oracle:oci:@<TNS_NAME>
  1841. // URLSPEC = jdbc:oracle:oci:@(DESCRIPTION=...)
  1842. // or URLSPEC = jdbc:oracle:oci:@(DESCRIPTION_LIST=...)
  1843. // Authentication: Signon (User ID/[Password])
  1844. if (cs.indexOf("^User ID:") != -1) {
  1845. f.m_connection_use_userid.checked = true;
  1846. f.m_connection_use_pword.disabled = false;
  1847. if (cs.indexOf("^?Password:") != -1) {
  1848. f.m_connection_use_pword.checked = true;
  1849. }
  1850. }
  1851. var urlEnd;
  1852. if (cs.indexOf('DESCRIPTION') != -1 || cs.indexOf('DESCRIPTION_LIST') != -1) {
  1853. // Oracle Net Descriptor
  1854. f.m_connection_jdbc_oracle_style[2].checked = true;
  1855. var thinURLProtocol = "jdbc:oracle:thin:@";
  1856. var thinURLStart = cs.indexOf(thinURLProtocol);
  1857. if (thinURLStart != -1) {
  1858. // Thin
  1859. f.m_connection_jdbc_oracle_driver_type[0].checked = true;
  1860. urlEnd = cs.indexOf(";DRIVER_NAME", thinURLStart + thinURLProtocol.length);
  1861. if (urlEnd != -1) {
  1862. f.m_connection_oracle_net_descriptor.value = formatOracleNetDesc(cs.substring(thinURLStart + thinURLProtocol.length, urlEnd));
  1863. }
  1864. } else {
  1865. // OCI
  1866. f.m_connection_jdbc_oracle_driver_type[1].checked = true;
  1867. var ociProtocol = "jdbc:oracle:oci:@";
  1868. var ociURLStart = cs.indexOf(ociProtocol);
  1869. if (ociURLStart != -1) {
  1870. urlEnd = cs.indexOf(";DRIVER_NAME", ociURLStart + ociProtocol.length);
  1871. if (urlEnd != -1) {
  1872. f.m_connection_oracle_net_descriptor.value = formatOracleNetDesc(cs.substring(ociURLStart + ociProtocol.length, urlEnd));
  1873. }
  1874. }
  1875. }
  1876. } else {
  1877. var thinServiceIDProtocol = "jdbc:oracle:thin:@//";
  1878. var thinURLStart = cs.indexOf(thinServiceIDProtocol);
  1879. if (thinURLStart != -1) {
  1880. // Service ID
  1881. f.m_connection_jdbc_oracle_style[0].checked = true;
  1882. var serverNameEnd = cs.indexOf(":", thinURLStart + thinServiceIDProtocol.length);
  1883. if (serverNameEnd != -1) {
  1884. f.m_connection_servername.value = cs.substring(thinURLStart + thinServiceIDProtocol.length, serverNameEnd);
  1885. }
  1886. var portEnd = cs.indexOf("/", serverNameEnd + 1);
  1887. if (portEnd != -1) {
  1888. f.m_connection_port.value = cs.substring(serverNameEnd + 1, portEnd);
  1889. }
  1890. urlEnd = cs.indexOf(";DRIVER_NAME", portEnd + 1);
  1891. if (urlEnd != -1) {
  1892. f.m_connection_oracle_service_id.value = cs.substring(portEnd + 1, urlEnd);
  1893. }
  1894. } else {
  1895. var ociProtocol = "jdbc:oracle:oci:@";
  1896. var ociURLStart = cs.indexOf(ociProtocol);
  1897. if (ociURLStart != -1) {
  1898. // TNS Names Alias
  1899. f.m_connection_jdbc_oracle_style[1].checked = true;
  1900. urlEnd = cs.indexOf(";DRIVER_NAME", ociURLStart + ociProtocol.length);
  1901. if (urlEnd != -1) {
  1902. f.m_connection_oracle_tns_name.value = cs.substring(ociURLStart + ociProtocol.length, urlEnd);
  1903. }
  1904. }
  1905. }
  1906. }
  1907. // find out if there are driver specific properties
  1908. // urlEnd = cs.indexOf(";DRIVER_NAME");
  1909. var driverEnd = cs.indexOf(";", urlEnd + ";DRIVER_NAME".length);
  1910. if (driverEnd != -1) {
  1911. var localsortstart = cs.indexOf(";LOCALSORT", driverEnd)
  1912. if (localsortstart != -1) {
  1913. if (localsortstart != driverEnd ) {
  1914. f.m_connection_jdbc_parameters.value = cs.substring(driverEnd + 1, cs.indexOf(";LOCALSORT", driverEnd));
  1915. }
  1916. } else {
  1917. f.m_connection_jdbc_parameters.value = cs.substring(driverEnd + 1);
  1918. }
  1919. f.m_connection_jdbc_sort_colseq.value = getFieldStartingAt(cs, urlEnd + 1, "LOCALSORT=", ";");
  1920. f.m_connection_jdbc_sort_level.value = getFieldStartingAt(cs, urlEnd + 1, "LEVEL=", ";");
  1921. }
  1922. }
  1923. else if (connectType == 'jdbc-generic' || connectType == 'lob-jdbc')
  1924. {
  1925. // [^User ID:][^?Password:];LOCAL;JDBC;URL=jdbc:<subprotocol>:<URL>;DRIVER_NAME=<DRIVER_NAME>[;CognosProperty1=value1[;...]]
  1926. // where
  1927. // subprotocol is defined in generateDatasourceMetadata.
  1928. // URL is user specified.
  1929. if (credentialNamespaces == 'true' ) {
  1930. selectRadioButton(f.authentication, 'namespace');
  1931. } else if (cs.indexOf("^User ID:") != -1) {
  1932. selectRadioButton(f.authentication, 'signon');
  1933. f.m_connection_use_pword.disabled = false;
  1934. if (cs.indexOf("^?Password:") != -1) {
  1935. f.m_connection_use_pword.checked = true;
  1936. }
  1937. } else {
  1938. selectRadioButton(f.authentication, 'none');
  1939. }
  1940. var urlConstant = "URL=";
  1941. var urlStart = cs.indexOf(urlConstant)
  1942. if (urlStart != -1) {
  1943. var urlEnd;
  1944. var driverConstant = ";DRIVER_NAME=";
  1945. urlEnd = cs.indexOf(driverConstant, urlStart + urlConstant.length);
  1946. if (urlEnd != -1) {
  1947. var jdbcUrl = cs.substring(urlStart + urlConstant.length, urlEnd);
  1948. var protocolStart = "jdbc:".length;
  1949. // Sybase and Greenplum have ':' in the protocol name so searching for the first index doesn't work
  1950. // Have to put in a static check for now. If we get too many exceptions we should look at
  1951. // reading the connections metadata file for a list subprotocols.
  1952. var protocolEnd = jdbcUrl.indexOf(":", protocolStart);
  1953. if (protocolEnd != -1) {
  1954. var subprotocol = jdbcUrl.substring(protocolStart, protocolEnd);
  1955. if (subprotocol.toLowerCase() == "sybase" || subprotocol.toLowerCase() == "pivotal") {
  1956. protocolEnd = jdbcUrl.indexOf(":", protocolEnd + 1);
  1957. subprotocol = jdbcUrl.substring(protocolStart, protocolEnd);
  1958. }
  1959. f.m_jdbc_connection_code = subprotocol;
  1960. f.m_jdbc_connection_url.value = jdbcUrl;
  1961. }
  1962. var driverEnd = cs.indexOf(";", urlEnd + driverConstant.length);
  1963. if (driverEnd != -1) {
  1964. f.m_jdbc_driver_class.value = cs.substring(urlEnd + driverConstant.length, driverEnd);
  1965. var localSort = "LOCALSORT=";
  1966. var propEnd = cs.indexOf(localSort, driverEnd + 1);
  1967. if (propEnd == -1) {
  1968. f.m_jdbc_connection_properties.value = cs.substring(driverEnd + 1);
  1969. } else if (propEnd == 0) {
  1970. f.m_jdbc_connection_properties.value = '';
  1971. } else {
  1972. f.m_jdbc_connection_properties.value = cs.substring(driverEnd + 1, propEnd);
  1973. }
  1974. f.m_connection_jdbc_sort_colseq.value = getFieldStartingAt(cs, driverEnd, "LOCALSORT=", ";");
  1975. f.m_connection_jdbc_sort_level.value = getFieldStartingAt(cs, driverEnd, "LEVEL=", ";");
  1976. } else {
  1977. f.m_jdbc_driver_class.value = cs.substring(urlEnd + driverConstant.length);
  1978. }
  1979. // Determine the User Identification Transform value.
  1980. start = cs.indexOf("@TRANSFORMUID");
  1981. if (start != -1)
  1982. {
  1983. f.m_transformUserIdentification.checked = true;
  1984. }
  1985. }
  1986. }
  1987. }
  1988. else if (connectType == 'filenet')
  1989. {
  1990. // [^User ID:][^?Password:];LOCAL;RP-CMIS-FILENET;URL=<URLSPEC>;DRIVER_NAME=<DRIVER_NAME>;ROOT=GRAPHIC[;CognosProperty1=value1[;...]]
  1991. // where
  1992. // URLSPEC = specific to the driver
  1993. // Authentication: Signon (User ID/[Password])
  1994. if (cs.indexOf("^User ID:") != -1) {
  1995. f.m_connection_use_userid.checked = true;
  1996. f.m_connection_use_pword.disabled = false;
  1997. if (cs.indexOf("^?Password:") != -1) {
  1998. f.m_connection_use_pword.checked = true;
  1999. }
  2000. }
  2001. connectionData = [
  2002. {key: "URL=", field: "m_connection_jdbc_url", end: ";DRIVER_NAME="},
  2003. {key: "DRIVER_NAME=", field: "m_connection_jdbc_driverclass", end: ";"},
  2004. {key: "ROOT=", field: "m_connection_file", end: ";"},
  2005. {key: "PROVIDER=", field: "", end: ";"}
  2006. ];
  2007. var startAt = cs.indexOf(connectionData[1].key);
  2008. var repositoryPluginType = getFieldStartingAt(cs, startAt, connectionData[1].key, connectionData[1].end);
  2009. var provider;
  2010. var isFilesystem = false;
  2011. if(repositoryPluginType == 'com.ibm.cognos.cm.fileSystemPlugin.FileSystemArchivePlugin') {
  2012. f[connectionData[1].field].value = "FileSystem";
  2013. isFilesystem = true;
  2014. } else {
  2015. startAt = cs.indexOf(connectionData[3].key);
  2016. if (startAt>=0) {
  2017. provider = getFieldStartingAt(cs, startAt, connectionData[3].key, connectionData[3].end);
  2018. if (isSupportedCmisProvider(provider)) {
  2019. f[connectionData[1].field].value = "CMIS_" + provider;
  2020. } else {
  2021. f[connectionData[1].field].value = "CMIS_FileNet";
  2022. }
  2023. } else {
  2024. f[connectionData[1].field].value = "CMIS_FileNet";
  2025. }
  2026. }
  2027. repoTypeSelectInd=f[connectionData[1].field].selectedIndex;
  2028. startAt = cs.indexOf(connectionData[0].key);
  2029. if(isFilesystem) {
  2030. f[connectionData[0].field].value = getFieldStartingAt(cs, startAt, connectionData[0].key+'alias:', connectionData[0].end);
  2031. } else {
  2032. f[connectionData[0].field].value = getFieldStartingAt(cs, startAt, connectionData[0].key, connectionData[0].end);
  2033. }
  2034. var endAt = 0;
  2035. startAt = cs.indexOf(connectionData[2].key);
  2036. if (startAt >= 0) {
  2037. f[connectionData[2].field].value = getFieldStartingAt(cs, startAt, connectionData[2].key, connectionData[2].end);
  2038. if (isSupportedCmisProvider(provider)) {
  2039. endAt = cs.indexOf(connectionData[3].key) + connectionData[3].key.length + provider.length;
  2040. } else {
  2041. endAt = cs.indexOf(connectionData[2].key) + connectionData[2].key.length + f[connectionData[2].field].value.length;
  2042. }
  2043. } else {
  2044. if (isSupportedCmisProvider(provider)) {
  2045. endAt = cs.indexOf(connectionData[3].key) + connectionData[3].key.length + provider.length;
  2046. } else {
  2047. endAt = cs.indexOf(connectionData[1].key) + connectionData[1].key.length + repositoryPluginType.length;
  2048. }
  2049. }
  2050. f.m_connection_jdbc_parameters.value = cs.substring(endAt + 1);
  2051. }
  2052. else if (connectType == 'jdbc-sql')
  2053. {
  2054. // [^User ID:][^?Password:];LOCAL;JD-SS;URL=<URLSPEC>;DRIVER_NAME=com.microsoft.sqlserver.jdbc.SQLServerDriver[;CognosProperty1=value1[;...]]
  2055. // where
  2056. // URLSPEC = jdbc:sqlserver://<SERVERNAME>:<PORT>[;INSTANCENAME=<INSTNAME>];DATABASE=<DB>[;LOGINTIMEOUT=<TIMEOUT>][;integratedSecurity=true][;[jdbcproperty1=jdbcvalue1][;jdbcproperty2=jdbcvalue2]...]
  2057. // Authentication: [0] None, [1] C8 service creds, [2] Namespace, [3] Signon (User ID/[Password])
  2058. if (credentialNamespaces == 'true') {
  2059. f.authentication[2].checked = 'true';
  2060. } else if (cs.indexOf("^User ID:") != -1) {
  2061. f.authentication[3].checked = true;
  2062. f.m_connection_use_pword.disabled = false;
  2063. if (cs.indexOf("^?Password:") != -1) {
  2064. f.m_connection_use_pword.checked = true;
  2065. }
  2066. } else if (cs.indexOf(";integratedSecurity=true") != -1) {
  2067. f.authentication[1].checked = true;
  2068. } else {
  2069. f.authentication[0].checked = true;
  2070. }
  2071. var serverNameEnd;
  2072. var urlProtocol = "jdbc:sqlserver://";
  2073. var urlStart = cs.indexOf(urlProtocol);
  2074. var portEnd = -1;
  2075. if (urlStart != -1) {
  2076. serverNameEnd = cs.indexOf(":", urlStart + urlProtocol.length);
  2077. portEnd = cs.indexOf(";", urlStart + urlProtocol.length);
  2078. var hasPort = true;
  2079. if (serverNameEnd == -1 || serverNameEnd > portEnd) {
  2080. serverNameEnd = portEnd;
  2081. hasPort = false;
  2082. }
  2083. if (serverNameEnd != -1) {
  2084. f.m_connection_servername.value = cs.substring(urlStart + urlProtocol.length, serverNameEnd);
  2085. }
  2086. if (hasPort) {
  2087. f.m_connection_port.value = cs.substring(serverNameEnd + 1, portEnd);
  2088. }
  2089. }
  2090. var startingWith = "INSTANCENAME=";
  2091. var start = cs.indexOf(startingWith, portEnd + 1);
  2092. if (start != -1) {
  2093. var end = cs.indexOf(";", start + startingWith.length);
  2094. if (end != -1) {
  2095. f.m_connection_sql_instance_name.value = cs.substring(start + startingWith.length, end);
  2096. } else {
  2097. f.m_connection_sql_instance_name.value = cs.substring(start + startingWith.length);
  2098. }
  2099. cs = cs.replace(eval("/;" + startingWith + f.m_connection_sql_instance_name.value + "/"), "");
  2100. }
  2101. var startingWith = "DATABASE=";
  2102. var start = cs.indexOf(startingWith, portEnd + 1);
  2103. if (start != -1) {
  2104. var end = cs.indexOf(";", start + startingWith.length);
  2105. if (end != -1) {
  2106. f.m_connection_jdbc_database_name.value = cs.substring(start + startingWith.length, end);
  2107. } else {
  2108. f.m_connection_jdbc_database_name.value = cs.substring(start + startingWith.length);
  2109. }
  2110. cs = cs.replace(eval("/;" + startingWith + f.m_connection_jdbc_database_name.value + "/"), "");
  2111. }
  2112. var startingWith = "LOGINTIMEOUT=";
  2113. var start = cs.indexOf(startingWith, portEnd + 1);
  2114. if (start != -1) {
  2115. var end = cs.indexOf(";", start + startingWith.length);
  2116. if (end != -1) {
  2117. f.m_connection_jdbc_connect_time.value = cs.substring(start + startingWith.length, end);
  2118. } else {
  2119. f.m_connection_jdbc_connect_time.value = cs.substring(start + startingWith.length);
  2120. }
  2121. cs = cs.replace(eval("/;" + startingWith + f.m_connection_jdbc_connect_time.value + "/"), "");
  2122. }
  2123. cs = cs.replace(/;integratedSecurity=true/, "");
  2124. var startingWith = ";DRIVER_NAME=";
  2125. var start = cs.indexOf(startingWith, portEnd);
  2126. if (start != portEnd) {
  2127. f.m_connection_jdbc_parameters.value = cs.substring(portEnd + 1, start);
  2128. }
  2129. f.m_connection_jdbc_sort_colseq.value = getFieldStartingAt(cs, portEnd + 1, "LOCALSORT=", ";");
  2130. f.m_connection_jdbc_sort_level.value = getFieldStartingAt(cs, portEnd + 1, "LEVEL=", ";");
  2131. }
  2132. else if (connectType == 'jdbc-teradata')
  2133. {
  2134. // [^User ID:][^?Password:];LOCAL;JD-TD;URL=<URLSPEC>;DRIVER_NAME=com.teradata.jdbc.TeraDriver[;CognosProperty1=value1[;...]]
  2135. // where
  2136. // URLSPEC = jdbc:teradata://<SERVERNAME>/DBS_PORT=<PORT>,DATABASE=<DBNAME>[,jdbcproperty1=jdbcvalue1][,jdbcproperty2=jdbcvalue2]...
  2137. // Authentication: [0] None, [1] Namespace, [2] Signon (User ID/[Password])
  2138. if (credentialNamespaces == 'true') {
  2139. f.authentication[1].checked = true;
  2140. } else if (cs.indexOf("^User ID:") != -1) {
  2141. f.authentication[2].checked = 'true';
  2142. f.m_connection_use_pword.disabled = false;
  2143. if (cs.indexOf("^?Password:") != -1) {
  2144. f.m_connection_use_pword.checked = true;
  2145. }
  2146. } else {
  2147. f.authentication[0].checked = 'true';
  2148. }
  2149. var serverNameEnd;
  2150. var urlProtocol = "jdbc:teradata://";
  2151. var urlStart = cs.indexOf(urlProtocol);
  2152. var dbs_port = "DBS_PORT=";
  2153. var dbs_port_start = cs.indexOf(dbs_port, serverNameEnd + 1);
  2154. if (urlStart != -1) {
  2155. if (dbs_port_start != -1) {
  2156. serverNameEnd = cs.indexOf("/", urlStart + urlProtocol.length);
  2157. } else {
  2158. serverNameEnd = cs.indexOf(",", urlStart + urlProtocol.length);
  2159. if (serverNameEnd == -1){
  2160. serverNameEnd = cs.indexOf(";", urlStart + urlProtocol.length);
  2161. }
  2162. }
  2163. if (serverNameEnd != -1) {
  2164. f.m_connection_servername.value = cs.substring(urlStart + urlProtocol.length, serverNameEnd);
  2165. }
  2166. }
  2167. var startingWith = "DBS_PORT=";
  2168. var start = cs.indexOf(startingWith, serverNameEnd + 1);
  2169. if (start != -1) {
  2170. var end = cs.indexOf(",", start + startingWith.length);
  2171. if (end != -1) {
  2172. f.m_connection_port.value = cs.substring(start + startingWith.length, end);
  2173. } else {
  2174. var end = cs.indexOf(";", start + startingWith.length);
  2175. if (end != -1) {
  2176. f.m_connection_port.value = cs.substring(start + startingWith.length, end);
  2177. }
  2178. }
  2179. var separator = "";
  2180. if (cs.charAt(start-1) == ",") {
  2181. separator = ",";
  2182. }
  2183. cs = cs.replace(eval("/" + separator + startingWith + f.m_connection_port.value + "/"), "");
  2184. }
  2185. var startingWith = "DATABASE=";
  2186. var start = cs.indexOf(startingWith, serverNameEnd);
  2187. if (start != -1) {
  2188. var end = cs.indexOf(",", start + startingWith.length);
  2189. if (end != -1) {
  2190. f.m_connection_jdbc_database_name.value = cs.substring(start + startingWith.length, end);
  2191. } else {
  2192. var end = cs.indexOf(";", start + startingWith.length);
  2193. if (end != -1) {
  2194. f.m_connection_jdbc_database_name.value = cs.substring(start + startingWith.length, end);
  2195. }
  2196. }
  2197. var separator = "";
  2198. if (cs.charAt(start-1) == ",") {
  2199. separator = ",";
  2200. }
  2201. cs = cs.replace(eval("/" + separator + startingWith + f.m_connection_jdbc_database_name.value + "/"), "");
  2202. }
  2203. var startingWith = ";DRIVER_NAME=";
  2204. var start = cs.indexOf(startingWith, serverNameEnd);
  2205. if (start != serverNameEnd + 1 && start != serverNameEnd) {
  2206. if (cs.charAt(serverNameEnd + 1) == ",") {
  2207. f.m_connection_jdbc_parameters.value = cs.substring(serverNameEnd + 2, start);
  2208. } else {
  2209. f.m_connection_jdbc_parameters.value = cs.substring(serverNameEnd + 1, start);
  2210. }
  2211. }
  2212. f.m_connection_jdbc_sort_colseq.value = getFieldStartingAt(cs, serverNameEnd + 1, "LOCALSORT=", ";");
  2213. f.m_connection_jdbc_sort_level.value = getFieldStartingAt(cs, serverNameEnd + 1, "LEVEL=", ";");
  2214. }
  2215. else if (connectType == 'jdbc-netezza')
  2216. {
  2217. // [^User ID:][^?Password:];LOCAL;JD-NZ;URL=<URLSPEC>;DRIVER_NAME=org.netezza.Driver[;CognosProperty1=value1[;...]]
  2218. // where
  2219. // URLSPEC = jdbc:netezza://<SERVERNAME>[:<PORT>]/<DBNAME>[[;jdbcproperty1=jdbcvalue1][;jdbcproperty2=jdbcvalue2]...]
  2220. // Authentication: [0] None, [1] Namespace, [2] Signon (User ID/[Password])
  2221. if (credentialNamespaces == 'true') {
  2222. f.authentication[1].checked = true;
  2223. } else if (cs.indexOf("^User ID:") != -1) {
  2224. f.authentication[2].checked = 'true';
  2225. f.m_connection_use_pword.disabled = false;
  2226. if (cs.indexOf("^?Password:") != -1) {
  2227. f.m_connection_use_pword.checked = true;
  2228. }
  2229. } else {
  2230. f.authentication[0].checked = 'true';
  2231. }
  2232. var serverNameEnd;
  2233. var urlProtocol = "jdbc:netezza://";
  2234. var urlStart = cs.indexOf(urlProtocol);
  2235. if (urlStart != -1) {
  2236. var serverPortEnd = cs.indexOf("/", urlStart + urlProtocol.length);
  2237. if (serverPortEnd != -1) {
  2238. var serverAndPort = cs.substring(urlStart + urlProtocol.length, serverPortEnd);
  2239. var indexOfPortStart = serverAndPort.indexOf(":");
  2240. if (indexOfPortStart == -1){
  2241. //in this case there was no port so just set the sername to the whole thing and forget about the port
  2242. f.m_connection_servername.value = serverAndPort;
  2243. } else {
  2244. //in this case we have a server and a port so need to take care of that
  2245. f.m_connection_servername.value = serverAndPort.substring(0, indexOfPortStart);
  2246. f.m_connection_port.value = serverAndPort.substring(indexOfPortStart + 1);
  2247. }
  2248. }
  2249. }
  2250. var urlEnd;
  2251. var dbNameEnd = cs.indexOf(";", serverPortEnd + 1);
  2252. if (dbNameEnd != -1) {
  2253. f.m_connection_jdbc_database_name.value = cs.substring(serverPortEnd + 1, dbNameEnd);
  2254. urlEnd = cs.indexOf(";DRIVER_NAME", dbNameEnd + 1);
  2255. if (urlEnd != -1) {
  2256. f.m_connection_jdbc_parameters.value = cs.substring(dbNameEnd + 1, urlEnd);
  2257. }
  2258. }
  2259. f.m_connection_jdbc_sort_colseq.value = getFieldStartingAt(cs, urlEnd + 1, "LOCALSORT=", ";");
  2260. f.m_connection_jdbc_sort_level.value = getFieldStartingAt(cs, urlEnd + 1, "LEVEL=", ";");
  2261. }
  2262. else if (connectType == 'xml')
  2263. {
  2264. f.m_connection_database.value = cs.substring(11);
  2265. }
  2266. else if (connectType == "sr3")
  2267. {
  2268. var connectionData = cs.substring(43);
  2269. var indexOfLB = connectionData.indexOf("LB:");
  2270. var endIndex = 0;
  2271. if (indexOfLB == -1)
  2272. {
  2273. endIndex = connectionData.indexOf(":");
  2274. f.m_connection_application_server.value = connectionData.substring(0,endIndex);
  2275. connectionData = connectionData.substring(endIndex + 1);
  2276. endIndex = connectionData.indexOf(":");
  2277. f.m_connection_system_number.value = connectionData.substring(0,endIndex);
  2278. connectionData = connectionData.substring(endIndex + 1);
  2279. }
  2280. else
  2281. {
  2282. f.m_connection_use_loadbalancing.checked = true;
  2283. f.m_connection_use_loadbalancing_hidden.value = "true";
  2284. endIndex = connectionData.indexOf(":", indexOfLB + 3);
  2285. f.m_connection_message_server.value = getFieldStartingAt(connectionData, 0, "LB:", ":");
  2286. connectionData = connectionData.substring(endIndex + 1);
  2287. endIndex = connectionData.indexOf(":");
  2288. f.m_connection_system_id.value = connectionData.substring(0,endIndex);
  2289. connectionData = connectionData.substring(endIndex + 1);
  2290. endIndex = connectionData.indexOf(":");
  2291. f.m_connection_logon_group.value = connectionData.substring(0,endIndex);
  2292. connectionData = connectionData.substring(endIndex + 1);
  2293. }
  2294. f.m_connection_router_string.value = getFieldStartingAt(connectionData, 0, "ROUTER_STRING=", ":");
  2295. endIndex = connectionData.indexOf(":");
  2296. connectionData = connectionData.substring(endIndex + 1);
  2297. endIndex = connectionData.indexOf(":");
  2298. f.m_connection_client.value = connectionData.substring(0,endIndex);
  2299. connectionData = connectionData.substring(endIndex + 1);
  2300. endIndex = connectionData.indexOf(";");
  2301. f.m_connection_language.value = connectionData.substring(0,endIndex);
  2302. connectionData = connectionData.substring(endIndex + 1);
  2303. f.m_connection_max_conn_in_pool.value = getFieldStartingAt(connectionData, 0, "MAX_CONN=", ";");
  2304. f.m_connection_abap_query_db_access_limit.value = getFieldStartingAt(connectionData, 0, "ABAP_QUERY_DB_ACCESSES=", ";");
  2305. f.m_connection_table_row_count.value = getFieldStartingAt(connectionData, 0, "TABLE_READ_COUNT=", ";");
  2306. f.m_connection_table_read_function.value = getFieldStartingAt(connectionData, 0, "READ_TABLE_FUNCTION_NAME=", ";");
  2307. }
  2308. else if (connectType == "sfdc")
  2309. {
  2310. if (cs.indexOf("^?Password:") != -1)
  2311. {
  2312. f.m_connection_use_pword.checked = true;
  2313. }
  2314. var startIndex = cs.indexOf("sfdc:");
  2315. var connectionData = cs.substring(startIndex+5);
  2316. var endIndex = connectionData.indexOf(";");
  2317. f.m_connection_url.value = connectionData.substring(0,endIndex);
  2318. f.m_connection_conc_calls_limit.value = getFieldStartingAt(connectionData, 0, "CONCURRENT_CALLS_LIMIT=", ";");
  2319. f.m_connection_user_conc_calls_limit.value = getFieldStartingAt(connectionData, 0, "USER_CONCURRENT_CALLS_LIMIT=", ";");
  2320. f.m_connection_timeout.value = getFieldStartingAt(connectionData, 0, "CONNECTION_TIMEOUT=", ";");
  2321. f.m_connection_query_batch_size.value = getFieldStartingAt(connectionData, 0, "QUERY_BATCH_SIZE=", ";");
  2322. f.m_connection_max_retries.value = getFieldStartingAt(connectionData, 0, "MAX_RETRIES=", ";");
  2323. f.m_connection_wait_between_retries.value = getFieldStartingAt(connectionData, 0, "WAIT_BETWEEN_RETRIES=", ";");
  2324. if (getFieldStartingAt(connectionData, 0, "PROXY_ENABLED=", ";") == "true") {
  2325. f.m_connection_proxy_enabled.checked = true;
  2326. disableProxyControls(false);
  2327. } else {
  2328. f.m_connection_proxy_enabled.checked = false;
  2329. disableProxyControls(true);
  2330. }
  2331. setProxyControls();
  2332. f.m_connection_proxy_host.value = getFieldStartingAt(connectionData, 0, "PROXY_HOST=", ";");
  2333. f.m_connection_proxy_port.value = getFieldStartingAt(connectionData, 0, "PROXY_PORT=", ";");
  2334. }
  2335. else if (connectType == "siebel")
  2336. {
  2337. var connectionData = cs.substring(49);
  2338. var endIndex = connectionData.indexOf(".");
  2339. f.m_connection_transport.value = connectionData.substring(0,endIndex);
  2340. connectionData = connectionData.substring(endIndex + 1);
  2341. endIndex = connectionData.indexOf(".");
  2342. f.m_connection_encryption.value = connectionData.substring(0,endIndex);
  2343. connectionData = connectionData.substring(endIndex + 1);
  2344. endIndex = connectionData.indexOf(":");
  2345. f.m_connection_compression.value = connectionData.substring(0,endIndex);
  2346. connectionData = connectionData.substring(endIndex + 1);
  2347. endIndex = connectionData.indexOf(":");
  2348. f.m_connection_gatewayserver.value = connectionData.substring(2,endIndex);
  2349. connectionData = connectionData.substring(endIndex + 1);
  2350. endIndex = connectionData.indexOf("/");
  2351. f.m_connection_gatewayport.value = connectionData.substring(0,endIndex);
  2352. connectionData = connectionData.substring(endIndex + 1);
  2353. endIndex = connectionData.indexOf("/");
  2354. f.m_connection_enterprise_name.value = connectionData.substring(0,endIndex);
  2355. connectionData = connectionData.substring(endIndex + 1);
  2356. endIndex = connectionData.indexOf("_");
  2357. f.m_connection_aom.value = connectionData.substring(0,endIndex);
  2358. connectionData = connectionData.substring(endIndex + 1);
  2359. endIndex = connectionData.indexOf(";");
  2360. f.m_connection_language.value = connectionData.substring(0,endIndex);
  2361. connectionData = connectionData.substring(endIndex + 1);
  2362. f.m_connection_siebel_repo.value = getFieldStartingAt(connectionData, 0, "REPOSITORY_NAME=", ";");
  2363. f.m_connection_login_retries.value = getFieldStartingAt(connectionData, 0, "LOGIN_RETRY_COUNT=", ";");
  2364. f.m_connection_login_retry_delay.value = getFieldStartingAt(connectionData, 0, "LOGIN_RETRY_DELAY=", ";");
  2365. f.m_connection_local_sort.value = getFieldStartingAt(connectionData, 0, "LOCALSORT=", ";");
  2366. f.m_connection_level.value = getFieldStartingAt(connectionData, 0, "LEVEL=", ";");
  2367. f.m_connection_charset.value = getFieldStartingAt(connectionData, 0, "CHARSET=", ";");
  2368. f.m_connection_adv_parameters.value = getFieldStartingAt(connectionData, 0, "ADVANCED_PARAMETERS=", ";");
  2369. }
  2370. else if (connectType == 'other')
  2371. {
  2372. f.m_other_connectionString.value = cs;
  2373. }
  2374. }
  2375. function getFieldStartingAt(string, startingAt, startingWith, endingWith)
  2376. {
  2377. var start = string.indexOf(startingWith, startingAt);
  2378. if (start != -1) {
  2379. var end = string.indexOf(endingWith, start + startingWith.length);
  2380. if (end == -1) {
  2381. return(string.substring(start + startingWith.length));
  2382. }
  2383. return(string.substring(start + startingWith.length, end));
  2384. }
  2385. return '';
  2386. }
  2387. // Searches the string for a given param and sets the frmField to the value found
  2388. function getField(string, param)
  2389. {
  2390. start = string.indexOf(param);
  2391. if (start != -1)
  2392. {
  2393. end = string.indexOf(";", start + param.length);
  2394. if (end == -1)
  2395. {
  2396. return(string.substring(start + param.length));
  2397. }
  2398. return(string.substring(start + param.length, end));
  2399. }
  2400. return '';
  2401. }
  2402. function togglePasswordCheckbox()
  2403. {
  2404. var f = document.pform;
  2405. if (f.m_connection_default_signon && f.m_connection_default_signon.checked)
  2406. {
  2407. disablePasswordFields(!f.m_connection_use_pword.checked);
  2408. }
  2409. }
  2410. function toggleCreateSignon()
  2411. {
  2412. var f = document.pform;
  2413. var defaultSignonChecked = f.m_connection_default_signon && f.m_connection_default_signon.checked;
  2414. disableUserIDField(!defaultSignonChecked);
  2415. if (f.m_connection_use_pword)
  2416. {
  2417. disablePasswordFields(!(defaultSignonChecked && f.m_connection_use_pword.checked));
  2418. }
  2419. else
  2420. {
  2421. disablePasswordFields(!defaultSignonChecked);
  2422. }
  2423. }
  2424. function toggleAssemblyCheckbox()
  2425. {
  2426. var f = document.pform;
  2427. disableAssemblyFields(f.m_connection_assembly.checked);
  2428. }
  2429. function updateRepositoryType() {
  2430. var f = document.pform;
  2431. if (f.m_connection_jdbc_driverclass.value == "FileSystem") {
  2432. if (f.fsAliasRoot_select.length==0) {
  2433. window.alert(repo_fs_none_msg);
  2434. f.m_connection_jdbc_driverclass.selectedIndex=repoTypeSelectInd;
  2435. return;
  2436. }
  2437. }
  2438. var allowSwitch = true;
  2439. if (f.m_connection_file.value!='' || f.m_connection_jdbc_parameters.value!='') {
  2440. allowSwitch = confirm(repo_wmsg);
  2441. } else {
  2442. if (f.m_connection_jdbc_driverclass.options[repoTypeSelectInd].value == "FileSystem") {
  2443. if (f.fsAliasRoot_select.selectedIndex!=0) {
  2444. allowSwitch = confirm(repo_wmsg);
  2445. }
  2446. } else {
  2447. if (f.cmisURL_input.value!='' || !f.m_connection_use_userid.checked || !f.m_connection_use_pword.checked || (f.m_connection_default_signon!=null && !f.m_connection_default_signon.checked)
  2448. || (f.m_connection_userid!=null && f.m_connection_userid.value!='') || (f.m_connection_password!=null && f.m_connection_password.value!='') || (f.m_connection_confirm_password!=null && f.m_connection_confirm_password.value!='')) {
  2449. allowSwitch = confirm(repo_wmsg);
  2450. }
  2451. }
  2452. }
  2453. if (allowSwitch) {
  2454. f.m_connection_file.value='';
  2455. f.m_connection_jdbc_parameters.value='';
  2456. if (f.m_connection_jdbc_driverclass.options[repoTypeSelectInd].value == "FileSystem") {
  2457. f.fsAliasRoot_select.selectedIndex=0;
  2458. f.m_connection_jdbc_url.value='';
  2459. } else {
  2460. f.cmisURL_input.value='';
  2461. f.m_connection_jdbc_url.value='';
  2462. f.m_connection_use_userid.checked=false;
  2463. f.m_connection_use_pword.checked=false;
  2464. if (f.m_connection_default_signon) {
  2465. f.m_connection_default_signon.checked=true;
  2466. f.m_connection_userid.value='';
  2467. f.m_connection_password.value='';
  2468. f.m_connection_confirm_password.value='';
  2469. updateSignonSection(false);
  2470. }
  2471. }
  2472. repoTypeSelectInd=f.m_connection_jdbc_driverclass.selectedIndex;
  2473. initRepositoryConnectionPage();
  2474. } else {
  2475. f.m_connection_jdbc_driverclass.selectedIndex=repoTypeSelectInd;
  2476. }
  2477. }
  2478. function isSupportedCmisProvider(provider) {
  2479. return provider == 'CM8' || provider == 'FileNet';
  2480. }
  2481. function cmisURL_input_changed() {
  2482. var f = document.pform;
  2483. f.m_connection_jdbc_url.value=f.cmisURL_input.value;
  2484. }
  2485. function fsAliasRoot_select_changed() {
  2486. var f = document.pform;
  2487. f.m_connection_jdbc_url.value=f.fsAliasRoot_select.value;
  2488. }
  2489. function updateTrustedContext()
  2490. {
  2491. var f = document.pform;
  2492. f.m_connection_identity_propagation.disabled = !f.m_connection_trusted_context.checked;
  2493. }
  2494. function initRepositoryConnectionPage()
  2495. {
  2496. var f = document.pform;
  2497. if (f.m_connection_jdbc_driverclass) {
  2498. if (f.m_p_credentialNamespaces) {
  2499. f.m_p_credentialNamespaces.value='';
  2500. }
  2501. var signonDiv = document.getElementById('gen-signon-section');
  2502. f.fsAliasRoot_select.selectedIndex=0;
  2503. if (f.m_connection_jdbc_driverclass.value == "FileSystem") {
  2504. if (f.fsAliasRoot_select.length==0) {
  2505. f.m_connection_jdbc_url.value='';
  2506. } else {
  2507. if (f.m_connection_jdbc_url.value == '') {
  2508. f.m_connection_jdbc_url.value=f.fsAliasRoot_select.value;
  2509. }
  2510. }
  2511. f.fsAliasRoot_select.value=f.m_connection_jdbc_url.value;
  2512. showDynamicDiv('fileSystemDiv');
  2513. hideDynamicDiv('cmisDiv');
  2514. signonDiv.style.display = 'none';
  2515. } else {
  2516. f.cmisURL_input.value=f.m_connection_jdbc_url.value;
  2517. f.m_connection_use_userid.checked=true;
  2518. f.m_connection_use_pword.checked=true;
  2519. if (f.m_connection_default_signon) {
  2520. f.m_connection_default_signon.checked=true;
  2521. }
  2522. updateSignonSection(true);
  2523. showDynamicDiv('cmisDiv');
  2524. hideDynamicDiv('fileSystemDiv');
  2525. signonDiv.style.display = 'inline';
  2526. }
  2527. }
  2528. }
  2529. function updateJdbcOracle()
  2530. {
  2531. var f = document.pform;
  2532. if (f.m_connection_jdbc_oracle_style) {
  2533. if (f.m_connection_jdbc_oracle_style[0] && f.m_connection_jdbc_oracle_style[0].checked == true) {
  2534. showDynamicDiv('serviceID');
  2535. f.m_connection_servername.disabled = false;
  2536. f.m_connection_port.disabled = false;
  2537. f.m_connection_oracle_service_id.disabled = false;
  2538. hideDynamicDiv('tnsNamesAlias');
  2539. f.m_connection_oracle_tns_name.disabled = true;
  2540. hideDynamicDiv('oracleNetDescriptor');
  2541. f.m_connection_oracle_net_descriptor.disabled = true;
  2542. } else if (f.m_connection_jdbc_oracle_style[1] && f.m_connection_jdbc_oracle_style[1].checked == true) {
  2543. hideDynamicDiv('serviceID');
  2544. f.m_connection_servername.disabled = true;
  2545. f.m_connection_port.disabled = true;
  2546. f.m_connection_oracle_service_id.disabled = true;
  2547. showDynamicDiv('tnsNamesAlias');
  2548. f.m_connection_oracle_tns_name.disabled = false;
  2549. hideDynamicDiv('oracleNetDescriptor');
  2550. f.m_connection_oracle_net_descriptor.disabled = true;
  2551. } else if (f.m_connection_jdbc_oracle_style[2] && f.m_connection_jdbc_oracle_style[2].checked == true) {
  2552. hideDynamicDiv('serviceID');
  2553. f.m_connection_servername.disabled = true;
  2554. f.m_connection_port.disabled = true;
  2555. f.m_connection_oracle_service_id.disabled = true;
  2556. hideDynamicDiv('tnsNamesAlias');
  2557. f.m_connection_oracle_tns_name.disabled = true;
  2558. showDynamicDiv('oracleNetDescriptor');
  2559. f.m_connection_oracle_net_descriptor.disabled = false;
  2560. }
  2561. }
  2562. }
  2563. function updateJdbcSortOptions()
  2564. {
  2565. var f = document.pform;
  2566. if (f.m_connection_jdbc_sort_colseq && f.m_connection_jdbc_sort_level) {
  2567. if (f.m_connection_jdbc_sort_colseq.value == '') {
  2568. f.m_connection_jdbc_sort_level.disabled = true;
  2569. } else {
  2570. f.m_connection_jdbc_sort_level.disabled = false;
  2571. }
  2572. }
  2573. }
  2574. function updateSignonSection(rootChecked)
  2575. {
  2576. var f = document.pform;
  2577. if (f.m_connection_default_signon)
  2578. {
  2579. f.m_connection_default_signon.disabled = !rootChecked;
  2580. }
  2581. if (f.m_connection_use_pword)
  2582. {
  2583. f.m_connection_use_pword.disabled = !rootChecked;
  2584. }
  2585. // if the signon radio button isn't checked, then then disabled the userid and password fields
  2586. if (!rootChecked)
  2587. {
  2588. disableUserIDField(true);
  2589. disablePasswordFields(true);
  2590. }
  2591. // if the generate default signon isn't checked, then disabled the userid and password fields
  2592. else if (f.m_connection_default_signon && !f.m_connection_default_signon.checked)
  2593. {
  2594. disableUserIDField(true);
  2595. disablePasswordFields(true);
  2596. }
  2597. else
  2598. {
  2599. disableUserIDField(false);
  2600. disablePasswordFields(!((f.m_connection_use_pword && f.m_connection_use_pword.checked) || !f.m_connection_use_pword));
  2601. }
  2602. }
  2603. // when the user switches between authentication types (no authentication, external namespace, signon, ...)
  2604. function onChangeAuthentication()
  2605. {
  2606. var f = document.pform;
  2607. for (var i=0; i < f.authentication.length; i++)
  2608. {
  2609. if (f.authentication[i].value == 'namespace')
  2610. {
  2611. if (f.m_p_credentialNamespaces)
  2612. {
  2613. f.m_p_credentialNamespaces.disabled = !f.authentication[i].checked;
  2614. if (f.m_transformUserIdentification) {
  2615. f.m_transformUserIdentification.disabled = !f.authentication[i].checked;
  2616. }
  2617. }
  2618. }
  2619. else if (f.authentication[i].value == 'signon')
  2620. {
  2621. updateSignonSection(f.authentication[i].checked);
  2622. }
  2623. }
  2624. }
  2625. function disableUserIDField(disabled)
  2626. {
  2627. if (document.pform.m_connection_userid) {
  2628. document.pform.m_connection_userid.disabled = disabled;
  2629. }
  2630. }
  2631. function disablePasswordFields(disabled)
  2632. {
  2633. if (document.pform.m_connection_password) {
  2634. document.pform.m_connection_password.disabled = disabled;
  2635. }
  2636. if (document.pform.m_connection_confirm_password) {
  2637. document.pform.m_connection_confirm_password.disabled = disabled;
  2638. }
  2639. }
  2640. function disableAssemblyFields(disabled)
  2641. {
  2642. if (document.pform.m_connection_schema) {
  2643. document.pform.m_connection_schema.disabled = disabled;
  2644. }
  2645. if (document.pform.m_connection_http_method) {
  2646. document.pform.m_connection_http_method.disabled = disabled;
  2647. }
  2648. if (document.pform.m_connection_http_message_body) {
  2649. document.pform.m_connection_http_message_body.disabled = disabled;
  2650. }
  2651. if (document.pform.m_connection_json_path) {
  2652. document.pform.m_connection_json_path.disabled = disabled;
  2653. }
  2654. }
  2655. function isValidNameValuePairList(field, separator) {
  2656. if (field != null && field.value != '') {
  2657. var pairs = field.value.split(separator);
  2658. if (pairs != null && pairs.length != 0) {
  2659. for (var i = 0; i < pairs.length; i++) {
  2660. var regExp = new RegExp("^([^=]+)=([^=]*)$");
  2661. if (regExp.test(pairs[i]) == false){
  2662. return false;
  2663. }
  2664. }
  2665. }
  2666. }
  2667. return true;
  2668. }
  2669. // In a dual-stack world a checkbox may be a checkbox or a hidden field by the time it
  2670. // is used to build the connection string. This method takes care of the difference.
  2671. function isCheckboxChecked(field){
  2672. return (field && (field.checked || field.type != 'checkbox'))
  2673. }
  2674. function isListItemSelected(select, item) {
  2675. if (select && select.value == item) {
  2676. return true;
  2677. }
  2678. return false;
  2679. }
  2680. // When creating a dual stack connection, fieldOrArrayOfFields may be 1) an array of input fields or 2) one hidden input.
  2681. // It is an array when the form is enabled and a hidden input when on the jdbc connection page.
  2682. function isRadioButtonSelected(fieldOrArrayOfFields, name) {
  2683. if (fieldOrArrayOfFields) {
  2684. if (fieldOrArrayOfFields.length > 0) {
  2685. for (var i = 0; i < fieldOrArrayOfFields.length; i++) {
  2686. var input = fieldOrArrayOfFields[i];
  2687. if (input.value == name) {
  2688. return (input.checked || input.type == 'hidden');
  2689. }
  2690. }
  2691. } else {
  2692. if (fieldOrArrayOfFields.value == name) {
  2693. return (fieldOrArrayOfFields.checked || fieldOrArrayOfFields.type == 'hidden');
  2694. }
  2695. }
  2696. }
  2697. return false;
  2698. }
  2699. function selectRadioButton(radioButtongGroup, name) {
  2700. for (var i = 0; i < radioButtongGroup.length; i++) {
  2701. var input = radioButtongGroup[i];
  2702. if (input.value == name) {
  2703. input.checked = 'true';
  2704. }
  2705. }
  2706. }
  2707. function stripSpecialCharsFromOracleNetDesc(value) {
  2708. return value.replace(new RegExp( "[\\t\\r\\n\\b\\f]", "g" ), "");
  2709. }
  2710. function formatOracleNetDesc(value) {
  2711. var formattedValue = '';
  2712. var indentLevel = 0;
  2713. var lastBracket = null;
  2714. for (var i = 0 ; i < value.length; i++) {
  2715. var currChar = value.charAt(i);
  2716. if (currChar == '(') {
  2717. if (lastBracket == ')') {
  2718. // )(
  2719. formattedValue += '\n' + generateIndent(indentLevel) + currChar;
  2720. } else {
  2721. // ((
  2722. if (lastBracket == null) {
  2723. // for the very first bracket, don't newline or increase indentLevel
  2724. formattedValue += generateIndent(indentLevel) + currChar;
  2725. } else {
  2726. indentLevel++;
  2727. formattedValue += '\n' + generateIndent(indentLevel) + currChar;
  2728. }
  2729. }
  2730. lastBracket = currChar;
  2731. } else if (currChar == ')') {
  2732. if (lastBracket == ')') {
  2733. // ))
  2734. indentLevel--;
  2735. formattedValue += '\n' + generateIndent(indentLevel) + currChar;
  2736. } else {
  2737. // ()
  2738. formattedValue += currChar;
  2739. }
  2740. lastBracket = currChar;
  2741. } else {
  2742. // all other chars
  2743. formattedValue += currChar;
  2744. }
  2745. }
  2746. return formattedValue;
  2747. }
  2748. function setProxyControls()
  2749. {
  2750. frm = document.pform;
  2751. if (frm.m_connection_proxy_enabled.checked == true)
  2752. {
  2753. frm.m_connection_proxy_enabled.value = "true";
  2754. disableProxyControls(false)
  2755. }
  2756. else
  2757. {
  2758. frm.m_connection_proxy_enabled.value = "false";
  2759. disableProxyControls(true)
  2760. }
  2761. }
  2762. function disableProxyControls(disabled)
  2763. {
  2764. frm = document.pform;
  2765. frm.m_connection_proxy_host.disabled=disabled;
  2766. frm.m_connection_proxy_port.disabled=disabled;
  2767. frm.m_connection_proxy_user.disabled=disabled;
  2768. frm.m_connection_proxy_password.disabled=disabled;
  2769. }
  2770. function generateIndent(indentLevel) {
  2771. var indent = '';
  2772. var j = indentLevel;
  2773. while (j != 0) {
  2774. indent += '\t';
  2775. j--;
  2776. }
  2777. return indent;
  2778. }