| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089 |
- ## Licensed to Cloudera, Inc. under one
- ## or more contributor license agreements. See the NOTICE file
- ## distributed with this work for additional information
- ## regarding copyright ownership. Cloudera, Inc. licenses this file
- ## to you under the Apache License, Version 2.0 (the
- ## "License"); you may not use this file except in compliance
- ## with the License. You may obtain a copy of the License at
- ##
- ## http://www.apache.org/licenses/LICENSE-2.0
- ##
- ## Unless required by applicable law or agreed to in writing, software
- ## distributed under the License is distributed on an "AS IS" BASIS,
- ## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- ## See the License for the specific language governing permissions and
- ## limitations under the License.
- <%!
- from desktop.views import commonheader, commonfooter, _ko
- from desktop import conf
- from django.utils.translation import ugettext as _
- %>
- <%namespace name="dashboard" file="common_dashboard.mako" />
- ${ commonheader(_('Search'), "search", user, "80px") | n,unicode }
- <script type="text/javascript">
- if (window.location.hash != "") {
- if (window.location.hash.indexOf("collection") > -1) {
- location.href = "/search/?" + window.location.hash.substr(1).replace(/(<([^>]+)>)/ig, "");
- }
- }
- SLIDER_LABELS = {
- STEP: "${_('Increment')}"
- }
- </script>
- <div class="search-bar" data-bind="visible: ! $root.isPlayerMode()">
- <div class="pull-right" style="padding-right:50px">
- <a class="btn pointer" title="${ _('Player mode') }" rel="tooltip" data-placement="bottom" data-bind="click: function(){ hueUtils.goFullScreen(); $root.isEditing(false); $root.isPlayerMode(true); }">
- <i class="fa fa-expand"></i>
- </a>
-
- <a class="btn pointer" title="${ _('Edit') }" rel="tooltip" data-placement="bottom" data-bind="click: toggleEditing, css: {'btn': true, 'btn-inverse': isEditing}">
- <i class="fa fa-pencil"></i>
- </a>
- % if is_owner:
- <a class="btn pointer" title="${ _('Save') }" rel="tooltip" data-placement="bottom" data-loading-text="${ _("Saving...") }" data-bind="click: save, css: {'btn': true}, visible: columns().length != 0">
- <i class="fa fa-save"></i>
- </a>
- % endif
- <a class="btn pointer" title="${ _('General Settings') }" rel="tooltip" data-placement="bottom" data-toggle="modal" data-target="#settingsDemiModal"
- data-bind="css: {'btn': true}, visible: columns().length != 0">
- <i class="fa fa-cog"></i>
- </a>
- <a class="btn pointer" title="${ _('Query Definitions') }" rel="tooltip" data-placement="bottom" data-toggle="modal" data-target="#qdefinitionsDemiModal"
- data-bind="css: {'btn': true}, visible: columns().length != 0">
- <i class="fa fa-bookmark-o"></i>
- </a>
- <span data-bind="visible: columns().length != 0"> </span>
- <a class="btn" href="${ url('search:new_search') }" title="${ _('New') }" rel="tooltip" data-placement="bottom" data-bind="css: {'btn': true}">
- <i class="fa fa-file-o"></i>
- </a>
- <a class="btn" href="${ url('search:admin_collections') }" title="${ _('Dashboards') }" rel="tooltip" data-placement="bottom" data-bind="css: {'btn': true}">
- <i class="fa fa-tags"></i>
- </a>
- </div>
- <form data-bind="visible: $root.isEditing() && columns().length == 0">
- ${ _('Select a search index') }
- <!-- ko if: columns().length == 0 -->
- <select data-bind="options: $root.initial.collections, value: $root.collection.name, disable: isSyncingCollections">
- </select>
- <label class="checkbox" style="display:inline-block; margin-left: 10px">
- <input type="checkbox" data-bind="checked: showCores" />${ _('Show cores') }
- <i class="fa fa-spinner fa-spin" data-bind="visible: isSyncingCollections"></i>
- </label>
- <!-- /ko -->
- <select data-bind="options: $root.availableDateFields, value: collection.timeFilter.field, optionsValue: 'name', visible: $root.isEditing() && $root.availableDateFields().length > 0" class="input-medium" style="margin-left: 4px"></select>
- <span data-bind="template: {name: 'time-filter'}, visible: collection.timeFilter.type() == 'rolling'"></span>
- <span data-bind="template: {name: 'time-fixed-filter'}, visible: collection.timeFilter.type() == 'fixed'"></span>
- </form>
- <form class="form-search" style="margin: 0" data-bind="submit: searchBtn, visible: columns().length != 0">
- <strong>${_("Search")}</strong>
- <div class="input-append">
- <div class="selectMask">
- <span
- data-bind="editable: collection.label, editableOptions: {enabled: $root.isEditing(), placement: 'right'}">
- </span>
- </div>
- <span data-bind="foreach: query.qs">
- <input data-bind="clearable: q, valueUpdate:'afterkeydown', typeahead: { target: q, nonBindableSource: queryTypeahead, multipleValues: true, multipleValuesSeparator: ':', extraKeywords: 'AND OR TO', completeSolrRanges: true }, css:{'input-xlarge': $root.query.qs().length == 1, 'input-medium': $root.query.qs().length < 4, 'input-small': $root.query.qs().length >= 4}" maxlength="4096" type="text" class="search-query">
- <!-- ko if: $index() >= 1 -->
- <a class="btn" href="javascript:void(0)" data-bind="click: $root.query.removeQ"><i class="fa fa-minus"></i></a>
- <!-- /ko -->
- </span>
- <a class="btn" href="javascript:void(0)" data-bind="click: $root.query.addQ"><i class="fa fa-plus"></i></a>
- <button type="submit" id="search-btn" class="btn btn-inverse" style="margin-left:10px; margin-right:10px">
- <i class="fa fa-search" data-bind="visible: ! isRetrievingResults()"></i>
- <!--[if !IE]> --><i class="fa fa-spinner fa-spin" data-bind="visible: isRetrievingResults()"></i><!-- <![endif]-->
- <!--[if IE]><img src="${ static('desktop/art/spinner-inverted.gif') }" data-bind="visible: isRetrievingResults()"/><![endif]-->
- </button>
- </div>
- <span data-bind="template: {name: 'time-filter'}, visible: collection.timeFilter.type() == 'rolling'"></span>
- <span data-bind="template: {name: 'time-fixed-filter'}, visible: collection.timeFilter.type() == 'fixed'"></span>
- </form>
- </div>
- <%dashboard:layout_toolbar>
- <%def name="results()">
- <div data-bind="css: { 'draggable-widget': true, 'disabled': !availableDraggableResultset() },
- draggable: {data: draggableResultset(), isEnabled: availableDraggableResultset,
- options: {'start': function(event, ui){lastWindowScrollPosition = $(window).scrollTop();$('.card-body').slideUp('fast');},
- 'stop': function(event, ui){$('.card-body').slideDown('fast'); $root.collection.template.isGridLayout(true); checkResultHighlightingAvailability(); }}}"
- title="${_('Grid')}" rel="tooltip" data-placement="top">
- <a data-bind="style: { cursor: $root.availableDraggableResultset() ? 'move' : 'default' }">
- <i class="fa fa-table"></i>
- </a>
- </div>
- <div data-bind="css: { 'draggable-widget': true, 'disabled': !availableDraggableResultset() },
- draggable: {data: draggableHtmlResultset(),
- isEnabled: availableDraggableResultset,
- options: {'start': function(event, ui){lastWindowScrollPosition = $(window).scrollTop();$('.card-body').slideUp('fast');},
- 'stop': function(event, ui){
- $('.card-body').slideDown('fast', function(){$(window).scrollTop(lastWindowScrollPosition)});
- $root.collection.template.isGridLayout(false);
- checkResultHighlightingAvailability();
- }
- }
- }"
- title="${_('HTML')}" rel="tooltip" data-placement="top">
- <a data-bind="style: { cursor: $root.availableDraggableResultset() ? 'move' : 'default' }">
- <i class="fa fa-code"></i>
- </a>
- </div>
- <div data-bind="css: { 'draggable-widget': true, 'disabled': !availableDraggableFilter() },
- draggable: {data: draggableFilter(), isEnabled: availableDraggableFilter,
- options: {'start': function(event, ui){lastWindowScrollPosition = $(window).scrollTop();$('.card-body').slideUp('fast');},
- 'stop': function(event, ui){$('.card-body').slideDown('fast', function(){$(window).scrollTop(lastWindowScrollPosition)});}}}"
- title="${_('Filter Bar')}" rel="tooltip" data-placement="top">
- <a data-bind="style: { cursor: $root.availableDraggableFilter() ? 'move' : 'default' }">
- <i class="fa fa-filter"></i>
- </a>
- </div>
- <div data-bind="visible: $root.isLatest,
- css: { 'draggable-widget': true, 'disabled': !availableDraggableNumbers() },
- draggable: {data: draggableCounter(), isEnabled: availableDraggableNumbers,
- options: {'start': function(event, ui){lastWindowScrollPosition = $(window).scrollTop();$('.card-body').slideUp('fast');},
- 'stop': function(event, ui){$('.card-body').slideDown('fast', function(){$(window).scrollTop(lastWindowScrollPosition)});}}}"
- title="${_('Counter')}" rel="tooltip" data-placement="top">
- <a data-bind="style: { cursor: $root.availableDraggableNumbers() ? 'move' : 'default' }">
- <i class="fa fa-superscript" style="font-size: 110%"></i>
- </a>
- </div>
- <div data-bind="css: { 'draggable-widget': true, 'disabled': !availableDraggableLeaflet()},
- draggable: {data: draggableLeafletMap(), isEnabled: availableDraggableLeaflet,
- options: {'start': function(event, ui){lastWindowScrollPosition = $(window).scrollTop();$('.card-body').slideUp('fast');},
- 'stop': function(event, ui){$('.card-body').slideDown('fast', function(){$(window).scrollTop(lastWindowScrollPosition)});}}}"
- title="${_('Marker Map')}" rel="tooltip" data-placement="top">
- <a data-bind="style: { cursor: 'move' }">
- <i class="fa fa-map-marker"></i>
- </a>
- </div>
- </%def>
- <%def name="widgets()">
- <div data-bind="css: { 'draggable-widget': true, 'disabled': !availableDraggableChart() },
- draggable: {data: draggableFacet(), isEnabled: availableDraggableChart,
- options: {'start': function(event, ui){lastWindowScrollPosition = $(window).scrollTop();$('.card-body').slideUp('fast');},
- 'stop': function(event, ui){$('.card-body').slideDown('fast', function(){$(window).scrollTop(lastWindowScrollPosition)});}}}"
- title="${_('Text Facet')}" rel="tooltip" data-placement="top">
- <a data-bind="style: { cursor: $root.availableDraggableChart() ? 'move' : 'default' }">
- <i class="fa fa-sort-amount-asc"></i>
- </a>
- </div>
- <div data-bind="css: { 'draggable-widget': true, 'disabled': !availableDraggableChart() },
- draggable: {data: draggablePie(), isEnabled: availableDraggableChart,
- options: {'start': function(event, ui){lastWindowScrollPosition = $(window).scrollTop();$('.card-body').slideUp('fast');},
- 'stop': function(event, ui){$('.card-body').slideDown('fast', function(){$(window).scrollTop(lastWindowScrollPosition)});}}}"
- title="${_('Pie Chart')}" rel="tooltip" data-placement="top">
- <a data-bind="style: { cursor: $root.availableDraggableChart() ? 'move' : 'default' }">
- <i class="hcha hcha-pie-chart"></i>
- </a>
- </div>
- <div data-bind="visible: ! $root.isLatest(),
- css: { 'draggable-widget': true, 'disabled': !availableDraggableChart() },
- draggable: {data: draggableBar(), isEnabled: availableDraggableChart,
- options: {'start': function(event, ui){lastWindowScrollPosition = $(window).scrollTop();$('.card-body').slideUp('fast');},
- 'stop': function(event, ui){$('.card-body').slideDown('fast', function(){$(window).scrollTop(lastWindowScrollPosition)});}}}"
- title="${_('Bar Chart')}" rel="tooltip" data-placement="top">
- <a data-bind="style: { cursor: $root.availableDraggableChart() ? 'move' : 'default' }">
- <i class="hcha hcha-bar-chart"></i>
- </a>
- </div>
- <div data-bind="visible: ! $root.isLatest(),
- css: { 'draggable-widget': true, 'disabled': !availableDraggableNumbers() },
- draggable: {data: draggableLine(), isEnabled: availableDraggableNumbers,
- options: {'start': function(event, ui){lastWindowScrollPosition = $(window).scrollTop();$('.card-body').slideUp('fast');},
- 'stop': function(event, ui){$('.card-body').slideDown('fast', function(){$(window).scrollTop(lastWindowScrollPosition)});}}}"
- title="${_('Line Chart')}" rel="tooltip" data-placement="top">
- <a data-bind="style: { cursor: $root.availableDraggableNumbers() ? 'move' : 'default' }">
- <i class="hcha hcha-line-chart"></i>
- </a>
- </div>
- <div data-bind="visible: $root.isLatest(),
- css: { 'draggable-widget': true, 'disabled': ! availableDraggableChart() },
- draggable: {data: draggableBucket(), isEnabled: availableDraggableChart,
- options: {'start': function(event, ui){lastWindowScrollPosition = $(window).scrollTop();$('.card-body').slideUp('fast');},
- 'stop': function(event, ui){$('.card-body').slideDown('fast', function(){$(window).scrollTop(lastWindowScrollPosition)});}}}"
- title="${_('Chart')}" rel="tooltip" data-placement="top">
- <a data-bind="style: { cursor: $root.availableDraggableChart() ? 'move' : 'default' }">
- <i class="hcha hcha-bar-chart"></i>
- </a>
- </div>
- <div data-bind="css: { 'draggable-widget': true, 'disabled': false },
- draggable: {data: draggableTree(), isEnabled: true,
- options: {'start': function(event, ui){lastWindowScrollPosition = $(window).scrollTop();$('.card-body').slideUp('fast');},
- 'stop': function(event, ui){$('.card-body').slideDown('fast', function(){$(window).scrollTop(lastWindowScrollPosition)});}}}"
- title="${_('Tree')}" rel="tooltip" data-placement="top">
- <a data-bind="style: { cursor: $root.availableDraggableChart() ? 'move' : 'default' }">
- <i class="fa fa-sitemap fa-rotate-270"></i>
- </a>
- </div>
- <div data-bind="visible: ! $root.isLatest(),
- css: { 'draggable-widget': true, 'disabled': false },
- draggable: {data: draggableHeatmap(), isEnabled: true,
- options: {'start': function(event, ui){lastWindowScrollPosition = $(window).scrollTop();$('.card-body').slideUp('fast');},
- 'stop': function(event, ui){$('.card-body').slideDown('fast', function(){$(window).scrollTop(lastWindowScrollPosition)});}}}"
- title="${_('Heatmap')}" rel="tooltip" data-placement="top">
- <a data-bind="style: { cursor: $root.availableDraggableChart() ? 'move' : 'default' }">
- <i class="fa fa-th"></i>
- </a>
- </div>
- <div data-bind="css: { 'draggable-widget': true, 'disabled': ! availableDraggableHistogram() },
- draggable: {data: draggableHistogram(), isEnabled: availableDraggableHistogram,
- options: {'start': function(event, ui){lastWindowScrollPosition = $(window).scrollTop();$('.card-body').slideUp('fast');},
- 'stop': function(event, ui){$('.card-body').slideDown('fast', function(){$(window).scrollTop(lastWindowScrollPosition)});}}}"
- title="${_('Timeline')}" rel="tooltip" data-placement="top">
- <a data-bind="style: { cursor: $root.availableDraggableHistogram() ? 'move' : 'default' }">
- <i class="hcha hcha-timeline-chart"></i>
- </a>
- </div>
- <div data-bind="css: { 'draggable-widget': true, 'disabled': ! availableDraggableMap() },
- draggable: {data: draggableMap(), isEnabled: availableDraggableMap,
- options: {'start': function(event, ui){lastWindowScrollPosition = $(window).scrollTop();$('.card-body').slideUp('fast');},
- 'stop': function(event, ui){$('.card-body').slideDown('fast', function(){$(window).scrollTop(lastWindowScrollPosition)});}}}"
- title="${_('Gradient Map')}" rel="tooltip" data-placement="top">
- <a data-bind="style: { cursor: $root.availableDraggableMap() ? 'move' : 'default' }">
- <i class="hcha hcha-map-chart"></i>
- </a>
- </div>
- </%def>
- </%dashboard:layout_toolbar>
- <div class="player-toolbar" data-bind="visible: $root.isPlayerMode">
- <div class="pull-right pointer" data-bind="visible: $root.isPlayerMode, click: function(){ hueUtils.exitFullScreen(); $root.isPlayerMode(false); }"><i class="fa fa-times"></i></div>
- <img src="${ static('desktop/art/icon_hue_48.png') }" />
- <h4 data-bind="text: collection.label"></h4>
- <form class="form-search" data-bind="submit: searchBtn">
- <span data-bind="foreach: query.qs">
- <input data-bind="clearable: q, typeahead: { target: q, source: $root.collection.template.fieldsNames, multipleValues: true, multipleValuesSeparator: ':', extraKeywords: 'AND OR TO', completeSolrRanges: true }, css:{'input-xlarge': $root.query.qs().length == 1, 'input-medium': $root.query.qs().length < 4, 'input-small': $root.query.qs().length >= 4}" maxlength="4096" type="text" class="search-query">
- <!-- ko if: $parent.query.qs().length > 1 -->
- <div class="pointer muted link" data-bind="click: $root.query.removeQ"><i class="fa fa-minus"></i></div>
- <!-- /ko -->
- </span>
- <div class="pointer muted link" data-bind="click: $root.query.addQ"><i class="fa fa-plus"></i></div>
- <div class="pointer muted link" data-bind="click: $root.searchBtn"><i class="fa fa-search" data-bind="visible: ! isRetrievingResults()"></i></div>
- <!--[if !IE]> --><i class="fa fa-spinner fa-spin muted" data-bind="visible: isRetrievingResults()"></i><!-- <![endif]-->
- <!--[if IE]><img src="${ static('desktop/art/spinner.gif') }" data-bind="visible: isRetrievingResults()"/><![endif]-->
- </form>
- </div>
- ${ dashboard.layout_skeleton() }
- <script type="text/html" id="empty-widget">
- ${ _('This is an empty widget.')}
- </script>
- <script type="text/html" id="facet-toggle">
- <div class="facet-field-tile">
- <div class="facet-field-cnt">
- <span class="facet-field-label facet-field-label-fixed-width facet-field-label-fixed-width-double facet-field-label-title">${ _('Settings') }</span>
- <!--[if !IE]> --><i class="fa fa-spinner fa-spin" data-bind="visible: $root.isRetrievingResults()"></i><!-- <![endif]-->
- <!--[if IE]><img src="${ static('desktop/art/spinner.gif') }" data-bind="visible: $root.isRetrievingResults()"/><![endif]-->
- </div>
- <div class="facet-field-cnt" data-bind="visible: properties.canRange">
- <span class="facet-field-label facet-field-label-fixed-width">${ _('Type') }</span>
- <a href="javascript: void(0)" title="${ _('Toggle how to group the values') }" data-bind="click: $root.collection.toggleRangeFacet">
- <i class="fa" data-bind="css: { 'fa-arrows-h': type() == 'range', 'fa-circle': type() == 'field', 'fa-level-up': type() == 'range-up' }, attr: { title: type() == 'field' ? 'Range' : type() == 'range-up' ? 'Range and up' : 'Term' }"></i>
- <span data-bind="visible: type() == 'range'">${_('range')}</span>
- <span data-bind="visible: type() == 'range-up'">${_('range & up')}</span>
- <span data-bind="visible: type() == 'field'">${_('field')}</span>
- </a>
- </div>
- <div class="facet-field-cnt">
- <span class="facet-field-label facet-field-label-fixed-width">${ _('Sorting') }</span>
- <a href="javascript: void(0)" title="${ _('Toggle sort order') }" data-bind="click: $root.collection.toggleSortFacet">
- <i class="fa" data-bind="css: { 'fa-caret-down': properties.sort() == 'desc', 'fa-caret-up': properties.sort() == 'asc' }"></i>
- <span data-bind="visible: properties.sort() == 'desc'">${_('descending')}</span>
- <span data-bind="visible: properties.sort() == 'asc'">${_('ascending')}</span>
- </a>
- </div>
- <!-- ko if: type() == 'pivot' -->
- <div class="facet-field-cnt">
- <span class="spinedit-cnt">
- <span class="facet-field-label facet-field-label-fixed-width">
- ${ _('Limit') }
- </span>
- <input type="text" class="input-medium" data-bind="spinedit: properties.limit"/>
- </span>
- </div>
- <div class="facet-field-cnt">
- <span class="spinedit-cnt">
- <span class="facet-field-label facet-field-label-fixed-width">
- ${ _('Min Count') }
- </span>
- <input type="text" class="input-medium" data-bind="spinedit: properties.mincount"/>
- </span>
- </div>
- <!-- /ko -->
- <!-- ko if: type() == 'range' || type() == 'range-up' || (type() == 'nested' && typeof properties.min != "undefined") -->
- <!-- ko ifnot: properties.isDate() -->
- <div class="slider-cnt" data-bind="slider: {start: properties.min, end: properties.max, gap: properties.initial_gap, min: properties.initial_start, max: properties.initial_end, properties: properties, labels: SLIDER_LABELS}"></div>
- <!-- /ko -->
- <!-- ko if: properties.isDate() && $root.collection.timeFilter && $root.collection.timeFilter.field && $root.collection.timeFilter.field() != field() -->
- <div data-bind="daterangepicker: {start: properties.start, end: properties.end, gap: properties.initial_gap, relatedgap: properties.gap, min: properties.min, max: properties.max}"></div>
- <br/>
- <!-- /ko -->
- <!-- /ko -->
- <!-- ko if: type() == 'field' -->
- <div class="facet-field-cnt">
- <span class="spinedit-cnt">
- <span class="facet-field-label facet-field-label-fixed-width">
- ${ _('Limit') }
- </span>
- <input type="text" class="input-medium" data-bind="spinedit: properties.limit"/>
- </span>
- </div>
- <!-- /ko -->
- <!-- ko if: widgetType() == 'map-widget' -->
- <div class="facet-field-cnt">
- <span class="spinedit-cnt">
- <span class="facet-field-label facet-field-label-fixed-width">
- ${ _('Scope') }
- </span>
- <select data-bind="selectedOptions: properties.scope" class="input-small">
- <option value="world">${ _("World") }</option>
- <option value="europe">${ _("Europe") }</option>
- <option value="aus">${ _("Australia") }</option>
- <option value="bra">${ _("Brazil") }</option>
- <option value="can">${ _("Canada") }</option>
- <option value="chn">${ _("China") }</option>
- <option value="fra">${ _("France") }</option>
- <option value="deu">${ _("Germany") }</option>
- <option value="ita">${ _("Italy") }</option>
- <option value="jpn">${ _("Japan") }</option>
- <option value="gbr">${ _("UK") }</option>
- <option value="usa">${ _("USA") }</option>
- </select>
- </span>
- </div>
- <!-- /ko -->
- </div>
- <!-- ko if: type() == 'pivot' || type() == 'nested' -->
- <div class="facet-field-tile" data-bind="visible: properties.scope() == 'tree' || (type() == 'pivot' && properties.facets().length == 0) || (type() == 'nested' && properties.facets().length < 3)">
- <div class="facet-field-cnt">
- <span class="facet-field-label facet-field-label-fixed-width facet-field-label-fixed-width-double facet-field-label-title">
- ${ _('Add a dimension') }
- </span>
- </div>
- <div class="facet-field-cnt">
- <span class="spinedit-cnt">
- <span class="facet-field-label facet-field-label-fixed-width">
- ${ _('Field') }
- </span>
- <select data-bind="options: $root.collection.template.fieldsNames, value: properties.facets_form.field, optionsCaption: '${ _ko('Choose...') }'"></select>
- </span>
- </div>
- <!-- ko if: type() == 'nested' -->
- <div class="facet-field-cnt">
- <span class="spinedit-cnt">
- <span class="facet-field-label facet-field-label-fixed-width">
- ${ _('Metric') }
- </span>
- <select data-bind="options: HIT_OPTIONS, optionsText: 'label', optionsValue: 'value', value: properties.facets_form.aggregate"></select>
- </span>
- </div>
- <!-- /ko -->
- <div class="facet-field-cnt">
- <span class="spinedit-cnt">
- <span class="facet-field-label facet-field-label-fixed-width">
- ${ _('Limit') }
- </span>
- <input type="text" class="input-medium" data-bind="spinedit: properties.facets_form.limit"/>
- </span>
- </div>
- <div class="facet-field-cnt">
- <span class="spinedit-cnt">
- <span class="facet-field-label facet-field-label-fixed-width">
- ${ _('Min Count') }
- </span>
- <input type="text" class="input-medium" data-bind="spinedit: properties.facets_form.mincount"/>
- <a class="pull-right" href="javascript: void(0)" data-bind="visible: ko.toJSON(properties.facets_form.field) != '', click: $root.collection.addPivotFacetValue">
- <i class="fa fa-plus"></i>
- </a>
- </span>
- </div>
- </div>
- <!-- /ko -->
- <div class="clearfix"></div>
- </script>
- <script type="text/html" id="facet-widget">
- <div class="widget-spinner" data-bind="visible: isLoading()">
- <!--[if !IE]> --><i class="fa fa-spinner fa-spin"></i><!-- <![endif]-->
- <!--[if IE]><img src="${ static('desktop/art/spinner.gif') }" /><![endif]-->
- </div>
- <!-- ko if: $root.getFacetFromQuery(id()).has_data() -->
- <div class="row-fluid" data-bind="with: $root.getFacetFromQuery(id())">
- <div data-bind="visible: $root.isEditing, with: $root.collection.getFacetById($parent.id())" style="margin-bottom: 20px">
- <span data-bind="template: { name: 'facet-toggle', afterRender: function(){ $root.getWidgetById($parent.id()).isLoading(false); } }">
- </span>
- </div>
- <div data-bind="with: $root.collection.getFacetById($parent.id())">
- <!-- ko if: type() == 'field' -->
- <div data-bind="foreach: $parent.counts">
- <div class="trigger-exclude">
- <!-- ko if: $index() < $parent.properties.limit() -->
- <!-- ko if: ! $data.selected -->
- <a class="exclude pointer" data-bind="click: function(){ $root.query.toggleFacet({facet: $data, widget_id: $parent.id(), 'exclude': true}) }" title="${ _('Exclude this value') }"><i class="fa fa-minus"></i></a>
- <div class="hellip">
- <a class="pointer" dir="ltr" data-bind="html: prettifyDate($data.value), click: function(){ $root.query.toggleFacet({facet: $data, widget_id: $parent.id()}) }, attr: {'title': $data.value + ' (' + $data.count + ')'}"></a>
- <span class="pointer counter" dir="rtl" data-bind="text: ' (' + $data.count + ')', click: function(){ $root.query.toggleFacet({facet: $data, widget_id: $parent.id()}) }"></span>
- </div>
- <!-- /ko -->
- <!-- ko if: $data.selected -->
- <span class="pointer" data-bind="click: function(){ $root.query.toggleFacet({facet: $data, widget_id: $parent.id()}) }">
- <a class="include pointer" data-bind="visible: ! exclude"><i class="fa fa-times"></i></a>
- <a class="include pointer" data-bind="visible: exclude"><i class="fa fa-plus"></i></a>
- <div class="hellip">
- <strong data-bind="html: prettifyDate($data.value), attr: {'title': $data.value}"></strong>
- </div>
- </span>
- <!-- /ko -->
- <!-- /ko -->
- <!-- ko if: $index() == $parent.properties.limit() -->
- <!-- ko if: $parent.properties.prevLimit == undefined || $parent.properties.prevLimit == $parent.properties.limit() -->
- <a class="pointer" data-bind="click: function(){ $root.collection.upDownFacetLimit($parent.id(), 'up') }">
- ${ _('Show more...') }
- </a>
- <!-- /ko -->
- <!-- ko if: $parent.properties.prevLimit != undefined && $parent.properties.prevLimit != $parent.properties.limit() -->
- <a class="pointer" data-bind="click: function(){ $root.collection.upDownFacetLimit($parent.id(), 'up') }">
- ${ _('Show more') }
- </a>
- /
- <a class="pointer" data-bind="click: function(){ $root.collection.upDownFacetLimit($parent.id(), 'down') }">
- ${ _('less...') }
- </a>
- <!-- /ko -->
- <!-- /ko -->
- </div>
- </div>
- <!-- /ko -->
- <!-- ko if: type() == 'range' -->
- <div data-bind="foreach: $parent.counts">
- <div class="trigger-exclude">
- <!-- ko if: ! selected -->
- <a class="exclude pointer" data-bind="click: function(){ $root.query.selectRangeFacet({count: $data.value, widget_id: $parent.id(), from: $data.from, to: $data.to, cat: $data.field, 'exclude': true}) }" title="${ _('Exclude this value') }"><i class="fa fa-minus"></i></a>
- <div class="hellip">
- <a class="pointer" data-bind="html: $data.is_single_unit_gap ? prettifyDate($data.from, $parent, $data.to) : prettifyDateRange($data.from, $data.to, $parent, false), click: function(){ $root.query.selectRangeFacet({count: $data.value, widget_id: $parent.id(), from: $data.from, to: $data.to, cat: $data.field}) }, attr: {'title': ($data.is_single_unit_gap ? $data.from : $data.from + ' - ' + $data.to) + ' (' + $data.value + ')'}"></a>
- <span class="pointer counter" data-bind="text: ' (' + $data.value + ')', click: function(){ $root.query.selectRangeFacet({count: $data.value, widget_id: $parent.id(), from: $data.from, to: $data.to, cat: $data.field}) }"></span>
- </div>
- <!-- /ko -->
- <!-- ko if: selected -->
- <span class="pointer" data-bind="click: function(){ $root.query.selectRangeFacet({count: $data.value, widget_id: $parent.id(), from: $data.from, to: $data.to, cat: $data.field}) }">
- <a class="include pointer" data-bind="visible: ! exclude"><i class="fa fa-times"></i></a>
- <a class="include pointer" data-bind="visible: exclude"><i class="fa fa-plus"></i></a>
- <div class="hellip">
- <strong data-bind="html: $data.is_single_unit_gap ? prettifyDate($data.from, $parent, $data.to) : prettifyDateRange($data.from, $data.to, $parent, false), attr: {'title': ($data.is_single_unit_gap ? $data.from : $data.from + ' - ' + $data.to) + ' (' + $data.value + ')'}"></strong>
- </div>
- </span>
- <!-- /ko -->
- </div>
- </div>
- <!-- /ko -->
- <!-- ko if: type() == 'range-up' -->
- <div data-bind="foreach: $parent.counts">
- <div class="trigger-exclude">
- <!-- ko if: ! selected -->
- <a class="exclude pointer" data-bind="click: function(){ $root.query.selectRangeUpFacet({count: $data.value, widget_id: $parent.id(), from: $data.from, to: $data.to, cat: $data.field, 'exclude': true, is_up: $data.is_up}) }" title="${ _('Exclude this value') }"><i class="fa fa-minus"></i></a>
- <div class="hellip">
- <a class="pointer" data-bind="html: prettifyDate($data.from, $parent) + ($data.is_up ? ' & Up' : ' & Less'), click: function(){ $root.query.selectRangeUpFacet({count: $data.value, widget_id: $parent.id(), from: $data.from, to: $data.to, cat: $data.field, is_up: $data.is_up}) }, attr: {'title': $data.from + ($data.is_up ? ' & Up' : ' & Less') + ' (' + $data.total_counts + ')'}"></a>
- <span class="pointer counter" data-bind="text: ' (' + $data.total_counts + ')', click: function(){ $root.query.selectRangeUpFacet({count: $data.value, widget_id: $parent.id(), from: $data.from, to: $data.to, cat: $data.field, is_up: $data.is_up}) }"></span>
- </div>
- <!-- /ko -->
- <!-- ko if: selected -->
- <span class="pointer" data-bind="click: function(){ $root.query.selectRangeUpFacet({count: $data.value, widget_id: $parent.id(), from: $data.from, to: $data.to, cat: $data.field, is_up: $data.is_up}) }">
- <a class="include pointer" data-bind="visible: ! exclude"><i class="fa fa-times"></i></a>
- <a class="include pointer" data-bind="visible: exclude"><i class="fa fa-plus"></i></a>
- <div class="hellip">
- <strong data-bind="html: prettifyDate($data.from, $parent) + ($data.is_up ? ' & Up' : ' & Less')"></strong>
- </div>
- </span>
- <!-- /ko -->
- </div>
- </div>
- <!-- /ko -->
- </div>
- </div>
- <!-- /ko -->
- </script>
- <script type="text/html" id="resultset-widget">
- <!-- ko if: $root.collection.template.isGridLayout() -->
- <div class="grid-row">
- <div class="grid-left-bar">
- <div>
- <!-- ko if: $root.response && $root.response().response && $root.response().response.numFound > 0 -->
- <div style="margin-top:3px">
- <a class="grid-side-btn active" href="javascript: void(0)"
- data-bind="click: function(){ $root.collection.template.showChart(false); $root.collection.template.showGrid(true); }, css: {'active': $root.collection.template.showGrid() }" title="${_('Grid')}">
- <i class="fa fa-th"></i>
- </a>
- </div>
- <div class="dropdown">
- <a class="grid-side-btn" style="padding-right:0" href="javascript:void(0)"
- data-bind="css: {'active': $root.collection.template.showChart() }, click: function(){ $root.collection.template.showChart(true); $root.collection.template.showGrid(false); }">
- <i class="hcha hcha-bar-chart" data-bind="visible: $root.collection.template.chartSettings.chartType() == ko.HUE_CHARTS.TYPES.BARCHART"></i>
- <i class="hcha hcha-line-chart" data-bind="visible: $root.collection.template.chartSettings.chartType() == ko.HUE_CHARTS.TYPES.LINECHART"
- style="display: none;"></i>
- <i class="hcha hcha-pie-chart" data-bind="visible: $root.collection.template.chartSettings.chartType() == ko.HUE_CHARTS.TYPES.PIECHART"
- style="display: none;"></i>
- <i class="fa fa-fw fa-dot-circle-o"
- data-bind="visible: $root.collection.template.chartSettings.chartType() == ko.HUE_CHARTS.TYPES.SCATTERCHART" style="display: none;"></i>
- <i class="fa fa-fw fa-map-marker" data-bind="visible: $root.collection.template.chartSettings.chartType() == ko.HUE_CHARTS.TYPES.MAP"
- style="display: none;"></i>
- <i class="hcha hcha-map-chart" data-bind="visible: $root.collection.template.chartSettings.chartType() == ko.HUE_CHARTS.TYPES.GRADIENTMAP"
- style="display: none;"></i>
- </a>
- <a class="dropdown-toggle grid-side-btn" style="padding:0" data-toggle="dropdown"
- href="javascript: void(0)" data-bind="css: {'active': $root.collection.template.showChart()}">
- <i class="fa fa-caret-down"></i>
- </a>
- <ul class="dropdown-menu">
- <li>
- <a href="javascript:void(0)"
- data-bind="css: {'active': $root.collection.template.chartSettings.chartType() == ko.HUE_CHARTS.TYPES.BARCHART}, click: function(){ $root.collection.template.chartSettings.chartType(ko.HUE_CHARTS.TYPES.BARCHART); }"
- class="active">
- <i class="hcha hcha-bar-chart"></i> ${_('Bars')}
- </a>
- </li>
- <li>
- <a href="javascript:void(0)"
- data-bind="css: {'active': $root.collection.template.chartSettings.chartType() == ko.HUE_CHARTS.TYPES.LINECHART}, click: function(){ $root.collection.template.chartSettings.chartType(ko.HUE_CHARTS.TYPES.LINECHART); }">
- <i class="hcha hcha-line-chart"></i> ${_('Lines')}
- </a>
- </li>
- <li>
- <a href="javascript:void(0)"
- data-bind="css: {'active': $root.collection.template.chartSettings.chartType() == ko.HUE_CHARTS.TYPES.PIECHART}, click: function(){ $root.collection.template.chartSettings.chartType(ko.HUE_CHARTS.TYPES.PIECHART); }">
- <i class="hcha hcha-pie-chart"></i> ${_('Pie')}
- </a>
- </li>
- ## <li>
- ## <a href="javascript:void(0)"
- ## data-bind="css: {'active': $root.collection.template.chartSettings.chartType() == ko.HUE_CHARTS.TYPES.SCATTERCHART}, click: function(){ $root.collection.template.chartSettings.chartType(ko.HUE_CHARTS.TYPES.SCATTERCHART); }">
- ## <i class="fa fa-fw fa-dot-circle-o chart-icon"></i> ${_('Scatter')}
- ## </a>
- ## </li>
- <li>
- <a href="javascript:void(0)"
- data-bind="css: {'active': $root.collection.template.chartSettings.chartType() == ko.HUE_CHARTS.TYPES.MAP}, click: function(){ $root.collection.template.chartSettings.chartType(ko.HUE_CHARTS.TYPES.MAP); }">
- <i class="fa fa-fw fa-map-marker chart-icon"></i> ${_('Marker Map')}
- </a>
- </li>
- ## <li>
- ## <a href="javascript:void(0)"
- ## data-bind="css: {'active': $root.collection.template.chartSettings.chartType() == ko.HUE_CHARTS.TYPES.GRADIENTMAP}, click: function(){ $root.collection.template.chartSettings.chartType(ko.HUE_CHARTS.TYPES.GRADIENTMAP); }">
- ## <i class="hcha hcha-map-chart"></i> ${_('Gradient Map')}
- ## </a>
- ## </li>
- </ul>
- </div>
- <div>
- <a class="grid-side-btn" href="javascript:void(0)" data-bind="click: function(){ $root.collection.template.showFieldList(!$root.collection.template.showFieldList())}, css: { 'blue' : $root.collection.template.showFieldList() }"><i
- class="fa fa-cog"></i></a>
- </div>
- <form method="POST" action="${ url('search:download') }" style="display:inline">
- ${ csrf_token(request) | n,unicode }
- <input type="hidden" name="collection" data-bind="value: ko.mapping.toJSON($root.collection)"/>
- <input type="hidden" name="query" data-bind="value: ko.mapping.toJSON($root.query)"/>
- <input type="hidden" name="download">
- <input type="hidden" name="type" value="">
- <div class="dropdown">
- <a class="grid-side-btn dropdown-toggle" style="padding-left:7px" data-toggle="dropdown">
- <i class="fa fa-download"></i>
- </a>
- <ul class="dropdown-menu">
- <li>
- <a class="inactive-action download" href="javascript:void(0)" data-bind="click: function(widget, event){ var $f = $(event.currentTarget).parents('form'); $f.find('[name=\'type\']').val('csv'); $f.submit()}" title="${ _('Download first rows as JSON') }">
- <i class="hfo hfo-file-csv"></i> CSV
- </a>
- </li>
- <li>
- <a class="inactive-action download" href="javascript:void(0)" data-bind="click: function(widget, event){ var $f = $(event.currentTarget).parents('form'); $f.find('[name=\'type\']').val('xls'); $f.submit()}" title="${ _('Download first rows as XLS') }">
- <i class="hfo hfo-file-xls"></i> Excel
- </a>
- </li>
- <li>
- <a class="inactive-action download" href="javascript:void(0)" data-bind="click: function(widget, event){ var $f = $(event.currentTarget).parents('form'); $f.find('[name=\'type\']').val('json'); $f.submit()}" title="${ _('Download first rows as JSON') }">
- <i class="hfo hfo-file-json"></i> JSON
- </a>
- </li>
- </ul>
- </div>
- </form>
- <!-- /ko -->
- </div>
- </div>
- </div>
- <div class="grid-results">
- <span data-bind="visible: $root.hasRetrievedResults() && $root.response().response">
- <div data-bind="visible: $root.collection.template.showFieldList() && $root.collection.template.showGrid()" style="float:left; width:200px; margin-right:10px; background-color:#FFF; padding:5px; border-right:1px solid #EEE">
- <input type="text" data-bind="clearable: $root.collection.template.fieldsAttributesFilter, valueUpdate:'afterkeydown'" placeholder="${_('Filter fields')}" style="width:180px; margin-bottom:10px" />
- <div style="margin-bottom: 8px">
- <a href="javascript: void(0)" data-bind="click: function(){$root.collection.template.filteredAttributeFieldsAll(true)}, style: {'font-weight': $root.collection.template.filteredAttributeFieldsAll() ? 'bold': 'normal'}">${_('All')} (<span data-bind="text: $root.collection.template.fieldsAttributes().length"></span>)</a> / <a href="javascript: void(0)" data-bind="click: function(){$root.collection.template.filteredAttributeFieldsAll(false)}, style: {'font-weight': ! $root.collection.template.filteredAttributeFieldsAll() ? 'bold': 'normal'}">${_('Current')} (<span data-bind="text: $root.collection.template.fields().length"></span>)</a>
- </div>
- <div style="border-bottom: 1px solid #CCC; padding-bottom: 4px;">
- <a href="javascript: void(0)" class="btn btn-mini"
- data-bind="click: toggleGridFieldsSelection, css: { 'btn-inverse': $root.collection.template.fields().length > 0 }"
- style="margin-right: 2px;">
- <i class="fa fa-square-o"></i>
- </a>
- <strong>${_('Field Name')}</strong>
- </div>
- <div class="fields-list" data-bind="foreach: $root.collection.template.filteredAttributeFields">
- <div style="margin-bottom: 3px; white-space: nowrap">
- <i class="fa fa-question-circle pull-right muted pointer analysis" data-bind="click: function() { $root.fieldAnalysesName(name()); $root.showFieldAnalysis(); }, attr: {'title': '${ _ko('Click to analyze field') } ' + name() + ' (' + type() + ')'}"></i>
- <input type="checkbox" data-bind="checkedValue: name, checked: $root.collection.template.fieldsSelected" style="margin: 0" />
- <div data-bind="text: name, css:{'field-selector': true, 'hoverable': $root.collection.template.fieldsSelected.indexOf(name()) > -1}, click: highlightColumn" style="margin-right:10px"></div>
- </div>
- </div>
- <div data-bind="visible: $root.collection.template.filteredAttributeFields().length == 0" style="padding-left:4px; padding-top:5px; font-size:40px; color:#CCC">
- <i class="fa fa-frown-o"></i>
- </div>
- </div>
- <div data-bind="visible: $root.collection.template.showFieldList() && $root.collection.template.showChart()" style="float:left; width:200px; margin-right:10px; background-color:#FFF; padding:5px; border-right: 1px solid #EEE">
- <span data-bind="template: {name: 'grid-chart-settings', data: $root.collection.template.chartSettings}"></span>
- </div>
- </span>
- <div class="widget-spinner" data-bind="visible: ! $root.hasRetrievedResults() || !$root.response().response">
- <!--[if !IE]> --><i class="fa fa-spinner fa-spin"></i><!-- <![endif]-->
- <!--[if IE]><img src="${ static('desktop/art/spinner.gif') }" /><![endif]-->
- </div>
- <div data-bind="visible: $root.hasRetrievedResults() && $root.results().length == 0 && $root.response().response">
- <br/>
- ${ _('Your search did not match any documents.') }
- </div>
- <div data-bind="visible: $root.hasRetrievedResults() && $root.results().length > 0 && $root.collection.template.showGrid()">
- <!-- ko if: $root.response().response -->
- <div data-bind="template: {name: 'resultset-pagination', data: $root.response()}" style="padding:8px; color:#666"></div>
- <!-- /ko -->
- <div id="result-main" style="overflow-x: auto">
- <table id="result-container" data-bind="visible: $root.hasRetrievedResults()" style="margin-top: 0; width: 100%">
- <thead>
- <tr data-bind="visible: $root.collection.template.fieldsSelected().length > 0, template: {name: 'result-sorting'}">
- </tr>
- <tr data-bind="visible: $root.collection.template.fieldsSelected().length == 0">
- <th style="width: 18px"> </th>
- <th>${ _('Document') }</th>
- </tr>
- </thead>
- <tbody data-bind="foreach: {data: $root.results, as: 'doc'}" class="result-tbody">
- <tr class="result-row" data-bind="style: {'backgroundColor': $index() % 2 == 0 ? '#FFF': '#F6F6F6'}">
- <td>
- <a href="javascript:void(0)" data-bind="click: toggleDocDetails">
- <i class="fa" data-bind="css: {'fa-caret-right' : ! doc.showDetails(), 'fa-caret-down': doc.showDetails()}"></i>
- </a>
- </td>
- <!-- ko foreach: row -->
- <td data-bind="html: $data"></td>
- <!-- /ko -->
- </tr>
- <tr data-bind="visible: doc.showDetails" class="show-details">
- <td> </td>
- <td data-bind="attr: {'colspan': $root.collection.template.fieldsSelected().length > 0 ? $root.collection.template.fieldsSelected().length + 1 : 2}">
- <span data-bind="template: {name: 'document-details', data: $data}"></span>
- </td>
- </tr>
- </tbody>
- </table>
- </div>
- </div>
- <div data-bind="visible: $root.hasRetrievedResults() && $root.results().length > 0 && $root.collection.template.showChart()">
- <div data-bind="visible: !$root.collection.template.hasDataForChart()" style="padding: 10px">${ _('Please select the chart parameters on the left.') }</div>
- <div data-bind="visible: $root.collection.template.hasDataForChart" style="overflow-x: auto">
- <div data-bind="attr:{'id': 'pieChart_'+id()}, pieChart: {data: {counts: $root.results(), sorting: $root.collection.template.chartSettings.chartSorting(), snippet: $data}, fqs: ko.observableArray([]),
- transformer: pieChartDataTransformerGrid, maxWidth: 350, parentSelector: '.chart-container' }, visible: $root.collection.template.chartSettings.chartType() == ko.HUE_CHARTS.TYPES.PIECHART" class="chart"></div>
- <div data-bind="attr:{'id': 'barChart_'+id()}, barChart: {datum: {counts: $root.results(), sorting: $root.collection.template.chartSettings.chartSorting(), snippet: $data}, fqs: ko.observableArray([]), hideSelection: true,
- transformer: multiSerieDataTransformerGrid, stacked: false, showLegend: true}, stacked: true, showLegend: true, visible: $root.collection.template.chartSettings.chartType() == ko.HUE_CHARTS.TYPES.BARCHART" class="chart"></div>
- <div data-bind="attr:{'id': 'lineChart_'+id()}, lineChart: {datum: {counts: $root.results(), sorting: $root.collection.template.chartSettings.chartSorting(), snippet: $data},
- transformer: multiSerieDataTransformerGrid, showControls: false }, visible: $root.collection.template.chartSettings.chartType() == ko.HUE_CHARTS.TYPES.LINECHART" class="chart"></div>
- <div data-bind="attr:{'id': 'leafletMapChart_'+id()}, leafletMapChart: {datum: {counts: $root.results(), sorting: $root.collection.template.chartSettings.chartSorting(), snippet: $data},
- transformer: leafletMapChartDataTransformerGrid, showControls: false, height: 380, visible: $root.collection.template.chartSettings.chartType() == ko.HUE_CHARTS.TYPES.MAP, forceRedraw: true}" class="chart"></div>
- </div>
- </div>
- </div>
- </div>
- <!-- /ko -->
- </script>
- <script type="text/html" id="grid-chart-settings">
- <ul class="nav nav-list" style="border: none; background-color: #FFF" data-bind="visible: chartType() != ''">
- <li data-bind="visible: [ko.HUE_CHARTS.TYPES.MAP, ko.HUE_CHARTS.TYPES.GRADIENTMAP, ko.HUE_CHARTS.TYPES.PIECHART].indexOf(chartType()) == -1" class="nav-header">${_('x-axis')}</li>
- <li data-bind="visible: chartType() == ko.HUE_CHARTS.TYPES.GRADIENTMAP" class="nav-header">${_('region')}</li>
- <li data-bind="visible: chartType() == ko.HUE_CHARTS.TYPES.MAP" class="nav-header">${_('latitude')}</li>
- <li data-bind="visible: chartType() == ko.HUE_CHARTS.TYPES.PIECHART" class="nav-header">${_('legend')}</li>
- </ul>
- <div data-bind="visible: chartType() != ''">
- <select data-bind="options: (chartType() == ko.HUE_CHARTS.TYPES.BARCHART || chartType() == ko.HUE_CHARTS.TYPES.PIECHART || chartType() == ko.HUE_CHARTS.TYPES.GRADIENTMAP) ? $root.collection.template.cleanedMeta : $root.collection.template.cleanedNumericMeta, value: chartX, optionsText: 'name', optionsValue: 'name', optionsCaption: '${_ko('Choose a column...')}', select2: { width: '100%', placeholder: '${ _ko("Choose a column...") }', update: chartX}" class="input-medium"></select>
- </div>
- <ul class="nav nav-list" style="border: none; background-color: #FFF" data-bind="visible: chartType() != ''">
- <li data-bind="visible: [ko.HUE_CHARTS.TYPES.MAP, ko.HUE_CHARTS.TYPES.GRADIENTMAP, ko.HUE_CHARTS.TYPES.PIECHART].indexOf(chartType()) == -1" class="nav-header">${_('y-axis')}</li>
- <li data-bind="visible: chartType() == ko.HUE_CHARTS.TYPES.GRADIENTMAP" class="nav-header">${_('value')}</li>
- <li data-bind="visible: chartType() == ko.HUE_CHARTS.TYPES.MAP" class="nav-header">${_('longitude')}</li>
- <li data-bind="visible: chartType() == ko.HUE_CHARTS.TYPES.PIECHART" class="nav-header">${_('value')}</li>
- </ul>
- <div style="overflow-y: scroll; max-height: 220px" data-bind="visible: chartType() != '' && (chartType() == ko.HUE_CHARTS.TYPES.BARCHART || chartType() == ko.HUE_CHARTS.TYPES.LINECHART)">
- <ul class="unstyled" data-bind="foreach: $root.collection.template.cleanedNumericMeta">
- <li><input type="checkbox" data-bind="checkedValue: name, checked: $parent.chartYMulti" /> <span data-bind="text: $data.name"></span></li>
- </ul>
- </div>
- <div data-bind="visible: chartType() == ko.HUE_CHARTS.TYPES.PIECHART || chartType() == ko.HUE_CHARTS.TYPES.MAP || chartType() == ko.HUE_CHARTS.TYPES.GRADIENTMAP || chartType() == ko.HUE_CHARTS.TYPES.SCATTERCHART">
- <select data-bind="options: chartType() == ko.HUE_CHARTS.TYPES.GRADIENTMAP ? $root.collection.template.cleanedMeta : $root.collection.template.cleanedNumericMeta, value: chartYSingle, optionsText: 'name', optionsValue: 'name', optionsCaption: '${_ko('Choose a column...')}', select2: { width: '100%', placeholder: '${ _ko("Choose a column...") }', update: chartYSingle}" class="input-medium"></select>
- </div>
- <ul class="nav nav-list" style="border: none; background-color: #FFF" data-bind="visible: chartType() != '' && chartType() == ko.HUE_CHARTS.TYPES.MAP">
- <li class="nav-header">${_('label')}</li>
- </ul>
- <div data-bind="visible: chartType() == ko.HUE_CHARTS.TYPES.MAP">
- <select data-bind="options: $root.collection.template.cleanedMeta, value: chartMapLabel, optionsText: 'name', optionsValue: 'name', optionsCaption: '${_ko('Choose a column...')}', select2: { width: '100%', placeholder: '${ _ko("Choose a column...") }', update: chartMapLabel}" class="input-medium"></select>
- </div>
- <ul class="nav nav-list" style="border: none; background-color: #FFF" data-bind="visible: chartType() != '' && chartType() == ko.HUE_CHARTS.TYPES.SCATTERCHART">
- <li class="nav-header">${_('scatter group')}</li>
- </ul>
- <div data-bind="visible: chartType() != '' && chartType() == ko.HUE_CHARTS.TYPES.SCATTERCHART">
- <select data-bind="options: $root.collection.template.cleanedMeta, value: chartScatterGroup, optionsText: 'name', optionsValue: 'name', optionsCaption: '${_ko('Choose a column...')}', select2: { width: '100%', placeholder: '${ _ko("Choose a column...") }', update: chartScatterGroup}" class="input-medium"></select>
- </div>
- <ul class="nav nav-list" style="border: none; background-color: #FFF" data-bind="visible: chartType() == ko.HUE_CHARTS.TYPES.SCATTERCHART">
- <li class="nav-header">${_('scatter size')}</li>
- </ul>
- <div data-bind="visible: chartType() == ko.HUE_CHARTS.TYPES.SCATTERCHART">
- <select data-bind="options: $root.collection.template.cleanedMeta, value: chartScatterSize, optionsText: 'name', optionsValue: 'name', optionsCaption: '${_ko('Choose a column...')}', select2: { width: '100%', placeholder: '${ _ko("Choose a column...") }', update: chartScatterSize}" class="input-medium"></select>
- </div>
- <!-- ko if: chartType() != '' && chartType() == ko.HUE_CHARTS.TYPES.GRADIENTMAP -->
- <ul class="nav nav-list" style="border: none; background-color: #FFF">
- <li class="nav-header">${_('scope')}</li>
- </ul>
- <div data-bind="visible: chartType() != ''">
- <select data-bind="selectedOptions: chartScope, optionsCaption: '${_ko('Choose a scope...')}', select2: { width: '100%', placeholder: '${ _ko("Choose a scope...") }', update: chartScope}">
- <option value="world">${ _("World") }</option>
- <option value="europe">${ _("Europe") }</option>
- <option value="aus">${ _("Australia") }</option>
- <option value="bra">${ _("Brazil") }</option>
- <option value="can">${ _("Canada") }</option>
- <option value="chn">${ _("China") }</option>
- <option value="fra">${ _("France") }</option>
- <option value="deu">${ _("Germany") }</option>
- <option value="ita">${ _("Italy") }</option>
- <option value="jpn">${ _("Japan") }</option>
- <option value="gbr">${ _("UK") }</option>
- <option value="usa">${ _("USA") }</option>
- </select>
- </div>
- <!-- /ko -->
- <ul class="nav nav-list" style="border: none; background-color: #FFF" data-bind="visible: chartType() != '' && chartType() != ko.HUE_CHARTS.TYPES.MAP && chartType() != ko.HUE_CHARTS.TYPES.GRADIENTMAP && chartType() != ko.HUE_CHARTS.TYPES.SCATTERCHART">
- <li class="nav-header">${_('sorting')}</li>
- </ul>
- <div class="btn-group" data-toggle="buttons-radio" data-bind="visible: chartType() != '' && chartType() != ko.HUE_CHARTS.TYPES.MAP && chartType() != ko.HUE_CHARTS.TYPES.GRADIENTMAP && chartType() != ko.HUE_CHARTS.TYPES.SCATTERCHART">
- <a rel="tooltip" data-placement="top" title="${_('No sorting')}" href="javascript:void(0)" class="btn" data-bind="css: {'active': chartSorting() == 'none'}, click: function(){ chartSorting('none'); }"><i class="fa fa-align-left fa-rotate-270"></i></a>
- <a rel="tooltip" data-placement="top" title="${_('Sort ascending')}" href="javascript:void(0)" class="btn" data-bind="css: {'active': chartSorting() == 'asc'}, click: function(){ chartSorting('asc'); }"><i class="fa fa-sort-amount-asc fa-rotate-270"></i></a>
- <a rel="tooltip" data-placement="top" title="${_('Sort descending')}" href="javascript:void(0)" class="btn" data-bind="css: {'active': chartSorting() == 'desc'}, click: function(){ chartSorting('desc'); }"><i class="fa fa-sort-amount-desc fa-rotate-270"></i></a>
- </div>
- </script>
- <script type="text/html" id="html-resultset-widget">
- <!-- ko ifnot: $root.collection.template.isGridLayout() -->
- <div data-bind="visible: $root.isEditing" style="margin-bottom: 20px">
- <ul class="nav nav-pills">
- <li class="active"><a href="javascript: void(0)" class="widget-editor-pill">${_('Editor')}</a></li>
- <li><a href="javascript: void(0)" class="widget-html-pill">${_('HTML')}</a></li>
- <li><a href="javascript: void(0)" class="widget-css-pill">${_('CSS & JS')}</a></li>
- <li><a href="javascript: void(0)" class="widget-settings-pill">${_('Sorting')}</a></li>
- </ul>
- </div>
- <!-- ko if: $root.isEditing() -->
- <div class="widget-section widget-editor-section">
- <div class="row-fluid">
- <div class="span9">
- <div data-bind="freshereditor: {data: $root.collection.template.template}"></div>
- </div>
- <div class="span3">
- <h5 class="editor-title">${_('Available Fields')}</h5>
- <select data-bind="options: $root.collection.fields, optionsText: 'name', value: $root.collection.template.selectedVisualField" class="input-large chosen-select"></select>
- <button title="${ _('Click on this button to add the field') }" class="btn plus-btn" data-bind="click: $root.collection.template.addFieldToVisual">
- <i class="fa fa-plus"></i>
- </button>
- <h5 class="editor-title" style="margin-top: 30px">${_('Available Functions')}</h5>
- <select id="visualFunctions" data-bind="value: $root.collection.template.selectedVisualFunction" class="input-large chosen-select">
- <option title="${ _('Formats date or timestamp in DD-MM-YYYY') }" value="{{#date}} {{/date}}">{{#date}}</option>
- <option title="${ _('Formats date or timestamp in HH:mm:ss') }" value="{{#time}} {{/time}}">{{#time}}</option>
- <option title="${ _('Formats date or timestamp in DD-MM-YYYY HH:mm:ss') }" value="{{#datetime}} {{/datetime}}">{{#datetime}}</option>
- <option title="${ _('Formats a date in the full format') }" value="{{#fulldate}} {{/fulldate}}">{{#fulldate}}</option>
- <option title="${ _('Formats a date as a Unix timestamp') }" value="{{#timestamp}} {{/timestamp}}">{{#timestamp}}</option>
- <option title="${ _('Formats a Unix timestamp as Ns, Nmin, Ndays... ago') }" value="{{#fromnow}} {{/fromnow}}">{{#fromnow}}</option>
- <option title="${ _('Downloads and embed the file in the browser') }" value="{{#embeddeddownload}} {{/embeddeddownload}}">{{#embeddeddownload}}</option>
- <option title="${ _('Downloads the linked file') }" value="{{#download}} {{/download}}">{{#download}}</option>
- <option title="${ _('Preview file in File Browser') }" value="{{#preview}} {{/preview}}">{{#preview}}</option>
- <option title="${ _('Truncate a value after 100 characters') }" value="{{#truncate100}} {{/truncate100}}">{{#truncate100}}</option>
- <option title="${ _('Truncate a value after 250 characters') }" value="{{#truncate250}} {{/truncate250}}">{{#truncate250}}</option>
- <option title="${ _('Truncate a value after 500 characters') }" value="{{#truncate500}} {{/truncate500}}">{{#truncate500}}</option>
- </select>
- <button title="${ _('Click on this button to add the function') }" class="btn plus-btn" data-bind="click: $root.collection.template.addFunctionToVisual">
- <i class="fa fa-plus"></i>
- </button>
- <p class="muted" style="margin-top: 10px"></p>
- </div>
- </div>
- </div>
- <div class="widget-section widget-html-section" style="display: none">
- <div class="row-fluid">
- <div class="span9">
- <textarea data-bind="codemirror: {data: $root.collection.template.template, lineNumbers: true, htmlMode: true, mode: 'text/html', stripScript: true }" data-template="true"></textarea>
- </div>
- <div class="span3">
- <h5 class="editor-title">${_('Available Fields')}</h5>
- <select data-bind="options: $root.collection.fields, optionsText: 'name', value: $root.collection.template.selectedSourceField" class="input-medium chosen-select"></select>
- <button title="${ _('Click on this button to add the field') }" class="btn plus-btn" data-bind="click: $root.collection.template.addFieldToSource">
- <i class="fa fa-plus"></i>
- </button>
- <h5 class="editor-title" style="margin-top: 30px">${_('Available Functions')}</h5>
- <select id="sourceFunctions" data-bind="value: $root.collection.template.selectedSourceFunction" class="input-medium chosen-select">
- <option title="${ _('Formats a date in the DD-MM-YYYY format') }" value="{{#date}} {{/date}}">{{#date}}</option>
- <option title="${ _('Formats a date in the HH:mm:ss format') }" value="{{#time}} {{/time}}">{{#time}}</option>
- <option title="${ _('Formats a date in the DD-MM-YYYY HH:mm:ss format') }" value="{{#datetime}} {{/datetime}}">{{#datetime}}</option>
- <option title="${ _('Formats a date in the full format') }" value="{{#fulldate}} {{/fulldate}}">{{#fulldate}}</option>
- <option title="${ _('Formats a date as a Unix timestamp') }" value="{{#timestamp}} {{/timestamp}}">{{#timestamp}}</option>
- <option title="${ _('Shows the relative time') }" value="{{#fromnow}} {{/fromnow}}">{{#fromnow}}</option>
- <option title="${ _('Downloads and embed the file in the browser') }" value="{{#embeddeddownload}} {{/embeddeddownload}}">{{#embeddeddownload}}</option>
- <option title="${ _('Downloads the linked file') }" value="{{#download}} {{/download}}">{{#download}}</option>
- <option title="${ _('Preview file in File Browser') }" value="{{#preview}} {{/preview}}">{{#preview}}</option>
- <option title="${ _('Truncate a value after 100 characters') }" value="{{#truncate100}} {{/truncate100}}">{{#truncate100}}</option>
- <option title="${ _('Truncate a value after 250 characters') }" value="{{#truncate250}} {{/truncate250}}">{{#truncate250}}</option>
- <option title="${ _('Truncate a value after 500 characters') }" value="{{#truncate500}} {{/truncate500}}">{{#truncate500}}</option>
- </select>
- <button title="${ _('Click on this button to add the function') }" class="btn plus-btn" data-bind="click: $root.collection.template.addFunctionToSource">
- <i class="fa fa-plus"></i>
- </button>
- <p class="muted" style="margin-top: 10px"></p>
- </div>
- </div>
- </div>
- <div class="widget-section widget-css-section" style="display: none">
- <textarea data-bind="codemirror: {data: $root.collection.template.extracode, lineNumbers: true, htmlMode: true, mode: 'text/html' }"></textarea>
- </div>
- <div class="widget-section widget-settings-section" style="display: none">
- <div style="overflow-x: scroll; min-height: 40px">
- <table>
- <tr data-bind="template: {name: 'result-sorting'}">
- </tr>
- </table>
- </div>
- <br/>
- </div>
- <!-- /ko -->
- <div id="result-main" style="overflow-x: auto">
- <div data-bind="visible: $root.hasRetrievedResults() && $root.results().length == 0">
- <br/>
- ${ _('Your search did not match any documents.') }
- </div>
- <!-- ko if: $root.response().response && $root.results().length > 0 -->
- <div data-bind="template: {name: 'resultset-pagination', data: $root.response() }"></div>
- <!-- /ko -->
- <table id="result-container" data-bind="visible: $root.hasRetrievedResults()" style="margin-top: 0; width: 100%">
- <thead>
- <tr>
- <th> </th>
- </tr>
- </thead>
- <tbody data-bind="foreach: {data: $root.results, as: 'doc'}" class="result-tbody">
- <tr data-bind="style: {'backgroundColor': $index() % 2 == 0 ? '#FFF': '#F6F6F6'}">
- <td><div data-bind="html: content" style="margin-bottom: -20px"></div></td>
- </tr>
- <tr>
- <td class="show-details-icon pointer" data-bind="click: toggleDocDetails">
- <i class="fa" data-bind="css: {'fa-caret-down' : ! doc.showDetails(), 'fa-caret-up': doc.showDetails()}"></i>
- </td>
- </tr>
- <tr data-bind="visible: doc.showDetails" class="show-details">
- <td data-bind="attr: {'colspan': $root.collection.template.fieldsSelected().length > 0 ? $root.collection.template.fieldsSelected().length + 1 : 2}">
- <span data-bind="template: {name: 'document-details', data: $data}"></span>
- </td>
- </tr>
- </tbody>
- </table>
- <div class="widget-spinner" data-bind="visible: ! $root.hasRetrievedResults()">
- <!--[if !IE]> --><i class="fa fa-spinner fa-spin"></i><!-- <![endif]-->
- <!--[if IE]><img src="${ static('desktop/art/spinner.gif') }" /><![endif]-->
- </div>
- </div>
- <!-- /ko -->
- </script>
- <script type="text/html" id="document-details">
- <!-- ko if: $data.details().length == 0 -->
- <!--[if !IE]> --><i class="fa fa-spinner fa-spin"></i><!-- <![endif]-->
- <!--[if IE]><img src="${ static('desktop/art/spinner.gif') }" /><![endif]-->
- <!-- /ko -->
- <!-- ko if: $data.details().length > 0 -->
- <div class="document-details-actions pull-left" data-bind="visible: ${ 'true' if can_edit_index else 'false' } || externalLink()">
- <a href="javascript:void(0)" data-bind="visible: ! showEdit(), click: function() { showEdit(true); }" title="${ _('Edit this document') }">
- <i class="fa fa-edit fa-fw"></i>
- </a>
- <a href="javascript:void(0)" data-bind="visible: showEdit(), click: function(data, e) { $(e.currentTarget).parent().css('marginTop', '8px'); $root.getDocument($data); showEdit(false); }" title="${ _('Undo changes') }">
- <i class="fa fa-undo fa-fw"></i>
- </a>
- <a href="javascript:void(0)" data-bind="visible: showEdit() && originalDetails() != ko.toJSON(details), click: $root.updateDocument" title="${ _('Update this document') }">
- <i class="fa fa-save fa-fw"></i>
- </a>
- <a href="javascript:void(0)" data-bind="visible: externalLink(), attr: { href: externalLink}" target="_blank" title="${ _('Show original document') }">
- <i class="fa fa-external-link fa-fw"></i>
- </a>
- </div>
- <div class="document-details pull-left">
- <table>
- <tbody data-bind="foreach: details">
- <tr data-bind="css: {'readonly': ! $parent.showEdit()}">
- <th class="grid-th" data-bind="text: key"></th>
- <td width="100%">
- <span data-bind="text: value, visible: ! $parent.showEdit()"></span>
- <input data-bind="value: value, visible: $parent.showEdit, valueUpdate: 'afterkeydown',
- click: function(detail, e){
- var target = $(e.currentTarget);
- target.parents('.show-details').find('.document-details-actions').animate({
- 'marginTop': (target.position().top - target.parents('table').position().top) + 'px'
- }, 200)
- }" class="input-xxlarge" style="width: 600px" />
- </td>
- </tr>
- </tbody>
- </table>
- </div>
- <!-- /ko -->
- </script>
- <script type="text/html" id="result-sorting">
- <th style="width: 18px"> </th>
- <!-- ko foreach: $root.collection.template.fieldsSelected -->
- <th data-bind="with: $root.collection.getTemplateField($data), event: { mouseover: $root.enableGridlayoutResultChevron, mouseout: $root.disableGridlayoutResultChevron }" style="white-space: nowrap">
- <div style="display: inline-block; width:20px;">
- <a href="javascript: void(0)" data-bind="click: function(){ $root.collection.translateSelectedField($index(), 'left'); }">
- <i class="fa fa-chevron-left" data-bind="visible: $root.toggledGridlayoutResultChevron() && $index() > 0"></i>
- <i class="fa fa-chevron-left" style="color: #FFF" data-bind="visible: !$root.toggledGridlayoutResultChevron() || $index() == 0"></i>
- </a>
- </div>
- <div style="display: inline-block;">
- <a href="javascript: void(0)" data-bind="click: $root.collection.toggleSortColumnGridLayout" title="${ _('Click to sort') }">
- <span data-bind="text: name"></span>
- <i class="fa" data-bind="visible: sort.direction() != null, css: { 'fa-chevron-down': sort.direction() == 'desc', 'fa-chevron-up': sort.direction() == 'asc' }"></i>
- </a>
- </div>
- <div style="display: inline-block; width:20px;">
- <a href="javascript: void(0)" data-bind="click: function(){ $root.collection.translateSelectedField($index(), 'right'); }">
- <i class="fa fa-chevron-right" data-bind="visible: $root.toggledGridlayoutResultChevron() && $index() < $root.collection.template.fields().length - 1"></i>
- <i class="fa fa-chevron-up" style="color: #FFF" data-bind="visible: !$root.toggledGridlayoutResultChevron() || $index() == $root.collection.template.fields().length - 1,"></i>
- </a>
- </div>
- </th>
- <!-- /ko -->
- </script>
- <script type="text/html" id="resultset-pagination">
- <div style="text-align: center; margin-top: 4px">
- <a href="javascript: void(0)" title="${ _('Previous') }">
- <span data-bind="click: $root.collection.toggleSortColumnGridLayout"></span>
- <i class="fa fa-arrow-left" data-bind="
- visible: $data.response.start * 1.0 >= $root.collection.template.rows() * 1.0,
- click: function() { $root.query.paginate('prev') }">
- </i>
- </a>
- ${ _('Showing') }
- <span data-bind="text: ($data.response.start + 1)"></span>
- ${ _('to') }
- <span data-bind="text: Math.min(($data.response.start + $root.collection.template.rows()), $data.response.numFound)"></span>
- ${ _('of') }
- <span data-bind="text: $data.response.numFound"></span>
- ${ _(' results') }
- <span data-bind="visible: $root.isEditing()">
- ${ _('Show') }
- <span class="spinedit-cnt">
- <input type="text" data-bind="spinedit: $root.collection.template.rows, valueUpdate:'afterkeydown'" style="text-align: center; margin-bottom: 0" />
- </span>
- ${ _('results per page') }
- </span>
- <a href="javascript: void(0)" title="${ _('Next') }">
- <span data-bind="click: $root.collection.toggleSortColumnGridLayout"></span>
- <i class="fa fa-arrow-right" data-bind="
- visible: ($root.collection.template.rows() * 1.0 + $data.response.start * 1.0) < $data.response.numFound,
- click: function() { $root.query.paginate('next') }">
- </i>
- </a>
- </div>
- </script>
- <script type="text/html" id="histogram-widget">
- <div class="widget-spinner" data-bind="visible: isLoading()">
- <!--[if !IE]> --><i class="fa fa-spinner fa-spin"></i><!-- <![endif]-->
- <!--[if IE]><img src="${ static('desktop/art/spinner.gif') }" /><![endif]-->
- </div>
- <!-- ko if: $root.getFacetFromQuery(id()).has_data() -->
- <div class="row-fluid" data-bind="with: $root.getFacetFromQuery(id())">
- <div data-bind="visible: $root.isEditing, with: $root.collection.getFacetById($parent.id())" style="margin-bottom: 20px">
- <span data-bind="template: { name: 'facet-toggle' }">
- </span>
- </div>
- <div style="padding-bottom: 10px; text-align: right; padding-right: 20px" data-bind="visible: counts().length > 0">
- <span data-bind="with: $root.collection.getFacetById($parent.id())">
- <span class="facet-field-label">${ _('Chart Type') }</span>
- <select class="input-small" data-bind="options: $root.timelineChartTypes,
- optionsText: 'label',
- optionsValue: 'value',
- value: properties.timelineChartType">
- </select>
- <span class="facet-field-label">${ _('Interval') }</span>
- <select class="input-small" data-bind="options: $root.intervalOptions,
- optionsText: 'label',
- optionsValue: 'value',
- value: properties.gap">
- </select>
- </span>
- <span class="facet-field-label">${ _('Zoom') }</span>
- <a href="javascript:void(0)" data-bind="click: $root.collection.rangeZoomOut"><i class="fa fa-search-minus"></i> ${ _('reset') }</a>
- <span class="facet-field-label" data-bind="visible: $root.query.multiqs().length > 1">${ _('Group by') }</span>
- <select class="input-medium" data-bind="visible: $root.query.multiqs().length > 1, options: $root.query.multiqs, optionsValue: 'id', optionsText: 'label', value: $root.query.selectedMultiq"></select>
- </div>
- <!-- ko if: $root.collection.getFacetById($parent.id()) -->
- <div data-bind="timelineChart: {datum: {counts: counts(), extraSeries: extraSeries(), widget_id: $parent.id(), label: label()}, stacked: $root.collection.getFacetById($parent.id()).properties.stacked(), field: field, label: label(), transformer: timelineChartDataTransformer,
- type: $root.collection.getFacetById($parent.id()).properties.timelineChartType,
- fqs: $root.query.fqs,
- onSelectRange: function(from, to){ $root.collection.selectTimelineFacet({from: from, to: to, cat: field, widget_id: $parent.id()}) },
- onStateChange: function(state){ $root.collection.getFacetById($parent.id()).properties.stacked(state.stacked); },
- onClick: function(d){ $root.query.selectRangeFacet({count: d.obj.value, widget_id: $parent.id(), from: d.obj.from, to: d.obj.to, cat: d.obj.field}) },
- onComplete: function(){ $root.getWidgetById($parent.id()).isLoading(false) }}" />
- <!-- /ko -->
- </div>
- <!-- /ko -->
- </script>
- <script type="text/html" id="bar-widget">
- <div class="widget-spinner" data-bind="visible: isLoading()">
- <!--[if !IE]> --><i class="fa fa-spinner fa-spin"></i><!-- <![endif]-->
- <!--[if IE]><img src="${ static('desktop/art/spinner.gif') }" /><![endif]-->
- </div>
- <!-- ko if: $root.getFacetFromQuery(id()).has_data() -->
- <div class="row-fluid" data-bind="with: $root.getFacetFromQuery(id())">
- <div data-bind="visible: $root.isEditing, with: $root.collection.getFacetById($parent.id())" style="margin-bottom: 20px">
- <span data-bind="template: { name: 'facet-toggle' }">
- </span>
- </div>
- <div data-bind="with: $root.collection.getFacetById($parent.id())">
- <!-- ko if: properties.canRange -->
- <div style="padding-bottom: 10px; text-align: right; padding-right: 20px">
- <span class="facet-field-label">${ _('Zoom') }</span>
- <a href="javascript:void(0)" data-bind="click: $root.collection.rangeZoomOut"><i class="fa fa-search-minus"></i> ${ _('reset') }</a>
- </div>
- <!-- /ko -->
- </div>
- <!-- ko if: $root.collection.getFacetById($parent.id()) -->
- <div data-bind="barChart: {datum: {counts: counts(), widget_id: $parent.id(), label: label()}, stacked: $root.collection.getFacetById($parent.id()).properties.stacked(), field: field, label: label(),
- fqs: $root.query.fqs,
- transformer: ($data.type == 'range-up' ? barChartRangeUpDataTransformer : barChartDataTransformer),
- onStateChange: function(state){ $root.collection.getFacetById($parent.id()).properties.stacked(state.stacked); },
- onClick: function(d) {
- if (d.obj.field != undefined) {
- if ($data.type == 'range-up') {
- viewModel.query.selectRangeUpFacet({count: d.obj.value, widget_id: d.obj.widget_id, from: d.obj.from, to: d.obj.to, cat: d.obj.field, 'exclude': false, is_up: d.obj.is_up});
- } else {
- viewModel.query.selectRangeFacet({count: d.obj.value, widget_id: d.obj.widget_id, from: d.obj.from, to: d.obj.to, cat: d.obj.field});
- }
- } else {
- viewModel.query.toggleFacet({facet: d.obj, widget_id: d.obj.widget_id});
- }
- },
- onSelectRange: function(from, to){ viewModel.collection.selectTimelineFacet({from: from, to: to, cat: field, widget_id: $parent.id()}) },
- onComplete: function(){ viewModel.getWidgetById($parent.id()).isLoading(false) } }"
- />
- <!-- /ko -->
- </div>
- <!-- /ko -->
- </script>
- <script type="text/html" id="bucket-widget">
- <div class="widget-spinner" data-bind="visible: isLoading()">
- <!--[if !IE]> --><i class="fa fa-spinner fa-spin"></i><!-- <![endif]-->
- <!--[if IE]><img src="${ static('desktop/art/spinner.gif') }" /><![endif]-->
- </div>
- <!-- ko if: $root.getFacetFromQuery(id()).has_data() -->
- <div class="row-fluid" data-bind="with: $root.getFacetFromQuery(id())">
- <div data-bind="with: $root.collection.getFacetById($parent.id())">
- <span data-bind="foreach: properties.facets, visible: !$parents[1].isLoading()">
- <div class="filter-box">
- <div class="title">
- <a data-bind="click: function() { $root.collection.removePivotFacetValue({'pivot_facet': $parent, 'value': $data}); }" class="pull-right" href="javascript:void(0)">
- <i class="fa fa-times"></i>
- </a>
- <div class="hit-title" data-bind="text: field, attr: {'title': field}"></div>
- <div class="clearfix"></div>
- </div>
- <div class="content">
- <div class="facet-field-cnt">
- <span class="facet-field-label">${ _('Metric') }</span>
- <select data-bind="options: HIT_OPTIONS, optionsText: 'label', optionsValue: 'value', value: aggregate" class="hit-options"></select>
- </div>
- <div class="facet-field-cnt" data-bind="visible: $root.isEditing()">
- <span class="spinedit-cnt">
- <span class="facet-field-label">
- ${ _('Limit') }
- </span>
- <input type="text" class="input-medium" data-bind="spinedit: limit"/>
- </span>
- </div>
- <div class="facet-field-cnt" data-bind="visible: $root.isEditing()">
- <span class="spinedit-cnt">
- <span class="facet-field-label">
- ${ _('Min Count') }
- </span>
- <input type="text" class="input-medium" data-bind="spinedit: mincount"/>
- </span>
- </div>
- </div>
- </div>
- </span>
- <div class="filter-box" data-bind="visible: $root.isEditing() && properties.facets().length < 2" style="opacity: 0.7">
- <div class="title" style="border: 1px dashed #d8d8d8; border-bottom: none">
- <a data-bind="visible: ko.toJSON(properties.facets_form.field) != '', click: $root.collection.addPivotFacetValue" class="pull-right" href="javascript:void(0)">
- <i class="fa fa-plus"></i> ${ _('Add') }
- </a>
- <select data-bind="options: $root.collection.template.fieldsNames, value: properties.facets_form.field, optionsCaption: '${ _ko('Field...') }'" class="hit-options" style="margin-bottom: 0; height: 20px"></select>
- <div class="clearfix"></div>
- </div>
- <div class="content" style="border: 1px dashed #d8d8d8; border-top: none">
- <div class="facet-field-cnt">
- <span class="spinedit-cnt">
- <span class="facet-field-label">
- ${ _('Metric') }
- </span>
- <select data-bind="options: HIT_OPTIONS, optionsText: 'label', optionsValue: 'value', value: properties.facets_form.aggregate" class="hit-options"></select>
- </span>
- </div>
- <div class="facet-field-cnt">
- <span class="spinedit-cnt">
- <span class="facet-field-label">
- ${ _('Limit') }
- </span>
- <input type="text" class="input-medium" data-bind="spinedit: properties.facets_form.limit"/>
- </span>
- </div>
- <div class="facet-field-cnt">
- <span class="spinedit-cnt">
- <span class="facet-field-label">
- ${ _('Min Count') }
- </span>
- <input type="text" class="input-medium" data-bind="spinedit: properties.facets_form.mincount"/>
- </span>
- </div>
- </div>
- </div>
- <div class="pull-right" style="margin-top: 40px">
- <div class="inline-block" style="padding-bottom: 10px; padding-right: 20px">
- <span class="facet-field-label">${ _('Sorting') }</span>
- <a href="javascript: void(0)" title="${ _('Toggle sort order') }" data-bind="click: $root.collection.toggleSortFacet">
- <i class="fa" data-bind="css: { 'fa-caret-down': properties.sort() == 'desc', 'fa-caret-up': properties.sort() == 'asc' }"></i>
- <span data-bind="visible: properties.sort() == 'desc'">${_('descending')}</span>
- <span data-bind="visible: properties.sort() == 'asc'">${_('ascending')}</span>
- </a>
- </div>
- <!-- ko if: properties.isDate -->
- <div class="inline-block" style="padding-bottom: 10px; padding-right: 20px">
- <span class="facet-field-label">${ _('Chart Type') }</span>
- <select class="input-small" data-bind="options: $root.timelineChartTypes,
- optionsText: 'label',
- optionsValue: 'value',
- value: properties.timelineChartType">
- </select>
- </div>
- <div class="inline-block" style="padding-bottom: 10px; padding-right: 20px">
- <span class="facet-field-label">${ _('Interval') }</span>
- <select class="input-small" data-bind="options: $root.intervalOptions,
- optionsText: 'label',
- optionsValue: 'value',
- value: properties.gap">
- </select>
- </div>
- <!-- /ko -->
- <!-- ko if: properties.canRange -->
- <div class="inline-block" style="padding-bottom: 10px; padding-right: 20px">
- <span class="facet-field-label">${ _('Zoom') }</span>
- <a href="javascript:void(0)" data-bind="click: $root.collection.rangeZoomOut"><i class="fa fa-search-minus"></i> ${ _('reset') }</a>
- </div>
- <!-- /ko -->
- </div>
- <div class="clearfix"></div>
- </div>
- <!-- ko if: $root.collection.getFacetById($parent.id()) -->
- <!-- ko if: dimension() == 1 -->
- <div data-bind="barChart: {datum: {counts: counts(), widget_id: $parent.id(), label: label()}, stacked: $root.collection.getFacetById($parent.id()).properties.stacked(), field: field, label: label(),
- fqs: $root.query.fqs,
- transformer: ($data.type == 'range-up' ? barChartRangeUpDataTransformer : barChartDataTransformer),
- onStateChange: function(state){ $root.collection.getFacetById($parent.id()).properties.stacked(state.stacked); },
- onClick: function(d) {
- if (d.obj.field != undefined) {
- if ($data.type == 'range-up') {
- viewModel.query.selectRangeUpFacet({count: d.obj.value, widget_id: d.obj.widget_id, from: d.obj.from, to: d.obj.to, cat: d.obj.field, 'exclude': false, is_up: d.obj.is_up});
- } else {
- viewModel.query.selectRangeFacet({count: d.obj.value, widget_id: d.obj.widget_id, from: d.obj.from, to: d.obj.to, cat: d.obj.field});
- }
- } else {
- viewModel.query.toggleFacet({facet: d.obj, widget_id: d.obj.widget_id});
- }
- },
- onSelectRange: function(from, to){ viewModel.collection.selectTimelineFacet({from: from, to: to, cat: field, widget_id: $parent.id()}) },
- onComplete: function(){ viewModel.getWidgetById($parent.id()).isLoading(false) } }"
- />
- <!-- /ko -->
- <!-- ko if: dimension() == 2 -->
- <div data-bind="barChart: {datum: {counts: counts(), widget_id: $parent.id(), label: label()}, stacked: $root.collection.getFacetById($parent.id()).properties.stacked(),
- isPivot: true,
- fqs: $root.query.fqs,
- transformer: pivotChartDataTransformer,
- onStateChange: function(state){ $root.collection.getFacetById($parent.id()).properties.stacked(state.stacked); },
- onClick: function(d) {
- $root.query.togglePivotFacet({facet: d.obj, widget_id: id()});
- },
- onComplete: function(){ viewModel.getWidgetById($parent.id()).isLoading(false) } }"
- />
- <!-- /ko -->
- <!-- ko if: dimension() == 3 -->
- <div data-bind="timelineChart: {datum: {counts: counts(), extraSeries: extraSeries(), widget_id: $parent.id(), label: label()}, stacked: $root.collection.getFacetById($parent.id()).properties.stacked(), field: field, label: label(), transformer: timelineChartDataTransformer,
- type: $root.collection.getFacetById($parent.id()).properties.timelineChartType,
- fqs: $root.query.fqs,
- onSelectRange: function(from, to){ $root.collection.selectTimelineFacet({from: from, to: to, cat: field, widget_id: $parent.id()}) },
- onStateChange: function(state){ $root.collection.getFacetById($parent.id()).properties.stacked(state.stacked); },
- onClick: function(d){ $root.query.selectRangeFacet({count: d.obj.value, widget_id: $parent.id(), from: d.obj.from, to: d.obj.to, cat: d.obj.field}) },
- onComplete: function(){ $root.getWidgetById($parent.id()).isLoading(false) }}" />
- <!-- /ko -->
- <!-- /ko -->
- </div>
- <!-- /ko -->
- </script>
- <script type="text/html" id="line-widget">
- <div class="widget-spinner" data-bind="visible: isLoading()">
- <!--[if !IE]> --><i class="fa fa-spinner fa-spin"></i><!-- <![endif]-->
- <!--[if IE]><img src="${ static('desktop/art/spinner.gif') }" /><![endif]-->
- </div>
- <!-- ko if: $root.getFacetFromQuery(id()).has_data() -->
- <div class="row-fluid" data-bind="with: $root.getFacetFromQuery(id())">
- <div data-bind="visible: $root.isEditing, with: $root.collection.getFacetById($parent.id())" style="margin-bottom: 20px">
- <span data-bind="template: { name: 'facet-toggle' }">
- </span>
- </div>
- <div style="padding-bottom: 10px; text-align: right; padding-right: 20px" data-bind="visible: counts.length > 0">
- <span class="facet-field-label">${ _('Zoom') }</span>
- <a href="javascript:void(0)" data-bind="click: $root.collection.rangeZoomOut"><i class="fa fa-search-minus"></i> ${ _('reset') }</a>
- </div>
- <div data-bind="lineChart: {datum: {counts: counts(), widget_id: $parent.id(), label: label()}, field: field, label: label(),
- transformer: lineChartDataTransformer,
- onClick: function(d){ viewModel.query.selectRangeFacet({count: d.obj.value, widget_id: d.obj.widget_id, from: d.obj.from, to: d.obj.to, cat: d.obj.field}) },
- onSelectRange: function(from, to){ viewModel.collection.selectTimelineFacet({from: from, to: to, cat: field, widget_id: $parent.id()}) },
- onComplete: function(){ viewModel.getWidgetById($parent.id()).isLoading(false) } }"
- />
- </div>
- <!-- /ko -->
- </script>
- <script type="text/html" id="pie-widget">
- <!-- ko if: $root.getFacetFromQuery(id()).has_data() -->
- <div class="row-fluid" data-bind="with: $root.getFacetFromQuery(id())">
- <div data-bind="visible: $root.isEditing, with: $root.collection.getFacetById($parent.id())" style="margin-bottom: 20px">
- <span data-bind="template: { name: 'facet-toggle' }">
- </span>
- </div>
- <div data-bind="with: $root.collection.getFacetById($parent.id())">
- <!-- ko if: type() == 'range' -->
- <div data-bind="pieChart: {data: {counts: $parent.counts(), widget_id: $parent.id()}, field: field, fqs: $root.query.fqs,
- transformer: rangePieChartDataTransformer,
- maxWidth: 250,
- onClick: function(d){ viewModel.query.selectRangeFacet({count: d.data.obj.value, widget_id: d.data.obj.widget_id, from: d.data.obj.from, to: d.data.obj.to, cat: d.data.obj.field}) },
- onComplete: function(){ viewModel.getWidgetById($parent.id()).isLoading(false)} }" />
- <!-- /ko -->
- <!-- ko if: type() == 'range-up' -->
- <div data-bind="pieChart: {data: {counts: $parent.counts(), widget_id: $parent.id()}, field: field, fqs: $root.query.fqs,
- transformer: rangeUpPieChartDataTransformer,
- rangeUp: true,
- maxWidth: 250,
- onClick: function(d){ viewModel.query.selectRangeUpFacet({count: d.data.obj.value, widget_id: d.data.obj.widget_id, from: d.data.obj.from, to: d.data.obj.to, cat: d.data.obj.field, 'exclude': false, is_up: d.data.obj.is_up}) },
- onComplete: function(){ viewModel.getWidgetById($parent.id()).isLoading(false)} }" />
- <!-- /ko -->
- <!-- ko if: type().indexOf('range') == -1 -->
- <div data-bind="pieChart: {data: {counts: $parent.counts(), widget_id: $parent.id()}, field: field, fqs: $root.query.fqs,
- transformer: pieChartDataTransformer,
- maxWidth: 250,
- onClick: function(d){ viewModel.query.toggleFacet({facet: d.data.obj, widget_id: d.data.obj.widget_id}) },
- onComplete: function(){ viewModel.getWidgetById($parent.id()).isLoading(false)} }" />
- <!-- /ko -->
- </div>
- </div>
- <!-- /ko -->
- <div class="widget-spinner" data-bind="visible: isLoading()">
- <!--[if !IE]> --><i class="fa fa-spinner fa-spin"></i><!-- <![endif]-->
- <!--[if IE]><img src="${ static('desktop/art/spinner.gif') }" /><![endif]-->
- </div>
- </script>
- <script type="text/html" id="tree-widget">
- <!-- ko if: $root.getFacetFromQuery(id()).has_data() -->
- <div class="row-fluid" data-bind="with: $root.getFacetFromQuery(id())">
- <div class="responsive-facet-toggle-section" data-bind="visible: $root.isEditing, with: $root.collection.getFacetById($parent.id())">
- <span data-bind="template: { name: 'facet-toggle', afterRender: function(){ $root.getWidgetById($parent.id()).isLoading(false); } }">
- </span>
- </div>
- <div data-bind="with: $root.collection.getFacetById($parent.id())">
- <div class="dimensions-header margin-bottom-10" data-bind="visible: $root.isEditing() && $data.properties.facets().length > 0">
- <span class="muted">${ _('Selected dimensions') }</span>
- </div>
- <div data-bind="foreach: $data.properties.facets, visible: $root.isEditing">
- <div class="filter-box">
- <div class="title">
- <a data-bind="click: function() { $root.collection.removePivotFacetValue({'pivot_facet': $parent, 'value': $data}); }" class="pull-right" href="javascript:void(0)">
- <i class="fa fa-times"></i>
- </a>
- <span data-bind="text: field"></span>
-
- </div>
- <div class="content">
- <div class="facet-field-cnt">
- <span class="spinedit-cnt">
- <span class="facet-field-label facet-field-label-fixed-width">
- ${ _('Limit') }
- </span>
- <input type="text" class="input-medium" data-bind="spinedit: limit"/>
- </span>
- </div>
- <div class="facet-field-cnt">
- <span class="spinedit-cnt">
- <span class="facet-field-label facet-field-label-fixed-width">
- ${ _('Min Count') }
- </span>
- <input type="text" class="input-medium" data-bind="spinedit: mincount"/>
- </span>
- </div>
- </div>
- </div>
- </div>
- <div class="clearfix"></div>
- <!-- ko if: properties.scope() == 'tree' -->
- <div data-bind="partitionChart: {datum: {counts: $parent.counts(), widget_id: $parent.id(), label: $parent.label()},
- fqs: $root.query.fqs,
- tooltip: '${ _ko('Click to zoom, double click to select') }',
- transformer: partitionChartDataTransformer,
- onStateChange: function(state){ },
- onClick: function(d) {
- $root.query.togglePivotFacet({facet: d.obj, widget_id: id()});
- },
- onComplete: function(){ viewModel.getWidgetById($parent.id()).isLoading(false) } }"
- />
- <!-- /ko -->
- </div>
- </div>
- <!-- /ko -->
- <div class="widget-spinner" data-bind="visible: isLoading()">
- <!--[if !IE]> --><i class="fa fa-spinner fa-spin"></i><!-- <![endif]-->
- <!--[if IE]><img src="${ static('desktop/art/spinner.gif') }" /><![endif]-->
- </div>
- </script>
- <script type="text/html" id="heatmap-widget">
- <!-- ko if: $root.getFacetFromQuery(id()).has_data() -->
- <div class="row-fluid" data-bind="with: $root.getFacetFromQuery(id())">
- <div class="floating-facet-toggle-section" data-bind="visible: $root.isEditing, with: $root.collection.getFacetById($parent.id())">
- <span data-bind="template: { name: 'facet-toggle', afterRender: function(){ $root.getWidgetById($parent.id()).isLoading(false); } }">
- </span>
- </div>
- <div data-bind="with: $root.collection.getFacetById($parent.id())">
- <div class="dimensions-header margin-bottom-10" data-bind="visible: $root.isEditing() && $data.properties.facets().length > 0">
- <span class="muted">${ _('Selected dimension') }</span>
- </div>
- <div data-bind="foreach: $data.properties.facets, visible: $root.isEditing">
- <div class="filter-box">
- <div class="title">
- <a data-bind="click: function() { $root.collection.removePivotFacetValue({'pivot_facet': $parent, 'value': $data}); }" class="pull-right" href="javascript:void(0)">
- <i class="fa fa-times"></i>
- </a>
- <span data-bind="text: field"></span>
-
- </div>
- <div class="content">
- <div class="facet-field-cnt">
- <span class="spinedit-cnt">
- <span class="facet-field-label facet-field-label-fixed-width">
- ${ _('Limit') }
- </span>
- <input type="text" class="input-medium" data-bind="spinedit: limit"/>
- </span>
- </div>
- <div class="facet-field-cnt">
- <span class="spinedit-cnt">
- <span class="facet-field-label facet-field-label-fixed-width">
- ${ _('Min Count') }
- </span>
- <input type="text" class="input-medium" data-bind="spinedit: mincount"/>
- </span>
- </div>
- </div>
- </div>
- </div>
- <div class="clearfix"></div>
- <!-- ko if: properties.scope() == 'stack' -->
- <div data-bind="barChart: {datum: {counts: $parent.counts(), widget_id: $parent.id(), label: $parent.label()}, stacked: $root.collection.getFacetById($parent.id()).properties.stacked(),
- isPivot: true,
- fqs: $root.query.fqs,
- transformer: pivotChartDataTransformer,
- onStateChange: function(state){ $root.collection.getFacetById($parent.id()).properties.stacked(state.stacked); },
- onClick: function(d) {
- $root.query.togglePivotFacet({facet: d.obj, widget_id: id()});
- },
- onComplete: function(){ viewModel.getWidgetById($parent.id()).isLoading(false) } }"
- />
- <!-- /ko -->
- </div>
- </div>
- <!-- /ko -->
- <div class="widget-spinner" data-bind="visible: isLoading()">
- <!--[if !IE]> --><i class="fa fa-spinner fa-spin"></i><!-- <![endif]-->
- <!--[if IE]><img src="${ static('desktop/art/spinner.gif') }" /><![endif]-->
- </div>
- </script>
- <script type="text/html" id="hit-widget">
- <div class="widget-spinner" data-bind="visible: ! $root.hasRetrievedResults()">
- <!--[if !IE]> --><i class="fa fa-spinner fa-spin"></i><!-- <![endif]-->
- <!--[if IE]><img src="${ static('desktop/art/spinner.gif') }" /><![endif]-->
- </div>
- <!-- ko if: $root.getFacetFromQuery(id()).has_data() -->
- <div class="row-fluid" data-bind="with: $root.getFacetFromQuery(id())">
- <div data-bind="with: $root.collection.getFacetById($parent.id())">
- <div data-bind="visible: $root.isEditing" style="margin-bottom: 20px">
- <span class="facet-field-label">${ _('Metric') }</span>
- <select data-bind="options: HIT_OPTIONS, optionsText: 'label', optionsValue: 'value', value: properties.aggregate"></select>
- </div>
- <div data-bind="visible: ! $root.isEditing(), text: getHitOption(properties.aggregate())" class="muted"></div>
- </div>
- <span class="big-counter" data-bind="textSqueezer: counts"></span>
- </div>
- <!-- /ko -->
- </script>
- <script type="text/html" id="filter-widget">
- <div data-bind="visible: $root.query.fqs().length == 0" style="margin-top: 10px; min-height: 87px">
- ${ _('There are currently no filters applied.') }
- </div>
- <div data-bind="foreach: { data: $root.query.fqs, afterRender: function(){ isLoading(false); } }">
- <!-- ko if: $data.type() == 'field' -->
- <div class="filter-box">
- <div class="title">
- <a href="javascript:void(0)" class="pull-right" data-bind="click: function() { chartsUpdatingState(); $root.query.removeFilter($data); $root.search(); }">
- <i class="fa fa-times"></i>
- </a>
- <span data-bind="text: $data.field"></span>
-
- </div>
- <div class="content">
- <strong>${_('selected')}</strong>
- <span data-bind="foreach: $data.filter">
- <span class="label label-info" style="margin-left: 4px" data-bind="visible: ! $data.exclude(), html: prettifyDate($data.value()), attr: {'title': $data.value()}"></span>
- </span>
- <br/>
- <strong>${_('excluded')}</strong>
- <span data-bind="foreach: $data.filter">
- <span class="label label-important" style="margin-left: 4px" data-bind="visible: $data.exclude(), html: prettifyDate($data.value()), attr: {'title': $data.value()}"></span>
- </span>
- </div>
- </div>
- <!-- /ko -->
- <!-- ko if: $data.type() == 'range' || $data.type() == 'range-up' -->
- <div class="filter-box">
- <div class="title">
- <a href="javascript:void(0)" class="pull-right" data-bind="click: function(){ chartsUpdatingState(); $root.query.removeFilter($data); $root.search() }">
- <i class="fa fa-times"></i>
- </a>
- <span data-bind="text: $data.field"></span>
-
- </div>
- <div class="content">
- <strong>${_('selected')}</strong>
- <span data-bind="foreach: $data.properties" style="font-weight: normal">
- <!-- ko if: $.grep($parent.filter(), function(f) { return f.value() == $data.from() && ! f.exclude() }).length > 0 -->
- <span class="label label-info">
- <!-- ko if: $parent.type() == 'range' -->
- <span data-bind="html: prettifyDateRange($data.from(), $data.to(), null, true), attr: {'title': $data.from() + ' -> ' + $data.to()}"></span>
- <!-- /ko -->
- <!-- ko if: $parent.type() == 'range-up' -->
- <strong data-bind="visible: ! $parent.is_up()">${ _('Until') }</strong>
- <span data-bind="html: prettifyDate($data.from()), attr: {'title': $data.from()}"></span>
- <strong data-bind="visible: $parent.is_up()"> & Up</strong>
- <!-- /ko -->
- </span>
- <!-- /ko -->
- </span>
- <br/>
- <strong>${_('excluded')}</strong>
- <span data-bind="foreach: $data.properties" style="font-weight: normal" class="excluded">
- <!-- ko if: $.grep($parent.filter(), function(f) { return f.value() == $data.from() && f.exclude() }).length > 0 -->
- <span class="label label-important">
- <span data-bind="html: prettifyDateRange($data.from(), $data.to(), null, true), attr: {'title': $data.from() + ' -> ' + $data.to()}"></span>
- </span>
- <!-- /ko -->
- </span>
- </div>
- </div>
- <!-- /ko -->
- <!-- ko if: $data.type() == 'map' -->
- <div class="filter-box">
- <div class="title">
- <a href="javascript:void(0)" class="pull-right" data-bind="click: function(){ chartsUpdatingState(); $root.query.removeFilter($data); $root.search() }">
- <i class="fa fa-times"></i>
- </a>
- <span data-bind="text: $data.lat"></span>, <span data-bind="text: $data.lon"></span>
-
- </div>
- <div class="content">
- <strong>${_('selected')}</strong>
- <span class="label label-info">
- [
- <span class="label label-info" style="margin-left: 4px" data-bind="text: $data.properties.lat_sw, attr: {'title': '${ _ko('Latitude South West') }'"></span>
- <span class="label label-info" style="margin-left: 4px" data-bind="text: $data.properties.lon_sw, attr: {'title': '${ _ko('Longitude South West') }'"></span>
- ]
- ${ _("TO") }
- [
- <span class="label label-info" style="margin-left: 4px" data-bind="text: $data.properties.lat_ne, attr: {'title': '${ _ko('Latitude North East') }'"></span>
- <span class="label label-info" style="margin-left: 4px" data-bind="text: $data.properties.lon_ne, attr: {'title': '${ _ko('Longitude North East') }'"></span>
- ]
- </span>
- </div>
- </div>
- <!-- /ko -->
- </div>
- <div class="clearfix"></div>
- <div class="widget-spinner" data-bind="visible: isLoading() && $root.query.fqs().length > 0">
- <!--[if !IE]> --><i class="fa fa-spinner fa-spin"></i><!-- <![endif]-->
- <!--[if IE]><img src="${ static('desktop/art/spinner.gif') }" /><![endif]-->
- </div>
- </script>
- <script type="text/html" id="map-widget">
- <!-- ko if: $root.getFacetFromQuery(id()).has_data() -->
- <div class="row-fluid" data-bind="with: $root.getFacetFromQuery(id())">
- <div data-bind="visible: $root.isEditing, with: $root.collection.getFacetById($parent.id())" style="margin-bottom: 20px">
- <div class="floating-facet-toggle-section">
- <span data-bind="template: { name: 'facet-toggle', afterRender: function(){ $root.getWidgetById($parent.id()).isLoading(false); } }">
- </span>
- </div>
- <div class="dimensions-header margin-bottom-10" data-bind="visible: $root.isEditing() && $data.properties.facets().length > 0">
- <span class="muted">${ _('Selected dimension') }</span>
- </div>
- <div data-bind="foreach: $data.properties.facets, visible: $root.isEditing">
- <div class="filter-box">
- <div class="title">
- <a data-bind="click: function() { $root.collection.removePivotFacetValue({'pivot_facet': $parent, 'value': $data}); }" class="pull-right" href="javascript:void(0)">
- <i class="fa fa-times"></i>
- </a>
- <span data-bind="text: field"></span>
-
- </div>
- <div class="content">
- <div class="facet-field-cnt">
- <span class="spinedit-cnt">
- <span class="facet-field-label facet-field-label-fixed-width">
- ${ _('Limit') }
- </span>
- <input type="text" class="input-medium" data-bind="spinedit: limit"/>
- </span>
- </div>
- <div class="facet-field-cnt">
- <span class="spinedit-cnt">
- <span class="facet-field-label facet-field-label-fixed-width">
- ${ _('Min Count') }
- </span>
- <input type="text" class="input-medium" data-bind="spinedit: mincount"/>
- </span>
- </div>
- </div>
- </div>
- </div>
- <div class="clearfix"></div>
- </div>
- <div class="margin-bottom-10" data-bind="visible: ! $root.isEditing()">
- <div data-bind="with: $root.collection.getFacetById($parent.id())">
- <!-- ko if: $data.properties.facets().length == 1 -->
- <div class="margin-bottom-10">
- <span data-bind="text: $data.properties.facets()[0].field"></span>
- </div>
- <!-- /ko -->
- </div>
- </div>
- <div data-bind="with: $root.collection.getFacetById($parent.id())">
- <div data-bind="mapChart: {data: {counts: $parent.counts(), scope: $root.collection.getFacetById($parent.id()).properties.scope()},
- transformer: mapChartDataTransformer,
- maxWidth: 750,
- isScale: true,
- onClick: function(d) {
- $root.query.togglePivotFacet({facet: {'fq_fields': d.fields, 'fq_values': d.value}, widget_id: id()});
- },
- onComplete: function(){ var widget = viewModel.getWidgetById($parent.id()); if (widget != null) { widget.isLoading(false)}; } }" />
- </div>
- </div>
- <!-- /ko -->
- <div class="widget-spinner" data-bind="visible: isLoading()">
- <!--[if !IE]> --><i class="fa fa-spinner fa-spin"></i><!-- <![endif]-->
- <!--[if IE]><img src="${ static('desktop/art/spinner.gif') }" /><![endif]-->
- </div>
- </script>
- <script type="text/html" id="leafletmap-widget">
- <div class="row-fluid">
- <div data-bind="visible: $root.isEditing" style="margin-top: 10px; margin-bottom: 20px;" class="leaflet-align">
- <span class="facet-field-label">${_('Latitude')}</span><div class="break-on-small-column"></div>
- <select data-bind="options: $root.collection.template.sortedGeogFieldsNames, value: $root.collection.template.leafletmap.latitudeField, optionsCaption: '${ _ko('Choose...') }'"></select>
-
- <div class="break-on-small-column"></div>
- <span class="facet-field-label">${_('Longitude')}</span><div class="break-on-small-column"></div>
- <select data-bind="options: $root.collection.template.sortedGeogFieldsNames, value: $root.collection.template.leafletmap.longitudeField, optionsCaption: '${ _ko('Choose...') }'"></select>
-
- <div class="break-on-small-column"></div>
- <span class="facet-field-label">${_('Label')}</span><div class="break-on-small-column"></div>
- <select data-bind="options: $root.collection.template.fieldsNames, value: $root.collection.template.leafletmap.labelField, optionsCaption: '${ _ko('Choose...') }'"></select>
- </div>
- <div data-bind="leafletMapChart: {showMoveCheckbox: true, moveCheckboxLabel: '${ _ko('Search as I move the map') }', visible: $root.hasRetrievedResults() && $root.collection.template.leafletmapOn(), isLoading: isLoading(), datum: {counts: $root.response()},
- transformer: leafletMapChartDataTransformer,
- onRegionChange: function(bounds){ $root.query.selectMapRegionFacet({widget_id: id(), 'bounds': ko.toJS(bounds, null, 2), lat: $root.collection.template.leafletmap.latitudeField(), lon: $root.collection.template.leafletmap.longitudeField()}); },
- onComplete: function(){ var widget = viewModel.getWidgetById(id()); if (widget != null) { widget.isLoading(false)}; } }">
- </div>
- </div>
- <div class="widget-spinner" data-bind="visible: isLoading()">
- <!--[if !IE]> --><i class="fa fa-spinner fa-spin"></i><!-- <![endif]-->
- <!--[if IE]><img src="${ static('desktop/art/spinner.gif') }" /><![endif]-->
- </div>
- </script>
- <script type="text/html" id="analysis-window">
- <!-- ko if: $root.fieldAnalysesName() -->
- <div data-bind="with: $root.getFieldAnalysis()">
- <div class="pull-right">
- <input type="text" data-bind="visible: section() == 'terms', clearable: terms.prefix, valueUpdate:'afterkeydown'" placeholder="${ _('Prefix filter...') }"/>
- <input type="text" data-bind="visible: section() == 'stats', clearable: stats.facet, typeahead: { target: stats.facet, source: $root.fieldsAnalysisAttributesNames, triggerOnFocus: true }" placeholder="${ _('Field name...') }"/>
- </div>
- <ul class="nav nav-tabs" role="tablist">
- <li class="active"><a href="#analysis-terms" role="tab" data-toggle="tab" data-bind="click: function() { section('terms'); }">${ _('Terms') }</a></li>
- <li><a href="#analysis-stats" role="tab" data-toggle="tab" data-bind="click: function() { section('stats'); }">${ _('Stats') }</a></li>
- </ul>
- <div class="tab-content">
- <div class="tab-pane active" id="analysis-terms" data-bind="with: terms">
- <div class="widget-spinner" data-bind="visible: $parent.isLoading()">
- <!--[if !IE]> --><i class="fa fa-spinner fa-spin"></i><!-- <![endif]-->
- <!--[if IE]><img src="${ static('desktop/art/spinner.gif') }" /><![endif]-->
- </div>
- <div class="alert" data-bind="visible: ! $parent.isLoading() && $data.data().length == 0">${ _('There are no terms to be shown') }</div>
- <table style="width: 100%" data-bind="visible: ! $parent.isLoading() && $data.data().length > 0" class="table-striped">
- <tbody data-bind="foreach: $data.data">
- <tr>
- <td data-bind="text: val.value"></td>
- <td style="width: 22px" data-bind="click: $root.query.addSingleTermFacet">
- <a href="javascript: void(0)"><i class="fa fa-plus" title="${ _('Select this value') }"></i></a>
- </td>
- <td style="width: 22px" data-bind="click: $root.query.removeSingleTermFacet">
- <a href="javascript: void(0)"><i class="fa fa-minus" title="${ _('Exclude this value') }"></i></a>
- </td>
- <td style="width: 40px">
- <div class="progress">
- <div class="bar-label" data-bind="text:val.count"></div>
- <div class="bar bar-info" style="margin-top:-20px;" data-bind="style: {'width': ((val.count / $parent.data()[0].val.count) * 100) + '%'}"></div>
- </div>
- </td>
- </tr>
- </tbody>
- </table>
- </div>
- <div class="tab-pane" id="analysis-stats" data-bind="with: stats">
- <div class="widget-spinner" data-bind="visible: $parent.isLoading()">
- <!--[if !IE]> --><i class="fa fa-spinner fa-spin"></i><!-- <![endif]-->
- <!--[if IE]><img src="${ static('desktop/art/spinner.gif') }" /><![endif]-->
- </div>
- <div class="alert" data-bind="visible: ! $parent.isLoading() && $data.data().length > 0 && $data.data()[0].key.toLowerCase() == 'error'">${ _('This field does not support stats') }</div>
- <div class="alert" data-bind="visible: ! $parent.isLoading() && $data.data().length == 0">${ _('There are no stats to be shown') }</div>
- <table style="width: 100%" data-bind="visible: ! $parent.isLoading() && $data.data().length > 0 && $data.data()[0].key.toLowerCase() != 'error'" class="table-striped">
- <tbody data-bind="foreach: $data.data">
- <tr>
- <td style="vertical-align: top"><strong data-bind="text: key"></strong></td>
- <!-- ko if: key == 'facets' -->
- <td>
- <!-- ko if: val[Object.keys(val)[0]] != null -->
- <table style="width: 400px">
- <tbody data-bind="foreach: Object.keys(val[Object.keys(val)[0]])">
- <tr>
- <td style="vertical-align: top; padding-left: 4px; padding-right: 4px"><strong data-bind="text: $data"></strong></td>
- <td data-bind="template: 'stats-facets'"></td>
- </tr>
- </tbody>
- </table>
- <!-- /ko -->
- <!-- ko ifnot: val[Object.keys(val)[0]] != null -->
- ${ _('Not available') }
- <!-- /ko -->
- </td>
- <!-- /ko -->
- <!-- ko ifnot: key == 'facets' -->
- <td data-bind="text: val"></td>
- <!-- /ko -->
- </tr>
- </tbody>
- </table>
- </div>
- </div>
- </div>
- <!-- /ko -->
- </script>
- <script type="text/html" id="stats-facets">
- <table style="width: 100%">
- <tbody data-bind="foreach: Object.keys($parent.val[Object.keys($parent.val)[0]][$data])">
- <tr>
- <td style="vertical-align: top; padding-left: 4px; padding-right: 4px"><strong data-bind="text: $data"></strong></td>
- <!-- ko ifnot: $data == 'facets' -->
- <td style="vertical-align: top" data-bind="text: $parents[1].val[Object.keys($parents[1].val)[0]][$parent][$data]"></td>
- <!-- /ko -->
- </tr>
- </tbody>
- </table>
- </script>
- <div id="addFacetDemiModal" class="demi-modal fade" data-backdrop="false">
- <div class="modal-body">
- <a href="javascript: void(0)" data-dismiss="modal" data-bind="click: addFacetDemiModalFieldCancel" class="pull-right"><i class="fa fa-times"></i></a>
- <div style="float: left; margin-right: 10px;text-align: center">
- <input id="addFacetInput" type="text" data-bind="clearable: $root.collection.template.fieldsModalFilter, valueUpdate:'afterkeydown'" placeholder="${_('Filter fields')}" class="input" style="float: left" /><br/>
- </div>
- <div>
- <ul data-bind="foreach: $root.collection.template.filteredModalFields().sort(function (l, r) { return l.name() > r.name() ? 1 : -1 }), visible: $root.collection.template.filteredModalFields().length > 0"
- class="unstyled inline fields-chooser" style="height: 100px; overflow-y: auto">
- <li data-bind="click: addFacetDemiModalFieldPreview">
- <span class="badge badge-info"><span data-bind="text: name(), attr: {'title': type()}"></span>
- </span>
- </li>
- </ul>
- <div class="alert alert-info inline" data-bind="visible: $root.collection.template.filteredModalFields().length == 0" style="margin-left: 250px;margin-right: 50px; height: 42px;line-height: 42px">
- ${_('There are no fields matching your search term.')}
- </div>
- </div>
- </div>
- <div><a class="pointer demi-modal-chevron" data-dismiss="modal" data-bind="click: addFacetDemiModalFieldCancel"><i class="fa fa-chevron-up"></i></a></div>
- </div>
- <div id="settingsDemiModal" class="demi-modal fade" data-backdrop="false">
- <a href="javascript: void(0)" data-dismiss="modal" class="pull-right" style="margin: 10px"><i class="fa fa-times"></i></a>
- <div class="modal-body">
- <div class="row-fluid">
- <div class="span12">
- <form class="form-horizontal">
- <fieldset>
- <legend><i class="fa fa-cogs"></i> ${ _('General settings') }</legend>
- <!-- ko if: $root.initial.inited() -->
- <div class="control-group">
- <label class="control-label" for="settingssolrindex">${ _('Solr index') }</label>
- <div class="controls">
- <select id="settingssolrindex" data-bind="options: $root.initial.collections, value: $root.collection.name"></select>
- </div>
- </div>
- <!-- /ko -->
- <div class="control-group">
- <label class="control-label" for="settingsdescription">${ _('Description') }</label>
- <div class="controls">
- <input id="settingsdescription" type="text" class="input-xlarge" data-bind="value: $root.collection.description" style="margin-bottom: 0" />
- </div>
- </div>
- <div class="control-group">
- <label class="control-label">${ _('Autocomplete') }</label>
- <div class="controls">
- <label class="checkbox" style="padding-top:0">
- <input type="checkbox" style="margin-right: 4px; margin-top: 9px" data-bind="checked: $root.collection.suggest.enabled"> ${ _('Dictionary') } <input type="text" class="input-xlarge" style="margin-bottom: 0; margin-left: 6px;" data-bind="value: $root.collection.suggest.dictionary" placeholder="${ _('Dictionary name or blank for default') }">
- </label>
- </div>
- </div>
- </fieldset>
- </form>
- </div>
- </div>
- </div>
- <div><a class="pointer demi-modal-chevron" data-dismiss="modal"><i class="fa fa-chevron-up"></i></a></div>
- </div>
- <div id="qdefinitionsDemiModal" class="demi-modal fade" data-backdrop="false">
- <a href="javascript: void(0)" data-dismiss="modal" class="pull-right" style="margin: 10px"><i class="fa fa-times"></i></a>
- <div class="modal-body">
- <div class="row-fluid">
- <div class="span12">
- <form class="form-inline">
- <fieldset>
- <legend><i class="fa fa-bookmark-o"></i> ${ _('Query definitions') }
- <div class="input-append" style="margin-left: 30px; margin-top: 4px">
- <input id="newqname" type="text" class="input-xxlarge" data-bind="value: $root.collection.newQDefinitionName, valueUpdate:'afterkeydown'" style="margin-bottom: 0" placeholder="${ _('Add current query as...') }" />
- <a title="${ _('Click on this button to add the currenty query as a new definition') }" class="btn plus-btn" data-bind="click: $root.collection.addQDefinition, css:{'disabled': $.trim($root.collection.newQDefinitionName()) == ''}" style="margin-top: 1px">
- <i class="fa fa-plus"></i>
- </a>
- </div>
- </legend>
- <div class="control-group" data-bind="visible: $root.collection.qdefinitions().length > 0" style="margin-top: 0">
- <div class="controls">
- <ul class="unstyled airy qdefinitions" data-bind="foreach: $root.collection.qdefinitions">
- <li>
- <span class="badge badge-info badge-left pointer">
- <span data-bind="text: name, attr:{'title': ko.mapping.toJSON(data, null, 2)}, click: $root.collection.loadQDefinition"></span>
- </span><span class="badge badge-right trash-share" data-bind="click: $root.collection.removeQDefinition"> <i class="fa fa-times"></i></span></li>
- </li>
- </ul>
- </div>
- </div>
- <div class="control-group" data-bind="visible: $root.collection.qdefinitions().length == 0">
- <div class="controls">
- <h4>${ _('There are currently no query definitions.') }</h4>
- </div>
- </div>
- </fieldset>
- </form>
- </div>
- </div>
- </div>
- <div><a class="pointer demi-modal-chevron" data-dismiss="modal"><i class="fa fa-chevron-up"></i></a></div>
- </div>
- <script type="text/html" id="time-filter">
- <span data-bind="visible: $root.availableDateFields().length > 0" >
- <span data-bind="template: {name: 'time-filter-select'}"></span>
- <a class="btn pointer" title="${ _('Time Settings') }" rel="tooltip" data-placement="bottom" data-toggle="modal" data-target="#timeSettingsDemiModal">
- <i class="fa fa-calendar"></i>
- </a>
- </span>
- </script>
- <script type="text/html" id="time-fixed-filter">
- <span data-bind="visible: $root.availableDateFields().length > 0" class="muted" title="${ _('Time Settings') }" rel="tooltip" data-placement="bottom" data-toggle="modal" data-target="#timeSettingsDemiModal" style="cursor:pointer">
-
- <span data-bind="text: moment($root.collection.timeFilter.from()).utc().format('YYYY-MM-DD HH:mm:SS')"></span>
- <i class="fa fa-long-arrow-right"></i>
- <span data-bind="text: moment($root.collection.timeFilter.to()).utc().format('YYYY-MM-DD HH:mm:SS')"></span>
- </span>
- </script>
- <script type="text/html" id="time-filter-select">
- <select id="settingstimeinterval" data-bind="value: collection.timeFilter.value" class="input-medium" style="margin-right: 4px">
- <option value="all">${ _('All') }</option>
- <option value="5MINUTES">${ _('Past 5 Minutes') }</option>
- <option value="30MINUTES">${ _('Past 30 Minutes') }</option>
- <option value="1HOURS">${ _('Past 1 Hour') }</option>
- <option value="12HOURS">${ _('Past 12 Hours') }</option>
- <option value="1DAYS">${ _('Past day') }</option>
- <option value="2DAYS">${ _('Past 2 days') }</option>
- <option value="7DAYS">${ _('Past 7 days') }</option>
- <option value="1MONTHS">${ _('Past 1 Month') }</option>
- <option value="3MONTHS">${ _('Past 3 Months') }</option>
- <option value="1YEARS">${ _('Past Year') }</option>
- <option value="2YEARS">${ _('Past 2 Years') }</option>
- <option value="10YEARS">${ _('Past 10 Years') }</option>
- </select>
- </script>
- <div id="timeSettingsDemiModal" class="demi-modal fade" data-backdrop="false">
- <a href="javascript: void(0)" data-dismiss="modal" class="pull-right" style="margin: 10px"><i class="fa fa-times"></i></a>
- <div class="modal-body">
- <div class="row-fluid">
- <div class="span12">
- <form class="form-horizontal">
- <fieldset>
- <legend><i class="fa fa-calendar"></i> ${ _('Time settings') }</legend>
- <span data-bind="visible: $root.availableDateFields().length > 0">
- <div class="control-group">
- <label class="control-label" for="settingstimefield">${ _('Date/time field') }</label>
- <div class="controls">
- <select id="settingstimefield" data-bind="options: $root.availableDateFields, value: collection.timeFilter.field, optionsValue: 'name'" class="input-medium"></select>
- </div>
- </div>
- <div class="control-group">
- <label class="control-label" for="settingstimetype">${ _('Type') }</label>
- <div class="controls">
- <label class="radio inline"><input type="radio" name="settingstimetype" value="rolling" data-bind="checked: collection.timeFilter.type" /> ${ _('Rolling') }</label>
- <label class="radio inline"><input type="radio" name="settingstimetype" value="fixed" data-bind="checked: collection.timeFilter.type" /> ${ _('Fixed') }</label>
- </div>
- </div>
- <div class="control-group" data-bind="visible: collection.timeFilter.type() == 'rolling'">
- <label class="control-label" for="settingstimeinterval">${ _('Interval') }</label>
- <div class="controls">
- <span data-bind="template: {name: 'time-filter-select'}"></span>
- </div>
- </div>
- <div class="control-group" data-bind="visible: collection.timeFilter.type() == 'fixed'">
- <label class="control-label" for="settingstimestart">${ _('Start date/time') }</label>
- <div class="controls">
- <input id="settingstimestart" type="text" data-bind="value: collection.timeFilter.from, datepicker: {momentFormat: 'YYYY-MM-DD[T]HH:mm:SS[Z]'}" />
- </div>
- </div>
- <div class="control-group" data-bind="visible: collection.timeFilter.type() == 'fixed'">
- <label class="control-label" for="settingstimeend">${ _('End date/time') }</label>
- <div class="controls">
- <input id="settingstimeend" type="text" data-bind="value: collection.timeFilter.to, datepicker: {momentFormat: 'YYYY-MM-DD[T]HH:mm:SS[Z]'}" />
- </div>
- </div>
- <div class="control-group">
- <div class="controls">
- <label class="checkbox">
- <input type="checkbox" style="margin-right: 4px; margin-top: 9px" data-bind="checked: $root.collection.autorefresh"/> ${ _('Auto-refresh every') } <input type="number" class="input-mini" style="margin-bottom: 0; margin-left: 6px; margin-right: 6px; width: 46px; text-align:center" data-bind="value: $root.collection.autorefreshSeconds"/> ${ _('seconds') }
- </label>
- </div>
- </div>
- </span>
- <!-- ko if: $root.availableDateFields().length == 0 -->
- <label class="checkbox">
- <input type="checkbox" style="margin-right: 4px; margin-top: 9px" data-bind="checked: $root.collection.autorefresh"/> ${ _('Auto-refresh every') } <input type="number" class="input-mini" style="margin-bottom: 0; margin-left: 6px; margin-right: 6px; width: 46px; text-align:center" data-bind="value: $root.collection.autorefreshSeconds"/> ${ _('seconds') }
- </label>
- <!-- /ko -->
- </fieldset>
- </form>
- </div>
- </div>
- </div>
- <div><a class="pointer demi-modal-chevron" data-dismiss="modal"><i class="fa fa-chevron-up"></i></a></div>
- </div>
- <div id="fieldAnalysis" class="popover mega-popover right">
- <div class="arrow"></div>
- <h3 class="popover-title" style="text-align: left">
- <a class="pull-right pointer" data-bind="click: function(){ $('#fieldAnalysis').hide(); $root.fieldAnalysesName(''); }"><i class="fa fa-times"></i></a>
- <strong data-bind="text: $root.fieldAnalysesName"></strong> ${ _(' field analysis') }
- </h3>
- <div class="popover-content" data-bind="template: { name: 'analysis-window' }" style="text-align: left"></div>
- </div>
- ## Extra code for style and custom JS
- <span id="extra" data-bind="augmenthtml: $root.collection.template.extracode"></span>
- <link rel="stylesheet" href="${ static('search/css/search.css') }">
- <link rel="stylesheet" href="${ static('desktop/ext/css/hue-filetypes.css') }">
- <link rel="stylesheet" href="${ static('desktop/ext/css/hue-charts.css') }">
- <link rel="stylesheet" href="${ static('desktop/ext/chosen/chosen.min.css') }">
- <link rel="stylesheet" href="${ static('desktop/ext/select2/select2.css') }">
- <script src="${ static('desktop/js/hue.json.js') }" type="text/javascript" charset="utf-8"></script>
- <script src="${ static('desktop/ext/js/moment-with-locales.min.js') }" type="text/javascript" charset="utf-8"></script>
- ${ dashboard.import_layout(True) }
- <script src="${ static('search/js/search.utils.js') }" type="text/javascript" charset="utf-8"></script>
- <script src="${ static('desktop/js/jquery.textsqueezer.js') }" type="text/javascript" charset="utf-8"></script>
- <script src="${ static('desktop/ext/js/bootstrap-editable.min.js') }" type="text/javascript" charset="utf-8"></script>
- <script src="${ static('desktop/js/ko.editable.js') }" type="text/javascript" charset="utf-8"></script>
- <script src="${ static('desktop/ext/js/shortcut.js') }" type="text/javascript" charset="utf-8"></script>
- <script src="${ static('desktop/ext/js/mustache.js') }" type="text/javascript" charset="utf-8"></script>
- <script src="${ static('desktop/ext/chosen/chosen.jquery.min.js') }" type="text/javascript" charset="utf-8"></script>
- <script src="${ static('desktop/ext/js/jquery/plugins/jquery.hotkeys.js') }"></script>
- <script src="${ static('desktop/ext/select2/select2.min.js') }" type="text/javascript" charset="utf-8"></script>
- <script src="${ static('search/js/search.ko.js') }" type="text/javascript" charset="utf-8"></script>
- ${ dashboard.import_bindings() }
- ${ dashboard.import_charts() }
- <style type="text/css">
- % if conf.CUSTOM.BANNER_TOP_HTML.get():
- .search-bar {
- top: 58px!important;
- }
- .card-toolbar {
- top: 100px!important;
- }
- #emptyDashboardEditing {
- top: 190px!important;
- }
- .dashboard {
- margin-top: 20px;
- }
- .dashboard.with-top-margin {
- margin-top: 80px;
- }
- % endif
- </style>
- <script type="text/javascript" charset="utf-8">
- var viewModel;
- nv.dev = false;
- moment.suppressDeprecationWarnings = true;
- var HIT_OPTIONS = [
- { value: "count", label: "${ _('Count') }" },
- { value: "unique", label: "${ _('Unique Count') }" },
- { value: "avg", label: "${ _('Average') }" },
- { value: "sum", label: "${ _('Sum') }" },
- { value: "min", label: "${ _('Min') }" },
- { value: "max", label: "${ _('Max') }" },
- { value: "sumsq", label: "${ _('Sum of square') }" },
- { value: "median", label: "${ _('Median') }" }
- ];
- function getHitOption(value){
- for (var i=0; i < HIT_OPTIONS.length; i++){
- if (HIT_OPTIONS[i].value == value){
- return HIT_OPTIONS[i].label;
- }
- }
- return '';
- }
- function prettifyDate(from, widget, to) {
- if (typeof from == "undefined" || $.isNumeric(from)) {
- return from;
- }
- if (typeof to != "undefined" && !$.isNumeric(to)) {
- return prettifyDateRange(from, to, widget);
- }
- var _mFrom = moment(from);
- if (_mFrom.isValid()) {
- var _format = "YYYY-MM-DD HH:mm:ss";
- var _minMaxDiff = 0;
- if (widget && widget.properties && widget.properties.min && widget.properties.min()) {
- _minMaxDiff = moment(widget.properties.max()).diff(moment(widget.properties.min()), 'seconds');
- if (moment(widget.properties.max()).seconds() == 0 && moment(widget.properties.min()).seconds() == 0) {
- _format = _format.substring(0, 16); // gets rid of :00 seconds
- }
- }
- _format = getFormat(_format, _minMaxDiff, widget);
- return _mFrom.utc().format(_format);
- }
- else {
- return from;
- }
- }
- function prettifyDateRange(from, to, widget, withCommon) {
- if (typeof from == "undefined" || $.isNumeric(from)) {
- return from + " - " + to;
- }
- var _mFrom = moment(from);
- var _mTo = moment(to);
- if (_mFrom.isValid() && _mTo.isValid()) {
- var _mFromFormatted = _mFrom.utc().format("YYYY-MM-DD HH:mm:ss");
- var _mToFormatted = _mTo.utc().format("YYYY-MM-DD HH:mm:ss");
- var _lastEqual = _mFromFormatted.length - 1;
- for (var i = _mFromFormatted.length - 1; i >= 0; i--) {
- if (_mFromFormatted[i] == _mToFormatted[i] && (_mFromFormatted[i] == "0" || _mFromFormatted[i] == ":")) {
- _lastEqual = i;
- }
- else break;
- }
- var _minMaxDiff = moment(to).diff(moment(from), 'seconds');
- var _format = "YYYY-MM-DD HH:mm:ss".substr(0, _lastEqual);
- if (_format.length == 13){
- _format += ":mm"; // hours without minutes are weird
- }
- var _formatWithCommon = _format.substring(10, _format.length);
- var _common = "YYYY-MM-DD";
- if (widget && widget.properties && widget.properties.min && widget.properties.min()) {
- _minMaxDiff = moment(widget.properties.max()).diff(moment(widget.properties.min()), 'seconds');
- }
- if (withCommon && _mTo.diff(_mFrom, 'days') >= 365){
- withCommon = false;
- _format = _common;
- }
- else {
- _format = getFormat(_format, _minMaxDiff, widget);
- }
- return ((_common != "" && withCommon) ? _mFrom.utc().format(_common) + " " : "") + _mFrom.utc().format(withCommon ? _formatWithCommon : _format) + " <i class='fa fa-long-arrow-right'></i> " + ((_common != "" && withCommon) ? _mTo.utc().format(_common) + " " : "") + _mTo.utc().format(withCommon ? _formatWithCommon : _format);
- }
- else {
- return from + " - " + to;
- }
- }
- function getFormat(format, minMaxDiff, widget) {
- var _hasWidget = widget && widget.properties && widget.properties.min && widget.properties.min();
- if (minMaxDiff > 0 && minMaxDiff <= 86400) { // max 1 day
- if (_hasWidget && moment(widget.properties.max()).date() != moment(widget.properties.min()).date()) {
- format = format.substring(5, format.length);
- }
- else {
- format = format.substring(10, format.length);
- }
- }
- if (minMaxDiff > 86400 && minMaxDiff <= 22464000) { // max 360 days
- format = format.substring(5, format.length);
- }
- if (minMaxDiff > 22464000){
- format = format.substr(0, 10);
- }
- if (format.indexOf("MM") == 0) {
- format = "MMM " + format.substr(3);
- }
- return format;
- }
- var lastWindowScrollPosition = 0;
- function pieChartDataTransformer(data) {
- var _data = [];
- $(data.counts).each(function (cnt, item) {
- item.widget_id = data.widget_id;
- _data.push({
- label: item.value,
- value: item.count,
- obj: item
- });
- });
- return _data;
- }
- function _rangePieChartDataTransformer(data, isUp) {
- var _data = [];
- $(data.counts).each(function (cnt, item) {
- item.widget_id = data.widget_id;
- var _label = isUp ? (item.from + (item.is_up ? ' & ${ _('Up') }' : ' & ${ _('Less') }')) : (item.from + ' - ' + item.to);
- _data.push({
- label: _label,
- from: item.from,
- to: item.to,
- value: item.value,
- obj: item
- });
- });
- return _data;
- }
- function rangePieChartDataTransformer(data) {
- return _rangePieChartDataTransformer(data, false);
- }
- function rangeUpPieChartDataTransformer(data) {
- return _rangePieChartDataTransformer(data, true);
- }
- function pieChartDataTransformerGrid(data) {
- var _data = [];
- var chartX = viewModel.collection.template.chartSettings.chartX();
- var chartY = viewModel.collection.template.chartSettings.chartYSingle();
- $(data.counts).each(function (cnt, item) {
- item.widget_id = data.widget_id;
- if (chartX != "" && item.item[chartX] && chartY != "" && item.item[chartY]) {
- _data.push({
- label: item.item[chartX](),
- value: item.item[chartY](),
- obj: item
- });
- }
- });
- return _data;
- }
- function _barChartDataTransformer(rawDatum, isUp) {
- var _datum = [];
- var _data = [];
- $(rawDatum.counts).each(function (cnt, item) {
- item.widget_id = rawDatum.widget_id;
- if (typeof item.from != "undefined") {
- if (isUp){
- _data.push({
- series: 0,
- x: item.from + (item.is_up ? ' & ${ _('Up') }' : ' & ${ _('Less') }'),
- y: item.value,
- obj: item
- });
- }
- else {
- _data.push({
- series: 0,
- x: item.from,
- x_end: item.to,
- y: item.value,
- obj: item
- });
- }
- }
- else {
- _data.push({
- series: 0,
- x: item.value,
- y: item.count,
- obj: item
- });
- }
- });
- _datum.push({
- key: rawDatum.label,
- values: _data
- });
- return _datum;
- }
- function barChartDataTransformer(rawDatum) {
- return _barChartDataTransformer(rawDatum, false);
- }
- function barChartRangeUpDataTransformer(rawDatum) {
- return _barChartDataTransformer(rawDatum, true);
- }
- function _partitionChartDataTransformer(counts) {
- var _categories = [];
- $(counts).each(function (cnt, item) {
- var _category = null;
- _categories.forEach(function (category) {
- if (category.name == item.value) {
- _category = category;
- }
- });
- if (_category == null) {
- _category = {
- name: item.value,
- size: item.count,
- obj: item,
- children: []
- }
- _categories.push(_category);
- }
- if (item.pivot != undefined) {
- var children = []
- $(item.pivot).each(function (cnt, child) {
- children = children.concat(_partitionChartDataTransformer(child));
- });
- _category.children = children;
- }
- });
- return _categories;
- }
- function partitionChartDataTransformer(rawDatum) {
- var _partitionData = {
- name: "${ _('Total') }",
- children: []
- }
- _partitionData.children = _partitionChartDataTransformer(rawDatum.counts);
- return _partitionData;
- }
- function pivotChartDataTransformer(rawDatum) {
- var _categories = [];
- $(rawDatum.counts).each(function (cnt, item) {
- item.widget_id = rawDatum.widget_id;
- var _key = Array.isArray(item.value) ? item.value[1] : item.value;
- var _category = null;
- _categories.forEach(function (category) {
- if (category.key == _key) {
- _category = category;
- }
- });
- if (_category == null) {
- _category = {
- key: _key,
- values: []
- };
- _categories.push(_category);
- }
- _category.values.push({
- series: 0,
- x: item.cat,
- y: item.count,
- obj: item
- });
- });
- return _categories;
- }
- function lineChartDataTransformer(rawDatum) {
- var _datum = [];
- var _data = [];
- $(rawDatum.counts).each(function (cnt, item) {
- item.widget_id = rawDatum.widget_id;
- if (typeof item.from != "undefined") {
- _data.push({
- series: 0,
- x: item.from,
- x_end: item.to,
- y: item.value,
- obj: item
- });
- }
- else {
- _data.push({
- series: 0,
- x: item.value,
- y: item.count,
- obj: item
- });
- }
- });
- _datum.push({
- key: rawDatum.label,
- values: _data
- });
- return _datum;
- }
- function timelineChartDataTransformer(rawDatum) {
- var _datum = [];
- var _data = [];
- $(rawDatum.counts).each(function (cnt, item) {
- _data.push({
- series: 0,
- x: new Date(moment(item.from).valueOf()),
- y: item.value,
- obj: item
- });
- });
- _datum.push({
- key: rawDatum.label,
- values: _data
- });
- // If multi query
- $(rawDatum.extraSeries).each(function (cnt, item) {
- if (cnt == 0) {
- _datum = [];
- }
- var _data = [];
- $(item.counts).each(function (cnt, item) {
- _data.push({
- series: cnt + 1,
- x: new Date(moment(item.from).valueOf()),
- y: item.value,
- obj: item
- });
- });
- _datum.push({
- key: item.label,
- values: _data
- });
- });
- return _datum;
- }
- function mapChartDataTransformer(data) {
- var _data = [];
- $(data.counts).each(function (cnt, item) {
- item.fields = item.pivot ? item.pivot[0].fq_fields : item.fq_fields;
- item.values = item.pivot ? item.pivot[0].fq_values : item.fq_values;
- item.counts = item.pivot ? item.pivot[0].count : item.count; // unused yet
- item.is2d = item.pivot ? true : false; // unused yet
- if (item.value != null && item.value != "" && item.value.length < 4) {
- var _label = data.scope == "world" ? HueGeo.getISOAlpha3(item.value) : item.value.toUpperCase();
- var _found = false;
- for (var i = 0; i < _data.length; i++) { // we group lower and upper cases together
- if (_data[i].label == _label) {
- _data[i].value += item.pivot ? item.pivot[0].fq_values : item.count;
- _found = true;
- break;
- }
- }
- if (!_found) {
- _data.push({
- label: _label,
- value: item.pivot ? item.pivot[0].fq_values : item.count,
- obj: item
- });
- }
- }
- });
- return _data;
- }
- function leafletMapChartDataTransformer(data) {
- var _data = [];
- if (!$.isEmptyObject(data.counts) && data.counts.response.docs && viewModel.collection.template.leafletmap.latitudeField() != "" && viewModel.collection.template.leafletmap.longitudeField() != "") {
- data.counts.response.docs.forEach(function (record) {
- var _obj = {
- lat: record[viewModel.collection.template.leafletmap.latitudeField()],
- lng: record[viewModel.collection.template.leafletmap.longitudeField()]
- }
- if (viewModel.collection.template.leafletmap.labelField() != "") {
- _obj.label = record[viewModel.collection.template.leafletmap.labelField()];
- }
- _data.push(_obj);
- });
- }
- return _data;
- }
- function leafletMapChartDataTransformerGrid(data) {
- var _data = [];
- $(data.counts).each(function (cnt, item) {
- var chartX = viewModel.collection.template.chartSettings.chartX();
- var chartY = viewModel.collection.template.chartSettings.chartYSingle();
- var chartMapLabel = viewModel.collection.template.chartSettings.chartMapLabel();
- if (chartX != "" && item.item[chartX] && chartY != "" && item.item[chartY]) {
- var _obj = {
- lat: item.item[chartX](),
- lng: item.item[chartY]()
- }
- if (chartMapLabel != "" && item.item[chartMapLabel]) {
- _obj.label = item.item[chartMapLabel]();
- }
- _data.push(_obj);
- }
- });
- return _data;
- }
- function multiSerieDataTransformer(rawDatum) {
- var _datum = [];
- if (rawDatum.snippet.chartX() != null && rawDatum.snippet.chartYMulti().length > 0) {
- var _plottedSerie = 0;
- rawDatum.snippet.chartYMulti().forEach(function (col) {
- var _idxValue = -1;
- var _idxLabel = -1;
- rawDatum.snippet.result.meta().forEach(function (icol, idx) {
- if (icol.name == rawDatum.snippet.chartX()) {
- _idxLabel = idx;
- }
- if (icol.name == col) {
- _idxValue = idx;
- }
- });
- if (_idxValue > -1) {
- var _data = [];
- $(rawDatum.counts()).each(function (cnt, item) {
- _data.push({
- series: _plottedSerie,
- x: item[_idxLabel],
- y: item[_idxValue],
- obj: item
- });
- });
- if (rawDatum.sorting == "asc") {
- _data.sort(function (a, b) {
- return a.y - b.y
- });
- }
- if (rawDatum.sorting == "desc") {
- _data.sort(function (a, b) {
- return b.y - a.y
- });
- }
- _datum.push({
- key: col,
- values: _data
- });
- _plottedSerie++;
- }
- });
- }
- return _datum;
- }
- function multiSerieDataTransformerGrid(rawDatum) {
- var _datum = [];
- var chartX = viewModel.collection.template.chartSettings.chartX();
- var chartY = viewModel.collection.template.chartSettings.chartYMulti();
- if (chartX != null && chartY.length > 0 && rawDatum.counts.length > 0) {
- var _plottedSerie = 0;
- chartY.forEach(function (col) {
- var _data = [];
- $(rawDatum.counts).each(function (cnt, item) {
- if (item.item[chartX] && item.item[col]) {
- _data.push({
- series: _plottedSerie,
- x: item.item[chartX](),
- y: item.item[col](),
- obj: item.item
- });
- }
- });
- if (rawDatum.sorting == "asc") {
- _data.sort(function (a, b) {
- return a.y - b.y
- });
- }
- if (rawDatum.sorting == "desc") {
- _data.sort(function (a, b) {
- return b.y - a.y
- });
- }
- _datum.push({
- key: col,
- values: _data
- });
- _plottedSerie++;
- });
- }
- return _datum;
- }
- function scatterChartDataTransformer(rawDatum) {
- var _datum = [];
- if (rawDatum.snippet.chartX() != null && rawDatum.snippet.chartYSingle() != null) {
- function addToDatum(col) {
- var _idxX = -1;
- var _idxY = -1;
- var _idxSize = -1;
- var _idxGroup = -1;
- rawDatum.snippet.result.meta().forEach(function (icol, idx) {
- if (icol.name == rawDatum.snippet.chartX()) {
- _idxX = idx;
- }
- if (icol.name == rawDatum.snippet.chartYSingle()) {
- _idxY = idx;
- }
- if (icol.name == rawDatum.snippet.chartScatterSize()) {
- _idxSize = idx;
- }
- if (icol.name == rawDatum.snippet.chartScatterGroup()) {
- _idxGroup = idx;
- }
- });
- if (_idxX > -1 && _idxY > -1) {
- var _data = [];
- $(rawDatum.counts()).each(function (cnt, item) {
- if (_idxGroup == -1 || item[_idxGroup] == col) {
- _data.push({
- x: item[_idxX],
- y: item[_idxY],
- shape: 'circle',
- size: _idxSize > -1 ? item[_idxSize] : 100,
- obj: item
- });
- }
- });
- _datum.push({
- key: col,
- values: _data
- });
- }
- }
- if (rawDatum.snippet.chartScatterGroup() != null) {
- var _idxGroup = -1;
- rawDatum.snippet.result.meta().forEach(function (icol, idx) {
- if (icol.name == rawDatum.snippet.chartScatterGroup()) {
- _idxGroup = idx;
- }
- });
- if (_idxGroup > -1) {
- $(rawDatum.counts()).each(function (cnt, item) {
- addToDatum(item[_idxGroup]);
- });
- }
- }
- else {
- addToDatum('${ _('Distribution') }');
- }
- }
- return _datum;
- }
- function scatterChartDataTransformerGrid(rawDatum) {
- var _datum = [];
- return _datum;
- }
- function toggleDocDetails(doc) {
- doc.showDetails(! doc.showDetails());
- if (doc.details().length == 0) {
- viewModel.getDocument(doc);
- }
- }
- function resizeFieldsList() {
- $(".fields-list").css("max-height", Math.max($("#result-container").height(), 230));
- window.setTimeout(function () {
- var _fillHeight = $("#result-container").height() - 40;
- if ($(".fields-list").height() < _fillHeight) {
- $(".fields-list").height(_fillHeight);
- $(".fields-list").css("max-height", _fillHeight);
- }
- }, 100);
- }
- function queryTypeahead(query, process) {
- var _source = viewModel.collection.template.fieldsNames();
- _source = _source.concat("AND OR TO".split(" "))
- if (viewModel.collection.suggest.enabled()) {
- viewModel.suggest(query, function (data) {
- var _tmp = [];
- if (typeof data != "undefined" && data.response && data.response.suggest && data.response.suggest[viewModel.collection.suggest.dictionary()]) {
- var suggestions = data.response.suggest[viewModel.collection.suggest.dictionary()][query].suggestions;
- suggestions.forEach(function (sugg) {
- _tmp.push(sugg.term + "<i class='muted fa fa-search'></i>");
- });
- }
- process(_tmp.concat(_source));
- });
- }
- else {
- return _source;
- }
- }
- $(document).ready(function () {
- var _resizeTimeout = -1;
- $(window).resize(function(){
- window.clearTimeout(_resizeTimeout);
- window.setTimeout(function(){
- resizeFieldsList();
- }, 200);
- });
- $(document).on("click", ".widget-settings-pill", function(){
- $(this).parents(".card-body").find(".widget-section").hide();
- selectAllCollectionFields(); // Make sure all the collection fields appear
- $(this).parents(".card-body").find(".widget-settings-section").show();
- $(this).parent().siblings().removeClass("active");
- $(this).parent().addClass("active");
- });
- $(document).on("click", ".widget-editor-pill", function(){
- $(this).parents(".card-body").find(".widget-section").hide();
- $(this).parents(".card-body").find(".widget-editor-section").show();
- $(this).parent().siblings().removeClass("active");
- $(this).parent().addClass("active");
- });
- $(document).on("click", ".widget-html-pill", function(){
- $(this).parents(".card-body").find(".widget-section").hide();
- $(this).parents(".card-body").find(".widget-html-section").show();
- $(document).trigger("refreshCodemirror");
- $(this).parent().siblings().removeClass("active");
- $(this).parent().addClass("active");
- });
- $(document).on("click", ".widget-css-pill", function(){
- $(this).parents(".card-body").find(".widget-section").hide();
- $(this).parents(".card-body").find(".widget-css-section").show();
- $(document).trigger("refreshCodemirror");
- $(this).parent().siblings().removeClass("active");
- $(this).parent().addClass("active");
- });
- $(document).on("magicLayout", function(){
- resizeFieldsList();
- });
- $(document).on("setLayout", function(){
- resizeFieldsList();
- });
- var _query = ${ query | n,unicode };
- viewModel = new SearchViewModel(${ collection.get_json(user) | n,unicode }, _query, ${ initial | n,unicode });
- viewModel.timelineChartTypes = ko.observableArray([
- {
- value: "line",
- label: "${ _('Lines')}"
- },
- {
- value: "bar",
- label: "${ _('Bars')}"
- }
- ]);
- ko.applyBindings(viewModel);
- viewModel.init(function(data){
- $(".chosen-select").trigger("chosen:updated");
- });
- viewModel.isRetrievingResults.subscribe(function(value){
- if (! value){
- resizeFieldsList();
- }
- });
- viewModel.isEditing.subscribe(function(value){
- if (value){
- window.setTimeout(function(){
- if ($(".slider-cnt").length > 0 && $(".slider-cnt").data("slider")){
- $(".slider-cnt").slider("redraw");
- }
- }, 300);
- }
- });
- viewModel.isPlayerMode.subscribe(function(value) {
- if (value){
- $(".navigator").hide();
- $("body").css("paddingTop", "40px");
- }
- else {
- $(".navigator").show();
- $("body").css("paddingTop", "80px");
- }
- });
- var _refreshTimeout = null;
- viewModel.collection.autorefresh.subscribe(function (value) {
- if (value) {
- refresh();
- }
- else {
- window.clearTimeout(_refreshTimeout);
- }
- });
- if (viewModel.collection.autorefresh()) {
- refresh();
- }
- function refresh() {
- _refreshTimeout = window.setTimeout(function () {
- if (viewModel.collection.autorefresh()) {
- viewModel.search(refresh);
- }
- }, ($.isNumeric(viewModel.collection.autorefreshSeconds()) ? viewModel.collection.autorefreshSeconds() * 1 : 60) * 1000)
- }
- $("#addFacetDemiModal").on("hidden", function () {
- if (typeof selectedWidget.hasBeenSelected == "undefined"){
- addFacetDemiModalFieldCancel();
- }
- });
- $(document).on("shownAnalysis", function(){
- var _fieldElement = $(".field-selector").filter(function(){ return $(this).text().toLowerCase() === viewModel.fieldAnalysesName().toLowerCase();}).parent();
- $("#fieldAnalysis").show().css("top", _fieldElement.position().top - $("#fieldAnalysis").outerHeight()/2 + _fieldElement.outerHeight()/2).css("left", _fieldElement.position().left + _fieldElement.outerWidth());
- });
- % if is_owner:
- $(window).bind("keydown", "ctrl+s alt+s meta+s", function(e){
- e.preventDefault();
- viewModel.save();
- return false;
- });
- % endif
- $(window).bind("keydown", "esc", function () {
- if ($(".demi-modal.fade.in").length > 0) {
- $(".demi-modal.fade.in .demi-modal-chevron").click();
- }
- });
- $("#newqname").bind("keydown", "return", function (e) {
- e.preventDefault();
- viewModel.collection.addQDefinition();
- });
- $(document).on("loadedQDefinition", function() {
- if ($(".demi-modal.fade.in").length > 0) {
- $(".demi-modal.fade.in .demi-modal-chevron").click();
- }
- });
- function loadQueryDefinition(id) {
- var _qdef = viewModel.collection.getQDefinition(id);
- if (_qdef != null) {
- viewModel.collection.loadQDefinition(_qdef);
- }
- }
- if (window.location.hash != "" && window.location.hash.indexOf("qd=") > -1) {
- loadQueryDefinition(window.location.hash.substr(1).replace(/(<([^>]+)>)/ig, "").split("=")[1]);
- }
- else if (_query.qd) {
- loadQueryDefinition(_query.qd);
- }
- });
- function toggleGridFieldsSelection() {
- if (viewModel.collection.template.fields().length > 0) {
- viewModel.collection.template.fieldsSelected([])
- }
- else {
- selectAllCollectionFields();
- }
- }
- function selectAllCollectionFields() {
- var _fields = [];
- $.each(viewModel.collection.fields(), function (index, field) {
- _fields.push(field.name());
- });
- viewModel.collection.template.fieldsSelected(_fields);
- }
- function columnDropAdditionalHandler(widget) {
- if (viewModel.collection.getFacetById(widget.id()) == null) {
- showAddFacetDemiModal(widget);
- }
- viewModel.search();
- }
- function widgetDraggedAdditionalHandler(widget, row) {
- showAddFacetDemiModal(widget, row);
- }
- function distributeRowWidgetsSize(row, waitForIt) {
- if (row) {
- if (waitForIt) {
- var _initial = row.widgets().length;
- var _widgetDropInterval = window.setInterval(function () {
- if (row.widgets().length != _initial) {
- window.clearInterval(_widgetDropInterval);
- row.autosizeWidgets();
- }
- }, 100)
- }
- else {
- row.autosizeWidgets();
- }
- }
- }
- var selectedWidget = null;
- var selectedRow = null;
- function showAddFacetDemiModal(widget, row) {
- if (["resultset-widget", "html-resultset-widget", "filter-widget", "leafletmap-widget"].indexOf(widget.widgetType()) == -1) {
- viewModel.collection.template.fieldsModalFilter("");
- viewModel.collection.template.fieldsModalType(widget.widgetType());
- viewModel.collection.template.fieldsModalFilter.valueHasMutated();
- $('#addFacetInput').typeahead({
- 'source': viewModel.collection.template.availableWidgetFieldsNames(),
- 'updater': function (item) {
- addFacetDemiModalFieldPreview({'name': function () {
- return item
- }});
- return item;
- }
- });
- selectedWidget = widget;
- selectedRow = row;
- $("#addFacetDemiModal").modal("show");
- $("#addFacetDemiModal input[type='text']").focus();
- }
- else {
- distributeRowWidgetsSize(row, true);
- }
- }
- function addFacetDemiModalFieldPreview(field) {
- var _existingFacet = viewModel.collection.getFacetById(selectedWidget.id());
- if (selectedWidget != null) {
- selectedWidget.hasBeenSelected = true;
- selectedWidget.isLoading(true);
- viewModel.collection.addFacet({'name': field.name(), 'widget_id': selectedWidget.id(), 'widgetType': selectedWidget.widgetType()});
- if (_existingFacet != null) {
- _existingFacet.label(field.name());
- _existingFacet.field(field.name());
- }
- $("#addFacetDemiModal").modal("hide");
- if (selectedRow != null) {
- distributeRowWidgetsSize(selectedRow);
- }
- }
- }
- function addFacetDemiModalFieldCancel() {
- viewModel.removeWidget(selectedWidget);
- selectedRow = null;
- }
- $(document).on("setResultsHeight", function () {
- $("#result-main").height($("#result-container").outerHeight() + 100);
- resizeFieldsList();
- });
- function highlightColumn(column) {
- var _colName = $.trim(column.name());
- if (viewModel.collection.template.fieldsSelected.indexOf(_colName) > -1) {
- var _t = $("#result-container");
- var _col = _t.find("th").filter(function () {
- return $.trim($(this).text()) == _colName;
- });
- if (_t.find("tr td:nth-child(" + (_col.index() + 1) + ").columnSelected").length == 0) {
- _t.find(".columnSelected").removeClass("columnSelected");
- _t.find("tr td:nth-child(" + (_col.index() + 1) + ")").addClass("columnSelected");
- _t.parent().animate({
- scrollLeft: _t.find("tr td:nth-child(" + (_col.index() + 1) + ")").position().left + _t.parent().scrollLeft() - _t.parent().offset().left - 30
- }, 300);
- }
- else {
- _t.find(".columnSelected").removeClass("columnSelected");
- }
- }
- }
- function checkResultHighlightingAvailability() {
- if (! viewModel.collection.idField()) {
- $(document).trigger("warn", "${ _('Result highlighting is unavailable: the collection does not have an index field') }");
- }
- }
- </script>
- ${ commonfooter(request, messages) | n,unicode }
|