[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Noalyss-commit] [noalyss] 02/09: Bug when adding a empty note
From: |
Dany De Bontridder |
Subject: |
[Noalyss-commit] [noalyss] 02/09: Bug when adding a empty note |
Date: |
Thu, 11 Feb 2016 15:14:17 +0000 |
sparkyx pushed a commit to branch master
in repository noalyss.
commit 3b9ce4ce2ceeb9f516fba831a8bffa13ecd84cf9
Author: Dany De Bontridder <address@hidden>
Date: Mon Feb 8 00:47:19 2016 +0100
Bug when adding a empty note
---
html/js/todo_list.js | 4 ++++
include/ajax/ajax_todo_list.php | 33 +++++++++++++++++++++++++--------
2 files changed, 29 insertions(+), 8 deletions(-)
diff --git a/html/js/todo_list.js b/html/js/todo_list.js
index 1df2eda..d073033 100644
--- a/html/js/todo_list.js
+++ b/html/js/todo_list.js
@@ -133,6 +133,10 @@ function todo_list_save(p_form)
var rec = req.responseText;
alert_box('erreur :' + rec);
}
+ if ( getNodeText(tl_id[0]) == '0') {
+ smoke.alert('Note est vide');
+ return;
+ }
var tr = $('tr'+p_form);
if ( p_form == 0)
{
diff --git a/include/ajax/ajax_todo_list.php b/include/ajax/ajax_todo_list.php
index 85d055f..74b2863 100644
--- a/include/ajax/ajax_todo_list.php
+++ b/include/ajax/ajax_todo_list.php
@@ -106,16 +106,33 @@ if ($ac == 'save')
$todo->set_parameter("desc", HtmlInput::default_value_get("p_desc", ""));
$todo->set_is_public(HtmlInput::default_value_get("p_public", "N"));
+ ob_start();
if ( $todo->get_parameter('owner') == $_SESSION['g_user'] ) $todo->save();
- $todo->load();
- header('Content-type: text/xml; charset=UTF-8');
+ ob_end_clean();
$dom=new DOMDocument('1.0','UTF-8');
- $tl_id=$dom->createElement('tl_id',$todo->get_parameter('id'));
-
$tl_content=$dom->createElement('row',$todo->display_row('class="odd"','N'));
- $root=$dom->createElement("root");
- $todo_class=$todo->get_class();
- $todo_class=($todo_class=="")?' odd ':$todo_class;
- $class=$dom->createElement("style",$todo_class);
+
+ if ($todo->get_parameter("id")==0)
+ {
+ $tl_id=$dom->createElement('tl_id', 0);
+ $tl_content=$dom->createElement('row','');
+ $root=$dom->createElement("root");
+ $todo_class=$todo->get_class();
+ $todo_class=($todo_class=="")?' odd ':$todo_class;
+ $class=$dom->createElement("style", $todo_class);
+ }
+ else
+ {
+ $todo->load();
+ $tl_id=$dom->createElement('tl_id', $todo->get_parameter('id'));
+
$tl_content=$dom->createElement('row',$todo->display_row('class="odd"', 'N'));
+ $root=$dom->createElement("root");
+ $todo_class=$todo->get_class();
+ $todo_class=($todo_class=="")?' odd ':$todo_class;
+ $class=$dom->createElement("style", $todo_class);
+ }
+ header('Content-type: text/xml; charset=UTF-8');
+
+
$root->appendChild($tl_id);
$root->appendChild($tl_content);
- [Noalyss-commit] [noalyss] branch master updated (adcf886 -> 81fd85e), Dany De Bontridder, 2016/02/11
- [Noalyss-commit] [noalyss] 01/09: Change constructor by __construct, Dany De Bontridder, 2016/02/11
- [Noalyss-commit] [noalyss] 02/09: Bug when adding a empty note,
Dany De Bontridder <=
- [Noalyss-commit] [noalyss] 03/09: Improve appearance waiting_box, Dany De Bontridder, 2016/02/11
- [Noalyss-commit] [noalyss] 04/09: small notice, Dany De Bontridder, 2016/02/11
- [Noalyss-commit] [noalyss] 05/09: replace phpcompta by noalyss, Dany De Bontridder, 2016/02/11
- [Noalyss-commit] [noalyss] 06/09: Task #15 - FenĂȘtre gestion : impossible d'afficher les commentaires des actions dĂ©pendantes Bug : undefined variable margin , the parent cannot be displaid, Dany De Bontridder, 2016/02/11
- [Noalyss-commit] [noalyss] 07/09: doc, Dany De Bontridder, 2016/02/11
- [Noalyss-commit] [noalyss] 08/09: Add function to grant or revoke admin to a folder, Dany De Bontridder, 2016/02/11
- [Noalyss-commit] [noalyss] 09/09: Update unit test files, Dany De Bontridder, 2016/02/11