[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Noalyss-commit] [noalyss] 01/30: Task #1118 - Partage de notes via le
From: |
Dany De Bontridder |
Subject: |
[Noalyss-commit] [noalyss] 01/30: Task #1118 - Partage de notes via le Pense-bête #1118 : partage de note Correction bug |
Date: |
Tue, 02 Jun 2015 22:29:01 +0000 |
sparkyx pushed a commit to branch master
in repository noalyss.
commit 1c8ed723962ae9e085d1fa1270d80d89974e3616
Author: Dany De Bontridder <address@hidden>
Date: Wed May 27 20:14:15 2015 +0200
Task #1118 - Partage de notes via le Pense-bête
#1118 : partage de note
Correction bug
---
html/ajax_todo_list.php | 45 +++++++++++++++++++++++++++++++++++++++++++--
1 files changed, 43 insertions(+), 2 deletions(-)
diff --git a/html/ajax_todo_list.php b/html/ajax_todo_list.php
index 3c4641e..05b310b 100644
--- a/html/ajax_todo_list.php
+++ b/html/ajax_todo_list.php
@@ -90,14 +90,23 @@ $ac=HtmlInput::default_value_get('act', 'save');
////////////////////////////////////////////////////////////////////////////////
if ($ac == 'save')
{
+
$cn=new Database(dossier::id());
$todo=new Todo_List($cn);
- $todo->set_parameter("id", HtmlInput::default_value_get("id", 0));
+ $id=HtmlInput::default_value_get("id", 0);
+ $todo->set_parameter("id",$id);
+ if ($id <> 0 ) { $todo->load(); }
+ else
+ {
+ $todo->set_parameter("owner", $_SESSION['g_user']);
+ }
+
$todo->set_parameter("date", HtmlInput::default_value_get("p_date_todo",
""));
$todo->set_parameter("title", HtmlInput::default_value_get("p_title", ""));
$todo->set_parameter("desc", HtmlInput::default_value_get("p_desc", ""));
$todo->set_is_public(HtmlInput::default_value_get("p_public", "N"));
- $todo->save();
+
+ if ( $todo->get_parameter('owner') == $_SESSION['g_user'] ) $todo->save();
$todo->load();
header('Content-type: text/xml; charset=UTF-8');
$dom=new DOMDocument('1.0','UTF-8');
@@ -223,4 +232,36 @@ if ( $ac=="set_share")
// remove a share from the user
$todo->remove_share($p_login);
}
+}
+////////////////////////////////////////////////////////////////////////////////
+// Remove the share of a note which the connected user doesn't own
+//
+////////////////////////////////////////////////////////////////////////////////
+if ( $ac=="remove_share")
+{
+ $id=HtmlInput::default_value_get("todo_id", 0);
+ $p_login=HtmlInput::default_value_get("login","");
+ // If note_id is not correct then give an error
+ if ($id==0||isNumber($id)==0 || trim ($p_login)=="")
+ {
+ header('Content-type: text/xml; charset=UTF-8');
+ $dom=new DOMDocument('1.0', 'UTF-8');
+ $status=$dom->createElement('status', "nok");
+ $tl_id=$dom->createElement('content', _("Erreur : paramètre
invalide"));
+ $dom->appendChild($status);
+ $dom->appendChild($tl_id);
+ echo $dom->saveXML();
+ return;
+ }
+ $todo=new Todo_List($cn);
+ $todo->set_parameter("id", $id);
+ $todo->load();
+ $todo->remove_share($p_login);
+
+ header('Content-type: text/xml; charset=UTF-8');
+ $dom=new DOMDocument('1.0', 'UTF-8');
+ $status=$dom->createElement('status', "ok");
+ $dom->appendChild($status);
+ echo $dom->saveXML();
+ return;
}
\ No newline at end of file
- [Noalyss-commit] [noalyss] branch master updated (38c52bf -> 255124b), Dany De Bontridder, 2015/06/02
- [Noalyss-commit] [noalyss] 01/30: Task #1118 - Partage de notes via le Pense-bête #1118 : partage de note Correction bug,
Dany De Bontridder <=
- [Noalyss-commit] [noalyss] 03/30: Merge tag 'rel6803', Dany De Bontridder, 2015/06/02
- [Noalyss-commit] [noalyss] 02/30: Task #1123 - Visualisation/présentation de la balance: SOLDE #1123 : PRINTBAL ajout du solde quand on utilise les sous-niveaux, Dany De Bontridder, 2015/06/02
- [Noalyss-commit] [noalyss] 05/30: Icon in the menu, Dany De Bontridder, 2015/06/02
- [Noalyss-commit] [noalyss] 06/30: #1118 : partage de note Esthétique Zoom des notes partagées, Dany De Bontridder, 2015/06/02
- [Noalyss-commit] [noalyss] 04/30: Icon in the menu, Dany De Bontridder, 2015/06/02
- [Noalyss-commit] [noalyss] 07/30: Improve method HtmlInput::title_box, Dany De Bontridder, 2015/06/02
- [Noalyss-commit] [noalyss] 08/30: #1118 : partage de note Ne peut partager note non sauvée, Dany De Bontridder, 2015/06/02
- [Noalyss-commit] [noalyss] 09/30: #1118 : partage de note Esthétique zoom, Dany De Bontridder, 2015/06/02
- [Noalyss-commit] [noalyss] 10/30: Database improve : new function get_affected returns the number of rows affected by the last query, Dany De Bontridder, 2015/06/02
- [Noalyss-commit] [noalyss] 13/30: Administration user : add condition if no folder exists + esthetic, Dany De Bontridder, 2015/06/02