i18n
This commit is contained in:
@@ -32,6 +32,10 @@ class Media extends PhpObject {
|
|||||||
$this->sSystemType = (substr(php_uname(), 0, 7) == "Windows")?'win':'unix';
|
$this->sSystemType = (substr(php_uname(), 0, 7) == "Windows")?'win':'unix';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getProjectCodeName() {
|
||||||
|
return $this->oProject->getProjectCodeName();
|
||||||
|
}
|
||||||
|
|
||||||
public function getMediasInfo() {
|
public function getMediasInfo() {
|
||||||
if(empty($this->asMedias)) {
|
if(empty($this->asMedias)) {
|
||||||
if($this->oProject->getProjectId()) {
|
if($this->oProject->getProjectId()) {
|
||||||
@@ -57,8 +61,15 @@ class Media extends PhpObject {
|
|||||||
|
|
||||||
public function addMedia($sMediaName, $sMethod='upload') {
|
public function addMedia($sMediaName, $sMethod='upload') {
|
||||||
$sError = '';
|
$sError = '';
|
||||||
if(!$this->isProjectModeValid() && $sMethod!='sync') $sError = 'Le projet (id='.$this->oProject->getProjectId().') n\'est pas en mode "blog"';
|
$asErrorParams = array();
|
||||||
elseif($this->oDb->pingValue(self::MEDIA_TABLE, array('filename'=>$sMediaName)) && $sMethod!='sync') $sError = 'l\'image existe déjà';
|
if(!$this->isProjectModeValid() && $sMethod!='sync') {
|
||||||
|
$sError = 'upload_wrong_mode';
|
||||||
|
$asErrorParams[] = $this->oProject->getProjectCodeName();
|
||||||
|
}
|
||||||
|
elseif($this->oDb->pingValue(self::MEDIA_TABLE, array('filename'=>$sMediaName)) && $sMethod!='sync') {
|
||||||
|
$sError = 'upload_media_exist';
|
||||||
|
$asErrorParams[] = $sMediaName;
|
||||||
|
}
|
||||||
else {
|
else {
|
||||||
//Add media to DB
|
//Add media to DB
|
||||||
$asMediaInfo = $this->getMediaInfoFromFile($sMediaName);
|
$asMediaInfo = $this->getMediaInfoFromFile($sMediaName);
|
||||||
@@ -74,19 +85,14 @@ class Media extends PhpObject {
|
|||||||
if($sMethod=='sync') $iMediaId = $this->oDb->insertUpdateRow(self::MEDIA_TABLE, $asDbInfo, array(Db::getId(Project::PROJ_TABLE), 'filename'));
|
if($sMethod=='sync') $iMediaId = $this->oDb->insertUpdateRow(self::MEDIA_TABLE, $asDbInfo, array(Db::getId(Project::PROJ_TABLE), 'filename'));
|
||||||
else $iMediaId = $this->oDb->insertRow(self::MEDIA_TABLE, $asDbInfo);
|
else $iMediaId = $this->oDb->insertRow(self::MEDIA_TABLE, $asDbInfo);
|
||||||
|
|
||||||
if(!$iMediaId) $sError = 'l\'image n\'a pas pu être entrée en base';
|
if(!$iMediaId) $sError = 'error_commit_db';
|
||||||
else {
|
else {
|
||||||
//Create thumbnail
|
//Create thumbnail
|
||||||
$this->getMediaThumbnail($sMediaName);
|
$this->getMediaThumbnail($sMediaName);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if($sError!='') {
|
return Spot::getResult(($sError==''), $sError, $asErrorParams);
|
||||||
$sError = 'Erreur lors de l\'ajout de "'.$sMediaName.'" : '.$sError;
|
|
||||||
$this->addError($sError);
|
|
||||||
}
|
|
||||||
|
|
||||||
return $sError;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -130,7 +130,6 @@ class Project extends PhpObject {
|
|||||||
|
|
||||||
$asProject['geofile'] = Spot::addTimestampToFilePath(Geo::getFilePath($asProject['geofile'], GeoJson::EXT));
|
$asProject['geofile'] = Spot::addTimestampToFilePath(Geo::getFilePath($asProject['geofile'], GeoJson::EXT));
|
||||||
$asProject['codename'] = $sCodeName;
|
$asProject['codename'] = $sCodeName;
|
||||||
$asProject['timezone_desc'] = Spot::getTimeZoneDesc($asProject['timezone']);
|
|
||||||
}
|
}
|
||||||
return $bSpecificProj?$asProject:$asProjects;
|
return $bSpecificProj?$asProject:$asProjects;
|
||||||
}
|
}
|
||||||
|
|||||||
27
inc/spot.php
27
inc/spot.php
@@ -19,8 +19,6 @@ class Spot extends Main
|
|||||||
//Database
|
//Database
|
||||||
const POST_TABLE = 'posts';
|
const POST_TABLE = 'posts';
|
||||||
|
|
||||||
const FORMAT_TIME = 'd/m/Y à H:i';
|
|
||||||
|
|
||||||
const FEED_CHUNK_SIZE = 15;
|
const FEED_CHUNK_SIZE = 15;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -126,9 +124,7 @@ class Spot extends Main
|
|||||||
'consts' => array(
|
'consts' => array(
|
||||||
'geo_server' => Settings::GEO_SERVER,
|
'geo_server' => Settings::GEO_SERVER,
|
||||||
'modes' => Project::MODES,
|
'modes' => Project::MODES,
|
||||||
'site_timezone' => Settings::TIMEZONE,
|
'site_timezone' => Settings::TIMEZONE
|
||||||
'site_timezone_desc' => self::getTimeZoneDesc(Settings::TIMEZONE),
|
|
||||||
'trans' => $this->oLang->getTranslations()
|
|
||||||
)
|
)
|
||||||
),
|
),
|
||||||
'index',
|
'index',
|
||||||
@@ -225,7 +221,7 @@ class Spot extends Main
|
|||||||
foreach($asMedias as $iIndex=>$asMedia) {
|
foreach($asMedias as $iIndex=>$asMedia) {
|
||||||
$sTimeRef = $asMedia[$sTimeRefField];
|
$sTimeRef = $asMedia[$sTimeRefField];
|
||||||
if($sTimeRef >= $this->oProject->getActivePeriod('from') && $sTimeRef <= $this->oProject->getActivePeriod('to')) {
|
if($sTimeRef >= $this->oProject->getActivePeriod('from') && $sTimeRef <= $this->oProject->getActivePeriod('to')) {
|
||||||
$asMedia['taken_on_formatted'] = date(self::FORMAT_TIME, strtotime($asMedia['taken_on']));
|
$asMedia['taken_on_formatted'] = $this->getTimeFormat(strtotime($asMedia['taken_on']));
|
||||||
$asMedia['displayed_id'] = 'N°'.($iIndex + 1);
|
$asMedia['displayed_id'] = 'N°'.($iIndex + 1);
|
||||||
|
|
||||||
$this->addTimeStamp($asMedia, strtotime($sTimeRef));
|
$this->addTimeStamp($asMedia, strtotime($sTimeRef));
|
||||||
@@ -263,8 +259,8 @@ class Spot extends Main
|
|||||||
|
|
||||||
private function addTimeStamp(&$asData, $iTime) {
|
private function addTimeStamp(&$asData, $iTime) {
|
||||||
$asData['unix_time'] = (int) $iTime;
|
$asData['unix_time'] = (int) $iTime;
|
||||||
$asData['relative_time'] = Toolbox::getDateTimeDesc($iTime, 'fr');
|
$asData['relative_time'] = Toolbox::getDateTimeDesc($iTime, $this->oLang->getLanguage());
|
||||||
$asData['formatted_time'] = date(self::FORMAT_TIME, $iTime);
|
$asData['formatted_time'] = $this->getTimeFormat($iTime);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getNewsFeed($iChunk=0)
|
public function getNewsFeed($iChunk=0)
|
||||||
@@ -328,7 +324,7 @@ class Spot extends Main
|
|||||||
public function upload()
|
public function upload()
|
||||||
{
|
{
|
||||||
$this->oClassManagement->incClass('uploader', true);
|
$this->oClassManagement->incClass('uploader', true);
|
||||||
$oUploader = new Uploader($this->oMedia);
|
$oUploader = new Uploader($this->oMedia, $this->oLang);
|
||||||
|
|
||||||
return $oUploader->sBody;
|
return $oUploader->sBody;
|
||||||
}
|
}
|
||||||
@@ -355,7 +351,7 @@ class Spot extends Main
|
|||||||
$bSuccess = $this->oProject->setTimeZone($sValue);
|
$bSuccess = $this->oProject->setTimeZone($sValue);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if(!$bSuccess) $sDesc = 'Issue committing to DB';
|
if(!$bSuccess) $sDesc = Mask::LANG_PREFIX.'error_commit_db';
|
||||||
|
|
||||||
return self::getJsonResult($bSuccess, $sDesc, array('values'=>$this->oProject->getProject()));
|
return self::getJsonResult($bSuccess, $sDesc, array('values'=>$this->oProject->getProject()));
|
||||||
}
|
}
|
||||||
@@ -380,10 +376,9 @@ class Spot extends Main
|
|||||||
return $iDegree.'°'.$iMinute.'\''.$fSecond.'"'.$sDirection;
|
return $iDegree.'°'.$iMinute.'\''.$fSecond.'"'.$sDirection;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function getTimeZoneDesc($sTimeZone) {
|
public function getTimeFormat($iTime) {
|
||||||
$sCity = substr(strrchr($sTimeZone, '/'), 1);
|
$sDate = date('d/m/Y', $iTime);
|
||||||
return 'heure d'.(in_array(strtolower(substr($sCity, 0, 1)), array('a', 'e', 'i', 'o', 'u', 'h'))?'\'':'e ').$sCity;
|
$sTime = date('H:i', $iTime);
|
||||||
|
return $this->oLang->getTranslation('date_time', array($sDate, $sTime));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
|
||||||
@@ -8,12 +8,18 @@ class Uploader extends UploadHandler
|
|||||||
*/
|
*/
|
||||||
private $oMedia;
|
private $oMedia;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Languages
|
||||||
|
* @var Translator
|
||||||
|
*/
|
||||||
|
private $oLang;
|
||||||
|
|
||||||
public $sBody;
|
public $sBody;
|
||||||
|
|
||||||
function __construct(&$oMedia)
|
function __construct(&$oMedia, &$oLang)
|
||||||
{
|
{
|
||||||
$this->error_messages['wrong_project_mode'] = 'Le projet n\'est pas en mode "blog".';
|
|
||||||
$this->oMedia = &$oMedia;
|
$this->oMedia = &$oMedia;
|
||||||
|
$this->oLang = &$oLang;
|
||||||
$this->sBody = '';
|
$this->sBody = '';
|
||||||
parent::__construct(array('image_versions'=>array(), 'accept_file_types'=>'/\.(gif|jpe?g|png|mov)$/i'));
|
parent::__construct(array('image_versions'=>array(), 'accept_file_types'=>'/\.(gif|jpe?g|png|mov)$/i'));
|
||||||
}
|
}
|
||||||
@@ -23,7 +29,7 @@ class Uploader extends UploadHandler
|
|||||||
|
|
||||||
//Check project mode
|
//Check project mode
|
||||||
if(!$this->oMedia->isProjectModeValid()) {
|
if(!$this->oMedia->isProjectModeValid()) {
|
||||||
$file->error = $this->get_error_message('wrong_project_mode');
|
$file->error = $this->get_error_message('upload_wrong_mode', array($this->oMedia->getProjectCodeName()));
|
||||||
$bResult = false;
|
$bResult = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -34,10 +40,8 @@ class Uploader extends UploadHandler
|
|||||||
$file = parent::handle_file_upload($uploaded_file, $name, $size, $type, $error, $index, $content_range);
|
$file = parent::handle_file_upload($uploaded_file, $name, $size, $type, $error, $index, $content_range);
|
||||||
|
|
||||||
if(empty($file->error)) {
|
if(empty($file->error)) {
|
||||||
$sError = $this->oMedia->addMedia($file->name);
|
$asResult = $this->oMedia->addMedia($file->name);
|
||||||
if($sError!='') {
|
if(!$asResult['result']) $file->error = $this->get_error_message($asResult['desc'], $asResult['data']);
|
||||||
$file->error = $this->get_error_message($sError);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return $file;
|
return $file;
|
||||||
@@ -46,6 +50,13 @@ class Uploader extends UploadHandler
|
|||||||
protected function body($sBodyPart) {
|
protected function body($sBodyPart) {
|
||||||
$this->sBody .= $sBodyPart;
|
$this->sBody .= $sBodyPart;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected function get_error_message($sError, $asParams=array()) {
|
||||||
|
$sTranslatedError = $this->oLang->getTranslation($sError, $asParams);
|
||||||
|
if($sTranslatedError) return $sTranslatedError;
|
||||||
|
elseif(array_key_exists($sError, $this->error_messages)) return $this->error_messages[$sError];
|
||||||
|
else return $sError;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
@@ -1 +1,46 @@
|
|||||||
page_og_desc=Keep contact with François when he is off hiking
|
locale = en_NZ
|
||||||
|
page_og_desc = Keep contact with François when he is off hiking
|
||||||
|
error_commit_db = Issue committing to DB
|
||||||
|
|
||||||
|
admin_save_success = Saved
|
||||||
|
|
||||||
|
track_main = Main track
|
||||||
|
track_offtrack = Off-track
|
||||||
|
track_hitchhiking = Hitchhiking
|
||||||
|
|
||||||
|
upload_title = Picture & Video Uploads
|
||||||
|
upload_wrong_mode = Project "$0" is not in blog mode. No upload allowed
|
||||||
|
upload_success = $0 uploaded successfully
|
||||||
|
upload_media_exist = Picture $0 already exists
|
||||||
|
|
||||||
|
post_message = Message
|
||||||
|
post_name = Name
|
||||||
|
post_new_message = New message
|
||||||
|
and = and
|
||||||
|
|
||||||
|
map_satellite = Satellite
|
||||||
|
map_otm = Open Topo Map
|
||||||
|
map_ign_france = IGN (France)
|
||||||
|
map_ign_spain = IGN (Spain)
|
||||||
|
map_linz = LINZ (New Zealand)
|
||||||
|
|
||||||
|
pic = Picture
|
||||||
|
pics = Pictures
|
||||||
|
pic_taken = taken on $0
|
||||||
|
video = Video
|
||||||
|
video_taken = shot on $0
|
||||||
|
add_on = added on $0
|
||||||
|
click_watch = Click to watch video
|
||||||
|
click_zoom = Click to zoom
|
||||||
|
media_count = Media $0 / $1
|
||||||
|
|
||||||
|
city_time = $0 time
|
||||||
|
|
||||||
|
project = Project
|
||||||
|
mode = Mode
|
||||||
|
code_name = Code name
|
||||||
|
start = Start
|
||||||
|
end = End
|
||||||
|
|
||||||
|
date_time = $0 at $1
|
||||||
|
time_zone = Time zone
|
||||||
@@ -1 +1,46 @@
|
|||||||
page_og_desc=Gardez le contact avec François lorsqu'il part sur les chemins
|
locale = fr_FR
|
||||||
|
page_og_desc = Gardez le contact avec François lorsqu'il part sur les chemins
|
||||||
|
error_commit_db = Error lors de la requête SQL
|
||||||
|
|
||||||
|
admin_save_success = Sauvegardé
|
||||||
|
|
||||||
|
track_main = Trajet principal
|
||||||
|
track_offtrack = Variante
|
||||||
|
track_hitchhiking = Hors rando
|
||||||
|
|
||||||
|
upload_title = Uploader photos & vidéos
|
||||||
|
upload_wrong_mode = Le projet "$0" n'est pas en mode blog. Aucun upload possible
|
||||||
|
upload_success = $0 a été uploadé
|
||||||
|
upload_media_exist = l'image $0 existe déjà
|
||||||
|
|
||||||
|
post_message = Message
|
||||||
|
post_name = Nom
|
||||||
|
post_new_message = Nouveau message
|
||||||
|
and = et
|
||||||
|
|
||||||
|
map_satellite = Satellite
|
||||||
|
map_otm = Open Topo Map
|
||||||
|
map_ign_france = IGN (France)
|
||||||
|
map_ign_spain = IGN (Espagne)
|
||||||
|
map_linz = LINZ (Nouvelle-Zélande)
|
||||||
|
|
||||||
|
pic = Photo
|
||||||
|
pics = Photos
|
||||||
|
pic_taken = prise le $0
|
||||||
|
video = Vidéo
|
||||||
|
video_taken = filmée le $0
|
||||||
|
add_on = ajoutée le $0
|
||||||
|
click_watch = Click pour voir la vidéo
|
||||||
|
click_zoom = Click pour zoomer
|
||||||
|
media_count = Média $0 sur $1
|
||||||
|
|
||||||
|
city_time = heure de $0
|
||||||
|
|
||||||
|
project = Projet
|
||||||
|
mode = Mode
|
||||||
|
code_name = Nom de code
|
||||||
|
start = Départ
|
||||||
|
end = Arrivée
|
||||||
|
|
||||||
|
date_time = $0 à $1
|
||||||
|
time_zone = Fuseau horaire
|
||||||
@@ -2,12 +2,12 @@
|
|||||||
<div id="projects">
|
<div id="projects">
|
||||||
<table>
|
<table>
|
||||||
<tr>
|
<tr>
|
||||||
<th>Project</th>
|
<th>[#]lang:project[#]</th>
|
||||||
<th>Mode</th>
|
<th>[#]lang:mode[#]</th>
|
||||||
<th>Code Name</th>
|
<th>[#]lang:code_name[#]</th>
|
||||||
<th>Start</th>
|
<th>[#]lang:start[#]</th>
|
||||||
<th>End</th>
|
<th>[#]lang:end[#]</th>
|
||||||
<th>Time Zone</th>
|
<th>[#]lang:time_zone[#]</th>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
@@ -25,7 +25,7 @@ oSpot.pageInit = function(asHash) {
|
|||||||
|
|
||||||
oSpot.onFeedback = function(sType, sMsg, asContext) {
|
oSpot.onFeedback = function(sType, sMsg, asContext) {
|
||||||
delete asContext.a;
|
delete asContext.a;
|
||||||
sMsg += ' (context: ';
|
sMsg += ' (';
|
||||||
$.each(asContext, function(sKey, sElem) {
|
$.each(asContext, function(sKey, sElem) {
|
||||||
sMsg += sKey+'='+sElem+' / ' ;
|
sMsg += sKey+'='+sElem+' / ' ;
|
||||||
});
|
});
|
||||||
@@ -65,7 +65,7 @@ function commit(event, $This) {
|
|||||||
self.get(
|
self.get(
|
||||||
'set_admin',
|
'set_admin',
|
||||||
function(asData){
|
function(asData){
|
||||||
oSpot.onFeedback('success', 'Sauvegarde OK', asInputs);
|
oSpot.onFeedback('success', self.lang('admin_save_success'), asInputs);
|
||||||
setProjects([asData.values]);
|
setProjects([asData.values]);
|
||||||
},
|
},
|
||||||
asInputs,
|
asInputs,
|
||||||
|
|||||||
@@ -9,6 +9,7 @@
|
|||||||
<meta property="og:type" content="website" />
|
<meta property="og:type" content="website" />
|
||||||
<meta property="og:url" content="[#]host_url[#]" />
|
<meta property="og:url" content="[#]host_url[#]" />
|
||||||
<meta property="og:image" content="images/ogp.png" />
|
<meta property="og:image" content="images/ogp.png" />
|
||||||
|
<meta property="og:locale" content="[#]lang:locale[#]" />
|
||||||
<link rel="apple-touch-icon" sizes="180x180" href="images/icons/apple-touch-icon.png?v=GvmqYyKwbb">
|
<link rel="apple-touch-icon" sizes="180x180" href="images/icons/apple-touch-icon.png?v=GvmqYyKwbb">
|
||||||
<link rel="icon" type="image/png" sizes="32x32" href="images/icons/favicon-32x32.png?v=GvmqYyKwbb">
|
<link rel="icon" type="image/png" sizes="32x32" href="images/icons/favicon-32x32.png?v=GvmqYyKwbb">
|
||||||
<link rel="icon" type="image/png" sizes="16x16" href="images/icons/favicon-16x16.png?v=GvmqYyKwbb">
|
<link rel="icon" type="image/png" sizes="16x16" href="images/icons/favicon-16x16.png?v=GvmqYyKwbb">
|
||||||
|
|||||||
@@ -13,9 +13,9 @@
|
|||||||
<div id="elems">
|
<div id="elems">
|
||||||
<div id="post-button"><i class="fa fa-fw"></i></div>
|
<div id="post-button"><i class="fa fa-fw"></i></div>
|
||||||
<div id="legend" class="leaflet-control-layers leaflet-control leaflet-control-layers-expanded">
|
<div id="legend" class="leaflet-control-layers leaflet-control leaflet-control-layers-expanded">
|
||||||
<div class="track"><span class="line main"></span><span class="desc">Trajet principal</span></div>
|
<div class="track"><span class="line main"></span><span class="desc">[#]lang:track_main[#]</span></div>
|
||||||
<div class="track"><span class="line off-track"></span><span class="desc">Variante</span></div>
|
<div class="track"><span class="line off-track"></span><span class="desc">[#]lang:track_offtrack[#]</span></div>
|
||||||
<div class="track"><span class="line hitchhiking"></span><span class="desc">Hors rando</span></div>
|
<div class="track"><span class="line hitchhiking"></span><span class="desc">[#]lang:track_hitchhiking[#]</span></div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -87,7 +87,7 @@ function initPage(asHash) {
|
|||||||
//Lightbox options
|
//Lightbox options
|
||||||
lightbox.option({
|
lightbox.option({
|
||||||
alwaysShowNavOnTouchDevices: true,
|
alwaysShowNavOnTouchDevices: true,
|
||||||
albumLabel: "Média %1 sur %2",
|
albumLabel: oSpot.lang('media_count', ['%1', '%2']),
|
||||||
fadeDuration: 300,
|
fadeDuration: 300,
|
||||||
imageFadeDuration: 400,
|
imageFadeDuration: 400,
|
||||||
resizeDuration: 600,
|
resizeDuration: 600,
|
||||||
@@ -128,8 +128,8 @@ function initProject(sProjectCodeName){
|
|||||||
|
|
||||||
//Timezone difference notice
|
//Timezone difference notice
|
||||||
var bSameTZ = (oSpot.consts.site_timezone == oSpot.vars(['project', 'timezone']));
|
var bSameTZ = (oSpot.consts.site_timezone == oSpot.vars(['project', 'timezone']));
|
||||||
self.tmp('site_tz_notice', bSameTZ?'':' ('+oSpot.consts.site_timezone_desc+')');
|
self.tmp('site_tz_notice', bSameTZ?'':' ('+getTimeZoneDesc(oSpot.consts.site_timezone)+')');
|
||||||
self.tmp('proj_tz_notice', bSameTZ?'':' ('+self.vars(['project', 'timezone_desc'])+')');
|
self.tmp('proj_tz_notice', bSameTZ?'':' ('+getTimeZoneDesc(self.vars(['project', 'timezone']))+')');
|
||||||
|
|
||||||
$.when(
|
$.when(
|
||||||
//Markers: Spot Messages & Medias
|
//Markers: Spot Messages & Medias
|
||||||
@@ -160,7 +160,7 @@ function initPosts() {
|
|||||||
var asPoster = {
|
var asPoster = {
|
||||||
type: 'poster',
|
type: 'poster',
|
||||||
formatted_time: '',
|
formatted_time: '',
|
||||||
relative_time: 'Nouveau message'
|
relative_time: oSpot.lang('post_new_message')
|
||||||
};
|
};
|
||||||
getPost(asPoster).appendTo($Poster.show());
|
getPost(asPoster).appendTo($Poster.show());
|
||||||
|
|
||||||
@@ -207,15 +207,16 @@ function getElevWidth() {
|
|||||||
function initSpotMessages(aoMessages, aoTracks) {
|
function initSpotMessages(aoMessages, aoTracks) {
|
||||||
|
|
||||||
//Tile layers
|
//Tile layers
|
||||||
var oMapBoxSat = L.tileLayer(self.tmp('tile_api'), {id: 'mapbox.satellite-streets', minZoom: 0, maxZoom: 19}),
|
aoLayers = {};
|
||||||
oOpenTopoMap = L.tileLayer(self.tmp('tile_api'), {id: 'opentopomap', minZoom: 2, maxZoom: 19}),
|
aoLayers[oSpot.lang('map_satellite')] = L.tileLayer(self.tmp('tile_api'), {id: 'mapbox.satellite-streets', minZoom: 0, maxZoom: 19});
|
||||||
oIgnSpain = L.tileLayer(self.tmp('tile_api'), {id: 'ign.es', minZoom: 1, maxZoom: 20}),
|
aoLayers[oSpot.lang('map_otm')] = L.tileLayer(self.tmp('tile_api'), {id: 'opentopomap', minZoom: 2, maxZoom: 19});
|
||||||
oIgnFrance = L.tileLayer(self.tmp('tile_api'), {id: 'ign.fr', minZoom: 0, maxZoom: 18, tileSize: 256}),
|
aoLayers[oSpot.lang('map_ign_france')] = L.tileLayer(self.tmp('tile_api'), {id: 'ign.fr', minZoom: 0, maxZoom: 18, tileSize: 256});
|
||||||
oLinz = L.tileLayer(self.tmp('tile_api'), {id: 'linz', maxZoom: 17, continuousWorld: true, attribution: 'Sourced from LINZ. CC BY 4.0'});
|
aoLayers[oSpot.lang('map_ign_spain')] = L.tileLayer(self.tmp('tile_api'), {id: 'ign.es', minZoom: 1, maxZoom: 20});
|
||||||
|
aoLayers[oSpot.lang('map_linz')] = L.tileLayer(self.tmp('tile_api'), {id: 'linz', maxZoom: 17, continuousWorld: true, attribution: 'Sourced from LINZ. CC BY 4.0'});
|
||||||
|
|
||||||
//Map
|
//Map
|
||||||
var oMap = L.map(self.tmp('$Map')[0], {
|
var oMap = L.map(self.tmp('$Map')[0], {
|
||||||
layers: [oMapBoxSat],
|
layers: [aoLayers[oSpot.lang('map_satellite')]],
|
||||||
attributionControl: false,
|
attributionControl: false,
|
||||||
zoomControl: false
|
zoomControl: false
|
||||||
});
|
});
|
||||||
@@ -274,18 +275,8 @@ function initSpotMessages(aoMessages, aoTracks) {
|
|||||||
}).addTo(oMap);
|
}).addTo(oMap);
|
||||||
self.tmp('elev', oElev);
|
self.tmp('elev', oElev);
|
||||||
|
|
||||||
//Controls: Tiles
|
//Controls: Tiles (layers)
|
||||||
L.control.layers(
|
L.control.layers(aoLayers, null, {position: 'topleft'}).addTo(oMap);
|
||||||
{
|
|
||||||
'Satellite': oMapBoxSat,
|
|
||||||
'Open Topo Map': oOpenTopoMap,
|
|
||||||
'IGN (France)': oIgnFrance,
|
|
||||||
'IGN (Espagne)': oIgnSpain,
|
|
||||||
'LINZ (Nouvelle-Zélande)': oLinz
|
|
||||||
},
|
|
||||||
null,
|
|
||||||
{position: 'topleft'}
|
|
||||||
).addTo(oMap);
|
|
||||||
|
|
||||||
//Tracks, colors & popup
|
//Tracks, colors & popup
|
||||||
var oTracks = L.geoJson(aoTracks, {
|
var oTracks = L.geoJson(aoTracks, {
|
||||||
@@ -404,14 +395,14 @@ function initSpotMessages(aoMessages, aoTracks) {
|
|||||||
href: asMedia.media_path,
|
href: asMedia.media_path,
|
||||||
'data-lightbox': 'marker-medias',
|
'data-lightbox': 'marker-medias',
|
||||||
'data-video': (bVideo?'true':'false'),
|
'data-video': (bVideo?'true':'false'),
|
||||||
'data-title': (bVideo?'Vidéo':'Photo')+' prise le '+asMedia.formatted_time+self.tmp('site_tz_notice'),
|
'data-title': oSpot.lang(bVideo?'video':'pic')+' '+oSpot.lang(bVideo?'video_taken':'pic_taken', [asMedia.formatted_time+self.tmp('site_tz_notice')]),
|
||||||
'data-orientation': asMedia.rotate})
|
'data-orientation': asMedia.rotate})
|
||||||
.append($('<img>', {'src': asMedia.thumb_path}))
|
.append($('<img>', {'src': asMedia.thumb_path}))
|
||||||
.append($('<span>', {'class': 'drill-icon'}).addIcon('fa-drill-'+(bVideo?'video':'picture')))
|
.append($('<span>', {'class': 'drill-icon'}).addIcon('fa-drill-'+(bVideo?'video':'picture')))
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
$Tooltip
|
$Tooltip
|
||||||
.append($('<p>').addIcon('fa-media fa-fw fa-lg').append('Photos'))
|
.append($('<p>').addIcon('fa-media fa-fw fa-lg').append(oSpot.lang('pics')))
|
||||||
.append($Medias);
|
.append($Medias);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -493,7 +484,7 @@ function getPost(asPost) {
|
|||||||
.append($('<p>').addIcon('fa-coords', true).append(asPost.lat_dms+' '+asPost.lon_dms))
|
.append($('<p>').addIcon('fa-coords', true).append(asPost.lat_dms+' '+asPost.lon_dms))
|
||||||
.append($('<p>').addIcon('fa-time', true).append(sAbsTime+self.tmp('site_tz_notice')))
|
.append($('<p>').addIcon('fa-time', true).append(sAbsTime+self.tmp('site_tz_notice')))
|
||||||
.append($('<a>', {'class':'drill'})
|
.append($('<a>', {'class':'drill'})
|
||||||
.append($('<img>', {'class':'staticmap', title: 'Click pour zoomer', src: getWmtsApiUrl('static', asPost.latitude, asPost.longitude, 13)}))
|
.append($('<img>', {'class':'staticmap', title: oSpot.lang('click_zoom'), src: getWmtsApiUrl('static', asPost.latitude, asPost.longitude, 13)}))
|
||||||
.append($('<span>', {'class': 'drill-icon fa-stack'})
|
.append($('<span>', {'class': 'drill-icon fa-stack'})
|
||||||
.addIcon('fa-message-in fa-stack-1x fa-rotate-270')
|
.addIcon('fa-message-in fa-stack-1x fa-rotate-270')
|
||||||
.addIcon('fa-message fa-stack-2x')
|
.addIcon('fa-message fa-stack-2x')
|
||||||
@@ -518,14 +509,14 @@ function getPost(asPost) {
|
|||||||
break;
|
break;
|
||||||
case 'media':
|
case 'media':
|
||||||
var bVideo = (asPost.subtype == 'video');
|
var bVideo = (asPost.subtype == 'video');
|
||||||
var sTakenOn = (asPost.taken_on == '0000-00-00 00:00:00')?'':' et prise le '+asPost.taken_on_formatted+self.tmp('site_tz_notice');
|
var sTakenOn = (asPost.taken_on == '0000-00-00 00:00:00')?'':(' '+oSpot.lang('and')+' '+oSpot.lang(bVideo?'video_taken':'pic_taken', [asPost.taken_on_formatted+self.tmp('site_tz_notice')]));
|
||||||
var $Image = $('<img>', {'src': asPost.thumb_path, title: bVideo?'Click pour voir la vidéo':'Click pour zoomer'});
|
var $Image = $('<img>', {'src': asPost.thumb_path, title: oSpot.lang(bVideo?'click_watch':'click_zoom')});
|
||||||
$Body = $('<a>', {
|
$Body = $('<a>', {
|
||||||
'class': 'drill',
|
'class': 'drill',
|
||||||
href: asPost.media_path,
|
href: asPost.media_path,
|
||||||
'data-video': (bVideo?'true':'false'),
|
'data-video': (bVideo?'true':'false'),
|
||||||
'data-lightbox': 'post-medias',
|
'data-lightbox': 'post-medias',
|
||||||
'data-title': (bVideo?'Vidéo':'Photo')+' ajoutée le '+sAbsTime+sTakenOn, 'data-orientation': asPost.rotate
|
'data-title': oSpot.lang(bVideo?'video':'pic')+' '+oSpot.lang('add_on', [sAbsTime+sTakenOn]), 'data-orientation': asPost.rotate
|
||||||
}).append($Image).append($('<span>', {'class': 'drill-icon'}).addIcon('fa-drill-'+(bVideo?'video':'picture')));
|
}).append($Image).append($('<span>', {'class': 'drill-icon'}).addIcon('fa-drill-'+(bVideo?'video':'picture')));
|
||||||
break;
|
break;
|
||||||
case 'post':
|
case 'post':
|
||||||
@@ -535,8 +526,8 @@ function getPost(asPost) {
|
|||||||
break;
|
break;
|
||||||
case 'poster':
|
case 'poster':
|
||||||
$Body = $('<p>', {'class':'message'})
|
$Body = $('<p>', {'class':'message'})
|
||||||
.append($('<textarea>', {id:'post', name:'post', placeholder:'Message', 'class':'autoExpand', rows:'1'}))
|
.append($('<textarea>', {id:'post', name:'post', placeholder:oSpot.lang('post_message'), 'class':'autoExpand', rows:'1'}))
|
||||||
.append($('<input>', {type:'text', id:'name', name:'name', placeholder:'Nom'}))
|
.append($('<input>', {type:'text', id:'name', name:'name', placeholder:oSpot.lang('post_name')}))
|
||||||
.append($('<button>', {type:'button', id:'submit', name:'submit'}).addIcon('fa-send'));
|
.append($('<button>', {type:'button', id:'submit', name:'submit'}).addIcon('fa-send'));
|
||||||
break;
|
break;
|
||||||
case 'loading':
|
case 'loading':
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
<div id="upload">
|
<div id="upload">
|
||||||
<h1>Picture & Video Uploads</h1>
|
<h1>[#]lang:upload_title[#]</h1>
|
||||||
<input id="fileupload" type="file" name="files[]" multiple>
|
<input id="fileupload" type="file" name="files[]" multiple>
|
||||||
<div id="progress">
|
<div id="progress">
|
||||||
<div class="bar" style="width: 0%;"></div>
|
<div class="bar" style="width: 0%;"></div>
|
||||||
@@ -18,8 +18,11 @@ oSpot.pageInit = function(asHash)
|
|||||||
acceptFileTypes: /(\.|\/)(gif|jpe?g|png|mov)$/i,
|
acceptFileTypes: /(\.|\/)(gif|jpe?g|png|mov)$/i,
|
||||||
done: function (e, asData) {
|
done: function (e, asData) {
|
||||||
var $Status = $('#status');
|
var $Status = $('#status');
|
||||||
|
|
||||||
|
console.log(asData);
|
||||||
|
|
||||||
$.each(asData.result.files, function(iKey, oFile) {
|
$.each(asData.result.files, function(iKey, oFile) {
|
||||||
var sMsg = ('error' in oFile)?oFile.error:(oFile.name+" uploaded successfully");
|
var sMsg = ('error' in oFile)?oFile.error:(self.lang('upload_success', [oFile.name]));
|
||||||
$Status.append($('<p>').text(sMsg));
|
$Status.append($('<p>').text(sMsg));
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
@@ -29,6 +32,6 @@ oSpot.pageInit = function(asHash)
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
else $('#messages').empty().append('Le projet "'+asProject.name+'" n\'est pas en mode blog. Aucun upload possible.');
|
else $('#status').empty().append(self.lang('upload_wrong_mode', [asProject.name]));
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
@@ -5,8 +5,7 @@
|
|||||||
* php-imagick
|
* php-imagick
|
||||||
* ffprobe (ffmpeg)
|
* ffprobe (ffmpeg)
|
||||||
## To Do List
|
## To Do List
|
||||||
* require js
|
* import/export
|
||||||
* Languages (front end with json)
|
|
||||||
* Convert all time to browser timezone
|
* Convert all time to browser timezone
|
||||||
* Reset zoom on image closing (lightbox)
|
* Reset zoom on image closing (lightbox)
|
||||||
* Optimize mobile image size (lightbox)
|
* Optimize mobile image size (lightbox)
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ function Spot(asGlobals)
|
|||||||
this.consts.hash_sep = '-';
|
this.consts.hash_sep = '-';
|
||||||
this.consts.title = 'Spotty';
|
this.consts.title = 'Spotty';
|
||||||
this.consts.default_page = 'project';
|
this.consts.default_page = 'project';
|
||||||
|
//this.consts.timezone = Intl.DateTimeFormat().resolvedOptions().timeZone;
|
||||||
|
|
||||||
/* Initialization */
|
/* Initialization */
|
||||||
|
|
||||||
@@ -77,6 +78,8 @@ function Spot(asGlobals)
|
|||||||
})
|
})
|
||||||
.done(function(oData)
|
.done(function(oData)
|
||||||
{
|
{
|
||||||
|
if(oData.desc.substr(0, self.consts.lang_prefix.length)==self.consts.lang_prefix) oData.desc = self.lang(oData.desc.substr(5));
|
||||||
|
|
||||||
if(oData.result==self.consts.error) fOnError(oData.desc);
|
if(oData.result==self.consts.error) fOnError(oData.desc);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -91,6 +94,20 @@ function Spot(asGlobals)
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
this.lang = function(sKey, asParams) {
|
||||||
|
asParams = asParams || [];
|
||||||
|
if($.type(asParams) == 'string') asParams = [asParams];
|
||||||
|
var sLang = '';
|
||||||
|
|
||||||
|
if(sKey in self.consts.lang) {
|
||||||
|
sLang = self.consts.lang[sKey];
|
||||||
|
for(i in asParams) sLang = sLang.replace('$'+i, asParams[i]);
|
||||||
|
}
|
||||||
|
else console.log('missing translation: '+sKey);
|
||||||
|
|
||||||
|
return sLang;
|
||||||
|
};
|
||||||
|
|
||||||
/* Page Switch - Trigger & Event catching */
|
/* Page Switch - Trigger & Event catching */
|
||||||
|
|
||||||
this.onHashChange = function()
|
this.onHashChange = function()
|
||||||
@@ -231,6 +248,11 @@ function setElem(aoAnchor, asPath, oValue)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function getTimeZoneDesc(sTimeZoneName) {
|
||||||
|
var sCity = sTimeZoneName.split('/')[1] || '';
|
||||||
|
return oSpot.lang('city_time', sCity);
|
||||||
|
}
|
||||||
|
|
||||||
$.prototype.addInput = function(sType, sName, sValue)
|
$.prototype.addInput = function(sType, sName, sValue)
|
||||||
{
|
{
|
||||||
return $(this).append($('<input>', {type: sType, name: sName, value: sValue}).data('old_value', sValue));
|
return $(this).append($('<input>', {type: sType, name: sName, value: sValue}).data('old_value', sValue));
|
||||||
|
|||||||
Reference in New Issue
Block a user