Changeset 13092


Ignore:
Timestamp:
Feb 11, 2012, 6:38:34 AM (8 years ago)
Author:
rvelices
Message:

rv_gmaps compatible with core version 2.4

Location:
extensions/rv_gmaps/trunk
Files:
14 edited

Legend:

Unmodified
Added
Removed
  • extensions/rv_gmaps/trunk/admin/admin_edit.php

    r9069 r13092  
    116116{
    117117  $query='
    118 SELECT id,tn_ext,name,path,file,lat,lon FROM '.IMAGES_TABLE.'
     118SELECT id,representative_ext,name,path,file,lat,lon FROM '.IMAGES_TABLE.'
    119119  WHERE id IN ('.implode(',',$page['cat_elements_id']).')
    120120  '.$conf['order_by'].'
     
    130130        $tpl_var = array_merge( $image,
    131131      array(
    132         'U_TN' => get_thumbnail_url($image),
    133         'TITLE' => get_thumbnail_title($image)
     132        'U_TN' => DerivativeImage::thumb_url($image),
     133        'TITLE' => render_element_name($image)
    134134      )
    135135    );
  • extensions/rv_gmaps/trunk/admin/admin_sync.php

    r12701 r13092  
    55  $sync_options = array(
    66    'simulate' => isset($_POST['simulate']),
    7                 'use_high' => isset($_POST['use_high']),
    87    'cat_id' => isset($_POST['cat_id']) ? (int)$_POST['cat_id'] : 0,
    98    'subcats_included' => isset($_POST['subcats_included']),
     
    1211  $sync_options = array(
    1312    'simulate' => true,
    14                 'use_high' => true,
    1513    'cat_id' => 0,
    1614    'subcats_included' => true,
     
    3533
    3634    $query='
    37 SELECT id,path,lat,lon,has_high
     35SELECT id,path,lat,lon
    3836  FROM '.IMAGES_TABLE.' INNER JOIN '.IMAGE_CATEGORY_TABLE.' ON id=image_id
    3937  WHERE category_id IN ('.implode(',', $cat_ids).')
     
    4341  {
    4442    $query='
    45 SELECT id,path,lat,lon,has_high
     43SELECT id,path,lat,lon
    4644  FROM '.IMAGES_TABLE;
    4745  }
     
    5351  {
    5452                $filename = $image['path'];
    55                 if ($sync_options['use_high'] and $image['has_high']=='true')
    56                         $filename = get_high_path($image);
    5753                $exif = @read_exif_data( $filename );
    5854                if ( empty($exif) )
     
    110106    array(
    111107      'SUBCATS_INCLUDED_CHECKED' => $sync_options['subcats_included'] ? 'checked="checked"' : '',
    112                         'USE_HIGH_CHECKED' => $sync_options['use_high'] ? 'checked="checked"' : ''
    113108    )
    114109  );
  • extensions/rv_gmaps/trunk/admin/admin_sync.tpl

    r8724 r13092  
    2727    <ul>
    2828      <li><label><input type="checkbox" name="simulate" value="1" checked="checked" /> {'only perform a simulation (no change in database will be made)'|@translate}</label></li>
    29                         <li><label><input type="checkbox" name="use_high" value="1" {$USE_HIGH_CHECKED} /> use high resolution images if available</label></li>
    3029    </ul>
    3130  </fieldset>
  • extensions/rv_gmaps/trunk/changelog.txt

    r12719 r13092  
     12.4.a
     2-compatible with piwigo 2.4
     3
    142.3.b
    25- search for places / location uses now google auto complete
  • extensions/rv_gmaps/trunk/include/functions.php

    r12700 r13092  
    44{
    55        global $conf;
    6         $dir = $conf['local_data_dir'];
    7         return $dir.'/tmp/_rvgm_cat_cache.dat';
     6        return PHPWG_ROOT_PATH.$conf['data_location'].'/tmp/_rvgm_cat_cache.dat';
    87}
    98
  • extensions/rv_gmaps/trunk/include/functions_map.php

    r8776 r13092  
    1010  global $page, $conf;
    1111  unset( $page['__rvm_config__'] );
    12   return $conf['local_data_dir'].'/plugins/'.basename(dirname(dirname(__FILE__))).'.dat';
     12  return PHPWG_ROOT_PATH.$conf['data_location'].'/plugins/'.basename(dirname(dirname(__FILE__))).'.dat';
    1313}
    1414
  • extensions/rv_gmaps/trunk/include/picture_map.inc.php

    r8304 r13092  
    99  array(
    1010    'RVM_PLUGIN_VERSION' => RVM_PLUGIN_VERSION,
    11     'GMAPS_API_KEY' => $conf['gmaps_api_key'],
    1211    'PLUGIN_ROOT_URL' => get_absolute_root_url().'plugins/'.$rvm_dir,
    1312                'PLUGIN_LOCATION' => 'plugins/'.$rvm_dir,
     
    3534  $template->assign(
    3635    array(
    37       'TN_SRC' => $picture['thumbnail'],
    3836      'U_NO_MAP' => duplicate_picture_url(),
    3937      'U_BLOWUP' => rvm_make_blowup_url( array('ll'=>$picture), array('start','box') ),
  • extensions/rv_gmaps/trunk/kml.php

    r8666 r13092  
    4444
    4545
    46 $img_fields = ' i.id,i.tn_ext,i.name,i.comment,i.file,i.path,i.lat,i.lon,i.date_creation';
     46$img_fields = ' i.id,i.representative_ext,i.name,i.comment,i.file,i.path,i.lat,i.lon,i.date_creation';
    4747
    4848rvm_build_section_items($img_fields, $where_sql, RVM_BUILD_ARRAY, $order_by);
     
    9292  {
    9393    $query = '
    94 SELECT id, path, tn_ext
     94SELECT id, path, representative_ext
    9595  FROM '.IMAGES_TABLE.'
    9696  WHERE id IN ('.implode(',', $thumbnail_ids).')';
    9797    $result = pwg_query($query);
    9898    while ($row = mysql_fetch_assoc($result))
    99       $thumbnail_src_of[$row['id']] = get_thumbnail_url($row);
     99      $thumbnail_src_of[$row['id']] = DerivativeImage::thumb_url($row);
    100100    unset($thumbnail_ids);
    101101  }
     
    149149        $page_url = duplicate_picture_url(array('image_id' => $img['id'],'image_file' => $img['file']),  array('start') );
    150150
    151         if (!empty( $img['name'] ) )
    152                 $title = $img['name'];
    153         else
    154                 $title = str_replace('_', ' ', get_filename_wo_extension($img['file']));
    155 
    156151  $tpl_var = array(
    157152      'U_PAGE'=> $page_url,
    158153      'TN_SRC'  => get_thumbnail_url($img),
    159       'TITLE'  => $title,
    160       'DESCRIPTION'  => trigger_event('render_element_description', $img['comment']),
     154      'TITLE'  => render_element_name($img),
     155      'DESCRIPTION'  => render_element_description($img),
    161156      'LAT'   => $img['lat'],
    162157      'LON'   => $img['lon'],
  • extensions/rv_gmaps/trunk/main.inc.php

    r12706 r13092  
    11<?php /*
    22Plugin Name: RV Maps&Earth
    3 Version: 2.3.b
     3Version: 2.4.a
    44Description: Extend your gallery with Google Maps and Google Earth ...
    55Plugin URI: http://piwigo.org/ext/extension_view.php?eid=122
     
    77Author URI: http://www.modusoptimus.com/
    88*/
    9 define( 'RVM_PLUGIN_VERSION', '2.3.b');
     9define( 'RVM_PLUGIN_VERSION', '2.4.a');
    1010defined('PHPWG_ROOT_PATH') or die('Hacking attempt!');
    1111
  • extensions/rv_gmaps/trunk/maintain.inc.php

    r12701 r13092  
    3939        {
    4040          global $conf;
    41                 $dest = $conf['local_data_dir'].'/plugins/'.basename(dirname(__FILE__)).'.dat';
     41                $dest = PHPWG_ROOT_PATH.$conf['data_location'].'/plugins/'.basename(dirname(__FILE__)).'.dat';
    4242          if (!file_exists($dest) )
    4343          {
     
    7070 
    7171  global $conf;
    72         $dest = $conf['local_data_dir'].'/plugins/'.basename(dirname(__FILE__)).'.dat';
     72        $dest = PHPWG_ROOT_PATH.$conf['data_location'].'/plugins/'.basename(dirname(__FILE__)).'.dat';
    7373  @unlink( $dest );
    7474}
  • extensions/rv_gmaps/trunk/map_data.php

    r12719 r13092  
    3131$where_sql = rvm_bounds_to_sql( $page['box'] );
    3232
    33 $img_fields = ' i.id,i.tn_ext,i.name,i.comment,i.path,i.lat,i.lon';
     33$img_fields = ' i.id,i.representative_ext,i.name,i.comment,i.path,i.lat,i.lon';
    3434
    3535$was_flat = @$page['flat'];
     
    4242header('Pragma:');*/
    4343header('Content-Type: text/plain; charset='.get_pwg_charset());
     44header('X-Robots-Tag: noindex');
    4445
    4546if ( extension_loaded('zlib') && !ini_get('zlib.output_compression') )
  • extensions/rv_gmaps/trunk/mapl.php

    r8666 r13092  
    4949  $where_sql = rvm_bounds_to_sql( $page['box'] );
    5050
    51 $img_fields = ' i.id,i.tn_ext,i.name,i.path,i.lat,i.lon';
     51$img_fields = ' i.id';
    5252
    5353$was_flat = @$page['flat'];
    5454$page['flat']=true;
    5555rvm_build_section_items($img_fields, $where_sql, RVM_BUILD_HASH, $order_by);
     56$page['items']=array_keys($page['items']);
    5657if (!$was_flat) unset($page['flat']);
    5758
     
    6162{
    6263/* GENERATE THE CATEGORY LIST *************************************************/
    63 $where_sql = 'i.id IN ('.implode(',', array_keys($page['items']) ).')';
     64$where_sql = 'i.id IN ('.implode(',', $page['items'] ).')';
    6465$where_sql .= get_sql_condition_FandF(
    6566        array( 'forbidden_categories' => 'category_id' ),
     
    9596
    9697/* GENERATE THE TAG LIST ******************************************************/
    97 $tags = get_common_tags( array_keys($page['items']), $conf['content_tag_cloud_items_number'], null);
     98$tags = get_common_tags( $page['items'], $conf['content_tag_cloud_items_number'], null);
    9899$tags = add_level_to_tags($tags);
    99100function counter_compare($a, $b)
     
    145146  );
    146147
    147 foreach ($page['items'] as $img)
    148 {
    149   $img['file'] = basename( $img['path'] );
    150   $thumbnail_url = get_thumbnail_url($img);
     148$pictures = array();
     149if (count($page['items']) > 0)
     150{
     151  $rank_of = array_flip($page['items']);
     152
     153  $query = '
     154SELECT *
     155  FROM '.IMAGES_TABLE.'
     156  WHERE id IN ('.implode(',', $page['items']).')
     157;';
     158  $result = pwg_query($query);
     159  while ($row = pwg_db_fetch_assoc($result))
     160  {
     161    $row['rank'] = $rank_of[ $row['id'] ];
     162    $pictures[] = $row;
     163  }
     164  usort($pictures, 'rank_compare');
     165  unset($rank_of);
     166}
     167
     168foreach ($pictures as $img)
     169{
    151170  $page_url = duplicate_picture_url(
    152171        array(
     
    157176        array('start')
    158177      );
    159   if (!empty( $img['name'] ) )
    160     $title = $img['name'];
    161   else
    162     $title = str_replace('_', ' ', get_filename_wo_extension($img['file']));
    163 
    164   $template->append(
    165     'thumbnails',
    166     array(
    167       'TN_SRC'       => $thumbnail_url,
    168       'URL'  => $page_url,
    169       'TN_ALT'   => $img['file'],
    170       'TN_TITLE'   => $title,
    171       )
    172     );
    173 }
     178  $name = render_element_name($img);
     179  $desc = render_element_description($img);
     180
     181  $tpl_thumbnails_var[] = array_merge( $img, array(
     182                'NAME' => $name,
     183    'TN_ALT' => htmlspecialchars(strip_tags($name)),
     184    'TN_TITLE' => get_thumbnail_title($img, $name, $desc),
     185    'URL' => $page_url,
     186    'DESCRIPTION' => $desc,
     187    'src_image' => new SrcImage($img),
     188    ) );
     189}
     190$template->assign( array(
     191  'derivative_params' => ImageStdParams::get_by_type(IMG_THUMB),
     192  'SHOW_THUMBNAIL_CAPTION' => false,
     193        'thumbnails' => $tpl_thumbnails_var,
     194    ) );
     195$template->set_filename('index_thumbnails', 'thumbnails.tpl');
     196$template->assign_var_from_handle('THUMBNAILS', 'index_thumbnails');
    174197
    175198$title = $page['title'];
  • extensions/rv_gmaps/trunk/template/mapl.tpl

    r8636 r13092  
    1 {html_head}
    2 <style type="text/css">
     1{html_style}
    32.fullTagCloud {ldelim}
    43        text-align: justify;
     
    98        display: inline;white-space: nowrap;
    109}
    11 </style>
    12 {/html_head}
     10{/html_style}
    1311
    1412<div id="content" class="content" style="margin: 0;">
     
    5048{/if}
    5149
    52 {if !empty($navbar) }{include file='navigation_bar.tpl'}{/if}
     50{if !empty($navbar)}{include file='navigation_bar.tpl' assign='NAVBAR'}{$NAVBAR}{/if}
    5351
    54 {if not empty($thumbnails)}
    55 <ul class="thumbnails">
    56         {foreach from=$thumbnails item=thumbnail}
    57         <li><span class="wrap1"><span class="wrap2">
    58                         <a href="{$thumbnail.URL}" title="{$thumbnail.TN_TITLE}">
    59                                 <img class="thumbnail" src="{$thumbnail.TN_SRC}" alt="{$thumbnail.TN_ALT}" />
    60                         </a>
    61                         </span></span>
    62         </li>
    63         {/foreach}
     52{if !empty($THUMBNAILS)}
     53<ul class="thumbnails" id="thumbnails">
     54{$THUMBNAILS}
    6455</ul>
    6556{/if}
    6657
     58{if !empty($NAVBAR)}{$NAVBAR}{/if}
    6759</div>
  • extensions/rv_gmaps/trunk/template/picture_map_content.tpl

    r12719 r13092  
    1 
    21{html_head}
    32<script src="http://maps.googleapis.com/maps/api/js?sensor=false&amp;language={$lang_info.code}" type="text/javascript"></script>
     
    54{combine_script id='jquery.nyroModal' load='async' path="`$PLUGIN_LOCATION`/template/nyroModal/jquery.nyroModal-1.6.2.js" version='1.6.2'}
    65<link href="{$PLUGIN_ROOT_URL}/template/nyroModal/nyroModal.css" rel="stylesheet" type="text/css">
    7 
    8 <style type="text/css">{literal}
     6{/html_head}{html_style}{literal}
    97#mapPicture {
    108        position:absolute;
     
    2018}
    2119
    22 #thumbPrev, #thumbNext {display:none;}
    23 {/literal}</style>
    24 {/html_head}
     20#linkPrev, #linkNext {display:none}
     21{/literal}{/html_style}
    2522
    2623<div id="mapPicture">
    27 <a href="{$U_NO_MAP}" title="{'return to normal view mode'|@translate}" rel="nofollow"><img src="{$TN_SRC}" alt="thumb"/></a>
     24<a href="{$U_NO_MAP}" title="{'return to normal view mode'|@translate}" rel="nofollow"><img src="{$current.THUMB_SRC}" alt="thumb"/></a>
    2825<br/>
    2926<a href="{$U_BLOWUP}" onclick="return blowupUrl(this.href);">{'More photos near this location'|@translate}</a>
Note: See TracChangeset for help on using the changeset viewer.