/* @@@BUILDINFO@@@ eventHandler.jsx 466 16-March-2007 */ /************************************************************************* * * ADOBE CONFIDENTIAL * ___________________ * * Copyright 2005 Adobe Systems Incorporated * All Rights Reserved. * * NOTICE: All information contained herein is, and remains * the property of Adobe Systems Incorporated and its suppliers, * if any. The intellectual and technical concepts contained * herein are proprietary to Adobe Systems Incorporated and its * suppliers and may be covered by U.S. and Foreign Patents, * patents in process, and are protected by trade secret or copyright law. * Dissemination of this information or reproduction of this material * is strictly forbidden unless prior written permission is obtained * from Adobe Systems Incorporated. **************************************************************************/ stockphoto.removeASP = false; stockphoto.ASPWorkspace = "Adobe Stock Photos"; stockphoto.APDWorkspace = "Adobe Photographers Directory"; stockphoto.resetPreviousWorkspace = false; stockphoto.previousWorkspace = "Adobe Stock Photos"; if( ( stockphoto.timeKeeperOn != undefined )&&( stockphoto.timeKeeperOn ) ) { stockphoto.timeKeeper.eventHandler = {}; stockphoto.timeKeeper.eventHandler.StTime = new Date(); } // EventHandler namespace and zstringCache instance stockphoto.eventHandler = {}; stockphoto.eventHandler.zc = new stockphoto.zstringCache("eventHandler"); //thumbnail sort flags stockphoto.eventHandler.bRememberThumbSortOrder = true; stockphoto.eventHandler.lastRemeberedSortOrder = undefined; // components of "pathAnalyzer" group analyzes a path to a folder or file, // determine if it is for BM and places NavBar accordingly. First // pathAnalyzer.AnalyzingPath() is performed to analyze the path. Then // pathAnalyzer.ProcessAnalyzedPath() processes using the result from // pathAnalyzer.AnalyzingPath(). Finally the pathAnalyzer.PostProcessOfAnalyzedPath() // make the Navbar to be visible, if it's necessary. stockphoto.eventHandler.pathAnalyzer = { quitBMWeb: false, doShoppingCart: true, pathIn: "", doc_id: -1, argOut: {} }; stockphoto.eventHandler.eventHistory = { type: "", subtype: "", doc_id: 0, // filled only for Thumb event count: 0 } // component of "StartUpFolder" places the NavBar for startup folder // when it is one of BM. stockphoto.eventHandler.StartUpFolder= { InitialSw: true, args: {} }; // This object is used to re-perform a task that may be overridden by // the app.scheduleTask-ed stockphoto.displayStartPage(). The task can know // whether it's being overridden by looking at the scheduled flag and can // assign another task to the altTask variable that is performed by // stockphoto.displayStartPage() as alternative. stockphoto.eventHandler.displayStartPage = { scheduled: 0, altTask: undefined }; // Change visibility of top navbar to b (true|false) stockphoto.eventHandler.pathAnalyzer.cStateCnst_WebNavShort =1; stockphoto.eventHandler.pathAnalyzer.cStateCnst_WebNavHigh =2; stockphoto.eventHandler.pathAnalyzer.cStateCnst_FileSysNav =4; stockphoto.eventHandler.pathAnalyzer.cStateCnst_ExistBMNavBar=8; stockphoto.eventHandler.pathAnalyzer.cStateCnst_Init =16; stockphoto.eventHandler.pathAnalyzer.cStateCnst_Undetermined =32; stockphoto.eventHandler.pathAnalyzer.cStateCnst_NonBMNavBar =55; stockphoto.eventHandler.pathAnalyzer.cStateCnst_MaskBMNavBar =56; stockphoto.eventHandler.pathAnalyzer.panePreviousState =0; stockphoto.eventHandler.pathAnalyzer.paneCurrentState =0; stockphoto.eventHandler.pathAnalyzer.panePreviousMode =""; stockphoto.eventHandler.pathAnalyzer.panePreviousPath =""; stockphoto.eventHandler.pathAnalyzer.panePreviousDispPath =""; stockphoto.eventHandler.pathAnalyzer.panePreviousMode2 =""; stockphoto.eventHandler.pathAnalyzer.panePreviousPath2 =""; stockphoto.eventHandler.pathAnalyzer.panePreviousDispPath2 =""; stockphoto.eventHandler.pathAnalyzer.ChangeNavVisiblity=function( doc, b, where ) { if( ( doc.topNavbar.height > 0 )&& ( doc.topNavbar.file != undefined )&& ( doc.topNavbar.file != "" )&& ( doc.topNavbar.visible != undefined ) ) { if( doc.browserMode == "compact" ) { if( doc.topNavbar.visible == true ) { doc.topNavbar.visible = false; // in stockphoto.eventHandler.pathAnalyzer.ChangeNavVisiblity } } else // not "compact" { if( doc.topNavbar.visible != b ) { doc.topNavbar.visible = b; // in stockphoto.eventHandler.pathAnalyzer.ChangeNavVisiblity } if (doc.topNavbar.visible == true) { // var iNavHeight = stockphoto.NavIntDt.processTable[stockphoto.NavIntDt_t[doc.id].navType].navHeight; var iNavHeight = stockphoto.DL.NavBar.GetNavHeightType(doc.id); // Only perform actions on Advanced Drawer if we are dealing with a 'High' Nav Bar, not the short (logo) one.. if (iNavHeight == stockphoto.NavIntDt._kNavHeight_high) { //var iWorF = stockphoto.NavExtFnc.GetNavWorFType(doc.id); //if (iWorF == undefined) //{ //Fix for Bug ID:1254850; webOrFile is not updated in the case mentioned in the bug. So using contentPaneMode always. var iWorF = stockphoto.NavIntFnc.get_kwORf( ( doc.contentPaneMode ).charAt(0) ); //} var iHtmLDStatus = stockphoto.NavExtFnc.getHTMLDStatus( doc.id, iWorF ); // bCNavProcessingStatus prevents re-entry into our Nav Bar redraw logic... var bCNavProcessingStatus = stockphoto.NavExtFnc.getCNavProcessingStatus(doc.id, iWorF); if ((iHtmLDStatus == stockphoto.NavBar.cnst_HtmLDStatus_HtmIsRead) // HTML Ready... && (bCNavProcessingStatus == false)) { stockphoto.NavExtFnc.setCNavProcessingStatus(doc.id, iWorF, true); // Set all filter states in the NavBar... var sSource = ''; var oSettings = stockphoto.DL.NavBar.GetDrawerSettings(doc.id); if (oSettings != undefined) { sSource = oSettings.toSource(); } if (sSource != '') { // Replace quotes to make it insertable in execJS... sSource = sSource.replace(/\"/g,'\\"'); execStr = 'setAllFilters(' + "'" + sSource + "'" + ');'; doc.topNavbar.execJS(execStr); } // if (sSource != '') var iNewHeight = stockphoto.NavCnv.NavCnv.HEIGHTT; if (iWorF == stockphoto.NavIntDt._kWebOrFile_filesystem) { iNewHeight = iNewHeight + stockphoto.NavCnv.NavCnv.BARHEIGHT; } var bUpdateNavBar = false; if ((doc.topNavbar.drawerVisible == true) && (stockphoto.search.showAdvancedDrawer[doc.id] == false)) { doc.topNavbar.drawerVisible = false; bUpdateNavBar = true; } else if (((doc.topNavbar.drawerVisible == false) || (doc.topNavbar.drawerVisible == undefined)) && (stockphoto.search.showAdvancedDrawer[doc.id] == true)) { //AK:added to adjust NAV bar height. if (false == stockphoto.core.displayValueCollectionFeatureflag) { iNewHeight = iNewHeight + stockphoto.NavCnv.NavCnv.BARDRAWEREXPANSION_BC4; } else { iNewHeight = iNewHeight + stockphoto.NavCnv.NavCnv.BARDRAWEREXPANSION; } doc.topNavbar.drawerVisible = true; bUpdateNavBar = true; } if (bUpdateNavBar == true) { doc.topNavbar.execJS('RefreshValuesFromES();'); if (doc.topNavbar.height != iNewHeight) { doc.topNavbar.height = iNewHeight; } } stockphoto.NavExtFnc.setCNavProcessingStatus(doc.id, iWorF, false); } // HTML Status Ready... } // if ('high' Nav Bar...) } } // not "compact"... } // main if-clause.. } // Change contentPaneMode of "doc" to "mode" stockphoto.eventHandler.pathAnalyzer.ChangeContentPaneMode=function( doc, mode, bFromNonBM ) { // bFromBM == undefined if it is called from BM var script, bClear=false, cFileSysWithNav=true; if( bFromNonBM == undefined ) { // caller is BM if( ( doc.contentPaneMode == "web" )|| ( doc.topNavbar == undefined )||( doc.topNavbar.visible == undefined )||( doc.topNavbar.height == undefined )|| ( ! doc.topNavbar.visible )||( doc.topNavbar.height <= 0 ) ) { cFileSysWithNav = false; } } else { // caller is non-BM if( ( stockphoto.eventHandler.pathAnalyzer.paneCurrentState & /*4*/ stockphoto.eventHandler.pathAnalyzer.cStateCnst_FileSysNav ) == 0 ) { cFileSysWithNav = false; } } // detecting the changes happened outside of BM if( ! cFileSysWithNav ) { stockphoto.eventHandler.pathAnalyzer.panePreviousState = /*2*/ stockphoto.eventHandler.pathAnalyzer.cStateCnst_WebNavHigh; if( ( mode == "web" )||( doc.browseMode == "compact" ) ) { stockphoto.eventHandler.pathAnalyzer.paneCurrentState = /*2*/ stockphoto.eventHandler.pathAnalyzer.cStateCnst_WebNavHigh; } else { // "web" -> "BM's filesystem" bClear = true; stockphoto.eventHandler.pathAnalyzer.paneCurrentState = /*4|8*/ stockphoto.eventHandler.pathAnalyzer.cStateCnst_FileSysNav | stockphoto.eventHandler.pathAnalyzer.cStateCnst_ExistBMNavBar; } } else { stockphoto.eventHandler.pathAnalyzer.panePreviousState = /*4|8*/ stockphoto.eventHandler.pathAnalyzer.cStateCnst_FileSysNav | stockphoto.eventHandler.pathAnalyzer.cStateCnst_ExistBMNavBar; if( ( mode == "web" )||( doc.browseMode == "compact" ) ) { // "BM's filesystem" -> "web" stockphoto.eventHandler.pathAnalyzer.paneCurrentState = /*2*/ stockphoto.eventHandler.pathAnalyzer.cStateCnst_WebNavHigh; } else { stockphoto.eventHandler.pathAnalyzer.paneCurrentState = /*4|8*/ stockphoto.eventHandler.pathAnalyzer.cStateCnst_FileSysNav | stockphoto.eventHandler.pathAnalyzer.cStateCnst_ExistBMNavBar; } } if( ( stockphoto.core.html.urlUILanguage == "en" )|| ( stockphoto.core.html.urlUILanguage == "es" )|| ( stockphoto.core.html.urlUILanguage == "fr" )|| ( stockphoto.core.html.urlUILanguage == "de" ) ) { if( stockphoto.eventHandler.pathAnalyzer.panePreviousPath != stockphoto.uris.APD ) { stockphoto.eventHandler.pathAnalyzer.panePreviousMode2 = stockphoto.eventHandler.pathAnalyzer.panePreviousMode; stockphoto.eventHandler.pathAnalyzer.panePreviousPath2 = stockphoto.eventHandler.pathAnalyzer.panePreviousPath; stockphoto.eventHandler.pathAnalyzer.panePreviousDispPath2 = stockphoto.eventHandler.pathAnalyzer.panePreviousDispPath } stockphoto.eventHandler.pathAnalyzer.panePreviousMode = doc.thumbnail.displayMode; stockphoto.eventHandler.pathAnalyzer.panePreviousPath = doc.thumbnail.path; stockphoto.eventHandler.pathAnalyzer.panePreviousDispPath = stockphoto.core.util.getDisplayPath(doc.thumbnail, " "); } if( bFromNonBM == undefined ) { var szEnter; szEnter = stockphoto.NavIntDt.TheEnter; if( doc.contentPaneMode != mode ) { // Set "Enter..." to edit box of Web-NavBar before/after switching to web-mode if( mode == "web" ) { if( stockphoto.DL.demandJsxLoading( stockphoto.DL.jsx_NavBar ) ) { stockphoto.NavIntFnc.SetKeyWord( szEnter, false /*=unescaped*/, doc.id, false ); stockphoto.NavExtFnc.SendKeyWordToHTM( escape( szEnter ), doc.id, 0, 0 ); } } doc.contentPaneMode = mode; } // The 'Enter...' string should always be set -- even when moving from web-to-web // Specifically in case of no-search-to-homepage if( mode == "web" ) { stockphoto.NavIntFnc.SetKeyWord( stockphoto.NavIntDt.TheEnter, false /*=unescaped*/, doc.id, true ); stockphoto.NavExtFnc.SendKeyWordToHTM( escape( szEnter ), doc.id, 2, 0 ); } } if( bClear ) { if( ( doc.topNavbar != undefined )&&( doc.topNavbar.visible != undefined )&&( doc.topNavbar.height != undefined )&& ( doc.topNavbar.visible )&&( doc.topNavbar.height > 0 ) ) { if( stockphoto.DL.demandJsxLoading( stockphoto.DL.jsx_NavBar ) ) { if( stockphoto.NavExtFnc.getHTMLDStatus( doc.id, stockphoto.NavBar.cnst_WorF_filesystem ) >= stockphoto.NavBar.cnst_HtmLDStatus_HtmIsRead ) { var script='setTimeout( "ProcClear();", 0 );' ; doc.navbars.filesystem.top.execJS( script ); } } } } } // Correct keyword string to the one that is suitable for display by // - removing "-nnn" from the bottom of sub folder name, and // - replace "_" with a space character. stockphoto.eventHandler.pathAnalyzer.CorrectKeyWordForDisplay=function( uKeyword ) { var k, n, i, Bt, OutStr=""; n = uKeyword.length; k = uKeyword.lastIndexOf('-'); // remove "-nnn" portion if "nnn" consists of only "0"-"9" if( k > 0 ) { for( i=k+1; i 57 ) ) { k = n; break; }; }; } else { k = n; }; // k now contains the size of "uKeyword", then change "_" to " " for( i=0; i 0 )&& ( app.documents[i].thumbnail.displayMode == "web") ) { return( true ); } } } // for return( false ); } // fix to bug- Watson: 1172046 // return true if the given path indicates that it is the DR login page stockphoto.eventHandler.pathAnalyzer.isLoginpage=function( pathIn ) { if ( "undefined" != typeof pathIn) { if (("undefined" != typeof stockphoto) && ("undefined" != typeof stockphoto.core) && ("undefined" != typeof stockphoto.core.BoxCar) && ("undefined" != typeof stockphoto.core.BoxCar.AnalyzeXmlFileObj) && ("undefined" != typeof stockphoto.core.BoxCar.AnalyzeXmlFileObj.Partners) && ("undefined" != typeof stockphoto.core.BoxCar.AnalyzeXmlFileObj.Partners[0]) && ("undefined" != typeof stockphoto.core.BoxCar.AnalyzeXmlFileObj.Partners[0].EComPartners) && ("undefined" != typeof stockphoto.core.BoxCar.AnalyzeXmlFileObj.Partners[0].EComPartners[0]) && ("undefined" != typeof stockphoto.core.BoxCar.AnalyzeXmlFileObj.Partners[0].EComPartners[0].LoginURL) && ("undefined" != typeof stockphoto.core.BoxCar.AnalyzeXmlFileObj.Partners[0].EComPartners[0].LoginURL.Value) ) { if( 0 <= pathIn.indexOf( "//" + stockphoto.core.BoxCar.AnalyzeXmlFileObj.Partners[0].EComPartners[0].LoginURL.Value)) { return( true ); } } } return( false ); } // return true if there is already a Login-page other than "doc_id" stockphoto.eventHandler.pathAnalyzer.isThereLoginPage=function( doc_id ) { var iDocItr; if ( ( "undefined" != typeof app.documents) && ( "undefined" != typeof app.documents.length)) { for( iDocItr=0; iDocItr < app.documents.length; iDocItr++ ) { if( ( "undefined" != typeof app.documents[iDocItr])&& ( app.documents[iDocItr].id != doc_id )&& ( "undefined" != app.documents[iDocItr].thumbnail ) ) { if (("undefined" != typeof stockphoto) && ("undefined" != typeof stockphoto.core) && ("undefined" != typeof stockphoto.core.BoxCar) && ("undefined" != typeof stockphoto.core.BoxCar.AnalyzeXmlFileObj) && ("undefined" != typeof stockphoto.core.BoxCar.AnalyzeXmlFileObj.Partners) && ("undefined" != typeof stockphoto.core.BoxCar.AnalyzeXmlFileObj.Partners[0]) && ("undefined" != typeof stockphoto.core.BoxCar.AnalyzeXmlFileObj.Partners[0].EComPartners) && ("undefined" != typeof stockphoto.core.BoxCar.AnalyzeXmlFileObj.Partners[0].EComPartners[0]) && ("undefined" != typeof stockphoto.core.BoxCar.AnalyzeXmlFileObj.Partners[0].EComPartners[0].LoginURL) && ("undefined" != typeof stockphoto.core.BoxCar.AnalyzeXmlFileObj.Partners[0].EComPartners[0].LoginURL.Value) ) { if( ( 0 <= stockphoto.core.util.getDisplayPath(app.documents[iDocItr].thumbnail, " ").indexOf("//" + stockphoto.core.BoxCar.AnalyzeXmlFileObj.Partners[0].EComPartners[0].LoginURL.Value) )&& ( "web" == app.documents[iDocItr].thumbnail.displayMode) ) { return( true ); } } } } // for } return( false ); } // Given a path string in "pathIn", analyze it and return... // args.k=0: recent search root // 1-9:each recent search flder // if "bBMQuick"==true, it does not check GlinderState.xml and SearchRequest.xml // to confirm the recent search folder. // 10: Downloaded comp folder // 11: Purchased image folder // 12: unused - "searches/saved" // 13: unused - "searches/recent" // 14: BM Home // other value for non-BM path // args.specifier=path specifier or folder path // args.name =path identifier to pass to "SwitchMenu()" // args.DOSFldr =Platform specific folder path // args.kKeyWd =unescaped keyword (display-ready) associated with the folder // "bIsStartUp" is true if analyzing the startup folder (unused) stockphoto.eventHandler.pathAnalyzer.AnalyzingPath=function( pathIn, bBMQuick, bIsStartUp, doc, bUseCurrentSettings ) { if( ( stockphoto.eventHandler.pathAnalyzer.pathIn != pathIn )|| ( stockphoto.eventHandler.pathAnalyzer.doc_id != doc.id ) ) { stockphoto.eventHandler.pathAnalyzer.argOut = stockphoto.eventHandler.pathAnalyzer.SubAnalyzingPath( pathIn, bBMQuick, bIsStartUp, doc, bUseCurrentSettings ); stockphoto.eventHandler.pathAnalyzer.pathIn = pathIn; stockphoto.eventHandler.pathAnalyzer.doc_id = doc.id; if( stockphoto.DL.isAlreadyLoaded( stockphoto.DL.jsx_NavBar ) ) // if st11NavBar is loaded { if( stockphoto.NavIntDt_t[doc.id] != undefined ) { stockphoto.NavExtFnc.SpiningWheelOff( doc.id ); } } /*B*/ try /*B*/ { /*B*/ if( ( stockphoto.NavIntDt_t != undefined )&& /*B*/ ( stockphoto.NavIntDt_t[doc.id] != undefined ) ) /*B*/ { /*B*/ if( stockphoto.Burp.prevArgK[ doc.id ] == undefined ) /*B*/ stockphoto.Burp.prevArgK[ doc.id ] = -11; /*B*/ var prevK = stockphoto.Burp.prevArgK[ doc.id ]; /*B*/ if( prevK != stockphoto.eventHandler.pathAnalyzer.argOut.k ) /*B*/ { /*B*/ stockphoto.Burp.prevArgK[ doc.id ] = ( prevK = stockphoto.eventHandler.pathAnalyzer.argOut.k ); /*B*/ if( prevK == 14 ) /*B*/ { /*B*/ if( stockphoto.Burp.doIt ) // in AnalyzingPath(), looking ar args.k /*B*/ stockphoto.Burp.URLFilter( doc.id, stockphoto.core.html.urlForBMHome ); /*B*/ else stockphoto.Burp.delayedExec = 'stockphoto.Burp.URLFilter('+doc.id+', "'+stockphoto.core.html.urlForBMHome+'" );' /*B*/ } /*B*/ else /*B*/ { /*B*/ var subValue; /*B*/ switch( prevK ) { /*B*/ case 10: subValue = "Comps"; break; /*B*/ case 11: subValue = "Images"; break; /*B*/ case 13: subValue = "Searches"; break; /*B*/ default: subValue = ""; /*B*/ } /*B*/ if( subValue != "" ) /*B*/ { /*B*/ if( stockphoto.Burp.doIt ) // in AnalyzingPath(), looking ar args.k /*B*/ stockphoto.Burp.callSPSUI( doc.id, stockphoto.Burp.code_favorite, "item", subValue, "", "" ); /*B*/ else stockphoto.Burp.delayedExec = 'stockphoto.Burp.callSPSUI( '+doc.id+','+stockphoto.Burp.code_favorite+',"item","'+subValue+'","","" );'; /*B*/ } /*B*/ } /*B*/ } /*B*/ } /*B*/ } catch(e) { ; } }; return( stockphoto.eventHandler.pathAnalyzer.argOut ); } // New function to compare two directories. stockphoto.eventHandler.folderThumbAreEqual = function( path1, path2 ) { //returning <0:Not Equal, 0:Eactly equal, >0:FolderThumb1 contains FolderThumb2 var result=false, lev=0; var svLev, localFolderThumb1, p1, p2, FolderThumb1, FolderThumb2, bOk=0, r1=0; svLev = $.level; $.level = 0; try { FolderThumb1 = new Thumbnail( path1 ); bOk |= 1; } catch(e) { ; } try { FolderThumb2 = new Thumbnail( path2 ); bOk |= 2; } catch(e) { ; } $.level = svLev; if( ( bOk & 3 ) == 3 ) { var realFolderThumb2; if( FolderThumb2.path != stockphoto.core.util.getDisplayPath(FolderThumb2, "folderThumbAreEqual()-1") ) { svLev = $.level; $.level=0; try { realFolderThumb2 = new Thumbnail( File(stockphoto.core.util.getDisplayPath(FolderThumb2, "folderThumbAreEqual()-2")) ); } catch(e) { $.level=svLev; return -1; } $.level=svLev; r1 = 1; } else { realFolderThumb2 = FolderThumb2; } svLev = $.level; $.level=0; try { localFolderThumb1 = new Thumbnail( FolderThumb1 ); } catch(e) { $.level=svLev; return -1; } $.level=svLev; while( true ) { if( localFolderThumb1 instanceof Thumbnail ) { if ("yes" == stockphoto.core.log.DebugINIData.Watson1290901) { // START - Workaround for Watson bug #1290901 // This workaround code should be removed when Bridge fixes this issue. if ( ( localFolderThumb1.spec != undefined ) && ( realFolderThumb2.spec != undefined ) && ( localFolderThumb1.spec.toString() == realFolderThumb2.spec.toString() ) ) { result = true; break; } // END - Workaround for Watson bug #1290901 } else { // Watson : 1328724 if (("undefined" != typeof localFolderThumb1.path) && ("undefined" != typeof realFolderThumb2.path)) { if( localFolderThumb1.path.toUpperCase() == realFolderThumb2.path.toUpperCase() ) { result = true; break; } } } } else { // parent can not be checked result = false; break; } lev++; if( localFolderThumb1.parent != undefined ) { var tempThumb = localFolderThumb1; // move up to next level of hierarchy svLev = $.level; $.level=0; try { localFolderThumb1 = new Thumbnail( tempThumb.parent ); } catch(e) { $.level=svLev; delete tempThumb; return -1; } $.level=svLev; delete tempThumb; } else { // root has no parent result = false; break; } } // while if( r1 != 0 ) delete realFolderThumb2; delete localFolderThumb1; delete FolderThumb1; delete FolderThumb2; if( ! result ) return( -1 ); return( lev ); } if( ( bOk & 1 ) != 0 ) delete FolderThumb1; if( ( bOk & 2 ) != 0 ) delete FolderThumb2; p1 = path1.toUpperCase(); p2 = path2.toUpperCase(); if( p1 == p2 ) { return( 0 ); } // p1 contains p2 if( p1.indexOf( p2 ) >= 0 ) { return( 1 ); } return( -1 ); } //Fix to bug - Watson: 1172046 stockphoto.eventHandler.handleDuplicateLoginPage = function(doc_id) { var doc = stockphoto.core.findDoc( doc_id ); if ( "undefined" != typeof doc ) { doc.thumbnail = new Thumbnail("stockphoto://home"); } } stockphoto.eventHandler.pathAnalyzer.SubAnalyzingPath=function( pathIn, bBMQuick, bIsStartUp, doc, bUseCurrentSettings ) { var ii, kk, doc_id, fsSpecifier, OSPathSpecifier="", UOSPathSpecifier, fPath, MySearchesFolder, wukwd; var bRet={ k:15, kKeyWd:"", specifier:"", name:"", DOSfldr:"" }, path1; // we need to save doc because this routine is called before app.documents[] is updated if( doc.id == undefined ) { return( bRet ); } doc_id = doc.id; if( stockphoto.core.log.DebugINIData.log != undefined ) stockphoto.core.log.logString( 0, "\neventHandler.pathAnalyzer.AnalyzingPath( pathIn="+pathIn+", " +"\n bBMQuick="+bBMQuick+", bIsStartUp="+bIsStartUp+", doc's id="+doc_id ); if( stockphoto.documents[doc_id] == undefined ) { stockphoto.documents[doc_id] = new stockphoto.core.Context( doc ); } var UOSPathMyCompFolder = ( File(stockphoto.core.folder.getMyCompFolder()).fsName ).toUpperCase(); var UOSPathPurchaseFolder = ( File(stockphoto.core.folder.getMyPurchasesFolder()).fsName ).toUpperCase(); var UOSPathShoppingCart = ( File(stockphoto.core.folder.getMyShoppingCartFolder()).fsName ).toUpperCase(); MySearchesFolder = stockphoto.core.folder.getMySearchesFolder(); if( stockphoto.core.BoxCar.NavBar.GetPreviousSearchFolder( doc_id ) != MySearchesFolder ) { if( ( MySearchesFolder != undefined )&&( MySearchesFolder != "" ) ) { stockphoto.core.BoxCar.NavBar.SetPreviousSearchFolder( MySearchesFolder, doc_id ); stockphoto.core.BoxCar.NavBar.SetRecentSearchFolder( ( Folder( MySearchesFolder ).fsName ).toUpperCase(), doc_id ); }; }; if( pathIn.substr(0, stockphoto.core.html.LengthOfUrlForBMHome) == stockphoto.core.html.urlForBMHome ) { bRet.specifier = "home"; } else { kk = pathIn.indexOf(":///"); // We want to strip ":///" only when it is a part of "xxx:file:///C:/yyy" // because "/C:/yyy" crashes the new Thumbnail() operation. if( ( stockphoto.isWin )&&( kk >= 0 )&&( pathIn.charAt( kk+5 ) == ":" ) ) { bRet.specifier = pathIn.substr( kk + 4 ); } else { kk = pathIn.indexOf("://"); if( kk >= 0 ) { bRet.specifier = pathIn.substr( kk + 3 ); } else { bRet.specifier = pathIn; } } }; switch( pathIn ) { case "stockphoto://recent": bRet.k=0; stockphoto.core.BoxCar.NavBar.SetRecentFolder( stockphoto.core.folder.getMySearchesFolder(), doc_id ); break; case "stockphoto://comps": bRet.k=10; stockphoto.core.BoxCar.NavBar.SetRecentFolder( stockphoto.core.folder.getMyCompFolder(), doc_id ); break; case "stockphoto://purchases": bRet.k=11; stockphoto.core.BoxCar.NavBar.SetRecentFolder( stockphoto.core.folder.getMyPurchasesFolder(), doc_id ); break; case "stockphoto://searches/saved": bRet.k=12; stockphoto.core.BoxCar.NavBar.SetRecentFolder( "", doc_id ); break; case "stockphoto://searches/recent": bRet.k=13; stockphoto.core.BoxCar.NavBar.SetRecentFolder( MySearchesFolder, doc_id ); break; case "stockphoto://home": bRet.k=14; stockphoto.core.BoxCar.NavBar.SetRecentFolder( "", doc_id ); bRet.specifier = "DISPLAYS"; break; case "stockphoto://shoppingcart": bRet.k=14; stockphoto.core.BoxCar.NavBar.SetRecentFolder( "", doc_id ); bRet.name = "ST14_SHopp"; break; default: bRet.k=15; stockphoto.core.BoxCar.NavBar.SetRecentFolder( "", doc_id ); // no constant }; stockphoto.core.BoxCar.NavBar.SetInTheHPLoadError( false, doc_id ); fsSpecifier = File( bRet.specifier ); OSPathSpecifier = fsSpecifier.fsName; UOSPathSpecifier = OSPathSpecifier.toUpperCase(); // if (bUseCurrentSettings != true) // false or undefined { stockphoto.search.showPreviousSettings[doc.id] = false; } if( bBMQuick ) { if( stockphoto.eventHandler.pathAnalyzer.customIndexOf( bRet.specifier, 1 ) ) { bRet.k = 1; var realParent; var svLev,thumb4specifier; svLev=$.level; $.level=0; try { thumb4specifier = new Thumbnail( File(bRet.specifier) ); } catch(e) { return( bRet ); $.level=svLev; } $.level=svLev; if ( thumb4specifier.parent != undefined ) { if( thumb4specifier.parent.path != stockphoto.core.util.getDisplayPath(thumb4specifier.parent, " ") ) { svLev=$.level; $.level=0; try { realParent = new Thumbnail( File(stockphoto.core.util.getDisplayPath(thumb4specifier.parent," ")) ); } catch(e) { return( bRet ); $.level=svLev; } $.level=svLev; } else { realParent = thumb4specifier.parent; } if( ! stockphoto.core.menu.isInFolderHierarchy( realParent, stockphoto.places.recentSearches ) ) { bRet.k = 0; // recent search folder itself } } } else if( stockphoto.eventHandler.pathAnalyzer.customIndexOf( bRet.specifier, 2 ) ) { bRet.k = 10; } else if( stockphoto.eventHandler.pathAnalyzer.customIndexOf( bRet.specifier, 3 ) ) { bRet.k = 11; } else if( stockphoto.eventHandler.pathAnalyzer.isShoppingCart( fsSpecifier, OSPathSpecifier ) ) { // in case we are given the complete url to shopping cart bRet.k = 14; } }; if (bRet.name.length == 0) { bRet.name = bRet.specifier+bRet.specifier; } // specified above, it is a path like "\Documents and Settings\....\Recent Searches\marse" if( bRet.k == 15 ) { // Two folders are compared using the new function folderThumbAreEqual() var path1 = File( bRet.specifier ).fsName; var compResult = stockphoto.eventHandler.folderThumbAreEqual( path1, stockphoto.core.BoxCar.NavBar.GetRecentSearchFolder( doc_id ) ); if( compResult == 0 ) { bRet.k = 0; bRet.name = "ST20_GS"; bRet.kKeyWd = ""; } else { var resultPrevSearch = stockphoto.eventHandler.folderThumbAreEqual( unescape(path1), stockphoto.core.BoxCar.NavBar.GetRecentSearchFolder( doc_id ) + "&"); var resultComp = stockphoto.eventHandler.folderThumbAreEqual( unescape(path1), stockphoto.core.folder.getMyCompFolder() + "&"); var resultHiRez = stockphoto.eventHandler.folderThumbAreEqual( unescape(path1), stockphoto.core.folder.getMyPurchasesFolder() + "&"); if (resultPrevSearch > 0 || (resultComp > 0) || (resultHiRez > 0)) { bRet.name = "ST20_GS"; bRet.kKeyWd = ""; if(resultPrevSearch > 0) bRet.k = 0; else if(resultComp > 0) bRet.k = 10; else bRet.k = 11; } else if( compResult > 0 ) { bRet.k = 0; bRet.name = "ST03_BB"; bRet.kKeyWd = ""; var kFsXML = new File( path1+"/CACHE/searchRequest.xml" ); // // For reading the search settings from previous search folder... // Set defaultSettings autoOpen value from app.preferences... var bAutoOpen = stockphoto.DL.getAdvSearchAutoOpenPref(); // autoOpen won't be in sync if this is the first folder opened in ASP.. if (bAutoOpen != stockphoto.search.defaultSettings.autoOpen) { stockphoto.search.defaultSettings.autoOpen = bAutoOpen; } var oSettings = eval(stockphoto.search.defaultSettings.toSource()); var oXmlSettingsObj = new stockphoto.core.BoxCar.AnalyzeXmlFile( kFsXML, stockphoto.seachRequestKeys ); oSettings = stockphoto.DL.NavBar.ParseAdvSettingsFromXmlObj(oXmlSettingsObj, oSettings); delete oXmlSettingsObj; var oFSObj = new File( path1+"/CACHE/SearchInfo.txt" ); if ((oFSObj != undefined) && (oFSObj.exists == true)) { oFSObj.encoding = 'UTF-16'; // To support all locales correctly oSettings = stockphoto.DL.NavBar.ParseAdvCollectionsFromFSObj( oFSObj, oSettings ); } // Set the isDefault parameter of search settings oSettings = stockphoto.DL.NavBar.setIsDefault( doc.id, oSettings ); stockphoto.search.previousSettings[doc.id] = oSettings; if (bUseCurrentSettings != true) // false or undefined { stockphoto.search.showPreviousSettings[doc.id] = true; } // // Read the simplified keyword... stockphoto.search.searchKeyword[doc.id] = ""; var arSimplifiedKeyword = stockphoto.DL.search.LoadSearchInfoFromFS(oFSObj, '[SimplifiedKeyword]'); if ((arSimplifiedKeyword != undefined) && (arSimplifiedKeyword.length > 0)) { stockphoto.search.searchKeyword[doc.id] = arSimplifiedKeyword[0]; } // Read the keyword... var arKeyword = stockphoto.DL.search.LoadSearchInfoFromFS(oFSObj, '[OriginalKeyword]'); if ((arKeyword != undefined) && (arKeyword.length > 0)) { bRet.kKeyWd = arKeyword[0]; } delete oFSObj; // If Keyword still hasn't been found... if( bRet.kKeyWd == "" ) { if( kFsXML != undefined ) { if( kFsXML.exists ) { if( kFsXML.open() ) { var kRecXML = kFsXML.read(); if( kRecXML != undefined ) { var kk = kRecXML.indexOf( ' 0 ) { if( ( bRet.specifier ).charAt( ii ) == '\\' ) { bRet.specifier = ( bRet.specifier ).substr( 0, ii ); } }; }; // Add to prohibit displaying the second shopping cart -BEG- if( bRet.k == 14 ) { if( stockphoto.eventHandler.pathAnalyzer.isThereShoppingCart( doc_id ) ) { stockphoto.core.BoxCar.NavBar.SetRecentFolder( "", doc_id ); bRet.name = bRet.specifier = "DISPLAYS"; } } // Add to prohibit displaying the second shopping cart -END- if( stockphoto.core.log.DebugINIData.log != undefined ) stockphoto.core.log.logString( 0, "AnalyzingPath->args{ k="+bRet.k+" specifier="+bRet.specifier +"\n name ="+bRet.name +"\n kKeyWd ="+bRet.kKeyWd +"\n DOSfldr="+bRet.DOSfldr ); //Fix to bug - Watson: 1172046 // Added to prevent displaying the second Login Page if( ( 15 == bRet.k )&& ( stockphoto.eventHandler.pathAnalyzer.isLoginpage(pathIn) ) ) { if( stockphoto.eventHandler.pathAnalyzer.isThereLoginPage( doc_id ) ) { app.scheduleTask("stockphoto.eventHandler.handleDuplicateLoginPage("+ doc.id + ");",100,false); } } // Watson : 1249207, 1208398 // If page is of Adobe Stock Photos family but not Home page or it is NoConnection page if( ( 15 == bRet.k ) && ((( pathIn.indexOf( stockphoto.core.html.urlForBMHPFamily ) >= 0 ) && ( pathIn.indexOf( stockphoto.core.html.urlForBMHome ) < 0 )) || (pathIn.indexOf("webpagefailed")>=0) ) ) { bRet.specifier = "DISPLAYS"; bRet.name = "HOME_OTHER"; bRet.k = 14; } return( bRet ); } // Given "path", obtain x and y value of "xOfy" and set them into // Nav bar's internal data structure stockphoto.eventHandler.pathAnalyzer.ResetCurrentXoyY=function( path, args, doc_id ) { var xx=-1, yy=-1, lbl="unknown", FolderObj; if( ( stockphoto.DL.demandJsxLoading( stockphoto.DL.jsx_NavBar ) )&& ( stockphoto.DL.demandJsxLoading( stockphoto.DL.jsx_HTMUtil ) ) ) { FolderObj = Folder( path ); stockphoto.NavExtFnc.GetFolderAndNumbers_NEW( FolderObj, doc_id, false, "pathAnalyzer.ResetCurrentXoyY" ); xx = stockphoto.NavExtFnc.CountNoOfFiles( path, "*.jpg" ); yy = stockphoto.NavExtFnc.getTotalImageCount( path ); stockphoto.DL.NavBar.updateXofY( "show", ""+xx, ""+yy, "refresh", doc_id, -1, "eventHandler.pathAnalyzer.ResetCurrentXoyY - refresh" ); // in stockphoto.eventHandler.pathAnalyzer.ResetCurrentXoyY() if( args.name != undefined ) { lbl = ( args.name ).toUpperCase(); if( ( lbl != "ST03_BB" )&&( lbl != "ST20_GS" )&& ( lbl != "FILE:///ST03_BB" )&&( lbl != "FILE:///ST20_GS" ) ) { stockphoto.NavExtFnc.ProgressGIFOn( doc_id ); } }; }; if( stockphoto.core.log.DebugINIData.log != undefined ) stockphoto.core.log.logString( 0, "stockphoto.eventHandler.pathAnalyzer.ResetCurrentXofY( path="+path +"\n args.name="+args.name +" doc_id="+doc_id+") -> xx="+xx+" yy="+yy+" lbl="+lbl ); } // The following functions are sometimes called before document object is ready. // Hence, if document is not ready, we need to delay the process by submitting // it to Bridge queue. Since we can not push an object into queue, we decompose // each component of object. This subroutine reconstruct the original object // in the delayed process stockphoto.eventHandler.pathAnalyzer.CombineKeysToArgsObj=function( k, kKeyWd, specifier, name, DOSfldr ) { var args={}; args.k =k; args.kKeyWd =kKeyWd; args.specifier=specifier; args.name =name; args.DOSfldr =DOSfldr; return( args ); } // It processes the case when we are given a unknown folder and we could // extract the previous search keyword by looking at the searchrequest.xml // in its sub folder CACHE. stockphoto.eventHandler.pathAnalyzer.doWhenKeyWordFound=function( k, escaped_kKeyWd, escaped_specifier, escaped_name, escaped_DOSfldr, doc_id ) { // KeyWord is found: specifier, kKeyWd var args={}; var doc; if( ( stockphoto.documents[ doc_id ] == undefined )|| ( stockphoto.documents[ doc_id ].document == undefined ) ) { app.scheduleTask( "stockphoto.eventHandler.pathAnalyzer.doWhenKeyWordFound("+k+", '"+escaped_kKeyWd+"', '"+escaped_specifier+"', '"+escaped_name+"', '"+escaped_DOSfldr+"', "+doc_id+" )", 500, false ); } else { doc = stockphoto.documents[ doc_id ].document; if( ( stockphoto.core.init.loadBMScripts() )&& ( stockphoto.DL.demandJsxLoading( stockphoto.DL.jsx_NavBar ) ) ) { // name ="ST03_BB"; is already set in AnalyzePath // Now we know {folder,keyword} is stored in {specifier,kKeyWd). // The follwing code can be shared with subroutine code // in search, search from getImageDetail, and promotion searhch var unescaped_KeyWd = unescape( escaped_kKeyWd ); var specifier = unescape( escaped_specifier ); var name = unescape( escaped_name ); var DOSfldr = unescape( escaped_DOSfldr ); ik = stockphoto.NavExtFnc.SetFolderAndKey( specifier, unescaped_KeyWd /* unescaped */, doc_id ); stockphoto.NavExtFnc.SetPreviousKeyIndex( ik, doc_id ); stockphoto.NavExtFnc.SetRecent_s_Folder( ik, doc_id ); if( stockphoto.core.log.DebugINIData.log != undefined ) stockphoto.core.log.logString( 0, "-- pathAnalyzer.doWhenKeyWordFound( k="+k+" unescaped_KeyWd="+unescaped_KeyWd+" specifier="+specifier+" name="+name+" DOSfldr="+DOSfldr+" doc_id="+doc_id+" / ik="+ik+" )" ); args = stockphoto.eventHandler.pathAnalyzer.CombineKeysToArgsObj( k, unescaped_KeyWd, specifier, name, DOSfldr ); stockphoto.eventHandler.pathAnalyzer.ResetCurrentXoyY( specifier, args, doc_id ); /* The following stockphoto.NavExtFnc.addBMNavBar() is used for the folder w/ search key in stead of SwitchNavBar() */ if( stockphoto.NavExtFnc.addBMNavBar( args, 1, doc ) ) // NavBar is loaded { stockphoto.eventHandler.pathAnalyzer.PostProcessOfAnalyzedPath( true, doc_id ); if (stockphoto.eventHandler.displayStartPage.scheduled > 0) { // Watson: 1321028 var task = "stockphoto.eventHandler.pathAnalyzer.doWhenKeyWordFound(" + k + ",'" + escaped_kKeyWd + "','" + escaped_specifier + "','" + escaped_name + "','" + escaped_DOSfldr + "'," + doc_id + ")"; stockphoto.eventHandler.displayStartPage.altTask = task; } } }; }; return( false ); } // It processes the case where we go to BM's sub folder but failed to extract // previous keyword from searchrequest.xml, and we need to get the keyword // from folder name. stockphoto.eventHandler.pathAnalyzer.doBMSearchFolder=function( k, escaped_kKeyWd, escaped_specifier, escaped_name, escaped_DOSfldr, doc_id ) { var args={}; var doc; if( ( stockphoto.documents[ doc_id ] == undefined )|| ( stockphoto.documents[ doc_id ].document == undefined ) ) { app.scheduleTask( "stockphoto.eventHandler.pathAnalyzer.doBMSearchFolder("+k+", '"+escaped_kKeyWd+"', '"+escaped_specifier+"', '"+escaped_name+"', '"+escaped_DOSfldr+"', "+doc_id+" )", 500, false ); } else { doc = stockphoto.documents[ doc_id ].document; if( stockphoto.core.log.DebugINIData.log != undefined ) stockphoto.core.log.logString( 0, "-- pathAnalyzer.doBMSearchFolder( k="+k+" kKeyWd="+kKeyWd+" specifier="+specifier+" name="+name+" DOSfldr="+DOSfldr+" doc_id="+doc_id+" )" ); if( stockphoto.core.init.loadBMScripts() ) { var kKeyWd = unescape( escaped_kKeyWd ); var specifier = unescape( escaped_specifier ); var name = unescape( escaped_name ); var DOSfldr = unescape( escaped_DOSfldr ); args = stockphoto.eventHandler.pathAnalyzer.CombineKeysToArgsObj( k, kKeyWd, specifier, name, DOSfldr ); if( name != "ST20_GS" ) { var path = stockphoto.core.BoxCar.NavBar.GetRecentFolder( doc_id ); if( ( path != undefined )&&( path != "" ) ) { stockphoto.eventHandler.pathAnalyzer.ResetCurrentXoyY( path, args, doc_id ); } }; if( stockphoto.DL.NavBar.addBMNavBar( args, 1, doc ) ) // Search folder { stockphoto.eventHandler.pathAnalyzer.PostProcessOfAnalyzedPath( true, doc_id ); if (stockphoto.eventHandler.displayStartPage.scheduled > 0) { var task = "stockphoto.eventHandler.pathAnalyzer.doBMSearchFolder(" + k + ",'" + escaped_kKeyWd + "','" + escaped_specifier + "','" + escaped_name + "','" + escaped_DOSfldr + "'," + doc_id + ")"; stockphoto.eventHandler.displayStartPage.altTask = task; } } }; }; } // This is for other BM folders such as "Downloaded Comp" and "Purchased" folder stockphoto.eventHandler.pathAnalyzer.doBMOtherFolders=function( k, escaped_kKeyWd, escaped_specifier, escaped_name, escaped_DOSfldr, doc_id ) { var args={}; var doc; if( ( stockphoto.documents[ doc_id ] == undefined )|| ( stockphoto.documents[ doc_id ].document == undefined ) ) { app.scheduleTask( "stockphoto.eventHandler.pathAnalyzer.doBMOtherFolders("+k+", '"+escaped_kKeyWd+"', '"+escaped_specifier+"', '"+escaped_name+"', '"+escaped_DOSfldr+"', "+doc_id+" )", 500, false ); } else { doc = stockphoto.documents[ doc_id ].document; if( stockphoto.core.log.DebugINIData.log != undefined ) stockphoto.core.log.logString( 0, "-- pathAnalyzer.doBMOtherFolders( k="+k+" kKeyWd="+kKeyWd+" specifier="+specifier+" name="+name+" DOSfldr="+DOSfldr+" doc_id="+doc_id+" )" ); if( stockphoto.core.init.loadBMScripts() ) { var kKeyWd = unescape( escaped_kKeyWd ); var specifier = unescape( escaped_specifier ); var name = unescape( escaped_name ); var DOSfldr = unescape( escaped_DOSfldr ); args = stockphoto.eventHandler.pathAnalyzer.CombineKeysToArgsObj( k, kKeyWd, specifier, name, DOSfldr ); if( stockphoto.DL.NavBar.addBMNavBar( args, 1, doc ) ) // doBMOtherFolders { stockphoto.eventHandler.pathAnalyzer.PostProcessOfAnalyzedPath( true, doc_id ); if (stockphoto.eventHandler.displayStartPage.scheduled > 0) { var task = "stockphoto.eventHandler.pathAnalyzer.doBMOtherFolders(" + k + ",'" + escaped_kKeyWd + "','" + escaped_specifier + "','" + escaped_name + "','" + escaped_DOSfldr + "'," + doc_id + ")"; stockphoto.eventHandler.displayStartPage.altTask = task; } } }; }; } // This is for the case that we are to move to shopping cart folder, or // about to display shopping cart. stockphoto.eventHandler.pathAnalyzer.doBMShoppingCart=function( doc_id ) { return; // do not handle shopping cart in event handler. It caused stockphoto.DL.doShoppingCart() be called twice. var doc; if( ( stockphoto.documents[ doc_id ] == undefined )|| ( stockphoto.documents[ doc_id ].document == undefined ) ) if( doc == undefined ) { app.scheduleTask( "stockphoto.eventHandler.pathAnalyzer.doBMShoppingCart("+doc_id+")", 500, false ); } else { doc = stockphoto.documents[ doc_id ].document; if( stockphoto.core.log.DebugINIData.log != undefined ) stockphoto.core.log.logString( 0, "-- pathAnalyzer.doBMShoppingCart( k="+k+" kKeyWd="+kKeyWd+" specifier="+specifier+" name="+name+" DOSfldr="+DOSfldr+" doc_id="+doc_id+" )" ); if( stockphoto.core.init.loadBMScripts() ) { stockphoto.DL.doShoppingCart( doc_id ); }; }; } // This is to display BM's Home page stockphoto.eventHandler.pathAnalyzer.doBMHomePage=function( k, escaped_kKeyWd, escaped_specifier, escaped_name, escaped_DOSfldr, doc_id ) { var args={}; var doc; if( ( stockphoto.documents[ doc_id ] == undefined )|| ( stockphoto.documents[ doc_id ].document == undefined ) ) { app.scheduleTask( "stockphoto.eventHandler.pathAnalyzer.doBMHomePage("+k+", '"+escaped_kKeyWd+"', '"+escaped_specifier+"', '"+escaped_name+"', '"+escaped_DOSfldr+"', "+doc_id+" )", 500, false ); } else { doc = stockphoto.documents[ doc_id ].document; if( stockphoto.core.log.DebugINIData.log != undefined ) stockphoto.core.log.logString( 0, "-- pathAnalyzer.doBMHomePage( k="+k+" kKeyWd="+kKeyWd+" specifier="+specifier+" name="+name+" DOSfldr="+DOSfldr+" doc_id="+doc_id+" )" ); if( stockphoto.core.init.loadBMScripts() ) { var kKeyWd = unescape( escaped_kKeyWd ); var specifier = unescape( escaped_specifier ); var name = unescape( escaped_name ); var DOSfldr = unescape( escaped_DOSfldr ); args = stockphoto.eventHandler.pathAnalyzer.CombineKeysToArgsObj( k, kKeyWd, specifier, name, DOSfldr ); stockphoto.eventHandler.pathAnalyzer.PostProcessOfAnalyzedPath( true, doc_id ); stockphoto.eventHandler.displayStartPage.scheduled++; // Watson : 1249207 // If page is of Adobe Stock Photos family but not Home page if ( "HOME_OTHER" != args.name) { app.scheduleTask( "stockphoto.displayStartPage("+doc_id+");", 100, false ); // Fixing 1126700 } }; }; } // - a path of shoppingcart htm file is given as the destination // - stockphoto://nothing is given as the destination // - we are in the eCom page stockphoto.eventHandler.pathAnalyzer.doNonBMFileAndFolder=function( k, escaped_kKeyWd, escaped_specifier, escaped_name, escaped_DOSfldr, doc_id ) { var args={}; var doc; if( ( stockphoto.documents[ doc_id ] == undefined )|| ( stockphoto.documents[ doc_id ].document == undefined ) ) { app.scheduleTask( "stockphoto.eventHandler.pathAnalyzer.doNonBMFileAndFolder("+k+", '"+escaped_kKeyWd+"', '"+escaped_specifier+"', '"+escaped_name+"', '"+escaped_DOSfldr+"', "+doc_id+" )", 500, false ); } else { doc = stockphoto.documents[ doc_id ].document; if( stockphoto.core.log.DebugINIData.log != undefined ) stockphoto.core.log.logString( 0, "-- pathAnalyzer.doNonBMFileAndFolder( k="+k+" kKeyWd="+kKeyWd+" specifier="+specifier+" name="+name+" DOSfldr="+DOSfldr+" doc_id="+doc_id+" )" ); { var kKeyWd = unescape( escaped_kKeyWd ); var specifier = unescape( escaped_specifier ); var name = unescape( escaped_name ); var DOSfldr = unescape( escaped_DOSfldr ); args = stockphoto.eventHandler.pathAnalyzer.CombineKeysToArgsObj( k, kKeyWd, specifier, name, DOSfldr ); var bSC=false, fSpec=File( specifier ); var wSpec=fSpec.fsName; if( ( wSpec.toUpperCase() ) == ( ( File(stockphoto.core.folder.getMyShoppingCartFolder()).fsName ).toUpperCase() ) ) { bSC = true; } else { var pSpec = ( File( fSpec.path ) ).fsName; if( ( ( pSpec.toUpperCase() ) == ( ( File(stockphoto.core.folder.getMyShoppingCartFolder()).fsName ).toUpperCase() ) )&& ( ( ( fSpec.name ).toUpperCase() ) == "ST14SHOPPINGCART.HTM" ) ) { bSC = true; } }; if( ( bSC )|| ( ( ( specifier ).toUpperCase() ) == "NOTHING" )|| ( ( ( specifier ).toUpperCase() ) == "SCFOOTER" )) { if( stockphoto.eventHandler.pathAnalyzer.isThereShoppingCart( doc_id ) ) { stockphoto.eventHandler.pathAnalyzer.doBMHomePage( 14, escaped_kKeyWd, escaped_specifier, escaped_name, escaped_DOSfldr, doc_id ); } else { args.name = "ST14_SHOPPINGCART"; if( stockphoto.DL.demandJsxLoading( stockphoto.DL.jsx_NavBar ) ) { if( stockphoto.DL.NavBar.addBMNavBar( args, 1, doc ) ) // "ShoppingCart"/"ScFoter" { stockphoto.eventHandler.pathAnalyzer.PostProcessOfAnalyzedPath( true, doc_id ); } } } return; }; if( stockphoto.core.BoxCar.NavBar.GetInECOMFlag( doc_id ) ) { args.name = "IMPL.CHECKOUT"; if( stockphoto.DL.demandJsxLoading( stockphoto.DL.jsx_NavBar ) ) { if( stockphoto.DL.NavBar.addBMNavBar( args, 1, doc ) ) // in eCom { stockphoto.eventHandler.pathAnalyzer.PostProcessOfAnalyzedPath( true, doc_id ); } } return; }; stockphoto.eventHandler.pathAnalyzer.PostProcessOfAnalyzedPath( false, doc_id ); if (stockphoto.eventHandler.displayStartPage.scheduled > 0) { var task = "stockphoto.eventHandler.pathAnalyzer.doNonBMFileAndFolder(" + k + ",'" + escaped_kKeyWd + "','" + escaped_specifier + "','" + escaped_name + "','" + escaped_DOSfldr + "'," + doc_id + ")"; stockphoto.eventHandler.displayStartPage.altTask = task; } } } } // Given the result of analysis of the path, further processing is done // in this function when the path belong to BM. stockphoto.eventHandler.pathAnalyzer.ProcessAnalyzedPath=function( bRetFromAnalyzePath, doc ) { var ik, arg_k, arg_kKeyWd, arg_specifier, arg_name, arg_DOSfldr; var escaped_kKeyWd, escaped_specifier, escaped_name, escaped_DOSfldr; var bRet={ handled:true, topNavBar:false, btmNavBar:false }; var doc_id=doc.id; if( ( bRetFromAnalyzePath.k >= 0 )&& ( bRetFromAnalyzePath.k < 15 ) ) { stockphoto.DL.NavBar.PrepareNavBar( doc_id ); } // and we got the associated key if( doc != undefined ) { if( doc.browserMode == "compact" ) { stockphoto.core.BoxCar.NavBar.SetIsCompactFlag( 2, doc_id, 0 ); } else { stockphoto.core.BoxCar.NavBar.SetIsCompactFlag( 1, doc_id, 0 ); } }; if( bRetFromAnalyzePath.k == undefined ) { arg_k = 15; } else { arg_k = bRetFromAnalyzePath.k; } if( bRetFromAnalyzePath.kKeyWd == undefined ) { arg_kKeyWd = ""; } else { arg_kKeyWd = bRetFromAnalyzePath.kKeyWd; } if( bRetFromAnalyzePath.specifier == undefined ) { arg_specifier = ""; } else { arg_specifier = bRetFromAnalyzePath.specifier; } if( stockphoto.DL.isAlreadyLoaded( stockphoto.DL.jsx_NavBar ) ) { stockphoto.NavExtFnc.SetStartUpFolder( arg_specifier ); } if( bRetFromAnalyzePath.name == undefined ) { arg_name = arg_specifier+arg_specifier; } else { arg_name = bRetFromAnalyzePath.name; } if( bRetFromAnalyzePath.DOSfldr == undefined ) { arg_DOSfldr = ""; } else { arg_DOSfldr = bRetFromAnalyzePath.DOSfldr; } escaped_kKeyWd = escape( arg_kKeyWd ); escaped_specifier = escape( arg_specifier ); escaped_name = escape( arg_name ); escaped_DOSfldr = escape( arg_DOSfldr ); if( bRetFromAnalyzePath.kKeyWd != "" ) { // it is one of RecentSearch, kKeyWd has a keyword stockphoto.eventHandler.pathAnalyzer.doWhenKeyWordFound( arg_k, escaped_kKeyWd, escaped_specifier, escaped_name, escaped_DOSfldr, doc_id ); } else if( bRetFromAnalyzePath.k == 14 ) { // "shoppingcart" or "home" if( ( bRetFromAnalyzePath.name == "ST14_SHopp" ) ) { if( stockphoto.eventHandler.pathAnalyzer.doShoppingCart ) { stockphoto.eventHandler.pathAnalyzer.doBMShoppingCart( doc_id ); } } else { stockphoto.eventHandler.pathAnalyzer.doBMHomePage( arg_k, escaped_kKeyWd, escaped_specifier, escaped_name, escaped_DOSfldr, doc_id ); }; } else if( ( bRetFromAnalyzePath.k>=10 )&&( bRetFromAnalyzePath.k<14 ) ) { // Comps|Purchase|Searches/saved|Searches/Recent stockphoto.eventHandler.pathAnalyzer.doBMOtherFolders( arg_k, escaped_kKeyWd, escaped_specifier, escaped_name, escaped_DOSfldr, doc_id ); } else if( bRetFromAnalyzePath.k < 10 ) { // Searches/Recent/* stockphoto.eventHandler.pathAnalyzer.doBMSearchFolder( arg_k, escaped_kKeyWd, escaped_specifier, escaped_name, escaped_DOSfldr, doc_id ); } else { if( bRetFromAnalyzePath.k >= 15 ) { stockphoto.eventHandler.pathAnalyzer.doNonBMFileAndFolder( arg_k, escaped_kKeyWd, escaped_specifier, escaped_name, escaped_DOSfldr, doc_id ); } bRet.handled = false; }; return( bRet ); } // After processing the result of pathAnalyzer.AnalyzingPath() in pathAnalyzer.PostProcessOfAnalyzedPath() // finalizes the process. stockphoto.eventHandler.pathAnalyzer.PostProcessOfAnalyzedPath=function( bTop, doc_id ) { var doc; if( stockphoto.core.log.DebugINIData.log != undefined ) stockphoto.core.log.logString( 0, "stockphoto.eventHandler.pathAnalyzer.PostProcessOfAnalyzedPath( bTop="+bTop+" doc_id="+doc_id+" )" ); if( ( stockphoto.DL.isAlreadyLoaded( stockphoto.DL.jsx_NavBar ) )&& ( stockphoto.documents[ doc_id ] != undefined )&& ( stockphoto.documents[ doc_id ].document != undefined )&& ( stockphoto.core.BoxCar.NavBar.GetIsCompactFlag( doc_id, 0 ) != 2 )&& ( stockphoto.documents[ doc_id ].document.topNavbar != undefined ) ) { doc = stockphoto.documents[ doc_id ].document; if( ! bTop ) { stockphoto.eventHandler.pathAnalyzer.ChangeNavVisiblity( doc, false, "stockphoto.eventHandler.pathAnalyzer.PostProcessOfAnalyzedPath #1" ); } else { stockphoto.eventHandler.pathAnalyzer.ChangeNavVisiblity( doc, true, "stockphoto.eventHandler.pathAnalyzer.PostProcessOfAnalyzedPath #2" ); }; }; } // ---------------------------------------------------------------------------- // The function set up Nav bar for the startup folder. stockphoto.eventHandler.StartUpFolder.ProcessStartUpFolder=function( doc_id ) { // tried to locate to one of BM folder and display Nav bar // even currently doc is not defined var bRet={}; var doc; if( ( stockphoto.documents[ doc_id ] != undefined )&& ( stockphoto.documents[ doc_id ].document != undefined )&& ( stockphoto.core.BoxCar.NavBar.GetIsCompactFlag( doc_id, 0 ) != 2 ) ) { doc = stockphoto.documents[ doc_id ].document; stockphoto.eventHandler.StartUpFolder.args.specifier = unescape( stockphoto.eventHandler.StartUpFolder.args.specifier ); bRet = stockphoto.eventHandler.pathAnalyzer.ProcessAnalyzedPath( stockphoto.eventHandler.StartUpFolder.args, doc ); if( bRet.topNavBar ) { stockphoto.eventHandler.pathAnalyzer.ChangeNavVisiblity( doc, true, "stockphoto.eventHandler.StartUpFolder.ProcessStartUpFolder" ); } } else { app.scheduleTask( "stockphoto.eventHandler.StartUpFolder.ProcessStartUpFolder("+doc_id+")", 1000, false ); }; } stockphoto.eventHandler.StartUpFolder.SetStartUpFolder=function( doc ) { var args={}, i, e="", f, g, doc_id; if( ! stockphoto.eventHandler.StartUpFolder.InitialSw ) return; if( ( app.preferences != undefined )&& ( app.preferences.target != undefined )&& ( app.preferences.target != "" )&& ( app.preferences.bm_myFolder != "" ) ) { stockphoto.eventHandler.StartUpFolder.InitialSw = false; doc_id = doc.id; f = File.decode( app.preferences.target ); // So we have UNICODE string if( ( ( f.substr(0,8) ).toUpperCase() == "FILE:///" )&& ( f.charAt(9) == ":" ) ) { f = unescape( f.substring( 8, f.length ) ); g = new File( f ); f = g.fsName; } else { if( ( f.substr(0,7) ).toUpperCase() == "FILE://" ) { f = unescape( f.substring( 7, f.length ) ); g = new File( f ); f = g.fsName; }; }; args =stockphoto.eventHandler.pathAnalyzer.AnalyzingPath( f, false, true, doc ); if( args.k < 15 ) { stockphoto.DL.NavBar.PrepareNavBar( doc_id ); // copy args to stockphoto.eventHandler.StartUpFolder.args stockphoto.eventHandler.StartUpFolder.args = args; stockphoto.eventHandler.StartUpFolder.ProcessStartUpFolder( doc_id ); }; }; } // ---------------------------------------------------------------------------- stockphoto.core.isSearchFolder = function( aThumbnail ) { // Resolve if it's an alias var realTarget = aThumbnail.resolve(); if ( ( realTarget != undefined ) && ( realTarget instanceof Thumbnail ) && ( realTarget.parent != undefined ) && ( realTarget.parent instanceof Thumbnail ) && ( stockphoto.core.util.getDisplayPath(realTarget.parent,"").toUpperCase() == stockphoto.core.util.getDisplayPath(stockphoto.places.recentSearches, " ").toUpperCase() ) ) { return true; } else { return false; } } stockphoto.core.setAdditionalMetadata = function(doc) { if (doc.sorts[0].type == 'name') { doc.additionalMetadata = [ "stock-sequence", "stock-media-title", undefined ]; } else { doc.additionalMetadata = [ "stock-media-title", undefined, undefined ]; } } stockphoto.core.configureView = function( event ) { if ( stockphoto.places.initialized ) { var doc = event.document; switch ( event.type ) { case "open": { if(true == stockphoto.eventHandler.bRememberThumbSortOrder) { stockphoto.eventHandler.lastRemeberedSortOrder = doc.sorts; } if (event.object == stockphoto.places.recentSearches) { stockphoto.eventHandler.bRememberThumbSortOrder = false; doc.sorts = [ { type: "date-created", reverse: true } ]; } else if ( stockphoto.core.isSearchFolder(event.object) ) { stockphoto.eventHandler.bRememberThumbSortOrder = false; doc.allowDrags = false; doc.showThumbnailName = false; doc.noItems = ""; doc.sorts = [ { type: "name", reverse: false } ]; stockphoto.core.setAdditionalMetadata(doc); } else { if(false == stockphoto.eventHandler.bRememberThumbSortOrder) { if(undefined != stockphoto.eventHandler.lastRemeberedSortOrder) { doc.sorts = stockphoto.eventHandler.lastRemeberedSortOrder; } } stockphoto.eventHandler.bRememberThumbSortOrder = true; } break; } case "sort": stockphoto.eventHandler.bRememberThumbSortOrder = (event.object != stockphoto.places.recentSearches) && (!(stockphoto.core.isSearchFolder(event.object) )); //fall through cases; case "configure": { if ( stockphoto.core.isSearchFolder(event.object) ) { stockphoto.core.setAdditionalMetadata(doc); } break; } } } } stockphoto.core.checkDblClick = {}; stockphoto.core.checkDblClick.doc = []; stockphoto.core.trimString =function(sSource) { if (sSource != undefined) { sSource= sSource.replace(/^\s+/g, '').replace(/\s+$/g, ''); return sSource.replace(/^\"+/g, '').replace(/\"+$/g, ''); } else { return ''; } } // ckphoto.core.checkDblClick.doc[ doc_id ].editCompList[ k ] // contains the list of displayPath selected by "editComp" button // ckphoto.core.checkDblClick.doc[ doc_id ].selList[ k ] // contains the list of selections for GPK // ckphoto.core.checkDblClick.doc[ doc_id ].selListNo // No of element in selList table stockphoto.core.checkDblClick.exec = function( doc_id, iType /* 1:waiting for GetComp/ 0: waiting for Xmp */, nTry ) { var j, jSlot=-1, pMin=-200, noOfNOTProced=0, noOfProced=0, noOfALL; //Watson: 1296872 var bValue = false; this.openThis=function( doc_id, jSlot ) { var svLev,f; svLev=$.level; $.level=0; try { f = new Thumbnail( stockphoto.core.checkDblClick.doc[ doc_id ].execCompList[ jSlot ].f ); } catch(e) { $.level=svLev; return; } $.level=svLev; if (stockphoto.core.openWith.selectedIndex[doc_id] == undefined || stockphoto.core.openWith.selectedIndex[doc_id] == -1) { try { //Watson: 1296872 // if open() is not able to open a file, it returns false bValue = f.open(); // use the default application to openwith, if there are no options if (false == bValue) { // Could not open an image file stockphoto.alertBox.alertBox(1008); } } catch( oEx ) { //Watson: 1296872 stockphoto.alertBox.alertBox(1008); } // use the default application to openwith, if there are no options } else { var result = { openWithApp : stockphoto.core.getEscapedPath(stockphoto.core.trimString(stockphoto.core.openWith.pathArray[stockphoto.core.openWith.selectedIndex[doc_id]])), openFile : stockphoto.core.getEscapedPath(f.path) } try { f.openWith(result.openWithApp); } catch(exception) { if( stockphoto.DL.demandJsxLoading( stockphoto.DL.jsx_AlertBox ) ) { stockphoto.alertBox.alertBox(1008); } } } delete stockphoto.core.checkDblClick.doc[ doc_id ].execCompList[ jSlot ].f; stockphoto.core.checkDblClick.doc[ doc_id ].execCompList[ jSlot ].f = undefined; //KR Watson# 1390681 if("undefined" != typeof stockphoto.core.checkDblClick.doc[ doc_id ].execCompList) { var srTemp = []; for(var iCount=0; iCount < jSlot; iCount++) { if(stockphoto.core.checkDblClick.doc[ doc_id ].execCompList.length > iCount) srTemp[iCount] = stockphoto.core.checkDblClick.doc[ doc_id ].execCompList[iCount]; } stockphoto.core.checkDblClick.doc[ doc_id ].execCompList = srTemp; } //KR Change End. delete f; f = undefined; } noOfALL = stockphoto.core.checkDblClick.doc[ doc_id ].execCompList.length; for( j=0; j So open immeiately to launch application this.openThis( doc_id, jSlot ); if( stockphoto.gpk3 != undefined ) { stockphoto.gpk3debug.rec = "--- wait[2]\n"; stockphoto.gpk3debug.write2LogFile( stockphoto.gpk3debug.rec ); } app.scheduleTask( "stockphoto.core.checkDblClick.exec("+doc_id+",0,0);", 7000, false ); } else { if( stockphoto.core.checkDblClick.doc[ doc_id ].editCompListNo > noOfALL ) { if( nTry < 30 ) // wait for GetComp { if( stockphoto.gpk3 != undefined ) { stockphoto.gpk3debug.rec = "--- wait[3] editCompListNo="+stockphoto.core.checkDblClick.doc[ doc_id ].editCompListNo+", noOfALL="+noOfALL+", nTry="+nTry+"\n"; stockphoto.gpk3debug.write2LogFile( stockphoto.gpk3debug.rec ); } app.scheduleTask( "stockphoto.core.checkDblClick.exec("+( doc_id )+",1,"+( nTry+1 )+");", 1000, false ); return; } } // For 2nd, 3rd,... one and GetComp is done this.openThis( doc_id, jSlot ); j = 2500 + ( 250 * noOfProced ); if( j > 4000 ) j = 4000; if( ( noOfProced % 3 ) == 2 ) j += 1000; if( stockphoto.gpk3 != undefined ) { stockphoto.gpk3debug.rec = "--- wait[4] timeOut="+j+"\n"; stockphoto.gpk3debug.write2LogFile( stockphoto.gpk3debug.rec ); } app.scheduleTask( "stockphoto.core.checkDblClick.exec("+doc_id+",0,0);", j, false ); } } stockphoto.core.isStockPhotosURL = function(target, doc) { if (("undefined" != typeof target) || ("undefined" != typeof target.path) || ("undefined" != typeof doc)) { var args = stockphoto.eventHandler.pathAnalyzer.SubAnalyzingPath( target.path ,false, true, doc, true); // Watson 1417395 if (args.k <= 14 || stockphoto.eventHandler.pathAnalyzer.isLoginpage(target.path) || (target.path.indexOf(stockphoto.uris.APD) >= 0) || (target.path.indexOf("stockphoto://nothing")>= 0) || (target.path.indexOf("stockphoto://checkout")>= 0)) { return true; } } return false; } stockphoto.core.checkDblClick.doit = function( doc_id, thumb, displayPath, bForceFalse, kindOfImage ) { // return 0: default app, 1: Gpk, 2: Ignore 3: Force to handle open var i, j, k, bOurs=false, m, jSlot, pMax; // "bForceFalse"=false means it comes from openWith() -> default app if( ! bForceFalse ) { return( 0 ); // -> default app } // Create stockphoto.core.checkDblClick.doc[ doc_id ] object if( stockphoto.core.checkDblClick.doc[ doc_id ] == undefined ) { stockphoto.core.checkDblClick.doc[ doc_id ] = {}; stockphoto.core.checkDblClick.doc[ doc_id ].editCompList = []; stockphoto.core.checkDblClick.doc[ doc_id ].editCompListNo = 0; stockphoto.core.checkDblClick.doc[ doc_id ].editCompListProced = 0; // stockphoto.core.checkDblClick.doc[ doc_id ].selList = []; stockphoto.core.checkDblClick.doc[ doc_id ].selListNo = 0; } // scan from execQueuelist dispBase = unescape( stockphoto.core.util.getBaseName( displayPath ) ); ndispBase = dispBase.length; if( stockphoto.core.checkDblClick.doc[ doc_id ].execCompList == undefined ) { stockphoto.core.checkDblClick.doc[ doc_id ].execCompList = []; } else { for( i=0; i default app } } } // scan stockphoto.gpk3.gpk3Dt[ args.doc_id ].editComp[ k ] and if it's same as "displayPath" // it implies it is one of "editComp"s so that it should be displayed in -> default app for( i=0; i= ndispBase ) { if( stockphoto.core.checkDblClick.doc[ doc_id ].editCompList[ i ].substring( nTab - ndispBase, nTab ) == dispBase ) { stockphoto.core.checkDblClick.doc[ doc_id ].editCompList[ i ] = ""; stockphoto.core.checkDblClick.doc[ doc_id ].editCompListProced ++; //return( 0 ); // -> default app jSlot = stockphoto.core.checkDblClick.doc[ doc_id ].execCompList.length; pMax = 0; for( j=0; j= stockphoto.core.checkDblClick.doc[ doc_id ].editCompListNo ) { // clear only the table / Counter is used later stockphoto.core.checkDblClick.doc[ doc_id ].editCompList = []; } return( 2 ); // ignore this time } } } // Kind of file is checked if( kindOfImage != undefined ) { if( ( kindOfImage == "Purchased" )||( kindOfImage == "Comp" )||( kindOfImage == "Thumbnail" ) ) bOurs = true; } if( ! bOurs ) { return( 0 ); // -> default app } if( kindOfImage == "Purchased" ) return( 0 ); // Primary Gpk display if( ! stockphoto.DL.demandJsxLoading( stockphoto.DL.jsx_ImgDetail ) ) return( 2 ); if( stockphoto.core.checkDblClick.doc[ doc_id ].selListNo <= 0 ) { if (("undefined" != typeof stockphoto.gpk3) && ("undefined" != typeof stockphoto.gpk3.gpk3Sys) && ("undefined" != typeof stockphoto.gpk3.gpk3Sys[ doc_id ]) && ("undefined" != typeof stockphoto.gpk3.gpk3Sys[ doc_id ].bprogressDialog) && (true == stockphoto.gpk3.gpk3Sys[ doc_id ].bprogressDialog)) { return (2); } stockphoto.gpk3.getPrice3fin( doc_id ); // start of gpk stockphoto.core.checkDblClick.doc[ doc_id ].selList = []; stockphoto.gpk3.gpk3ThumbArray[ doc_id ] = []; var oSel = app.document.selections; var iSelLength = app.document.selectionLength; for( i=0, j=0, k=0; i The same code is repeated - this should be optimized sPartnerName = m["Media/bmsp:PartnerName"]; if (sPartnerName == undefined) { sPartnerName = ""; } var zc = stockphoto.eventHandler.zc; var titleStr = zc.get("$$$/EventHandler/ThumbEvent/Titles/Title=Title: "); var pathStr = zc.get("$$$/EventHandler/ThumbEvent/Titles/Path=Path: "); var providerStr; var imageIDStr; /* Changes added to show ImageId/ASPRefId */ if ((stockphoto.core.ImageID.ID == stockphoto.core.ImageIDs.MediaID) || (m.ASPRefID == undefined) || (m.ASPRefID == "") || (m.ASPRefID == m.MediaID)) { imageIDStr = zc.get("$$$/EventHandler/ThumbEvent/Titles/ImageID=Image ID: "); providerStr = zc.get("$$$/EventHandler/ThumbEvent/Titles/Provider=Provider: "); hoverText = imageIDStr + m.MediaID + "\n" + titleStr + title + "\n" + providerStr + supplier; } else { // imageIDStr = zc.get("$$ $/EventHandler/ThumbEvent/Titles/AdobeID=Adobe ID: "); imageIDStr = "Adobe ID: "; providerStr = ""; hoverText = imageIDStr + m.ASPRefID + "\n" + titleStr + title + "\n" + providerStr + "Adobe Stock Photos"; } var displayPath = stockphoto.core.util.getDisplayPath(event.document.thumbnail,""); if (displayPath.split(':', 1)[0] == "bridgesearch") { hoverText += "\n" + pathStr + target.path; } result = { handled: true, tipText: hoverText }; return result; } } } break; } case "create": { // Empty block - will probably remove, but don't want to make it fall to the 'default' case break; } case "preview": { if (stockphoto.core.isImageFile(target)) { target.refresh("metadata"); // Request refresh metadata... var m = target.metadata; // Assuming the 'refresh' kicks in sooner or later, we don't need synchronous Metadata here... if (m != undefined) { m.namespace = "http://ns.adobe.com/StockPhoto/1.0/"; } else { break; } if ((app.document != undefined) && (app.document.context == undefined)) { if( stockphoto.core.init.isScriptLoaded ) { if (m.KindOfImage == "Thumbnail") { stockphoto.DL.GetComp.GetCompFile(target.path); } } } if ( stockphoto.places.initialized ) { var imageKind = m.KindOfImage; if ((imageKind == "Thumbnail") || (imageKind == "Comp") || (imageKind == "Purchased")) { // The same code is repeated - this should be optimized sPartnerName = m["Media/bmsp:PartnerName"]; if (sPartnerName == undefined) { sPartnerName = ""; } result = { handled: true }; /* Changes added to show ImageId/ASPRefId */ if ((stockphoto.core.ImageID.ID == stockphoto.core.ImageIDs.MediaID) || (m.ASPRefID == undefined) || (m.ASPRefID == "") || (m.ASPRefID == m.MediaID)) { result["0"] = m.MediaID; } else { result["0"] = m.ASPRefID; } result["1"] = m["Media/bmsp:MediaTitle"]; } } } break; } case "configure": //Watson : 1260559 // This event is called when "view" is changed. (Using "View" menu item) // In case BM Scripts has not been loaded, we should not load them in this event. if ( false == stockphoto.core.init.isInitDll ) { break; } document = (event.document instanceof Document) ? event.document : app.document; if (document.browserMode != "compact") { stockphoto.core.init.loadBMScripts( true ); } if( stockphoto.DL.demandJsxLoading( stockphoto.DL.jsx_NavBar ) ) { var doc_id = document.id; stockphoto.NavExtFnc.PrepareNavBar( doc_id ); args = stockphoto.eventHandler.pathAnalyzer.AnalyzingPath( event.object.path, false, true, document ); if (document.browserMode == "compact") { if( stockphoto.DL.demandJsxLoading( stockphoto.DL.jsx_NavBar ) ) { stockphoto.NavExtFnc.finalCleanUpOfSubFolder( 1, stockphoto.core.folder.getTempFolder()+stockphoto.core.CurrentProcessID, true ); } stockphoto.core.BoxCar.NavBar.SetIsCompactFlag( 2, doc_id, 0 ); stockphoto.core.BoxCar.NavBar.SetIsCompactFlag( 2, doc_id, 1 ); if( ( document.topNavbar != undefined )&& ( document.topNavbar.visible == true )&& ( args.k < 15 ) ) stockphoto.eventHandler.pathAnalyzer.ChangeNavVisiblity( document, false, "stockphoto.core.doThumbEvent #1" ); } else { stockphoto.NavExtFnc.SetCurrTopBar( "", doc_id ); var PrevIsCompact = stockphoto.core.BoxCar.NavBar.GetIsCompactFlag( doc_id, 1 ); stockphoto.core.BoxCar.NavBar.SetIsCompactFlag( 1, doc_id, 0 ); stockphoto.core.BoxCar.NavBar.SetIsCompactFlag( 1, doc_id, 1 ); if( PrevIsCompact != 1 ) { // Compact->Full, or first time Full stockphoto.eventHandler.StartUpFolder.args={}; stockphoto.eventHandler.StartUpFolder.SetStartUpFolder( document ); app.document.refresh(); }; stockphoto.eventHandler.pathAnalyzer.ProcessAnalyzedPath( args, document ); if( ( document.topNavbar != undefined )&& ( document.topNavbar.visible == false )&& ( args.k < 15 ) ) stockphoto.eventHandler.pathAnalyzer.ChangeNavVisiblity( document, true, "stockphoto.core.doThumbEvent #2" ); }; }; case "sort": { if ( target.container ) { stockphoto.core.configureView( event ); } break; } case "openWith": appPath = event.appPath; bForceFalse = false; case "open": { if (stockphoto.core.isStockPhotosURL(app.document.thumbnail, app.document)) { if (("HTML" == app.document.presentationMode) && ("compact" == app.document.browserMode)) { app.document.browserMode = "full"; } if (false == stockphoto.resetPreviousWorkspace) { if ("undefined" == typeof app.document.workspace || "undefined" == typeof app.document.workspace.id) { stockphoto.previousWorkspace = "default"; } else { stockphoto.previousWorkspace = app.document.workspace.id; } stockphoto.resetPreviousWorkspace = true; } if (app.document.thumbnail.path.indexOf(stockphoto.uris.APD) < 0) { app.document.setWorkspace(stockphoto.ASPWorkspace); } else { app.document.setWorkspace(stockphoto.APDWorkspace); } } else if (true == stockphoto.resetPreviousWorkspace) { app.document.setWorkspace(stockphoto.previousWorkspace); stockphoto.resetPreviousWorkspace = false; } var document=undefined; var m, kindOfImage=undefined; var isShoppingCart = ( ( target.path != undefined )&& ( ( target.path ).substr( 0,11 ) == "stockphoto:" )&& ( ( stockphoto.core.util.getDisplayPath(target,"") ).indexOf( "st14ShoppingCart" ) > 0 ) ); if (isShoppingCart) { event.document.jsFuncs = stockphoto.core.html.LocalHtmlCallBacks; event.document.visitUrl = stockphoto.core.html.doBMUrlFilter; } else { if( ! target.container ) { var sTargetPath = target.path; if ("undefined" == typeof sTargetPath) { sTargetPath = ""; } if (( target.displayMode == "filesystem" ) && (sTargetPath.indexOf('http://') != 0) && (sTargetPath.indexOf('https://') != 0)) { //Watson: 1341250 m = target.metadata; // We don't need the synchronous Metadata here... if ( ( typeof m != "undefined" ) && ( m instanceof Metadata ) ) { m.namespace = "http://ns.adobe.com/StockPhoto/1.0/"; kindOfImage = m.KindOfImage; if( ( m.KindOfImage == "Thumbnail" )||( m.KindOfImage == "Comp" ) ) { if ( ! stockphoto.core.init.isScriptLoaded ) { stockphoto.core.init.loadBMScripts( true ); } } } switch( stockphoto.core.checkDblClick.doit( event.document.id, target, displayPath, bForceFalse, kindOfImage ) ) { case 1: app.scheduleTask( "stockphoto.gpk3.getPrice3ByOpen("+event.document.id+");", 10, false ); case 2: result.handled = true; return( result ) case 3: /*B*/ if( stockphoto.Burp.doIt ) // in doThumbEvent /*B*/ { /*B*/ stockphoto.Burp.openApp( event.document.id, target, bForceFalse, kindOfImage, m ); /*B*/ } return( result ); default: ; } /*B*/ if( stockphoto.Burp.doIt ) // in doThumbEvent /*B*/ { /*B*/ stockphoto.Burp.openApp( event.document.id, target, bForceFalse, kindOfImage, m ); /*B*/ } } if( stockphoto.gpk3 != undefined ) { var dbgDt2 = new Date(); stockphoto.gpk3debug.rec = "<> "+dbgDt2.getFullYear()+"/"+dbgDt2.getMonth()+"/"+dbgDt2.getDate() + " "+dbgDt2.getHours()+":"+dbgDt2.getMinutes()+":"+dbgDt2.getSeconds()+"."+dbgDt2.getMilliseconds() + "\n "+displayPath+"\n"; stockphoto.gpk3debug.write2LogFile( stockphoto.gpk3debug.rec ); } } } if ( target.container || isShoppingCart) { stockphoto.core.configureView( event ); if (stockphoto.search.setFolder) { break; } document = (event.document instanceof Document) ? event.document : app.document; stockphoto.eventHandler.pathAnalyzer.ChangeContentPaneMode( document, document.contentPaneMode, true ) stockphoto.eventHandler.StartUpFolder.SetStartUpFolder( document ); var doc_id = document.id; if( stockphoto.DL.isAlreadyLoaded( stockphoto.DL.jsx_NavBar ) ) { stockphoto.NavExtFnc.PrepareNavBar( doc_id ); } args = stockphoto.eventHandler.pathAnalyzer.AnalyzingPath( target.path, false, false, document ); /*if(0 == args.k) { doc.allowDrags = false; doc.showThumbnailName = false; doc.noItems = ""; doc.sorts = [ { type: "name", reverse: false } ]; stockphoto.core.setAdditionalMetadata(doc); }*/ if (document.browserMode == "compact") { if( stockphoto.DL.demandJsxLoading( stockphoto.DL.jsx_NavBar ) ) { stockphoto.NavExtFnc.finalCleanUpOfSubFolder( 1, stockphoto.core.folder.getTempFolder()+stockphoto.core.CurrentProcessID, true ); } stockphoto.core.BoxCar.NavBar.SetIsCompactFlag( 2, doc_id, 0 ); stockphoto.core.BoxCar.NavBar.SetIsCompactFlag( 2, doc_id, 1 ); if( ( document.topNavbar != undefined )&& ( document.topNavbar.visible == true )&& ( args.k < 15 ) ) stockphoto.eventHandler.pathAnalyzer.ChangeNavVisiblity( document, false, "stockphoto.core.doThumbEvent #3" ); break; // done if Compact } else { var PrevIsCompact = stockphoto.core.BoxCar.NavBar.GetIsCompactFlag( doc_id, 1 ); stockphoto.core.BoxCar.NavBar.SetIsCompactFlag( 1, doc_id, 0 ); stockphoto.core.BoxCar.NavBar.SetIsCompactFlag( 1, doc_id, 1 ); if( PrevIsCompact != 1 ) { // Compact->Full, or first time Full stockphoto.eventHandler.StartUpFolder.args={}; stockphoto.eventHandler.StartUpFolder.SetStartUpFolder( document ); }; if( ( document.topNavbar != undefined )&& ( document.topNavbar.visible == false )&& ( args.k < 15 ) ) stockphoto.eventHandler.pathAnalyzer.ChangeNavVisiblity( document, true, "stockphoto.core.doThumbEvent #4" ); }; // At this point "k" should have one of the code, defined // in the above switch(){} stements. // If kKeyWd != "", it implies that we found the search keyword // from a folder path with special ways. bRet = stockphoto.eventHandler.pathAnalyzer.ProcessAnalyzedPath( args, document ); //stockphoto.core.configureView( event ); if( bRet.handled ) result.handled = true; } else { if ( target.displayMode == "filesystem" ) { if( kindOfImage != undefined ) { // if ( stockphoto.core.init.isScriptLoaded ) // { // m = target.metadata; // if ( m instanceof Metadata ) // { // m.namespace = "http://ns.adobe.com/StockPhoto/1.0/"; if ( ( kindOfImage == "Thumbnail" )||( kindOfImage == "Comp" ) ) { // if file is already in "Saved Low Res" folder, do not handle Open event if ( stockphoto.core.menu.isInFolderHierarchy( target, stockphoto.places.recentSearches ) ) { stockphoto.DL.GetComp.GetAndOpenComp(target.path, appPath); result.handled = true; } } // } } } else if ( (target.displayMode == "web") && (target.path == "stockphoto://home") && (!stockphoto.places.initialized) ) { event.document.thumbnail = new Thumbnail("bridge://startpage"); result.handled = true; } }; break; } case "close": { if ( !event.document.allowDrags ) { event.document.allowDrags = true; } break; } //select event removed from here for Mocha } return result } stockphoto.core.retry = { }; stockphoto.core.noConnectionFilter = function(url) { var place; with (stockphoto.places) { switch (url) { case home.path: place = "home"; break; case comps.path: place = "comps"; break; case purchases.path: place = "purchases"; break; case recentSearches.path: place = "recentSearches"; break; } } if (place != undefined) { var script; script = "app.document.thumbnail = stockphoto.places." + place + ";"; app.scheduleTask(script, 0, false); return undefined; } var res={ result:true, url:url, toHistory:false }; return( res ); } // Watson : 1208398 // Code for loading NoConnection page stockphoto.core.showNoConnectionPage = function(doc_id, path) { var newNm; var filePath = unescape(path); var doc = stockphoto.core.findDoc( doc_id ); var oFile, disFile if ("undefined" != typeof doc) { doc.visitUrl = stockphoto.core.noConnectionFilter; (stockphoto.core.BoxCar.cntHomePage)++; var oThumb = new Thumbnail("stockphoto://webpagefailed"+stockphoto.core.BoxCar.cntHomePage); oThumb.displayMode = "web"; newNm = stockphoto.core.folder.getTempFolder()+"/"+stockphoto.core.CurrentProcessID+"/" + "noConn"+( stockphoto.core.BoxCar.cntHomePage )+".htm"; oFile = File( filePath ); if ("undefined" != oFile) { oFile.copy( newNm ); disFile = File( newNm ); if ("undefined" != disFile) { oThumb.displayPath = unescape( disFile.fsName ); stockphoto.core.BoxCar.NavBar.SetInTheHPLoadError( true, doc.id ); doc.thumbnail = oThumb; stockphoto.core.BoxCar.szInFailedHomePage = stockphoto.core.util.getDisplayPath(oThumb,""); } } } } stockphoto.core.doDocEvent = function(event) { var result = { handled: false }; var target = event.object var type = event.type; var args={}; var bRet={}; var newNm, filePath=""; var doc = event.object; switch (type) { case "failed": { stockphoto.core.BoxCar.szInFailedHomePage = ""; if( stockphoto.places.initialized ) { if (event.location == "web") { if (doc.thumbnail.path == stockphoto.places.home.path) { // Watson : 1208398 // Commented code for hiding navbar //if ( ( doc.topNavbar != undefined )&& ( doc.topNavbar.visible != undefined ) ) //{ //stockphoto.eventHandler.pathAnalyzer.ChangeNavVisiblity( doc, false, "stockphoto.core.doDocEvent #1" ); //} // filePath will contain the path for the localized HTM if ( stockphoto.DL.demandJsxLoading( stockphoto.DL.jsx_NavBar ) ) { filePath = stockphoto.NavExtFnc.PrepareNoConnectionHTM( doc ); } if( filePath != "" ) { stockphoto.core.retry = { url: event.url, document: event.document }; stockphoto.core.BoxCar.szOriginalHomePage = stockphoto.core.util.getDisplayPath(app.document.thumbnail,""); // Watson : 1208398 // No connection page was not getting display sometimes. "app.scheduleTask" is used to add some delay app.scheduleTask("stockphoto.core.showNoConnectionPage("+doc.id+",'"+escape(filePath)+"');", 100, false); // Watson : 1208398 // Commented code for hiding navbar //if ( ( doc.topNavbar != undefined )&& ( doc.topNavbar.visible != undefined ) ) //{ //stockphoto.eventHandler.pathAnalyzer.ChangeNavVisiblity( doc, false, "stockphoto.core.doDocEvent #2" ); //} result.handled = true; } } // - Added demanJsxLoading, since otherwise it caused exception at loading time... if (stockphoto.DL.demandJsxLoading( stockphoto.DL.jsx_MiscDlgs ) ) { if (unescape(doc.thumbnail.path) == stockphoto.MiscDlgs.MyAccountContext.url) { app.document.thumbnail = stockphoto.MiscDlgs.MyAccountContext.thumbnail; stockphoto.MiscDlgs.MyAccountContext.url = undefined; stockphoto.MiscDlgs.MyAccountContext.thumbnail = undefined; app.scheduleTask("stockphoto.MiscDlgs.MyAccountFailHandler()", 2000, false); result.handled = true; } } } } break; } case "open": stockphoto.core.BoxCar.szInFailedHomePage = ""; break; case "create": { stockphoto.core.BoxCar.szInFailedHomePage = ""; stockphoto.documents[doc.id] = new stockphoto.core.Context( doc ); // // Check if this is the first document to be created, or if it has been // created from an existing one using File->New. if ((stockphoto.core.lastActiveDocumentID == 0) || (stockphoto.search.settings[stockphoto.core.lastActiveDocumentID] == undefined)) { // This is the first document... stockphoto.core.log.logString(0,"[stockphoto.core.doDocEvent:create]: Copying search settings for document " + doc.id + " from default"); // Set defaultSettings autoOpen value from app.preferences... stockphoto.search.defaultSettings.autoOpen = stockphoto.DL.getAdvSearchAutoOpenPref(); var sDefaultSettings = stockphoto.search.defaultSettings.toSource(); stockphoto.search.settings[doc.id] = eval(sDefaultSettings); stockphoto.search.showAdvancedDrawer[doc.id] = false; // Previous Settings may already have been parsed, if this is a startup folder if (stockphoto.search.showPreviousSettings[doc.id] == undefined) { stockphoto.search.showPreviousSettings[doc.id] = false; } } else { // Copy the settings from the parent (last selected) document... stockphoto.core.log.logString(0,"[stockphoto.core.doDocEvent:create]: Copying search settings for document " + doc.id + " from document " + stockphoto.core.lastActiveDocumentID); stockphoto.search.settings[doc.id] = eval(stockphoto.search.settings[stockphoto.core.lastActiveDocumentID].toSource()); stockphoto.search.showAdvancedDrawer[doc.id] = stockphoto.search.showAdvancedDrawer[stockphoto.core.lastActiveDocumentID]; if (stockphoto.search.previousSettings[stockphoto.core.lastActiveDocumentID] != undefined) { stockphoto.search.previousSettings[doc.id] = eval(stockphoto.search.previousSettings[stockphoto.core.lastActiveDocumentID].toSource()) } else { stockphoto.search.previousSettings[doc.id] = eval(stockphoto.search.defaultSettings.toSource()); } stockphoto.search.showPreviousSettings[doc.id] = stockphoto.search.showPreviousSettings[stockphoto.core.lastActiveDocumentID]; } stockphoto.core.lastActiveDocumentID = doc.id; stockphoto.core.log.logString(0,"[stockphoto.core.doDocEvent:create]: Search Settings: " + stockphoto.search.settings[doc.id].toSource()); stockphoto.core.log.logString(0,"[stockphoto.core.doDocEvent:create]: Advanced Drawer: " + stockphoto.search.showAdvancedDrawer[doc.id]); // if (!stockphoto.places.initialized) { stockphoto.core.init.initializeBM( new Thumbnail("stockphoto://home") ); } if (doc.browserMode != "compact") { if( stockphoto.eventHandler.StartUpFolder.SetStartUpFolderIsw ) stockphoto.eventHandler.StartUpFolder.SetStartUpFolder(); } // set default UTL fileter to be ours doc.visitUrl = stockphoto.core.html.doBMUrlFilter; break; } case "close": { // Workaround for 1257507. In multiple window with GPK opened, and // windows are closed with top-right [x] button, Bridge does handle // close statement properly. if( ( stockphoto.gpk3 != undefined )&& ( stockphoto.gpk3.gpk3Sys[ event.object.id ] != undefined )&& ( stockphoto.gpk3.gpk3Sys[ event.object.id ].bdialog != undefined )&& ( stockphoto.gpk3.gpk3Sys[ event.object.id ].bdialog ) ) { stockphoto.DL.imgDetail.getPriceFin( doc.id ); stockphoto.docTab = []; stockphoto.docTab[ event.object.id ] = event.object; app.scheduleTask( "stockphoto.docTab[ "+event.object.id+" ].close();", 1000, false ); result.handled=true; return( result ); } stockphoto.core.BoxCar.szInFailedHomePage = ""; // check if the closing window is BM and web mode if( doc.topNavbar.visible ) { stockphoto.eventHandler.pathAnalyzer.quitBMWeb = true; } else { stockphoto.eventHandler.pathAnalyzer.quitBMWeb = false; } break; } case "destroy": { stockphoto.core.BoxCar.szInFailedHomePage = ""; if ( (doc instanceof Document) && (doc.id != undefined) ) { var context = stockphoto.documents[doc.id]; if (context != undefined) { context.close(); } } break; } case "select": { stockphoto.core.BoxCar.szInFailedHomePage = ""; // This needs to be done on Macintosh only, due to the difference // in sequence of events in Win / Mac. if( Folder.fs == 'Macintosh' ) { stockphoto.core.lastActiveDocumentID = doc.id; } break; } case "deselect": { // This needs to be done on Windows only, due to the difference // in sequence of events in Win / Mac. if( Folder.fs == 'Windows' ) { stockphoto.core.lastActiveDocumentID = doc.id; //Fix for Bug No:1251044 if(stockphoto.DL.demandJsxLoading( stockphoto.DL.jsx_NavBar )) { if (stockphoto.NavExtFnc.IsExecJSSafe(doc.id)) { app.scheduleTask("stockphoto.DL.NavBar.changeMediaTypeFocus(" + doc.id + ")", 0, false); } } } break; } case "selectionsChanged": { // new event added // Since Thumbnail's "select" is blocked by Bridge, we need handle "selectionsChanged" event if( ( stockphoto.eventHandler.eventHistory.type != "Doc" )|| ( stockphoto.eventHandler.eventHistory.subtype != type )|| ( stockphoto.eventHandler.eventHistory.doc_id != doc.id ) ) { stockphoto.core.BoxCar.HomePage.CheckIfCompactView( event, false ); } stockphoto.core.menu.thumbContextMenuObj.invalidateSelectionInfo(); stockphoto.eventHandler.eventHistory.doc_id = doc.id; // Invalidate the getSelectInfo() cache stockphoto.core.getSelectInfoLastDoc = undefined; stockphoto.core.getSelectInfoData = undefined; stockphoto.core.getASPImagesCountData = undefined; break; } case "loading": { /* PERF */ if (stockphoto.timeKeeperNewOn && "web" == event.location) { stockphoto.core.util.startTimer("Loading Web Page in Opera"); } if(0 == stockphoto.core.SaveComp.FirstInit && app.document.thumbnail.path == stockphoto.places.home.path ) { stockphoto.core.init.loadBMScripts(false); } } case "complete": { /* PERF */ if (stockphoto.timeKeeperNewOn && "web" == event.location) { stockphoto.core.util.writeTimer("Loading Web Page in Opera"); stockphoto.core.util.writeTimer("Since st00Core Load"); } } } // changed for "selectionsChanged" stockphoto.eventHandler.eventHistory.type = "Doc"; stockphoto.eventHandler.eventHistory.subtype = type; return result; } // watson no. 1290834 - fix desc: scan favorites array, if ASP absent, reset target // Additional Note - (manish) - Changed loops to use the new app.favorites.contains() API stockphoto.core.setReopenTarget = function( ) { //need to reset to home page on next startup, if the doc is displaying ecom page or no connection page at the time of quitting if (("undefined" != typeof app.document) && ("undefined" != typeof app.document.thumbnail)) { if((app.document.thumbnail.path.indexOf( stockphoto.core.html.urlForBMHPFamily ) >= 0 ) || (app.document.thumbnail.path.indexOf("webpagefailed")>=0)) { app.preferences.target = stockphoto.uris.home; } } // KR - Checking if the current folder is ASP folder then set the target (net time open) to ASP Home page if(("undefined" != typeof app.document) && ("undefined" != typeof app.document.thumbnail) && ("undefined" != typeof stockphoto.places.recentSearches) && ("undefined" != typeof stockphoto.places.comps) && ("undefined" != typeof stockphoto.places.purchases) && (stockphoto.core.menu.isInFolderHierarchy(app.document.thumbnail, new Thumbnail(stockphoto.places.recentSearches) ) || stockphoto.core.menu.isInFolderHierarchy(app.document.thumbnail, new Thumbnail(stockphoto.places.comps) ) || stockphoto.core.menu.isInFolderHierarchy(app.document.thumbnail, new Thumbnail(stockphoto.places.purchases)) || (-1 != app.document.thumbnail.displayPath.indexOf(stockphoto.core.folder.getMySearchesFolder())) || (-1 != app.document.thumbnail.displayPath.indexOf(stockphoto.core.folder.getMyCompFolder())) || (-1 != app.document.thumbnail.displayPath.indexOf(stockphoto.core.folder.getMyPurchasesFolder())) )) { app.preferences.target = stockphoto.uris.home; } if ( ( (! app.favorites.contains(stockphoto.uris.homeScript)) || (false == stockphoto.core.isASPFavEnabled) ) && (stockphoto.uris.home == app.preferences.target) ) { app.preferences.target = ""; } } stockphoto.core.removeASPNode = function(removeASPFlag, enableBeforeDelete) { if (true == removeASPFlag) { if(enableBeforeDelete && app.favorites.contains(stockphoto.uris.homeScript)) { app.favorites.enable(stockphoto.uris.homeScript); } var oASPItem = stockphoto.findFavoritesItem( stockphoto.uris.homeScript, 'standard' ); if (undefined != oASPItem.thumb) { app.favorites.remove(oASPItem.thumb); } stockphoto.core.removePhotoDir(enableBeforeDelete); } } stockphoto.core.doAppEvent = function(event) { var result = { handled: false }; var type = event.type; stockphoto.eventHandler.eventHistory.type = "App"; stockphoto.eventHandler.eventHistory.subtype = type; switch (type) { case "close": { stockphoto.core.removeASPNode(stockphoto.removeASP, true); // only check download queue if stock loaded if (stockphoto.core.init.isInitDll) { // do not quit if user chooses to continue downloading hi-res images if (stockphoto.DL.doCheckDownloadMgrQueueBeforeQuitting() != 1) { result = { handled: true }; } if (stockphoto.core.dontQuit == true) // don't quit just yet { stockphoto.core.quitRequested = true; // but let everyone know we tried. result = { handled: true }; } } // 1290834 stockphoto.core.setReopenTarget( ); break; } case "destroy": { stockphoto.core.removeASPNode(stockphoto.removeASP, true); if( app.preferences.target.indexOf( "APSPhotoDir" ) >= 0 || app.preferences.target.indexOf( "photographersdirectory" ) >= 0 ) { app.preferences.target = stockphoto.uris.home; } // stockphoto.core.doInsertPhotoDir( true, "", 0 ); if (stockphoto.core.init.isScriptLoaded) { // Before removing core, we clean-up temp. directory stockphoto.DL.demandJsxLoading( stockphoto.DL.jsx_NavBar ); stockphoto.NavExtFnc.finalCleanUp( false ); // destroy if( stockphoto.core.BoxCar.AnalyzeXmlFileObj != undefined ) { stockphoto.core.BoxCar.AnalyzeXmlFileObj.removeMem(); delete stockphoto.core.BoxCar.AnalyzeXmlFileObj; stockphoto.core.BoxCar.AnalyzeXmlFileObj = undefined; } if( ( stockphoto.HTMLUtil != undefined )&& ( stockphoto.HTMLUtil.ConvertToPriceStringObj != undefined ) ) { delete stockphoto.HTMLUtil.ConvertToPriceStringObj; stockphoto.HTMLUtil.ConvertToPriceStringObj = undefined; } if (stockphoto.core.eventTaskID != 0) { app.cancelTask(stockphoto.core.eventTaskID, false); stockphoto.core.eventTaskID = 0; } if( stockphoto.Burp.doIt ) { // more-search main entry /*B*/ try /*B*/ { /*B*/ stockphoto.Burp.terminate(); /*B*/ } catch(e) { ; } } //if( stockphoto.gpk3 != undefined ) // stockphoto.gpk3.getPrice3allFin(); stockphoto.impl.terminate(); stockphoto.impl = undefined; stockphoto.lib = undefined; stockphoto.core.init.isScriptLoaded = false; } // 1290834 stockphoto.core.setReopenTarget( ); } } return result; } stockphoto.core.doPrefsEvent = function(event) { var result = { handled: false }; var type = event.type; var target = event.object stockphoto.eventHandler.eventHistory.type = "Prefs"; stockphoto.eventHandler.eventHistory.subtype = type; if (stockphoto.places.initialized) { switch (type) { case "create": { stockphoto.DL.preference(target.addPanel("Adobe Stock Photos")); break; } case "ok": { stockphoto.prefs.OkBtnClicked(); // app.scheduleTask( "stockphoto.core.doInsertPhotoDir("+false+", '',"+0+");", 200, false ); // Update ASP and APD URLs with Billing Country... break; } case "cancel": { stockphoto.prefs.CancelBtnClicked(); break; } case "disabled": { if ("AdobeStockPhotos" == event.scriptName) { stockphoto.removeASP = true; } break; } case "enabled": { if ("AdobeStockPhotos" == event.scriptName) { stockphoto.removeASP = false; } break; } } } return result; } stockphoto.core.doFavoritesEvent = function(event) { var result = { handled: false }; if (undefined != event) { stockphoto.eventHandler.eventHistory.type = "Favorites"; stockphoto.eventHandler.eventHistory.subtype = event.type; if ((undefined != event.type) && (undefined != event.object.path)) { switch (event.type) { case "enabled": { if ((event.object.path == stockphoto.uris.home) || (event.object.path == stockphoto.uris.APD)) { if (event.object.path == stockphoto.uris.home) { stockphoto.core.isASPFavEnabled = true; } result.handled = true; } break; } case "disabled": { if ((event.object.path == stockphoto.uris.home) || (event.object.path == stockphoto.uris.APD)) { // Remove ASP/APD from startup if our thumbnail is being disabled... if (event.object.path == app.preferences.target) { app.preferences.target = ''; } if (event.object.path == stockphoto.uris.home) { stockphoto.core.isASPFavEnabled = false; } result.handled = true; } break; } } // switch } } // if (undefined != event) return result; } stockphoto.core.eventHandler = function( event ) { var result = { handled: false }; var target = event.object; var sLocation = event.location; if ('favorites' == sLocation) { return stockphoto.core.doFavoritesEvent(event); } // Thumbnail events else if ( (('document' == sLocation) || ('favorites' == sLocation)) && (target instanceof Thumbnail) ) { return stockphoto.core.doThumbEvent(event); } // App events else if ( ('app' == sLocation) && (target instanceof App) ) { return stockphoto.core.doAppEvent(event); } // Document events else if ( (('app' == sLocation) || ('document' == sLocation) || ('web' == sLocation)) && (target instanceof Document) ) { return stockphoto.core.doDocEvent(event) } else if (( 'prefs' == sLocation) && (target instanceof PreferencesDialog) ) { return stockphoto.core.doPrefsEvent(event); } else { stockphoto.eventHandler.eventHistory.type = "Unknown"; } return result; } app.eventHandlers.push( { handler: stockphoto.core.eventHandler } ); if( ( stockphoto.timeKeeperOn != undefined )&&( stockphoto.timeKeeperOn ) ) { stockphoto.timeKeeper.eventHandler.EdTime = new Date(); }