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