123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145 |
- /****************************************************************
- ** IBM Confidential
- **
- ** OCO Source Materials
- **
- ** IBM Cognos Products: mdsrv
- **
- ** (C) Copyright IBM Corp. 2008, 2017
- **
- ** The source code for this program is not published or otherwise
- ** divested of its trade secrets, irrespective of what has been
- ** deposited with the U.S. Copyright Office.
- *****************************************************************/
- G_HAL.F_Include( WEB_CONTENT + "/hal/C_Deck.js" );
- G_HAL.F_Include( WEB_CONTENT + "/hal/C_TreeView.js" );
- G_HAL.F_Include( WEB_CONTENT + "/hal/C_ListView.js" );
- G_HAL.F_Include( WEB_CONTENT + "/hal/U_CookieJar.js" );
- G_HAL.F_Include( WEB_CONTENT + "/hal/C_Dialog.js" );
- G_HAL.F_Include( WEB_CONTENT + "/common/json/json2.js" );
- G_HAL.F_Include( WEB_CONTENT + "/hal/G_ResManager.js" );
- G_HAL.F_Include( WEB_CONTENT + "/hal/C_MultiScriptRequest.js" );
- //G_HAL.F_Include( WEB_CONTENT + "hal/G_KeyboardManager.js");
- G_HAL.F_Include( WEB_CONTENT + "/hal/C_ComboBox.js" );
- G_HAL.F_Include( WEB_CONTENT + "/hal/C_PropertySheet.js" );
- /*
- This file is used for Essbase and TMR, as their implementations have something in common,
- e.g. keeping track of a map from a cube to one (or more) alias, which maps to the selected language(s).
- Since TMR doesn't support aliases, we can use a fake alias so that the existing code in FM can be leveraged.
- Note that TM1 can't be used because TM1 has 4 levels of mapping: cube -> dimensions -> aliases -> languages.
- */
- //TO DO & Ideas:
- //
- // - button: Unselect all
- //
- // - label: Number of objects selected
- // These are meant to be constants (even if JavaScript allows you to change them; you MUST NOT change them).
- var kDatabaseTypeStr = "database";
- var kCatalogTypeStr = "catalog";
- var kCubeTypeStr = "cube";
- var kInfoQueryTypeStr = "infoQuery";
- var kDimensionGroupTypeStr = "dimensionGroup";
- var kDimensionTypeStr = "dimension";
- var kMeasuresGroupTypeStr = "Measures";
- var kMeasureTypeStr = "measure";
- var asyncErrorPagePid = "importWizard_communication_error_page";
- var mapCubeAliasLanguages; //map { cubeuniqueName, map { alias table / list(of selected languages) } }
- var cubeNodeList; // keeps the tree nodes of the selected cubes. We need the tree nodes to be able to compute the path to the cube browsing the parents.
- var cubeAttributeDimensionsAsProperties; // keep the attributeDimensionsAsProperties per cube
- var mapCubeAliasTables; // map { cubeuniqueName, treeSnippet} ( used to cash the alias tables per cube to improve the performance )
- var G_App = {};
- function ImportWizard()
- {
- this.credentials = "";
- }
- ImportWizard.prototype.setDataSourceCredentials = function(credentialString)
- {
- this.credentials = credentialString;
- urlRequestInvoker.RequestFinished();
- }
- ImportWizard.prototype.updateCredentials = function(newCredentials)
- {
- var urlPostParams = new Object();
- urlPostParams["pid"] = "updateCredentials";
- urlPostParams["current_credentials"] = this.credentials;
- urlPostParams["newcredentials_password"] = newCredentials;
- urlPostParams["error_pid"] = asyncErrorPagePid;
-
- var updateCredentialsRequestURL = GATEWAY_URL + "/metadataUIService";
-
- urlRequestInvoker.MakeAsyncRequestInIFrame( updateCredentialsRequestURL, urlPostParams );
- }
- ImportWizard.prototype.checkNext = function()
- {
- var currentCard = G_App.m_oDeck.F_GetIndex();
-
- switch (currentCard)
- {
- case 0:
- {
- var msg = this.checkImportSelectionRestraints();
- if (msg && msg != null)
- {
- return msg;
- }
- msg = this.checkDesignLocaleSelected();
- if (msg && msg != null){
- return msg;
- }
- break;
- }
- case 1:
- break;
- case 2:
- break;
- case 3:
- break;
- }
- return null;
- }
- ImportWizard.prototype.checkDesignLocaleSelected = function(){
- var designLocaleList = document.getElementById( "designLanguage" );
-
- if (designLocaleList.selectedIndex < 0){
- return localizedStrings["MSR_SAP_designLocaleRequired"];
- }
-
- }
- ImportWizard.prototype.checkImportSelectionRestraints = function()
- {
- var treeNodesList = G_App.m_oTreeViewCheckboxes.F_GetCheckedNodes();
-
- if (treeNodesList.length == 0)
- {
- return localizedStrings["MSR_SAP_mustImportAtLeastOneItem"];
- }
- return null;
- }
- IMPORTWIZARD = new ImportWizard();
- G_App.F_HAL_OnLoad = function()
- {
- // @todo Must pass proper locale code!
- G_ResManager.F_SetLocale( "en" );
-
- // This call is needed even if we don't pass a filename as an argument,
- // in order to load the standard HAL string resources.
- G_ResManager.F_LoadStrings( [ /*WEB_CONTENT + "/mdsrv/res/strings"*/], this );
- //Enable Accessibility for FireFox Browser only, pass false as second parameter if you don't want the focus ring in Firefox
- G_HAL.F_EnableAccessibility( G_BrowserInfo.M_bIsFirefox );
- //Enable High Contrast Mode need for FireFox only, Need testing to enable it for IE as well
- //if( G_BrowserInfo.M_bIsFirefox )
- // Need to check if the high contrast mode is enabled, waiting for HAL to expose this function or may not need it
- //G_HAL.F_EnableHighContrastMode();
- };
- G_App.initControls = function()
- {
- this.m_oDeck = new C_Deck( document.getElementById( "divDeck" ), this );
- UpdateButtonsEnableStatus( 0 /* cardIndex */ );
- this.F_ApplySkin( "corporate|portal" );
- // this.F_ApplySkin( "windows|app" );
-
- this.m_treeViewNodesDoc = U_XML.F_CreateDocument();
- var treeViewElem = this.m_treeViewNodesDoc.appendChild( this.m_treeViewNodesDoc.createElement( 'treeView' ) );
- treeViewElem.setAttribute( "id", "TreeView" );
- treeViewElem.setAttribute( "showCheckboxes", "true" );
- //treeViewElem.setAttribute( "multiSelect", "false" );
-
- // Only populate with the root node if in "create" mode!
- if (!IMPORTWIZARD.isEdit)
- {
- this.PopulateTreeView_RootNode( this.m_treeViewNodesDoc, treeViewElem );
- }
- this.m_oTreeViewCheckboxes = new C_TreeView( document.getElementById( "divTreeViewCheckboxes" ), treeViewElem, this );
- g_expandTreeLevel = 0;
- var useV5DataServerCheckBox = document.getElementById( "useV5DataServer" );
- useV5DataServerCheckBox.checked = IMPORTWIZARD.bUseV5DataServer;
- if (IMPORTWIZARD.bDisableClassic == "true")
- //useV5DataServerCheckBox.disabled=true;
- useV5DataServerCheckBox.style.display = "none";
- // Cubes
- var aDoc3 = U_XML.F_CreateDocument();
- var listViewElemCubes = aDoc3.appendChild( aDoc3.createElement( 'listView' ) );
- listViewElemCubes.setAttribute( "id", "CubesListView" );
- listViewElemCubes.setAttribute( "showCheckboxes", "false" );
- listViewElemCubes.setAttribute( "multiSelect", "false" );
- listViewElemCubes.appendChild( aDoc3.createElement( "listItems" ) );
- this.m_oListViewCubes = new C_ListView( document.getElementById( "divListViewCubes" ), listViewElemCubes, this );
-
-
- // Alias Tables
- var aDocDimensions = U_XML.F_CreateDocument();
- var listViewElemDimensions = aDocDimensions.appendChild( aDocDimensions.createElement( 'listView' ) );
- listViewElemDimensions.setAttribute( "id", "DimensionsListView" );
- listViewElemDimensions.setAttribute( "showCheckboxes", "false" );
- listViewElemDimensions.setAttribute( "multiSelect", "false" );
- listViewElemDimensions.appendChild( aDocDimensions.createElement( "listItems" ) );
- this.m_oListViewDimensions = new C_ListView( document.getElementById( "divListViewDimensions" ), listViewElemDimensions, this );
- // Locales per alias per dimension
- var aDoc2 = U_XML.F_CreateDocument();
- var listViewElem = aDoc2.appendChild( aDoc2.createElement( 'listView' ) );
- listViewElem.setAttribute( "id", "LanguagesListView" );
- listViewElem.setAttribute( "view", "checkbox" );
- listViewElem.setAttribute( "showCheckboxes", "true" );
- listViewElem.appendChild( aDoc2.createElement( "listItems" ) );
- this.m_oListViewCheckboxes = new C_ListView( document.getElementById( "divListViewCheckboxes" ), listViewElem, this );
- // pre-populate the language list box
- PopulateLanguagesListBox();
- if (IMPORTWIZARD.enableTest == false)
- {
- ShowPackageRenameDlgIfNeeded();
- }
- }
- G_App.expandNode = function( node)
- {
- // testing code to expand the root node
- if (IMPORTWIZARD.enableTest == true)
- {
- //var node = g_viewNodeToExpand.selectSingleNode( "treeNode" );
- if (node != null)
- {
- G_App.m_oTreeViewCheckboxes.F_ExpandNode(node );
- G_App.m_oTreeViewCheckboxes.F_Draw();
- }
- }
- }
- G_App.initializeTreeViewCheckBox = function( )
- {
- this.m_treeViewNodesDoc = U_XML.F_CreateDocument();
- var treeViewElem = this.m_treeViewNodesDoc.appendChild( this.m_treeViewNodesDoc.createElement( 'treeView' ) );
- treeViewElem.setAttribute( "id", "TreeView" );
- treeViewElem.setAttribute( "showCheckboxes", "true" );
- this.PopulateTreeView_RootNode( this.m_treeViewNodesDoc, treeViewElem );
- // delete the maps
- mapCubeAliasTables = new Object();
- mapCubeAliasLanguages = new Object();
- cubeAttributeDimensionsAsProperties = new Object();
-
- this.m_oTreeViewCheckboxes = new C_TreeView( document.getElementById( "divTreeViewCheckboxes" ), treeViewElem, this );
-
-
- g_expandTreeLevel = 0;
-
- // expand the root node
- var treeRootViewNode = G_App.m_oTreeViewCheckboxes.F_GetTreeViewNode();
- var node = treeRootViewNode.selectSingleNode( "treeNode" );
- if (node != null)
- {
- setTimeout( function(){
- G_App.expandNode( node);
- }, 700 );
- }
- }
- G_App.F_ListView_OnCheckboxClick = function( v_oListView, v_nListItem, v_iMouseButton )
- {
- if (v_oListView == G_App.m_oListViewCheckboxes)
- {
- // will fill out the map mapLanguageAlias
- var checkedItemsOrig = G_App.m_oListViewCheckboxes.F_GetCheckedListItems();
- var checkedItems = new Array();
- for (var n = 0; n < checkedItemsOrig.length; n++)
- {
- var lang = checkedItemsOrig[n];
- var langCode = lang.getAttribute( "value" );
- checkedItems[n] = langCode;
- }
- // for TMR, simply add the selected languages
- // to the map using a faked alias, because TMR doesn't support aliases
- if (IMPORTWIZARD.dataSourceType == "TMR")
- {
- var mapDimMapLang = new Object();
- var cubeName = getSelectedCubeUniqueName();
- mapCubeAliasLanguages[cubeName] = mapDimMapLang;
- var aliasName = "TMR_Alias";
- mapDimMapLang[aliasName] = checkedItems; // list of languages
- return;
- }
- // !!!!! ToDo: !!!!! check to see if the language has already been assaigned to different alias table
- if (G_App.checkLangIsUsed() == false) // check to see if the languge has been already used. Unchecks the language. Returns "true" or "false"
- {
- v_nListItem.setAttribute("checked", "false"); //
- G_App.m_oListViewCheckboxes.F_Draw();
- return;
- }
-
- var dimNode = G_App.m_oListViewDimensions.F_GetSelectedListItem();
- if (dimNode != null)
- {
- var dimName = dimNode.getAttribute("label");
-
-
- var childNodeUniqueName = getSelectedCubeUniqueName();
- if (childNodeUniqueName != null)
- {
- var mapAliasMapLang = mapCubeAliasLanguages[childNodeUniqueName];
- if (mapAliasMapLang == null)
- {
- mapAliasMapLang = new Object();
- mapCubeAliasLanguages[childNodeUniqueName] = mapAliasMapLang;
- }
- mapAliasMapLang[dimName] = checkedItems; // list of languages
- }
- }
- }
- }
- // check to see if the languge has been already used.
- // Unchecks the language.
- // Returns true or false
- G_App.checkLangIsUsed = function()
- {
- var childNodeUniqueName = getSelectedCubeUniqueName();
- if (childNodeUniqueName != null)
- {
- var mapAliasMapLang = mapCubeAliasLanguages[childNodeUniqueName];
- if (mapAliasMapLang != null)
- {
- var aliasNode = G_App.m_oListViewDimensions.F_GetSelectedListItem();
- if (aliasNode != null)
- {
- var aliasNameSelected = aliasNode.getAttribute("label");
-
- var checkedItems = G_App.m_oListViewCheckboxes.F_GetCheckedListItems();
- for (var aliasName in mapAliasMapLang)
- {
- if (aliasNameSelected != aliasName)
- {
- var checkedItemsPerAlias = mapAliasMapLang[aliasName];
- for (var n = 0; n < checkedItemsPerAlias.length; n++)
- {
- var langCode = checkedItemsPerAlias[n];
- // var langCode = lang.getAttribute( "value" );
- // var langName = lang.getAttribute( "label" );
-
- for (var k = 0; k < checkedItems.length; k++)
- {
- var item = checkedItems[k];
- var code = item.getAttribute( "value" );
- if (code == langCode)
- {
- // error message
- // like
- // The selected language has been used in table - "ActoCust[Week][Coach]"
- var message = localizedStrings["MSR_ESB_tooManyLanguages"].replace("{0}", aliasName);
- if (message){
- alert(message);
- // item.setAttribute("checked", "false"); //
- // G_App.m_oListViewCheckboxes.F_Draw();
- }
- return false;
- }
- }
- }
- }
- }
- }
- }
- }
- return true;
- }
- G_App.F_ListView_OnItemClick = function( v_oListView, v_nListItem, v_iMouseButton )
- {
- if (v_oListView == G_App.m_oListViewCubes)
- {
- G_App.RepopulateAliasTablesListView();
- }
-
- if (v_oListView == G_App.m_oListViewDimensions)
- {
- if (IMPORTWIZARD.dataSourceType != "TMR") // for TMR, don't care about this
- {
- // 2. Set language chechboxes from the map
- G_App.RepopulateLanguagesListView();
- }
- }
- }
- G_App.RepopulateAliasTablesListView = function()
- {
- var cubeNode = G_App.m_oListViewCubes.F_GetSelectedListItem();
- var childNodeUniqueName = getSelectedCubeUniqueName();
- if (IMPORTWIZARD.dataSourceType != "TMR")
- {
- var attribDimAsProp = cubeAttributeDimensionsAsProperties [childNodeUniqueName];
- if (attribDimAsProp == null)
- cubeAttributeDimensionsAsProperties [childNodeUniqueName] = getAttributeDimensionsAsProperties();
- else
- {
- if (attribDimAsProp == "true")
- {
- document.getElementById( "radProperties" ).checked = true;
- document.getElementById( "radSeparateDim" ).checked = false;
- }
- else if (attribDimAsProp == "false")
- {
- document.getElementById( "radProperties" ).checked = false;
- document.getElementById( "radSeparateDim" ).checked = true;
- }
- }
- }
- // see if we have already populated it
- var treeSnippet = mapCubeAliasTables[childNodeUniqueName];
- if (treeSnippet == null)
- {
- var selValue = cubeNode.getAttribute( "value" );
- for (var k = 0; k < cubeNodeList.length; k++)
- {
- var currentNode = cubeNodeList[k];
- var nodeValue = currentNode.getAttribute( "value" );
- if (selValue == nodeValue)
- {
- PopulateDimensionsListBox( currentNode );
- break;
- }
- }
- }
- else
- {
- metadataDimensionListResultsReceived( treeSnippet );
- }
- }
- // Sets the checked languages in the language list box accordingly with the selected alias table
- // The values are kept in the map mapAliasLanguages
- G_App.RepopulateLanguagesListView = function()
- {
- // Clear all check boxes
- G_App.m_oListViewCheckboxes.F_UncheckAll();
-
- // var cubeListNode = G_App.m_oListViewCubes.F_GetSelectedListItem();
- var childNodeUniqueName = getSelectedCubeUniqueName();
- if (childNodeUniqueName != null)
- {
- var dimNode = G_App.m_oListViewDimensions.F_GetSelectedListItem();
- if (dimNode != null)
- {
-
- var dimName = dimNode.getAttribute("label");
-
- G_App.m_oListViewCheckboxes.F_UncheckAll();
-
- //map { cubeuniqueName, map { alias table / list(of selected languages) } }
- var mapAliasLangs = mapCubeAliasLanguages[childNodeUniqueName];
- if (mapAliasLangs != null)
- {
-
- var listLang = mapAliasLangs[dimName]; // list of languages
- if (listLang != null)
- {
- var langItems = G_App.m_oListViewCheckboxes.F_GetListItems();
- for (var n = 0; n < langItems.length; n++)
- {
- var lang = langItems[n];
- var langCode = lang.getAttribute( "value" );
- var langName = lang.getAttribute( "label" );
-
- // see if it has been checked
- for ( var k = 0; k < listLang.length; k++ )
- {
- var code = listLang[k];
- if (langCode == code)
- {
- lang.setAttribute("checked", "true");
- break;
- }
- }
- }
-
- }
- }
- }
- }
- G_App.m_oListViewCheckboxes.F_Draw();
- }
- function OnUseV5DataServerBtnClicked( sourceUseV5DataServerChkBox )
- {
- G_App.m_oTreeViewCheckboxes.F_Detach();
- G_App.initializeTreeViewCheckBox();
- }
- function getSelectedCubeUniqueName()
- {
- var cubeNode = G_App.m_oListViewCubes.F_GetSelectedListItem();
-
- if (cubeNode == null)
- return null;
-
- var nodeValue = cubeNode.getAttribute( "value" );
- var childNodeValueObj = eval( "(" + nodeValue + ")" );
- return childNodeValueObj.uniqueName;
- }
-
- function OnSeparateDimBtnClicked( )
- {
- cubeAttributeDimensionsAsProperties [getSelectedCubeUniqueName()] = "false";
- }
- function OnPropertiesBtnClicked( )
- {
- cubeAttributeDimensionsAsProperties [getSelectedCubeUniqueName()] = "true";
- }
- function selectFirstItemInTreeControl()
- {
- var v_elSpanFirst = G_App.m_oTreeViewCheckboxes.F_GetFirstVisibleTreeItem();
- if ( v_elSpanFirst )
- {
- v_elSpanFirst.focus();
- }
- }
- G_App.F_ResManager_OnStringsLoaded = function( v_aFiles )
- {
- G_ResManager.F_LoadResources( [ WEB_CONTENT + "/mdsrv/res/EditVariablesResources.xml" ],this );
- };
- G_App.F_ResManager_OnResourcesLoaded = function( v_aFiles )
- {
- //LoadStrings is async call therefore load all the controls after G_ResManager.F_LoadStrings G_ResManager.F_LoadResources are completed. This change was done because the Treeview tries to access HAL string before it is loaded.
- this.initControls();
- }
- function retrieveImportSpec()
- {
- var getImportSpecRequestURL = GATEWAY_URL + "/metadataUIService";
-
- D_Progress.F_DisableCancel();
- D_Progress.F_Show( null, localizedStrings["MSR_SAP_Loading"] );
-
-
- var getImportSpecRequestPostParams = {};
- getImportSpecRequestPostParams["pid"] = "importWizard_ImportSpec_pid";
- getImportSpecRequestPostParams["packageLocation"] = IMPORTWIZARD.packageLocation;
- getImportSpecRequestPostParams["packageName"] = IMPORTWIZARD.packageName;
- getImportSpecRequestPostParams["error_pid"] = asyncErrorPagePid;
-
- IMPORTWIZARD.onResumeFromNonRecoverableError = function(){
- hideProgressIfShowing();
- }
- urlRequestInvoker.MakeAsyncRequestInIFrame( getImportSpecRequestURL, getImportSpecRequestPostParams );
- }
- function GenerateJSONString( obj )
- {
- var strObjJSON = "";
-
- for (var i in obj)
- {
- strObjJSON += "\t\t\"" + i + "\": ";
- strObjJSON += "\"" + obj[i] + "\",\n";
- }
-
- // The last comma must be removed, in order to have a syntactically correct JSON string.
- // Firefox doesn't care about this, but IE fails to work properly if this isn't done.
- var lastCommaIndex = strObjJSON.lastIndexOf( ',' );
-
- strObjJSON = "\t{\n" + strObjJSON.substr(0, lastCommaIndex ) + "\n\t}\n";
-
- // alert( "GenerateJSONString\n\n" + strObjJSON ); // Debugging
- return strObjJSON;
- }
- G_App.PopulateTreeView_RootNode = function( aDoc, treeViewElem )
- {
- var rootNodeElem = treeViewElem.appendChild( aDoc.createElement( "treeNode" ) );
- var nodeValueObj = {};
- nodeValueObj["type"] = kDatabaseTypeStr;
- nodeValueObj["uniqueName"] = kDatabaseTypeStr;
-
- var nodeIcon = GetIconFilePath( kDatabaseTypeStr );
- var nodeValue = GenerateJSONString( nodeValueObj );
- rootNodeElem.setAttribute( "value", nodeValue );
- rootNodeElem.setAttribute( "label", IMPORTWIZARD.dataSourceName);
- rootNodeElem.setAttribute( "smallIcon", nodeIcon );
- rootNodeElem.setAttribute( "expandedSmallIcon", nodeIcon );
- rootNodeElem.setAttribute( "expandable", "true" );
- rootNodeElem.setAttribute( "staticCheckbox", "true" );
- rootNodeElem.setAttribute( "role", "treeItem" );
- rootNodeElem.setAttribute( "tooltip", kDatabaseTypeStr );
- };
- var bIsLanguagesListPopulated = false;
- function PopulateLanguagesListBox()
- {
- var getLanguagesRequestURL = GATEWAY_URL + "/metadataUIService";
- D_Progress.F_DisableCancel();
- D_Progress.F_Show( null, localizedStrings["MSR_SAP_Loading"]);
-
- var getLanguagesRequestPostParams = {};
- getLanguagesRequestPostParams["pid"] = "OLAPImportWizard_Languages_pid"
- getLanguagesRequestPostParams["datasource"] = IMPORTWIZARD.dataSourceName;
- getLanguagesRequestPostParams["dataSourceCredentials"] = IMPORTWIZARD.credentials;
- getLanguagesRequestPostParams["error_pid"] = asyncErrorPagePid;
- urlRequestInvoker.MakeAsyncRequestInIFrame( getLanguagesRequestURL, getLanguagesRequestPostParams );
- }
- G_App.PopulateLanguagesListView = function(languagesList)
- {
- var designLocaleList = document.getElementById( "designLanguage" );
- var selIndex = 0;
- for (var i = 0; i < languagesList.length; i++)
- {
- var newListItemNode = this.m_oListViewCheckboxes.F_AppendNewListItem();
- newListItemNode.setAttribute( "value", languagesList[i].localeId );
- newListItemNode.setAttribute( "label", languagesList[i].localeName );
- newListItemNode.setAttribute( "staticCheckbox", "false" );
- newListItemNode.setAttribute( "checked", "false" );
- if (languagesList[i].localeId == IMPORTWIZARD.productLocale)
- selIndex = i;
- designLocaleList.options[i]=new Option(languagesList[i].localeName, languagesList[i].localeId);
- }
- designLocaleList.selectedIndex = selIndex;
- bIsLanguagesListPopulated = true;
- hideProgressIfShowing();
- };
- function providerLangResultsReceived( providerLanguages )
- {
- G_App.PopulateLanguagesListView( providerLanguages.lang );
- G_App.m_oListViewCheckboxes.F_Draw();
-
- //D_Progress.F_Hide();
- urlRequestInvoker.RequestFinished();
-
- // expand the root node
- //alert( "In providerLangResultsReceived( providerLanguages ).\n" );
- setTimeout( function(){
- var treeRootViewNode = G_App.m_oTreeViewCheckboxes.F_GetTreeViewNode();
- var node = treeRootViewNode.selectSingleNode( "treeNode" );
- G_App.expandNode(node);
- }, 700 );
-
-
- // // For accessibility Set the focus on the first item of the check box
- // var v_nFirstListItem = G_App.m_oListViewCheckboxes.F_GetFirstSelectableItem();
- // if ( v_nFirstListItem )
- // {
- // var vaFocus = document.getElementById( v_nFirstListItem.getAttribute( "htmlId" ) );
- // if( vaFocus )
- // vaFocus.focus();
- // }
- }
- function importSpecReceivedReceived( treeSnippet )
- {
- D_Progress.F_Hide();
- urlRequestInvoker.RequestFinished();
- G_App.m_oTreeViewCheckboxes.F_StartAsyncLoad();
- var aDoc = G_App.m_treeViewNodesDoc;
- var treeViewElem = G_App.m_oTreeViewCheckboxes.F_GetTreeViewNode();
- IMPORTWIZARD.dataSourceName = treeSnippet.node.Name; // In edit scenario we didn't know the ds name, so we populate it now
- PopulateTreeView( treeSnippet.node, aDoc, treeViewElem );
- G_App.m_oTreeViewCheckboxes.F_EndAsyncLoad( true /* v_bSucceeded */);
-
- selectFirstItemInTreeControl();
- }
- function SaveModifiedSettings()
- {
- var saveModifiedSettingsURL = GATEWAY_URL + "/metadataUIService";
- D_Progress.F_DisableCancel();
- D_Progress.F_Show( null, localizedStrings["MSR_SAP_Saving"]);
- var saveModifiedSettingsParams = {};
- saveModifiedSettingsParams["pid"] = "saveModifiedPackageSettings_pid";
- saveModifiedSettingsParams["searchPath"] = IMPORTWIZARD.packageLocation + "/package[@name=" + EncloseInQuotes( IMPORTWIZARD.packageName ) + "]/model";
- saveModifiedSettingsParams["property"] = "http://developer.cognos.com/ceba/constants/queryOptionEnum#mode";
-
- var ms_useV5DataServerCheckBox = document.getElementById( "ms_useV5DataServer" );
-
- if (ms_useV5DataServerCheckBox.checked)
- {
- saveModifiedSettingsParams["value"] = "http://developer.cognos.com/ceba/constants/queryModeEnum#dynamic"; // XQE
- }
- else
- {
- saveModifiedSettingsParams["value"] = "http://developer.cognos.com/ceba/constants/queryModeEnum#compatible"; // Legacy query stack
- }
-
- saveModifiedSettingsParams["error_pid"] = asyncErrorPagePid;
- urlRequestInvoker.MakeAsyncRequestInIFrame( saveModifiedSettingsURL, saveModifiedSettingsParams );
- }
- function OnSaveModifiedPackageSettingsRequestCompleted()
- {
- D_Progress.F_Hide();
- urlRequestInvoker.RequestFinished();
- window.location.replace( IMPORTWIZARD.backURL );
- }
- //
- // Populates the tree view based on data obtained from the server side
- // (through a JSP async call).
- // This data could be coming from either:
- // - the browse JSP (when expanding tree nodes for the first time)
- // - the import spec JSP (when editing an existing package)
- //
- function PopulateTreeView( treeViewNodeData, aDoc, treeViewElem )
- {
- var nodeLabel = treeViewNodeData.Name;
- var nodeType = treeViewNodeData.Type;
- var bIsNodeSelected = treeViewNodeData.Selected != null && treeViewNodeData.Selected != "false";
- var nodeValueObj = {};
- nodeValueObj["type"] = nodeType;
- nodeValueObj["uniqueName"] = (treeViewNodeData.uniqueName != null) ? treeViewNodeData.uniqueName : treeViewNodeData.Name;
- var nodeValue = GenerateJSONString( nodeValueObj );
- var nodeIcon = GetIconFilePath( nodeType );
- var nodeExpandedIcon = GetIconFilePath( nodeType );
-
- var bExpandable = (nodeType != kCubeTypeStr);
- var bHideCheckBox = (nodeType == kDimensionGroupTypeStr || nodeType == kDimensionTypeStr
- || nodeType == kMeasuresGroupTypeStr || nodeType == kMeasureTypeStr);
- var bStaticCheckBox = (nodeType != kCubeTypeStr);
- var bChecked = !bHideCheckBox && bIsNodeSelected;
- var nodeElem = treeViewElem.appendChild( aDoc.createElement( "treeNode" ) );
- nodeElem.setAttribute( "value", nodeValue );
- nodeElem.setAttribute( "label", nodeLabel );
- nodeElem.setAttribute( "smallIcon", nodeIcon );
- nodeElem.setAttribute( "expandedSmallIcon", nodeExpandedIcon );
- nodeElem.setAttribute( "tooltip", nodeType );
- nodeElem.setAttribute( "expandable", bExpandable ? "true" : "false" );
-
- nodeElem.setAttribute( "hideCheckbox", bHideCheckBox ? "true" : "false" );
- nodeElem.setAttribute( "staticCheckbox", bStaticCheckBox ? "true" : "false" );
- nodeElem.setAttribute( "checked", bChecked ? "true" : "false" );
-
-
- // testing code
- if (IMPORTWIZARD.enableTest)
- {
- if (nodeValueObj["uniqueName"] == IMPORTWIZARD.treeLevels[g_expandTreeLevel])
- {
- // remember treeViewNodeData
- g_viewNodeToExpand = nodeElem;
- }
-
- if (nodeValueObj["type"] == kCubeTypeStr)
- {
- if (nodeValueObj["uniqueName"] == IMPORTWIZARD.cubeToSelect)
- {
- nodeElem.setAttribute( "checked","true" );
- }
- }
- }
- // testing code end
-
-
-
- if (treeViewNodeData.children != null)
- {
- for (var i = 0; i < treeViewNodeData.children.length; i++)
- {
- PopulateTreeView( treeViewNodeData.children[i], aDoc, nodeElem );
- }
- }
- }
-
- /**
- * Used in edit mode, to pass to the browse JSP, the selected nodes recursively.
- */
- function ExtractSelectedTreeNodes( v_nTreeNode, nodePathEntry )
- {
- if (v_nTreeNode.childNodes != null && v_nTreeNode.childNodes.length > 0)
- {
- nodePathEntry.children = [];
-
- for (var i = 0; i < v_nTreeNode.childNodes.length; i++)
- {
- var childNodeName = v_nTreeNode.childNodes[i].getAttribute( "label" );
- var childNodeValue = v_nTreeNode.childNodes[i].getAttribute( "value" );
-
- var childNodeValueObj = eval( "(" + childNodeValue + ")" );
- var childNodeType = childNodeValueObj.type;
- var childNodeUniqueName = childNodeValueObj.uniqueName;
-
- nodePathEntry.children[i] = {};
- nodePathEntry.children[i]["uniqueName"] = childNodeUniqueName;
- nodePathEntry.children[i].Selected = "true";
- nodePathEntry.children[i].Type = childNodeType;
- nodePathEntry.children[i].Value = "false";
- nodePathEntry.children[i].Name = childNodeName;
-
- ExtractSelectedTreeNodes( v_nTreeNode.childNodes[i], nodePathEntry.children[i] );
- }
- }
- }
- var g_treeNodeBeingPopulated = null;
- var g_expandTreeLevel = 0; // used only for testing (does not expect collapsing the tree nodes)
- var g_viewNodeToExpand = null; // node to expand based on the provided drill down path
- var g_dimNum = 0; // currently selected dimension number (zero based) in test mode
- //var g_aliasNum = 0; // currently selected alias table number (zero based) in test mode
- G_App.F_TreeView_OnPopulateChildren = function( v_oTreeView, v_nTreeNode )
- {
- //
- // Disable the Next & Finish buttons temporarily, to prevent 2 async calls from colliding in the same IFrame.
- //
- var nextButton = document.getElementById( "nextButton" );
- EnableButton( nextButton, false /* bEnable */ );
- var finishButton = document.getElementById( "finishButton" );
- IMPORTWIZARD.isFinishButtonEnabled = IsButtonEnabled( finishButton );
- EnableButton( finishButton, false /* bEnable */ );
-
- var currentNode = v_nTreeNode;
- var nodePath = "";
-
- // The nodePath is being build back-wards
- do
- {
- var nodeName = currentNode.getAttribute( "label" );
- var nodeValue = currentNode.getAttribute( "value" );
-
- var nodeValueObj = eval( "(" + nodeValue + ")" );
- var nodeType = nodeValueObj.type;
- var nodeUniqueName = nodeValueObj.uniqueName;
-
- // if the node path is empty then we are at the beginning
- var bIsSelectedNode = (nodePath == "");
-
- var nodePathEntry = {};
- nodePathEntry.Name = nodeName;
- nodePathEntry.Type = nodeType;
- nodePathEntry.Value = "false";
-
- if (nodeType == kDatabaseTypeStr)
- {
- nodePathEntry.dbType = IMPORTWIZARD.dataSourceType;
- nodePathEntry.isSystem = "false";
- }
- else
- {
- nodePathEntry.uniqueName = nodeUniqueName;
- }
-
- if (bIsSelectedNode)
- {
- nodePathEntry.Selected = "true";
- nodePathEntry.expansion = "true";
- ExtractSelectedTreeNodes( v_nTreeNode, nodePathEntry );
- }
-
- strNodePathEntry = JSON.stringify( nodePathEntry, null, "\t" );
-
- var nodePathEntryPostfix = (currentNode == v_nTreeNode) ? "\n" : ",\n";
- nodePath = strNodePathEntry + nodePathEntryPostfix + nodePath;
- currentNode = currentNode.parentNode;
- }
- while (currentNode != null && currentNode.tagName == "treeNode");
- nodePath = "{\"node\":[\n" + nodePath + "]}";
- g_treeNodeBeingPopulated = v_nTreeNode;
-
- var browseTreeRequestURL = GATEWAY_URL + "/metadataUIService";
- var browseTreeRequestPostParams = {};
- if (IMPORTWIZARD.enableTestNoDBConnection)
- browseTreeRequestPostParams["pid"] = "importWizard_GetTreeNodes_TEST_pid";
- else
- browseTreeRequestPostParams["pid"] = "importWizard_GetTreeNodes_pid";
- browseTreeRequestPostParams["connectionName"] = IMPORTWIZARD.dataSourceName;
- browseTreeRequestPostParams["nodePath"] = nodePath;
- browseTreeRequestPostParams["dataSourceCredentials"] = IMPORTWIZARD.credentials;
- browseTreeRequestPostParams["error_pid"] = asyncErrorPagePid;
-
- var useV5DataServerCheckBox = document.getElementById( "useV5DataServer" );
- browseTreeRequestPostParams["useV5DataServer"] = useV5DataServerCheckBox.checked ? "true" : "false";
-
- IMPORTWIZARD.onResumeFromRecoveredErrorHandler = function()
- {
- urlRequestInvoker.RequestFinished();
-
- G_App.m_oTreeViewCheckboxes.F_EndAsyncLoad( false /* v_bSucceeded */ );
- g_treeNodeBeingPopulated = null;
-
- if (this.retry)
- {
- this.retry = false;
- G_App.m_oTreeViewCheckboxes.F_ExpandNode(v_nTreeNode);
- }
- };
-
- IMPORTWIZARD.onResumeFromNonRecoverableError = function()
- {
- G_App.m_oTreeViewCheckboxes.F_EndAsyncLoad( false /* v_bSucceeded */ );
- g_treeNodeBeingPopulated = null;
- urlRequestInvoker.RequestFinished();
- }
-
- urlRequestInvoker.MakeAsyncRequestInIFrame( browseTreeRequestURL, browseTreeRequestPostParams );
-
- return true;
- };
- G_App.F_HAL_OnUnLoad = function()
- {
- this.m_oTreeViewCheckboxes.F_Detach();
- this.m_oListViewCheckboxes.F_Detach();
-
- if (this.m_oPropertySheet != null)
- {
- this.m_oPropertySheet.F_Detach();
- }
- };
- G_App.F_ApplySkin = function( v_sSkin )
- {
- // Build the path to the appropriate skin css file
- var v_aSkin = v_sSkin.split( "|" );
- var v_sSkinName = v_aSkin[0];
- var v_sSkinType = v_aSkin[1];
- var v_sSkinPath = WEB_CONTENT + "/skins/" + v_sSkinName + "/hal/hal_portal_skin.css";
- var v_sSkinPath2 = WEB_CONTENT + "/skins/" + v_sSkinName + "/hal/hal_skin.css";
-
- // Remove existing link tag to skin css
- var v_nExistingCSSNode = document.getElementById( "idHALSkinCSS" );
- if ( v_nExistingCSSNode )
- {
- v_nExistingCSSNode.parentNode.removeChild( v_nExistingCSSNode );
- }
-
- // Create and append new link tag to skin css
- var v_elHead = document.getElementsByTagName( "head" )[0];
- var v_elLinkCSS = document.createElement( "link" );
- v_elLinkCSS.id = "idHALSkinCSS";
- v_elLinkCSS.type = "text/css";
- v_elLinkCSS.rel = "stylesheet";
- v_elLinkCSS.href = v_sSkinPath;
- v_elHead.appendChild( v_elLinkCSS );
-
- var v_elLinkCSS2 = document.createElement( "link" );
- v_elLinkCSS2.id = "idHALSkinCSS";
- v_elLinkCSS2.type = "text/css";
- v_elLinkCSS2.rel = "stylesheet";
- v_elLinkCSS2.href = v_sSkinPath2;
- v_elHead.appendChild( v_elLinkCSS2 );
-
- document.body.style.backgroundColor = ( v_sSkinType == "portal" ) ? "#FFFFFF" : "";
-
- // Set skin value in cookie
- var v_dateExpires = new Date();
- v_dateExpires.setUTCFullYear( v_dateExpires.getUTCFullYear() + 1 );
- U_CookieJar.F_SetCookie( "skin", v_sSkin, v_dateExpires );
- };
- G_App.F_Deck_OnBeforeCardVisible = function( v_oDeck, v_divNewCard, v_iOldCardIndex, v_iNewCardIndex )
- {
- };
- G_App.F_Deck_OnAfterCardVisible = function( v_oDeck, v_divNewCard, v_iOldCardIndex, v_iNewCardIndex )
- {
- if (v_oDeck == this.m_oDeck)
- {
- var pageTitles =
- [
- localizedStrings["MSR_SAP_selectObjectsTitle"],
- localizedStrings["MSR_SAP_selectLanguagesTitle"],
- localizedStrings["MSR_SAP_generateDimensionsTitle"]
- ];
-
- // var pageTitlePostfix = (IMPORTWIZARD.isEdit) ? " <i>[Edit Package Mode]</i>" : "";
- document.getElementById( "dialogHeaderTitle" ).innerHTML = pageTitles[v_iNewCardIndex];
-
- UpdateButtonsEnableStatus( v_iNewCardIndex );
- if (v_iNewCardIndex == 1 /* languages card index */ )
- {
- if (bIsLanguagesListPopulated == false)
- {
- PopulateLanguagesListBox();
- }
- if (IMPORTWIZARD.dataSourceType != "TMR")
- {
- document.getElementById( "radSeparateDim" ).checked = "false";
- document.getElementById( "radProperties" ).checked = "true";
- }
- // populate the list box with the dimensions (id="divListViewDimensions") from the selected cube
- // Get the selected tree node
- var treeNodesList = G_App.m_oTreeViewCheckboxes.F_GetCheckedNodes();
- var cubeNamesToDelete = [];
- for (var cubeName in mapCubeAliasTables)
- {
- // search the new list to see if the cube has been deleted
- var found = false;
- for (var n = 0; n < treeNodesList.length; n++)
- {
- var treeNode = treeNodesList.item( n );
- var nodeValue = treeNode.getAttribute( "value" );
- var nodeValueObj = eval( "(" + nodeValue + ")" );
- var nodeUniqueName = nodeValueObj.uniqueName;
- if (nodeUniqueName == cubeName)
- {
- found = true;
- break;
- }
- }
- if (found == false)
- {
- cubeNamesToDelete.push(cubeName);
- }
- }
- for (var k = 0; k < cubeNamesToDelete.length; k++)
- {
- var cube = cubeNamesToDelete[k];
- delete mapCubeAliasTables[cube];
-
- if (mapCubeAliasLanguages[cube] != null)
- {
- delete mapCubeAliasLanguages[cube];
- }
- if (cubeAttributeDimensionsAsProperties[cube] != null)
- {
- delete cubeAttributeDimensionsAsProperties[cube];
- }
- }
-
- PopulateCubes( treeNodesList );
- }
- else if(v_iNewCardIndex == 2 )
- {
- //For Accessibility put the focus on the first control of the page
- var focusElement = document.getElementById( "radioShortName");
- if( focusElement )
- {
- focusElement.focus();
- }
- }
- }
- };
- G_App.F_Next = function()
- {
- var msg = IMPORTWIZARD.checkNext();
- if (msg){
- alert(msg);
- }
- else{
- var currentCard = G_App.m_oDeck.F_GetIndex();
-
- switch (currentCard)
- {
- case 0:
- {
- if(mapCubeAliasTables == null)
- mapCubeAliasTables = new Object();
- if(mapCubeAliasLanguages == null)
- mapCubeAliasLanguages = new Object();
- if(cubeAttributeDimensionsAsProperties == null)
- cubeAttributeDimensionsAsProperties = new Object();
-
- break;
- }
- case 1:
- break;
- case 2:
- break;
- case 3:
- break;
- }
-
- this.m_oDeck.F_Next();
- }
- };
- function PopulateCubes( treeNodesList )
- {
- //
- // Disable the Next & Finish buttons temporarily, to prevent 2 async calls from colliding in the same IFrame.
- //
- cubeNodeList = treeNodesList; // keeps the tree nodes of the selected cubes. We need the tree nodes to be able to compute the path to the cube browsing the parents.
- G_App.m_oListViewCubes.F_Clear();
-
-
- var nextButton = document.getElementById( "nextButton" );
- EnableButton( nextButton, false );
- var finishButton = document.getElementById( "finishButton" );
- EnableButton( finishButton, true );
- if (D_Progress.F_IsActiveDialog() == false)
- {
- D_Progress.F_DisableCancel();
- D_Progress.F_Show( null, localizedStrings["MSR_SAP_Loading"]);
- }
- for (var i = 0; i < treeNodesList.length; i++)
- {
- var cube = treeNodesList[i];
- var nodeName = cube.getAttribute( "label" );
- var nodeValue = cube.getAttribute( "value" );
- var childNodeValueObj = eval( "(" + nodeValue + ")" );
- var childNodeType = childNodeValueObj.type;
- var childNodeUniqueName = childNodeValueObj.uniqueName;
-
- var newListItemNode = G_App.m_oListViewCubes.F_AppendNewListItem();
- newListItemNode.setAttribute( "value", nodeValue );
- newListItemNode.setAttribute( "label", nodeName );
- }
- G_App.selectFirstListBoxItem(G_App.m_oListViewCubes);
- G_App.m_oListViewCubes.F_Draw();
- // populate dimensions for the first cube in the list
- var firstCube = treeNodesList[0];
- PopulateDimensionsListBox( firstCube );
- hideProgressIfShowing();
- }
- function PopulateDimensionsListBox( v_nTreeNode )
- {
- //
- // Disable the Next & Finish buttons temporarily, to prevent 2 async calls from colliding in the same IFrame.
- //
- var nextButton = document.getElementById( "nextButton" );
- EnableButton( nextButton, false ); // bEnable
- var finishButton = document.getElementById( "finishButton" );
- IMPORTWIZARD.isFinishButtonEnabled = IsButtonEnabled( finishButton );
- EnableButton( finishButton, false );// bEnable
- if (D_Progress.F_IsActiveDialog() == false)
- {
- D_Progress.F_DisableCancel();
- D_Progress.F_Show( null, localizedStrings["MSR_SAP_Loading"]);
- }
-
- var currentNode = v_nTreeNode;
- var nodePath = "";
-
- // The nodePath is being build back-wards
- do
- {
- var nodeName = currentNode.getAttribute( "label" );
- var nodeValue = currentNode.getAttribute( "value" );
-
- var nodeValueObj = eval( "(" + nodeValue + ")" );
- var nodeType = nodeValueObj.type;
- var nodeUniqueName = nodeValueObj.uniqueName;
-
- // if the node path is empty then we are at the beginning
- var bIsSelectedNode = (nodePath == "");
-
- var nodePathEntry = {};
- nodePathEntry.Name = nodeName;
- nodePathEntry.Type = nodeType;
- nodePathEntry.Value = "false";
-
- if (nodeType == kDatabaseTypeStr)
- {
- nodePathEntry.dbType = IMPORTWIZARD.dataSourceType;
- nodePathEntry.isSystem = "false";
- }
- else
- {
- nodePathEntry.uniqueName = nodeUniqueName;
- }
-
- if (bIsSelectedNode)
- {
- nodePathEntry.Selected = "true";
- nodePathEntry.expansion = "true";
- ExtractSelectedTreeNodes( v_nTreeNode, nodePathEntry );
- }
-
- strNodePathEntry = JSON.stringify( nodePathEntry, null, "\t" );
-
- var nodePathEntryPostfix = (currentNode == v_nTreeNode) ? "\n" : ",\n";
- nodePath = strNodePathEntry + nodePathEntryPostfix + nodePath;
- currentNode = currentNode.parentNode;
- }
- while (currentNode != null && currentNode.tagName == "treeNode");
- nodePath = "{\"node\":[\n" + nodePath + "]}";
- g_treeNodeBeingPopulated = v_nTreeNode;
-
- var browseTreeRequestURL = GATEWAY_URL + "/metadataUIService";
- var browseTreeRequestPostParams = {};
- if (IMPORTWIZARD.enableTestNoDBConnection)
- browseTreeRequestPostParams["pid"] = "OLAPImportWizard_GetDimensionsList_TEST_pid";
- else
- browseTreeRequestPostParams["pid"] = "OLAPImportWizard_GetDimensionsList_pid";
- browseTreeRequestPostParams["connectionName"] = IMPORTWIZARD.dataSourceName;
- browseTreeRequestPostParams["nodePath"] = nodePath;
- browseTreeRequestPostParams["dataSourceCredentials"] = IMPORTWIZARD.credentials;
- browseTreeRequestPostParams["error_pid"] = asyncErrorPagePid;
-
- var useV5DataServerCheckBox = document.getElementById( "useV5DataServer" );
- browseTreeRequestPostParams["useV5DataServer"] = useV5DataServerCheckBox.checked ? "true" : "false";
-
- IMPORTWIZARD.onResumeFromRecoveredErrorHandler = function()
- {
- urlRequestInvoker.RequestFinished();
-
- G_App.m_oTreeViewCheckboxes.F_EndAsyncLoad( false );// v_bSucceeded
- g_treeNodeBeingPopulated = null;
-
- if (this.retry)
- {
- this.retry = false;
- G_App.m_oTreeViewCheckboxes.F_ExpandNode(v_nTreeNode);
- }
- };
-
- IMPORTWIZARD.onResumeFromNonRecoverableError = function()
- {
- G_App.m_oTreeViewCheckboxes.F_EndAsyncLoad( false );// v_bSucceeded
- g_treeNodeBeingPopulated = null;
- urlRequestInvoker.RequestFinished();
- }
-
- urlRequestInvoker.MakeAsyncRequestInIFrame2( browseTreeRequestURL, browseTreeRequestPostParams );
-
- }
- G_App.F_Back = function()
- {
- this.m_oDeck.F_Back();
- };
- //
- // When a node is checked/unchecked, update the check status of the parent nodes.
- //
- G_App.F_TreeView_OnNodeCheck = function( v_oTreeView, v_nTreeNode )
- {
- };
- G_App.F_TreeView_OnNodeClick = function( v_oTreeView, v_nTreeNode, v_iMouseButton )
- {
- };
- G_App.F_TreeView_OnNodeDblClick = function( v_oTreeView, v_nTreeNode )
- {
- };
- function IsButtonEnabled( button )
- {
- return (button.className == "commandButton");
- }
- // Enables the button (if bEnable is true), or disables it (if bEnable is false).
- // It preserves and restores the OnClick and OnDblClick events properly.
- function EnableButton( button, bEnable )
- {
- var prevEnabledState = IsButtonEnabled( button );
-
- if (bEnable == true /*&& button.className == "commandButtonInactiveII"*/)
- {
- button.className = "commandButton";
- button.onmouseover = function( e ) { this.className = "commandButtonOver"; };
- button.onmouseout = function( e ) { this.className = "commandButton"; };
- button.onmousedown = function( e ) { this.className = "commandButton"; };
- button.onkeypress = handle_onkeydown;
- button.children[0].tabIndex = 0;
- if (prevEnabledState == false)
- {
- if (button.onclick_enabled != null)
- {
- button.onclick = button.onclick_enabled;
- }
-
- if (button.ondblclick_enabled != null)
- {
- button.ondblclick = button.ondblclick_enabled;
- }
- }
- }
- else if (bEnable == false)
- {
- button.className = "commandButtonInactiveII";
- button.onmouseover = null;
- button.onmouseout = null;
- button.onmousedown = null;
- button.onkeypress = null;
- button.children[0].tabIndex = -1;
-
-
- // preserve the previous event handlers
- if (prevEnabledState == true)
- {
- button.onclick_enabled = button.onclick;
- button.ondblclick_enabled = button.ondblclick;
- }
-
- button.onclick = "";
- button.ondblclick = "";
- }
- }
- function UpdateButtonsEnableStatus( cardIndex )
- {
- var prevButton = document.getElementById( "prevButton" );
- var bEnablePrevButton = (cardIndex != 0);
-
- if (bEnablePrevButton)
- {
- prevButton.onclick = function( e ) { G_App.F_Back(); };
- prevButton.ondblclick = function( e ) { G_App.F_Back(); };
- }
-
- EnableButton( prevButton, bEnablePrevButton );
-
- var nextButton = document.getElementById( "nextButton" );
- var bEnableNextButton = (cardIndex != G_App.m_oDeck.F_GetNumberOfCards() - 1);
-
- if (bEnableNextButton)
- {
- nextButton.onclick = function( e ) { G_App.F_Next(); };
- nextButton.ondblclick = function( e ) { G_App.F_Next(); };
- }
-
- EnableButton( nextButton, bEnableNextButton );
-
- var finishButton = document.getElementById( "finishButton" );
- var bEnableFinishButton = (cardIndex == G_App.m_oDeck.F_GetNumberOfCards() - 1);
-
- if (bEnableFinishButton)
- {
- finishButton.onclick = function( e ) { WizardDone(); };
- finishButton.ondblclick = function( e ) { WizardDone(); };
- EnableButton( finishButton, bEnableFinishButton );
- }
- }
- function UpdateImportSpecLang()
- {
-
- // for each cube from mapCubeAliasTables
- for (var cubeName in mapCubeAliasTables)
- {
- var treeSnippet = mapCubeAliasTables[cubeName];
- var mapAliasLangs = mapCubeAliasLanguages[cubeName]; //map { cubeuniqueName, map { alias table / list(of selected languages) } }
-
- if (mapAliasLangs != null)
- {
- // TMR doesn't support aliases, so just add aliasTableLang to the importSpec if the user has selected a language
- // because the code in FM is looking for aliasTableLang to add locales to the package
- if (IMPORTWIZARD.dataSourceType == "TMR")
- {
- var checkedItemsPerAlias = mapAliasLangs["TMR_Alias"];
- if (checkedItemsPerAlias != null)
- {
- for (var n = 0; n < checkedItemsPerAlias.length; n++)
- {
- var langCode = checkedItemsPerAlias[n];
-
- var nodeEntry = {};
- nodeEntry.Name = aliasName;
- nodeEntry.Type = "aliasTableLang";
- nodeEntry.uniqueName = langCode;
-
- // add the new entry to the dimension
- treeSnippet.node.children.push(nodeEntry);
- }
- }
- }
- for (var i = 0; i < treeSnippet.node.children.length; i++)
- {
- treeViewNodeData = treeSnippet.node.children[i]
-
- var aliasName = treeViewNodeData.Name;
- var nodeType = treeViewNodeData.Type;
-
- if (nodeType == "aliasTable")
- {
- var checkedItemsPerAlias = mapAliasLangs[aliasName];
- if (checkedItemsPerAlias != null)
- {
- for (var n = 0; n < checkedItemsPerAlias.length; n++)
- {
- var langCode = checkedItemsPerAlias[n];
- // var langCode = lang.getAttribute( "value" );
- // var langName = lang.getAttribute( "label" );
-
- var nodeEntry = {};
- nodeEntry.Name = aliasName;
- nodeEntry.Type = "aliasTableLang";
- nodeEntry.uniqueName = langCode;
-
- // add the new entry to the dimension
- treeSnippet.node.children.push(nodeEntry);
- }
- }
- }
- }
- }
-
- }
- }
- // returns "true" (Properties of the dimension they are associated with ) or "false" (Separate dimensions )
- function getAttributeDimensionsAsProperties()
- {
- var v_separateDim;
- if ( document.getElementById( "radSeparateDim" ).checked )
- {
- v_separateDim = "false";
- }
- else if ( document.getElementById( "radProperties" ).checked )
- {
- v_separateDim = "true";
- }
-
- return v_separateDim;
- }
- function associateCubesWithAliases(treeNodesPaths)
- {
- // browse to the leaf (cube)
- var curentNode = treeNodesPaths[0].children; // get catalogs
- if (curentNode != null)
- {
- for (var k = 0; k < curentNode.length; k++)
- {
- if (curentNode[k].children != null)
- {
- associateCubesWithAliases(curentNode[k].children);
- }
- else
- {
- // here curentNode is a cube
- var cube = mapCubeAliasTables[curentNode.Name];
- curentNode.children = cube.node.children;
- }
- }
- }
- else
- {
- // here treeNodesPaths are cubes
- for (var j = 0; j < treeNodesPaths.length; j++)
- {
- var cube = mapCubeAliasTables[treeNodesPaths[j].Name];
- if (cube != null)
- {
- treeNodesPaths[j].children = cube.node.children;
- }
-
- var attrib = cubeAttributeDimensionsAsProperties [treeNodesPaths[j].Name];
- if (attrib == null)
- attrib = "true"; // the default value is "true"
- treeNodesPaths[j].attributeDimensionsAsProperties = attrib;
- }
- }
- }
- function WizardDone()
- {
- UpdateImportSpecLang();
-
- // Build the importSpec object
- var treeNodesList = G_App.m_oTreeViewCheckboxes.F_GetCheckedNodes();
-
- if (treeNodesList.length == 0)
- {
- alert( "No objects have been selected for the import.\n\nImport action cancelled.\n" );
- return;
- }
-
- var treeNodesPaths = [];
- for (var n = 0; n < treeNodesList.length; n++)
- {
- var treeNode = treeNodesList.item( n );
- treeNodesPaths[n] = GetTreeNodePath( treeNode );
- }
-
- ConsolidateTree( treeNodesPaths, 0 /* referenceNodeIndex */ );
-
- if (treeNodesPaths.length != 1)
- {
- alert( "ASSERT FAILED: The number tree objects must be 1!\n\nIt is currently: " + treeNodesPaths.length );
- }
- associateCubesWithAliases(treeNodesPaths);
-
- var importSpec = {};
- importSpec["node"] = [];
- importSpec["node"][0] = treeNodesPaths[0];
- var strImportSpec = JSON.stringify( importSpec, null, "\t" );
-
-
- var useV5DataServerCheckBox = document.getElementById( "useV5DataServer" );
- var designLocaleCombo = document.getElementById("designLanguage");
- var parameters = {};
- parameters["params"] = {};
- parameters["params"]["UseV5DataServer"] = useV5DataServerCheckBox.checked ? "true" : "false";
- parameters["params"].designLocale = designLocaleCombo.options[designLocaleCombo.selectedIndex].value;
-
- var strParameters = JSON.stringify( parameters, null, "\t" );
- var pkgInfo = {};
- pkgInfo["pkgInfo"]={};
- pkgInfo["pkgInfo"]["Name"]=IMPORTWIZARD.packageName;
- pkgInfo["pkgInfo"]["Description"]=IMPORTWIZARD.packageDescription;
- pkgInfo["pkgInfo"]["ScreenTip"]=IMPORTWIZARD.packageScreentip;
- pkgInfo["pkgInfo"]["Location"]=IMPORTWIZARD.packageLocation;
-
- var strPkgInfo = JSON.stringify( pkgInfo, null, "\t" );
-
- IMPORTWIZARD.onResumeFromNonRecoverableError = function(){
- hideProgressIfShowing();
- }
- var importHelper = new ImportHelper(strImportSpec, strParameters, strPkgInfo);
- importHelper.runImport();
- D_Progress.F_DisableCancel();
- D_Progress.F_Show( null, localizedStrings["MSR_SAP_creatingPackage"] );
- }
- function hideProgressIfShowing()
- {
- if (D_Progress.F_IsActiveDialog())
- {
- // hide any progress that may be up
- D_Progress.F_Hide();
- }
- }
- function GetTreeNodePath( v_nTreeNode )
- {
- var currentNode = v_nTreeNode;
- var nodePathObj = {};
- var bIsLeaf = true;
-
- // The nodePath is being build back-wards
- do
- {
- var nodeLabel = currentNode.getAttribute( "label" );
- var nodeValue = currentNode.getAttribute( "value" );
-
- var nodeValueObj = eval( "(" + nodeValue + ")" );
- var nodeType = nodeValueObj.type;
- var nodeUniqueName = nodeValueObj.uniqueName;
- var nodeEntry = {};
- nodeEntry.Name = nodeLabel;
- nodeEntry.Type = nodeType;
- nodeEntry.Value = (nodeType == kDatabaseTypeStr || nodeType == kCatalogTypeStr) ? "partial" : "true";
- if (nodeType == kDatabaseTypeStr)
- {
- nodeEntry.dbType = IMPORTWIZARD.dataSourceType;
- nodeEntry.isSystem = "false";
- }
- else
- {
- nodeEntry.uniqueName = nodeUniqueName;
- }
-
- if (!bIsLeaf)
- {
- nodeEntry.children = [nodePathObj];
- }
-
- nodePathObj = nodeEntry;
- currentNode = currentNode.parentNode;
- bIsLeaf = false;
- }
- while (currentNode != null && currentNode.tagName == "treeNode");
- return nodePathObj;
- }
- // The first node in the array will end up containing the cosolidated tree nodes.
- function ConsolidateTree( treeNodesPaths, referenceNodeIndex )
- {
- // Consolidate the various trees (tree node paths) into a single unified tree.
- if (referenceNodeIndex < treeNodesPaths.length - 2)
- {
- ConsolidateTree( treeNodesPaths, referenceNodeIndex + 1);
- }
- // Traverse the list of nodes in reverse, to be able to remove elements on the fly.
- for (var n = treeNodesPaths.length - 1; n > (referenceNodeIndex); n--)
- {
- var firstTreeNode = treeNodesPaths[referenceNodeIndex];
- var currentTreeNode = treeNodesPaths[n];
-
- if (AreObjectsEqual( firstTreeNode, currentTreeNode, ["children"] ))
- {
- // var strTreeNodePathBEFORE = JSON.stringify( firstTreeNode, null, "\t" );
- // alert( "(BEFORE) same root node found\n\n\""
- /// + strTreeNodePathBEFORE);
- if (firstTreeNode.children == undefined || firstTreeNode.children == null)
- {
- firstTreeNode.children = currentTreeNode.children;
- }
- else
- {
- firstTreeNode.children = firstTreeNode.children.concat( currentTreeNode.children );
- }
- // node already processed; remove it from the collection.
- treeNodesPaths.splice( n, 1 );
-
- ConsolidateTree( firstTreeNode.children, 0 /* referenceNodeIndex */ );
- }
- }
- }
- G_App.F_OnCancel = function()
- {
- D_Progress.F_Hide();
- };
- function GetIconFilePath( objectType )
- {
-
- // hal/images/tv_folder.gif hal/images/tv_folder_expanded.gif
- //
- // This directory has all the images necessary:
- // C:\Program Files\cognos\c8.5.17.3_Colorado_2009-02-13\webcontent\pat\images
-
- var iconDirPath = WEB_CONTENT + "/mdsrv/importWizardUI/images/";
- //
- // This is NOT an associative array, but rather a HACK,
- // where the keys are actually elements of the object properties.
- //
- var iconMap = [];
- iconMap[kDatabaseTypeStr] = iconDirPath + "icon_data_source.gif";
- iconMap[kCatalogTypeStr] = iconDirPath + "icon_catalog.gif";
- iconMap[kCubeTypeStr] = iconDirPath + "icon_cube.gif";
- iconMap[kInfoQueryTypeStr] = iconDirPath + "icon_info_query.gif";
- iconMap[kDimensionGroupTypeStr] = iconDirPath + "icon_folder_dimensions.gif";
- iconMap[kDimensionTypeStr] = iconDirPath + "icon_dimension.gif";
- iconMap[kMeasuresGroupTypeStr] = iconDirPath + "icon_folder_measures.gif";
- iconMap[kMeasureTypeStr] = iconDirPath + "icon_measure.gif";
-
- iconMap["unknown"] = WEB_CONTENT + "/hal/images/btn_new.gif";
- var objectIconFilePath = iconMap[objectType];
-
- if (objectIconFilePath == null)
- {
- objectIconFilePath = iconMap["unknown"];
- }
- return objectIconFilePath;
- }
- function metadataTreeResultsReceived( treeSnippet )
- {
- if (g_treeNodeBeingPopulated == null)
- {
- return;
- }
-
- if (treeSnippet == null)
- {
- G_App.m_oTreeViewCheckboxes.F_EndAsyncLoad( true /* v_bSucceeded */ );
- g_treeNodeBeingPopulated = null;
- urlRequestInvoker.RequestFinished();
- return;
- }
-
- g_viewNodeToExpand = null;
-
- // This function will clear only the child nodes.
- G_App.m_oTreeViewCheckboxes.F_Clear( g_treeNodeBeingPopulated );
- for (var i = 0; i < treeSnippet.node.children.length; i++)
- {
- var aDoc = G_App.m_treeViewNodesDoc;
- PopulateTreeView( treeSnippet.node.children[i], aDoc, g_treeNodeBeingPopulated );
- }
- G_App.m_oTreeViewCheckboxes.F_EndAsyncLoad( true /* v_bSucceeded */ );
- g_treeNodeBeingPopulated = null;
- urlRequestInvoker.RequestFinished();
-
-
- //
- // Re-enable the Next and Finish buttons
- //
- var nextButton = document.getElementById( "nextButton" );
- EnableButton( nextButton, true /* bEnable */ );
- var finishButton = document.getElementById( "finishButton" );
- EnableButton( finishButton, IMPORTWIZARD.isFinishButtonEnabled /* bEnable */ );
-
-
-
- g_expandTreeLevel += 1;
- if (g_viewNodeToExpand != null)
- {
- setTimeout( function(){
- G_App.expandNode( g_viewNodeToExpand);
- }, 700 );
- }
- if (IMPORTWIZARD.enableTest == true)
- {
- if (g_expandTreeLevel == IMPORTWIZARD.treeLevels.length + 1)
- {
- setTimeout( function(){
- G_App.F_Next();
- }, 700 );
- }
- }
- }
- function metadataDimensionListResultsReceived( treeSnippet )
- {
-
- var childNodeUniqueName = getSelectedCubeUniqueName();
- if (childNodeUniqueName != null)
- {
- mapCubeAliasTables[childNodeUniqueName] = treeSnippet; // map { cubeListNode, treeSnippet} ( used to cash the alias tables per cube to improve the performance )
- }
-
- // g_dimensionTree = treeSnippet;
- G_App.PopulateDimensionsListView(treeSnippet);
- hideProgressIfShowing();
- urlRequestInvoker.RequestFinished();
- G_App.m_oListViewDimensions.F_Draw();
-
- G_App.selectFirstListBoxItem(G_App.m_oListViewDimensions);
- G_App.m_oListViewDimensions.F_Draw();
-
- if (IMPORTWIZARD.enableTest == true)
- {
- // in test mode, select all dimensions that are sent as http parameters
- for (var dim in IMPORTWIZARD.dimAlias)
- {
- G_App.m_oListViewDimensions.F_DeselectAll();
- var strDim = new String(dim);
- g_dimNum = strDim.substr(1);
- G_App.selectListBoxItem(G_App.m_oListViewDimensions, g_dimNum);
-
- G_App.m_oListViewDimensions.F_Draw();
- //G_App.PopulateAliasTablesListView(treeSnippet);
- }
-
- // Finish
- // no requests in the previous code, so goto to finish
- WizardDone();
- }
-
-
- // For accessibility Set the focus on the first item of the check box
- var v_nFirstListItem = G_App.m_oListViewDimensions.F_GetFirstSelectableItem();
- if ( v_nFirstListItem )
- {
- var vaFocus = document.getElementById( v_nFirstListItem.getAttribute( "htmlId" ) );
- if( vaFocus )
- vaFocus.focus();
- }
- G_App.m_oListViewDimensions.F_Draw();
- var finishButton = document.getElementById( "finishButton" );
- EnableButton( finishButton, IMPORTWIZARD.isFinishButtonEnabled /* bEnable */ );
-
- }
- G_App.PopulateDimensionsListView = function(treeSnippet)
- {
-
- var bAliasTableListPopulates = "false";
- G_App.m_oListViewDimensions.F_Clear(); // clear the alias tables list box
-
- for (var i = 0; i < treeSnippet.node.children.length; i++)
- {
-
- treeViewNodeData = treeSnippet.node.children[i]
-
- var nodeLabel = treeViewNodeData.Name;
- var nodeType = treeViewNodeData.Type;
-
- if (nodeType == "aliasTable")
- {
- var newListItemNode = this.m_oListViewDimensions.F_AppendNewListItem();
- newListItemNode.setAttribute( "value", nodeType );
- newListItemNode.setAttribute( "label", nodeLabel );
- }
- bAliasTableListPopulates = "true";
- }
- G_App.m_oListViewDimensions.F_Draw();
-
- // enable languages list box if
- if (bAliasTableListPopulates == "true")
- {
- G_App.dissableLanguageBox("false");
- G_App.m_oListViewCheckboxes.F_Draw();
-
- // select the first alias table
- G_App.selectFirstListBoxItem(G_App.m_oListViewDimensions);
-
- // populate the languages list box for the selected (first) alias table
- G_App.RepopulateLanguagesListView();
-
- // select the first language list box item
- // first unselect all because this is multi-selection list box
- G_App.m_oListViewCheckboxes.F_DeselectAll();
- G_App.selectFirstListBoxItem(G_App.m_oListViewCheckboxes);
- G_App.m_oListViewCheckboxes.F_Draw();
-
-
-
- if (IMPORTWIZARD.enableTest == true)
- {
- var dim = "a" + g_dimNum;
- var langs = IMPORTWIZARD.dimAlias[dim];
- // for (var lang in mapAliasMapLang)
- // {
- // G_App.m_oListViewAliasTables.F_DeselectAll();
- // var strAlias = new String(alias);
- // g_aliasNum = strAlias.substr(1);
- // G_App.selectListBoxItem(G_App.m_oListViewAliasTables, g_aliasNum);
-
- // G_App.m_oListViewAliasTables.F_Draw();
- // // populate the languages list box for the selected (first) alias table
- // G_App.RepopulateLanguagesListView();
-
- // var langs = mapAliasMapLang[alias];
- for (var lang in langs)
- {
- // "lang" is the name of the language to select
- var nodeListLangs = G_App.m_oListViewCheckboxes.F_GetListItems();
- var numberOfLangs = nodeListLangs.length;
- for ( var i = 0; i < numberOfLangs; i++ )
- {
- var la = nodeListLangs.item( i );
- langName = la.getAttribute("label");
- if (langName == lang)
- {
- la.setAttribute("checked", "true");
- G_App.F_ListView_OnCheckboxClick( G_App.m_oListViewCheckboxes, la, null );
- break;
- }
- }
- G_App.m_oListViewCheckboxes.F_Draw();
- }
- G_App.m_oListViewCheckboxes.F_Draw();
- // }
-
-
- }
-
-
-
- }
- else
- {
- // no alias tables
-
- // Clear all check boxes
- G_App.m_oListViewCheckboxes.F_UncheckAll();
- G_App.m_oListViewCheckboxes.F_DeselectAll();
- G_App.m_oListViewCheckboxes.F_Draw();
- G_App.dissableLanguageBox("true");
- G_App.m_oListViewCheckboxes.F_Draw();
-
- }
-
- };
- // The argument is "true" or "false"
- G_App.dissableLanguageBox = function(bEnable)
- {
- var nl = G_App.m_oListViewCheckboxes.F_GetListItems();
- for ( var i = 0; i < nl.length; i++ )
- {
- var v_nListItem = nl.item( i );
- v_nListItem.setAttribute( "staticCheckbox", bEnable );
- }
- }
- //
- G_App.selectFirstListBoxItem = function(listBoxView)
- {
- var v_nlListItems = listBoxView.F_GetListViewNode().selectNodes( "listItems/listItem" );
- if (v_nlListItems != null && v_nlListItems.length > 0)
- {
- var v_nListItem = v_nlListItems.item( 0 );
- v_nListItem.setAttribute( "selected", "true" );
-
- }
- }
- // select a given item from the listbox view
- // itemNumber = integer (zero based)
- G_App.selectListBoxItem = function(listBoxView, itemNumber)
- {
- var v_nlListItems = listBoxView.F_GetListViewNode().selectNodes( "listItems/listItem" );
- if (v_nlListItems != null && v_nlListItems.length > 0)
- {
- if (itemNumber < v_nlListItems.length)
- {
- var v_nListItem = v_nlListItems.item( itemNumber );
- v_nListItem.setAttribute( "selected", "true" );
- }
- }
- }
- function HandleException(jsonExceptionObj)
- {
- hideProgressIfShowing();
- var errorPageMgr = new ErrorPageManager();
-
- if (jsonExceptionObj.isQF)
- {
- document.getElementById( "main" ).style.display = "none";
- errorPageMgr.handleQF(jsonExceptionObj.faultDom, ErrorPageClosed);
- }
- else if (jsonExceptionObj.isCAM)
- {
- document.getElementById( "main" ).style.display = "none";
- errorPageMgr.handleCAM(jsonExceptionObj, ErrorPageClosed);
- }
- else
- {
- var msg = jsonExceptionObj.messageString;
- if (msg === "")
- {
- msg = localizedStrings["MSR_SAP_unknownErrorMessage"];
- }
- var stackTrace = jsonExceptionObj.stackTrace;
- stackTrace = unescape(stackTrace);
-
- document.getElementById( "main" ).style.display = "none";
- document.getElementById( "editSelection" ).style.display = "none"
-
- errorPageMgr.setupAndDisplayErrorPage(localizedStrings["MSR_SAP_errorPageTitle"], "",
- msg, stackTrace, ErrorPageClosed);
- }
- }
- function ErrorPageClosed(recovered)
- {
- document.getElementById("main").style.display = "block";
-
- // If its been recovered, then we presume that call back will occur at a later time
- if (IMPORTWIZARD.onResumeFromNonRecoverableError && !recovered){
- IMPORTWIZARD.onResumeFromNonRecoverableError();
- }
- }
- function launchFromEdit()
- {
- var selectMetadataRadioBtn = document.getElementById( "modifyMetadataSelections" );
- var editVariablesRadioBtn = document.getElementById( "editVariables" );
- var modifySettingsRadioBtn = document.getElementById( "modifySettings" );
- var editSelectionPage = document.getElementById( "editSelection" );
-
- if (selectMetadataRadioBtn.checked)
- {
- editSelectionPage.style.display = "none";
-
- var main = document.getElementById( "main" );
- main.style.display = "block";
- retrieveImportSpec();
- }
- else if (editVariablesRadioBtn.checked)
- {
- editSelectionPage.style.display = "none";
- OnShowVariables();
- }
- else if (modifySettingsRadioBtn.checked)
- {
- SaveModifiedSettings();
- }
- }
- function ImportHelper(importSpec, parameters, packageInfo)
- {
- this.m_importSpec = importSpec;
- this.m_parameters = parameters;
- this.m_packageInfo = packageInfo;
- }
- ImportHelper.prototype.runImport = function()
- {
- var importRequestURL = GATEWAY_URL + "/metadataUIService"
-
- this.m_requestId = new Date().getTime();
-
- var importRequestPostParams = {};
- if (IMPORTWIZARD.enableTestNoDBConnection)
- importRequestPostParams["pid"] = "OLAPImportWizard_Import_TEST_pid";
- else
- importRequestPostParams["pid"] = "OLAPImportWizard_Import_pid";
- importRequestPostParams["importSpec"] = this.m_importSpec;
- importRequestPostParams["parameters"] = this.m_parameters;
- importRequestPostParams["packageInfo"] = this.m_packageInfo;
- importRequestPostParams["requestId"] = this.m_requestId;
- importRequestPostParams["dataSourceCredentials"] = IMPORTWIZARD.credentials;
- importRequestPostParams["error_pid"] = asyncErrorPagePid;
-
- if (IMPORTWIZARD.enableTest == true)
- {
- importRequestPostParams["enableTest"] = "true";
- }
-
-
- urlRequestInvoker.MakeAsyncRequestInIFrame( importRequestURL, importRequestPostParams );
- }
|