1 | {known_script id="jquery.ui" src=$ROOT_URL|@cat:"themes/default/js/ui/packed/ui.core.packed.js"} |
---|
2 | {known_script id="jquery.ui.dialog" src=$ROOT_URL|@cat:"themes/default/js/ui/packed/ui.dialog.packed.js"} |
---|
3 | {known_script id="jquery.ui.slider" src=$ROOT_URL|@cat:"themes/default/js/ui/packed/ui.slider.packed.js"} |
---|
4 | {known_script id="maps.google.com/api" src="http://maps.google.com/maps/api/js?sensor=false"} |
---|
5 | |
---|
6 | <!-- |
---|
7 | Note : the position of control (navigation, mapType) were implemented, but the |
---|
8 | result after trying positionning is strange... |
---|
9 | so, these functionnalities are deactivated |
---|
10 | --> |
---|
11 | |
---|
12 | |
---|
13 | {literal} |
---|
14 | <script type="text/javascript"> |
---|
15 | |
---|
16 | |
---|
17 | |
---|
18 | |
---|
19 | function userDefManage () |
---|
20 | { |
---|
21 | var properties = { |
---|
22 | id:'', |
---|
23 | gMap:null, |
---|
24 | } |
---|
25 | |
---|
26 | /** |
---|
27 | * initialize the page |
---|
28 | */ |
---|
29 | this.init = function () |
---|
30 | { |
---|
31 | computedHeight=$(window).height()-100; |
---|
32 | computedWidth=$(window).width()-100; |
---|
33 | $('#iDialogEdit') |
---|
34 | .dialog( |
---|
35 | { |
---|
36 | autoOpen:false, |
---|
37 | width:computedWidth, |
---|
38 | height:computedHeight, |
---|
39 | modal: true, |
---|
40 | dialogClass: 'gcBgTabSheet gcBorder', |
---|
41 | title: '{/literal}{"gmaps_config_map"|@translate}{literal}', |
---|
42 | buttons: |
---|
43 | { |
---|
44 | '{/literal}{"gmaps_ok"|@translate}{literal}': |
---|
45 | function() |
---|
46 | { |
---|
47 | if(checkValidity()) doUpdate(); |
---|
48 | }, |
---|
49 | '{/literal}{"gmaps_cancel"|@translate}{literal}': |
---|
50 | function() |
---|
51 | { |
---|
52 | $('#iDialogEdit').dialog("close"); |
---|
53 | } |
---|
54 | } |
---|
55 | } |
---|
56 | ); |
---|
57 | |
---|
58 | $('#iBDDisplayTypeIC, #iBDDisplayTypeIP, #iBDDisplayTypeMP').bind('change', |
---|
59 | function () |
---|
60 | { |
---|
61 | switch($(this).val()) |
---|
62 | { |
---|
63 | case 'IC': |
---|
64 | $('#iBDZoomLevelRow').hide(); |
---|
65 | $('[name=fBDSizeMode]').attr('disabled', false); |
---|
66 | break; |
---|
67 | case 'IP': |
---|
68 | $('#iBDZoomLevelRow').show(); |
---|
69 | $('[name=fBDSizeMode]').attr('disabled', false); |
---|
70 | break; |
---|
71 | case 'MP': |
---|
72 | $('#iBDZoomLevelRow').show(); |
---|
73 | $('#iBDSizeModeF').attr('checked', true).change(); |
---|
74 | $('[name=fBDSizeMode]').attr('disabled', true); |
---|
75 | break; |
---|
76 | } |
---|
77 | } |
---|
78 | ); |
---|
79 | |
---|
80 | $('#iBDSizeModeA, #iBDSizeModeF').bind('change', |
---|
81 | function () |
---|
82 | { |
---|
83 | switch($(this).val()) |
---|
84 | { |
---|
85 | case 'A': |
---|
86 | $('#iBDMapWidthSliderRow, #iBDMapHeightSliderRow').hide(); |
---|
87 | break; |
---|
88 | case 'F': |
---|
89 | $('#iBDMapWidthSliderRow, #iBDMapHeightSliderRow').show(); |
---|
90 | break; |
---|
91 | } |
---|
92 | } |
---|
93 | ); |
---|
94 | |
---|
95 | $("#iBDMapWidthSlider").slider( |
---|
96 | { |
---|
97 | min:100, |
---|
98 | max:1280, |
---|
99 | step:5, |
---|
100 | value:100, |
---|
101 | slide: function(event, ui) { changeSize(ui.value, 'iBDMapWidthSlider'); } |
---|
102 | }); |
---|
103 | $("#iBDMapHeightSlider").slider( |
---|
104 | { |
---|
105 | min:100, |
---|
106 | max:1280, |
---|
107 | step:5, |
---|
108 | value:100, |
---|
109 | slide: function(event, ui) { changeSize(ui.value, 'iBDMapHeightSlider'); } |
---|
110 | }); |
---|
111 | $("#iBDMapZoomLevelSlider").slider( |
---|
112 | { |
---|
113 | min:1, |
---|
114 | max:20, |
---|
115 | step:1, |
---|
116 | value:8, |
---|
117 | slide: function(event, ui) { changeZoom(ui.value, 'plugin'); } |
---|
118 | }); |
---|
119 | $("#iBDMapWidthSlider a, #iBDMapHeightSlider a, #iBDMapZoomLevelSlider").addClass('gcBgInput'); |
---|
120 | |
---|
121 | $('#iBDMapMapType').bind('change', function () { changeMapType('plugin'); } ); |
---|
122 | $('#iBDMapMapTypeControlType').bind('change', changeTypeControlType); |
---|
123 | //$('#iBDMapTypeControlPos').bind('change', changeTypeControlPosition); |
---|
124 | $('#iBDMapNavigationControlType').bind('change', changeNavigationControlType); |
---|
125 | //$('#iBDMapNavigationControlPos').bind('change', changeNavigationControlPosition); |
---|
126 | $('#iBDMapScaleControl').bind('change', changeScaleControl); |
---|
127 | |
---|
128 | |
---|
129 | loadList(); |
---|
130 | } |
---|
131 | |
---|
132 | |
---|
133 | |
---|
134 | /** |
---|
135 | * change the display control display mode |
---|
136 | */ |
---|
137 | var changeScaleControl = function () |
---|
138 | { |
---|
139 | if(properties.gMap!=null) |
---|
140 | { |
---|
141 | properties.gMap.setOptions( |
---|
142 | { |
---|
143 | scaleControl: ($('#iBDMapScaleControl').val()=='n')?false:true, |
---|
144 | } |
---|
145 | ); |
---|
146 | } |
---|
147 | } |
---|
148 | |
---|
149 | /** |
---|
150 | * change the display control type |
---|
151 | */ |
---|
152 | var changeTypeControlType = function () |
---|
153 | { |
---|
154 | if(properties.gMap!=null) |
---|
155 | { |
---|
156 | cType=parseInt($('#iBDMapMapTypeControlType').val()); |
---|
157 | |
---|
158 | properties.gMap.setOptions( |
---|
159 | { |
---|
160 | mapTypeControl: (cType==-1)?false:true, |
---|
161 | mapTypeControlOptions: |
---|
162 | { |
---|
163 | style:cType |
---|
164 | } |
---|
165 | } |
---|
166 | ); |
---|
167 | } |
---|
168 | } |
---|
169 | |
---|
170 | /** |
---|
171 | * change the display control position |
---|
172 | */ |
---|
173 | /* |
---|
174 | var changeTypeControlPosition = function () |
---|
175 | { |
---|
176 | if(properties.gMap!=null) |
---|
177 | { |
---|
178 | properties.gMap.setOptions( |
---|
179 | { |
---|
180 | mapTypeControlOptions: |
---|
181 | { |
---|
182 | position:parseInt($('#iBDMapTypeControlPos').val()) |
---|
183 | } |
---|
184 | } |
---|
185 | ); |
---|
186 | } |
---|
187 | } |
---|
188 | */ |
---|
189 | |
---|
190 | |
---|
191 | /** |
---|
192 | * change the zoom control type |
---|
193 | */ |
---|
194 | var changeNavigationControlType = function () |
---|
195 | { |
---|
196 | if(properties.gMap!=null) |
---|
197 | { |
---|
198 | cType=parseInt($('#iBDMapNavigationControlType').val()); |
---|
199 | |
---|
200 | properties.gMap.setOptions( |
---|
201 | { |
---|
202 | navigationControl: (cType==-1)?false:true, |
---|
203 | navigationControlOptions: |
---|
204 | { |
---|
205 | style:cType |
---|
206 | } |
---|
207 | } |
---|
208 | ); |
---|
209 | } |
---|
210 | } |
---|
211 | |
---|
212 | /** |
---|
213 | * change the zoom control position |
---|
214 | */ |
---|
215 | /* |
---|
216 | var changeNavigationControlPosition = function () |
---|
217 | { |
---|
218 | if(properties.gMap!=null) |
---|
219 | { |
---|
220 | properties.gMap.setOptions( |
---|
221 | { |
---|
222 | navigationControlOptions: |
---|
223 | { |
---|
224 | position:parseInt($('#iBDMapTypeControlPos').val()) |
---|
225 | } |
---|
226 | } |
---|
227 | ); |
---|
228 | } |
---|
229 | } |
---|
230 | */ |
---|
231 | |
---|
232 | /** |
---|
233 | * change the width/height |
---|
234 | * @param value : the width or height |
---|
235 | * @param id : define if the width is changed or the height |
---|
236 | */ |
---|
237 | var changeSize = function (value, id) |
---|
238 | { |
---|
239 | $('#'+id+'Display').html(value+'px'); |
---|
240 | $('#'+id+'Value').val(value); |
---|
241 | |
---|
242 | $('#iBDExampleMap').css( |
---|
243 | { |
---|
244 | width:$('#iBDMapWidthSliderValue').val()+'px', |
---|
245 | height:$('#iBDMapHeightSliderValue').val()+'px' |
---|
246 | } |
---|
247 | ); |
---|
248 | |
---|
249 | if(properties.gMap!=null) google.maps.event.trigger(properties.gMap, 'resize'); |
---|
250 | } |
---|
251 | |
---|
252 | /** |
---|
253 | * change the zoom value |
---|
254 | * @param value : the zoom value (1 - 20) |
---|
255 | * @param caller : designed to determine who's calling the function and avoid |
---|
256 | * recursivity in events call ; values = 'plugin' or 'map' |
---|
257 | */ |
---|
258 | var changeZoom = function (value, caller) |
---|
259 | { |
---|
260 | $('#iBDMapZoomLevelSliderDisplay').html(value); |
---|
261 | $('#iBDMapZoomLevelSliderValue').val(value); |
---|
262 | |
---|
263 | if(properties.gMap!=null && caller=='plugin') |
---|
264 | { |
---|
265 | properties.gMap.setZoom(parseInt(value)); |
---|
266 | } |
---|
267 | else if(caller=='map') |
---|
268 | { |
---|
269 | $('#iBDMapZoomLevelSlider').slider('option', 'value', value); |
---|
270 | } |
---|
271 | } |
---|
272 | |
---|
273 | /** |
---|
274 | * change the display mode (map type) |
---|
275 | * @param caller : designed to determine who's calling the function and avoid |
---|
276 | * recursivity in events call ; values = 'plugin' or 'map' |
---|
277 | */ |
---|
278 | var changeMapType = function (caller) |
---|
279 | { |
---|
280 | if(properties.gMap!=null && caller=='plugin') |
---|
281 | { |
---|
282 | properties.gMap.setOptions( |
---|
283 | { |
---|
284 | mapTypeId: $('#iBDMapMapType').val() |
---|
285 | } |
---|
286 | ); |
---|
287 | } |
---|
288 | else if(caller=='map') |
---|
289 | { |
---|
290 | $('#iBDMapMapType').val(properties.gMap.getMapTypeId()); |
---|
291 | } |
---|
292 | } |
---|
293 | |
---|
294 | |
---|
295 | /** |
---|
296 | * initialize the map |
---|
297 | */ |
---|
298 | var initializeMap = function () |
---|
299 | { |
---|
300 | var latlng=new google.maps.LatLng(0, 0); |
---|
301 | |
---|
302 | mapTypeControlOptions={ }; |
---|
303 | |
---|
304 | var map = new google.maps.Map($("#iBDExampleMap").get(0), |
---|
305 | { |
---|
306 | mapTypeId: $('#iBDMapMapType').val(), |
---|
307 | zoom: parseInt($('#iBDMapZoomLevelSliderValue').val()), |
---|
308 | center:latlng, |
---|
309 | navigationControl: ($('#iBDMapNavigationControlType').val()!='-1')?true:false, |
---|
310 | navigationControlOptions: |
---|
311 | { |
---|
312 | style:($('#iBDMapNavigationControlType').val()!='-1')?parseInt($('#iBDMapNavigationControlType').val()):0, |
---|
313 | }, |
---|
314 | scaleControl: ($('#iBDMapScaleControl').val()=='n')?false:true, |
---|
315 | mapTypeControl:($('#iBDMapMapTypeControlType').val()!='-1')?true:false, |
---|
316 | mapTypeControlOptions: |
---|
317 | { |
---|
318 | style:($('#iBDMapMapTypeControlType').val()!='-1')?parseInt($('#iBDMapMapTypeControlType').val()):0, |
---|
319 | }, |
---|
320 | markerTitle:'', |
---|
321 | } |
---|
322 | ); |
---|
323 | |
---|
324 | properties.gMap=map; |
---|
325 | |
---|
326 | google.maps.event.addListener( |
---|
327 | properties.gMap, |
---|
328 | 'zoom_changed', |
---|
329 | function() |
---|
330 | { |
---|
331 | changeZoom(properties.gMap.getZoom(), 'map'); |
---|
332 | } |
---|
333 | ); |
---|
334 | |
---|
335 | google.maps.event.addListener( |
---|
336 | properties.gMap, |
---|
337 | 'maptypeid_changed', |
---|
338 | function() |
---|
339 | { |
---|
340 | changeMapType('map'); |
---|
341 | } |
---|
342 | ); |
---|
343 | } |
---|
344 | |
---|
345 | /** |
---|
346 | * manage the tabsheet |
---|
347 | * |
---|
348 | * @param String tabsheet : id of the tabsheet to display |
---|
349 | */ |
---|
350 | this.displayTab = function (tabsheet) |
---|
351 | { |
---|
352 | switch(tabsheet) |
---|
353 | { |
---|
354 | case 'general': |
---|
355 | $('#iTabGeneral').css('display', 'block'); |
---|
356 | $('#iTabDimensions').css('display', 'none'); |
---|
357 | $('#iTabMapType').css('display', 'none'); |
---|
358 | $('#iTabZoomLevel').css('display', 'none'); |
---|
359 | break; |
---|
360 | case 'dimensions': |
---|
361 | $('#iTabGeneral').css('display', 'none'); |
---|
362 | $('#iTabDimensions').css('display', 'block'); |
---|
363 | $('#iTabMapType').css('display', 'none'); |
---|
364 | $('#iTabZoomLevel').css('display', 'none'); |
---|
365 | break; |
---|
366 | case 'mapType': |
---|
367 | $('#iTabGeneral').css('display', 'none'); |
---|
368 | $('#iTabDimensions').css('display', 'none'); |
---|
369 | $('#iTabMapType').css('display', 'block'); |
---|
370 | $('#iTabZoomLevel').css('display', 'none'); |
---|
371 | break; |
---|
372 | case 'zoomLevel': |
---|
373 | $('#iTabGeneral').css('display', 'none'); |
---|
374 | $('#iTabDimensions').css('display', 'none'); |
---|
375 | $('#iTabMapType').css('display', 'none'); |
---|
376 | $('#iTabZoomLevel').css('display', 'block'); |
---|
377 | break; |
---|
378 | } |
---|
379 | } |
---|
380 | |
---|
381 | |
---|
382 | /** |
---|
383 | * open the dialog box to edit the map properties |
---|
384 | * |
---|
385 | * @param String id : if set to '' => open dialogbox in 'add' mode |
---|
386 | * otherwise edit the given map |
---|
387 | */ |
---|
388 | this.editMap = function (id) |
---|
389 | { |
---|
390 | properties.id=id; |
---|
391 | updateDialog(''); |
---|
392 | this.displayTab('general'); |
---|
393 | // >> because li items don't have id... :-( |
---|
394 | $('#itab2 li').removeClass('selected_tab').addClass('normal_tab'); |
---|
395 | $('#itab2 li:first').addClass('selected_tab'); |
---|
396 | // << |
---|
397 | |
---|
398 | $('#iDialogEdit') |
---|
399 | .bind('dialogopen', function () |
---|
400 | { |
---|
401 | if(properties.id!='') |
---|
402 | { |
---|
403 | displayProcessing(true); |
---|
404 | |
---|
405 | $.ajax( |
---|
406 | { |
---|
407 | type: "POST", |
---|
408 | url: "{/literal}{$datas.urlRequest}{literal}", |
---|
409 | async: true, |
---|
410 | data: { ajaxfct:"admin.maps.getMap", id:properties.id }, |
---|
411 | success: |
---|
412 | function(msg) |
---|
413 | { |
---|
414 | updateDialog(msg); |
---|
415 | initializeMap(); |
---|
416 | displayProcessing(false); |
---|
417 | } |
---|
418 | } |
---|
419 | ); |
---|
420 | } |
---|
421 | else |
---|
422 | { |
---|
423 | initializeMap(); |
---|
424 | } |
---|
425 | } |
---|
426 | ) |
---|
427 | .dialog("open"); |
---|
428 | } |
---|
429 | |
---|
430 | /** |
---|
431 | * delete a map |
---|
432 | * |
---|
433 | * @param String id : id of the map to delete |
---|
434 | */ |
---|
435 | this.deleteMap = function (id) |
---|
436 | { |
---|
437 | $('#iDialogDelete') |
---|
438 | .html('<br>{/literal}{"gmaps_pleaseConfirmMetadataDelete_1"|@translate}<br><br>{"gmaps_pleaseConfirmMetadataDelete_2"|@translate}{literal}') |
---|
439 | .dialog( |
---|
440 | { |
---|
441 | autoOpen:true, |
---|
442 | modal: true, |
---|
443 | dialogClass: 'gcBgTabSheet gcBorder', |
---|
444 | title: '{/literal}{"gmaps_deleteMap"|@translate}{literal}', |
---|
445 | buttons: |
---|
446 | { |
---|
447 | '{/literal}{"gmaps_delete"|@translate}{literal}': |
---|
448 | function() |
---|
449 | { |
---|
450 | $(this).html("<br><img src='./plugins/GrumPluginClasses/icons/processing.gif'>"); |
---|
451 | $.ajax( |
---|
452 | { |
---|
453 | type: "POST", |
---|
454 | url: "{/literal}{$datas.urlRequest}{literal}", |
---|
455 | async: true, |
---|
456 | data: { ajaxfct:"admin.maps.deleteMap", id:id }, |
---|
457 | success: |
---|
458 | function(msg) |
---|
459 | { |
---|
460 | $('#iDialogDelete').dialog("destroy"); |
---|
461 | loadList(); |
---|
462 | } |
---|
463 | } |
---|
464 | ); |
---|
465 | }, |
---|
466 | '{/literal}{"gmaps_cancel"|@translate}{literal}': |
---|
467 | function() |
---|
468 | { |
---|
469 | $('#iDialogDelete').dialog("destroy"); |
---|
470 | } |
---|
471 | } |
---|
472 | } |
---|
473 | ); |
---|
474 | } |
---|
475 | |
---|
476 | /** |
---|
477 | * update values of the dialog box |
---|
478 | * |
---|
479 | * @param String items : json string ; if empty assume to reset all fields |
---|
480 | * with blank |
---|
481 | */ |
---|
482 | var updateDialog = function (items) |
---|
483 | { |
---|
484 | if(items=='') |
---|
485 | { |
---|
486 | tmp={ |
---|
487 | sizeMode:'A', |
---|
488 | displayTYpe:'IC' |
---|
489 | } |
---|
490 | $('#iBDName').val(''); |
---|
491 | $('#iBDDisplayTypeIC').attr('checked', true); |
---|
492 | $('#iBDSizeModeA').attr('checked', true); |
---|
493 | $('#iBDMapWidthSliderValue').val('470'); |
---|
494 | $('#iBDMapHeightSliderValue').val('210'); |
---|
495 | $('#iBDMapWidthSlider').slider('option', 'value', 470); |
---|
496 | $('#iBDMapHeightSlider').slider('option', 'value', 210); |
---|
497 | $('#iBDMapZoomLevelSliderValue').val(4); |
---|
498 | $('#iBDMapZoomLevelSlider').slider('option', 'value', 4); |
---|
499 | $('#iBDMapMapType').val('hybrid'); |
---|
500 | $('#iBDMapMapTypeControlType').val('0'); // default - auto |
---|
501 | //$('#iBDMapTypeControlPos').val('3'); // top right |
---|
502 | $('#iBDMapNavigationControlType').val('0'); // default - auto |
---|
503 | //$('#iBDMapNavigationControlPos').val('1'); // top left |
---|
504 | $('#iBDMapScaleControl').val('y'); // default - visible |
---|
505 | $('#iBDExampleMap').html('').css( |
---|
506 | { |
---|
507 | width:$('#iBDMapWidthSliderValue').val()+'px', |
---|
508 | height:$('#iBDMapHeightSliderValue').val()+'px' |
---|
509 | } |
---|
510 | ); |
---|
511 | |
---|
512 | properties.gMap=null; |
---|
513 | } |
---|
514 | else |
---|
515 | { |
---|
516 | tmp=$.parseJSON(items); |
---|
517 | |
---|
518 | $('#iBDNumId').val(tmp.id); |
---|
519 | $('#iBDName').val(tmp.name); |
---|
520 | $('#iBDDisplayType'+tmp.displayType).attr('checked', true); |
---|
521 | $('#iBDSizeMode'+tmp.sizeMode).attr('checked', true); |
---|
522 | $('#iBDMapWidthSliderValue').val(tmp.width); |
---|
523 | $('#iBDMapHeightSliderValue').val(tmp.height); |
---|
524 | $('#iBDMapWidthSlider').slider('option', 'value', tmp.width); |
---|
525 | $('#iBDMapHeightSlider').slider('option', 'value', tmp.height); |
---|
526 | $('#iBDMapZoomLevelSliderValue').val(tmp.zoomLevel); |
---|
527 | $('#iBDMapZoomLevelSlider').slider('option', 'value', tmp.zoomLevel); |
---|
528 | $('#iBDMapMapType').val(tmp.mapType); |
---|
529 | $('#iBDMapMapTypeControlType').val(tmp.mapTypeControl); |
---|
530 | $('#iBDMapNavigationControlType').val(tmp.navigationControl); |
---|
531 | $('#iBDMapScaleControl').val(tmp.scaleControl); |
---|
532 | |
---|
533 | $('#iBDExampleMap').html('').css( |
---|
534 | { |
---|
535 | width:tmp.width+'px', |
---|
536 | height:tmp.height+'px' |
---|
537 | } |
---|
538 | ); |
---|
539 | } |
---|
540 | |
---|
541 | $('#iBDDisplayType'+tmp.displayType+', #iBDSizeMode'+tmp.sizeMode).change(); |
---|
542 | changeSize($('#iBDMapWidthSliderValue').val(), 'iBDMapWidthSlider'); |
---|
543 | changeSize($('#iBDMapHeightSliderValue').val(), 'iBDMapHeightSlider'); |
---|
544 | changeZoom($('#iBDMapZoomLevelSliderValue').val(), ''); |
---|
545 | } |
---|
546 | |
---|
547 | /** |
---|
548 | * reload the user defined map list |
---|
549 | */ |
---|
550 | var loadList = function () |
---|
551 | { |
---|
552 | $('#iListMaps').html("<br>{/literal}{'gmaps_loading'|@translate}{literal}<br><img src='./plugins/GrumPluginClasses/icons/processing.gif'>"); |
---|
553 | |
---|
554 | $.ajax( |
---|
555 | { |
---|
556 | type: "POST", |
---|
557 | url: "{/literal}{$datas.urlRequest}{literal}", |
---|
558 | async: true, |
---|
559 | data: { ajaxfct:"admin.maps.getList" }, |
---|
560 | success: |
---|
561 | function(msg) |
---|
562 | { |
---|
563 | $("#iListMaps").html(msg); |
---|
564 | } |
---|
565 | } |
---|
566 | ); |
---|
567 | } |
---|
568 | |
---|
569 | /** |
---|
570 | * check the validity of a given map id |
---|
571 | * a valid id only contains chars : A-Z0-9_ |
---|
572 | * |
---|
573 | * @param String tagId : the tagId |
---|
574 | * @return Boolean : true if ok, otherwise false |
---|
575 | */ |
---|
576 | var checkIdValidity = function (tagId) |
---|
577 | { |
---|
578 | re=/^[a-z0-9_]+$/i; |
---|
579 | if(re.exec(tagId)==null) return(false); |
---|
580 | return(true); |
---|
581 | } |
---|
582 | |
---|
583 | |
---|
584 | /** |
---|
585 | * check for the validity of the map settings |
---|
586 | */ |
---|
587 | var checkValidity = function () |
---|
588 | { |
---|
589 | $('.error').removeClass('error'); |
---|
590 | |
---|
591 | ok=true; |
---|
592 | |
---|
593 | return(ok); |
---|
594 | } |
---|
595 | |
---|
596 | /** |
---|
597 | * send map update to the server, and close the dialog box if everything |
---|
598 | * is ok |
---|
599 | */ |
---|
600 | var doUpdate = function () |
---|
601 | { |
---|
602 | displayProcessing(true); |
---|
603 | |
---|
604 | // build datas |
---|
605 | datas = { |
---|
606 | name:$('#iBDName').val(), |
---|
607 | displayType:$('[name=fBDDisplayType]:checked').val(), |
---|
608 | sizeMode:$('[name=fBDSizeMode]:checked').val(), |
---|
609 | width:$('#iBDMapWidthSliderValue').val(), |
---|
610 | height:$('#iBDMapHeightSliderValue').val(), |
---|
611 | zoomLevel:$('#iBDMapZoomLevelSliderValue').val(), |
---|
612 | mapType:$('#iBDMapMapType').val(), |
---|
613 | mapTypeControl:$('#iBDMapMapTypeControlType').val(), |
---|
614 | navigationControl:$('#iBDMapNavigationControlType').val(), |
---|
615 | scaleControl:$('#iBDMapScaleControl').val(), |
---|
616 | style:'', |
---|
617 | } |
---|
618 | |
---|
619 | $.ajax( |
---|
620 | { |
---|
621 | type: "POST", |
---|
622 | url: "{/literal}{$datas.urlRequest}{literal}", |
---|
623 | async: true, |
---|
624 | data: { ajaxfct:"admin.maps.setMap", id:properties.id, datas:datas }, |
---|
625 | success: |
---|
626 | function(msg) |
---|
627 | { |
---|
628 | displayProcessing(false); |
---|
629 | |
---|
630 | if(msg.match(/^[0-9]+$/i)!=null) |
---|
631 | { |
---|
632 | // result Ok ! => close the dialog box and reload the list |
---|
633 | $('#iDialogEdit').dialog("close"); |
---|
634 | loadList(); |
---|
635 | } |
---|
636 | else |
---|
637 | { |
---|
638 | returned=msg.split('!'); |
---|
639 | $('#'+returned[0]).addClass('error'); |
---|
640 | alert(returned[1]); |
---|
641 | } |
---|
642 | } |
---|
643 | } |
---|
644 | ); |
---|
645 | } |
---|
646 | |
---|
647 | /** |
---|
648 | * display or hide the processing flower |
---|
649 | */ |
---|
650 | var displayProcessing = function (visible) |
---|
651 | { |
---|
652 | if(visible) |
---|
653 | { |
---|
654 | $('#iBDProcessing').css("display", "block"); |
---|
655 | } |
---|
656 | else |
---|
657 | { |
---|
658 | $('#iBDProcessing').css("display", "none"); |
---|
659 | } |
---|
660 | } |
---|
661 | |
---|
662 | this.init(); |
---|
663 | } |
---|
664 | |
---|
665 | |
---|
666 | </script> |
---|
667 | {/literal} |
---|
668 | |
---|
669 | |
---|
670 | |
---|
671 | <h2>{'gmaps_maps_management'|@translate}</h2> |
---|
672 | |
---|
673 | |
---|
674 | <div class='addMap'> |
---|
675 | <a onclick="udm.editMap('');">{'gmaps_add_a_new_map'|@translate}</a> |
---|
676 | </div> |
---|
677 | |
---|
678 | |
---|
679 | <table id='iHeaderListMaps' class="littlefont"> |
---|
680 | <tr> |
---|
681 | <th>{'gmaps_name'|@translate}</th> |
---|
682 | <th style="width:150px;">{'gmaps_displayType'|@translate}</th> |
---|
683 | <th style="width:90px;">{'gmaps_dimensions'|@translate}</th> |
---|
684 | <th style="width:90px;">{'gmaps_zoomLevel'|@translate}</th> |
---|
685 | <th style="width:90px;">{'gmaps_mapType'|@translate}</th> |
---|
686 | <th style="width:90px;">{'gmaps_googleMapTypeControl'|@translate}</th> |
---|
687 | <th style="width:90px;">{'gmaps_googleMapNavigationControl'|@translate}</th> |
---|
688 | <th style="width:90px;">{'gmaps_googleMapScaleControl'|@translate}</th> |
---|
689 | <th width="40px"> </th> |
---|
690 | </tr> |
---|
691 | </table> |
---|
692 | |
---|
693 | <div id='iListMaps' class="{$themeconf.name}"> |
---|
694 | </div> |
---|
695 | <div id="iListMapsNb"></div> |
---|
696 | |
---|
697 | |
---|
698 | <div id="iDialogDelete"> |
---|
699 | </div> |
---|
700 | |
---|
701 | |
---|
702 | <div id="iDialogEdit"> |
---|
703 | <div id='iBDProcessing' style="display:none;position:absolute;width:100%;height:100%;background:#000000;opacity:0.75"> |
---|
704 | <img src="plugins/GrumPluginClasses/icons/processing.gif" style="margin-top:100px;"> |
---|
705 | </div> |
---|
706 | |
---|
707 | {$mapTabsheet} |
---|
708 | |
---|
709 | <form> |
---|
710 | <div id='iTabsContainer' style='height:100px;'> |
---|
711 | <div id='iTabGeneral' style='display:none;'> |
---|
712 | <table class='formtable'> |
---|
713 | <tr> |
---|
714 | <td>{'gmaps_name'|@translate}</td> |
---|
715 | <td> |
---|
716 | <input type='text' id='iBDName' maxlength=80 size=60 value=''> |
---|
717 | </td> |
---|
718 | </tr> |
---|
719 | |
---|
720 | <tr> |
---|
721 | <td>{'gmaps_displayType'|@translate}</td> |
---|
722 | <td> |
---|
723 | <label><input type='radio' id='iBDDisplayTypeIC' name='fBDDisplayType' value='IC'> {'gmaps_displayTypeIC'|@translate}</label><br> |
---|
724 | <label><input type='radio' id='iBDDisplayTypeIP' name='fBDDisplayType' value='IP'> {'gmaps_displayTypeIP'|@translate}</label><br> |
---|
725 | <label><input type='radio' id='iBDDisplayTypeMP' name='fBDDisplayType' value='MP'> {'gmaps_displayTypeMP'|@translate}</label> |
---|
726 | </td> |
---|
727 | </tr> |
---|
728 | |
---|
729 | </table> |
---|
730 | </div> |
---|
731 | |
---|
732 | <div id='iTabDimensions' style='display:none;'> |
---|
733 | |
---|
734 | <table class="formtable"> |
---|
735 | <tr> |
---|
736 | <td>{'gmaps_map_dimensions_are'|@translate}</td> |
---|
737 | <td colspan="3"> |
---|
738 | <label><input type="radio" id="iBDSizeModeA" name="fBDSizeMode" value="A"> {'gmaps_interface_dimensions_a'|@translate}</label><br> |
---|
739 | <label><input type="radio" id="iBDSizeModeF" name="fBDSizeMode" value="F"> {'gmaps_interface_dimensions_f'|@translate}</label> |
---|
740 | </td> |
---|
741 | </tr> |
---|
742 | |
---|
743 | <tr id='iBDMapWidthSliderRow'> |
---|
744 | <td> </td> |
---|
745 | <td style='padding-left:30px;'>{'gmaps_width'|@translate}</td> |
---|
746 | <td> |
---|
747 | <input type="hidden" id="iBDMapWidthSliderValue" value=""> |
---|
748 | <div id="iBDMapWidthSlider" class="gcBgInput gcBorderInput"></div> |
---|
749 | </td> |
---|
750 | <td width="70px"> |
---|
751 | <div id="iBDMapWidthSliderDisplay"></div> |
---|
752 | </td> |
---|
753 | </tr> |
---|
754 | <tr id='iBDMapHeightSliderRow'> |
---|
755 | <td> </td> |
---|
756 | <td style='padding-left:30px;'>{'gmaps_height'|@translate}</td> |
---|
757 | <td> |
---|
758 | <input type="hidden" id="iBDMapHeightSliderValue" value=""> |
---|
759 | <div id="iBDMapHeightSlider" class="gcBgInput gcBorderInput"></div> |
---|
760 | </td> |
---|
761 | <td width="70px"> |
---|
762 | <div id="iBDMapHeightSliderDisplay"></div> |
---|
763 | </td> |
---|
764 | </tr> |
---|
765 | </table> |
---|
766 | </div> |
---|
767 | |
---|
768 | <div id='iTabMapType' style='display:none;'> |
---|
769 | <table class='formtable'> |
---|
770 | <tr> |
---|
771 | <td>{'gmaps_mapType'|@translate}</td> |
---|
772 | <td> |
---|
773 | <select id='iBDMapMapType'> |
---|
774 | <option value='hybrid'>{'gmaps_googleMapType_hybrid'|@translate}</option> |
---|
775 | <option value='satellite'>{'gmaps_googleMapType_satellite'|@translate}</option> |
---|
776 | <option value='roadmap'>{'gmaps_googleMapType_roadmap'|@translate}</option> |
---|
777 | <option value='terrain'>{'gmaps_googleMapType_terrain'|@translate}</option> |
---|
778 | </select> |
---|
779 | </td> |
---|
780 | </tr> |
---|
781 | |
---|
782 | <tr> |
---|
783 | <td>{'gmaps_googleMapControlType'|@translate}</td> |
---|
784 | <td> |
---|
785 | <select id='iBDMapMapTypeControlType'> |
---|
786 | <option value='-1'>{'gmaps_googleMapTypeControl_-1'|@translate}</option> |
---|
787 | <option value='0'>{'gmaps_googleMapTypeControl_0'|@translate}</option> |
---|
788 | <option value='1'>{'gmaps_googleMapTypeControl_1'|@translate}</option> |
---|
789 | <option value='2'>{'gmaps_googleMapTypeControl_2'|@translate}</option> |
---|
790 | </select> |
---|
791 | </td> |
---|
792 | </tr> |
---|
793 | |
---|
794 | <!-- |
---|
795 | <tr> |
---|
796 | <td>{'gmaps_googleMapControlPos'|@translate}</td> |
---|
797 | <td> |
---|
798 | <select id='iBDMapTypeControlPos'> |
---|
799 | <option value='2'>{'gmaps_googleMapControlPos_T'|@translate}</option> |
---|
800 | <option value='7'>{'gmaps_googleMapControlPos_B'|@translate}</option> |
---|
801 | <option value='4'>{'gmaps_googleMapControlPos_L'|@translate}</option> |
---|
802 | <option value='5'>{'gmaps_googleMapControlPos_R'|@translate}</option> |
---|
803 | <option value='1'>{'gmaps_googleMapControlPos_TL'|@translate}</option> |
---|
804 | <option value='3'>{'gmaps_googleMapControlPos_TR'|@translate}</option> |
---|
805 | <option value='6'>{'gmaps_googleMapControlPos_BL'|@translate}</option> |
---|
806 | <option value='8'>{'gmaps_googleMapControlPos_BR'|@translate}</option> |
---|
807 | </select> |
---|
808 | </td> |
---|
809 | </tr> |
---|
810 | --> |
---|
811 | |
---|
812 | </table> |
---|
813 | </div> |
---|
814 | |
---|
815 | |
---|
816 | <div id='iTabZoomLevel' style='display:none;'> |
---|
817 | <table class='formtable'> |
---|
818 | <tr id='iBDZoomLevelRow'> |
---|
819 | <td>{'gmaps_zoomLevel'|@translate}</td> |
---|
820 | <td> |
---|
821 | <table class="formclass"> |
---|
822 | <tr> |
---|
823 | <td> |
---|
824 | <input type="hidden" id="iBDMapZoomLevelSliderValue" value=""> |
---|
825 | <div id="iBDMapZoomLevelSlider" class="gcBgInput gcBorderInput"></div> |
---|
826 | </td> |
---|
827 | <td width="70px"> |
---|
828 | <div id="iBDMapZoomLevelSliderDisplay"></div> |
---|
829 | </td> |
---|
830 | </tr> |
---|
831 | </table> |
---|
832 | </td> |
---|
833 | </tr> |
---|
834 | |
---|
835 | <tr> |
---|
836 | <td>{'gmaps_googleMapControlType'|@translate}</td> |
---|
837 | <td> |
---|
838 | <select id='iBDMapNavigationControlType'> |
---|
839 | <option value='-1'>{'gmaps_googleMapNavigationControl_-1'|@translate}</option> |
---|
840 | <option value='0'>{'gmaps_googleMapNavigationControl_0'|@translate}</option> |
---|
841 | <option value='1'>{'gmaps_googleMapNavigationControl_1'|@translate}</option> |
---|
842 | <option value='2'>{'gmaps_googleMapNavigationControl_2'|@translate}</option> |
---|
843 | <option value='3'>{'gmaps_googleMapNavigationControl_3'|@translate}</option> |
---|
844 | </select> |
---|
845 | </td> |
---|
846 | </tr> |
---|
847 | |
---|
848 | <!-- |
---|
849 | <tr> |
---|
850 | <td>{'gmaps_googleMapControlPos'|@translate}</td> |
---|
851 | <td> |
---|
852 | <select id='iBDMapNavigationControlPos'> |
---|
853 | <option value='2'>{'gmaps_googleMapControlPos_T'|@translate}</option> |
---|
854 | <option value='7'>{'gmaps_googleMapControlPos_B'|@translate}</option> |
---|
855 | <option value='4'>{'gmaps_googleMapControlPos_L'|@translate}</option> |
---|
856 | <option value='5'>{'gmaps_googleMapControlPos_R'|@translate}</option> |
---|
857 | <option value='1'>{'gmaps_googleMapControlPos_TL'|@translate}</option> |
---|
858 | <option value='3'>{'gmaps_googleMapControlPos_TR'|@translate}</option> |
---|
859 | <option value='6'>{'gmaps_googleMapControlPos_BL'|@translate}</option> |
---|
860 | <option value='8'>{'gmaps_googleMapControlPos_BR'|@translate}</option> |
---|
861 | </select> |
---|
862 | </td> |
---|
863 | </tr> |
---|
864 | --> |
---|
865 | |
---|
866 | <tr> |
---|
867 | <td>{'gmaps_googleMapScaleControl'|@translate}</td> |
---|
868 | <td> |
---|
869 | <select id='iBDMapScaleControl'> |
---|
870 | <option value='y'>{'gmaps_display_visible'|@translate}</option> |
---|
871 | <option value='n'>{'gmaps_display_hidden'|@translate}</option> |
---|
872 | </select> |
---|
873 | </td> |
---|
874 | </tr> |
---|
875 | |
---|
876 | </table> |
---|
877 | </div> |
---|
878 | </div> |
---|
879 | |
---|
880 | <div id='iBDExampleMap' style='margin-left:auto;margin-right:auto;margin-top:20px;border:1px solid;'></div> |
---|
881 | |
---|
882 | </form> |
---|
883 | </div> |
---|
884 | |
---|
885 | |
---|
886 | {literal} |
---|
887 | <script type="text/javascript"> |
---|
888 | var udm=new userDefManage(); |
---|
889 | </script> |
---|
890 | {/literal} |
---|
891 | |
---|