-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPeopleMap.html
398 lines (354 loc) · 13.9 KB
/
PeopleMap.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
<!DOCTYPE html>
<html>
<head>
<title>All Content</title>
<meta about="Search all content at once."/>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge"/>
<meta name="viewport"
content="width=device-width, height=device-height, initial-scale=1.0, maximum-scale=1.0, user-scalable=0">
<script src="js/CoveoJsSearch.WithDependencies.js"></script>
<script type="text/javascript" src="https://maps.googleapis.com/maps/api/js?key=AIzaSyCCm-i7I611b3HxtQOCt3NlMtl5-oFX9Oc&sensor=false"> </script>
<script type="text/javascript" src="https://www.google.com/jsapi"></script>
<script src="js/CoveoGoogleMap.js"></script>
<script src="js/CoveoMarkerClusterer.js"></script>
<script type="text/javascript" src="http://google-maps-utility-library-v3.googlecode.com/svn/trunk/infobox/src/infobox.js"></script>
<script src="js/CoveoResultRelatedResults.js"></script>
<script src="js/d3.js"></script>
<script src="//code.jquery.com/ui/1.11.3/jquery-ui.js"></script>
<link rel="stylesheet" href="Calendar/fullcalendar.min.css">
<link rel="stylesheet" href="//code.jquery.com/ui/1.11.3/themes/smoothness/jquery-ui.css">
<script src="Calendar/moment.min.js"></script>
<script src="Calendar/fullcalendar.min.js"></script>
<link rel="stylesheet" href="css/CoveoFullSearch.css"/>
<style>
.calAvail{ background-color:#42d692; }
.calAvailHalf { background-color:#ee8a36;}
.calNotAvail { background-color:#d83a28;}
.ProposedHalf { background-color:#ee8a36;}
.Holiday { border-color: green }
.Training { border-color: red}
.Selected { border-top: 2px;border-bottom:2px;border-color:black}
.NotSelected { zoom: 1;
filter: alpha(opacity=20);
opacity: 0.2; }
.calReserveHalf { background-color:#ee8a36;}
.calReserved { background-color:#d83a28;}
.Calendar h2 {
font-size:1.2em;
}
.fc-bg tr td{
height: 20px;
}
.fc-content-skeleton tr {
height: 2px;
}
</style>
<script type="text/javascript">
var FieldnameAvail="@mydateavail";
var FieldnameAvailClean="mydateavail";
var NrOfMonths=0;
//Construct the query to get the dates which are selected
function getFullDates(min,max)
{
var result="";
var minDate = new Date(min);
var maxDate = new Date(max);
var NrofDays=0;
var one_day=1000*60*60*24;
NrOfMonths=maxDate.getMonth()-minDate.getMonth()+1;
NrofDays=Math.round((maxDate.getTime()-minDate.getTime())/one_day);
for (i = 0; i <= NrofDays; i++)
{
var check = new Date(minDate.getFullYear(),minDate.getMonth(),minDate.getDate()+i);
//Do not add saturday and sundays
if (check.getDay()%6==0)
{
}
else
{
if (result == "")
{
result = FieldnameAvail + "=\"" + $.datepicker.formatDate('yymmdd', check) /*+ Hours.ToString() */+ "\"";
}
else
{
result = result + " AND " + FieldnameAvail + "=\"" + $.datepicker.formatDate('yymmdd', check) /*+ Hours.ToString() */+ "\"";
}
}
}
return result;
}
$(function () {
//Used for the related results on a result
Coveo.Rest.SearchEndpoint.configureOnPremiseEndpoint('http://localhost:8080/rest/search');
$('#search').coveo('init');
//Hook up to populate breadcrumb for the map
$('#search').on('populateBreadcrumb', function(e, args){
if (mapQuery!=null)
{
if(mapQuery!="@uri")
{
var container = "<div>Filtered on map location.</div>";
args.breadcrumbs.push({ element: container });
}
}
if (mapQueryCircle!=null)
{
if(mapQueryCircle!="@uri")
{
var container = "<div>Filtered on only contents within the boundary of the circle location.</div>";
args.breadcrumbs.push({ element: container });
}
}
});
//Hook up to the clearbreadcrumb
$('#search').on('clearBreadcrumb', function(e, args){
mapQuery=null;
mapQueryCircle=null;
resetMap();
$('#search').coveo('executeQuery');
});
//When we have results rebuild the map
$('#search').on('querySuccess', function (e, args) {
mapQueryResults = args.queryBuilder.computeCompleteExpression();
if (Coveo.Utils.isNullOrUndefined(mapQueryResults))
{
mapQueryResults='@uri';
}
allreset=false;
createResultsMap(mapQueryResults, "mylat","mylon");
});
//Initialize the date pickers
var dates = $( "#CALMinimumDateTxt, #CALMaximumDateTxt" ).datepicker({
defaultDate: '+0',
changeMonth: true,
dateFormat:'dd-mm-yy',
showAnim:'slideDown',
showWeek:true,
showButtonPanel:true,
firstday:1,
numberOfMonths: 3,
onSelect: function( selectedDate ) {
var option = this.id == "CALMinimumDateTxt"? "minDate" : "maxDate",
instance = $( this ).data( "datepicker" ),
date = $.datepicker.parseDate('dd-mm-yy', selectedDate, instance.settings );
dates.not( this ).datepicker( 'option', option, date );
$('#CALMinimumDateTxt').trigger('change');
}
});
//Hook up to the query to add the dates (if needed)
//Also add the mapquery's and the nested queries
$('#search').on("buildingQuery", function (e, args) {
var radiosel=$('input:radio[name=avail]:checked').val();
if ( radiosel!='All')
{
var addquery=getFullDates($('#CALMinimumDateTxt').datepicker('getDate'),$('#CALMaximumDateTxt').datepicker('getDate'));
if (radiosel=='Avail')
{
args.queryBuilder.advancedExpression.add("("+addquery+")");
}
else
{
args.queryBuilder.advancedExpression.add("NOT ("+addquery+")");
}
}
if (mapQuery!=null)
{
args.queryBuilder.advancedExpression.add(mapQuery);
}
if (mapQueryCircle!=null)
{
args.queryBuilder.advancedExpression.add(mapQueryCircle);
}
//We also want to add a nested query against the resume's
// add the disjunction query to get all comments, attachments and tickets matching the query
var basicExpression = args.queryBuilder.expression.build();
var completeQuery = (typeof basicExpression==='undefined') ? "":"(" + basicExpression + ")";
var advancedExpression = "";//!args.Builder.AdvancedExpression.Empty ? " (" + args.Builder.AdvancedExpression.ToString() + ")" : "";
if (completeQuery!="") {
//args.queryBuilder.disjunctionExpression.add("@sysfiletype=activedirperson @employeenumber=[[@mycvemp] ("+completeQuery+") "+advancedExpression+" ]");
}
});
$('.CoveoSearchInterface').on('newResultDisplayed', function(e, args) {
//Add the calendar to the result, only if it is selected
var mycal=$(args.item).find('.Calendar');
mycal.empty();
if ($('#CALMaximumDateTxt').val()!="" && $('#CALMinimumDateTxt').val()!="")
{
var Start=$('#CALMinimumDateTxt').datepicker('getDate');
var StartDate=$('#CALMinimumDateTxt').datepicker('getDate');
var EndDate=$('#CALMaximumDateTxt').datepicker('getDate');
NrOfMonths=$('#CALMaximumDateTxt').datepicker('getDate').getMonth()-$('#CALMinimumDateTxt').datepicker('getDate').getMonth();
for(i=0;i<=NrOfMonths;i++)
{
var newcal = Coveo.$('<div/>').addClass('mycalendar'+i).appendTo(mycal);
newcal.css('width','200px').css('display','inline-block').css('margin','5px');
newcal.fullCalendar({
height: 150,
width: 150,
weekNumbers: false,
columnFormat: 'dd',
defaultDate: Start,
contentHeight: 'auto',
aspectRatio: 5,
header: {
left: 'title',
center: '',
right: ''
},
dayRender: function (date, cell) {
if (date<StartDate || date>EndDate)
{
//disable it
cell.addClass("NotSelected");
}
else
{
//disable it
cell.addClass("Selected");
}
//If our result contains this date then available else not
var curdate=moment(date).format('YYYYMMDD');
if (args.result.raw[FieldnameAvailClean].indexOf(curdate)!=-1)
{
//disable it
cell.addClass("calAvail");
cell.attr('title','Available');
}
else
{
//disable it
cell.addClass("calNotAvail");
cell.attr('title','Not Available');
}
}
});
Start=new Date(Start.getFullYear(),Start.getMonth()+1,Start.getDate());
}
}
});
});
</script>
</head>
<body id="search" class='CoveoSearchInterface' data-enable-history="true">
<div class="coveo-tab-section">
<a class="CoveoTab"
data-id="All"
data-caption="People"
data-icon="coveo-sprites-tab-all-content"
data-expression='@sysworkemail @mydateavail'
></a>
</div>
<div class="coveo-search-section">
<div class="coveo-logo-column">
<div class="coveo-logo"></div>
</div>
<div class="coveo-searchBox-column" >
<div class="coveo-search-section-wrapper">
<div class="CoveoSettings" data-include-in-menu=".CoveoShareQuery,.CoveoPreferencesPanel"></div>
<div class="CoveoSearchBox" data-activate-omnibox="true"></div>
</div>
</div>
<div class="coveo-logo-column">
</div>
<div class="coveo-searchBox-column" >
<div class="coveo-search-section-wrapper">
From: <input type="text" id="CALMinimumDateTxt"> To: <input type="text" id="CALMaximumDateTxt"><br>
Show availability: <input type="radio" name="avail" value="All" checked>All <input type="radio" name="avail" value="Avail">Only Available people
<input type="radio" name="avail" value="NotAvail">Only NOT Available people
</div>
</div>
</div>
<div class="coveo-results-section">
<div class="coveo-facet-column">
<div data-tab="All">
<div class="CoveoFacetRange" data-tab="All" data-title="Relative date distribution" data-field="@sysdate"
data-date-field="true" data-range-slider="true" data-slider-graph-steps="20"
data-slider-start="2007/12/31"
data-slider-end="2014/12/31"></div>
<div class="CoveoFacet"
data-title="Type"
data-field="@objecttype"
data-allow-toggling-operator="true"
data-show-icon="true"
data-tab="All"></div>
<div class="CoveoFacet"
data-title="File Type"
data-field="@sysfiletype"></div>
<div class="CoveoFacet"
data-title="Author"
data-field="@sysauthor"></div>
</div>
</div>
<div class="coveo-results-column">
<div class="CoveoShareQuery"></div>
<div class="CoveoPreferencesPanel">
<div class="CoveoResultsPreferences"></div>
<div class="CoveoResultsFiltersPreferences"></div>
</div>
<div class="CoveoBreadcrumb"></div>
<div class="coveo-results-header">
<div class="coveo-summary-section">
<span class="CoveoQuerySummary"></span>
<span class="CoveoQueryDuration"></span>
</div>
<div class="coveo-sort-section">
<span class="CoveoSort" data-sort-criteria="relevancy">Relevance</span>
<span class="CoveoSort" data-sort-criteria="date descending,date ascending">Date</span>
</div>
<div class="coveo-clear"></div>
</div>
<div class="CoveoHiddenQuery"></div>
<div class="CoveoDidYouMean"></div>
<div class="CoveoErrorReport" data-pop-up="false"></div>
<div id="map-container" >
<div style="width:700px;height:300px" id="map-canvas"></div>
</div>
<div class="CoveoResultList" data-wait-animation="fade">
<script id="Default" type="text/x-underscore-template">
<div style="margin:5px" width="100px">
<%= thumbnail(undefined,undefined,{'width':'100px'})%>
</div>
<div class="coveo-date"><%-dateTime(raw.sysdate)%></div>
<div class="coveo-title">
<a class="CoveoResultLink" ><%=title?highlight(title, titleHighlights):clickUri%></a>
<%= loadTemplate("DefaultQuickView") %>
</div>
<div class="coveo-excerpt">
<%=highlight(excerpt, excerptHighlights)%>
</div>
<div class="CoveoPrintableUri"></div>
<table class="CoveoFieldTable">
<tr data-field="@sysauthor" data-caption="Author"></tr>
</table>
<div class="Calendar" style=""></div>
</script>
<script id="DefaultQuickView" type="text/x-underscore-template">
<div class="CoveoQuickView" data-title="<%= attrEncode(fromFileTypeToIcon(obj) + title) %>"
data-fixed="true"
data-template-id="DefaultQuickViewContent">
</div>
</script>
<script id="DefaultQuickViewContent" type="text/x-underscore-template">
<div class="coveo-quick-view-header">
<table class="CoveoFieldTable">
<tr data-field="@sysdate" data-caption="Date" data-helper="dateTime"></tr>
<tr data-field="@objecttype" data-caption="Type"></tr>
</table>
</div>
<div class="CoveoQuickViewDocument"></div>
</script>
<script class="result-template" type="text/x-underscore-template">
<%=
loadTemplates({
'Default' : 'default'
})
%>
</script>
</div>
<div class="CoveoPager"></div>
</div>
</div>
</body>
</html>