Changeset 9445 for extensions/edit_gmaps


Ignore:
Timestamp:
Mar 1, 2011, 11:40:34 AM (13 years ago)
Author:
cljosse
Message:

[edit_gmaps] set conformity with rv_gmaps install.

Location:
extensions/edit_gmaps
Files:
5 edited

Legend:

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

    r9412 r9445  
    22if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!');
    33include_once(PHPWG_ROOT_PATH.'admin/include/tabsheet.class.php');
    4 
    5 $colonnes = cl_get_columns_of(IMAGES_TABLE);
    6 
    7 $key = array_search('lon', $colonnes[IMAGES_TABLE]);
    8 if (!$key){
    9     $q = 'ALTER TABLE '.IMAGES_TABLE.' ADD COLUMN `lon` DOUBLE(9,6)';
    10     pwg_query($q);     
    11 }       
    12 $key = array_search('lat', $colonnes[IMAGES_TABLE]);
    13 if (!$key){
    14     $q = 'ALTER TABLE '.IMAGES_TABLE.' ADD COLUMN `lat` DOUBLE(9,6)';
    15     pwg_query($q);     
    16 }       
    17 $key = array_search('alt', $colonnes[IMAGES_TABLE]);
    18 if (!$key){
    19     $q = 'ALTER TABLE '.IMAGES_TABLE.' ADD COLUMN `alt` DOUBLE(9,6)';
    20     pwg_query($q);     
    21 }       
    22 
    23        
    24 /**
    25 * list all columns of each given table
    26 *
    27 * @return array of array
    28 */
    29 function cl_get_columns_of($table)
    30 {
    31     $columns_of = array();
    32     $query = 'DESC '.$table.';';
    33     $result = mysql_query($query);     
    34     $columns_of[$table] = array();   
    35 
    36     if ($result)   
    37         while ($row = mysql_fetch_row($result))
    38            array_push($columns_of[$table], $row[0]);
    39        
    40     return $columns_of;
    41 }
    424
    435
  • extensions/edit_gmaps/admin/header_2_2.tpl

    r9412 r9445  
    1 {combine_script id="jquery" load="header" path = $ROOT_URL|@cat:"themes/default/js/jquery.js"}
     1{combine_script id="jquery" load="header" path = $ROOT_URL|@cat:"themes/default/js/jquery.min.js "}
    22{combine_script id="jquery.cluetip" path = $ROOT_URL|@cat:"themes/default/js/plugins/jquery.cluetip.js" require="jquery" }
    3 {combine_script id="jquery.ui" path=$ROOT_URL|@cat:"themes/default/js/ui/jquery.ui.core.js" require="jquery"}
    4 {combine_script id="jquery.ui.resizable" path=$ROOT_URL|@cat:"themes/default/js/ui/jquery.ui.resizable.js" require="jquery,jquery.ui"}
    5 {combine_script id="jquery.ui.slider" path=$ROOT_URL|@cat:"themes/default/js/ui/jquery.ui.slider.js" require="jquery,jquery.ui"}
    6 {combine_script id="jquery.ui.draggable" path=$ROOT_URL|@cat:"themes/default/js/ui/jquery.ui.draggable.js" require="jquery,jquery.ui"}
     3{combine_script id="jquery.ui" path=$ROOT_URL|@cat:"themes/default/js/ui/minified/jquery.ui.core.min.js " require="jquery"}
     4{combine_script id="jquery.ui.resizable" path=$ROOT_URL|@cat:"themes/default/js/ui/minified/jquery.ui.resizable.min.js " require="jquery,jquery.ui"}
     5{combine_script id="jquery.ui.slider" path=$ROOT_URL|@cat:"themes/default/js/ui/minified/jquery.ui.slider.min.js " require="jquery,jquery.ui"}
     6{combine_script id="jquery.ui.draggable" path=$ROOT_URL|@cat:"themes/default/js/ui/minified/jquery.ui.draggable.min.js " require="jquery,jquery.ui"}
    77
    88
  • extensions/edit_gmaps/edit_gmaps.inc.php

    r9412 r9445  
    3434);
    3535
     36class 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    }
    3646
     47/**
     48* list all columns of each given table
     49*
     50* @return array of array
     51*/
     52  static public function Get_columns_of($table){
     53    $columns_of = array();
     54    $query = 'DESC '.$table.';';
     55    $result = mysql_query($query);     
     56    $columns_of[$table] = array();   
    3757
     58    if ($result)   
     59        while ($row = mysql_fetch_row($result))
     60            array_push($columns_of[$table], $row[0]);
     61       
     62    return $columns_of;
     63  }
     64}
    3865
    3966class cl_edit_controler {
     
    112139     }
    113140
    114      function Memo_vars($variables)
    115 {
    116                 ob_start();
    117                 echo '<pre>';
    118                 print_r($variables);
    119                 echo '</pre>';
    120                 $m= ob_get_contents();
    121141
    122         ob_end_clean();
    123                 return $m;
    124                
    125 }
    126 } // class   
    127142
     143} // class   
    128144 
     145global $conf ;
     146  $colonnes = cl_edit_functions::Get_columns_of(IMAGES_TABLE); 
     147$key = array_search('lon', $colonnes[IMAGES_TABLE]);
     148if (!$key){
     149    $q = 'ALTER TABLE '.IMAGES_TABLE.' ADD COLUMN `lon` DOUBLE(8,6)';
     150    pwg_query($q);     
     151}       
     152$key = array_search('lat', $colonnes[IMAGES_TABLE]);
     153if (!$key){
     154    $q = 'ALTER TABLE '.IMAGES_TABLE.' ADD COLUMN `lat` DOUBLE(9,6)';
     155    pwg_query($q);     
     156}       
     157 
     158$key = array_search('alt', $colonnes[IMAGES_TABLE]);
     159if (!$key){
     160    $q = 'ALTER TABLE '.IMAGES_TABLE.' ADD COLUMN `alt` DOUBLE(9,6)';
     161    pwg_query($q);     
     162}       
     163
     164       
     165
    129166
    130167?>
  • extensions/edit_gmaps/main.inc.php

    r9413 r9445  
    1414        include_once(EDIT_CL_PATH.'edit_gmaps.inc.php');
    1515
     16$cl_edit_functions = new cl_edit_functions();
    1617$cl_edit_controler = new cl_edit_controler();
    1718add_event_handler('get_admin_plugin_menu_links', array(&$cl_edit_controler,'cl_edit_admin_menu')  );
  • extensions/edit_gmaps/maintain.inc.php

    r9377 r9445  
    11<?php
    2 function plugin_install()
     2if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!');
     3if (!defined('EDIT_CL_PATH'))
     4define(  'EDIT_CL_PATH',   PHPWG_PLUGINS_PATH.basename(dirname(__FILE__)).'/' );
     5        include_once(EDIT_CL_PATH.'edit_gmaps.inc.php');
     6
     7$cl_edit_functions = new cl_edit_functions();
     8
     9function plugin_install($plugin_id,$plugin_version,&$errors)
    310{
    4   $q = '
    5 ALTER TABLE '.IMAGES_TABLE.' ADD COLUMN `alt` DOUBLE(9,6)';
    6   pwg_query($q);
     11global $conf,$lang ;
     12
     13   if (!isset($conf['gmaps_api_key']))
     14
     15$msg = sprintf(l10n('To install this plugin, you need to install %s before'),"RV Maps&Earth" );
     16  if(is_array($errors))
     17  {    array_push($errors,  "CANNOT INSTALL - $plugin_id <BR />".$msg);  }
     18  else  {    $errors=Array( "CANNOT INSTALL - $plugin_id <BR />".$msg);  }
     19   return  ;
     20}
     21 $colonnes=cl_edit_functions::Get_columns_of(IMAGES_TABLE);
     22
     23 $colonnes=cl_edit_functions::Get_columns_of(IMAGES_TABLE);
     24 $key = array_search('alt', $colonnes[IMAGES_TABLE]);
     25if (!$key){
     26 $q = 'ALTER TABLE '.IMAGES_TABLE.' ADD COLUMN `alt` DOUBLE(9,6)';
     27    pwg_query($q);     
     28    }
    729}
    830
     
    2143function plugin_uninstall()
    2244{
    23   $q = '
    24 ALTER TABLE '.IMAGES_TABLE.' DROP COLUMN `alt`';
     45  global $conf ;
     46     $q = 'ALTER TABLE '.IMAGES_TABLE.' DROP COLUMN `alt`';
     47    pwg_query( $q ); 
     48
     49  if (!isset($conf['gmaps_api_key']))
     50
     51    $q = 'ALTER TABLE '.IMAGES_TABLE.' DROP COLUMN `lon`';
    2552  pwg_query( $q );
     53    $q = 'ALTER TABLE '.IMAGES_TABLE.' DROP COLUMN `lat`';
     54  pwg_query( $q );
     55  }
    2656}
    2757?>
Note: See TracChangeset for help on using the changeset viewer.