| 1 |
<?php |
<?php |
| 2 |
// $Id: openlayers.mapclient.inc,v 1.1.2.18 2008/06/30 10:03:03 openwereld Exp $ |
// $Id: openlayers.mapclient.inc,v 1.1.2.19 2008/06/30 13:01:03 openwereld Exp $ |
| 3 |
|
|
| 4 |
/** |
/** |
| 5 |
* Initialize header. |
* Initialize header. |
| 59 |
drupal_add_js(drupal_get_path('module', 'openlayers') .'/custom/PrintContext.Control.js', 'extra', 'header'); |
drupal_add_js(drupal_get_path('module', 'openlayers') .'/custom/PrintContext.Control.js', 'extra', 'header'); |
| 60 |
drupal_add_js(drupal_get_path('module', 'openlayers') .'/custom/FeatureInfo.Control.js', 'extra', 'header'); |
drupal_add_js(drupal_get_path('module', 'openlayers') .'/custom/FeatureInfo.Control.js', 'extra', 'header'); |
| 61 |
drupal_add_js(drupal_get_path('module', 'openlayers') .'/custom/ZoomToExtent.Control.js', 'extra', 'header'); |
drupal_add_js(drupal_get_path('module', 'openlayers') .'/custom/ZoomToExtent.Control.js', 'extra', 'header'); |
| 62 |
|
drupal_add_js(drupal_get_path('module', 'openlayers') .'/custom/LayerSwitcher.Control.js', 'extra', 'header'); |
| 63 |
|
|
| 64 |
// add custom javascript code |
// add custom javascript code |
| 65 |
$js = "\nwindow.\$ = window.jQuery;\n"; // prevent OpenLayers from overwriting $ |
$js = "\nwindow.\$ = window.jQuery;\n"; // prevent OpenLayers from overwriting $ |
| 536 |
$js .= "layer_options.opacity = 1.0;\n"; |
$js .= "layer_options.opacity = 1.0;\n"; |
| 537 |
$js .= "layer_options.displayInLegend = true;\n"; |
$js .= "layer_options.displayInLegend = true;\n"; |
| 538 |
if (isset($layer[4])) { |
if (isset($layer[4])) { |
| 539 |
$keylen = strpos($layer[4], '='); |
$extras = explode(',', $layer[4]); |
| 540 |
$key = substr($layer[4], 0, $keylen); |
foreach ($extras as $extra) { |
| 541 |
$value = substr($layer[4], $keylen + 1); |
$keylen = strpos($extra, '='); |
| 542 |
if ($key == 'legendurl') { |
$key = substr($extra, 0, $keylen); |
| 543 |
$js .= "layer_options.legend = {};\n"; |
$value = substr($extra, $keylen + 1); |
| 544 |
$js .= "layer_options.legend.href = '{$value}';\n"; |
if ($key == 'legendurl') { |
| 545 |
|
$js .= "layer_options.legend = {};\n"; |
| 546 |
|
$js .= "layer_options.legend.href = '{$value}';\n"; |
| 547 |
|
} |
| 548 |
|
else if ($key == 'visibility') { |
| 549 |
|
$js .= "layer_options.visibility = $value;\n"; |
| 550 |
|
} |
| 551 |
} |
} |
| 552 |
} |
} |
| 553 |
|
|
| 576 |
// (5) controls |
// (5) controls |
| 577 |
$controls = explode(',', (isset($map['controls']) ? $map['controls'] : '')); |
$controls = explode(',', (isset($map['controls']) ? $map['controls'] : '')); |
| 578 |
// add layer switcher |
// add layer switcher |
| 579 |
$js .= "map.addControl(new OpenLayers.Control.LayerSwitcher({title: Drupal.t('Layer switcher'), 'outsideViewport': true}));\n"; |
$js .= "map.addControl(new MappingKit.Control.LayerSwitcher({title: Drupal.t('Layer switcher')}));\n"; |
| 580 |
// scale line |
// scale line |
| 581 |
$js .= "map.addControl(new OpenLayers.Control.ScaleLine());\n"; |
$js .= "map.addControl(new OpenLayers.Control.ScaleLine());\n"; |
| 582 |
|
|