123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362 |
- /****************************************************************
- ** Licensed Materials - Property of IBM
- **
- ** IBM Cognos Products: mdsrv
- **
- ** (C) Copyright IBM Corp. 2008, 2016
- **
- ** US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
- *****************************************************************/
- 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" );
- //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 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;
- }
- break;
- }
- case 1:
- var msg = this.checkDesignLocaleSelected();
- if (msg && msg != null){
- return msg;
- }
- 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();
- var numCubes = 0;
- var numInfoQueries = 0;
-
- for (var n = 0; n < treeNodesList.length; n++)
- {
- var currentNode = treeNodesList.item(n);
- var nodeValue = currentNode.getAttribute( "value" );
-
- var nodeValueObj = eval( "(" + nodeValue + ")" );
- if (nodeValueObj.type == kCubeTypeStr)
- {
- numCubes++;
- }
- else if (nodeValueObj.type == kInfoQueryTypeStr)
- {
- numInfoQueries++;
- }
-
- if (numCubes > this.maxCubes)
- {
- return localizedStrings["MSR_SAP_tooManyCubes"].replace("{0}", this.maxCubes);
- }
-
- if (numInfoQueries > this.maxInfoQueries)
- {
- return localizedStrings["MSR_SAP_tooManyInfoQueries"].replace("{0}", this.maxInfoQueries);
- }
- }
-
- 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();
- };
- var useV5DataServerCheckBox = null;
- G_App.initControls = function()
- {
- this.m_oDeck = new C_Deck( document.getElementById( "divDeck" ), this );
- UpdateButtonsEnableStatus( 0 /* cardIndex */ );
- var obj = document.getElementById( "radioShortName" );
- obj.checked = true;
- 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" );
-
- // Only populate with the root node if in "create" mode!
- if (!IMPORTWIZARD.isEdit)
- {
- this.PopulateTreeView_RootNode( this.m_treeViewNodesDoc, treeViewElem );
- }
-
- // var v_nTreeNode = treeViewElem.selectSingleNode( ".//treeNode[@label='Node A1']" );
- // v_nTreeNode.setAttribute( "checked", "true" );
- // var v_nTreeNode = treeViewElem.selectSingleNode( ".//treeNode[@label='Node A2']" );
- // v_nTreeNode.setAttribute( "staticCheckbox", "true" );
- this.m_oTreeViewCheckboxes = new C_TreeView( document.getElementById( "divTreeViewCheckboxes" ), treeViewElem, this );
-
- var dualStructuresCheckBox = document.getElementById( "cbSAPBWDualStructuresSupport" );
- dualStructuresCheckBox.checked = "true";
-
-
- useV5DataServerCheckBox = document.getElementById( "useV5DataServer" );
- useV5DataServerCheckBox.checked = IMPORTWIZARD.bUseV5DataServer;
-
- if (IMPORTWIZARD.bDisableClassic == "true")
- //useV5DataServerCheckBox.disabled=true;
- useV5DataServerCheckBox.style.display = "none";
- var aDoc2 = U_XML.F_CreateDocument();
- var listViewElem = aDoc2.appendChild( aDoc2.createElement( 'listView' ) );
- listViewElem.setAttribute( "id", "LanguagesListView" );
- listViewElem.setAttribute( "showCheckboxes", "true" );
- listViewElem.appendChild( aDoc2.createElement( "listItems" ) );
- this.m_oListViewCheckboxes = new C_ListView( document.getElementById( "divListViewCheckboxes" ), listViewElem, this );
- // TODO: Delete this code, and implement smart picking
-
- // if (supportedLanguagesTable.length > 0)
- // {
- // var designLanguageEditBox = document.getElementById( "designLanguage" );
-
- // designLanguageEditBox.value = supportedLanguagesTable[0][1];
- // picking the deisng locale from the list of CCL loclaes deosn't make sense, even FMUI this behaviour was questionable, but FMUI
- // was stuck because the design locale was already set, we are creating a model from scratch, so the design locale should be one of the provider
- // languages
- // certainly picking the first ccl language doesn't make sense, if anything we should take the content locale, and do a best match against the
- // available language locales
- // for the sake of getting this working in the integration, I'm just not doing anything here at all, the user will need to pick from the list
- // The code that sends down the CCL language list in the JSP should be deleted, and instead the jsp should send down the content locale so we can do a
- // best match
- // }
-
-
- ShowPackageRenameDlgIfNeeded();
- // For accessibility In edit choice page set the default focus to editvariables
- if (IMPORTWIZARD.isEdit)
- {
- var vfocusElement = document.getElementById("editVariables");
- if( vfocusElement )
- {
- vfocusElement.focus();
- }
- }
- }
- 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 );
- this.m_oTreeViewCheckboxes = new C_TreeView( document.getElementById( "divTreeViewCheckboxes" ), treeViewElem, this );
-
- // delete the maps
- mapCubeAliasLanguages = new Object();
- mapCubeDimTables = new Object();
- }
- function selectFirstItemInTreeControl()
- {
- //var v_nTreeView = G_App.m_oTreeViewCheckboxes.F_GetTreeViewNode();
- //var v_elSpanFirst = v_nTreeView.F_GetFirstVisibleTreeItem();
- 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"] = "importWizard_Languages_pid"
- getLanguagesRequestPostParams["datasource"] = IMPORTWIZARD.dataSourceName;
- getLanguagesRequestPostParams["dataSourceCredentials"] = IMPORTWIZARD.credentials;
- getLanguagesRequestPostParams["useV5DataServer"] = useV5DataServerCheckBox.checked ? "true" : "false";
- getLanguagesRequestPostParams["error_pid"] = asyncErrorPagePid;
- urlRequestInvoker.MakeAsyncRequestInIFrame( getLanguagesRequestURL, getLanguagesRequestPostParams );
- }
- G_App.PopulateLanguagesListView = function(languagesList)
- {
- var designLocaleList = document.getElementById( "designLanguage" );
-
- 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" );
-
- designLocaleList.options[i]=new Option(languagesList[i].localeName, languagesList[i].localeId);
- }
- bIsLanguagesListPopulated = true;
- };
- function OnUseV5DataServerBtnClicked( sourceUseV5DataServerChkBox )
- {
- G_App.m_oTreeViewCheckboxes.F_Detach();
- G_App.initializeTreeViewCheckBox();
- }
- function providerLangResultsReceived( providerLanguages )
- {
- G_App.PopulateLanguagesListView( providerLanguages.lang );
- G_App.m_oListViewCheckboxes.F_Draw();
-
- D_Progress.F_Hide();
- urlRequestInvoker.RequestFinished();
- // 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 useV5DataServerCheckBox = document.getElementById( "ms_useV5DataServer" );
-
- if (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 stateSmallIcon = "hal/images/icon_information_16x16.gif";
-
- var bExpandable = (nodeType != kDimensionTypeStr && nodeType != kMeasureTypeStr);
- var bHideCheckBox = (nodeType == kDimensionGroupTypeStr || nodeType == kDimensionTypeStr
- || nodeType == kMeasuresGroupTypeStr || nodeType == kMeasureTypeStr);
- var bStaticCheckBox = (nodeType == kDatabaseTypeStr || nodeType == kCatalogTypeStr);
- 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( "stateSmallIcon", stateSmallIcon );
- 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" );
- 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;
- 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 = "BW";
- var dualStructuresCheckBox = document.getElementById( "cbSAPBWDualStructuresSupport" );
- nodePathEntry.dualStructures = dualStructuresCheckBox.checked ? "true" : "false";
- 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 = {};
- browseTreeRequestPostParams["pid"] = "importWizard_GetTreeNodes_pid";
- browseTreeRequestPostParams["connectionName"] = IMPORTWIZARD.dataSourceName;
- browseTreeRequestPostParams["nodePath"] = nodePath;
- browseTreeRequestPostParams["dataSourceCredentials"] = IMPORTWIZARD.credentials;
- browseTreeRequestPostParams["error_pid"] = asyncErrorPagePid;
- 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 );
-
- // WHAT IS THIS USEFULL FOR ????
- // if ( v_nTreeNode.firstChild || ( v_nTreeNode.getAttribute( "hasFetchedChildren" ) == "true" ) )
- // {
- // return;
- // }
- //
- // v_nTreeNode.setAttribute( "hasFetchedChildren", "true" );
- //
- // var v_bIsSearch = ( v_nTreeNode.getAttribute( "isSearchNode" ) == "true" );
- // var v_sSearchPath = v_nTreeNode.getAttribute( "searchPath" );
- // if ( v_nTreeNode.getAttribute( "isSearchNode" ) != "true" )
- // {
- // v_sSearchPath += "/*";
- // }
- // this.m_oRequest = G_ContentManager.F_CreateCMRequest( this, v_sSearchPath );
- // this.m_oRequest.F_Send();
- // this.m_nCurrentNode = v_nTreeNode;
-
- 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 */ && bIsLanguagesListPopulated == false)
- {
- PopulateLanguagesListBox();
- }
- 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{
- this.m_oDeck.F_Next();
- }
- };
- 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 )
- {
- var currentNode = v_nTreeNode;
-
- while (currentNode.parentNode != null && currentNode.parentNode.tagName == "treeNode")
- {
- var parentNode = currentNode.parentNode;
-
- var bIsNodeCheckedPrevState = (currentNode.getAttribute( "checked" ) == "true");
- // The new state of the check box.
- var bIsNodeChecked = !bIsNodeCheckedPrevState;
-
- var bIsParentNodeChecked = (parentNode.getAttribute( "checked" ) == "true");
-
- // The call to F_GetCheckedChildrenNodes doesn't include the current "node check" operation!
- var numOfCheckedNodes = G_App.m_oTreeViewCheckboxes.F_GetCheckedChildrenNodes( parentNode ).length;
-
- // The node that triggered the event is not yet included in the F_GetCheckedChildrenNodes result!
- if (currentNode == v_nTreeNode)
- {
- numOfCheckedNodes += bIsNodeChecked ? +1 : -1;
- }
-
- parentNode.setAttribute( "checked", numOfCheckedNodes > 0 ? "true" : "false" );
- G_App.m_oTreeViewCheckboxes.F_UpdateNode( parentNode );
-
- currentNode = parentNode;
- }
- };
- 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 WizardDone()
- {
- // 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 );
-
-
- // var nodeName = treeNode.getAttribute( "label" );
- // var nodeValue = treeNode.getAttribute( "value" );
- //
- // var nodeValueObj = eval( "(" + nodeValue + ")" );
- // var nodeType = nodeValueObj.type;
- // var nodeUniqueName = nodeValueObj.uniqueName;
- // alert( nodeName + " " + nodeValue );
-
- }
-
- ConsolidateTree( treeNodesPaths, 0 /* referenceNodeIndex */ );
-
- if (treeNodesPaths.length != 1)
- {
- alert( "ASSERT FAILED: The number tree objects must be 1!\n\nIt is currently: " + treeNodesPaths.length );
- }
-
- var importSpec = {};
- importSpec["node"] = [];
- importSpec["node"][0] = treeNodesPaths[0];
-
- var strImportSpec = JSON.stringify( importSpec, null, "\t" );
-
-
-
- // Build the parameters object
-
-
- var nodeList = G_App.m_oListViewCheckboxes.F_GetCheckedListItems();
- var selectedLanguages = [];
- var selectedLanguagesCodes = [];
-
- for (var i = 0; i < nodeList.length; i++)
- {
- var listItem = nodeList.item( i );
- var langCode = listItem.getAttribute( "value" );
- var langName = listItem.getAttribute( "label" );
- selectedLanguages.push( langName );
- selectedLanguagesCodes.push( langCode );
- }
-
-
- var shortNameRadioBtn = document.getElementById( "radioShortName" );
- var longNameRadioBtn = document.getElementById( "radioLongName" );
- var technicalNameRadioBtn = document.getElementById( "radioTechnicalName" );
-
- var objectName = shortNameRadioBtn.value;
-
- if (longNameRadioBtn.checked)
- {
- objectName = longNameRadioBtn.value;
- }
- else if (technicalNameRadioBtn.checked)
- {
- objectName = technicalNameRadioBtn.value;
- }
-
-
- var enhanceModelForSAPCheckBox = document.getElementById( "enhanceModelForSAP" );
- var useV5DataServerCheckBox = document.getElementById( "useV5DataServer" );
- var designLocaleCombo = document.getElementById("designLanguage");
- var parameters = {};
- parameters["params"] = {};
- parameters["params"]["ObjectName"] = objectName;
- parameters["params"]["ObjectLayout"] = enhanceModelForSAPCheckBox.checked ? "true" : "false";
- parameters["params"]["UseV5DataServer"] = useV5DataServerCheckBox.checked ? "true" : "false";
- parameters["params"].languages = selectedLanguagesCodes;
- 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 = "BW";
- var dualStructuresCheckBox = document.getElementById( "cbSAPBWDualStructuresSupport" );
- nodeEntry.dualStructures = dualStructuresCheckBox.checked ? "true" : "false";
-
- nodeEntry.isSystem = "false";
- }
- else
- {
- nodeEntry.uniqueName = nodeUniqueName;
- }
-
- // if (nodePathObj != undefined)
- 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 */ );
- // var strTreeNodePathAFTER = JSON.stringify( firstTreeNode, null, "\t" );
- // alert( "(AFTER) same root node found\n\n\""
- // + strTreeNodePathAFTER);
- }
- }
- }
- 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;
- }
- // 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 */ );
- }
- 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 = {};
- importRequestPostParams["pid"] = "importWizard_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;
-
- urlRequestInvoker.MakeAsyncRequestInIFrame( importRequestURL, importRequestPostParams );
- }
|