POWERPOINT
+A FAIRE DE TOUTE URGENECE !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+- DIRECTIONS
+- Ne pas oublier de changer l'adresse dans détails - tup administration
+- ADRESSE PAS AFFICHEE / MAJ
+- Retour accueil : la map disparait
+- Corriger bug : gps automatique
+- Corriger bug : double tap nécessaire pour afficher adresse
+- Finir PPT
+- Détruire le ticket après envoi
+
+!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+
+
+
+
+
+
+
+
+
+
+
+local function mapAddressHandler( event )
+
+ -- on supprime tous les marqueurs déjà présents à chaque activation
+ map:removeAllMarkers()
+
+ -- on récupère la position de l'utilisateur
+ local location = map:getUserLocation()
+
+ -- on centre la map sur la position
+ map:setCenter( location.latitude, location.longitude, true )
+ -- on place le marqueur
+ map:addMarker( location.latitude, location.longitude )
+
+ -- on récupère les coordonnées pour l'envoi plus tard
+ coordT = ""..location.latitude..","..location.longitude
+
+ labelAdresse.text = "Recherche de votre position .."
+
+ if event.isError then
+ print( "mapView Error: " .. event.errorMessage )
+ labelAdresse.text = "Event.isError"
+ else
+ labelAdresse.text = "Recherche de votre position ..."
+ --print( "The specified location is in: " .. event.city .. ", " .. event.country )
+ number = event.streetDetail
+ street = event.street
+ postalCode = event.postalCode
+ city = event.city
+ country = event.country
+
+ -- on récupère l'adresse sur la carte
+ local k = ""..number..", "..street.." "..postalCode.." "..city.." "..country
+
+ -- on stocke l'adresse
+ adresseT = k
+
+ -- on tronque l'adresse pour éviter qu'elle prenne toute la place
+ if #k > 34 then
+
+ labelAdresse.text = k:sub(1,34).."..."
+
+ else labelAdresse.text = k
+
+ end
+ end
+end
+
+local function mapLocaliser()
+
+ -- on récupère l'adresse la plus proche des coordonnées GPS
+ local nearestAddress = map:nearestAddress( location.latitude, location.longitude, mapAddressHandler )
+ ticket.labelAdresse.text = adresseT
+
+end
+
+
+
+
+
+
+
+
+
+
+
TUP
+144x82 cm
+
+544 x 310
+570 x 320
+
+
+http://tup.url.ph/gestion/map.php?lat=NDUuNzMwODY4NjMyNjAwMDE0&lng=NS4wMDUxMzA3Njc4MjIyNjY=&myCoord=MzcuNDQ4NDg1LC0xMjIuMTU4OTEx&adresse=1OENADKPMEAL%22%20)
+
+
+!! Corriger bug GPS
+utiliser ça
+ Runtime:addEventListener( "location", locationHandler )
+
+
+
Présentation du projet
Qu'est-ce que TUP ?
Technologie employée : justification, etc.
+https://apps.wifirst.net/pictures/000/204/303/103881/204303/large/picture.jpg?1410028000
+https://apps.wifirst.net/pictures/000/204/302/103881/204302/large/picture.jpg?1410027998
-- bug bouton photo réglé
--
TRES IMPORTANT
-BUG PHOTO TICKET !!!
-ON OK -> VALIDER CONNEXION
-BUG ON ACCUEIL -> retour ticket : plus de map !!
+√ BUG PHOTO TICKET !!!
+
+~~ ON OK -> VALIDER CONNEXION
+
+√ BUG ON ACCUEIL -> retour ticket : plus de map !!
+
BOUTON ACCUEIL A DROITE SUR LISTETICKETSENCOURS
!!!! bouton retour : listener !!!
elseif ( phase == "did" ) then
+-- composer.removeScene( "Ecran_Accueil", true )
+
end
end
-- on désactive les écouteurs quand
-- la scène est sn train d'être changée
self.objet:disableListeners()
- -- destruction de la scène (avec recyclage)
- composer.removeScene( "Ecran_Gestion", false )
elseif ( phase == "did" ) then
+ -- destruction de la scène (avec recyclage)
+ composer.removeScene( "Ecran_Gestion", true )
+
end
end
-- Ecran_Ticket.lua
+local SX = display.screenOriginX -- Origine X
+local CX = display.contentCenterX -- Centre X
+
-- Chargement des modules
local composer = require( "composer" )
elseif ( phase == "did" ) then
--self.objet:enableListeners()
+ self.objet.map.x = SX + CX
end
function Accueil:new()
accueil = display.newGroup()
+accueil.nb = 0
local function initBackground()
ribbon:setFillColor( 0,0,0 )
ribbon.alpha = 0
- transition.to( ribbon, { time = 2000, y = logo.y + logo.height - 10, alpha = .5, transition = easing.outExpo })
+ transition.to( ribbon, { time = 2000, y = logo.y + logo.height - 10, alpha = .3, transition = easing.outExpo })
accueil:insert( ribbon )
accueil:insert( title )
+ local nb = display.newText( "Tickets disponibles : "..accueil.nb, 0, 0, "Dosis-Book", 14 )
+ nb.x = VW - nb.width/2 - 5
+ nb.y = VH - nb.height/2 - 5
+ accueil:insert( nb )
+ accueil.textNb = nb
+
end
+
+
local function initNbTicketsCallback(event)
if ( event.isError ) then
print("Network error!")
- native.showAlert( "Erreur réseau.", "Veuillez vérifier votre connexion internet." )
+ native.showAlert( "Erreur réseau.", "Veuillez vérifier votre connexion internet.", { "OK" } )
else
print("RESPONSE:" .. event.response)
local data = json.decode(event.response)
if (data.result == 200) then
-
-- nombre de tickets
- print(data.nb[1])
accueil.nb = data.nb[1]
-
+ accueil.textNb.text = "Tickets disponibles : "..accueil.nb
+ print(tonumber(accueil.nb)>0)
elseif (data.result == 403) then
accueil.nb = 0
print("Erreur")
end
+
+
+
end
end
end
db:close()
+
+
local url = "http://tup.url.ph/app/recup_nb_tickets.php?mail="..mime.b64(mail)
network.request(url, "GET", initNbTicketsCallback)
end
local function onCreerTicket( event )
- transition.to(accueil.tab,{time=100,x=accueil.tab.x,y=accueil.tab.y - accueil.tab.height})
- Runtime:dispatchEvent{ name = "MenuEvent", type = "ticket" }
+ if (tonumber(accueil.nb)>0) then
+ transition.to(accueil.tab,{time=100,x=accueil.tab.x,y=accueil.tab.y - accueil.tab.height})
+ Runtime:dispatchEvent{ name = "MenuEvent", type = "ticket" }
+ else
+ native.showAlert( "Repassez demain !", "Vous n'avez plus de tickets en stock.", { "OK" } )
+ end
end
--Runtime:addEventListener("enterFrame", frame)
-- transition d'entrée de la barre d'onglets
transition.to(accueil.tab,{time=100,x=tab.x,y=SY})
+ initNbTickets()
end
function accueil:disableListeners()
end
local mailField = native.newTextField( -100, -100, VW, tHeight )
- mailField.x=CX
- mailField.y=SY + 160
+ mailField.x = CX
+ mailField.y = SY + 160
mailField.inputType = "email"
mailField.placeholder = "Adresse mail"
mailField.size = inputFontSize + 6
-- on vérifie que l'adresse mail est correcte
if not ( mail:match("[A-Za-z0-9%.%%%+%-]+@[A-Za-z0-9%.%%%+%-]+%.%w%w%w?%w?")) then
- native.showAlert( "Erreur.", "Veuillez entrer une adresse mail correcte.", { "Oups !" } )
+ native.showAlert( "Erreur.", "Veuillez entrer une adresse mail correcte.", { "OK" } )
end
-- on vérifie que le mot de passe est bien entré
local function loginCallback(event)
if ( event.isError ) then
print("Network error!")
- native.showAlert( "Erreur réseau.", "Veuillez vérifier votre connexion internet." )
+ native.showAlert( "Erreur réseau.", "Veuillez vérifier votre connexion internet.", { "OK" } )
else
print("RESPONSE:" .. event.response)
local data = json.decode(event.response)
-- on vérifie que l'adresse mail est correcte
if not ( mail:match("[A-Za-z0-9%.%%%+%-]+@[A-Za-z0-9%.%%%+%-]+%.%w%w%w?%w?")) then
- native.showAlert( "Erreur.", "Veuillez entrer une adresse mail correcte.", { "Oups !" } )
+ native.showAlert( "Erreur.", "Veuillez entrer une adresse mail correcte.", { "OK" } )
end
-- on vérifie que le mot de passe est bien entré
{
width = 5/8 * VW,
height = 1/11 * VH,
+ fontSize = 14,
label = "Retour vers Connexion",
defaultFile = "blue_texture.png",
labelColor = { default = {1,1,1}, over = {0,0,0,.5} },
-- on vérifie que l'adresse mail est correcte
if not ( mail:match("[A-Za-z0-9%.%%%+%-]+@[A-Za-z0-9%.%%%+%-]+%.%w%w%w?%w?")) then
- native.showAlert( "Erreur.", "Veuillez entrer une adresse mail correcte.", { "Oups !" } )
+ native.showAlert( "Erreur.", "Veuillez entrer une adresse mail correcte.", { "OK" } )
else
local url = "http://tup.url.ph/app/change_pwd.php?mail="..mail
local changer = widget.newButton
{
shape = "rect",
- width = 250,
+ width = 260,
height = 30,
fillColor = { default = { 0, 0, 0, .5 }, over = { 0, 0, 0, .4 } },
label = "Obtenir un nouveau mot de passe",
+ labelColor = { default = { 1, 1, 1, .8 }, over = { 0, 0, 0, .4 } },
onPress = onSwitchPwd,
font = "Dosis-Book"
}
width = 200,
height = 30,
fillColor = { default = { 0, 0, 0, .5 }, over = { 0, 0, 0, .4 } },
- label = "Récuperer mot de passe",
+ label = "Récupérer mot de passe",
+ labelColor = { default = { 1, 1, 1, .8 }, over = { 0, 0, 0, .4 } },
onRelease = onChangePwd,
font = "Dosis-Book"
}
{
width = 5/8 * VW,
height = 1/11 * VH,
- label = "Se Connecter",
+ label = "Connexion",
defaultFile = "blue_texture.png",
labelColor = { default = {1,1,1}, over = {0,0,0,.5} },
onPress = onConnect,
{
width = 5/8 * VW,
height = 1/11 * VH,
- label = "S'inscrire >",
+ label = "Inscription >",
labelColor = { default = {1,1,1}, over = {0,0,0,.5} },
defaultFile = "vert.png",
onPress = onInscription,
width = 5/8 * VW,
height = 1/11 * VH,
sheet = buttonSheet,
- label = "S'inscrire",
+ label = "Inscription",
defaultFile = "vert.png",
labelColor = { default = {1,1,1}, over = {0,0,0,.5} },
onPress = onValidation,
width = 5/8 * VW,
height = 1/11 * VH,
sheet = buttonSheet,
- label = "Se Connecter >",
+ label = "Connexion >",
defaultFile = "blue_texture.png",
labelColor = { default = {1,1,1}, over = {0,0,0,.5} },
onPress = onConnect,
-- print ( "pas de ticket" )
local noTicket = display.newText( "Pas de ticket en cours.", CX, CY, "Dosis-Book", 20 )
+ noTicket:setFillColor( 0,0,0 )
listeTickets:insert( noTicket )
else
local function initButtons()
- local boutonRetour = display.newRect( 0, 0, 60, 40 )
- boutonRetour.alpha = .01
+ -- fonction de retour à l'accueil
+ local function onAccueil( event )
- boutonRetour.anchorX = 0
+ Runtime:dispatchEvent{ name = "MenuEvent", type = "accueilSlideRight" }
+
+ end
+ local boutonRetour = widget.newButton
+ {
+ shape = "rect",
+ width = 60,
+ height = 40,
+ font = "Dosis-Book",
+ fontSize = 14,
+ fillColor = { default = { 0, 0, 0, .1 }, over = { 0, 0, 0, .08 } },
+ label = "< Accueil",
+ labelColor = { default = { 1, 1, 1, 1 }, over = { 1, 1, 1, 1 } },
+ onRelease = onAccueil,
+ }
+ boutonRetour.alpha = 1
+ boutonRetour.anchorX = 0
boutonRetour.x = SX
boutonRetour.y = VH - boutonRetour.height/2
-
listeTickets:insert( boutonRetour )
listeTickets.boutonRetour = boutonRetour
-
- -- Action du bouton retour (vers l'accueil)
-
- function boutonRetour:touch( event )
-
- if event.phase == "began" then
-
- Runtime:dispatchEvent{ name = "MenuEvent", type = "accueilSlideRight" }
-
- end
-
- end
-
- local labelRetour = display.newText( "< Accueil", 8, SY + VH - 20, "Dosis-Book", 14 )
- labelRetour.anchorX = 0
-
- listeTickets:insert( labelRetour )
end
local function onComplete( event )
local newPhoto = event.target
-
+
-- si la prise de photo n'est pas annulée
if newPhoto ~= nil then
local btn = prisePhoto.boutonPhoto
-- Une photo a été prise
- isPhotoTaken = true
-
- -- sauvegarder la photo
- display.save( newPhoto, { filename = "photo.jpg", baseDir = system.TemporaryDirectory } )
+ Runtime:dispatchEvent{ name = "photoTaken" }
-- masquer l'ancienne photo
local clear = display.newRect( 0, 0, btn.width, btn.height )
photo.height = 70
photo.x = clear.x + 20
photo.y = clear.y + 60
+
+ -- sauvegarder la photo
+ display.save( newPhoto, { filename = "photo.jpg", baseDir = system.TemporaryDirectory } )
+
ticket:insert( photo )
end
}
boutonRetour.alpha = 1
boutonRetour.anchorX = 0
- boutonRetour.x = VW + boutonRetour.width
+ boutonRetour.x = SX - 2*boutonRetour.width
boutonRetour.y = border2.y + border2.height/2
ticket:insert( boutonRetour )
ticket.boutonRetour = boutonRetour
local labelObligatoire = display.newText( "*Obligatoires", 0, 0, "Dosis-Book", 14 )
labelObligatoire:setFillColor( 0, 0, 0, 1 )
labelObligatoire.anchorX = 0
- labelObligatoire.x = SX + 5
+ labelObligatoire.x = VW - labelObligatoire.width - 5
labelObligatoire.y = ticket.border2.y + ticket.border2.height/2
ticket:insert( labelObligatoire )
ticket.labelObligatoire = labelObligatoire
end
+local function photoIsTaken( event )
+
+ isPhotoTaken = true
+
+end
+
-- Initialisation des boutons de priorité du ticket
local function initPriorite()
-- fonction d'action du bouton de localiser
function boutonLocaliser:touch( event )
- if event.phase == "began" and isLocaliserActive then
+ -- on supprime tous les marqueurs déjà présents à chaque activation
+ map:removeAllMarkers()
- -- on supprime tous les marqueurs déjà présents à chaque activation
- map:removeAllMarkers()
+ -- on récupère la position de l'utilisateur
+ local location = map:getUserLocation()
- -- on récupère la position de l'utilisateur
- local location = map:getUserLocation()
+ -- on centre la map sur la position
+ map:setCenter( location.latitude, location.longitude, true )
+ -- on place le marqueur
+ map:addMarker( location.latitude, location.longitude )
- -- on centre la map sur la position
- map:setCenter( location.latitude, location.longitude, true )
- -- on place le marqueur
- map:addMarker( location.latitude, location.longitude )
+ -- on récupère les coordonnées pour l'envoi plus tard
+ coordT = ""..location.latitude..","..location.longitude
- -- on récupère les coordonnées pour l'envoi plus tard
- coordT = ""..location.latitude..","..location.longitude
+ if event.phase == "began" and isLocaliserActive then
local function mapAddressHandler( event )
labelAdresse.text = "Recherche de votre position .."
if event.isError then
- print( "mapView Error: " .. event.errorMessage )
labelAdresse.text = "Event.isError"
else
labelAdresse.text = "Recherche de votre position ..."
- print( "The specified location is in: " .. event.city .. ", " .. event.country )
number = event.streetDetail
street = event.street
postalCode = event.postalCode
-- on récupère l'adresse la plus proche des coordonnées GPS
local nearestAddress = map:nearestAddress( location.latitude, location.longitude, mapAddressHandler )
+ labelAdresse.text = adresseT
+
+ isAddressWritten = true
end
ticket:insert( iconGps )
ticket.iconGps = iconGps
- local function localize()
- ticket.boutonLocaliser:touch({phase = "began"})
- end
-
- -- on se localise dès l'arrivée sur le ticket
- timer.performWithDelay( 1000, localize )
-
end
-- Fin de la map et de tous ses composants
end
--- Initialisation du nombre de tickets restants
-
-local function initRestants()
-
-end
-
local function displayHint()
native.showAlert( "Hâlte-là !", "Veuillez renseigner les informations obligatoires.", { "D'accord :)", "D'accord :(" } )
print( "Response:", event.response )
photoName = event.response
- print("Upload de l'image terminé, on envoit les informations du ticket")
+ print("Upload de l'image terminé, on envoie les informations du ticket")
sendAll()
end
end
print(" On commence l'upload de l'image")
uploadImage()
else -- si la personne n'a pas pris de photo on envoie simplement les données relatives au ticket
+ print("sendall")
sendAll()
end
- if ticket.map then
-
- ticket.map:removeSelf()
- ticket.map = nil
+ ticket.map.x = 2*VW
- end
-
Runtime:dispatchEvent{ name = "MenuEvent", type = "accueil" }
native.showAlert( "Merci !", "Votre ticket a bien été envoyé.", { "De rien :)" } )
transition.to( ticket.boutonLocaliser, { time = 500, x = SX + VW - ticket.boutonLocaliser.width, transition = easing.outExpo } )
transition.to( ticket.descr, { time = 500, x = SX - 4, transition = easing.outExpo } )
transition.to( ticket.textDescr, { time = 550, x = SX + 10, transition = easing.outQuad } )
- transition.to( ticket.boutonRetour, { time = 750, x = VW - ticket.boutonRetour.width, transition = easing.outQuad } )
+ transition.to( ticket.boutonRetour, { time = 750, x = SX, transition = easing.outQuad } )
local k = SY + VH - ticket.border2.height
local l = SY + ticket.adresseBg.y + ticket.adresseBg.height
ticket.boutonEnvoyer:addEventListener( "touch", boutonEnvoyer )
Runtime:addEventListener( "MenuEvent", changeType )
+ Runtime:addEventListener( "photoTaken", photoIsTaken )
Runtime:addEventListener( "key", onKeyEvent )
-- on active le bouton retour un peu après pour éviter des conflits de chargement
ticket.boutonRetour:removeEventListener( "touch", boutonRetour )
Runtime:removeEventListener( "MenuEvent", changeType )
+ Runtime:removeEventListener( "photoTaken", photoIsTaken )
Runtime:removeEventListener( "key", onKeyEvent )
end
initMap()
initDescription()
initEnvoyer()
- initRestants()
initCircles()
ticket:disposeElements()