123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472547354745475547654775478547954805481548254835484548554865487548854895490549154925493549454955496549754985499550055015502550355045505550655075508550955105511551255135514551555165517551855195520552155225523552455255526552755285529553055315532553355345535553655375538553955405541554255435544554555465547554855495550555155525553555455555556555755585559556055615562556355645565556655675568556955705571557255735574557555765577557855795580558155825583558455855586558755885589559055915592559355945595559655975598559956005601560256035604560556065607560856095610561156125613561456155616561756185619562056215622562356245625562656275628562956305631563256335634563556365637563856395640564156425643564456455646564756485649565056515652565356545655565656575658565956605661566256635664566556665667566856695670567156725673567456755676567756785679568056815682568356845685568656875688568956905691569256935694569556965697569856995700570157025703570457055706570757085709571057115712571357145715571657175718571957205721572257235724572557265727572857295730573157325733573457355736573757385739574057415742574357445745574657475748574957505751575257535754575557565757575857595760576157625763576457655766576757685769577057715772577357745775577657775778577957805781578257835784578557865787578857895790579157925793579457955796579757985799580058015802580358045805580658075808580958105811581258135814581558165817581858195820582158225823582458255826582758285829583058315832583358345835583658375838583958405841584258435844584558465847584858495850585158525853585458555856585758585859586058615862586358645865586658675868586958705871587258735874587558765877587858795880588158825883588458855886588758885889589058915892589358945895589658975898589959005901590259035904590559065907590859095910591159125913591459155916591759185919592059215922592359245925592659275928592959305931593259335934593559365937593859395940594159425943594459455946594759485949595059515952595359545955595659575958595959605961596259635964596559665967596859695970597159725973597459755976597759785979598059815982598359845985598659875988598959905991599259935994599559965997599859996000600160026003600460056006600760086009601060116012601360146015601660176018601960206021602260236024602560266027602860296030603160326033603460356036603760386039604060416042604360446045604660476048604960506051605260536054605560566057605860596060606160626063606460656066606760686069607060716072607360746075607660776078607960806081608260836084608560866087608860896090609160926093609460956096609760986099610061016102610361046105610661076108610961106111611261136114611561166117611861196120612161226123612461256126612761286129613061316132613361346135613661376138613961406141614261436144614561466147614861496150615161526153615461556156615761586159616061616162616361646165616661676168616961706171617261736174617561766177617861796180618161826183618461856186618761886189619061916192619361946195619661976198619962006201620262036204620562066207620862096210621162126213621462156216621762186219622062216222622362246225622662276228622962306231623262336234623562366237623862396240624162426243624462456246624762486249625062516252625362546255625662576258625962606261626262636264626562666267626862696270627162726273627462756276627762786279628062816282628362846285628662876288628962906291629262936294629562966297629862996300630163026303630463056306630763086309631063116312631363146315631663176318631963206321632263236324632563266327632863296330633163326333633463356336633763386339634063416342634363446345634663476348634963506351635263536354635563566357635863596360636163626363636463656366636763686369637063716372637363746375637663776378637963806381638263836384638563866387638863896390639163926393639463956396639763986399640064016402640364046405640664076408640964106411641264136414641564166417641864196420642164226423642464256426642764286429643064316432643364346435643664376438643964406441644264436444644564466447644864496450645164526453645464556456645764586459646064616462646364646465646664676468646964706471647264736474647564766477647864796480648164826483648464856486648764886489649064916492649364946495649664976498649965006501650265036504650565066507650865096510651165126513651465156516651765186519652065216522652365246525652665276528652965306531653265336534653565366537653865396540654165426543654465456546654765486549655065516552655365546555655665576558655965606561656265636564656565666567656865696570657165726573657465756576657765786579658065816582658365846585658665876588658965906591659265936594659565966597659865996600660166026603660466056606660766086609661066116612661366146615661666176618661966206621662266236624662566266627662866296630663166326633663466356636663766386639664066416642664366446645664666476648664966506651665266536654665566566657665866596660666166626663666466656666666766686669667066716672667366746675667666776678667966806681668266836684668566866687668866896690669166926693669466956696669766986699670067016702670367046705670667076708670967106711671267136714671567166717671867196720672167226723672467256726672767286729673067316732673367346735673667376738673967406741674267436744674567466747674867496750675167526753675467556756675767586759676067616762676367646765676667676768676967706771677267736774677567766777677867796780678167826783678467856786678767886789679067916792679367946795679667976798679968006801680268036804680568066807680868096810681168126813681468156816681768186819682068216822682368246825682668276828682968306831683268336834683568366837683868396840684168426843684468456846684768486849685068516852685368546855685668576858685968606861686268636864686568666867686868696870687168726873687468756876687768786879688068816882688368846885688668876888688968906891689268936894689568966897689868996900690169026903690469056906690769086909691069116912691369146915691669176918691969206921692269236924692569266927692869296930693169326933693469356936693769386939694069416942694369446945694669476948694969506951695269536954695569566957695869596960696169626963696469656966696769686969697069716972697369746975697669776978697969806981698269836984698569866987698869896990699169926993699469956996699769986999700070017002700370047005700670077008700970107011701270137014701570167017701870197020702170227023702470257026702770287029703070317032703370347035703670377038703970407041704270437044704570467047704870497050705170527053705470557056705770587059706070617062706370647065706670677068706970707071707270737074707570767077707870797080708170827083708470857086708770887089709070917092709370947095709670977098709971007101710271037104710571067107710871097110711171127113711471157116711771187119712071217122712371247125712671277128712971307131713271337134713571367137713871397140714171427143714471457146714771487149715071517152715371547155715671577158715971607161716271637164716571667167716871697170717171727173717471757176717771787179718071817182718371847185718671877188718971907191719271937194719571967197719871997200720172027203720472057206720772087209721072117212721372147215721672177218721972207221722272237224722572267227722872297230723172327233723472357236723772387239724072417242724372447245724672477248724972507251725272537254725572567257725872597260726172627263726472657266726772687269727072717272727372747275727672777278727972807281728272837284728572867287728872897290729172927293729472957296729772987299730073017302730373047305730673077308730973107311731273137314731573167317731873197320732173227323732473257326732773287329733073317332733373347335733673377338733973407341734273437344734573467347734873497350735173527353735473557356735773587359736073617362736373647365736673677368736973707371737273737374737573767377737873797380738173827383738473857386738773887389739073917392739373947395739673977398739974007401740274037404740574067407740874097410741174127413741474157416741774187419742074217422742374247425742674277428742974307431743274337434743574367437743874397440744174427443744474457446744774487449745074517452745374547455745674577458745974607461746274637464746574667467746874697470747174727473747474757476747774787479748074817482748374847485748674877488748974907491749274937494749574967497749874997500750175027503750475057506750775087509751075117512751375147515751675177518751975207521752275237524752575267527752875297530753175327533753475357536753775387539754075417542754375447545754675477548754975507551755275537554755575567557755875597560756175627563756475657566756775687569757075717572757375747575757675777578757975807581758275837584758575867587758875897590759175927593759475957596759775987599760076017602760376047605760676077608760976107611761276137614761576167617761876197620762176227623762476257626762776287629763076317632763376347635763676377638763976407641764276437644764576467647764876497650765176527653765476557656765776587659766076617662766376647665766676677668766976707671767276737674767576767677767876797680768176827683768476857686768776887689769076917692769376947695769676977698769977007701770277037704770577067707770877097710771177127713771477157716771777187719772077217722772377247725772677277728772977307731773277337734773577367737773877397740774177427743774477457746774777487749775077517752775377547755775677577758775977607761776277637764776577667767776877697770777177727773777477757776777777787779778077817782778377847785778677877788778977907791779277937794779577967797779877997800780178027803780478057806780778087809781078117812781378147815781678177818781978207821782278237824782578267827782878297830783178327833783478357836783778387839784078417842784378447845784678477848784978507851785278537854785578567857785878597860786178627863786478657866786778687869787078717872787378747875787678777878787978807881788278837884788578867887788878897890789178927893789478957896789778987899790079017902790379047905790679077908790979107911791279137914791579167917791879197920792179227923792479257926792779287929793079317932793379347935793679377938793979407941794279437944794579467947794879497950795179527953795479557956795779587959796079617962796379647965796679677968796979707971797279737974797579767977797879797980798179827983798479857986798779887989799079917992799379947995799679977998799980008001800280038004800580068007800880098010801180128013801480158016801780188019802080218022802380248025802680278028802980308031803280338034803580368037803880398040804180428043804480458046804780488049805080518052805380548055805680578058805980608061806280638064806580668067806880698070807180728073807480758076807780788079808080818082808380848085808680878088808980908091809280938094809580968097809880998100810181028103810481058106810781088109811081118112811381148115811681178118811981208121812281238124812581268127812881298130813181328133813481358136813781388139814081418142814381448145814681478148814981508151815281538154815581568157815881598160816181628163816481658166816781688169817081718172817381748175817681778178817981808181818281838184818581868187818881898190819181928193819481958196819781988199820082018202820382048205820682078208820982108211821282138214821582168217821882198220822182228223822482258226822782288229823082318232823382348235823682378238823982408241824282438244824582468247824882498250825182528253825482558256825782588259826082618262826382648265826682678268826982708271827282738274827582768277827882798280828182828283828482858286828782888289829082918292829382948295829682978298829983008301830283038304830583068307830883098310831183128313831483158316831783188319832083218322832383248325832683278328832983308331833283338334833583368337833883398340834183428343834483458346834783488349835083518352835383548355835683578358835983608361836283638364836583668367836883698370837183728373837483758376837783788379838083818382838383848385838683878388838983908391839283938394839583968397839883998400840184028403840484058406840784088409841084118412841384148415841684178418841984208421842284238424842584268427842884298430843184328433843484358436843784388439844084418442844384448445844684478448844984508451845284538454845584568457845884598460846184628463846484658466846784688469847084718472847384748475847684778478847984808481848284838484848584868487848884898490849184928493849484958496849784988499850085018502850385048505850685078508850985108511851285138514851585168517851885198520852185228523852485258526852785288529853085318532853385348535853685378538853985408541854285438544854585468547854885498550855185528553855485558556855785588559856085618562856385648565856685678568856985708571857285738574857585768577857885798580858185828583858485858586858785888589859085918592859385948595859685978598859986008601860286038604860586068607860886098610861186128613861486158616861786188619862086218622862386248625862686278628862986308631863286338634863586368637863886398640864186428643864486458646864786488649865086518652865386548655865686578658865986608661866286638664866586668667866886698670867186728673867486758676867786788679868086818682868386848685868686878688868986908691869286938694869586968697869886998700870187028703870487058706870787088709871087118712871387148715871687178718871987208721872287238724872587268727872887298730873187328733873487358736873787388739874087418742874387448745874687478748874987508751875287538754875587568757875887598760876187628763876487658766876787688769877087718772877387748775877687778778877987808781878287838784878587868787878887898790879187928793879487958796879787988799880088018802880388048805880688078808880988108811881288138814881588168817881888198820882188228823882488258826882788288829883088318832883388348835883688378838883988408841884288438844884588468847884888498850885188528853885488558856885788588859886088618862886388648865886688678868886988708871887288738874887588768877887888798880888188828883888488858886888788888889889088918892889388948895889688978898889989008901890289038904890589068907890889098910891189128913891489158916891789188919892089218922892389248925892689278928892989308931893289338934893589368937893889398940894189428943894489458946894789488949895089518952895389548955895689578958895989608961896289638964896589668967896889698970897189728973897489758976897789788979898089818982898389848985898689878988898989908991899289938994899589968997899889999000900190029003900490059006900790089009901090119012901390149015901690179018901990209021902290239024902590269027902890299030903190329033903490359036903790389039904090419042904390449045904690479048904990509051905290539054905590569057905890599060906190629063906490659066906790689069907090719072907390749075907690779078907990809081908290839084908590869087908890899090909190929093909490959096909790989099910091019102910391049105910691079108910991109111911291139114911591169117911891199120912191229123912491259126912791289129913091319132913391349135913691379138913991409141914291439144914591469147914891499150915191529153915491559156915791589159916091619162916391649165916691679168916991709171917291739174917591769177917891799180918191829183918491859186918791889189919091919192919391949195919691979198919992009201920292039204920592069207920892099210921192129213921492159216921792189219922092219222922392249225922692279228922992309231923292339234923592369237923892399240924192429243924492459246924792489249925092519252925392549255925692579258925992609261926292639264926592669267926892699270927192729273927492759276927792789279928092819282928392849285928692879288928992909291929292939294929592969297929892999300930193029303930493059306930793089309931093119312931393149315931693179318931993209321932293239324932593269327932893299330933193329333933493359336933793389339934093419342934393449345934693479348934993509351935293539354935593569357935893599360936193629363936493659366936793689369937093719372937393749375937693779378937993809381938293839384938593869387938893899390939193929393939493959396939793989399940094019402940394049405940694079408940994109411941294139414941594169417941894199420942194229423942494259426942794289429943094319432943394349435943694379438943994409441944294439444944594469447944894499450945194529453945494559456945794589459946094619462946394649465946694679468946994709471947294739474947594769477947894799480948194829483948494859486948794889489949094919492949394949495949694979498949995009501950295039504950595069507950895099510951195129513951495159516951795189519952095219522952395249525952695279528952995309531953295339534953595369537953895399540954195429543954495459546954795489549955095519552955395549555955695579558955995609561956295639564956595669567956895699570957195729573957495759576957795789579958095819582958395849585958695879588958995909591959295939594959595969597959895999600960196029603960496059606960796089609961096119612961396149615961696179618961996209621962296239624962596269627962896299630963196329633963496359636963796389639964096419642964396449645964696479648964996509651965296539654965596569657965896599660966196629663966496659666966796689669967096719672967396749675967696779678967996809681968296839684968596869687968896899690969196929693969496959696969796989699970097019702970397049705970697079708970997109711971297139714971597169717971897199720972197229723972497259726972797289729973097319732973397349735973697379738973997409741974297439744974597469747974897499750975197529753975497559756975797589759976097619762976397649765976697679768976997709771977297739774977597769777977897799780978197829783978497859786978797889789979097919792979397949795979697979798979998009801980298039804980598069807980898099810981198129813981498159816981798189819982098219822982398249825982698279828982998309831983298339834983598369837983898399840984198429843984498459846984798489849985098519852985398549855985698579858985998609861986298639864986598669867986898699870987198729873987498759876987798789879988098819882988398849885988698879888988998909891989298939894989598969897989898999900990199029903990499059906990799089909991099119912991399149915991699179918991999209921992299239924992599269927992899299930993199329933993499359936993799389939994099419942994399449945994699479948994999509951995299539954995599569957995899599960996199629963996499659966996799689969997099719972997399749975997699779978997999809981998299839984998599869987998899899990999199929993999499959996999799989999100001000110002100031000410005100061000710008100091001010011100121001310014100151001610017100181001910020100211002210023100241002510026100271002810029100301003110032100331003410035100361003710038100391004010041100421004310044100451004610047100481004910050100511005210053100541005510056100571005810059100601006110062100631006410065100661006710068100691007010071100721007310074100751007610077100781007910080100811008210083100841008510086100871008810089100901009110092100931009410095100961009710098100991010010101101021010310104101051010610107101081010910110101111011210113101141011510116101171011810119101201012110122101231012410125101261012710128101291013010131101321013310134101351013610137101381013910140101411014210143101441014510146101471014810149101501015110152101531015410155101561015710158101591016010161101621016310164101651016610167101681016910170101711017210173101741017510176101771017810179101801018110182101831018410185101861018710188101891019010191101921019310194101951019610197101981019910200102011020210203102041020510206102071020810209102101021110212102131021410215102161021710218102191022010221102221022310224102251022610227102281022910230102311023210233102341023510236102371023810239102401024110242102431024410245102461024710248102491025010251102521025310254102551025610257102581025910260102611026210263102641026510266102671026810269102701027110272102731027410275102761027710278102791028010281102821028310284102851028610287102881028910290102911029210293102941029510296102971029810299103001030110302103031030410305103061030710308103091031010311103121031310314103151031610317103181031910320103211032210323103241032510326103271032810329103301033110332103331033410335103361033710338103391034010341103421034310344103451034610347103481034910350103511035210353103541035510356103571035810359103601036110362103631036410365103661036710368103691037010371103721037310374103751037610377103781037910380103811038210383103841038510386103871038810389103901039110392103931039410395103961039710398103991040010401104021040310404104051040610407104081040910410104111041210413104141041510416104171041810419104201042110422104231042410425104261042710428104291043010431104321043310434104351043610437104381043910440104411044210443104441044510446104471044810449104501045110452104531045410455104561045710458104591046010461104621046310464104651046610467104681046910470104711047210473104741047510476104771047810479104801048110482104831048410485104861048710488104891049010491104921049310494104951049610497104981049910500105011050210503105041050510506105071050810509105101051110512105131051410515105161051710518105191052010521105221052310524105251052610527105281052910530105311053210533105341053510536105371053810539105401054110542105431054410545105461054710548105491055010551105521055310554105551055610557105581055910560105611056210563105641056510566105671056810569105701057110572105731057410575105761057710578105791058010581105821058310584105851058610587105881058910590105911059210593105941059510596105971059810599106001060110602106031060410605106061060710608106091061010611106121061310614106151061610617106181061910620106211062210623106241062510626106271062810629106301063110632106331063410635106361063710638106391064010641106421064310644106451064610647106481064910650106511065210653106541065510656106571065810659106601066110662106631066410665106661066710668106691067010671106721067310674106751067610677106781067910680106811068210683106841068510686106871068810689106901069110692106931069410695106961069710698106991070010701107021070310704107051070610707107081070910710107111071210713107141071510716107171071810719107201072110722107231072410725107261072710728107291073010731107321073310734107351073610737107381073910740107411074210743107441074510746107471074810749107501075110752107531075410755107561075710758107591076010761107621076310764107651076610767107681076910770107711077210773107741077510776107771077810779107801078110782107831078410785107861078710788107891079010791107921079310794107951079610797107981079910800108011080210803108041080510806108071080810809108101081110812108131081410815108161081710818108191082010821108221082310824108251082610827108281082910830108311083210833108341083510836108371083810839108401084110842108431084410845108461084710848108491085010851108521085310854108551085610857108581085910860108611086210863108641086510866108671086810869108701087110872108731087410875108761087710878108791088010881108821088310884108851088610887108881088910890108911089210893108941089510896108971089810899109001090110902109031090410905109061090710908109091091010911109121091310914109151091610917109181091910920109211092210923109241092510926109271092810929109301093110932109331093410935109361093710938109391094010941109421094310944109451094610947109481094910950109511095210953109541095510956109571095810959109601096110962109631096410965109661096710968109691097010971109721097310974109751097610977109781097910980109811098210983109841098510986109871098810989109901099110992109931099410995109961099710998109991100011001110021100311004110051100611007110081100911010110111101211013110141101511016110171101811019110201102111022110231102411025110261102711028110291103011031110321103311034110351103611037110381103911040110411104211043110441104511046110471104811049110501105111052110531105411055110561105711058110591106011061110621106311064110651106611067110681106911070110711107211073110741107511076110771107811079110801108111082110831108411085110861108711088110891109011091110921109311094110951109611097110981109911100111011110211103111041110511106111071110811109111101111111112111131111411115111161111711118111191112011121111221112311124111251112611127111281112911130111311113211133111341113511136111371113811139111401114111142111431114411145111461114711148111491115011151111521115311154111551115611157111581115911160111611116211163111641116511166111671116811169111701117111172111731117411175111761117711178111791118011181111821118311184111851118611187111881118911190111911119211193111941119511196111971119811199112001120111202112031120411205112061120711208112091121011211112121121311214112151121611217112181121911220112211122211223112241122511226112271122811229112301123111232112331123411235112361123711238112391124011241112421124311244112451124611247112481124911250112511125211253112541125511256112571125811259112601126111262112631126411265112661126711268112691127011271112721127311274112751127611277112781127911280112811128211283112841128511286112871128811289112901129111292112931129411295112961129711298112991130011301113021130311304113051130611307113081130911310113111131211313113141131511316113171131811319113201132111322113231132411325113261132711328113291133011331113321133311334113351133611337113381133911340113411134211343113441134511346113471134811349113501135111352113531135411355113561135711358113591136011361113621136311364113651136611367113681136911370113711137211373113741137511376113771137811379113801138111382113831138411385113861138711388113891139011391113921139311394113951139611397113981139911400114011140211403114041140511406114071140811409114101141111412114131141411415114161141711418114191142011421114221142311424114251142611427114281142911430114311143211433114341143511436114371143811439114401144111442114431144411445114461144711448114491145011451114521145311454114551145611457114581145911460114611146211463114641146511466114671146811469114701147111472114731147411475114761147711478114791148011481114821148311484114851148611487114881148911490114911149211493114941149511496114971149811499115001150111502115031150411505115061150711508115091151011511115121151311514115151151611517115181151911520115211152211523115241152511526115271152811529115301153111532115331153411535115361153711538115391154011541115421154311544115451154611547115481154911550115511155211553115541155511556115571155811559115601156111562115631156411565115661156711568115691157011571115721157311574115751157611577115781157911580115811158211583115841158511586115871158811589115901159111592115931159411595115961159711598115991160011601116021160311604116051160611607116081160911610116111161211613116141161511616116171161811619116201162111622116231162411625116261162711628116291163011631116321163311634116351163611637116381163911640116411164211643116441164511646116471164811649116501165111652116531165411655116561165711658116591166011661116621166311664116651166611667116681166911670116711167211673116741167511676116771167811679116801168111682116831168411685116861168711688116891169011691116921169311694116951169611697116981169911700117011170211703117041170511706117071170811709117101171111712117131171411715117161171711718117191172011721117221172311724117251172611727117281172911730117311173211733117341173511736117371173811739117401174111742117431174411745117461174711748117491175011751117521175311754117551175611757117581175911760117611176211763117641176511766117671176811769117701177111772117731177411775117761177711778117791178011781117821178311784117851178611787117881178911790117911179211793117941179511796117971179811799118001180111802118031180411805118061180711808118091181011811118121181311814118151181611817118181181911820118211182211823118241182511826118271182811829118301183111832118331183411835118361183711838118391184011841118421184311844118451184611847118481184911850118511185211853118541185511856118571185811859118601186111862118631186411865118661186711868118691187011871118721187311874118751187611877118781187911880118811188211883118841188511886118871188811889118901189111892118931189411895118961189711898118991190011901119021190311904119051190611907119081190911910119111191211913119141191511916119171191811919119201192111922119231192411925119261192711928119291193011931119321193311934119351193611937119381193911940119411194211943119441194511946119471194811949119501195111952119531195411955119561195711958119591196011961119621196311964119651196611967119681196911970119711197211973119741197511976119771197811979119801198111982119831198411985119861198711988119891199011991119921199311994119951199611997119981199912000120011200212003120041200512006120071200812009120101201112012120131201412015120161201712018120191202012021120221202312024120251202612027120281202912030120311203212033120341203512036120371203812039120401204112042120431204412045120461204712048120491205012051120521205312054120551205612057120581205912060120611206212063120641206512066120671206812069120701207112072120731207412075120761207712078120791208012081120821208312084120851208612087120881208912090120911209212093120941209512096120971209812099121001210112102121031210412105121061210712108121091211012111121121211312114121151211612117121181211912120121211212212123121241212512126121271212812129121301213112132121331213412135121361213712138121391214012141121421214312144121451214612147121481214912150121511215212153121541215512156121571215812159121601216112162121631216412165121661216712168121691217012171121721217312174121751217612177121781217912180121811218212183121841218512186121871218812189121901219112192121931219412195121961219712198121991220012201122021220312204122051220612207122081220912210122111221212213122141221512216122171221812219122201222112222122231222412225122261222712228122291223012231122321223312234122351223612237122381223912240122411224212243122441224512246122471224812249122501225112252122531225412255122561225712258122591226012261122621226312264122651226612267122681226912270122711227212273122741227512276122771227812279122801228112282122831228412285122861228712288122891229012291122921229312294122951229612297122981229912300123011230212303123041230512306123071230812309123101231112312123131231412315123161231712318123191232012321123221232312324123251232612327123281232912330123311233212333123341233512336123371233812339123401234112342123431234412345123461234712348123491235012351123521235312354123551235612357123581235912360123611236212363123641236512366123671236812369123701237112372123731237412375123761237712378123791238012381123821238312384123851238612387123881238912390123911239212393123941239512396123971239812399124001240112402124031240412405124061240712408124091241012411124121241312414124151241612417124181241912420124211242212423124241242512426124271242812429124301243112432124331243412435124361243712438124391244012441124421244312444124451244612447124481244912450124511245212453124541245512456124571245812459124601246112462124631246412465124661246712468124691247012471124721247312474124751247612477124781247912480124811248212483124841248512486124871248812489124901249112492124931249412495124961249712498124991250012501125021250312504125051250612507125081250912510125111251212513125141251512516125171251812519125201252112522125231252412525125261252712528125291253012531125321253312534125351253612537125381253912540125411254212543125441254512546125471254812549125501255112552125531255412555125561255712558125591256012561125621256312564125651256612567125681256912570125711257212573125741257512576125771257812579125801258112582125831258412585125861258712588125891259012591125921259312594125951259612597125981259912600126011260212603126041260512606126071260812609126101261112612126131261412615126161261712618126191262012621126221262312624126251262612627126281262912630126311263212633126341263512636126371263812639126401264112642126431264412645126461264712648126491265012651126521265312654126551265612657126581265912660126611266212663126641266512666126671266812669126701267112672126731267412675126761267712678126791268012681126821268312684126851268612687126881268912690126911269212693126941269512696126971269812699127001270112702127031270412705127061270712708127091271012711127121271312714127151271612717127181271912720127211272212723127241272512726127271272812729127301273112732127331273412735127361273712738127391274012741127421274312744127451274612747127481274912750127511275212753127541275512756127571275812759127601276112762127631276412765127661276712768127691277012771127721277312774127751277612777127781277912780127811278212783127841278512786127871278812789127901279112792127931279412795127961279712798127991280012801128021280312804128051280612807128081280912810128111281212813128141281512816128171281812819128201282112822128231282412825128261282712828128291283012831128321283312834128351283612837128381283912840128411284212843128441284512846128471284812849128501285112852128531285412855128561285712858128591286012861128621286312864128651286612867128681286912870128711287212873128741287512876128771287812879128801288112882128831288412885128861288712888128891289012891128921289312894128951289612897128981289912900129011290212903129041290512906129071290812909129101291112912129131291412915129161291712918129191292012921129221292312924129251292612927129281292912930129311293212933129341293512936129371293812939129401294112942129431294412945129461294712948129491295012951129521295312954129551295612957129581295912960129611296212963129641296512966129671296812969129701297112972129731297412975129761297712978129791298012981129821298312984129851298612987129881298912990129911299212993129941299512996129971299812999130001300113002130031300413005130061300713008130091301013011130121301313014130151301613017130181301913020130211302213023130241302513026130271302813029130301303113032130331303413035130361303713038130391304013041130421304313044130451304613047130481304913050130511305213053130541305513056130571305813059130601306113062130631306413065130661306713068130691307013071130721307313074130751307613077130781307913080130811308213083130841308513086130871308813089130901309113092130931309413095130961309713098130991310013101131021310313104131051310613107131081310913110131111311213113131141311513116131171311813119131201312113122131231312413125131261312713128131291313013131131321313313134131351313613137131381313913140131411314213143131441314513146131471314813149131501315113152131531315413155131561315713158131591316013161131621316313164131651316613167131681316913170131711317213173131741317513176131771317813179131801318113182131831318413185131861318713188131891319013191131921319313194131951319613197131981319913200132011320213203132041320513206132071320813209132101321113212132131321413215132161321713218132191322013221132221322313224132251322613227132281322913230132311323213233132341323513236132371323813239132401324113242132431324413245132461324713248132491325013251132521325313254132551325613257132581325913260132611326213263132641326513266132671326813269132701327113272132731327413275132761327713278132791328013281132821328313284132851328613287132881328913290132911329213293132941329513296132971329813299133001330113302133031330413305133061330713308133091331013311133121331313314133151331613317133181331913320133211332213323133241332513326133271332813329133301333113332133331333413335133361333713338133391334013341133421334313344133451334613347133481334913350133511335213353133541335513356133571335813359133601336113362133631336413365133661336713368133691337013371133721337313374133751337613377133781337913380133811338213383133841338513386133871338813389133901339113392133931339413395133961339713398133991340013401134021340313404134051340613407134081340913410134111341213413134141341513416134171341813419134201342113422134231342413425134261342713428134291343013431134321343313434134351343613437134381343913440134411344213443134441344513446134471344813449134501345113452134531345413455134561345713458134591346013461134621346313464134651346613467134681346913470134711347213473134741347513476134771347813479134801348113482134831348413485134861348713488134891349013491134921349313494134951349613497134981349913500135011350213503135041350513506135071350813509135101351113512135131351413515135161351713518135191352013521135221352313524135251352613527135281352913530135311353213533135341353513536135371353813539135401354113542135431354413545135461354713548135491355013551135521355313554135551355613557135581355913560135611356213563135641356513566135671356813569135701357113572135731357413575135761357713578135791358013581135821358313584135851358613587135881358913590135911359213593135941359513596135971359813599136001360113602136031360413605136061360713608136091361013611136121361313614136151361613617136181361913620136211362213623136241362513626136271362813629136301363113632136331363413635136361363713638136391364013641136421364313644136451364613647136481364913650136511365213653136541365513656136571365813659136601366113662136631366413665136661366713668136691367013671136721367313674136751367613677136781367913680136811368213683136841368513686136871368813689136901369113692136931369413695136961369713698136991370013701137021370313704137051370613707137081370913710137111371213713137141371513716137171371813719137201372113722137231372413725137261372713728137291373013731137321373313734137351373613737137381373913740137411374213743137441374513746137471374813749137501375113752137531375413755137561375713758137591376013761137621376313764137651376613767137681376913770137711377213773137741377513776137771377813779137801378113782137831378413785137861378713788137891379013791137921379313794137951379613797137981379913800138011380213803138041380513806138071380813809138101381113812138131381413815138161381713818138191382013821138221382313824138251382613827138281382913830138311383213833138341383513836138371383813839138401384113842138431384413845138461384713848138491385013851138521385313854138551385613857138581385913860138611386213863138641386513866138671386813869138701387113872138731387413875138761387713878138791388013881138821388313884138851388613887138881388913890138911389213893138941389513896138971389813899139001390113902139031390413905139061390713908139091391013911139121391313914139151391613917139181391913920139211392213923139241392513926139271392813929139301393113932139331393413935139361393713938139391394013941139421394313944139451394613947139481394913950139511395213953139541395513956139571395813959139601396113962139631396413965139661396713968139691397013971139721397313974139751397613977139781397913980139811398213983139841398513986139871398813989139901399113992139931399413995139961399713998139991400014001140021400314004140051400614007140081400914010140111401214013140141401514016140171401814019140201402114022140231402414025140261402714028140291403014031140321403314034140351403614037140381403914040140411404214043140441404514046140471404814049140501405114052140531405414055140561405714058140591406014061140621406314064140651406614067140681406914070140711407214073140741407514076140771407814079140801408114082140831408414085140861408714088140891409014091140921409314094140951409614097140981409914100141011410214103141041410514106141071410814109141101411114112141131411414115141161411714118141191412014121141221412314124141251412614127141281412914130141311413214133141341413514136141371413814139141401414114142141431414414145141461414714148141491415014151141521415314154141551415614157141581415914160141611416214163141641416514166141671416814169141701417114172141731417414175141761417714178141791418014181141821418314184141851418614187141881418914190141911419214193141941419514196141971419814199142001420114202142031420414205142061420714208142091421014211142121421314214142151421614217142181421914220142211422214223142241422514226142271422814229142301423114232142331423414235142361423714238142391424014241142421424314244142451424614247142481424914250142511425214253142541425514256142571425814259142601426114262142631426414265142661426714268142691427014271142721427314274142751427614277142781427914280142811428214283142841428514286142871428814289142901429114292142931429414295142961429714298142991430014301143021430314304143051430614307143081430914310143111431214313143141431514316143171431814319143201432114322143231432414325143261432714328143291433014331143321433314334143351433614337143381433914340143411434214343143441434514346143471434814349143501435114352143531435414355143561435714358143591436014361143621436314364143651436614367143681436914370143711437214373143741437514376143771437814379143801438114382143831438414385143861438714388143891439014391143921439314394143951439614397143981439914400144011440214403144041440514406144071440814409144101441114412144131441414415144161441714418144191442014421144221442314424144251442614427144281442914430144311443214433144341443514436144371443814439144401444114442144431444414445144461444714448144491445014451144521445314454144551445614457144581445914460144611446214463144641446514466144671446814469144701447114472144731447414475144761447714478144791448014481144821448314484144851448614487144881448914490144911449214493144941449514496144971449814499145001450114502145031450414505145061450714508145091451014511145121451314514145151451614517145181451914520145211452214523145241452514526145271452814529145301453114532145331453414535145361453714538145391454014541145421454314544145451454614547145481454914550145511455214553145541455514556145571455814559145601456114562145631456414565145661456714568145691457014571145721457314574145751457614577145781457914580145811458214583145841458514586145871458814589145901459114592145931459414595145961459714598145991460014601146021460314604146051460614607146081460914610146111461214613146141461514616146171461814619146201462114622146231462414625146261462714628146291463014631146321463314634146351463614637146381463914640146411464214643146441464514646146471464814649146501465114652146531465414655146561465714658146591466014661146621466314664146651466614667146681466914670146711467214673146741467514676146771467814679146801468114682146831468414685146861468714688146891469014691146921469314694146951469614697146981469914700147011470214703147041470514706147071470814709147101471114712147131471414715147161471714718147191472014721147221472314724147251472614727147281472914730147311473214733147341473514736147371473814739147401474114742147431474414745147461474714748147491475014751147521475314754147551475614757147581475914760147611476214763147641476514766147671476814769147701477114772147731477414775147761477714778147791478014781147821478314784147851478614787147881478914790147911479214793147941479514796147971479814799148001480114802148031480414805148061480714808148091481014811148121481314814148151481614817148181481914820148211482214823148241482514826148271482814829148301483114832148331483414835148361483714838148391484014841148421484314844148451484614847148481484914850148511485214853148541485514856148571485814859148601486114862148631486414865148661486714868148691487014871148721487314874148751487614877148781487914880148811488214883148841488514886148871488814889148901489114892148931489414895148961489714898148991490014901149021490314904149051490614907149081490914910149111491214913149141491514916149171491814919149201492114922149231492414925149261492714928149291493014931149321493314934149351493614937149381493914940149411494214943149441494514946149471494814949149501495114952149531495414955149561495714958149591496014961149621496314964149651496614967149681496914970149711497214973149741497514976149771497814979149801498114982149831498414985149861498714988149891499014991149921499314994149951499614997149981499915000150011500215003150041500515006150071500815009150101501115012150131501415015150161501715018150191502015021150221502315024150251502615027150281502915030150311503215033150341503515036150371503815039150401504115042150431504415045150461504715048150491505015051150521505315054150551505615057150581505915060150611506215063150641506515066150671506815069150701507115072150731507415075150761507715078150791508015081150821508315084150851508615087150881508915090150911509215093150941509515096150971509815099151001510115102151031510415105151061510715108151091511015111151121511315114151151511615117151181511915120151211512215123151241512515126151271512815129151301513115132151331513415135151361513715138151391514015141151421514315144151451514615147151481514915150151511515215153151541515515156151571515815159151601516115162151631516415165151661516715168151691517015171151721517315174151751517615177151781517915180151811518215183151841518515186151871518815189151901519115192151931519415195151961519715198151991520015201152021520315204152051520615207152081520915210152111521215213152141521515216152171521815219152201522115222152231522415225152261522715228152291523015231152321523315234152351523615237152381523915240152411524215243152441524515246152471524815249152501525115252152531525415255152561525715258152591526015261152621526315264152651526615267152681526915270152711527215273152741527515276152771527815279152801528115282152831528415285152861528715288152891529015291152921529315294152951529615297152981529915300153011530215303153041530515306153071530815309153101531115312153131531415315153161531715318153191532015321153221532315324153251532615327153281532915330153311533215333153341533515336153371533815339153401534115342153431534415345153461534715348153491535015351153521535315354153551535615357153581535915360153611536215363153641536515366153671536815369153701537115372153731537415375153761537715378153791538015381153821538315384153851538615387153881538915390153911539215393153941539515396153971539815399154001540115402154031540415405154061540715408154091541015411154121541315414154151541615417154181541915420154211542215423154241542515426154271542815429154301543115432154331543415435154361543715438154391544015441154421544315444154451544615447154481544915450154511545215453154541545515456154571545815459154601546115462154631546415465154661546715468154691547015471154721547315474154751547615477154781547915480154811548215483154841548515486154871548815489154901549115492154931549415495154961549715498154991550015501155021550315504155051550615507155081550915510155111551215513155141551515516155171551815519155201552115522155231552415525155261552715528155291553015531155321553315534155351553615537155381553915540155411554215543155441554515546155471554815549155501555115552155531555415555155561555715558155591556015561155621556315564155651556615567155681556915570155711557215573155741557515576155771557815579155801558115582155831558415585155861558715588155891559015591155921559315594155951559615597155981559915600156011560215603156041560515606156071560815609156101561115612156131561415615156161561715618156191562015621156221562315624156251562615627156281562915630156311563215633156341563515636156371563815639156401564115642156431564415645156461564715648156491565015651156521565315654156551565615657156581565915660156611566215663156641566515666156671566815669156701567115672156731567415675156761567715678156791568015681156821568315684156851568615687156881568915690156911569215693156941569515696156971569815699157001570115702157031570415705157061570715708157091571015711157121571315714157151571615717157181571915720157211572215723157241572515726157271572815729157301573115732157331573415735157361573715738157391574015741157421574315744157451574615747157481574915750157511575215753157541575515756157571575815759157601576115762157631576415765157661576715768157691577015771157721577315774157751577615777157781577915780157811578215783157841578515786157871578815789157901579115792157931579415795157961579715798157991580015801158021580315804158051580615807158081580915810158111581215813158141581515816158171581815819158201582115822158231582415825158261582715828158291583015831158321583315834158351583615837158381583915840158411584215843158441584515846158471584815849158501585115852158531585415855158561585715858158591586015861158621586315864158651586615867158681586915870158711587215873158741587515876158771587815879158801588115882158831588415885158861588715888158891589015891158921589315894158951589615897158981589915900159011590215903159041590515906159071590815909159101591115912159131591415915159161591715918159191592015921159221592315924159251592615927159281592915930159311593215933159341593515936159371593815939159401594115942159431594415945159461594715948159491595015951159521595315954159551595615957159581595915960159611596215963159641596515966159671596815969159701597115972159731597415975159761597715978159791598015981159821598315984159851598615987159881598915990159911599215993159941599515996159971599815999160001600116002160031600416005160061600716008160091601016011160121601316014160151601616017160181601916020160211602216023160241602516026160271602816029160301603116032160331603416035160361603716038160391604016041160421604316044160451604616047160481604916050160511605216053160541605516056160571605816059160601606116062160631606416065160661606716068160691607016071160721607316074160751607616077160781607916080160811608216083160841608516086160871608816089160901609116092160931609416095160961609716098160991610016101161021610316104161051610616107161081610916110161111611216113161141611516116161171611816119161201612116122161231612416125161261612716128161291613016131161321613316134161351613616137161381613916140161411614216143161441614516146161471614816149161501615116152161531615416155161561615716158161591616016161161621616316164161651616616167161681616916170161711617216173161741617516176161771617816179161801618116182161831618416185161861618716188161891619016191161921619316194161951619616197161981619916200162011620216203162041620516206162071620816209162101621116212162131621416215162161621716218162191622016221162221622316224162251622616227162281622916230162311623216233162341623516236162371623816239162401624116242162431624416245162461624716248162491625016251162521625316254162551625616257162581625916260162611626216263162641626516266162671626816269162701627116272162731627416275162761627716278162791628016281162821628316284162851628616287162881628916290162911629216293162941629516296162971629816299163001630116302163031630416305163061630716308163091631016311163121631316314163151631616317163181631916320163211632216323163241632516326163271632816329163301633116332163331633416335163361633716338163391634016341163421634316344163451634616347163481634916350163511635216353163541635516356163571635816359163601636116362163631636416365163661636716368163691637016371163721637316374163751637616377163781637916380163811638216383163841638516386163871638816389163901639116392163931639416395163961639716398163991640016401164021640316404164051640616407164081640916410164111641216413164141641516416164171641816419164201642116422164231642416425164261642716428164291643016431164321643316434164351643616437164381643916440164411644216443164441644516446164471644816449164501645116452164531645416455164561645716458164591646016461164621646316464164651646616467164681646916470164711647216473164741647516476164771647816479164801648116482164831648416485164861648716488164891649016491164921649316494164951649616497164981649916500165011650216503165041650516506165071650816509165101651116512165131651416515165161651716518165191652016521165221652316524165251652616527165281652916530165311653216533165341653516536165371653816539165401654116542165431654416545165461654716548165491655016551165521655316554165551655616557165581655916560165611656216563165641656516566165671656816569165701657116572165731657416575165761657716578165791658016581165821658316584165851658616587165881658916590165911659216593165941659516596165971659816599166001660116602166031660416605166061660716608166091661016611166121661316614166151661616617166181661916620166211662216623166241662516626166271662816629166301663116632166331663416635166361663716638166391664016641166421664316644166451664616647166481664916650166511665216653166541665516656166571665816659166601666116662166631666416665166661666716668166691667016671166721667316674166751667616677166781667916680166811668216683166841668516686166871668816689166901669116692166931669416695166961669716698166991670016701167021670316704167051670616707167081670916710167111671216713167141671516716167171671816719167201672116722167231672416725167261672716728167291673016731167321673316734167351673616737167381673916740167411674216743167441674516746167471674816749167501675116752167531675416755167561675716758167591676016761167621676316764167651676616767167681676916770167711677216773167741677516776167771677816779167801678116782167831678416785167861678716788167891679016791167921679316794167951679616797167981679916800168011680216803168041680516806168071680816809168101681116812168131681416815168161681716818168191682016821168221682316824168251682616827168281682916830168311683216833168341683516836168371683816839168401684116842168431684416845168461684716848168491685016851168521685316854168551685616857168581685916860168611686216863168641686516866168671686816869168701687116872168731687416875168761687716878168791688016881168821688316884168851688616887168881688916890168911689216893168941689516896168971689816899169001690116902169031690416905169061690716908169091691016911169121691316914169151691616917169181691916920169211692216923169241692516926169271692816929169301693116932169331693416935169361693716938169391694016941169421694316944169451694616947169481694916950169511695216953169541695516956169571695816959169601696116962169631696416965169661696716968169691697016971169721697316974169751697616977169781697916980169811698216983169841698516986169871698816989169901699116992169931699416995169961699716998169991700017001170021700317004170051700617007170081700917010170111701217013170141701517016170171701817019170201702117022170231702417025170261702717028170291703017031170321703317034170351703617037170381703917040170411704217043170441704517046170471704817049170501705117052170531705417055170561705717058170591706017061170621706317064170651706617067170681706917070170711707217073170741707517076170771707817079170801708117082170831708417085170861708717088170891709017091170921709317094170951709617097170981709917100171011710217103171041710517106171071710817109171101711117112171131711417115171161711717118171191712017121171221712317124171251712617127171281712917130171311713217133171341713517136171371713817139171401714117142171431714417145171461714717148171491715017151171521715317154171551715617157171581715917160171611716217163171641716517166171671716817169171701717117172171731717417175171761717717178171791718017181171821718317184171851718617187171881718917190171911719217193171941719517196171971719817199172001720117202172031720417205172061720717208172091721017211172121721317214172151721617217172181721917220172211722217223172241722517226172271722817229172301723117232172331723417235172361723717238172391724017241172421724317244172451724617247172481724917250172511725217253172541725517256172571725817259172601726117262172631726417265172661726717268172691727017271172721727317274172751727617277172781727917280172811728217283172841728517286172871728817289172901729117292172931729417295172961729717298172991730017301173021730317304173051730617307173081730917310173111731217313173141731517316173171731817319173201732117322173231732417325173261732717328173291733017331173321733317334173351733617337173381733917340173411734217343173441734517346173471734817349173501735117352173531735417355173561735717358173591736017361173621736317364173651736617367173681736917370173711737217373173741737517376173771737817379173801738117382173831738417385173861738717388173891739017391173921739317394173951739617397173981739917400174011740217403174041740517406174071740817409174101741117412174131741417415174161741717418174191742017421174221742317424174251742617427174281742917430174311743217433174341743517436174371743817439174401744117442174431744417445174461744717448174491745017451174521745317454174551745617457174581745917460174611746217463174641746517466174671746817469174701747117472174731747417475174761747717478174791748017481174821748317484174851748617487174881748917490174911749217493174941749517496174971749817499175001750117502175031750417505175061750717508175091751017511175121751317514175151751617517175181751917520175211752217523175241752517526175271752817529175301753117532175331753417535175361753717538175391754017541175421754317544175451754617547175481754917550175511755217553175541755517556175571755817559175601756117562175631756417565175661756717568175691757017571175721757317574175751757617577175781757917580175811758217583175841758517586175871758817589175901759117592175931759417595175961759717598175991760017601176021760317604176051760617607176081760917610176111761217613176141761517616176171761817619176201762117622176231762417625176261762717628176291763017631176321763317634176351763617637176381763917640176411764217643176441764517646176471764817649176501765117652176531765417655176561765717658176591766017661176621766317664176651766617667176681766917670176711767217673176741767517676176771767817679176801768117682176831768417685176861768717688176891769017691176921769317694176951769617697176981769917700177011770217703177041770517706177071770817709177101771117712177131771417715177161771717718177191772017721177221772317724177251772617727177281772917730177311773217733177341773517736177371773817739177401774117742177431774417745177461774717748177491775017751177521775317754177551775617757177581775917760177611776217763177641776517766177671776817769177701777117772177731777417775177761777717778177791778017781177821778317784177851778617787177881778917790177911779217793177941779517796177971779817799178001780117802178031780417805178061780717808178091781017811178121781317814178151781617817178181781917820178211782217823178241782517826178271782817829178301783117832178331783417835178361783717838178391784017841178421784317844178451784617847178481784917850178511785217853178541785517856178571785817859178601786117862178631786417865178661786717868178691787017871178721787317874178751787617877178781787917880178811788217883178841788517886178871788817889178901789117892178931789417895178961789717898178991790017901179021790317904179051790617907179081790917910179111791217913179141791517916179171791817919179201792117922179231792417925179261792717928179291793017931179321793317934179351793617937179381793917940179411794217943179441794517946179471794817949179501795117952179531795417955179561795717958179591796017961179621796317964179651796617967179681796917970179711797217973179741797517976179771797817979179801798117982179831798417985179861798717988179891799017991179921799317994179951799617997179981799918000180011800218003180041800518006180071800818009180101801118012180131801418015180161801718018180191802018021180221802318024180251802618027180281802918030180311803218033180341803518036180371803818039180401804118042180431804418045180461804718048180491805018051180521805318054180551805618057180581805918060180611806218063180641806518066180671806818069180701807118072180731807418075180761807718078180791808018081180821808318084180851808618087180881808918090180911809218093180941809518096180971809818099181001810118102181031810418105181061810718108181091811018111181121811318114181151811618117181181811918120181211812218123181241812518126181271812818129181301813118132181331813418135181361813718138181391814018141181421814318144181451814618147181481814918150181511815218153181541815518156181571815818159181601816118162181631816418165181661816718168181691817018171181721817318174181751817618177181781817918180181811818218183181841818518186181871818818189181901819118192181931819418195181961819718198181991820018201182021820318204182051820618207182081820918210182111821218213182141821518216182171821818219182201822118222182231822418225182261822718228182291823018231182321823318234182351823618237182381823918240182411824218243182441824518246182471824818249182501825118252182531825418255182561825718258182591826018261182621826318264182651826618267182681826918270182711827218273182741827518276182771827818279182801828118282182831828418285182861828718288182891829018291182921829318294182951829618297182981829918300183011830218303183041830518306183071830818309183101831118312183131831418315183161831718318183191832018321183221832318324183251832618327183281832918330183311833218333183341833518336183371833818339183401834118342183431834418345183461834718348183491835018351183521835318354183551835618357183581835918360183611836218363183641836518366183671836818369183701837118372183731837418375183761837718378183791838018381183821838318384183851838618387183881838918390183911839218393183941839518396183971839818399184001840118402184031840418405184061840718408184091841018411184121841318414184151841618417184181841918420184211842218423184241842518426184271842818429184301843118432184331843418435184361843718438184391844018441184421844318444184451844618447184481844918450184511845218453184541845518456184571845818459184601846118462184631846418465184661846718468184691847018471184721847318474184751847618477184781847918480184811848218483184841848518486184871848818489184901849118492184931849418495184961849718498184991850018501185021850318504185051850618507185081850918510185111851218513185141851518516185171851818519185201852118522185231852418525185261852718528185291853018531185321853318534185351853618537185381853918540185411854218543185441854518546185471854818549185501855118552185531855418555185561855718558185591856018561185621856318564185651856618567185681856918570185711857218573185741857518576185771857818579185801858118582185831858418585185861858718588185891859018591185921859318594185951859618597185981859918600186011860218603186041860518606186071860818609186101861118612186131861418615186161861718618186191862018621186221862318624186251862618627186281862918630186311863218633186341863518636186371863818639186401864118642186431864418645186461864718648186491865018651186521865318654186551865618657186581865918660186611866218663186641866518666186671866818669186701867118672186731867418675186761867718678186791868018681186821868318684186851868618687186881868918690186911869218693186941869518696186971869818699187001870118702187031870418705187061870718708187091871018711187121871318714187151871618717187181871918720187211872218723187241872518726187271872818729187301873118732187331873418735187361873718738187391874018741187421874318744187451874618747187481874918750187511875218753187541875518756187571875818759187601876118762187631876418765187661876718768187691877018771187721877318774187751877618777187781877918780187811878218783187841878518786187871878818789187901879118792187931879418795187961879718798187991880018801188021880318804188051880618807188081880918810188111881218813188141881518816188171881818819188201882118822188231882418825188261882718828188291883018831188321883318834188351883618837188381883918840188411884218843188441884518846188471884818849188501885118852188531885418855188561885718858188591886018861188621886318864188651886618867188681886918870188711887218873188741887518876188771887818879188801888118882188831888418885188861888718888188891889018891188921889318894188951889618897188981889918900189011890218903189041890518906189071890818909189101891118912189131891418915189161891718918189191892018921189221892318924189251892618927189281892918930189311893218933189341893518936189371893818939189401894118942189431894418945189461894718948189491895018951189521895318954189551895618957189581895918960189611896218963189641896518966189671896818969189701897118972189731897418975189761897718978189791898018981189821898318984189851898618987189881898918990189911899218993189941899518996189971899818999190001900119002190031900419005190061900719008190091901019011190121901319014190151901619017190181901919020190211902219023190241902519026190271902819029190301903119032190331903419035190361903719038190391904019041190421904319044190451904619047190481904919050190511905219053190541905519056190571905819059190601906119062190631906419065190661906719068190691907019071190721907319074190751907619077190781907919080190811908219083190841908519086190871908819089190901909119092190931909419095190961909719098190991910019101191021910319104191051910619107191081910919110191111911219113191141911519116191171911819119191201912119122191231912419125191261912719128191291913019131191321913319134191351913619137191381913919140191411914219143191441914519146191471914819149191501915119152191531915419155191561915719158191591916019161191621916319164191651916619167191681916919170191711917219173191741917519176191771917819179191801918119182191831918419185191861918719188191891919019191191921919319194191951919619197191981919919200192011920219203192041920519206192071920819209192101921119212192131921419215192161921719218192191922019221192221922319224192251922619227192281922919230192311923219233192341923519236192371923819239192401924119242192431924419245192461924719248192491925019251192521925319254192551925619257192581925919260192611926219263192641926519266192671926819269192701927119272192731927419275192761927719278192791928019281192821928319284192851928619287192881928919290192911929219293192941929519296192971929819299193001930119302193031930419305193061930719308193091931019311193121931319314193151931619317193181931919320193211932219323193241932519326193271932819329193301933119332193331933419335193361933719338193391934019341193421934319344193451934619347193481934919350193511935219353193541935519356193571935819359193601936119362193631936419365193661936719368193691937019371193721937319374193751937619377193781937919380193811938219383193841938519386193871938819389193901939119392193931939419395193961939719398193991940019401194021940319404194051940619407194081940919410194111941219413194141941519416194171941819419194201942119422194231942419425194261942719428194291943019431194321943319434194351943619437194381943919440194411944219443194441944519446194471944819449194501945119452194531945419455194561945719458194591946019461194621946319464194651946619467194681946919470194711947219473194741947519476194771947819479194801948119482194831948419485194861948719488194891949019491194921949319494194951949619497194981949919500195011950219503195041950519506195071950819509195101951119512195131951419515195161951719518195191952019521195221952319524195251952619527195281952919530195311953219533195341953519536195371953819539195401954119542195431954419545195461954719548195491955019551195521955319554195551955619557195581955919560195611956219563195641956519566195671956819569195701957119572195731957419575195761957719578195791958019581195821958319584195851958619587195881958919590195911959219593195941959519596195971959819599196001960119602196031960419605196061960719608196091961019611196121961319614196151961619617196181961919620196211962219623196241962519626196271962819629196301963119632196331963419635196361963719638196391964019641196421964319644196451964619647196481964919650196511965219653196541965519656196571965819659196601966119662196631966419665196661966719668196691967019671196721967319674196751967619677196781967919680196811968219683196841968519686196871968819689196901969119692196931969419695196961969719698196991970019701197021970319704197051970619707197081970919710197111971219713197141971519716197171971819719197201972119722197231972419725197261972719728197291973019731197321973319734197351973619737197381973919740197411974219743197441974519746197471974819749197501975119752197531975419755197561975719758197591976019761197621976319764197651976619767197681976919770197711977219773197741977519776197771977819779197801978119782197831978419785197861978719788197891979019791197921979319794197951979619797197981979919800198011980219803198041980519806198071980819809198101981119812198131981419815198161981719818198191982019821198221982319824198251982619827198281982919830198311983219833198341983519836198371983819839198401984119842198431984419845198461984719848198491985019851198521985319854198551985619857198581985919860198611986219863198641986519866198671986819869198701987119872198731987419875198761987719878198791988019881198821988319884198851988619887198881988919890198911989219893198941989519896198971989819899199001990119902199031990419905199061990719908199091991019911199121991319914199151991619917199181991919920199211992219923199241992519926199271992819929199301993119932199331993419935199361993719938199391994019941199421994319944199451994619947199481994919950199511995219953199541995519956199571995819959199601996119962199631996419965199661996719968199691997019971199721997319974199751997619977199781997919980199811998219983199841998519986199871998819989199901999119992199931999419995199961999719998199992000020001200022000320004200052000620007200082000920010200112001220013200142001520016200172001820019200202002120022200232002420025200262002720028200292003020031200322003320034200352003620037200382003920040200412004220043200442004520046200472004820049200502005120052200532005420055200562005720058200592006020061200622006320064200652006620067200682006920070200712007220073200742007520076200772007820079200802008120082200832008420085200862008720088200892009020091200922009320094200952009620097200982009920100201012010220103201042010520106201072010820109201102011120112201132011420115201162011720118201192012020121201222012320124201252012620127201282012920130201312013220133 |
- /*
- *+------------------------------------------------------------------------+
- *| Licensed Materials - Property of IBM
- *| IBM Cognos Products: Content Explorer
- *| (C) Copyright IBM Corp. 2015, 2018
- *|
- *| US Government Users Restricted Rights - Use, duplication or disclosure
- *| restricted by GSA ADP Schedule Contract with IBM Corp.
- *+------------------------------------------------------------------------+
- */
- define('bacontentnav/common/ui/list_actions/ListAction',[
- '../../../lib/@waca/core-client/js/core-client/ui/core/Class',
- '../../../utils/ContentStoreObject',
- 'underscore'
- ], function(Class, ContentStoreObject, _) {
- 'use strict';
- var ListAction = Class.extend({
- /**
- These options are optional, either they get passed in the constructor or in the options
- when calling the isItemVisible and onSelectItems methods
- options.oListControl {object}
- options.aSelctedContext {object}
- **/
- init: function(options) {
- ListAction.inherited('init', this, arguments);
- _.extend(this, options);
- },
- isItemVisible: function(options) {
- void(options);
- var elements = options.target.itemId.split('.');
- var actionName = elements.pop();
- var listControl = this.getListControl(options);
- if (listControl && listControl.contentView.isEnabledAction) {
- return listControl.contentView.isEnabledAction(actionName);
- } else if (options.target.activeObject && options.target.activeObject.contentView.isEnabledAction) {
- return options.target.activeObject.contentView.isEnabledAction(actionName);
- }
- return true;
- },
- /**
- Glass API, this is what gets called when a menu item is clicked
- **/
- onSelectItem: function(options) {
- return this.getMissingData(options).then(function(options) {
- this.execute(options);
- }.bind(this));
- },
- /**
- * Returns an array of properties
- */
- getRequiredPropertiesList: function(options) {
- void(options);
- //To be overridden by subclass as needed.
- },
- getMissingData: function(options) {
- var requiredProperties = this.getRequiredPropertiesList(options);
- if (!requiredProperties || !requiredProperties.length) {
- return Promise.resolve(options);
- }
- var missingProperties = [];
- requiredProperties.forEach(function(field) {
- if (!options.target.activeObject.aSelectedContext[0][field]) {
- missingProperties.push(field);
- }
- });
- if (!missingProperties.length) {
- return Promise.resolve(options);
- }
- return options.glassContext.getCoreSvc('.Ajax').ajax({
- 'url': ContentStoreObject.getSelfLink(options.target.activeObject.aSelectedContext[0]),
- 'dataType': 'json',
- 'data': {
- 'fields': missingProperties.join(',')
- },
- 'type': 'GET'
- })
- .then(function(response) {
- missingProperties.forEach(function(field) {
- var data = response.data && response.data.data[0] || {};
- if (field.indexOf('base') !== -1) {
- options.target.activeObject.aSelectedContext[0].base = data.base;
- } else {
- options.target.activeObject.aSelectedContext[0][field] = data[field];
- }
- }.bind(this));
- return options;
- }.bind(this));
- },
- getListControl: function(options) {
- if (!this.oListControl && options && options.target && options.target.activeObject) {
- this.oListControl = options.target.activeObject.oListControl;
- }
- return this.oListControl;
- },
- getSelectedContext: function(options) {
- if (options && options.target && options.target.activeObject) {
- return options.target.activeObject.aSelectedContext;
- }
- },
- getParentSlideout: function(options) {
- if (!this.parentSlideout && options && options.target && options.target.activeObject) {
- this.parentSlideout = options.target.activeObject.slideout;
- }
- return this.parentSlideout;
- },
- hasStateID: function(options, stateId) {
- var listControl = this.getListControl(options);
- return !!(listControl && listControl.stateId && listControl.stateId === stateId);
- }
- });
- return ListAction;
- });
- /*
- *+------------------------------------------------------------------------+
- *| Licensed Materials - Property of IBM
- *| IBM Cognos Products: BI Content Explorer
- *| (C) Copyright IBM Corp. 2015, 2020
- *|
- *| US Government Users Restricted Rights - Use, duplication or disclosure
- *| restricted by GSA ADP Schedule Contract with IBM Corp.
- *+------------------------------------------------------------------------+
- */
- define('bacontentnav/common/ui/list_actions/AddInlineAction',[
- './ListAction',
- '../../../lib/@waca/core-client/js/core-client/utils/BidiUtil',
- '../../../lib/@waca/core-client/js/core-client/utils/BrowserUtils',
- 'underscore'
- ], function(ListAction, BidiUtil, BrowserUtils, _) {
- 'use strict'; //NOSONAR
- var AddInlineAction = ListAction.extend({
- getDefaultName: function() {
- return '';
- },
- getType: function() {
- return 'text';
- },
- getClass: function() {
- return 'inlineAdded';
- },
- destroy: function() {
- AddInlineAction.inherited('destroy', this, arguments);
- this._clearBlurTimeout();
- },
- _clearBlurTimeout: function() {
- window.clearTimeout(this._blurTimeout);
- this._blurTimeout = null;
- },
- execute: function() {
- this._isCancelled = false;
- this._handledSave = false;
- this._clearBlurTimeout();
- var listControl = this.getListControl();
- listControl.setInStandbyMode(true);
- return listControl.addRowData([{
- 'defaultName': this.getDefaultName(),
- 'type': this.getType(),
- 'uid': _.uniqueId('new_' + this.getType() + '_')
- }], true).then(function(nTRs) {
- this._inlineTR = nTRs[0];
- this._updateRowForInlineEdit(this._inlineTR);
- }.bind(this));
- },
- cancel: function() {
- if (!this._isCancelled && this._inlineTR) {
- this._isCancelled = true;
- var listControl = this.getListControl();
- listControl.removeRow(this._inlineTR);
- listControl.setInStandbyMode(false);
- }
- },
- _updateRowForInlineEdit: function(TR) {
- var listControl = this.getListControl();
- listControl.setInStandbyMode(true);
- // Make sure the datatable doesn't try to render anymore rows when we scroll
- // the new row into view
- listControl.setRenderRowsOnScroll(false);
- // Scroll the TR into view
- var scrollPosition = ($(TR).height() * TR.rowIndex) - (listControl._scrollNode.height() / 2);
- listControl.getScrollingNode().scrollTop(scrollPosition);
- this._scrollStartTime = new Date();
- this._createInput($(TR));
- },
- _createInput: function($TR) {
- var listControl = this.getListControl();
- var $theDiv = $TR.find('.nameColumnDiv:first');
- $TR.addClass(this.getClass());
- var tdEllipsisCell = $theDiv.parent();
- tdEllipsisCell.empty();
- var $theInput = $(document.createElement('input'));
- $theInput.attr('type', 'text');
- if (BrowserUtils.isIE11 && BrowserUtils.isIE11()) {
- $theInput.attr('value', this.getDefaultName());
- $theInput.attr('onfocus', 'this.select()');
- } else {
- $theInput.attr('placeholder', this.getDefaultName());
- }
- tdEllipsisCell.append($theInput);
- BidiUtil.initElementForBidi($theInput[0]);
- $theInput.on('keydown', function(evt) {
- // call the blur event when the Enter key is pressed
- switch (evt.keyCode) {
- //enter
- case 13:
- this._handleBlur(evt);
- evt.stopPropagation();
- break;
- //esc
- case 27:
- evt.stopPropagation();
- this.cancel();
- break;
- }
- }.bind(this));
- $theInput.on('blur', function(evt) {
- this._handleBlur(evt);
- }.bind(this));
- if (BrowserUtils.isIPad()) {
- $theInput.on('clicktap', function(evt) {
- evt.stopPropagation();
- });
- $(window).on('clicktap.addInlineAction', function() {
- this._handleBlur({
- 'currentTarget': $theInput
- });
- $(window).off('.addInlineAction');
- }.bind(this));
- } else {
- // Only attach the scroll event if we're not on an ipad since this sometimes
- // gets triggered when the keyboard opens
- // Weird way to bind but it's the only way to correctly be able to 'unbind' once we've created the folder
- listControl.$el.find('.dataTables_scrollBody').on('scroll', null, {
- 'input': $theInput,
- 'this': this
- }, this._onScroll);
- $theInput.focus();
- }
- },
- _onScroll: function(event) {
- var $theInput = event.data.input;
- var thisObj = event.data.this;
- // Lots of scrolling events when trying to scroll the TR into View. Only process scroll events
- // if we haven't had one for 250ms (i.e. after the scroll into view is done)
- var ellapsedTime = (new Date() - thisObj._scrollStartTime);
- if (ellapsedTime > 250) {
- $theInput.blur();
- return true;
- } else {
- thisObj._scrollStartTime = new Date();
- }
- },
- _handleBlur: function(evt) {
- //ensure we don't handle multiple blurs.
- if (this._blurTimeout) {
- return;
- }
- this._blurTimeout = window.setTimeout(function() {
- this._onBlurTimeout(evt);
- }.bind(this), 300);
- },
- _onBlurTimeout: function(evt) {
- this._clearBlurTimeout();
- // Detach the scroll event
- var listControl = this.getListControl();
- listControl.$el.find('.dataTables_scrollBody').off('scroll', null, this._onScroll);
- if (!this._isCancelled) {
- if (!this._handledSave) {
- var targetValue = $(evt.currentTarget).val();
- var oData = {
- 'defaultName': this._validateInput(targetValue),
- 'type': this.getType()
- };
- this._handledSave = true;
- this.sendAddRequest(oData, this.getListControl());
- }
- } else {
- this.cancel();
- }
- },
- _validateInput: function(inputString) {
- // remove whitespaces from both ends of the input string
- var trim = inputString ? inputString.trim() : '';
- // replace whitespace characters to normal space, could escape unicode non-breaking character
- trim = trim.replace(/\s/g, ' ');
- // use default if the trimmed input is empty
- return trim || this.getDefaultName();
- },
- // need to override, pass in data, listControl
- sendAddRequest: function() {
- return Promise.resolve(true);
- }
- });
- return AddInlineAction;
- });
- /*
- *+------------------------------------------------------------------------+
- *| Licensed Materials - Property of IBM
- *| IBM Cognos Products: Dashboard
- *| (C) Copyright IBM Corp. 2015, 2016
- *|
- *| US Government Users Restricted Rights - Use, duplication or disclosure
- *| restricted by GSA ADP Schedule Contract with IBM Corp.
- *+------------------------------------------------------------------------+
- */
- define('bacontentnav/lib/gemini/dashboard/nls/DashboardResources',{
- "root": true,
- "cs": true,
- "da": true,
- "de": true,
- "es": true,
- "fi": true,
- "fr": true,
- "hr": true,
- "hu": true,
- "it": true,
- "ja": true,
- "kk": true,
- "ko": true,
- "no": true,
- "nb": true,
- "nl": true,
- "pl": true,
- "pt": true,
- "pt-br": true,
- "ro": true,
- "ru": true,
- "sl": true,
- "sv": true,
- "th": true,
- "tr": true,
- "zh": true,
- "zh-cn": true,
- "zh-tw": true
- });
- /**
- * Licensed Materials - Property of IBM
- *
- * IBM Cognos Products: BI Glass
- *
- * Copyright IBM Corp. 2017
- *
- * US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
- */
- define('bacontentnav/lib/gemini/dashboard/nls/root/DashboardResources',{
- "noSourcesSelectedLabel": "No sources selected",
- "heatChartProp_colorPaletteLabel": "Color palettes",
- "barChartProp_hideGridLinesDescription": "Hide grid lines",
- "lineChartProp_hideAxisTitleLabelsLabel": "Hide axis title labels",
- "editDashboardCoachMarkContents": "Click the pencil icon to edit this dashboard.",
- "lineChartProp_lineColorLabel": "Line and symbol color",
- "lineChartProp_interpolationLabel": "Smooth lines",
- "NoPinsCollected": "No items collected",
- "clusterLineDataSlot_valuesRepeatingLabel": "Value",
- "moreMembers": "Show more...",
- "areaChartProp_interpolationDescription": "Lines connecting the data points are curved.",
- "radialChartCaption": "Radial",
- "clusterColumnName": "Column",
- "heatDataSlot_yAxisLabel": "Vertical axis",
- "stackedColumnDataSlot_categoriesLabel": "Axis label",
- "radialBarChartProp_maintainAxisScalesLabel": "Maintain axis scale",
- "barChartCaption": "Bar",
- "mapDescription": "Legacy Map",
- "errorLoadingDataSetMetaData": "An error occurred while reading the metadata",
- "lineColumnComboChartProp_maintainAxisScalesLabel": "Maintain axis scale",
- "backLabel": "Go back",
- "lineColumnComboChartProp_hideSymbolsLabel": "Hide symbols",
- "hideShowSummaries": "Hide show summaries",
- "pieChartDataSlot_categoriesLabel": "Categories",
- "bubbleDataSlot_yAxisLabel": "Vertical axis",
- "heatDescription": "Heat",
- "scatterPlotDescription": "Scatter plot",
- "tabName_general": "General",
- "lineChartProp_hideSymbolsDescription": "Hide symbols",
- "dataAssetPropertiesLabel": "Visualization properties",
- "treeMapName": "Tree map",
- "scatterPlotChartNoCatDataSlot_yAxisLabel": "Vertical axis",
- "tabName_animation": "Animation",
- "bodySmallTextLabel": "Body Small",
- "pointChart1catProp_symbolShapeLabel": "Symbol shape",
- "propWordColor": "Word color",
- "areaDataSlot_valuesLabel": "Value",
- "scatterPlotChartNoCatProp_elementColorLabel": "Element color",
- "heatChartProp_maintainAxisScalesDescription": "Always display the minimum and maximum values on the axes.",
- "columnChartProp_hideAxisTitleLabelsLabel": "Hide axis title labels",
- "areaChartProp_maintainAxisScalesDescription": "Always display the minimum and maximum values on the axes.",
- "packedBubbleChart1CatDataSlot_categoriesLabel": "Categories",
- "clusterBarDataSlot_categoriesLabel": "Axis label",
- "wordChart1Cat1MeasureProp_elementColorLabel": "Word color",
- "pieDescription": "Pie",
- "okButton": "OK",
- "lineColumnComboChartProp_maintainAxisScalesDescription": "Always display the minimum and maximum values on the axes.",
- "treeMapDataSlot_valuesLabel": "Size by",
- "lineChartProp_interpolationDescription": "Lines connecting the data points are curved.",
- "radialBarDataSlot_categoriesLabel": "Categories",
- "packedBubbleChart1CatProp_hideLabelLabel": "Hide label",
- "pointDataSlot_categoriesLabel": "Axis label",
- "areaChartDataSlot_valuesLabel": "Value",
- "imageWidgetLabel": "Image",
- "areaChartProp_maintainAxisScalesLabel": "Maintain axis scale",
- "packedBubbleDataSlot_colorLabel": "Color by",
- "radialChartProp_hideRadialValueLabel": "Hide value",
- "clusterColumnDataSlot_valuesLabel": "Value",
- "barChartProp_hideAxisTitleLabelsDescription": "Hide the titles for the axes.",
- "map1measureDataSlot_valuesLabel": "Region heat",
- "noStoryFound": "The story cannot be retrieved. Either it no longer exists or you don't have sufficient privileges to view it.",
- "addDataDashboardCoachMarkContents": "Drag and drop data from the data panel onto your dashboard.",
- "heatChartDataSlot_valuesLabel": "Heat by",
- "bubbleChartProp_colorPaletteLabel": "Color palettes",
- "selectTemplateLabel": "Select a template",
- "columnChartProp_hideGridLinesDescription": "Hide grid lines",
- "stackedColumnDescription": "Stack column",
- "sourcePaneLabel": "Selected sources",
- "propLineColor": "Line color",
- "radialChartProp_elementColorLabel": "Radial bar color",
- "noDashboardFound": "The dashboard cannot be retrieved. Either it no longer exists or you don't have sufficient privileges to view it.",
- "clusterLineName": "Line",
- "stackedColumnDataSlot_colorLabel": "Color by",
- "radialChartProp_suppressZerosDescription": "Hide categories with no associated values.",
- "barChartProp_maintainAxisScalesLabel": "Maintain axis scale",
- "heatChartProp_hideLegendDescription": "Hide the legend.",
- "tabName_textDetails": "Text details",
- "cmDuplicateName": "An item with this name already exists. Try another name",
- "editStoryCoachMarkTitle": "Edit story",
- "lineColumnComboChartProp_symbolShapeLabel": "Symbol shape",
- "HistogramYAxisTitle": "Count",
- "pinAddedToast": "Item was successfully collected",
- "crosstabName": "Crosstab",
- "lineColumnComboChartDataSlot_lineValueLabel": "Line value",
- "mapDataSlot_sizeHeatLabel": "Point heat",
- "propElementColor": "Visualization element color",
- "stackedColumnName": "Stack column",
- "wordChart1Cat1MeasureProp_suppressZerosLabel": "Hide empty",
- "addSourceLabel": "Add a source",
- "radialBarChartProp_colorPaletteLabel": "Color palettes",
- "treeMap1Cat1MeasureChartProp_maintainAxisScalesDescription": "Always display the minimum and maximum values on the axes.",
- "radialDataSlot_categoriesLabel": "Categories",
- "summaryChartDescription": "Summary",
- "heatChartProp_legendPositionLabel": "Legend position",
- "preAggregateLabel": "Apply prompt values from the data source",
- "wordChart1Cat1MeasureProp_maintainAxisScalesLabel": "Maintain axis scale",
- "noStoryPermision": "You do not have sufficient privileges to view this story",
- "pieDataSlot_valuesLabel": "Value",
- "heatName": "Heat",
- "lineColumnComboChartProp_hideLegendLabel": "Hide legend",
- "pieChartDataSlot_valuesLabel": "Value",
- "pieName": "Pie",
- "darkThemeLabel": "Dark",
- "lineColumnComboChartDataSlot_categoryLabel": "Axis label",
- "map1measureProp_heatScalePaletteLabel": "Color order",
- "barChartProp_suppressZerosLabel": "Hide empty",
- "pointChart1catProp_colorPaletteLabel": "Color palettes",
- "pieChartProp_legendPositionLabel": "Legend position",
- "tabName_visDetails": "Details",
- "wordCloudDataSlot_colorLabel": "Color by",
- "treeMapDescription": "Tree map",
- "treeMap1Cat1MeasureChartProp_maintainAxisScalesLabel": "Maintain axis scale",
- "bubbleChartProp_hideAxisTitleLabelsDescription": "Hide the titles for the axes.",
- "lineColumnComboDataSlot_lineValueLabel": "Line value",
- "bubbleChartProp_hideGridLinesDescription": "Hide grid lines",
- "stackedBarDataSlot_valuesRepeatingLabel": "Value",
- "noMatchDatasets": "No matched data sets found.",
- "scatterPlotDataSlot_yAxisLabel": "Vertical axis",
- "timelineAnimationProperties": "Open animation properties",
- "quoteSmallTextLabel": "Quote Small",
- "value_is_not_available": "N/A",
- "barChartProp_maintainAxisScalesDescription": "Always display the minimum and maximum values on the axes.",
- "areaName": "Area",
- "bubbleChartDataSlot_sizeLabel": "Size by",
- "packedBubbleChart1CatProp_suppressZerosDescription": "Hide categories with no associated values.",
- "treeMap1Cat1MeasureChartProp_hideLegendLabel": "Hide legend",
- "treeMap1Cat1MeasureChartProp_colorPaletteLabel": "Color palettes",
- "postAggregateLabel": "Apply prompt values in the report",
- "pointChart1catDataSlot_categoriesLabel": "Axis label",
- "scatterPlotDataSlot_categoriesLabel": "Points",
- "metadataPickerTitle": "Create Data Set",
- "pieChartProp_pieAsDonutLabel": "Display as donut chart",
- "areaDescription": "Area",
- "scatterPlotName": "Scatter plot",
- "packedBubbleName": "Packed bubble",
- "areaChartProp_lineColorLabel": "Area color",
- "bubbleChartDataSlot_xAxisLabel": "Horizontal axis",
- "scatterPlotChartNoCatProp_symbolShapeLabel": "Symbol shape",
- "bubbleChartProp_hideLegendLabel": "Hide legend",
- "lineColumnComboChartProp_hideLegendDescription": "Hide the legend.",
- "lineColumnComboDataSlot_categoryLabel": "Axis label",
- "radialName": "Radial",
- "clusterLineDataSlot_colorLabel": "Color by",
- "propHideEmpty": "Hide empty",
- "heatChartProp_suppressZerosDescription": "Hide categories with no associated values.",
- "columnChartProp_elementColorLabel": "Column color",
- "shapesDoubleChevron": "Double chevron",
- "lineColumnComboChartProp_elementColorLabel": "Column color",
- "playerDescription": "Data player",
- "map1measureProp_maintainAxisScalesDescription": "Always display the minimum and maximum values on the axes.",
- "lineColumnComboChartProp_suppressZerosDescription": "Hide categories with no associated values.",
- "stackedColumnDataSlot_valuesLabel": "Value",
- "clusterBarDescription": "Bar",
- "packedBubbleChart1CatProp_suppressZerosLabel": "Hide empty",
- "areaChartProp_suppressZerosLabel": "Hide empty",
- "clearFilterValueToolTip": "Clear filter values",
- "treeMap1Cat1MeasureChartProp_hideLegendDescription": "Hide the legend.",
- "lineChartProp_hideGridLinesDescription": "Hide grid lines",
- "noDashboardCapability": "You do not have the capability to run the dashboard application",
- "timeline_filter_moved_to": "Time line filter %{id} moved to %{time}",
- "packedBubbleDataSlot_categoriesLabel": "Categories",
- "lineChartProp_hideDataLinesLabel": "Hide line(s)",
- "cmEmptySelectionStory": "The story has been deleted. Try to save as a new story",
- "barChartDataSlot_valuesLabel": "Value",
- "dataset_location": "location",
- "bodyTextLabel": "Body",
- "gridName": "Grid",
- "dataset_time": "time",
- "bubbleChartDataSlot_colorLabel": "Color by",
- "dashboard": "Dashboard",
- "propRadialbarColor": "Radial bar color",
- "areaChartProp_interpolationLabel": "Smooth lines",
- "radialBarChartProp_suppressZerosLabel": "Hide empty",
- "cmEmptySelection": "The dashboard has been deleted. Try to save as a new dashboard",
- "clusterBarDataSlot_valuesLabel": "Value",
- "stackedBarDataSlot_colorLabel": "Color by",
- "deletePinConfirm": "Confirm delete",
- "areaChartProp_colorPaletteLabel": "Color palettes",
- "propLineAndSymbolColor": "Line and symbol color",
- "barChartDataSlot_categoriesLabel": "Axis label",
- "createDashboardTitle": "Create dashboard",
- "pieChartProp_suppressZerosLabel": "Hide empty",
- "treeMapDataSlot_colorLabel": "Heat by",
- "columnChartProp_maintainAxisScalesDescription": "Always display the minimum and maximum values on the axes.",
- "wordChart1Cat1MeasureDataSlot_wordLabel": "Words",
- "webpageWidgetLabel": "Webpage",
- "pieChartProp_pieAsDonutDescription": "Display as donut chart",
- "panAndZoomShimCoachmarkContent": "Select this story type to create an animated presentation that pans and zooms from scene to scene.",
- "radialBarDataSlot_valuesLabel": "Value",
- "treeMap2Cat2MeasureChartProp_colorPaletteLabel": "Color palettes",
- "scatterPlotChartNoCatProp_colorPaletteLabel": "Color palettes",
- "lineChartProp_hideDataLinesDescription": "Hide line(s)",
- "treeMap1Cat2MeasureChartProp_colorPaletteLabel": "Color palettes",
- "lineColumnComboChartCaption": "Line and column",
- "wordCloudDataSlot_scaleLabel": "Size by",
- "pinDeletedToast": "Collected item was removed",
- "radialDescription": "Radial",
- "areaChartProp_suppressZerosDescription": "Hide categories with no associated values.",
- "wordChart1Cat1MeasureProp_colorPaletteLabel": "Color palettes",
- "heatDataSlot_xAxisLabel": "Horizontal axis",
- "heatChartDataSlot_yAxisLabel": "Vertical axis",
- "lineColumnComboChartDataSlot_columnValueLabel": "Column value",
- "lineChartProp_hideAxisTitleLabelsDescription": "Hide the titles for the axes.",
- "treeMap1Cat1MeasureChartCaption": "Tree map",
- "summaryChartName": "Summary",
- "subtitleTextLabel": "Subtitle",
- "bubbleDataSlot_xAxisLabel": "Horizontal axis",
- "lineChartProp_hideGridLinesLabel": "Hide grid lines",
- "pointChart1catProp_suppressZerosDescription": "Hide categories with no associated values.",
- "captionTextLabel": "Caption",
- "pointChart1catProp_maintainAxisScalesLabel": "Maintain axis scale",
- "heatChartProp_maintainAxisScalesLabel": "Maintain axis scale",
- "radialDataSlot_valuesLabel": "Value",
- "lineColumnComboChartProp_hideAxisTitleLabelsLabel": "Hide axis title labels",
- "pointChart1catProp_hideAxisTitleLabelsDescription": "Hide the titles for the axes.",
- "clusterColumnDataSlot_colorLabel": "Color by",
- "bubbleChartProp_hideGridLinesLabel": "Hide grid lines",
- "lineColumnComboName": "Line and column",
- "packedBubbleDataSlot_sizeLabel": "Size by",
- "radialChartProp_colorPaletteLabel": "Color palettes",
- "pieChartCaption": "Pie",
- "addDataCoachMarkTitle": "Add data",
- "scatterPlotChartNoCatDataSlot_xAxisLabel": "Horizontal axis",
- "barChartProp_suppressZerosDescription": "Hide categories with no associated values.",
- "radialBarChartProp_suppressZerosDescription": "Hide categories with no associated values.",
- "lineChartProp_maintainAxisScalesLabel": "Maintain axis scale",
- "pinLabel": "Collection",
- "wordChart1Cat1MeasureProp_maintainAxisScalesDescription": "Always display the minimum and maximum values on the axes.",
- "heatChartProp_hideAxisTitleLabelsDescription": "Hide the titles for the axes.",
- "radialBarChartDataSlot_valuesLabel": "Value",
- "map1measureProp_maintainAxisScalesLabel": "Maintain axis scale",
- "mediaWidgetLabel": "Media",
- "columnChartProp_hideAxisTitleLabelsDescription": "Hide the titles for the axes.",
- "radialBarChartDataSlot_categoriesLabel": "Categories",
- "stackedBarDataSlot_valuesLabel": "Value",
- "radialChartProp_maintainAxisScalesLabel": "Maintain axis scale",
- "playerDataSlot_categoriesLabel": "Axis label",
- "mapName": "Legacy Map",
- "pieChartProp_hideLegendDescription": "Hide the legend.",
- "swapRowsAndColumns": "Swap rows and columns",
- "treeMapDataSlot_level3Label": "Level three",
- "editDashboardCoachMarkTitle": "Edit dashboard",
- "bubbleDataSlot_colorLabel": "Color by",
- "clusterLineDataSlot_categoriesLabel": "Horizontal axis",
- "mapDataSlot_sizeLabel": "Point size",
- "lineColumnComboChartProp_lineColorLabel": "Line and symbol color",
- "lineChartDataSlot_valuesLabel": "Value",
- "radialBarChartCaption": "Radial bar",
- "expandSceneCoachmarkContent": "Animate a scene by adjusting object visibility based on time and duration.",
- "titleSmallTextLabel": "Title Small",
- "addDataStoryCoachMarkContents": "Drag and drop data from the data panel onto your story.",
- "bubbleChartCaption": "Bubble",
- "pointChart1catProp_maintainAxisScalesDescription": "Always display the minimum and maximum values on the axes.",
- "areaChartProp_hideGridLinesLabel": "Hide grid lines",
- "lineChartProp_suppressZerosDescription": "Hide categories with no associated values.",
- "errorLoadingDataSet": "The metadata for data set '%{datasetName}' did not load. Please contact your administrator for details.",
- "treeMap3Cat1MeasureChartProp_colorPaletteLabel": "Color palettes",
- "clusterBarDataSlot_colorLabel": "Color by",
- "scatterPlotChartNoCatProp_symbolFillLabel": "Fill shape",
- "titleTextLabel": "Title",
- "dataset_date": "date",
- "pointDescription": "Point",
- "bubbleDescription": "Bubble",
- "treeMap2Cat1MeasureChartProp_colorPaletteLabel": "Color palettes",
- "tabName_webDetails": "Web page details",
- "clusterColumnDescription": "Column",
- "applyFilter": "Apply filter",
- "lineColumnComboChartProp_suppressZerosLabel": "Hide empty",
- "dataset_number": "number",
- "columnChartCaption": "Column",
- "wordCloudName": "Word cloud",
- "map1measureProp_suppressZerosDescription": "Hide categories with no associated values.",
- "lineChartProp_hideSymbolsLabel": "Hide Symbols",
- "scatterPlotChartNoCatProp_hideAxisTitleLabelsLabel": "Hide axis title labels",
- "pointChart1catProp_hideAxisTitleLabelsLabel": "Hide axis title labels",
- "find_label": "Find",
- "invertSelectionToolTip": "Invert filter selections",
- "intentSearchTitle": "Create a visualization based on your search",
- "lineColumnComboChartProp_interpolationLabel": "Smooth lines",
- "overviewCoachmarkTitle": "Overview scenes",
- "bubbleName": "Bubble",
- "columnChartDataSlot_valuesLabel": "Value",
- "radialBarName": "Radial bar",
- "areaDataSlot_categoriesLabel": "Axis label",
- "treeMap1Cat1MeasureChartDataSlot_categoriesLabel": "Level one",
- "pointChart1catProp_symbolFillDescription": "Display fill color for the symbols.",
- "pieChartProp_hideLegendLabel": "Hide legend",
- "summaryChartDataSlot_valuesLabel": "Value",
- "packedBubbleChart1CatProp_maintainAxisScalesDescription": "Always display the minimum and maximum values on the axes.",
- "barChartProp_hideAxisTitleLabelsLabel": "Hide axis title labels",
- "radialChartProp_suppressZerosLabel": "Hide empty",
- "packedBubbleChart1CatProp_elementColorLabel": "Bubble color",
- "radialBarChartProp_hideRadialTitleLabel": "Hide title",
- "treeMap1Cat1MeasureChartProp_suppressZerosDescription": "Hide categories with no associated values.",
- "invertFilterSelection": "Invert",
- "gridDescription": "Grid",
- "columnChartProp_suppressZerosDescription": "Hide categories with no associated values.",
- "mapDataSlot_categoriesLabel": "Regions",
- "lineColumnComboDataSlot_columnValueLabel": "Column value",
- "defaultName": "New dashboard",
- "scatterPlotChartNoCatProp_symbolFillDescription": "Display fill color for the symbols.",
- "story": "Story",
- "expandSceneCoachmarkTitle": "Open timeline",
- "editStoryCoachMarkContents": "Click the pencil icon to edit this story.",
- "treeMapDataSlot_level2Label": "Level two",
- "areaDataSlot_colorLabel": "Color by",
- "previewUnavailable": "The data tray and global filters are unavailable for Framework Manager packages.",
- "clusterLineDataSlot_valuesLabel": "Vertical axis",
- "heatChartCaption": "Heat",
- "columnChartProp_colorPaletteLabel": "Color palettes",
- "lineColumnComboDescription": "Line and column",
- "stackedBarName": "Stack bar",
- "lineColumnComboChartProp_colorPaletteLabel": "Color palettes",
- "areaChartProp_hideAxisTitleLabelsDescription": "Hide the titles for the axes.",
- "map1measureProp_hideLegendDescription": "Hide the legend.",
- "errorLoadingDataSets": "An error occurred while loading the list of data sets",
- "map1measureProp_colorPaletteLabel": "Color palettes",
- "map1measureDataSlot_categoriesLabel": "Regions",
- "pinDeleteError": "We can't delete one or more assets from the collection. Try again later.",
- "noDashboardPermision": "You do not have sufficient privileges to view this dashboard",
- "wordCloudDescription": "Word cloud",
- "deletePin": "Delete the collected item",
- "areaChartDataSlot_categoriesLabel": "Axis label",
- "scatterPlotDataSlot_xAxisLabel": "Horizontal axis",
- "createStoryTitle": "Create story",
- "radialChartProp_hideRadialTitleLabel": "Hide title",
- "clusterColumnDataSlot_categoriesLabel": "Axis label",
- "overviewCoachmarkContent": "Use the overview scenes at the start and end of your story to show the big picture of all the scenes. From an overview scene, click and drag a scene to swap it with another scene. You can show or hide the overview scenes in the story properties.",
- "heatChartProp_heatScalePaletteLabel": "Color order",
- "intentSearchLabel": "Intent search",
- "cancelButton": "Cancel",
- "wordChart1Cat1MeasureDataSlot_scaleLabel": "Size by",
- "lineChartProp_colorPaletteLabel": "Color palettes",
- "treeMap3Cat2MeasureChartProp_colorPaletteLabel": "Color palettes",
- "lineColumnComboChartProp_hideAxisTitleLabelsDescription": "Hide the titles for the axes.",
- "itemCountText": "%{itemCount} Item(s) selected",
- "radialChartProp_maintainAxisScalesDescription": "Always display the minimum and maximum values on the axes.",
- "radialChartDataSlot_categoriesLabel": "Categories",
- "pointChart1catProp_suppressZerosLabel": "Hide empty",
- "pinRetrieveError": "We can't retrieve one or more collected items. Try again later.",
- "bubbleChartProp_maintainAxisScalesDescription": "Always display the minimum and maximum values on the axes.",
- "scatterPlotChartNoCatCaption": "Scatter plot",
- "wordChart1Cat1MeasureCaption": "Word cloud",
- "lineChartProp_symbolShapeLabel": "Symbol shape",
- "propColumnColor": "Column color",
- "barChartProp_hideGridLinesLabel": "Hide grid lines",
- "pieChartProp_hideRadialValueLabel": "Hide value",
- "scatterPlotDataSlot_colorLabel": "Color by",
- "unSupportedPromptType": "The prompt scenario is not currently supported.",
- "missingDataSetData": "The data for this data set is not available. Refresh the data set or contact your administrator for access to the source.",
- "columnChartProp_suppressZerosLabel": "Hide empty",
- "heatChartProp_hideAxisTitleLabelsLabel": "Hide axis title labels",
- "treeMap1Cat1MeasureChartProp_suppressZerosLabel": "Hide empty",
- "addDataSourceDialogButtonLabel": "Add",
- "timelineFilter": "Add filter",
- "map1measureProp_suppressZerosLabel": "Hide empty",
- "wordChart1Cat1MeasureProp_suppressZerosDescription": "Hide categories with no associated values.",
- "propHideLeafNode": "Hide Lead Labels",
- "heatChartProp_suppressZerosLabel": "Hide empty",
- "lineColumnComboChartProp_hideGridLinesLabel": "Hide grid lines",
- "radialBarChartProp_maintainAxisScalesDescription": "Always display the minimum and maximum values on the axes.",
- "deletePinConfirmationMessage": "Are you sure you want to delete this collected item? This cannot be undone.",
- "treeMapDataSlot_categoriesLabel": "Level one",
- "sweepTransitionLabel": "Sweep",
- "packedBubbleChart1CatCaption": "Packed bubble",
- "clusterBarDataSlot_valuesRepeatingLabel": "Value",
- "bubbleChartProp_maintainAxisScalesLabel": "Maintain axis scale",
- "packedBubbleChart1CatProp_maintainAxisScalesLabel": "Maintain axis scale",
- "pointChart1catDataSlot_valuesLabel": "Value",
- "pointChart1catCaption": "Point",
- "mapDataSlot_valuesLabel": "Region heat",
- "lineChartProp_maintainAxisScalesDescription": "Always display the minimum and maximum values on the axes.",
- "conditionalPalettePickerLabel": "Distribution of %{title} values",
- "tabName_imageDetails": "Image details",
- "pointDataSlot_colorLabel": "Color by",
- "propColorOrder": "Color order",
- "heatDataSlot_valuesLabel": "Heat by",
- "areaChartCaption": "Area",
- "radialDataSlot_maxSizeLabel": "Maximum value",
- "treeMap1Cat1MeasureChartProp_legendPositionLabel": "Legend position",
- "pieChartProp_suppressZerosDescription": "Hide categories with no associated values.",
- "noTransitionLabel": "None",
- "map1measureProp_hideLegendLabel": "Hide legend",
- "packedBubbleChart1CatProp_hideValueLabel": "Hide value",
- "heatChartProp_hideLegendLabel": "Hide legend",
- "pieDataSlot_categoriesLabel": "Categories",
- "errorLabel": "Error",
- "lineColumnComboChartProp_hideGridLinesDescription": "Hide grid lines",
- "tabName_mediaDetails": "Media details",
- "quoteTextLabel": "Quote",
- "propColorPalettes": "Color palettes",
- "radialBarChartProp_elementColorLabel": "Radial bar color",
- "noStoryCapability": "You do not have the capability to use stories",
- "pointDataSlot_valuesLabel": "Value",
- "defaultStoryName": "New story",
- "clusterLineDescription": "Line",
- "panAndZoomShimCoachmarkTitle": "Guided journey",
- "defaultThemeLabel": "Default",
- "modelFilter": "Filter",
- "sourceNotFound": "We can't load the visualization, because its associated source '%{sourceName}' isn't available",
- "propBarColor": "Bar color",
- "sceneTransitionPropertyLabel": "Scene transition",
- "radialBarDescription": "Radial bar",
- "propAreaColor": "Area color",
- "progressiveTransitionLabel": "Progressive",
- "clusterBarName": "Bar",
- "gridDataSlot_grid_colsLabel": "Column",
- "wordCloudDataSlot_wordLabel": "Words",
- "areaChartProp_hideAxisTitleLabelsLabel": "Hide axis title labels",
- "treeMap1Cat1MeasureChartDataSlot_valuesLabel": "Size by",
- "heatChartDataSlot_xAxisLabel": "Horizontal axis",
- "bubbleChartDataSlot_yAxisLabel": "Vertical axis",
- "clearTextFilterValue": "Clear",
- "radialChartDataSlot_valuesLabel": "Value",
- "stackedBarDataSlot_categoriesLabel": "Axis label",
- "responsiveTextLabel": "Auto-size",
- "pointChart1catProp_symbolFillLabel": "Fill shape",
- "barChartProp_elementColorLabel": "Bar color",
- "bubbleChartProp_hideAxisTitleLabelsLabel": "Hide axis title labels",
- "searchHierarchyMembers": "Use search to find members...",
- "map1measureProp_legendPositionLabel": "Legend position",
- "pointName": "Point",
- "itemExcludeCountText": "%{itemCount} Item(s) excluded",
- "scatterPlotChartNoCatProp_hideGridLinesLabel": "Hide grid lines",
- "pointChart1catProp_elementColorLabel": "Shape color",
- "lineColumnComboChartProp_interpolationDescription": "Lines connecting the data points are curved.",
- "filter_includesAll": "Includes all",
- "moreTitle": "More",
- "lineColumnComboChartProp_hideDataLinesDescription": "Hide line(s)",
- "dataset_text": "text",
- "preAggregateText": "The range uses the values in the data source, not the values displayed in the dashboard.",
- "pointChart1catProp_hideGridLinesLabel": "Hide grid lines",
- "widgetConditionalFormatLabel": "Toggle conditional format controls",
- "lineColumnComboChartProp_hideSymbolsDescription": "Hide symbols",
- "stackedColumnDataSlot_valuesRepeatingLabel": "Value",
- "barChartProp_colorPaletteLabel": "Color palettes",
- "bubbleChartProp_hideLegendDescription": "Hide the legend.",
- "areaChartProp_hideGridLinesDescription": "Hide grid lines",
- "clusterColumnDataSlot_valuesRepeatingLabel": "Value",
- "remove_slider_handle": "Remove handle",
- "packedBubbleChart1CatDataSlot_sizeLabel": "Size by",
- "summaryCaption": "Summary",
- "addDataSourceDialogTitle": "Add a data source",
- "lineChartCaption": "Line",
- "bubbleChartProp_legendPositionLabel": "Legend position",
- "columnChartDataSlot_categoriesLabel": "Axis label",
- "lineChartDataSlot_categoriesLabel": "Axis label",
- "columnChartProp_hideGridLinesLabel": "Hide grid lines",
- "scatterPlotChartNoCatProp_hideGridLinesDescription": "Hide grid lines",
- "lineChartProp_suppressZerosLabel": "Hide empty",
- "scatterPlotChartNoCatProp_hideAxisTitleLabelsDescription": "Hide the titles for the axes.",
- "pointChart1catProp_hideGridLinesDescription": "Hide grid lines",
- "lineColumnComboChartProp_legendPositionLabel": "Legend position",
- "bubbleDataSlot_sizeLabel": "Size by",
- "columnChartProp_maintainAxisScalesLabel": "Maintain axis scale",
- "lightThemeLabel": "Light",
- "packedBubbleChart1CatProp_colorPaletteLabel": "Color palettes",
- "map1measureCaption": "Map",
- "packedBubbleDescription": "Packed bubble",
- "stackedBarDescription": "Stack bar",
- "lineColumnComboChartProp_hideDataLinesLabel": "Hide line(s)",
- "pieChartProp_colorPaletteLabel": "Color palettes",
- "playerName": "Data player"
- });
- /**
- * Licensed Materials - Property of IBM
- * IBM Cognos Products: BI Cloud (C) Copyright IBM Corp. 2014, 2017
- * US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
- */
- define('bacontentnav/lib/gemini/app/nls/DashboardResources',{
- root: {
- // Application Title
- 'appTitle': 'Project Gemini',
- 'appExit': 'Go to Welcome page',
- 'widgetsListLabel': 'Widgets list. Select a widget and press enter to add.',
- //General
- listSeparator: ', ',
- pointSeparator: ':',
- 'insync': 'Up-to-date',
- 'dirty': 'Not up-to-date',
- 'conflict': 'Conflict saving the view',
- 'error': 'Problem saving the view',
- 'failure': 'Unable to contact the server',
- 'saveFailed': 'Unable to save the view',
- 'wa_insync': 'Saved',
- 'wa_conflict': 'Conflict saving the view',
- 'wa_error': 'Unable to save the view',
- 'wa_failure': 'Unable to contact the server',
- // Menu Labels
- 'changeDisplay': 'Change display',
- 'changeToColumnChart': 'Change to column chart',
- 'changeToBubbleChart': 'Change to bubble chart',
- 'toggleMoveHandles': 'Toggle move handles',
- 'undo': 'Undo',
- 'redo': 'Redo',
- 'mode': 'Change the mode',
- 'untitled': 'Untitled',
- 'remove': 'Remove',
- 'editTitle': 'Edit the title',
- 'edit': 'Edit',
- 'done': 'Done',
- // Create a board
- 'createAV': 'Create',
- 'createAvEditNameLabel': '1. Name your view',
- 'createAvSelectTemplateLabel': '2. Select a template',
- 'selectTemplateLabel': 'Select a template',
- 'singlePageLayoutLabel': 'Single page layout',
- 'tabLayoutLabel': 'Tabbed layout',
- 'slideShowLayoutLabel': 'Slide show layout',
- 'panAndZoomLayoutLabel': 'Guided journey layout',
- 'panAndZoomShimLayoutFooter': 'A guided journey layout is a collection of scenes on a single canvas. When you run this type of story, the presentation zooms and pans on each individual scene in sequential order. This differs from a slide show layout where each scene is presented on a new canvas. The guided journey layout with three scenes connected by lines allows you to create a horizontal sequence of scenes. This is useful for showing a timeline.',
- 'infographicsLayoutLabel': 'Infographic layout',
- 'panAndZoomShimLayoutLabel': 'Guided journey layout',
- 'freeformTemplate': 'Freeform',
- 'freeformTemplateDesc': 'Visualizations in a freeform layout appear exactly as you size and place them in the view, regardless of the screen size. In the other layouts, the size and position of visualizations adjust to fit into the screen.',
- //label for each template
- 'NoTemplate': 'Free form',
- 'Template1': 'Blank',
- 'Template2': 'Title 1 by 2',
- 'Template3': '2 over 1',
- 'Template4': '4 over 1',
- 'Template5': 'Footer 1 by 2 ',
- 'Template6': '3 beside 1 over 1',
- 'Template7': '4 beside 3 over 1',
- 'Template8': '2 over 3 by 2',
- 'Template9': '2 by 2',
- 'Template10': '1 by 2 beside 2 by 2 over 1',
- 'Template11': '3 by 1 over 1 by 2',
- 'Template12': '2 over 1 beside 1 by 2',
- 'Template13': 'One beside 1 by 2 beside 1 by 4',
- 'Infographics1': 'Blank',
- 'Infographics2': '4 rows',
- 'Infographics3': '4 rows with headers',
- 'Infographics4': '2 by 4',
- 'Infographics5': 'Large top display with 2 by 2',
- 'Infographics6': '2 by 4 with vertical gap',
- 'Infographics7': '2 by 4 staggered',
- 'Infographics8': 'Tennis court',
- 'Infographics9': '3 by 4',
- 'Infographics10': '4 by 8',
- 'PanAndZoomShim1': '5 scenes arranged in a rectangular shape',
- 'PanAndZoomShim2': '4 scenes arranged in a staircase shape going up from left to right',
- 'PanAndZoomShim3': '6 scenes arranged in a rectangular shape',
- 'PanAndZoomShim4': '7 scenes arranged in a rectangular shape, with 6 small scenes on the top and 1 large scene on the bottom',
- 'PanAndZoomShim5': '4 scenes arranged with 2 small scenes on the top, 1 large scene in the middle, and 1 small scene on the bottom-left',
- 'PanAndZoomShim6': 'A sequence of 4 scenes arranged horizontally',
- // Objects
- 'createAvDashboardLabel': 'Dashboard',
- 'createAvDataStoryLabel': 'Story',
- // Templates
- 'createAvSinglePageLabel': 'Single page',
- 'createAvTabLabel': 'Tabbed',
- 'createAvInfographicsLabel': 'Infographic',
- 'createAvSlideShowLabel': 'Slide show',
- 'createAvPanAndZoomLabel': 'Guided journey',
- // Data tray
- 'dataTrayHandleOpenLabel': 'Open data tray',
- 'dataTrayHandleCloseLabel': 'Close data tray',
- 'dataTrayHandleOpenLabelSceneSelector': 'Open scene selector',
- 'dataTrayHandleCloseLabelSceneSelector': 'Close scene selector',
- // Dialogs
- 'dlg_loading': 'Loading...',
- 'dlg_ok': 'OK',
- 'dlg_cancel': 'Cancel',
- 'dlg_close': 'Close',
- 'dlg_update': 'Update',
- 'dlg_renameBoardTitle': 'Rename this object',
- 'dlg_renameDatasetTitle': 'Rename this data set',
- 'dlg_renameSceneTitle': 'Rename this scene',
- 'dlg_NameLabel': 'Name:',
- 'dlg_NewNameLabel': 'New name:',
- 'dlg_DefaultNameWithDataSet': '%{name} View',
- 'dlg_ShareTitle': 'Share content',
- 'dlg_UnshareTitle': 'Remove content sharing',
- 'dlg_ShareUser': 'User ID:',
- 'dlg_NewColumnLabel': 'New calculation name',
- 'dlg_new': 'New...',
- 'dlg_open': 'Open...',
- 'dlg_makeACopy': 'Make a copy',
- 'dlg_rename': 'Rename...',
- 'dlg_moreToCome': 'More actions coming...',
- 'dlg_createStory': 'Create a story',
- 'dlg_use': 'Use',
- 'dlg_IntentResultsTitle': 'Select a data set',
- 'dlg_IntentHeaderName': 'Name',
- 'dlg_IntentHeaderDate': 'Date',
- 'dlg_IntentSearchClear': 'Clear intent search terms',
- 'dlg_IntentNoMatch': 'We can\'t find any matches. Try again with different terms.',
- 'dlg_RelinkDatasetTitle': 'Replace data set \'%{datasetName}\' with ...',
- open_error: 'A problem occurred while opening the view.',
- // Delete Board
- 'del_dialogTitle': 'Confirm deletion',
- 'del_itemMsg': 'Are you sure you want to delete \'%{name}\'?',
- 'del_itemsMsg': 'Are you sure you want to delete %{count} items?',
- 'del_deleteErr': 'Unable to delete \'%{name}\'',
- // List Sorting
- 'dlg_ascending': 'ascending',
- 'dlg_descending': 'descending',
- 'dlg_custom': 'custom',
- 'dlg_none': 'none',
- // Input Placeholders
- 'search': 'Search',
- 'searchHint': 'Search all your data',
- 'clearSearchResult': 'Clear search results',
- // Shapes and shapes categories
- // Basic shapes
- 'shapesBasicShapesCat': 'Basic',
- 'shapesCircle': 'Circle',
- 'shapesHexagon': 'Hexagon',
- 'shapesLine': 'Line',
- 'shapesOctagon': 'Octagon',
- 'shapesPentagon': 'Pentagon',
- 'shapesSquare': 'Square',
- 'shapesTriangle': 'Triangle',
- 'shapesDiamond': 'Diamond',
- 'shapesTitle': 'Shape properties',
- // Advanced shapes
- 'shapesAdvancedShapesCat': 'Advanced',
- 'shapesSquareRounded': 'Rounded square',
- 'shapesStar': 'Star',
- 'shapesChevron': 'Chevron',
- 'shapesBadge_ribbon': 'Badge ribbon',
- 'shapesBadge': 'Badge',
- 'shapesHeart': 'Heart',
- 'shapesExclamation': 'Exclamation',
- 'shapesTrendingup': 'Trending up',
- 'shapesTrendingdown': 'Trending down',
- 'shapesX': 'X',
- // People shapes
- 'shapesPeopleCat': 'People',
- 'shapesFemale': 'Female',
- 'shapesHappyface': 'Happy face',
- 'shapesMale': 'Male',
- 'shapesMan': 'Man',
- 'shapesNeutralface': 'Neutral face',
- 'shapesSadface': 'Sad face',
- 'shapesShakehands': 'Shake hands',
- 'shapesThumbsdown': 'Thumbs down',
- 'shapesThumbsup': 'Thumbs up',
- 'shapesWoman': 'Woman',
- // Weather and places
- 'shapesPlacesWeatherCat': 'Places & weather',
- 'shapesCity': 'City',
- 'shapesCloud': 'Cloud',
- 'shapesEducation': 'Education',
- 'shapesGovernment': 'Government',
- 'shapesHalfcloud': 'Half cloud',
- 'shapesHouse': 'House',
- 'shapesMoon': 'Moon',
- 'shapesRain': 'Rain',
- 'shapesSunny': 'Sunny',
- //Vehicles
- 'shapesVehiclesCat': 'Vehicles',
- 'shapesAirplane': 'Airplane',
- 'shapesCar': 'Car',
- 'shapesShip': 'Ship',
- 'shapesShoppingcart': 'Shopping cart',
- 'shapesTrain': 'Train',
- 'shapesTruck': 'Truck',
- //Objects
- 'shapesObjectsCat': 'Objects',
- 'shapesBook': 'Book',
- 'shapesBriefcase': 'Briefcase',
- 'shapesCalendar': 'Calendar',
- 'shapesCheck': 'Check',
- 'shapesClock': 'Clock',
- 'shapesDesktop': 'Desktop',
- 'shapesDocument': 'Document',
- 'shapesFood': 'Food',
- 'shapesGear': 'Gear',
- 'shapesHealth': 'Health',
- 'shapesIdea': 'Idea',
- 'shapesMobile': 'Mobile',
- 'shapesMoney_bill': 'Money bill',
- 'shapesMoney_coin': 'Money coin',
- 'shapesPiggybank': 'Piggy bank',
- 'shapesStackofpaper': 'Stack of paper',
- 'shapesStickynote1': 'Sticky Note 1',
- 'shapesStickynote2': 'Sticky Note 2',
- 'shapesTarget': 'Target',
- 'shapesTool': 'Tool',
- 'shapesUmbrella': 'Umbrella',
- 'shapesBrain': 'Brain',
- 'shapesSkull': 'Skull',
- 'shapesEye': 'Eye',
- // Arrows shapes
- 'shapesArrowsCat': 'Arrows',
- 'shapesRightArrow': 'Right arrow',
- 'shapesLeftArrow': 'Left arrow',
- 'shapesDoubleArrow': 'Double arrow',
- 'shapesCurvedArrow': 'Curved arrow',
- // Callouts shapes
- 'shapesCalloutsCat': 'Callouts',
- 'shapesRectCallout': 'Callout',
- // Images
- 'imageWidgetTitle': 'Image widget',
- 'imageTextLabel': 'Paste the URL and press Enter to save it',
- 'imgUrl': 'Image URL',
- 'imgPasteLink': 'Paste the URL and press Enter to save it',
- 'imgAltText': 'Alternate text',
- 'imgAltTextDescription': 'Text that is read by a screen reader',
- 'imgResizeToFit': 'Resize to fit the image\'s size',
- 'imgHeight': 'Height:',
- 'imgWidth': 'Width:',
- 'imgTransparency': 'Transparency:',
- 'imgMissingUrl': 'The image URL is missing',
- 'imgUrlValidationError': 'The image URL is not valid',
- // Data player widget
- 'playButtonLabel': 'Play',
- 'dataPlayerValueListLabel': 'Data player values',
- // Text Widget
- 'textStyle': 'Styles',
- 'textStyleDescription': 'Preformatted text styles',
- 'textTitleStyle': 'Title',
- 'textTitleSmallStyle': 'Title small',
- 'textSubtitleStyle': 'Subtitle',
- 'textBodyStyle': 'Body',
- 'textBodySmallStyle': 'Body small',
- 'textCaptionStyle': 'Caption',
- 'textQuoteStyle': 'Quote',
- 'textQuoteSmallStyle': 'Quote small',
- 'textResponsiveStyle': 'Auto-size',
- 'textAutoFontSize': 'Auto',
- 'responsiveCoachmarkTitle': 'Auto-size font',
- 'responsiveCoachmarkContent': 'The font size automatically resizes to fit when you resize this text type. You can set the font size in the text properties.',
- 'propText': 'Text properties',
- 'propTextReturn': 'Text properties',
- 'textPlaceHolder': 'Enter your text here.',
- 'textFontSize': 'Font size',
- 'textFontFamily': 'Font family',
- 'textFontWeight': 'Font weight',
- // Widget Properties
- 'propAltText': 'Alternate text',
- 'propImageLink': 'Image link',
- 'propMissingURL': 'Enter URL',
- 'propMissingAltText': 'Enter alternate text',
- 'propImgTop': 'Image properties',
- 'propGeneralReturn': 'General properties',
- 'propStyle': 'General',
- 'propStyleReturn': 'General',
- 'propFillColor': 'Fill color',
- 'propTextColor': 'Text color',
- 'propBorderColor': 'Border color',
- 'propMaintainAxisScales': 'Maintain axis scale',
- 'propShowItemLabel': 'Show the item label',
- 'propHideLegend': 'Hide the legend',
- 'propColorPalette': 'Palette',
- 'propLegendPosition': 'Legend position',
- 'propHideAxisTitleLabels': 'Hide axis titles',
- 'propLineColor': 'Line color',
- 'propBubbleColor': 'Bubble color',
- 'propInterpolation': 'Smooth lines',
- 'propElementColor': 'Visualization element color',
- 'propSymbolShape': 'Symbol shape',
- 'propHeatScalePalette': 'Color order',
- 'propHeatScalePalette_tooltipDarkerForLowerValue': 'Darker colors represent smaller values.',
- 'propHeatScalePalette_tooltipDarkerForHigherValue': 'Darker colors represent larger values.',
- 'propImageDetails': 'Image details',
- 'propWebDetails': 'Web page details',
- 'propMediaDetails': 'Media details',
- 'propPasteLink': 'Enter the URL and press Enter',
- 'propScaleLabel': 'Quantity of icons',
- 'propScaleDescription': 'Select the quantity of icons',
- 'propScaleFew': 'Low',
- 'propScaleDefault': 'Default',
- 'propScaleMany': 'High',
- 'mediaAriaLabel': 'url input',
- 'ariaGroupLabel': 'Dropdown list category: %{cateoryLabel} item: %{itemLabel}. Press DOWN key to expand. Press UP and DOWN key to navigate or Press ESCAPE key to collapse.',
- // Theme
- 'propTheme': 'Theme',
- // Timer
- 'lastRefresh': 'Last refresh: %{timeInterval} ago',
- 'widgetTimer': 'Widget timer',
- // Theme colors
- 'transparent': 'No color',
- 'white': 'White',
- 'lightGrey': 'Light grey',
- 'grey': 'Grey',
- 'darkGrey': 'Dark grey',
- 'black': 'Black',
- 'lightBlue': 'Light blue',
- 'blue': 'Blue',
- 'darkBlue': 'Dark blue',
- 'yellow': 'Yellow',
- 'orange': 'Orange',
- 'lime': 'Lime',
- 'green': 'Green',
- 'peach': 'Peach',
- 'red': 'Red',
- 'violet': 'Violet',
- 'aqua': 'Aqua',
- 'purple': 'Purple',
- 'plum': 'plum',
- // Dashboard
- 'propDashboardBackgroundColor': 'Background color',
- //Story
- 'propShowStoryOverviewFirstSlide': 'Show all scenes at the start',
- 'propShowStoryOverviewLastSlide': 'Show all scenes at the end',
- // Vis widget
- 'propVisType': 'Visualization types',
- 'propVisTypeReturn': 'Visualization types',
- 'propVisDetails': 'Details',
- // Animation properties for widgets
- 'propAniDetails': 'Animation',
- 'propAniDetailsReturn': 'Animation',
- 'propAniEntrance': 'Entrance',
- 'propAniTypeEntrance': 'Animation',
- 'propAniTypeEntranceSlideIn': 'Slide in',
- 'propAniTypeEntranceFadeIn': 'Fade in',
- 'propAniTypeEntrancePivotIn': 'Pivot in',
- 'propAniTypeEntranceScaleIn': 'Scale in',
- 'propAniTypeEntranceShrinkIn': 'Shrink in',
- 'propAniDirectionIn': 'Direction',
- 'propAniDirectionInLeft': 'From left',
- 'propAniDirectionInRight': 'From right',
- 'propAniDirectionInTop': 'From top',
- 'propAniDirectionInBottom': 'From bottom',
- 'propAniExit': 'Exit',
- 'propAniTypeExit': 'Animation',
- 'propAniTypeExitSlideIn': 'Slide out',
- 'propAniTypeExitFadeIn': 'Fade out',
- 'propAniTypeExitPivotOut': 'Pivot out',
- 'propAniTypeExitScaleIn': 'Scale out',
- 'propAniTypeExitExpandOut': 'Expand out',
- 'propAniDirectionOut': 'Direction',
- 'propAniDirectionOutLeft': 'To left',
- 'propAniDirectionOutRight': 'To right',
- 'propAniDirectionOutTop': 'To top',
- 'propAniDirectionOutBottom': 'To bottom',
- // Alignment picker
- 'propAlignPickTop': 'Align top',
- 'propAlignPickRight': 'Align right',
- 'propAlignPickBottom': 'Align bottom',
- 'propAlignPickLeft': 'Align left',
- 'propAlignPickCenter': 'Align center',
- 'propAlignPicker': 'Alignment',
- // Toolbar picker
- 'propToolbarPickBold': 'Bold',
- 'propToolbarPickUnderline': 'Underline',
- 'propToolbarPickItalic': 'Italic',
- 'propToolbarPickJustifyLeft': 'Align left',
- 'propToolbarPickJustifyCenter': 'Align center',
- 'propToolbarPickJustifyRight': 'Align right',
- 'propToolbarPickJustify': 'Justify',
- // Symbol shapes
- 'propCircle': 'Circle',
- 'propTriangle': 'Triangle',
- 'propSquare': 'Square',
- 'propRect': 'Rectangle',
- 'propStar': 'Star',
- 'propCross': 'Cross',
- 'propPlus': 'Plus',
- 'propPoly': 'Polygon',
- // True and false selection
- 'propTrue': 'True',
- 'propFalse': 'False',
- // Position selection
- 'propLeft': 'Left',
- 'propRight': 'Right',
- 'propTop': 'Top',
- 'propBottom': 'Bottom',
- // Interpolation options
- 'propSmooth': 'Smooth',
- 'propStraight': 'Straight',
- // indentedListView
- 'srILVTreeLabel': 'List', // screen reader label for tree role
- // widget move
- 'srWidgetMoveLeft': 'Move left', // screen reader
- 'srWidgetMoveUp': 'Move up', // screen reader
- 'srWidgetMoveRight': 'Move right', // screen reader
- 'srWidgetMoveDown': 'Move down', // screen reader
- // widget resize
- 'srWidgetResizeBigger': 'Increase the size proportionally', // screen reader
- 'srWidgetResizeSmaller': 'Decrease the size proportionally', // screen reader
- 'srWidgetResizeBiggerV': 'Increase the size vertically', // screen reader
- 'srWidgetResizeSmallerV': 'Decrease the size vertically', // screen reader
- 'srWidgetResizeBiggerH': 'Increase the size horizontally', // screen reader
- 'srWidgetResizeSmallerH': 'Decrease the size horizontally', // screen reader
- // widget rotate
- 'srWidgetRotateCW': 'Rotate clockwise', // screen reader
- 'srWidgetRotateCCW': 'Rotate counterclockwise', // screen reader
- // Recommended types
- 'visRecommendedTypes': 'Recommended visualization types',
- 'visMore': 'More...',
- 'visMoreTooltip': 'More visualizations',
- 'visOtherTypes': 'Other visualization types',
- 'visChange': 'Change visualization',
- 'automaticArchetypeCaption': 'Automatic',
- // Visualization
- 'visualizationLabel': 'Visualization',
- 'chartLabel': '%{chartName} chart',
- 'dataWidgetDescription': '%{widgetLabel}: %{columnNames}',
- 'f12KeyDescription': 'Press F12 to navigate within the widget',
- 'f10KeyDescription': 'Press F10 to launch the widget focus view',
- 'WidgetLabelWithDescripion': '%{label}. %{description}',
- 'summaryLabel': '%{label} with value %{value}',
- 'shapeColorLabel': 'Shape color',
- 'showLegendLabel': 'Show legend',
- //Webpage
- 'webpageWidgetTitle': 'Webpage widget',
- 'webpagePasteLink': 'Paste the URL and press Enter to save it',
- 'propWebpageLink': 'Web page URL',
- 'propWebpageTitle': 'Web page title',
- 'propWebpageTitleDescription': 'Title of the web page',
- 'propWebpageTop': 'Web page properties',
- 'webpageMissingUrl': 'The web page URL is missing',
- 'webpageUrlValidationError': 'The web page URL is not valid',
- 'webpageHttpValidationError': 'The web page must be accessed using an HTTPS link for the browser to display it',
- //VizState
- 'vzErrorLoading': 'Unable to load visualization',
- 'vzErrorLoadingMissingData': 'Unable to load visualization, missing context data',
- //Media (Video / Audio)
- 'mediaWidgetTitle': 'Media widget',
- 'mediaPasteLink': 'Paste the URL and press Enter to save it',
- 'videoHeight': 'Height:',
- 'videoWidth': 'Width:',
- 'propMediaLink': 'Media link',
- 'propMediaTitle': 'Media title',
- 'propMediaTitleDescription': 'Title of the media',
- 'propMediaTop': 'Media properties',
- 'mediaMissingUrl': 'The media link URL is missing',
- 'mediaUrlValidationError': 'The media file URL is not valid',
- 'mediaUnknownValidationError': 'This type of media is not supported',
- 'mediaHttpValidationError': 'The media file must be accessed using an HTTPS link for the browser to display it',
- // Properties pane
- 'commonPropertiesLabel': 'Properties',
- // Data strip
- 'dataSetsLabel': 'Data set',
- 'dataViewsLabel': 'View',
- 'columnQuality': 'Data quality',
- 'columnProperties': 'Data properties',
- 'dataQuality': 'Data quality',
- 'dataQualityRowCount': 'Number of rows',
- 'dataQualityDistribution': 'Distribution',
- 'dataRowLabel': 'Data',
- // Timeline strip
- 'storytellingSceneLabel': 'Scene',
- 'storytellingAddSceneLabel': 'Add a new scene',
- 'storytellingInsertSceneLabel': 'Insert a new scene',
- 'storySceneSingleCountLabel': '1 scene',
- 'storySceneCountLabel': '%{count} scenes',
- 'storySceneRangeCountLabel': 'Scene %{index} of %{count}',
- 'storySceneExpand': 'Open timeline',
- 'timelineRightContainerLabel': 'Timeline button control group',
- 'timelineViewLabel': 'Timeline',
- 'timelineZoomFit': 'Zoom to fit',
- 'timelineZoomIn': 'Zoom in',
- 'timelineZoomOut': 'Zoom out',
- 'timelineLeftHandle': 'left handle',
- 'timelineRightHandle': 'right handle',
- // object is timelineLeftHandle, timelineRightHandle or the title of the widget
- 'timelineMoveLeft': 'Move %{object} left',
- 'timelineMoveRight': 'Move %{object} right',
- 'timelinePositionIndicatorMoveLeftTo': 'timeline position indicator move left to %{position}',
- 'timelinePositionIndicatorMoveRightTo': 'timeline position indicator move right to %{position}',
- // Admin UI
- 'adminTitle': 'Administration',
- 'adminAccount': 'Account',
- 'adminConnCreate': 'Create new connection',
- 'adminConnEdit': 'Edit connection',
- 'adminConnTest': 'Test connection',
- 'adminConnTestButton': 'Test',
- 'adminConnTestConnection': 'Please provide credentials for the connection %{name}:',
- 'adminConnTestFailed': 'Failed',
- 'adminConnTestFailure': 'We can\'t connect to the <i>%{name}</i> database. Review the message that we received from the database then attempt to correct the problem.',
- 'adminConnTestFailureDetailsLess': 'Hide details',
- 'adminConnTestFailureDetailsMore': 'Show details',
- 'adminConnTestFailureLess': 'Less',
- 'adminConnTestFailureMore': 'More',
- 'adminConnTestInProgress': 'Testing',
- 'adminConnTestSuccess': 'Succeeded',
- 'adminDataConnections': 'Data connections',
- 'adminSecureGateway': 'Secured gateways',
- 'adminEmail': 'Contact email',
- 'adminFullname': 'Full name',
- 'adminRole': 'Role',
- 'adminScxRole': 'Subscription roles',
- 'adminSignonUnchanged': 'User ID is set, edit to change.',
- 'adminUserId': 'User ID',
- 'adminUserProfile': 'User profile',
- 'adminUsers': 'Users',
- 'adminFirstName': 'First name',
- 'adminLastName': 'Last name',
- 'adminErrorTitle': 'We\'re sorry',
- 'adminServiceError': 'The server or service stopped responding. Please try again later.',
- 'adminServiceInviteConflict': 'We\'re unable to send the invitation. This happens if the user has already been invited but hasn\'t accepted the invitation yet. Or the user might have been deleted from the account.',
- 'scxServerNotAvailable': 'The subscription administration service is currently unavailable.',
- 'adminSelectRoleTitle': 'Select a role',
- 'adminLastAdminErrorTitle': 'Unable to change role',
- 'adminLastAdminError': 'There is the only user with Administrator role.\n\nYou need to have at least one user with Administrator role.',
- // Admin account
- 'adminSubscriptionLabel': 'Subscription',
- 'adminSubscriptionVersion': 'You are currently subscribed to <b>%{version}</b>.',
- 'adminSubscriptionUpgrade': '<a href="" target="_blank" class="upgradeLink"><span class="wfg_add"></span>Edit options</a> for storage space, licenses, and subscriptions.',
- 'adminSubscriptionLearnMore': 'Learn more about other subscription options.',
- 'adminPurchasesLabel': 'Purchases',
- 'adminTotalSpaceLabel': 'Total space',
- 'adminSpaceInfo': 'Your maximum upload size is %{maxUpload} and the maximum number of columns allowed in your data set is %{numCols} columns.',
- 'adminAvailableLabel': 'Available',
- 'adminUsedLabel': 'Used',
- 'adminTotalLabel': 'Total',
- 'adminLicensesLabel': 'Licenses',
- 'adminEditLabel': 'Edit',
- 'adminPromoCodeLabel': 'Promotion code',
- 'adminAccountError': 'We can\'t retrieve the account details. Please try again later.',
- 'adminUnitsB': 'B',
- 'adminUnitsBLabel': '%{value} B',
- 'adminUnitsKB': 'KB',
- 'adminUnitsKBLabel': '%{value} KB',
- 'adminUnitsMB': 'MB',
- 'adminUnitsMBLabel': '%{value} MB',
- 'adminUnitsGB': 'GB',
- 'adminUnitsGBLabel': '%{value} GB',
- 'adminUnitsTB': 'TB',
- 'adminUnitsTBLabel': '%{value} TB',
- 'adminUnitsPB': 'PB',
- 'adminUnitsPBLabel': '%{value} PB',
- 'adminOperatorPrefix': '%{prefix} %{value}',
- 'adminUnknown': 'Unknown',
- 'adminNoPurchases': 'No purchases found',
- // Admin UI - Users tab
- 'adminUserDelete': 'Are you sure you want to delete this user?', // to_review
- 'adminUsersDelete': 'Are you sure you want to delete these users?', // to_review
- 'adminUsersDeleteFailDesc': 'Errors with deleting users.', // to_review
- 'adminUsersDeleteFailTitle': 'Delete Error', // to_review
- 'adminUsersDeleteSuccessDesc': 'Users were successfully deleted.', // to_review
- 'adminUsersDeleteSuccessTitle': 'Success!', // to_review
- 'adminUsersHeadingName': 'Name',
- 'adminUsersHeadingStatus': 'Status',
- 'adminUsersHeadingLastModified': 'Last modified',
- 'adminUsersInviteLabel': 'Invite user',
- 'adminUsersManageAccountsLabel': 'Manage user accounts',
- 'adminDropHere': 'Drop your .csv file here or tap to browse',
- 'adminInviteCancelled': 'This user wasn\'t invited yet. Request was cancelled.',
- 'adminInviteCount': 'You selected %{count} users. (max %{max})',
- 'adminInviteDisclaimer': '* You can invite %{count} users at a time',
- 'adminInviteErrorCode': '[Error %{errorcode}]',
- 'adminInviteErrorLine': '%{email} - %{reason} %{action} %{errorcode}',
- 'adminInviteInProgress': 'Inviting users...',
- 'adminInviteCancelDesc': 'Cancelling...',
- 'adminInviteCancelTitle': 'Cancel',
- 'adminInviteFailDesc': 'We encountered %{count} errors.<br>Review the messages below to determine which user invitations failed.',
- 'adminInviteFailTitle': 'We didn\'t invite everyone',
- 'adminInviteOverLimit': 'This user wasn\'t invited yet. You can invite up to %{count} users at a time and this user exceeded that limit.',
- 'adminInviteSuccessCount': 'We successfully invited %{count} of your selected %{selectedCount} users.',
- 'adminInviteTryAgain': 'Tap "Invite uploaded users" again to invite the next %{count} users.',
- 'adminInviteServerError': 'Server error (%{errorcode}). Please try again.',
- 'adminInviteSuccessDesc': 'Successfully invited users.',
- 'adminInviteSuccessTitle': 'Success!',
- 'adminUpload': 'Upload data',
- 'adminUploadDesc': 'To invite multiple users, create a .csv file or save a spreadsheet as the file type <b>CSV</b>.<br><br>The CSV file must have 3 columns in this order: email address, given name, and family name.<br>Do not include other columns.',
- 'adminUploadHelpLink': 'Learn more',
- 'adminUsersDeleteAll': 'Delete users',
- 'adminUsersInviteAll': 'Invite uploaded users',
- 'adminUsersUpload': 'Upload users',
- 'adminUploading': 'Uploading Data...',
- 'adminUploadErrorLine': 'Line %{line}: %{reason}',
- 'adminUploadSuccess': 'Success!',
- 'adminUploadSuccessDesc': 'Your file \'%{name}\' has been successfuly uploaded.',
- 'adminUploadFailCount': 'We found %{failedCount} errors in your file.',
- 'adminUploadFailDesc': 'Make sure that there are no empty fields and that all email addresses are valid. <br><br>Please check your file and resubmit.',
- 'adminUploadFailTitle': 'We can\'t upload your file',
- 'adminUserStatus_PRELOAD': 'Not invited yet',
- 'adminUserStatus_INVITATION_PENDING': 'Invited',
- 'adminUserStatus_INACTIVE_PENDING': 'Invited but not activated',
- 'adminUserStatus_ACTIVE': 'Active',
- 'adminUserStatus_INACTIVE_SUSPENDED': 'Suspended',
- // Data connection parameters (for the values returned by /externalconnections/types. 'conn_' + [parameter name]
- 'conn_biurl': 'URL',
- 'conn_dbname': 'Database name',
- 'conn_dbtypeid': 'Database type',
- 'conn_host': 'Server name',
- 'conn_name': 'Connection name',
- 'conn_password': 'Password',
- 'conn_password_confirm': 'Confirm password',
- 'conn_port': 'Port number',
- 'conn_port_validation': 'Only numbers are allowed for port.',
- 'conn_schema': 'Database schema',
- 'conn_signon': 'Include signon',
- 'conn_ssl': 'Use SSL',
- 'conn_sslcertificate': 'SSL certificate (optional)',
- 'conn_sslcertificate_set': 'SSL certificate is set, edit to change.',
- 'conn_url': 'JDBC connection parameters (optional)',
- 'conn_user': 'User ID',
- // Data Connection types (for the values returned by /externalconnections/types. 'connType_' + [name]
- 'connType_Cognos_BI': 'IBM Cognos BI Server',
- 'connType_IBM_DB2': 'IBM DB2',
- 'connType_MySQL': 'MySQL',
- 'connType_Oracle': 'Oracle',
- 'connType_Postgres': 'PostgreSQL',
- 'connType_SQLDB': 'IBM SQL Database for Bluemix',
- 'connType_SQL_Server': 'Microsoft SQL Server',
- 'connType_dashDB': 'IBM dashDB',
- 'bi_connect_error': 'Connection files have not been installed in the required folder on your IBM Cognos BI server.<br><br>Contact your IBM Cognos BI administrator, who can enable the connection. For more information, see the <a class="wah-anchor" href="https://watson.analytics.ibmcloud.com/docs/help/#wa_an_overview/wa-an-admin-dataconn-c10_admin.html" target="_blank">Docs</a>.',
- 'bi_notrunning_error': 'We can\'t reach the IBM Cognos BI server using the URL you provided.<br><br>Verify that the URL is correct. See the <a class="wah-anchor" href="https://watson.analytics.ibmcloud.com/docs/help/#wa_an_overview/wa_an_hlp_c10_conn_err.html" target="_blank">Docs</a> for other possible reasons why you can\'t connect.',
- 'bi_info': 'The server must use a secure web protocol and the URL must begin with https.<br>For example, https://bi_server.example.com/ibmcognos',
- 'dbTypeRestrictionLabel': 'With your subscription, you can only create and use connections to one database type at a time.<br><br>To connect to another database type, delete all database connections, then create new connections. To connect to multiple database types simultaneously, upgrade your subscription. ',
- // Modelling UI
- 'typeColumn': 'Type',
- 'modellingColumnType': 'Type',
- 'modellingColumnAggregation': 'Aggregation',
- 'modellingColumnUsage': 'Usage',
- 'modellingColumnSort': 'Sort',
- 'modellingColumnFormat': 'Format',
- 'modellingColumnCategory': 'Category',
- 'modellingLoading': 'Loading...',
- 'modellingProcessing': 'Processing...',
- 'modellingImport': 'Import',
- 'modellingReimport': 'Re-import',
- 'modellingDatasourceTitle': 'Data source',
- 'modellingImportStartedTitle': 'Importing started',
- 'modellingImportStartedText': 'Importing your data may take a bit of time.\n\n(You can create a view while the data is imported.)',
- 'importDatasourceTitle': 'Connections',
- 'dropHere': 'Drop here to create a new data source...',
- 'browseButton': 'Browse',
- 'errorNoData': 'There is no data to process.',
- 'errorNoFile': 'There is no file to upload.',
- 'errorUploadFailed': 'Unable to upload.',
- 'uploadSucceessful': 'Upload succeessful',
- 'del_datasourceTitle': 'Delete data set',
- 'del_datasourceMsg': 'Are you sure you wish to delete \'%{name}\'?',
- 'modellingFileUpdate': 'Update',
- 'modellingFileUpdateTitle': 'Update data set',
- 'modellingFileUpdateDescription': 'Do you want to update \'%{name}\'?',
- 'modellingFileUpdatingTitle': 'Updating \'%{name}\'',
- 'modellingUpdateStartedTitle': 'Update import started',
- 'modellingUpdateStartedText': 'Updating your data may take a bit of time.\n\n(You can create a view while the data is updated.)',
- 'modellingErrorImportUploadNoFile': 'No file to upload.',
- 'modellingErrorImportUploadFailed': 'Unable to upload.',
- 'modellingErrorImportUploadInvalidType': 'The file type is not valid.',
- 'modellingErrorImportUploadTableFailed': 'Unable to get tables.',
- 'modellingIntentResultsTitle': 'Select the proposed data set to use',
- 'modellingColumnViewRelationships': 'View related tables',
- 'modellingTableRelatedTables': 'Tables related to \'%{name}\'',
- 'modellingTable': '%{name} - Table',
- 'modellingColumnIncludedInDataSet': 'Added',
- 'modellingDataSet': 'Data set',
- 'modellingViewInDataSet': 'View in data set',
- 'modellingViewRelatedTables': 'View related',
- 'modellingRelatedTablesNoneFound': 'No related tables found',
- 'modellingValidatingDataset': 'Validating...',
- 'datasetFinishedRefreshing': 'Data set %{datasetName} has been refreshed.',
- // Join UI - Navigation Controller titles
- 'modellingJoinTable': 'Resolve join path:',
- 'modellingJoinColumns': 'Define a join path for table: %{name}',
- 'modellingJoinToTable': 'Join to table: %{name}',
- // Data Quality
- 'excluded': 'Excluded',
- 'metricPrefixThousand': 'K',
- 'metricPrefixMillion': 'M',
- 'metricPrefixBillion': 'B',
- 'metricPrefixTrillion': 'T',
- 'metricPrefixQuadrillion': 'Q',
- //Column Flyout
- 'modellingColumnFilter': 'Filter',
- 'modellingColumnSortNone': 'Clear the sort',
- 'modellingColumnSortAsc': 'Sort ascending',
- 'modellingColumnSortDesc': 'Sort descending',
- 'modellingColumnRemove': 'Remove this column',
- // Import File Browser
- dropboxPageTitle: 'New Dropbox connection',
- sizeColumn: 'Size',
- //Modelling Column Property Values
- 'dataType_string': 'String',
- 'dataType_date': 'Date',
- 'dataType_integer': 'Integer',
- 'dataType_double': 'Double',
- 'dataType_float': 'Float',
- 'dataType_boolean': 'Boolean',
- 'defaultAggregation_count': 'Count',
- 'defaultAggregation_countdistinct': 'Count distinct',
- 'defaultAggregation_max': 'Maximum',
- 'defaultAggregation_min': 'Minimum',
- 'defaultAggregation_avg': 'Average',
- 'defaultAggregation_sum': 'Sum',
- 'defaultAggregation_auto': 'Auto (%{aggregationType})',
- 'type_fact': 'Fact',
- 'type_attribute': 'Attribute',
- 'defaultSort_none': 'Do not sort',
- 'defaultSort_asc': 'Sort ascending',
- 'defaultSort_desc': 'Sort descending',
- 'category_none': 'None',
- 'category_location': 'Location',
- 'category_monetary': 'Monetary',
- 'category_time': 'Time',
- // Root menu
- rootMenuTitle: 'Main menu',
- errorMessageTitle: 'Error',
- errorMessageDetails: 'Details: ',
- errorMessageTitleAssetAlreadyExists: 'Asset already exists',
- defaultTabTitle: 'Tab %{index}',
- tabAddBtnTitle: 'Add a new tab',
- // Homepage View
- nameColumn: 'Name',
- creatorColumn: 'Created by',
- creationDateColumn: 'Date created',
- versionColumn: 'Version',
- modifiedColumn: 'Last Modified',
- filterBy: 'Filter items',
- allFilter: 'All items',
- createdByMeFilter: 'Created by me',
- sharedWithMeFilter: 'Shared with me',
- favoritesFilter: 'My favorites',
- recentsFilter: 'Recently added',
- sortBy: 'Sort by',
- // Sort Menu
- sortModified: 'Modified',
- sortUpdated: 'Updated',
- sortName: 'Name',
- viewAs: 'View as',
- thumbnailsView: 'View as thumbnails',
- listView: 'View as a list',
- createMenu: 'Create',
- newAppItem: 'Dashboard',
- newDataSet: 'Data set',
- newStory: 'Story',
- menuSelectionState_a11y: '"%{item}" selector set to "%{selectedItem}"',
- unableToShareItem: 'Unable to share item "%{item}".',
- toastFetchingContent: 'Getting more content...',
- unableToGetData: 'Unable to get content.',
- unableToFavorite: 'Unable to change the Favorite status.',
- hpErrorMissingRequiredOptions: 'Missing required initialization options',
- unableToOpenBoard: 'Unable to open "%{name}".',
- unableToDuplicateBoard: 'Unable to duplicate "%{name}".',
- unableToCreateBoard: 'Unable to create "%{name}".',
- unableToCreateBoardNameConflict: 'An asset with the same name already exists.',
- // DataSet Detail View
- status: 'Status',
- numberOfRows: 'Rows',
- importWarnings: 'Warnings',
- lineNumbers: 'Lines',
- excerptFromSource: 'Excerpt',
- reason: 'Reason',
- numberOfRowsDropped: 'rows dropped',
- oneRowDropped: '1 row was dropped',
- // Type Menu
- typeMenuLabel: 'Type',
- dashboardsLabel: 'Dashboards',
- datasetsLabel: 'Data sets',
- storiesLabel: 'Stories',
- allLabel: 'All types',
- // Board Page View App Bar
- datasets: 'Data sets',
- settings: 'Properties',
- add: 'Add',
- widgets: 'Widgets',
- dashboardProperties: 'Dashboard properties',
- storyProperties: 'Story properties',
- pins: 'Collection',
- // For languages with more than one plural form, provide the different forms delimited by |||| in the string below.
- // See https://github.com/airbnb/polyglot.js#pluralization
- pinCount: '%{smart_count} collected item |||| %{smart_count} collected items',
- pinSearch: 'Search',
- pinListView: 'List view',
- pinIconView: 'Icon view',
- pinRemove: 'Remove',
- pinCreate: 'Create',
- pinDateFilter: 'Date Filter',
- pinDateFilterAll: 'All',
- pinDateFilterToday: 'Today',
- pinDateFilterYesterday: 'Yesterday',
- pinDateFilterPastWeek: 'Past week',
- pinDateFilterPastMonth: 'Past month',
- pinDateFilterEarlier: 'Earlier',
- // widgets contextual toolbar labels
- toolbarRegionLabel: 'Toolbar',
- toolbarActionDelete: 'Delete',
- toolbarActionGroup: 'Group',
- toolbarActionUngroup: 'Ungroup',
- toolbarActionOrder: 'Order',
- toolbarActionEditTitle: 'Edit the title',
- toolbarActionPin: 'Collect',
- //Story scene toolbar
- toolbarActionTimeline: 'Set the scene timeline',
- // data widget contextual toolbar labels
- toolbarActionSort: 'Sort',
- toolbarActionSortAscending: 'Sort ascending',
- toolbarActionSortDescending: 'Sort descending',
- toolbarActionSortAuto: 'Auto (%{sortOrder})',
- toolbarActionFormat: 'Format',
- toolbarActionFormatAbbreviation: 'Abbreviate',
- toolbarActionFormatNone: 'Auto',
- toolbarActionFilter: 'Filter',
- toolbarActionTopBottom: 'Top or bottom',
- toolbarActionToggleShapeDrop: 'Infographic shape',
- toolbarActionToggleShapeDropTitle: 'Create an infographic',
- toolbarActionToggleShapeDropText: 'Drag a shape to this field to create an infographic.',
- toolbarActionAggregationType: 'Summarize',
- toolbarActionFilterLocalKeepSelected: 'Keep',
- toolbarActionFilterLocalExcludeSelected: 'Exclude',
- toolbarActionFilterAllKeepSelected: 'Filter',
- toolbarActionSimpleCalculation: 'Simple calculation',
- toolbarActionDrillBack: 'Back',
- toolbarActionDrillUp: 'Drill up',
- toolbarActionDrillDown: 'Drill down',
- toolbarActionNavigate: 'Navigate',
- toolbarActionCreateFilterGroup: 'Create new connection',
- toolbarActionDisconnectFilterGroup: 'Break all links',
- toolbarActionLinkFilterGroup: 'Add to an existing connection',
- toolbarLabel: '%{labelName}:',
- toolbarNoValueLabel: '%{labelName}',
- // Side bar
- 'sidebarAdd': 'Add',
- 'sidebarMultiselect': 'Toggle multiple selection',
- 'multiselectMsg': '%{count} selected',
- 'multiselectWithTotalMsg': '%{count} of %{total}',
- 'sidebarGoBack': 'Go back',
- //DataSet pane
- errorLoadingDataSets: 'We can\'t load this data set',
- errorLoadingDataSetMetaData: 'We can\'t load this data set',
- 'dataSetPaneLastUpdated': 'Last updated: %{date}',
- 'dataSetPaneDateUnknown': 'Unknown',
- 'sourcePaneLabel': 'Selected sources',
- 'addSourceLabel': 'Add a source',
- 'intentSearchLabel': 'Intent search',
- 'find_label': 'Find',
- 'navigationPathsLabel': 'Navigation paths',
- //widgetlist
- errorLoadingWidgetList: 'We can\'t load the objects.',
- errorLoadingThemeFile: 'We can\'t load the theme definition',
- errorLoadingLayoutFile: 'We can\'t load the view.',
- //data widget
- dwErrorLoadingAvailableVisualizations: 'We can\'t load the available visualization definitions',
- dwErrorLoadingVisualizationNotFound: 'We can\'t load the object, because it is missing a visualization definition',
- dwErrorLoadingVisualizationListNotFound: 'We can\'t load the visualization.',
- dwErrorRunningQuery: 'We can\'t retrieve the data from data set %{datasetName}.',
- dwErrorGeoData: 'We\'re having trouble displaying the geographic data in a map. Please choose another visualization type. ',
- dwPromptSignonCancelWarning: 'The data for this visualization is unavailable. Please provide the correct credentials.',
- dwErrorMissingDataset: 'We can\'t load the visualization, because its associated data set \'%{datasetName}\' isn\'t available.',
- dwErrorRenderingVisualization: 'We can\'t load this visualization.',
- dwErrorVisualizationTooSmall: 'The visualization is too small to display the data it contains. Make the visualization larger or limit the data it contains.',
- aria_label_datatable: 'Data table',
- aria_key_navi_datatable_desc: 'Use arrow keys to navigate to each cell. Press Control and Home key to move to the first row, Control and End key to move to the last row.',
- geomapUnrecognizedLocations: 'Unrecognized locations:',
- geomapAmbiguousLocations: 'Ambiguous regions:',
- // custom widget
- customWidget: 'Custom widget',
- noCustomWidgets: 'No custom widgets',
- // Action names
- 'toggleContextBar': 'Toggle the context bar',
- 'delete': 'Delete',
- 'share': 'Share',
- 'unshare': 'Unshare',
- 'rename': 'Rename',
- 'close': 'Close',
- 'duplicate': 'Duplicate',
- 'copyOf': 'Copy of %{name}',
- 'retry': 'Retry',
- 'changeTemplate': 'Change template',
- // Aggregation Types
- 'sum': 'Sum',
- 'count': 'Count',
- 'countdistinct': 'Count distinct',
- 'avg': 'Average',
- 'min': 'Minimum',
- 'max': 'Maximum',
- 'custom': 'Custom',
- 'calculated': "Calculated",
- 'aggregatedColumnLabel': '%{column} (%{aggregationTypeLabel})', // For example, the sum of Revenue
- //simple calculation
- 'percDifferenceOp': '% change',
- //For example, Profit - Expenses
- 'calculationTitle': '%{col1} %{operator} %{col2}',
- 'quickadd': 'What do you want to see? For example, Revenue by Year.',
- 'templateWidgetPlaceholderInput': 'Visualization criteria...',
- 'QuickAddResultsHeader': 'Data visualizations',
- 'NoQuickAddResults': 'Nothing matched your intent. Create a new data set?',
- 'NoQuickAddResultsRetry': 'We can\'t find any matches. Try again with different terms.',
- 'templateWidgetTitle': 'Template',
- nullValueLabel: '(blank)',
- nullValueContent: '(no value)',
- // Modelling / Data Shaping
- textFilterControlRegionLabel: 'Text filter - %{columnName}',
- textFilterSelectTab: 'Select',
- textFilterConditionTab: 'Set a condition',
- textFilterItemsSelected: '(%{selected})',
- textFilterItemsNotFound: 'No items are available.',
- textFilterEquals: 'Equals',
- textFilterContains: 'Contains',
- textFilterBeginsWith: 'Begins with',
- textFilterEndsWith: 'Ends with',
- textFilterDoesNotEqual: 'Does not equal',
- textFilterDoesNotContain: 'Does not contain',
- textFilterDoesNotBeginWith: 'Does not begin with',
- textFilterDoesNotEndWith: 'Does not end with',
- textFilterSampleText: 'For example: A',
- textFilterAndButton: 'And',
- textFilterOrButton: 'Or',
- dateFilterMessage: 'Select a range of dates',
- dateRangeControlRegionLabel: 'Date range filter - %{columnName}',
- dateFilterRangeOption: 'Range option',
- dateFilterDateLabel: 'Date',
- dateFilterBlank: '(blank)',
- dateFilterBefore: 'Before',
- dateFilterAfter: 'After',
- dateFilterBetween: 'Between',
- dateFilterSampleText: 'YYYY-MM-DD',
- dateTitle: 'Date',
- dateIncludeBlankLabel: 'Include blank date',
- timeTitle: 'Time',
- timeFilterMessage: 'Select a range of times',
- dateTimeFilterMessage: 'Select a range of dates and times',
- topbottomSelectOption: 'Top or bottom option',
- topbottomOptionLabel: 'Show',
- searchByLabel: 'By',
- searchNoMatches: 'No matches found',
- topbottomRankColumnLabel: 'Add a rank column to grid',
- topbottomNone: 'None',
- topFive: 'Top 5',
- bottomFive: 'Bottom 5',
- topTen: 'Top 10',
- bottomTen: 'Bottom 10',
- topbottomSearchColumn: 'Find a column',
- searchColumnAriaLabel: 'Find a column. Type the name of the column to search for then use the down arrow to find the column in a list',
- rankColumnLabel: 'Rank (%{columnLabel})',
- rangeFilterControlRegionLabel: 'Range filter - %{columnName}',
- // Slider
- sliderRegionLabel: 'Slider control, use right and left arrows to move the slider handles',
- sliderHandleLabel: 'Slider handle',
- a11ySliderHandleLabel: 'Slider handle %{sliderValue}',
- sliderInputLabel: 'value',
- // Refinery - Hidden columns
- datasetItemsUnavailable: 'Some data set items used in this visualization are unavailable.',
- datasetItemUnavailable: 'This data set item is unavailable',
- //Authoring topBottom
- topOperator: 'Top',
- bottomOperator: 'Bottom',
- //For dimension column. eg: Top 5 by Quantity. %{operator} is topOperator or bottomOperator, %{val} is a number and %{fact} is a column name.
- topBottomFact: '%{operator} %{value} by %{columnLabel}',
- //For fact column. eg: Top 10. %{operator} is topOperator or bottomOperator and %{val} is a number.
- topBottomDimension: '%{operator} %{value}',
- topBottomTitle: 'This object only',
- deleteTopBottom: 'Delete top or bottom count',
- editTopBottom: 'Edit top or bottom count',
- deleteDrillState: 'Delete current drill state',
- ariaDeleteDrillStateLabel: 'Press ENTER key to edit top or bottom count.',
- drillUpStateTitle: 'Drill Up',
- drillDownStateTitle: 'Drill Down',
- ariaEditTopBottomLabel: 'Press ENTER key to edit top or bottom count.',
- ariaDeleteTopBottomLabel: 'Press DELETE key to delete top or bottom count.',
- // Authoring filtering
- dimFilterIn: 'Includes: %{in}',
- dimFilterNotIn: 'Excludes: %{out}',
- measureFilterBetween: 'Between %{lowerBound} and %{upperBound}',
- measureFilterNotBetween: 'Not between %{lowerBound} and %{upperBound}',
- gtFilter: 'After %{lowerBound}',
- ltFilter: 'Before %{upperBound}',
- localFilterTitle: 'This object only',
- globalFilterTitle: 'All objects',
- deleteFilter: 'Delete filter',
- editFilter: 'Edit filter',
- ariaEditFilterLabel: 'Press ENTER key to edit filter.',
- ariaDeleteFilterLabel: 'Press DELETE key to delete filter.',
- // Prompts
- ariaEditPrompt: 'Press ENTER key to change the prompt value',
- moreDataIndicator: 'Your data was clipped at %{threshold} items. Apply a filter to show less.',
- // data point filtering
- dataPointFilterTitle: 'Data points',
- dataPointFilterIncludeSummary: 'Included %{valueCount} data points',
- dataPointFilterExcludeSummary: 'Excluded %{valueCount} data points',
- // DB2 connection page
- db2Database: 'DB2 Database (%{jdbcConnection})',
- db2Title: 'Connect to IBM DB2',
- // Database
- databaseConnectionMessage: 'Provide your database connection details:',
- connectionString: 'Database connection string',
- databaseCredentials: 'Credentials: ',
- databaseUserName: 'User name',
- databasePassword: 'Password',
- databaseConnect: 'Connect',
- // Twitter Keyword page
- twitterTitle: 'Twitter',
- twitterKeywordMessage: 'Enter a search term:',
- twitterKeyword: 'Keyword',
- twitterSearch: 'Search',
- // NewConnectionView Providers
- twitterProvider: 'Twitter',
- dropboxProvider: 'Dropbox',
- db2Provider: 'DB2',
- workbookCreateFailed: 'We can\'t create the view: %{error}\nFailed operation: %{lastOp}',
- // Expanded View, Focus View
- widgetFiltersLabel: 'Widget filters',
- missingColumn: 'Missing: %{columnLabel}',
- missingFiltering: 'Missing filters on following column IDs:',
- heatByLabel: 'Heat by',
- 'evCollapse': 'Collapse',
- 'evColumns': 'Columns',
- 'evLocalFilters': 'Local filters',
- 'evExpand': 'Expand',
- 'evFilterTooltip': 'Filter',
- 'evAdd': 'Add a column',
- // Navigation View
- 'navigationBack': 'Back',
- //Storytelling
- storyTellingDefaultSceneTitle: 'Scene %{index}',
- storyTellingTabAddBtnTitle: 'Add a new scene',
- storyTellingOverviewBtnLabel: 'Overview',
- storyTellingSelectSceneWarning: 'Please select a scene',
- storyTellingSceneAddBtnTitle: 'Add a new scene',
- storyTellingNumScenes: '%{index} scenes',
- storyTellingTimelineDisabledInteraction: 'Tap again to pause and interact',
- timelineRecord: 'Record',
- timelineRecording: 'Capturing property changes...',
- timelinePlay: 'Play',
- timelinePause: 'Pause',
- sceneStart: 'Jump to the beginning of the scene',
- sceneEnd: 'Jump to the end of the scene',
- sceneNavigation: 'Scene navigation',
- navNextScene: 'Next scene',
- navPrevScene: 'Previous scene',
- navPrevSceneAbbreviated: 'Prev scene',
- navExitFullScreen: 'Exit full screen',
- navToggleOverview: 'Toggle overview',
- fullscreen: 'Enter full screen',
- fullscreenMenuLabel: 'Full screen',
- betaStorytelling_1: 'This is a Beta feature and is subject to the terms of use found ',
- betaStorytelling_2: 'here',
- betaStorytelling_3: '. By using this Beta feature you agree to those terms.',
- betaDialog: 'Technology Preview Code (TPC) provided with the IBM SaaS are not part of the IBM SaaS. TPC is provided under the same terms as the IBM SaaS, except as provided below. Some or all of the TPC may not be made generally available by IBM as or in a product or offering. You are permitted to use TPC only for internal use for evaluation purposes and not for use in a production environment. You may use the TPC until IBM withdraws the TPC or terminates access to it. IBM provides the TPC without obligation of support and "AS IS," WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING, WITHOUT LIMITATION, THE WARRANTY OF TITLE, NON-INFRINGEMENT OR NON-INTERFERENCE AND ANY IMPLIED WARRANTIES AND CONDITIONS OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. You should take precautions to avoid any loss of data that might result when the TPC can no longer be used. You agree IBM may use all feedback and suggestions you provide. ',
- //time journey
- 'sceneListStart': 'Start',
- 'sceneListEnd': 'End',
- // Pinning
- 'contentPinFail': 'We can\'t collect the content: %{error}',
- // Layouts
- 'dropZoneLabel': 'Drop here to maximize',
- //Share
- shareDefaultPageTitle: 'Page %{index}',
- shareDefaultStoryPageTitle: 'Scene %{index}',
- nextPage: 'Next page',
- previousPage: 'Previous page',
- assetAssembly: 'view',
- assetStory: 'story',
- toolbar_save: 'Save',
- brgr_saveAs: 'Save as',
- brgr_refresh: 'Refresh',
- saving: 'Saving...',
- save_success: 'Your view has been saved.',
- save_failure: 'We\'re sorry. Your view could not be saved. Please try again later.',
- geminiLeave: 'You are about to leave IBM Watson Analytics.',
- warning: 'Warning',
- missingDataSetData: 'The data for this data set is not available. Refresh the data set or contact your administrator for access to the source.',
- // Calculations
- error_calculation_in_use: 'The selected calculation is in use and cannot be deleted.',
- resize: 'Resize',
- rotate: 'Rotate',
- moveHandle: 'Move widget',
- panHandle: 'Pan',
- //Navigation
- navigateTitle: 'Navigate to',
- // Slide out titles
- shapeSlideoutTitle: 'Shapes',
- textSlideoutTitle: 'Text',
- mediaSlideoutTitle: 'Media',
- visualizationSlideoutTitle: 'Visualizations',
- // Board Model Dialog Messages
- invalidJSONResponse: 'Provided JSON is invalid. See error log for more information.',
- // Widget type labels
- shape_label: 'Shape',
- image_label: 'Image',
- data_label: 'Chart',
- media_label: 'Media',
- text_label: 'Text',
- embedMedia_label: 'Media',
- youtube_label: 'YouTube video',
- webpage_label: 'Webpage',
- // **** Smart names for objects ****
- // You might think that one_name is useless, but we have it in case we need to change that resource into one_name_numbered
- one_name: '%{name}',
- one_name_numbered: '%{name} (%{number})',
- noExtraText_shape: 'Shape',
- noExtraText_shape_numbered: 'Shape (%{number})',
- few_shape: 'Group of %{count} shapes',
- many_shape: 'Group of %{count} shapes',
- // %{text} is the alternate text of the image, specified in the properties by the user
- one_image: '%{text} image',
- one_image_number: '%{text} image (%{number})',
- noExtraText_image: 'Image',
- noExtraText_image_numbered: 'Image (%{number})',
- few_image: 'Group of %{count} images',
- many_image: 'Group of %{count} images',
- noExtraText_text: 'Empty text box',
- noExtraText_text_numbered: 'Empty text box (%{number})',
- few_text: 'Group of %{count} text boxes',
- many_text: 'Group of %{count} text boxes',
- // %{name} is the user-provided name of the chart
- one_named_data: '%{name} chart',
- one_named_data_numbered: '%{name} chart (%{number})',
- one_unknown_data: 'Chart',
- one_unknown_data_numbered: 'Chart (%{number})',
- // Bubble chart: y-axis vs x-axis by color bubble chart
- RAVE2_bubble_has_mapping: '%{y} vs %{x} by %{color} bubble chart',
- RAVE2_bubble_has_mapping_numbered: '%{y} vs %{x} by %{color} bubble chart (%{number})',
- RAVE2_bubble_no_mapping: 'Empty bubble chart',
- RAVE2_bubble_no_mapping_numbered: 'Empty bubble chart (%{number})',
- RAVE2_bubble_named: '%{name} bubble chart',
- RAVE2_bubble_named_numbered: '%{name} bubble chart (%{number})',
- // Clustered Bar chart: y-axis by value bar chart - note that the labels are mislabeld vis-a-vis the slotIds
- RAVE2_clusteredbar_has_mapping: '%{x} by %{y} bar chart',
- RAVE2_clusteredbar_has_mapping_numbered: '%{x} by %{y} bar chart (%{number})',
- RAVE2_clusteredbar_no_mapping: 'Empty bar chart',
- RAVE2_clusteredbar_no_mapping_numbered: 'Empty bar chart (%{number})',
- RAVE2_clusteredbar_named: '%{name} bar chart',
- RAVE2_clusteredbar_named_numbered: '%{name} bar chart (%{number})',
- // Clustered Column chart: value by x-axis column chart - note that the labels are mislabeld vis-a-vis the slotIds
- RAVE2_clusteredcolumn_has_mapping: '%{y} by %{x} column chart',
- RAVE2_clusteredcolumn_has_mapping_numbered: '%{y} by %{x} column chart (%{number})',
- RAVE2_clusteredcolumn_no_mapping: 'Empty column chart',
- RAVE2_clusteredcolumn_no_mapping_numbered: 'Empty column chart (%{number})',
- RAVE2_clusteredcolumn_named: '%{name} column chart',
- RAVE2_clusteredcolumn_named_numbered: '%{name} column chart (%{number})',
- // Crosstab: values by Row1 (and Column1)
- crosstab_opt_mapping: '%{values} by %{row_level1} and %{column_level1}',
- crosstab_opt_mapping_numbered: '%{values} by %{row_level1} and %{column_level1} (%{number})',
- crosstab_has_mapping: '%{values} by %{row_level1}',
- crosstab_has_mapping_numbered: '%{values} by %{row_level1} (%{number})',
- crosstab_no_mapping: 'Empty crosstab',
- crosstab_no_mapping_numbered: 'Empty crosstab (%{number})',
- crosstab_named: '%{name} crosstab',
- crosstab_named_numbered: '%{name} crosstab (%{number})',
- // Data player: axis label dataplayer
- dataPlayer_has_mapping: '%{categories} data player',
- dataPlayer_has_mapping_numbered: '%{categories} data player (%{number})',
- dataPlayer_no_mapping: 'Empty data player',
- dataPlayer_no_mapping_numbered: 'Empty data player (%{number})',
- dataPlayer_named: '%{name} data player',
- dataPlayer_named_numbered: '%{name} data player (%{number})',
- // Grid: first column grid
- JQGrid_has_mapping: '%{grid_cols} grid',
- JQGrid_has_mapping_numbered: '%{grid_cols} grid (%{number})',
- JQGrid_no_mapping: 'Empty grid',
- JQGrid_no_mapping_numbered: 'Empty grid (%{number})',
- JQGrid_named: '%{name} grid',
- JQGrid_named_numbered: '%{name} grid (%{number})',
- // Heatmap: color by x axis and y axis heatmap
- RAVE2_heatmap_has_mapping: '%{color} by %{x} and %{y} heatmap',
- RAVE2_heatmap_has_mapping_numbered: '%{color} by %{x} and %{y} heatmap (%{number})',
- RAVE2_heatmap_no_mapping: 'Empty heatmap',
- RAVE2_heatmap_no_mapping_numbered: 'Empty heatmap (%{number})',
- RAVE2_heatmap_named: '%{name} heatmap',
- RAVE2_heatmap_named_numbered: '%{name} heatmap (%{number})',
- // Hierarchy: level one hierarchy
- hierarchy_has_mapping: '%{level1} hierarchy',
- hierarchy_has_mapping_numbered: '%{level1} hierarchy (%{number})',
- hierarchy_no_mapping: 'Empty hierarchy',
- hierarchy_no_mapping_numbered: 'Empty hierarchy (%{number})',
- hierarchy_named: '%{name} hierarchy',
- hierarchy_named_numbered: '%{name} hierarchy (%{number})',
- // Legacy map: Region heat by Regions map
- map_has_mapping: '%{values} by %{categories} map',
- map_has_mapping_numbered: '%{values} by %{categories} map (%{number})',
- map_no_mapping: 'Empty map',
- map_no_mapping_numbered: 'Empty map (%{number})',
- map_named: '%{name} map',
- map_named_numbered: '%{name} map (%{number})',
- // Line and column chart
- RAVE2_compositeSmoothOneDataSet_has_mapping: 'Line and column chart',
- RAVE2_compositeSmoothOneDataSet_has_mapping_numbered: 'Line and column chart (%{number})',
- RAVE2_compositeSmoothOneDataSet_named: '%{name} line and column chart',
- RAVE2_compositeSmoothOneDataSet_named_numbered: '%{name} line and column chart (%{number})',
- // (New) map: region color by regions map
- RAVE2_tiledmap_has_mapping: '%{value} by %{featureId} map',
- RAVE2_tiledmap_has_mapping_numbered: '%{value} by %{featureId} map (%{number})',
- RAVE2_tiledmap_no_mapping: 'Empty map',
- RAVE2_tiledmap_no_mapping_numbered: 'Empty map (%{number})',
- RAVE2_tiledmap_named: '%{name} map',
- RAVE2_tiledmap_named_numbered: '%{name} map (%{number})',
- // Packed bubble chart: categories by size bubble chart
- RAVE2_packedBubble_has_mapping: '%{label} by %{size} bubble chart',
- RAVE2_packedBubble_has_mapping_numbered: '%{label} by %{size} bubble chart (%{number})',
- RAVE2_packedBubble_no_mapping: 'Empty bubble chart',
- RAVE2_packedBubble_no_mapping_numbered: 'Empty bubble chart (%{number})',
- RAVE2_packedBubble_named: '%{name} bubble chart',
- RAVE2_packedBubble_named_numbered: '%{name} bubble chart (%{number})',
- // Pie chart: values by categories pie chart
- RAVE2_pie_has_mapping: '%{value} by %{color} pie chart',
- RAVE2_pie_has_mapping_numbered: '%{value} by %{color} pie chart (%{number})',
- RAVE2_pie_no_mapping: 'Empty pie chart',
- RAVE2_pie_no_mapping_numbered: 'Empty pie chart (%{number})',
- RAVE2_pie_named: '%{name} pie chart',
- RAVE2_pie_named_numbered: '%{name} pie chart (%{number})',
- // Point chart: value by x axis point chart
- RAVE2_point_has_mapping: '%{y} by %{x} point chart',
- RAVE2_point_has_mapping_numbered: '%{y} by %{x} point chart (%{number})',
- RAVE2_point_no_mapping: 'Empty point chart',
- RAVE2_point_no_mapping_numbered: 'Empty point chart (%{number})',
- RAVE2_point_named: '%{name} point chart',
- RAVE2_point_named_numbered: '%{name} point chart (%{number})',
- // Radial chart: value by label radial chart
- RAVE2_dial_has_mapping: '%{value} by %{label} radial chart',
- RAVE2_dial_has_mapping_numbered: '%{value} by %{label} radial chart (%{number})',
- RAVE2_dial_no_mapping: 'Empty radial chart',
- RAVE2_dial_no_mapping_numbered: 'Empty radial chart (%{number})',
- RAVE2_dial_named: '%{name} radial chart',
- RAVE2_dial_named_numbered: '%{name} radial chart (%{number})',
- // Radial bar, category labels chart: value by categories radial bar chart
- RAVE2_multipleDialCategoryLabel_has_mapping: '%{value} by %{category} radial bar chart',
- RAVE2_multipleDialCategoryLabel_has_mapping_numbered: '%{value} by %{category} radial bar chart (%{number})',
- RAVE2_multipleDialCategoryLabel_no_mapping: 'Empty radial bar chart',
- RAVE2_multipleDialCategoryLabel_no_mapping_numbered: 'Empty radial bar chart (%{number})',
- RAVE2_multipleDialCategoryLabel_named: '%{name} radial bar chart',
- RAVE2_multipleDialCategoryLabel_named_numbered: '%{name} radial bar chart (%{number})',
- // Scatter plot: points by x axis and y axis scatter plot OR (if no points) x axis vs y axis scatter plot
- RAVE2_scatter_opt_mapping: '%{label} by %{x} and %{y} scatter plot',
- RAVE2_scatter_opt_mapping_numbered: '%{label} by %{x} and %{y} scatter plot (%{number})',
- RAVE2_scatter_has_mapping: '%{x} vs %{y} scatter plot',
- RAVE2_scatter_has_mapping_numbered: '%{x} vs %{y} scatter plot (%{number})',
- RAVE2_scatter_no_mapping: 'Empty scatter plot',
- RAVE2_scatter_no_mapping_numbered: 'Empty scatter plot (%{number})',
- RAVE2_scatter_named: '%{name} scatter plot',
- RAVE2_scatter_named_numbered: '%{name} scatter plot (%{number})',
- // Smooth area chart: value by x axis smooth area chart
- RAVE2_smoothArea_has_mapping: '%{y} by %{x} smooth area chart',
- RAVE2_smoothArea_has_mapping_numbered: '%{y} by %{x} smooth area chart (%{number})',
- RAVE2_smoothArea_no_mapping: 'Empty smooth area chart',
- RAVE2_smoothArea_no_mapping_numbered: 'Empty smooth area chart (%{number})',
- RAVE2_smoothArea_named: '%{name} smooth area chart',
- RAVE2_smoothArea_named_numbered: '%{name} smooth area chart (%{number})',
- // Smooth line chart: value by x axis smooth line chart
- RAVE2_smoothline_has_mapping: '%{y} by %{x} smooth line chart',
- RAVE2_smoothline_has_mapping_numbered: '%{y} by %{x} smooth line chart (%{number})',
- RAVE2_smoothline_no_mapping: 'Empty smooth line chart',
- RAVE2_smoothline_no_mapping_numbered: 'Empty smooth line chart (%{number})',
- RAVE2_smoothline_named: '%{name} smooth line chart',
- RAVE2_smoothline_named_numbered: '%{name} smooth line chart (%{number})',
- // Stacked Bar chart: x-axis by value bar chart - note that the labels are mislabeld vis-a-vis the slotIds
- RAVE2_stackedbar_has_mapping: '%{x} by %{y} bar chart',
- RAVE2_stackedbar_has_mapping_numbered: '%{x} by %{y} bar chart (%{number})',
- RAVE2_stackedbar_no_mapping: 'Empty bar chart',
- RAVE2_stackedbar_no_mapping_numbered: 'Empty bar chart (%{number})',
- RAVE2_stackedbar_named: '%{name} bar chart',
- RAVE2_stackedbar_named_numbered: '%{name} bar chart (%{number})',
- // Stacked Column chart: x-axis by value column chart - note that the labels are mislabeld vis-a-vis the slotIds
- RAVE2_stackedcolumn_has_mapping: '%{x} by %{y} column chart',
- RAVE2_stackedcolumn_has_mapping_numbered: '%{x} by %{y} column chart (%{number})',
- RAVE2_stackedcolumn_no_mapping: 'Empty column chart',
- RAVE2_stackedcolumn_no_mapping_numbered: 'Empty column chart (%{number})',
- RAVE2_stackedcolumn_named: '%{name} column chart',
- RAVE2_stackedcolumn_named_numbered: '%{name} column chart (%{number})',
- // Summary value: value summary value
- summary_has_mapping: '%{values} summary value',
- summary_has_mapping_numbered: '%{values} summary value (%{number})',
- summary_no_mapping: 'Empty summary value',
- summary_no_mapping_numbered: 'Empty summary value (%{number})',
- summary_named: '%{name} summary value',
- summary_named_numbered: '%{name} summary value (%{number})',
- // (Infographic summary) Infographic: value infographic
- infographicSummary_has_mapping: '%{values} infographic',
- infographicSummary_has_mapping_numbered: '%{values} infographic (%{number})',
- infographicSummary_no_mapping: 'Empty infographic',
- infographicSummary_no_mapping_numbered: 'Empty infographic (%{number})',
- infographicSummary_named: '%{name} infographic',
- infographicSummary_named_numbered: '%{name} infographic (%{number})',
- // Tree map: 'size by' by 'level 1' tree map
- treeMap_has_mapping: '%{categories} by %{values} tree map',
- treeMap_has_mapping_numbered: '%{categories} by %{values} tree map (%{number})',
- treeMap_no_mapping: 'Empty tree map',
- treeMap_no_mapping_numbered: 'Empty tree map (%{number})',
- treeMap_named: '%{name} tree map',
- treeMap_named_numbered: '%{name} tree map (%{number})',
- // Word cloud: words word cloud
- RAVE2_wordcloud_has_mapping: '%{label} word cloud',
- RAVE2_wordcloud_has_mapping_numbered: '%{label} word cloud (%{number})',
- RAVE2_wordcloud_no_mapping: 'Empty word cloud',
- RAVE2_wordcloud_no_mapping_numbered: 'Empty word cloud (%{number})',
- RAVE2_wordcloud_named: '%{name} word cloud',
- RAVE2_wordcloud_named_numbered: '%{name} word cloud (%{number})',
- few_data: 'Group of %{count} charts',
- many_data: 'Group of %{count} charts',
- noExtraText_youtube: 'YouTube video',
- noExtraText_youtube_numbered: 'YouTube video (%{number})',
- // %{text} is the user-provided title of the video
- one_youtube: '%{text} YouTube video',
- one_youtube_numbered: '%{text} YouTube video (%{number})',
- few_youtube: 'Group of %{count} YouTube videos',
- many_youtube: 'Group of %{count} YouTube videos',
- noExtraText_embedMedia: 'Media link',
- noExtraText_embedMedia_numbered: 'Media link (%{number})',
- // %{text} is the user-provided title of the media link
- one_embedMedia: '%{text} media link',
- one_embedMedia_numbered: '%{text} media link (%{number})',
- few_embedMedia: 'Group of %{count} media links',
- many_embedMedia: 'Group of %{count} media links',
- noExtraText_media: 'Media',
- noExtraText_media_numbered: 'Media (%{number})',
- // %{text} is the user-provided title of the media link
- one_media: '%{text} media',
- one_media_numbered: '%{text} media (%{number})',
- few_media: 'Group of %{count} media',
- many_media: 'Group of %{count} media',
- noExtraText_webpage: 'Web page',
- noExtraText_webpage_numbered: 'Web page (%{number})',
- // %{text} is the user-provided title of the web page
- one_webpage: '%{text} web page',
- one_webpage_numbered: '%{text} web page (%{number})',
- few_webpage: 'Group of %{count} web pages',
- many_webpage: 'Group of %{count} web pages',
- one_unknown: 'An object',
- one_unknown_numbered: 'An object (%{number})',
- few_unknown: 'Group of %{count} objects',
- many_unknown: 'Group of %{count} objects',
- //a11y label for the left/right arrow for navigation path
- next: 'Next',
- previous: 'Previous',
- //a11y description
- current_nav_group: 'Current navigation group is %{navigation_group_name}',
- //Page Context
- 'filterBlank': '(blank)'
- },
- "cs": true,
- "da": true,
- "de": true,
- "es": true,
- "fi": true,
- "fr": true,
- "hr": true,
- "hu": true,
- "it": true,
- "ja": true,
- "kk": true,
- "ko": true,
- "no": true,
- "nb": true,
- "nl": true,
- "pl": true,
- "pt": true,
- "pt-br": true,
- "ro": true,
- "ru": true,
- "sl": true,
- "sv": true,
- "th": true,
- "tr": true,
- "zh": true,
- "zh-cn": true,
- "zh-tw": true
- });
- /**
- * Licensed Materials - Property of IBM
- * IBM Cognos Products: BI Cloud (C) Copyright IBM Corp. 2014, 2017
- * US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
- */
- define('bacontentnav/lib/gemini/app/nls/StringResources',[
- 'i18n!../../dashboard/nls/DashboardResources',
- 'i18n!../nls/DashboardResources',
- 'polyglot'
- ], function(titanResources, geminiResources, Polyglot) {
- /**
- * Module which provides simple access to string resources.
- *
- */
- var titanPoly = new Polyglot({
- phrases: titanResources,
- allowMissing: true
- });
- var geminiPoly = new Polyglot({
- phrases: geminiResources
- });
- var StringResources = function() {};
- /**
- * Get the string resource for the given key and interpolation options
- *
- * @param key The key of the string to return
- * @param interpolationOptions Optional interpolation options (see poly.t documentation for details)
- * @returns The string to display
- */
- StringResources.prototype.get = function( key, interpolationOptions ) {
- var msg = titanPoly.t(key, interpolationOptions);
- if(msg === key){
- msg = geminiPoly.t(key, interpolationOptions);
- }
- return msg;
- };
- return new StringResources();
- });
- /**
- * Licensed Materials - Property of IBM
- * IBM Cognos Products: BI Cloud (C) Copyright IBM Corp. 2014, 2017
- * US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
- */
- define('bacontentnav/lib/gemini/app/ui/dialogs/BaseDialog',['../../../../@waca/core-client/js/core-client/ui/core/Class', 'jquery', 'underscore', '../../nls/StringResources', '../../../../@waca/core-client/js/core-client/utils/EventHelper'], function(Class, $, _, stringResources) {
- 'use strict';
- var Dialog = Class.extend({
- _buttons: ['ok', 'cancel'],
- _showCloseX: false,
- _width: null,
- _minWidth:null,
- init: function( options ) {
- this._dialogId = _.uniqueId('modalDialog_');
- this._queryId = '#' + this._dialogId;
- this._defaultKeyMap = { "13": this.ok, "27": this.cancel };
- this.keyMap = this._getKeyCodeMap();
- // set dialog options
- this.setDialogOptions( options );
- },
- // Children can override to provide different key event mappings
- _getKeyCodeMap: function() {
- return this._defaultKeyMap;
- },
- setDialogOptions: function( options ){
- // process options
- if( options ) {
- // set width as necessary
- if( options.width ) {
- this._width = options.width;
- }
- if(options.minWidth){
- this._minWidth = options.minWidth;
- }
- // set closeX button option
- if( options.showCloseX ) {
- this._showCloseX = options.showCloseX;
- }
- // Check for buttons passed in and override defaults.
- if( options.buttons ) {
- this._buttons = options.buttons;
- }
- }
- },
- destroy: function() {
- $(this._queryId).remove();
- },
- remove: function() {
- this.destroy();
- },
- hide: function() {
- $(this._queryId).removeClass('show');
- this.destroy();
- },
- open: function() {
- this.showBlocker();
- this.show();
- },
- // Children can override to provide different blocker cell definitions to use
- getBlockerCell: function() {
- return $('<div>', {
- 'id': this._dialogId + 'Container',
- 'class': 'dialogBlockerCell'
- });
- },
- showBlocker: function() {
- var nBlocker = $(this._queryId);
- if (!nBlocker.length) {
- nBlocker = $('<div>', {
- 'id': this._dialogId,
- 'class': 'dialogBlocker show'
- });
- // set the blocker height (works with scrollbars)
- nBlocker.height($(document).height());
- var nBlockerCell = this.getBlockerCell();
- $('body').append(
- nBlocker.append(
- nBlockerCell.text( stringResources.get('dlg_loading') )
- )
- );
- nBlocker.on('keydown', this.onKey.bind(this));
- }
- },
- show: function() {
- var nContainer = this._container();
- // set width as necessary
- if( this._width ) {
- nContainer.css("max-width", this._width );
- }
- if( this._minWidth ) {
- nContainer.css("min-width", this._minWidth );
- }
- // build dialog as necessary
- if (nContainer.length) {
- nContainer.empty();
- var header = $('<div>', {'class': 'dialogHeader'}),
- title = this.renderTitle( $('<header>', {'class': 'dialogTitle'}) ),
- closeX = this.renderCloseX(),
- content = this.renderContent( $('<div>', {'class': 'dialogContent'}) ),
- footer = this.renderFooter( $('<footer>') );
- // pop the title and closeX into the header
- header.append( title, closeX );
- // set width as necessary (this prevents content from collapsing)
- if( this._width ) {
- header.css( 'max-width',this._width );
- }
- if( this._minWidth ) {
- header.css( 'min-width',this._minWidth );
- }
- // assemble dialog
- nContainer.append(
- $('<div>', {
- 'class': 'modalDialog',
- 'tabIndex': '0',
- 'role': 'dialog'
- }).append(
- header,
- content,
- footer
- )
- );
- //Support for IE
- var modalDialog = nContainer.find('.modalDialog');
- if(this._width){
- modalDialog.css('max-width', this._width);
- }
- if(this._minWidth){
- modalDialog.css('min-width', this._minWidth);
- }
- this.focusOnButton();
- }
- },
- // Children can override to provide different initial button focusing behaviour
- focusOnButton: function() {
- var firstBtn = this._container().find('footer').children('.dialogButton')[0];
- if (firstBtn) {
- firstBtn.focus();
- }
- },
- renderContent: function(n) {
- n.text('Dialog Content');
- return n;
- },
- renderTitle: function(n) {
- n.text('Dialog Title');
- return n;
- },
- /**
- * This function adds a CSS class that will cause the dialog to be centered vertically.
- * This could potentially be affected by additional styles in extended dialog classes.
- **/
- verticalAlignDialog: function() {
- this._container().addClass( 'dialogVerticalAlign' );
- },
- renderCloseX: function() {
- // only render if required
- if( !this._showCloseX ){
- return null;
- }
- // create button
- var closeX = $('<div>',
- {
- 'class': 'wfg_shape_x dialogCloseX',
- 'title': stringResources.get('dlg_close'),
- 'aria-label': stringResources.get('dlg_close'),
- 'role': 'button'
- });
- closeX.onClick( this.cancel.bind( this ) );
- return closeX;
- },
- renderFooter: function(n) {
- // loop though button collection and process
- for (var i = 0, iLen = this._buttons.length; i < iLen; i++) {
- var btnSpec = this._getButtonDef( this._buttons[i] );
- var b = {
- 'class': 'dialogButton ' + btnSpec.type,
- 'text': btnSpec.text,
- 'aria-label' : btnSpec.text,
- 'role' : 'button',
- 'tabIndex': '0'
- };
- n.append($('<button>', b).onClick(btnSpec.handler.bind(this)));
- }
- return n;
- },
- /**
- * This function takes a given button id or partial definition and updates it to return a complete definition.
- *
- * A button can be an id such as: "ok", "cancel", or "close" OR
- * a button can be an object containing one or more of the following options:
- * {
- * text: String label to display
- * handler: Callback function
- * defaultId: If specified this will use the spec specified by the id (i.e. "ok") for missing info
- * type: "primary" or "secondary" will set the class and visuals accordingly. "destructive"
- * is not currently supportted but might be in the future
- * }
- *
- * @param button Button id or partial spec object
- * @returns Object Complete button spec.
- **/
- _getButtonDef: function( button ) {
- // define the default button spec
- var buttonsDef = {
- 'ok': { 'text': stringResources.get('dlg_ok'), 'handler': this.ok, 'type':'primary' },
- 'cancel': { 'text': stringResources.get('dlg_cancel'), 'handler': this.cancel, 'type':'secondary' },
- 'close': { 'text': stringResources.get('dlg_close'), 'handler': this.cancel, 'type':'primary' }
- };
- // if object is passed then fill in missing otherwise lookup and return
- if( typeof( button ) === 'object' ) {
- // check for defaultId
- if( button.defaultId ) {
- // default text if necessary
- if( !button.text ) {
- button.text = buttonsDef[ button.defaultId ].text;
- }
- // default handler if necesssary
- if( !button.handler ) {
- button.handler = buttonsDef[ button.defaultId ].handler;
- }
- // default type if necesssary
- if( !button.type ) {
- button.type = buttonsDef[ button.defaultId ].type;
- }
- }
- // return
- return button;
- }
- return buttonsDef[ button ];
- },
- onKey: function(evt) {
- var keyCodeString = evt.keyCode.toString();
- if (this.keyMap.hasOwnProperty(keyCodeString)) {
- this.keyMap[keyCodeString].call(this);
- return false;
- }
- return true;
- },
- ok: function() {
- this.hide();
- },
- cancel: function() {
- this.hide();
- },
- /**
- *
- */
- enableOk: function(bEnabled) {
- var btn = $('.dialogButton', this._container()).eq(0);
- btn.toggleClass('disabled', bEnabled === false); // if bEnabled is undefined, it means true.
- if (bEnabled === false) {
- btn.attr('disabled','disabled');
- }
- else {
- btn.removeAttr('disabled');
- }
- },
- disableOk: function() {
- this.enableOk(false);
- },
- _container: function() {
- return $(this._queryId + 'Container');
- }
- });
- return Dialog;
- });
- /**
- * Licensed Materials - Property of IBM
- * IBM Cognos Products: BI Cloud (C) Copyright IBM Corp. 2014
- * US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
- */
- define('bacontentnav/lib/gemini/app/ui/dialogs/MessageBox',['./BaseDialog', 'jquery', 'underscore'], function(BaseDialog, $, _) {
- var Dialog = null;
- Dialog = BaseDialog.extend({
- _buttons: ['ok'],
- init: function(sType, sTitle, sMessage) {
- this._props = {
- 'type': sType,
- 'title': sTitle,
- 'msg': sMessage
- };
- Dialog.inherited('init', this, arguments);
- },
- renderContent: function(n) {
- n.append(
- $('<div>', {
- 'class': 'messageBox ' + this._props.type,
- 'html': _.escape(this._props.msg)
- })
- );
- return n;
- },
- renderTitle: function(n) {
- n.text(this._props.title);
- return n;
- }
- });
- return Dialog;
- });
- /*
- *+------------------------------------------------------------------------+
- *| Licensed Materials - Property of IBM
- *| IBM Cognos Products: Content Explorer
- *| (C) Copyright IBM Corp. 2015, 2018
- *|
- *| US Government Users Restricted Rights - Use, duplication or disclosure
- *| restricted by GSA ADP Schedule Contract with IBM Corp.
- *+------------------------------------------------------------------------+
- */
- define('bacontentnav/ui/dialogs/NameCollisionDialog',[
- '../../lib/gemini/app/ui/dialogs/MessageBox',
- '../../nls/StringResource',
- '../../lib/@waca/core-client/js/core-client/ui/properties/CheckBox'
- ], function(MessageBox, StringResource, CheckBox) {
- var Dialog = null;
- Dialog = MessageBox.extend({
- //Design was debating between two dialog options, the bulk dialog, and the one by one dialog.
- //Set this to false to display the One by One dialog, with the checkbox.
- _DISPLAY_BULK_DIALOG: true,
- _buttons: [],
- _replaceCallback: null,
- _keepBothCallback: null,
- _skipCallback: null,
- create: function(replace, keepBoth, skip, isCopyAction, name) {
- this._replaceCallback = replace;
- this._keepBothCallback = keepBoth;
- this._skipCallback = skip;
- this._name = name;
- /*Set the strings for the buttons, depending on whether the current action is copy or move*/
- var replaceStr, skipObj, keepBothStr;
- if (this._DISPLAY_BULK_DIALOG) {
- replaceStr = StringResource.get('overwrite');
- keepBothStr = StringResource.get('rename');
- skipObj = 'cancel';
- } else {
- replaceStr = (isCopyAction) ? StringResource.get('copyReplace') : StringResource.get('moveReplace');
- keepBothStr = StringResource.get('keepBoth');
- var skipStr = (isCopyAction) ? StringResource.get('copySkip') : StringResource.get('moveSkip');
- skipObj = {
- 'text': skipStr,
- 'handler': this.skip,
- 'type': 'primary copy',
- 'defaultId': 'skipButton'
- };
- }
- this._buttons = [];
- if (this._replaceCallback) {
- this._buttons.push({
- 'text': replaceStr,
- 'handler': this.replace,
- 'type': 'primary move',
- 'defaultId': 'replaceButton'
- });
- }
- if (this._keepBothCallback) {
- this._buttons.push({
- 'text': keepBothStr,
- 'handler': this.keepBoth,
- 'type': 'primary move',
- 'defaultId': 'keepBothButton'
- });
- }
- this._buttons.push(skipObj);
- /* Create a few global variables shared by all NameCollisionDialogs */
- if (typeof Dialog.stack === 'undefined') {
- Dialog.stack = [];
- }
- if (typeof Dialog._repeatActionCallBack === 'undefined') {
- Dialog._repeatActionCallBack = null;
- }
- if (typeof Dialog._doRepeatAction === 'undefined') {
- Dialog._doRepeatAction = false;
- }
- /*Variable that keeps track of whether or not this dialog is the last dialog to appear*/
- this.isLastInstance = true;
- if (Dialog.stack.length !== 0) {
- Dialog.stack[Dialog.stack.length - 1].isLastInstance = false;
- }
- Dialog.stack.push(this);
- if (this._DISPLAY_BULK_DIALOG) {
- if (Dialog.stack.length > 1) {
- this._props.title = StringResource.get('bulkNameCollision', {
- 'noOfItems': Dialog.stack.length
- });
- }
- } else {
- this._props.title = StringResource.get('nameCollision', {
- 'nameOfItem': this._name
- });
- }
- },
- replace: function() {
- this.checkRepeat('replace');
- if (this._replaceCallback) {
- this._replaceCallback();
- }
- Dialog.inherited('ok', this, arguments);
- },
- keepBoth: function() {
- this.checkRepeat('keepBoth');
- if (this._keepBothCallback) {
- this._keepBothCallback();
- }
- Dialog.inherited('ok', this, arguments);
- },
- skip: function() {
- this.checkRepeat('skip');
- if (this._skipCallback) {
- this._skipCallback();
- }
- Dialog.inherited('cancel', this, arguments);
- },
- cancel: function() {
- this.checkRepeat('cancel');
- Dialog.inherited('cancel', this, arguments);
- },
- hide: function() {
- Dialog.inherited('hide', this, arguments);
- //Remove the curent element in the stack
- Dialog.stack = $.grep(Dialog.stack, function(value) {
- return value !== this;
- }.bind(this));
- if (Dialog.stack.length > 0) {
- //Open next element. Only one dialog should be opened at a time.
- if (!this._DISPLAY_BULK_DIALOG && !Dialog._doRepeatAction) {
- Dialog.stack[0].open();
- } else {
- /*The user selected the checkbox to apply his action for all dialogs.
- Do not open the other dialogs, but do apply the saved action.*/
- Dialog.stack[0].doRepeat();
- }
- } else {
- //There is no more dialogs to process. Clear the global variables.
- Dialog._doRepeatAction = false;
- Dialog._repeatActionCallBack = null;
- }
- },
- open: function() {
- Dialog.inherited('open', this, arguments);
- this.renderContent($('<div>'));
- /*
- Add the checkbox to apply the selected action to all remaining dialogs.
- Do not add the checkbox if only 1 dialog remains.
- */
- if (!this._DISPLAY_BULK_DIALOG && Dialog.stack.length > 1) {
- var footer = this._container().find('footer');
- footer.addClass('propertyUIControl');
- var $checkBoxDiv = $('<div></div>');
- footer.prepend($checkBoxDiv);
- var labelStr = StringResource.get('repeatNameCollisionAction', {
- 'noItems': Dialog.stack.length - 1
- });
- //If there are exactly 2 elements in the stack, fetch the singular string
- if (Dialog.stack.length - 1 === 1) {
- labelStr = StringResource.get('repeatNameCollisionActionSingular');
- }
- var aCheckbox = new CheckBox({
- 'el': $checkBoxDiv,
- 'id': 'nameCollision',
- 'name': 'nameCollision',
- 'position': 'leading',
- 'label': labelStr,
- 'controlOnLeft': true,
- 'onChange': function(event) {
- void(event);
- Dialog._doRepeatAction = !Dialog._doRepeatAction;
- }.bind(this)
- });
- aCheckbox.render();
- Dialog._doRepeatAction = false;
- }
- if (!this._DISPLAY_BULK_DIALOG || Dialog.stack.length === 1) {
- var header = this._container().find('div.dialogHeader');
- var $nameHeader = $('<header></header>');
- $nameHeader.addClass('dialogTitle');
- $nameHeader.text(this._name);
- header.append($nameHeader);
- }
- this._container().addClass('nameCollisionDialog');
- },
- checkRepeat: function(str) {
- if (this._DISPLAY_BULK_DIALOG || (!Dialog._repeatActionCallBack && Dialog._doRepeatAction)) {
- Dialog._repeatActionCallBack = str;
- }
- },
- doRepeat: function() {
- switch (Dialog._repeatActionCallBack) {
- case 'replace':
- this.replace();
- break;
- case 'keepBoth':
- this.keepBoth();
- break;
- case 'skip':
- this.skip();
- break;
- case 'cancel':
- this.cancel();
- break;
- default:
- break;
- }
- },
- isLast: function() {
- return this.isLastInstance;
- }
- });
- return Dialog;
- });
- /*
- *+------------------------------------------------------------------------+
- *| Licensed Materials - Property of IBM
- *| IBM Cognos Products: Content Explorer
- *| (C) Copyright IBM Corp. 2015, 2020
- *|
- *| US Government Users Restricted Rights - Use, duplication or disclosure
- *| restricted by GSA ADP Schedule Contract with IBM Corp.
- *+------------------------------------------------------------------------+
- */
- define('bacontentnav/utils/ContentManagement',[
- 'underscore',
- '../lib/@waca/core-client/js/core-client/utils/BidiUtil',
- './ContentServiceUrls',
- './ContentStoreObject',
- './GlassContextHelper',
- '../nls/StringResource',
- '../ui/dialogs/NameCollisionDialog'
- ], function(_, BidiUtil, ContentServiceUrls, ContentStoreObject, GlassContextHelper, StringResource, NameCollisionDialog) {
- 'use strict'; //NOSONAR
- var _singletonInstance = null;
- var ContentManagement = function() {
- if (ContentManagement.prototype._singletonInstance) {
- return ContentManagement.prototype._singletonInstance;
- }
- };
- ContentManagement.prototype._init = function(options) {
- this._glassContext = options.glassContext;
- this._ajaxService = this._glassContext.getCoreSvc('.Ajax');
- this._contentServicePromise = this._glassContext.getSvc('.Content');
- this._options = options;
- };
- ContentManagement.prototype._onAllSettled = function(action, results) {
- // refresh content if any move was successful
- var successCount = _.filter(results, function(result) {
- return result.isFulfilled();
- }).length;
- if (successCount) {
- // show toast of successful items and refresh content
- this._displayToast(action, successCount, results.length);
- this._refreshContent();
- }
- // show name collision dialog if necessary
- if (NameCollisionDialog.stack && NameCollisionDialog.stack.length) {
- NameCollisionDialog.stack[NameCollisionDialog.stack.length - 1].open();
- }
- };
- //TODO: this should be extracted to a common core utility
- ContentManagement.prototype._allSettled = function(promiseArray) {
- return Promise.all(promiseArray.map(function(promise) {
- return promise.reflect();
- }));
- };
- /**
- * Returns the message associated with the given action, number of objects and name.
- */
- ContentManagement.prototype._displayToast = function(action, successCount, totalCount) {
- var msg;
- var isSingleSuccessfulAction = totalCount === 1 && successCount === 1;
- switch (action) {
- case 'copy':
- msg = (isSingleSuccessfulAction) ?
- StringResource.get('toastDoneCopyingSingular', {
- 'nameOfItem': BidiUtil.enforceTextDirection(this._options.inputObjects[0].defaultName)
- }) :
- StringResource.get('toastDoneCopying', {
- 'noOfItems': successCount
- });
- break;
- case 'shortcut':
- msg = (isSingleSuccessfulAction) ?
- StringResource.get('toastDoneShortcuttingSingular', {
- 'nameOfItem': BidiUtil.enforceTextDirection(this._getShortCutName(this._options.inputObjects[0].defaultName))
- }) :
- StringResource.get('toastDoneShortcutting', {
- 'noOfItems': successCount
- });
- break;
- default: // move
- msg = (isSingleSuccessfulAction) ?
- StringResource.get('toastDoneMovingSingular', {
- 'nameOfItem': BidiUtil.enforceTextDirection(this._options.inputObjects[0].defaultName)
- }) :
- StringResource.get('toastDoneMoving', {
- 'noOfItems': successCount
- });
- }
- GlassContextHelper.displayToast(this._glassContext, msg);
- };
- ContentManagement.prototype.isNameConflict = function(error) {
- var errorCode = (error && error.jqXHR && error.jqXHR.responseJSON && error.jqXHR.responseJSON.errorCode) || '';
- if (error && error.code === 400) {
- if (errorCode.indexOf('cmUpdateFailed1') !== -1) {
- //check if we have a CM-REQ-4036 error (duplicate error).
- var jqXHRMessages = error.jqXHR.responseJSON.messages || [];
- return _.some(jqXHRMessages, function(message) {
- return message.indexOf('CM-REQ-4036') !== -1;
- });
- } else {
- return ['cmDuplicateName','cmNameConflict', 'cmDuplicateObject'].indexOf(errorCode) !== -1;
- }
- }
- return false;
- };
- /**
- * returns true if the error contains a CM-REQ-4335 uknown error message
- * @param error an error from CM
- * @return boolean if this is an unknown update error.
- */
- ContentManagement.prototype.isUnknownUpdateError = function(error) {
- if (error && error.code === 400 && error.jqXHR && error.jqXHR.responseJSON) {
- //check if we have a CM-REQ-4036 error (duplicate error).
- var jqXHRMessages = error.jqXHR.responseJSON.messages || [];
- return _.some(jqXHRMessages, function(message) {
- return message.indexOf('CM-REQ-4335') !== -1;
- });
- }
- return false;
- };
- ContentManagement.prototype._getActionPromises = function(action, data) {
- var aPromises = [];
- this._options.inputObjects.forEach(function(obj) {
- aPromises.push(new Promise(function(resolve, reject) {
- // map to all relevant informations of the item being copied or moved
- var requestDataMap = {
- 'obj': obj,
- 'data': data,
- 'action': action
- };
- // only update MRU if moving an item (?)
- var newMRUInfo = (this.ancestors && action === 'move') ? {
- id: obj.id,
- ancestors: this.ancestors,
- selfUrl: ContentStoreObject.getSelfLink(obj)
- } : null;
- this._ajaxService.ajax(this._getRequestOptions(requestDataMap))
- .then(function(newMRUInfo) {
- // update the mru entry and resolve
- this._contentServicePromise.then(function(contentSvc){
- contentSvc.updateMRUEntry(newMRUInfo);
- });
- resolve();
- }.bind(this, newMRUInfo))
- .catch(function(newMRUInfo, err) {
- if (this.isNameConflict(err)) {
- if (requestDataMap.action === 'shortcut') {
- // not an error, do a rename, then resolve
- this._renameCopy(requestDataMap, 0, newMRUInfo);
- resolve();
- } else {
- this.createConflictDialogSingle(requestDataMap, newMRUInfo);
- reject(err);
- }
- } else {
- this._handleError(err, requestDataMap, 0);
- reject(err);
- }
- }.bind(this, newMRUInfo));
- }.bind(this)));
- }.bind(this));
- return aPromises;
- };
- ContentManagement.prototype._createURL = function(sBaseURL, oParams) {
- return sBaseURL + '?' + $.param(oParams);
- };
- /**
- * @param requestDataMap : A map to all relevant informations of the item being copied or moved
- *
- * Expects requestDataMap to be {'obj': xxx, 'data':yyy, 'isCopyAction':boolean}
- * Builds the Ajax options for either Copy or Move, depending on isCopyAction
- */
- ContentManagement.prototype._getRequestOptions = function(requestDataMap, bReplaceRequest) {
- if (!requestDataMap) {
- return;
- }
- var requestOptions;
- var oParams;
- if (requestDataMap.action === 'copy') {
- // create id string
- var sourceId = _.map(this._options.inputObjects, function(obj){
- return ContentStoreObject.getObjectId(obj);
- }).join(',');
- oParams = {
- 'recursive': 'true',
- 'source': sourceId
- };
- // multi select
- if (this._options.inputObjects.length > 1) {
- oParams.updateAction = 'fail';
- }
- // replace
- if (bReplaceRequest === true) {
- oParams.updateAction = 'replace';
- } else if (bReplaceRequest === false) {
- oParams.updateAction = 'update';
- }
- // rename data
- var data = requestDataMap.rename ? {
- 'defaultName': requestDataMap.obj.defaultName
- } : {};
- requestOptions = {
- 'contentType': 'application/json',
- 'type': 'POST',
- 'url': this._createURL(requestDataMap.data, oParams),
- 'data': JSON.stringify(data)
- };
- } else if (requestDataMap.action === 'shortcut') {
- requestOptions = {
- 'contentType': 'application/json',
- 'type': 'POST',
- 'url': this._createURL(requestDataMap.data, {}),
- 'data': JSON.stringify({
- 'type': 'shortcut',
- 'target': [{
- 'type': 'baseClass',
- 'searchPath': requestDataMap.obj.searchPath || 'storeID("' + requestDataMap.obj.id + '")'
- }],
- 'defaultName': this._getShortCutName(requestDataMap.obj.defaultName)
- })
- };
- } else {
- // move
- // rename is only needed when there is a name conflict
- if (requestDataMap.rename) {
- requestDataMap.data.defaultName = requestDataMap.obj.defaultName;
- }
- var sURL;
- if (bReplaceRequest == true) {
- sURL = this._createURL(ContentStoreObject.getSelfLink(requestDataMap.obj), {
- 'updateAction': 'replace'
- });
- } else if (bReplaceRequest == false) {
- sURL = this._createURL(ContentStoreObject.getSelfLink(requestDataMap.obj), {
- 'updateAction': 'update'
- });
- } else {
- sURL = ContentStoreObject.getSelfLink(requestDataMap.obj);
- }
- requestOptions = {
- 'dataType': 'json',
- 'contentType': 'application/json',
- 'type': 'PUT',
- 'url': sURL,
- 'data': JSON.stringify(requestDataMap.data)
- };
- }
- return requestOptions;
- };
- ContentManagement.prototype._getShortCutName = function(itemName) {
- return StringResource.get('shortcutToItem', {
- itemName: itemName
- });
- };
- /**
- * Refresh the content view if there is an associated listControl
- */
- ContentManagement.prototype._refreshContent = function() {
- if (this._options.listControl && this._options.listControl.contentView && this._options.listControl.contentView.onCopyMove) {
- return this._options.listControl.contentView.onCopyMove();
- }
- if (this._options.listControl && this._options.listControl.contentView && this._options.listControl.contentView.refresh) {
- return this._options.listControl.contentView.refresh();
- }
- };
- /**
- * Returns a promise resolved with the destination
- */
- ContentManagement.prototype._getDestinationInfo = function() {
- var destinationUrl = this._options.destinationUrl;
- return this._ajaxService.ajax({
- 'dataType': 'json',
- 'contentType': 'application/json',
- 'type': 'GET',
- 'data': {
- 'fields': 'id,defaultName,ancestors'
- },
- 'url': destinationUrl
- })
- .then(function(response) {
- var data = response.data && response.data.data[0];
- this.ancestors = ContentStoreObject.getAncestors(data);
- // if the destination is not a root folder, build an entry for the destination from its ancestors
- if (this.ancestors &&
- destinationUrl !== ContentServiceUrls.getMyFoldersURL() &&
- destinationUrl !== ContentServiceUrls.getPublicFoldersURL()) {
- this.ancestors.push(ContentStoreObject.buildAncestorEntry(data));
- }
- return Promise.resolve(data);
- }.bind(this));
- };
- /*
- Handles a name colission by attempting to rename the object. Otherwise, opens an error dialog.
- */
- ContentManagement.prototype._handleError = function(error, requestDataMap, count) {
- if (error.code === 400) {
- // ew?
- var parent = requestDataMap.obj && requestDataMap.obj.ancestors && requestDataMap.obj.ancestors[requestDataMap.obj.ancestors.length - 1];
- var isCopiedInsideParent = ((requestDataMap.action === 'copy') && parent && requestDataMap.data.indexOf(parent.id) !== -1);
- // if copying to same folder or handling a name conflict with count less than 20, rename auto-magically
- if (((isCopiedInsideParent && !requestDataMap.isCopiedInsideParent) || this.isNameConflict(error)) && (count < 20)) {
- requestDataMap.isCopiedInsideParent = isCopiedInsideParent; // only check once
- count += 1;
- return this._renameCopy(requestDataMap, count);
- }
- }
- GlassContextHelper.showAjaxServiceError(this._glassContext, error);
- };
- /*
- Moves an array of objects to a destination folder or package
- @param options.glassContext - {object} glass context from view calling this function
- @param options.inputObjects - {array} objects that are being moved (oData format)
- @param options.destinationUrl - {string} REST URL for the destination folder
- @param options.listControl - {object} list control that will have rows removed from it after move
- */
- ContentManagement.prototype.moveObjects = function(options) {
- this._init(options);
- return this._getDestinationInfo()
- .then(function(destinationInfo) {
- var requestData = {
- 'parent': [{
- 'id': ContentStoreObject.getObjectId(destinationInfo)
- }]
- };
- return this._allSettled(this._getActionPromises('move', requestData))
- .then(this._onAllSettled.bind(this, 'move'));
- }.bind(this));
- };
- /**
- * Copies an array of objects to a destination folder or package
- * @param options.glassContext - {object} glass context from view calling this function
- * @param options.inputObjects - {array} objects that are being copied (oData format)
- * @param options.destinationItemsUrl - {string} REST URL for the destination folder
- */
- ContentManagement.prototype.shortcutObjects = function(options) {
- this._init(options);
- return this._allSettled(this._getActionPromises('shortcut', options.destinationItemsUrl))
- .then(this._onAllSettled.bind(this, 'shortcut'));
- };
- /**
- * Copies multple objects using one bulk copy api so that report linked items are also copied
- *
- * @param bReplaceRequest - {boolean} true to set the request to replace conflicting objects
- */
- ContentManagement.prototype.copyMultipleObjects = function(bReplaceRequest) {
- var requestDataMap = {
- 'action': 'copy',
- 'data': this._options.destinationItemsUrl
- };
- return this._ajaxService.ajax(this._getRequestOptions(requestDataMap, bReplaceRequest))
- .then(function() {
- GlassContextHelper.displayToast(this._glassContext, StringResource.get('toastDoneCopying', {
- 'noOfItems': this._options.inputObjects.length
- }));
- this._refreshContent();
- }.bind(this))
- .catch(function(err) {
- if (err && err.jqXHR && this.isNameConflict(err)) {
- // bulk copy name conflicts don't give the user the option of renaming, just overwrite and cancel
- var dialog = this.createConflictDialogMulti(requestDataMap);
- dialog.open();
- } else {
- //TODO: improve error message?
- GlassContextHelper.showAjaxServiceError(this._glassContext, err);
- }
- }.bind(this));
- };
- /*
- copies an array of objects to a destination folder or package
- @param options.glassContext - {object} glass context from view calling this function
- @param options.inputObjects - {array} objects that are being copied (oData format)
- @param options.destinationItemsUrl - {string} REST URL for the destination folder
- */
- ContentManagement.prototype.copyObjects = function(options) {
- this._init(options);
- return this._options.inputObjects.length > 1 ?
- this.copyMultipleObjects() : // special bulk action for copying multiple objects
- this._allSettled(this._getActionPromises('copy', options.destinationItemsUrl))
- .then(this._onAllSettled.bind(this, 'copy'));
- };
- /*
- Called when the initial copy/move/shortcut action fails due to a name collision, when copying a single asset.
- Creates the dialog that will allow the user to handle the error.
- @param this._destinationChildrenPromise : A keeper variable used by the 'replace' function. Avoids repetitive ajax calls
- to access the same destination info
- */
- ContentManagement.prototype.createConflictDialogSingle = function(requestDataMap, newMRUInfo) {
- this._destinationChildrenPromise = null; //?
- var oDialog = new NameCollisionDialog('nameCollision', StringResource.get('nameCollision', {
- 'nameOfItem': requestDataMap.obj.defaultName
- }), StringResource.get('nameCollisionMessage'));
- // option 1, replace existing item
- var replace = function() {
- return this._replaceExisting(requestDataMap, newMRUInfo);
- }.bind(this);
- // option 2, copy - renaming the new item
- var keepBoth = function() {
- return this._renameCopy(requestDataMap, 0, newMRUInfo);
- }.bind(this);
- // option 3, cancel
- var cancel = function() {
- return Promise.resolve();
- };
- oDialog.create(replace, keepBoth, cancel, requestDataMap.action, requestDataMap.obj.defaultName);
- return oDialog;
- };
- /*
- Called when the initial copy/move/shortcut action fails due to a name collision, when copying multiple assets.
- Creates the dialog that will allow the user to handle the error.
- @param requestDataMap - {object} information on the copy request
- */
- ContentManagement.prototype.createConflictDialogMulti = function(requestDataMap) {
- this._destinationChildrenPromise = null;
- var oDialog = new NameCollisionDialog('nameCollisionGeneric', StringResource.get('nameCollisionGeneric'), StringResource.get('nameCollisionMessage'));
- var replace = function() {
- // check if an update or replace action is required when overwriting
- return this._glassContext.services.config.getConfigValue('ContentApps/updateTargetObjectWhenOverwrite').then(function(isUpdate) {
- var bReplaceRequest = true;
- if ((isUpdate === 'true')) {
- bReplaceRequest = false;
- }
- return this.copyMultipleObjects(bReplaceRequest);
- }.bind(this));
- }.bind(this);
- var keepBoth = null;
- var skip = function() {
- /*Closes the dialog without doing anything*/
- return Promise.resolve();
- };
- oDialog.create(replace, keepBoth, skip, requestDataMap.action, '');
- return oDialog;
- };
- /*
- Called by the keepBoth() function of the NameCollisionDialog
- @param requestDataMap : A map to all relevant informations of the item being copied or moved
- @param count : The number to append to the name of the renamed item.
- Bounces back and forth with the _handleError() function until a name can be appended with a proper count value
- */
- ContentManagement.prototype._renameCopy = function(requestDataMap, count, newMRUInfo) {
- if (!count) {
- var extractedNameAndCount = this._extractNameAndCount(requestDataMap);
- requestDataMap.obj.defaultName = extractedNameAndCount.name;
- count = extractedNameAndCount.count + 1;
- }
- var originalName = requestDataMap.obj.defaultName;
- if (count > 0) {
- requestDataMap.obj.defaultName += ' (' + count + ')';
- requestDataMap.rename = true;
- if (newMRUInfo) {
- newMRUInfo.defaultName = requestDataMap.obj.defaultName;
- }
- }
- var requestOptions = this._getRequestOptions(requestDataMap);
- var newName = requestDataMap.obj.defaultName;
- requestDataMap.obj.defaultName = originalName;
- return this._ajaxService.ajax(requestOptions)
- .then(function() {
- this._contentServicePromise.then(function(contentSvc){
- contentSvc.updateMRUEntry(newMRUInfo);
- });
- if (requestDataMap.action === 'copy') {
- GlassContextHelper.displayToast(this._glassContext, StringResource.get('toastDoneCopyingSingular', {
- 'nameOfItem': BidiUtil.enforceTextDirection(requestDataMap.obj.defaultName)
- }));
- // renaming a short cut happens automagically when there's a name conflict so do not display rename message
- } else if (requestDataMap.action !== 'shortcut') {
- GlassContextHelper.displayToast(this._glassContext, StringResource.get('RenameFileSuccessfully', {
- 'originalNameOfObject': BidiUtil.enforceTextDirection(requestDataMap.obj.defaultName),
- 'newNameOfObject': BidiUtil.enforceTextDirection(newName)
- }));
- }
- this._refreshContent();
- }.bind(this))
- .catch(function(err){
- this._handleError(err, requestDataMap, count);
- }.bind(this));
- };
- /*
- If given a name such as "New Folder (14)", this function will extract the name from the count and
- return the two under the form {'name': "New Folder", 'count': 14}
- @regex '\\s\\([1-9]\d*\\)' : This will find a non-zero number of any length that is surronded on the left by a space
- and open bracket ' (' and on the right a closing bracket ')'.
- */
- ContentManagement.prototype._extractNameAndCount = function(requestDataMap) {
- var originalName = requestDataMap.obj.defaultName;
- var extractedStr = originalName.match('\\s\\([1-9]\\d*\\)');
- var returnValue = {
- 'name': originalName,
- 'count': 0
- };
- if (extractedStr !== null) {
- extractedStr = extractedStr[extractedStr.length - 1];
- var theCount = parseInt(extractedStr.substring(2, extractedStr.length - 1), 10);
- if (typeof theCount === 'number') {
- returnValue.name = originalName.replace(extractedStr, '');
- returnValue.count = theCount;
- }
- }
- return returnValue;
- };
- /*
- Called by the replace() function of the NameCollisionDialog
- First deletes an existing element with the current item's name, then adds the current item to the destination
- */
- ContentManagement.prototype._replaceExisting = function(requestDataMap, newMRUInfo) {
- // delete existing item with the same name in the MRU
- return this._getDestinationChildrenInfo(requestDataMap.action)
- .then(function(destinationChildren) {
- destinationChildren.data.forEach(function(child) {
- if (child.defaultName === requestDataMap.obj.defaultName) {
- return this._glassContext.getCoreSvc('.Config').getConfigValue('ContentApps/updateTargetObjectWhenOverwrite').then(function(isUpdate){
- this._contentServicePromise.then(function(contentSvc){
- contentSvc.removeFromMRU(child);
- });
- // replace by default
- var bReplaceRequest = true;
- if ((isUpdate === 'true') && (child.type === requestDataMap.obj.type)) {
- bReplaceRequest = false;
- }
- // replace the source item in the destination folder
- return this._ajaxService.ajax(this._getRequestOptions(requestDataMap, bReplaceRequest))
- .then(function() {
- // add new item to the MRU
- this._contentServicePromise.then(function(contentSvc){
- contentSvc.updateMRUEntry(newMRUInfo);
- });
- // display toast
- GlassContextHelper.displayToast(this._glassContext, StringResource.get('OverwriteFileSuccessfully', {
- 'nameOfObject': BidiUtil.enforceTextDirection(requestDataMap.obj.defaultName)
- }));
- this._refreshContent();
- }.bind(this))
- .catch(function(err) {
- this._handleError(err, requestDataMap, 0);
- }.bind(this));
- }.bind(this));
- }
- }.bind(this));
- }.bind(this));
- };
- /*
- Finds and returns a promise containing the array of items at the destination.
- Saves the result in this._destinationChildrenPromise to avoid duplicate ajax calls in the case
- where multiple collisions at once create multiple dialogs.
- */
- ContentManagement.prototype._getDestinationChildrenInfo = function(action) {
- if (!this._destinationChildrenPromise) {
- var url;
- if (action === 'copy' || action === 'shortcut') {
- url = this._options.destinationItemsUrl + '?fields=ancestors,defaultName';
- } else {
- url = this._options.destinationUrl + '/items';
- }
- this._destinationChildrenPromise = this._ajaxService.ajax({
- 'dataType': 'json',
- 'contentType': 'application/json',
- 'type': 'GET',
- 'url': url,
- 'cache': false
- })
- .then(function(response){
- return response && response.data;
- });
- }
- return this._destinationChildrenPromise;
- };
- var _static = {
- getInstance: function() {
- if (!_singletonInstance) {
- _singletonInstance = new ContentManagement();
- }
- return _singletonInstance;
- }
- };
- return _static.getInstance();
- });
- /*
- *+------------------------------------------------------------------------+
- *| Licensed Materials - Property of IBM
- *| IBM Cognos Products: Content Explorer
- *| (C) Copyright IBM Corp. 2018
- *|
- *| US Government Users Restricted Rights - Use, duplication or disclosure
- *| restricted by GSA ADP Schedule Contract with IBM Corp.
- *+------------------------------------------------------------------------+
- */
- define('bacontentnav/utils/ActionHelper',[
- 'jquery',
- './ContentManagement'
- ], function($, ContentManagement) {
- 'use strict';
- return {
- /**
- * Handles an error received when creating a Content Nav asset (due to name conflict, etc.)
- * @param {object} listControl host list control
- * @param {object} assetInfo asset information for creation
- * @param {object} err error recieved from creation failure
- * @param {object} messages i18n error messages to display, if appl.
- * @return {promise} resolved with asset info if successful, otherwise reject with error
- */
- handleAddItemError: function(listControl, assetInfo, err, messages) {
- // check for client side error
- if (err.code === 400) {
- // if name duplication, try to increment (up to 20)
- if (ContentManagement.isNameConflict(err)) {
- var newNameString = this._getNewNameString(listControl, assetInfo);
- if (this.count < 20) {
- assetInfo.defaultName = newNameString;
- return Promise.resolve(assetInfo);
- } else {
- err = this._applyErrorMessage(err, messages['itemsOverLimit']);
- return Promise.reject(err);
- }
- } else {
- return Promise.reject(err);
- }
- } else {
- // If the URL name is > then 255 characters
- if (err.code === 500 && assetInfo.defaultName.length > 255) {
- err = this._applyErrorMessage(err, messages['nameLengthError']);
- }
- return Promise.reject(err);
- }
- },
- /**
- * Generates a non-conflicting file name (e.g. if there's a: 'New Report (3)', it will generate 'New Report (4)')
- * @param {object} listControl host list control
- * @param {object} assetInfo asset information for creation
- * @return {string} new name
- */
- _getNewNameString: function(listControl, assetInfo) {
- var nameList = [];
- var aData = listControl._dTable.fnGetData();
- aData.forEach(function(rowData) { // Get a small list of names that has the substring assetInfo.defaultName
- var name = rowData.defaultName.toLowerCase();
- if (name.indexOf(assetInfo.defaultName.toLowerCase()) === 0) {
- nameList.push(name);
- }
- });
- var newNameString;
- for (var i = 1; i <= nameList.length; i++) {
- newNameString = assetInfo.defaultName + ' (' + i + ')';
- if ($.inArray(newNameString.toLowerCase(), nameList) === -1) {
- break;
- }
- }
- this.count = i;
- return newNameString;
- },
- /**
- * Set's-up the error's responseJSON with the message to show to the user
- * @param {object} err error recieved from creation failure
- * @param {object} messages i18n error messages to display, if appl.
- * @return {object} modified error object
- */
- _applyErrorMessage: function(err, message) {
- // Remove unnecessary message generated from the error
- var responseJSON = err.jqXHR && err.jqXHR.responseJSON || {};
- responseJSON.messages.splice(1, 1);
- responseJSON.messages[0] = message;
- return err;
- }
- };
- });
- /*
- *+------------------------------------------------------------------------+
- *| Licensed Materials - Property of IBM
- *| IBM Cognos Products: ba-content-nav
- *| (C) Copyright IBM Corp. 2015, 2018
- *|
- *| US Government Users Restricted Rights - Use, duplication or disclosure
- *| restricted by GSA ADP Schedule Contract with IBM Corp.
- *+------------------------------------------------------------------------+
- */
- define('bacontentnav/common/ui/list_actions/AddFolderAction',[
- 'jquery',
- './AddInlineAction',
- '../../../utils/ActionHelper',
- '../../../nls/StringResource',
- '../../../utils/ContentManagement',
- '../../../utils/GlassContextHelper',
- '../../../lib/@waca/core-client/js/core-client/utils/BidiUtil'
- ], function($, AddInlineAction, ActionHelper, StringResource, ContentManagement, GlassContextHelper, BidiUtil) {
- 'use strict';
- var AddFolderAction = AddInlineAction.extend({
- getDefaultName: function() {
- return StringResource.get('newFolderDefaultName');
- },
- getType: function() {
- return 'folder';
- },
- getClass: function() {
- return 'newFolderRow';
- },
- _addFolder: function(data, listControl) {
- var displayName = data.defaultName;
- var requestOptions = {
- 'headers': {
- 'Accept': 'application/json',
- 'Content-Type': 'application/json'
- },
- 'type': 'POST',
- 'url': listControl.url,
- 'data': JSON.stringify(data)
- };
- listControl.addFolderNameForFocus = displayName;
- return listControl.glassContext.getCoreSvc('.Ajax').ajax(requestOptions)
- .then(function() {
- GlassContextHelper.displayToast(listControl.glassContext, StringResource.get('toastCreateNewFolder', {
- 'nameOfFolder': BidiUtil.enforceTextDirection(displayName)
- }));
- })
- .catch(function(err) {
- var messages = {
- 'itemsOverLimit': StringResource.get('itemsOverLimit', {
- itemName: data.defaultName
- }),
- 'nameLengthError': StringResource.get('errorMessageLengthFolderName')
- };
- return ActionHelper.handleAddItemError(listControl, data, err, messages)
- .then(function() {
- // resolved a name conflict so try again
- return this._addFolder(data, listControl);
- }.bind(this))
- .catch(function (err) {
- listControl.updateDatatable();
- GlassContextHelper.showAjaxServiceError(listControl.glassContext, err);
- return Promise.reject(err);
- });
- }.bind(this));
- },
- sendAddRequest: function(data, listControl) {
- // check if the defaultName contains both ' and " which is not allowed by CM
- if ((data.defaultName.indexOf('\'') > -1) && (data.defaultName.indexOf('"') > -1)){
- listControl.cancelActions();
- return GlassContextHelper.displayToast(listControl.glassContext, StringResource.get('errorMessageApostropheError'), {
- 'type': 'error'
- });
- }
- return this._addFolder(data, listControl)
- .then(function() {
- listControl.updateDatatable();
- });
- }
- });
- return AddFolderAction;
- });
- /**
- * Licensed Materials - Property of IBM
- * IBM Cognos Products: ba-content-nav
- * (C) Copyright IBM Corp. 2018
- * US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
- */
- define('bacontentnav/utils/MRUHelper',[
- '../lib/@waca/core-client/js/core-client/ui/dialogs/ConfirmationDialog',
- '../nls/StringResource',
- './ContentServiceUrls'
- ], function(ConfirmationDialog, StringResource, ContentServiceUrls) {
- var MRUHelper = {
- /**
- * Returns true if the given view requires asset verification for MRU purposes
- * @param {object} view
- */
- requiresAssetVerification: function(view) {
- return view && view.requiresAssetVerification === true;
- },
- /**
- * Shows the no access dialog offering to remove the given asset from the user's recent list
- * @param {object} glassContext
- * @param {string} oDataId - the id of the asset
- */
- showNoAccessDialog: function(glassContext, oDataId) {
- if (glassContext && oDataId) {
- var oDialog = new ConfirmationDialog('noAccessRecent', StringResource.get('noAccessRecent'), StringResource.get('noAccessRecentMsg'));
- oDialog.confirm(function() {
- glassContext.getSvc('.Content')
- .then(function(contentSvc) {
- contentSvc.removeFromMRU({ id: oDataId });
- })
- .catch(function(err) {
- // log the error, don't cascade as there's nothing a user can do
- glassContext.getCoreSvc('.Logger').error(err);
- });
- });
- return oDialog;
- }
- },
- /**
- * Returns a promise with true or false depending on whether the user can access the given object id, showing the no access dialog if not.
- * Verifies whether the user can access this item (it does not check if the user has permissions to execute any action)
- * @param {object} glassContext
- * @param {string} oDataId - the id of the object to be verified
- */
- verifyAccess: function(glassContext, oDataId) {
- if (glassContext && oDataId) {
- var options = {
- url: ContentServiceUrls.getBaseObjectsURL() + '/' + oDataId,
- dataType: 'json',
- data: { 'fields': 'permissions' }
- };
- return glassContext.getCoreSvc('.Ajax').ajax(options)
- .then(function(response) {
- var freshData = response.data.data[0];
- if (!freshData || freshData.permissions.length === 0) {
- this.showNoAccessDialog(glassContext, oDataId);
- return false;
- } else {
- return true;
- }
- }.bind(this))
- .catch(function(err) {
- // show no access if an error has occurred
- glassContext.getCoreSvc('.Logger').error(err);
- this.showNoAccessDialog(glassContext, oDataId);
- return false;
- }.bind(this));
- } else {
- // in the unlikely event this happens, let's just tell the caller we couldn't verify access
- return Promise.resolve(false);
- }
- }
- };
- return MRUHelper;
- });
- /*
- *+------------------------------------------------------------------------+
- *| Licensed Materials - Property of IBM
- *| IBM Cognos Products: Content Explorer
- *| (C) Copyright IBM Corp. 2015, 2018
- *|
- *| US Government Users Restricted Rights - Use, duplication or disclosure
- *| restricted by GSA ADP Schedule Contract with IBM Corp.
- *+------------------------------------------------------------------------+
- */
- define('bacontentnav/common/ui/list_actions/DefaultAction',[
- '../../../lib/@waca/core-client/js/core-client/ui/core/Class',
- '../../../utils/ContentServiceUrls',
- '../../../utils/ContentStoreObject',
- '../../../utils/GlassContextHelper',
- '../../../utils/MRUHelper',
- '../../../utils/UIHelper',
- '../../../nls/StringResource',
- 'underscore'
- ], function(Class, ContentServiceUrls, ContentStoreObject, GlassContextHelper, MRUHelper, UIHelper, StringResource, _) {
- 'use strict'; //NOSONAR
- var DefaultAction = Class.extend({
- /**
- options.glassContext
- options.oData {object} - (optional) This is the content service response for the object
- options.storeId {string} - (optional) If no oData is provided, we will use the storeId to query for the object information
- options.listControl
- **/
- init: function(options) {
- DefaultAction.inherited('init', this, arguments);
- _.extend(this, options);
- },
- canExecute: function() {
- // if it's an MRU view - let's check later in case the state has changed
- var view = this.listControl && this.listControl.contentView || this.contentView;
- if (MRUHelper.requiresAssetVerification(view)) {
- return Promise.resolve(true);
- }
- return this._canExecute();
- },
- execute: function() {
- var view = this.listControl && this.listControl.contentView || this.contentView;
- return this._getData(view).then(function(oData) {
- this.oData = oData;
- if (MRUHelper.requiresAssetVerification(view)) {
- this._canExecute()
- .then(function(canExecute) {
- if (canExecute) {
- return this._executeAction();
- } else {
- // Show the no access dialog
- MRUHelper.showNoAccessDialog(this.glassContext, this.oData && this.oData.id || this.storeId);
- // If we were able to find the asset, let's make sure it's up to date in the mru
- if (this.oData) {
- return this.glassContext.getSvc('.Content').then(function(contentSvc){
- contentSvc.addToMRU(this.oData);
- }.bind(this));
- } else {
- return Promise.resolve();
- }
- }
- }.bind(this));
- } else if (!this.oData) {
- return Promise.reject(new Error('No data for default action'));
- } else {
- return this._executeAction();
- }
- }.bind(this));
- },
- _updateMRU: function() {
- return this.glassContext.getSvc('.Content').then(function(contentSvc){
- ContentStoreObject.setGlassContext(this.glassContext);
- contentSvc.addToMRU(this.oData);
- }.bind(this));
- },
- _canExecute: function() {
- if (!this.oData) {
- return Promise.resolve(false);
- }
- return Promise.resolve(this.glassContext.appController.canExecuteAction(this._getActionId(), this._buildPayload()));
- },
- _executeAction: function() {
- return ContentStoreObject.getPermissions(this.oData, true)
- .then(function(permissions) {
- this.oData[ContentStoreObject.PERMISSIONS] = permissions;
- var payload = this._buildPayload();
- var actionId = this._getActionId();
- return this.glassContext.appController.performAction(actionId, payload)
- .then(function() {
- // If an AppView exists, wait for the AppView to render before updating the MRU, else just update MRU
- if(this.glassContext.appController.currentAppView) {
- this.glassContext.appController.currentAppView.onViewRendered().then(function() {
- // We've successfully done a defaultAction, add the object to the MRU list
- this._updateMRU();
- }.bind(this));
- } else {
- this._updateMRU();
- }
- }.bind(this))
- .catch(function(err) {
- this.glassContext.getCoreSvc('.Logger').error(err);
- this._showToastOnLaunchError(this.oData);
- return Promise.reject(err);
- }.bind(this));
- }.bind(this));
- },
- _getActionId: function() {
- var objType = ContentStoreObject.getType(this.oData);
- if (objType === null) {
- return null;
- }
- return 'com.ibm.bi.contentApps.defaultAction.' + objType;
- },
- _getData: function(view) {
- this.storeId = this.storeId || this.oData && this.oData.id;
- if (this.oData && !MRUHelper.requiresAssetVerification(view)) {
- return Promise.resolve(this.oData);
- } else if (this.storeId) {
- var options = {
- url: ContentServiceUrls.getBaseObjectsURL() + '/' + this.storeId,
- dataType: 'json',
- data: view && view.getURLParameters && view.getURLParameters()
- };
- return this.glassContext.getCoreSvc('.Ajax').ajax(options)
- .then(function(response) {
- return Promise.resolve(response.data && response.data.data[0]);
- })
- .catch(function(err) {
- if (MRUHelper.requiresAssetVerification(view)) {
- return Promise.resolve();
- } else {
- GlassContextHelper.showAjaxServiceError(this.glassContext, err);
- return Promise.reject(err);
- }
- }.bind(this));
- } else {
- return Promise.reject(new Error('No data or storeId to do the action with.'));
- }
- },
- _buildPayload: function() {
- return {
- 'glassContext': this.glassContext,
- 'target': {
- 'activeObject': {
- 'oListControl': this.listControl,
- 'aSelectedContext': [this.oData]
- },
- 'itemId': this._getActionId()
- }
- };
- },
- _showToastOnLaunchError: function(data) {
- GlassContextHelper.displayToast(this.glassContext, StringResource.get('toastLaunchPerspectiveError', {
- objectType: UIHelper.getTypeNameFromObject(data)
- }), {
- type: 'error'
- });
- }
- });
- return DefaultAction;
- });
- /*
- *+------------------------------------------------------------------------+
- *| Licensed Materials - Property of IBM
- *| IBM Cognos Products: Content Explorer
- *| (C) Copyright IBM Corp. 2017
- *|
- *| US Government Users Restricted Rights - Use, duplication or disclosure
- *| restricted by GSA ADP Schedule Contract with IBM Corp.
- *+------------------------------------------------------------------------+
- */
- define('bacontentnav/common/ui/list_actions/DefaultActionHandler',[
- 'underscore',
- '../list_actions/DefaultAction',
- '../../../utils/ContentStoreObject',
- '../../../utils/UIHelper'
- ], function(_, DefaultAction, ContentStoreObject, UIHelper) {
- 'use strict';
- return {
- /**
- * Executes the given action on an item in the given list control
- * @param {object} options
- * @param {object} options.evt - the triggering event
- * @param {object} options.oData - the asset data
- * @param {object} options.listControl - the list control that contents the row
- * @param {object} options.glassContext - the glass context
- * @param {object} options.action - the action to execute
- *
- * @return Promise
- */
- executeAction: function(options) {
- // parse the options
- var oData = options.oData;
- var listControl = options.listControl;
- var glassContext = options.glassContext;
- // only perform an action if no item is in creation mode (i.e. NewFolder) and we're not doing multiselect
- if (listControl.isMultitouchActive() || listControl.isInStandbyMode()) {
- return Promise.resolve(true); // shortcut the rest
- }
- // set so _selectRow can hide properties page
- listControl.contentView.propertiesOverride = true;
- // hide slideout on launch if not navigating
- if (!UIHelper.isContainer(ContentStoreObject.getType(oData))) {
- glassContext.appController.hideSlideOut();
- }
- // do the action TODO: does this always return a promise?
- options.action.execute();
- return Promise.resolve(true);
- },
- /**
- * Executes the default action on an item in the list control after checking permissions
- * @param {object} options
- * @param {object} options.$div - the content nav row being selected
- * @param {object} options.oData - the asset data
- * @param {object} options.listControl - the list control that contents the row
- * @param {object} options.glassContext - the glass context
- *
- * @return Promise
- */
- executeDefaultAction: function(options) {
- return new Promise(function(resolve/*, reject*/) {
- // parse the options
- var oData = options.oData;
- var listControl = options.listControl;
- var glassContext = options.glassContext;
- // create the action and set on options to pass along
- var defaultAction = new DefaultAction({
- 'glassContext': glassContext,
- 'oData': oData,
- 'listControl': listControl
- });
- options.action = defaultAction;
- // search results don't return any permissions, so always show the item as a link TODO: can we improve this?
- var permissionPromise = oData[ContentStoreObject.PERMISSIONS] ? defaultAction.canExecute() : Promise.resolve(true);
- // check permissions
- permissionPromise
- .then(function(options, bCanExecute) {
- if (bCanExecute) {
- this.executeAction(options);
- }
- resolve();
- }.bind(this, options))
- .catch(function() {
- //TODO: should we log something if the action was not executed?
- resolve();
- });
- }.bind(this));
- }
- };
- });
- define('text!bacontentnav/common/templates/ListControlTemplate.html',[],function () { return '<div id="listContainer{{=it.id}}" class="ca-listContainer">\n\t<table summary="{{=it.accessibleLabel}}" aria-label="{{=it.accessibleLabel}}" id="{{=it.id}}" class="listControl">\n\t\t<thead>\n\t\t\t<tr role="row" tabindex="-1">\n\t\t\t\t{{~it.columns :column}}\n\t\t\t\t\t<th role="columnheader" class="cth_{{=(column.name + \'_\' + it.id)}}" scope="col">\n\t\t\t\t\t\t<div class="columnText{{?column.headerClass}} {{=column.headerClass}}{{?}}">\n\t\t\t\t\t\t\t<div class="{{? it.sort }} sortable {{=(\'cdiv_\' + column.name + \'_\' + it.id)}}{{?}} {{? column.hiddenLabel }} hidden{{?}}">{{? column.label }}{{=column.label}}{{?? column.hiddenLabel }}{{=column.hiddenLabel}}{{??}} {{?}}\n\t\t\t\t\t\t\t<div class="sort_underline"></div>\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t\t<div class="columnSpacer"></div>\n\t\t\t\t\t</th>\n\t\t\t\t{{~}}\n\t\t\t</tr>\n\t\t</thead>\n\t\t<tbody>\n\t\t</tbody>\n\t</table>\n</div>\n';});
- define('text!bacontentnav/common/templates/EmptyListTemplate.html',[],function () { return '<div class="emptyTableContent{{?it.shortTable == true}} shortTable{{?}}">\n\t{{?it.emptyIcon}}\n\t<div class="emptyTableImage {{?it.iconStyle}} {{=it.iconStyle}}{{?}}">\n\t\t<svg class="svgIcon {{?it.isSpinner}}loadingSpinner--animation{{?}}" role="img" focusable="false"><use style="pointer-events:none;" xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href={{=it.emptyIcon}}></use></svg>\n\t</div>\n\t{{?}}\n\t<div class="emptyTableTextBlock">\n\t\t<div class="emptyTableText" aria-label="{{=it.text}}" tabindex="0">{{=it.text}}</div>\n\t\t{{?it.textParagraph}}\n\t\t\t<div class="emptyTableTextParagraph" aria-label="{{=it.textParagraph}}" tabindex="0">{{=it.textParagraph}}</div>\n\t\t{{?}}\n\t</div>\n</div>\n';});
- !function(a,s){if("object"==typeof exports&&"object"==typeof module)module.exports=s(require("@ba-ui-toolkit/ba-graphics/dist/illustrations-js/ba-graphics-icons-commons.js"));else if("function"==typeof define&&define.amd)define('bacontentnav/lib/@ba-ui-toolkit/ba-graphics/dist/illustrations-js/empty-folder_128',["@ba-ui-toolkit/ba-graphics/dist/illustrations-js/ba-graphics-icons-commons.js"],s);else{var c=s("object"==typeof exports?require("@ba-ui-toolkit/ba-graphics/dist/illustrations-js/ba-graphics-icons-commons.js"):a["@ba-ui-toolkit/ba-graphics/dist/illustrations-js/ba-graphics-icons-commons.js"]);for(var i in c)("object"==typeof exports?exports:a)[i]=c[i]}}("undefined"!=typeof self?self:this,function(a){return webpackJsonPBaGraphics([105],{"099720445ff350ff6c39":function(a,s,c){"use strict";var i=c("9689a9c94ae38b47fa2c"),r=c.n(i),e=c("9ce58a7deea14f49ef01"),t=c.n(e),h=new r.a({id:"empty-folder_128_v7",use:"empty-folder_128_v7-usage",viewBox:"0 0 200 200",content:'<symbol xmlns="http://www.w3.org/2000/svg" viewBox="0 0 200 200" id="empty-folder_128_v7"><circle class="ba-graphics-neutral-white4" cx="100" cy="100" r="100" /><path class="ba-graphics-white" d="M2.07 170.06h4.76" /><path class="ba-graphics-gray60" d="M6.83 172.06H2.07a2 2 0 110-4h4.76a2 2 0 110 4z" /><path class="ba-graphics-white" d="M14.92 170.06h183.06" /><path class="ba-graphics-gray60" d="M198 172.06H14.92a2 2 0 110-4H198a2 2 0 010 4z" /><circle class="ba-graphics-gray60" cx="104.14" cy="22.46" r="2" /><circle class="ba-graphics-gray60" cx="133.32" cy="37.1" r="2" /><path class="ba-graphics-gray60" d="M62.85 36.1a4 4 0 004-4 1 1 0 112 0 4 4 0 004 4 1 1 0 010 2 4 4 0 00-4 4 1 1 0 01-2 0 4 4 0 00-4-4 1 1 0 010-2z" /><rect class="ba-graphics-gray40" x="28.16" y="68.05" width="144" height="104" rx="2" /><path class="ba-graphics-gray60" d="M168.16 72.05v96h-136v-96h136m2-4h-140a2 2 0 00-2 2v100a2 2 0 002 2h140a2 2 0 002-2v-100a2 2 0 00-2-2z" /><g style="opacity:.1"><path class="ba-graphics-gray80" d="M170.16 168h-140a2 2 0 01-2-2V79a2 2 0 012-2h18.23a4 4 0 013 1.31l7.61 8.4a4.17 4.17 0 003 1.35h108.16a2 2 0 012 2v76a2 2 0 01-2 1.94z" /><path class="ba-graphics-gray80" d="M48.39 81L56 89.4a8.21 8.21 0 005.8 2.66h106.36v72h-136V81h16.23m0-4H30.16a2 2 0 00-2 2v87a2 2 0 002 2h140a2 2 0 002-2V90a2 2 0 00-1.94-2H61.93a4.17 4.17 0 01-3-1.35l-7.62-8.38a4 4 0 00-3-1.31z" /></g><path class="ba-graphics-white" d="M170.16 172.05h-140a2 2 0 01-2-2v-87a2 2 0 012-2h18.23a4 4 0 013 1.31L59 90.75a4 4 0 003 1.3h108.16a2 2 0 012 2v76a2 2 0 01-2 2z" /><path class="ba-graphics-gray60" d="M48.39 85.05L56 93.44a8 8 0 005.92 2.61h106.24v72h-136v-83h16.23m0-4H30.16a2 2 0 00-2 2v87a2 2 0 002 2h140a2 2 0 002-2v-76a2 2 0 00-2-2H61.93a4 4 0 01-3-1.3l-7.62-8.39a4 4 0 00-3-1.31z" /><path class="ba-graphics-white" d="M88.66 148.74h19.08" /><path class="ba-graphics-gray60" d="M107.74 150.74H88.65a2 2 0 010-4h19.09a2 2 0 110 4z" /><circle class="ba-graphics-gray60" cx="75.32" cy="137.69" r="3.47" /><circle class="ba-graphics-gray60" cx="121" cy="137.69" r="3.47" /></symbol>'});t.a.add(h);s.a=h},"3865314c5959606874d4":function(s,c){s.exports=a},"9616210854fe62536956":function(a,s,c){"use strict";Object.defineProperty(s,"__esModule",{value:!0});var i=c("3865314c5959606874d4"),r=(c.n(i),c("099720445ff350ff6c39"));s.default=r.a}},["9616210854fe62536956"])});
- !function(a,s){if("object"==typeof exports&&"object"==typeof module)module.exports=s(require("@ba-ui-toolkit/ba-graphics/dist/illustrations-js/ba-graphics-icons-commons.js"));else if("function"==typeof define&&define.amd)define('bacontentnav/lib/@ba-ui-toolkit/ba-graphics/dist/illustrations-js/search-results_128',["@ba-ui-toolkit/ba-graphics/dist/illustrations-js/ba-graphics-icons-commons.js"],s);else{var c=s("object"==typeof exports?require("@ba-ui-toolkit/ba-graphics/dist/illustrations-js/ba-graphics-icons-commons.js"):a["@ba-ui-toolkit/ba-graphics/dist/illustrations-js/ba-graphics-icons-commons.js"]);for(var i in c)("object"==typeof exports?exports:a)[i]=c[i]}}("undefined"!=typeof self?self:this,function(a){return webpackJsonPBaGraphics([35],{"3865314c5959606874d4":function(s,c){s.exports=a},b86a89ab812875d2eaf9:function(a,s,c){"use strict";var i=c("9689a9c94ae38b47fa2c"),e=c.n(i),t=c("9ce58a7deea14f49ef01"),r=c.n(t),l=new e.a({id:"search-results_128_v7",use:"search-results_128_v7-usage",viewBox:"0 0 200 200",content:'<symbol xmlns="http://www.w3.org/2000/svg" viewBox="0 0 200 200" id="search-results_128_v7"><circle class="ba-graphics-neutral-white4" cx="100" cy="100" r="100" /><path class="ba-graphics-white" d="M14.97 170.08h135.66" /><path class="ba-graphics-gray60" d="M150.63 172.08H15a2 2 0 110-4h135.63a2 2 0 010 4z" /><path class="ba-graphics-white" d="M2 170.08h4.97" /><path class="ba-graphics-gray60" d="M7 172.08H2a2 2 0 010-4h5a2 2 0 010 4z" /><path class="ba-graphics-white" d="M179.03 170.08H198" /><path class="ba-graphics-gray60" d="M198 172.08h-19a2 2 0 010-4h19a2 2 0 010 4z" /><path class="ba-graphics-white" d="M158.63 170.08h12.4" /><path class="ba-graphics-gray60" d="M171 172.08h-12.4a2 2 0 010-4H171a2 2 0 010 4z" /><circle class="ba-graphics-gray60" cx="55.73" cy="70.9" r="2" /><circle class="ba-graphics-gray60" cx="99.29" cy="34.77" r="2" /><path class="ba-graphics-gray60" d="M54.38 36.33a4 4 0 004-4 1 1 0 012 0 4 4 0 004 4 1 1 0 010 2 4 4 0 00-4 4 1 1 0 01-2 0 4 4 0 00-4-4 1 1 0 010-2zm80.04-12.56a2.65 2.65 0 002.65-2.65.66.66 0 011.32 0 2.65 2.65 0 002.61 2.65.66.66 0 010 1.32 2.65 2.65 0 00-2.65 2.65.66.66 0 01-1.32 0 2.65 2.65 0 00-2.65-2.65.66.66 0 110-1.32z" /><path class="ba-graphics-neutral-white4" d="M82.18 121.06l1 1.08a2.85 2.85 0 01-.23 4l-23.62 21.12a2.86 2.86 0 01-2.06.73 2.89 2.89 0 01-2-1l-5.93-6.64a2.84 2.84 0 01.22-4l23.62-21.14a2.89 2.89 0 012.07-.72 2.82 2.82 0 012 1l1.16 1.3 4.95-4.36a38.26 38.26 0 113.73 4.3z" /><path class="ba-graphics-gray60" d="M57.43 150.2h-.29a5.06 5.06 0 01-3.49-1.69l-5.93-6.63a5.07 5.07 0 01.4-7.14l23.62-21.14a5.05 5.05 0 016.84.09l1.82-1.61a40.65 40.65 0 116.6 7.62l-1.79 1.58a5.07 5.07 0 01-.87 6.51L60.8 148.91a5.12 5.12 0 01-3.37 1.29zm17.68-33.48a.67.67 0 00-.43.16L51.07 138a.64.64 0 00-.22.48.66.66 0 00.16.43l5.99 6.66a.62.62 0 00.44.21.67.67 0 00.47-.16l23.57-21.11a.65.65 0 00.06-.91l-2.42-2.73 8.1-7.18 1.47 1.46a36.11 36.11 0 10-3.52-4.05l1.21 1.63-8.12 7.17-2.62-3a.63.63 0 00-.44-.22z" /><circle class="ba-graphics-white" cx="114.08" cy="89.49" r="27.3" /><path class="ba-graphics-gray60" d="M114.08 118.91a29.42 29.42 0 1129.41-29.42 29.45 29.45 0 01-29.41 29.42zm0-54.61a25.2 25.2 0 1025.2 25.19 25.22 25.22 0 00-25.2-25.19z" /></symbol>'});r.a.add(l);s.a=l},f0f5b3d0dafd8138f35f:function(a,s,c){"use strict";Object.defineProperty(s,"__esModule",{value:!0});var i=c("3865314c5959606874d4"),e=(c.n(i),c("b86a89ab812875d2eaf9"));s.default=e.a}},["f0f5b3d0dafd8138f35f"])});
- !function(a,s){if("object"==typeof exports&&"object"==typeof module)module.exports=s(require("@ba-ui-toolkit/ba-graphics/dist/illustrations-js/ba-graphics-icons-commons.js"));else if("function"==typeof define&&define.amd)define('bacontentnav/lib/@ba-ui-toolkit/ba-graphics/dist/illustrations-js/recent-activity_128',["@ba-ui-toolkit/ba-graphics/dist/illustrations-js/ba-graphics-icons-commons.js"],s);else{var c=s("object"==typeof exports?require("@ba-ui-toolkit/ba-graphics/dist/illustrations-js/ba-graphics-icons-commons.js"):a["@ba-ui-toolkit/ba-graphics/dist/illustrations-js/ba-graphics-icons-commons.js"]);for(var i in c)("object"==typeof exports?exports:a)[i]=c[i]}}("undefined"!=typeof self?self:this,function(a){return webpackJsonPBaGraphics([50],{"06ed3a87abd189187ff5":function(a,s,c){"use strict";Object.defineProperty(s,"__esModule",{value:!0});var i=c("3865314c5959606874d4"),h=(c.n(i),c("2ad33f842a20668c416d"));s.default=h.a},"2ad33f842a20668c416d":function(a,s,c){"use strict";var i=c("9689a9c94ae38b47fa2c"),h=c.n(i),t=c("9ce58a7deea14f49ef01"),r=c.n(t),e=new h.a({id:"recent-activity_128_v7",use:"recent-activity_128_v7-usage",viewBox:"0 0 200 200",content:'<symbol xmlns="http://www.w3.org/2000/svg" viewBox="0 0 200 200" id="recent-activity_128_v7"><circle class="ba-graphics-neutral-white4" cx="100" cy="100" r="100" /><path class="ba-graphics-white" d="M14.97 170.08h135.66" /><path class="ba-graphics-gray60" d="M150.63 172.08H15a2 2 0 110-4h135.63a2 2 0 010 4z" /><path class="ba-graphics-white" d="M2 170.08h4.97" /><path class="ba-graphics-gray60" d="M7 172.08H2a2 2 0 010-4h5a2 2 0 010 4z" /><path class="ba-graphics-white" d="M179.03 170.08H198" /><path class="ba-graphics-gray60" d="M198 172.08h-19a2 2 0 010-4h19a2 2 0 010 4z" /><path class="ba-graphics-white" d="M158.63 170.08h12.4" /><path class="ba-graphics-gray60" d="M171 172.08h-12.4a2 2 0 010-4H171a2 2 0 010 4z" /><circle class="ba-graphics-gray60" cx="137.78" cy="38.33" r="2" /><circle class="ba-graphics-gray60" cx="105.47" cy="18.8" r="2" /><path class="ba-graphics-gray1" d="M67.62 122.77H18.1v-11.93h49.52z" /><path class="ba-graphics-gray60" d="M69.1 124.25H16.62v-14.89H69.1zm-49.53-3h46.58v-9H19.57z" /><path class="ba-graphics-gray60" d="M42 118.34H25.68a1.48 1.48 0 010-3H42a1.48 1.48 0 010 3zm11.77 0h-7.39a1.48 1.48 0 010-3h7.39a1.48 1.48 0 010 3zM66 28.18a4 4 0 004-4 1 1 0 012 0 4 4 0 004 4 1 1 0 010 2 4 4 0 00-4 4 1 1 0 11-2 0 4 4 0 00-4-4 1 1 0 010-2z" /><circle class="ba-graphics-white" cx="100" cy="100" r="51.75" /><path class="ba-graphics-gray60" d="M100 153.75A53.75 53.75 0 11153.75 100 53.81 53.81 0 01100 153.75zm0-103.5A49.75 49.75 0 10149.75 100 49.81 49.81 0 00100 50.25z" /><path class="ba-graphics-gray60" d="M132.26 134.26a2 2 0 01-1.41-.58l-4.75-4.75a2 2 0 012.83-2.83l4.75 4.75a2 2 0 01-1.42 3.41zM72.49 74.49a2 2 0 01-1.42-.59l-4.75-4.75a2 2 0 012.83-2.83l4.75 4.75a2 2 0 01-1.41 3.42zm-4.75 59.77a2 2 0 01-1.42-3.41l4.75-4.75a2 2 0 012.83 2.83l-4.75 4.75a2 2 0 01-1.41.58zm59.77-59.77a2 2 0 01-1.41-3.42l4.75-4.75a2 2 0 012.83 2.83l-4.75 4.75a2 2 0 01-1.42.59zM61.09 102h-6.72a2 2 0 010-4h6.72a2 2 0 010 4zm84.54 0h-6.72a2 2 0 010-4h6.72a2 2 0 010 4zM100 63.09a2 2 0 01-2-2v-6.72a2 2 0 014 0v6.72a2 2 0 01-2 2zm0 84.54a2 2 0 01-2-2v-6.72a2 2 0 014 0v6.72a2 2 0 01-2 2zm.1-50.57a2 2 0 01-2-2V70.57a2 2 0 014 0v24.49a2 2 0 01-2 2zm17.78 5.14h-13.13a2 2 0 010-4h13.13a2 2 0 010 4z" /><path class="ba-graphics-gray60" d="M100 106.15a6.15 6.15 0 116.15-6.15 6.16 6.16 0 01-6.15 6.15zm0-8.3a2.15 2.15 0 102.15 2.15 2.16 2.16 0 00-2.15-2.15z" /><g style="opacity:.1"><path class="ba-graphics-gray80" d="M183.25 91.68h-49.53V79.74h49.53z" /><path class="ba-graphics-gray80" d="M185.25 93.68h-53.53V77.74h53.53zm-49.53-4h45.53v-7.94h-45.53z" /></g><path class="ba-graphics-white" d="M181.76 90.18h-49.53V78.24h49.53z" /><path class="ba-graphics-gray60" d="M183.24 91.65h-52.49V76.76h52.49zm-49.53-3h46.57v-9h-46.57z" /><path class="ba-graphics-gray60" d="M156.08 85.74h-16.26a1.48 1.48 0 110-3h16.26a1.48 1.48 0 010 3zm11.83 0h-7.39a1.48 1.48 0 110-3h7.39a1.48 1.48 0 010 3z" /></symbol>'});r.a.add(e);s.a=e},"3865314c5959606874d4":function(s,c){s.exports=a}},["06ed3a87abd189187ff5"])});
- /*
- *+------------------------------------------------------------------------+
- *| Licensed Materials - Property of IBM
- *| IBM Cognos Products: ba_content_nav
- *| (C) Copyright IBM Corp. 2015, 2021
- *|
- *| US Government Users Restricted Rights - Use, duplication or disclosure
- *| restricted by GSA ADP Schedule Contract with IBM Corp.
- *+------------------------------------------------------------------------+
- */
- define('bacontentnav/common/ui/ListControl',[
- 'q',
- 'doT',
- 'jquery',
- 'require',
- 'underscore',
- './list_actions/AddFolderAction',
- './list_actions/DefaultActionHandler',
- 'text!../templates/ListControlTemplate.html',
- 'text!../templates/EmptyListTemplate.html',
- '../../lib/@ba-ui-toolkit/ba-graphics/dist/illustrations-js/empty-folder_128',
- '../../lib/@ba-ui-toolkit/ba-graphics/dist/illustrations-js/search-results_128',
- '../../lib/@ba-ui-toolkit/ba-graphics/dist/illustrations-js/recent-activity_128',
- '../../nls/StringResource',
- '../../utils/UIHelper',
- '../../utils/ContentStoreObject',
- '../../lib/@waca/baglass/js/baglass/app/ContentView',
- '../../lib/@waca/core-client/js/core-client/utils/Utils',
- '../../lib/@waca/core-client/js/core-client/ui/Menu',
- 'datatables',
- 'datatables-natural'
- ], function(Q, dot, $, LocalRequire, _, AddFolderAction, DefaultActionHandler, listControlTemplate, emptyListTemplate, emptyFolder_128, emptySearch_128, emptyRecents_128, StringResource, UIHelper, ContentStoreObject, ContentView, Utils, Menu) {
- 'use strict';
- // Keep a list of visible list controls - needed for the resize handler
- var listControls = {};
- // Loops through each list control and call their resize
- var resizeEventHandler = function() {
- $.each(listControls, (function(index, listControl) {
- listControl.resize();
- }));
- };
- $(window).on('resize', resizeEventHandler);
- var ListControl = ContentView.extend({
- sort: true,
- sortIndexes: null,
- disableColumnHeaders: false,
- propertiesSpacing: null,
- dataTableOptions: {},
- aSelectedRows: [],
- oSelectedData: undefined,
- multiSelect: true,
- _isShowingEmptyMessage: false,
- rightClickContextMenu: true,
- // How many items we add to the list when you scroll to the bottom
- _showLoadBuffer: 40,
- browserResize: true,
- spinnerTimeout: null,
- /**
- * @param options.$el JQuery node to append the table HTML
- * @param options.url {string} - URL for the ajax request to get the JSON
- * @param options.urlParameters {object} - object of key/value pairs representing URL parameters
- * @param options.columns {object} - An array of column metadata. Must provide both a name property and a label property. Also can specify any property supported by datatables aoColumnDefs property
- * @param options.sort {boolean} - default is true
- * @param options.propertiesSpacing {String} - css string value of for the width of the column before the context menu button (only applies when context menu takes up the last column), value of null disables the resizing
- * @param options.ajaxProp {String} - location to find the array of objects in the data response. Defaults to 'data'
- * @param options.dataTableOptions {object} - datatable option used to override defaults
- * @param options.defaultSort {array} - array containing the index {int} and order {string}, for example [1, 'asc']
- * @param options.multiSelect {boolean} - allow multi-select functionality - default is true
- * @param options.disableColumnHeaders {boolean} - default is false
- * @param options.resizeCallback {function} - gets called after the resize() function
- * @param options.singleSelectCallback {function} - gets called after a single selection is made
- * @param options.deselectCallback {function} - gets called after all selection is removed
- * @param options.rightClickContextMenu {boolean} - default is true
- * @param options.emptyFolderString {string} - heading string that accompanies the empty svgIcon logo - default: "There is nothing in this folder."
- * @param options.emptyParagraphString {string} - paragraph string that accompanies the empty svgIcon logo - default: none
- * @param options.showEmptyNewFolderButton {boolean} - should the new folder button show up when a folder is empty? default: true
- * @param options.rowLimit {int} - Limits the datatable to only show x rows.
- * @param options.debounceRate {int} - The number of milliseconds for the debounce before we call this._dTable._fnDraw() in the resize(). Defaults to 300ms.
- * @param options.filterByTypes {string} - regular expression filter on index column. For example, if you want to only display folders, packages, and reports; set to "folder|package|report"."
- * @param options.setFocusOnDraw {boolean} - if true, will set focus to the first item in the list after drawing is complete. defaults to true.
- * @param options.getJSONDataCallback {function} - optional, if specified the method will be called to get the JSON data for the datatable to render. Must return a resolved promise with the JSON object.
- * @param options.dataManipulationCallback {function} - optional, called after the Ajax call to do any changes to the response before the datatable renders it
- * @param options.selectedRow {[string, string]} - optional, allows user to select one row of the data table. First string is the property to match, and second string is the value.
- * @param options.browserResize {boolean} - optional, default is true. Allows caller to specify whether to call on the browser resize to resize the datatable
- * @param options.calcExtraNonTableHeight {function} - optional, called to calculate extra non-table height if it is applicable;
- * @param options.groupByColumnAPI {object} - optional, default is undefined. Allows caller to specify how rows should be grouped
- * @param options.groupByColumnAPI.shouldGroup {function} - returns boolean to determine if rows should be grouped. Takes the datatable API as a parameter.
- * @param options.groupByColumnAPI.getGroupName {function} - optional, takes column value as parameter and returns the name for that group.
- * @param options.groupByColumnAPI.columnIndex {integer} - index of the column to group by.
- * @param options.contentView.isDialog {boolean} - If true, the ListControl is in a modal dialog.
- * @param options.contentView.onDefaultAction {object} - Handler to the dialog object so we can close it on default actions.
- */
- init: function(options) {
- // Need to keep the original options around for the loading more rows logic
- this._initialOptions = _.extend({}, options);
- this._lastShiftSelectedRow = null;
- this.aSelectedRows = [];
- this.wasSelected = false;
- this.showEmptyNewFolderButton = true;
- this.parentHasWritePermission = true;
- this.setFocusOnDraw = true;
- this.emptyFolderString = StringResource.get('emptyTableContentMessage');
- if (this.textParagraph) {
- this.emptyParagraphString = this.textParagraph;
- }
- this._scrollTop = null;
- ListControl.inherited('init', this, arguments);
- this.ajaxProp = 'data';
- this.accessibleLabel = options.accessibleLabel || '';
- _.extend(this, options);
- // the URL needs to be set to something, or the datatable won't try to render and getJSONDataCallback won't be called
- this.url = this.url || ' ';
- this.getData = this.getJSONDataCallback;
- // Add ourselves to the listControls object so that resize gets handled
- this._id = _.uniqueId('lc_');
- listControls[this._id] = this;
- this._renderedRowCount = this._showLoadBuffer;
- this._renderRowsOnScroll = true;
- this._showWorking = false;
- this._cancelDebounce = false;
- this.debounceRate = options.debounceRate || 300; //300 ms debounce on render
- this._emptyIcon = options.emptyIcon;
- this._calcExtraNonTableHeight = options.calcExtraNonTableHeight;
- this._groupByColumnAPI = options.groupByColumnAPI;
- this.oSelectedData = {};
- },
- createColumnObject: function(columnSpec, ColumnModule) {
- return new ColumnModule($.extend(columnSpec, {
- 'listControl': this,
- 'glassContext': this.glassContext
- }));
- },
- /**
- Main entry point - will render the data table with the information supplied
- @return - promise that will be resolved when the datatable is rendered
- **/
- _loadModule: function(moduleId) {
- return new Promise(function(resolve, reject) {
- if (typeof moduleId === 'function') {
- resolve(moduleId);
- } else {
- LocalRequire([moduleId], function(Module) {
- if (Module) {
- resolve(Module);
- } else {
- this.logger.error('Module id is not set');
- reject({ msg: ' Module id is not set', causedBy: 'Module id is not set' });
- }
- }.bind(this), function (error) {
- this.logger.error(moduleId + ' id is not loaded');
- reject({ msg: moduleId + ' is not loaded', causedBy: error });
- }.bind(this));
- }
- }.bind(this));
- },
- render: function() {
- var aPromises = [];
- $.each(this.columns, function(index, column) {
- if ((column.type && column.type.indexOf('natural') === -1) || column.module ) {
- var columnObj = column;
- var path = column.module || './list_columns/' + column.type;
- aPromises.push(new Promise(function(resolve){
- this._loadModule(path).then(function(ColumnModule) {
- delete columnObj.type;
- var col = this.createColumnObject(columnObj, ColumnModule);
- col.getSpec().then(function(spec) {
- _.extend(columnObj, spec);
- // Set the column index correctly
- columnObj.aTargets = [index];
- resolve();
- });
- }.bind(this));
- }.bind(this)));
- }
- }.bind(this));
- // Wait until all the promises are resolved before rendering the data table
- return Promise.all(aPromises).then(function() {
- var sHtml = dot.template(listControlTemplate)({
- id: this._id,
- accessibleLabel: this.accessibleLabel,
- columns: this.columns,
- sort: this.sort
- });
- this.$el.append(sHtml);
- return this._renderDataTable().then(function() {
- this._registerEvents();
- return this;
- }.bind(this));
- }.bind(this))
- .catch(function(e) {
- //show the empty table message
- this.showEmptyTableMessage();
- //and rethrow
- throw(e);
- }.bind(this));
- },
- _registerEvents: function() {
- if (this.rightClickContextMenu) {
- $('#' + this._id + ' tbody').on('contextmenu', 'tr', function(evt) {
- if ($(evt.target).is('INPUT')) {
- return true;
- }
- this._hideSlideoutChildrenToTheRight();
- if (this.contentView.slideout && this.contentView.slideout.child && this.contentView.slideout.child.hideHandler) {
- return false;
- }
- var trNode = evt.currentTarget;
- // Clear all the selections if right clicking on a row that wasn't previously selected
- if (!$(trNode).hasClass('selected')) {
- this.selectSingleRow(trNode); //hide multi-select bar after clearing rows
- }
- if (this.aSelectedRows === null || this.aSelectedRows.length < 1) {
- if (!this.canSelectCallback || (this.canSelectCallback && this.canSelectCallback(this.getRowData(trNode)))) {
- this.aSelectedRows = [trNode];
- this._updateSelectedData();
- }
- }
- if (this.aSelectedRows && this.aSelectedRows.length > 0) {
- evt.stopPropagation();
- this._updateSizeForSelection();
- $(trNode).addClass('selected');
- this._toggleCheckBox(trNode, true);
- this.getActionPayload(evt).then(function(actionPayload) {
- this.glassContext.appController.showContextMenu(actionPayload);
- }.bind(this));
- return false;
- }
- return true;
- }.bind(this));
- }
- // process row events
- this._dTable.on('primaryaction', 'tr', this.handleClick.bind(this));
- this._dTable.on('dblclick', 'tr', this.handleDoubleClick.bind(this));
- this._dTable.on('hold', this.handleHoldEvent.bind(this));
- },
- /**
- * Process the row via up/down keyboard navigation - needed a way to check if we are at the bottom of the currently loaded datatable or not. If we are then load the remainder of data (if there is any to load).
- *
- * @param {Object} options
- */
- _processRowForMoreDataLoad: function(options) {
- var currentRowLocation = options.dataTable.find(options.currentRow).index() + 1;
- if (options.lastRenderedRow <= currentRowLocation + 1) {
- this._handleReRender();
- }
- },
- _handleReRender: function() {
- if (!this._hasVerticalScrollbar()) {
- return;
- }
- // Flag to make sure we don't process multiple scroll events at the same time
- this.setRenderRowsOnScroll(false);
- var aData = this._dTable.fnGetData();
- // If we're already showing all the data
- if (this._renderedRowCount >= aData.length) {
- this.setRenderRowsOnScroll(true);
- this._renderedRowCount = aData.length;
- // Hide the loading animation container
- this._scrollNode.find('.listControlLoadingMore').css('display', 'none');
- return;
- }
- // Show the loading animation
- this._scrollNode.find('.loadingAnimation').css('display', 'block');
- this._renderExtraRows(this._renderedRowCount, this._showLoadBuffer).then(function() {
- this.setRenderRowsOnScroll(true);
- this._scrollNode.find('.loadingAnimation').css('display', 'none');
- }.bind(this));
- },
- getContextMenuId: function() {
- return this.contextMenuId ? this.contextMenuId : 'com.ibm.bi.contentApps.listViewMenu';
- },
- _getTargetPromise: function(actionPayload) {
- var selectedObjects = this.getSelectedObjects();
- if (selectedObjects && selectedObjects.length === 1 && UIHelper.hasSource(selectedObjects[0])) {
- return ContentStoreObject.getTargetSearchPath(selectedObjects[0], true).then(function(selectionTarget) {
- if (selectionTarget) {
- return this.glassContext.getSvc('.Content').then(function(contentService) {
- return this.glassContext.getCoreSvc('.Ajax').ajax({
- url: contentService.getSearchPathUrl(ContentStoreObject.getSearchPath(selectionTarget)),
- dataType: 'json',
- data: this.urlParameters
- }).then(function(response) {
- var target = response && response.data && response.data.data;
- if (target && target.length === 1) {
- actionPayload.activeObject.targetSelectedContext = selectedObjects;
- return Promise.resolve(target);
- } else {
- this.logger.warn('Asset with target does not return proper source target: ' + selectionTarget && selectionTarget.id);
- return Promise.resolve(selectedObjects);
- }
- }.bind(this))
- .catch(function(err){
- this.logger.warn('Target is not found:' + err);
- return Promise.resolve(selectedObjects);
- }.bind(this));
- }.bind(this));
- }
- }.bind(this));
- } else {
- return Promise.resolve(selectedObjects);
- }
- },
- getActionPayload: function(event) {
- // figure out the position for the context menu
- var position = {};
- var pageX = event.pageX;
- var gestureCenterPageX = event.gesture && event.gesture.center && event.gesture.center.pageX;
- if (!(pageX || gestureCenterPageX)) {
- position = $(event.target).offset();
- } else {
- position.left = pageX || gestureCenterPageX;
- position.top = event.pageY || event.gesture.center.pageY;
- }
- // set up action payload
- var actionPayload = {
- activeObject: {
- oListControl: this,
- handler: this.contentView,
- slideout: this.contentView.slideout,
- // being explicit here to raise awareness of the targetSelectedContext,
- // it is only used in scenario of an action that needs to operate on the
- // event targetted asset (eg a shortcut) instead its source target
- targetSelectedContext: undefined
- },
- position: {
- pageX: position.left,
- pageY: position.top
- },
- menuId: this.getContextMenuId()
- };
- // figure out objects to act on...
- return this._getTargetPromise(actionPayload)
- .then(this.getSelectedObjectFolderCapabilities.bind(this))
- .then(this.getSelectedObjectWPermissions.bind(this))
- .then(this.checkSetVersionsSupported.bind(this))
- .then(function(selectedContext) {
- // add objects to payload - consider deprecating options
- actionPayload.activeObject.aSelectedContext = selectedContext;
- actionPayload.options = this.getPublicSelectedObjects(selectedContext);
- return Promise.resolve(actionPayload);
- }.bind(this));
- },
- getFirstFocusElement: function() {
- var $firstTableThing;
- if (this._isShowingEmptyMessage) {
- $firstTableThing = this.$el.find(".newFolderLabel[tabindex='0']");
- } else {
- $firstTableThing = this.$el.find("td[tabindex='0']");
- }
- return $firstTableThing;
- },
- setFocus: function() {
- var $firstTableThing = null;
- if (this.addFolderNameForFocus) {
- var newFocus = this.$el.find('td.name').filter(function(ind, el) {
- return $(el).text() === this.addFolderNameForFocus;
- }.bind(this));
- //var $newFocus = this.$el.find("td:contains('" + this.addFolderNameForFocus + "')");
- if (newFocus.length !== 0) {
- $firstTableThing = $(newFocus[0]);
- }
- //need to reset the addFolderNameForFocus as it is always one time shot
- this.addFolderNameForFocus = undefined;
- }
- if ($firstTableThing === null) {
- $firstTableThing = this.getFirstFocusElement();
- }
- if ($firstTableThing.length > 0) {
- $firstTableThing.focus();
- return true;
- } else {
- return false;
- }
- },
- handleDoubleClick: function(evt) {
- // hooking into this flag for now, TODO: verify there are no cases where they differ
- var oData = this.getSelectedObjects()[0]; // the selected object
- if (this.rightClickContextMenu) {
- // find the row and select it
- var trNode = this.findRowNode(evt.currentTarget);
- this.selectSingleRow(trNode);
- // find current selection
- var $div = $(evt.currentTarget); // the row
- // launch the action on the selected object
- DefaultActionHandler.executeDefaultAction({
- listControl: this,
- glassContext: this.glassContext,
- $div: $div,
- evt: evt,
- oData: oData
- });
- // for automation - set the row to idle
- if (ContentStoreObject.getDisabled(oData)) {
- $div.addClass('dimmed idle');
- }
- }
- if (this.contentView.isDialog) {
- if (typeof this.contentView.onDefaultAction !== 'undefined' && !ContentStoreObject.getDisabled(oData)) {
- this.contentView.onDefaultAction();
- }
- }
- },
- handleClick: function(evt) {
- var trNode = this.findRowNode(evt.currentTarget);
- // Click still fired by browser for hold events on iPad, this is to catch and nullify the click
- if (evt.type === 'click' && this.multiSelectEvent && this.multiSelectEvent.type === 'hold') {
- return;
- }
- // Click a folder and its property page is open, do nothing and stop the event
- if (this.aSelectedRows.length === 1 && trNode.rowIndex === this.aSelectedRows[0].rowIndex && $(trNode).hasClass('selected') && this.contentView._propertiesOpen) {
- return;
- }
- if (evt.which === 3 && (evt.shiftKey || evt.ctrlKey || evt.metaKey || $(trNode).hasClass('selected'))) {
- return false;
- }
- // Process <Shift>click
- if (evt.shiftKey && this.multiSelect) {
- // no rows previously selected, handle like normal click
- if (this.aSelectedRows.length === 0) {
- this._handleSingleSelect(trNode, evt.target);
- this._lastShiftSelectedRow = null;
- }
- // Get last selected row
- var oLastSelectedRow = this._lastShiftSelectedRow;
- var iLastSelectedRowIndex = 1;
- if (oLastSelectedRow) {
- iLastSelectedRowIndex = oLastSelectedRow.rowIndex;
- if (iLastSelectedRowIndex < 0) {
- iLastSelectedRowIndex = 1;
- }
- }
- // Clear all rows of 'selected' class
- this._clearRows();
- var iEndRow = Math.max(iLastSelectedRowIndex, trNode.rowIndex);
- var iStartRow = Math.min(iLastSelectedRowIndex, trNode.rowIndex);
- // Get filtered table rows
- var aNodes = this._dTable.$('tr', {
- 'filter': 'applied'
- });
- for (var i = iStartRow; i <= iEndRow; i = i + 1) {
- if (!this.canSelectCallback || (this.canSelectCallback && this.canSelectCallback(this.getRowData(aNodes[i - 1])))) {
- $(aNodes[i - 1]).addClass('selected');
- this._toggleCheckBox(aNodes[i - 1], true);
- this.aSelectedRows.push(aNodes[i - 1]);
- }
- }
- if (this.aSelectedRows.length > 1) {
- this._showMultiSelectBar();
- }
- this._updateSelectedData();
- this._updateRowsCounter();
- } else if (((evt.ctrlKey || evt.metaKey) && this.multiSelect) || (evt.type === 'tap' && this.touchMultiSelectEnabled)) {
- // Process <Ctrl>click
- if (this.aSelectedRows.length === 0) {
- // no rows previously selected, handle like normal click
- this._handleSingleSelect(trNode, evt.target);
- } else {
- this._handleMultiSelect(trNode, evt.target);
- }
- } else if (this._handleSingleSelect(trNode, evt.target) === false) {
- // Process normal mouse click
- return false;
- }
- },
- _handleMultiSelect: function(trNode, target) {
- this._updateSizeForSelection();
- if (!this.canSelectCallback || (this.canSelectCallback && this.canSelectCallback(this.getRowData(trNode)))) {
- // Toggle 'selected' class of current row
- if (!($(trNode).hasClass('selected') && $(target).hasClass('forceRowSelection'))) {
- $(trNode).toggleClass('selected');
- this._toggleCheckBox(trNode, $(trNode).hasClass('selected'));
- }
- // Maintain the array of selected rows
- var iIndex = this.aSelectedRows.indexOf(trNode);
- if (iIndex > -1) {
- if (!$(target).hasClass('forceRowSelection')) {
- this.aSelectedRows.splice(iIndex, 1);
- }
- } else {
- this.aSelectedRows.push(trNode);
- }
- this._updateSelectedData();
- this._updateRowsCounter();
- }
- if (this.aSelectedRows.length === 0) {
- this._clearRows();
- this._hideMultiSelectBar();
- } else {
- this._lastShiftSelectedRow = trNode;
- this._showMultiSelectBar();
- }
- },
- _handleSingleSelect: function(trNode, target) {
- // behavior for regular click
- if (!$(target).hasClass('forceRowSelection')) {
- this._hideMultiSelectBar();
- if (this.aSelectedRows.length === 1 && trNode.rowIndex === this.aSelectedRows[0].rowIndex) {
- if ($(trNode).hasClass('selected') && this.contentView._propertiesOpen) {
- return false;
- }
- if (this.deselectCallback) {
- this.deselectCallback();
- }
- $(trNode).removeClass('selected');
- this._toggleCheckBox(trNode, false);
- this.aSelectedRows = [];
- this._updateSelectedData();
- }
- this.selectSingleRow(trNode);
- } else {
- // behavior for ellipsis button (only change the selection if the row isn't already selected)
- var found = false;
- this.aSelectedRows.forEach(function(selRow) {
- if (selRow.rowIndex === trNode.rowIndex) {
- found = true;
- }
- });
- if (!found) {
- this.selectSingleRow(trNode);
- }
- }
- },
- selectSingleRow: function(trNode) {
- var selectedObject = this.getRowData(trNode);
- if (!this.canSelectCallback || (this.canSelectCallback && this.canSelectCallback(selectedObject))) {
- this._hideMultiSelectBar();
- this._clearRows();
- this._selectRow(trNode);
- }
- if ((!this.isInStandbyMode() || this.selectAcrossFolders) && this.singleSelectCallback) {
- this.singleSelectCallback(selectedObject);
- }
- },
- selectAll: function() {
- this._clearRows();
- // Get filtered table rows
- var aNodes = this._dTable.$('tr', {
- 'filter': 'applied'
- });
- for (var i = 0; i < aNodes.length; i++) {
- if (!this.canSelectCallback || (this.canSelectCallback && this.canSelectCallback(this.getRowData(aNodes[i])))) {
- $(aNodes[i]).addClass('selected');
- this._toggleCheckBox(aNodes[i], true);
- this.aSelectedRows.push(aNodes[i]);
- }
- }
- if (this.aSelectedRows.length > 1) {
- this._showMultiSelectBar();
- }
- this._updateSelectedData();
- this._updateRowsCounter();
- },
- clearAll: function() {
- this._clearRows();
- this._updateSelectedData();
- },
- clearAllSelected: function() {
- this._clearRows();
- this.oSelectedData = {};
- this._updateSelectedData();
- },
- _updateRowsCounter: function() {
- var noOfItemSelected = StringResource.get('noOfItemSelected', {
- 'noOfItems': this.aSelectedRows.length
- });
- if (this.contentView.updateMultiSelectBarText) {
- this.contentView.updateMultiSelectBarText(noOfItemSelected);
- }
- },
- _showMultiSelectBar: function() {
- if(this.$el.hasClass('singleSelectMode')){
- this.$el.removeClass('singleSelectMode');
- }
- if (this.contentView.showMultiSelectBar) {
- this.contentView.showMultiSelectBar(this.isAccountPickerSlideout());
- }
- },
- _hideMultiSelectBar: function() {
- this.$el.addClass('singleSelectMode'); //make ellipsesButton visible only in single select mode
- if (this.contentView && this.contentView.hideMultiSelectBar) {
- this.contentView.hideMultiSelectBar();
- }
- },
- _hideSlideoutChildrenToTheRight: function() {
- if (this.contentView && this.contentView.slideout && this.contentView.slideout.child) {
- this.contentView.slideout.child.hide(this.contentView.slideout.child); //TODO: ?
- }
- },
- handleHoldEvent: function(evt) {
- this._updateSizeForSelection();
- this._showMultiSelectBar();
- this._clearRows();
- this.touchMultiSelectEnabled = true;
- var node = this.findRowNode(evt.target.parentNode);
- if (!this.canSelectCallback || (this.canSelectCallback && this.canSelectCallback(this.getRowData(node)))) {
- $(node).addClass('selected');
- this._toggleCheckBox(node, true);
- this.aSelectedRows.push(node);
- this.multiSelectEvent = evt;
- this._updateSelectedData();
- this._updateRowsCounter();
- }
- },
- findRowNode: function(node) {
- while (node.nodeName.toLowerCase() !== 'tr') {
- node = node.parentNode;
- }
- return node;
- },
- /**
- * Clear all selected rows in dataTable
- **/
- _clearRows: function() {
- _.each(this.aSelectedRows, function(oRow) {
- $(oRow).removeClass('selected');
- this._toggleCheckBox(oRow, false);
- }.bind(this));
- this.aSelectedRows = [];
- // Clear button and counter for multi-select on touch devices
- this.touchMultiSelectEnabled = false;
- },
- /**
- * Deselect a row in dataTable
- **/
- _deselectRow: function(trNode) {
- $(trNode).removeClass('selected');
- this._toggleCheckBox(trNode, false);
- this.aSelectedRows = this.aSelectedRows.filter(function(selRow){
- return selRow.rowIndex !== trNode.rowIndex;
- });
- this._updateSelectedData();
- },
- /**
- * Toggle checkbox checked state
- **/
- _toggleCheckBox: function(parent, toggleState) {
- var $checkBox = $(parent).find('input.checkBoxes[type=checkbox]');
- if ($checkBox) {
- toggleState = toggleState !== undefined ? toggleState : !$checkBox.prop('checked');
- $checkBox.prop('checked', toggleState);
- }
- },
- /**
- * Select a row in dataTable
- **/
- _selectRow: function(trNode) {
- this._updateSizeForSelection();
- $(trNode).addClass('selected');
- this._toggleCheckBox(trNode, true);
- this.aSelectedRows.push(trNode);
- this._updateSelectedData();
- this._lastShiftSelectedRow = trNode;
- },
- _updateSelectedData: function() {
- if (this.selectAcrossFolders) {
- var parentId = this._ancestors[this._ancestors.length-1].id;
- this.oSelectedData[parentId] = this.getSelectedObjects();
- if (this.selectAcrossFoldersSelectionChangeCallback) {
- this.selectAcrossFoldersSelectionChangeCallback(_.flatten(_.map(this.oSelectedData, _.values)));
- }
- }
- },
- _doUpdateSize: function() {
- if (!this._dataRendered) {
- return;
- }
- var $head = this.$el.find('.dataTables_scrollBody');
- var height = $head.css('height');
- if (height !== undefined) {
- var num = parseInt(height.substr(0, height.length - 2));
- if (!isNaN(num)) {
- $head.css('height', num + 2 + 'px');
- }
- }
- },
- _updateSizeForSelection: function() {
- if ($('body').hasClass('highcontrast') && !this.wasSelected){
- this._doUpdateSize();
- this.wasSelected = true;
- }
- },
- /**
- * Create the datatable
- **/
- _renderDataTable: function() {
- var deferred = Q.defer();
- var xbound = this.$el.width();
- jQuery.fn.dataTableExt.oSort['string-asc'] = function(a, b) {
- a = a.toString().toLowerCase();
- b = b.toString().toLowerCase();
- return UIHelper.getCollator().compare(a, b);
- };
- jQuery.fn.dataTableExt.oSort['string-desc'] = function(a, b) {
- a = a.toString().toLowerCase();
- b = b.toString().toLowerCase();
- return UIHelper.getCollator().compare(a, b) * -1;
- };
- delete jQuery.fn.dataTableExt.oSort['string-pre'];
- var self = this;
- var datatableSettings = {
- 'width': '55%',
- 'iDisplayLength': 40,
- 'autoWidth': true,
- 'sAjaxSource': this.url,
- 'sAjaxDataProp': this.ajaxProp,
- 'bServerSide': false,
- 'bFilter': true,
- 'bInfo': false,
- 'bAutoWidth': false,
- 'paging': true,
- 'bScrollInfinite': true,
- 'bScrollCollapse': true,
- 'bDeferRender': true,
- 'orderClasses': false,
- 'bSort': this.sort,
- 'sDom': 'rti',
- 'asStripeClasses': [''],
- 'aaSorting': this.defaultSort || [],
- 'sScrollY': this.skipYBound ? undefined: this._calcYBound(),
- 'sScrollX': xbound,
- 'sScrollXInner': '100%',
- 'aoColumnDefs': this.columns,
- 'fnInitComplete': function(oSettings) {
- self._dTable = this;
- self._fnInitComplete(oSettings);
- deferred.resolve();
- },
- 'fnServerData': function(sSource, aoData, fnCallback, oSettings) {
- // Use a timeout so that if there isn't going to be a wait, it doesn't flash the spinner
- this._dataRendered = false;
- if (!this.isInitialized) {
- window.clearTimeout(this.spinnerTimeout);
- this.spinnerTimeout = window.setTimeout(this.showWorking.bind(this), 600);
- }
- var options = {
- 'url': sSource,
- 'dataType': 'json',
- 'data': this.urlParameters,
- 'type': 'GET'
- };
- var handleResponse = function(data, jqXHR) {
- this.removeEmptyTableMessage();
- oSettings.jqXHR = jqXHR;
- this._dataRetrieved = true;
- if (this.dataManipulationCallback) {
- this.dataManipulationCallback(data, this.sortIndexes);
- }
- if (this.rowLimit) {
- if (this.ajaxProp && data[this.ajaxProp].length > this.rowLimit) {
- data[this.ajaxProp] = data[this.ajaxProp].slice(0, this.rowLimit);
- } else if (data.length > this.rowLimit) {
- data = data.slice(0, this.rowLimit);
- }
- }
- fnCallback(data);
- this._dataRendered = true;
- // Stops text selection when the user does shift+click in the table in IE11
- $(oSettings.nTable).bind('selectstart', function(element) {
- return $(element.target).is(':text');
- });
- }.bind(this);
- if (this.getData) {
- // Leaving for now to be backwards compatible
- this.getData(options)
- .done(function(data, textStatus, jqXHR) {
- handleResponse(data, jqXHR);
- })
- .fail(function(jqXHR) {
- oSettings.jqXHR = jqXHR;
- deferred.reject(jqXHR);
- }.bind(this));
- } else {
- this.glassContext.getCoreSvc('.Ajax').ajax(options)
- .then(function(response) {
- handleResponse(response.data, response.jqXHR);
- })
- .catch(function(err) {
- oSettings.jqXHR = err.jqXHR;
- deferred.reject(err);
- }.bind(this));
- }
- }.bind(this),
- 'preDrawCallback': function(oSettings) {
- this._preDrawCallback(oSettings);
- }.bind(this),
- 'drawCallback': function(oSettings) {
- this._drawCallback(oSettings);
- }.bind(this),
- 'createdRow': this.createdRowCallback || function(row, data, index) {
- void(index);
- if (this.selectedRow && data[this.selectedRow[0]] === this.selectedRow[1]) {
- this._selectRow(row);
- this.selectedRow = null;
- }
- //Restore selection if we allow selection across folders
- if (this.selectAcrossFolders && this._previousSelections) {
- if (this._previousSelections[data.id]) {
- this._updateSizeForSelection();
- $(row).addClass('selected');
- this._toggleCheckBox(row, true);
- this.aSelectedRows.push(row);
- this._lastShiftSelectedRow = row;
- }
- }
- $(row).attr('data-name', data.defaultName);
- }.bind(this)
- };
- var options = _.extend(datatableSettings, this.dataTableOptions);
- this._dTable = $('#' + this._id).dataTable(options);
- // We call the internal _fnDraw as fnDraw does a sort, and it makes resizing very slow. All we need is a draw as we are in resize()
- if (!this.debouncedDraw) {
- this.debouncedDraw = _.debounce(function() {
- //_cancelRedraw is a flag to indicate if this debounce should go or not
- // we set it to false on remove() because underscore doesn't have a way to cancel a debounce. (lodash does, btw).
- if (this._cancelDebounce !== true) {
- this._dTable._fnDraw();
- }
- }.bind(this), this.debounceRate);
- }
- return deferred.promise;
- },
- _fnInitComplete: function(oSettings) {
- this.isInitialized = true;
- this._scrollNode = this.$el.find('.dataTables_scrollBody');
- if (this.filterByTypes) {
- this._filterInfo = {
- 'filterValue': this.filterByTypes,
- 'column': this.filterColumnIndex,
- 'regExpression': true
- };
- this._dTable.fnFilter(this.filterByTypes, this.filterColumnIndex, true);
- }
- if (this.disableColumnHeaders) {
- $(oSettings.nScrollHead).remove();
- }
- var tabEl = $(oSettings.nScrollHead).find('table');
- var lab = tabEl.attr('aria-label');
- tabEl.removeAttr('aria-label');
- tabEl.attr('aria-labelledby', this._id + '_tableHeaderLab1 ' + this._id + '_tableHeaderLab2');
- var hiddenDiv1 = $('<div style="position: absolute; left: -999px" aria-hidden="true" id="' + this._id + '_tableHeaderLab1"></div>');
- hiddenDiv1.text(lab);
- var hiddenDiv2 = $('<div style="position: absolute; left: -999px" aria-hidden="true" id="' + this._id + '_tableHeaderLab2">' + StringResource.get('listControlColumns') + '</div>');
- tabEl.parent().append(hiddenDiv1);
- tabEl.parent().append(hiddenDiv2);
- //If the last column is the properties column, add the ability to specially handle the 2nd last column
- if (this.propertiesSpacing && oSettings.aoColumns[oSettings.aoColumns.length - 1].sName === 'properties') {
- oSettings.aoColumns[oSettings.aoColumns.length - 2].weight = null;
- oSettings.aoColumns[oSettings.aoColumns.length - 2].sWidth = this.propertiesSpacing;
- }
- this._handleColumnCallbacks(oSettings);
- this._processColumnWeights(oSettings);
- this.resize();
- if (!this.browserResize) {
- this._drawCallback(oSettings);
- }
- var scrollToPos = 0;
- if (this.aSelectedRows && this.aSelectedRows.length > 0) {
- scrollToPos = $(this.aSelectedRows[0]).offset().top - (this._scrollNode.height() / 2);
- }
- this._scrollNode.scrollTop(scrollToPos);
- this._scrollNode.bind('scroll', this._onScroll.bind(this));
- this._initRenderedRowCount();
- this._updateLoadingMoreDiv();
- },
- getScrollingNode: function() {
- return this._scrollNode;
- },
- setRenderRowsOnScroll: function(bValue) {
- this._renderRowsOnScroll = bValue;
- },
- _onScroll: function(event) {
- if (!this.isInitialized || !this._dataRetrieved || !this._dataRendered) {
- return;
- }
- var $target = $(event.target);
- // If we've scrolled to the bottom
- if (this._renderRowsOnScroll && ($target.scrollTop() + $target.innerHeight()) >= ($target[0].scrollHeight - 20)) {
- this._handleReRender();
- }
- //RTC#202962 hide contextmenu when scrolling
- Menu.hideOpenMenus();
- },
- /**
- Will load more rows into the datatable. This is done by rendering a dummy listControl off the screen
- and moving its TR elements over to the main listControl
- @startIndex - the starting index in the list data of the row to render
- @count - how many rows starting from the 'startIndex' to render
- **/
- _renderExtraRows: function(startIndex, count) {
- // Build a div off the screen to contain the listControl
- var $listControlContainer = $('<div></div>');
- // Need to set it's width to match the current listControls width so that the ellipses get processed correctly
- $listControlContainer.css('width', this._scrollNode.width() + 'px');
- $listControlContainer.css('position', 'absolute');
- $listControlContainer.css('left', '-1000px');
- $listControlContainer.css('height', '0px');
- $listControlContainer.css('overflow', 'hidden');
- $(document.body).append($listControlContainer);
- var rowInfoToRender = this._getRowInfoToRender(startIndex, count);
- // Nothing left to display
- if (rowInfoToRender.length === 0) {
- // Hide the loading animation container
- this._scrollNode.find('.listControlLoadingMore').css('display', 'none');
- return Promise.resolve();
- }
- // Build the options for the dummy listControl
- var options = _.extend({}, this._initialOptions, {
- 'el': $listControlContainer[0],
- '$el': $listControlContainer,
- // our data is already sorted
- 'sort': false,
- // no need to have any resize callbacks going for the hidden list control
- 'resizeCallback': null,
- 'getJSONDataCallback': function(rowInfoToRender) {
- // Return the rows that should get rendered by the dummy listControl
- var deferred = $.Deferred();
- var response = {};
- if (this.ajaxProp) {
- response[this.ajaxProp] = rowInfoToRender.aData;
- } else {
- response = rowInfoToRender.aData;
- }
- // this call seems to rely on $ deferred's sync nature
- deferred.resolve(response);
- return deferred.promise();
- }.bind(this, rowInfoToRender)
- });
- var listControl = new ListControl(options);
- // renderExtraRows creates a new instance of listControl, needs to keep the selectedData and selectedRows in sync
- listControl.oSelectedData = this.oSelectedData;
- listControl.aSelectedRows = this.aSelectedRows;
- return listControl.render().then(function() {
- // Get all the TRs that were rendered
- var nTRs = $listControlContainer.find('.dataTables_scrollBody').find('tbody').find('tr');
- // Append the rendered TRs to our table
- this._scrollNode.find('tbody').append(nTRs);
- $listControlContainer.remove();
- var oSettings = this._dTable.fnSettings();
- // Some badness to get our datatable to know about the TRs we've just added
- nTRs.each(function(index, nTr) {
- // This is the index of datatables internal map. Maps data to the index of the TR in the table
- var dataIndex = rowInfoToRender.aIndexMappding ? rowInfoToRender.aIndexMappding[index] : startIndex + index;
- var rowMapIndex = this._dTable.api().rows()[0][dataIndex];
- if (rowMapIndex >= 0) {
- // Fix the _DT_RowIndex property found on the TR
- nTr._DT_RowIndex = rowMapIndex;
- // Fix the internal aoData to know about the TR we inserted
- oSettings.aoData[rowMapIndex].nTr = nTr;
- oSettings.aoData[rowMapIndex].anCells = nTr.cells;
- this._formatRowsContent(oSettings.aoColumns,[oSettings.aoData[rowMapIndex]]);
- }
- }.bind(this));
- this._groupByColumnCallback(startIndex);
- return nTRs;
- }.bind(this));
- },
- /**
- Format rows based on column specification
- @param aoColumns - array of columns
- @param aData - array of rows (data) to format
- **/
- _formatRowsContent: function(aoColumns,aoData){
- aoColumns.forEach(function(column,index){
- aoData.forEach(function(rowData){
- this._formatContent(rowData,column,index);
- }.bind(this));
- }.bind(this));
- },
- /**
- Format one row data based on column specification
- @param rowData - a row data
- @param columnMeta - current column's specification
- @param col - current column
- **/
- _formatContent : function(rowData,columnMeta,col) {
- if (rowData.anCells && rowData.anCells[col]){
- if (columnMeta.formatContent) {
- columnMeta.formatContent(rowData.anCells[col]);
- }
- var $cell = $(rowData.anCells[col]);
- var scope = columnMeta.scope;
- if (scope === 'row') {
- $cell.attr('role', 'rowheader');
- } else {
- $cell.attr('role', 'gridcell');
- }
- $cell.attr('tabindex', '-1');
- }
- },
- /**
- Return row data, only rows that should be displayed (not filtered out) will be returned
- **/
- _getRowInfoToRender: function(startIndex, count) {
- // If we're not filtering, simply return the next section of data to render
- if (!this._filterInfo) {
- this._renderedRowCount = startIndex + count;
- return {
- 'aData': this._dTable.api().rows().data().splice(startIndex, count)
- };
- } else {
- var aData = [];
- var aIndexMappding = [];
- var tableApi = this._dTable.api();
- var data = tableApi.rows().data();
- var dataIndex = startIndex;
- var isFiltered;
- // This is data of the column used for filtering. Usually this will be an array of 'types', 1 entry for each row
- var aColumnDataToFilter = tableApi.column(this._filterInfo.column).data();
- // If we're filtering using a regex
- if (this._filterInfo.regExpression) {
- var regex = new RegExp(this._filterInfo.filterValue);
- isFiltered = function(rowIndex) {
- return !regex.test(aColumnDataToFilter[rowIndex]);
- }.bind(this);
- } else {
- // No regex, do a simple compare
- isFiltered = function(rowIndex) {
- return this._filterInfo.filterValue !== aColumnDataToFilter[rowIndex];
- }.bind(this);
- }
- // Loops through the data until we've gotten enough rows to render or we've hit the end of the data
- while (aData.length < count && dataIndex < data.length) {
- if (!isFiltered(dataIndex)) {
- aData.push(data[dataIndex]);
- aIndexMappding.push([dataIndex]);
- }
- dataIndex = dataIndex + 1;
- }
- this._renderedRowCount = dataIndex;
- return {
- 'aData': aData,
- 'aIndexMappding': aIndexMappding
- };
- }
- },
- /**
- Add data to the internal data object of the datatable
- @param aData - array of objects (data) to add
- @param forceRowRender {boolean}
- **/
- addRowData: function(aData, forceRowRender) {
- var tableApi = this._dTable.api();
- var newRows = tableApi.rows.add(aData).draw(false);
- if (forceRowRender) {
- var aPromises = [];
- var mapping = tableApi.row()[0];
- var newRowIndexes = newRows[0];
- newRowIndexes.forEach(function(rowIndex) {
- aPromises.push(new Promise(function(resolve) {
- var row = tableApi.row(rowIndex);
- // If there are already 40 or more rows rendered (initial render is 40), then the TR
- // will not get rendered automatically since we need to render it ourselves.
- if (!row.node()) {
- // Find the index of the data we just added using datatables internal map
- for (var dataIndex = 0; dataIndex < mapping.length; dataIndex = dataIndex + 1) {
- if (mapping[dataIndex] === rowIndex) {
- break;
- }
- }
- // Render the row
- this._renderExtraRows(dataIndex, 1).then(function(nTRs) {
- resolve(nTRs[0]);
- });
- } else {
- resolve(row.node());
- }
- }.bind(this)));
- }.bind(this));
- return Promise.all(aPromises).then(function(nTRs) {
- return nTRs;
- });
- }
- },
- /**
- If we should show the working icon instead of the bee when there's an empty table
- **/
- setShowWorking: function(showWorking) {
- this._showWorking = showWorking;
- },
- _isShortTable: function() {
- var listContainer = this.$el.find('#listContainer' + this._id);
- return listContainer.height() < 200;
- },
- /**
- Show the working icon in the empty table
- **/
- showWorking: function() {
- if (this._isShowingWorking) {
- return;
- }
- this.removeEmptyTableMessage();
- var listContainer = this.$el.find('#listContainer' + this._id);
- var sHtml = dot.template(emptyListTemplate)({
- 'text': '',
- 'shortTable': this._isShortTable(),
- 'isSpinner': true,
- 'iconStyle': 'contentLoadingSpinner',
- 'emptyIcon': '#ba_content_nav-load'
- });
- listContainer.append(sHtml).hide().fadeIn(300);
- this._isShowingWorking = true;
- },
- /**
- Show the empty table graphic
- **/
- showEmptyTableMessage: function() {
- if (this._isShowingEmptyMessage) {
- return;
- }
- this.removeEmptyTableMessage();
- var listContainer = this.$el.find('#listContainer' + this._id);
- var sHtml = dot.template(emptyListTemplate)({
- 'text': this.emptyFolderString,
- 'textParagraph': this.emptyParagraphString,
- 'shortTable': this._isShortTable(),
- 'emptyIcon': this._emptyIcon
- });
- listContainer.append(sHtml);
- var svg = listContainer.find('.svgIcon');
- var use = listContainer.find('use');
- use.remove();
- if (this._emptyIcon === '#ba_content_nav-search_64') {
- Utils.setIcon(svg, emptySearch_128.default.id);
- } else if (this._emptyIcon === '#ba_content_nav-time_64') {
- Utils.setIcon(svg, emptyRecents_128.default.id);
- } else {
- Utils.setIcon(svg, emptyFolder_128.default.id);
- }
- this._isShowingEmptyMessage = true;
- },
- removeEmptyTableMessage: function() {
- if (this._isShowingWorking || this._isShowingEmptyMessage) {
- this.$el.find('.emptyTableContent').remove();
- this._isShowingEmptyMessage = false;
- this._isShowingWorking = false;
- }
- if (this.spinnerTimeout) {
- clearTimeout(this.spinnerTimeout);
- this.spinnerTimeout = null;
- }
- },
- /**
- Show the empty table graphic
- **/
- showEmptyFilterMessage: function() {
- if (this._isShowingEmptyMessage) {
- return;
- }
- this.removeEmptyTableMessage();
- var listContainer = this.$el.find('#listContainer' + this._id);
- var sHtml = dot.template(emptyListTemplate)({
- 'text': StringResource.get('noFilterResult'),
- 'textParagraph': StringResource.get('tryOtherFilter'),
- 'shortTable': this._isShortTable(),
- 'emptyIcon': this._emptyIcon
- });
- listContainer.append(sHtml);
- this._isShowingEmptyMessage = true;
- },
- _preDrawCallback: function(oSettings) {
- void(oSettings);
- if (this.getScrollingNode()) {
- this._scrollTop = this.getScrollingNode().scrollTop();
- }
- this._ancestors = this.contentView.getAncestors && this.contentView.getAncestors();
- //Parse the selection to restore visual selection to selected items
- this._previousSelections = null;
- if (this.selectAcrossFolders && this._ancestors && this._ancestors.length) {
- var parentId = this._ancestors[this._ancestors.length-1].id;
- if (this.oSelectedData[parentId] && this.oSelectedData[parentId].length) {
- var selection = this.oSelectedData[parentId];
- this._previousSelections = {};
- for (var i=0; i<selection.length; i++) {
- this._previousSelections[selection[i].id] = true;
- }
- }
- }
- },
- _drawCallback: function(oSettings) {
- if (this.getScrollingNode() && this._scrollTop !== null) {
- var height = this.getScrollingNode().height();
- if (this._scrollTop >= height) {
- this._scrollTop = 0;
- }
- this.getScrollingNode().scrollTop(this._scrollTop);
- this._scrollTop = null;
- }
- if (this.isInitialized && this._dataRetrieved) {
- // If there is no data, first try to set a spinner while we wait for the data
- if (oSettings.aoData.length === 0) {
- if (this._showWorking) {
- this.setShowWorking(false); // Don't execute this the second time around
- window.clearTimeout(this.spinnerTimeout);
- this.spinnerTimeout = window.setTimeout(this.showWorking.bind(this), 1000); // Start showing spinner after 1s
- } else {
- // After trying to show the spinner and wait, we still returned with nothing. Show empty list
- this.showEmptyTableMessage();
- // Just in case - remove the timeout so it is not called after this
- clearTimeout(this.spinnerTimeout);
- this.spinnerTimeout = null;
- }
- } else if (oSettings.aoData.length > 0) {
- if (oSettings.fnRecordsDisplay() === 0){
- this.showEmptyFilterMessage();
- }else{
- this.removeEmptyTableMessage();
- }
- }
- this._groupByColumnCallback(0);
- //Each column can have a function fnDrawCallback(nTd) which will be called when the table fnDrawCallback is drawn
- this._formatRowsContent(oSettings.aoColumns,oSettings.aoData);
- this._initRenderedRowCount();
- // Make sure we reset the scrolling properties since we've just redrawn the datatable
- this.setRenderRowsOnScroll(true);
- this._updateLoadingMoreDiv();
- if (this.widgetKeyController) {
- this.widgetKeyController.setInitialTabIndex();
- if (this.setFocusOnDraw) {
- this.setFocus();
- }
- }
- }
- },
- _createRowGroupHeader: function(group, firstGroup) {
- var groupName = group;
- if (this._groupByColumnAPI.getGroupName) {
- groupName = this._groupByColumnAPI.getGroupName(group);
- }
- var groupHeader = '<tr class="group';
- if ( firstGroup ){
- groupHeader += ' firstGroup';
- }
- groupHeader += '"><td><span aria-label="' + groupName + '">'+ groupName +'</span></td><td class="contentListFocusable"></td><td class="contentListFocusable"></td></tr>';
- return groupHeader;
- },
- /*
- * Create row group headers
- * @startIndex - optional, the index to start creating row groups
- */
- _groupByColumnCallback: function(startIndex) {
- if ( this._groupByColumnAPI ){
- if ( startIndex === undefined ) {
- startIndex = 0;
- }
- var tableApi = this._dTable.api();
- if ( this._groupByColumnAPI.shouldGroup(tableApi) ) {
- var rows = tableApi.rows().nodes();
- var columnData = tableApi.column(this._groupByColumnAPI.columnIndex).data();
- var last;
- if ( startIndex !== 0 ) {
- last = columnData[startIndex-1];
- } else {
- last = null;
- }
- var isFiltered = null;
- if (this._filterInfo) {
- var aColumnDataToFilter = tableApi.column(this._filterInfo.column).data();
- if (this._filterInfo.regExpression) {
- var regex = new RegExp(this._filterInfo.filterValue);
- isFiltered = function(i) {
- return !regex.test(aColumnDataToFilter[i]);
- }.bind(this);
- }
- }
- columnData.each( function (group, i) {
- if ( i>=startIndex && last !== group ) {
- if (!isFiltered || !isFiltered(i)) {
- // Add group title when no Filter defined or the first non filtered row found
- var groupHeader = this._createRowGroupHeader(group, i===0);
- $(rows).eq(i).before(groupHeader);
- last = group;
- }
- }
- }.bind(this));
- this.$el.find('.dataTables_scrollBody').css('min-height', this._calcYBound() + 'px');
- }
- }
- },
- _initRenderedRowCount: function() {
- this._renderedRowCount = this._showLoadBuffer;
- // If we're filtering we don't really know the index of the last drawn data row. Figure it out.
- if (this._filterInfo) {
- var nLastTR = this._scrollNode.find('tr:last');
- var _DT_RowIndex = nLastTR[0]._DT_RowIndex;
- var rowMapIndex = this._dTable.api().rows()[0];
- for (var dataIndex = 0; dataIndex < rowMapIndex.length; dataIndex += 1) {
- if (rowMapIndex[dataIndex] === _DT_RowIndex) {
- this._renderedRowCount = dataIndex + 1;
- break;
- }
- }
- }
- },
- _hasVerticalScrollbar: function() {
- return this._scrollNode && this._scrollNode[0] && this._scrollNode[0].scrollHeight > this._scrollNode[0].clientHeight;
- },
- _updateLoadingMoreDiv: function() {
- if (!this._scrollNode) {
- this._scrollNode = this.$el.find('.dataTables_scrollBody');
- }
- // Hide the fetch more data animation, we don't want it to be the cause of a scrollbar
- if (this._$loadingAnimationContainer) {
- this._$loadingAnimationContainer.css('display', 'none');
- }
- // If we have a vertical scrollbar, add in the fetch more data animation
- if (this._hasVerticalScrollbar() && this._dTable.fnGetData().length > this._showLoadBuffer) {
- if (!this._$loadingAnimationContainer) {
- var loadingAnimation = Utils.getLoadingAnimation(1);
- this._$loadingAnimationContainer = $('<div class="listControlLoadingMore"></div>', {
- 'class': 'listControlLoadingMore'
- });
- $(loadingAnimation).addClass('loadingAnimation');
- this._$loadingAnimationContainer.append(loadingAnimation);
- this._scrollNode.append(this._$loadingAnimationContainer);
- }
- this._$loadingAnimationContainer.css('display', 'block');
- }
- },
- /**
- Updates the content of the datatable with an optional URL for new data
- **/
- updateDatatable: function(url) {
- if (!this._dTable) return;
- if (url) {
- this._dTable.fnSettings().sAjaxSource = url;
- this.url = url;
- // clear multi-selected rows and buttons/counters for touch devices when launching a new view
- this._clearRows();
- // Scroll back to the top on url change
- if (this.getScrollingNode()) {
- this.getScrollingNode().scrollTop(0);
- }
- // When there is a new url, there is a potential need to show loading content - set to true to show spinner
- this.setShowWorking(true);
- // Clear the table so the user cannot click on the same row before the refresh.
- this._dTable.fnClearTable();
- }
- this._dataRetrieved = false;
- this._dataRendered = false;
- this._dTable.api().ajax.reload();
- this._dTable.fnDraw();
- this._clearRows();
- this.setInStandbyMode(false);
- this.setShowWorking(false);
- },
- updateCell: function(colData, row, colIndex) {
- var table = this._dTable;
- table.fnUpdate(colData, row, colIndex);
- var $tdEl = $($(row).find('td')[colIndex]);
- table.fnSettings().aoColumns[colIndex].fnCreatedCell($tdEl, table.fnGetData($tdEl.get(0)), colData);
- },
- getDatatable: function() {
- return this._dTable;
- },
- /**
- Call to remove the list control from the DOM and disconnect any events
- **/
- remove: function() {
- if (this._addFolderAction) {
- this._addFolderAction.destroy();
- }
- // remove ourselves from the listControls object so that the resize event not longer gets fired
- listControls[this._id] = null;
- delete listControls[this._id];
- if (this._dTable) {
- this._cancelDebounce = true;
- this._dTable.api().destroy(true);
- this._dTable.remove();
- }
- this.$el.find('.ca-listContainer').remove();
- },
- /**
- Returns an array of the selected rows (tr's)
- **/
- getSelectedRows: function() {
- return this.aSelectedRows || [];
- },
- /**
- Returns an array of objects that are being represented by the selected rows
- **/
- getSelectedObjects: function() {
- var i;
- var rowObjects = [];
- for (i = 0; i < this.aSelectedRows.length; i += 1) {
- var obj = this.getRowData(this.aSelectedRows[i]);
- if (obj) {
- rowObjects.push(obj);
- } else {
- // this can happen if, for example, a user has clicked on a grouping label
- this.logger.error(new Error('Selection was not found in the datatable: ' + this.aSelectedRows[i]));
- }
- }
- return rowObjects;
- },
- getRowData: function(trNode) {
- var obj = this._dTable.fnGetData(trNode);
- // Augment the object information with ancestor info if it doesn't already have it
- if (obj) {
- if (!obj[ContentStoreObject.ANCESTORS] && this._ancestors && this._ancestors.length > 0) {
- obj[ContentStoreObject.ANCESTORS] = this._ancestors.slice();
- }
- }
- return obj;
- },
- /**
- * Get an array of objects destined for the public API
- * @returns {Object} Where the type, name and id are publicly available
- */
- getPublicSelectedObjects: function(selectedObjects) {
- return $.map(selectedObjects, function(obj) {
- return {
- type: obj.type,
- name: obj.defaultName,
- id: obj.id
- };
- });
- },
- /**
- Returns an object represented by the selected row
- If necessary, object is augmented with the permissions data
- **/
- getSelectedObjectWPermissions: function(selectedObjects) {
- if (!selectedObjects) {
- selectedObjects = this.getSelectedObjects();
- }
- if (selectedObjects.length === 1) {
- if (selectedObjects[0].type === 'report') {
- return ContentStoreObject.getPermissionsOwnerIdAndMetadataModelPackageEffectiveUserCapabilities(selectedObjects[0], true).then(function(selected, data) {
- selected[0][ContentStoreObject.PERMISSIONS] = data.permissions;
- selected[0][ContentStoreObject.OWNER] = data.owner;
- selected[0][ContentStoreObject.METADATA_MODEL_PACKAGE] = data.metadataModelPackage;
- return Promise.resolve(selected);
- }.bind(this, selectedObjects));
- } else if (selectedObjects[0].type === 'reportView') {
- return ContentStoreObject.getPermissionsOwnerIdAndBasePermissions(selectedObjects[0], true, true).then(function(selected, data) {
- selected[0][ContentStoreObject.PERMISSIONS] = data.permissions;
- selected[0][ContentStoreObject.OWNER] = data.owner;
- selected[0][ContentStoreObject.BASE] = data.base;
- return Promise.resolve(selected);
- }.bind(this, selectedObjects));
- } else {
- return ContentStoreObject.getPermissionsOwnerIdAndCapabilities(selectedObjects[0], true).then(function(selected, data) {
- selected[0][ContentStoreObject.PERMISSIONS] = data.permissions;
- selected[0][ContentStoreObject.OWNER] = data.owner;
- selected[0][ContentStoreObject.EFFECTIVE_USER_CAPABILITIES] = data.effectiveUserCapabilities;
- return Promise.resolve(selected);
- }.bind(this, selectedObjects));
- }
- } else {
- return Promise.resolve(selectedObjects);
- }
- },
- checkSetVersionsSupported: function(selectedObjects) {
- for (var i = 0; i < selectedObjects.length; i = i + 1) {
- // we will show page for versions all the time, a hack so we can access archives even if there are no versions
- if (!_.isBoolean(selectedObjects[i].versionsSupported)) {
- selectedObjects[i].versionsSupported = UIHelper.isVersionsSupported(selectedObjects[i]);
- }
- }
- return Promise.resolve(selectedObjects);
- },
- /**
- Loops through the selected rows and removes them from the datatable
- **/
- removeSelectedRows: function() {
- if (this.aSelectedRows) {
- while (this.aSelectedRows.length > 0) {
- this.removeRow(this.aSelectedRows.pop());
- }
- this._updateSelectedData();
- this._updateRowsCounter();
- this._hideMultiSelectBar();
- }
- },
- /**
- Adds a row to the datatable
- **/
- addFolder: function() {
- this._clearRows();
- this._addFolderAction = new AddFolderAction({
- 'oListControl': this
- });
- return this._addFolderAction.execute();
- },
- /**
- Cancels any current actions ('addFolder' for eample)
- */
- cancelActions: function() {
- if (this._addFolderAction) {
- this._addFolderAction.cancel();
- }
- },
- /**
- Removes a row from the datatable
- @param $tr - jquery node for the table row that is being removed from the DataTable
- **/
- removeRow: function($tr) {
- if (this._scrollNode.scrollTop() !== 0) {
- this._scrollNode.scrollTop(0); // scroll to top so we don't trigger scrolling events
- }
- this._dTable.fnDeleteRow($tr);
- },
- /**
- Removes all the rows that are represented by objects
- @param rowsToDelete - a collection of numbers noting the index of the rows to delete
- **/
- removeIndexRows: function(rowsToDelete) {
- var rows = this.$el.find('tbody tr');
- rowsToDelete.forEach(function(anIndex) {
- this.removeRow(rows[anIndex]);
- }.bind(this));
- },
- /**
- Calculates the available room for the data table
- **/
- _calcYBound: function() {
- var containerHeight = this.$container ? (this.$container.height() - 40) : this.$el.height();
- var headerHeight = this.$el.find('.dataTables_scrollHead').outerHeight(true) || 0;
- // Get the height of all the other elements in our pageView that aren't the actual data table
- var nonTableHeight;
- nonTableHeight = this.$el.children(':not(.dataTables_wrapper, .contentViewSwitcher, .ca-listContainer)').outerHeight(true);
- if (!nonTableHeight) {
- nonTableHeight = 0;
- }
- nonTableHeight += this._calcExtraNonTableHeight ? this._calcExtraNonTableHeight(this) : 0;
- if (this.$container) {
- var descendantNode = this.$el[0];
- var $currentNode = this.$el.parent();
- while ($currentNode[0] && $currentNode[0] !== this.$container.parent()[0]) {
- var children = $currentNode.children();
- for (var i = 0; i < children.length; i = i + 1) {
- var child = children[i];
- if (child !== descendantNode) {
- nonTableHeight += $(child).outerHeight(true);
- }
- }
- descendantNode = $currentNode[0];
- $currentNode = $currentNode.parent();
- }
- }
- var newHeight = containerHeight - headerHeight - nonTableHeight;
- if (this.minHeight && newHeight < this.minHeight) {
- newHeight = this.minHeight;
- }
- return newHeight;
- },
- /**
- Called on browser resize to resize the datatable
- **/
- resize: function() {
- if (!this.browserResize) {
- return;
- }
- var oSettings = this._dTable && this._dTable.fnSettings && this._dTable.fnSettings();
- if (oSettings) {
- oSettings.oScroll.sY = this._calcYBound() + 'px';
- oSettings.oScroll.sX = this.$el.width() + 'px';
- oSettings.oScroll.sXInner = (this.$el.width() < this.minWidth) ? this.minWidth + 'px' : '100%';
- this.debouncedDraw && this.debouncedDraw();
- this.$el.find('.dataTables_scrollBody').css('max-height', oSettings.oScroll.sY);
- }
- if (this.resizeCallback) {
- this.resizeCallback();
- }
- },
- /**
- Filter on column with value
- @filterValue {string} - the filter to be applied
- @column {int} - the column to apply the filter to
- @regExpression {boolean} - is the @filterValue a regular expression
- **/
- filter: function(filterValue, column, regExpression) {
- // We don't want to trigger adding more rows from scrolling events while we filter.
- this.setRenderRowsOnScroll(false);
- this._filterInfo = {
- 'filterValue': filterValue,
- 'column': column,
- 'regExpression': regExpression
- };
- this._dTable.fnFilter(filterValue, column, regExpression);
- this._dTable.fnDraw(false);
- },
- /**
- Uses weights to properly assign percent widths to columns that need them
- Assigns percentages based on the unused percent of the space available
- **/
- _processColumnWeights: function(oSettings) {
- var weightSum = 0;
- var percentSum = 0;
- oSettings.aoColumns.forEach(function(column) {
- if (column.weight) {
- weightSum += column.weight;
- } else if (column.sWidth && column.sWidth.slice(-1) === '%') {
- percentSum += parseInt(column.sWidth.slice(0, -1), 10);
- }
- });
- oSettings.aoColumns.forEach(function(column) {
- if (column.weight) {
- column.sWidth = Math.floor(column.weight / weightSum * (100 - percentSum)) + '%';
- }
- });
- },
- /**
- Executes arbitrary callbacks on each row in a column if the column defines the postprocessRowCallback function
- **/
- _handleColumnCallbacks: function(oSettings) {
- var i;
- function postProcessHelper(row) {
- oSettings.aoColumns[i].postprocessRowCallback(row, i);
- }
- for (i = 0; i < oSettings.aoColumns.length; i += 1) {
- if (oSettings.aoColumns[i].postprocessRowCallback) {
- oSettings.aoData.forEach(postProcessHelper);
- }
- }
- },
- setInStandbyMode: function(inStandbyMode) {
- this._inStandbyMode = inStandbyMode;
- },
- isInStandbyMode: function() {
- return this._inStandbyMode || this.aSelectedRows.length >= 2 ||
- (this.multiSelect && this.touchMultiSelectEnabled);
- },
- isMultitouchActive: function() {
- return this.touchMultiSelectEnabled;
- },
- setIsAccountPickerSlideout: function() {
- this._isAccountPickerSlideout = true;
- },
- isAccountPickerSlideout: function() {
- return this._isAccountPickerSlideout || false;
- },
- setShowEmptyNewFolderButton: function(bShowNewFolderLink) {
- this.showEmptyNewFolderButton = bShowNewFolderLink;
- },
- setParentHasWritePermission: function(bHasWritePermission) {
- this.parentHasWritePermission = bHasWritePermission;
- },
- selectFirstRow: function() {
- this.selectSingleRow(this.findRowNode(this.getFirstFocusElement()[0]));
- },
- /**
- Returns an object represented by the selected row
- If necessary, object is augmented with the last ancestor folder/package capability data
- **/
- getSelectedObjectFolderCapabilities: function(selectedObjects) {
- if (!selectedObjects) {
- selectedObjects = this.getSelectedObjects();
- }
- if (!this.contentView.slideout || selectedObjects.length !== 1 || UIHelper.isContainer(ContentStoreObject.getType(selectedObjects[0])) || !ContentStoreObject.getAncestors(selectedObjects[0])) {
- return Promise.resolve(selectedObjects);
- } else {
- var lastAncestor = _.last(selectedObjects[0].ancestors);
- return ContentStoreObject.getEffectiveUserCapabilities(lastAncestor, true).then(function(selectedObjects) {
- return Promise.resolve(selectedObjects);
- }.bind(this, selectedObjects));
- }
- }
- });
- return ListControl;
- });
- /**
- * Licensed Materials - Property of IBM
- * IBM Cognos Products: BI Cloud (C) Copyright IBM Corp. 2014, 2017
- * US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
- */
- define('bacontentnav/lib/gemini/app/util/View',[ 'jquery', 'underscore', 'doT', '../../../@waca/core-client/js/core-client/ui/core/Events', '../../../@waca/core-client/js/core-client/utils/EventHelper' ], function($, _, dot, Events) {
- 'use strict';
- var View = null;
- var eventsRegex = /^(\S+)\s*(.*)$/;
- // View related attributes that are supported
- var viewAttributes = ['el', 'id', 'className', 'tagName', 'events'];
- /**
- * A Backbone style base View Class. UI Views should extend this class.
- *
- */
- View = Events.extend({
- templateString: null,
- id: null,
- init: function(attributes) {
- View.inherited('init', this, arguments);
- this.viewId = _.uniqueId('view');
- this.dotTemplate = dot.template(this.templateString || '');
- _.extend(this, _.pick(attributes || {}, viewAttributes));
- this._initDomElement();
- this._attachEvents();
- },
- /**
- * The tag name given to the view's DOM element. By default it's a DIV.
- */
- tagName: 'div',
- /**
- * Initialize the DOM element for this view
- */
- _initDomElement: function() {
- if ( !this.el ) {
- var attrs = {};
- if (this.id) {
- attrs.id = _.result(this, 'id');
- }
- if (this.className) {
- attrs['class'] = _.result(this, 'className');
- }
- this.setElement(document.createElement(this.tagName));
- this.$el.attr(attrs);
- }
- else {
- this.setElement(_.result(this, 'el'));
- }
- },
- /**
- * Convenience function to use jQuery to find a DOM element within this view. This is
- * faster then doing a global lockup.
- */
- $: function(selector) {
- return this.$el.find(selector);
- },
- /**
- * Hide the view
- */
- hide: function() {
- this.$el.hide();
- },
- /**
- * Show the view if hidden
- */
- show: function() {
- this.$el.show();
- },
- /**
- * Make sure the target is the intended dom node, using CSS class to validate.
- * If not the right node, check out the parents.
- */
- getTarget: function(target, sClass) {
- var $t = $(target);
- if ( !$t.hasClass(sClass) ){
- var parents = $t.parents('.' + sClass);
- if (parents.length > 0) {
- target = parents[0];
- }
- }
- return target;
- },
- /**
- * Render is the main function of the View. Views should implement (override) the render
- * method to populate this.el with the appropriate HTML. Render should always return this
- * to allow chaining of calls.
- */
- render: function() {
- return this;
- },
- /**
- * Remove this view:
- * -Remove the element from the DOM
- * -Remove the event listeners
- */
- remove: function() {
- if (this.$el) {
- this.$el.remove();
- }
- if (this.off) {
- this.off();
- }
- return this;
- },
- /**
- * Set the view element to a new DOM element
- */
- setElement: function(el) {
- this._detachEvents();
- this.$el = el instanceof $ ? el : $(el);
- this.el = this.$el[0];
- this._attachEvents();
- return this;
- },
- /**
- * Attaches the events in this.events to this.el for this view
- */
- _attachEvents: function() {
- var events = this.events;
- this._detachEvents();
- for ( var key in events) {
- if (events.hasOwnProperty(key)) {
- var callback = events[key];
- if (!_.isFunction(callback)) {
- callback = this[events[key]];
- }
- if (!callback) {
- continue;
- }
- var match = key.match(eventsRegex);
- var eventName = match[1];
- var selector = match[2];
- // add the event to the element, with a namespace 'privateViewEvents'
- this.$el.on(eventName + '.privateViewEvents' + this.viewId, selector, callback.bind(this));
- }
- }
- return this;
- },
- /**
- * Detaches all the events from the element
- */
- _detachEvents: function() {
- if (this.$el) {
- this.$el.off('.privateViewEvents' + this.viewId);
- }
- return this;
- }
- });
- return View;
- });
- /**
- * Licensed Materials - Property of IBM
- * IBM Cognos Products: BI Cloud (C) Copyright IBM Corp. 2016, 2017
- * US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
- */
- define('bacontentnav/lib/gemini/app/ui/Toolbar',[
- '../util/View',
- 'jquery',
- 'underscore',
- '../../../@waca/core-client/js/core-client/utils/ClassFactory'
- ], function(View, $, _, ClassFactory) {
- 'use strict';
- var Toolbar = null;
- /**
- * Creates an application bar to serve as a main menu bar
- */
- Toolbar = View.extend({
- moduleMap: [],
- addItemsDeferred: null,
- init: function(options) {
- Toolbar.inherited('init', this, arguments);
- this.items = options.items;
- this.itemMap = {};
- this.readyArray = [];
- this.labelsView = false;
- },
- /**
- * Adds an item to the toolbar
- *
- * Returns a deferred object that will be resolve once the rendered item is added to the toolbar
- */
- addItem: function(itemSpec) {
- // Need to add the item to the bar before requiring a module
- var $item = $('<div>');
- this.$el.append($item);
- return this._renderItem(itemSpec, $item);
- },
- _renderItem: function(itemSpec, $item) {
- if (!itemSpec.type && !itemSpec.module) {
- itemSpec.type = 'Menu';
- }
- var module = itemSpec.type ? ('app/ui/toolbar_components/' + itemSpec.type) : itemSpec.module;
- return this._renderItemHelper(module, itemSpec, $item);
- },
- _renderItemHelper: function(module, itemSpec, $item) {
- var deferred = $.Deferred();
- this.readyArray.push(deferred.promise());
- ClassFactory.loadModule(module).then(function(Item) {
- itemSpec.el = $item;
- var item = new Item(itemSpec, this.rootMenu || this.parentView, this);
- item.render();
- this.itemMap[item.name] = item;
- deferred.resolve();
- if (item.notifyRenderComplete) {
- item.notifyRenderComplete();
- }
- }.bind(this));
- return deferred;
- },
- /**
- * Removes an item from the toolbar
- */
- removeItem: function(itemName){
- this.itemMap[itemName].remove();
- delete this.itemMap[itemName];
- },
- /**
- * Add an array of items to the toolbar
- * @param itemSpecArray
- *
- * Returns a deferred object that will be resolved when all items are rendered and added to the toolbar
- */
- addItems: function(itemSpecArray){
- var deferredArray = [];
- _.each(itemSpecArray, function(itemSpec){
- deferredArray.push(this.addItem(itemSpec));
- }.bind(this));
- this.addItemsDeferred = Promise.all(deferredArray);
- return this.addItemsDeferred;
- },
- clearItems: function(){
- _.each(this.itemMap, function(item){
- item.remove();
- }.bind(this));
- this.$el.empty();
- this.itemMap = {};
- this.readyArray = [];
- },
- /**
- * Draws the Toolbar
- */
- render: function() {
- this.$el.empty();
- if (this.items) {
- return this.addItems(this.items);
- }
- return $.Deferred().resolve().promise();
- },
- ready: function(){
- var deferred = $.Deferred();
- if (this.readyArray.length > 0){
- $.when.apply($, this.readyArray).done(function(){
- deferred.resolve();
- });
- } else {
- deferred.resolve();
- }
- return deferred.promise();
- },
- setFocus: function() {
- var first = Object.keys(this.itemMap)[0];
- if (first) {
- var focusElement = this.itemMap[first];
- if(focusElement && focusElement.setFocus) {
- focusElement.setFocus();
- }
- }
- }
- });
- return Toolbar;
- });
- define('text!bacontentnav/lib/gemini/app/ui/templates/Menu.html',[],function () { return '<div class="dropdown-toggle" id="{{=it.id}}_toggle" data-toggle="dropdown" aria-describedby="{{=it.id}}_ddtMenu" aria-label="{{!it.label}}" tabindex="0" role="button" aria-haspopup="true">\n\t{{? it.hcLabel}}\n\t\t<span class="hcLabel">{{=it.label}}</span>\n\t{{?}}\n\t{{? it.labelOnly}}\n\t\t<span id="{{=it.id}}_ddtMenu" class="menu-label">{{=it.label}}</span>\n\t{{?}}\n</div>\n<div class="arrow-wrapper">\n\t<div class="arrow"></div>\n</div>\n<ul class="dropdown-menu" id="{{=it.id}}_toggle" aria-labelledby="{{=it.id}}_toggle" role="menu">\n\t\t{{? it.showTitle}}\n\t\t<h1 role="presentation" class="dropdown-header header-{{!it.name}}">{{!it.label}}</h1>\n\t\t{{?}}\n\t\t{{~it.items :item :index}}\n\t\t\t{{? item.disabled && item.icon}}\n\t\t\t\t<li role="presentation" class="dropdown-header header-{{!item.name}} {{?item.hidden}}hidden{{?}}" aria-disabled="true" id="{{=it.id}}_{{=item.name}}">\n\t\t\t\t\t<span class="{{!item.icon}} menuitem-icon"></span>{{!item.label}}</li>\n\t\t\t{{?? item.disabled}}\n\t\t\t\t<li role="presentation" class="dropdown-header header-{{!item.name}} {{?item.hidden}}hidden{{?}}" aria-disabled="true" id="{{=it.id}}_{{=item.name}}">{{!item.label}}</li>\n\t\t\t{{??}}\n\t\t\t\t<li class="dropdown-menuitem {{=item.name}} {{?item.hidden}}hidden{{?}} propertyUIControl" id="{{=it.id}}_{{=item.name}}">\n\t\t\t\t{{? it.showTick && item.icon}}\n\t\t\t\t\t<a role="menuitemcheckbox" href="#" aria-label="{{!item.label}}" aria-checked="true" class="propertyRow {{? index=== 0}}firstMenuItem{{?}} {{? index === it.items.length - 1}}lastMenuItem{{?}}">\n\t\t\t\t\t\t{{!item.label}}\n\t\t\t\t\t</a>\n\t\t\t\t{{?? it.showTick}}\n\t\t\t\t\t<a role="menuitemcheckbox" href="#" aria-label="{{!item.label}}" aria-checked="true" class="textOnly {{? index=== 0}}firstMenuItem{{?}} {{? index === it.items.length - 1}}lastMenuItem{{?}}">\n\t\t\t\t\t\t<input type="checkbox"/>\n\t\t\t\t\t\t{{!item.label}}\n\t\t\t\t\t</a>\n\t\t\t\t{{?? it.isSort && item.icon}}\n\t\t\t\t\t<a role="menuitem" href="#" {{? index=== 0}}class="firstMenuItem"{{?}} {{? index === it.items.length - 1}}class="lastMenuItem"{{?}}>\n\t\t\t\t\t\t{{!item.label}}\n\t\t\t\t\t\t<span class="{{!item.icon}} menuitem-icon" style="display: none;">\n\t\t\t\t\t\t\t<svg class="svgIcon" aria-hidden="true"><use xlink:href="#common-previous" xmlns:xlink="http://www.w3.org/1999/xlink"></use></svg>\n\t\t\t\t\t\t</span>\n\t\t\t\t\t\t<span class="wfg_accept"></span>\n\t\t\t\t\t</a>\n\t\t\t\t{{?? it.isSort}}\n\t\t\t\t\t<a role="menuitemsort" href="#" aria-label="{{!item.label}}" class="sortMenuItem {{? index=== 0}}firstMenuItem{{?}} {{? index === it.items.length - 1}}lastMenuItem{{?}}">\n\t\t\t\t\t\t{{!item.label}}\n\t\t\t\t\t</a>\n\t\t\t\t{{?? item.icon}}\n\t\t\t\t\t<a href="#" aria-label="{{!item.label}}" {{? index=== 0}}class="firstMenuItem"{{?}} {{? index === it.items.length - 1}}class="lastMenuItem"{{?}}>\n\t\t\t\t\t\t<span class="{{!item.icon}} menuitem-icon"></span><span class="wfg_accept"></span> {{!item.label}}</a>\n\t\t\t\t{{??}}\n\t\t\t\t\t<a role="menuitem" href="#" aria-label="{{!item.label}}" class="textOnly {{? index=== 0}}firstMenuItem{{?}} {{? index === it.items.length - 1}}lastMenuItem{{?}}">{{!item.label}}</a>\n\t\t\t\t{{?}}\n\t\t{{?}}\n\t\t</li>\n\t{{~}}\n</ul>\n';});
- /**
- * Licensed Materials - Property of IBM
- * IBM Cognos Products: BI Cloud (C) Copyright IBM Corp. 2014, 2017
- * US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
- */
- define('bacontentnav/lib/gemini/app/ui/toolbar_components/Menu',[ '../../util/View', 'jquery', 'underscore', '../../../../@waca/core-client/js/core-client/utils/BidiUtil', 'text!../templates/Menu.html' ], function(View, $, _, bidi, template) {
- var MenuItem = null;
- /**
- * Represents a drop down menu that can be added to an app bar
- */
- MenuItem = View.extend({
- templateString: template,
- events: {
- 'keydown': '_handleKeyboard',
- 'click .dropdown-menuitem': '_handleClick'
- },
- itemActions: null,
- itemSpecMap: null,
- baseClass: 'toolbar',
- hcLabel: null, // create an element for high contrast label
- showTitle: true,
- /**
- * Creates a new menu item
- *
- * @param spec -
- * The menu item spec
- * @param root -
- * A reference to the root menu item, where items go if the app bar is collapsed horizontally
- */
- init: function(spec) {
- _.defaults(spec, {hcLabel: true});
- _.extend(this, spec);
- this.itemActions = {};
- this.itemSpecMap = {};
- _.each(this.items, function(item) {
- this.itemSpecMap[item.name] = item;
- }.bind(this));
- MenuItem.inherited('init', this, arguments);
- },
- _handleClick: function(event){
- event.preventDefault();
- this._performAction(event.currentTarget.id);
- },
- _performAction: function(id) {
- var action = this.itemActions[id];
- if (action){
- // Delay the action slightly to allow bootstrap to close the menu before
- // the action is fired
- setTimeout(function() {
- action();
- }, 10);
- }
- },
- /**
- * Removes a menu item
- */
- removeItem: function(name){
- var id = this.viewId + '_' + name;
- this.$menu.children('#' + id).remove();
- delete this.itemSpecMap[name];
- delete this.itemActions[id];
- },
- addDivider: function() {
- var divider = $('<li role="presentation" class="divider">');
- this.$menu.append(divider);
- return divider;
- },
- /**
- * Adds a new menu item to the drop down
- */
- addItem: function(item) {
- this.itemSpecMap[item.name] = item;
- var menuItem = $('<li id="' + this._getItemId(item.name) + '">');
- var action = null;
- if (item.checked) {
- action = $('<a role="menuitem" href="#" aria-label="' + item.label + '" aria-checked="true" class="menuitem-toggled">' + item.label + '</a>');
- }
- else {
- action = $('<a role="menuitem" href="#" aria-label="' + item.label + '" aria-checked="false">' + item.label + '</a>');
- }
- menuItem.append(action);
- menuItem.addClass('dropdown-menuitem');
- menuItem.addClass(item.name);
- this.$menu.append(menuItem);
- this._buildMenuItem(item);
- return menuItem;
- },
- showItem: function(name){
- this.$menu.find('.'+ name).removeClass('hidden');
- },
- hideItem: function(name){
- this.$menu.find('.' + name).addClass('hidden');
- },
- _handleKeyboard: function(e) {
- var keyCode = e.which || e.keyCode || e.charCode;
- var $target = $(e.target);
- var $nextFocus;
- switch (keyCode) {
- case 9: //tabkey
- if (e.shiftKey) {
- if ($target.hasClass("firstMenuItem")){
- $nextFocus = $target.closest("ul").find("a.lastMenuItem");
- $nextFocus.focus();
- e.preventDefault();
- }
- } else {
- if ($target.hasClass('lastMenuItem')) {
- $nextFocus = $target.closest("ul").find("a.firstMenuItem");
- $nextFocus.focus();
- e.preventDefault();
- }
- }
- break;
- case 13: // enter key
- case 32: // space
- e.preventDefault();
- this.$toggle.dropdown('toggle');
- if ($(e.target).hasClass('dropdown-toggle')) {
- var first = this.$el.find('.dropdown-menu a').first();
- first.focus();
- } else {
- var currentItem = this.getTarget(e.target, 'dropdown-menuitem');
- this._performAction(currentItem.id);
- }
- break;
- case 37: // left arrow
- case 39: // right arrow
- if ($(e.target.parentNode).hasClass('dropdown-menuitem')) {
- var downKeyEvt = _.clone(e);
- downKeyEvt.keyCode = keyCode + 1; // left to up arrow: 38, right to down arrow:40;
- $(e.target).trigger(downKeyEvt); // delegate to bootstrap
- }
- break;
- default:
- break;
- }
- },
- _templateParams: function() {
- return {
- id: this.viewId,
- items: this.items,
- label: this.label,
- icon: this.icon,
- hcLabel: this.hcLabel,
- baseClass: this.baseClass,
- labelOnly: this.labelOnly,
- showTitle: this.showTitle
- };
- },
- /**
- * Draws the MenuItem
- */
- render: function() {
- var sHtml = this.dotTemplate( this._templateParams() );
- this.$el.append(sHtml);
- this.$el.addClass(this.baseClass + 'ItemWrapper');
- this.$el.addClass('dropdown');
- this.$toggle = this.$el.children('.dropdown-toggle');
- this.$toggle.addClass(this.baseClass + 'Icon');
- this.$iconImage = $('<span class="' + this.icon + '"></span>');
- if (this.icon) {
- this.$toggle.prepend(this.$iconImage);
- }
- this.$toggle.attr('title', this.label);
- this.$toggle.addClass(this.baseClass + 'Item');
- this.$menu = this.$el.children('.dropdown-menu');
- if (this.trailing) {
- this.$menu.addClass('dropdown-menu-right');
- }
- var promise = this._buildDropDown();
- this.$menuLabel = this.$el.find('.menu-label');
- return promise;
- },
- _buildDropDown: function() {
- var deferred = $.Deferred();
- require([ 'bsdropdown' ], function() {
- this.$toggle.dropdown();
- /**
- * A callback can be passed to opening behavior
- */
- if (this.action) {
- this.$el.on('show.bs.dropdown', this.action.bind(this));
- }
- this._buildMenuItems();
- deferred.resolve(this.$el);
- }.bind(this));
- return deferred.promise();
- },
- _buildMenuItems: function() {
- _.each(this.items, function(item) {
- this._buildMenuItem(item);
- }.bind(this));
- },
- _getItemId: function(name) {
- return this.viewId + '_' + name;
- },
- _buildMenuItem: function(item) {
- var itemID = this._getItemId(item.name);
- this.itemActions[itemID] = item.action;
- var itemNode = $('#' + itemID);
- var elem = itemNode.get(0);
- if (elem) {
- bidi.initElementForBidi(elem);
- }
- }
- });
- return MenuItem;
- });
- /**
- * Licensed Materials - Property of IBM
- * IBM Cognos Products: BI Cloud (C) Copyright IBM Corp. 2014, 2015, 2017
- * US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
- */
- define('bacontentnav/lib/gemini/app/ui/toolbar_components/Button',[
- '../../util/View',
- 'underscore',
- '../../../../@waca/core-client/js/core-client/utils/Utils'
- ], function(View, _, CommonsUtils) {
- 'use strict';
- var Button = null;
- /**
- * Represents a drop down menu that can be added to an app bar
- */
- Button = View.extend({
- events: {
- 'primaryaction' : '_handleClick',
- 'mousedown': '_handleStartDrag',
- 'dragdown': '_handleStartDrag'
- },
- baseClass: 'toolbar',
- /**
- * Creates a new menu item
- *
- * @param spec -
- * The menu item spec
- * @param root -
- * A reference to the root menu item, where items go if the app bar is collapsed horizontally
- */
- init: function(spec, parentItem, toolbar) {
- this.group = null; //group can be set for sets of buttons that act as states of an action
- this.selected = false;
- this.toolbar = toolbar;
- _.extend(this, spec);
- Button.inherited('init', this, arguments);
- },
- _handleClick: function () {
- if (this.$('button').prop('disabled')){
- return;
- }
- var dfd = null;
- if (this.action) {
- dfd = this.action.apply(this, arguments);
- }
- if (this.arrow && dfd && dfd.then) {
- dfd.then( this.$el.addClass.bind(this.$el, 'open') );
- }
- if (this.$('button').prop('update')){
- this.toolbar.updateButtons();
- }
- },
- _handleStartDrag: function(){
- if (this.$('button').prop('disabled')){
- return;
- }
- if (this.startDrag) {
- this.startDrag.apply(this, arguments);
- }
- },
- /**
- * Draws the MenuItem
- */
- render: function() {
- var $button;
- if (this.text) {
- $button = $('<button>' + this.text + '</button>');
- } else {
- $button = $('<button></button>');
- }
- // Sets the attribute only if value is defined. Helper to reduce complexity while doing validation.
- var _setAttr = function(sAttr, sValue) {
- if (sValue) {
- $button.attr(sAttr, sValue);
- }
- };
- // Adds the sClassname if it's defined to the element. Helper to reduce complexity while doing validation.
- var _addClass = function($el, className) {
- if (className) {
- $el.addClass(className);
- }
- };
- _setAttr('title', this.label);
- if(this.icon) {
- CommonsUtils.setIcon($button, this.icon, this.label, this.label);
- }
- else{
- _setAttr('aria-label', this.label);
- }
- _addClass($button, this.className);
- _setAttr('id', this.id);
- _setAttr('accesskey', this.accesskey);
- if (typeof this.disabled === "function") {
- if(this.disabled()===true){
- $button.prop('disabled', true);
- }
- }else if(this.disabled === true){
- $button.prop('disabled', true);
- }
- if (typeof this.update === "function") {
- if(this.update()===true){
- $button.prop('update', true);
- }
- }else if(this.update === true){
- $button.prop('update', true);
- }
- if (this.hidden) {
- this.$el.hide();
- }
- this.$el
- .empty()
- .addClass(this.baseClass + 'Icon ' + this.baseClass + 'Item')
- .prepend( $button );
- if (this.selected) {
- this.$el.addClass('selected');
- }
- _addClass(this.$el, this.group);
- if (this.arrow) {
- this.$el.append( $('<div class="arrow-wrapper"><div class="arrow"></div></div>') );
- }
- return this;
- },
- setFocus: function(){
- this.$('button').focus();
- }
- });
- return Button;
- });
- define('text!bacontentnav/lib/gemini/app/ui/templates/ApplicationBar.html',[],function () { return '<div id="{{=it.id}}" class="appbar" role="menubar">\n\t<div class="appbarRow">\n\t\t{{? it.showHome}}\n\t\t<div class="appbarHome" id="{{=it.id}}_home"></div>\n\t\t{{?}}\n\t\t<div class="appbarLeading" id="{{=it.id}}_leading"></div>\n\t\t<div class="appbarCenter" id="{{=it.id}}_center"></div>\n\t\t<div class="appbarTrailing" id="{{=it.id}}_trailing"></div>\n\t\t<div class="appbarOverflow" id="{{=it.id}}_root"></div>\n\t\t<div class="appbarProfile" id="{{=it.id}}_profile"></div>\n\t</div>\n</div>\n<div id="{{=it.id}}_subbar" class="subbar">\n</div>\n';});
- /**
- * Licensed Materials - Property of IBM
- * IBM Cognos Products: BI Cloud (C) Copyright IBM Corp. 2014
- * US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
- */
- define('bacontentnav/lib/gemini/app/ui/ApplicationBar',[ './Toolbar', 'jquery', './toolbar_components/Menu', './toolbar_components/Button', 'text!./templates/ApplicationBar.html', '../nls/StringResources' ],
- function(Toolbar, $, Menu, Button, template, resources) {
- var ApplicationBar = null;
- var WEBFONT_USER_ICON = 'wfg_user';
- /**
- * A variation of the toolbar to represent the application main bar.
- */
- ApplicationBar = Toolbar.extend({
- templateString: template,
- moduleMap: [],
- defaultHeight: 70,
- smallHeight: 45,
- init: function(options) {
- ApplicationBar.inherited('init', this, arguments);
- this.profile = options.profile;
- this.rootItems = options.rootItems;
- this.authURL = options.authURL;
- this.logoutUrl = options.logoutUrl;
- this.appController = options.appController;
- this.config = options.appBarConfig || {showHome: true, showLogout: true};
- this.hasCollapsedItems = false;
- this.onHide = options.onHide;
- this.onShow = options.onShow;
- // add keydown handler
- this._onKeyHandle = $('html').on('keydown.ApplicationBar', this.onKeydown.bind(this));
- },
- /**
- * Handle keydown event
- * @return void
- */
- onKeydown: function( event ){
- // trap the F10 keydown event and focus the home button
- if( event.keyCode === 121 ){
- // if there is a home button then give it focus
- if( this.homeButton ){
- this.homeButton.$el.find( 'button' ).focus();
- }
- // stop propagation
- event.stopPropagation();
- // must return false to prevent browser F10 interaction
- return false;
- }
- },
- /**
- * Clean up event handlers
- * @return void
- */
- remove: function() {
- this._onKeyHandle.off();
- this._onKeyHandle = null;
- ApplicationBar.inherited('remove', this, arguments);
- },
- /**
- * Adds an item to the application bar
- */
- addItem: function(itemSpec) {
- // Need to add the item to the bar before requiring a module
- var deferred = null;
- var $item = $('<div>');
- if (itemSpec.position === 'trailing') {
- this.$trailingActions.append($item);
- }
- else if (itemSpec.position === 'center') {
- this.$centerActions.append($item);
- }
- else {
- this.$leadingActions.append($item);
- }
- itemSpec.baseClass = 'appbar';
- deferred = this._renderItem(itemSpec, $item);
- if (!itemSpec.supportCustomCollapse) {
- this._buildCollapsedItem(itemSpec, $item);
- }
- return deferred;
- },
- /**
- * Add a list root items to the application bar root menu
- */
- addRootItems: function(items) {
- if (items){
- this.rootMenu.$el.removeClass('visible-xs');
- }
- _.each(items, function(item) {
- this.rootItems[item.name] = item;
- this.rootMenu.addItem(item);
- }.bind(this));
- },
- /**
- * Clears all items except those from the root and profile menu. Collapsed root items will be removed
- */
- clearItems: function() {
- _.each(this.itemMap, function(item) {
- this.removeItem(item.name);
- }.bind(this));
- this.$leadingActions.empty();
- this.$trailingActions.empty();
- this.itemMap = {};
- },
- removeItem: function(itemName) {
- this._removeSubSection(itemName);
- var item = this.itemMap[itemName];
- if (item.items) {
- _.each(item.items, function(subItem) {
- this.rootMenu.removeItem(subItem.name);
- }.bind(this));
- }
- else {
- this.rootMenu.removeItem(itemName);
- }
- ApplicationBar.inherited('removeItem', this, arguments);
- },
- clearRootItems: function() {
- this.rootMenu.$el.addClass('visible-xs');
- _.each(this.rootItems, function(item) {
- this.removeRootItem(item.name);
- }.bind(this));
- this.rootItems = {};
- },
- removeRootItem: function(itemName) {
- this.rootMenu.removeItem(itemName);
- delete this.rootItems[itemName];
- },
- getAddedItem: function(itemName) {
- return this.addItemsDeferred.then(function() {
- if (this.itemMap[itemName]) {
- return Promise.resolve(this.itemMap[itemName]);
- } else {
- return Promise.reject();
- }
- }.bind(this));
- },
- _buildCollapsedItem: function(itemSpec, $item) {
- itemSpec.responsive = (itemSpec.responsive === undefined) ? true : itemSpec.responsive;
- if (itemSpec.responsive) {
- if (!this.hasCollapseItems){
- this.hasCollapseItems = true;
- this._addRootMenuDivider();
- }
- $item.addClass('hidden-xs');
- if (itemSpec.items) {
- this._addSubSection(itemSpec);
- }else if (itemSpec.type === 'Separator'){
- this._addRootMenuDivider();
- }
- else {
- var $subItem = this.rootMenu.addItem(itemSpec, true);
- $subItem.addClass('visible-xs');
- }
- }
- },
- _removeSubSection: function(name) {
- this.rootMenu.$menu.children('.header-' + name).remove();
- },
- _addRootMenuDivider: function(){
- // Don't add a second divider if there is a divider already
- if (!this.rootMenu.$menu.children().last().hasClass('divider')) {
- var divider = this.rootMenu.addDivider();
- divider.addClass('visible-xs');
- return divider;
- }
- return null;
- },
- _addSubSection: function(itemSpec) {
- var rootMenuHeader = $('<li role="presentation" class="dropdown-header header-' + itemSpec.name + '">' + itemSpec.label + '</li>');
- rootMenuHeader.addClass('visible-xs');
- var divider = this._addRootMenuDivider();
- if (divider){
- // This class allows the divider to be removed when the section is removed
- divider.addClass('header-' + itemSpec.name );
- }
- this.rootMenu.$menu.append(rootMenuHeader);
- _.each(itemSpec.items, function(subItem) {
- this.rootMenu.addItem(subItem).addClass('visible-xs');
- }.bind(this));
- divider =this._addRootMenuDivider();
- if (divider){
- divider.addClass('header-' + itemSpec.name );
- }
- },
- /**
- * Draws the AppBar
- */
- render: function() {
- var sHtml = this.dotTemplate({
- id: this.viewId,
- showHome: this.config.showHome
- });
- this.$el.html(sHtml);
- var deferred = $.Deferred();
- this._createRootMenu().done(function(){
- if(this.config.showHome) {
- this._createHomeButton();
- }
- this._createProfileMenu().then(function(){
- this.$leadingActions = $('#' + this.viewId + '_leading');
- this.$trailingActions = $('#' + this.viewId + '_trailing');
- this.$centerActions = $('#' + this.viewId + '_center');
- this.addItems(this.items).done( function() {
- if(_.isEmpty(this.rootMenu.itemActions) ) {
- this.rootMenu.$el.removeClass('visible-xs');
- this.rootMenu.$el.hide();
- }
- deferred.resolve(this);
- }.bind(this));
- }.bind(this));
- }.bind(this));
- return deferred.promise();
- },
- _createHomeButton: function(){
- var $itemEl = $('<div></div>');
- $('#' + this.viewId + '_home').append($itemEl);
- var spec = {
- name: 'home',
- label: resources.get('rootMenuTitle'),
- type: 'Button',
- el: $itemEl,
- icon: 'wfg_gemini',
- baseClass: 'appbar',
- action: this._goHomeAction.bind(this)
- };
- this.homeButton = new Button(spec);
- this.homeButton.render();
- },
- _goHomeAction: function () {
- if(this.config.showHome) {
- this.appController.goHome();
- this.homeButton.$el.find('button').blur();
- }
- },
- /**
- * Creates the root (i.e. hamburger) menu. Besides holding root items, when the app bar is small horizontally actions will be collapsed to this menu
- */
- _createRootMenu: function() {
- var $itemEl = $('<div></div>');
- $('#' + this.viewId + '_root').append($itemEl);
- var spec = {
- name: 'mainMenu',
- label: resources.get('rootMenuTitle'),
- type: 'Menu',
- el: $itemEl,
- icon: 'wfg_menuoverflow',
- trailing: true,
- baseClass: 'appbar',
- items: this.rootItems
- };
- this.rootMenu = new Menu(spec);
- var promise = this.rootMenu.render();
- if (!this.rootItems || this.rootItems.length === 0 ){
- this.rootMenu.$el.addClass('visible-xs');
- }
- return promise;
- },
- _createProfileMenu: function() {
- if (!this.profile || !this.config.showLogout) {
- return $.Deferred().resolve().promise();
- }
- var $itemEl = $('<div></div>');
- $('#' + this.viewId + '_profile').append($itemEl);
- var spec = {
- name: 'profileMenu',
- label: this.profile.displayName,
- hcLabel: false,
- type: 'Menu',
- el: $itemEl,
- icon: 'profileIcon',
- baseClass: 'appbar',
- trailing: true,
- items: [ {
- name: 'logout',
- label: 'Logout',
- action: this._logout.bind(this)
- } ]
- };
- this.profileMenu = new Menu(spec);
- var promise = this.profileMenu.render();
- var bHighContrast = $(document.body).hasClass('highcontrast'),
- bUseBadge = this.profile._attachmentInfo && this.profile._attachmentInfo.badge;
- if (!bHighContrast && bUseBadge) {
- var badgeURL = '/app/account/' + this.profile._meta.bundleID + '/badge';
- this.profileMenu.$iconImage.css('backgroundImage', 'url(\'' + badgeURL + '\')');
- }
- else {
- this.profileMenu.$iconImage.addClass(WEBFONT_USER_ICON);
- }
- return promise;
- },
- _logout: function() {
- window.location.href = this.logoutUrl;
- },
- show: function() {
- $(this.$el).find('.appbar').show();
- },
- hide: function() {
- $(this.$el).find('.appbar').hide();
- }
- });
- return ApplicationBar;
- });
- /*
- *+------------------------------------------------------------------------+
- *| Licensed Materials - Property of IBM
- *| IBM Cognos Products: Content Explorer
- *| (C) Copyright IBM Corp. 2015, 2018
- *|
- *| US Government Users Restricted Rights - Use, duplication or disclosure
- *| restricted by GSA ADP Schedule Contract with IBM Corp.
- *+------------------------------------------------------------------------+
- */
- define('bacontentnav/common/ui/ContentBar',[
- 'require',
- '../../lib/gemini/app/ui/ApplicationBar'
- ], function(LocalRequire, ApplicationBar) {
- 'use strict';
- var ContentBar = ApplicationBar.extend({
- /**
- * #gemini: overriding the render() as 'options.profile' is assumed to be always available
- * and it is not in this case.
- */
- render: function() {
- var sHtml = this.dotTemplate({
- 'id': this.viewId
- });
- this.$el.html(sHtml);
- return this._createRootMenu().then(function() {
- this.$leadingActions = $('#' + this.viewId + '_leading');
- this.$trailingActions = $('#' + this.viewId + '_trailing');
- this.$centerActions = $('#' + this.viewId + '_center');
- return this.addItems(this.items).then(function() {
- if (($(this.el).find('.appbarLeading').children()).length === 0) {
- $(this.el).find('.appbarLeading').append(this.items[0].el);
- }
- $(this.el).find('.appbarLeading').children().addClass('contentBarItem');
- $(this.el).find('.appbarCenter').children().addClass('contentBarItem');
- $(this.el).find('.appbarTrailing').children().addClass('contentBarItem');
- this.resize();
- return this;
- }.bind(this));
- }.bind(this));
- },
- resize: function() {
- if (this.itemMap.breadcrumbs) {
- this.itemMap.breadcrumbs.resize();
- }
- },
- /* override Gemini's show/hide as it does not show/hide the entire bar div element */
- hide: function() {
- if (this.onHide) {
- this.onHide();
- }
- this.$el.hide();
- },
- show: function() {
- if (this.onShow) {
- this.onShow();
- }
- this.$el.show();
- },
- isVisible: function() {
- return this.$el[0].style.display !== 'none';
- },
- _renderItem: function(itemSpec, $item) {
- if (!itemSpec.type && !itemSpec.module) {
- itemSpec.type = 'Menu';
- }
- var module = itemSpec.type ? ('../../lib/gemini/app/ui/toolbar_components/' + itemSpec.type) : itemSpec.module;
- return this._renderItemHelper(module, itemSpec, $item);
- },
- _loadModule: function(moduleId) {
- return new Promise(function(resolve, reject) {
- if (typeof moduleId === 'function') {
- resolve(moduleId);
- } else {
- return LocalRequire([moduleId], function(Module) {
- if (Module) {
- resolve(Module);
- } else {
- reject(new Error('No module found'));
- }
- }.bind(this));
- }
- }.bind(this));
- },
- _renderItemHelper: function(module, itemSpec, $item) {
- var promise = this._loadModule(module).then(function(Item) {
- itemSpec.el = $item;
- var item = new Item(itemSpec, this.rootMenu || this.parentView, this);
- item.render();
- this.itemMap[item.name] = item;
- if (item.notifyRenderComplete) {
- item.notifyRenderComplete();
- }
- }.bind(this));
- this.readyArray.push(promise);
- return promise;
- }
- });
- return ContentBar;
- });
- /*
- *+------------------------------------------------------------------------+
- *| Licensed Materials - Property of IBM
- *| IBM Cognos Products: Content Explorer
- *| (C) Copyright IBM Corp. 2016
- *|
- *| US Government Users Restricted Rights - Use, duplication or disclosure
- *| restricted by GSA ADP Schedule Contract with IBM Corp.
- *+------------------------------------------------------------------------+
- */
- define('bacontentnav/utils/A11YHelper',[], function() {
- 'use strict';
- var _singletonInstance = null;
- var A11YHelper = function() {
- this.SCREENREADER_ALERT_ID = 'ca_screenreader_alert';
- };
- A11YHelper.prototype.screenReaderAlertUser = function(sMessage) {
- if (!sMessage || !sMessage.length) {
- return;
- }
- var $divElem = $('#' + this.SCREENREADER_ALERT_ID);
- if ($divElem.length) {
- $divElem.remove();
- }
- $divElem = $('<div>', {
- 'id': this.SCREENREADER_ALERT_ID,
- 'style': 'position:absolute; top:-9000px;',
- 'role': 'alert'
- });
- $divElem.text(sMessage);
- $('body').append($divElem);
- };
- var _static = {
- getInstance: function() {
- if (!_singletonInstance) {
- _singletonInstance = new A11YHelper();
- }
- return _singletonInstance;
- }
- };
- return _static.getInstance();
- });
- /*
- *+------------------------------------------------------------------------+
- *| Licensed Materials - Property of IBM
- *| IBM Cognos Products: Content Explorer
- *| (C) Copyright IBM Corp. 2016
- *|
- *| US Government Users Restricted Rights - Use, duplication or disclosure
- *| restricted by GSA ADP Schedule Contract with IBM Corp.
- *+------------------------------------------------------------------------+
- */
- define('bacontentnav/utils/BaseNavigatorPlugin',[
- '../lib/@waca/core-client/js/core-client/ui/core/Class',
- 'underscore'
- ], function(Class, _) {
- 'use strict';
- var BaseNavigatorPlugin = Class.extend({
- init: function(options) {
- BaseNavigatorPlugin.inherited('init', this, arguments);
- _.extend(this, options);
- this.focusElmentContainer = '_need to override this';
- },
- upPressed: function(srcEl, nonPrintKeyStatus) { void(nonPrintKeyStatus); },
- downPressed: function(srcEl, nonPrintKeyStatus) { void(nonPrintKeyStatus); },
- rightPressed: function(srcEl, nonPrintKeyStatus) { void(nonPrintKeyStatus); },
- leftPressed: function(srcEl, nonPrintKeyStatus) { void(nonPrintKeyStatus); },
- escPressed: function(srcEl, nonPrintKeyStatus) { void(nonPrintKeyStatus); },
- tabPressed: function(srcEl, nonPrintKeyStatus) { void(nonPrintKeyStatus); }
- });
- return BaseNavigatorPlugin;
- });
- /*
- *+------------------------------------------------------------------------+
- *| Licensed Materials - Property of IBM
- *| IBM Cognos Products: Content Explorer
- *| (C) Copyright IBM Corp. 2015, 2017
- *|
- *| US Government Users Restricted Rights - Use, duplication or disclosure
- *| restricted by GSA ADP Schedule Contract with IBM Corp.
- *+------------------------------------------------------------------------+
- */
- define('bacontentnav/utils/TableNavigatorPlugin',[
- './BaseNavigatorPlugin',
- 'underscore'
- ], function(BaseNavigatorPlugin, _) {
- 'use strict';
- var TableNavigatorPlugin = BaseNavigatorPlugin.extend({
- init: function(options) {
- TableNavigatorPlugin.inherited('init', this, arguments);
- _.extend(this, options);
- this.focusElmentContainer = 'td';
- this.actionMode = false;
- },
- spacePressed: function(srcEl) {
- var focList = this.navObj.getFocusableItemsList($(srcEl));
- if (focList.length === 1 && !$(srcEl).hasClass('newFolderRow') || $(srcEl).hasClass('ellipsesButton_cell') || $(srcEl).hasClass('nowrap multiProp')) {
- $(focList[0]).focus();
- return false;
- } else {
- return true;
- }
- },
- enterPressed: function(srcEl) {
- var $srcEl = $(srcEl);
- var focList;
- if ((!this.actionMode) && ($srcEl.prop('tagName') === 'TD')) {
- focList = this.navObj.getFocusableItemsList($srcEl);
- if (focList.length === 1) {
- //if ther is only one item them simulate a click to that item
- focList.trigger('click');
- return false;
- } else if (focList.length > 0) {
- //more then one item the just focus to the first one
- this.actionMode = true;
- this.enableCellContentTabCycling(focList);
- $(focList[0]).focus();
- return false;
- }
- } else {
- this.actionMode = false;
- focList = this.navObj.getFocusableItemsList($srcEl.closest('td'));
- this.disableCellContentTabCycling(focList);
- return true;
- }
- },
- disableCellContentTabCycling: function(focList) {
- var tr = $(focList).closest('tr');
- setTimeout(function() { tr.removeClass('actionMode'); }, 100);
- $(focList[0]).removeClass('tabCycleStart').removeClass('innerText');
- $(focList[focList.length - 1]).removeClass('tabCycleEnd').removeClass('innerText');
- focList.toArray().forEach(function(item) {
- $(item).attr('tabindex', '-1');
- });
- },
- enableCellContentTabCycling: function(focList) {
- $(focList).closest('tr').addClass('actionMode');
- $(focList[0]).addClass('tabCycleStart').addClass('innerText');
- $(focList[focList.length - 1]).addClass('tabCycleEnd').addClass('innerText');
- focList.toArray().forEach(function(item) {
- $(item).attr('tabindex', '0');
- });
- },
- escPressed: function(srcEl) {
- if (this.actionMode) {
- var $srcEl = $(srcEl);
- this.actionMode = false;
- var focList = this.navObj.getFocusableItemsList($srcEl);
- this.disableCellContentTabCycling(focList);
- var $currentTd = $($(srcEl).closest('td')[0]);
- $currentTd.focus();
- return false;
- }
- return true;
- },
- tabPressed: function(srcEl, nonPrintKeyStatus) {
- if (this.actionMode) {
- var $srcEl = $(srcEl);
- var $currentTd;
- if (($srcEl.hasClass('tabCycleEnd')) && (!nonPrintKeyStatus.isShiftKeyPressed)) {
- $currentTd = $($(srcEl).closest('td')[0]);
- $currentTd.find('.tabCycleStart').focus();
- return false;
- } else if (($srcEl.hasClass('tabCycleStart')) && (nonPrintKeyStatus.isShiftKeyPressed)) {
- $currentTd = $($(srcEl).closest('td')[0]);
- $currentTd.find('.tabCycleEnd').focus();
- return false;
- } else {
- return true;
- }
- } else {
- return true;
- }
- },
- upPressed: function(srcEl) {
- if (!this.actionMode) {
- var $trEl = $($(srcEl).closest('tr')[0]);
- var nextTr = $trEl.prev('tr');
- this._processUpDownMove(srcEl, $trEl, nextTr);
- }
- return true;
- },
- _processUpDownMove: function(srcEl, $trEl, nextTr) {
- var $currentTd = $($(srcEl).closest('td')[0]);
- var nextTD = $(nextTr).children()[$currentTd.index()];
- this.navObj.changeFocusFrom($(srcEl), $currentTd, $(nextTD));
- },
- downPressed: function(srcEl) {
- if (!this.actionMode) {
- var $trEl = $($(srcEl).closest('tr')[0]);
- var nextTr = $trEl.next('tr');
- this._processUpDownMove(srcEl, $trEl, nextTr);
- }
- return true;
- },
- rightPressed: function(srcEl) {
- if (!this.actionMode) {
- var $currentTd = $($(srcEl).closest('td')[0]);
- var nextTD = $currentTd.next('td');
- var focusElFound = false;
- while (nextTD.length > 0 && !focusElFound) {
- focusElFound = this.navObj.changeFocusFrom($(srcEl), $currentTd, $(nextTD));
- nextTD = nextTD.next('td');
- }
- }
- return true;
- },
- leftPressed: function(srcEl) {
- if (!this.actionMode) {
- var $currentTd = $($(srcEl).closest('td')[0]);
- var nextTD = $currentTd.prev('td');
- var focusElFound = false;
- while (nextTD.length > 0 && !focusElFound) {
- focusElFound = this.navObj.changeFocusFrom($(srcEl), $currentTd, $(nextTD));
- nextTD = nextTD.prev('td');
- }
- }
- return true;
- }
- });
- return TableNavigatorPlugin;
- });
- /*
- *+------------------------------------------------------------------------+
- *| Licensed Materials - Property of IBM
- *| IBM Cognos Products: Content Explorer
- *| (C) Copyright IBM Corp. 2015, 2017
- *|
- *| US Government Users Restricted Rights - Use, duplication or disclosure
- *| restricted by GSA ADP Schedule Contract with IBM Corp.
- *+------------------------------------------------------------------------+
- */
- define('bacontentnav/utils/ListControlWidgetNavigator',[
- './TableNavigatorPlugin'
- ], function(TableNavigatorPlugin) {
- 'use strict';
- var ListControlWidgetNavigator = TableNavigatorPlugin.extend({
- upPressed: function(srcEl, options) {
- options.closestTr = $(srcEl).closest('tr');
- this._processEvent(options);
- ListControlWidgetNavigator.inherited('upPressed', this, arguments);
- },
- downPressed: function(srcEl, options) {
- options.closestTr = $(srcEl).closest('tr');
- this._processEvent(options);
- ListControlWidgetNavigator.inherited('downPressed', this, arguments);
- },
- _processEvent: function(options) {
- try {
- options._keyDownEvent.preventDefault();
- var dt = (this.navObj.$el.length === 1) ? this.navObj.$el : $(this.navObj.$el[1]);
- this._totalRecords = this._totalRecords || dt.DataTable().page.info().recordsTotal;
- this._lastRenderedRow = dt.find('tr:last').index() + 1;
- this.fCallBack({
- dataTable: dt,
- currentRow: options.closestTr,
- lastRenderedRow: this._lastRenderedRow,
- dTTotalRecords: this._totalRecords
- });
- } catch (error) {
- window.console.error('Expecting _keyDownEvent to be here.');
- window.console.error(error);
- }
- }
- });
- return ListControlWidgetNavigator;
- });
- /*
- *+------------------------------------------------------------------------+
- *| Licensed Materials - Property of IBM
- *| IBM Cognos Products: Content Explorer
- *| (C) Copyright IBM Corp. 2016
- *|
- *| US Government Users Restricted Rights - Use, duplication or disclosure
- *| restricted by GSA ADP Schedule Contract with IBM Corp.
- *+------------------------------------------------------------------------+
- */
- define('bacontentnav/utils/WidgetNavigator',[
- '../lib/@waca/core-client/js/core-client/ui/core/Class',
- '../lib/@waca/core-client/js/core-client/ui/KeyCodes',
- './TableNavigatorPlugin',
- './ListControlWidgetNavigator',
- 'underscore'
- ], function(Class, KeyCodes, TableNavigatorPlugin, ListControlWidgetNavigator, _) {
- 'use strict';
- /***
- handlers are plugable classes that must implement the following api:
- focusElmentContainer property representing the element name of the element that contains all the focusable elements within a cell
- upPressed - method respond to up key navigations return true if the press should continue propagation false if the press should not
- downPressed - method respond to down key navigation return true if the press should continue propagation false if the press should not
- rightPressed - method respond to right key navigation return true if the press should continue propagation false if the press should not
- leftPressed - method respond to left key navigation return true if the press should continue propagation false if the press should not
- enterPressed - method respond to enter key return true if the press should continue propagation false if the press should not
- Note that upper case must be used for the handlerMap key
- **/
- var handlerMap = {
- 'TABLE': TableNavigatorPlugin,
- 'LISTCONTROL': ListControlWidgetNavigator
- };
- var WidgetNavigator = Class.extend({
- /**
- options.$el - containing element of the widget
- options.focusClass - class used to find focusable elements
- **/
- init: function(options) {
- WidgetNavigator.inherited('init', this, arguments);
- _.extend(this, options);
- var elName = this.$el.prop('tagName');
- var elClassName = this.$el.prop('className');
- var elClassNameList = [];
- if (elClassName !== undefined) {
- elClassNameList = this.$el.prop('className').split(' ');
- }
- for (var index = 0; index < elClassNameList.length; index += 1) {
- var currentClass = elClassNameList[index].toUpperCase();
- if (handlerMap[currentClass]) {
- this.handler = new handlerMap[currentClass];
- this.handler.fCallBack = this.fCallBack || undefined;
- this.fCallBack = undefined;
- break;
- }
- }
- if (this.handler === undefined) {
- var handConst = handlerMap[elName];
- if (handConst) {
- this.handler = new handConst;
- } else {
- //if the handler is still undefined then just create a table handler by default
- this.handler = new TableNavigatorPlugin();
- }
- }
- this.handler.navObj = this;
- this.setInitialTabIndex();
- this.installKeyHandler();
- },
- installKeyHandler: function() {
- this.$el.on('keydown keyup', this._keyHandler.bind(this));
- },
- _keyHandler: function(evt) {
- var sourceEl = evt.target;
- var result = true;
- var options = {};
- options.isShiftKeyPressed = evt.shiftKey;
- options._keyDownEvent = (_.isFunction(this.handler.fCallBack)) ? evt : undefined;
- if (evt.type === 'keyup') {
- switch (evt.which) {
- case KeyCodes.ESCAPE:
- // Escape has to be on keyup in order to prevent the default functionality of closing the slideout
- result = this.handler.escPressed(sourceEl, options);
- break;
- default:
- }
- } else {
- switch (evt.which) {
- case KeyCodes.UP_ARROW:
- result = this.handler.upPressed(sourceEl, options);
- break;
- case KeyCodes.DOWN_ARROW:
- result = this.handler.downPressed(sourceEl, options);
- break;
- case KeyCodes.LEFT_ARROW:
- result = this.handler.leftPressed(sourceEl, options);
- break;
- case KeyCodes.SPACE:
- result = this.handler.spacePressed(sourceEl);
- break;
- case KeyCodes.RIGHT_ARROW:
- result = this.handler.rightPressed(sourceEl, options);
- break;
- case KeyCodes.ENTER:
- result = this.handler.enterPressed(sourceEl, options);
- break;
- case KeyCodes.TAB:
- result = this.handler.tabPressed(sourceEl, options);
- break;
- default:
- }
- }
- if (!result) {
- evt.preventDefault();
- }
- if (evt.which === KeyCodes.RIGHT_ARROW) {
- evt.preventDefault();
- }
- return result;
- },
- getFocusableItemsList: function($parentNode) {
- if ($parentNode.children().length === 0) {
- if ($parentNode.hasClass(this.focusClass)) {
- return $parentNode;
- } else {
- return $();
- }
- } else {
- return $parentNode.find('.' + this.focusClass);
- }
- },
- _updateTabIndeciesFor: function($oldParent, $newParent) {
- if ($oldParent) {
- $oldParent.attr('tabindex', '-1');
- }
- $newParent.attr('tabindex', '0');
- },
- /* $srcEl is the element that currently has the focus
- $oldParent is the containing element of the srcElement
- $newParent is a potential candidate for focus change, if there are not focusable elements found
- in $newParent then it will return false and do nothing. It is up to the caller to try another candidate
- */
- changeFocusFrom: function($srcEl, $oldParent, $newParent) {
- var $newFocusEl = this.getFocusableItemsList($newParent);
- if ($newFocusEl.length === 0) {
- return false;
- } else {
- /*
- tabable items that are only visible on hover need some special handling to show them
- first and then we can focus to them....otherwise bad things happen.....terrible things
- */
- var oldFocusList = this.getFocusableItemsList($oldParent);
- var $oldFocEl = $(oldFocusList[0]);
- // jQuery addClass, hasClass and removeClass does not work for SVG elements (use DOM methods)
- if ($oldFocEl[0].classList.contains('tempAddVis')) {
- $oldFocEl[0].classList.remove('tempAddVis');
- $oldFocEl.css('visibility', '');
- }
- if ($newFocusEl.css('visibility') === 'hidden') {
- $newFocusEl.css('visibility', 'visible');
- $newFocusEl[0].classList.add('tempAddVis');
- }
- this._updateTabIndeciesFor($oldParent, $newParent);
- $($newFocusEl[0]).closest(this.handler.focusElmentContainer).focus();
- return true;
- }
- },
- _hasScroll: function(el) {
- var overflowY = $(el).css('overflow-y');
- return (overflowY === 'scroll' || overflowY === 'auto') && el.scrollHeight > el.clientHeight;
- },
- _getScrollingParent: function($el) {
- var res = null;
- $el.parents().each(function(i, node){
- if (this._hasScroll(node)) {
- res = $(node);
- return false;
- }
- }.bind(this));
- return res;
- },
- // Sets the tab index to the first visible element containing focusClass
- setInitialTabIndex: function() {
- if (this.$el) {
- var $fistFocusElList = this.$el.find('.' + this.focusClass);
- var $scrollingTop = 0;
- var $scrollingParent = this._getScrollingParent($fistFocusElList.first());
- if ($scrollingParent) {
- $scrollingTop = $scrollingParent[0].getBoundingClientRect().top;
- }
- $.each($fistFocusElList, function(i, node) {
- var top = node.getBoundingClientRect().top;
- if (top >= $scrollingTop) {
- var $fistFocusEl = $(node);
- var $currentTd = $($fistFocusEl.closest(this.handler.focusElmentContainer)[0]);
- this._updateTabIndeciesFor(null, $currentTd);
- return false;
- }
- }.bind(this));
- }
- }
- });
- return WidgetNavigator;
- });
- /*
- *+------------------------------------------------------------------------+
- *| Licensed Materials - Property of IBM
- *| IBM Cognos Products: Content Explorer
- *| (C) Copyright IBM Corp. 2015, 2018
- *|
- *| US Government Users Restricted Rights - Use, duplication or disclosure
- *| restricted by GSA ADP Schedule Contract with IBM Corp.
- *+------------------------------------------------------------------------+
- */
- define('bacontentnav/common/ui/BreadcrumbDropDown',[
- 'jquery',
- '../../lib/@waca/core-client/js/core-client/ui/DropDownMenu',
- '../../lib/@waca/core-client/js/core-client/utils/ContentFormatter',
- 'underscore'
- ], function($, DropDownMenu, ContentFormatter, _) {
- 'use strict';
- var BreadCrumbDropDown = DropDownMenu.extend({
- /*
- * options.propagateEvent {boolean} - optional. true - event should be propagated
- */
- propagateEvent: true,
- render: function() {
- $(this.actionElement).on('primaryaction', this._handlePrimaryAction.bind(this));
- this.$el = $(this.actionElement);
- this.menuButton = $(this.actionElement);
- this.menuButtonDom = this.actionElement;
- this._setTitle();
- $(window).on('shown.bs.popover', this._updatePopupover.bind(this));
- return Promise.resolve(this.$el);
- },
- destroy: function(){
- this.hidePopup();
- $(this.actionElement).off('primaryaction');
- $(window).off('shown.bs.popover');
- },
- hidePopup: function() {
- if (this.$ddPopover) {
- this.$ddPopover.popover('destroy');
- this.$ddPopover = null;
- }
- },
- _handlePrimaryAction: function(event) {
- /*jshint unused: false */
- this._onMenuSelect(event);
- if (!this.propagateEvent) {
- event.stopPropagation();
- }
- return this.propagateEvent;
- },
- _updatePopupover: function(event) {
- if ((event) && (event.target) && (event.target.title === this.title) && (this.$ddPopover)) {
- var popupId = this.$ddPopover.attr('aria-describedby');
- var $popupEl = $('#' + popupId);
- var $popupItems = $popupEl.find('.commonMenuLink');
- var maxWidth = $popupItems.width();
- _.each($popupItems, function(item) {
- var menuChildren = $(item).children();
- var $iconEl;
- var $spanEl;
- var calMaxWidth;
- if ($(menuChildren[0]).is('svg')) {
- $iconEl = $(menuChildren[0]);
- $spanEl = $(menuChildren[1]);
- calMaxWidth = maxWidth - $iconEl.outerWidth(true);
- } else {
- $spanEl = $(menuChildren[0]);
- var iconWidth = $('.commonMenuLink .svgIcon', menuChildren).outerWidth(true);
- var spanPadding = $spanEl.innerWidth() - $spanEl.width();
- calMaxWidth = maxWidth - iconWidth - spanPadding;
- }
- ContentFormatter.updateEllipsesBasedOnWidth($spanEl[0], calMaxWidth, $spanEl.width());
- }, this);
- }
- }
- });
- return BreadCrumbDropDown;
- });
- /*
- *+------------------------------------------------------------------------+
- *| Licensed Materials - Property of IBM
- *| IBM Cognos Products: ba-content-nav
- *| (C) Copyright IBM Corp. 2015, 2018
- *|
- *| US Government Users Restricted Rights - Use, duplication or disclosure
- *| restricted by GSA ADP Schedule Contract with IBM Corp.
- *+------------------------------------------------------------------------+
- */
- define('bacontentnav/common/ui/Breadcrumbs',[
- '../../lib/@waca/core-client/js/core-client/ui/View',
- 'jquery',
- 'underscore',
- './BreadcrumbDropDown',
- '../../lib/@waca/core-client/js/core-client/utils/ContentFormatter',
- '../../utils/ContentStoreObject',
- '../../utils/UIHelper',
- '../../nls/StringResource',
- '../../lib/@waca/core-client/js/core-client/utils/BidiUtil',
- '../../lib/@waca/core-client/js/core-client/utils/Utils'
- ], function(View, $, _, DropDownMenu, ContentFormatter, ContentStoreObject, UIHelper, StringResource, BidiUtil, Utils) {
- 'use strict';
- var BreadCrumb = View.extend({
- /**
- options.$el {jquery node} - container node where the breadcrumbs should be rendered
- options.ancestors {array} - ancestors property from content service
- options.navigateCallback - callback to call when a breadcrumb part is clicked
- **/
- collapsedBreadCrumbIcon: 'ba_content_nav-folder-overflow_16',
- previousIcon: 'ba_content_nav-back-previous_16',
- chevronRightIcon: (BidiUtil.isMirrored ? 'common-chevron_left' : 'common-chevron_right'),
- defaultWidth: 400,
- bcPrev: null,
- NumOfResponsiveBC: 3,
- init: function(options) {
- BreadCrumb.inherited('init', this, arguments);
- _.extend(this, options);
- this._bSetFocusToSelf = false;
- this._oVisibleBreadcrumb = null;
- },
- _getOuterWidth: function($elem, inclusive) {
- // jQuery 3 returns undefined (previously, null) for an empty set of elements,
- // so we need to make sure we have a number to do operations correctly
- return $elem.outerWidth(!!inclusive) || 0;
- },
- _getMenuItems: function(ancestors) {
- var menuItems = [];
- var i;
- for (i = 0; i < ancestors.length - 1; i += 1) {
- var ancestor = ancestors[i];
- var icon = UIHelper.getSVGIconForType(ContentStoreObject.getType(ancestor));
- if (icon.indexOf('#') === 0) {
- icon = icon.substring(1);
- }
- var newMenuItem = {
- 'label': ContentStoreObject.getName(ancestor),
- 'icon': icon,
- 'onSelect': this.breadcrumbClicked.bind(this, i)
- };
- menuItems.push(newMenuItem);
- }
- return menuItems;
- },
- /**
- Renders the collapsed breadcrumb control for breadcrumbs that do not fit the screen
- **/
- _renderCollapsedItems: function(container) {
- var length = this.ancestors.length;
- var list = $('<ul>', {
- 'class': 'breadcrumbCompact'
- });
- container.append(list);
- var listItem = this._createBreadcrumbItem();
- list.append(listItem);
- this._createCollapsedBreadCrumbItem(listItem, this.collapsedBreadCrumbIcon, length - 1);
- this._updateResponsiveItems(list);
- },
- /**
- * Creates a list item element that represents one breadcrumb item
- *
- * @param bIsFocusable if the item should be focusable
- * @param label the item's label <optional>
- * @param iconId the item's icon id <optional>
- * @param index the item's index in the list of items <optional
- * @return a list item element that represents one breadcrumb item
- **/
- _createBreadcrumbItem: function(bIsFocusable, label, iconId, index) {
- var $elem = $('<li>', {
- 'class': 'active'
- });
- if (iconId) {
- $elem.append(this._createSvgIcon(iconId));
- }
- var $div = $('<div>', {
- 'class': 'breadcrumbItemTxt'
- });
- var $span = $('<span>');
- if (bIsFocusable) {
- $div.attr('tabindex', '0');
- $div.attr('role', 'link');
- if (index !== undefined && index >=0) {
- $div.on('primaryaction', this.breadcrumbClicked.bind(this, index));
- }
- } else {
- $div.attr('role', 'presentation');
- }
- if (label) {
- $div.attr('aria-label', label);
- $span.text(BidiUtil.enforceTextDirection(label));
- }
- $div.append($span);
- $elem.append($div);
- return $elem;
- },
- /**
- * Renders the big breadcrumb control for breadcrumbs that fit the screen
- *
- * @param container a container element for the full items list
- **/
- _renderFullItems: function(container) {
- var length = this.ancestors.length;
- var $list = $('<ul>', {
- 'class': 'breadcrumbFull'
- });
- container.append($list);
- for (var i = 1; i < length; i += 1) {
- var bIsLastItem = (i === (length - 1));
- var bIsFocusable = !bIsLastItem;
- var name = ContentStoreObject.getName(this.ancestors[i]);
- $list.append(this._createBreadcrumbItem(bIsFocusable, name, this.chevronRightIcon, i));
- }
- },
- _Ellipsize: function($item) {
- var stringWidth = $item.find('span').width();
- ContentFormatter.updateEllipsesBasedOnWidth($item.find('span').get(0), this._getOuterWidth($item), stringWidth);
- },
- _createEllipses: function(widthForBreadCrumbs) {
- void (widthForBreadCrumbs);
- var $compactBreadCrumb = this.$el.find('.breadcrumbCompact');
- var items = $compactBreadCrumb.find('li.responsive .breadcrumbItemTxt');
- if (items.length > 0) {
- for(var i = items.length - 1; i >=0 ; i--) {
- var $item = $(items.get(i));
- var ancestor = this.ancestors[this.ancestors.length - items.length + i];
- if(items.find('span').width() !== 0){
- $item.find('span').text(BidiUtil.enforceTextDirection(ContentStoreObject.getName(ancestor)));
- }
- this._Ellipsize($(items.get(i)));
- }
- }
- },
- _getResponsiveWidth: function() {
- var $appBar = this.$el.parents('.appbarRow');
- var $unresponsiveAppBar = $appBar.find('.appbarTrailing');
- var $breadcrumbPrevious = this.$el.find('.breadcrumbPrevious');
- var $breadcrumbRoot = this.$el.find('.breadcrumbRoot');
- var widthForBreadCrumbs = this._getOuterWidth($appBar) - this._getOuterWidth($unresponsiveAppBar);
- widthForBreadCrumbs = widthForBreadCrumbs - this._getOuterWidth($breadcrumbPrevious);
- widthForBreadCrumbs = widthForBreadCrumbs - this._getOuterWidth($breadcrumbRoot);
- return widthForBreadCrumbs;
- },
- _showResponsiveItems: function() {
- var fullBreadCrumb = this.$el.find('.breadcrumbFull');
- var compactBreadCrumb = this.$el.find('.breadcrumbCompact');
- var $breadcrumbs = this.$el.find('.breadcrumbs');
- $breadcrumbs.removeClass('compactMode');
- var widthForBreadCrumbs = this._getResponsiveWidth();
- var fullBreadCrumbWidth = this._getFullWidth(fullBreadCrumb);
- if (widthForBreadCrumbs <= fullBreadCrumbWidth) {
- this._updateNumOfResponsiveBC();
- $breadcrumbs.addClass('compactMode');
- this._oVisibleBreadcrumb = compactBreadCrumb;
- } else {
- $breadcrumbs.removeClass('compactMode');
- this._oVisibleBreadcrumb = fullBreadCrumb;
- }
- widthForBreadCrumbs = this._getResponsiveWidth();
- this._checkRoot($breadcrumbs);
- this._createEllipses(widthForBreadCrumbs);
- },
- _updateNumOfResponsiveBC: function(){
- var appBar = this.$el.parents('.appbarRow');
- var appBarWidth = this._getOuterWidth(appBar);
- var appBarDefaultWidth = 365;
- var appBarBreakpointWidth = 290;
- if(appBarWidth <= appBarDefaultWidth){
- //create breakpoints that determines numOfResponsiveBC
- this.NumOfResponsiveBC = ((appBarWidth >= appBarBreakpointWidth && this.ancestors.length > 3) || (appBarWidth < appBarBreakpointWidth && this.ancestors.length > 2)) ? 1 : 3;
- }else{
- this.NumOfResponsiveBC = 3;
- }
- this._updateCollapsedBreadCrumb();
- },
- _getFullWidth: function(elem) {
- var totalWidth = 0;
- $.each(elem.children(), function(i, value) {
- //Passing 'true' to outerWidth to include the margins in the width of the element
- totalWidth += this._getOuterWidth($(value), true);
- }.bind(this));
- return totalWidth;
- },
- _goUp: function() {
- if (this.ancestors.length - 2 >= 0) {
- this.breadcrumbClicked(this.ancestors.length - 2);
- }
- },
- _goRoot: function() {
- this.breadcrumbClicked(0);
- },
- _createLeftArrow: function(nav) {
- var $list = $('<ul>', {
- 'class': 'breadcrumbPrevious'
- });
- var $item = $('<li>', {});
- var $svgContainer = this._createSvgIcon(this.previousIcon);
- $svgContainer.attr('tabindex', '0');
- $svgContainer.attr('role', 'button');
- $svgContainer.attr('title', StringResource.get('previous'));
- $svgContainer.attr('aria-label', StringResource.get('previous'));
- $svgContainer.on('primaryaction', this._goUp.bind(this));
- if (BidiUtil.isMirrored) {
- $svgContainer.css({ transform: 'scaleX(-1)' });
- }
- $item.append($svgContainer);
- $list.append($item);
- nav.append($list);
- this.bcPrev = $list;
- this._updateLeftArrowVisible();
- },
- _createRoot: function(nav) {
- var $list = $('<ul>', {
- 'class': 'breadcrumbRoot'
- });
- var $item = this._createRootItem();
- $list.append($item);
- $list = this.ancestors.length === 1 ? $list.addClass('currentFolder'):$list.removeClass('currentFolder');
- nav.append($list);
- },
- _createRootItem: function() {
- var $item = $('<li>', {});
- var defaultName = ContentStoreObject.getName(this.ancestors[0]);
- var iconId = UIHelper.getSVGIconForType(ContentStoreObject.getType(this.ancestors[0]));
- var $iconEl = this._createSvgIcon(iconId);
- $iconEl.attr('tabindex', '0');
- $iconEl.attr('role', 'button');
- $iconEl.on('primaryaction', this._goRoot.bind(this));
- $iconEl.attr('aria-label', defaultName);
- $iconEl.attr('title', defaultName);
- var rootName = BidiUtil.enforceTextDirection(defaultName);
- var $div = $('<div>', {
- 'class': 'breadcrumbRootTxt'
- });
- $div.text(rootName);
- $div.attr('tabindex', '0');
- $div.attr('role', 'link');
- $div.attr('aria-label', defaultName);
- $div.on('primaryaction', this._goRoot.bind(this));
- $item.append($iconEl);
- $item.append($div);
- return $item;
- },
- _checkRoot: function(container) {
- if (this.ancestors.length !== 1) {
- container.find('.breadcrumbCustomRoot').remove();
- return;
- }
- if (this.$el && this.$el.parents('.pageView').length) {
- var slideout = this.$el.parents('.pageView');
- if (slideout.get(0).id === 'customFoldersSlideoutContent') {
- var item = this._createBreadcrumbItem(false, this.ancestors[0].defaultName, this.collapsedBreadCrumbIcon, 0);
- item.addClass('breadcrumbCustomRoot').addClass('responsive');
- container.find('.breadcrumbCompact').append(item);
- this._Ellipsize(item.find('div.breadcrumbItemTxt'));
- }
- }
- },
- /**
- Renders the breadcrumb control
- **/
- render: function() {
- if (!this.ancestors) {
- return;
- }
- this.$el.addClass('breadcrumbContainer');
- var container = $('<div>', {
- 'class': 'breadcrumbs',
- 'aria-label': this.label,
- 'aria-controls': this.ariaControls
- });
- this.$el.append(container);
- this._createLeftArrow(container);
- this._createRoot(container);
- this._renderCollapsedItems(container);
- this._renderFullItems(container);
- this._showResponsiveItems();
- return this;
- },
- resize: function() {
- this._showResponsiveItems();
- },
- /**
- Call the supplied callback for the breadcrumb that's been clicked
- **/
- breadcrumbClicked: function(index) {
- this.navigateCallback(index);
- },
- /**
- Call the supplied callback for the breadcrumb that's been clicked
- **/
- rootBreadcrumbClicked: function(event) {
- if (event && event.target) {
- var index = null;
- if ($(event.target).is('li')) {
- index = $(event.target).index();
- } else if ($(event.target).is('span') || $(event.target).is('svg')) {
- index = $(event.target).parent().index();
- }
- if (index !== null) {
- this.breadcrumbClicked(index);
- }
- }
- },
- /**
- Creates an SVG icon based on the icon id, and optional icon class.
- **/
- _createSvgIcon: function(iconId, iconClass) {
- var $icon = $('<div class="bsIcon"></div>');
- Utils.setIcon($icon, this.getSvgId(iconId));
- if (iconClass) {
- $icon.find('.svgIcon').addClass(iconClass);
- }
- return $icon;
- },
- _updateSvgIcon: function($parent, iconId) {
- if ($parent) {
- $parent.find('svg.svgIcon').first().remove();
- Utils.setIcon($parent, this.getSvgId(iconId));
- }
- },
- _updateRoot: function(breadcrumbs) {
- var rootItem = this.ancestors[0];
- var rootItemName = ContentStoreObject.getName(rootItem);
- // get the root
- var $breadcrumbRoot = this.$el.find('.breadcrumbRoot');
- // update icon
- var $icon = $breadcrumbRoot.find('.bsIcon');
- $icon.attr('aria-label', rootItemName);
- this._updateSvgIcon($icon, UIHelper.getSVGIconForType(ContentStoreObject.getType(rootItem)));
- // update text
- var $label = $breadcrumbRoot.find('.breadcrumbRootTxt');
- $label.attr('aria-label', rootItemName);
- $label.text(BidiUtil.enforceTextDirection(rootItemName));
- // select if required
- if (breadcrumbs.length === 1 ) {
- $breadcrumbRoot.addClass('currentFolder');
- } else {
- $breadcrumbRoot.removeClass('currentFolder');
- }
- },
- _updateFullBreadCrumb: function(breadcrumbs) {
- var newBreadcrumbs = breadcrumbs.slice(1);
- var i;
- var $ul = this.$el.find('.breadcrumbFull');
- var oldLength = $ul[0].childNodes.length;
- var newLength = newBreadcrumbs.length;
- if (newLength > oldLength) {
- //update tabindex and role of previous last item
- var prevLastItem = $ul.find('li:nth-child(' + oldLength + ')');
- var prevLastItemTxt = prevLastItem.find('div.breadcrumbItemTxt');
- prevLastItemTxt.attr('tabindex', '0');
- prevLastItemTxt.attr('role', 'link');
- for (i = oldLength; i < newLength; i += 1) {
- var bIsLastItem = (i === (newLength - 1));
- $ul.append(this._createBreadcrumbItem(!bIsLastItem, null, this.chevronRightIcon, i+1));
- }
- prevLastItemTxt.on('primaryaction', this.breadcrumbClicked.bind(this, oldLength));
- } else {
- for (i = oldLength; i > newLength; i -= 1) {
- $($ul.children()[$ul[0].childNodes.length - 1]).remove();
- }
- //remove role=link from last item
- var lastItem = $ul.find('li:last-child');
- var lastItemTxt = lastItem.find('div.breadcrumbItemTxt');
- lastItemTxt.removeAttr('tabindex');
- lastItemTxt.attr('role', 'presentation');
- }
- for (i = 0; i < newLength; i += 1) {
- var $textItem = $($ul[0].childNodes[i]).find('div.breadcrumbItemTxt');
- var defaultName = ContentStoreObject.getName(newBreadcrumbs[i]);
- $textItem.attr('aria-label', defaultName);
- $textItem.find('span').get(0).textContent = BidiUtil.enforceTextDirection(defaultName);
- }
- },
- _createDropDown: function(parentEl) {
- var menuItems = this._getMenuItems(this.ancestors);
- this.ddMenu = new DropDownMenu({
- dropDownMenuSpec: {
- 'class': 'breadcrumbs-popover',
- 'title': this.name || '',
- 'icon': this.collapsedBreadCrumbIcon,
- 'items': menuItems,
- 'actionElement': parentEl,
- 'ddMenuPlacement': 'bottom',
- 'propagateEvent': false
- }
- });
- this.ddMenu.render();
- },
- _createCollapsedBreadCrumbItem: function($parentEl, icon, number) {
- var $chevronRightIcon = this._createSvgIcon(this.chevronRightIcon);
- var $iconEl = this._createSvgIcon(this.collapsedBreadCrumbIcon, 'collapsedBreadCrumbIcon');
- $parentEl.off('primaryaction');
- if (number > 0) {
- this._createDropDown($iconEl);
- $iconEl.attr('aria-haspopup', 'true');
- } else {
- $parentEl.removeAttr('aria-haspopup');
- $iconEl.on('primaryaction', this.rootBreadcrumbClicked.bind(this));
- }
- $parentEl.attr('role', 'link');
- $parentEl.empty();
- $iconEl.attr('tabindex', '0');
- $iconEl.attr('role', 'button');
- $iconEl.attr('aria-label', StringResource.get('collapsedBreadCrumb'));
- $iconEl.attr('title', StringResource.get('collapsedBreadCrumb'));
- $iconEl.addClass('collapsedBreadCrumbIcon');
- $parentEl.append($chevronRightIcon);
- $parentEl.append($iconEl);
- },
- _updateCollapsedBreadCrumb: function() {
- var $ul = this.$el.find('.breadcrumbCompact');
- var $firstElement = $($ul[0].childNodes[0]);
- this._createCollapsedBreadCrumbItem($firstElement, UIHelper.getSVGIconForType(ContentStoreObject.getType(this.ancestors[0])), this.ancestors.length - 1);
- this._updateResponsiveItems($ul);
- },
- _updateResponsiveItems: function($ul) {
- $ul.find('li.responsive').remove();
- for(var i = this.NumOfResponsiveBC; i > 0; i--) {
- if ((this.ancestors.length - i) >= 1) {
- var bIsFocusable = (i !== 1);
- var name = ContentStoreObject.getName(this.ancestors[this.ancestors.length - i]);
- var $item = this._createBreadcrumbItem(bIsFocusable, name, this.chevronRightIcon, this.ancestors.length - i);
- $item.addClass('responsive');
- $ul.append($item);
- }
- }
- },
- _updateLeftArrowVisible: function() {
- if (this.ancestors.length > 1) {
- this.bcPrev.removeClass('hidden');
- } else {
- this.bcPrev.addClass('hidden');
- }
- },
- updateBreadcrumb: function(newAncestors) {
- if (this.ddMenu) {
- this.ddMenu.hidePopup();
- }
- if (!newAncestors) {
- return;
- }
- this.ancestors = newAncestors;
- this._updateRoot(newAncestors);
- this._updateFullBreadCrumb(newAncestors);
- this._updateLeftArrowVisible();
- this._updateCollapsedBreadCrumb();
- this._showResponsiveItems();
- },
- getSvgId: function(iconId) {
- return iconId.charAt(0) === '#'? iconId.substr(1) : iconId;
- }
- });
- return BreadCrumb;
- });
- /*
- *+------------------------------------------------------------------------+
- *| Licensed Materials - Property of IBM
- *| IBM Cognos Products: Content Explorer
- *| (C) Copyright IBM Corp. 2015, 2019
- *|
- *| US Government Users Restricted Rights - Use, duplication or disclosure
- *| restricted by GSA ADP Schedule Contract with IBM Corp.
- *+------------------------------------------------------------------------+
- */
- /**
- Base class for Content Views that need to show breadcrumbs, filters or a content list
- Properties to override
- trackBreadcrumbs {boolean} - defaults to false, set to true if you want to track breadcrumb information (if showBreadcrumbs is true, it is not necessary to set this to true)
- showBreadcrumbs {boolean} - defaults to false, set to true if you want to show breadcrumbs
- showFilter {boolean} - defaults to false, set to true if you want to show the filter control
- showAddFolder {boolean} - defaults to false, set to true if you want to show the 'Add folder' button
- showNewItem {boolean} - defaults to false, set to true if you want to show the 'New' button
- stateId {string} - if you want the save state information (filter setting, sorting, ...) set this property to a unique value (i.e. class name)
- contentListContainer {object} - optional container
- Functions to override
- renderContent - gets called after the content bar is rendered. This is where you'll render your own content or call renderContentList with options to render the data table.
- This method needs to return a promise that will be resolved when the content is done drawing.
- getModuleName - if your view supports Navigating, then you must override this function and return the path to your View
- getViewContainerClass - if you want to specify a different css class on the main container div
- contentbarItems - Override if you want to add extra controls in the content bar. Returns an array of items, uses the Gemini syntax
- getFilterColumnIndex - If you're using the filter control and the icon column isn't the first column, override this returning the index of the 'type' column to be used to filter
- getRootAncestor - If you're using breadcrumbs, this function should return the Label to use for the first breadcrumb
- Functions to know about
- renderContentList - creates a ListControl object to render the table. The possible options are documented in bacontentnav/common/ui/ListControl.js
- removeContentList - deletes the ListControl from the View
- **/
- define('bacontentnav/common/ContentListPageView',[
- 'jquery',
- 'underscore',
- '../lib/@waca/baglass/js/baglass/app/ContentView',
- './ui/ListControl',
- './ui/ContentBar',
- '../nls/StringResource',
- '../utils/ContentStoreObject',
- '../utils/UIHelper',
- '../utils/GlassContextHelper',
- '../utils/A11YHelper',
- '../utils/WidgetNavigator',
- '../utils/ContentServiceUrls',
- './ui/Breadcrumbs',
- './ui/BreadcrumbDropDown'
- /* jshint maxparams:false */
- ], function($, _, ContentView, ListControl, ContentBar, StringResource, ContentStoreObject,
- UIHelper, GlassContextHelper, A11YHelper, WidgetNavigator, ContentServiceUrls, Breadcrumbs, DropDownMenu) { //NOSONAR
- 'use strict'; //NOSONAR
- var ContentListPageView = ContentView.extend({
- showSort: false,
- contentListFacets: null,
- contentListSortIndexes: null,
- contentListFilters: ['name', ContentStoreObject.MODIFICATION_TIME],
- currentFilters: {}, // Key/value JSON holding filter id/name pair
- /**
- Update the data table by re-fetching the data
- **/
- refresh: function(url) {
- this.logger.debug('ContentListPageView.refresh');
- // ensure flag for content-nav team root is correct
- this._updateTeamRoot();
- if (this._listControl) {
- this._listControl.updateDatatable(url);
- }
- // Hide multiselect bar if it's still displayed
- if (this.multiselectBar !== undefined && this.multiselectBar.isVisible()) {
- this._listControl._clearRows();
- this.multiselectBar.hide();
- this.contentBar.show();
- }
- },
- /**
- @options.url {string} - Rest URL to used to query the items to display. (itemLink)
- @options.selfUrl {boolean} - Rest URL for the object to display (selfLink)
- @options.showBreadcrumbs {boolean} - should the breadcrumb control be shown. Default is false
- @options.showFilter {boolean} - should the filter control be shown. Default is false
- @options.showAddFolder {boolean} - should the Add Folder button be shown. Default is false
- @options.showNewItem {boolean} - should the New button be shown. Default is false
- @options.ancestors {array} - ancestors property from the content service
- @options.skipAncestors {boolean} - should the ancestors to be rendered. Default is false
- @options.showSwitchButton {boolean} - should the view switch button be shown. Default is false. Implement _getSwitchViewIcon to choose icon
- @options.navigateCallback {function} - if you want to be notified when navigation takes place
- @options.navigateOnRowSelect {boolean} - default false
- @options.selectedRow {array} - select default rows in the contentList
- **/
- init: function(options) {
- this.ancestors = [];
- this.showSwitchButton = false;
- // Default is to not show the breadcrumbs of filter
- this.showBreadcrumbs = false;
- this.trackBreadcrumbs = false;
- this.showFilter = false;
- this.skipAncestors = false;
- this.showNewItem = false;
- this.navigateOnRowSelect = false;
- this._urlParameters = {};
- // Override this in your subclasses if you show filter
- //otherwise the filters will collide
- this.menuNamePrefix = 'CONTENTLISTPV_';
- // Reset the filter dropdown to it's default (All Content)
- this.updateFilterString('');
- ContentListPageView.inherited('init', this, arguments);
- _.extend(this, options);
- // WHAAA TODO HACK, ContentStoreObject was designed as a singleton, when relatively referenced,
- // it doesn't have the glassContext set, reset it here
- ContentStoreObject.setGlassContext(this.glassContext);
- this.facets = this.getSortSpec();
- this.sortMappingSpec = this.getSortMappingSpec();
- this._resetSelectedSortViewFacets();
- },
- _findFolderCmId: function() {
- if (this.folder && !this._folderIsId()) {
- return this.glassContext.getSvc('.Content')
- .then(function(contentSvc) {
- return contentSvc.getPathUrl(this.folder);
- }.bind(this))
- .then(function(requestEndpoint) {
- return this.glassContext.getCoreSvc('.Ajax').ajax({
- url: requestEndpoint,
- type: 'GET',
- dataType: 'json'
- });
- }.bind(this))
- .then(function(result) {
- this.folder = result.data.data[0].id;
- }.bind(this));
- } else {
- return Promise.resolve();
- }
- },
- /**
- * Main entry point to render the View
- **/
- render: function() {
- return new Promise(function(resolve, reject) {
- this.getContainer().addClass(this.getViewContainerClass());
- $('.dialogBlockerCell').addClass('transparent');
- UIHelper.initializeRegistry(this.glassContext)
- .then(function() {
- return this._findFolderCmId()
- .then(function() {
- this.selfUrl = this.selfUrl ? this.selfUrl : this._getDefaultSelfURL();
- this.url = this.url ? this.url : this._getDefaultRequestURL();
- return this._renderContentBar()
- .then(function(contentbar) {
- // Render the table after the context bar so it gets sized correctly
- return (this.renderContent && this.renderContent() || Promise.resolve())
- .then(function() {
- this._renderSelectionControlBar();
- $('.dialogBlockerCell').removeClass('transparent');
- resolve(contentbar);
- }.bind(this));
- }.bind(this));
- }.bind(this));
- }.bind(this))
- .catch(function(err){
- reject(err);
- });
- // Populate the filter options
- _.each(this.getFilterSpec(), function(filterObj) {
- this.currentFilters[filterObj.name + '_' + this.id] = filterObj.name;
- }.bind(this));
- this._createMultiSelectBar();
- // Pick up whether properties should be closing and close them here.
- this.getContainer().on('clicktap', function(evt) {
- var target = evt.target;
- //The target is BUTTON on FF/IE and svg on Chrome/Safari
- if (target.tagName && target.tagName.toLowerCase() === 'svg' && target.parentElement && target.parentElement.tagName.toLowerCase() === 'button') {
- target = evt.target.parentElement;
- }
- if ($(target).hasClass('parentProperties') && $(target).hasClass('common-configure-manage')) {
- return true;
- }
- if (this._retainProperties) {
- this._retainProperties = false;
- }
- }.bind(this));
- // Responsive sizing (designed for iPad for now)
- var debounced = _.debounce(this._adjustWidth.bind(this), 300);
- this._resizeHandler = $(window).on('resize', debounced);
- this._adjustWidth();
- if (this.slideout) {
- this.slideout.on('show', function() {
- this.refresh();
- }.bind(this));
- this.getContainer().attr('tabindex', '0');
- }
- }.bind(this));
- },
- bindWidgetNavigator: function() {
- var contentViewSwitcherTable = this.getContainer().find('.contentViewSwitcher table');
- var contentViewSwitcherRows = contentViewSwitcherTable.find('tr');
- this._listControl.widgetKeyController = new WidgetNavigator({
- $el: this.getContainer().find('.listControl'),
- focusClass: 'contentListFocusable',
- fCallBack: this._listControl._processRowForMoreDataLoad.bind(this._listControl)
- });
- if (contentViewSwitcherTable) {
- _.each(contentViewSwitcherRows, function(row) {
- $(row).addClass('keyboardAccess');
- });
- }
- },
- /**
- * Callback for row selection in the list view
- **/
- _selectRow: function(oData) {
- if (this._propertiesOpen && this.propertiesOverride !== true) {
- this.getContainer().focus();
- this._retainProperties = true;
- //deselect all text fields inside of the slideout
- this.propertiesSlideout.$el.find(':focus').blur();
- setTimeout(function() {
- this.showProperties(oData);
- }.bind(this), 10);
- } else if (this.navigateOnRowSelect && ContentStoreObject.hasPermissions(oData, ['traverse']) &&
- UIHelper.hasRequiredCapabilities(oData, this.typesToOpen, this.capabilitiesRequired)) {
- this.navigate(oData);
- }
- if (_.isFunction(this.listControlCallback)) {
- this.listControlCallback(oData);
- }
- this._resetPropertiesOverride();
- },
- _resetPropertiesOverride: function() {
- this.propertiesOverride = false;
- },
- closeProperties: function() {
- if (this._propertiesOpen) {
- this.togglePropertiesMode();
- if (this.propertiesSlideout) {
- this.propertiesSlideout.onHide();
- }
- }
- },
- /**
- * Appropriately shows properties in either the child pane or a pane on the right
- **/
- showProperties: function( /*objectInformation*/ ) {
- // do nothing
- },
- closeNewURL: function() {
- if (this._newURLOpen) {
- this.toggleNewURLMode();
- if (this.newURLSlideout) {
- this.newURLSlideout.onHide();
- }
- }
- },
- /**
- * Appropriately shows 'New URL' in the child pane
- **/
- showNewURL: function() {
- // do nothing
- },
- /**
- * Callback for a screen resize
- **/
- _adjustWidth: function() {
- //detect iPad width
- if ($(window).width() <= 1024) {
- this.getContainer().addClass('pageview-small');
- } else {
- this.getContainer().removeClass('pageview-small');
- }
- if (this.contentBar) {
- this.contentBar.resize();
- }
- },
- /**
- * Create a ListControl object to render the table. The possible options are documented in bacontentnav/common/ui/ListControl.js
- * @param {object} - object containing options
- * @returns - promise that will resolve to the rendered datatable
- **/
- renderContentList: function(options) {
- // UI Registry should already be initialized - but some tests bypass 'render', so ensure it's done :(
- return UIHelper.initializeRegistry(this.glassContext)
- .then(function() {
- options.urlParameters = this.getURLParameters();
- this._listControl = new ListControl(this._getDatatableOptions(options));
- if (options.dataManipulationCallback !== undefined) {
- this.getListControl().dataManipulationCallback = options.dataManipulationCallback;
- if (this.contentListSortIndexes) {
- this.getListControl().sortIndexes = this.contentListSortIndexes;
- }
- }
- return this._listControl.render().then(this.bindWidgetNavigator.bind(this));
- }.bind(this));
- },
- /**
- * Override this in any view that can switch modes
- **/
- switchViewMode: function() {
- // do nothing
- },
- /**
- * Add a new folder using listControl's addFolder()
- **/
- _addFolder: function() {
- if (this._listControl) {
- if (this._propertiesOpen) {
- this.closeProperties();
- }
- this._listControl.addFolder();
- }
- },
- _getContentBarAccesibleLabel: function() {
- if ((this.contentBar !== undefined) && (this.contentBar.itemMap !== undefined)) {
- if (this.contentBar.itemMap.nameLabel === undefined) {
- return '';
- } else {
- return this.contentBar.itemMap.nameLabel.label;
- }
- }
- },
- /**
- * Return the combination of default options with the ones passed in by the sub class
- **/
- _getDatatableOptions: function(options) {
- var contentBarLabel = this._getContentBarAccesibleLabel();
- var hasWrite = ContentStoreObject.hasPermissions(this.parentObj, ['write']);
- var datatableOptions = {
- 'el': this.getContainer(),
- 'defaultSort': this.getDefaultSort(),
- 'stateId': this.stateId || null,
- 'glassContext': this.glassContext,
- 'singleSelectCallback': this._selectRow.bind(this),
- 'contentView': this,
- 'accessibleLabel': StringResource.get('ViewAccessibleLabel', {
- label: contentBarLabel
- }),
- 'filterColumnIndex': this.getFilterColumnIndex(),
- 'showEmptyNewFolderButton': hasWrite
- };
- if (this.selectedRow) {
- datatableOptions.selectedRow = this.selectedRow;
- delete this.selectedRow;
- }
- var listControlOptions = this.getListControlOptions();
- if (listControlOptions) {
- _.extend(datatableOptions, listControlOptions);
- }
- _.extend(datatableOptions, options);
- return datatableOptions;
- },
- setFocus: function() {
- if (this.slideout) {
- this.getContainer().focus();
- }
- },
- getListControlOptions: function() {
- return null;
- },
- getDefaultSort: function() {
- return [1, 'asc'];
- },
- /**
- * Delete the ListControl from the View
- **/
- removeContentList: function() {
- this.logger.debug('ContentListPageView.removeContentList', this._listControl);
- if (this._listControl) {
- this._listControl.remove();
- }
- if(this.newItemDropDown){
- this.newItemDropDown.destroy();
- }
- },
- /**
- * Remove the View from the DOM
- **/
- remove: function() {
- this.removeContentList();
- return ContentListPageView.inherited('remove', this, arguments);
- },
- /**
- * View extending this class that support navigating folders must override this function to return the path to their View
- **/
- getModuleName: function() {
- // do nothing
- },
- /**
- * Class to be placed on the main pageView container
- **/
- getViewContainerClass: function() {
- return 'ContentListPageView';
- },
- /**
- * Return the items url for the root folder of the view, can be overridden if not opening a folder
- **/
- _getDefaultRequestURL: function() {
- var returnUrl = '';
- if (this.folder) {
- returnUrl = ContentServiceUrls.getBaseObjectsURL() + '/' + this.folder + '/items';
- }
- return returnUrl;
- },
- /**
- * Render and show the content bar if it's required
- **/
- _renderContentBar: function() {
- return this._createContentBar()
- .then(function(contentBar) {
- if (contentBar) {
- contentBar.show();
- }
- return this._updateAppBar()
- .then(function() {
- return contentBar;
- });
- }.bind(this));
- },
- _renderSelectionControlBar: function() {
- if (this.selectAcrossFolders) {
- this.$selectionControlBar = $('<div class="selectionControlBar"><span class="selectAll"><a role="button" tabindex="0"></a></span><span class="clearAll"><a role="button" tabindex="0"></a></span></div>');
- var selectAll = this.$selectionControlBar.find('.selectAll a');
- selectAll.text(StringResource.get('selectAllFolder'));
- selectAll.attr('aria-label', StringResource.get('selectAllFolder'));
- selectAll.on('primaryaction', function() {
- if (this._listControl) {
- this._listControl.selectAll();
- }
- }.bind(this));
- var clearAll = this.$selectionControlBar.find('.clearAll a');
- clearAll.text(StringResource.get('deselectAllFolder'));
- clearAll.attr('aria-label', StringResource.get('deselectAllFolder'));
- clearAll.on('primaryaction', function() {
- if (this._listControl) {
- this._listControl.clearAll();
- }
- }.bind(this));
- this.getContainer().append(this.$selectionControlBar);
- }
- },
- clearAllSelected: function() {
- if (this._listControl) {
- this._listControl.clearAllSelected();
- }
- },
- /**
- * Set up the container for the view to render differently when a properties pane is open
- **/
- togglePropertiesMode: function() {
- if (this._propertiesOpen) {
- this.getContainer().removeClass('propertiesMode');
- this._propertiesOpen = false;
- } else {
- this.getContainer().addClass('propertiesMode');
- this._propertiesOpen = true;
- }
- },
- /**
- * Set up the container for the view to render differently when a 'New URL'' pane is open
- **/
- toggleNewURLMode: function() {
- if (this._newURLOpen) {
- this.getContainer().removeClass('newURLMode');
- this._newURLOpen = false;
- } else {
- this.getContainer().addClass('newURLMode');
- this._newURLOpen = true;
- }
- },
- /**
- * Return a promise which will resolve with an array of controls to show in the toolbar
- **/
- _contentbarItems: function() {
- var items = [];
- return this.initializeAncestors()
- .then(function() {
- if (this.showBreadcrumbs) {
- items.push({
- 'name': 'breadcrumbs',
- 'position': 'leading',
- 'label': StringResource.get('breadCrumbsAccessibleLabel'),
- 'responsive': false,
- 'module': Breadcrumbs,
- 'navigateCallback': this._navigateAncestor.bind(this),
- 'ancestors': this.ancestors
- });
- }
- if (this.showParentPropertiesButton && this.ancestors && this.ancestors[0].id === '.public_folders') {
- items.push({
- 'name': 'parentProperties',
- 'position': 'trailing',
- 'module': './contentbar_components/Button',
- 'className': 'parentProperties',
- 'label': StringResource.get('properties', {
- 'objectName': StringResource.get('teamContent')
- }),
- 'responsive': false,
- 'icon': 'common-properties',
- 'action': function() {
- this._listControl._clearRows();
- if (!this._propertiesOpen) {
- this.showProperties({
- 'selfUrl': this.selfUrl
- });
- } else {
- this.closeProperties();
- }
- }.bind(this)
- });
- }
- if (this.showAddFolder) {
- items.push({
- 'name': 'addFolderButton',
- 'position': 'trailing',
- 'label': StringResource.get('newFolderLabel'),
- 'responsive': false,
- 'module': './contentbar_components/Button',
- 'className': 'addNewFolder',
- 'icon': 'common-add-folder',
- 'action': function() {
- this._addFolder();
- }.bind(this)
- });
- }
- if (this.showNewItem) {
- items.push({
- 'name': 'newItemButton',
- 'position': 'trailing',
- 'label': StringResource.get('newItemMenuLabel'),
- 'responsive': false,
- 'module': './contentbar_components/Button',
- 'className': 'newItemButton',
- 'icon': 'common-add',
- 'action': function() {
- this._openNewItemMenu();
- }.bind(this)
- });
- }
- if (this.showFilter) {
- items.push({
- 'name': 'contentNavFilter',
- 'label': StringResource.get('filterBy'),
- 'responsive': false,
- 'labelOnly': false,
- 'hcLabel': false,
- 'position': 'trailing',
- 'supportCustomCollapse': true,
- 'showTitle': false,
- 'updateLabel': false,
- 'icon': 'common-filter',
- 'bSVG': true,
- 'module': './contentbar_components/Button',
- 'className': 'contentNavFilter',
- 'pushed': false,
- 'action': this.filterViewClicked.bind(this)
- });
- }
- if (this.showSort) {
- items.push({
- 'name': 'facetButton',
- 'module': './contentbar_components/Button',
- 'position': 'trailing',
- 'label': StringResource.get('sort'),
- 'responsive': false,
- 'className': 'contentNavSortButton',
- 'icon': 'ba_content_nav-sort_16',
- 'bSVG': true,
- 'disabled': false,
- 'pushed': false,
- 'action': this._sortViewFacetClicked.bind(this)
- });
- }
- items = items.concat(this.contentbarItems());
- return Promise.resolve(items);
- }.bind(this));
- },
- _sortViewFacetClicked: function() {
- var filterButton = this.contentBar.itemMap.facetButton.$el.find('button');
- if (this.contentBar.itemMap.facetButton.pushed === false && filterButton.prop('disabled') === false) {
- this.contentBar.itemMap.facetButton.pushed = true;
- filterButton.addClass('filtered');
- this.glassContext.appController.showSlideOut({
- 'parent': this.slideout,
- 'label': StringResource.get('sort'),
- 'width': '200px',
- 'content': {
- 'module': 'bacontentnav/common/SortView',
- 'view': this
- }
- }).on('hide', function() {
- filterButton.removeClass('filtered');
- this.contentBar.itemMap.facetButton.pushed = false;
- }.bind(this));
- }
- },
- _resetSelectedSortViewFacets: function() {
- // Default setting
- this.selected = {
- sortBy: 'name',
- order: 'asc'
- };
- this.updateSortColumn(this.selected);
- },
- /**
- * Should be overridden if custom controls are to be placed in the content bar
- **/
- contentbarItems: function() {
- return [];
- },
- /**
- * Should be overridden if copy/move action will be invoked from this view
- **/
- _getDefaultSelfURL: function() {
- var returnUrl = '';
- if (this.folder) {
- returnUrl = ContentServiceUrls.getBaseObjectsURL() + '/' + this.folder;
- }
- return returnUrl;
- },
- /**
- * Create the content bar
- **/
- _createContentBar: function() {
- return this._contentbarItems().then(function(items) {
- if (!items || items.length === 0) {
- return Promise.resolve(null);
- } else {
- this.$contentbar = $('<div class="contentexplorerbar"></div>');
- this.getContainer().prepend(this.$contentbar);
- this.contentBar = new ContentBar({
- el: this.$contentbar,
- items: items,
- appController: this.appController,
- appBarConfig: {
- showHome: false,
- showLogout: false
- }
- });
- return this.contentBar.render().then(function() {
- return Promise.resolve(this);
- }.bind(this.contentBar));
- }
- }.bind(this));
- },
- /**
- * Query for properties from the parent object if we don't already have them
- **/
- getParentProperties: function() {
- if (this.parentObj || !this.selfUrl) {
- return Promise.resolve(true);
- }
- var options = {
- url: this.selfUrl,
- dataType: 'json',
- type: 'GET',
- data: {
- 'fields': 'permissions'
- }
- };
- return this.glassContext.getCoreSvc('.Ajax').ajax(options)
- .then(function(response) {
- this.parentObj = response.data.data[0];
- // Make sure the last ancestor has the information we just queried for. This helps reduce the
- // number of http requests when navigating using the breadcrumbs
- if (this.ancestors) {
- _.last(this.ancestors).permissions = this.parentObj.permissions;
- }
- }.bind(this))
- .catch(function(err) {
- GlassContextHelper.showAjaxServiceError(this.glassContext, err);
- return Promise.reject(err);
- }.bind(this));
- },
- getContextMenuId: function() {
- return UIHelper.getConfiguration('contextMenuId');
- },
- getPersonalViewModulePath: function() {
- return UIHelper.getConfiguration('modulePaths').myContent;
- },
- getTeamViewModulePath: function() {
- return UIHelper.getConfiguration('modulePaths').teamContent;
- },
- _multiselectbarItems: function() {
- return Promise.resolve([{
- 'name': 'selectedLabel',
- 'position': 'leading',
- 'label': '',
- 'module': '../../lib/gemini/app/ui/toolbar_components/Label',
- 'style': 'selectedLabel'
- }, {
- 'name': 'cancelButton',
- 'position': 'trailing',
- 'label': StringResource.get('cancel'),
- 'text': StringResource.get('cancel'),
- 'labelOnly': true,
- 'module': './contentbar_components/Button',
- 'className': 'cancelButton',
- 'action': function() {
- this._listControl._clearRows();
- this.hideMultiSelectBar();
- this.setFocus();
- }.bind(this)
- }, {
- 'name': 'ellipsesButton',
- 'position': 'trailing',
- 'icon': 'common-menuoverflow',
- 'module': './contentbar_components/Button',
- 'label': StringResource.get('more'),
- 'className': 'ellipsesButton',
- 'action': function(event) {
- var position = {};
- if (event.type === 'keypress') {
- position = $(event.target).offset();
- } else {
- position.left = event.pageX || event.gesture.center.pageX;
- position.top = event.pageY || event.gesture.center.pageY;
- }
- var selectedContext = this._listControl.getSelectedObjects();
- var args = {
- 'position': {
- 'pageX': position.left,
- 'pageY': position.top
- },
- 'menuId': this.getContextMenuId(),
- 'activeObject': {
- 'oListControl': this._listControl,
- 'aSelectedContext': selectedContext
- },
- options: this._listControl.getPublicSelectedObjects(selectedContext)
- };
- event.stopPropagation();
- this.glassContext.appController.showContextMenu(args);
- return false;
- }.bind(this)
- }]);
- },
- /**
- * Return/create the multiselect bar
- **/
- _createMultiSelectBar: function() {
- return this._multiselectbarItems().then(function(items) {
- this.$multiselectbar = $('<div id="' + _.uniqueId('multiselectbar_') + '" class="multiselectbar"></div>');
- this.getContainer().prepend(this.$multiselectbar);
- this.multiselectBar = new ContentBar({
- el: this.$multiselectbar,
- items: items,
- appController: this.appController,
- appBarConfig: {
- showHome: false,
- showLogout: false
- },
- onHide: function() {
- this.$el.removeClass('multiselectbarContentNav');
- },
- onShow: function() {
- this.$el.addClass('multiselectbarContentNav');
- }
- });
- this.$multiselectbar.attr('aria-live', 'polite');
- this.multiselectBar.hide();
- return this.multiselectBar.render().then(function() {
- return Promise.resolve(this);
- }.bind(this.multiselectBar));
- }.bind(this));
- },
- getFilterColumnIndex: function() {
- return 0;
- },
- getAncestors: function() {
- return this.ancestors;
- },
- /**
- * Filter the datatable
- **/
- _filter: function(filterString) {
- if (!this._listControl) {
- return;
- }
- if (filterString === 'allContent' && this.currentFilters[filterString + '_' + this.id]) {
- // All Content exists - it was checked and now it is being unchecked - get rid of everything
- _.each(this.getFilterSpec(), function(filterObj) {
- delete this.currentFilters[filterObj.name + '_' + this.id];
- }.bind(this));
- } else if (filterString === 'allContent') {
- // All Content does not exist - it was unchecked and now it is being checked - add all filters
- _.each(this.getFilterSpec(), function(filterObj) {
- this.currentFilters[filterObj.name + '_' + this.id] = filterObj.name;
- }.bind(this));
- } else if (this.currentFilters[filterString + '_' + this.id]) {
- // The selected filter is already checked, delete it
- delete this.currentFilters[filterString + '_' + this.id];
- // When we remove a filter, it could be the first one removed - this should toggle off the all content
- if (this.currentFilters['allContent_' + this.id]) {
- delete this.currentFilters['allContent_' + this.id];
- }
- } else {
- this.currentFilters[filterString + '_' + this.id] = filterString;
- // When we add a filter, it could make every filter checked - if so, toggle on the all content again
- if (this.getFilterCountPerId() === this.getFilterSpec().length - 1) {
- this.currentFilters['allContent_' + this.id] = 'allContent';
- }
- }
- // Build the filter string
- var contentListFilter = '';
- if (this.getFilterCountPerId() === 0) {
- contentListFilter = 'none';
- } else if (this.contentListFacets && !this.currentFilters['allContent_' + this.id]) {
- _.each(this.getFilterSpec(), function(filterObj) {
- if (this.currentFilters[filterObj.name + '_' + this.id]) {
- contentListFilter = this.contentListFacets[filterObj.name] + (contentListFilter ? '|' + contentListFilter : '');
- }
- }.bind(this));
- }
- this._listControl.filter(contentListFilter, this.getFilterColumnIndex(), true);
- },
- /**
- * When there are several different filter menus (distinguished by their menu id), need to be able to determine how many
- * filters are set for a specific menu.
- */
- getFilterCountPerId: function() {
- return Object.keys(this.currentFilters).filter(function(key) {
- return key.indexOf(this.id) > -1;
- }.bind(this)).length;
- },
- updateFilterString: function(filterString) {
- if (this.stateId && UIHelper.isLocalStorageSupported()) {
- localStorage.setItem('filterString_' + this.stateId, filterString);
- }
- },
- /**
- Default to public folders, unless it's my_folders or specific storeid
- **/
- getRootAncestor: function() {
- return (this.folder === '.my_folders') ? ContentStoreObject.getRootMyFoldersAncestors() : ContentStoreObject.getRootPublicFoldersAncestor();
- },
- /**
- Check whether this.folder is a public/my folder or a storeId
- **/
- _folderIsId: function() {
- return this.folder && this.folder.match(/^i[0-9A-F]{32}$/);
- },
- initializeAncestors: function() {
- return new Promise(function(resolve) {
- //Sometimes the breadcrumbs will need to be kept track of without being shown
- if ((this.showBreadcrumbs || this.trackBreadcrumbs) && this.ancestors.length === 0) {
- if (!this._folderIsId()) {
- this.ancestors.push(this.getRootAncestor());
- resolve(this.ancestors);
- } else if (this.skipAncestors) {
- this._sendRequestForMissingInfo('permissions,defaultName', this.selfUrl).then(function(oData) {
- this.ancestors = [ContentStoreObject.buildAncestorEntry(oData)];
- resolve(this.ancestors);
- }.bind(this));
- } else {
- this._sendRequestForMissingInfo('permissions,ancestors,defaultName', this.selfUrl).then(function(oData) {
- this.ancestors = ContentStoreObject.buildAncestorTree(oData);
- resolve(this.ancestors);
- }.bind(this));
- }
- } else {
- resolve(this.ancestors);
- }
- }.bind(this));
- },
- addURLParameters: function(oProperties) {
- $.each(oProperties, function(name, value) {
- // Special case for fields, each view can add to the list of properties needed
- if (this._urlParameters[name] && name === 'fields') {
- this._urlParameters[name] = this._urlParameters[name] + ',' + value;
- } else {
- this._urlParameters[name] = value;
- }
- }.bind(this));
- },
- getURLParameters: function() {
- return this._urlParameters;
- },
- /**
- Creates the Wide view(s) to the object oData
- @param showChildren {boolean}: optional argument, if true the view will show the children of the first parameter oData
- **/
- openSlideoutView: function(oData, showChildren) {
- this.logger.debug('ContentListPageView.openSlideoutView', oData, showChildren);
- var renderFromReact = oData.renderFromReact;
- this._queryMissingInfoToOpenView(oData).then(function(oData) {
- var ancestors = ContentStoreObject.getAncestors(oData);
- if (!ancestors) {
- return;
- }
- if(ancestors.length > 0){
- var rootUrl = ContentStoreObject.getSelfLink(ancestors[0]);
- var pluginId = rootUrl === ContentServiceUrls.getPublicFoldersURL() ? 'com.ibm.bi.contentApps.teamFoldersSlideout' : 'com.ibm.bi.contentApps.myContentFoldersSlideout';
- }
- var plugin = this.glassContext.appController.findPlugin(pluginId);
- if(plugin) {
- if(plugin.$el) {
- this.glassContext.appController.hideSlideOut().then(function(){
- plugin.$el.trigger('click');
- });
- } else {
- this.logger.error('Plugin with id="' + pluginId + '" does not have $el');
- }
- plugin.itemSpec.options.content.initialFolder = oData;
- plugin.itemSpec.options.content.renderFromReact = renderFromReact;
- } else {
- this.logger.error('Cannot find plugin with id="' + pluginId + '"');
- }
- }.bind(this)).catch(function() {
- // Add function to catch the error
- });
- },
- _queryMissingInfoToOpenView: function(oData) {
- return new Promise(function(resolve, reject) {
- var url = ContentStoreObject.getSelfLink(oData);
- var ancestors = ContentStoreObject.getAncestors(oData);
- if (url && ancestors) {
- resolve(oData);
- } else if (url) {
- // Query for the information we need to open the view (ancestors and defaultName)
- this._sendRequestForMissingInfo('ancestors,defaultName', url).then(function(obj) {
- resolve(obj);
- });
- } else {
- reject(new Error('No self url to open view'));
- }
- }.bind(this));
- },
- _sendRequestForMissingInfo: function(fields, url) {
- var options = {
- url: url,
- dataType: 'json',
- type: 'GET',
- data: {
- 'fields': fields
- }
- };
- return this.glassContext.getCoreSvc('.Ajax').ajax(options)
- .then(function(response) {
- return response.data.data[0];
- })
- .catch(function(err) {
- GlassContextHelper.showAjaxServiceError(this.glassContext, err);
- return Promise.reject(err);
- }.bind(this));
- },
- /**
- * Callback used when the user clicks on a breadcrumb
- * @index {int} - the index in the ancestor array for the breadcrumb that was clicked on
- **/
- _navigateAncestor: function(index) {
- if (index >= this.ancestors.length - 1 || (this._propertiesOpen) || (this._newURLOpen)) {
- if (this._propertiesOpen) {
- this.closeProperties();
- }
- if (this._newURLOpen) {
- this.closeNewURL();
- }
- return;
- }
- var ancestorEntry = this.ancestors[index];
- this.ancestors = this.ancestors.slice(0, index);
- this.navigate(ancestorEntry);
- },
- /**
- * Helper function to render a new pageView with new content
- **/
- navigate: function(oData, row) {
- this.logger.debug('ContentListPageView.navigate', oData);
- void(row);
- if (!oData) {
- return;
- }
- if (!UIHelper.isContainer(ContentStoreObject.getType(oData))) {
- return;
- }
- if (this._propertiesOpen) {
- this.closeProperties();
- }
- this.parentObj = oData.permissions ? oData : null;
- this.url = ContentStoreObject.getItemsLink(oData);
- this.selfUrl = ContentStoreObject.getSelfLink(oData);
- if (this.parentObj && this.parentObj.permissions) {
- this._listControl.setParentHasWritePermission(ContentStoreObject.hasPermissions(this.parentObj, ['write']));
- }
- if (this._listControl && this._listControl.updateDatatable) {
- this._listControl.updateDatatable(this.url);
- this.refreshBreadcrumbs(oData);
- this._updateAppBar();
- }
- var currentLocation = ContentStoreObject.getName(this.ancestors[this.ancestors.length - 1]);
- if (currentLocation && currentLocation.length) {
- A11YHelper.screenReaderAlertUser(StringResource.get('a11yContentListUpdatedNotification', {
- 'folderOrPackageName': currentLocation
- }));
- }
- },
- _updateTeamRoot: function(){
- if (this.inTeamRoot) {
- $('body').addClass('inTeamRootNav');
- } else {
- $('body').removeClass('inTeamRootNav');
- }
- },
- _updateAppBar: function() {
- // update team root flag and then do the team root update
- this.inTeamRoot = this.ancestors && this.ancestors.length === 1 && this.ancestors[0].id === '.public_folders';
- this._updateTeamRoot();
- return this.getParentProperties().then(function() {
- var hasWrite = ContentStoreObject.hasPermissions(this.parentObj, ['write']);
- if (this.showParentPropertiesButton) {
- // Only show the parent properties button if we're at the root of Team Content
- var display = this.inTeamRoot && hasWrite ? 'inline-block' : 'none';
- this._updateAppbarButton('.parentProperties', display);
- }
- if (this.showAddFolder) {
- this._updateAppbarButton('.addNewFolder', hasWrite ? 'inline-block' : 'none');
- }
- // hide new item button if the context menu is empty
- // context menu is empty when user cannot create url or user cannot create new folder
- if (!this.isAllowNewFolder() && this.inTeamRoot){
- this._updateAppbarButton('.newItemButton', 'none');
- } else {
- this._updateAppbarButton('.newItemButton', 'inline-block');
- }
- }.bind(this));
- },
- /**
- * check if user has the capability to create a new folder
- * */
- isAllowNewFolder: function() {
- var userProfileSettings = this.glassContext.services.userProfile && this.glassContext.services.userProfile.userProfileSettings;
- var allowNewFolder = !(userProfileSettings &&
- userProfileSettings.ui_excludedFeatures &&
- userProfileSettings.ui_excludedFeatures.ids &&
- userProfileSettings.ui_excludedFeatures.ids.indexOf('com.ibm.bi.contentApps.Folder') >= 0);
- return allowNewFolder;
- },
- _updateAppbarButton: function(cssClass, display) {
- if(this.$contentbar) {
- var button = this.$contentbar.find(cssClass).parent();
- button.css('display', display);
- // Hide/show the separator if it's right after the button we're updating
- var nextNode = button.next();
- var previousVisibleNode = button.prevAll(':visible:first');
- if ((previousVisibleNode.length === 0 || previousVisibleNode.hasClass('appbarSeparatorItem')) && nextNode.hasClass('appbarSeparatorItem')) {
- nextNode.css('display', display);
- }
- }
- },
- refreshBreadcrumbs: function(oData) {
- this.logger.debug('ContentListPageView.refreshBreadcrumbs', oData);
- var ancestorEntry = ContentStoreObject.buildAncestorEntry(oData);
- this.ancestors.push(ancestorEntry);
- if (this.showBreadcrumbs) {
- this.contentBar.getAddedItem('breadcrumbs').then(function(breadcrumbsView) {
- breadcrumbsView.updateBreadcrumb(this.ancestors);
- }.bind(this));
- }
- if (this.navigateCallback) {
- this.navigateCallback(this.ancestors);
- }
- },
- isEnabledAction: function(actionName) {
- return !(this.disabledActions && this.disabledActions.indexOf(actionName) > -1);
- },
- _getFilterItems: function(filterSpec, filterMenuPrefix, defaultFilterValue, doFilter) {
- return _.map(filterSpec, function(item) {
- return {
- 'name': filterMenuPrefix + item.name,
- 'icon': 'wft_checkmark',
- 'label': item.label,
- 'checked': item.value === defaultFilterValue,
- 'action': function() {
- doFilter(item.name);
- }
- };
- });
- },
- // Overridden
- getFilterSpec: function() {
- return [];
- },
- // Overridden
- getSortSpec: function() {
- return {
- sortBy: {
- name: 'name',
- modificationTime: 'modificationTime'
- },
- order: {
- sortedAscending: 'asc',
- sortedDescending: 'desc'
- }
- };
- },
- // Overridden
- // Map single column sorting to multi-column sorting
- getSortMappingSpec: function() {
- return {
- name: ['groupByFolder', 'name'],
- modificationTime: ['groupByFolder', 'modificationTime'],
- type: ['groupByType', 'name']
- };
- },
- getListControl: function() {
- return this._listControl;
- },
- sort: function() {
- if (!this.getListControl()) {
- return;
- }
- var columnName = localStorage.getItem('sortColumnName_' + this.stateId);
- var direction = localStorage.getItem('sortColumnDir_' + this.stateId);
- var sortArray = [];
- if (this.getListControl()) {
- var dt = this.getListControl().getDatatable();
- var index = -1;
- for (var i = 0; i < this.sortMappingSpec[columnName].length; i++) {
- index = dt.api().column(this.sortMappingSpec[columnName][i] + ':name').index();
- if (index >= 0) {
- sortArray.push([index, direction]);
- }
- }
- }
- if (sortArray.length > 0) {
- dt.api().order(sortArray).draw();
- }
- },
- updateSortColumn: function(selectedSort) {
- if (this.stateId && UIHelper.isLocalStorageSupported()) {
- localStorage.setItem('sortColumnName_' + this.stateId, selectedSort.sortBy);
- localStorage.setItem('sortColumnDir_' + this.stateId, selectedSort.order);
- }
- },
- _getSortItems: function(sortSpec, menuPrefix, defaultColumn, defaultSortDirection, doSort) {
- return _.map(sortSpec, function(item) {
- return {
- 'name': menuPrefix + item.name,
- 'label': item.label,
- 'icon': 'sortDirection',
- 'sorted': item.value === defaultColumn ? defaultSortDirection : null,
- 'action': function() {
- doSort(item.value);
- }
- };
- });
- },
- filterViewClicked: function() {
- return;
- },
- getContainer: function() {
- return this.contentListContainer || this.$el;
- },
- hideMultiSelectBar: function() {
- if (this.multiselectBar) {
- this.multiselectBar.hide();
- }
- var contentBar = this.folderSearchBar && this.folderSearchBar.isVisible() ? this.folderSearchBar : this.contentBar;
- if (contentBar) {
- contentBar.show();
- }
- },
- showMultiSelectBar: function(isAccountPickerSlideout) {
- if (this.selectAcrossFolders) {
- return;
- }
- var contentBar = this.folderSearchBar && this.folderSearchBar.isVisible() ? this.folderSearchBar : this.contentBar;
- if (contentBar) {
- contentBar.hide();
- }
- if (this.multiselectBar) {
- if (isAccountPickerSlideout) {
- var ellipsis = this.multiselectBar.$el.find('div.appbarLeading');
- $(ellipsis[0]).css('visibility', 'hidden');
- }
- this.multiselectBar.show();
- }
- },
- updateMultiSelectBarText: function(noOfItemSelected) {
- if (this.multiselectBar) {
- this.multiselectBar.getAddedItem('selectedLabel').then(function(selectedLabelObject) {
- selectedLabelObject.text(noOfItemSelected);
- }.bind(this));
- }
- },
- // Overridden
- getNewItemSpec: function() {
- return Promise.resolve([]);
- },
- // Overridden
- createNewItem: function(type) {
- void(type);
- },
- _getNewItems: function() {
- return this.getNewItemSpec().then(function(data){
- return _.map(data, function(item) {
- // strip '#' prefix, if appl.
- var icon = UIHelper.getSVGIconForType(item.type).replace(/^#/, '');
- return {
- 'label': UIHelper.getTypeName(item.type),
- 'icon': icon,
- 'onSelect': this.createNewItem.bind(this, item.type)
- };
- }.bind(this));
- }.bind(this));
- },
- _createNewItemDropDown: function($parent) {
- return this._getNewItems().then(function(data){
- this.newItemDropDown = new DropDownMenu({
- dropDownMenuSpec: {
- 'title': StringResource.get('newItemMenuLabel'),
- 'id': 'newItemMenu',
- 'label': 'newItemMenu',
- 'icon': '',
- 'items': data,
- 'actionElement': $parent[0],
- 'ddMenuPlacement': 'bottom',
- 'class': 'newItemDropDown'
- }
- });
- return this.newItemDropDown.render();
- }.bind(this));
- },
- _openNewItemMenu: function() {
- if (this.newItemDropDown) {
- this.newItemDropDown.show();
- } else {
- return new Promise(function(resolve, reject){
- var $newItemButton = this.$el.find('.newItemButton');
- $newItemButton.attr('tabindex', '0');
- this._createNewItemDropDown($newItemButton)
- .then(function(newItemDropDown) {
- $newItemButton.trigger('click');
- resolve(newItemDropDown);
- }.bind($newItemButton)).catch(function(err){
- reject(err);
- });
- }.bind(this));
- }
- }
- });
- _.extend(ContentListPageView);
- return ContentListPageView;
- });
- /*
- *+------------------------------------------------------------------------+
- *| Licensed Materials - Property of IBM
- *| IBM Cognos Products: SEARCH
- *| (C) Copyright IBM Corp. 2017, 2018
- *|
- *| US Government Users Restricted Rights - Use, duplication or disclosure
- *| restricted by GSA ADP Schedule Contract with IBM Corp.
- *+------------------------------------------------------------------------+
- */
- define('bacontentnav/common/ui/FolderSearchBar',['jquery',
- 'underscore',
- '../../lib/@waca/core-client/js/core-client/ui/View',
- '../../lib/@waca/core-client/js/core-client/utils/Utils',
- '../../lib/@waca/core-client/js/core-client/utils/BidiUtil',
- '../../nls/StringResource',
- 'jquery-ui'], function($, _, View, Utils, BidiUtil, StringResources) {
- /**
- * Represents a search bar that can be added to an app bar
- */
- var FolderSearchBar = View.extend({
- events: {
- clicktap: 'action'
- },
- /**
- * Creates a search bar
- */
- init: function(spec) {
- _.extend(this, spec);
- FolderSearchBar.inherited('init', this, arguments);
- this.folderSearchbarInitialized = false;
- // search input
- this.$input = $('<input class="searchinput">')
- .attr({
- type: 'search',
- value: this.value,
- placeholder: StringResources.get('searchFolder'),
- title: this.label,
- maxlength: 256,
- role: 'combobox',
- 'aria-autocomplete': 'list'
- })
- .on('search', this.search.bind(this))
- .on('change', this.resetState.bind(this))
- .on('focus', this.setCaret.bind(this))
- .keydown(
- function(e) {
- if (e.which === 27) {
- //ESC key
- if (!_.isEmpty(this.getSearchString())) {
- this.hadTypeaheadContent = true;
- this.controller.onClear();
- e.stopPropagation();
- }
- }
- }.bind(this)
- )
- .keyup(
- function(e) {
- if (e.which === 27) {
- //ESC key
- if (this.hadTypeaheadContent) {
- this.hadTypeaheadContent = false;
- e.stopPropagation();
- }
- } else if (e.which !== 9 && e.which !== 16) {
- // if not tab/shift
- this.search(e);
- }
- }.bind(this)
- );
- BidiUtil.initElementForBidi(this.$input[0]);
- // search button
- this.$searchButton = $('<button class="s4h" disabled></button>').attr({
- type: 'button',
- title: StringResources.get('search')
- });
- Utils.setIcon(this.$searchButton, 'common-search');
- // clear search button
- this.$clearSearchButton = $('<button class="s4hReset" ></button>')
- .attr({
- type: 'reset',
- title: StringResources.get('clear')
- })
- .on('clicktap', this.clear.bind(this));
- Utils.setIcon(this.$clearSearchButton, 'common-close-cancel-error');
- this.hadTypeaheadContent = false;
- },
- setCaret: function(e) {
- e.stopPropagation();
- window.setTimeout(
- function() {
- this.moveCaretToEnd(this.$input[0]);
- }.bind(this),
- 0
- );
- },
- moveCaretToEnd: function(el) {
- if (typeof el.selectionStart == 'number' && !this.folderSearchbarInitialized) {
- el.selectionStart = el.selectionEnd = el.value.length;
- this.folderSearchbarInitialized = true;
- } else if (typeof el.createTextRange != 'undefined') {
- el.focus();
- var range = el.createTextRange();
- range.collapse(false);
- range.select();
- }
- },
- /**
- * Draws the Search bar
- */
- render: function() {
- this.$el
- .empty()
- .addClass('searchbar appbarIcon appbarItem filled s4hBar')
- .append(this.$searchButton, [this.$input, this.$clearSearchButton]);
- if (!this.value) {
- this.$el.removeClass('filled');
- }
- this.setFocus();
- return Promise.resolve(this);
- },
- /**
- * Show the Search bar
- * @param {boolean} noFocus - no focus needed
- */
- show: function(noFocus) {
- if (this.isHidden()) {
- this.$input.fadeIn('fast');
- this.$searchButton.fadeIn('fast');
- this.$clearSearchButton.fadeIn('fast');
- this.$el.slideDown('fast');
- if (!noFocus) {
- this.setFocus();
- this.$input.select();
- }
- }
- },
- /**
- * handle search event
- * @param {object} e - search event
- */
- search: function(e) {
- var searchString = this.getSearchString();
- this.controller.applyFilter(searchString);
- this.setFocus();
- this.showHideClearSearchButton();
- if (e) {
- e.preventDefault();
- }
- },
- /**
- * handle the event when clear button is clicked
- */
- clear: function() {
- if (this.$input.val() !== '') {
- this.gainFocus = true;
- this.$input.val('');
- this.$input.select();
- this.setFocus();
- this.showHideClearSearchButton();
- if (this.controller.renderFromReact) {
- this.controller.clearSearch();
- } else {
- this.controller.clearFilter();
- }
- }
- },
- /**
- * set search string to input control
- * @param {string} searchString - search string to be set
- */
- setSearchString: function(searchString) {
- var str = _.isString(searchString) ? searchString : '';
- if (this.getSearchString() !== str) {
- this.$input.val(str);
- }
- this.showHideClearSearchButton();
- },
- /**
- * get search string from input control
- * @return {string} search string in input control
- */
- getSearchString: function() {
- return this.$input.val().trim();
- },
- /**
- * Hide the Search bar
- * @param {boolean} preserveInput - should input value be preserved
- */
- hide: function(preserveInput) {
- if (!this.$el.is(':hidden')) {
- this.$el.slideUp('fast');
- this.$input.fadeOut('fast').blur();
- if (!preserveInput) {
- this.$input.val('');
- }
- this.$searchButton.fadeOut('fast');
- this.$clearSearchButton.fadeOut('fast');
- }
- },
- /**
- * Is the search bar hidden
- * @return {boolean} true - the search is hidden, otherwise false;
- */
- isHidden: function() {
- return this.$el.is(':hidden');
- },
- /**
- * show or hide clear search button based on input value is empty or not
- */
- showHideClearSearchButton: function() {
- if (this.$input.val()) {
- this.$el.addClass('filled');
- } else {
- this.$el.removeClass('filled');
- }
- },
- /**
- * set input control on focus
- */
- setFocus: function() {
- if (!this.$input.is(':focus')) {
- this.$input.focus();
- }
- },
- /**
- * reset state when input value changes
- */
- resetState: function() {
- this.showHideClearSearchButton();
- }
- });
- return FolderSearchBar;
- });
- /*
- *+------------------------------------------------------------------------+
- *| Licensed Materials - Property of IBM
- *| IBM Cognos Products: Content Explorer
- *| (C) Copyright IBM Corp. 2018
- *|
- *| US Government Users Restricted Rights - Use, duplication or disclosure
- *| restricted by GSA ADP Schedule Contract with IBM Corp.
- *+------------------------------------------------------------------------+
- */
- define('bacontentnav/utils/TextUtils',[
- ], function() {
- 'use strict';
- //some misc text manipulation methods
- return {
- /**
- * Returns a modified string where all 'regex' characters (such as \, [, ], $, etc) are escaped.
- * @param {String} string The string on which to replace all characters that could mess up a regex.
- */
- escapeRegexChars: function(string) {
- var retString = string;
- if (string && typeof string === 'string') {
- retString = retString.replace(/[-[\]{}()*+?.\\^$|#]/g, '\\$&');
- }
- return retString;
- }
- };
- });
- /*
- * Licensed Materials - Property of IBM
- *
- * IBM Cognos Products: GLASS
- *
- * (C) Copyright IBM Corp. 2017, 2018
- *
- * US Government Users Restricted Rights - Use, duplication or disclosure
- * restricted by GSA ADP Schedule Contract with IBM Corp.
- */
- define('bacontentnav/common/FolderSearchController',[
- '../lib/@waca/core-client/js/core-client/ui/core/Class',
- 'jquery',
- 'underscore',
- './ui/ContentBar',
- './ui/FolderSearchBar',
- '../utils/TextUtils'
- ], function(BaseClass, $, _, ContentBar, FolderSearchBar, TextUtils) {
- 'use strict';
- /**
- * This Class is folder search bar controller
- */
- var FolderSearchController = BaseClass.extend(
- /**
- * @lends FolderSearchController.prototype
- */
- {
- /**
- * Constructor
- * @param options.pageView {object} - The container's view
- * @param options.class {string} - the css class used to render search bar widget
- */
- init: function(options) {
- _.extend(this, options);
- FolderSearchController.inherited('init', this, arguments);
- this._filterColumnIndex = this._getFilterColumnIndex('MultipleProperties');
- this.value = '';
- },
- /**
- * Returns a promise resolved with search bar items (ie. SearchBar and cancel button )
- **/
- _folderSearchBarItems: function() {
- return new Promise(function(resolve /*,reject*/ ) {
- var items = [{
- 'name': 'searchInput',
- 'module': FolderSearchBar,
- 'position': 'leading',
- 'glassContext': this.pageView.glassContext,
- 'controller': this,
- 'label': '',
- 'value': this.value
- }];
- resolve(items);
- }.bind(this));
- },
- /**
- * Returns/creates the folder search bar
- **/
- createFolderSearchBar: function(onSearchFilter, onClearFilter, onClearSearchFilter, renderFromReact) {
- this.onSearchFilter = onSearchFilter;
- this.onClearFilter = onClearFilter;
- this.onClearSearchFilter = onClearSearchFilter;
- this.renderFromReact = renderFromReact;
- return this._folderSearchBarItems().then(function(items) {
- this.$folderSearchBar = $('<div id="' + _.uniqueId('contentsearchbar_') + '" class="' + this.class + '"></div>');
- this.getContainer().prepend(this.$folderSearchBar);
- this._contentBar = new ContentBar({
- el: this.$folderSearchBar,
- items: items,
- appController: this.pageView.appController,
- appBarConfig: {
- showHome: false,
- showLogout: false
- }
- });
- this.$folderSearchBar.attr('aria-live', 'polite');
- this._contentBar.hide();
- return this._contentBar.render().then(function() {
- return this._contentBar.getAddedItem('searchInput').then(function(_searchInput){
- this.searchInput = _searchInput;
- _searchInput.search();
- return this._contentBar;
- }.bind(this));
- }.bind(this));
- }.bind(this));
- },
- /**
- * apply filter to the list control of the page view
- * @param {string} keyword - keyword uses to filter the list control;
- **/
- applyFilter: function(keyword) {
- var oldValue = this.value;
- if (this.onSearchFilter) {
- this.onSearchFilter(keyword);
- }
- keyword = TextUtils.escapeRegexChars(keyword);
- this.value = keyword;
- if (this.pageView) {
- if (this.pageView.getListControl()) {
- this.pageView.getListControl().filter(keyword, this._filterColumnIndex, true);
- }
- if (this._isStateChange(oldValue, keyword)) {
- this.pageView.trigger('filterState:change');
- }
- }
- },
- /**
- * clear filter to the list control of the page view
- **/
- clearFilter: function() {
- this.onClear();
- },
- clearSearch: function() {
- if (this.searchInput) {
- this.searchInput.clear();
- if (this.onClearSearchFilter) {
- this.onClearSearchFilter();
- }
- }
- },
- /**
- * called when the user clicks on cancel button of the search bar
- **/
- onClear: function() {
- if (this.searchInput) {
- this.searchInput.clear();
- }
- if (this.onClearFilter) {
- this.onClearFilter();
- }
- this.applyFilter('');
- },
- /**
- * find the corresponding index number in list control with the column name
- * @param {string} columnName - the name of the column
- * @return {int} column index number
- **/
- _getFilterColumnIndex: function(columnName) {
- var columns = this.pageView._getColumnSpecification(),
- i;
- for (i = 0; i < columns.length; i++) {
- if (columns[i].type === columnName) {
- return i;
- }
- }
- return -1;
- },
- /**
- * Is the current active element a editable element like input or textArea?
- * @return {boolean}
- */
- _isEditableTag: function(name) {
- return name === 'input' || name === 'textArea';
- },
- /**
- * is current focus on a input
- * @return {boolean} true - the current focus is on a input; otherwise false;
- **/
- _isCurrentFocusEditable: function() {
- var focus = $(document.activeElement);
- if (focus && this._isEditableTag(focus[0].localName)) {
- return true;
- } else {
- return false;
- }
- },
- /**
- * get the container of the current page view;
- * @return {object} - current container view;
- **/
- getContainer: function() {
- return this.pageView.getContainer();
- },
- /**
- * get the content bar of the current page view;
- * @return {object} - current content bar;
- **/
- getContentBar: function() {
- return this.pageView.contentBar;
- },
- /**
- * setter for search input value
- * @param {string} value - input value
- */
- setInputValue: function(value) {
- var oldValue = this.value;
- this.value = value;
- if (this._isStateChange(this.value, oldValue)) {
- this.pageView.trigger('filterState:change');
- }
- },
- _isStateChange: function(oldValue, newValue) {
- return oldValue === '' && newValue !== '' || oldValue !== '' && newValue === '';
- },
- /**
- * test if we should handle the keyboard event caught from contentListPageView
- * @param {object} e - keyboard event
- * @return true should handle the keyboard event; otherwise, false
- **/
- shouldHandle: function(e) {
- /* keyCodesList = [tab, enter, shift, ctrl, alt, esc, arrow left, arrow top, arrow right, arrow bottom]*/
- var keyCodesList = [9,13,16,17,18,27,37,38,39,40];
- var _shouldHandle = keyCodesList.indexOf(e.which) === -1 && keyCodesList.indexOf(e.keyCode) === -1 && !e.ctrlKey && !e.metaKey && !e.altKey;
- if (_shouldHandle && !this._isCurrentFocusEditable()) {
- return true;
- } else {
- return false;
- }
- },
- isDirty: function() {
- return this.value && this.value.trim() !== '';
- }
- });
- return FolderSearchController;
- });
- /*
- *+------------------------------------------------------------------------+
- *| Licensed Materials - Property of IBM
- *| IBM Cognos Products: SEARCH
- *| (C) Copyright IBM Corp. 2017, 2021
- *|
- *| US Government Users Restricted Rights - Use, duplication or disclosure
- *| restricted by GSA ADP Schedule Contract with IBM Corp.
- *+------------------------------------------------------------------------+
- */
- define('bacontentnav/common/FilterViewController',[
- 'underscore',
- 'moment',
- '../lib/@waca/core-client/js/core-client/ui/core/Class'
- ], function(_, Moment, Class) {
- 'use strict';
- /*
- * This class is the filter view controller
- */
- var Fvc = Class.extend({
- propertyUIControlModule: 'bi/commons/ui/properties/PropertyUIControl',
- /**
- * Constructor
- * @param options.view {string} - container's view
- */
- init: function(options) {
- Fvc.inherited('init', this, arguments);
- this.minRange = null;
- this.maxRange = null;
- this.dateModifiedLabel = '';
- this.view = options.view;
- //filterSpecs is a method that returns the columns specifications for filtering
- this.filterSpecs = options.filterSpecs;
- //find the filter column
- this.filterColumn = this.findTypeFilterColumn('Icon');
- this.filterObject = {
- //the filterObject contains all of our filter elements (folders, data, etc.)
- type: options.filterObject,
- modificationTime: options.modificationTime || {}
- };
- this.resultLimit = 50;
- this.setResultLimit = options.setResultLimit;
- this.strokeShown = false; // Small circle that appears above the filter after the filter is selected
- this.resetSelected();
- this.filteredClassShown = false;
- },
- /**
- * Sends out a 'filterState:change' event to the listening view.
- * The view is repsonsible for handling the filtering using the query and column provided.
- * @param {string} filterQuery - string which is passed in to the datatable's filter API
- **/
- filter: function(filterQuery) {
- this.view.trigger('filterState:change', { filterQuery:filterQuery, column:this.filterColumn });
- },
- /**
- * Sets the minimum and maximum range when the date modified filter has been triggered
- * Sends out a 'filterState:changeDate' event to the listening view.
- * The view is responsible for handling the filtering using the minRange, maxRange and/or the modificationTime
- * @param {string} value - string used to set the minRange and maxRange
- **/
- onChangeModificationTime: function(value) {
- var rangeVariable = value.split('|');
- this.minRange = rangeVariable[0] || null;
- this.maxRange = rangeVariable[1] || null;
- this._dateModifiedLabelSetter(value);
- //just redraw the datatable
- if (this.selected.modificationTime !== value) {
- this.selected.modificationTime = value;
- this.view.trigger('filterState:changeDate', { minRange: this.minRange, maxRange: this.maxRange, modificationTime: this.selected.modificationTime });
- }
- },
- /**
- * Sets the result limit.
- * Sends out a 'filterState:changeResutLimit' event to the listening view.
- * The view is responsible for handling the updating the view with the new result limit.
- * @param {number} value - new result limit
- **/
- onChangeResultLimit: function(value) {
- this.resultLimit = value;
- this.view.trigger('filterState:changeResutLimit', { resultLimit: value });
- },
- /**
- * returns the current result limit
- **/
- getResultLimit: function() {
- return this.resultLimit;
- },
- /**
- * Returns the column number where columnName matches what is in filterSpecs
- * @param {string} columnName - string used to find the column number with the associated name
- * @return {int} returns the column index number
- **/
- findTypeFilterColumn: function(columnName) {
- var columns = this.filterSpecs();
- for (var i = 0; i < columns.length; i++) {
- if (columns[i].type === columnName) {
- return i;
- }
- }
- return -1;
- },
- /**
- * returns an array of all individual selected types
- */
- getSelectedTypes: function() {
- var displayTypes = [];
- _.each(this.selected.types, function(type) {
- displayTypes = displayTypes.concat(type.split('|'));
- }.bind(this));
- return displayTypes;
- },
- /**
- * returns a stringified version of the currenctly selected types
- */
- getSelectedTypesQuery: function() {
- return this.selected.types.join('|');
- },
- /**
- * Concatenates queries based on which filter type has been selected
- * Removes queries if they have been unselected
- * @param {string} filter - string used to identify the filter being clicked
- * @param {boolean} state - used to identify whether or not the filter is checked
- * @returns True if the selection was added
- **/
- onChangeTypeFilter: function(filter, state) {
- var filterType = this.filterObject.type[filter];
- var ret = false;
- if (state) {
- if (this.selected.types.indexOf(filterType) === -1) {
- this.selected.types.push(filterType);
- ret = true;
- }
- } else {
- this.selected.types = _.without(this.selected.types, filterType);
- }
- return ret;
- },
- /**
- * Sets the date for modificationTime queries
- **/
- setDefaultFilters: function() {
- this.filterObject.modificationTime = {};
- var now = Moment().hour(0).minute(0).second(0).millisecond(0).add(1, 'd');
- this.filterObject.modificationTime.today = now.clone().subtract(1, 'd').toISOString() +
- '|' + now.toISOString();
- this.filterObject.modificationTime.yesterday = now.clone().subtract(2, 'd').toISOString() +
- '|' + now.clone().subtract(1, 'd').toISOString();
- this.filterObject.modificationTime.pastWeek = now.clone().subtract(1, 'w').toISOString() +
- '|' + now.toISOString();
- this.filterObject.modificationTime.pastMonth = now.clone().subtract(1, 'M').toISOString() +
- '|' + now.toISOString();
- },
- /**
- * programatically sets a filter type.
- * returns a promise that is resolved when the filter is rerendered
- * @param {String} filter
- */
- addFilter: function(filter) {
- if (this.onChangeTypeFilter(filter, true)) {
- this.filter(this.getSelectedTypesQuery(), this.filterColumn);
- }
- //update the UI
- if (this.filterView) {
- return this.filterView.render();
- } else {
- return Promise.resolve();
- }
- },
- /**
- * returns true if the provided filter type has been filtered.
- */
- isFiltered: function(filter) {
- return this.selected.types.indexOf(filter) !== -1;
- },
- /**
- * returns true if the user has filtered anything
- */
- isDirty: function() {
- return this.selected.types.length > 0 || (this.minRange !== null && this.maxRange !== null);
- },
- /**
- * Resets all of our selections
- */
- resetSelected: function() {
- this.setDefaultFilters();
- this.selected = {
- 'types': [],
- 'modificationTime': null
- };
- this.minRange = null;
- this.maxRange = null;
- this.dateModifiedLabel = '';
- },
- /**
- * Removes a 'filtered' css clas to the provided button
- */
- removeFilteredClass: function(button) {
- if (this.selected.types.length == 0 && this.minRange === null && this.maxRange === null) {
- $(button).removeClass('filtered');
- this.filteredClassShown = false;
- }
- },
- /**
- * Adds a 'filtered' css clas to the provided button
- */
- addFilteredClass: function(button) {
- if (!this.filteredClassShown) {
- $(button).addClass('filtered');
- this.filteredClassShown = true;
- }
- },
- /**
- * Returns the currently set Modification Time
- */
- getModificationTime: function() {
- return this.selected.modificationTime;
- },
- /**
- * Returns the currently set Minimum Date range, or null if not set
- */
- getMinRange: function() {
- return this.minRange;
- },
- /**
- * Returns the currently set Maximum Date range, or null if not set
- */
- getMaxRange: function() {
- return this.maxRange;
- },
- /**
- * Sets the dateModifiedLabel (which is a concatenation of minRange and maxRange)
- * @param {string} value - string used to set dateModifiedLabel so the state of date modification time will be remembered
- * if the filter gets re-rendered
- **/
- _dateModifiedLabelSetter: function(value) {
- // Empty string is treated as falsy
- if (value === '') {
- this.dateModifiedLabel = '';
- } else {
- this.dateModifiedLabel = value ? value : this.dateModifiedLabel;
- }
- }
- });
- return Fvc;
- });
- !function(e,i){if("object"==typeof exports&&"object"==typeof module)module.exports=i(require("@ba-ui-toolkit/ba-graphics/dist/icons-js/ba-graphics-icons-commons.js"));else if("function"==typeof define&&define.amd)define('bacontentnav/lib/@ba-ui-toolkit/ba-graphics/dist/icons-js/filter-applied_16',["@ba-ui-toolkit/ba-graphics/dist/icons-js/ba-graphics-icons-commons.js"],i);else{var o=i("object"==typeof exports?require("@ba-ui-toolkit/ba-graphics/dist/icons-js/ba-graphics-icons-commons.js"):e["@ba-ui-toolkit/ba-graphics/dist/icons-js/ba-graphics-icons-commons.js"]);for(var s in o)("object"==typeof exports?exports:e)[s]=o[s]}}("undefined"!=typeof self?self:this,function(e){return webpackJsonPBaGraphics([1239],{"3865314c5959606874d4":function(i,o){i.exports=e},"47a4fa6d8010c58f1e00":function(e,i,o){"use strict";Object.defineProperty(i,"__esModule",{value:!0});var s=o("3865314c5959606874d4"),a=(o.n(s),o("e21347f38ade5a747478"));i.default=a.a},e21347f38ade5a747478:function(e,i,o){"use strict";var s=o("9689a9c94ae38b47fa2c"),a=o.n(s),c=o("9ce58a7deea14f49ef01"),t=o.n(c),n=new a.a({id:"filter-applied_16_v7",use:"filter-applied_16_v7-usage",viewBox:"0 0 16 16",content:'<symbol xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" id="filter-applied_16_v7"><path d="M10 7c.8 0 1.5.7 1.5 1.5S10.8 10 10 10s-1.5-.7-1.5-1.5S9.2 7 10 7zm3-5H3c-.6 0-1 .4-1 1v1.8c0 .3.1.5.3.7L6 9.2V13c0 .6.4 1 1 1h2c.6 0 1-.4 1-1v-1.5c-.3 0-.7-.1-1-.2V13H7V8.8l-4-4V3h10v1.8l-1.3 1.3c.3.2.5.4.7.7l1.3-1.3c.2-.2.3-.4.3-.7V3c0-.6-.4-1-1-1z" /></symbol>'});t.a.add(n);i.a=n}},["47a4fa6d8010c58f1e00"])});
- !function(e,o){if("object"==typeof exports&&"object"==typeof module)module.exports=o(require("@ba-ui-toolkit/ba-graphics/dist/icons-js/ba-graphics-icons-commons.js"));else if("function"==typeof define&&define.amd)define('bacontentnav/lib/@ba-ui-toolkit/ba-graphics/dist/icons-js/filter_16',["@ba-ui-toolkit/ba-graphics/dist/icons-js/ba-graphics-icons-commons.js"],o);else{var s=o("object"==typeof exports?require("@ba-ui-toolkit/ba-graphics/dist/icons-js/ba-graphics-icons-commons.js"):e["@ba-ui-toolkit/ba-graphics/dist/icons-js/ba-graphics-icons-commons.js"]);for(var i in s)("object"==typeof exports?exports:e)[i]=s[i]}}("undefined"!=typeof self?self:this,function(e){return webpackJsonPBaGraphics([1233],{"2a291322f8aea355dd92":function(e,o,s){"use strict";var i=s("9689a9c94ae38b47fa2c"),t=s.n(i),c=s("9ce58a7deea14f49ef01"),a=s.n(c),n=new t.a({id:"filter_16_v7",use:"filter_16_v7-usage",viewBox:"0 0 16 16",content:'<symbol xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" id="filter_16_v7"><path d="M9 14H7c-.6 0-1-.4-1-1V9.2L2.3 5.5c-.2-.2-.3-.4-.3-.7V3c0-.6.4-1 1-1h10c.6 0 1 .4 1 1v1.8c0 .3-.1.5-.3.7L10 9.2V13c0 .6-.4 1-1 1zM3 3v1.8l4 4V13h2V8.8l4-4V3H3z" /></symbol>'});a.a.add(n);o.a=n},"3865314c5959606874d4":function(o,s){o.exports=e},e7be0695235c82fb118e:function(e,o,s){"use strict";Object.defineProperty(o,"__esModule",{value:!0});var i=s("3865314c5959606874d4"),t=(s.n(i),s("2a291322f8aea355dd92"));o.default=t.a}},["e7be0695235c82fb118e"])});
- /*
- *+------------------------------------------------------------------------+
- *| Licensed Materials - Property of IBM
- *| IBM Cognos Products: Content Explorer
- *| (C) Copyright IBM Corp. 2015, 2019
- *|
- *| US Government Users Restricted Rights - Use, duplication or disclosure
- *| restricted by GSA ADP Schedule Contract with IBM Corp.
- *+------------------------------------------------------------------------+
- */
- define('bacontentnav/common/BaseContentWideView',[
- './ContentListPageView',
- '../nls/StringResource',
- '../utils/ContentStoreObject',
- '../utils/UIHelper',
- './FolderSearchController',
- './FilterViewController',
- 'moment',
- 'text!./templates/EmptyListTemplate.html',
- '../lib/@ba-ui-toolkit/ba-graphics/dist/icons-js/filter-applied_16',
- '../lib/@ba-ui-toolkit/ba-graphics/dist/icons-js/filter_16',
- '../lib/@waca/core-client/js/core-client/utils/Utils',
- 'jquery'
- ], function(ContentListPageView, StringResource, ContentStoreObject, UIHelper, FolderSearchController, FilterViewController, Moment, EmptyListTemplate, filterApplied_16, filter_16, Utils, $) {
- 'use strict'; //NOSONAR
- var BaseContentWideView = ContentListPageView.extend({
- init: function(options) {
- void(options);
- BaseContentWideView.inherited('init', this, arguments);
- this.addURLParameters({
- 'nav_filter': 'true',
- 'fields': 'userInterfaces,defaultName,disabled,hidden,permissions,runInAdvancedViewer,modificationTime,canBurst,iconURI,defaultScreenTip,searchPath,defaultPortalAction,base.defaultName,tags,target.searchPath,target.disabled,effectiveUserCapabilities,base.permissions,options,base.options'
- });
- this.folderSearchController = new FolderSearchController({
- 'pageView': this,
- 'class': 'contentsearchbar'
- });
- this.getContainer().on('keypress', this.handleKeyboard.bind(this));
- this.filterViewController = new FilterViewController({
- filterSpecs: this._getColumnSpecification.bind(this),
- view: this,
- filterObject: UIHelper.getFilterFacets(['content'])
- });
- this._filterRangeCallback();
- this.on('filterState:change', this.onFilterStateChange.bind(this));
- this.on('filterState:changeDate', this.onFilterStateChangeDate.bind(this));
- },
- remove: function() {
- BaseContentWideView.inherited('remove', this, arguments);
- this.off('filterState:change');
- this.off('filterState:changeDate');
- },
- /**
- * Callback from the filterState:change trigger in the filterViewController
- * @param {Object} filterObject An object that contains the 'filterQuery' to use and 'column' index
- */
- onFilterStateChange: function(filterObject) {
- if (filterObject && filterObject.filterQuery !== undefined && this.getListControl()) {
- this.getListControl().filter(filterObject.filterQuery, filterObject.column, true);
- }
- var svgContainer = this.$el.find('.contentNavFilter');
- var svg = svgContainer.find('.svgIcon');
- svg.remove();
- if (this.folderSearchController.isDirty() || this.filterViewController.isDirty()) {
- Utils.setIcon(svgContainer, filterApplied_16.default.id);
- } else {
- Utils.setIcon(svgContainer, filter_16.default.id);
- }
- },
- /**
- * called when the user filters the filtercontroller by date
- */
- onFilterStateChangeDate: function() {
- this.onFilterStateChange();
- if (this.getListControl()) {
- this.getListControl().getDatatable().fnDraw();
- }
- },
- getSlideoutWidth: function() {
- return '300px';
- },
- saveSlideoutWidth: function() {
- var width = this.$el.width();
- UIHelper.saveSlideoutWidth(this.id, width);
- },
- handleKeyboard: function(e) {
- //handle any keypresses that will open the filterview.
- if (this.folderSearchController.shouldHandle(e)) {
- this.folderSearchController.setInputValue(String.fromCharCode(e.which));
- this.filterViewClicked();
- }
- },
- renderContent: function() {
- var _resizeCallback = null;
- return this.renderContentList({
- 'disableColumnHeaders': true,
- 'columns': this._getColumnSpecification(),
- 'url': (this.url || this._getDefaultRequestURL()),
- 'selfDefindedEmptyListTemplate': EmptyListTemplate,
- 'emptyIcon': this.emptyIcon,
- 'resizeCallback': function() {
- //Adjusting the screen width resets the scrolling of the content list view
- var ancestors = this.$el.find('.navigationAncestor');
- if (ancestors.length > 0) {
- var row = ancestors[0];
- var scrollingParent = $(row).closest('.dataTables_scrollBody');
- $(scrollingParent).scrollTop(row.offsetTop - scrollingParent.offsetTop);
- }
- if (_resizeCallback) {
- clearTimeout(_resizeCallback);
- }
- _resizeCallback = setTimeout(this.saveSlideoutWidth.bind(this), 500);
- }.bind(this),
- 'dataManipulationCallback': this.dataManipulationCallback,
- 'groupByColumnAPI': this.getGroupByColumnAPI()
- });
- },
- /**
- * @override
- */
- getListControlOptions: function() {
- return { setFocusOnDraw: true };
- },
- getViewContainerClass: function() {
- return 'ContentListPageView ContentWideView';
- },
- /**
- * @override
- **/
- _addFolder: function() {
- //clear out the search
- this.folderSearchController.clearFilter();
- //if we're filtered, then remove the modification time and add the 'folders' filter
- // to ensure we can see the 'add folder' inline editor.
- if (this.filterViewController.isDirty()) {
- this.filterViewController.onChangeModificationTime('');
- this.filterViewController.addFilter('folders').then(function() {
- BaseContentWideView.inherited('_addFolder', this, arguments);
- }.bind(this));
- } else {
- BaseContentWideView.inherited('_addFolder', this, arguments);
- }
- },
- /**
- Defines the columns for the data table. The structure and properties of the definition come
- from the datatable API.
- **/
- _getColumnSpecification: function() {
- return [{
- 'type': 'Icon',
- 'accessibleLabel': StringResource.get('itemType')
- }, {
- 'type': 'Name',
- 'scope': 'row'
- }, {
- 'type': 'Time',
- 'propertyName': ContentStoreObject.MODIFICATION_TIME
- }, {
- 'type': 'ContextMenu'
- }];
- },
- navigate: function(oData, row) {
- void(row);
- if (UIHelper.isContainer(ContentStoreObject.getType(oData))) {
- if (this.slideout) {
- this.slideout.$el.attr('aria-label', ContentStoreObject.getName(oData));
- }
- } else {
- var ancestors = ContentStoreObject.getAncestors(this);
- if (ancestors) {
- var parent = ancestors[ancestors.length-1];
- arguments[0] = parent;
- this.ancestors.pop();
- }
- }
- BaseContentWideView.inherited('navigate', this, arguments);
- },
- /**
- * Creats slideout and sends information over to FilterView.js
- **/
- filterViewClicked: function() {
- var _show = false;
- if (this._filterSlideout == null && this.contentBar.itemMap.contentNavFilter) {
- var filterButton = this.contentBar.itemMap.contentNavFilter.$el.find('button');
- if (filterButton.prop('disabled') === false) {
- _show = true;
- this._showFilterSlideout();
- }
- }
- if (!_show) {
- this._onFilterSlideoutHide();
- }
- },
- /**
- * show the filter slideout if it is not currently being shown.
- */
- _showFilterSlideout: function() {
- if (this._filterSlideout == null) {
- if (this.contentBar.itemMap.contentNavFilter) {
- var filterButton = this.contentBar.itemMap.contentNavFilter.$el.find('button');
- this.filterViewController.addFilteredClass(filterButton);
- }
- this._filterSlideout = this.glassContext.appController.showSlideOut({
- 'parent': this.slideout,
- 'label': StringResource.get('filterBy'),
- 'width': '200px',
- 'hideOnParentClick': false,
- 'content': {
- 'module': 'bacontentnav/common/FilterView',
- 'view': this,
- 'searchBarController': this.folderSearchController,
- 'filterController': this.filterViewController
- }
- });
- //on hide remove the filtered class
- this._filterSlideout.on('hide', function() {
- this._onFilterSlideoutHide();
- }.bind(this));
- }
- },
- /**
- * called when the user closes the filter view
- */
- _onFilterSlideoutHide: function() {
- if (!this.folderSearchController.isDirty() && !this.filterViewController.isDirty()) {
- var filterButton = this.contentBar.itemMap.contentNavFilter.$el.find('button');
- this.filterViewController.removeFilteredClass(filterButton);
- }
- if (this._filterSlideout) {
- //hide it
- this._filterSlideout.hide();
- this._filterSlideout = null;
- }
- },
- /**
- * Filters the datatable based on a minimum and a maximum range defined in the filterViewController
- **/
- _filterRangeCallback: function() {
- if (!this.registeredCallback) {
- $.fn.dataTable.ext.search.push(this._checkFilterRange.bind(this));
- this.registeredCallback = true;
- }
- },
- /**
- * Private function to filters the datatable based on a minimum and a maximum range
- **/
- _checkFilterRange: function(settings, data, dataIndex) {
- void(dataIndex);
- if (this.getListControl()) {
- var fnSettings = this.getListControl().getDatatable().fnSettings();
- if ((settings && settings.sTableId) === (fnSettings && fnSettings.sTableId)) {
- var createdAt = data[2];
- var minRange = this.filterViewController.getMinRange();
- var maxRange = this.filterViewController.getMaxRange();
- if (minRange && maxRange) {
- return (Moment(createdAt).isSameOrAfter(minRange) && Moment(createdAt).isSameOrBefore(maxRange));
- }
- }
- }
- return true;
- },
- /*
- * Create the getGroupByColumnAPI to be passed to the ListControl
- */
- getGroupByColumnAPI: function() {
- return undefined;
- }
- });
- return BaseContentWideView;
- });
- /**
- * Licensed Materials - Property of IBM
- *
- * IBM Cognos Products: Content Explorer
- *
- * Copyright IBM Corp. 2015, 2018
- *
- * US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
- */
- define('bi/content_apps/nls/ContentExplorerResources',{
- "root": true,
- "cs": true,
- "da": true,
- "de": true,
- "es": true,
- "fi": true,
- "fr": true,
- "he": true,
- "hr": true,
- "hu": true,
- "it": true,
- "ja": true,
- "kk": true,
- "ko": true,
- "no": true,
- "nb": true,
- "nl": true,
- "pl": true,
- "pt": true,
- "pt-br": true,
- "ro": true,
- "ru": true,
- "sl": true,
- "sv": true,
- "th": true,
- "tr": true,
- "zh": true,
- "zh-cn": true,
- "zh-tw": true
- });
- /**
- * Licensed Materials - Property of IBM
- * IBM Cognos Products: content-apps
- * (C) Copyright IBM Corp. 2022, 2022
- * US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
- */
- define('bi/content_apps/nls/root/ContentExplorerResources',{
- "allContent": "All content",
- "allGenericItems": "All",
- "myContent": "My content",
- "copy": "Copy to",
- "confirmDelete": "Confirm delete",
- "confirmDeleteMessage": "Deleting entries can break links. Are you sure you want to delete the selected entries?",
- "dashboards": "Dashboards",
- "delete": "Delete",
- "edit": "Edit",
- "notebooks": "Notebooks",
- "modificationTime": "Modified",
- "modifiedWithColon": "Modified:",
- "move": "Move to",
- "name": "Name",
- "tenant": "Tenant",
- "tenantSettings": "Tenant settings",
- "tenantSet": "Tenant updated",
- "tenantSetError": "Error setting tenant",
- "tenantClear": "Tenant cleared",
- "tenantClearError": "Error clearing tenant",
- "owner": "Owner",
- "reports": "Reports",
- "copyMove": "Copy or move:",
- "copyOnly": "Copy",
- "goToCloudLocation": "Go to cloud location",
- "noOfItemSelected": "%{noOfItems} selected",
- "selectDestination": "Select a destination",
- "selectAccountGroupOrRole": "Select groups, users or roles",
- "members": "Members",
- "teamFolders": "Team content",
- "folders": "Folders",
- "type": "Type",
- "folderTeamContent": "Folder (Team Content)",
- "typeWithColon": "Type:",
- "unknown": "Unknown",
- "description": "Description",
- "general": "General",
- "advancedProperties": "Advanced",
- "location": "Location",
- "schedule": "Schedule",
- "created": "Created",
- "createdWithColon": "Created:",
- "disableThisEntry": "Disable this entry",
- "hideThisEntry": "Hide this entry",
- "indexed": "Indexed",
- "language": "Language",
- "reportOutputVersions": "Report output versions",
- "reportOutputVersion": "Report output version",
- "rowsPerPageHtmlReport": "Rows per page in HTML Reports",
- "package": "Package",
- "data": "Data",
- "dataModule": "Data module",
- "mode": "Mode",
- "live": "Live",
- "snapshot": "Snapshot",
- "noSnapshotsFound": "No Snapshot found",
- "uploadedFile": "Uploaded file",
- "fileUpload": "Upload files",
- "dataSetEx": "Data set",
- "externalRepository": "External repository",
- "queryMode": "Query mode",
- "queryModeCompatible": "Compatible",
- "queryModeDynamic": "Dynamic",
- "report": "Report",
- "activeReport": "Active Report",
- "query": "Query",
- "analysis": "Analysis",
- "permission": "Permissions",
- "capabilities": "Capabilities",
- "newFolderDefaultName": "New Folder",
- "newFolderLabel": "New folder",
- "switchViewsLabel": "Switch Views",
- "emptyTableContentMessage": "There's nothing in this folder",
- "emptyRecentList": "You haven't viewed any content recently.",
- "back": "Back",
- "optionsMenuLabel": "Options",
- "defaultAction": "Default action",
- "reportOptions": "Report options",
- "promptValues": "Prompt values",
- "runTheReport": "Run the report",
- "viewMostRecentReport": "View most recent report",
- "openWithReportStudio": "Open with Report Studio",
- "comingSoon": "Coming soon",
- "recentlyViewed": "Recently viewed",
- "destination": "Destination:",
- "lastUsed": "Last Used",
- "reportView": "Report View",
- "folder": "Folder",
- "dashboard": "Dashboard",
- "story": "Story",
- "workspace": "Workspace",
- "pagelet": "Page",
- "content": "Content",
- "directory": "Namespaces",
- "dataSet": "Data set",
- "powerPlayCube": "PowerPlay Cube",
- "powerPlayReport": "PowerPlay Report",
- "powerPlay8Report": "PowerPlay Report",
- "powerPlay8ReportView": "PowerPlay Report View",
- "reportTemplate": "Report Template",
- "agent": "Agent",
- "agentDefinition": "Agent Definition",
- "agentDefinitionView": "Agent View",
- "dataMovementTask": "Data Movement Task",
- "dataMovementTaskAlias": "Data Movement Task Alias",
- "document": "Document",
- "DocumentRetention": "Document properties",
- "jobDefinition": "Job Definition",
- "job": "Job",
- "metricsDataSourceETLTask": "Metrics Data Source ETL Task",
- "metricsExportTask": "Metrics Export Task",
- "metricsFileImportTask": "Metrics File Import Task",
- "metricsMaintenanceTask": "Metrics Maintenance Task",
- "planningTask": "Planning Task",
- "shortcut": "Shortcut",
- "URL": "URL",
- "launchable": "Launchable",
- "dataSetFolder": "Data Set Folder",
- "ViewAccessibleLabel": "View %{label}",
- "overrideReportOptions": "Override the default report options",
- "format": "Format",
- "formats": "Formats",
- "saveReport": "Save the report",
- "promptForValues": "Prompt me",
- "promptGenerationHint": "You will be prompted for input before the report runs in background.",
- "html": "HTML",
- "pdf": "PDF",
- "spreadsheetML": "Excel",
- "xlsxData": "Excel Data",
- "csv": "CSV",
- "xml": "XML",
- "runAs": "Run as",
- "permissionHeader": "Permission",
- "read": "Read",
- "write": "Write",
- "execute": "Execute",
- "setPolicy": "Set Policy",
- "full": "Full",
- "traverse": "Traverse",
- "toastDoneMoving": "%{noOfItems} items were moved.",
- "toastDoneCopying": "%{noOfItems} items were copied.",
- "toastDoneShortcutting": "%{noOfItems} shortcuts were created.",
- "toastDoneDeleting": "%{noOfItems} items were deleted.",
- "toastDoneMovingSingular": "%{nameOfItem} was moved.",
- "toastDoneCopyingSingular": "%{nameOfItem} was copied.",
- "toastDoneShortcuttingSingular": "%{nameOfItem} was created.",
- "toastDoneShortcuttingPortalPage": "Shortcut to %{nameOfItem} was created in My portal pages.",
- "toastCreateNewFolder": "%{nameOfFolder} was created.",
- "toastDoneDeletingSingular": "%{nameOfItem} was deleted.",
- "toastLaunchPerspectiveError": "Cannot open object %{objectType}.",
- "toastItemsWereAdded": "%{noOfItems} items were added to the profile.",
- "toastItemsWereAddedSingular": "%{noOfItems} item was added to the profile.",
- "toastItemsAlreadyAddedSingular": "Item has already been added to the profile.",
- "toastItemsAlreadyAdded": "Items have already been added to the profile.",
- "toastItemsWereDeleted": "%{noOfItems} items in the profile were deleted.",
- "toastItemsWereDeletedSingular": "%{noOfItems} item in the profile was deleted.",
- "toastRunRequestWasSubmitted": "Run request was submitted.",
- "toastRunRequestFailed": "Run request failed.",
- "shortCutName": "%{nameOfItem}%{shortCutLabel}",
- "ok": "OK",
- "cancel": "Cancel",
- "permissionDetails": "Permission Details",
- "grant": "Grant",
- "deny": "Deny",
- "overrideParentPermissions": "Override parent permissions",
- "applyToAllChildren": "Apply to all children",
- "policiesTableLable": "Policies",
- "policesAddButtonLabel": "Member",
- "policesAddMemberButtonLabel": "Add",
- "policesRemove": "Remove",
- "policiesFindAUserHint": "Search",
- "policiesFindModeMenuTip": "Search method",
- "policiesFindMode": "Search",
- "policiesTypeInMode": "Type in",
- "policyFilterAccounts": "Users",
- "policyFilterRoles": "Roles",
- "policyFilterGroups": "Groups",
- "policyToastMessageSyntax": "Type the names of the entries to find, separated by semi-colons. Use the format namespace/user, group or role; For example, type Cognos/Everyone",
- "policyToastMessageNamespace": "You must first select a namespace.",
- "emptyPolicyList": "Nothing found",
- "applyLabel": "Apply",
- "permissionRead": "Read",
- "permissionRun": "Run",
- "permissionWrite": "Write",
- "permissionFull": "Full",
- "permissionCustom": "Custom",
- "permissionDetailsColumnAccess": "Access",
- "permissionDetailsColumnPermission": "Permission",
- "permissionDetailsColumnAction": "Action",
- "permissionSetAccess": "Set access",
- "preferencesMyCredentials": "My credentials",
- "preferencesCredentialsLabel": "Credentials",
- "preferencesDataSourceCredentialsLabel": "Data Servers",
- "preferencesDatasourceTitle": "Data server credentials",
- "preferencesDatasourceHeader": "Data server name",
- "preferencesGroupsAndRoles": "Groups and Roles",
- "preferencesMyCapabilities": "My Capabilities",
- "preferencesCredentialsHintText": "Specify the users, groups or roles that can use your credentials to run activities:",
- "preferencesCapabilitiesHintText": "These capabilities are available to you:",
- "preferencesGroupsAndRolesHintText": "In this session, you can use the access permissions of these groups and roles:",
- "preferencesDataSourceCredentialsHintText": "You have saved credentials for these data servers:",
- "enableAccessibilitySupport": "Enable accessibility support",
- "languages": "Languages",
- "True": "True",
- "False": "False",
- "id": "ID",
- "run": "Run",
- "createVersion": "Create a version",
- "create": "Create",
- "size": "Size",
- "sizeByte": "%{value} B",
- "sizeKiloByte": "%{value} KB",
- "sizeMegaByte": "%{value} MB",
- "sizeGigaByte": "%{value} GB",
- "sizeTeraByte": "%{value} TB",
- "sizePetaByte": "%{value} PB",
- "refreshedDatetime": "Refreshed time",
- "dataRefreshed": "Data refreshed",
- "dataRefWithColon": "Data refreshed:",
- "missingPermissions": "You need permissions to view the properties for this item.",
- "missingPolicies": "You only see entries that you have permissions for. You might see different entries if you sign in to a different namespace",
- "versions": "Versions",
- "archives": "Archives",
- "occurrences": "Occurrences",
- "days": "Day(s)",
- "months": "Month(s)",
- "errorMessages": "Messages",
- "errorMessageApostropheError": "Please enter a file name that does not contain both ' and \" characters",
- "error": "Error",
- "warn": "Warning",
- "fatal": "Fatal",
- "debug": "Debug",
- "info": "Information",
- "runTime": "Run time",
- "requestTime": "Request time",
- "startTime": "Start time",
- "endTime": "End time",
- "successful": "Successful",
- "failed": "Failed",
- "noSavedOutputs": "There are no saved outputs.",
- "noVersions": "No versions available",
- "noReportOptionsAvailable": "No report options record available.",
- "showDetails": "Open details panel",
- "unavailable": "Unavailable",
- "runInBackgroundOption": "Run in background",
- "selectAFormat": "Please select a format",
- "delivery": "Delivery",
- "now": "Now",
- "later": "Later",
- "invalidTime": "Time selected is earlier than current time. Please select again.",
- "executionPrompt": "Prompt for values",
- "currentValues": "Current values",
- "noPromptsValuesSet": "You currently have no prompt values set",
- "setValues": "Set values",
- "numOfPromptValues": "prompt values",
- "selectionBasedFeatures": "Enable selection-based interactivity",
- "allowNotifications": "Enable alerts about new versions",
- "advancedOutput": "Enable enhanced user features in saved output versions",
- "allowAnnotations": "Enable comments in saved output versions",
- "clear": "Clear",
- "sourceReport": "Source report",
- "sourceAgent": "Source agent",
- "burst": "Burst the report",
- "associatedSource": "Source package or data module",
- "associatedSourceAgent": "Source package",
- "linkPackageOrModule": "Link the %{itemName} to a package or data module",
- "linkPackage": "Link the %{itemName} to a package",
- "confirmTakeOwnership": "Confirm Take Ownership",
- "confirmTakeOwnershipMessage": "Are you sure you want to take ownership of the selected entries?",
- "SetLabel": "Set...",
- "externalRepositories": "External Repositories",
- "toastTakeOwnership": "You own %{noOfItemsClaimed} of %{noOfItems} selected items.",
- "runAsUser": "With user's credentials",
- "runWithOwnerCapabilities": "With owner capabilities",
- "runAsOwner": "As %{ownerName}",
- "pdfOptions": "PDF options",
- "set": "Set",
- "passwordNotMatched": "Passwords don't match or are missing",
- "Orientation": "Orientation",
- "default": "Default",
- "portrait": "Portrait",
- "landscape": "Landscape",
- "pageSize": "Paper size",
- "letter": "Letter",
- "legal": "Legal",
- "11x17": "11x17",
- "A3": "A3",
- "A4": "A4",
- "B4JIS": "B4 JIS",
- "B5JIS": "B5 JIS",
- "requiresPasswordToOpenReport": "Requires a password to open the report",
- "requiresPasswordToAccessOptions": "Requires a password to access options",
- "password": "Password:",
- "confirmPassword": "Confirm Password:",
- "runHistory": "Run History",
- "viewRunHistory": "View...",
- "runHistoryDetails": "View run history details",
- "jobAdvancedProperties": "Properties",
- "scheduleAJob": "Schedule Job",
- "viewCurrentVersions": "View document versions",
- "viewArchivedVersions": "View archived versions",
- "unknownUpdateError": "Item update failed. Contact your administrator for further assistance.",
- "renameCollisionError": "%{name} already exists. Try a different name.",
- "nameCollision": "An item with this name already exists:",
- "nameCollisionMessage": "What do you want to do?",
- "copyReplace": "Copy and replace",
- "keepBoth": "Keep both",
- "copySkip": "Don't copy",
- "moveReplace": "Move and replace",
- "moveSkip": "Don't move",
- "repeatNameCollisionAction": "Do this for the next %{noItems} conflicts",
- "repeatNameCollisionActionSingular": "Do this for the next conflict",
- "bulkNameCollision": "There are %{noOfItems} items with names that already exist",
- "overwrite": "Overwrite",
- "rename": "Rename",
- "role": "Role",
- "account": "Account",
- "group": "Group",
- "namespace": "Namespace",
- "SetLanguagesLabel": "Set...",
- "SetExternalRespostoryLabel": "Set...",
- "SetCapabilitiesLabel": "Set...",
- "JobAdvancedSettings": "Set...",
- "JobSchedule": "Set...",
- "JobAdvancedRunHistory": "View...",
- "packageConfiguration": "Package configuration",
- "editPackageConfiguration": "Edit...",
- "invalidNumber": "The value entered is not a number. Type a number.",
- "exceedMaxLength": "The text is too long. Shorten to %{maxLength} characters.",
- "invalidInput": "Invalid input",
- "invalidEmailMessage": "Email address is not valid.",
- "typeInHintText": "Example: Namespace1/name; Namespace2/name;",
- "importDeployment": "Import deployment",
- "exportDeployment": "Export deployment",
- "between": "Between",
- "and": "and",
- "properties": "Properties - %{objectName}",
- "none": "None",
- "objectDeleted": "This object doesn't exist",
- "PageLayout": "Page Layout",
- "PageStyle": "Style",
- "Gateway": "Gateway",
- "PowerPlayReport": "PowerPlay Report",
- "more": "More",
- "title": "Title",
- "itemName": "Item name",
- "showMissingPolicies": "show",
- "hideMissingPolicies": "hide",
- "nowOrLaterRadioOptions": "Run now or later options",
- "runHistoryUnits": "Run history units",
- "reportOutputVersionsUnits": "Report output versions units",
- "breadCrumbsAccessibleLabel": "Ancestor Folders",
- "a11yContentListUpdatedNotification": "Now showing contents of %{folderOrPackageName}",
- "a11yPropertyPane": "Properties of object %{nameOfObject}",
- "moreActionsMenu": "More Actions Menu",
- "itemType": "Item type",
- "confirmCancelMessage": "Do you want to discard your changes?",
- "confirmCancel": "Confirm cancel",
- "formatOptions": "Format options",
- "listControlColumns": "List Columns",
- "source": "Source",
- "external": "External",
- "removeSelectedItem": "Remove selected item",
- "deleteReportVersion": "Delete report version",
- "dataset": "Data set",
- "numberRows": "Number of rows",
- "numberColumns": "Number of columns",
- "TimeToRefresh": "Time to refresh",
- "LastRefreshedBy": "Refreshed by",
- "OverwriteFileSuccessfully": "Successfully overwrote the object %{nameOfObject}",
- "RenameFileSuccessfully": "Successfully renamed the object from %{originalNameOfObject} to %{newNameOfObject}",
- "showAllHistory": "Show all history",
- "history": "History",
- "user": "User",
- "confirmDeleteAllowed": "You do not have permission to delete: %{number} item(s). Would you like to proceed and delete the rest?",
- "download": "Download",
- "personal": "Personal",
- "customization": "Customization",
- "schemas": "Schemas",
- "connections": "Connections",
- "numberOutOfRange": "The value entered must be a number between %{min} and %{max}",
- "numberTooSmall": "The value entered must be a number greater than %{min}",
- "numberTooBig": "The value entered must be a number less than %{max}",
- "searchReturnedNoResults": "Your search returned no results.",
- "tryChangingSearchTerms": "Try changing your search terms.",
- "searchAllYourData": "Search all your data",
- "search": "Search",
- "saveSearch": "Save search",
- "narrowYourSearch": "Narrow your search",
- "all": "All",
- "packages": "Packages",
- "savedSearch": "Saved searches",
- "haventSavedSearches": "You haven't saved any searches.",
- "clickTheSaveButton": "You can click the save button after you search.",
- "remove": "Remove",
- "searchWasDeleted": "Search was deleted",
- "searchWasntDeleted": "Search wasn't deleted",
- "searchWasSaved": "Search was saved",
- "searchWasntSaved": "Search wasn't saved",
- "socialInsightsProject": "Social Insights",
- "saveTenSearches": "You can save 10 searches.",
- "deleteASearch": "Delete one to save another.",
- "models": "Models",
- "today": "Today",
- "yesterday": "Yesterday",
- "date": "Date",
- "clearAll": "Clear all",
- "EnterSearchTerms": "Enter a search term before you select a filter type.",
- "pastWeek": "Past Week",
- "pastMonth": "Past Month",
- "createShortcut": "Create shortcut",
- "createShortcutDialogTitle": "Create shortcut:",
- "shortcutTo": "Shortcut to",
- "shortcutToItem": "Shortcut to %{itemName}",
- "add": "Add",
- "close": "Close",
- "confirmClearTenant": "Confirm clear tenant",
- "confirmClearTenantText": "Clearing the tenant will change the value to \"None\" and might allow other tenants to access the content.<br><br>Click OK to make the entry public or Cancel to keep the current tenant",
- "changeTenantWarning": "Changing the tenant of an entry also changes the tenant of child entries.",
- "dataSource": "Data Server",
- "dataSourceConnection": "Data Server Connection",
- "setSourceLocation": "Set Source %{itemName} Location",
- "defaultPortalAction": "Default Portal Action",
- "openReport": "Edit",
- "openAnalysis": "Open with Analysis Studio",
- "openQuery": "Open with Query Studio",
- "openPowerPlay8Report": "Open with PowerPlay Studio",
- "openInteractiveReport": "Edit",
- "searchPath": "Search path",
- "itemsOverLimit": "The specified name '%{itemName}' has exceeded the maximum (20) limit. Please specify a different name to continue.",
- "newURLLabel": "Create URL",
- "newURLDesc": "Specify a name and URL. Optionally, specify a description.",
- "urlNamePlaceholder": "Add a name for the URL",
- "descriptionPlaceholder": "Add a description",
- "urlPlaceholder": "Add a URL that uses an acceptable domain",
- "viewAcceptableDomains": "View acceptable domains",
- "acceptableDomains": "Acceptable domains",
- "noEntries": "There are no entries in the acceptable domains list. Contact your administrator.",
- "fieldsAreMandatory": "The name and URL are mandatory.",
- "errorMessageLengthURLName": "Please enter a URL name that does not exceed 255 characters.",
- "unacceptableDomain": "Your URL uses an invalid domain. Click 'View acceptable domains' to see a list of domains you can use.",
- "toastCreateNewURL": "%{nameofURL} was created.",
- "myPortalPages": "My portal pages",
- "classicView": "Classic view",
- "showUnavailablePolicies": "Show unavailable policies",
- "agentViewOf": "Agent view of %{agentName}"
- });
- /*
- *+------------------------------------------------------------------------+
- *| Licensed Materials - Property of IBM
- *| IBM Cognos Products: Content Explorer
- *| (C) Copyright IBM Corp. 2015, 2018
- *|
- *| US Government Users Restricted Rights - Use, duplication or disclosure
- *| restricted by GSA ADP Schedule Contract with IBM Corp.
- *+------------------------------------------------------------------------+
- */
- define('bi/content_apps/nls/StringResource',['i18n!bi/content_apps/nls/ContentExplorerResources', 'polyglot'], function (localeResources, Polyglot) {
- 'use strict';
- /**
- * Module which provides simple access to string resources.
- *
- */
- var poly = new Polyglot({
- phrases: localeResources
- });
- var StringResources = function () {
- return undefined;
- };
- /**
- * Get the string resource for the given key and interpolation options
- *
- * @param key The key of the string to return
- * @param interpolationOptions Optional interpolation options (see poly.t documentation for details)
- * @returns The string to display
- */
- StringResources.prototype.get = function (key, interpolationOptions) {
- return poly.t(key, interpolationOptions);
- };
- return new StringResources();
- });
- /*
- *+------------------------------------------------------------------------+
- *| Licensed Materials - Property of IBM
- *|
- *| IBM Cognos Products: content-apps
- *|
- *| (C) Copyright IBM Corp. 2015, 2018
- *|
- *| US Government Users Restricted Rights - Use, duplication or disclosure
- *| restricted by GSA ADP Schedule Contract with IBM Corp.
- *+------------------------------------------------------------------------+
- */
- define('bi/content_apps/utils/C10Utils',[
- 'underscore'
- ], function(_) {
- 'use strict';
- var _singletonInstance = null;
- var C10Utils = function() {
- if (C10Utils.prototype._singletonInstance) {
- return C10Utils.prototype._singletonInstance;
- }
- this.typeToStudioMap = {
- 'analysis': 'AnalysisStudio',
- 'query': 'QueryStudio',
- 'agentDefinition': 'EventStudio',
- 'package': 'MetricsStudio',
- 'powerPlay8Report': 'PowerplayStudio'
- };
- this.typeToCapabilityMap = {
- 'analysis': 'canUseAnalysisStudio',
- 'query': 'canUseQueryStudio',
- 'agentDefinition': 'canUseEventStudio'
- };
- this.propGeneralTitanActionEnum = {
- 'lang': 'languages',
- 'repo': 'repository',
- 'routing': 'routing',
- 'url': 'url',
- 'pp': 'powerplay',
- 'document': 'document'
- };
- this.morphletMap = {
- 'propGeneral': 'portal/properties_general_titan.xts',
- 'pageLayout': 'portal/properties_pagelet_layout_titan.xts',
- 'pageStyle': 'portal/properties_pagelet_style_titan.xts',
- 'capabilities': 'portal/properties_capabilities_titan.xts',
- 'archive': 'portal/outputs_titan.xts',
- 'runOptsPP8': 'portal/properties_powerplay_8_run_options.xts',
- 'propPP8': 'portal/properties_powerplay_8_run_options_titan.xts',
- 'proppowerplay': 'portal/properties_powerplay_run_options_titan.xts',
- 'agent': 'portal/properties_agent_titan.xts',
- 'metricsExport': 'portal/properties_metrics_export_titan.xts',
- 'metricsImport': 'portal/properties_metrics_import _titan.xts',
- 'metricsMainTask': 'portal/properties_metrics_maintenance_titan.xts',
- 'launch': 'portal/launch.xts',
- 'package': 'portal/properties_packageconfiguration.xts',
- 'newPackage': 'portal/new_packageconfiguration.xts',
- 'viewHistory': 'portal/history/view_details.xts'
- };
- // extracted for testing purposes
- this.openWindow = function(url) {
- window.open(url, '_blank');
- };
- C10Utils.prototype._singletonInstance = this;
- };
- C10Utils.prototype.openC10Morphlet = function(morphlet, oClass, id, additionalParams) {
- var params = [{
- 'm_class': oClass
- }, {
- 'm_obj': 'storeID("' + id + '")'
- }];
- if (additionalParams) {
- params = params.concat(additionalParams);
- }
- this.openC10Tab(morphlet, params);
- };
- C10Utils.prototype.openC10MorphletWithParams = function(morphlet, params) {
- this.openC10Tab(morphlet, params || []);
- };
- C10Utils.prototype.openC10General = function(action, oClass, id) {
- this.openC10Morphlet(this.morphletMap.propGeneral, oClass, id, [{
- 'titanAction': action
- }]);
- };
- C10Utils.prototype.getC10DeliveryOptArray = function(label, opts) {
- var smtpItems = '';
- var ldapItems = '';
- var smtpCount = 0;
- var ldapCount = 0;
- opts.forEach(function(anOpt) {
- if (anOpt.address.indexOf('@') !== -1) {
- smtpItems += '<item xsi:type="bus:addressSMTP">' + anOpt.address + '</item>';
- smtpCount++;
- } else {
- ldapItems += '<item xsi:type="bus:searchPathMultipleObject">' + anOpt.address + '</item>';
- ldapCount++;
- }
- });
- var result = '';
- if (smtpCount > 0) {
- var smtpResult = '<item xsi:type="bus:deliveryOptionAddressSMTPArray"><name xsi:type="bus:deliveryOptionEnum">' + label + 'Address</name><value xsi:type="SOAP-ENC:Array" SOAP-ENC:arrayType="bus:addressSMTP[##CA_NUM_ITEMS##]">##CA_ITEMS##</value></item>';
- smtpResult = smtpResult.replace('##CA_ITEMS##', smtpItems);
- smtpResult = smtpResult.replace('##CA_NUM_ITEMS##', smtpCount);
- result += smtpResult;
- }
- if (ldapCount > 0) {
- var ldapResult = '<item xsi:type="bus:deliveryOptionSearchPathMultipleObjectArray"><name xsi:type="bus:deliveryOptionEnum">' + label + '</name><value xsi:type="SOAP-ENC:Array" SOAP-ENC:arrayType="bus:searchPathMultipleObject[##CA_NUM_ITEMS##]">##CA_ITEMS##</value></item>';
- ldapResult = ldapResult.replace('##CA_ITEMS##', ldapItems);
- ldapResult = ldapResult.replace('##CA_NUM_ITEMS##', ldapCount);
- result += ldapResult;
- }
- return result;
- };
- C10Utils.prototype.getPowerPlayC10DeliveryOptions = function(deliveryOptions) {
- var c10DeliveryOptions = '<options xmlns:cm="http://developer.cognos.com/schemas/xts-cm/1/" xmlns:send="http://developer.cognos.com/schemas/xts/logic-sheet/xslt/brl/1/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="bus:optionArrayProp"><value xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xsi:type="SOAP-ENC:Array" SOAP-ENC:arrayType="bus:option[##CA_NUMBER_OPTIONITEMS##]">##CA_ITEMS##</value></options>';
- var items = '';
- var itemCount = 0;
- if ((deliveryOptions.to) && (deliveryOptions.to.length > 0)) {
- items += this.getC10DeliveryOptArray('to', deliveryOptions.to);
- itemCount++;
- }
- if ((deliveryOptions.cc) && (deliveryOptions.cc.length > 0)) {
- items += this.getC10DeliveryOptArray('cc', deliveryOptions.cc);
- itemCount++;
- }
- if ((deliveryOptions.bcc) && (deliveryOptions.bcc.length > 0)) {
- items += this.getC10DeliveryOptArray('bcc', deliveryOptions.bcc);
- itemCount++;
- }
- if (deliveryOptions.subject) {
- items += '<item xsi:type="bus:deliveryOptionString"><name xsi:type="bus:deliveryOptionEnum">subject</name><value xsi:type="xsd:string">' + deliveryOptions.subject + '</value></item>';
- itemCount++;
- }
- var emailAsAttachment = deliveryOptions.emailAsAttachment === true;
- items += '<item xsi:type="bus:powerPlay8OptionBoolean"><name xsi:type="bus:powerPlay8OptionEnum">emailAsAttachment</name><value xsi:type="xsd:boolean">' + emailAsAttachment + '</value></item>';
- itemCount++;
- var emailAsURL = deliveryOptions.emailAsURL === true;
- items += '<item xsi:type="bus:powerPlay8OptionBoolean"><name xsi:type="bus:powerPlay8OptionEnum">emailAsURL</name><value xsi:type="xsd:boolean">' + emailAsURL + '</value></item>';
- itemCount++;
- if (deliveryOptions.memoPart) {
- // var memoText = _.escape(deliveryOptions.memoPart);
- // memoText = memoText.replace(/&nbsp;/g, ' ');
- var encodedMemoText = window.btoa(_.unescape(deliveryOptions.memoPart));
- itemCount++;
- items += '<item xsi:type="bus:deliveryOptionMemoPart"><name xsi:type="bus:deliveryOptionEnum">memoPart</name><value xsi:type="bus:memoPartComposite"><contentDisposition xsi:type="bus:smtpContentDispositionEnum">inline</contentDisposition><contentType xsi:type="bus:smtpContentTypeEnum">alternative</contentType><parts xsi:type="SOAP-ENC:Array" SOAP-ENC:arrayType="bus:memoPart[2]"><item xsi:type="bus:memoPartString"><contentDisposition xsi:type="bus:smtpContentDispositionEnum">inline</contentDisposition><text xsi:type="xsd:string">' + 'fred' + '</text></item><item xsi:type="bus:memoPartMIMEAttachment"><contentDisposition xsi:type="bus:smtpContentDispositionEnum">inline</contentDisposition><name xsi:type="xsd:string"/><data xsi:type="xsd:base64Binary">' + encodedMemoText + '</data><dataSize xsi:type="xsd:integer">0</dataSize><dataType xsi:type="xsd:string">text/html</dataType></item></parts></value></item>';
- }
- c10DeliveryOptions = c10DeliveryOptions.replace('##CA_ITEMS##', items);
- return c10DeliveryOptions.replace('##CA_NUMBER_OPTIONITEMS##', itemCount);
- };
- C10Utils.prototype.openC10Studio = function(objectInfo, glassContext, isDesignMode) {
- var studio = this.typeToStudioMap[objectInfo.type];
- var urlParms = [{
- 'ui.tool': studio
- }, {
- 'ui.object': 'storeID("' + objectInfo.id + '")'
- }, {
- 'ui.action': 'edit'
- }, {
- 'ui.gateway': glassContext.gateway + '/v1/disp'
- }, {
- 'launch.launchinWindow': 'true'
- }];
- if (isDesignMode) {
- urlParms.push({
- 'ui.crngnd': 'true'
- });
- }
- if (studio === 'MetricsStudio') {
- urlParms['ui.action'] = 'run';
- }
- this.openC10Tab(this.morphletMap.launch, urlParms);
- };
- C10Utils.prototype.isPowerPlay = function(objectType) {
- return (objectType === 'powerPlay8Report' || objectType === 'powerPlay8ReportView');
- };
- C10Utils.prototype.openC10Tab = function(morphlet, urlParams) {
- var c10Parameters = [{
- 'b_action': 'xts.run'
- }, {
- 'backURL': encodeURIComponent('disp?b_action=xts.run&m=portal/close.xts&ui.compid=ps')
- }, {
- 'm': morphlet
- }];
- c10Parameters = c10Parameters.concat(urlParams);
- var url = 'v1/disp';
- var count = 0;
- c10Parameters.forEach(function(item) {
- if (count === 0) {
- url += '?';
- } else {
- url += '&';
- }
- $.each(item, function(key, value) {
- url += key + '=' + value;
- });
- count += 1;
- });
- this.openWindow(url);
- };
- var _static = {
- getInstance: function() {
- if (!_singletonInstance) {
- _singletonInstance = new C10Utils();
- }
- return _singletonInstance;
- }
- };
- return _static.getInstance();
- });
- /*
- *+------------------------------------------------------------------------+
- *| Licensed Materials - Property of IBM
- *| IBM Cognos Products: Content Explorer
- *| (C) Copyright IBM Corp. 2015, 2018
- *|
- *| US Government Users Restricted Rights - Use, duplication or disclosure
- *| restricted by GSA ADP Schedule Contract with IBM Corp.
- *+------------------------------------------------------------------------+
- */
- define('bacontentnav/utils/PolicyHelper',[
- '../nls/StringResource',
- '../lib/@waca/core-client/js/core-client/i18n/Formatter',
- 'underscore'
- ], function(StringResource, Formatter, _) {
- 'use strict';
- var _singletonInstance = null;
- var PolicyHelper = function() {
- if (PolicyHelper.prototype._singletonInstance) {
- return PolicyHelper.prototype._singletonInstance;
- }
- PolicyHelper.prototype._singletonInstance = this;
- PolicyHelper.prototype.permissionEnum = {
- 'r': 'read',
- 'w': 'write',
- 'x': 'execute',
- 'sp': 'setPolicy',
- 't': 'traverse'
- };
- PolicyHelper.prototype.read = [this.permissionEnum.r, this.permissionEnum.t];
- PolicyHelper.prototype.run = [this.permissionEnum.r, this.permissionEnum.t, this.permissionEnum.x];
- PolicyHelper.prototype.write = [this.permissionEnum.r, this.permissionEnum.t, this.permissionEnum.w, this.permissionEnum.x];
- PolicyHelper.prototype.full = [this.permissionEnum.r, this.permissionEnum.t, this.permissionEnum.w, this.permissionEnum.x, this.permissionEnum.sp];
- PolicyHelper.prototype.clonePermissionArray = function(permArray) {
- var newPerm = [];
- permArray.forEach(function(perm) {
- newPerm.push(_.clone(perm));
- });
- return newPerm;
- };
- PolicyHelper.prototype.simplePermEnum = {
- 'read': [{
- 'access': 'grant',
- 'name': this.permissionEnum.r
- }, {
- 'access': 'grant',
- 'name': this.permissionEnum.t
- }],
- 'run': [{
- 'access': 'grant',
- 'name': this.permissionEnum.r
- }, {
- 'access': 'grant',
- 'name': this.permissionEnum.t
- }, {
- 'access': 'grant',
- 'name': this.permissionEnum.x
- }],
- 'write': [{
- 'access': 'grant',
- 'name': this.permissionEnum.r
- }, {
- 'access': 'grant',
- 'name': this.permissionEnum.t
- }, {
- 'access': 'grant',
- 'name': this.permissionEnum.x
- }, {
- 'access': 'grant',
- 'name': this.permissionEnum.w
- }],
- 'full': [{
- 'access': 'grant',
- 'name': this.permissionEnum.r
- }, {
- 'access': 'grant',
- 'name': this.permissionEnum.t
- }, {
- 'access': 'grant',
- 'name': this.permissionEnum.x
- }, {
- 'access': 'grant',
- 'name': this.permissionEnum.w
- }, {
- 'access': 'grant',
- 'name': this.permissionEnum.sp
- }]
- };
- };
- PolicyHelper.prototype.getDisplayPermissionsList = function(permissionsArray) {
- return permissionsArray.map(function(perm){
- return StringResource.get(perm);
- });
- };
- PolicyHelper.prototype.getIconsForPermissionValues = function(permissionsArray) {
- var answer = {};
- ['read', 'write', 'execute', 'traverse', 'setPolicy'].forEach(function(perm) {
- answer[perm] = {
- 'icon': '#common-default_perm',
- 'tooltip': StringResource.get('default'),
- 'label': StringResource.get(perm)
- };
- });
- permissionsArray.forEach(function(perm) {
- if (perm.access === 'grant') {
- answer[perm.name].icon = '#common-grant_perm';
- answer[perm.name].tooltip = StringResource.get('grant');
- } else {
- answer[perm.name].icon = '#common-deny_perm';
- answer[perm.name].tooltip = StringResource.get('deny');
- }
- });
- return answer;
- };
- PolicyHelper.prototype._flattenPermission = function(permissions) {
- var ret = {};
- _.each(permissions, function(permission) {
- if (permission.access !== 'default') {
- ret[permission.name] = permission.access;
- }
- });
- return ret;
- };
- PolicyHelper.prototype.getMySimplifiedPermissions = function(permissions) {
- return this.getSimplifiedPermissions(permissions.map(function(name) {
- return {
- 'access': 'grant',
- 'name': name
- };
- }));
- };
- PolicyHelper.prototype.getSimplifiedPermissions = function(permissionsArray) {
- var permissionsObject = this._flattenPermission(permissionsArray);
- for (var name in this.simplePermEnum) {
- var permObject = this._flattenPermission(this.simplePermEnum[name]);
- if (_.isEqual(permissionsObject, permObject)) {
- return StringResource.get(name);
- }
- }
- return StringResource.get('permissionCustom');
- };
- var _static = {
- getInstance: function() {
- if (!_singletonInstance) {
- _singletonInstance = new PolicyHelper();
- }
- return _singletonInstance;
- }
- };
- return _static.getInstance();
- });
- /*
- *+------------------------------------------------------------------------+
- *| Licensed Materials - Property of IBM
- *|
- *| IBM Cognos Products: content-apps
- *|
- *| (C) Copyright IBM Corp. 2015, 2022
- *|
- *| US Government Users Restricted Rights - Use, duplication or disclosure
- *| restricted by GSA ADP Schedule Contract with IBM Corp.
- *+----
- */
- define('bi/content_apps/PropertiesGeneralTab',[
- 'underscore',
- 'bi/commons/ui/properties/PropertyTabView',
- 'bi/commons/i18n/Formatter',
- 'bi/commons/utils/DateTimeUtils',
- 'bi/commons/utils/Utils',
- 'bi/content_apps/utils/C10Utils',
- 'bi/content_apps/nls/StringResource',
- 'bacontentnav/utils/ContentStoreObject',
- 'bacontentnav/utils/PolicyHelper',
- 'bacontentnav/utils/GlassContextHelper',
- 'bacontentnav/utils/UIHelper'
- ], function(_, PropertyTabView, I18NFormatter, DateTimeUtils, Utils, C10Utils, StringResource, ContentStoreObject, PolicyHelper, GlassContextHelper, UIHelper) {
- 'use strict'; //NOSONAR
- var _numberLabels = ['sizeKiloByte', 'sizeMegaByte', 'sizeGigaByte', 'sizeTeraByte', 'sizePetaByte'];
- var _baseProperties = ['base.defaultName', 'base.defaultDescription', 'base.ancestors', 'base.metadataModelPackage', 'base.module'];
- var _baseReportProperties = ['metadataModelPackage.defaultName', 'metadataModelPackage.ancestors', 'owner.id', 'retentions', 'defaultPortalAction', 'runAsOwner', 'runWithOwnerCapabilities', 'options', 'executionPrompt', 'parameters', 'module.defaultName', 'module.ancestors', 'allowNotification'];
- var _static = {
- 'PROPERTIES_TO_QUERY': {
- 'common': ['id', 'defaultName', 'owner.defaultName', 'ancestors', 'defaultDescription',
- 'modificationTime', 'creationTime', 'contact', 'type', 'disabled', 'hidden', 'name.locale', 'permissions', 'tenantID', 'searchPath'
- ],
- 'metricsExportTask': ['retentions'],
- 'report': _baseReportProperties,
- 'query': _baseReportProperties,
- 'jobDefinition': ['retentions'],
- 'agentDefinition': ['retentions'],
- 'planningTask': ['retentions'],
- 'metricsFileImportTask': ['retentions'],
- 'metricsDataSourceETLTask': ['retentions'],
- 'metricsMaintenanceTask': ['retentions'],
- 'reportView': _baseReportProperties.concat(_baseProperties),
- 'powerPlay8ReportView': _baseReportProperties.concat(_baseProperties),
- 'agentDefinitionView': _baseReportProperties.concat(_baseProperties),
- 'package': ['repositoryRules', 'queryMode', 'routingHints'],
- 'folder': ['repositoryRules'],
- 'uploadedFile': ['history'],
- 'dataSet2': ['metadataModelPackage', 'module'],
- 'shortcut': ['target'],
- 'agent': ['retentions']
- }
- };
- var PropertiesGeneralTab = PropertyTabView.extend({
- init: function(options) {
- PropertiesGeneralTab.inherited('init', this, arguments);
- _.extend(this, options);
- },
- render: function() {
- this._id = _.uniqueId('prop_');
- var descriptionMaxLength = Math.max(1024, this._getDescription().length);
- return this._checkCanSetTenant().then(function(canSetTenant) {
- this._canSetTenant = canSetTenant;
- return this.renderPropertyUIControl({
- 'el': this.$el,
- 'glassContext': this.glassContext,
- 'readOnly': !ContentStoreObject.hasPermissions(this.objectInfo, ['write']),
- 'items': [{
- 'name': 'defaultDescription',
- 'label': StringResource.get('description'),
- 'value': this._getDescription(),
- 'type': 'TextArea',
- 'editable': true,
- 'multiline': true,
- 'validator': {
- 'maxLength': descriptionMaxLength
- }
- }, {
- 'type': 'CollapsibleSection',
- 'label': StringResource.get('advancedProperties'),
- 'items': this._getAdvancedPropertyItems()
- }]
- });
- }.bind(this));
- },
- _getLocation: function() {
- return ContentStoreObject.getLocation(this.objectInfo);
- },
- _getSearchPath: function() {
- return ContentStoreObject.getSearchPath(this.objectInfo);
- },
- _getShortcutTargetLocation: function() {
- return ContentStoreObject.getLocation(this.objectInfo.target[0], true) || StringResource.get('unavailable');
- },
- _getDescription: function() {
- return ContentStoreObject.getDescription(this.objectInfo) || '';
- },
- _getModificationTime: function() {
- return ContentStoreObject.getModificationTime(this.objectInfo, true, 'medium');
- },
- _getDisableThisEntry: function() {
- return this.objectInfo.disabled;
- },
- _getHideThisEntry: function() {
- return this.objectInfo.hidden;
- },
- _getLanguage: function() {
- return this.objectInfo.name ? this.objectInfo.name.locale : null;
- },
- _getScreenTip: function() {
- return this.objectInfo.defaultScreenTip || '';
- },
- _getQueryMode: function() {
- var optionsValue = this.objectInfo.options && this.objectInfo.options[0].value;
- if (optionsValue) {
- return optionsValue.indexOf('compatible') === -1 ? StringResource.get('queryModeDynamic') : StringResource.get('queryModeCompatible');
- }
- return null;
- },
- _getExternalRepository: function() {
- return this.objectInfo.repositoryRules ? this.objectInfo.repositoryRules[0].dataSourceName : null;
- },
- _getSizeOfFile: function() {
- var history = ContentStoreObject.getHistoryConfig(this.objectInfo);
- return history ? this._abbreviateNumber(history.sizeOnDisk) : null;
- },
- _getDataSetSize: function() {
- return (this.objectInfo.dataSetOutputInfo && this.objectInfo.dataSetOutputInfo.dataSize) ? this._abbreviateNumber(this.objectInfo.dataSetOutputInfo.dataSize) : null;
- },
- _setPowerPlayGateway: function() {
- C10Utils.openC10General(C10Utils.propGeneralTitanActionEnum.pp, this.objectInfo.type, this.objectInfo.id);
- },
- _setPageLayoutProperty: function() {
- C10Utils.openC10Morphlet(C10Utils.morphletMap.pageLayout, this.objectInfo.type, this.objectInfo.id);
- },
- _setPageStyleProperty: function() {
- C10Utils.openC10Morphlet(C10Utils.morphletMap.pageStyle, this.objectInfo.type, this.objectInfo.id);
- },
- _setURLProperty: function() {
- C10Utils.openC10General(C10Utils.propGeneralTitanActionEnum.url, this.objectInfo.type, this.objectInfo.id);
- },
- _setLanguageValues: function() {
- C10Utils.openC10General(C10Utils.propGeneralTitanActionEnum.lang, this.objectInfo.type, this.objectInfo.id);
- },
- _setExternalRepository: function() {
- C10Utils.openC10General(C10Utils.propGeneralTitanActionEnum.repo, this.objectInfo.type, this.objectInfo.id);
- },
- _editPackageConfiguration: function() {
- // check if the package configuration exists under the package - in order to launch the new or edit UI
- var requestOptions = {
- dataType: 'json',
- type: 'GET',
- url: 'v1/objects/' + this.objectInfo.id + '/items?types=packageConfiguration'
- };
- this.glassContext.getCoreSvc('.Ajax').ajax(requestOptions)
- .then(function(response) {
- // set up common params
- var objectSearchPath = 'storeID("' + this.objectInfo.id + '")';
- var params = [
- { m_name: this.objectInfo.defaultName },
- { m_obj_search_path: objectSearchPath },
- { m_path: '' }
- ];
- if (response && response.data && response.data.data && response.data.data.length) {
- // note: assuming there is only 1 package configuration, so it's the first one
- params = params.concat([
- { m_class: 'packageConfiguration' },
- { m_new_class: '' },
- { m_obj: 'storeID("' + response.data.data[0].id + '")' }
- ]);
- C10Utils.openC10MorphletWithParams(C10Utils.morphletMap.package, params);
- } else {
- // if there are no package configurations, launch the new configuration editor
- params = params.concat([
- { m_class: 'package' },
- { m_new_class: 'packageConfiguration' },
- { m_obj: objectSearchPath }
- ]);
- C10Utils.openC10MorphletWithParams(C10Utils.morphletMap.newPackage, params);
- }
- }.bind(this));
- },
- _getRefreshTime: function() {
- var history = ContentStoreObject.getHistoryConfig(this.objectInfo);
- return history && DateTimeUtils.formatDateTime(history.refreshTime, 'short', GlassContextHelper.getLocaleTime(this.glassContext)) || null;
- },
- _abbreviateNumber: function(number, localeOverride) {
- // default label and number value
- var labelKey = 'sizeByte';
- var labelValue = Math.round(number * 100) / 100;
- // loop and reduce the number accordingly
- for (var i = 0; i < _numberLabels.length; i = i + 1) {
- // process the number if greater than 1024
- if (Math.round(number * 10) / 10 >= 1024) {
- // update the number... divide by 1024
- number = number / 1024;
- // update label and number value
- labelKey = _numberLabels[i];
- labelValue = Math.round(number * 10) / 10;
- } else {
- // done so exit
- break;
- }
- }
- return StringResource.get(labelKey, {
- 'value': I18NFormatter.formatNumber(labelValue, {
- type: 'decimal',
- locale: localeOverride
- })
- });
- },
- _getSourceLocation: function() {
- var base = ContentStoreObject.getBase(this.objectInfo);
- return base && ContentStoreObject.getLocation(base, true) || StringResource.get('unavailable');
- },
- _getSourcePackageOrModuleLocation: function(objectInfo, appendDefaultName) {
- var source = ContentStoreObject.getMetadataModelPackage(objectInfo) || ContentStoreObject.getModule(objectInfo);
- return source && ContentStoreObject.getLocation(source, appendDefaultName) || StringResource.get('unavailable');
- },
- _buildTenantsList: function() {
- var tenants = this.glassContext.getCoreSvc('.UserProfile').tenants;
- var tenantsList = [{
- label: '',
- value: null,
- selected: true
- }];
- for (var item in tenants) {
- tenantsList.push({
- label: tenants[item].defaultName,
- value: tenants[item]
- });
- }
- return tenantsList;
- },
- _getTenantNameByID: function(tenantID) {
- if (tenantID === '') {
- return StringResource.get('none');
- }
- var tenants = this.glassContext.getCoreSvc('.UserProfile').tenants;
- for (var item in tenants) {
- if (tenants[item].tenantID === tenantID) {
- return tenants[item].defaultName;
- }
- }
- return tenantID;
- },
- _checkCanSetTenant: function() {
- return new Promise(function(resolve /*, reject*/ ) {
- if (this._canSeeTenant()) {
- this.glassContext.getCoreSvc('.UserProfile').isSysAdmin().then(function(isSysAdmin) {
- resolve(isSysAdmin);
- }.bind(this), function() {
- resolve(false);
- });
- } else {
- resolve(false);
- }
- }.bind(this));
- },
- _canSeeTenant: function() {
- // can see tenant information if there are tenants AND (the item's first ancestor is the team content folder OR the object is related to tenants)
- return (this.glassContext.getCoreSvc('.UserProfile').tenants || []).length &&
- ((ContentStoreObject.isTeamContent(this.objectInfo.ancestors && this.objectInfo.ancestors.length > 0 && this.objectInfo.ancestors[0])) ||
- (UIHelper.hasTenantOption(this.objectInfo)));
- },
- //this method could be optimized a bit...
- _getAdvancedPropertyItems: function() {
- var isRoot = ContentStoreObject.isTeamContent(this.objectInfo);
- this._advancedProperties = [];
- if (this._canSeeTenant()) {
- this.currentTenantID = this.objectInfo.tenantID;
- this._advancedProperties.push({
- 'type': 'SingleLineValue',
- 'name': 'changeTenant',
- 'label': StringResource.get('tenant'),
- 'value': this._getTenantNameByID(this.objectInfo.tenantID),
- 'disabled': !this._canSetTenant,
- 'editCallback': function() {
- this.changeTenantSlideout = this.glassContext.appController.showSlideOut({
- 'parent': this.slideout,
- 'position': 'left',
- 'width': '400',
- 'overlay': true,
- 'label': StringResource.get('tenantSettings'),
- 'content': {
- 'module': 'bi/content_apps/TenantSlideoutView',
- 'glassContext': this.glassContext,
- 'title': StringResource.get('Tenants'),
- 'objectInfo': this.objectInfo,
- 'currentTenantID': this.currentTenantID,
- 'onChangeCallback': this.updateTenant.bind(this)
- }
- });
- }.bind(this)
- }, {
- 'type': 'Separator'
- });
- }
- this._advancedProperties.push({
- 'name': 'disabled',
- 'label': StringResource.get('disableThisEntry'),
- 'checked': this._getDisableThisEntry(),
- 'type': 'CheckBox'
- });
- if (!isRoot) {
- var ups = this.glassContext.getCoreSvc('.UserProfile');
- if (ups.capabilities && ups.capabilities.indexOf('canUseShowHiddenObjectsPreference') >= 0) {
- $.merge(this._advancedProperties, [{
- 'type': 'Separator'
- }, {
- 'name': 'hidden',
- 'label': StringResource.get('hideThisEntry'),
- 'checked': this._getHideThisEntry(),
- 'type': 'CheckBox'
- }]);
- }
- $.merge(this._advancedProperties, [{
- 'type': 'Separator'
- }, {
- 'name': 'location',
- 'label': StringResource.get('location'),
- 'value': this._getLocation(),
- 'type': 'SingleLineValue',
- 'isSTT': true
- }]);
- $.merge(this._advancedProperties, [{
- 'type': 'Separator'
- }, {
- 'name': 'searchPath',
- 'label': StringResource.get('searchPath'),
- 'newLook': true,
- 'value': this._getSearchPath(),
- 'type': 'InputLabel',
- 'inputStyles': 'width: 210px',
- 'readOnly': true,
- 'isSTT': true
- }]);
- if (this.objectInfo.type === 'shortcut') {
- $.merge(this._advancedProperties, [{
- 'type': 'Separator'
- }, {
- 'name': 'shortcutTo',
- 'label': StringResource.get('shortcutTo'),
- 'value': this._getShortcutTargetLocation(),
- 'type': 'SingleLineValue'
- }]);
- }
- }
- $.merge(this._advancedProperties, [{
- 'type': 'Separator'
- }, {
- 'name': ContentStoreObject.ID,
- 'label': StringResource.get('id'),
- 'value': ContentStoreObject.getObjectId(this.objectInfo),
- 'type': 'SingleLineValue'
- }, {
- 'type': 'Separator'
- }, {
- 'name': 'myPermissions',
- 'type': 'SingleLineLinks',
- 'items': [{
- 'align': 'left',
- 'items': [{
- 'type': 'text',
- 'value': StringResource.get('permissionHeader'),
- 'name': 'permissionsLab'
- }]
- }, {
- 'align': 'right',
- 'items': [{
- 'type': 'text',
- 'value': PolicyHelper.getMySimplifiedPermissions(ContentStoreObject.getPermissions(this.objectInfo)),
- 'name': 'PermissionValue'
- }, {
- 'type': 'icon',
- 'class': 'permissionInformation displayToolTip',
- 'svgIcon': 'common-info-moreinfo',
- 'iconTooltip': PolicyHelper.getDisplayPermissionsList(ContentStoreObject.getPermissions(this.objectInfo))
- }]
- }]
- }]);
- if (!isRoot) {
- $.merge(this._advancedProperties, [{
- 'type': 'Separator'
- }, {
- 'name': 'languages',
- 'type': 'SingleLineLinks',
- 'items': [{
- 'align': 'left',
- 'items': [{
- 'type': 'text',
- 'name': 'languagesText',
- 'value': StringResource.get('languages')
- }]
- }, {
- 'align': 'right',
- 'items': [{
- 'type': 'text',
- 'name': 'languagesLink',
- 'value': StringResource.get('SetLanguagesLabel'),
- 'clickCallback': this._setLanguageValues.bind(this),
- 'ariaLabelledby': 'languagesText languagesLink'
- }]
- }]
- }]);
- }
- switch (this.objectInfo.type) {
- case 'powerPlayCube':
- case 'powerPlayReport':
- this._advancedProperties = this._advancedProperties.concat([{
- 'type': 'Separator'
- }, {
- 'name': 'layoutProperty',
- 'type': 'SingleLineLinks',
- 'items': [{
- 'align': 'left',
- 'items': [{
- 'type': 'text',
- 'name': 'layoutPropertyText',
- 'value': StringResource.get('Gateway')
- }]
- }, {
- 'align': 'right',
- 'items': [{
- 'type': 'text',
- 'name': 'layoutPropertyLink',
- 'value': StringResource.get('SetExternalRespostoryLabel'),
- 'clickCallback': this._setPowerPlayGateway.bind(this),
- 'ariaLabelledby': 'layoutPropertyText layoutPropertyLink'
- }]
- }]
- }]);
- break;
- case 'pagelet':
- this._advancedProperties = this._advancedProperties.concat([{
- 'type': 'Separator'
- }, {
- 'name': 'layoutProperty',
- 'type': 'SingleLineLinks',
- 'items': [{
- 'align': 'left',
- 'items': [{
- 'type': 'text',
- 'name': 'layoutPropertyText',
- 'value': StringResource.get('PageLayout')
- }]
- }, {
- 'align': 'right',
- 'items': [{
- 'type': 'text',
- 'name': 'layoutPropertyLink',
- 'value': StringResource.get('SetExternalRespostoryLabel'),
- 'clickCallback': this._setPageLayoutProperty.bind(this),
- 'ariaLabelledby': 'layoutPropertyText layoutPropertyLink'
- }]
- }]
- }, {
- 'type': 'Separator'
- }, {
- 'name': 'pageStyleProperty',
- 'type': 'SingleLineLinks',
- 'items': [{
- 'align': 'left',
- 'items': [{
- 'type': 'text',
- 'name': 'pageStylePropertyText',
- 'value': StringResource.get('PageStyle')
- }]
- }, {
- 'align': 'right',
- 'items': [{
- 'type': 'text',
- 'name': 'pageStylePropertyLink',
- 'value': StringResource.get('SetExternalRespostoryLabel'),
- 'clickCallback': this._setPageStyleProperty.bind(this),
- 'ariaLabelledby': 'pageStylePropertyText pageStylePropertyLink'
- }]
- }]
- }]);
- break;
- case 'URL':
- this._advancedProperties = this._advancedProperties.concat([{
- 'type': 'Separator'
- }, {
- 'name': 'urlProperty',
- 'type': 'SingleLineLinks',
- 'items': [{
- 'align': 'left',
- 'items': [{
- 'type': 'text',
- 'name': 'urlPropertyText',
- 'value': StringResource.get('URL')
- }]
- }, {
- 'align': 'right',
- 'items': [{
- 'type': 'text',
- 'name': 'urlPropertyLink',
- 'value': StringResource.get('SetExternalRespostoryLabel'),
- 'clickCallback': this._setURLProperty.bind(this),
- 'ariaLabelledby': 'urlPropertyText urlPropertyLink'
- }]
- }]
- }]);
- break;
- case 'folder':
- case 'content':
- this._advancedProperties = this._advancedProperties.concat([{
- 'type': 'Separator'
- }, {
- 'name': 'expernalRepository',
- 'type': 'SingleLineLinks',
- 'items': [{
- 'align': 'left',
- 'items': [{
- 'type': 'text',
- 'name': 'expernalRepositoryText',
- 'value': StringResource.get('externalRepositories')
- }]
- }, {
- 'align': 'right',
- 'items': [{
- 'type': 'text',
- 'name': 'expernalRepositoryLink',
- 'value': StringResource.get('SetExternalRespostoryLabel'),
- 'clickCallback': this._setExternalRepository.bind(this),
- 'ariaLabelledby': 'expernalRepositoryText expernalRepositoryLink'
- }]
- }]
- }]);
- break;
- case 'package':
- this._advancedProperties = this._advancedProperties.concat([{
- 'type': 'Separator'
- }, {
- 'name': 'queryMode',
- 'label': StringResource.get('queryMode'),
- 'value': this._getQueryMode(),
- 'type': 'SingleLineValue'
- }, {
- 'type': 'Separator'
- }, {
- 'name': 'expernalRepository',
- 'type': 'SingleLineLinks',
- 'items': [{
- 'align': 'left',
- 'items': [{
- 'type': 'text',
- 'name': 'expernalRepositoryText',
- 'value': StringResource.get('externalRepositories')
- }]
- }, {
- 'align': 'right',
- 'items': [{
- 'type': 'text',
- 'name': 'expernalRepositoryLink',
- 'value': StringResource.get('SetExternalRespostoryLabel'),
- 'clickCallback': this._setExternalRepository.bind(this),
- 'ariaLabelledby': 'expernalRepositoryText expernalRepositoryLink'
- }]
- }]
- }, {
- 'type': 'Separator'
- }, {
- 'name': 'packageConfiguration',
- 'type': 'SingleLineLinks',
- 'items': [{
- 'align': 'left',
- 'items': [{
- 'type': 'text',
- 'name': 'editPackageConfiguration',
- 'value': StringResource.get('packageConfiguration')
- }]
- }, {
- 'align': 'right',
- 'items': [{
- 'type': 'text',
- 'name': 'editPackageConfigurationLink',
- 'value': StringResource.get('editPackageConfiguration'),
- 'clickCallback': this._editPackageConfiguration.bind(this),
- 'ariaLabelledby': 'editPackageConfiguration editPackageConfigurationLink'
- }]
- }]
- }]);
- break;
- case 'uploadedFile':
- this._advancedProperties = this._advancedProperties.concat([{
- 'type': 'Separator'
- }, {
- 'name': 'size',
- 'label': StringResource.get('size'),
- 'value': this._getSizeOfFile(),
- 'type': 'SingleLineValue'
- }, {
- 'type': 'Separator'
- }, {
- 'name': 'refreshedDatetime',
- 'label': StringResource.get('refreshedDatetime'),
- 'value': this._getRefreshTime(),
- 'type': 'SingleLineValue'
- }]);
- break;
- case 'powerPlay8Report':
- case 'query':
- case 'report':
- case 'interactiveReport':
- case 'agentDefinition':
- this._advancedProperties = this._advancedProperties.concat([{
- 'type': 'Separator'
- }, {
- 'name': 'setSourceData',
- 'type': 'SingleLineLinks',
- 'items': [{
- 'align': 'left',
- 'items': [{
- 'type': 'text',
- 'name': 'associatedSourceDataText',
- 'value': this.objectInfo.type === 'agentDefinition'? StringResource.get('associatedSourceAgent') : StringResource.get('associatedSource')
- }]
- }, {
- 'align': 'right',
- 'items': [{
- 'type': 'text',
- 'name': 'setAssociatedSourceDataLink',
- 'value': StringResource.get('SetLanguagesLabel'),
- 'clickCallback': this._selectPackage.bind(this, this.objectInfo.type),
- 'ariaLabelledby': 'associatedSourceDataText setAssociatedSourceDataLink'
- }]
- }]
- }, {
- 'name': 'sourceDataLocationName',
- 'label': '',
- 'value': this._getSourcePackageOrModuleLocation(this.objectInfo, true),
- 'type': 'SingleLineValue'
- }]);
- break;
- case 'powerPlay8ReportView':
- case 'reportView':
- case 'agentDefinitionView':
- this._advancedProperties = this._advancedProperties.concat([{
- 'type': 'Separator'
- }, {
- 'name': 'setSourceReport',
- 'type': 'SingleLineLinks',
- 'items': [{
- 'align': 'left',
- 'items': [{
- 'type': 'text',
- 'name': 'associatedSourceText',
- 'value': this.objectInfo.type === 'agentDefinitionView'? StringResource.get('sourceAgent') : StringResource.get('sourceReport')
- }]
- }, {
- 'align': 'right',
- 'items': [{
- 'type': 'text',
- 'name': 'setAssociatedSourceLink',
- 'value': StringResource.get('SetLanguagesLabel'),
- 'clickCallback': this._selectSource.bind(this, this.objectInfo.type),
- 'ariaLabelledby': 'associatedSourceText setAssociatedSourceLink'
- }]
- }]
- }, {
- 'name': 'sourceLocationName',
- 'label': '',
- 'value': this._getSourceLocation(),
- 'type': 'SingleLineValue'
- }]);
- break;
- case 'dataSet2':
- var unknown = StringResource.get('unknown');
- this._advancedProperties = this._advancedProperties.concat([{
- 'type': 'Separator'
- }, {
- 'name': 'setSourceDataSet',
- 'type': 'SingleLineLinks',
- 'items': [{
- 'align': 'left',
- 'items': [{
- 'type': 'text',
- 'name': 'associatedSourceDataText',
- 'value': StringResource.get('associatedSourceAgent')
- }]
- }, {
- 'align': 'right',
- 'items': [{
- 'type': 'text',
- 'name': 'setAssociatedSourceDataLink',
- 'value': StringResource.get('SetLanguagesLabel'),
- 'clickCallback': this._selectPackage.bind(this, this.objectInfo.type),
- 'ariaLabelledby': 'associatedSourceDataText setAssociatedSourceDataLink'
- }]
- }]
- }, {
- 'name': 'sourceDataLocationName',
- 'label': '',
- 'value': this._getSourcePackageOrModuleLocation(this.objectInfo, true),
- 'type': 'SingleLineValue'
- }, {
- 'type': 'Separator'
- }, {
- 'name': 'size',
- 'label': StringResource.get('size'),
- 'value': this._getDataSetSize() || unknown,
- 'type': 'SingleLineValue'
- }, {
- 'type': 'Separator'
- }, {
- 'name': 'numRows',
- 'label': StringResource.get('numberRows'),
- 'value': ContentStoreObject.getDataDescriptor(this.objectInfo.dataSetOutputInfo).numRows || unknown,
- 'type': 'SingleLineValue'
- }, {
- 'type': 'Separator'
- }, {
- 'name': 'numColumns',
- 'label': StringResource.get('numberColumns'),
- 'value': ContentStoreObject.getDataDescriptor(this.objectInfo.dataSetOutputInfo).numColumns || unknown,
- 'type': 'SingleLineValue'
- }, {
- 'type': 'Separator'
- }, {
- 'name': 'timeToRefresh',
- 'label': StringResource.get('TimeToRefresh'),
- 'value': Utils.formatDuration(ContentStoreObject.getDataDescriptor(this.objectInfo.dataSetOutputInfo).elapsedTimeMilli),
- 'type': 'SingleLineValue'
- }, {
- 'type': 'Separator'
- }, {
- 'name': 'refreshedBy',
- 'label': StringResource.get('LastRefreshedBy'),
- 'value': ContentStoreObject.getOwnerName(this.objectInfo.dataSetOutputInfo),
- 'type': 'SingleLineValue'
- }, {
- 'type': 'Separator'
- }]);
- break;
- }
- return this._advancedProperties;
- },
- onClose: function() {
- return this.getPropertyUIControl().onClose();
- },
- getModifiedProperties: function() {
- if (!ContentStoreObject.hasPermissions(this.objectInfo, ['write'])) {
- return null;
- }
- var modifiedProperties = this.getPropertyUIControl().getModifiedProperties();
- if (this.modifiedBaseReport !== undefined) {
- _.extend(modifiedProperties, {
- 'base': [this.modifiedBaseReport]
- });
- } else if (this.modifiedBasePackage !== undefined) {
- //TODO remove asset knowledge
- if (this.modifiedBasePackage.type === 'module') {
- _.extend(modifiedProperties, {
- 'module': [this.modifiedBasePackage],
- 'metadataModelPackage': null, // clear any existing metadata metadataModel or package
- 'metadataModel': null
- });
- } else {
- _.extend(modifiedProperties, {
- 'metadataModelPackage': [this.modifiedBasePackage],
- 'module': null, // clear any existing metadata metadataModel or module
- 'metadataModel': null
- });
- }
- }
- this.logger.debug('PropertiesGeneralTab.getModifiedProperties', modifiedProperties);
- return modifiedProperties;
- },
- updateTenant: function(tenantID) {
- this._oPropertyUIControl.getProperty('changeTenant').setValue(this._getTenantNameByID(tenantID));
- this.currentTenantID = tenantID;
- },
- _selectSource: function(parentType) {
- ContentStoreObject.getBaseObjectType(this.objectInfo).then(function(baseType) {
- require(['bacontentnav/ui/dialogs/OpenDialog'], function(OpenDialog) {
- var objectType = ContentStoreObject.getType(this.objectInfo);
- var type = baseType || UIHelper.getBaseTypes(objectType).join('|');
- var dialog = new OpenDialog({
- glassContext: this.glassContext,
- 'typesToOpen': type.split('|'),
- 'filtersByTypes': 'folder|package' + '|' + type,
- multiSelect: false,
- ancestors: ContentStoreObject.getAncestors(this.objectInfo),
- onOpenCallback: function(selectedItems) {
- this._setBase(selectedItems[0]);
- }.bind(this)
- });
- dialog.title = StringResource.get('setSourceLocation', {
- itemName: StringResource.get(parentType)
- });
- dialog.open();
- }.bind(this));
- }.bind(this));
- },
- _selectPackage: function(parentType) {
- require(['bacontentnav/ui/dialogs/OpenDialog'], function(OpenDialog) {
- var dialog = new OpenDialog({
- glassContext: this.glassContext,
- // Currently, agentDefinition does not support the linkage of 'data module' yet.
- 'typesToOpen': parentType === 'agentDefinition'? ['package'] : ['package', 'module'],
- 'filtersByTypes': 'folder|package|module',
- multiSelect: false,
- ancestors: ContentStoreObject.getAncestors(this.objectInfo),
- capabilitiesRequired: parentType === 'report'? ['canUseReportStudio'] : undefined,
- onOpenCallback: function(selectedItems) {
- this._setBasePackage(selectedItems[0]);
- }.bind(this)
- });
- dialog.title = parentType === 'agentDefinition'? StringResource.get('linkPackage', {
- itemName: StringResource.get(this.objectInfo.type)
- }) : StringResource.get('linkPackageOrModule', {
- itemName: StringResource.get(this.objectInfo.type)
- });
- dialog.open();
- }.bind(this));
- },
- _setBasePackage: function(base) {
- this.modifiedBasePackage = {
- 'searchPath': 'storeID("' + base.id + '")',
- 'type': ContentStoreObject.getType(base)
- };
- this._oPropertyUIControl.getProperty('sourceDataLocationName').setValue(ContentStoreObject.getLocation(base, false));
- },
- _setBase: function(base) {
- this.modifiedBaseReport = {
- 'searchPath': 'storeID("' + base.id + '")',
- 'type': ContentStoreObject.getType(base)
- };
- this._oPropertyUIControl.getProperty('sourceLocationName').setValue(ContentStoreObject.getLocation(base, true));
- }
- });
- PropertiesGeneralTab.getPropertiesToQuery = function(type) {
- return PropertiesGeneralTab.PROPERTIES_TO_QUERY.common.concat(PropertiesGeneralTab.PROPERTIES_TO_QUERY[type]).join(',');
- };
- _.extend(PropertiesGeneralTab, _static);
- return PropertiesGeneralTab;
- });
- define('text!bi/content_apps/propertiespageview.json',[],function () { return '{\n\t"copyright": "Licensed Materials - Property of IBM. IBM Cognos Products: BI Cloud(C) Copyright IBM Corp.2014, 2022. US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.",\n\t"tabs": {\n\t\t"jobDefinition": [{\n\t\t\t"name": "general",\n\t\t\t"module": "bi/content_apps/PropertiesGeneralTab"\n\t\t}, {\n\t\t\t"name": "job",\n\t\t\t"module": "bi/content_apps/PropertiesJobTab"\n\t\t}, {\n\t\t\t"name": "schedule",\n\t\t\t"module": "bi/schedule/views/SchedulesView",\n\t\t\t"requiredCapabilities": ["canUseScheduling"],\n\t\t\t"requiredPermissions": ["read"]\n\t\t}, {\n\t\t\t"name": "permission",\n\t\t\t"module": "bi/content_apps/PropertiesPermissionsTab",\n\t\t\t"requiredPermissions": ["setPolicy"]\n\t\t}],\n\t\t"report": [{\n\t\t\t"name": "general",\n\t\t\t"module": "bi/content_apps/PropertiesGeneralTab"\n\t\t}, {\n\t\t\t"name": "report",\n\t\t\t"module": "bi/content_apps/PropertiesReportTab",\n\t\t\t"requiredPermissions": ["read"]\n\t\t}, {\n\t\t\t"name": "schedule",\n\t\t\t"module": "bi/schedule/views/SchedulesView",\n\t\t\t"requiredCapabilities": ["canUseScheduling"],\n\t\t\t"requiredPermissions": ["read"]\n\t\t}, {\n\t\t\t"name": "permission",\n\t\t\t"module": "bi/content_apps/PropertiesPermissionsTab",\n\t\t\t"requiredPermissions": ["setPolicy"]\n\t\t}],\n\t\t"dataSet2": [{\n\t\t\t"name": "general",\n\t\t\t"module": "bi/content_apps/PropertiesGeneralTab"\n\t\t}, {\n\t\t\t"name": "permission",\n\t\t\t"module": "bi/content_apps/PropertiesPermissionsTab",\n\t\t\t"requiredPermissions": ["setPolicy"]\n\t\t}, {\n\t\t\t"name": "schedule",\n\t\t\t"module": "bi/schedule/views/SchedulesView",\n\t\t\t"requiredCapabilities": ["canUseScheduling"],\n\t\t\t"requiredPermissions": ["read"]\n\t\t}],\n\t\t"reportView": [{\n\t\t\t"name": "general",\n\t\t\t"module": "bi/content_apps/PropertiesGeneralTab"\n\t\t}, {\n\t\t\t"name": "report",\n\t\t\t"module": "bi/content_apps/PropertiesReportTab",\n\t\t\t"requiredPermissions": ["read"]\n\t\t}, {\n\t\t\t"name": "schedule",\n\t\t\t"module": "bi/schedule/views/SchedulesView",\n\t\t\t"requiredCapabilities": ["canUseScheduling"],\n\t\t\t"requiredPermissions": ["read"]\n\t\t}, {\n\t\t\t"name": "permission",\n\t\t\t"module": "bi/content_apps/PropertiesPermissionsTab",\n\t\t\t"requiredPermissions": ["setPolicy"]\n\t\t}],\n\t\t"package": [{\n\t\t\t"name": "general",\n\t\t\t"module": "bi/content_apps/PropertiesGeneralTab"\n\t\t}, {\n\t\t\t"name": "permission",\n\t\t\t"module": "bi/content_apps/PropertiesPermissionsTab",\n\t\t\t"requiredPermissions": ["setPolicy"]\n\t\t}, {\n\t\t\t"name": "capabilities",\n\t\t\t"module": "bi/content_apps/PropertiesCapabilitiesTab",\n\t\t\t"requiredCapabilities": ["canUseObjectCapabilities"]\n\t\t}],\n\t\t"folder": [{\n\t\t\t"name": "general",\n\t\t\t"module": "bi/content_apps/PropertiesGeneralTab"\n\t\t}, {\n\t\t\t"name": "permission",\n\t\t\t"module": "bi/content_apps/PropertiesPermissionsTab",\n\t\t\t"requiredPermissions": ["setPolicy"]\n\t\t}, {\n\t\t\t"name": "capabilities",\n\t\t\t"module": "bi/content_apps/PropertiesCapabilitiesTab",\n\t\t\t"requiredCapabilities": ["canUseObjectCapabilities"]\n\t\t}],\n\t\t"content": [{\n\t\t\t"name": "general",\n\t\t\t"module": "bi/content_apps/PropertiesGeneralTab"\n\t\t}, {\n\t\t\t"name": "permission",\n\t\t\t"module": "bi/content_apps/PropertiesPermissionsTab",\n\t\t\t"requiredPermissions": ["setPolicy"]\n\t\t}, {\n\t\t\t"name": "capabilities",\n\t\t\t"module": "bi/content_apps/PropertiesCapabilitiesTab",\n\t\t\t"requiredCapabilities": ["canUseObjectCapabilities"]\n\t\t}],\n\t\t"dashboard": [{\n\t\t\t"name": "general",\n\t\t\t"module": "bi/content_apps/PropertiesGeneralTab"\n\t\t}, {\n\t\t\t"name": "permission",\n\t\t\t"module": "bi/content_apps/PropertiesPermissionsTab",\n\t\t\t"requiredPermissions": ["setPolicy"]\n\t\t}],\n\t\t"jupyterNotebook": [{\n\t\t\t"name": "general",\n\t\t\t"module": "bi/content_apps/PropertiesGeneralTab"\n\t\t}, {\n\t\t\t"name": "permission",\n\t\t\t"module": "bi/content_apps/PropertiesPermissionsTab",\n\t\t\t"requiredPermissions": ["setPolicy"]\n\t\t}, {\n\t\t\t"name": "schedule",\n\t\t\t"module": "bi/schedule/views/SchedulesView",\n\t\t\t"requiredCapabilities": ["canUseScheduling"],\n\t\t\t"requiredPermissions": ["read"]\n\t\t}],\n\t\t"unknown": [{\n\t\t\t"name": "general",\n\t\t\t"module": "bi/content_apps/PropertiesGeneralTab"\n\t\t}, {\n\t\t\t"name": "permission",\n\t\t\t"module": "bi/content_apps/PropertiesPermissionsTab",\n\t\t\t"requiredPermissions": ["setPolicy"]\n\t\t}],\n\t\t"powerPlayReport": [{\n\t\t\t"name": "general",\n\t\t\t"module": "bi/content_apps/PropertiesGeneralTab"\n\t\t}, {\n\t\t\t"name": "PowerPlayReport",\n\t\t\t"module": "bi/content_apps/PropertiesC10Tab"\n\t\t}, {\n\t\t\t"name": "permission",\n\t\t\t"module": "bi/content_apps/PropertiesPermissionsTab",\n\t\t\t"requiredPermissions": ["setPolicy"]\n\t\t}],\n\t\t"document": [{\n\t\t\t"name": "general",\n\t\t\t"module": "bi/content_apps/PropertiesGeneralTab"\n\t\t}, {\n\t\t\t"name": "document",\n\t\t\t"module": "bi/content_apps/PropertiesC10Tab"\n\t\t}, {\n\t\t\t"name": "permission",\n\t\t\t"module": "bi/content_apps/PropertiesPermissionsTab",\n\t\t\t"requiredPermissions": ["setPolicy"]\n\t\t}],\n\t\t"agent": [{\n\t\t\t"name": "general",\n\t\t\t"module": "bi/content_apps/PropertiesGeneralTab"\n\t\t}, {\n\t\t\t"name": "agent",\n\t\t\t"module": "bi/content_apps/PropertiesC10Tab"\n\t\t}, {\n\t\t\t"name": "schedule",\n\t\t\t"module": "bi/schedule/views/SchedulesView",\n\t\t\t"requiredCapabilities": ["canUseScheduling"],\n\t\t\t"requiredPermissions": ["read"]\n\t\t}, {\n\t\t\t"name": "permission",\n\t\t\t"module": "bi/content_apps/PropertiesPermissionsTab",\n\t\t\t"requiredPermissions": ["setPolicy"]\n\t\t}],\n\t\t"agentDefinitionView": [{\n\t\t\t"name": "general",\n\t\t\t"module": "bi/content_apps/PropertiesGeneralTab"\n\t\t}, {\n\t\t\t"name": "agent",\n\t\t\t"module": "bi/content_apps/PropertiesC10Tab"\n\t\t}, {\n\t\t\t"name": "schedule",\n\t\t\t"module": "bi/schedule/views/SchedulesView",\n\t\t\t"requiredCapabilities": ["canUseScheduling"],\n\t\t\t"requiredPermissions": ["read"]\n\t\t}, {\n\t\t\t"name": "permission",\n\t\t\t"module": "bi/content_apps/PropertiesPermissionsTab",\n\t\t\t"requiredPermissions": ["setPolicy"]\n\t\t}],\n\t\t"planningTask": [{\n\t\t\t"name": "general",\n\t\t\t"module": "bi/content_apps/PropertiesGeneralTab"\n\t\t}, {\n\t\t\t"name": "planningTask",\n\t\t\t"module": "bi/content_apps/PropertiesC10Tab"\n\t\t}, {\n\t\t\t"name": "permission",\n\t\t\t"module": "bi/content_apps/PropertiesPermissionsTab",\n\t\t\t"requiredPermissions": ["setPolicy"]\n\t\t}],\n\t\t"metricsExportTask": [{\n\t\t\t"name": "general",\n\t\t\t"module": "bi/content_apps/PropertiesGeneralTab"\n\t\t}, {\n\t\t\t"name": "metricsExportTask",\n\t\t\t"module": "bi/content_apps/PropertiesC10Tab"\n\t\t}, {\n\t\t\t"name": "permission",\n\t\t\t"module": "bi/content_apps/PropertiesPermissionsTab",\n\t\t\t"requiredPermissions": ["setPolicy"]\n\t\t}],\n\t\t"metricsDataSourceETLTask": [{\n\t\t\t"name": "general",\n\t\t\t"module": "bi/content_apps/PropertiesGeneralTab"\n\t\t}, {\n\t\t\t"name": "metricsDataSourceETLTask",\n\t\t\t"module": "bi/content_apps/PropertiesC10Tab"\n\t\t}, {\n\t\t\t"name": "permission",\n\t\t\t"module": "bi/content_apps/PropertiesPermissionsTab",\n\t\t\t"requiredPermissions": ["setPolicy"]\n\t\t}],\n\t\t"metricsFileImportTask": [{\n\t\t\t"name": "general",\n\t\t\t"module": "bi/content_apps/PropertiesGeneralTab"\n\t\t}, {\n\t\t\t"name": "metricsFileImportTask",\n\t\t\t"module": "bi/content_apps/PropertiesC10Tab"\n\t\t}, {\n\t\t\t"name": "permission",\n\t\t\t"module": "bi/content_apps/PropertiesPermissionsTab",\n\t\t\t"requiredPermissions": ["setPolicy"]\n\t\t}],\n\t\t"metricsMaintenanceTask": [{\n\t\t\t"name": "general",\n\t\t\t"module": "bi/content_apps/PropertiesGeneralTab"\n\t\t}, {\n\t\t\t"name": "metricsMaintenanceTask",\n\t\t\t"module": "bi/content_apps/PropertiesC10Tab"\n\t\t}, {\n\t\t\t"name": "permission",\n\t\t\t"module": "bi/content_apps/PropertiesPermissionsTab",\n\t\t\t"requiredPermissions": ["setPolicy"]\n\t\t}],\n\t\t"powerPlay8ReportView": [{\n\t\t\t"name": "general",\n\t\t\t"module": "bi/content_apps/PropertiesGeneralTab"\n\t\t}, {\n\t\t\t"name": "report",\n\t\t\t"module": "bi/content_apps/PropertiesReportTab",\n\t\t\t"requiredPermissions": ["read"]\n\t\t}, {\n\t\t\t"name": "schedule",\n\t\t\t"module": "bi/schedule/views/SchedulesView",\n\t\t\t"requiredCapabilities": ["canUseScheduling"],\n\t\t\t"requiredPermissions": ["read"]\n\t\t}, {\n\t\t\t"name": "permission",\n\t\t\t"module": "bi/content_apps/PropertiesPermissionsTab",\n\t\t\t"requiredPermissions": ["setPolicy"]\n\t\t}]\n\t}\n}\n';});
- /*
- *+------------------------------------------------------------------------+
- *| Licensed Materials - Property of IBM
- *
- *| IBM Cognos Products: content-apps
- *
- *| (C) Copyright IBM Corp. 2015, 2021
- *|
- *| US Government Users Restricted Rights - Use, duplication or disclosure
- *| restricted by GSA ADP Schedule Contract with IBM Corp.
- *+------------------------------------------------------------------------+
- */
- //jshint maxparams: 8
- define('bi/content_apps/PropertiesPageView',[
- 'underscore',
- 'bacontentnav/lib/@waca/core-client/js/core-client/ui/properties/PropertyPageView',
- 'bacontentnav/utils/ContentStoreObject',
- 'bacontentnav/utils/GlassContextHelper',
- 'bacontentnav/utils/UIHelper',
- 'bacontentnav/utils/ContentManagement',
- 'bi/content_apps/nls/StringResource',
- 'bi/content_apps/PropertiesGeneralTab',
- 'text!bi/content_apps/propertiespageview.json'
- ], function(_, PropertyPageView, ContentStoreObject, GlassContextHelper, UIHelper, ContentManagement, StringResource, PropertiesGeneralTab, propertiesPageViewDefinitions) {
- 'use strict'; //NOSONAR
- var PropertiesPageView = PropertyPageView.extend({
- _isSaved: false,
- /**
- * @param options.$el - JQuery node to append the view onto (either a parent pane or the body)
- * @param options.objectInformation {object} - An object that contains the information for the content
- *
- * @constructor
- */
- init: function(options) {
- PropertiesPageView.inherited('init', this, arguments);
- _.extend(this, options);
- this._oPropertiesPageViewDefinitions = JSON.parse(propertiesPageViewDefinitions);
- },
- render: function() {
- return this._getPropertiesInfo().then(function() {
- if (this.objectInformation.objectDeleted) {
- UIHelper.renderInfoMessage(this.$el, StringResource.get('objectDeleted'));
- } else {
- var isRoot = ContentStoreObject.isTeamContent(this.objectInformation);
- var object = ContentStoreObject.getObjectName(this.objectInformation);
- var objectName = isRoot ? StringResource.get('teamFolders') : object;
- return this.renderPropertyUIControl({
- 'el': this.$el,
- 'glassContext': this.glassContext,
- 'slideout': this.slideout,
- 'readOnly': !ContentStoreObject.hasPermissions(this.objectInformation, ['write']),
- 'ariaLabel': StringResource.get('a11yPropertyPane', {
- 'nameOfObject': objectName
- }),
- 'items': [{
- 'name': 'defaultName',
- 'editable': isRoot ? false : true,
- 'svgIcon': UIHelper.getTypeSVGIconFromObject(this.objectInformation),
- 'svgToolTip': UIHelper.getTypeNameFromObject(this.objectInformation),
- 'value': objectName,
- 'type': 'Banner',
- 'ariaLabel': StringResource.get('itemName'),
- 'handleReturnKey': true,
- 'enterKeyCallback': this.update.bind(this),
- 'isString': true
- }, {
- 'type': 'OwnerRow',
- 'owner': isRoot ? StringResource.get('none') : ContentStoreObject.getOwnerName(this.objectInformation),
- 'creationTime': ContentStoreObject.getCreationDate(this.objectInformation, true, 'short', true),
- 'modificationTime': ContentStoreObject.getModificationTime(this.objectInformation, true, 'short', true),
- 'refreshTime': this.objectInformation.dataSetOutputInfo ? this.objectInformation.dataSetOutputInfo.creationTime : null,
- 'fileType': UIHelper.getTypeNameFromObject(this.objectInformation)
- }, {
- 'type': 'TabControl',
- 'items': this._getTabItems()
- }]
- });
- }
- }.bind(this));
- },
- /**
- * Update our objectInformation model.
- * This calls remove() to ensure any changes are saved, sets the new objectInformation and then renders.
- * @param newObjectInformation a new model.
- * @returns a promise that resolves when everything is updated and rendered.
- */
- updateObjectInformationModel: function(newObjectInformation, onPropertiesClose) {
- //update and then render. This is in a finally so that it will update on an error as well.
- return this.update().finally(function() {
- if (this._oPropertyUIControl) {
- this._oPropertyUIControl.remove();
- }
- this._oPropertyUIControl = null;
- this.objectInformation = newObjectInformation;
- if (onPropertiesClose) {
- onPropertiesClose();
- }
- return this.render();
- }.bind(this));
- },
- update: function() {
- if (ContentStoreObject.hasPermissions(this.objectInformation, ['read write'])) {
- return Promise.resolve(true);
- }
- if (!this.getPropertyUIControl()) {
- return Promise.resolve(true);
- }
- var data = this.getPropertyUIControl().getModifiedProperties();
- if (_.size(data) === 0) {
- return Promise.resolve(true);
- }
- // check if the defaultName contains both ' and " which is not allowed by CM
- if (data.defaultName && typeof(data.defaultName) === 'string' && (data.defaultName.indexOf('\'') > -1) && (data.defaultName.indexOf('"') > -1)){
- GlassContextHelper.displayToast(this.glassContext, StringResource.get('errorMessageApostropheError'), {
- 'type': 'error'
- });
- return Promise.resolve(true);
- }
- // Update the parent view which is showing the original object
- return this._directSave(data).then(function() {
- if (typeof (this.parentView.refresh) === 'function') {
- this.parentView.refresh();
- }
- data.id = this.objectInformation.id;
- data.selfUrl = ContentStoreObject.getSelfLink(this.objectInformation);
- this.glassContext.getSvc('.Content').then(function(contentSvc) {
- contentSvc.updateMRUEntry(data);
- });
- }.bind(this));
- },
- _doSave: function() {
- return this.update();
- },
- _directSave: function(data) {
- // Add the type and url to the properties (used in the PUT request)
- var type = null;
- var url = null;
- // Notes:
- // The refReportSelfLink is captured/cached when figuring out the packaging info for agentDefinition object's report child object in terms of avoiding another Ajax call.
- // With our current Object Model, unlike report object containing the defined packaging info, agentDefinition object has to define the packaging info via its report child object.
- // If there are other objects similar to agentDefinition, handle similarly.
- // Currently, agentDefinition does not support the linkage of "data module" which will need to be supported eventually according to OM.
- if (ContentStoreObject.getMetadataModelPackage(data) && this.objectInformation.refReportSelfLink) {
- type = 'report';
- url = this.objectInformation.refReportSelfLink;
- } else {
- type = ContentStoreObject.getType(this.objectInformation);
- url = ContentStoreObject.getSelfLink(this.objectInformation);
- }
- data.type = type;
- // check if the defaultName contains both ' and " before sending update request, which is not allowed by CM
- if (data.defaultName && typeof(data.defaultName) === 'string' && (data.defaultName.indexOf('\'') > -1) && (data.defaultName.indexOf('"') > -1)){
- return GlassContextHelper.displayToast(this.glassContext, StringResource.get('errorMessageApostropheError'), {
- 'type': 'error'
- });
- }
- return this._sendUpdateRequest(data, url);
- },
- _sendUpdateRequest: function(data, url) {
- var options = {
- 'headers': {
- 'Accept': 'application/json',
- 'Content-Type': 'application/json'
- },
- 'type': 'PUT',
- 'url': url,
- 'data': JSON.stringify(data)
- };
- return this._sendRequest(options, false, data);
- },
- _sendRequest: function(options, successHandler, data, ignoreFailure) {
- this.logger.debug('PropertiesPageView._sendRequest', options, data);
- successHandler = successHandler || function() {};
- options.cache = false;
- return new Promise(function(resolve, reject) {
- this.glassContext.getCoreSvc('.Ajax').ajax(options)
- .then(successHandler.bind(this))
- .catch(function(error) {
- if (!ignoreFailure) {
- // check for name collisions or undetailed update errors
- var isDuplicate = ContentManagement.isNameConflict(error);
- var isUnknownUpdateError = !isDuplicate && ContentManagement.isUnknownUpdateError(error);
- if (isDuplicate || isUnknownUpdateError) {
- // use a toast message if this is a name collision or unknown error
- var message = isDuplicate ?
- StringResource.get('renameCollisionError', {
- 'name': data && data.defaultName || ''
- }) :
- StringResource.get('unknownUpdateError');
- GlassContextHelper.displayToast(this.glassContext, message, {
- 'type': 'error'
- });
- } else {
- // show dialog if other error messages are available
- GlassContextHelper.showAjaxServiceErrorMessage(this.glassContext, error.jqXHR);
- }
- reject(new Error());
- }
- }.bind(this))
- .finally(function() {
- resolve();
- });
- }.bind(this));
- },
- _getPropertiesInfo: function() {
- var options = this._getRequestOptions(ContentStoreObject.getSelfLink(this.objectInformation), this._getPropertiesToQuery());
- return this._sendRequest(options, this._handleGetInfoSuccess).then(function() {
- return Promise.all(this._getAdditionalInfo());
- }.bind(this));
- },
- _getAdditionalInfo: function() {
- var aPromises = [];
- // get additional info based on the real object type, NOT PROPERTIES_MAP
- switch (this.objectInformation.type) {
- case 'package':
- var modelGetURL = ContentStoreObject.getModelsLink(this.objectInformation);
- if (modelGetURL) {
- // Send the models request and only resolve this deferred once the models deferred is resolved
- aPromises.push(this._sendRequest(this._getRequestOptions(modelGetURL, 'options'), this._handleGetModelSuccess));
- }
- break;
- case 'reportView':
- case 'powerPlay8ReportView':
- var baseSource = ContentStoreObject.getBaseMetadataModelPackage(this.objectInformation) || ContentStoreObject.getBaseModule(this.objectInformation);
- if (baseSource) {
- var baseSelfURL = ContentStoreObject.getSelfLink(baseSource);
- if (baseSelfURL) {
- aPromises.push(this._sendRequest(this._getRequestOptions(baseSelfURL, 'defaultName,ancestors'), this._handleGetPackageSuccess));
- }
- }
- break;
- case 'dataSet2':
- var metadataModel = ContentStoreObject.getMetadataModelPackage(this.objectInformation) || ContentStoreObject.getModule(this.objectInformation);
- if (metadataModel) {
- var selfLink = ContentStoreObject.getSelfLink(metadataModel);
- if (selfLink) {
- aPromises.push(this._sendRequest(this._getRequestOptions(selfLink, 'defaultName,ancestors'), this._handleGetPackageSuccess));
- }
- }
- aPromises.push(this._sendRequest(this._getRequestOptions(ContentStoreObject.getSelfLink(this.objectInformation) + '/default_output', 'creationTime,dataSize,dataDescriptor,owner.defaultName'), this._handleGetDataSetOutputResponse));
- break;
- case 'shortcut':
- var targetUrl = this.objectInformation.target && this.objectInformation.target[0]._meta.links.path.url;
- if (targetUrl) {
- aPromises.push(this._sendRequest(this._getRequestOptions(targetUrl, 'defaultName,ancestors'), this._handleGetShortcutTargetDataSuccess, null, true));
- }
- break;
- case 'agentDefinition':
- var itemsLink = ContentStoreObject.getItemsLink(this.objectInformation);
- if (itemsLink) {
- aPromises.push(this._sendRequest(this._getRequestOptions(itemsLink, 'metadataModelPackage{defaultName,ancestors}'), this._handleGetReportMetadataModelPackageSuccess, null, true));
- }
- break;
- default:
- }
- return aPromises;
- },
- _getRequestOptions: function(url, fields) {
- return {
- dataType: 'json',
- type: 'GET',
- url: url,
- data: {
- fields: fields
- }
- };
- },
- _getFirstInResponseArray: function(requestResponse) {
- var data = _.isArray(requestResponse.data && requestResponse.data.data) ? requestResponse.data.data : null;
- return data && data.length !== 0 ? data[0] : null;
- },
- _handleGetInfoSuccess: function(requestResponse) {
- var firstData = this._getFirstInResponseArray(requestResponse);
- if (firstData) {
- $.extend(this.objectInformation, firstData);
- } else {
- this.objectInformation.objectDeleted = true;
- }
- },
- _handleGetModelSuccess: function(requestResponse) {
- //just set the options info as we do not want to accidentally overwrite the model info or really anything else
- var firstData = this._getFirstInResponseArray(requestResponse);
- if (firstData) {
- this.objectInformation.options = firstData.options;
- }
- },
- _handleGetDataSetOutputResponse: function(requestResponse) {
- var firstData = this._getFirstInResponseArray(requestResponse);
- if (firstData) {
- this.objectInformation.dataSetOutputInfo = {
- 'creationTime': ContentStoreObject.getCreationDate(firstData, true, 'short', true),
- 'dataSize': firstData.dataSize,
- 'dataDescriptor': firstData.dataDescriptor,
- 'owner': firstData.owner
- };
- }
- },
- _handleGetPackageSuccess: function(requestResponse) {
- var firstData = this._getFirstInResponseArray(requestResponse);
- if (firstData) {
- var objToUpdate = ContentStoreObject.getBaseMetadataModelPackage(this.objectInformation) ||
- ContentStoreObject.getMetadataModelPackage(this.objectInformation) ||
- ContentStoreObject.getBaseModule(this.objectInformation) ||
- ContentStoreObject.getModule(this.objectInformation);
- objToUpdate[ContentStoreObject.DEFAULT_NAME] = firstData.defaultName;
- objToUpdate[ContentStoreObject.ANCESTORS] = firstData.ancestors;
- }
- },
- _handleGetShortcutTargetDataSuccess: function(requestResponse) {
- var firstData = this._getFirstInResponseArray(requestResponse);
- if (firstData) {
- var objToUpdate = this.objectInformation.target && this.objectInformation.target[0];
- if (objToUpdate) {
- objToUpdate.defaultName = firstData.defaultName;
- objToUpdate.ancestors = firstData.ancestors;
- }
- }
- },
- _handleGetReportMetadataModelPackageSuccess: function(requestResponse) {
- if (requestResponse && requestResponse.data && requestResponse.data.data) {
- var data = _.find(requestResponse.data.data, function (element) { return element.type === 'report'; });
- this.objectInformation.refReportSelfLink = ContentStoreObject.getSelfLink(data);
- this.objectInformation.metadataModelPackage = data.metadataModelPackage;
- }
- },
- // Used for Properties tab
- _getObjectType: function() {
- return UIHelper.getProperties(ContentStoreObject.getType(this.objectInformation));
- },
- _getPropertiesToQuery: function() {
- this._objType = this._getObjectType();
- if (this._objType === 'unknown') {
- this.logger.log('PropertiesPageView: No mapping for object type ' + this.objectInformation.type);
- }
- return PropertiesGeneralTab.getPropertiesToQuery(this._objType);
- },
- _getTabItems: function() {
- var tabItems = [];
- var objectType = this._getObjectType();
- // Check to make sure the objectType is supported. If not, default to unknown
- var supportedObjectTabs = this._oPropertiesPageViewDefinitions.tabs;
- if (!supportedObjectTabs[objectType]) {
- objectType = 'unknown';
- }
- supportedObjectTabs[objectType].forEach(function(tab) {
- if (this._isTabDisplayed(tab)) {
- tabItems.push({
- 'name': StringResource.get(tab.name),
- 'module': tab.module,
- 'objectInfo': this.objectInformation,
- 'glassContext': this.glassContext,
- 'slideout': this.slideout
- });
- }
- }.bind(this));
- return tabItems;
- },
- _isTabDisplayed: function(tab) {
- var missingRequiredCapabilities = false;
- if (tab.requiredCapabilities) {
- missingRequiredCapabilities = tab.requiredCapabilities.some(function(capability) {
- return !this.glassContext.hasCapability(capability);
- }.bind(this));
- }
- if ((!this.glassContext.isDevInstall() && tab.devMode) ||
- (tab.requiredPermissions && !UIHelper.hasPermissions(this.objectInformation.permissions, tab.requiredPermissions)) ||
- missingRequiredCapabilities) {
- return false;
- }
- return true;
- }
- });
- return PropertiesPageView;
- });
- /*
- *+------------------------------------------------------------------------+
- *| Licensed Materials - Property of IBM
- *| IBM Cognos Products: Content Explorer
- *| (C) Copyright IBM Corp. 2015, 2019
- *|
- *| US Government Users Restricted Rights - Use, duplication or disclosure
- *| restricted by GSA ADP Schedule Contract with IBM Corp.
- *+------------------------------------------------------------------------+
- */
- define('bi/content_apps/common/ui/list_actions/LegacyArtifactDefaultActionHandlerBase',[
- 'bi/glass/core/Class',
- 'bi/content_apps/utils/C10Utils',
- 'underscore'
- ], function(Class, C10Utils, _) {
- 'use strict';
- var LegacyArtifactDefaultActionHandlerBase = Class.extend({
- init: function(options) {
- LegacyArtifactDefaultActionHandlerBase.inherited('init', this, arguments);
- _.extend(this, options);
- },
- canExecute: function(options) {
- void(options);
- return true;
- },
- _replaceBackURL: function(url) {
- var index = url.indexOf('backURL=');
- var urlWithoutBack = url;
- if (index !== -1) {
- urlWithoutBack = url.substring(0, index - 1);
- var endIndex = url.indexOf('&', index);
- if (endIndex !== -1) {
- urlWithoutBack += url.substring(endIndex);
- }
- }
- var backURL = '../utils/close.html';
- url = urlWithoutBack + '&backURL=' + encodeURIComponent(backURL);
- url += '&ui.backURL=' + encodeURIComponent(backURL);
- return url;
- },
- _getLegacyLaunchURL: function(options) {
- var selectedContext = options.target.activeObject.aSelectedContext;
- var navServiceEndpoint = LegacyArtifactDefaultActionHandlerBase.NAVService + selectedContext[0].id + '?json=';
- this.options = options;
- return options.glassContext.getCoreSvc('.Ajax').ajax({
- 'url': navServiceEndpoint,
- 'dataType': 'text',
- 'type': 'GET'
- })
- .then(function(result) {
- result = result && result.data;
- if (result) {
- /* TODO - do we need this?? Seems a little.. bad. */
- var parsedResponse = eval('parsedResponse=' + result); // NOSONAR: eval is needed here
- if (parsedResponse.feed) {
- var oType = parsedResponse.feed.cm$objectClass;
- var oTargetType = parsedResponse.feed.cm$targetObjectClass;
- var launchURL;
- var links = parsedResponse.feed.link;
- for (var i = 0; i < links.length; i = i + 1) {
- if (links[i].rel === 'alternate' && links[i].type === 'application/octet-stream') {
- launchURL = links[i].href;
- }
- }
- if (launchURL) {
- if (C10Utils.isPowerPlay(oType)) {
- if (this.options.target.runOptions) {
- launchURL = launchURL.replace('&ui.crnfrm=HTML','&ui.crnfrm=PDF');
- if (this.options.target.runOptions.prompt) {
- launchURL += '&ui.crnp=true';
- } else {
- launchURL = launchURL.replace('&ui.crnp=true', '');
- }
- }
- }
- }
- if (launchURL && oType !== 'URL' && oTargetType !== 'URL') {
- launchURL = this._replaceBackURL(launchURL);
- }
- var payLoad = {
- launchURL: launchURL,
- oType: oType,
- oTargetType: oTargetType,
- navFeed: parsedResponse
- };
- return Promise.resolve(payLoad);
- } else {
- return Promise.reject(new Error());
- }
- } else {
- Promise.reject(new Error());
- }
- }.bind(this));
- }
- });
- LegacyArtifactDefaultActionHandlerBase.NAVService = 'v1/disp/atom/cm/id/';
- return LegacyArtifactDefaultActionHandlerBase;
- });
- /*
- *+------------------------------------------------------------------------+
- *| Licensed Materials - Property of IBM
- *| IBM Cognos Products: content-apps
- *| (C) Copyright IBM Corp. 2015, 2018
- *|
- *| US Government Users Restricted Rights - Use, duplication or disclosure
- *| restricted by GSA ADP Schedule Contract with IBM Corp.
- *+------------------------------------------------------------------------+
- */
- define('bi/content_apps/common/ui/list_actions/LegacyArtifactActionHandler',[
- 'underscore',
- 'bi/content_apps/common/ui/list_actions/LegacyArtifactDefaultActionHandlerBase',
- 'bacontentnav/utils/ContentStoreObject',
- 'bacontentnav/utils/GlassContextHelper'
- ], function(_, BaseActionHandler, ContentStoreObject, GlassContextHelper) {
- 'use strict';
- var LegacyArtifactActionHandler = BaseActionHandler.extend({
- init: function(options) {
- LegacyArtifactActionHandler.inherited('init', this, arguments);
- _.extend(this, options);
- },
- canExecute: function() {
- return true;
- },
- doAction: function(options) {
- var content = options.target.activeObject.aSelectedContext[0];
- if (content.type === 'myPageletRef' || content.type === 'pagelet') {
- return options.glassContext.getCoreSvc('.Config').getConfigValue('ContentApps/enableMyPortalPages')
- .then(function(isFeatureEnabled) {
- if (isFeatureEnabled === 'true') {
- if (content.type === 'myPageletRef') {
- content.id = content.target;
- }
- content.objRef = content.id;
- return options.glassContext.appController.openAppView('pagelet', { content: content });
- } else {
- return this._doLegacyAction(options);
- }
- }.bind(this));
- } else {
- return this._doLegacyAction(options);
- }
- },
- _doLegacyAction: function(options) {
- return this._getLegacyLaunchURL(options).then(function(payLoad) {
- var launchURL = payLoad.launchURL;
- var item = options.target.activeObject.aSelectedContext[0];
- var runPermissions = ContentStoreObject.hasPermissions(item, ['execute']);
- if (launchURL) {
- if (options.target.runOptions !== undefined) {
- launchURL = launchURL.replace('ui.action=edit', 'ui.action=run');
- if (options.target.runOptions.prompt) {
- launchURL = launchURL + '&ui.crnp=true';
- } else {
- launchURL = launchURL + '&ui.crnp=false';
- }
- }
- var newTab = this._openUrl(launchURL);
- // resolve if there's tab or it was a file ('file'-protocol URLs don't create a tab)
- if (newTab || (launchURL.indexOf('file:') === 0) || (launchURL.indexOf('\\\\') === 0)) {
- return Promise.resolve();
- } else {
- return Promise.reject(new Error('Could not launch a new tab.'));
- }
- } else if(!launchURL && (options.target.itemId.indexOf('powerPlay8Report') !== -1) && runPermissions) {
- // the launch url comes back as undefined from the atom api if the user does not have powerplay capability
- // APAR 140674 workaround to open a power play report as pdf for users without the capability
- var contentLocale = GlassContextHelper.getUserPreference(options.glassContext, 'contentLocale');
- var productLocale = GlassContextHelper.getUserPreference(options.glassContext, 'productLocale');
- var outputId = options.target.activeObject.aSelectedContext[0].id;
- var name = options.target.activeObject.aSelectedContext[0].defaultName;
- var url = 'v1/disp?b_action=powerPlayService&ui.gateway=/bi/v1/disp&ui.action=run&ui.crnfrm=PDF&ui.crnp=true&LA='+productLocale+'&LO='+contentLocale+'&crnobj='+ item.searchPath +'&ui.tool=PowerplayStudio&ui.format=PDF&ui.object=storeID(%22' + outputId + '%22)&ui.name=' + _.escape(name);
- url = url + '&cv.header=false&ui.backURL=%2fcps4%2fportlets%2fcommon%2fclose.html';
- this._openUrl(url);
- return Promise.resolve();
- } else {
- return Promise.reject(new Error('No URL associated with the artifact.'));
- }
- }.bind(this));
- },
- _openUrl: function(url) {
- return window.open(url);
- }
- });
- return LegacyArtifactActionHandler;
- });
- /*
- *+------------------------------------------------------------------------+
- *| Licensed Materials - Property of IBM
- *| IBM Cognos Products: BI Content Explorer
- *| (C) Copyright IBM Corp. 2018
- *|
- *| US Government Users Restricted Rights - Use, duplication or disclosure
- *| restricted by GSA ADP Schedule Contract with IBM Corp.
- *+------------------------------------------------------------------------+
- */
- define('bi/content_apps/common/ui/list_actions/AddURLAction',[
- 'jquery',
- 'underscore',
- 'bacontentnav/common/ui/list_actions/ListAction',
- 'bi/content_apps/nls/StringResource',
- 'bacontentnav/utils/ContentManagement',
- 'bacontentnav/utils/GlassContextHelper',
- 'bacontentnav/utils/ActionHelper',
- 'bi/content_apps/common/ui/list_actions/LegacyArtifactActionHandler',
- 'bi/commons/utils/BidiUtil'
- // jshint -W072
- ], function($, _, ListAction, StringResource, ContentManagement, GlassContextHelper, ActionHelper, LegacyArtifactActionHandler, BidiUtil) {
- // jshint +W072
- 'use strict';
- var AddFolderAction = ListAction.extend({
- init: function(options) {
- _.extend(this, options);
- this.contentList = this.hostView.view;
- this.listControl = this.hostView.listControl;
- this.glassContext = this.hostView.glassContext;
- this.logger = this.glassContext.getCoreSvc('.Logger');
- this.legacyHandler = new LegacyArtifactActionHandler();
- this.renderFromReact = this.hostView.renderFromReact;
- if(this.listControl && !this.renderFromReact) {
- this.url = this.listControl.url;
- this.aData = this.listControl._dTable.fnGetData();
- } else {
- this.url = this.hostView.url;
- this.aData = this.contentList && this.contentList.state && this.contentList.state.files;
- }
- },
- execute: function(data) {
- var displayName = data.defaultName;
- data.type = 'URL';
- var requestOptions = {
- 'headers': {
- 'Accept': 'application/json',
- 'Content-Type': 'application/json'
- },
- 'type': 'POST',
- 'url': this.url,
- 'data': JSON.stringify(data)
- };
- return this.glassContext.getCoreSvc('.Ajax').ajax(requestOptions)
- .then(function(response) {
- // if the domain was not acceptable Content Service will still create the item but with an empty 'alternate' link
- // so as a work-around we will check for it's presence and show an error and delete the asset if it's missing
- var location = response.jqXHR.getResponseHeader('location');
- var id = this._extractIDFromLocation(location);
- var mruInfo = {
- 'id': id,
- 'type': data.type,
- 'defaultName': data.defaultName
- };
- var options = {
- 'glassContext': this.glassContext,
- 'target': {
- 'activeObject': {
- 'aSelectedContext': [{
- 'id': id
- }]
- }
- }
- };
- return this.legacyHandler._getLegacyLaunchURL(options)
- .then(function(payLoad) {
- if (!payLoad.launchURL) {
- // delete the invalid asset
- var requestOptions = {
- 'type': 'DELETE',
- 'url': location
- };
- return this.glassContext.getCoreSvc('.Ajax').ajax(requestOptions)
- .then(function() {
- this._showError(StringResource.get('unacceptableDomain', {
- viewAcceptableDomains: StringResource.get('viewAcceptableDomains')
- }));
- }.bind(this))
- .catch(function(err) {
- return this._handleError(data, err);
- }.bind(this));
- } else {
- return this._onSuccess(displayName, mruInfo);
- }
- }.bind(this))
- .catch(function(err) {
- // this just means we're unable to verify the domain so just log the error and finish up
- this.logger.error('problem fetching info on newly-created URL', err);
- data.id = id;
- return this._onSuccess(displayName, mruInfo);
- }.bind(this));
- }.bind(this))
- .catch(function(err) {
- return this._handleError(data, err);
- }.bind(this));
- },
- _onSuccess: function(displayName, mruInfo) {
- if(this.listControl && !this.renderFromReact) {
- this.listControl.updateDatatable();
- } else {
- this.contentList.fetchListData(this.url);
- }
- GlassContextHelper.displayToast(this.glassContext, StringResource.get('toastCreateNewURL', {
- 'nameofURL': BidiUtil.enforceTextDirection(displayName)
- }));
- this.hostView.close();
- this.glassContext.getSvc('.Content')
- .then(function(contentSvc) {
- return contentSvc.addToMRU(mruInfo);
- });
- return Promise.resolve();
- },
- _handleError: function(data, err) {
- // check for client side error
- var messages = {
- 'itemsOverLimit': StringResource.get('itemsOverLimit', {
- itemName: data.defaultName
- }),
- 'nameLengthError': StringResource.get('errorMessageLengthURLName')
- };
- if(this.listControl && !this.renderFromReact){
- return ActionHelper.handleAddItemError(this.listControl, data, err, messages)
- .then(function() {
- // resolved a name conflict so try again
- return this.execute(data);
- }.bind(this))
- .fail(function (err) {
- this._showError('', err);
- return Promise.reject(err);
- }.bind(this));
- } else {
- return this.handleAddItemError(data, err)
- .then(function(data) {
- // resolved a name conflict so try again
- return this.execute(data);
- }.bind(this))
- .fail(function (err) {
- this._showError('', err);
- return Promise.reject(err);
- }.bind(this));
- }
- },
- _showError: function(message, err) {
- if(this.listControl && !this.renderFromReact) {
- this.listControl.updateDatatable();
- } else {
- this.contentList.fetchListData(this.url);
- }
- if (err) {
- GlassContextHelper.showAjaxServiceError(this.glassContext, err);
- } else {
- this.hostView.showErrorMessage(message, 'warn');
- }
- this.hostView.enableSubmitButton();
- },
- _getNewNameString: function(data) {
- var nameList = [];
- this.aData.forEach(function(rowData) { // Get a small list of names that has the substring data.defaultName
- var name = rowData.defaultName.toLowerCase();
- if (name.indexOf(data.defaultName.toLowerCase()) === 0) {
- nameList.push(name);
- }
- });
- var newNameString;
- for (var i = 1; i <= nameList.length; i++) {
- newNameString = data.defaultName + ' (' + i + ')';
- if (!nameList.includes(newNameString.toLowerCase())) {
- break;
- }
- }
- this.count = i;
- return newNameString;
- },
- handleAddItemError: function(data, err) {
- // check for client side error
- if (err.code === 400) {
- // if name duplication, try to increment (up to 20)
- if (ContentManagement.isNameConflict(err)) {
- var newNameString = this._getNewNameString(data);
- if (this.count < 20) {
- data.defaultName = newNameString;
- return Promise.resolve(data);
- } else {
- GlassContextHelper.displayToast(this.glassContext, StringResource.get('itemsOverLimit', {
- itemName: data.defaultName
- }),{ type: 'error' });
- return Promise.reject(err.message);
- }
- } else if (data.defaultName.length > 255) {
- // If the URL name is > than 255 characters
- GlassContextHelper.displayToast(this.glassContext, StringResource.get('errorMessageLengthURLName'),
- { type: 'error' });
- return Promise.reject(err.message);
- }
- } else {
- return Promise.reject(err);
- }
- },
- _extractIDFromLocation: function(location) {
- // want everything after the last slash (/bi/v1/objects/i752E8C17A5A149649BD6A26FF8978073)
- return location.slice(location.lastIndexOf('/') + 1);
- }
- });
- return AddFolderAction;
- });
- /*
- *+------------------------------------------------------------------------+
- *| Licensed Materials - Property of IBM
- *| IBM Cognos Products: Content Explorer
- *| (C) Copyright IBM Corp. 2018, 2020
- *|
- *| US Government Users Restricted Rights - Use, duplication or disclosure
- *| restricted by GSA ADP Schedule Contract with IBM Corp.
- *+------------------------------------------------------------------------+
- */
- define('bi/content_apps/ui/dialogs/DomainsDialog',[
- 'bacontentnav/lib/@waca/core-client/js/core-client/ui/core/Class',
- 'jquery',
- 'underscore'
- ], function(Class, $, _) {
- var Dialog = null;
- Dialog = Class.extend({
- _buttons: ['ok'],
- init: function(options) {
- this._options = options;
- this.id = 'com-ibm-ca-domainsDialogTitle';
- this.contentId = 'com-ibm-ca-domainsDialogContent';
- Dialog.inherited('init', this, [this._options]);
- },
- open: function() {
- this._options.glassContext.showMessage(this.renderContent(), this._options.title, 'info', this._buttons, '', undefined, true, 'domainsDialog');
- },
- renderContent: function() {
- var $list = $('<ul>', {
- 'class': 'itemListing'
- });
- _.forEach(this._options.list, function(listItem) {
- $list.append(
- $('<li>', {
- 'class': 'listItem',
- 'html': listItem
- })
- );
- });
- var $div = $('<div>');
- $div.append($list);
- return $div.html();
- }
- });
- return Dialog;
- });
- /*
- *+------------------------------------------------------------------------+
- *| Licensed Materials - Property of IBM
- *| IBM Cognos Products: Content Explorer
- *| (C) Copyright IBM Corp. 2018, 2020
- *|
- *| US Government Users Restricted Rights - Use, duplication or disclosure
- *| restricted by GSA ADP Schedule Contract with IBM Corp.
- *+------------------------------------------------------------------------+
- */
- define('bi/content_apps/ui/views/AddURLView',[
- 'underscore',
- 'bi/glass/app/ContentView',
- 'bi/content_apps/common/ui/list_actions/AddURLAction',
- 'bi/content_apps/nls/StringResource',
- 'bacontentnav/utils/ContentStoreObject',
- 'bacontentnav/utils/GlassContextHelper',
- 'bi/content_apps/ui/dialogs/DomainsDialog',
- 'bi/commons/utils/BidiUtil',
- 'bi/commons/ui/KeyCodes'
- // jshint -W072
- ], function(_, ContentView, AddURLAction, StringResource, ContentStoreObject, GlassContextHelper, DomainsDialog, BidiUtil, KeyCodes) {
- // jshint +W072
- 'use strict';
- var AddURLView = ContentView.extend({
- propertyUIControlModule: 'bi/commons/ui/properties/PropertyUIControl',
- init: function(options) {
- _.extend(this, options);
- AddURLView.inherited('init', this, arguments);
- this.CONFIGVALUE_VALIDDOMAINLIST = 'CAF.caf_validDomainList';
- this.url = this.url && this.url._meta && this.url._meta.links && this.url._meta.links.items && this.url._meta.links.items.url;
- this.contentList = this.view;
- this.renderFromReact = options.renderFromReact;
- this.addURLAction = new AddURLAction({
- 'hostView': this
- });
- },
- render: function() {
- return new Promise(function(resolve) {
- this._renderFormItems(resolve, this._buildFormItems());
- }.bind(this));
- },
- _renderFormItems: function(resolve, items) {
- require([this.propertyUIControlModule], function(PropertyUIControl) {
- this.$el.addClass(this._getAddURLViewClass());
- this._oPropertyUIControl = new PropertyUIControl({
- 'glassContext': this.glassContext,
- 'el': this.$el,
- 'items': items
- });
- this._oPropertyUIControl.render().then(function() {
- this.submitButton = this.$el.find('.primary');
- $('input', this.$el).each(function(i, node) {
- $(node).on('keydown', this._onKeydown.bind(this, $(node)));
- }.bind(this));
- resolve(this._oPropertyUIControl);
- }.bind(this));
- }.bind(this));
- },
- /**
- * Class to be placed on the AddURLView
- **/
- _getAddURLViewClass: function() {
- return 'AddURLView';
- },
- _buildFormItems: function() {
- var title = StringResource.get('newURLLabel');
- return [
- {
- 'value': title,
- 'type': 'Banner',
- 'svgIcon': '#common-url',
- 'svgToolTip': 'URL',
- 'ariaLabel': title
- },
- {
- 'name': 'instructions',
- 'label': StringResource.get('newURLDesc'),
- 'type': 'HintText'
- },
- {
- 'name': 'defaultName',
- 'label': StringResource.get('name'),
- 'placeHolderText': StringResource.get('urlNamePlaceholder'),
- 'newLook': true,
- 'value': '',
- 'type': 'InputLabel',
- 'multiline': true,
- 'readOnly': false
- },
- {
- 'type': 'Separator'
- },
- {
- 'name': 'defaultDescription',
- 'label': StringResource.get('description'),
- 'placeHolderText': StringResource.get('descriptionPlaceholder'),
- 'value': '',
- 'type': 'TextArea',
- 'editable': true,
- 'multiline': true,
- 'validator': {
- 'maxLength': 1024
- }
- },
- {
- 'type': 'Separator'
- },
- {
- 'name': 'uri',
- 'label': StringResource.get('URL'),
- 'placeHolderText': StringResource.get('urlPlaceholder'),
- 'newLook': true,
- 'value': '',
- 'type': 'InputLabel',
- 'multiline': true,
- 'readOnly': false
- },
- {
- type: 'SingleLineLinks',
- name: 'viewAcceptableDomains',
- items: [{
- align: 'right',
- items : [
- {
- 'type' : 'text',
- 'value' : StringResource.get('viewAcceptableDomains'),
- clickCallback: function() {
- this._showAcceptableDomains();
- }.bind(this)
- }
- ]
- }]
- },
- {
- 'type': 'Footer',
- 'items': [
- {
- 'type': 'Button',
- 'label': StringResource.get('ok'),
- 'onSelect': this._onSubmitClick.bind(this),
- 'primary': true
- },
- {
- 'type': 'Button',
- 'label': StringResource.get('cancel'),
- 'onSelect': this._onCancelClick.bind(this),
- 'primary': false
- }
- ]
- }
- ];
- },
- _onCancelClick: function() {
- this.slideout.hide();
- },
- _onSubmitClick: function() {
- var data = this._processSubmittedData();
- if (data.missing.length === 0) {
- this.disableSubmitButton();
- return this.addURLAction.execute(data.props)
- .then(function() {
- if(this.listControl && !this.renderFromReact) {
- this.listControl.updateDatatable();
- } else {
- this.contentList.fetchListData(this.url);
- }
- }.bind(this));
- } else {
- var message = StringResource.get('fieldsAreMandatory');
- this.showErrorMessage(message, 'warn');
- this.enableSubmitButton();
- }
- },
- _onKeydown: function(node, event) {
- if (event.keyCode === KeyCodes.ENTER) {
- // this is to circumvent a weird issue where glass wasn't considering a field modified when it had focus *sigh...*
- node.blur();
- this._onSubmitClick();
- event.stopPropagation();
- }
- },
- _processSubmittedData: function() {
- var data = {
- 'props': this._oPropertyUIControl.getModifiedProperties(),
- 'missing': []
- };
- this._checkInputValue('defaultName', data, StringResource.get('name'));
- this._checkInputValue('uri', data, StringResource.get('URL'));
- return data;
- },
- _checkInputValue: function(valueName, data, missingLabel) {
- // for some reason input fields containing only whitespace come back as: NaN, so checking these explicitly. *sigh...*
- if (typeof data.props[valueName] === 'undefined' || _.isNaN(data.props[valueName]) || data.props[valueName].trim() === '') {
- data.props[valueName] = '';
- // only add to missing list if label was provided
- if (missingLabel) {
- data.missing.push(missingLabel);
- }
- }
- },
- showErrorMessage: function(message, type) {
- this.glassContext.appController.showErrorMessage(message, StringResource.get(type));
- },
- _showAcceptableDomains: function() {
- if (this.domainsDialog) {
- this.domainsDialog.open();
- } else {
- return this.glassContext.getCoreSvc('.Config').getConfigValue(this.CONFIGVALUE_VALIDDOMAINLIST)
- .then(function(result) {
- // for some weird reason, if no domains were added to the whitelist, the respone is: 'myDefault'
- // so treating this as: 'no entries', I'll add it to the bugs I'm logging around this
- // so ultimately the list has one item which says: 'No entries' *sigh...*
- if (result === 'myDefault') {
- result = StringResource.get('noEntries');
- }
- var options = {
- 'glassContext': this.glassContext,
- 'type': 'acceptableDomains',
- 'title': StringResource.get('acceptableDomains'),
- 'list': result && result.split(','),
- 'width': '600px'
- };
- this.domainsDialog = new DomainsDialog(options);
- this.domainsDialog.open();
- }.bind(this))
- .catch(function(err) {
- GlassContextHelper.showAjaxServiceError(this.glassContext, err);
- }.bind(this));
- }
- },
- disableSubmitButton: function() {
- this.submitButton.prop('disabled', true);
- },
- enableSubmitButton: function() {
- this.submitButton.prop('disabled', false);
- },
- close: function() {
- this._onCancelClick();
- }
- });
- return AddURLView;
- });
- /*
- *+------------------------------------------------------------------------+
- *| Licensed Materials - Property of IBM
- *| IBM Cognos Products: Content Explorer
- *| (C) Copyright IBM Corp. 2017, 2020
- *|
- *| US Government Users Restricted Rights - Use, duplication or disclosure
- *| restricted by GSA ADP Schedule Contract with IBM Corp.
- *+------------------------------------------------------------------------+
- */
- define('bi/content_apps/CABaseContentView',[
- 'bacontentnav/utils/GlassContextHelper',
- 'bacontentnav/common/BaseContentWideView',
- 'bacontentnav/nls/StringResource',
- './PropertiesPageView',
- 'bi/content_apps/ui/views/AddURLView',
- 'bacontentnav/utils/ContentStoreObject',
- 'bacontentnav/utils/UIHelper',
- 'bi/commons/utils/BrowserUtils',
- 'underscore'
- ], function(GlassContextHelper, BaseContentWideView, StringResource, PropertiesPageView, AddURLView, ContentStoreObject, UIHelper, BrowserUtils, _) {
- 'use strict';
- var MY_FOLDERS = '.my_folders';
- var CABaseContentView = BaseContentWideView.extend({
- init: function(options) {
- void(options);
- CABaseContentView.inherited('init', this, arguments);
- this.contentListFacets = UIHelper.getFilterFacets(['content']);
- this.contentListFilterItems = UIHelper.getConfiguration('filter').items || [];
- this.contentListSortIndexes = UIHelper.getConfiguration('sort').indexes;
- this.allowUploadFiles = !BrowserUtils.isIPad();
- this.options = options;
- if (this.options.slideout && this.options.slideout.el) {
- this.contentPane = this.options.slideout.el.querySelector('.pane-content');
- }
- },
- showProperties: function(objectInformation, options) {
- if (this._propertiesOpen) {
- //update the object info in the exising PropertiesPageView
- if (options && options.target && options.target.activeObject && options.target.activeObject.onPropertiesClose) {
- this.propertiesSlideout.contentView.updateObjectInformationModel(objectInformation, options.target.activeObject.onPropertiesClose);
- } else {
- this.propertiesSlideout.contentView.updateObjectInformationModel(objectInformation);
- }
- } else {
- this.togglePropertiesMode();
- // rendering from react, use the provided glass context
- if (options && options.glassContext && options.target.activeObject.parentSlideout && options.target.activeObject.onPropertiesClose) {
- this.propertiesSlideout = options.glassContext.appController.showSlideOut({
- label: StringResource.get('properties', {
- objectName: objectInformation.defaultName
- }),
- position: options.target.activeObject.parentSlideout ? null : 'right',
- parent: options.target.activeObject.parentSlideout,
- width: '400',
- enableTabLooping: true,
- hideOnParentClick: false,
- onHide: function() {
- this._focus();
- this.togglePropertiesMode();
- if (this.propertiesSlideout && this.propertiesSlideout.contentView) {
- this.propertiesSlideout.contentView.onHide().then(function() {
- options.target.activeObject.onPropertiesClose();
- this.propertiesSlideout.hide();
- this._propertiesOpen = false;
- }.bind(this)).catch(function(){
- var uiControl = this.propertiesSlideout.contentView.getPropertyUIControl();
- if (uiControl) {
- var namePropety = uiControl.getProperty('defaultName');
- namePropety.getHTMLControl().val(objectInformation.defaultName);
- namePropety._onBlur();
- namePropety.remove();
- namePropety.render();
- }
- this._propertiesOpen = false;
- }.bind(this));
- }
- }.bind(this),
- content: {
- module: PropertiesPageView,
- parentView: this,
- objectInformation: objectInformation,
- glassContext: options.glassContext
- },
- resizable: true
- });
- } else {
- // not rendering from react, use this.glassContext
- this.propertiesSlideout = this.glassContext.appController.showSlideOut({
- label: StringResource.get('properties', {
- objectName: objectInformation.defaultName
- }),
- position: this.slideout ? null : 'right',
- parent: this.slideout,
- width: '400',
- enableTabLooping: true,
- hideOnParentClick: false,
- onHide: function() {
- this._focus();
- this.togglePropertiesMode();
- if (this.propertiesSlideout && this.propertiesSlideout.contentView) {
- this.propertiesSlideout.contentView.onHide().then(function() {
- this.propertiesSlideout.hide();
- this._propertiesOpen = false;
- }.bind(this)).catch(function(){
- var uiControl = this.propertiesSlideout.contentView.getPropertyUIControl();
- if (uiControl) {
- var namePropety = uiControl.getProperty('defaultName');
- namePropety.getHTMLControl().val(objectInformation.defaultName);
- namePropety._onBlur();
- namePropety.remove();
- namePropety.render();
- }
- this._propertiesOpen = false;
- }.bind(this));
- }
- }.bind(this),
- content: {
- module: PropertiesPageView,
- parentView: this,
- objectInformation: objectInformation,
- glassContext: this.glassContext
- },
- resizable: true
- });
- }
- }
- },
- getFilterSpec: function() {
- var filterSpec = [];
- _.forEach(this.contentListFilterItems, function(item) {
- // note: assumption that there's a message with key the same as the item
- filterSpec.push({
- name: item,
- label: item.displayLabel || StringResource.get(item),
- value: item
- });
- });
- return filterSpec;
- },
- getSortSpec: function() {
- return {
- sortBy: {
- name: 'name',
- modificationTime: 'modificationTime'
- },
- order: {
- sortedAscending: 'asc',
- sortedDescending: 'desc'
- }
- };
- },
- getSortMappingSpec: function() {
- return {
- name: ['groupByFolder', 'name'],
- modificationTime: ['groupByFolder', 'modificationTime'],
- type: ['groupByType', 'name']
- };
- },
- commonDataManipulationCallback: function(rawData, sortIndexes) {
- if (sortIndexes === null) {
- return;
- }
- rawData.data.forEach(function(data) {
- // Add a couple of calculated fields 'groupByFolder' and 'groupByType' based on the 'type' value
- var dataType = UIHelper.getDisplayType(data);
- if (UIHelper.isContainer(dataType)) {
- data.groupByFolder = sortIndexes.folders;
- if (UIHelper.isGroup(dataType, 'packages')) {
- data.groupByType = sortIndexes.packages;
- } else {
- data.groupByType = data.groupByFolder;
- }
- } else {
- // Anything else
- data.groupByFolder = sortIndexes.others;
- // For Type sort
- if (UIHelper.isGroup(dataType, 'report')) {
- data.groupByType = sortIndexes.reports;
- } else if (UIHelper.isGroup(dataType, 'dashboard')) {
- data.groupByType = sortIndexes.dashboards;
- } else if (UIHelper.isGroup(dataType, 'data')) {
- data.groupByType = sortIndexes.data;
- } else if (UIHelper.isGroup(dataType, 'exploration')) {
- data.groupByType = sortIndexes.explorations;
- } else if (UIHelper.isGroup(dataType, 'stories')) {
- data.groupByType = sortIndexes.stories;
- } else {
- // Anything else
- data.groupByType = sortIndexes.others;
- }
- }
- });
- },
- getGroupByColumnAPI: function() {
- return {
- columnIndex: this.GROUP_BY_TYPE_COLUMN_INDEX,
- getGroupName: function(group) {
- var msgKey = _.find(Object.keys(this.contentListSortIndexes), function(sortIndex) {
- return this.contentListSortIndexes[sortIndex] === group;
- }.bind(this));
- return msgKey && StringResource.get(msgKey) || group;
- }.bind(this),
- shouldGroup: function(api) {
- var sortInfo = api.order();
- return sortInfo && sortInfo[0] && sortInfo[0][0] === this.GROUP_BY_TYPE_COLUMN_INDEX;
- }.bind(this)
- };
- },
- getNewItemSpec: function() {
- var types = [];
- return new Promise(function(resolve){
- var userProfileSettings = this.glassContext.services.userProfile && this.glassContext.services.userProfile.userProfileSettings;
- var allowCreateURL = !(userProfileSettings &&
- userProfileSettings.ui_excludedFeatures &&
- userProfileSettings.ui_excludedFeatures.ids &&
- userProfileSettings.ui_excludedFeatures.ids.indexOf('com.ibm.bi.contentApps.URL') >= 0);
- var allowNewFolder = !(userProfileSettings &&
- userProfileSettings.ui_excludedFeatures &&
- userProfileSettings.ui_excludedFeatures.ids &&
- userProfileSettings.ui_excludedFeatures.ids.indexOf('com.ibm.bi.contentApps.Folder') >= 0);
- var inTeamContent = this.ancestors && this.ancestors[0].id === '.public_folders';
- if (allowNewFolder || !inTeamContent) {
- types.push({
- type: 'folder'
- });
- }
- if (allowCreateURL) {
- types.push({
- type: 'URL'
- });
- }
- if (this.canUploadFiles() && this.allowUploadFiles){
- types.push({ type: 'fileUpload' });
- }
- resolve(types);
- }.bind(this));
- },
- showNewURL: function() {
- if (!this._newURLOpen) {
- this.toggleNewURLMode();
- }
- this.newURLSlideout = this.glassContext.appController.showSlideOut({
- label: StringResource.get('newURLLabel'),
- position: this.slideout ? null : 'right',
- parent: this.slideout,
- width: '400',
- enableTabLooping: true,
- onHide: function() {
- if (this._newURLOpen) {
- this.toggleNewURLMode();
- }
- if (this.newURLSlideout && this.newURLSlideout.contentView && this.newURLSlideout.contentView.onHide) {
- this.newURLSlideout.contentView.onHide().then(function() {
- this.newURLSlideout.hide();
- }.bind(this));
- } else {
- this.newURLSlideout.hide();
- }
- }.bind(this),
- content: {
- module: AddURLView,
- view: this,
- glassContext: this.glassContext,
- listControl: this._listControl
- }
- });
- },
- getFileUploader: function() {
- if (!this.fUploaderPromise ) {
- this.fUploaderPromise = this.glassContext.getSvc('.FileUpload')
- .then(function(fileUploader) {
- if (fileUploader.el === undefined) {
- fileUploader.el = this.glassContext.cachedPerspectives[0].currentContentView.el;
- fileUploader.container = document.createElement('div');
- }
- return fileUploader;
- }.bind(this))
- .catch(function(err) {
- // display the error and continue
- this.glassContext.appController.showErrorMessage(err);
- return null;
- }.bind(this));
- }
- return this.fUploaderPromise;
- },
- getSearchPath: function() {
- var options = {
- url: this.selfUrl,
- dataType: 'json',
- type: 'GET',
- data: {
- fields: 'searchPath'
- }
- };
- return this.glassContext.getCoreSvc('.Ajax').ajax(options)
- .then(function(response) {
- this.parentObj = response.data.data[0];
- if ((this.selfUrl.indexOf(MY_FOLDERS) > -1)) {
- this.parentObj.searchPath = undefined;
- }
- }.bind(this))
- .catch(function(err) {
- GlassContextHelper.showAjaxServiceError(this.glassContext, err);
- throw err;
- }.bind(this));
- },
- uploadFile: function() {
- if (this.canUploadFiles() && this.allowUploadFiles){
- return this.getFileUploader().then(function(fileUploader) {
- var fileDestination;
- if ( this.parentObj && !this.parentObj.searchPath && this.selfUrl.indexOf(MY_FOLDERS) > -1 ) {
- fileDestination = MY_FOLDERS;
- fileUploader.showFilePicker(null, null, null, { destination: fileDestination });
- } else if (!this.parentObj || !this.parentObj.searchPath) {
- return this.getSearchPath().then(function() {
- fileDestination = this.parentObj.searchPath || MY_FOLDERS;
- fileUploader.showFilePicker(null, null, null, { destination: fileDestination });
- }.bind(this));
- } else {
- fileDestination = this.parentObj.searchPath || MY_FOLDERS;
- fileUploader.showFilePicker(null, null, null, { destination: fileDestination });
- }
- }.bind(this));
- } else {
- return Promise.resolve();
- }
- },
- canUploadFiles: function() {
- return this.glassContext.hasCapability('canUploadFiles');
- },
- createNewItem: function(type) {
- if (type === 'folder') {
- this._addFolder();
- } else if (type === 'URL') {
- this.showNewURL();
- } else if (type === 'fileUpload') {
- this.uploadFile();
- } else {
- this.logger.warn('Attempting to create unsupported item: ' + type);
- }
- },
- _focus: function() {
- this.$el.focus();
- }
- });
- return CABaseContentView;
- });
- /*
- *+------------------------------------------------------------------------+
- *| Licensed Materials - Property of IBM
- *| IBM Cognos Products: Content Explorer
- *| (C) Copyright IBM Corp. 2015, 2018
- *|
- *| US Government Users Restricted Rights - Use, duplication or disclosure
- *| restricted by GSA ADP Schedule Contract with IBM Corp.
- *+------------------------------------------------------------------------+
- */
- define('bi/content_apps/LegacyCATeamFoldersView',[
- './CABaseContentView',
- 'bacontentnav/utils/ContentStoreObject',
- 'bacontentnav/utils/ContentServiceUrls',
- 'bacontentnav/nls/StringResource'
- ], function(CABaseContentView, ContentStoreObject, ContentServiceUrls, StringResource) {
- 'use strict';
- var CATeamFoldersView = CABaseContentView.extend({
- stateId: 'TeamFoldersView',
- GROUP_BY_TYPE_COLUMN_INDEX: 4,
- init: function() {
- this.showParentPropertiesButton = true;
- /*eslint no-unused-vars: 0*/
- CATeamFoldersView.inherited('init', this, arguments);
- this.addURLParameters({
- 'fields': 'tenantID'
- });
- this.filterMenuNamePrefix = 'TEAMCONTENT_';
- this.emptyIcon = '#ba_content_nav-shared_64';
- this.dataManipulationCallback = this.commonDataManipulationCallback;
- },
- _getDefaultRequestURL: function() {
- return ContentServiceUrls.getPublicFoldersURL() + '/items';
- },
- _getDefaultSelfURL: function() {
- return ContentServiceUrls.getPublicFoldersURL();
- },
- _getColumnSpecification: function() {
- var columnSpecs = [{
- 'type': 'Icon',
- 'accessibleLabel': StringResource.get('itemType')
- }];
- var nameProps = {
- 'type': 'MultipleProperties',
- 'orientation': 'horizontal',
- 'items': [{
- 'type': 'Time',
- 'displayInline': true,
- 'propertyName': ContentStoreObject.MODIFICATION_TIME
- }]
- };
- if (this._showTenantInfo()) {
- nameProps.items.push({
- 'type': 'Tenant',
- 'propertyName': ContentStoreObject.TENANT_NAME,
- 'showAsActiveLink': false
- });
- }
- columnSpecs.push({
- 'type': 'MultipleProperties',
- 'orientation': 'vertical',
- 'items': [{
- 'type': 'Name'
- },
- nameProps
- ]
- });
- // There is a invisible column for ModifiedTime along with Name.
- // This second 'hidden' column is required to allow DataTable to sort on ModifiedTime.
- columnSpecs.push({
- 'type': 'Time',
- 'propertyName': ContentStoreObject.MODIFICATION_TIME,
- 'visible': false
- });
- // Here is another invisible column groupByFolder for the calculated grouping value
- columnSpecs.push({
- 'type': 'Text',
- 'propertyName': 'groupByFolder',
- 'visible': false
- });
- // Here is another invisible column groupByType for the calculated grouping value
- columnSpecs.push({
- 'type': 'Text',
- 'propertyName': 'groupByType',
- 'visible': false
- });
- if (this._showTenantInfo()) {
- // There is an invisible column for Tenant along with Name.
- // This second 'hidden' column is required to allow DataTable to sort on Tenant.
- columnSpecs.push({
- 'type': 'Tenant',
- 'propertyName': ContentStoreObject.TENANT_NAME,
- 'visible': false
- });
- }
- columnSpecs.push({
- 'type': 'ContextMenu'
- });
- return columnSpecs;
- },
- getSortSpec: function() {
- var sortSpec = CATeamFoldersView.inherited('getSortSpec', this, arguments);
- if (this._showTenantInfo()) {
- sortSpec.sortBy.tenant = 'tenantName';
- }
- // for Type sort
- sortSpec.sortBy.type = 'type';
- return sortSpec;
- },
- _showTenantInfo: function() {
- var ups = this.glassContext.getCoreSvc('.UserProfile');
- return ups.tenants && ups.tenants.length > 0;
- },
- getDefaultSort: function() {
- return [
- [3, 'asc'],
- [1, 'asc']
- ];
- }
- });
- return CATeamFoldersView;
- });
- /*
- *+------------------------------------------------------------------------+
- *| Licensed Materials - Property of IBM
- *| IBM Cognos Products: Content Explorer
- *| (C) Copyright IBM Corp. 2015, 2018
- *|
- *| US Government Users Restricted Rights - Use, duplication or disclosure
- *| restricted by GSA ADP Schedule Contract with IBM Corp.
- *+------------------------------------------------------------------------+
- */
- define('bi/content_apps/LegacyCAMyContentView',[
- './CABaseContentView',
- 'bacontentnav/utils/ContentStoreObject',
- 'bacontentnav/utils/ContentServiceUrls',
- 'bacontentnav/nls/StringResource'
- ], function(CABaseContentView, ContentStoreObject, ContentServiceUrls, StringResource) {
- 'use strict';
- var LegacyCAMyContentView = CABaseContentView.extend({
- stateId: 'CAMyContentView',
- GROUP_BY_TYPE_COLUMN_INDEX: 4,
- init: function() {
- LegacyCAMyContentView.inherited('init', this, arguments);
- this.filterMenuNamePrefix = 'MYCONTENT_';
- this.emptyIcon = '#ba_content_nav-personal_64';
- this.dataManipulationCallback = this.commonDataManipulationCallback;
- },
- _getDefaultRequestURL: function() {
- return ContentServiceUrls.getMyFoldersURL() + '/items';
- },
- _getDefaultSelfURL: function() {
- return ContentServiceUrls.getMyFoldersURL();
- },
- getRootAncestor: function() {
- return ContentStoreObject.getRootMyFoldersAncestors();
- },
- _getColumnSpecification: function() {
- var columnSpecs = [{
- 'type': 'Icon',
- 'accessibleLabel': StringResource.get('itemType')
- }];
- columnSpecs.push({
- 'type': 'MultipleProperties',
- 'orientation': 'vertical',
- 'items': [{
- 'type': 'Name'
- //'scope': 'row'
- }, {
- 'type': 'Time',
- 'displayInline': true,
- 'propertyName': ContentStoreObject.MODIFICATION_TIME
- }]
- });
- columnSpecs.push({
- 'type': 'Time',
- 'propertyName': ContentStoreObject.MODIFICATION_TIME,
- 'visible': false
- });
- // Here is another invisible column groupByFolder for the calculated grouping value
- columnSpecs.push({
- 'type': 'Text',
- 'propertyName': 'groupByFolder',
- 'visible': false
- });
- // Here is another invisible column groupByType for the calculated grouping value
- columnSpecs.push({
- 'type': 'Text',
- 'propertyName': 'groupByType',
- 'visible': false
- });
- columnSpecs.push({
- 'type': 'ContextMenu'
- });
- return columnSpecs;
- },
- getSortSpec: function() {
- var sortSpec = LegacyCAMyContentView.inherited('getSortSpec', this, arguments);
- // For Type sort
- sortSpec.sortBy.type = 'type';
- return sortSpec;
- },
- getDefaultSort: function() {
- return [
- [3, 'asc'],
- [1, 'asc']
- ];
- }
- });
- return LegacyCAMyContentView;
- });
- /**
- * Licensed Materials - Property of IBM
- * IBM Cognos Products: BI Cloud (C) Copyright IBM Corp. 2014
- * US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
- */
- define('bacontentnav/lib/gemini/app/ui/toolbar_components/Label',[ 'jquery', '../../util/View', 'underscore' ], function($, View, _) {
- var Label = null;
- /**
- * Represents a drop down menu that can be added to an app bar
- */
- Label = View.extend({
- baseClass: 'toolbar',
- /**
- * Creates a Label item
- *
- * @param spec -
- * The menu item spec
- * @param root -
- * A reference to the root menu item, where items go if the app bar is collapsed horizontally
- */
- init: function(spec) {
- _.extend(this, spec);
- this._initLabel();
- Label.inherited('init', this, arguments);
- },
- /**
- * Draws the Label
- */
- render: function() {
- this.$el
- .empty()
- .addClass(this.baseClass + 'InactiveItem')
- .attr('id', this.viewId);
- this._updateLabel();
- if (this.style) {
- this.$el.addClass(this.style);
- }
- if (this.isStatusLabel) {
- this.$el.attr('role', 'status');
- }
- if (this.editable) {
- this.$el.attr('tabindex','0').inlineEditor(this.changedAction, {
- style: {width: 'auto'},
- noEmptyText: true
- });
- }
- return this;
- },
- _initLabel: function() {
- //If label is a string, simply render this string statically,
- //otherwise, use _getLabel and _updateLabel to keep the UI and
- //model in synch.
- if($.type(this.label) === 'object') {
- this._getLabel = this.label.get;
- this.label.onChange(this._updateLabel, this);
- }
- },
- _getLabel: function() {
- return this.label;
- },
- _updateLabel: function() {
- this.text(this._getLabel());
- },
- /**
- * Changes the text of the label
- */
- text: function(value) {
- this.$el.text(value);
- }
- });
- return Label;
- });
- /*
- *+------------------------------------------------------------------------+
- *| Licensed Materials - Property of IBM
- *| IBM Cognos Products: Content Explorer
- *| (C) Copyright IBM Corp. 2015, 2016
- *|
- *| US Government Users Restricted Rights - Use, duplication or disclosure
- *| restricted by GSA ADP Schedule Contract with IBM Corp.
- *+------------------------------------------------------------------------+
- */
- define('bacontentnav/common/ui/EllipsisLabel',[
- '../../lib/gemini/app/ui/toolbar_components/Label',
- '../../lib/@waca/core-client/js/core-client/utils/ContentFormatter',
- 'underscore'
- ],
- function(Label, ContentFormatter, _) {
- 'use strict';
- var EllipsisLabel = Label.extend({
- text: function(value) {
- this.$el.text(_.unescape(value));
- if (this.style) {
- this.$el.addClass(this.style);
- }
- ContentFormatter.middleShortenString(this.$el[0]);
- }
- });
- return EllipsisLabel;
- });
- /*
- *+------------------------------------------------------------------------+
- *| Licensed Materials - Property of IBM
- *| IBM Cognos Products: Content Explorer
- *| (C) Copyright IBM Corp. 2017, 2018
- *|
- *| US Government Users Restricted Rights - Use, duplication or disclosure
- *| restricted by GSA ADP Schedule Contract with IBM Corp.
- *+------------------------------------------------------------------------+
- */
- define('bacontentnav/MRUView',[
- './common/BaseContentWideView',
- './common/ui/EllipsisLabel',
- './utils/ContentServiceUrls',
- './nls/StringResource'
- ], function(
- BaseContentWideView, EllipsisLabel, ContentServiceUrls, StringResource) {
- 'use strict';
- var MRUView = BaseContentWideView.extend({
- stateId: 'MRUView',
- requiresAssetVerification: true,
- init: function(options) {
- void(options);
- MRUView.inherited('init', this, arguments);
- this.filterMenuNamePrefix = 'MRU_';
- this.emptyIcon = '#ba_content_nav-time_64';
- },
- _getDefaultRequestURL: function() {
- return ContentServiceUrls.getMRUURL();
- },
- _getModuleName: function() {
- return 'bi/content_apps/MRUView';
- },
- contentbarItems: function() {
- return [{
- 'name': 'nameLabel',
- 'position': 'leading',
- 'style': 'nameLabel',
- 'module': EllipsisLabel,
- 'label': StringResource.get('recentlyViewed')
- }];
- },
- renderContent: function() {
- return this.glassContext.getSvc('.Content')
- .then(function(contentSvc){
- this._contentSvc = contentSvc;
- return MRUView.inherited('renderContent', this, arguments);
- }.bind(this));
- },
- getListControlOptions: function() {
- return {
- 'ajaxProp': '',
- 'emptyFolderString': StringResource.get('emptyRecentList'),
- 'showEmptyNewFolderButton': false,
- 'rowLimit': this._contentSvc.getMRUMaxSize(),
- 'getJSONDataCallback': this._contentSvc.getMRUList.bind(this._contentSvc)
- };
- },
- getDefaultSort: function() {
- return [];
- },
- _getColumnSpecification: function() {
- return [{
- 'type': 'Icon'
- }, {
- 'type': 'MultipleProperties',
- 'items': [{
- 'type': 'Name'
- }, {
- 'type': 'Text',
- 'propertyName': 'formatedPath',
- 'clickCallback': this.openSlideoutView.bind(this),
- 'showAsActiveLink': false
- }]
- }, {
- 'type': 'ContextMenu'
- }];
- }
- });
- return MRUView;
- });
- /*
- *+------------------------------------------------------------------------+
- *| Licensed Materials - Property of IBM
- *| IBM Cognos Products: Content Explorer
- *| (C) Copyright IBM Corp. 2017, 2018
- *|
- *| US Government Users Restricted Rights - Use, duplication or disclosure
- *| restricted by GSA ADP Schedule Contract with IBM Corp.
- *+------------------------------------------------------------------------+
- */
- define('bi/content_apps/CAMRUView',[
- 'bacontentnav/MRUView',
- 'bacontentnav/nls/StringResource',
- 'bacontentnav/utils/ContentStoreObject',
- './PropertiesPageView'
- ], function(
- MRUView, StringResource, ContentStoreObject, PropertiesPageView) {
- 'use strict';
- var CAMRUView = MRUView.extend({
- stateId: 'CAMRUView',
- init: function() {
- CAMRUView.inherited('init', this, arguments);
- },
- showProperties: function(objectInformation) {
- if (!this._propertiesOpen) {
- this.togglePropertiesMode();
- }
- this.propertiesSlideout = this.glassContext.appController.showSlideOut({
- 'label': StringResource.get('properties', {
- 'objectName': objectInformation.defaultName
- }),
- 'position': this.slideout ? null : 'right',
- 'parent': this.slideout,
- 'width': '400',
- 'enableTabLooping': true,
- 'onHide': function() {
- if (this._propertiesOpen) {
- this.togglePropertiesMode();
- }
- if (this.propertiesSlideout && this.propertiesSlideout.contentView) {
- this.propertiesSlideout.contentView.onHide().then(function() {
- //remove propertiesPageView
- this.propertiesSlideout.hide();
- }.bind(this));
- }
- }.bind(this),
- 'content': {
- 'module': PropertiesPageView,
- 'parentView': this,
- 'objectInformation': objectInformation,
- 'glassContext': this.glassContext
- },
- 'resizable': true
- });
- }
- });
- return CAMRUView;
- });
- /*
- *+------------------------------------------------------------------------+
- *| Licensed Materials - Property of IBM
- *| IBM Cognos Products: Content Explorer
- *| (C) Copyright IBM Corp. 2015, 2018
- *|
- *| US Government Users Restricted Rights - Use, duplication or disclosure
- *| restricted by GSA ADP Schedule Contract with IBM Corp.
- *+------------------------------------------------------------------------+
- */
- define('bacontentnav/search/SearchBar',[
- 'jquery',
- 'underscore',
- '../lib/@waca/core-client/js/core-client/ui/View',
- '../lib/@waca/core-client/js/core-client/utils/Utils',
- '../lib/@waca/core-client/js/core-client/utils/BidiUtil',
- '../nls/StringResource',
- 'jquery-ui'
- ], function($, _, View, Utils, BidiUtil, StringResources) {
- var SearchBar = null;
- /**
- * Represents a search bar that can be added to an app bar
- */
- SearchBar = View.extend({
- events: {
- 'clicktap': 'action'
- },
- baseClass: 'toolbar',
- getSuggestUrl: 'v1/suggest/cm',
- /**
- * Creates a search bar
- */
- init: function(spec) {
- _.extend(this, spec);
- SearchBar.inherited('init', this, arguments);
- this.searchBarCutDetected = false;
- // search input
- this.$input = $('<input class="searchinput">')
- .attr({
- 'type': 'search',
- 'value': this.value,
- 'placeholder': this.label,
- 'title': this.label,
- 'maxlength': 256,
- 'role': 'combobox',
- 'aria-autocomplete': 'list'
- })
- .on('search', this.search.bind(this))
- .on('change', this.updateButtonItems.bind(this))
- .bind('cut', function() {
- setTimeout(function() {
- this.reinitializeSearchBar();
- }.bind(this));
- }.bind(this))
- .keyup(function(e) {
- if (e.which === 13) {
- this.search(e);
- } else if (e.which !== 9 && e.which !== 16) {
- // if not tab/shift
- this.updateButtonItems();
- }
- setTimeout(function() {
- if (!this.$input.val() && (!this.searchBarCutDetected)) {
- this.clear();
- }
- }.bind(this));
- }.bind(this))
- .autocomplete({
- source: function(request, srcresponse) {
- var _term = request.term ? request.term.trim() : '';
- if (_term.length > 0) {
- var params = {
- filter: 'type|' + this.view.defaultTypes.join('|'),
- term: request.term,
- hide_internal: 'all'
- };
- this.glassContext.getCoreSvc('.Ajax').ajax({
- url: this.getSuggestUrl + '?' + $.param(params, true)
- })
- .then(function(response) {
- srcresponse(response.data.results);
- });
- }
- }.bind(this),
- open: function() {
- // Note: This is temporary code to bring the suggestions list box to the front
- // This should be changed at the css level.
- this.$input.autocomplete('widget').addClass('search-autocomplete');
- this.$input.autocomplete('widget').find('li')
- .on('clicktap', function(event) {
- event.stopPropagation();
- this.setSearchString($(event.target).text());
- this.search(event);
- }.bind(this))
- .each(function() {
- this.dir = BidiUtil.resolveBaseTextDir(this.innerHTML);
- });
- return false;
- }.bind(this)
- });
- BidiUtil.initElementForBidi(this.$input[0]);
- // search button
- this.$searchButton = $('<button class="s4h" disabled/>')
- .attr({
- 'type': 'button',
- 'title': StringResources.get('search')
- });
- Utils.setIcon(this.$searchButton, 'common-search');
- // clear search button
- this.$clearSearchButton = $('<button class="s4hReset" />')
- .attr({
- 'type': 'reset',
- 'title': StringResources.get('clear')
- })
- .on('clicktap', this.clear.bind(this));
- Utils.setIcon(this.$clearSearchButton, 'common-close-cancel-error');
- },
- /**
- * Draws the Search bar
- */
- render: function() {
- this.$el
- .empty()
- .addClass('searchbar appbarIcon appbarItem filled s4hBar')
- .append(this.$searchButton, [this.$input, this.$clearSearchButton]);
- if (!this.value) {
- this.$el.removeClass('filled');
- }
- return Promise.resolve(this);
- },
- show: function(noFocus) {
- if (this.isHidden()) {
- this.$input.fadeIn('fast');
- this.$searchButton.fadeIn('fast');
- this.$clearSearchButton.fadeIn('fast');
- this.$el.slideDown('fast');
- if (!noFocus) {
- this.setFocus();
- this.$input.select();
- }
- }
- },
- search: function(e) {
- this.searchBarCutDetected = false;
- var searchString = this.getSearchString();
- if (searchString) {
- this.$input.blur();
- this.view.searchTerm = searchString;
- this.view.execSearch(true);
- if (e) {
- e.preventDefault();
- }
- }
- },
- resetState: function() {
- this.view.resetState();
- },
- clear: function() {
- this.view.clearView();
- this.showHideClearSearchButton();
- this.setFocus();
- },
- setSearchString: function(searchString) {
- var str = _.isString(searchString) ? searchString : '';
- if (this.getSearchString() !== str) {
- this.$input.val(str);
- }
- this.showHideClearSearchButton();
- },
- getSearchString: function() {
- return this.$input.val().trim();
- },
- hide: function(preserveInput) {
- if (!this.$el.is(':hidden')) {
- this.$el.slideUp('fast');
- this.$input
- .fadeOut('fast')
- .blur();
- if (!preserveInput) {
- this.$input.val('');
- }
- this.$searchButton.fadeOut('fast');
- this.$clearSearchButton.fadeOut('fast');
- }
- },
- isHidden: function() {
- return this.$el.is(':hidden');
- },
- showHideClearSearchButton: function() {
- if (this.$input.val()) {
- this.$el.addClass('filled');
- } else {
- this.$el.removeClass('filled');
- }
- },
- setFocus: function() {
- this.$input.focus();
- },
- /**
- * Updates the button state for filters/etc.
- */
- updateButtonItems: function() {
- this.view.showHideContentBarItems();
- this.showHideClearSearchButton();
- },
- reinitializeSearchBar: function() {
- if (!this.$input.val()) {
- this.clear();
- this.searchBarCutDetected = true;
- }
- }
- });
- return SearchBar;
- });
- /*
- *+------------------------------------------------------------------------+
- *| Licensed Materials - Property of IBM
- *| IBM Cognos Products: Content Explorer
- *| (C) Copyright IBM Corp. 2015, 2018
- *|
- *| US Government Users Restricted Rights - Use, duplication or disclosure
- *| restricted by GSA ADP Schedule Contract with IBM Corp.
- *+------------------------------------------------------------------------+
- */
- define('bacontentnav/search/SearchFolderView',[
- '../common/BaseContentWideView',
- '../utils/ContentStoreObject',
- '../utils/UIHelper',
- '../nls/StringResource',
- 'underscore'
- ], function(BaseContentWideView, ContentStoreObject, UIHelper, StringResource, _) {
- 'use strict';
- var SearchFolderView = BaseContentWideView.extend({
- stateId: 'SearchFolderView',
- emptyIcon: '#ba_content_nav-personal_64',
- init: function() {
- SearchFolderView.inherited('init', this, arguments);
- this.contentListFacets = UIHelper.getFilterFacets(['content']);
- },
- getModuleName: function() {
- return 'bacontentnav/search/SearchFolderView';
- },
- renderContent: function() {
- var ancestorType = this.ancestors && this.ancestors.length > 0 && this.ancestors[0].type;
- if (ancestorType === 'directory') {
- this.stateId = 'MyContentView';
- this.emptyIcon = '#ba_content_nav-personal_64';
- } else if (ancestorType === 'content') {
- this.stateId = 'TeamFoldersView';
- this.emptyIcon = '#ba_content_nav-shared_64';
- } else {
- this.stateId = 'SearchFolderView';
- }
- return this.renderContentList({
- 'columns': this._getColumnSpecification(),
- 'url': this.url,
- 'selectedRow': this.selectedRow,
- 'emptyIcon': this.emptyIcon
- });
- },
- _getColumnSpecification: function() {
- var columnSpecs = [{
- 'type': 'Icon',
- 'accessibleLabel': StringResource.get('itemType')
- }];
- columnSpecs.push({
- 'type': 'MultipleProperties',
- 'orientation': 'vertical',
- 'items': [{
- 'type': 'Name'
- }, {
- 'type': 'Time',
- 'displayInline': true,
- 'propertyName': ContentStoreObject.MODIFICATION_TIME
- }]
- });
- // This invisible spec is required for sorting/filtering purposes,
- // as these functions cannot get the data from "MultipleProperties"
- columnSpecs.push({
- 'type': 'Time',
- 'propertyName': ContentStoreObject.MODIFICATION_TIME,
- 'visible': false
- });
- columnSpecs.push({
- 'type': 'ContextMenu'
- });
- return columnSpecs;
- },
- getFilterSpec: function() {
- var filterSpec = [];
- _.forEach(UIHelper.getConfiguration('filter').items, function(item) {
- // note: assumption that there's a message with key the same as the item
- filterSpec.push({
- name: item,
- label: item.displayLabel || StringResource.get(item),
- value: item
- });
- });
- return filterSpec;
- },
- showProperties: function(objectInformation) {
- if (!this.propertiesView) {
- return;
- }
- if (!this._propertiesOpen) {
- this.togglePropertiesMode();
- }
- this.propertiesSlideout = this.glassContext.appController.showSlideOut({
- 'label': StringResource.get('properties', {
- 'objectName': objectInformation.defaultName
- }),
- 'position': this.slideout ? null : 'right',
- 'parent': this.slideout,
- 'width': '400',
- 'enableTabLooping': true,
- 'onHide': function() {
- if (this._propertiesOpen) {
- this.togglePropertiesMode();
- }
- if (this.propertiesSlideout && this.propertiesSlideout.contentView) {
- this.propertiesSlideout.contentView.onHide().then(function() {
- //remove propertiesPageView
- this.propertiesSlideout.hide();
- }.bind(this));
- }
- }.bind(this),
- 'content': {
- 'module': this.propertiesView,
- 'parentView': this,
- 'objectInformation': objectInformation,
- 'glassContext': this.glassContext
- },
- 'resizable': true
- });
- }
- });
- return SearchFolderView;
- });
- /*
- *+------------------------------------------------------------------------+
- *| Licensed Materials - Property of IBM
- *| IBM Cognos Products: ba-content-nav
- *| (C) Copyright IBM Corp. 2017, 2018
- *|
- *| US Government Users Restricted Rights - Use, duplication or disclosure
- *| restricted by GSA ADP Schedule Contract with IBM Corp.
- *+------------------------------------------------------------------------+
- */
- define('bacontentnav/common/SearchFilterViewController',['underscore', 'moment', './FilterViewController'], function(_, Moment, FilterViewController) {
- 'use strict';
- /*
- * This class is a sub class of FilterViewController for the search view.
- */
- var SearchFilterViewController = FilterViewController.extend({
- /**
- * Constructor
- * @param options.view {string} - container's view
- * @override
- */
- init: function(options) {
- void(options);
- SearchFilterViewController.inherited('init', this, arguments);
- },
- /**
- * Sets the date for modificationTime queries
- * @override
- **/
- setDefaultFilters: function() {
- SearchFilterViewController.inherited('setDefaultFilters', this, arguments);
- this.filterObject.modificationTime.today += '|true|false';
- this.filterObject.modificationTime.yesterday += '|true|false';
- this.filterObject.modificationTime.pastWeek += '|true|false';
- this.filterObject.modificationTime.pastMonth += '|true|false';
- }
- });
- return SearchFilterViewController;
- });
- /*
- *+------------------------------------------------------------------------+
- *| Licensed Materials - Property of IBM
- *| IBM Cognos Products: Content Explorer
- *| (C) Copyright IBM Corp. 2015, 2021
- *|
- *| US Government Users Restricted Rights - Use, duplication or disclosure
- *| restricted by GSA ADP Schedule Contract with IBM Corp.
- *+------------------------------------------------------------------------+
- */
- define('bacontentnav/search/BaseSearchView',[
- 'jquery',
- 'moment-timezone',
- './SearchBar',
- './SearchFolderView',
- '../nls/StringResource',
- '../common/ContentListPageView',
- '../utils/ContentStoreObject',
- '../utils/UIHelper',
- '../common/SearchFilterViewController',
- 'underscore'
- ], function($, Moment, SearchBar, SearchFolderView, StringResources, ContentListPageView, ContentStoreObject, UIHelper, SearchFilterViewController, _) {
- 'use strict';
- var EMPTY_SEARCH_ICON = '#ba_content_nav-search_64';
- var Search = ContentListPageView.extend({
- init: function(options) {
- Search.inherited('init', this, arguments);
- var searchConfig = UIHelper.getConfiguration('search');
- this.searchURL = searchConfig.URL;
- this.savedSearchURL = searchConfig.savedURL;
- this.searchReturnParams = searchConfig.returnParams || '';
- this.disabledActions = searchConfig.disabledActions || [];
- this.defaultTypes = UIHelper.getTypes(['content']) || [];
- //content service might not be set properly in ContentStoreObject
- if (this.glassContext) {
- ContentStoreObject.setGlassContext(this.glassContext);
- }
- //our filterview controller
- this.filterViewController = options.filterViewController || new SearchFilterViewController({
- filterSpecs: this._getColumnSpecification.bind(this),
- view: this,
- filterObject: UIHelper.getFilterFacets(['content']),
- setResultLimit: true
- });
- /*
- * Object containing groups being filtered against as keys
- * and the filter strings to be applied as the values.
- * It is modified when the user changes their facet selections, or instigates a new search,
- * and is used to figure out which facets are being applied when rendering the facets view.
- */
- this.filterViewController.resetSelected();
- /*
- * Storage location of resultSetSize from the server.
- */
- this.resultsetSize = 0;
- this.searchTerm = '';
- this.savedSearchDeleteClicked = false;
- this.savedSearchclicked = false;
- // set up search bar
- this.searchBar = new SearchBar({
- 'name': 'searchInput',
- 'module': SearchBar,
- 'position': 'leading',
- 'glassContext': this.glassContext,
- 'view': this,
- 'label': StringResources.get('searchAllYourData'),
- 'value': ''
- });
- this.searchBarRendered = false;
- this.on('filterState:change', this.onFilterStateChange.bind(this));
- this.on('filterState:changeDate', this.onFilterStateChange.bind(this));
- this.on('filterState:changeResutLimit', this.onFilterStateChange.bind(this));
- },
- remove: function() {
- Search.inherited('remove', this, arguments);
- this.off('filterState:change');
- this.off('filterState:changeDate');
- this.off('filterState:changeResutLimit');
- },
- //callback from the filter
- onFilterStateChange: function() {
- this._updateStroke();
- this.execSearch(false);
- },
- /**
- * @override
- */
- _getColumnSpecification: function() {
- return this._getBaseColumnSpec();
- },
- /**
- * @override
- */
- getListControlOptions: function() {
- return { setFocusOnDraw:false };
- },
- /**
- * Updates the filter button's stroke
- */
- _updateStroke: function() {
- var svg = this.$el.find('.facetButton .svgIcon');
- if (svg) {
- if (this.filterViewController.isDirty()) {
- UIHelper.addStroke(svg);
- } else {
- UIHelper.removeStroke(svg);
- }
- }
- },
- /**
- * Sets the search term in the searchBar. Does not execute the search.
- */
- setSearchTerm: function(term) {
- this.searchTerm = (_.isString(term) ? term : '').trim();
- this.searchBar.setSearchString(this.searchTerm);
- },
- /**
- * Gets the currently set search term as a string.
- */
- getSearchTerm: function() {
- return this.searchTerm.trim();
- },
- setFocus: function() {
- // shouldn't need this check, but...
- if (_.isFunction(this.searchBar && this.searchBar.setFocus)) {
- this.searchBar.setFocus();
- } else {
- Search.inherited('setFocus', this, arguments);
- }
- },
- showHideContentBarItems: function() {
- if (this.contentBar) {
- var facetButton = this.contentBar.itemMap.facetButton.$el.find('button');
- var savedSearchButton = this.contentBar.itemMap.savedSearchButton.$el.find('button');
- var isDisabled = this.filterViewController.isDirty() === false && this.resultsetSize === 0;
- facetButton.prop('disabled', isDisabled);
- savedSearchButton.prop('disabled', isDisabled);
- if (!this.filterViewController.isDirty()) {
- this.filterViewController.removeFilteredClass(facetButton);
- }
- }
- },
- getViewContainerClass: function() {
- return 'ContentListPageView ContentWideView SearchPageView';
- },
- contentbarItems: function() {
- return [{
- 'name': 'nameLabel',
- 'module': 'bacontentnav/lib/gemini/app/ui/toolbar_components/Label',
- 'className': 'searchLabel',
- 'responsive': false,
- 'label': StringResources.get('search')
- }, {
- 'name': 'savedSearchButton',
- 'module': 'bacontentnav/common/ui/contentbar_components/Button',
- 'position': 'trailing',
- 'label': StringResources.get('saveSearch'),
- 'responsive': false,
- 'className': 'saveSearchButton',
- 'icon': 'ba_content_nav-save_16',
- 'bSVG': true,
- 'disabled': true,
- 'action': this.saveSearchClicked.bind(this)
- }, {
- 'name': 'facetButton',
- 'module': 'bacontentnav/common/ui/contentbar_components/Button',
- 'position': 'trailing',
- 'label': StringResources.get('narrowYourSearch'),
- 'responsive': false,
- 'className': 'facetButton',
- 'icon': 'common-filter',
- 'bSVG': true,
- 'disabled': true,
- 'pushed': false,
- 'action': this.facetClicked.bind(this)
- }];
- },
- renderContent: function() {
- return this.renderSavedSearch();
- },
- saveSlideoutWidth: function() {
- var width = this.$el.width();
- UIHelper.saveSlideoutWidth(this.id, width);
- },
- _calcExtraNonTableHeight: function(tableView) {
- var searchbarHeight = tableView.$el.children('.SearchPageView .searchbar').outerHeight(true) || 40,
- searchResultHeight = tableView.$el.find('.ca-listContainer .propertyRow').outerHeight(true) || 40;
- return searchbarHeight + searchResultHeight;
- },
- _renderContentList: function(params, resetFacets) {
- if (_.isObject(params)) {
- params = '?' + $.param(params, true);
- }
- params = _.isString(params) ? params : '';
- return this.renderContentList({
- 'disableColumnHeaders': this.disableColumnHeaders,
- 'columns': this._getColumnSpecification(),
- 'ajaxProp': 'results',
- 'showEmptyNewFolderButton': false,
- 'multiSelect': false,
- 'emptyFolderString': StringResources.get('searchReturnedNoResults'),
- 'emptyParagraphString': StringResources.get('tryChangingSearchTerms'),
- 'url': this.searchURL + params,
- 'defaultSort': [],
- 'emptyIcon': EMPTY_SEARCH_ICON,
- 'calcExtraNonTableHeight': this._calcExtraNonTableHeight,
- 'dataManipulationCallback': function(resetFacetsFlag, response) {
- response.results = response.results || [];
- // filter via expected display types to detect, for example, explorations as different from dashboards
- var selectedDisplayTypes = this._getSelectedDisplayTypes();
- if (selectedDisplayTypes.length !== 0) {
- response.results = _.filter(response.results, function(result) {
- return selectedDisplayTypes.indexOf(UIHelper.getDisplayType(result)) !== -1;
- }.bind(this));
- }
- this.resultsetSize = response.results.length;
- if (resetFacetsFlag) {
- this.showHideContentBarItems();
- }
- if (response.totalResults) {
- this._showSearchResultsCaption(this.resultsetSize);
- }
- if (this.resultsetSize === 0) {
- //focus the search string
- this.setFocus();
- }
- }.bind(this, resetFacets)
- })
- .catch(function(e){
- //show an error
- this.glassContext.appController.showToast(StringResources.get('errorWithSearch'), {
- 'type': 'error',
- 'preventDuplicates': false
- });
- //rethrow it
- throw(e);
- }.bind(this));
- },
- renderSavedSearch: function() {
- var _resizeCallback = null;
- return this.renderContentList({
- 'disableColumnHeaders': true,
- 'columns': this._getSavedSearchColumnSpecification(),
- 'ajaxProp': '',
- 'showEmptyNewFolderButton': false,
- 'emptyFolderString': StringResources.get('haventSavedSearches'),
- 'emptyParagraphString': StringResources.get('clickTheSaveButton'),
- 'url': this.savedSearchURL,
- 'defaultSort': [],
- 'rightClickContextMenu': false,
- 'multiSelect': false,
- 'rowLimit': 10,
- 'emptyIcon': EMPTY_SEARCH_ICON,
- 'calcExtraNonTableHeight': this._calcExtraNonTableHeight,
- 'resizeCallback': function() {
- if (_resizeCallback) {
- clearTimeout(_resizeCallback);
- }
- _resizeCallback = setTimeout(this.saveSlideoutWidth.bind(this), 500);
- }.bind(this),
- 'dataManipulationCallback': function(response) {
- response.sort(function(x, y) {
- var date1 = new Date(x.timestamp);
- var date2 = new Date(y.timestamp);
- return date2 - date1;
- });
- if (response.length !== 0) {
- this._showSavedSearchLabel();
- }
- }.bind(this)
- });
- },
- execSearch: function(resetFlag) {
- if (this.getSearchTerm() && this.getSearchTerm().length > 0) {
- this.removeContentList();
- // do a reset if requested
- if (resetFlag === true) {
- this.resetState();
- }
- // set up search parameters, adding current filters
- var params = {
- 'fields': this.searchReturnParams,
- results: this.filterViewController.getResultLimit(),
- query: this.getSearchTerm(),
- hide_internal: 'all',
- filter: []
- };
- //filtered by time?
- if (this.filterViewController.getModificationTime()) {
- params.filter.push('modificationTime|' + this.filterViewController.getModificationTime());
- }
- //filtered by type?
- if (this._getFilteredTypes().length > 0) {
- params.filter.push('type|' + this._getFilteredTypes().join('|'));
- }
- //debounce this to ensure we don't rerender too many times
- if (!this._debouncedDraw) {
- this._debouncedDraw = _.debounce(
- this._renderContentList.bind(this)
- , 300);
- }
- return this._debouncedDraw(params, resetFlag);
- }
- },
- /**
- * Resets our state. Removes all filters, search parameters, etc.
- */
- resetState: function() {
- this.resultsetSize = 0;
- this.filterViewController.resetSelected();
- this.showHideContentBarItems();
- this._updateStroke();
- },
- /**
- Renders and shows the content bar if it's required
- **/
- _renderContentBar: function() {
- return this._createContentBar()
- .then(function(contentBar) {
- if (contentBar) {
- contentBar.show();
- }
- return this._updateAppBar()
- .then(function() {
- if (!this.searchBarRendered) {
- this.$el.append(this.searchBar.$el);
- this.searchBar.render();
- this.searchBarRendered = true;
- }
- return contentBar;
- }.bind(this));
- }.bind(this));
- },
- /**
- * Clears out the search view. Including the state, searchterm and content list.
- * @param searchTerm if provided, the search bar will be repopulated with this search string after clearing.
- */
- clearView: function(searchTerm) {
- this.resetState();
- this._updateStroke();
- //will default to '' if searchTerm is undefined.
- this.setSearchTerm(searchTerm);
- this.removeContentList();
- this.renderContent();
- this.showHideContentBarItems();
- },
- _getBaseColumnSpec: function() {
- var columns = [];
- columns.push({
- 'type': 'Icon'
- });
- var multiPropItems = [];
- multiPropItems.push({
- 'type': 'Name'
- });
- multiPropItems.push({
- 'type': 'Location',
- 'clickCallback': this._navigateParent.bind(this),
- 'showAsActiveLink': false
- });
- columns.push({
- 'type': 'MultipleProperties',
- 'items': multiPropItems
- });
- columns.push({
- 'type': 'ContextMenu'
- });
- return columns;
- },
- _getSavedSearchColumnSpecification: function() {
- return [{
- 'type': 'Text',
- 'propertyName': 'name',
- 'clickCallback': this._savedSearch.bind(this)
- }, {
- 'type': 'ClickableIcon',
- 'name': 'remove',
- 'a11yLabel': StringResources.get('remove'),
- 'icon': 'common-close-cancel-error',
- 'clickCallback': this._deleteSavedSearch.bind(this)
- }];
- },
- _savedSearch: function(oData) {
- this.setSearchTerm(oData.name);
- this.execSearch(true);
- },
- _showSavedSearchLabel: function() {
- var $savedSearchContainter = this.$el.find('.ca-listContainer');
- if (!$savedSearchContainter.hasClass('savedSearch')) {
- $savedSearchContainter.addClass('savedSearch').prepend('<div id="savedSearchLabel" class="propertyRow">' + StringResources.get('savedSearch') + '</div>');
- }
- },
- _showSearchResultsCaption: function(size) {
- var $savedSearchContainter = this.$el.find('.ca-listContainer');
- var $searchResults = $savedSearchContainter.find('.propertyRow.searchResultsCaption');
- if (size !== 0) {
- if ($searchResults.length == 0) {
- $savedSearchContainter.addClass('searchResults').prepend('<div class="propertyRow searchResultsCaption">' + size + ' ' + StringResources.get('results') + '</div>');
- } else {
- $searchResults.text(size + ' ' + StringResources.get('results'));
- }
- }
- },
- _deleteSavedSearch: function(oData) {
- if (!this.savedSearchDeleteClicked) {
- this.savedSearchDeleteClicked = true;
- var options = {
- 'dataType': 'json',
- 'type': 'DELETE',
- 'url': oData.url
- };
- return this.glassContext.getCoreSvc('.Ajax').ajax(options)
- .then(function() {
- this.savedSearchDeleteClicked = false;
- this.refresh();
- this.glassContext.appController.showToast(StringResources.get('searchWasDeleted'), {
- 'type': 'success',
- 'preventDuplicates': false
- });
- }.bind(this))
- .catch(function(err) {
- this.savedSearchDeleteClicked = false;
- this.glassContext.appController.showToast(StringResources.get('searchWasntDeleted'), {
- 'type': 'error',
- 'preventDuplicates': false
- });
- return Promise.reject(err);
- }.bind(this));
- } else {
- return Promise.resolve();
- }
- },
- _showSlideOut: function(options) {
- this.glassContext.appController.showSlideOut({
- parent: this.slideout,
- label: ContentStoreObject.getName(options.oData),
- position: 'left',
- width: options.width || '400',
- closeSlideouts: true,
- content: {
- showBreadcrumbs: true,
- showFilter: true,
- showAddFolder: false,
- showNewItem: true,
- module: SearchFolderView,
- url: options.selfLink + '/items',
- selfUrl: options.selfLink,
- selectedRow: options.selectedRow,
- ancestors: options.ancestors,
- propertiesView: this.propertiesView,
- getNewItemSpec: function() { return Promise.resolve([ { type: 'folder' } ]); },
- createNewItem: function() { this._addFolder(); }
- },
- resizable: true
- });
- },
- navigate: function(oData) {
- var selfLink = ContentStoreObject.getSelfLink(oData);
- var ancestors = [];
- for (var i in oData.ancestors) {
- ancestors.push(ContentStoreObject.buildAncestorEntry(oData.ancestors[i]));
- }
- ancestors.push(ContentStoreObject.buildAncestorEntry(oData));
- this._showSlideOut({
- oData: oData,
- width: '576',
- selfLink: selfLink,
- ancestors: ancestors
- });
- },
- _navigateParent: function(oData) {
- var selfLink = ContentStoreObject.getSelfLink(oData.ancestors[oData.ancestors.length - 1]);
- // so _selectRow can hide properties page
- this.propertiesOverride = true;
- var ancestors = [];
- for (var i in oData.ancestors) {
- ancestors.push(ContentStoreObject.buildAncestorEntry(oData.ancestors[i]));
- }
- this._showSlideOut({
- oData: oData,
- selfLink: selfLink,
- selectedRow: ['id', oData.id],
- ancestors: ancestors
- });
- },
- facetClicked: function() {
- if (this.contentBar.itemMap.facetButton.pushed === false && this.contentBar.itemMap.facetButton.$el.find('button').prop('disabled') === false) {
- var filterButton = this.contentBar.itemMap.facetButton.$el.find('button');
- this.contentBar.itemMap.facetButton.pushed = true;
- this.filterViewController.addFilteredClass(filterButton);
- this.glassContext.appController.showSlideOut({
- 'parent': this.slideout,
- 'label': StringResources.get('narrowYourSearch'),
- 'width': '200px',
- 'content': {
- 'module': 'bacontentnav/common/FilterView',
- 'view': this,
- 'searchBarController': null, //no search
- 'filterController': this.filterViewController
- }
- }).on('hide', function() {
- this.filterViewController.removeFilteredClass(filterButton);
- this.contentBar.itemMap.facetButton.pushed = false;
- this.setFocus();
- }.bind(this));
- }
- },
- saveSearchClicked: function() {
- if (!this.savedSearchclicked) {
- this.savedSearchclicked = true;
- this.glassContext.getCoreSvc('.Ajax').ajax({
- url: this.savedSearchURL
- })
- .then(this.saveSearchValidate.bind(this))
- .catch(function(err) {
- void(err);
- this.glassContext.appController.showToast(StringResources.get('searchWasntSaved'), {
- 'type': 'error',
- 'preventDuplicates': false
- });
- this.logger.error('Could not get saved searches');
- this.savedSearchclicked = false;
- }.bind(this));
- }
- },
- saveSearchValidate: function(res) {
- var response = res.data;
- if (response.length >= 10) {
- this.glassContext.appController.showToast(StringResources.get('saveTenSearches') + ' ' + StringResources.get('deleteASearch'), {
- 'type': 'warning',
- 'preventDuplicates': false
- });
- this.savedSearchclicked = false;
- } else {
- var flag = true;
- for (var i in response) {
- if (response[i].query === this.getSearchTerm()) {
- flag = false;
- var options = {
- 'dataType': 'json',
- 'type': 'DELETE',
- 'url': response[i].url
- };
- this.glassContext.getCoreSvc('.Ajax').ajax(options)
- .then(this.saveSearch.bind(this));
- break;
- }
- }
- if (flag) {
- this.saveSearch();
- }
- }
- },
- saveSearch: function() {
- var searchTerm = this.getSearchTerm();
- var ajaxData = JSON.stringify({
- 'name': searchTerm,
- 'query': searchTerm
- });
- var options = {
- url: this.savedSearchURL,
- type: 'POST',
- contentType: 'application/json',
- data: ajaxData
- };
- return this.glassContext.getCoreSvc('.Ajax').ajax(options)
- .then(function() {
- this.glassContext.appController.showToast(StringResources.get('searchWasSaved'), {
- 'type': 'success',
- 'preventDuplicates': false
- });
- }.bind(this))
- .catch(function() {
- this.glassContext.appController.showToast(StringResources.get('searchWasntSaved'), {
- 'type': 'error',
- 'preventDuplicates': false
- });
- this.logger.error('Could not post saved search');
- }.bind(this))
- .finally(function() {
- this.savedSearchclicked = false;
- }.bind(this));
- },
- /**
- * Returns the currently selected display types
- * @return {array}
- */
- _getSelectedDisplayTypes: function() {
- return this.filterViewController ? this.filterViewController.getSelectedTypes() : '';
- },
- /**
- * Returns the currently selected content-service types
- * @return {array}
- */
- _getFilteredTypes: function() {
- var types = [];
- _.each(this._getSelectedDisplayTypes(), function(displayType){
- types.push(UIHelper.getType(displayType));
- });
- // if there were no selected types, use the default types
- return types.length === 0 ? this.defaultTypes : types;
- }
- });
- return Search;
- });
- /*
- *+------------------------------------------------------------------------+
- *| Licensed Materials - Property of IBM
- *| IBM Cognos Products: Content Explorer
- *| (C) Copyright IBM Corp. 2015, 2018
- *|
- *| US Government Users Restricted Rights - Use, duplication or disclosure
- *| restricted by GSA ADP Schedule Contract with IBM Corp.
- *+------------------------------------------------------------------------+
- */
- define('bacontentnav/search/SearchFlyoutView',['./BaseSearchView'], function(BaseSearchView) {
- 'use strict';
- var Search = BaseSearchView.extend({
- disableColumnHeaders: true,
- getModuleName: function() {
- return 'bacontentnav/search/SearchFlyoutView';
- },
- _getColumnSpecification: function() {
- return this._getBaseColumnSpec();
- }
- });
- return Search;
- });
- /*
- *+------------------------------------------------------------------------+
- *| Licensed Materials - Property of IBM
- *| IBM Cognos Products: Content Explorer
- *| (C) Copyright IBM Corp. 2015, 2018
- *|
- *| US Government Users Restricted Rights - Use, duplication or disclosure
- *| restricted by GSA ADP Schedule Contract with IBM Corp.
- *+------------------------------------------------------------------------+
- */
- define('bi/content_apps/CASearchFlyoutView',[
- 'bacontentnav/search/SearchFlyoutView',
- 'bacontentnav/nls/StringResource',
- './PropertiesPageView'
- ], function(SearchFlyoutView, StringResource, PropertiesPageView) {
- 'use strict';
- var CASearchFlyoutView = SearchFlyoutView.extend({
- stateId: 'CASearchFlyoutView',
- init: function(options) {
- void(options);
- CASearchFlyoutView.inherited('init', this, arguments);
- // used by SearchFolderView - consider refactoring
- this.propertiesView = PropertiesPageView;
- },
- //todo: this piece of code should be moved to bacontentnav, so it can be shared.
- showProperties: function(objectInformation) {
- if (!this._propertiesOpen) {
- this.togglePropertiesMode();
- }
- this.propertiesSlideout = this.glassContext.appController.showSlideOut({
- 'label': StringResource.get('properties', {
- 'objectName': objectInformation.defaultName
- }),
- 'position': this.slideout ? null : 'right',
- 'parent': this.slideout,
- 'width': '400',
- 'enableTabLooping': true,
- 'onHide': function() {
- this._focus();
- if (this._propertiesOpen) {
- this.togglePropertiesMode();
- }
- if (this.propertiesSlideout && this.propertiesSlideout.contentView) {
- this.propertiesSlideout.contentView.onHide().then(function() {
- //remove propertiesPageView
- this.propertiesSlideout.hide();
- }.bind(this));
- }
- }.bind(this),
- 'content': {
- 'module': PropertiesPageView,
- 'parentView': this,
- 'objectInformation': objectInformation,
- 'glassContext': this.glassContext
- },
- 'resizable': true
- });
- },
- _focus: function() {
- this.$el.focus();
- }
- });
- return CASearchFlyoutView;
- });
- /*
- *+------------------------------------------------------------------------+
- *| Licensed Materials - Property of IBM
- *| IBM Cognos Products: Content Explorer
- *| (C) Copyright IBM Corp. 2016, 2018
- *|
- *| US Government Users Restricted Rights - Use, duplication or disclosure
- *| restricted by GSA ADP Schedule Contract with IBM Corp.
- *+------------------------------------------------------------------------+
- */
- define('bi/content_apps/GenericFolderWideView',[
- 'bacontentnav/nls/StringResource',
- 'bacontentnav/utils/ContentStoreObject',
- './CABaseContentView',
- './PropertiesPageView',
- 'underscore'
- ], function(StringResource, ContentStoreObject, CABaseContentView, PropertiesPageView, _) {
- 'use strict';
- var GenericFolderWideView = CABaseContentView.extend({
- stateId: 'GenericFolderView',
- GROUP_BY_TYPE_COLUMN_INDEX: 4,
- init: function(options) {
- this.showParentPropertiesButton = true;
- _.extend(this, options);
- /*eslint no-unused-vars: 0*/
- GenericFolderWideView.inherited('init', this, arguments);
- this.addURLParameters({
- 'fields': 'owner.defaultName,modificationTime'
- });
- //
- this.dataManipulationCallback = this.commonDataManipulationCallback;
- //always show the new item
- this.showNewItem = true;
- this.showAddFolder = false;
- },
- _getColumnSpecification: function() {
- var columnSpecs = [{
- 'type': 'Icon',
- 'accessibleLabel': StringResource.get('itemType')
- }];
- var nameProps = {
- 'type': 'MultipleProperties',
- 'orientation': 'horizontal',
- 'items': [{
- 'type': 'Time',
- 'displayInline': true,
- 'propertyName': ContentStoreObject.MODIFICATION_TIME
- }]
- };
- columnSpecs.push({
- 'type': 'MultipleProperties',
- 'orientation': 'vertical',
- 'items': [{
- 'type': 'Name'
- },
- nameProps
- ]
- });
- // There is a invisible column for ModifiedTime along with Name.
- // This second 'hidden' column is required to allow DataTable to sort on ModifiedTime.
- columnSpecs.push({
- 'type': 'Time',
- 'propertyName': ContentStoreObject.MODIFICATION_TIME,
- 'visible': false
- });
- // Here is another invisible column groupByFolder for the calculated grouping value
- columnSpecs.push({
- 'type': 'Text',
- 'propertyName': 'groupByFolder',
- 'visible': false
- });
- // Here is another invisible column groupByType for the calculated grouping value
- columnSpecs.push({
- 'type': 'Text',
- 'propertyName': 'groupByType',
- 'visible': false
- });
- columnSpecs.push({
- 'type': 'ContextMenu'
- });
- return columnSpecs;
- },
- /**
- Appropriately shows properties in either the child pane or a pane on the left
- */
- showProperties: function(objectInformation) {
- if (!this._propertiesOpen) {
- this.togglePropertiesMode();
- }
- this.propertiesSlideout = this.glassContext.appController.showSlideOut({
- 'label': StringResource.get('properties', {
- 'objectName': objectInformation.defaultName
- }),
- 'position': this.slideout ? null : 'left',
- 'parent': this.slideout,
- 'width': '400',
- 'enableTabLooping': true,
- 'onHide': function() {
- if (this._propertiesOpen) {
- this.togglePropertiesMode();
- }
- if (this.propertiesSlideout && this.propertiesSlideout.contentView) {
- this.propertiesSlideout.contentView.onHide().then(function() {
- //remove propertiesPageView
- this.propertiesSlideout.hide();
- }.bind(this));
- }
- }.bind(this),
- 'content': {
- 'module': PropertiesPageView,
- 'parentView': this,
- 'objectInformation': objectInformation,
- 'glassContext': this.glassContext
- }
- });
- },
- getSortSpec: function() {
- var sortSpec = GenericFolderWideView.inherited('getSortSpec', this, arguments);
- // ensure we can sort by type
- sortSpec.sortBy.type = 'type';
- return sortSpec;
- },
- getDefaultSort: function() {
- return [
- [3, 'asc'],
- [1, 'asc']
- ];
- }
- });
- return GenericFolderWideView;
- });
- /*
- *+------------------------------------------------------------------------+
- *| Licensed Materials - Property of IBM
- *| IBM Cognos Products: Content Explorer
- *| (C) Copyright IBM Corp. 2015, 2016
- *|
- *| US Government Users Restricted Rights - Use, duplication or disclosure
- *| restricted by GSA ADP Schedule Contract with IBM Corp.
- *+------------------------------------------------------------------------+
- */
- define('bacontentnav/common/ui/contentbar_components/Button',['jquery', '../../../lib/gemini/app/ui/toolbar_components/Button'], function($, GeminiButton) {
- 'use strict';
- var Button = null;
- /**
- * Represents a drop down menu that can be added to an app bar
- */
- Button = GeminiButton.extend({
- events: {
- 'primaryaction': '_handleClick',
- 'mousedown': '_handleStartDrag',
- 'dragdown': '_handleStartDrag'
- },
- render: function() {
- Button.inherited('render', this, arguments);
- var $button = $(this.$el).find('button');
- //should not need to do this but chrome and firefox does not seem to put it in the taborder so add it in directly
- if (this.hiddenOnRender) {
- this.$el.hide();
- $button.attr('tabindex', '-1');
- } else {
- $button.attr('tabindex', '0');
- }
- if (this.displayLabel) {
- var $icon = $(this.$el).find('svg');
- $button.append($("<span class='buttonLabel'>" + this.label + '</span>'));
- $icon.css('float', 'left');
- }
- return this;
- }
- });
- return Button;
- });
- /*
- *+------------------------------------------------------------------------+
- *| Licensed Materials - Property of IBM
- *| IBM Cognos Products: Content Explorer
- *| (C) Copyright IBM Corp. 2015
- *|
- *| US Government Users Restricted Rights - Use, duplication or disclosure
- *| restricted by GSA ADP Schedule Contract with IBM Corp.
- *+------------------------------------------------------------------------+
- */
- define('bacontentnav/common/ui/contentbar_components/HiddenLabel',['jquery', '../../../lib/gemini/app/ui/toolbar_components/Button'], function($, GeminiButton) {
- var HiddenLabel = null;
- /**
- * represents a hidden label for accessibility purposes
- */
- HiddenLabel = GeminiButton.extend({
- events: {},
- render: function() {
- return this;
- }
- });
- return HiddenLabel;
- });
- /**
- * Licensed Materials - Property of IBM
- * IBM Cognos Products: BI Cloud (C) Copyright IBM Corp. 2014, 2017
- * US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
- */
- define('bacontentnav/lib/gemini/app/ui/toolbar_components/MenuWithTick',[
- './Menu',
- 'underscore',
- 'text!../templates/Menu.html',
- '../../../../@waca/core-client/js/core-client/ui/properties/CheckBox',
- '../../../../../nls/StringResource'
- ], function(Menu, _, template, CheckBox, StringResource) {
- var MenuWithTickItem = null;
- /**
- * Represents a drop down menu that can be added to an app bar
- */
- MenuWithTickItem = Menu.extend({
- templateString: template,
- /**
- * Creates a new menu item
- *
- * @param spec -
- * The menu item spec
- * @param root -
- * A reference to the root menu item, where items go if the app bar is collapsed horizontally
- */
- init: function(spec) {
- _.extend(this, spec);
- MenuWithTickItem.inherited('init', this, arguments);
- },
- _templateParams: function() {
- var params = MenuWithTickItem.inherited('_templateParams', this, arguments);
- params.showTick = true;
- params.showTitle = true;
- params.label = StringResource.get('filterHeader');
- return params;
- },
- /**
- * Updates checked mark and aria-checked attributes in given menuItem
- */
- updateMenuItemTick: function($MenuItem, checked, disabled) {
- if ($MenuItem) {
- var checkbox = $MenuItem.find('.checkbox');
- var menuItemLink = $MenuItem.find('a');
- var checkboxParent = $MenuItem.find('.clickable');
- if (checkbox && checkboxParent && menuItemLink && menuItemLink[0] && checkbox[0]) {
- if (checked) {
- checkbox.addClass('checked');
- }
- else {
- checkbox.removeClass('checked');
- }
- if (disabled) {
- checkboxParent.addClass('disabled');
- }
- else {
- checkboxParent.removeClass('disabled');
- }
-
- menuItemLink[0].setAttribute('aria-checked', checked ? true : false);
- checkbox[0].setAttribute('aria-checked', checked ? true : false);
- checkbox[0].setAttribute('aria-disabled', disabled ? true : false);
- }
- }
- }
- });
- return MenuWithTickItem;
- });
- /**
- * Licensed Materials - Property of IBM
- * IBM Cognos Products: BI Cloud (C) Copyright IBM Corp. 2014, 2018
- * US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
- */
- define('bacontentnav/lib/gemini/app/ui/toolbar_components/ToggleMenuBar',[
- 'underscore',
- './MenuWithTick',
- '../../../../@waca/core-client/js/core-client/ui/properties/CheckBox'
- ], function(_, MenuWithTick, CheckBox) {
- 'use strict';
- var ToggleMenuBar = null;
- /**
- * Represents a drop down menu that can be added to an app bar
- */
- ToggleMenuBar = MenuWithTick.extend({
- /**
- * Creates a new item
- *
- * @param spec -
- * The item spec
- * @param root -
- * A reference to the root menu item, where items go if the app bar is collapsed horizontally
- */
- init: function(spec) {
- _.extend(this, spec);
- ToggleMenuBar.inherited('init', this, arguments);
- this.itemMap = {};
- this.checkedFilters = [];
- },
- _handleClick: function(event){
- event.stopPropagation();
- this.onCheckboxChange(event.currentTarget.id);
- },
- _handleKeyboard: function(event) {
- var keyCode = event.which || event.keyCode || event.charCode;
- var $target = $(event.target);
- // Only override the enter and space keys. Else pass on to base class
- if ((keyCode === 13 || keyCode === 32) && !$target.hasClass('dropdown-toggle')){
- event.stopPropagation();
- this.onCheckboxChange(event.target.parentNode.id);
- }
- else {
- ToggleMenuBar.inherited('_handleKeyboard', this, arguments);
- }
- },
- /**
- * Toggle Spec
- * ------------------------------------------------------------
- *
- * - Default: 'All content' is selected
- * - All checkboxes are checked
- * - 'All content' is disabled and checked
- *
- * - When an option is unselected
- * - That option becomes unchecked
- * - 'All content' becomes unchecked
- *
- * - When 'All Content' is selected (when possible)
- * - Return it back to 'All Content' state (see Default)
- *
- * - When an option is selected that makes all options checked
- * - Return it back to 'All Content' state (see Default)
- *
- */
- /**
- * Follow filter multi-select spec
- */
- updateSelectedItem: function() {
- // First, unselect all
- _.each(this.items, function(item) {
- this.updateMenuItemTick(this.itemMap[this._getItemId(item.name)], false, false);
- }.bind(this));
- // Then select all that are expected to be selected
- _.each(this.checkedFilters, function(id) {
- this.updateMenuItemTick(this.itemMap[id], true, false);
- }.bind(this));
- },
- /**
- * The following function is called when a checkbox from the ToggleMenu is clicked.
- * @param id -
- * The id of the checkbox that was clicked
- */
- onCheckboxChange: function(id) {
- this._performAction(id); // Perform the actual filter
- if (id === this._getItemId(this.items[0].name)) {
- // All was selected
- if ( this.checkedFilters.indexOf(this._getItemId(this.items[0].name)) > -1 ) {
- // Remove all filters
- this.removeAllFilters();
- }
- else {
- // Add all filters
- this.selectAllFilters();
- }
- }
- else {
- if (this.checkedFilters.indexOf(id) > -1) {
- // Remove this filter
- this.checkedFilters.splice(this.checkedFilters.indexOf(id), 1);
- }
- else {
- // Add this filter
- this.checkedFilters.push(id);
- }
- if (this.checkedFilters.length < this.items.length && this.checkedFilters.indexOf(this._getItemId(this.items[0].name)) > -1) {
- // Handle when 'All' needs to be automatically removed
- this.checkedFilters.splice(this.checkedFilters.indexOf(this._getItemId(this.items[0].name)), 1);
- }
- else if (this.checkedFilters.length === this.items.length - 1 && !this.checkedFilters.indexOf(this._getItemId(this.items[0].name)) > -1) {
- // Handle when 'All' needs to be automatically selected
- this.checkedFilters.push(this._getItemId(this.items[0].name));
- }
- }
- this.updateSelectedItem();
- },
- selectAllFilters: function() {
- this.checkedFilters = []; // Empty current set of filters
- _.each(this.items, function(item) {
- this.checkedFilters.push(this._getItemId(item.name));
- }.bind(this));
- },
- removeAllFilters: function() {
- this.checkedFilters = [];
- },
- render: function() {
- var promise = ToggleMenuBar.inherited('render', this, arguments);
- this.selectAllFilters();
- this.updateSelectedItem();
- if (this.updateLabel) {
- _.each(this.items, function(item) {
- if (item.checked) {
- this.updateSelectedItem();
- }
- }.bind(this));
- if (!this.sCheckedItemName) {
- this.updateSelectedItem();
- }
- }
- return promise;
- },
- _buildDropDown: function() {
- var promise = ToggleMenuBar.inherited('_buildDropDown', this, arguments);
- //populate itemMap to reference elements by name
- _.each(this.items, function(item) {
- var id = this._getItemId(item.name);
- this.itemMap[id] = this.$menu.find('#' + id);
- // Add a checkbox control to each item in the Filter dropdown
- var propertyControl = this.itemMap[id].find('.propertyRow');
- if (propertyControl) {
- var checkbox = new CheckBox({
- 'el': propertyControl,
- 'id': id,
- 'name': item.name,
- 'position': 'leading',
- 'nestedUIControl': true,
- 'readOnly': false,
- 'onChange': function(name) {
- var changeId = this._getItemId(name);
- this.onCheckboxChange(changeId);
- }.bind(this)
- });
- checkbox.render();
- }
- // Add each item to the list of checked items (all items are checked by default)
- this.checkedFilters.push(id);
- }.bind(this));
- this.updateSelectedItem();
- return promise;
- },
- remove: function() {
- _.each(this.itemMap, function(item) {
- if (item.remove) {
- item.remove();
- }
- });
- ToggleMenuBar.inherited('remove', this, arguments);
- }
- });
- return ToggleMenuBar;
- });
- /*
- *+------------------------------------------------------------------------+
- *| Licensed Materials - Property of IBM
- *| IBM Cognos Products: Content Explorer
- *| (C) Copyright IBM Corp. 2015,2017
- *|
- *| US Government Users Restricted Rights - Use, duplication or disclosure
- *| restricted by GSA ADP Schedule Contract with IBM Corp.
- *+------------------------------------------------------------------------+
- */
- define('bacontentnav/common/ui/contentbar_components/ToggleMenuBar',['jquery', '../../../lib/gemini/app/ui/toolbar_components/ToggleMenuBar', '../../../lib/@waca/core-client/js/core-client/utils/Utils'], function($, GeminiToggleMenuBar, Utils) {
- var ToggleMenuBar = null;
- /**
- * Represents a drop down menu that can be added to an app bar
- */
- ToggleMenuBar = GeminiToggleMenuBar.extend({
- events: {
- 'clicktap .dropdown-toggle': '_handleClick',
- 'clicktap .dropdown-menuitem': '_handleClick',
- 'keydown': '_handleKeyboard'
- },
- render: function() {
- ToggleMenuBar.inherited('render', this, arguments);
- if (this.icon) {
- if (this.iconRightAlign) {
- this.$toggle.append(this.$iconImage);
- }
- if (this.bSVG) {
- Utils.setIcon(this.$iconImage, this.icon);
- }
- }
- this.$toggle = this.className ? this.$toggle.addClass(this.className) : this.$toggle;
- }
- });
- return ToggleMenuBar;
- });
- /**
- * Licensed Materials - Property of IBM
- * IBM Cognos Products: BI Cloud (C) Copyright IBM Corp. 2014, 2017
- * US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
- */
- define('bacontentnav/lib/gemini/app/ui/toolbar_components/MenuWithActive',[ './Menu', 'underscore', 'text!../templates/Menu.html', '../../../../../nls/StringResource'], function(Menu, _, template, StringResource) {
- var MenuWithActive = null;
- /**
- * Represents a drop down menu that can be added to an app bar
- */
- MenuWithActive = Menu.extend({
- templateString: template,
- /**
- * Creates a new menu item
- *
- * @param spec -
- * The menu item spec
- * @param root -
- * A reference to the root menu item, where items go if the app bar is collapsed horizontally
- */
- init: function(spec) {
- _.extend(this, spec);
- MenuWithActive.inherited('init', this, arguments);
- },
- _templateParams: function() {
- var params = MenuWithActive.inherited('_templateParams', this, arguments);
- params.isSort = true;
- params.showTitle = true;
- params.label = StringResource.get('sortHeader');
- return params;
- },
- /**
- * Updates checked mark and aria-checked attributes in given menuItem
- */
- updateMenuItemActive: function($MenuItem, checked, isAsc) {
- if ($MenuItem) {
- var link = $MenuItem.find('a');
- var icon = link.find('span.sortDirection');
- var svg = icon.find('use');
- if (checked) {
- link.addClass('sortByActive');
- }
- else {
- link.removeClass('sortByActive');
- }
-
- if (isAsc != null) {
- var svgId = isAsc ? '#ba_content_nav-arrow_up_16' : '#ba_content_nav-arrow_down_16';
- icon[0].setAttribute('style', '');
- icon[0].setAttribute('aria-label', isAsc ? StringResource.get('sortedAscending') : StringResource.get('sortedDescending'));
- svg[0].setAttribute('xlink:href', svgId);
- }
- else {
- icon[0].setAttribute('style', 'display: none;');
- }
-
- link[0].setAttribute('aria-checked', checked ? 'true' : 'false');
- }
- }
- });
- return MenuWithActive;
- });
- /**
- * Licensed Materials - Property of IBM
- * IBM Cognos Products: BI Cloud (C) Copyright IBM Corp. 2017
- * US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
- */
- define('bacontentnav/lib/gemini/app/ui/toolbar_components/SortMenuBar',[ './MenuWithActive', 'underscore'], function( MenuWithActive, _ ) {
- 'use strict';
- var SortMenuBar = null;
- /**
- * Represents a drop down menu that can be added to an app bar
- */
- SortMenuBar = MenuWithActive.extend({
- itemMap: {},
- sCheckedItemId: null,
- updateLabel: false,
- sortAscending: true,
- /**
- * Creates a new item
- *
- * @param spec -
- * The item spec
- * @param root -
- * A reference to the root menu item, where items go if the app bar is collapsed horizontally
- */
- init: function(spec) {
- _.extend(this, spec);
- SortMenuBar.inherited('init', this, arguments);
- },
- toggleHandler: function(name) {
- this.updateSelectedItem(this._getItemId(name));
- },
- /**
- * Make sure only one item is selected
- */
- updateSelectedItem: function(id) {
- var item = this.itemMap[id];
- if(!item || !item.children) {
- // if we haven't selected an item, we do not update the tick
- return;
- }
- // Check if the selected item is the current selected item
- if (this.sCheckedItemId === id) {
- /* The selected item is already selected - therefore, flip the ascending/descending option
- updateMenuItemActive( $MenuItem - the actual DOM item,
- checked - whether or not that DOM element should be ACTIVE,
- asc - whether or not the sort direction is ascending )
- */
- this.sortAscending = !this.sortAscending; // flip the value of sortAscending
- this.updateMenuItemActive(this.itemMap[id], true, this.sortAscending);
- }
- else {
- // The selected item was not already selected - therefore, unselect the current item and select the new item with direction ascending
- this.sortAscending = true;
-
- // Remove active and sort direction from old sort type
- this.updateMenuItemActive(this.itemMap[this.sCheckedItemId], false, null);
- // Add active and sort direction to new sort type
- this.updateMenuItemActive(this.itemMap[id], true, this.sortAscending);
- // Update the current sort by name
- this.sCheckedItemId = id;
- }
- if (this.updateLabel) {
- if (this.$menuLabel.length > 0 && item.children) {
- this.$menuLabel.text(item.children('a').attr('aria-label'));
- }
- }
- },
- render: function() {
- var promise = SortMenuBar.inherited('render', this, arguments);
- if (this.updateLabel) {
- _.each(this.items, function(item) {
- if (item.checked) {
- this.updateSelectedItem(this._getItemId(item.name));
- }
- }.bind(this));
- if (!this.sCheckedItemId) {
- this.updateSelectedItem(this._getItemId(this.items[0].name));
- }
- }
- return promise;
- },
- _performAction: function(id) {
- this.updateSelectedItem(id);
- SortMenuBar.inherited('_performAction', this, arguments);
- },
- _getItemNameFromID: function(id) {
- var prefix = this.viewId + '_';
- return id.substr(prefix.length);
- },
- _templateParams: function() {
- var params = SortMenuBar.inherited('_templateParams', this, arguments);
- params.isSort = true;
- return params;
- },
- _buildDropDown: function() {
- var promise = SortMenuBar.inherited('_buildDropDown', this, arguments);
- //populate itemMap to reference elements by name
- _.each(this.items, function(item) {
- var id = this._getItemId(item.name);
- this.itemMap[id] = this.$menu.find('#' + id);
- if (item.sorted) {
- this.sCheckedItemId = id;
- this.updateMenuItemActive(this.itemMap[this.sCheckedItemId], true, this.sortAscending);
- }
- }.bind(this));
- return promise;
- },
- remove: function() {
- _.each(this.itemMap, function(item) {
- if (item.remove) {
- item.remove();
- }
- });
- SortMenuBar.inherited('remove', this, arguments);
- }
- });
- return SortMenuBar;
- });
- /*
- *+------------------------------------------------------------------------+
- *| Licensed Materials - Property of IBM
- *| IBM Cognos Products: Content Explorer
- *| (C) Copyright IBM Corp. 2015, 2017
- *|
- *| US Government Users Restricted Rights - Use, duplication or disclosure
- *| restricted by GSA ADP Schedule Contract with IBM Corp.
- *+------------------------------------------------------------------------+
- */
- define('bacontentnav/common/ui/contentbar_components/SortMenuBar',['jquery', '../../../lib/gemini/app/ui/toolbar_components/SortMenuBar', '../../../lib/@waca/core-client/js/core-client/utils/Utils'], function($, GeminiToggleMenuBar, Utils) {
- var SortMenuBar = null;
- /**
- * Represents a drop down menu that can be added to an app bar
- */
- SortMenuBar = GeminiToggleMenuBar.extend({
- events: {
- 'clicktap .dropdown-toggle': '_handleClick',
- 'clicktap .dropdown-menuitem': '_handleClick',
- 'keydown': '_handleKeyboard'
- },
- render: function() {
- SortMenuBar.inherited('render', this, arguments);
- if (this.icon) {
- if (this.iconRightAlign) {
- this.$toggle.append(this.$iconImage);
- }
- if (this.bSVG) {
- Utils.setIcon(this.$iconImage, this.icon);
- }
- }
- this.$toggle = this.className ? this.$toggle.addClass(this.className) : this.$toggle;
- }
- });
- return SortMenuBar;
- });
- /*
- *+------------------------------------------------------------------------+
- *| Licensed Materials - Property of IBM
- *| IBM Cognos Products: Content Explorer
- *| (C) Copyright IBM Corp. 2017, 2019
- *|
- *| US Government Users Restricted Rights - Use, duplication or disclosure
- *| restricted by GSA ADP Schedule Contract with IBM Corp.
- *+------------------------------------------------------------------------+
- */
- define('bacontentnav/common/ui/list_columns/Column',[
- '../../../lib/@waca/core-client/js/core-client/ui/core/Class',
- '../../../lib/@waca/core-client/js/core-client/utils/ContentFormatter',
- '../../../lib/@waca/core-client/js/core-client/utils/BidiUtil',
- '../../../utils/MRUHelper',
- '../../../utils/UIHelper',
- 'underscore'
- ], function(Class, ContentFormatter, BidiUtil, MRUHelper, UIHelper, _) {
- 'use strict';
- /*****
- options: getDataFn - function that can overwrite the default behavior
- retrieving the data for the column. The function is passed the json object
- the contains the data and is expected to return the specific data from that argument
- **/
- var Column = Class.extend({
- init: function(options) {
- _.extend(this, options);
- if (!this._bNavigable) {
- this._bNavigable = $.isFunction(this.clickCallback);
- }
- },
- getSpec: function() {
- var hasConsole = typeof console;
- void(hasConsole);
- },
- /**
- returns the data for this column. If a dataFn has been provided it
- uses that otherwise it calls _data()
- **/
- getData: function(oData) {
- if (this.getDataFn) {
- return this.getDataFn(oData);
- } else {
- return this._getData(oData);
- }
- },
- /**
- Override if your column returns data
- **/
- _getData: function() {
- return '';
- },
- /**
- Override if your property has special logic when creating the cell
- **/
- createCell: function(parentNode, sData) {
- var $parent = $(parentNode);
- $parent.text(_.unescape(sData));
- },
- getListControl: function() {
- return this.listControl;
- },
- createEllipseCell: function(nParent, sData, oData) {
- var $parent = $(nParent);
- $parent.addClass('ellipsis_cell');
- var safeData = _.unescape(sData);
- var divClass = 'nameColumnDiv';
- if (this._bNavigable) {
- divClass += ' contentListFocusable';
- if (oData.type !== 'folder' && UIHelper.isValid(oData) &&
- (this.listControl && UIHelper.hasRequiredCapabilities(oData, this.listControl.typesToOpen, this.listControl.capabilitiesRequired))) {
- divClass += ' clickable';
- }
- }
- if (BidiUtil.userPreferredTextDir) {
- safeData = BidiUtil.enforceTextDirection(safeData);
- }
- var $div = $('<div></div>', {
- 'title': safeData,
- 'text': safeData,
- 'class': divClass,
- 'tabindex': '-1'
- });
- $parent[0].fnResizeCallback = function() {
- $div[0].textContent = safeData;
- this.getMiddleShortenString($div[0]);
- if (BidiUtil.userPreferredTextDir !== '') {
- if (($parent.hasClass('location') || ($parent.hasClass('text') && $div[0].textContent.indexOf('>') >= 0))) {
- $div[0].textContent = BidiUtil.enforceTextDirectionForLocation($div[0].textContent);
- $div[0].title = BidiUtil.enforceTextDirectionForLocation(safeData);
- } else {
- $div.attr('dir', BidiUtil.resolveBaseTextDir($div[0].textContent));
- }
- }
- }.bind(this);
- $parent.empty().append($div);
- this.addClickAction($div, nParent, sData, oData);
- return $div;
- },
- processTextForEllipses: function(nTd) {
- var $td = $(nTd);
- if ($td[0].fnResizeCallback) {
- $td[0].fnResizeCallback();
- }
- },
- getMiddleShortenString: function(content) {
- ContentFormatter.middleShortenString(content);
- },
- /**
- * Override if you need to add a click action on a ellipse enabled cell
- */
- addClickAction: function($div, nParent, sData, oData) {
- if (!_.isUndefined(this.clickCallback)) {
- $div.addClass('contentListFocusable');
- $div.on('primaryaction', function(e) {
- this.clickCallback(oData, e);
- }.bind(this));
- }
- },
- /**
- * Common functionality for creating a context menu
- */
- onContextMenu: function(oData, event) {
- if (!event.shiftKey && !event.ctrlKey) {
- event.stopPropagation();
- var listControl = this.getListControl();
- //
- if (_.isFunction(listControl._hideSlideoutChildrenToTheRight)){
- listControl._hideSlideoutChildrenToTheRight();
- }
- listControl._clearRows(); //show context menu for single select items only
- listControl.handleClick(event);
- var showContextMenu = function() {
- listControl.getActionPayload(event).then(function(actionPayload) {
- this.glassContext.appController.showContextMenu(actionPayload);
- }.bind(this));
- }.bind(this);
- var view = listControl.contentView || {};
- if (MRUHelper.requiresAssetVerification(view)) {
- MRUHelper.verifyAccess(this.glassContext, oData && oData.id)
- .then(function(hasAccess) {
- if (hasAccess) {
- showContextMenu();
- } else if (view.slideout) {
- view.slideout.hide();
- }
- });
- } else {
- showContextMenu();
- }
- return false;
- }
- }
- });
- return Column;
- });
- /*
- *+------------------------------------------------------------------------+
- *| Licensed Materials - Property of IBM
- *| IBM Cognos Products: Content Explorer
- *| (C) Copyright IBM Corp. 2016, 2018
- *|
- *| US Government Users Restricted Rights - Use, duplication or disclosure
- *| restricted by GSA ADP Schedule Contract with IBM Corp.
- *+------------------------------------------------------------------------+
- */
- define('bacontentnav/common/ui/list_columns/BaseIcon',[
- './Column'
- ], function(Column) {
- 'use strict';
- var BaseIcon = Column.extend({
- getSpec: function() {
- return Promise.resolve({
- 'name': this.name,
- 'bSortable': false,
- 'sClass': 'icon ellipsesButton_cell',
- 'hiddenLabel': this.name,
- 'width': '40px',
- 'mData': this.getData.bind(this),
- 'fnCreatedCell': this.createCell.bind(this)
- });
- },
- /**
- * takes the node and appends the result of the createObjectImg function to it
- * createObjectImg should be defined by child classes
- */
- createCell: function(nParent, sData, oData) {
- var $parent = $(nParent);
- var objectImg = this.createObjectImg(oData);
- $parent.empty().append(objectImg);
- $parent.attr('aria-label', this.a11yLabel);
- this.addClickAction(objectImg, nParent, sData, oData);
- },
- /**
- * Override to define your own icon in the cell
- */
- createObjectImg: function(){
- var $div = $('<div>', {
- role: 'img',
- tabindex: '-1'
- });
- return $div;
- }
- });
- return BaseIcon;
- });
- /*
- *+------------------------------------------------------------------------+
- *| Licensed Materials - Property of IBM
- *| IBM Cognos Products: Content Explorer
- *| (C) Copyright IBM Corp. 2015, 2018
- *|
- *| US Government Users Restricted Rights - Use, duplication or disclosure
- *| restricted by GSA ADP Schedule Contract with IBM Corp.
- *+------------------------------------------------------------------------+
- */
- define('bacontentnav/common/ui/list_columns/Icon',[
- './BaseIcon',
- '../../../utils/UIHelper',
- '../../../utils/ContentStoreObject',
- '../../../nls/StringResource',
- '../../../lib/@waca/core-client/js/core-client/utils/Utils'
- ], function(BaseIcon, UIHelper, ContentStoreObject, StringResource, Utils) {
- 'use strict';
- var Icon = BaseIcon.extend({
- getSpec: function(){
- return Icon.inherited('getSpec', this, arguments).then(function(spec){
- spec.name = 'icon';
- spec.headerClass = 'headerIcon';
- return spec;
- });
- },
- _getData: function(oRowData) {
- return UIHelper.getFilterType(oRowData);
- },
- createObjectImg: function(oData) {
- var type = UIHelper.getDisplayType(oData);
- var hidden = ContentStoreObject.getHidden(oData);
- var disabled = ContentStoreObject.getDisabled(oData);
- var sXLink = UIHelper.getTypeSVGIconFromObject(oData);
- var tooltip = UIHelper.getTypeNameFromObject(oData);
- var a11yLabel = tooltip;
- var sClass = 'svgIcon';
- if (hidden) {
- sClass += ' dimmed';
- a11yLabel = 'hidden ' + a11yLabel;
- }
- if (sXLink) {
- // Overlay disabled icon decorator
- var iconObject = '<use xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="' + sXLink + '"></use>';
- if (disabled) {
- var iconDisabledOverlay = '<use xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="#common-disabled" x="5" y="5" height="10" width="12" style="stroke: #ff0000;"></use>';
- iconObject += iconDisabledOverlay;
- a11yLabel = 'disabled ' + a11yLabel;
- } else if (UIHelper.getIconFill(type)) {
- iconObject = '<use xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="' + sXLink + '" style="fill: ' + UIHelper.getIconFill(type) + '"></use>';
- }
- // Add view decorator unless it is a report view - new icon does not require decorator (June 2017)
- if (UIHelper.isSVGIconDecorated(type)) {
- iconObject += '<use xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="#common-view_decorator" x="5" y="5" height="10" width="12"></use>';
- }
- return Utils.embedSVGIcon($('<div role="img" alt="' + tooltip + '" title="' + tooltip + '"><svg role="presentation" class="' + sClass + '">' + iconObject + '<text>' + a11yLabel + '</text></svg></div>'));
- }
- return $('<div></div>', {
- 'alt': tooltip,
- 'title': tooltip,
- 'height': '30px',
- 'width': '30px'
- });
- }
- });
- return Icon;
- });
- /*
- *+------------------------------------------------------------------------+
- *| Licensed Materials - Property of IBM
- *| IBM Cognos Products: Content Explorer
- *| (C) Copyright IBM Corp. 2015, 2016, 2017
- *|
- *| US Government Users Restricted Rights - Use, duplication or disclosure
- *| restricted by GSA ADP Schedule Contract with IBM Corp.
- *+------------------------------------------------------------------------+
- */
- define('bacontentnav/common/ui/list_columns/AccountIcon',[
- './Icon'
- ], function(Icon) {
- 'use strict';
- var AccountIcon = Icon.extend({
- getData: function(oRowData) {
- return oRowData.objectClass;
- }
- });
- return AccountIcon;
- });
- /*
- *+------------------------------------------------------------------------+
- *| Licensed Materials - Property of IBM
- *| IBM Cognos Products: Content Explorer
- *| (C) Copyright IBM Corp. 2015, 2018
- *|
- *| US Government Users Restricted Rights - Use, duplication or disclosure
- *| restricted by GSA ADP Schedule Contract with IBM Corp.
- *+------------------------------------------------------------------------+
- */
- define('bacontentnav/common/ui/list_columns/BirdBeakMenu',[
- './Column',
- '../../../common/ui/BreadcrumbDropDown',
- '../../../nls/StringResource',
- '../../../lib/@waca/core-client/js/core-client/utils/Utils'
- ], function(Column, DropDownMenu, StringResource, Utils) {
- 'use strict';
- var BirdBeakMenu = Column.extend({
- getSpec: function() {
- return Promise.resolve({
- //'name': 'Set PermissionAAAA',
- 'bSortable': false,
- 'sClass': 'ellipsesButton_cell',
- 'hiddenLabel': this.name,
- 'mData': function() {
- return ''; //This is a workaround for the assumption that all ListControl elements look to the row data for information
- },
- 'fnCreatedCell': function(nTd, sData, oData) {
- void(oData);
- var $td = $(nTd);
- var $div = $('<div></div>', {
- 'class': 'ellipsesButton forceRowSelection'
- });
- $div.attr('role', 'link');
- $div.attr('tabindex', '-1');
- $div.attr('title', this.name);
- this._createDropDown($div);
- $td.empty().append($div);
- }.bind(this)
- });
- },
- _createDropDown: function($parentEl) {
- var $div = $('<div>').addClass('contentListFocusable').appendTo($parentEl);
- Utils.setIcon($div, 'common-titan-arrow-down');
- this.ddMenu = new DropDownMenu({
- dropDownMenuSpec: {
- 'title': this.name || '',
- 'id': 'birdBeakId',
- 'label': 'BirdBeak',
- 'items': this.menuItems,
- 'actionElement': $div[0],
- 'ddMenuPlacement': 'bottom'
- }
- });
- this.ddMenu.render().then(function(el) {
- $div.append(el);
- });
- $parentEl.addClass('birdBeak');
- }
- });
- return BirdBeakMenu;
- });
- /*
- *+------------------------------------------------------------------------+
- *| Licensed Materials - Property of IBM
- *| IBM Cognos Products: Content Explorer
- *| (C) Copyright IBM Corp. 2015, 2018
- *|
- *| US Government Users Restricted Rights - Use, duplication or disclosure
- *| restricted by GSA ADP Schedule Contract with IBM Corp.
- *+------------------------------------------------------------------------+
- */
- define('bacontentnav/common/ui/list_columns/ClickableIcon',[
- '../../../lib/@waca/core-client/js/core-client/utils/Utils',
- './BaseIcon'
- ], function(utils, BaseIcon) {
- 'use strict';
- /**
- @param options.name {string} - Item name
- @param options.clickCallback {function} - Optional, callback function to call when the user clicks on the icon
- @param options.icon {string} - The icon to display, in standard svg format
- **/
- var ClickableIcon = BaseIcon.extend({
- createObjectImg: function(){
- var $div = $('<div>', {
- 'class': 'ellipsesButton forceRowSelection',
- 'title': this.a11yLabel,
- 'role': 'link',
- 'tabindex': '-1'
- });
- utils.setIcon($div, this.icon);
- return $div;
- }
- });
- return ClickableIcon;
- });
- /*
- *+------------------------------------------------------------------------+
- *| Licensed Materials - Property of IBM
- *| IBM Cognos Products: Content Explorer
- *| (C) Copyright IBM Corp. 2015, 2018
- *|
- *| US Government Users Restricted Rights - Use, duplication or disclosure
- *| restricted by GSA ADP Schedule Contract with IBM Corp.
- *+------------------------------------------------------------------------+
- */
- define('bacontentnav/common/ui/list_columns/ContextMenu',[
- '../../../lib/@waca/core-client/js/core-client/utils/Utils',
- '../../../nls/StringResource',
- './BaseIcon',
- 'underscore'
- ], function(Utils, StringResource, BaseIcon, _) {
- 'use strict';
- var ContextMenu = BaseIcon.extend({
- init: function(options) {
- ContextMenu.inherited('init', this, arguments);
- _.extend(this, options);
- this.clickCallback = this.onContextMenu;
- this.a11yLabel = StringResource.get('moreActionsMenu');
- },
- getSpec: function(){
- return ContextMenu.inherited('getSpec', this, arguments).then(function(spec){
- spec.name = 'properties';
- return spec;
- });
- },
- createObjectImg: function(){
- var $div = $('<div></div>', {
- 'class': 'ellipsesButton forceRowSelection',
- 'title': StringResource.get('more'),
- 'tabindex': '-1'
- });
- Utils.setIcon($div, 'common-menuoverflow');
- return $div;
- }
- });
- return ContextMenu;
- });
- /*
- *+------------------------------------------------------------------------+
- *| Licensed Materials - Property of IBM
- *| IBM Cognos Products: Content Explorer
- *| (C) Copyright IBM Corp. 2015, 2018
- *|
- *| US Government Users Restricted Rights - Use, duplication or disclosure
- *| restricted by GSA ADP Schedule Contract with IBM Corp.
- *+------------------------------------------------------------------------+
- */
- define('bacontentnav/common/ui/list_columns/Location',[
- '../../../utils/ContentStoreObject',
- '../../../lib/@waca/core-client/js/core-client/utils/ContentFormatter',
- './Column',
- '../../../nls/StringResource',
- 'underscore'
- ], function(ContentStoreObject, ContentFormatter, Column, StringResource,_) {
- 'use strict';
- var Location = Column.extend({
- getSpec: function() {
- return Promise.resolve({
- 'name': 'location',
- 'label': StringResource.get('location'),
- 'headerClass': 'location',
- 'mData': this.getData.bind(this),
- 'sClass': 'location',
- 'weight': 20,
- 'fnCreatedCell': this.createEllipseCell.bind(this),
- 'formatContent': this.processTextForEllipses.bind(this)
- });
- },
- _getData: function(oRowData) {
- return _.escape(ContentStoreObject.getLocation(oRowData));
- },
- addClickAction: function($div, nParent, sData, oData) {
- if (this.clickCallback) {
- $div.addClass(this.showAsActiveLink !== false ? 'active' : 'clickable');
- $div.attr('role', 'link');
- $div.on('primaryaction', function(evt) {
- void(evt);
- this.clickCallback(oData);
- }.bind(this));
- }
- }
- });
- return Location;
- });
- /*
- *+------------------------------------------------------------------------+
- *| Licensed Materials - Property of IBM
- *| IBM Cognos Products: Content Explorer
- *| (C) Copyright IBM Corp. 2015, 2018
- *|
- *| US Government Users Restricted Rights - Use, duplication or disclosure
- *| restricted by GSA ADP Schedule Contract with IBM Corp.
- *+------------------------------------------------------------------------+
- */
- define('bacontentnav/common/ui/list_columns/MultipleProperties',[
- 'require',
- '../../../utils/ContentStoreObject',
- './Column'
- ], function(LocalRequire, ContentStoreObject, Column) {
- 'use strict';
- /**
- @param options.items [objects] - array of properties to display
- @param options.weight {number} - Weight of the column
- @param options.orientation {string} - [horizontal | vertical] Orientation display, defaults to 'vertical'
- **/
- var MultipleProperties = Column.extend({
- getSpec: function() {
- this._oProperties = [];
- var aPromises = [];
- // Loop through all the items and create an object for them
- $.each(this.items, function(index, item) {
- if (item.type) {
- var path = item.module || './' + item.type;
- aPromises.push(new Promise(function(resolve) {
- LocalRequire([path], function(Module) {
- // Create the column object and save it in the item object for reference later
- item.obj = this.getListControl().createColumnObject(item, Module);
- item.obj.getSpec().then(function(spec) {
- item.spec = spec;
- resolve();
- });
- }.bind(this));
- }.bind(this)));
- }
- }.bind(this));
- // We've loaded all the columns
- return Promise.all(aPromises).then(function() {
- return {
- 'name': this.items[0].spec.name,
- 'label': this.items[0].spec.label,
- 'sClass': 'nowrap',
- 'weight': this.weight || 20,
- 'fnCreatedCell': this.createCell.bind(this),
- 'mData': this.getData.bind(this),
- 'formatContent': this.formatContent.bind(this)
- };
- }.bind(this));
- },
- /**
- Need this so that the column gets correctly sorted. Currently,
- all the UX spec have the name first in these types of columns
- **/
- _getData: function(oRowData) {
- if (this.items[0].spec.mData) {
- return this.items[0].spec.mData(oRowData);
- } else {
- // Default to Name
- return oRowData[ContentStoreObject.DEFAULT_NAME];
- }
- },
- createCell: function(parentNode, sData, oData) {
- var horizontal = this.orientation === 'horizontal';
- var $parentNode = $(parentNode);
- $parentNode.empty();
- if (!horizontal) {
- $parentNode.addClass('multiProp');
- } else {
- $parentNode.addClass('multiPropHorizontal');
- }
- $.each(this.items, function(index, item) {
- // Each sub property will be contained in a div
- var $div = $('<div>').addClass(item.type.toLowerCase());
- if (horizontal) {
- $div.addClass('textDivInline');
- } else {
- $div.addClass('textDiv');
- }
- $parentNode.append($div);
- // Call the properties 'createCell' method passing the div as the parent
- item.spec.fnCreatedCell($div[0], item.obj.getData(oData), oData);
- });
- },
- /**
- Some properties have special formating needs, loop through all the properties
- and call their 'formatContent' methods
- **/
- formatContent: function(nTd) {
- var $nTd = $(nTd);
- $.each(this.items, function(index, item) {
- if (item.spec.formatContent) {
- var itemContainer = $nTd.find('.' + item.type.toLowerCase());
- if (itemContainer.length) {
- item.spec.formatContent(itemContainer);
- }
- }
- });
- }
- });
- return MultipleProperties;
- });
- /*
- *+------------------------------------------------------------------------+
- *| Licensed Materials - Property of IBM
- *| IBM Cognos Products: Content Explorer
- *| (C) Copyright IBM Corp. 2015, 2019
- *|
- *| US Government Users Restricted Rights - Use, duplication or disclosure
- *| restricted by GSA ADP Schedule Contract with IBM Corp.
- *+------------------------------------------------------------------------+
- */
- define('bacontentnav/common/ui/list_columns/Name',[
- 'underscore',
- './Column',
- '../list_actions/DefaultAction',
- '../list_actions/DefaultActionHandler',
- '../../../utils/ContentStoreObject',
- '../../../nls/StringResource',
- '../../../utils/UIHelper',
- '../../../lib/@waca/core-client/js/core-client/ui/KeyCodes'
- ], function(_, Column, DefaultAction, DefaultActionHandler, ContentStoreObject, StringResource, UIHelper, KeyCodes) {
- 'use strict';
- /**
- options.navigateCallback {function} - function to call when the user clicks on a container. The link to navigate to and breadcrumb information will be passed in the callback
- **/
- var Name = Column.extend({
- _bNavigable: true,
- getSpec: function() {
- return Promise.resolve({
- 'name': 'name',
- 'label': StringResource.get('name'),
- 'headerClass': 'name',
- 'mData': this.getData.bind(this),
- 'sClass': 'name',
- 'weight': 20,
- 'fnCreatedCell': this.createEllipseCell.bind(this),
- 'formatContent': this.processTextForEllipses.bind(this),
- 'type': 'natural-ci'
- });
- },
- _getData: function(oRowData) {
- return _.escape(oRowData[ContentStoreObject.DEFAULT_NAME]);
- },
- addClickAction: function($div, nParent, sData, oData) {
- return new Promise(function(resolve /*, reject*/ ) {
- var objType = ContentStoreObject.getType(oData);
- var listControl = this.getListControl();
- if (!this.navigateOnly || (UIHelper.isContainer(objType) && !listControl.singleSelectCallback)) {
- var promise;
- var defaultAction = new DefaultAction({
- 'glassContext': this.glassContext,
- 'oData': oData,
- 'listControl': listControl
- });
- // Search results don't return any permissions, so always show the item as a link
- if (UIHelper.isValid(oData)) {
- promise = oData[ContentStoreObject.PERMISSIONS] ? defaultAction.canExecute() : Promise.resolve(true);
- } else {
- promise = Promise.resolve(false);
- }
- // If the promise is resolved
- promise.then(function(defaultAction, bCanExecute) {
- if (bCanExecute) {
- $div.on('primaryaction', function(bCanExecute, evt) {
- if (evt.shiftKey || evt.ctrlKey || evt.metaKey) {
- resolve();
- return; // shortcut the action
- } else if (evt.which === KeyCodes.SPACE) { // why?
- // so _selectRow can hide properties page
- this.listControl.contentView.propertiesOverride = true;
- // hide slideout on launch if not navigating
- if (!UIHelper.isContainer(objType)) {
- this.glassContext.appController.hideSlideOut();
- }
- } else {
- DefaultActionHandler.executeAction({
- evt: evt,
- oData: oData,
- listControl: listControl,
- glassContext: this.glassContext,
- action: defaultAction
- });
- }
- }.bind(this, defaultAction));
- $div.addClass('active').attr('role', 'link');
- }
- resolve();
- }.bind(this, defaultAction)).catch(function() {
- // Can't execute, just ignore the rejected promise
- resolve();
- });
- } else {
- if (UIHelper.isContainer(objType) && ContentStoreObject.hasPermissions(oData, ['traverse'])) {
- $div.addClass('active').attr('role', 'link');
- }
- resolve();
- }
- // add 'idle' class for automation
- if (ContentStoreObject.getDisabled(oData) || !UIHelper.isValid(oData) ||
- (this.listControl && !UIHelper.hasRequiredCapabilities(oData, this.listControl.typesToOpen, this.listControl.capabilitiesRequired))) {
- $div.addClass('dimmed idle');
- $div.parent().parent().addClass('dimmed idle'); // this looks unsafe?
- }
- }.bind(this));
- }
- });
- return Name;
- });
- /*
- *+------------------------------------------------------------------------+
- *| Licensed Materials - Property of IBM
- *| IBM Cognos Products: Content Explorer
- *| (C) Copyright IBM Corp. 2015, 2018
- *|
- *| US Government Users Restricted Rights - Use, duplication or disclosure
- *| restricted by GSA ADP Schedule Contract with IBM Corp.
- *+------------------------------------------------------------------------+
- */
- define('bacontentnav/common/ui/list_columns/Owner',[
- '../../../utils/ContentStoreObject',
- '../../../nls/StringResource',
- './Column',
- 'underscore'
- ], function(ContentStoreObject, StringResource, Column, _) {
- 'use strict';
- var Owner = Column.extend({
- getSpec: function() {
- return Promise.resolve({
- 'name': 'owner',
- 'label': StringResource.get('owner'),
- 'sClass': 'nowrap',
- 'weight': 10,
- 'mData': this.getData.bind(this),
- 'fnCreatedCell': this.createCell.bind(this)
- });
- },
- _getData: function(oRowData) {
- return _.escape(ContentStoreObject.getOwnerName(oRowData));
- }
- });
- return Owner;
- });
- /*
- *+------------------------------------------------------------------------+
- *| Licensed Materials - Property of IBM
- *| IBM Cognos Products: Content Explorer
- *| (C) Copyright IBM Corp. 2015, 2018
- *|
- *| US Government Users Restricted Rights - Use, duplication or disclosure
- *| restricted by GSA ADP Schedule Contract with IBM Corp.
- *+------------------------------------------------------------------------+
- */
- define('bacontentnav/common/ui/list_columns/Text',[
- '../../../nls/StringResource',
- './Column',
- 'underscore'
- ], function(StringResource, Column,_) {
- 'use strict';
- /**
- Generic class that display the property as text
- **/
- var Text = Column.extend({
- /**
- @param options.propertyName {string} - name of the property where the text can be found
- @param options.label {string} - Optional, the column header
- @param options.clickCallback {function} - Optional, callback function to call when the user clicks on the text
- @param options.showAsActiveLink {boolean} - Optional, if the text should be blue or not. Default is true if clickCallback is specified
- **/
- init: function(options) {
- Text.inherited('init', this, arguments);
- _.extend(this, options);
- },
- getSpec: function() {
- return Promise.resolve({
- 'name': this.propertyName,
- 'label': this.label,
- 'sClass': 'nowrap',
- 'weight': 10,
- 'mData': this.getData.bind(this),
- 'fnCreatedCell': this.createEllipseCell.bind(this),
- 'formatContent': this.processTextForEllipses.bind(this),
- 'visible': this.visible
- });
- },
- _getData: function(oRowData) {
- return _.escape(oRowData[this.propertyName]) || '';
- },
- addClickAction: function($div, nParent, sData, oData) {
- if (this.clickCallback) {
- $div.addClass(this.showAsActiveLink !== false ? 'active' : 'clickable');
- $div.attr('role', 'link');
- $div.on('primaryaction', function(evt) {
- // Only perform an action if no item is in creation mode (i.e. NewFolder) and we're not doing multiselect
- if (evt.shiftKey || evt.ctrlKey || evt.metaKey || this.listControl.isMultitouchActive()) {
- return;
- }
- this.clickCallback(oData);
- }.bind(this));
- }
- }
- });
- return Text;
- });
- /*
- *+------------------------------------------------------------------------+
- *| Licensed Materials - Property of IBM
- *| IBM Cognos Products: Content Explorer
- *| (C) Copyright IBM Corp. 2015, 2018
- *|
- *| US Government Users Restricted Rights - Use, duplication or disclosure
- *| restricted by GSA ADP Schedule Contract with IBM Corp.
- *+------------------------------------------------------------------------+
- */
- define('bacontentnav/common/ui/list_columns/Permission',[
- '../../../utils/ContentStoreObject',
- '../../../lib/@waca/core-client/js/core-client/utils/ContentFormatter',
- '../../../nls/StringResource',
- './Text',
- '../../../utils/ContentManagement',
- '../../../utils/PolicyHelper'
- ], function(ContentStoreObject, ContentFormatter, StringResource, Text, ContentManagement, PolicyHelper) {
- 'use strict';
- /**
- options.navigateCallback {function} - function to call when the user clicks on a container. The link to navigate to and breadcrumb information will be passed in the callback
- **/
- var Permission = Text.extend({
- getSpec: function() {
- return Promise.resolve({
- 'name': 'policy',
- 'label': StringResource.get('permissionHeader'),
- 'headerClass': 'name',
- 'mData': this.getData.bind(this),
- 'sClass': 'name',
- 'weight': 10,
- 'fnCreatedCell': this.createEllipseCell.bind(this),
- 'formatContent': this.processTextForEllipses.bind(this)
- });
- },
- _getData: function(oRowData) {
- return PolicyHelper.getSimplifiedPermissions(oRowData.permissions);
- },
- addClickAction: function($div, nParent, sData, oData) {
- if (this.clickCallback) {
- $div.addClass(this.showAsActiveLink !== false ? 'active' : 'clickable');
- $div.attr('role', 'link');
- $div.on('primaryaction', function(evt) {
- // Only perform an action if no item is in creation mode (i.e. NewFolder) and we're not doing multiselect
- if (evt.shiftKey || evt.ctrlKey || evt.metaKey || this.listControl.isMultitouchActive()) {
- return;
- }
- /*jshint unused: false */
- this.clickCallback(oData);
- }.bind(this, oData));
- }
- }
- });
- return Permission;
- });
- /*
- *+------------------------------------------------------------------------+
- *| Licensed Materials - Property of IBM
- *| IBM Cognos Products: Content Explorer
- *| (C) Copyright IBM Corp. 2016, 2018
- *|
- *| US Government Users Restricted Rights - Use, duplication or disclosure
- *| restricted by GSA ADP Schedule Contract with IBM Corp.
- *+------------------------------------------------------------------------+
- */
- define('bacontentnav/common/ui/list_columns/RadioButtons',[
- '../../../lib/@waca/core-client/js/core-client/utils/Utils',
- './BaseIcon'
- ], function(Utils, Icon) {
- 'use strict';
- var RadioButtons = Icon.extend({
- createObjectImg: function() {
- var $div = $('<div>', {
- role: 'img',
- tabindex: '-1',
- 'class': 'roundButton'
- });
- var $svg = $('<svg><circle class="outer" cx="8" cy="8" r="7"></circle><circle class="radioBtn inner" cx="8" cy="8" r="5"></circle></svg>');
- $div.html($svg);
- return $div;
- }
- });
- return RadioButtons;
- });
- /*
- *+------------------------------------------------------------------------+
- *| Licensed Materials - Property of IBM
- *| IBM Cognos Products: Content Explorer
- *| (C) Copyright IBM Corp. 2017, 2018
- *|
- *| US Government Users Restricted Rights - Use, duplication or disclosure
- *| restricted by GSA ADP Schedule Contract with IBM Corp.
- *+------------------------------------------------------------------------+
- */
- define('bacontentnav/common/ui/list_columns/Tenant',[
- '../../../utils/ContentStoreObject',
- '../../../nls/StringResource',
- './Column',
- 'underscore'
- ], function(ContentStoreObject, StringResource, Column, _) {
- 'use strict';
- var Tenant = Column.extend({
- _bNavigable: true,
- getSpec: function() {
- return Promise.resolve({
- 'name': 'tenantName',
- 'label': StringResource.get('tenant'),
- 'headerClass': 'name',
- 'mData': this.getData.bind(this),
- 'sClass': 'name',
- 'weight': 15,
- 'fnCreatedCell': this.createEllipseCell.bind(this),
- 'formatContent': this.processTextForEllipses.bind(this),
- 'type': 'natural-ci'
- });
- },
- _getData: function(oRowData) {
- return this._getTenantNameByID(_.escape(oRowData[ContentStoreObject.TENANT_ID]));
- },
- _getTenantNameByID: function(tenantID) {
- var tenantName;
- if (tenantID === '') {
- tenantName = tenantID;
- } else {
- var tenants = this.glassContext.getCoreSvc('.UserProfile').tenants;
- var tenant = _.find(tenants, function(tenant){
- return tenant.tenantID === tenantID;
- });
- if (tenant) {
- tenantName = tenant.defaultName;
- } else {
- tenantName = tenantID;
- }
- }
- return _.escape(tenantName);
- }
- });
- return Tenant;
- });
- /*
- *+------------------------------------------------------------------------+
- *| Licensed Materials - Property of IBM
- *| IBM Cognos Products: Content Explorer
- *| (C) Copyright IBM Corp. 2015, 2017
- *|
- *| US Government Users Restricted Rights - Use, duplication or disclosure
- *| restricted by GSA ADP Schedule Contract with IBM Corp.
- *+------------------------------------------------------------------------+
- */
- define('bacontentnav/common/ui/list_columns/Time',[
- '../../../utils/ContentStoreObject',
- '../../../nls/StringResource',
- './Column',
- '../../../lib/@waca/core-client/js/core-client/utils/DateTimeUtils',
- '../../../utils/GlassContextHelper',
- 'underscore'
- ], function(ContentStoreObject, StringResource, Column, DateTimeUtils, GlassContextHelper, _) {
- 'use strict';
- /**
- Class that knows how to correctly format time
- **/
- var Time = Column.extend({
- COLUMN_LABELS: {
- 'modificationTime': StringResource.get('modificationTime'),
- 'timestamp': StringResource.get('lastUsed')
- },
- displayInline: false,
- /**
- @param options.propertyName {string} - name of the property where the GMT time can be found in the JSON response
- @param options.label {string} - Optional, the Time class knows the label for the most common time properties.
- @param options.displayInline {boolean} - optional, if the time is diaplayed in a line
- **/
- init: function(options) {
- Time.inherited('init', this, arguments);
- _.extend(this, options);
- if (!this.label) {
- this.label = this.COLUMN_LABELS[this.propertyName];
- }
- },
- getSpec: function() {
- return Promise.resolve({
- 'name': this.propertyName,
- 'label': this.label,
- 'sClass': 'nowrap',
- 'width': '100px',
- 'mData': this.getData.bind(this),
- 'fnCreatedCell': this.createCell.bind(this),
- 'visible': this.visible
- });
- },
- _getData: function(oRowData) {
- return oRowData[this.propertyName] || '';
- },
- createCell: function(parentNode, sData) {
- var $parent = $(parentNode);
- if (sData === '') {
- $parent.text('---');
- } else {
- var date = DateTimeUtils.formatDate(sData, 'short', GlassContextHelper.getLocaleTime(this.glassContext)).toString();
- var time = DateTimeUtils.formatTime(sData, 'short', GlassContextHelper.getLocaleTime(this.glassContext)).toString();
- if (this.displayInline) {
- var timestamp = [date, time].join(' ');
- var $timestamp = $('<div>', {
- 'text': timestamp,
- 'class': 'modifiedTime displayInline'
- });
- $parent.text('');
- $parent.append($timestamp);
- } else {
- var $date = $('<div>').text(date);
- var $time = $('<div>', {
- 'text': time,
- 'class': 'modifiedTime'
- });
- $parent.text('');
- $parent.append($date, $time);
- }
- }
- }
- });
- return Time;
- });
- /*
- *+------------------------------------------------------------------------+
- *| Licensed Materials - Property of IBM
- *| IBM Cognos Products: Content Explorer
- *| (C) Copyright IBM Corp. 2017
- *|
- *| US Government Users Restricted Rights - Use, duplication or disclosure
- *| restricted by GSA ADP Schedule Contract with IBM Corp.
- *+------------------------------------------------------------------------+
- */
- // This file is used to create the require.js layers. Only the entry points are necessary
- define('bacontentnav/common/ui/list_columns/all',[
- './AccountIcon',
- './BirdBeakMenu',
- './ClickableIcon',
- './ContextMenu',
- './Location',
- './MultipleProperties',
- './Name',
- './Owner',
- './Permission',
- './RadioButtons',
- './Tenant',
- './Time'
- ], function() {
- 'use strict';
- });
- /*
- *+------------------------------------------------------------------------+
- *| Licensed Materials - Property of IBM
- *| IBM Cognos Products: ba-content-nav
- *| (C) Copyright IBM Corp. 2018
- *|
- *| US Government Users Restricted Rights - Use, duplication or disclosure
- *| restricted by GSA ADP Schedule Contract with IBM Corp.
- *+------------------------------------------------------------------------+
- */
- define('bacontentnav/common/ui/list_actions/TargetListAction',[
- './ListAction'
- ], function(ListAction) {
- 'use strict'; //NOSONAR
- /**
- * This list action should try to use the original target of the action (the event target), and not one provided via indirection, such as through a shortcut.
- */
- var TargetListAction = ListAction.extend({
- getSelectedContext: function(options) {
- // if available, return the event target selected context
- var activeObject = options && options.target && options.target.activeObject;
- return activeObject && (activeObject.targetSelectedContext || activeObject.aSelectedContext);
- }
- });
- return TargetListAction;
- });
- /*
- *+------------------------------------------------------------------------+
- *| Licensed Materials - Property of IBM
- *| IBM Cognos Products: Content Explorer
- *| (C) Copyright IBM Corp. 2017, 2020
- *|
- *| US Government Users Restricted Rights - Use, duplication or disclosure
- *| restricted by GSA ADP Schedule Contract with IBM Corp.
- *+------------------------------------------------------------------------+
- */
- define('bacontentnav/ui/dialogs/ErrorDialog',[
- '../../lib/@waca/core-client/js/core-client/ui/core/Class',
- '../../nls/StringResource',
- 'jquery',
- 'underscore'
- ], function(Class, StringResource, $, _) {
- var Dialog = null;
- Dialog = Class.extend({
- _buttons: ['ok'],
- init: function(options) {
- void(Class);
- this._options = options;
- _.defaults(this._options, { details: true });
- Dialog.inherited('init', this, [this._options]);
- },
- open: function() {
- this._options.glassContext.showMessage(this.renderContent(), this._options.title, 'error', this._buttons, this._options.width, undefined, true, 'errorDialog');
- },
- renderContent: function() {
- var node = $('<div>');
- if (this._options.details && this._options.msg) {
- node.append('<h3>' + StringResource.get('details') + '</h3>');
- node.append(
- $('<textarea>', {
- 'class': 'errorDetails',
- 'html': _.escape(this._options.msg)
- })
- );
- } else {
- node.append(
- $('<div>', {
- 'class': 'messageBox ' + this.type,
- 'html': _.escape(this._options.msg)
- })
- );
- }
- return node.html();
- }
- });
- return Dialog;
- });
- /*
- *+------------------------------------------------------------------------+
- *| Licensed Materials - Property of IBM
- *| IBM Cognos Products: Content Explorer
- *| (C) Copyright IBM Corp. 2015, 2020
- *|
- *| US Government Users Restricted Rights - Use, duplication or disclosure
- *| restricted by GSA ADP Schedule Contract with IBM Corp.
- *+------------------------------------------------------------------------+
- */
- define('bacontentnav/common/ui/list_actions/DeleteAction',[
- 'underscore',
- './TargetListAction',
- '../../../lib/@waca/core-client/js/core-client/utils/BidiUtil',
- '../../../utils/ContentServiceUrls',
- '../../../utils/ContentStoreObject',
- '../../../utils/GlassContextHelper',
- '../../../nls/StringResource',
- '../../../lib/@waca/core-client/js/core-client/ui/dialogs/ConfirmationDialog',
- '../../../ui/dialogs/ErrorDialog'
- ], function(_, TargetListAction, BidiUtil, ContentServiceUrls, ContentStoreObject, GlassContextHelper, StringResource, ConfirmationDialog, ErrorDialog) {
- 'use strict'; //NOSONAR
- var itemsToDelete = [];
- var DeleteAction = TargetListAction.extend({
- isItemVisible: function(options) {
- if (DeleteAction.inherited('isItemVisible', this, [options])) {
- var selectedContext = this.getSelectedContext(options);
- if (selectedContext) {
- return _.every(selectedContext, function(selection) {
- return ContentStoreObject.hasPermissions(selection, ['write']);
- });
- }
- }
- return false;
- },
- execute: function(options) {
- var aSelectionContext = this.getSelectedContext(options);
- if (!aSelectionContext) {
- return;
- }
- //create array of intersection of items waiting to be deleted and items currently selected
- var commonValues = _.filter(aSelectionContext, function (item1) {
- return _.some(this, function (item2) {
- return item1.id === item2.id;
- });
- }, itemsToDelete);
- //check if intersection is greater than 0, if it is show error dialog and return
- if(commonValues.length > 0){
- this.showDuplicateDeleteError(options.glassContext);
- return;
- }
- var listControl = this.getListControl(options);
- var unableDeleteIndex = [];
- var totalSelectedItems = aSelectionContext.length;
- aSelectionContext = _.filter(aSelectionContext, function(el, index) {
- if (ContentStoreObject.hasPermissions(el, ['write'])) {
- return true;
- }
- unableDeleteIndex.push(index);
- return false;
- });
- var oDialog;
- if (aSelectionContext.length === totalSelectedItems) {
- oDialog = new ConfirmationDialog('confirmDelete', StringResource.get('confirmDelete'), StringResource.get('confirmDeleteMessage'));
- } else {
- var unableDelete = totalSelectedItems - aSelectionContext.length;
- oDialog = new ConfirmationDialog('confirmDelete', StringResource.get('confirmDelete'), StringResource.get('confirmDeleteAllowed', {
- number: unableDelete
- }));
- }
- oDialog.ok = this.onOk.bind(oDialog, listControl);
- oDialog.cancel = this.onCancel.bind(oDialog, listControl);
- oDialog.confirm(this.onConfirm.bind(this, aSelectionContext, options, unableDeleteIndex));
- oDialog.renderContent($('<div>'));
- oDialog._container().addClass('contentDeleteConfirmDialog');
- },
- onOk: function(listControl) {
- if (listControl && listControl.getSelectedRows) {
- // On OK focus to the next row after deletion, if there is no next row, focus to the previous row.
- var firstRow = $(listControl.getSelectedRows()[0]);
- if (firstRow.next().length) {
- firstRow = firstRow.next();
- } else if (firstRow.prev().length) {
- firstRow = firstRow.prev();
- }
- this.setLaunchPoint(firstRow.find('.ellipsesButton_cell')[0]);
- }
- ConfirmationDialog.inherited('ok', this, arguments);
- if (this._confirmCallback) {
- this._confirmCallback();
- }
- },
- onCancel: function(listControl) {
- if (listControl && listControl.getSelectedRows) {
- this.setLaunchPoint($(listControl.getSelectedRows()[0]).find('.ellipsesButton_cell')[0]);
- }
- ConfirmationDialog.inherited('cancel', this, arguments);
- if (this._cancelCallback) {
- this._cancelCallback();
- }
- },
- onConfirm: function(aSelectionContext, options, unableDeleteIndex) {
- itemsToDelete = aSelectionContext;
- var glassContext = options.glassContext;
- var eventRouter = glassContext.getCoreSvc('.Events');
- var url, sText;
- var listControl = this.getListControl(options);
- if (listControl && !options.target.activeObject.renderFromReact) {
- listControl.aSelectedRows = _.filter(listControl.aSelectedRows, function(el, index) {
- return !_.contains(unableDeleteIndex, index);
- });
- }
- if (aSelectionContext.length === 1) {
- url = ContentStoreObject.getSelfLink(aSelectionContext[0]) + '?force=true&recursive=true';
- sText = StringResource.get('toastDoneDeletingSingular', {
- 'nameOfItem': BidiUtil.enforceTextDirection(aSelectionContext[0].defaultName)
- });
- } else {
- for (var i = 0; i < aSelectionContext.length; i += 1) {
- if (i === 0) {
- url = ContentServiceUrls.getBaseObjectsURL() + '?ids=' + aSelectionContext[i].id;
- } else {
- url += ',' + aSelectionContext[i].id;
- }
- }
- url += '&force=true&recursive=true';
- sText = StringResource.get('toastDoneDeleting', {
- 'noOfItems': aSelectionContext.length
- });
- }
- eventRouter.trigger('deleteAction:begin', aSelectionContext);
- glassContext.getCoreSvc('.Ajax').ajax({
- 'dataType': 'json',
- 'type': 'DELETE',
- 'url': url
- }).then(function() {
- itemsToDelete = [];
- if (listControl && !options.target.activeObject.renderFromReact) {
- listControl.removeSelectedRows();
- if (listControl.contentView.slideout && listControl.contentView.slideout.child) {
- listControl.contentView.slideout.child.remove();
- }
- }
- aSelectionContext.forEach(function(context) {
- glassContext.getSvc('.Content').then(function(contentSvc){
- contentSvc.removeFromMRU(context);
- });
- });
- GlassContextHelper.displayToast(glassContext, sText);
- eventRouter.trigger('deleteAction:done', aSelectionContext);
- if (options.target.activeObject.onDelete){
- options.target.activeObject.onDelete(aSelectionContext);
- }
- })
- .catch(function(err) {
- if(err && err.requestInfo.jqXHR.responseJSON.errorCode === 'caf'){
- var options = {
- 'type': 'repeatedDeleteError',
- 'title': StringResource.get('repeatedDeleteError'),
- 'msg': err.jqXHR.responseJSON.messages.join('\n'),
- 'width': '600px',
- 'glassContext': glassContext
- };
- var eDialog = new ErrorDialog(options);
- eDialog.open();
- } else {
- GlassContextHelper.showAjaxServiceError(glassContext, err);
- }
- eventRouter.trigger('deleteAction:fail', aSelectionContext);
- });
- },
- showDuplicateDeleteError: function(glassContext){
- var errorDialogOptions = {
- 'type': 'repeatedDeleteError',
- 'title': StringResource.get('repeatedDeleteErrorTitle'),
- 'msg': StringResource.get('repeatedDeleteError'),
- 'width': '600px',
- 'glassContext': glassContext
- };
- var eDialog = new ErrorDialog(errorDialogOptions);
- eDialog.open();
- }
- });
- return DeleteAction;
- });
- /**
- * Licensed Materials - Property of IBM
- * IBM Cognos Products: BI Cloud (C) Copyright IBM Corp. 2017
- * US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
- */
- define('bacontentnav/common/ui/ContentGenericDialog',['../../lib/@waca/core-client/js/core-client/ui/dialogs/GenericViewDialog', 'underscore'], function(GenericViewDialog, _) {
- 'use strict';
- /**
- Dialog that renders a generic view:
- the view should implement:
- getButtonSpec: returns a button spec in the form that Gemini BaseDialog would accept
- this dialog gets passed into the view through options in the constructor(options.dialog)
- this dialog exposes the jquery nodes of the buttons through the {defaultId,value} map
- **/
- var ContentGenericDialog = GenericViewDialog.extend({
- /**
- @constructor
- @param options.title - title displayed at the top of the dialog
- @param options.module - module for the view to be displayed inside of the dialog (this module should implement fn:getButtonSpec)
- @param options.viewOtpions - options that are to be passed into the constructor of module (above)
- @param options.cssClass - css class string that will be appended to the modalDialog div
- **/
- init: function(options) {
- ContentGenericDialog.inherited('init', this, arguments);
- this.title = options.title;
- this.viewClass = options.viewClass;
- this.viewOptions = options.viewOptions;
- this.buttonNodes = {};
- this.cssClass = options.cssClass || '';
- this.view = new this.viewClass(_.extend(this.viewOptions, {
- 'dialog': this
- }));
- if (this.view.getButtonSpec) {
- this._buttons = this.view.getButtonSpec(options);
- }
- },
- show: function() {
- ContentGenericDialog.inherited('show', this, arguments);
- this._container().find('.modalDialog').addClass(this.cssClass);
- },
- enableButton: function(id) {
- var button = this._container().find('.dialogButton.' + id);
- button.removeClass('disabled');
- button.attr('tabindex', '0');
- button.attr('aria-disabled', 'false');
- },
- disableButton: function(id) {
- var button = this._container().find('.dialogButton.' + id);
- button.addClass('disabled');
- button.attr('tabindex', '-1');
- button.attr('aria-disabled', 'true');
- }
- });
- return ContentGenericDialog;
- });
- /*
- *+------------------------------------------------------------------------+
- *| Licensed Materials - Property of IBM
- *| IBM Cognos Products: Content Explorer
- *| (C) Copyright IBM Corp. 2015, 2020
- *|
- *| US Government Users Restricted Rights - Use, duplication or disclosure
- *| restricted by GSA ADP Schedule Contract with IBM Corp.
- *+------------------------------------------------------------------------+
- */
- define('bacontentnav/ui/dialogs/CopyMoveDialog',[
- '../../nls/StringResource',
- '../../utils/ContentStoreObject',
- '../../lib/@waca/core-client/js/core-client/utils/ContentFormatter',
- '../../common/ui/ContentGenericDialog',
- '../../lib/@waca/core-client/js/core-client/utils/BidiUtil'
- ], function(StringResource, ContentStoreObject, ContentFormatter, ContentGenericDialog, BidiUtil) {
- 'use strict'; //NOSONAR
- var CopyMoveDialog = ContentGenericDialog.extend({
- _bShortenTitle: false,
- _subtitleNode: null,
- init: function() {
- CopyMoveDialog.inherited('init', this, arguments);
- },
- renderTitle: function(node) {
- var inputObjects = this.view.inputObjects;
- var titleRow = $('<div>', {
- 'class': 'copyMoveDialogTitleRow'
- });
- node.append(titleRow);
- var title = $('<div>', {
- 'class': 'copyMoveDialogTitle'
- }).text(CopyMoveDialog.getStaticPartOfDialogTitle(this.viewOptions.type));
- var subtitle = $('<div>', {
- 'class': 'copyMoveDialogSubtitle'
- });
- titleRow.append(title, subtitle);
- this._bShortenTitle = (inputObjects.length === 1);
- subtitle.text(CopyMoveDialog.getVariablePartOfDialogTitle(inputObjects));
- if (this._bShortenTitle) {
- subtitle.attr('dir', BidiUtil.resolveBaseTextDir(subtitle.text()));
- }
- this._subtitleNode = subtitle;
- return node;
- },
- show: function() {
- /*jshint unused: false */
- CopyMoveDialog.inherited('show', this, arguments);
- var container = this._container();
- container.addClass('copyMoveDialog');
- if (this._bShortenTitle) {
- ContentFormatter.middleShortenString(this._subtitleNode.get(0));
- }
- },
- cancel: function() {
- // TODO: revisit this - not all dialog views have a list control
- if (this.view.getListControl && typeof(this.view.getListControl) === 'function' && this.view.getListControl().cancelActions) {
- this.view.getListControl().cancelActions();
- }
- CopyMoveDialog.inherited('cancel', this, arguments);
- }
- });
- CopyMoveDialog.getVariablePartOfDialogTitle = function(inputObjects) {
- var sTitle;
- var noOfItems = inputObjects.length;
- if (noOfItems === 1) {
- sTitle = ContentStoreObject.getName(inputObjects[0]);
- } else {
- sTitle = StringResource.get('noOfItemSelected', {
- 'noOfItems': inputObjects.length
- });
- }
- return sTitle;
- };
- CopyMoveDialog.getStaticPartOfDialogTitle = function(dialogType) {
- var key = null;
- if(dialogType === 'copyMoveDialog') {
- key = 'copyMove';
- } else if(dialogType === 'shortcutDialog') {
- key = 'createShortcutDialogTitle';
- }
- return key !== null ? StringResource.get(key) : null;
- };
- CopyMoveDialog.getAriaLabelForDialogTitle = function(dialogType, inputObjects) {
- return CopyMoveDialog.getStaticPartOfDialogTitle(dialogType) + ' ' + CopyMoveDialog.getVariablePartOfDialogTitle(inputObjects);
- };
- return CopyMoveDialog;
- });
- /*
- *+------------------------------------------------------------------------+
- *| Licensed Materials - Property of IBM
- *| IBM Cognos Products: ba-content-nav
- *| (C) Copyright IBM Corp. 2015, 2018
- *|
- *| US Government Users Restricted Rights - Use, duplication or disclosure
- *| restricted by GSA ADP Schedule Contract with IBM Corp.
- *+------------------------------------------------------------------------+
- */
- define('bacontentnav/common/ui/list_actions/ManageContentAction',[
- 'require',
- 'underscore',
- './TargetListAction',
- '../../../ui/dialogs/CopyMoveDialog',
- '../../../utils/GlassContextHelper',
- '../../../utils/ContentStoreObject'
- ], function(LocalRequire, _, TargetListAction, CopyMoveDialog, GlassContextHelper, ContentStoreObject) {
- 'use strict'; //NOSONAR
- var ManageContentAction = TargetListAction.extend({
- isItemVisible: function(options) {
- if (ManageContentAction.inherited('isItemVisible', this, [options])) {
- var selectedContext = this.getSelectedContext(options);
- if (selectedContext) {
- return _.every(selectedContext, function(selection) {
- return ContentStoreObject.hasPermissions(selection, ['read', 'write', 'traverse']);
- });
- }
- }
- return false;
- },
- execute: function(options) {
- var inputObjects = this.getSelectedContext(options);
- var listControl = this.getListControl(options);
- if ((!listControl && options.target.activeObject.contentView && options.glassContext) || options.target.activeObject.renderFromReact) {
- listControl = {
- contentView: options.target.activeObject.contentView,
- glassContext: options.glassContext
- };
- }
- this._getAncestors(listControl, inputObjects).then(function(ancestors) {
- LocalRequire(['../../../ManageContentDialogView'], function(ManageContentDialogView) {
- var dialog = new CopyMoveDialog({
- 'viewClass': ManageContentDialogView,
- 'cssClass': 'contentListDialog',
- 'id': 'ca_copymovedialog',
- 'titleAriaLabel': CopyMoveDialog.getAriaLabelForDialogTitle(this._getModalType(), inputObjects),
- 'viewOptions': this.getCopyMoveDialogViewOptions(listControl, inputObjects, ancestors)
- });
- dialog.open();
- }.bind(this));
- }.bind(this));
- },
- // Return the options for when we open the CopyMoveDialog
- // can be overridden.
- getCopyMoveDialogViewOptions: function(listControl, inputObjects, ancestors) {
- return {
- 'glassContext': listControl.glassContext,
- 'type': this._getModalType(),
- 'ancestors': ancestors,
- 'showBreadcrumbs': true,
- 'url': listControl.contentView.url,
- 'selfUrl': listControl.contentView.selfUrl,
- 'inputObjects': inputObjects,
- 'showAddFolder': true,
- 'invokingListControl': listControl,
- 'moveDisabled': false
- };
- },
- _getAncestors: function(listControl, inputObjects) {
- var ancestors = listControl.contentView.getAncestors();
- if (ancestors && ancestors.length > 0) {
- return Promise.resolve(ancestors.slice());
- } else {
- // Only query for ancestors if all the input objects are from the same folder
- if (this._areAllInputObjectsFromSameFolder(inputObjects)) {
- return listControl.glassContext.getCoreSvc('.Ajax').ajax({
- url: ContentStoreObject.getSelfLink(inputObjects[0]),
- dataType: 'json',
- type: 'GET',
- data: {
- 'fields': 'ancestors'
- }
- })
- .then(function(response) {
- var data = response.data && response.data.data && response.data.data[0];
- // set the ancestors on each input object before returning them
- if (data && data.ancestors) {
- var ancestors = ContentStoreObject.getAncestors(data);
- _.each(inputObjects, function(inputObject) {
- inputObject.ancestors = ancestors.slice();
- });
- return Promise.resolve(ancestors.slice());
- } else {
- return Promise.resolve([]);
- }
- })
- .catch(function(err) {
- GlassContextHelper.showAjaxServiceError(this.glassContext, err);
- return Promise.reject(err);
- }.bind(this));
- } else {
- // We have a mix of input object locations, so do send any specific ancestor to the copy/move dialog
- return Promise.resolve([]);
- }
- }
- },
- _areAllInputObjectsFromSameFolder: function(inputObjects) {
- var inputObjectsAllFromSameFolder = true;
- for (var i = 1; i < inputObjects.length; i = i + 1) {
- if (inputObjects[0].formatedPath) {
- if (inputObjects[0].formatedPath !== inputObjects[i].formatedPath) {
- inputObjectsAllFromSameFolder = false;
- break;
- }
- } else {
- if (!ContentStoreObject.ancestorsEqual(inputObjects[0].ancestors, inputObjects[i].ancestors)) {
- inputObjectsAllFromSameFolder = false;
- break;
- }
- }
- }
- return inputObjectsAllFromSameFolder;
- },
- _getModalType: function() {
- return 'copyMoveDialog';
- }
- });
- return ManageContentAction;
- });
- /*
- *+------------------------------------------------------------------------+
- *| Licensed Materials - Property of IBM
- *| IBM Cognos Products: Content Explorer
- *| (C) Copyright IBM Corp. 2015, 2018
- *|
- *| US Government Users Restricted Rights - Use, duplication or disclosure
- *| restricted by GSA ADP Schedule Contract with IBM Corp.
- *+------------------------------------------------------------------------+
- */
- define('bacontentnav/common/ui/list_actions/ManageContentActionCopyOnly',[
- '../../../utils/ContentStoreObject',
- './ManageContentAction',
- 'underscore'
- ], function(ContentStoreObject, ManageContentAction, _) {
- 'use strict'; //NOSONAR
- var ManageContentActionCopyOnly = ManageContentAction.extend({
- isItemVisible: function(options) {
- var selectedContext = this.getSelectedContext(options);
- if (selectedContext) {
- return _.every(selectedContext, function(selection) {
- return ContentStoreObject.hasPermissions(selection, ['read']) && !ContentStoreObject.hasPermissions(selection, ['write', 'traverse']);
- });
- }
- },
- // returns the options for when we open the CopyMoveDialog
- // can be overriden.
- getCopyMoveDialogViewOptions: function(listControl, inputObjects, ancestors) {
- return {
- 'glassContext': listControl.glassContext,
- 'type': this._getModalType(),
- 'ancestors': ancestors,
- 'showBreadcrumbs': true,
- 'url': listControl.contentView.url,
- 'selfUrl': listControl.contentView.selfUrl,
- 'inputObjects': inputObjects,
- 'showAddFolder': true,
- 'invokingListControl': listControl,
- 'moveDisabled' : true
- };
- }
- });
- return ManageContentActionCopyOnly;
- });
- /*
- *+------------------------------------------------------------------------+
- *| Licensed Materials - Property of IBM
- *| IBM Cognos Products: Content Explorer
- *| (C) Copyright IBM Corp. 2015, 2018
- *|
- *| US Government Users Restricted Rights - Use, duplication or disclosure
- *| restricted by GSA ADP Schedule Contract with IBM Corp.
- *+------------------------------------------------------------------------+
- */
- define('bacontentnav/common/ui/list_actions/MRURemoveAction',[
- './ListAction'
- ], function(ListAction) {
- 'use strict';
- var MRURemoveAction = ListAction.extend({
- isItemVisible: function(options) {
- return this.hasStateID(options, 'CAMRUView');
- },
- execute: function(options) {
- var contentServicePromise = options.glassContext.getSvc('.Content');
- var aPromises = [];
- this.getSelectedContext(options).forEach(function(mruEntry) {
- aPromises.push(
- contentServicePromise.then(function(contentSvc){
- contentSvc.removeFromMRU(mruEntry);
- }));
- });
- return Promise.all(aPromises)
- .then(function() {
- this.getListControl().updateDatatable();
- this.getListControl().removeSelectedRows();
- }.bind(this));
- }
- });
- return MRURemoveAction;
- });
- /*
- *+------------------------------------------------------------------------+
- *| Licensed Materials - Property of IBM
- *| IBM Cognos Products: Content Explorer
- *| (C) Copyright IBM Corp. 2015, 2018
- *|
- *| US Government Users Restricted Rights - Use, duplication or disclosure
- *| restricted by GSA ADP Schedule Contract with IBM Corp.
- *+------------------------------------------------------------------------+
- */
- define('bacontentnav/common/ui/list_actions/NavigateContainerAction',[
- '../../../lib/@waca/core-client/js/core-client/ui/core/Class',
- '../../../utils/ContentStoreObject',
- 'underscore'
- ], function(Class, ContentStoreObject, _) {
- 'use strict';
- var NavigateContainerAction = Class.extend({
- init: function(options) {
- NavigateContainerAction.inherited('init', this, arguments);
- _.extend(this, options);
- },
- /**
- * We require traverse to be able to navigate into a container
- */
- canExecute: function(options) {
- var selectedContext = options.target.activeObject.aSelectedContext;
- return ContentStoreObject.hasPermissions(selectedContext[0], ['traverse']);
- },
- doAction: function(object) {
- var listControl = object.target.activeObject.oListControl;
- var selectedObjects = object.target.activeObject.aSelectedContext;
- if (listControl && selectedObjects.length === 1) {
- listControl.contentView.navigate(selectedObjects[0], listControl.getSelectedRows()[0]);
- return Promise.resolve();
- } else {
- return Promise.reject(new Error('No objects selected'));
- }
- }
- });
- return NavigateContainerAction;
- });
- /*
- *+------------------------------------------------------------------------+
- *| Licensed Materials - Property of IBM
- *| IBM Cognos Products: Content Explorer
- *| (C) Copyright IBM Corp. 2016, 2017
- *|
- *| US Government Users Restricted Rights - Use, duplication or disclosure
- *| restricted by GSA ADP Schedule Contract with IBM Corp.
- *+------------------------------------------------------------------------+
- */
- // This file is used to create the require layers. Only the entry points are necessary
- define('bacontentnav/common/ui/list_actions/all',[
- './AddFolderAction',
- './DefaultAction',
- './DeleteAction',
- './ManageContentAction',
- './ManageContentActionCopyOnly',
- './MRURemoveAction',
- './NavigateContainerAction'
- ], function() {
- 'use strict';
- });
- define('text!bacontentnav/common/templates/ContentViewSwitcherTemplate.html',[],function () { return '<div class="contentViewSwitcher{{?it.showRootFolderName}} showRootFolderName{{?}}">\n\t<table role="presentation">\n\t\t<tbody>\n\t\t\t{{~it.rows :row:index}}\n\t\t\t\t<tr role="button" tabindex="0" class="rootSelector{{=index}}">\n\t\t\t\t\t<td class="icon" {{?!it.showRootFolderName}}title="{{=_.escape(row.defaultName)}}"{{?}}>\n\t\t\t\t\t\t<svg class="svgIcon">\n\t\t\t\t\t\t\t<use style="pointer-events: none;" xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="{{=row.svgIcon}}"></use>\n\t\t\t\t\t\t</svg>\n\t\t\t\t\t</td>\n\t\t\t\t\t{{?it.showRootFolderName}}\n\t\t\t\t\t<td class="name">\n\t\t\t\t\t\t<div title="{{=_.escape(row.defaultName)}}" class="active">{{=_.escape(row.defaultName)}}</div>\n\t\t\t\t\t</td>\n\t\t\t\t\t{{?}}\n\t\t\t\t</tr>\n\t\t\t{{~}}\n\t\t</tbody>\n\t</table>\n</div>\n';});
- /*
- *+------------------------------------------------------------------------+
- *| Licensed Materials - Property of IBM
- *| IBM Cognos Products: Content Explorer
- *| (C) Copyright IBM Corp. 2015, 2020
- *|
- *| US Government Users Restricted Rights - Use, duplication or disclosure
- *| restricted by GSA ADP Schedule Contract with IBM Corp.
- *+------------------------------------------------------------------------+
- */
- define('bacontentnav/common/ContentSelectionDialogView',[
- 'text!./templates/ContentViewSwitcherTemplate.html',
- './ContentListPageView',
- '../nls/StringResource',
- '../utils/ContentStoreObject',
- '../lib/@waca/core-client/js/core-client/utils/ContentFormatter',
- '../utils/UIHelper',
- '../utils/ContentServiceUrls',
- '../lib/@waca/core-client/js/core-client/utils/BidiUtil',
- 'doT',
- '../lib/@waca/core-client/js/core-client/ui/KeyCodes',
- 'underscore'
- ], function(contentViewSwitcherTemplate, ContentListPageView, StringResource, ContentStoreObject, ContentFormatter, UIHelper, ContentServiceUrls, BidiUtil, dot, KeyCodes, _) {
- 'use strict';
- var ContentSelectionDialogView = ContentListPageView.extend({
- GROUP_BY_TYPE_COLUMN_INDEX: 4,
- stateId: 'ContentSelectionDialogView',
- showDestination: true,
- showRootFolderName: false,
- /**
- @options.showDestination {boolean} - default is true
- @options.showRootFolderName {boolean} - default is false
- @options.filterByTypes {string} - regular expression filter by content type(s). For example, if you want to only display folders, packages, and reports; set to "folder|package|report".
- @options.onClickItemCallback {function} - if you want to be notified when clicking an item on content list
- @options.dataManipulationCallback {function} - optional, called after the Ajax call to do any changes to the response before the datatable renders it
- **/
- init: function(options) {
- /*jshint unused: false */
- ContentSelectionDialogView.inherited('init', this, arguments);
- this.contentListSortIndexes = UIHelper.getConfiguration('sort').indexes;
- this.contentContainer = $('<div></div>', {
- 'class': 'dialogContentContainer'
- });
- this.contentListContainer = $('<div></div>', {
- 'class': 'contentListContainer'
- });
- this.$el.append(this.contentContainer);
- this.contentContainer.append(this.contentListContainer);
- var userProfileSettings = options.glassContext.getCoreSvc('.UserProfile') && options.glassContext.getCoreSvc('.UserProfile').userProfileSettings;
- var myContentHidden = userProfileSettings &&
- userProfileSettings.ui_excludedFeatures &&
- userProfileSettings.ui_excludedFeatures.ids &&
- userProfileSettings.ui_excludedFeatures.ids.indexOf('com.ibm.bi.contentApps.myContentFoldersSlideout') >= 0;
- var teamContentHidden = false;
- if (options.alwaysShowTeamContent !== true) {
- teamContentHidden = userProfileSettings &&
- userProfileSettings.ui_excludedFeatures &&
- userProfileSettings.ui_excludedFeatures.ids &&
- userProfileSettings.ui_excludedFeatures.ids.indexOf('com.ibm.bi.contentApps.teamFoldersSlideout') >= 0;
- }
- if (!this.ancestors || this.ancestors.length === 0) {
- if (teamContentHidden) {
- this.ancestors = [ContentStoreObject.getRootMyFoldersAncestors()];
- } else {
- this.ancestors = [this.getRootAncestor()];
- }
- }
- var myFolder = ContentStoreObject.getRootMyFoldersAncestors();
- var publicFolder = ContentStoreObject.getRootPublicFoldersAncestor();
- var folderArray = [];
- if(myContentHidden !== true){
- folderArray.push(myFolder);
- } if (teamContentHidden !== true) {
- folderArray.push(publicFolder);
- } if (!this.ancestors || this.ancestors.length === 0) {
- if (teamContentHidden === true) {
- this.folder = 'my_folders';
- }
- this.ancestors = [this.getRootAncestor()];
- }
- this.rootObjects = options.rootObjects || folderArray;
- this.ancestorsMap = {};
- this.rootObjects.forEach(function(rootObject) {
- rootObject.svgIcon = UIHelper.getSVGIconForType(ContentStoreObject.getType(rootObject));
- this.ancestorsMap[rootObject.id] = rootObject.id === this.ancestors[0].id ? this.ancestors : [rootObject];
- }.bind(this));
- this.selectedRootId = this.ancestors[0].id;
- var ancestorsLength = this.ancestors.length;
- var itemsLink = ContentStoreObject.getItemsLink(this.ancestors[ancestorsLength - 1]);
- //ContentStoreObject use _meta.links.self to build items link, in case it is not there, try to build it with selfurl;
- this.url = itemsLink ? itemsLink : this._buildItemsLinkWithSelfUrl(this.ancestors[ancestorsLength - 1].selfUrl);
- this.selfUrl = ContentStoreObject.getSelfLink(this.ancestors[ancestorsLength - 1]);
- this.navigateOnRowSelect = true;
- this.dataManipulationCallback = options.dataManipulationCallback;
- this.addURLParameters({
- 'nav_filter': 'true',
- 'fields': 'defaultName,disabled,hidden,permissions,userInterfaces,iconURI,defaultScreenTip,tags'
- });
- if (this.multiSelect) {
- this.GROUP_BY_TYPE_COLUMN_INDEX = 5;
- }
- },
- _buildItemsLinkWithSelfUrl: function(selfUrl) {
- return selfUrl + '/items';
- },
- _getModuleName: function() {
- return '../ContentSelectionDialogView';
- },
- renderContent: function() {
- jQuery.fn.dataTableExt.oSort['string-asc'] = function(a, b) {
- a = a.toString().toLowerCase();
- b = b.toString().toLowerCase();
- return UIHelper.getCollator().compare(a, b);
- };
- jQuery.fn.dataTableExt.oSort['string-desc'] = function(a, b) {
- a = a.toString().toLowerCase();
- b = b.toString().toLowerCase();
- return UIHelper.getCollator().compare(a, b) * -1;
- };
- delete jQuery.fn.dataTableExt.oSort['string-pre'];
- this.contentHeader = $('<div>', {
- 'class': 'dialogContentHeader'
- });
- this.contentFooter = $('<div>', {
- 'class': 'dialogContentFooter'
- });
- this.$el.prepend(this.contentHeader);
- this.$el.append(
- this.contentFooter);
- var dataManipulationCallback = this.dataManipulationCallback || this.commonDataManipulationCallback;
- var renderContentListOptions = {
- 'browserResize': false,
- 'disableColumnHeaders': true,
- 'multiSelect': false,
- 'canSelectCallback': this.canSelectCallback,
- 'selectAcrossFolders': this.selectAcrossFolders,
- 'selectAcrossFoldersSelectionChangeCallback': this.selectAcrossFoldersSelectionChangeCallback,
- 'rightClickContextMenu': false,
- 'columns': this._getColumnSpecification(),
- 'url': this.url,
- 'defaultSort': this.getDefaultSort(),
- 'filterByTypes': this.filterByTypes,
- 'typesToOpen': this.typesToOpen,
- 'capabilitiesRequired': this.capabilitiesRequired,
- 'dataManipulationCallback': dataManipulationCallback,
- 'groupByColumnAPI': this.getGroupByColumnAPI(),
- 'skipYBound': true // don't need to calculate the y-bound as it is constrained by dialog
- };
- if (this.multiSelect) {
- renderContentListOptions.multiSelect = true;
- }
- var fRenderContentViewSwitcher = this.teamContentOnly === true ? function() {
- return Promise.resolve();
- } : this._renderContentViewSwitcher.bind(this);
- return this._renderHeader()
- .then(this._fetchCustomFolder.bind(this))
- .then(fRenderContentViewSwitcher)
- .then(this._renderFooter.bind(this))
- .then(this.renderContentList.bind(this, renderContentListOptions))
- .then(this._postRenderContent.bind(this));
- },
- _fetchCustomFolder: function() {
- var userProfileSettings = this.glassContext.getCoreSvc('.UserProfile').userProfileSettings;
- var customFolder = userProfileSettings && userProfileSettings.ui_teamFolders;
- var path = customFolder && customFolder.pathRef;
- if (path) {
- path = path.replace(/^\//, '');
- var pathURL = ContentServiceUrls.getBasePathURL() + encodeURIComponent(path);
- return this.glassContext.getCoreSvc('.Ajax').ajax({
- dataType: 'json',
- url: pathURL
- }).then(function(result) {
- var cmObj = result.data.data[0];
- cmObj.svgIcon = '#ba_content_nav-custom-folder_24';
- this.ancestorsMap[cmObj.id] = cmObj.id === this.ancestors[0].id ? this.ancestors : [cmObj];
- this.rootObjects.push(cmObj);
- return Promise.resolve();
- }.bind(this))
- .catch(function(err){
- this.logger.error(err);
- return Promise.resolve();
- }.bind(this));
- } else {
- return Promise.resolve();
- }
- },
- //Override as necessary
- _renderHeader: function() {
- return Promise.resolve(true);
- },
- _renderFooter: function() {
- this._renderDestinationInfo();
- return Promise.resolve(true);
- },
- _renderDestinationInfo: function() {
- if (!this.showDestination) {
- return;
- }
- var destinationLabel = $('<div>', {
- 'class': 'destinationLabel'
- });
- destinationLabel.text(StringResource.get('destination'));
- this.destinationValue = $('<div>', {
- 'class': 'destinationValue'
- });
- var destinationSection = $('<div>', {
- 'class': 'destinationSection'
- }).append(destinationLabel, this.destinationValue);
- this.contentFooter.append(destinationSection);
- this._updateDestination();
- return destinationSection;
- },
- _postRenderContent: function() {
- //Override if there is a need for special behaviour after content is rendered.
- //Should return promise
- return Promise.resolve(true);
- },
- //Renders the left portion of the content selection dialog
- _renderContentViewSwitcher: function() {
- var sHtml = dot.template(contentViewSwitcherTemplate)({
- 'rows': this.rootObjects,
- 'showRootFolderName': this.showRootFolderName
- });
- this.contentContainer.prepend(sHtml);
- this._addSwitchRootFolderEventHandler();
- this._updateContentViewSwitcher();
- return Promise.resolve();
- },
- _addSwitchRootFolderEventHandler: function() {
- this.rootObjects.forEach(function(rootObject, index) {
- var rowNode = this.contentContainer.find('.rootSelector' + index);
- rowNode.click(function() {
- if (!rowNode.hasClass('selected')) {
- this._switchRootFolder(rootObject);
- }
- }.bind(this));
- rowNode.keydown(this._keydownHandler.bind(this, rowNode, rootObject));
- }.bind(this));
- },
- _keydownHandler: function(rowNode, rootObject, evt) {
- var result = true;
- if (evt.keyCode === KeyCodes.SPACE || evt.keyCode === KeyCodes.ENTER) {
- if (!rowNode.hasClass('selected')) {
- this._switchRootFolder(rootObject);
- result = false;
- }
- }
- return result;
- },
- _updateContentViewSwitcher: function() {
- this.rootObjects.forEach(function(rootObject, index) {
- var rowNode = this.contentContainer.find('.rootSelector' + index);
- if (rootObject.id === this.selectedRootId) {
- rowNode.addClass('selected');
- rowNode.attr('aria-pressed', 'true');
- } else {
- rowNode.removeClass('selected');
- rowNode.attr('aria-pressed', 'false');
- }
- }.bind(this));
- },
- _switchRootFolder: function(rootObject) {
- // Save the ancestor of the previously selected root
- this.ancestorsMap[this.selectedRootId] = this.ancestors;
- this.selectedRootId = rootObject.id;
- this.ancestors = this.ancestorsMap[rootObject.id];
- var lastAncestor = this.ancestors.pop();
- this.navigate(lastAncestor);
- },
- /**
- Defines the columns for the data table. The structure and properties of the definition come
- from the datatable API.
- **/
- _getColumnSpecification: function() {
- var columnSpecs = [{
- 'type': 'Icon'
- }, {
- 'type': 'Name',
- 'navigateOnly': true
- }];
- // There is a invisible column for ModifiedTime along with Name.
- // This second 'hidden' column is required to allow DataTable to sort on ModifiedTime.
- columnSpecs.push({
- 'type': 'Time',
- 'propertyName': ContentStoreObject.MODIFICATION_TIME,
- 'visible': false
- });
- // Here is another invisible column groupByFolder for the calculated grouping value
- columnSpecs.push({
- 'type': 'Text',
- 'propertyName': 'groupByFolder',
- 'visible': false
- });
- // Here is another invisible column groupByType for the calculated grouping value
- columnSpecs.push({
- 'type': 'Text',
- 'propertyName': 'groupByType',
- 'visible': false
- });
- if (this.multiSelect) {
- // push checkbox to the columnSpec when multiSelect enabled
- columnSpecs.unshift({
- 'type': 'Checkbox'
- });
- }
- return columnSpecs;
- },
- _updateButtonsState: function() {
- //Override as necessary;
- },
- updateDialog: function(oData) {
- this._updateContentViewSwitcher();
- this._updateDestination();
- this._updateButtonsState(oData);
- },
- _updateDestination: function() {
- if (!this.showDestination || !this.ancestors || !this.ancestors.length) {
- return;
- }
- var destination = ContentStoreObject.getName(this.ancestors[this.ancestors.length - 1]);
- this.destinationValue.text(destination);
- ContentFormatter.middleShortenString(this.destinationValue.get(0));
- var dir = BidiUtil.resolveBaseTextDir(this.destinationValue.text());
- if (dir.length > 0) {
- this.destinationValue.attr('dir', dir);
- }
- },
- navigate: function(oData) {
- if (this.onClickItemCallback) {
- this.onClickItemCallback(oData);
- }
- ContentSelectionDialogView.inherited('navigate', this, arguments);
- this.updateDialog(oData);
- },
- getDefaultSort: function() {
- if (this.multiSelect) {
- return [
- [4, 'asc'],
- [2, 'asc']
- ];
- } else {
- return [
- [3, 'asc'],
- [1, 'asc']
- ];
- }
- },
- getSortSpec: function() {
- return {
- sortBy: {
- name: 'name',
- modificationTime: 'modificationTime'
- },
- order: {
- sortedAscending: 'asc',
- sortedDescending: 'desc'
- }
- };
- },
- getSortMappingSpec: function() {
- return {
- name: ['groupByFolder', 'name'],
- modificationTime: ['groupByFolder', 'modificationTime'],
- type: ['groupByType', 'name']
- };
- },
- commonDataManipulationCallback: function(rawData, sortIndexes) {
- if (sortIndexes === null) {
- return;
- }
- rawData.data.forEach(function(data) {
- // Add a couple of calculated fields 'groupByFolder' and 'groupByType' based on the 'type' value
- var dataType = UIHelper.getDisplayType(data);
- if (UIHelper.isContainer(dataType)) {
- data.groupByFolder = sortIndexes.folders;
- data.groupByType = data.groupByFolder;
- } else {
- // Anything else
- data.groupByFolder = sortIndexes.others;
- // For Type sort
- if (UIHelper.isGroup(dataType, 'report')) {
- data.groupByType = sortIndexes.reports;
- } else if (UIHelper.isGroup(dataType, 'dashboard')) {
- data.groupByType = sortIndexes.dashboards;
- } else if (UIHelper.isGroup(dataType, 'data')) {
- data.groupByType = sortIndexes.data;
- } else if (UIHelper.isGroup(dataType, 'exploration')) {
- data.groupByType = sortIndexes.explorations;
- } else {
- // Anything else
- data.groupByType = sortIndexes.others;
- }
- }
- });
- },
- getGroupByColumnAPI: function() {
- return {
- 'columnIndex': this.GROUP_BY_TYPE_COLUMN_INDEX,
- 'getGroupName': function(group) {
- var msgKey = _.find(Object.keys(this.contentListSortIndexes), function(sortIndex) {
- return this.contentListSortIndexes[sortIndex] === group;
- }.bind(this));
- return msgKey && StringResource.get(msgKey) || group;
- }.bind(this),
- 'shouldGroup': function(api) {
- var sortInfo = api.order();
- return sortInfo && sortInfo[0] && sortInfo[0][0] === this.GROUP_BY_TYPE_COLUMN_INDEX;
- }.bind(this)
- };
- }
- });
- return ContentSelectionDialogView;
- });
- define('text!bacontentnav/ui/views/templates/OpenView.html',[],function () { return '<!-- Licensed Materials - Property of IBM\n\n IBM Cognos Products: Cognos Analytics\n\n (C) Copyright IBM Corp. 2016\n\n US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.\n-->\n<div class="openView">\n\t<div class="selectFolderView"></div>\n</div>\n';});
- /**
- * Licensed Materials - Property of IBM
- *
- * IBM Cognos Products: BI UI Commons
- *
- * Copyright IBM Corp. 2015, 2020
- *
- * US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
- */
- //jshint maxparams:9
- define('bacontentnav/ui/views/OpenView',[
- 'jquery',
- 'doT',
- '../../lib/@waca/core-client/js/core-client/ui/core/View',
- '../../common/ContentSelectionDialogView',
- '../../utils/ContentStoreObject',
- '../../utils/UIHelper',
- 'text!./templates/OpenView.html',
- '../../nls/StringResource'
- ], function($, doT, BaseView, ContentView, ContentStoreObject, UIHelper, template, StringResources) {
- /**
- * Open view. This class renders a view with a folder selection section and an input to enter the file name.
- *
- * @param - options
- *
- * {
- * 'glassContext': <glass context object> // Glass context object
- * 'onOpen':function(){} // Callback when the view is opened
- * 'onSelectionChange': function(selection){} // Callback when the folder selection has changed. The callback receives the selection object as a parameter
- * }
- *
- */
- var OpenView = BaseView.extend({
- templateString: template,
- events: {},
- isDialog: false,
- onDefaultAction: null, // default - no action. This is used for dialogs.
- init: function(options) {
- OpenView.inherited('init', this, arguments);
- $.extend(this, options);
- this._contentViewclass = this._contentViewClass || ContentView;
- this._selectedItems = [];
- },
- render: function() {
- this.$el.empty();
- var sHtml = this.dotTemplate({
- openLabel: this.filesToOpenTitle || StringResources.get('filesToOpen')
- });
- this.$el.append(sHtml);
- var contentViewOptions = {
- $el: this.$('.selectFolderView'),
- 'glassContext': this.glassContext,
- 'breadcrumbs': [{
- 'label': this.defaultName || StringResources.get('teamFolders'),
- 'url': this.url || '/v1/objects/.public_folders/items',
- 'selfUrl': this.selfUrl || '/v1/objects/.public_folders'
- }],
- 'showBreadcrumbs': true,
- 'showAddFolder': false,
- 'showFilter': !this.filterByTypes || this.filterByTypes.length === 0,
- 'showDestination': false,
- 'url': this.url || 'v1/objects/.public_folders/items',
- 'selfUrl': this.selfUrl || 'v1/objects/.public_folders',
- 'rootObjects': this.rootObjects,
- 'ancestors': ContentStoreObject.getAncestors({
- ancestors: this.ancestors
- }),
- 'inputObjects': [],
- 'filterByTypes': this.filterByTypes,
- 'typesToOpen': this.typesToOpen,
- 'capabilitiesRequired': this.capabilitiesRequired,
- 'dataManipulationCallback': this.dataManipulationCallback,
- 'teamContentOnly': this.teamContentOnly,
- 'isDialog': this.isDialog,
- 'onDefaultAction': this.onDefaultAction,
- 'alwaysShowTeamContent': this.alwaysShowTeamContent
- };
- if (this.multiSelect) {
- contentViewOptions.multiSelect = true;
- contentViewOptions.canSelectCallback = this.canSelect.bind(this);
- contentViewOptions.selectAcrossFolders = true;
- contentViewOptions.selectAcrossFoldersSelectionChangeCallback = this.onMultiSelectionChange.bind(this);
- } else {
- contentViewOptions.onClickItemCallback = this.onSelectionChange.bind(this);
- }
- this.contentView = new this._contentViewclass(contentViewOptions);
- if (this.contentView.addURLParameters) {
- this.contentView.addURLParameters({
- 'fields': 'searchPath'
- });
- if (this.extraUrlParameters) {
- this.contentView.addURLParameters({
- 'fields': this.extraUrlParameters
- });
- }
- if (this.capabilitiesRequired) {
- this.contentView.addURLParameters({
- 'fields': 'effectiveUserCapabilities'
- });
- }
- }
- this.contentView.render();
- this.$fileNames = this.$('.fileNames');
- },
- remove: function() {
- OpenView.inherited('remove', this, arguments);
- this.contentView.remove();
- this._emptySelection();
- },
- /**
- * Get an array of select objects
- */
- getSelectedItems: function() {
- return this._selectedItems;
- },
- canSelect: function(data) {
- return this._isTypeToOpen(UIHelper.getFilterType(data)) === true;
- },
- /**
- * Default selection change callback. To be provide by the called in the constructor options
- */
- onSelectionChange: function(data) {
- // To be provided by caller in constructor options to handle selection change
- if (this._isSelected(data) === false) {
- if (this._isTypeToOpen(UIHelper.getFilterType(data)) === true) {
- if (!this.multiSelect) {
- this._emptySelection();
- }
- this._selectedItems.push(data);
- } else if (!this.multiSelect) {
- this._emptySelection();
- }
- }
- this._toggleOpenButton();
- },
- onMultiSelectionChange: function(selection) {
- this._selectedItems = selection;
- this.parent.updateSelectionCount(this._selectedItems.length);
- this._toggleOpenButton();
- },
- _emptySelection: function() {
- this._selectedItems = [];
- },
- clearAllSelected: function() {
- if (this.contentView) {
- this.contentView.clearAllSelected();
- }
- },
- _setFocusAfterDeleteSelectedItem: function() {
- this.parent.setFocus();
- },
- _toggleOpenButton: function() {
- var openButton = this.parent.findFooterButton('open_button');
- if (this._selectedItems.length === 0 || this.getSelectedItems()[0].disabled) {
- openButton.disable();
- } else {
- openButton.enable();
- }
- },
- _isTypeToOpen: function(type) {
- var types = this.typesToOpen,
- len = types ? types.length : 0,
- ret = (len === 0);
- for (var i = 0; i < len; i++) {
- if (type === types[i]) {
- ret = true;
- break;
- }
- }
- return ret;
- },
- _isSelected: function(data) {
- var len = this._selectedItems.length,
- item;
- for (var i = 0; i < len; i++) {
- item = this._selectedItems[i];
- if (item.id === data.id) {
- return true;
- }
- }
- return false;
- }
- });
- return OpenView;
- });
- /**
- * Licensed Materials - Property of IBM
- *
- * IBM Cognos Products: BI UI Commons
- *
- * Copyright IBM Corp. 2015, 2021
- *
- * US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
- */
- define('bacontentnav/ui/dialogs/OpenDialog',['../../lib/@waca/core-client/js/core-client/ui/dialogs/GenericViewDialog',
- '../views/OpenView',
- '../../nls/StringResource'
- ], function (BaseDialog, OpenView, StringResources) {
- /**
- * Create a save as dialog that will be used to select a folder and a file name.
- *
- * @param - options
- * {
- * glassContext: <glassContextObject>, // Glass context object.
- * typesToOpen: string array, contains all types to open, for example: ['report']
- * multiSelect: boolean, if true, support multiple files open
- * onOpenCallback: function(items){ } // Callback when locations are selected.
- * onCancelCallback: function(){ } // Callback when cancel button is pressed.
- * options.primaryBtnText: String customized primary button text than the default "OK"
- * options.dialogTitle: String customized dialog title than the default open dialog title
- * options.filtersByTypes: Array customized 'filters by types' than the default open dialog supports
- * options.dataManipulationCallback {functions} - Passed to the list control. Function will get called before the rendering of the data
- * viewOptions.url String , viewOptions.selfUrl String and viewOptions.ancestors Array of objects are three parameters
- * to customize the initial folder when dialog opens
- * }
- *
- */
- var OpenDialog = BaseDialog.extend({
- init: function (options) {
- this.options = options;
- var typesToFilter = 'folder|package';
- var typesToOpen = options['typesToOpen'];
- for (var i = 0; i < typesToOpen.length; i++) {
- typesToFilter = typesToFilter + '|' + typesToOpen[i];
- }
- var dialogOptions = {
- 'buttons': [{
- 'text': options.primaryBtnText || StringResources.get('open'),
- 'handler': this.ok.bind(this),
- 'type': 'primary',
- 'defaultId': 'open_button'
- },
- {
- 'handler': this.cancel.bind(this),
- 'defaultId': 'cancel'
- }],
- 'viewClass': OpenView,
- 'id': 'openDialogTitle',
- 'title': options.dialogTitle || StringResources.get('openDialogTitle'),
- 'viewOptions': {
- 'ancestors': options.ancestors,
- 'url': options.url,
- 'selfUrl': options.selfUrl,
- 'glassContext': options.glassContext,
- 'onOpen': this.onOpen.bind(this),
- 'isDialog': true,
- 'onDefaultAction': this.onDefaultAction.bind(this),
- 'filesToOpenTitle': options.filesToOpenTitle || StringResources.get('filesToOpen'),
- 'typesToOpen': options['typesToOpen'] || [],
- 'capabilitiesRequired': options['capabilitiesRequired'] || undefined,
- 'multiSelect': options['multiSelect'] || false,
- 'parent': this,
- 'filterByTypes': options.filtersByTypes || [typesToFilter] || undefined,
- 'rootObjects': options.rootObjects,
- 'extraUrlParameters': this._getExtraUrlParameters(options['extraUrlParameters'], typesToOpen),
- 'dataManipulationCallback': options.dataManipulationCallback,
- 'teamContentOnly': options.teamContentOnly,
- 'alwaysShowTeamContent': options.alwaysShowTeamContent || false
- }
- };
- OpenDialog.inherited('init', this, [dialogOptions]);
- },
- _getExtraUrlParameters: function (extraUrlParameters, typesToOpen) {
- var extraParams = extraUrlParameters || [];
- // CANAV-3259: fetch base object for reportView usage
- if (typesToOpen && typesToOpen.length > 0 && typesToOpen.indexOf('reportView') !== -1) {
- extraParams.push('base.defaultName');
- }
- return extraParams;
- },
- renderFooter: function () {
- var n = OpenDialog.inherited('renderFooter', this, arguments);
- if (this.options.multiSelect) {
- this._selectionCount = $('<span>', { 'class': 'selectionCount' });
- var noOfItemSelected = StringResources.get('noOfItemSelected', {
- 'noOfItems': 0
- });
- this._selectionCount.text(noOfItemSelected);
- this._selectionCount.attr('aria-label', noOfItemSelected);
- var footer = n.find('.footerContainer');
- var clearSelection = $('<span class="clearSelection"><a role="button" tabindex="0"></a></span>');
- footer.addClass('selectionCounter');
- footer.prepend(clearSelection);
- footer.prepend(this._selectionCount);
- clearSelection = clearSelection.find('a');
- clearSelection.text(StringResources.get('clearAllSelected'));
- clearSelection.attr('aria-label', StringResources.get('clearAllSelected'));
- clearSelection.on('primaryaction', function () {
- if (this.view) {
- this.view.clearAllSelected();
- }
- }.bind(this));
- }
- return n;
- },
- updateSelectionCount: function (count) {
- var noOfItemSelected = StringResources.get('noOfItemSelected', {
- 'noOfItems': count
- });
- this._selectionCount.text(noOfItemSelected);
- },
- /**
- * Called when the dialog is opened
- */
- onOpen: function () {
- var container = this._container();
- container.addClass('openDialog');
- container.find('.dialogHeader');
- container.find('.modalDialog').addClass('contentListDialog');
- container.find('footer').attr('role', 'contentinfo').attr('aria-label', StringResources.get('openDialogFooter'));
- this.findFooterButton('open_button').disable();
- },
- /**
- * Called when the save button is clicked
- */
- ok: function () {
- if (this.options.onOpenCallback) {
- this.options.onOpenCallback(this.view.getSelectedItems());
- }
- OpenDialog.inherited('ok', this, arguments);
- this.hide();
- },
- /**
- * Called when the cancel button is clicked
- */
- cancel: function () {
- if (this.options.onCancelCallback) {
- this.options.onCancelCallback();
- }
- OpenDialog.inherited('cancel', this, arguments);
- },
- setFocus: function () {
- this._container().find('.dialogButton.secondary')[0].focus();
- },
- onDefaultAction: function () {
- this.ok();
- }
- });
- return OpenDialog;
- });
- define('text!bacontentnav/ui/views/templates/SaveAsView.html',[],function () { return '<!-- Licensed Materials - Property of IBM\n\n IBM Cognos Products: Cognos Analytics\n\n (C) Copyright IBM Corp. 2016\n\n US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.\n-->\n<div class="saveAsView">\n\t<div class="selectFolderView"></div>\n\t<div class="fileNameSection">\n\t\t<div class="saveAsLabel">{{!it.saveAsLabel}}</div>\n\t\t<input class="fileName" type="text" value="{{!it.defaultNameValue}}" aria-label="{{!it.saveAsLabel}}" tabindex="0">\n\t</div>\n</div>';});
- /**
- * Licensed Materials - Property of IBM
- *
- * IBM Cognos Products: ba-content-nav
- *
- * Copyright IBM Corp. 2015, 2020
- *
- * US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
- */
- define('bacontentnav/ui/views/SaveAsView',[
- 'jquery',
- '../../lib/@waca/core-client/js/core-client/ui/KeyCodes',
- '../../lib/@waca/core-client/js/core-client/ui/core/View',
- '../../lib/@waca/core-client/js/core-client/utils/BidiUtil',
- '../../common/ContentSelectionDialogView',
- '../../utils/ContentServiceUrls',
- '../../utils/ContentStoreObject',
- '../../utils/UIHelper',
- '../../nls/StringResource',
- 'text!./templates/SaveAsView.html'
- ], function($, KeyCodes, BaseView, BidiUtil, ContentSelectionDialogView, ContentServiceUrls, ContentStoreObject, UIHelper, StringResources, template) {
- /**
- * SaveAs view. This class renders a view with a folder selection section and an input to enter the file name.
- *
- * @param - options
- *
- * {
- * 'glassContext': <glass context object> // Glass context object
- * 'defaultFileName': 'some name', // Default file name value
- * 'onOpen':function(){} // Callback when the view is opened
- * 'onSelectionChange': function(selection){} // Callback when the folder selection has changed. The callback receives the selection object as a parameter
- * }
- *
- */
- var SaveAsView = BaseView.extend({
- templateString: template,
- events: {},
- init: function(options) {
- SaveAsView.inherited('init', this, arguments);
- $.extend(this, options);
- this._contentViewclass = this._contentViewClass || ContentSelectionDialogView;
- },
- render: function() {
- this._createContentView();
- this.contentView.render();
- var nameInput = this.$('input.fileName');
- nameInput.on('keydown', this._onKeyDown.bind(this));
- BidiUtil.initElementForBidi(nameInput[0]);
- },
- _createContentView: function() {
- this.$el.empty();
- var sHtml = this.dotTemplate({
- defaultNameValue: this.defaultFileName || this.glassContext.appController.currentAppView.currentContentView.title || '',
- saveAsLabel: this.inputLabel || StringResources.get('saveAsLabel')
- });
- this.$el.append(sHtml);
- this.contentView = new this._contentViewclass({
- $el: this.$('.selectFolderView'),
- 'glassContext': this.glassContext,
- 'showBreadcrumbs': true,
- 'showAddFolder': true,
- 'url': this.url || ContentServiceUrls.getPublicFoldersContentURL(),
- 'selfUrl': this.selfUrl || ContentServiceUrls.getPublicFoldersURL(),
- 'ancestors': ContentStoreObject.getAncestors({ ancestors: this.ancestors }),
- 'inputObjects': [],
- 'alwaysShowTeamContent': this.alwaysShowTeamContent,
- 'navigateCallback': function(data) {
- this.onNavigation(data);
- }.bind(this),
- 'listControlCallback': this._updateSaveAsName.bind(this)
- });
- },
- _onKeyDown: function(evt) {
- var keyCode = evt.keyCode;
- if (keyCode === KeyCodes.ENTER && this.getFileName().replace(/\s+/g, '').length !== 0) {
- this.saveOnKeyDown();
- // Return false to stop propagation, in the case where the dialog is destroyed by pressing enter, the focus goes back on the button that pressed it and re-open the dialog.
- return false;
- }
- },
- _updateSaveAsName: function(data) {
- if (!UIHelper.isContainer(data.type)) {
- var temp = this.$('input.fileName');
- temp.attr('value', data.defaultName);
- }
- },
- remove: function() {
- SaveAsView.inherited('remove', this, arguments);
- this.contentView.remove();
- },
- /**
- * Get the current selection
- */
- getSelection: function() {
- this.selection = {
- 'url': this.contentView.url
- };
- return this.selection;
- },
- /**
- * Get the filename value
- */
- getFileName: function() {
- return this.$('.fileName').val();
- },
- /**
- * Default selection change callback. To be provide by the called in the constructor options
- */
- onSelectionChange: function() {
- // To be provided by caller in constructor options to handle selection change
- }
- });
- return SaveAsView;
- });
- define('text!bacontentnav/ui/dialogs/template/saveAsProgressIndicator.html',[],function () { return '<div class="saveAsInProgress">\n <div class="saveAsInProgress__indicator"></div>\n <label class="saveAsInProgress__indicator-label">{{!it.loadText}}</label>\n</div>';});
- /**
- * Licensed Materials - Property of IBM
- *
- * IBM Cognos Products: ba-content-nav
- *
- * Copyright IBM Corp. 2015, 2020
- *
- * US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
- */
- define('bacontentnav/ui/dialogs/SaveAsDialog',['underscore',
- '../../lib/@waca/core-client/js/core-client/ui/dialogs/ConfirmationDialog',
- '../../lib/@waca/core-client/js/core-client/ui/dialogs/GenericViewDialog',
- '../../lib/@waca/core-client/js/core-client/utils/BidiUtil',
- '../views/SaveAsView',
- '../../utils/UIHelper',
- '../../utils/ContentStoreObject',
- '../../utils/ContentServiceUrls',
- '../../utils/GlassContextHelper',
- '../../nls/StringResource',
- 'text!./template/saveAsProgressIndicator.html',
- 'ca-ui-toolkit',
- 'react',
- 'react-dom'
- ],
- function(_, ConfirmationDialog, GenericViewDialog, BidiUtil, SaveAsView, UIHelper, ContentStoreObject, ContentServiceUrls, GlassContextHelper, StringResource, saveAsProgressIndicatorTemplate, uiToolkit, React, ReactDOM) {
- /**
- * Create a save as dialog that will be used to select a folder and a file name.
- * A service object can be passed to the dialog in order to implement the saving process and returns a Promise. Doing so will show an overwrite dialog if the promise returns an error.
- * Note: If passing a service, onSave won't be called.
- *
- * @param - options
- * {
- * glassContext: <glassContextObject>, // Glass context object.
- * defaultFileName: "some name", // Default file name to be used in the save dialog.
- * onSave: function(selection, filename) {} // Callback when the location is selected. The callback has 3 parameters:
- * 1 - Selected folder object
- * 2 - File name string
- * onHide: function() {} // Callback when dialog is hidden.
- * viewOptions.url String , viewOptions.selfUrl String and viewOptions.ancestors Array of objects are three parameters
- * to customize the initial folder when dialog opens
- *
- * service: {
- * save: function (service, selection, filename, overwrite) // Save function returning a promise.
- * : Promise() // The promise should be resolved when the save succeed, or can reject
- * // with the following object: { isDuplicate: true }
- * }
- *
- * }
- *
- */
- var SaveAsDialog = GenericViewDialog.extend({
- templateString: saveAsProgressIndicatorTemplate,
- init: function(options) {
- this.options = options;
- var dialogOptions = _.defaults(options, {
- 'buttons': [ {
- 'text': StringResource.get('save'),
- 'handler': this.ok.bind(this),
- 'type': 'primary',
- 'defaultId': 'save_button'
- }, 'cancel' ],
- 'viewClass': SaveAsView,
- 'id': 'saveDialogTitle',
- 'title': StringResource.get('saveDialogTitle'),
- 'viewOptions': {
- 'ancestors': this.isRenderFromReact() ? this.options.service.context.target.activeObject.ancestors : options.ancestors,
- 'url': options.url,
- 'selfUrl': options.selfUrl,
- 'glassContext': options.glassContext,
- 'defaultFileName': options.defaultFileName,
- 'inputLabel': options.inputLabel,
- 'alwaysShowTeamContent': options.alwaysShowTeamContent || false,
- 'onOpen':this.onOpen.bind(this),
- 'onHide':this.onHide.bind(this),
- 'onNavigation': this._onNavi.bind(this),
- 'saveOnKeyDown': this.ok.bind(this)
- }
- });
- // clean up and use core services
- this.glassContext = options.glassContext;
- if (this.glassContext && this.glassContext.getCoreSvc) {
- this.logger = this.glassContext.getCoreSvc('.Logger');
- } else {
- this.logger = { error: function() {} }; // unit test requires :(
- }
- this.inputEventAdded = false;
- SaveAsDialog.inherited('init', this, [ dialogOptions ]);
- },
- _onNavi: function() {
- this._updateButtons();
- if(!this.inputEventAdded){
- this.inputEventAdded = true;
- this._container().find('.fileName').on('input', function() {
- this._updateButtons();
- }.bind(this));
- }
- },
- _isSaveButtonDisabled: function() {
- // check UI capabilities
- var doesNotHaveWritePermission = false;
- if (!this.view.getFileName().trim()) {
- return Promise.resolve(true);
- }
- var saveAsCapabilities = UIHelper.getConfiguration('capabilities')['saveAs'];
- if (saveAsCapabilities.publicFolder === false) {
- // check for public folder
- var selection = this.view.getSelection();
- if (selection && selection.url === ContentServiceUrls.getPublicFoldersContentURL()) {
- return Promise.resolve(true);
- }
- }
- if (saveAsCapabilities.requiresParentWritePermissions === true) {
- // check for write permissions of parent
- var parentObj = this.view.contentView.parentObj;
- if (parentObj && parentObj.permissions) {
- doesNotHaveWritePermission = parentObj.permissions.indexOf('write') === -1;
- return Promise.resolve(doesNotHaveWritePermission);
- } else {
- return this.view.contentView.getParentProperties().then(function() {
- parentObj = this.view.contentView.parentObj;
- if (parentObj && parentObj.permissions) {
- doesNotHaveWritePermission = parentObj.permissions.indexOf('write') === -1;
- }
- return Promise.resolve(doesNotHaveWritePermission);
- }.bind(this));
- }
- } else {
- return Promise.resolve(false);
- }
- },
- _updateButtons: function() {
- return this._isSaveButtonDisabled().then(function(disabled) {
- if (disabled) {
- this.saveButton.disable();
- } else {
- this.saveButton.enable();
- }
- }.bind(this));
- },
- /**
- * Called when the dialog is opened
- */
- onOpen: function() {
- var container = this._container();
- container.addClass('saveDialog');
- container.find('.dialogHeader');
- container.find('.modalDialog').addClass('contentListDialog');
- container.find('footer').attr('role','contentinfo').attr('aria-label', StringResource.get('saveDialogFooter'));
- this.saveButton = this.findFooterButton('save_button');
- this._onNavi();
- },
- /**
- * Called when the save button is clicked
- */
- ok: function() {
- if (this.saveButton.isEnabled()) {
- if (this.options.service) {
- this._onSaveService(this.view.getSelection(), this.view.getFileName(), false);
- } else {
- this.options.onSave(this.view.getSelection(), this.view.getFileName());
- }
- } else {
- GlassContextHelper.displayToast(this.glassContext, StringResource.get('toastNoCapabilityForContainer', {
- 'nameOfContainer': BidiUtil.enforceTextDirection(this._getDestinationName())
- }), {
- 'type': 'warning'
- });
- }
- },
- /**
- * Called on dialog hiding
- */
- onHide: function(){
- if(this.options !== 'undefined' && _.isFunction(this.options.onHide)) {
- this.options.onHide();
- }
- },
- setFocus: function(){
- this._container().find('.fileName')[0].focus();
- },
- _onSaveService: function(selection, name, overwrite) {
- if (!_.isFunction(this.options.service.save)) {
- this.logger.error('SaveAsDialog service save undefined.');
- } else {
- try {
- this._doSaveService(selection, name, overwrite);
- } catch (e) {
- this.logger.error(e);
- }
- }
- },
- _renderProgressIndicator: function (){
- var progressIndicatorEl = this.dotTemplate({
- loadText: StringResource.get('loading')
- });
- // occupy the space to avoid dialog size changing due to min height
- this._saveAsView = this.view.$el.find('.saveAsView');
- this._saveAsView.addClass('invisible');//bootstrap class name
- this.view.$el.append(progressIndicatorEl);
- this._$saveAsInProgressIndicator = this.view.$el.find('.saveAsInProgress__indicator');
- this._$saveAsInProgress = this.view.$el.find('.saveAsInProgress');
- ReactDOM.render(React.createElement(uiToolkit.ProgressIndicator), this._$saveAsInProgressIndicator.get(0));
- this.saveButton.disable();
- },
- _doSaveService: function(selection, name, overwrite) {
- this._renderProgressIndicator();
- var assets = this.view.contentView.getListControl().getDatatable().fnGetData();
- this.options.service.save(this.options.service, selection, name, !!overwrite)
- .catch(function(errorObject) {
- if (errorObject) {
- if (errorObject.isDuplicate === true) {
- var sameNameFolder = _.filter(assets, function(asset){ return asset.defaultName === name && UIHelper.isContainer(asset.type); });
- if(sameNameFolder.length > 0) {
- GlassContextHelper.displayToast(this.glassContext, StringResource.get('toastSaveErrorSameNameDifferentType', {
- 'nameOfItem': name
- }), {
- 'type': 'warning'
- });
- } else {
- var oDialog = this._getConfirmRefreshDialog(name);
- oDialog.confirm(function() {
- this._onSaveService(selection, name, true);
- }.bind(this));
- }
- } else if (errorObject.isReplaceFailed === true) {
- GlassContextHelper.displayToast(this.glassContext, StringResource.get('toastSaveErrorSameNameDifferentType', {
- 'nameOfItem': name
- }), {
- 'type': 'warning'
- });
- } else {
- this.logger.error(errorObject);
- }
- }
- }.bind(this)).finally(function(){
- this._saveAsView.removeClass('invisible');//bootstrap class name
- this._$saveAsInProgress.remove();
- this.saveButton.enable();
- if (this.isRenderFromReact()){
- this.options.service.context.target.activeObject.onCloseSaveDialog();
- }
- }.bind(this));
- },
- isRenderFromReact: function() {
- var renderFromReact = this.options.service
- && this.options.service.context
- && this.options.service.context.target
- && this.options.service.context.target.activeObject
- && this.options.service.context.target.activeObject.renderFromReact === true;
- return renderFromReact;
- },
- _getConfirmRefreshDialog: function(fileName) {
- return new ConfirmationDialog('confirmRefresh', StringResource.get('confirmRefreshUpload'), StringResource.get('msgConfirmRefreshUpload', {
- fileName: fileName
- }));
- },
- _getDestinationName: function() {
- var destination = '';
- if (this.view && this.view.contentView) {
- var ancestors = this.view.contentView.ancestors;
- if (ancestors) {
- destination = ContentStoreObject.getName(ancestors[ancestors.length - 1]);
- }
- }
- return destination;
- }
- });
- return SaveAsDialog;
- });
- /*
- *+------------------------------------------------------------------------+
- *| Licensed Materials - Property of IBM
- *| IBM Cognos Products: Content Explorer
- *| (C) Copyright IBM Corp. 2018
- *|
- *| US Government Users Restricted Rights - Use, duplication or disclosure
- *| restricted by GSA ADP Schedule Contract with IBM Corp.
- *+------------------------------------------------------------------------+
- */
- define('bacontentnav/services/ContentDialogFactory',[
- '../ui/dialogs/OpenDialog',
- '../ui/dialogs/SaveAsDialog'
- ], function(OpenDialog, SaveAsDialog) {
- var ContentDialogFactory = function() {};
- ContentDialogFactory.prototype.createOpenDialog = function(options) {
- return new OpenDialog(options);
- };
- ContentDialogFactory.prototype.createSaveAsDialog = function(options) {
- return new SaveAsDialog(options);
- };
- return ContentDialogFactory;
- });
- define("js/content_apps/folderBundle", function(){});
|