i18n
This commit is contained in:
@@ -32,6 +32,10 @@ class Media extends PhpObject {
|
||||
$this->sSystemType = (substr(php_uname(), 0, 7) == "Windows")?'win':'unix';
|
||||
}
|
||||
|
||||
public function getProjectCodeName() {
|
||||
return $this->oProject->getProjectCodeName();
|
||||
}
|
||||
|
||||
public function getMediasInfo() {
|
||||
if(empty($this->asMedias)) {
|
||||
if($this->oProject->getProjectId()) {
|
||||
@@ -57,8 +61,15 @@ class Media extends PhpObject {
|
||||
|
||||
public function addMedia($sMediaName, $sMethod='upload') {
|
||||
$sError = '';
|
||||
if(!$this->isProjectModeValid() && $sMethod!='sync') $sError = 'Le projet (id='.$this->oProject->getProjectId().') n\'est pas en mode "blog"';
|
||||
elseif($this->oDb->pingValue(self::MEDIA_TABLE, array('filename'=>$sMediaName)) && $sMethod!='sync') $sError = 'l\'image existe déjà';
|
||||
$asErrorParams = array();
|
||||
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 {
|
||||
//Add media to DB
|
||||
$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'));
|
||||
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 {
|
||||
//Create thumbnail
|
||||
$this->getMediaThumbnail($sMediaName);
|
||||
}
|
||||
}
|
||||
|
||||
if($sError!='') {
|
||||
$sError = 'Erreur lors de l\'ajout de "'.$sMediaName.'" : '.$sError;
|
||||
$this->addError($sError);
|
||||
}
|
||||
|
||||
return $sError;
|
||||
return Spot::getResult(($sError==''), $sError, $asErrorParams);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -130,7 +130,6 @@ class Project extends PhpObject {
|
||||
|
||||
$asProject['geofile'] = Spot::addTimestampToFilePath(Geo::getFilePath($asProject['geofile'], GeoJson::EXT));
|
||||
$asProject['codename'] = $sCodeName;
|
||||
$asProject['timezone_desc'] = Spot::getTimeZoneDesc($asProject['timezone']);
|
||||
}
|
||||
return $bSpecificProj?$asProject:$asProjects;
|
||||
}
|
||||
|
||||
27
inc/spot.php
27
inc/spot.php
@@ -19,8 +19,6 @@ class Spot extends Main
|
||||
//Database
|
||||
const POST_TABLE = 'posts';
|
||||
|
||||
const FORMAT_TIME = 'd/m/Y à H:i';
|
||||
|
||||
const FEED_CHUNK_SIZE = 15;
|
||||
|
||||
/**
|
||||
@@ -126,9 +124,7 @@ class Spot extends Main
|
||||
'consts' => array(
|
||||
'geo_server' => Settings::GEO_SERVER,
|
||||
'modes' => Project::MODES,
|
||||
'site_timezone' => Settings::TIMEZONE,
|
||||
'site_timezone_desc' => self::getTimeZoneDesc(Settings::TIMEZONE),
|
||||
'trans' => $this->oLang->getTranslations()
|
||||
'site_timezone' => Settings::TIMEZONE
|
||||
)
|
||||
),
|
||||
'index',
|
||||
@@ -225,7 +221,7 @@ class Spot extends Main
|
||||
foreach($asMedias as $iIndex=>$asMedia) {
|
||||
$sTimeRef = $asMedia[$sTimeRefField];
|
||||
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);
|
||||
|
||||
$this->addTimeStamp($asMedia, strtotime($sTimeRef));
|
||||
@@ -263,8 +259,8 @@ class Spot extends Main
|
||||
|
||||
private function addTimeStamp(&$asData, $iTime) {
|
||||
$asData['unix_time'] = (int) $iTime;
|
||||
$asData['relative_time'] = Toolbox::getDateTimeDesc($iTime, 'fr');
|
||||
$asData['formatted_time'] = date(self::FORMAT_TIME, $iTime);
|
||||
$asData['relative_time'] = Toolbox::getDateTimeDesc($iTime, $this->oLang->getLanguage());
|
||||
$asData['formatted_time'] = $this->getTimeFormat($iTime);
|
||||
}
|
||||
|
||||
public function getNewsFeed($iChunk=0)
|
||||
@@ -328,7 +324,7 @@ class Spot extends Main
|
||||
public function upload()
|
||||
{
|
||||
$this->oClassManagement->incClass('uploader', true);
|
||||
$oUploader = new Uploader($this->oMedia);
|
||||
$oUploader = new Uploader($this->oMedia, $this->oLang);
|
||||
|
||||
return $oUploader->sBody;
|
||||
}
|
||||
@@ -355,7 +351,7 @@ class Spot extends Main
|
||||
$bSuccess = $this->oProject->setTimeZone($sValue);
|
||||
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()));
|
||||
}
|
||||
@@ -380,10 +376,9 @@ class Spot extends Main
|
||||
return $iDegree.'°'.$iMinute.'\''.$fSecond.'"'.$sDirection;
|
||||
}
|
||||
|
||||
public static function getTimeZoneDesc($sTimeZone) {
|
||||
$sCity = substr(strrchr($sTimeZone, '/'), 1);
|
||||
return 'heure d'.(in_array(strtolower(substr($sCity, 0, 1)), array('a', 'e', 'i', 'o', 'u', 'h'))?'\'':'e ').$sCity;
|
||||
public function getTimeFormat($iTime) {
|
||||
$sDate = date('d/m/Y', $iTime);
|
||||
$sTime = date('H:i', $iTime);
|
||||
return $this->oLang->getTranslation('date_time', array($sDate, $sTime));
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
}
|
||||
@@ -8,12 +8,18 @@ class Uploader extends UploadHandler
|
||||
*/
|
||||
private $oMedia;
|
||||
|
||||
/**
|
||||
* Languages
|
||||
* @var Translator
|
||||
*/
|
||||
private $oLang;
|
||||
|
||||
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->oLang = &$oLang;
|
||||
$this->sBody = '';
|
||||
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
|
||||
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;
|
||||
}
|
||||
|
||||
@@ -34,10 +40,8 @@ class Uploader extends UploadHandler
|
||||
$file = parent::handle_file_upload($uploaded_file, $name, $size, $type, $error, $index, $content_range);
|
||||
|
||||
if(empty($file->error)) {
|
||||
$sError = $this->oMedia->addMedia($file->name);
|
||||
if($sError!='') {
|
||||
$file->error = $this->get_error_message($sError);
|
||||
}
|
||||
$asResult = $this->oMedia->addMedia($file->name);
|
||||
if(!$asResult['result']) $file->error = $this->get_error_message($asResult['desc'], $asResult['data']);
|
||||
}
|
||||
|
||||
return $file;
|
||||
@@ -46,6 +50,13 @@ class Uploader extends UploadHandler
|
||||
protected function body($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">
|
||||
<table>
|
||||
<tr>
|
||||
<th>Project</th>
|
||||
<th>Mode</th>
|
||||
<th>Code Name</th>
|
||||
<th>Start</th>
|
||||
<th>End</th>
|
||||
<th>Time Zone</th>
|
||||
<th>[#]lang:project[#]</th>
|
||||
<th>[#]lang:mode[#]</th>
|
||||
<th>[#]lang:code_name[#]</th>
|
||||
<th>[#]lang:start[#]</th>
|
||||
<th>[#]lang:end[#]</th>
|
||||
<th>[#]lang:time_zone[#]</th>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
@@ -25,7 +25,7 @@ oSpot.pageInit = function(asHash) {
|
||||
|
||||
oSpot.onFeedback = function(sType, sMsg, asContext) {
|
||||
delete asContext.a;
|
||||
sMsg += ' (context: ';
|
||||
sMsg += ' (';
|
||||
$.each(asContext, function(sKey, sElem) {
|
||||
sMsg += sKey+'='+sElem+' / ' ;
|
||||
});
|
||||
@@ -65,7 +65,7 @@ function commit(event, $This) {
|
||||
self.get(
|
||||
'set_admin',
|
||||
function(asData){
|
||||
oSpot.onFeedback('success', 'Sauvegarde OK', asInputs);
|
||||
oSpot.onFeedback('success', self.lang('admin_save_success'), asInputs);
|
||||
setProjects([asData.values]);
|
||||
},
|
||||
asInputs,
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
<meta property="og:type" content="website" />
|
||||
<meta property="og:url" content="[#]host_url[#]" />
|
||||
<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="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">
|
||||
|
||||
@@ -13,9 +13,9 @@
|
||||
<div id="elems">
|
||||
<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 class="track"><span class="line main"></span><span class="desc">Trajet principal</span></div>
|
||||
<div class="track"><span class="line off-track"></span><span class="desc">Variante</span></div>
|
||||
<div class="track"><span class="line hitchhiking"></span><span class="desc">Hors rando</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">[#]lang:track_offtrack[#]</span></div>
|
||||
<div class="track"><span class="line hitchhiking"></span><span class="desc">[#]lang:track_hitchhiking[#]</span></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -87,7 +87,7 @@ function initPage(asHash) {
|
||||
//Lightbox options
|
||||
lightbox.option({
|
||||
alwaysShowNavOnTouchDevices: true,
|
||||
albumLabel: "Média %1 sur %2",
|
||||
albumLabel: oSpot.lang('media_count', ['%1', '%2']),
|
||||
fadeDuration: 300,
|
||||
imageFadeDuration: 400,
|
||||
resizeDuration: 600,
|
||||
@@ -128,8 +128,8 @@ function initProject(sProjectCodeName){
|
||||
|
||||
//Timezone difference notice
|
||||
var bSameTZ = (oSpot.consts.site_timezone == oSpot.vars(['project', 'timezone']));
|
||||
self.tmp('site_tz_notice', bSameTZ?'':' ('+oSpot.consts.site_timezone_desc+')');
|
||||
self.tmp('proj_tz_notice', bSameTZ?'':' ('+self.vars(['project', 'timezone_desc'])+')');
|
||||
self.tmp('site_tz_notice', bSameTZ?'':' ('+getTimeZoneDesc(oSpot.consts.site_timezone)+')');
|
||||
self.tmp('proj_tz_notice', bSameTZ?'':' ('+getTimeZoneDesc(self.vars(['project', 'timezone']))+')');
|
||||
|
||||
$.when(
|
||||
//Markers: Spot Messages & Medias
|
||||
@@ -160,7 +160,7 @@ function initPosts() {
|
||||
var asPoster = {
|
||||
type: 'poster',
|
||||
formatted_time: '',
|
||||
relative_time: 'Nouveau message'
|
||||
relative_time: oSpot.lang('post_new_message')
|
||||
};
|
||||
getPost(asPoster).appendTo($Poster.show());
|
||||
|
||||
@@ -207,15 +207,16 @@ function getElevWidth() {
|
||||
function initSpotMessages(aoMessages, aoTracks) {
|
||||
|
||||
//Tile layers
|
||||
var oMapBoxSat = L.tileLayer(self.tmp('tile_api'), {id: 'mapbox.satellite-streets', minZoom: 0, maxZoom: 19}),
|
||||
oOpenTopoMap = L.tileLayer(self.tmp('tile_api'), {id: 'opentopomap', minZoom: 2, maxZoom: 19}),
|
||||
oIgnSpain = L.tileLayer(self.tmp('tile_api'), {id: 'ign.es', minZoom: 1, maxZoom: 20}),
|
||||
oIgnFrance = 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 = {};
|
||||
aoLayers[oSpot.lang('map_satellite')] = L.tileLayer(self.tmp('tile_api'), {id: 'mapbox.satellite-streets', minZoom: 0, maxZoom: 19});
|
||||
aoLayers[oSpot.lang('map_otm')] = L.tileLayer(self.tmp('tile_api'), {id: 'opentopomap', minZoom: 2, maxZoom: 19});
|
||||
aoLayers[oSpot.lang('map_ign_france')] = L.tileLayer(self.tmp('tile_api'), {id: 'ign.fr', minZoom: 0, maxZoom: 18, tileSize: 256});
|
||||
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
|
||||
var oMap = L.map(self.tmp('$Map')[0], {
|
||||
layers: [oMapBoxSat],
|
||||
layers: [aoLayers[oSpot.lang('map_satellite')]],
|
||||
attributionControl: false,
|
||||
zoomControl: false
|
||||
});
|
||||
@@ -274,18 +275,8 @@ function initSpotMessages(aoMessages, aoTracks) {
|
||||
}).addTo(oMap);
|
||||
self.tmp('elev', oElev);
|
||||
|
||||
//Controls: Tiles
|
||||
L.control.layers(
|
||||
{
|
||||
'Satellite': oMapBoxSat,
|
||||
'Open Topo Map': oOpenTopoMap,
|
||||
'IGN (France)': oIgnFrance,
|
||||
'IGN (Espagne)': oIgnSpain,
|
||||
'LINZ (Nouvelle-Zélande)': oLinz
|
||||
},
|
||||
null,
|
||||
{position: 'topleft'}
|
||||
).addTo(oMap);
|
||||
//Controls: Tiles (layers)
|
||||
L.control.layers(aoLayers, null, {position: 'topleft'}).addTo(oMap);
|
||||
|
||||
//Tracks, colors & popup
|
||||
var oTracks = L.geoJson(aoTracks, {
|
||||
@@ -404,14 +395,14 @@ function initSpotMessages(aoMessages, aoTracks) {
|
||||
href: asMedia.media_path,
|
||||
'data-lightbox': 'marker-medias',
|
||||
'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})
|
||||
.append($('<img>', {'src': asMedia.thumb_path}))
|
||||
.append($('<span>', {'class': 'drill-icon'}).addIcon('fa-drill-'+(bVideo?'video':'picture')))
|
||||
);
|
||||
});
|
||||
$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);
|
||||
}
|
||||
|
||||
@@ -493,7 +484,7 @@ function getPost(asPost) {
|
||||
.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($('<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'})
|
||||
.addIcon('fa-message-in fa-stack-1x fa-rotate-270')
|
||||
.addIcon('fa-message fa-stack-2x')
|
||||
@@ -518,14 +509,14 @@ function getPost(asPost) {
|
||||
break;
|
||||
case 'media':
|
||||
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 $Image = $('<img>', {'src': asPost.thumb_path, title: bVideo?'Click pour voir la vidéo':'Click pour zoomer'});
|
||||
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: oSpot.lang(bVideo?'click_watch':'click_zoom')});
|
||||
$Body = $('<a>', {
|
||||
'class': 'drill',
|
||||
href: asPost.media_path,
|
||||
'data-video': (bVideo?'true':'false'),
|
||||
'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')));
|
||||
break;
|
||||
case 'post':
|
||||
@@ -535,8 +526,8 @@ function getPost(asPost) {
|
||||
break;
|
||||
case 'poster':
|
||||
$Body = $('<p>', {'class':'message'})
|
||||
.append($('<textarea>', {id:'post', name:'post', placeholder:'Message', 'class':'autoExpand', rows:'1'}))
|
||||
.append($('<input>', {type:'text', id:'name', name:'name', placeholder:'Nom'}))
|
||||
.append($('<textarea>', {id:'post', name:'post', placeholder:oSpot.lang('post_message'), 'class':'autoExpand', rows:'1'}))
|
||||
.append($('<input>', {type:'text', id:'name', name:'name', placeholder:oSpot.lang('post_name')}))
|
||||
.append($('<button>', {type:'button', id:'submit', name:'submit'}).addIcon('fa-send'));
|
||||
break;
|
||||
case 'loading':
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<div id="upload">
|
||||
<h1>Picture & Video Uploads</h1>
|
||||
<h1>[#]lang:upload_title[#]</h1>
|
||||
<input id="fileupload" type="file" name="files[]" multiple>
|
||||
<div id="progress">
|
||||
<div class="bar" style="width: 0%;"></div>
|
||||
@@ -18,8 +18,11 @@ oSpot.pageInit = function(asHash)
|
||||
acceptFileTypes: /(\.|\/)(gif|jpe?g|png|mov)$/i,
|
||||
done: function (e, asData) {
|
||||
var $Status = $('#status');
|
||||
|
||||
console.log(asData);
|
||||
|
||||
$.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));
|
||||
});
|
||||
},
|
||||
@@ -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>
|
||||
@@ -5,8 +5,7 @@
|
||||
* php-imagick
|
||||
* ffprobe (ffmpeg)
|
||||
## To Do List
|
||||
* require js
|
||||
* Languages (front end with json)
|
||||
* import/export
|
||||
* Convert all time to browser timezone
|
||||
* Reset zoom on image closing (lightbox)
|
||||
* Optimize mobile image size (lightbox)
|
||||
|
||||
@@ -5,6 +5,7 @@ function Spot(asGlobals)
|
||||
this.consts.hash_sep = '-';
|
||||
this.consts.title = 'Spotty';
|
||||
this.consts.default_page = 'project';
|
||||
//this.consts.timezone = Intl.DateTimeFormat().resolvedOptions().timeZone;
|
||||
|
||||
/* Initialization */
|
||||
|
||||
@@ -77,6 +78,8 @@ function Spot(asGlobals)
|
||||
})
|
||||
.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);
|
||||
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 */
|
||||
|
||||
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)
|
||||
{
|
||||
return $(this).append($('<input>', {type: sType, name: sName, value: sValue}).data('old_value', sValue));
|
||||
|
||||
Reference in New Issue
Block a user