| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971 |
- ## 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); huePubSub.publish('gridChartForceUpdate'); }">
- <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-map-marker" data-bind="visible: $root.collection.template.chartSettings.chartType() == ko.HUE_CHARTS.TYPES.MAP"
- 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.showChart(true); $root.collection.template.chartSettings.chartType(ko.HUE_CHARTS.TYPES.BARCHART); $root.collection.template.showGrid(false); huePubSub.publish('gridChartForceUpdate');}"
- 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.showChart(true); $root.collection.template.chartSettings.chartType(ko.HUE_CHARTS.TYPES.LINECHART); $root.collection.template.showGrid(false); huePubSub.publish('gridChartForceUpdate');}">
- <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.showChart(true); $root.collection.template.chartSettings.chartType(ko.HUE_CHARTS.TYPES.PIECHART); $root.collection.template.showGrid(false); huePubSub.publish('gridChartForceUpdate');}">
- <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.MAP}, click: function(){ $root.collection.template.showChart(true); $root.collection.template.chartSettings.chartType(ko.HUE_CHARTS.TYPES.MAP); $root.collection.template.showGrid(false); huePubSub.publish('gridChartForceUpdate');}">
- <i class="fa fa-fw fa-map-marker chart-icon"></i> ${_('Marker 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 class="grid-chart-container" 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) ? $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.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">
- <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.MAP">
- <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">
- <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>
- ${ 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 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();
- });
- huePubSub.subscribe('gridChartForceUpdate', function () {
- window.setTimeout(function () {
- $('.grid-chart-container').children().trigger('forceUpdate')
- }, 200);
- });
- 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 }
|