Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
labelabeille
app
Commits
d8da0448
Commit
d8da0448
authored
Jul 01, 2016
by
lucas64500
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Session conservee entre lancements de l'app + Modification d'un rucher
parent
bb6c096b
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
58 additions
and
47 deletions
+58
-47
index.html
index.html
+3
-5
js/accueil2.js
js/accueil2.js
+7
-22
js/connexion.js
js/connexion.js
+12
-2
js/creer_ruche.js
js/creer_ruche.js
+3
-1
js/creer_rucher.js
js/creer_rucher.js
+8
-3
js/historique.js
js/historique.js
+2
-2
js/index.js
js/index.js
+2
-3
js/parametres.js
js/parametres.js
+13
-6
templates.html
templates.html
+8
-3
No files found.
index.html
View file @
d8da0448
...
...
@@ -95,7 +95,7 @@
<input
class=
"zone_texte"
type=
"text"
value=
"Mot de passe"
id=
"mdp_connexion"
onfocus=
"if(this.value=='Mot de passe'){this.value='';this.type='password'}"
onblur=
"if(this.value==''){this.value = 'Mot de passe'; this.type='text'}"
/>
<div
class=
"bouton"
id=
"valider_connexion"
style=
"display:inline-block;"
><span>
VALIDER
</span></div>
<div
class=
"bouton"
id=
"commencer_inscription"
style=
"display:inline-block;"
><span>
S'INSCRIRE
</span></div>
<div
class=
"bouton"
id=
"test"
style=
"display:inline-block;"
><span>
TESTER
</span></div>
<!--
<div class="bouton" id="test" style="display:inline-block;"><span>TESTER</span></div>
-->
</form>
<div
style=
"clear:left;"
></div>
</div>
...
...
@@ -170,7 +170,7 @@
<div
class=
"page"
id=
"paccueil"
>
<div
id=
"menu_haut"
>
<img
src=
"img/carte.png"
id=
"btCarte"
alt=
"Carte"
/>
<img
src=
"img/historique.png"
id=
"btHistorique"
alt=
"Historique"
/>
<!--
<img src="img/historique.png" id="btHistorique" alt="Historique" />
-->
<img
class=
"droite"
id=
"btReglages"
src=
"img/reglages.png"
alt=
"Réglages"
/>
</div>
...
...
@@ -308,9 +308,7 @@
<div
id=
"bas_triangle"
></div>
<div
class=
"corps"
>
<div
class=
"sous_titre"
>
<span
class=
"nav_gauche"
><
</
span
>
<span
class=
"nav_droite"
>
>
</span>
<h1>
Ruchers
</h1>
<h1>
Modifier un rucher
</h1>
</div>
<div
class=
"contenu formulaire"
id=
"corps-params-rucher"
>
</div>
...
...
js/accueil2.js
View file @
d8da0448
...
...
@@ -71,27 +71,13 @@ function notif(nom,ruche,idSeuil){
});
cordova
.
plugins
.
notification
.
local
.
on
(
"
click
"
,
function
(
notification
)
{
inotif
=
0
;
cordova
.
plugins
.
notification
.
local
.
cancelAll
();
goToListHives
(
1
);
});
}
}
/*
function notif(nom,nomRuche){
inotif++;
cordova.plugins.notification.local.schedule({
id: inotif,
badge: inotif,
title: "Alerte ("+nomRuche+")",
text: "Seuil "+nom+" dépassé",
at: new Date()
});
cordova.plugins.notification.local.on("click", function (notification) {
inotif=0;
accueil();
});
}*/
var
seuils
=
[
/*{
...
...
@@ -175,7 +161,7 @@ function actuNotifs(){if(!enActualisation){
for
(
s
=
0
;
s
<
seuils
.
length
;
s
++
)
{
if
(
testSeuil
(
donneesRuches
.
hivegroups
[
r
].
hives
[
i
],
seuils
[
s
],
donneesRuches
.
hivegroups
[
r
].
hives
[
i
].
data
[
seuils
[
s
].
nom
].
v
))
notif
(
seuils
[
s
].
nom
,
donneesRuches
.
hivegroups
[
r
].
hives
[
i
],
s
);
if
(
testSeuil
(
donneesRuches
.
hivegroups
[
r
].
hives
[
i
],
seuils
[
s
],
donneesRuches
.
hivegroups
[
r
].
hives
[
i
].
data
[
seuils
[
s
].
nom
].
v
))
notif
(
seuils
[
s
].
description
,
donneesRuches
.
hivegroups
[
r
].
hives
[
i
],
s
);
}
enActualisation
=
false
;
...
...
@@ -191,9 +177,10 @@ var slider_ruchers;
var
$window
=
[];
var
tScroll
=
[];
function
accueil
(){
cordova
.
plugins
.
notification
.
local
.
cancelAll
();
//Carte
_
(
"
btCarte
"
).
addEventListener
(
evtclick
,
goToMap
);
_
(
"
btHistorique
"
).
addEventListener
(
evtclick
,
goToHistorique
);
//
_("btHistorique").addEventListener(evtclick, goToHistorique);
nbRuchers
=
donneesRuches
.
hivegroups
.
length
;
console
.
log
(
"
Nb de ruchers :
"
+
nbRuchers
);
...
...
@@ -255,6 +242,7 @@ function nouveauRucher(){
function
allerAuRucher
(
k
){
if
(
!
transitionEnCours
&&!
slider_ruchers
.
enTransition
){
$
(
"
#sous_titre_accueil
"
).
children
(
"
h1
"
).
html
(
donneesRuches
.
hivegroups
[
k
-
1
].
name
);
$
(
"
#sous_titre_accueil
"
).
children
(
"
h1
"
).
on
(
"
click
"
,
goToHiveGroupParameters
);
var
change
=
false
;
if
(
rucher
!=
k
){
change
=
true
;}
if
(
rucher
<=
nbRuchers
){
...
...
@@ -267,10 +255,7 @@ function allerAuRucher(k){
idHiveGroup
=
k
-
1
;
if
(
change
)
slider_ruchers
.
slidePageFrom
(
$
(
"
#rucher
"
+
rucher
),(
left
?
"
left
"
:
"
right
"
));
if
(
nbRuches
[
rucher
]
==
0
){
//Mieux placer le bouton + quand il est tout seul sur la page
}
else
{
if
(
nbRuches
[
rucher
]
>
0
){
$window
[
rucher
].
scrollTop
((
rucheSelect2
[
rucher
]
-
1
)
*
h
);
$window
[
rucher
].
scroll
(
function
(){
defiler
(
rucher
);});
tScroll
[
rucher
]
=
setInterval
(
function
(){
defiler
(
rucher
);},
100
);
...
...
js/connexion.js
View file @
d8da0448
...
...
@@ -58,6 +58,8 @@ function connexion(user, passwd, success, failure) {
_
(
"
ch
"
).
style
.
visibility
=
"
hidden
"
;
console
.
log
(
JSON
.
stringify
(
data
));
customer
=
data
;
window
.
localStorage
.
setItem
(
"
user
"
,
user
);
window
.
localStorage
.
setItem
(
"
login
"
,
passwd
);
success
();
},
error
:
function
(
xhr
,
ajaxOptions
,
thrownError
)
{
...
...
@@ -72,16 +74,23 @@ function connexion(user, passwd, success, failure) {
}
}
var
user
;
var
login
;
/**
* get and deal with connection data
*/
function
connect
()
{
if
(
!
(
window
.
localStorage
.
getItem
(
"
user
"
)
===
null
))
{
user
=
window
.
localStorage
.
getItem
(
"
user
"
);
login
=
window
.
localStorage
.
getItem
(
"
login
"
);
connexion
(
user
,
login
,
connexion_success
,
connexion_failure
);
}
$
(
"
#test
"
).
click
(
tester
);
$
(
"
#valider_connexion
"
).
click
(
function
(){
if
(
!
enCharge
){
var
user
=
encodeURIComponent
(
$
(
"
#email_connexion
"
).
val
());
user
=
encodeURIComponent
(
$
(
"
#email_connexion
"
).
val
());
//console.log(user);
var
login
=
encodeURIComponent
(
$
(
"
#mdp_connexion
"
).
val
());
login
=
encodeURIComponent
(
$
(
"
#mdp_connexion
"
).
val
());
//console.log(login);
connexion
(
user
,
login
,
connexion_success
,
connexion_failure
);
}
...
...
@@ -134,6 +143,7 @@ function finCharge(){
}
function
logout
()
{
window
.
localStorage
.
clear
();
charge
();
$
.
ajax
({
type
:
'
GET
'
,
...
...
js/creer_ruche.js
View file @
d8da0448
...
...
@@ -112,6 +112,8 @@ function goToAddLogger() {
},
error
:
function
(
xhr
,
ajaxOptions
,
thrownError
)
{
finCharge
();
afficherBd
(
"
Une erreur est survenue
"
,
"
Fermer
"
);
console
.
log
(
xhr
.
responseText
);
}
});
...
...
@@ -128,7 +130,7 @@ function deleteHive(id,action) {
withCredentials
:
true
},
//data: 'idclient=1&idruche=25&nomruche=NomDeMaRuche',
success
:
function
(
data
)
{
finCharge
();
action
();},
success
:
function
(
data
)
{
action
();},
error
:
function
(
xhr
,
ajaxOptions
,
thrownError
)
{
console
.
log
(
xhr
.
responseText
);
...
...
js/creer_rucher.js
View file @
d8da0448
...
...
@@ -85,6 +85,7 @@ function addHives() {
}
function
deleteHiveGroup
()
{
charge
();
$
.
ajax
({
type
:
'
DELETE
'
,
url
:
url
+
'
pshivegroup/
'
+
donneesRuches
.
hivegroups
[
idHiveGroup
].
id_hive_group
,
...
...
@@ -93,10 +94,14 @@ function deleteHiveGroup() {
withCredentials
:
true
},
//data: 'idclient=1&idruche=25&nomruche=NomDeMaRuche',
success
:
function
(
data
)
{
console
.
log
(
data
);
$
(
"
#resultat
"
).
html
(
JSON
.
stringify
(
data
));},
success
:
function
(
data
)
{
finCharge
();
goToListHives
(
1
);
},
error
:
function
(
xhr
,
ajaxOptions
,
thrownError
)
{
console
.
log
(
xhr
.
responseText
);
$
(
"
#result
"
).
html
(
xhr
.
responseText
);
finCharge
();
console
.
log
(
thrownError
);
afficherBd
(
"
Une erreur est survenue
"
,
"
Fermer
"
);
}
});
}
js/historique.js
View file @
d8da0448
...
...
@@ -74,7 +74,7 @@ function afficherNotes(data, indexHive){
note
.
data
=
defaultNotes
[
j
];
}
}
if
(
note
.
date_add
.
indexOf
(
"
NaN
"
)
!=-
1
)
note
.
date_add
=
"
Date inconnue
"
;
notes
.
push
(
note
);
};
for
(
var
i
in
customNotesSetByUser
)
{
...
...
@@ -85,7 +85,7 @@ function afficherNotes(data, indexHive){
note
.
data
=
customNotesCreatedByUser
[
j
];
}
}
if
(
note
.
date_add
.
indexOf
(
"
NaN
"
)
!=-
1
)
note
.
date_add
=
"
Date inconnue
"
;
notes
.
push
(
note
);
};
notes
.
sort
(
function
(
a
,
b
)
{
...
...
js/index.js
View file @
d8da0448
...
...
@@ -114,11 +114,10 @@ function debut(){
function
charger
(){
if
(
pcharge
<
100
)
pcharge
++
;
dessinCercleFLAT
(
_
(
"
canvasProgressSimple
"
),
pcharge
);
if
(
templateCharge
){
//
if(pcharge==100&&templateCharge){
if
(
pcharge
==
100
&&
templateCharge
){
transition
(
_
(
"
pconnexion
"
));
clearInterval
(
tcharge
);
//connect();
connexion
(
"
guillaume.vizier@polytechnique.edu
"
,
"
labelabeille
"
,
connexion_success
,
connexion_failure
);
connect
();
}
}
...
...
js/parametres.js
View file @
d8da0448
...
...
@@ -86,6 +86,8 @@ function goToGeneralParameters() {
//console.log('goToGeneralParameters : end');
}
/**
* display the parameters for the selected hivegroup
*/
...
...
@@ -95,13 +97,17 @@ function goToHiveGroupParameters() {
//console.log(listHives.ruches.length);
//console.log(JSON.stringify(listHives));
//console.log(listHives.ruches[0].name);
var
h
=
Mustache
.
render
(
template
,
hive
G
roups
[
idHiveGroup
]);
//
console.log(h);
var
h
=
Mustache
.
render
(
template
,
donneesRuches
.
hive
g
roups
[
idHiveGroup
]);
console
.
log
(
h
);
document
.
getElementById
(
"
corps-params-rucher
"
).
innerHTML
=
h
;
//console.log(document.getElementById("corps-params-rucher").innerHTML);
//console.log('goToHiveGroupParameters : before transition');
transition
(
_
(
"
pparametres-rucher
"
),
"
slide
"
);
//organiserRuches(listHives.ruches.length);
$
(
"
#supprimer_rucher
"
).
on
(
"
click
"
,
function
(
e
)
{
e
.
preventDefault
();
deleteHiveGroup
();
});
if
(
isTest
)
{
$
(
"
#form-params-ruchers
"
).
find
(
"
.bouton
"
).
click
(
function
(
e
){
$
(
this
).
off
(
"
click
"
);
e
.
preventDefault
();
...
...
@@ -113,14 +119,12 @@ function goToHiveGroupParameters() {
}
else
{
$
(
"
#form-params-ruchers
"
).
find
(
"
.bouton
"
).
click
(
function
(
e
){
$
(
"
#form-params-ruchers
"
).
submit
();
});
$
(
"
#form-params-ruchers
"
).
submit
(
function
(
e
){
//console.log("début modif");
e
.
preventDefault
();
var
donnees
=
$
(
this
).
serialize
();
var
donnees
=
$
(
this
).
parent
().
serialize
();
//console.log(donnees);
console
.
log
(
donneesRuches
.
hivegroups
[
idHiveGroup
]);
charge
();
$
.
ajax
({
type
:
'
PATCH
'
,
url
:
url
+
'
pshivegroup/
'
+
donneesRuches
.
hivegroups
[
idHiveGroup
].
id_hive_group
,
...
...
@@ -131,6 +135,7 @@ function goToHiveGroupParameters() {
success
:
function
(
data
)
{
console
.
log
(
data
);
console
.
log
(
donneesRuches
.
hivegroups
[
idHiveGroup
].
hives
[
idHive
]);
finCharge
();
/* go back to details */
donneesRuches
.
hivegroups
[
idHiveGroup
].
name
=
$
(
"
#apibundle_pshivegroup_name
"
).
val
();
donneesRuches
.
hivegroups
[
idHiveGroup
].
harvest
=
$
(
"
#apibundle_pshivegroup_harvest
"
).
val
();
...
...
@@ -138,6 +143,8 @@ function goToHiveGroupParameters() {
},
error
:
function
(
xhr
,
ajaxOptions
,
thrownError
)
{
//console.log(xhr.responseText);
finCharge
();
afficherBd
(
"
Un erreur est survenue
"
,
"
Fermer
"
);
}
});
});
...
...
templates.html
View file @
d8da0448
...
...
@@ -245,7 +245,8 @@
<!--<
/div>--
>
<
div
>
<
label
for
=
"
apibundle_pshivegroup_name
"
>
Nom
<
/label
>
<
input
type
=
"
text
"
id
=
"
apibundle_pshivegroup_name
"
name
=
"
apibundle_pshivegroup[name]
"
maxlength
=
"
64
"
/>
<
input
type
=
"
text
"
id
=
"
apibundle_pshivegroup_name
"
name
=
"
apibundle_pshivegroup[name]
"
value
=
"
{{name}}
"
maxlength
=
"
64
"
/>
<
div
class
=
"
cl
"
><
/div
>
<
/div
>
<!--<
div
>
<
label
for
=
"
apibundle_pshivegroup_note
"
>
Note
<
/label
>
...
...
@@ -253,14 +254,18 @@
<
/div>--
>
<
div
>
<
label
for
=
"
apibundle_pshivegroup_harvest
"
class
=
"
required
"
>
Récolte
<
/label
>
<
input
type
=
"
number
"
id
=
"
apibundle_pshivegroup_harvest
"
name
=
"
apibundle_pshivegroup[harvest]
"
required
=
"
required
"
/>
<
input
type
=
"
number
"
id
=
"
apibundle_pshivegroup_harvest
"
name
=
"
apibundle_pshivegroup[harvest]
"
value
=
"
{{harvest}}
"
required
=
"
required
"
/>
<
div
class
=
"
cl
"
><
/div
>
<
/div
>
<!--<
div
>
<
label
for
=
"
apibundle_pshivegroup_notes
"
>
Notes
<
/label
>
<
textarea
id
=
"
apibundle_pshivegroup_notes
"
name
=
"
apibundle_pshivegroup[notes]
"
maxlength
=
"
65535
"
><
/textarea
>
<
/div>--
>
<
/div
>
<
input
class
=
"
bouton
"
type
=
"
submit
"
value
=
"
ENVOYER
"
>
<
div
class
=
"
bouton
"
><
span
>
VALIDER
<
/span></
div
>
<
br
/>
<
div
id
=
"
supprimer_rucher
"
class
=
"
bouton2
"
style
=
"
text-align:center;clear:none;
"
>
Supprimer
ce
rucher
<
/div
>
<
/form
>
</script>
<script
type=
"text/html"
id=
"tpl-params-ruche"
>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment