Files
ajax
class
css
db
images
js
calculator.js
getProjectsList.php
getUncompletedTasks.php
index.js
jquery-1.3.1.min.js
jquery.blogs.js
jquery.easing-1.3.pack.js
jquery.fancybox-1.3.0.pack.js
jquery.fancybox-1.3.1.js
jquery.fancybox-1.3.1.pack.js
jquery.jclock.js
jquery.jclockAdvanced.js
jquery.links.js
jquery.mousewheel-3.0.2.pack.js
jquery.notes.js
jquery.ouifm.js
jquery.search.js
jquery.weather.js
jquery.xdomainajax.js
main.js
.htaccess
CURL.php
GoogleMeteo.php
addSite.php
add_note.html
blogs.php
blogs_last_post.php
calculator.html
config.php
getProjectsList.php
getUncompletedTasks.php
index.php
install-todoist.php
meteo.php
notepad.html
notes_extract.php
Accueil/js/getProjectsList.php

6 lines
1001 B
PHP

<?header('Content-type: application/javascript');
$token = $_GET['token'];
?>
function cbfunc(o){
$('body').append('<div id="results"><h2>Select your project</h2></div>');
$('#results').append('<ul id="uncompletedList"><ul>');
for(var i in o)
{
$('#uncompletedList').append('<li id="'+o[i].id+'" class="selectableProject">'+o[i].name+'</li>');
}
}
$(document).ready(function(){
var token = "<?=$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);
$('.selectableProject').live('click', function(){
var name = $(this).text();
var id = $(this).attr('id');
$.post('ajax/saveTodoist.php', {name: name, id: id}, function(msg){
$('body').append('<a href="index.php">Etape suivante</a>');
if(msg=="ok"){
location.reload();
}else{
alert(msg);
}
});
});
});