From cfb26c5af37da595a7a81f90065fde9537dbc6b1 Mon Sep 17 00:00:00 2001 From: Silvio Date: Thu, 17 May 2012 17:19:37 -0300 Subject: Syncing with svn --- .gitignore | 2 +- gmap_arcgis.js | 22 +--- gmap_arcgis.module | 335 ++++++----------------------------------------------- 3 files changed, 36 insertions(+), 323 deletions(-) diff --git a/.gitignore b/.gitignore index 18069b0..030edbe 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,2 @@ -.svn +*svn *swp diff --git a/gmap_arcgis.js b/gmap_arcgis.js index 9960f94..af85eaf 100644 --- a/gmap_arcgis.js +++ b/gmap_arcgis.js @@ -35,8 +35,6 @@ function gmap_arcgis() { id = Drupal.settings.gmap_arcgis.id; } } - - // Get an existing GMap instance using Drupal GMap Module API // and add an ArcGIS extension to it @@ -70,16 +68,14 @@ function gmap_arcgis() { icon.infoAnchor = new GPoint(info[4][0], info[4][1]); icon.infoWindowAnchor = new GPoint(info[5][0], info[5][1]); } + GEvent.addListener(map, "moveend", function() { showLabels(label[0], fields, content, icon); }); showLabels(label[0], fields, content, icon); } for (j = 0; j < polygons.length; j++) { - showPolygons(polygons[j]); } - - }, 5); //setTimeout($.unblockUI, 10000); @@ -112,7 +108,6 @@ function showLabelsCallback(fields, content, icon) { // Label title var title = '{' + fields[1] + '}'; - // JS literal class esri.arcgis.gmaps.MarkerOptions var myMarkerOptions = { title:title, icon:icon }; @@ -129,14 +124,12 @@ function showLabelsCallback(fields, content, icon) { // Add polygons from a given ArcGIS MapServer Layer function showPolygons(uri) { pol = new esri.arcgis.gmaps.DynamicMapServiceLayer(uri, null, 0.55); - GEvent.addListener(pol,"load",function(g){ map.addOverlay(g);setTimeout($.unblockUI, 6000);}); - } // Callback for showPolygons function showPolygonsCallback(mapservicelayer, error) { - map.addOverlay(mapservicelayer); + map.addOverlay(mapservicelayer); } // Add custom marker @@ -149,7 +142,6 @@ function createMarker(point, name, html, icone) { icon.iconAnchor = new GPoint(6, 20); icon.infoWindowAnchor = new GPoint(5, 1); - var marker = new GMarker(point); GEvent.addListener(marker, "click", function() { marker.openInfoWindowHtml(html); }); return marker; @@ -167,15 +159,5 @@ $(document).ready(function() { $('#nav').hide(); //get(Drupal.gmap.getMap('auto1map').vars.behavior); - }); - - //$('auto1map').append('
oi oi oi
'); - -}); - -$(document).ready(function() { - $("#uc-form").show(); - }); - diff --git a/gmap_arcgis.module b/gmap_arcgis.module index 9a71980..76b667e 100644 --- a/gmap_arcgis.module +++ b/gmap_arcgis.module @@ -16,14 +16,11 @@ function gmap_arcgis_perm() { return array('access gmap_arcgis content'); } - /** * Implementation of hook_gmap(). */ function gmap_arcgis_gmap($op, &$map) { if ($op == 'pre_theme_map') { - - /** * Use $map to change and add custom overlays into * a given map instance. @@ -56,7 +53,6 @@ function gmap_arcgis_gmap($op, &$map) { // Setup Map Id drupal_add_js(array('gmap_arcgis' => array('id' => $map['id'])), 'setting'); - /** * Setup polygons and labels. Labels have the following format: * @@ -91,10 +87,9 @@ function gmap_arcgis_gmap($op, &$map) { /** * The code below provides titles on markers */ - // if(is_array($map['markers'])) { - // array_walk($map['markers'], 'add_title_on_marker'); - // } - + //if(is_array($map['markers'])) { + // array_walk($map['markers'], 'add_title_on_marker'); + //} if (isset($map['arcgis']['polygons'])) { drupal_add_js(array('gmap_arcgis' => array('polygons' => $map['arcgis']['polygons'])), 'setting'); @@ -125,42 +120,37 @@ function gmap_arcgis_gmap($op, &$map) { $results = $my_content_view->result; - foreach($results AS $r) { - //Format the Body of the ballon - $inicio = format_date($r->event_unix_event_start); - $fim = format_date($r->event_unix_event_end); - $body = '
'; - $body .= "

$r->node_title

"; - $body .= " -

- $r->node_revisions_body -

- - "; - $body .= '
'; - - - - - $data['latitude'] = $r->location_latitude; - $data['longitude'] = $r->location_longitude; - $data['title'] = $r->node_title; - $data['offset'] = 0; - $data['nid'] = $r->nid; - $data['body'] = $body; - $data['category'] = 'marker_uc'; - - __addMarker(&$map, $data); + // Format the Body of the ballon + $inicio = format_date($r->event_unix_event_start); + $fim = format_date($r->event_unix_event_end); + $body = '
'; + $body .= "

$r->node_title

"; + $body .= " +

+ $r->node_revisions_body +

+ + "; + $body .= '
'; + + $data['latitude'] = $r->location_latitude; + $data['longitude'] = $r->location_longitude; + $data['title'] = $r->node_title; + $data['offset'] = 0; + $data['nid'] = $r->nid; + $data['body'] = $body; + $data['category'] = 'marker_uc'; + + __addMarker(&$map, $data); } */ - // Add custom js $gmap_arcgis_path = drupal_get_path('module', 'gmap_arcgis') . '/'; drupal_add_js($gmap_arcgis_path . 'gmap_arcgis.js'); @@ -171,8 +161,7 @@ function gmap_arcgis_gmap($op, &$map) { jquery_ui_add('ui.slider'); $path_ui_css = drupal_get_path('module', 'jquery_ui'); - //drupal_add_css($path_ui_css . '/jquery.ui/themes/default/ui.all.css'); - + drupal_add_css($path_ui_css . '/jquery.ui/themes/default/ui.all.css'); drupal_add_js('showOverlay();', 'inline', 'footer'); } } @@ -183,12 +172,10 @@ function gmap_arcgis_gmap($op, &$map) { * @param array $marker */ function add_title_on_marker(&$marker) { - if (!empty($marker['text'])) { $dom = new DOMDocument(); $dom->loadHTML($marker['text']); //$dom->preserveWhiteSpace = false; - // print_r($marker['text']); $divs = $dom->getElementsByTagName('div'); if ($divs) { @@ -225,271 +212,17 @@ function __addMarker(&$map, $data) { ); } -/** - * Implementation of hook_form() - */ -function uc_form($form_state) { - - $text = t('Choose a protected area on the list below'); - - $view = views_get_view('mapa'); - - //$view->execute('default'); - - $view->execute_display('default'); - //firep($view->result, 'lsita de uc'); - - $i = 0; - $opcoes[-1] = $text; - - foreach ($view->result AS $res) { - - $opcoes[$i] = $res->node_title . ' (' . $res->node_data_field_categoria_field_categoria_value . ')'; - $i++; - } - - asort($opcoes); - - $form['div_tag'] = array( - '#type' => 'markup', - '#value' => '
', - '#weight' => -5, - ); // - - $form['markers'] = array( - '#type' => 'checkbox', - '#prefix' => '
', - '#title' => t('Conservational Units markers'), - '#suffix' => '
', - '#default_value' => 1, - '#weight' => -4, - ); - - /* $form['ucs'] = array( - '#type' => 'checkbox', - '#title' => t('Conservational Units limits'), - '#default_value' => 1, - '#weight' => -3, - ); */ -//['.t('hide markers').'] - $form['tis'] = array( - '#type' => 'checkbox', - '#title' => t('Indigenous Lands'), - '#weight' => -2, - ); - $form['focos'] = array( - '#type' => 'checkbox', - '#title' => t('Heat sources'), - '#weight' => -1, - ); - - $form['energia'] = array( - '#type' => 'checkbox', - '#title' => t('Energy'), - '#weight' => 0, - ); - - $form['cavernas'] = array( - '#type' => 'checkbox', - '#title' => t('Caves'), - '#weight' => 1, - ); - - $form['mineracao'] = array( - '#type' => 'checkbox', - '#title' => t('Mining'), - '#weight' => 2, - ); - - $form['biomas'] = array( - '#type' => 'checkbox', - '#title' => t('Biomes'), - '#weight' => 3, - ); - - $form['fitofisionomia'] = array( - '#type' => 'checkbox', - '#title' => t('Vegetation'), - '#weight' => 4, - ); - $form['baciashidrograficas'] = array( - '#type' => 'checkbox', - '#title' => t('Watersheds'), - '#weight' => 5, - ); - - $form['ramsar'] = array( - '#type' => 'checkbox', - '#title' => t('Ramsar Sites'), - '#weight' => 6, - ); - - - $form['lista_uc'] = array( - '#type' => 'select', - '#title' => $text, - '#default_value' => array(-1, $text), - '#options' => $opcoes, - '#weight' => 7, - '#attributes' => array('class' => 'selectmenu'), - ); - - - $form['div_tag2'] = array( - '#type' => 'markup', - '#value' => '

' . t('Subtitles') . '

- - -

' . t('Ramsar Sites') . '

-
'.gmap_arcgis_link_nota_tecnica(), - '#weight' => 8, - ); - - return $form; -} - /** * Implementation of hook_block() */ function gmap_arcgis_block($op='list', $delta=0, $edit=array()) { - global $map; switch ($op) { case 'list': - $blocks[0]['info'] = t('Protected areas list'); return $blocks; case 'view': - - drupal_add_js('$(window).load(function() { - $("#slider").slider( - { - value:1, - min: -1, - max: 10, - step: 1, - start: function(event,ui) { - - //$.blockUI({ message: "

Just a moment...

" }); - }, - animate: true, - change: function(event, ui) { - - Desmatamento(ui.value) - }, - slide: function(event,ui) { - - //$("#yy").html(ui.value); - } - }); - }); - ', - 'inline', 'header'); - - drupal_add_js('$("#clickmapa").click(function() { - var options = {}; - $("#uc-form").toggle("fold",options,500); - if($("#abrefecha").hasClass("close_gmap_arcgis")) { - $("#abrefecha").switchClass("open_gmap_arcgis","close_gmap_arcgis"); - } else { - $("#abrefecha").switchClass("close_gmap_arcgis","open_gmap_arcgis"); - - } - return false; - }); -', 'inline', 'footer'); $blocks['subject'] = t('Protected areas list'); $blocks['content'] = drupal_get_form('uc_form') . '
X
'; @@ -504,10 +237,8 @@ function gmap_arcgis_block($op='list', $delta=0, $edit=array()) { function gmap_arcgis_link_nota_tecnica() { - // global $base_url; - //$str = http://uc.socioambiental.org/quem-somos# - - return l(t('More information about the map'),'quem-somos',array('fragment' => 'middle-tab-5', 'external' => TRUE)); + // global $base_url; + //$str = http://uc.socioambiental.org/quem-somos# + return l(t('Sources'), 'quem-somos', array('fragment' => 'tabset-tab-3', 'external' => TRUE)); } - -- cgit v1.2.3