Changeset 14891


Ignore:
Timestamp:
05/10/12 23:00:13 (8 years ago)
Author:
psli
Message:

Version 1.2 : Mise a jour de la page Admin pour simplifier le paramétrage

Location:
extensions/Psli_BingMaps
Files:
10 edited

Legend:

Unmodified
Added
Removed
  • extensions/Psli_BingMaps/JS/Psli-BingMaps.js

    r14872 r14891  
    2121        psli_g_ZoomEntity.push(new Microsoft.Maps.EntityCollection()); 
    2222 
     23/**************************************************************************/ 
     24// JS Function used by admin script while setting up plugin 
     25function psli_AdminUpdateMap() { 
     26        psli_g_MapCenter = new Microsoft.Maps.Location(document.getElementById("lat").value, document.getElementById("lon").value); 
     27        psli_g_zoomInitial = document.getElementById("zoom").value 
     28        var pin = new Microsoft.Maps.Pushpin(psli_g_MapCenter); 
     29        psli_g_Map.entities.clear(); 
     30        psli_g_Map.entities.push(pin); 
     31         
     32        psli_g_Map.setView({center: psli_g_MapCenter, zoom: psli_g_zoomInitial});        
     33} 
     34 
     35function psli_AdminMapClick(e) { 
     36        if (e.targetType == "map") { 
     37                var psli_l_Point = new Microsoft.Maps.Point(e.getX(), e.getY()); 
     38                psli_g_MapCenter = e.target.tryPixelToLocation(psli_l_Point); 
     39                psli_g_zoomInitial = Math.round(psli_g_Map.getZoom()); 
     40                 
     41                document.getElementById("lat").value = psli_g_MapCenter.latitude; 
     42                document.getElementById("lon").value = psli_g_MapCenter.longitude; 
     43                document.getElementById("zoom").value = psli_g_zoomInitial; 
     44                                 
     45                var pin = new Microsoft.Maps.Pushpin(psli_g_MapCenter); 
     46                psli_g_Map.entities.clear(); 
     47                psli_g_Map.entities.push(pin); 
     48                 
     49                psli_g_Map.setView({center: psli_g_MapCenter, zoom: psli_g_zoomInitial}); 
     50        } 
     51} 
     52 
     53function psli_InitAdminSetup () { 
     54        psli_g_MapOptions = {  
     55                credentials: psli_g_BingKey,  
     56                showDashboard:false, 
     57                showMapTypeSelector:false, 
     58                showScalebar:false, 
     59                mapTypeId: Microsoft.Maps.MapTypeId.road, 
     60                center: psli_g_MapCenter, 
     61                zoom: psli_g_zoomInitial 
     62        }; 
     63         
     64        psli_g_Map = new Microsoft.Maps.Map(document.getElementById("myMap"), psli_g_MapOptions); 
     65        Microsoft.Maps.Events.addHandler(psli_g_Map, "click", psli_AdminMapClick); 
     66        var pin = new Microsoft.Maps.Pushpin(psli_g_MapCenter); 
     67        psli_g_Map.entities.clear(); 
     68        psli_g_Map.entities.push(pin); 
     69        psli_g_Map.setView({center: psli_g_MapCenter, zoom: psli_g_zoomInitial}); 
     70} 
     71         
    2372/**************************************************************************/ 
    2473// JS Function used by admin script while editing category location      
  • extensions/Psli_BingMaps/include/admin.inc.php

    r14872 r14891  
    186186                        'PSLIBINGMAPSKEY' => $row['value'], 
    187187                        'PSLIBINGMAPSVIEW' => $initialView, 
     188                        'JSPATH' => PSLI_BINGMAPS_JS 
    188189                )); 
    189190                 
    190191        // Language data 
    191         load_language('plugin.lang', PSLI_BINGMAPS_DIRECTORY); 
     192        load_language('plugin.lang', PSLI_BINGMAPS_TEMPLATE_PATH); 
    192193} 
    193194 
     
    198199 { 
    199200        global $template; 
    200         $template->set_prefilter('categories', 'PSLIBINGMAPS_Category_Prefilter_1_1'); 
     201        $template->set_prefilter('categories', 'PSLIBINGMAPS_Category_Prefilter_1_1a'); 
    201202 } 
    202203 
     
    205206// Add fieldset with data for Psli-BingMaps plugin 
    206207/********************************************************************************************/ 
    207 function PSLIBINGMAPS_Category_Prefilter_1_1($content, &$smarty) 
     208function PSLIBINGMAPS_Category_Prefilter_1_1a($content, &$smarty) 
    208209{        
    209210        $search = '#name="reset"> 
     
    319320                                </div> 
    320321                                <script charset="UTF-8" type="text/javascript" src="http://ecn.dev.virtualearth.net/mapcontrol/mapcontrol.ashx?v=7.0"></script>                                     
    321                                 <script charset="UTF-8" type="text/javascript" src="./plugins/Psli-BingMaps/JS/Psli-BingMaps.js"></script>                          
     322                                <script charset="UTF-8" type="text/javascript" src="{$JSPATH}"></script>                            
    322323                                <script>                 
    323324                                psli_g_BingKey = "{$PSLIBINGMAPSKEY}"; 
     
    341342   array( 
    342343     'NAME'  => 'PSLI-BingMaps', 
    343      'URL'   => get_admin_plugin_menu_link(PSLI_BINGMAPS_DIRECTORY.'include/admin.php') 
     344     'URL'   => get_admin_plugin_menu_link(PSLI_BINGMAPS_ADMIN_PHP) 
    344345   ) 
    345346 ); 
  • extensions/Psli_BingMaps/include/admin.php

    r14872 r14891  
    135135        'LAT'          => $lat, 
    136136        'LON'          => $lon, 
    137         'ZOOM'         => $zoom 
     137        'ZOOM'         => $zoom, 
     138        'JSPATH'           => PSLI_BINGMAPS_JS 
    138139  ) 
    139140); 
    140141 
    141142// Language data 
    142 load_language('plugin.lang', PSLI_BINGMAPS_DIRECTORY); 
     143load_language('plugin.lang', PSLI_BINGMAPS_TEMPLATE_PATH); 
    143144 
    144145// Assign the template contents to ADMIN_CONTENT 
    145 $template->set_filenames(array('plugin_admin_content' => PSLI_BINGMAPS_DIRECTORY.'template/admin.tpl')); 
     146$template->set_filenames(array('plugin_admin_content' => PSLI_BINGMAPS_ADMIN_TPL)); 
    146147$template->assign_var_from_handle('ADMIN_CONTENT', 'plugin_admin_content'); 
    147148 
  • extensions/Psli_BingMaps/include/const.inc.php

    r14872 r14891  
    1616 
    1717// Define 
    18 define('PSLI_BINGMAPS_DIRECTORY', dirname(__FILE__).'/../'); 
    1918define('PSLI_ENTITIES_TABLE' , $prefixeTable . 'psli_entities'); 
    2019define('PSLI_DATAPOINT_TABLE' , $prefixeTable . 'psli_datapoint'); 
     
    2726define('PSLI_CONF_VERSION_MIN', 'PsliBingMapsVerMin'); 
    2827define('PSLI_VERSION_MAJ', 1); 
    29 define('PSLI_VERSION_MIN', 1); 
     28define('PSLI_VERSION_MIN', 2); 
    3029 
    3130?> 
  • extensions/Psli_BingMaps/include/guest.inc.php

    r14872 r14891  
    6868         
    6969                // Language data 
    70                 load_language('plugin.lang', PSLI_BINGMAPS_DIRECTORY); 
     70                load_language('plugin.lang', PSLI_BINGMAPS_TEMPLATE_PATH); 
    7171                 
    7272                $conf['psli_already_done'] = true; 
     
    7979</div> 
    8080<script charset="UTF-8" type="text/javascript" src="http://ecn.dev.virtualearth.net/mapcontrol/mapcontrol.ashx?v=7.0"></script>                     
    81 <script charset="UTF-8" type="text/javascript" src="./plugins/Psli-BingMaps/JS/Psli-BingMaps.js"></script>                          
     81<script charset="UTF-8" type="text/javascript" src="'.PSLI_BINGMAPS_JS.'"></script>                         
    8282<script> 
    8383psli_g_BingKey = "'.$conf[PSLI_CONF_KEY].'"; 
  • extensions/Psli_BingMaps/include/version.inc.php

    r14872 r14891  
    4343        $version_min = "1"; 
    4444} 
     45 
     46// from version 1.1 
     47if (($version_maj == "1") and ($version_min == "1")) 
     48{ 
     49        // No differences between 1.1 and 1.2 except localization 
     50        // Just update version in configuration 
     51        $query = ' 
     52                UPDATE '.CONFIG_TABLE.' 
     53                        SET value = "' . PSLI_VERSION_MAJ . '" 
     54                        WHERE param = "'.PSLI_CONF_VERSION_MAJ.'" 
     55                        LIMIT 1'; 
     56        pwg_query($query); 
     57        $query = ' 
     58                UPDATE '.CONFIG_TABLE.' 
     59                        SET value = "' . PSLI_VERSION_MIN . '" 
     60                        WHERE param = "'.PSLI_CONF_VERSION_MIN.'" 
     61                        LIMIT 2'; 
     62        pwg_query($query); 
     63        $version_maj = PSLI_VERSION_MAJ; 
     64        $version_min = PSLI_VERSION_MIN; 
     65} 
    4566?> 
  • extensions/Psli_BingMaps/language/en_UK/plugin.lang.php

    r14872 r14891  
    11<?php 
    22 
     3$lang['Setup Helper'] = 'Use the map to set initial center position and zoom level of the map.'; 
     4$lang['PointnClick Map'] = 'Point and Click map'; 
    35$lang['Localisation - Plugin Psli-BingMaps'] = 'Localisation - Plugin Psli-BingMaps'; 
    46$lang['Latitude'] = 'Latitude'; 
  • extensions/Psli_BingMaps/language/fr_FR/plugin.lang.php

    r14872 r14891  
    11<?php 
    22 
     3$lang['Setup Helper'] = 'Utilisez la carte ci-dessous pour d&eacute;finir la position et le niveau de zoom initial de la carte.'; 
     4$lang['PointnClick Map'] = 'Carte'; 
    35$lang['Localisation - Plugin Psli-BingMaps'] = 'Localisation - Plugin Psli-BingMaps'; 
    46$lang['Latitude'] = 'Latitude'; 
  • extensions/Psli_BingMaps/main.inc.php

    r14872 r14891  
    1515// Chech whether we are indeed included by Piwigo. 
    1616if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!'); 
    17   
     17 
     18// define Path for PHP and JS file 
     19define ('PSLI_BINGMAPS_PATH', PHPWG_PLUGINS_PATH . basename(dirname(__FILE__)) . '/'); 
     20define ('PSLI_BINGMAPS_JS', PSLI_BINGMAPS_PATH.'JS/Psli-BingMaps.js'); 
     21define ('PSLI_BINGMAPS_VERSION_INC_PHP', PSLI_BINGMAPS_PATH.'include/version.inc.php'); 
     22define ('PSLI_BINGMAPS_ADMIN_INC_PHP', PSLI_BINGMAPS_PATH.'include/admin.inc.php'); 
     23define ('PSLI_BINGMAPS_GUEST_INC_PHP', PSLI_BINGMAPS_PATH.'include/guest.inc.php'); 
     24define ('PSLI_BINGMAPS_ADMIN_PHP', PSLI_BINGMAPS_PATH.'include/admin.php'); 
     25 
     26// define Path for template file 
     27define('PSLI_BINGMAPS_TEMPLATE_PATH', dirname(__FILE__).'/'); 
     28define ('PSLI_BINGMAPS_ADMIN_TPL', PSLI_BINGMAPS_TEMPLATE_PATH.'template/admin.tpl'); 
     29 
    1830// Include define data 
    1931include_once(dirname(__FILE__).'/include/const.inc.php'); 
    2032 
    2133// Check plugin update 
    22 include_once(PSLI_BINGMAPS_DIRECTORY.'include/version.inc.php'); 
     34include_once(PSLI_BINGMAPS_VERSION_INC_PHP); 
    2335 
    2436// Plugin for admin 
    2537if (script_basename() == 'admin')    
    2638{ 
    27   include_once(PSLI_BINGMAPS_DIRECTORY.'include/admin.inc.php'); 
     39  include_once(PSLI_BINGMAPS_ADMIN_INC_PHP); 
    2840} 
    2941else 
    3042{ 
    31   include_once(PSLI_BINGMAPS_DIRECTORY.'include/guest.inc.php'); 
     43  include_once(PSLI_BINGMAPS_GUEST_INC_PHP); 
    3244} 
    3345 
  • extensions/Psli_BingMaps/template/admin.tpl

    r14872 r14891  
    1111 
    1212<fieldset> 
    13 <legend>{'Configuration'|@translate}</legend> 
     13<legend>{'Configuration'|@translate}tatata</legend> 
    1414<table style="width:100%;"> 
    1515        <colgroup> 
     
    2323  <tr> 
    2424    <td align="right">{'Center Latittude'|@translate} : &nbsp;&nbsp;</td> 
    25     <td><input type="text" size="30" maxlength="21" name="lat" value="{$LAT}"></td></td> 
     25    <td><input type="text" size="30" maxlength="21" name="lat" id="lat" value="{$LAT}" onChange="psli_AdminUpdateMap();" /></td></td> 
    2626  </tr> 
    2727  <tr> 
    2828    <td align="right">{'Center Longitude'|@translate} : &nbsp;&nbsp;</td> 
    29     <td><input type="text" size="30" maxlength="21" name="lon" value="{$LON}"></td></td> 
     29    <td><input type="text" size="30" maxlength="21" name="lon" id="lon" value="{$LON}" onChange="psli_AdminUpdateMap();" /></td></td> 
    3030  </tr> 
    3131  <tr> 
    3232    <td align="right">{'Zoom'|@translate} : &nbsp;&nbsp;</td> 
    33     <td><input type="text" size="10" maxlength="3" name="zoom" value="{$ZOOM}"></td></td> 
     33    <td><input type="text" size="10" maxlength="3" name="zoom" id="zoom" value="{$ZOOM}" onChange="psli_AdminUpdateMap();" /></td></td> 
    3434  </tr> 
    3535  <tr> 
     
    4646</fieldset> 
    4747 
     48<fieldset> 
     49<legend>{'PointnClick Map'|@translate}</legend> 
     50<table style="width:100%;"> 
     51        <tr><td style="text-align:center;">{'Setup Helper'|@translate}</td></tr> 
     52        <tr> 
     53                <td> 
     54                        <div id='myMap' style="position:relative; text-align:center; height:400px; margin:15px; border:2px solid white"></div> 
     55                        <script charset="UTF-8" type="text/javascript" src="http://ecn.dev.virtualearth.net/mapcontrol/mapcontrol.ashx?v=7.0"></script>                     
     56                        <script charset="UTF-8" type="text/javascript" src="{$JSPATH}"></script>                            
     57                        <script> 
     58                                psli_g_BingKey = "{$KEY}"; 
     59                                psli_g_zoomInitial = {$ZOOM}; 
     60                                psli_g_MapCenter = new Microsoft.Maps.Location({$LAT}, {$LON}); 
     61                                 
     62                                psli_InitAdminSetup(); 
     63                        </script> 
     64                </td> 
     65        </tr> 
     66</table> 
     67</fieldset> 
    4868<p><input type="submit" name="submit" value="{'Submit'|@translate}"></p> 
    4969 
Note: See TracChangeset for help on using the changeset viewer.