/[drupal]/contributions/modules/exif2gmap/exif2gmap.module
ViewVC logotype

Diff of /contributions/modules/exif2gmap/exif2gmap.module

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph | View Patch Patch

revision 1.1.2.4, Tue Apr 21 16:24:32 2009 UTC revision 1.1.2.5, Sat May 23 03:52:52 2009 UTC
# Line 50  function exif2gmap_admin_settings() { Line 50  function exif2gmap_admin_settings() {
50      '#return_value' => 1,      '#return_value' => 1,
51      '#default_value' => variable_get('exif2gmap_exif_show', 0),      '#default_value' => variable_get('exif2gmap_exif_show', 0),
52    );    );
53      $form['exif2gmap']['exif2gmap_imgsrc_target'] = array(
54        '#type' => 'checkbox',
55        '#title' => t('Parse jpeg file located in <img src> tag.'),
56                    '#description'=> t('If the check is on, the module parse the jpeg which locate in <img src>, instead of jpeg which locate in <a href> tag.'),
57        '#return_value' => 1,
58        '#default_value' => variable_get('exif2gmap_imgsrc_target', 0),
59      );
60    $form['exif2gmap']['exif2gmap_MapKey'] = array(    $form['exif2gmap']['exif2gmap_MapKey'] = array(
61      '#type' => 'textfield',      '#type' => 'textfield',
62      '#title' => t('Google Map API Key'),      '#title' => t('Google Map API Key'),
# Line 80  function exif2gmap_admin_settings() { Line 87  function exif2gmap_admin_settings() {
87      '#attributes' => NULL,      '#attributes' => NULL,
88      '#required' => TRUE,      '#required' => TRUE,
89    );    );
90      $form['exif2gmap']['map_controls'] = array(
91        '#value' => '<b>' . t('Map Controls:') . '</b>',
92      );
93      $form['exif2gmap']['exif2gmap_show_pan_zoom'] = array(
94        '#type' => 'checkbox',
95        '#title' => t('Show a pan/zoom control'),
96        '#return_value' => 1,
97        '#default_value' => variable_get('exif2gmap_show_pan_zoom', 1),
98      );
99      $form['exif2gmap']['exif2gmap_show_map_type'] = array(
100        '#type' => 'checkbox',
101        '#title' => t('Show buttons that let the user toggle between map types (street map, satellite map, and hybrid map)'),
102        '#return_value' => 1,
103        '#default_value' => variable_get('exif2gmap_show_map_type', 0),
104      );
105      $form['exif2gmap']['exif2gmap_show_scale_bar'] = array(
106        '#type' => 'checkbox',
107        '#title' => t('Show a scale bar'),
108        '#return_value' => 1,
109        '#default_value' => variable_get('exif2gmap_show_scale_bar', 0),
110      );
111      $form['exif2gmap']['exif2gmap_show_overview_map'] = array(
112        '#type' => 'checkbox',
113        '#title' => t('Show a collapsible overview map in the bottom right corner of the main map'),
114        '#return_value' => 1,
115        '#default_value' => variable_get('exif2gmap_show_overview_map', 0),
116      );
117    
118    return system_settings_form($form);    return system_settings_form($form);
119  }  }
# Line 252  function exif2gmap_process($text, $forma Line 286  function exif2gmap_process($text, $forma
286    $mapkey=variable_get('exif2gmap_MapKey','');    $mapkey=variable_get('exif2gmap_MapKey','');
287    $width=variable_get('exif2gmap_GMwidth', '');    $width=variable_get('exif2gmap_GMwidth', '');
288    $height=variable_get('exif2gmap_GMheight', '');    $height=variable_get('exif2gmap_GMheight', '');
289    
290    
291    $url = trim(url('<front>', array('absolute' => TRUE)),"/");    $url = trim(url('<front>', array('absolute' => TRUE)),"/");
292          $res=array();          $res=array();
293    
294            if(variable_get('exif2gmap_imgsrc_target','')){
295                    preg_match_all('/<img[^>]*src=["\']([^"\']*)["\'][^>]*>/', $text, $res,PREG_SET_ORDER);
296                    $cnt=count($res);
297            }else{
298                    preg_match_all('/<a[^>]*href=["\']([^"\']*)["\'][^>]*>(.*?)<\/a>/', $text, $res,PREG_SET_ORDER);
299                    $cnt=count($res);
300            }
301    
         preg_match_all('/<a[^>]*href=["\']([^"\']*)["\'][^>]*>(.*?)<\/a>/', $text, $res,PREG_SET_ORDER);  
         $cnt=count($res);  
302          if(variable_get('exif2gmap_debug','')){          if(variable_get('exif2gmap_debug','')){
303                  drupal_set_message($url);                  drupal_set_message($url);
304                  drupal_set_message($text);                  drupal_set_message($text);
# Line 286  function exif2gmap_process($text, $forma Line 327  function exif2gmap_process($text, $forma
327                                  //check basepath.                                  //check basepath.
328                                  $head=strtolower(substr($res[$i][1],0,4));                                  $head=strtolower(substr($res[$i][1],0,4));
329                                  if(variable_get('exif2gmap_debug','')){                                  if(variable_get('exif2gmap_debug','')){
330                                            drupal_set_message($res[$i][1]);
331                                          drupal_set_message($head);                                          drupal_set_message($head);
332                                  }                                  }
333                                  if(strcmp($head,"http")!=0){                                  if(strcmp($head,"http")!=0){
# Line 293  function exif2gmap_process($text, $forma Line 335  function exif2gmap_process($text, $forma
335                                  }else{                                  }else{
336                                          $fname=$res[$i][1];                                          $fname=$res[$i][1];
337                                  }                                  }
338                                    $gps=get_gpsdata($fname);
339                          $gps=get_gpsdata($fname);                                  $camera=get_cameradata($fname);
                         $camera=get_cameradata($fname);  
340                                  if($gps!=NULL){                                  if($gps!=NULL){
341                                          $j++;                                          $j++;
342                                          $ans[$j]=array();                                          $ans[$j]=array();
# Line 305  function exif2gmap_process($text, $forma Line 346  function exif2gmap_process($text, $forma
346                                          $ans[$j]['tag']=$res[$i][0];                                          $ans[$j]['tag']=$res[$i][0];
347    
348                                          //Add exif data parse                                          //Add exif data parse
349                                          if(isset($camera['Model'])){                                          if(isset($camera['Model'])){
350                                                  $ans[$j]['Model']=$camera['Model'];                                                  $ans[$j]['Model']=$camera['Model'];
351                                          }else{                                          }else{
352                                                  $ans[$j]['Model']=NULL;                                                  $ans[$j]['Model']=NULL;
353                                          }                                          }
354                                          if(isset($camera['Lens'])){                                          if(isset($camera['Lens'])){
355                                                  $ans[$j]['Lens']=$camera['Lens'];                                                  $ans[$j]['Lens']=$camera['Lens'];
356                                          }else{                                          }else{
357                                                  $ans[$j]['Lens']=NULL;                                                  $ans[$j]['Lens']=NULL;
358                                          }                                          }
359                                  }                                  }
360                          }                          }
361                  }                  }
# Line 371  function exif2gmap_process($text, $forma Line 412  function exif2gmap_process($text, $forma
412    
413    $script_body .= 'map'.$map_counter.'.setCenter(new GLatLng(' .$Clat. ',' .$Clon. '), 7);    $script_body .= 'map'.$map_counter.'.setCenter(new GLatLng(' .$Clat. ',' .$Clon. '), 7);
414          ';          ';
415    $script_body .= 'map'.$map_counter.'.addControl(new GLargeMapControl());    if(variable_get('exif2gmap_show_pan_zoom','')){
416        $script_body .= 'map'.$map_counter.'.addControl(new GLargeMapControl());
417          ';          ';
418      }
419      if(variable_get('exif2gmap_show_map_type','')){
420        $script_body .= 'map'.$map_counter.'.addControl(new GMapTypeControl());
421            ';
422      }
423      if(variable_get('exif2gmap_show_scale_bar','')){
424        $script_body .= 'map'.$map_counter.'.addControl(new GScaleControl());
425            ';
426      }
427      if(variable_get('exif2gmap_show_overview_map','')){
428        $script_body .= 'map'.$map_counter.'.addControl(new GOverviewMapControl());
429            ';
430      }
431          $script_body .= 'var rectObj = new GLatLngBounds(new GLatLng('.$SWlat.','.$SWlon.'), new GLatLng('.$NElat.','.$NElon.'));';          $script_body .= 'var rectObj = new GLatLngBounds(new GLatLng('.$SWlat.','.$SWlon.'), new GLatLng('.$NElat.','.$NElon.'));';
432          $script_body .= 'var zm = map'.$map_counter.'.getBoundsZoomLevel(rectObj); map'.$map_counter.'.setZoom(zm-1)';          $script_body .= 'var zm = map'.$map_counter.'.getBoundsZoomLevel(rectObj); map'.$map_counter.'.setZoom(zm-1)';
433    
# Line 392  function exif2gmap_process($text, $forma Line 446  function exif2gmap_process($text, $forma
446    
447          $script=$script_head.$script_body.$script_tail;          $script=$script_head.$script_body.$script_tail;
448    //inline coding..    //inline coding..
449          drupal_set_html_head('<script type="text/javascript" src="http://maps.google.com/maps?file=api&amp;v=2&amp;key='.$mapkey.'"></script>');          //drupal_set_html_head('<script type="text/javascript" src="http://maps.google.com/maps?file=api&amp;v=2&amp;key='.$mapkey.'"></script>');
450          drupal_add_js($script,'inline');          //drupal_add_js($script,'inline');
451            $text .='<script type="text/javascript" src="http://maps.google.com/maps?file=api&amp;v=2&amp;key='. $mapkey.'"></script>';
452            $text .='<script type="text/javascript">' . $script . '</script>';
453    
454    
455          //add div portion.          //add div portion.
456          $text .= '<br><div id="map'.$digest.'" style="width: '.$width.'; height: '.$height.'"></div>';          $text .= '<br><div id="map'.$digest.'" style="width: '.$width.'; height: '.$height.'"></div>';

Legend:
Removed from v.1.1.2.4  
changed lines
  Added in v.1.1.2.5

  ViewVC Help
Powered by ViewVC 1.1.2