diff --git a/ajax/saveTodoist.php b/ajax/saveTodoist.php index e881b4c..8a72978 100644 --- a/ajax/saveTodoist.php +++ b/ajax/saveTodoist.php @@ -1,21 +1,21 @@ addChild("token", $token); $xmla->asXML('../db/todoist.xml'); -echo $token; -}else if(isset($_GET['name']) && isset($_GET['id'])){ - $name = trim($_GET['name']); - $id = trim($_GET['id']); +echo "ok"; +}else if(isset($_POST['name']) && isset($_POST['id'])){ + $name = trim($_POST['name']); + $id = trim($_POST['id']); $xmla->addChild("name", $name); $xmla->addChild("id", $id); $xmla->asXML('../db/todoist.xml'); -echo $id; +echo "ok"; } \ No newline at end of file diff --git a/getProjectsList.php b/getProjectsList.php index 180ec35..f89a6a4 100644 --- a/getProjectsList.php +++ b/getProjectsList.php @@ -1,10 +1,10 @@ token== '' || $xmla->token == null) - header('Location: index.php'); + header('Location: install-todoist.php'); if($xmla->name == '' || $xmla->name == null):?> - + Todoist : getProjects @@ -14,5 +14,5 @@ if($xmla->name == '' || $xmla->name == null):?> visibility == "true"){ $xmla = simplexml_load_file('db/todoist.xml'); -echo '
'; +echo '
'; if($xmla->token== '' || $xmla->token == null || $xmla->id == '' || $xmla->id == null) -echo 'Impossible de trouver votre configuration. Merci de bien vouloir la recommencer.'; +echo 'Impossible de trouver votre configuration. Cliquez ici pour la mettre en place.
'; else{ $token = $xmla->token; $id = $xmla->id;?> - + diff --git a/install-todoist.php b/install-todoist.php new file mode 100644 index 0000000..a752127 --- /dev/null +++ b/install-todoist.php @@ -0,0 +1,24 @@ +token == '' || $xmla->token == null):?> + + + Todoist : Login + + + + + +
+
+ + Cliquez ici pour vous identifier +
+
+ + + -function cbfunc(o){ - var name = o[0].name; - var id = o[0].id; - - if(id == undefined){ - $('body').append('ERROR'); - }else{ - $.get('saveTodoist.php', {name: name, id: id}, function(){ - window.location.reload(); - }); - } -} - -$(document).ready(function(){ - var token = ""; - var script = document.createElement('script'); - script.type = 'text/javascript'; - script.src = 'https://todoist.com/API/getProjects?token='+token+'&format=json&callback=cbfunc'; - document.getElementsByTagName('head')[0].appendChild(script); +function cbfunc(o){ $('body').append('

Select your project

'); $('#results').append('