Add Todoist installation script (need to be styled)

This commit is contained in:
Chouchen
2010-09-15 09:54:20 +00:00
parent 08469447cb
commit 9f637b565d
6 changed files with 42 additions and 35 deletions

View File

@ -1,21 +1,21 @@
<?
$xmla = simplexml_load_file('../db/todoist.xml');
$xmla = simplexml_load_file('../db/todoist.xml');
if(isset($_POST['token'])){
$token = trim($_POST['token']);
$xmla->addChild("token", $token);
$xmla->addChild("token", $token);
$xmla->asXML('../db/todoist.xml');
echo "ok";
}else if(isset($_POST['name']) && isset($_POST['id'])){

View File

@ -1,10 +1,10 @@
<?
$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):?>
@ -14,5 +14,5 @@ if($xmla->name == '' || $xmla->name == null):?>
<style>
.selectableProject{text-decoration:underline; color:blue; cursor:pointer;}
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
</style>
<title>Todoist : getProjects</title>

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
install-todoist.php Normal file
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;

View File

@ -1,23 +1,6 @@
<?header('Content-type: application/javascript');
$token = $_GET['token'];
?>
function cbfunc(o){
var name = o[0].name;
var id = o[0].id;
if(id == undefined){
$('body').append('<span>ERROR</span>');
}else{
$.get('saveTodoist.php', {name: name, id: id}, function(){
?>

View File

@ -3,8 +3,8 @@ function cbfunc(o){
var token = o.api_token;
if(token == undefined){
$('#error').html('Identification erronnée');
$('#error').html('Identification erronnée');
}else{