Browse Source

Add Todoist installation script (need to be styled)

remotes/svn/ModulesALaMano
Chouchen 10 years ago
parent
commit
9f637b565d
6 changed files with 42 additions and 35 deletions
  1. +7
    -7
      ajax/saveTodoist.php
  2. +4
    -4
      getProjectsList.php
  3. +3
    -3
      index.php
  4. +24
    -0
      install-todoist.php
  5. +2
    -19
      js/getProjectsList.php
  6. +2
    -2
      js/index.js

+ 7
- 7
ajax/saveTodoist.php View File

@@ -1,21 +1,21 @@
<?
$xmla = simplexml_load_file('../db/todoist.xml');
if(isset($_GET['token'])){
$token = trim($_GET['token']);
if(isset($_POST['token'])){
$token = trim($_POST['token']);
$xmla->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";
}

+ 4
- 4
getProjectsList.php View File

@@ -1,10 +1,10 @@
<?
$xmla = simplexml_load_file('todoist.xml');
$xmla = simplexml_load_file('db/todoist.xml');
if($xmla->token== '' || $xmla->token == null)
header('Location: index.php');
header('Location: install-todoist.php');
if($xmla->name == '' || $xmla->name == null):?>
<html>
<head>
<head> <style> .selectableProject{text-decoration:underline; color:blue; cursor:pointer;} </style>
<title>Todoist : getProjects</title>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
<script type="text/javascript" src="js/getProjectsList.php?token=<?=$xmla->token?>"></script>
@@ -14,5 +14,5 @@ if($xmla->name == '' || $xmla->name == null):?>
</body>
</html>
<? else:
header('Location: getUncompletedTasks.php');
header('Location: index.php');
endif;

+ 3
- 3
index.php View File

@@ -150,13 +150,13 @@ if($config = simplexml_load_file('db/config.xml')){
<?}?>
<?if($config_xml[6]->visibility == "true"){
$xmla = simplexml_load_file('db/todoist.xml');
echo '<div id="todoList"></div>';
echo '<div id="todoList">';
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. <a href="install-todoist.php">Cliquez ici</a> pour la mettre en place.</div>';
else{
$token = $xmla->token;
$id = $xmla->id;?>
</div>
<script type="text/javascript" src="js/getUncompletedTasks.php?token=<?=$token?>&id=<?=$id?>"></script>
<?}}?>
</body>


+ 24
- 0
install-todoist.php View File

@@ -0,0 +1,24 @@
<?
$xmla = simplexml_load_file('db/todoist.xml');
if($xmla->token == '' || $xmla->token == null):?>
<html>
<head>
<title>Todoist : Login</title>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
<script type="text/javascript" src="js/index.js"></script>
</head>
<body>
<fieldset>
<input type="text" name="email" id="email"/><br/>
<input type="password" name="password" id="password"/>
<span id="loginBtn">Cliquez ici pour vous identifier</span>
<div id="error"></div>
</fieldset>
</body>
</html>
<?
else:
header('Location: getProjectsList.php');
endif;

+ 2
- 19
js/getProjectsList.php
File diff suppressed because it is too large
View File


+ 2
- 2
js/index.js View File

@@ -3,8 +3,8 @@ function cbfunc(o){
if(token == undefined){
$('#error').html('Identification erronnée');
}else{
$.get('saveTodoist.php', {token: token}, function(){
location.reload(true);
$.post('ajax/saveTodoist.php', {token: token}, function(data){ $('body').append('<a href="getProjectsList.php">Etape suivante</a>'); if(data=="ok"){
location.reload(); }else{ alert(data); }
});
}
}


Loading…
Cancel
Save