Changeset 20034


Ignore:
Timestamp:
Jan 10, 2013, 9:55:42 AM (11 years ago)
Author:
cljosse
Message:

[extensions] edit_gmaps Minor corrections

Location:
extensions/edit_gmaps
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • extensions/edit_gmaps/admin/admin_edit.php

    r18635 r20034  
    5353//========== Mode GLOBAL ================================
    5454
     55
    5556check_input_parameter('selection', $_POST, true, PATTERN_ID);
    5657include (PHPWG_ROOT_PATH.'admin/batch_manager.php');
    5758    $tabsheet = new tabsheet();
    58     $tabsheet->assign();
    59  
    60 
     59    $tabsheet->assign(); 
    6160
    6261if(isset($page['cat_elements_id']))
    6362    $template->concat('TABSHEET_TITLE', ' '.l10n_dec('%d image', '%d images', count($page['cat_elements_id'])).' - '.$page['title']); 
    6463
    65  
     64
    6665 if(isset($_POST)){
    67 // $info_message .= cl_edit_functions::Memo_Vars($_POST);
    68 
     66// $info_message .= cl_print_var($_POST);
    6967//===============================================================
    7068$collection = array();
     
    103101$adresse =  $lang_info['country'];   ;
    104102$adresse=str_replace("/",", ",$adresse);
    105  
     103global $EDIT_CL_parametres ;
     104 
     105$EDIT_CL_parametres = cl_edit_controler::cl_edit_Get_Options();
     106
     107
     108$template->assign( 'coordinates',
     109                    array(  'FILE' => '',
     110                            'LAT' =>  ($EDIT_CL_parametres->lat =='')?'100': $EDIT_CL_parametres->lat,
     111                            'LON' => ($EDIT_CL_parametres->lon =='')?'100':  $EDIT_CL_parametres->lon ,
     112                            'ADRESSE' => ($EDIT_CL_parametres->adress =='')?$adresse:  $EDIT_CL_parametres->adress ,
     113                            'ZOOM' => 18,
     114                            'ALT' => $EDIT_CL_parametres->alt =='' ?0: $EDIT_CL_parametres->alt
     115                        )
     116                    );
     117                 
    106118if (count($collection)>0 )
    107119  if ( isset($_POST['update']) && ( $_POST['update']==l10n('update_exif') || $_POST['update'] == l10n('update_all')  )){
     
    299311                $j++ ;
    300312            } else{
    301             //   $info_message .= cl_edit_functions::Memo_Vars($current[$j]);
     313            //   $info_message .= cl_print_var($current[$j]);
    302314                break ;
    303315            }
     
    342354$match="";
    343355if ( isset($_POST['submit'])   ) {
    344 
     356if ( isset($_POST['match']) && $_POST['match']!='' ){   
     357      cl_edit_controler::cl_edit_Set_Options();
     358      cl_edit_controler::cl_edit_sauve_options_inf();
     359  }
    345360 if ($_POST['submit']==l10n('selection') ) {
    346361    $collection =$_POST['selection'];
    347362  }
     363
    348364  if ($_POST['submit']==l10n('add') ) {
    349365    $_POST['selection']=array();
     
    359375//=================================================================================
    360376$src="";
    361 $template->assign( 'coordinates',
    362                     array(  'FILE' => '',
    363                             'LAT' => '100',
    364                             'LON' => '100',
    365                             'ADRESSE' => $adresse,
    366                             'ZOOM' => 18,
    367                             'ALT' => 0
    368                         )
    369                     );
     377
    370378//======================================================================
    371379if (isset($_POST['submit']) and $_POST['submit']==l10n('selection' )){
     
    387395              $infos_gps  =  cl_edit_controler::Get_exif_gps( $image['path'],$image,false,false) ;           
    388396               
    389               if(isset($infos_gps['lat']) && $infos_gps['is_exif']){     
    390               //======= test affichage BD ================
    391                 if($image['lat']=='' || $image['lon']==''){ 
     397             
     398             
     399
     400               if( ($image['lat']=='' || $image['lon']=='')|| $EDIT_CL_parametres->check_exif=='on' ) {                         
     401                  if(isset($infos_gps['lat']) && $infos_gps['is_exif']){     
    392402                        $image['lat']=$infos_gps['lat'];
    393403                        $image['lon']=$infos_gps['lon'];
    394                         $image['alt']=$infos_gps['alt'];             
    395                 }
    396               }       
     404                        $image['alt']=$infos_gps['alt'];
     405                  } 
     406              }                     
     407              if($image['lat'] <> ''){               
     408                  $lon=$image['lon'];
     409                  $lat=$image['lat'];   
     410                  $alt=$image['alt'];   
     411              }
    397412              //==========================================
    398                        
    399               if ( $init_info && $image['lat'] <> '' ) {               
    400 
    401                 $init_info = false ;
    402                 $lat = ($image['lat'] <> '') ? $image['lat'] : '100'  ;
    403                 $lon = ($image['lon']  <> '') ? $image['lon'] : '3.0'  ;
    404                 $alt = ($image['alt']  <> '') ? $image['alt'] : '0'  ;
    405                      
     413              if ( $init_info && $image['lat'] <> '' ) {     
     414                $init_info = false ;                     
    406415                //=====================================================
    407416                $template->assign( 'coordinates',
     
    417426              }
    418427              //=====================================================
    419                     $lon=$image['lon'];
    420                     $lat=$image['lat'];
     428                           
     429
     430
     431
     432
    421433                    $lonDMS= dec2dms($lon) ;
    422434                    $latDMS= dec2dms($lat) ;
     
    456468//============================================================
    457469 if ( !empty($first_image)) {
    458    $erreur_message .= cl_edit_functions::Memo_Vars($first_image);
     470   $erreur_message .= cl_print_var($first_image);
    459471   
    460472   if (isset($_POST['update'])) {
  • extensions/edit_gmaps/edit_gmaps.inc.php

    r17779 r20034  
    3535
    3636class cl_edit_functions {
    37         static public   function Memo_vars($variables) {
    38                     ob_start();
    39                     echo '<pre>';
    40                     print_r($variables);
    41                     echo '</pre>';
    42                     $m= ob_get_contents();
    43             ob_end_clean();
    44                     return $m;         
    45     }
    46 
    47 /**
     37     
     38/**************************************
    4839* list all columns of each given table
    49 *
     40***************************************
    5041* @return array of array
    5142*/
     
    260251  }
    261252//======================================================
    262      static public function cl_edit_admin_menu($menu)
     253static public function cl_edit_admin_menu($menu)
    263254    {
    264255            include_once( dirname(__FILE__) .'/include/functions.php');
     
    271262            return $menu;
    272263    }
     264        /****************************
     265        *
     266        *****************************/
     267  static public function cl_edit_Get_Options(){
     268                global $conf,$EDIT_CL_parametres,$infos_message ;
     269  if (!isset($conf['edit_gmaps'])){   
     270  $q = '
     271    INSERT INTO '.CONFIG_TABLE.' (param, value, comment)
     272    VALUES ("edit_gmaps","","Parametres du plugin edit_gmaps")
     273  ;';
     274  pwg_query($q);         
     275
     276  }
     277        $EDIT_CL_parametres =  unserialize($conf['edit_gmaps']); 
     278    if (!isset($EDIT_CL_parametres->lat )){
     279      $EDIT_CL_parametres= cl_edit_controler::cl_edit_Set_Options();
     280    }
     281   
     282                return $EDIT_CL_parametres;
     283  }
    273284        /*
    274285        *
    275286        */
    276  function cl_edit_Get_Options()
    277   {
    278                 global $conf,$EDIT_CL_parametres;
    279                 $EDIT_CL_parametres =  unserialize($conf['cl_edit']);
    280                 $EDIT_CL_parametres =  cl_edit_Set_Options();
    281                 return $EDIT_CL_parametres;
    282   }
    283         /*
    284         *
    285         */
    286 function cl_edit_Set_Options()
    287   {
    288 
     287 static public function cl_edit_Set_Options(){
    289288  global $EDIT_CL_parametres;
    290289//=============================================================================
    291 $my_para=$EDIT_CL_parametres;
    292     $my_para->type=(isset($_POST['type']))? $_POST['type']: ((isset($my_para->type)) ? $my_para->type:  'Ty') ;
    293 
     290$my_para=$EDIT_CL_parametres;
     291$lon= isset($my_para->lon)? $my_para->lon:'' ;
     292$lat= isset($my_para->lat)? $my_para->lat:'' ;
     293$alt= isset($my_para->alt)? $my_para->alt:'0' ;
     294    $my_para->lon    = (isset($_POST['lon']))? $_POST['lon']: $lon ;
     295    $my_para->lat    = (isset($_POST['lat']))? $_POST['lat']: $lat ;
     296    $my_para->alt    = (isset($_POST['alt']))? $_POST['alt']: $alt ;
     297    $my_para->adress    = (isset($_POST['match']))? $_POST['match']: '' ;
    294298//===============================================================================       
    295 
    296299if ( isset($_POST['selectAction'] ) && $_POST['selectAction'] == l10n('cl_edit_save') )  { 
    297                 $my_para->check_desc_v = isset($_POST['check_desc_v']) ? $_POST['check_desc_v'] : "off" ;
     300                $my_para->check_exif = isset($_POST['check_exif']) ? $_POST['check_exif'] : "off" ;
    298301
    299302         }else{
    300                 $my_para->check_desc_v = isset($_POST['check_desc_v']) ? $_POST['check_desc_v'] : ( ( isset($my_para->check_desc_v) ) ? $my_para->check_desc_v :   'off') ; 
    301 
    302 
     303                $my_para->check_exif = isset($_POST['check_exif']) ? $_POST['check_exif'] : ( ( isset($my_para->check_exif) ) ? $my_para->check_exif :   'off') ; 
    303304   }
    304 
     305   $EDIT_CL_parametres=$my_para;
    305306return $my_para;
    306 }
    307         /*
     307
     308}
     309        /**********************
    308310        *
    309         */
    310     function cl_edit_sauve_options_inf()
    311     {
    312     global $options,$infos_message,$conf,$EDIT_CL_parametres  ;
    313     $infos_message .=l10n("cl_edit_save_config")."<br>";
    314      $EDIT_CL_parametres=cl_edit_Set_Options();
    315 
    316      if ( isset($EDIT_CL_parametres) )
    317             {
    318  
     311        **********************/
     312  static public function cl_edit_sauve_options_inf()    {
     313    global $options,$infos_message,$conf,$EDIT_CL_parametres  ;   
     314   // $infos_message .=l10n("cl_edit_save_config")."<br>". cl_print_var($EDIT_CL_parametres);
     315   // cl_aff_infos_plus();
     316     if ( isset($EDIT_CL_parametres) ){
    319317                    $query = '
    320318                    UPDATE '.CONFIG_TABLE.'
    321319                    SET value="'.addslashes(serialize($EDIT_CL_parametres)).'"
    322                     WHERE param = "cl_EDIT_CL"
     320                    WHERE param = "edit_gmaps"
    323321                    LIMIT 1';
    324322                            pwg_query($query);
    325               }
    326          
     323              } 
    327324     }
    328 
    329325
    330326
    331327} // class   
    332328 
    333 
     329/*************************
     330 *
     331 *************************/
     332 if(!function_exists("cl_print_var")){
     333   function cl_print_var($variables){
     334    ob_start();
     335    echo '<pre>';
     336    print_r($variables);
     337    echo '</pre>';
     338    $m= ob_get_contents();
     339    ob_end_clean();
     340    return $m;         
     341  }
     342}
     343/******************
     344*
     345******************/
     346if(!function_exists("cl_aff_infos_plus")){
     347        function cl_aff_infos_plus()
     348                {
     349                 global $template,$infos_message,$error_message,$warnings_message, $user ;
     350                 global  $conf,$lang,$page  ;
     351                 //==============================================================
     352                  if (isset($error_message))    {       
     353                                if ($error_message <> ""){
     354                                                $error_message=str_replace("\n",'<br />',$error_message) ;
     355                                                $template->assign('errors',$error_message);
     356                                                $error_message="";
     357                                        }
     358                        }
     359     //==============================================================
     360                  if (isset($warnings_message)) {       
     361                                if ($warnings_message <> ""){
     362                                                $warnings_message=str_replace("\n",'<br />',$warnings_message) ;
     363                                                $template->assign('warnings',$warnings_message);
     364                                                $warnings_message="";
     365                                        }
     366                        }
     367        //=============================================
     368                  if (isset($infos_message)){                   
     369                                if ($infos_message <> ""){
     370                                                $infos_message=str_replace("\n",'<br />',$infos_message) ;
     371                                                $template->assign('infos',$infos_message);
     372                                                $infos_message="";
     373                                        }
     374                                }
     375                                //=============================================================
     376                return;         
     377               
     378                } // function cl_autosize_aff_infos_plus
     379        //===============================================================
     380}
    334381?>
  • extensions/edit_gmaps/main.inc.php

    r18635 r20034  
    22/*
    33Plugin Name: Edit Maps&Earth
    4 Version: 2.2.6
     4Version: 2.2.7
    55Description:  Editor for rv gmaps
    66Plugin URI: http://piwigo.org/ext/extension_view.php?eid=330
  • extensions/edit_gmaps/maintain.inc.php

    r9445 r20034  
    3232{
    3333  $dir_name = basename( dirname(__FILE__) );
    34 
     34  if (!isset($conf['edit_gmaps'])){   
     35  $q = '
     36    INSERT INTO '.CONFIG_TABLE.' (param, value, comment)
     37    VALUES ("edit_gmaps","","Parametres du plugin edit_gmaps")
     38  ;';
     39  pwg_query($q);
     40  }
    3541}
    3642
    37 function plugin_deactivate()
    38 {
    39  
     43function plugin_deactivate(){
    4044  cl_meta_invalidate_cache();
     45  global $conf; 
     46  if (isset($conf['edit_gmaps']))  {
     47    $q = '
     48      DELETE FROM '.CONFIG_TABLE.'
     49      WHERE param="edit_gmaps"
     50    ;';
     51    pwg_query($q);
     52    }
    4153}
    4254
    43 function plugin_uninstall()
    44 {
     55function plugin_uninstall(){
    4556  global $conf ;
    4657     $q = 'ALTER TABLE '.IMAGES_TABLE.' DROP COLUMN `alt`';
     
    5465  pwg_query( $q );
    5566  }
     67
    5668}
    5769?>
Note: See TracChangeset for help on using the changeset viewer.