Changeset 2843
- Timestamp:
- 01/10/11 13:19:18 (13 years ago)
- Location:
- plugins/myLocation/trunk
- Files:
-
- 2 added
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
plugins/myLocation/trunk/_admin.php
r2693 r2843 13 13 if (!defined('DC_CONTEXT_ADMIN')) { return; } 14 14 15 $core->addBehavior('adminBlogPreferencesForm',array('myLocationBehaviors','adminBlogPreferencesForm')); 16 $core->addBehavior('adminBeforeBlogSettingsUpdate',array('myLocationBehaviors','adminBeforeBlogSettingsUpdate')); 17 18 class myLocationBehaviors 19 { 20 public static function adminBlogPreferencesForm($core,$settings) 21 { 22 echo 23 '<fieldset><legend>'.__('Geolocation').'</legend>'. 24 '<p><label class="classic">'. 25 form::checkbox('mylocation_enable','1',$settings->myLocation->enable). 26 __('Enable geolocation').'</label></p>'. 27 '</fieldset>'; 28 } 29 30 public static function adminBeforeBlogSettingsUpdate($settings) 31 { 32 $settings->myLocation->put('enable',!empty($_POST['mylocation_enable'])); 33 } 34 } 15 $_menu['Plugins']->addItem(__('myLocation'),'plugin.php?p=myLocation','index.php?pf=myLocation/icon.png', 16 preg_match('/plugin.php\?p=myLocation(&.*)?$/',$_SERVER['REQUEST_URI']), 17 $core->auth->check('admin',$core->blog->id)); 35 18 36 19 ?> -
plugins/myLocation/trunk/_define.php
r2699 r2843 15 15 /* Description*/ "Display your current location", 16 16 /* Author */ "Tomtom (http://blog.zenstyle.fr)", 17 /* Version */ '0.1. 1',17 /* Version */ '0.1.2', 18 18 /* Permissions */ 'usage,contentadmin' 19 19 ); -
plugins/myLocation/trunk/_install.php
r2699 r2843 22 22 $core->blog->settings->addNamespace('myLocation'); 23 23 $core->blog->settings->myLocation->put('enable',false,'boolean','Enable myLocation',false,true); 24 $core->blog->settings->myLocation->put('position','afterContent','string','Position of location display',false,true); 25 $core->blog->settings->myLocation->put('accuracy','city','string','Geolocalisation accuracy',false,true); 26 $core->blog->settings->myLocation->put('css','','string','Custom CSS',false,true); 24 27 25 28 # --INSTALL AND UPDATE PROCEDURES-- -
plugins/myLocation/trunk/_public.php
r2693 r2843 13 13 if (!defined('DC_RC_PATH')) { return; } 14 14 15 $core->addBehavior('public HeadContent',array('myLocationBehaviors','publicHeadContent'));15 $core->addBehavior('publicFooterContent',array('myLocationBehaviors','publicFooterContent')); 16 16 $core->addBehavior('templateBeforeBlock',array('myLocationBehaviors','templateBeforeBlock')); 17 $core->addBehavior('publicCommentAfterContent',array('myLocationBehaviors','publicCommentAfterContent'));18 17 $core->addBehavior('coreBeforeCommentCreate',array('myLocationBehaviors','coreBeforeCommentCreate')); 19 18 $core->addBehavior('coreBlogGetComments',array('myLocationBehaviors','coreBlogGetComments')); 20 19 20 if ($core->blog->settings->myLocation->position === 'afterContent') { 21 $core->addBehavior('publicCommentAfterContent',array('myLocationBehaviors','publicCommentAfterContent')); 22 } 23 else { 24 $core->addBehavior('templateAfterValue',array('myLocationBehaviors','templateAfterValue')); 25 } 26 21 27 class myLocationBehaviors 22 28 { 23 public static function public HeadContent($core,$_ctx)29 public static function publicFooterContent($core,$_ctx) 24 30 { 25 31 $js = $core->blog->getQMarkURL().'pf='.basename(dirname(__FILE__)).'/js/post.js'; … … 34 40 'var post_location_error_denied = "'.__('Permission denied by your browser').'";'."\n". 35 41 'var post_location_error_unavailable = "'.__('You location is currently unavailable. Please, try later').'";'."\n". 42 'var post_location_error_accuracy = "'.__('You location is currently unavailable for the choosen accuracy').'";'."\n". 36 43 'var post_location_longitude = "'.(isset($_POST['c_location_longitude']) ? $_POST['c_location_longitude'] : '').'";'."\n". 37 44 'var post_location_latitude = "'.(isset($_POST['c_location_latitude']) ? $_POST['c_location_latitude'] : '').'";'."\n". 38 45 'var post_location_address = "'.(isset($_POST['c_location_address']) ? $_POST['c_location_address'] : '').'";'."\n". 46 'var post_location_accuracy = "'.$core->blog->settings->myLocation->accuracy.'";'."\n". 39 47 '//]]>'."\n". 40 48 '</script>'."\n". … … 57 65 } 58 66 67 public static function templateAfterValue($core,$tag,$attr) 68 { 69 $fit_tag = $core->blog->settings->myLocation->position; 70 71 if ($tag === $fit_tag) { 72 return 73 "<?php\n". 74 'if ($_ctx->comments->hasLocation()) {'."\n". 75 'echo \' <span class="comment-location">\'.$_ctx->comments->getLocation().\'</span>\';'."\n". 76 '}'."\n". 77 "?>"; 78 } 79 } 80 59 81 public static function coreBeforeCommentCreate($blog,$cur) 60 82 { -
plugins/myLocation/trunk/inc/class.rs.ext.comment.location.php
r2693 r2843 36 36 sprintf('http://maps.google.com/maps?q=%s,+%s+%s',$location['latitude'],$location['longitude'],''); 37 37 38 echosprintf('<a href="%s">%s</a>',$url,$address);38 return sprintf('<a href="%s">%s</a>',$url,$address); 39 39 } 40 40 } -
plugins/myLocation/trunk/js/post.js
r2693 r2843 64 64 function succesCallback(position) { 65 65 $('input[type="submit"]').removeAttr('disabled'); 66 var address ;66 var address = ''; 67 67 var geocoder = new google.maps.Geocoder(); 68 68 var latlng = new google.maps.LatLng(position.coords.latitude, position.coords.longitude); 69 69 geocoder.geocode({'latLng': latlng}, function(results, status) { 70 70 if (status == google.maps.GeocoderStatus.OK) { 71 for (var i = 2; i < results.length; i++) { 72 if (results[i]) { 73 address = results[i].formatted_address; 74 break; 71 for (var i = 0; i < results.length; i++) { 72 for (var j = 0; j < results[i].types.length; j++) { 73 if (results[i].types[j] == post_location_accuracy) { 74 address = results[i].formatted_address; 75 break; 76 } 75 77 } 76 78 } 79 $('#c_location_longitude').val(position.coords.longitude); 80 $('#c_location_latitude').val(position.coords.latitude); 81 $('#c_location_address').val(address); 82 if (address.length > 0) { 83 updLocationLabel(address,'success'); 84 } 85 else { 86 updLocationLabel(post_location_error_accuracy,'unavailable'); 87 } 77 88 } 78 $('#c_location_longitude').val(position.coords.longitude);79 $('#c_location_latitude').val(position.coords.latitude);80 if (address.length > 0) {89 else { 90 $('#c_location_longitude').val(position.coords.longitude); 91 $('#c_location_latitude').val(position.coords.latitude); 81 92 $('#c_location_address').val(address); 82 updLocationLabel( address,'success');93 updLocationLabel(post_location_error_unavailable,'unavailable'); 83 94 } 84 95 }); -
plugins/myLocation/trunk/locales/fr/main.po
r2693 r2843 1 1 # Language: Français 2 # Module: myLocation - 0.1 3 # Date: 201 0-10-01 17:32:352 # Module: myLocation - 0.1.2 3 # Date: 2011-01-10 12:17:41 4 4 # Translated with translater 1.5 5 5 … … 7 7 msgstr "" 8 8 "Content-Type: text/plain; charset=UTF-8\n" 9 "Project-Id-Version: myLocation 0.1 \n"9 "Project-Id-Version: myLocation 0.1.2\n" 10 10 "POT-Creation-Date: \n" 11 "PO-Revision-Date: 201 0-10-01T17:32:35+00:00\n"12 "Last-Translator: T homas Bouron\n"11 "PO-Revision-Date: 2011-01-10T12:17:41+00:00\n" 12 "Last-Translator: Tomtom\n" 13 13 "Language-Team: \n" 14 14 "MIME-Version: 1.0\n" 15 15 "Content-Transfer-Encoding: 8bit\n" 16 16 17 #: _admin.php:23 18 msgid "Geolocation" 19 msgstr "Géo localisation" 17 #: _admin.php:15 18 #: index.php:50 19 #: index.php:60 20 msgid "myLocation" 21 msgstr "myLocation" 20 22 21 #: _admin.php:26 22 msgid "Enable geolocation" 23 msgstr "Activer la géo localisation" 24 25 #: _public.php:32 23 #: _public.php:38 26 24 msgid "Add my location" 27 25 msgstr "Ajouter ma localisation" 28 26 29 #: _public.php:3 327 #: _public.php:39 30 28 msgid "Searching..." 31 29 msgstr "Recherche..." 32 30 33 #: _public.php: 3431 #: _public.php:40 34 32 msgid "Permission denied by your browser" 35 33 msgstr "Permission refusé par votre navigateur" 36 34 37 #: _public.php: 3535 #: _public.php:41 38 36 msgid "You location is currently unavailable. Please, try later" 39 37 msgstr "Votre localisation actuelle est indisponible. Merci de réessayer plus tard" 38 39 #: _public.php:42 40 msgid "You location is currently unavailable for the choosen accuracy" 41 msgstr "Votre localisation actuelle est indisponible pour le niveau de précision demandé" 40 42 41 43 #: inc/class.rs.ext.comment.location.php:32 … … 43 45 msgstr "Voir sur la carte" 44 46 47 #: index.php:33 48 msgid "After content" 49 msgstr "Après le contenu" 50 51 #: index.php:34 52 msgid "After author name" 53 msgstr "Après l'auteur" 54 55 #: index.php:37 56 msgid "Street address" 57 msgstr "Adresse" 58 59 #: index.php:38 60 msgid "Postal code" 61 msgstr "Code postal" 62 63 #: index.php:39 64 msgid "Administrative area" 65 msgstr "Zone administrative" 66 67 #: index.php:40 68 msgid "Neighborhood" 69 msgstr "Environ" 70 71 #: index.php:41 72 msgid "State" 73 msgstr "Région" 74 75 #: index.php:42 76 msgid "Country" 77 msgstr "Pays" 78 79 #: index.php:56 80 msgid "Configuration has been successfully updated" 81 msgstr "La configuration a été mise à jour avec succès" 82 83 #: index.php:62 84 msgid "General options" 85 msgstr "Options générales" 86 87 #: index.php:65 88 msgid "Enable geolocation" 89 msgstr "Activer la géo localisation" 90 91 #: index.php:67 92 msgid "Position of location display" 93 msgstr "Position de l'affichage de la localisation" 94 95 #: index.php:71 96 msgid "Custom CSS" 97 msgstr "CSS personnalisée" 98 99 #: index.php:74 100 msgid "Leave blank to use the default plugin CSS" 101 msgstr "Laissez vide pour utiliser la CSS par défaut du plugin" 102 103 #: index.php:76 104 msgid "Geolocalisation accuracy" 105 msgstr "Précision de la géo localisation" 106 107 msgid "Geolocation" 108 msgstr "Géo localisation" 109
Note: See TracChangeset
for help on using the changeset viewer.