Ajout de la fonctionnalité d'upload de module.

This commit is contained in:
Chouchen
2010-09-27 14:37:14 +00:00
parent 734e6f4829
commit 5a8dbbb330
12 changed files with 78 additions and 138 deletions

View File

@@ -47,18 +47,6 @@ class links extends Module{
$links = new links($params);
}
public function setLink($link){
// Saving the position and z-index of the note:
$xmla = simplexml_load_file('../'.self::LINKS_FILE);
$path = $xmla->xpath("//item[@id='weather']");
$path[0]->x = $x;
$xmla->asXML('../'.AccueilModules::CONFIG_FILE);
echo "ok";
}
public function setVisibility($visibility){
// Saving the position and z-index of the note:
$xmla = simplexml_load_file('../'.AccueilModules::CONFIG_FILE);

View File

@@ -0,0 +1,25 @@
<?// Escaping the input data:
$rid = $_POST['id'];
$explodeid = explode("-",$rid);
$id = intval($explodeid[1]);
$xmla = simplexml_load_file('../db/notes.xml');
$target = false;
$i = 0;
foreach ($xmla->note as $s) {
if ($s['id']==$id) { $target = $i; break; }
$i++;
}
if ($target !== false) {
unset($xmla->note[$target]);
}
$xmla->asXML('../db/notes.xml');
$target++;
echo $target;
?>

View File

@@ -0,0 +1,29 @@
<?// Escaping the input data:
$body = $_POST['body'];
$color = $_POST['color'];
$zindex = $_POST['zindex'];
$nb = 1;
$xmla = simplexml_load_file('../db/notes.xml');
$field_count = count($xmla->note);
/*foreach($xmla->note as $test){
if($nb < $test['id']){$nb=$test['id'];}
}*/
$test = $xmla->note;
for($i=0;$i<$field_count;$i++){
if($nb <= $test[$i]['id']) $nb = $test[$i]['id']+1;
}
$newnote = $xmla->addChild('note');
$newnote->addAttribute("id", $nb);
$newnote->addChild('text', $body);
$newnote->addChild('color', $color);
$newnote->addChild('zindex', $zindex);
$newnote->addChild('top', '0');
$newnote->addChild('left', '0');
$xmla->asXML('../db/notes.xml');
echo $nb;
?>

View File

@@ -14,8 +14,8 @@ class search extends Module {
$this->moduleName = get_class();
$this->pathToModule = 'modules/'.$this->moduleName.'/';
$this->setParams($params);
echo '<link rel="stylesheet" type="text/css" href="'.$this->pathToModule.'css/search.css">
<script type="text/javascript" src="'.$this->pathToModule.'js/jquery.search.js"></script>
echo '<link rel="stylesheet" type="text/css" href="'.$this->pathToModule.'css/'.$this->moduleName.'.css">
<script type="text/javascript" src="'.$this->pathToModule.'js/'.$this->moduleName.'.js"></script>
<form id="searchForm" method="post">
<fieldset>
<input id="s" type="text" />

View File

@@ -1,18 +1,3 @@
<?
$xmla = simplexml_load_file('../db/todoist.xml');
if($xmla->token== '' || $xmla->token == null)
header('Location: install-todoist.php');
if($xmla->name == '' || $xmla->name == null):?>
<html>
<head>
<style>
.selectableProject{text-decoration:underline; color:blue; cursor:pointer;}
</style>
<title>Todoist : getProjects</title>
<?
$xmla = simplexml_load_file('../db/todoist.xml');
if($xmla->token== '' || $xmla->token == null)

View File

@@ -1,7 +1,7 @@
<?
$xmla = simplexml_load_file('../db/todoist.xml');
if($xmla->token== '' || $xmla->token == null)
header('Location: install-todoist.php');

View File

@@ -1,56 +1,9 @@
<?header('Content-type: application/javascript');
$token = $_GET['token'];
$id = $_GET['id'];
?>
function cbfunc(o){
$('#results').append('<ul id="uncompletedList"><ul>');
for(var i in o)
{
$('#uncompletedList').append('<li id="'+o[i].id+'">'+o[i].content+' - '+o[i].date_string+' <img src="images/interface/delete.png" class="deleteTask" id="delete-'+o[i].id+'"/> <img src="images/interface/complete.png" class="completeTask" id="complete-'+o[i].id+'"/> </li>');
}
$('#uncompletedList li').prepend('<div class="puce"></div>');
}
function cbfunc2(o){
$('#uncompletedList').append('<li id="'+o.id+'">'+o.content+' - '+o.date_string+' <img src="images/interface/delete.png" id="delete-'+o.id+'"/> <img src="images/interface/complete.png" class="completeTask" id="complete-'+o.id+'"/> </li>');
}
$(document).ready(function(){
$('#todo').resizable();
$('#todo').draggable();
$('#todo').append('<div id="results"></div><img src="images/interface/add.png" id="showNewTask"/><fieldset id="newTaskFieldset" style="display:none; width:200px;"><input type="text" name="newtask" id="newtask"/> <select id="priority"><option id="1" value="1">1</option><option id="2" value="2">2</option><option id="3" value="3">3</option><option id="4" value="4">4</option></select> <br/><input type="text" name="date_string" id="date_string"/> <img src="images/interface/add.png" id="addTask"/></fieldset>');
var token = "<?=$token?>";
var project_id = "<?=$id?>";
var script = document.createElement('script');
script.type = 'text/javascript';
script.src = 'https://todoist.com/API/getUncompletedItems?project_id='+project_id+'&token='+token+'&format=json&callback=cbfunc';
document.getElementsByTagName('head')[0].appendChild(script);
$('#showNewTask').click(function(){
$('#newTaskFieldset').toggle();
});
$token = $_GET['token'];
$id = $_GET['id'];
?>
function cbfunc(o){
$('#results').append('<ul id="uncompletedList"><ul>');
for(var i in o)
{

View File

@@ -1,21 +1,4 @@
function cbfunc(o){
var token = o.api_token;
if(token == undefined){
function cbfunc(o){
var token = o.api_token;
}else{
$.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);
}
});
}
if(token == undefined){
$('#error').html('Identification erronnée');