[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Noalyss-commit] [noalyss] 03/04: Task #1118 - Partage de notes via le
From: |
Dany De Bontridder |
Subject: |
[Noalyss-commit] [noalyss] 03/04: Task #1118 - Partage de notes via le Pense-bête #1118 : partage de note 1) la note ne peut être effacée que par son propriétaire 2) la note partagée peut être modifiée par ceux la partageant |
Date: |
Wed, 27 May 2015 17:55:40 +0000 |
sparkyx pushed a commit to branch master
in repository noalyss.
commit 1eaf6db36a0a4413523fc1c22bac37da3daca572
Author: Dany De Bontridder <address@hidden>
Date: Wed May 27 19:42:11 2015 +0200
Task #1118 - Partage de notes via le Pense-bête
#1118 : partage de note
1) la note ne peut être effacée que par son propriétaire
2) la note partagée peut être modifiée par ceux la partageant
---
html/js/todo_list.js | 26 ++++++++++++++++++++++++++
include/class_todo_list.php | 24 ++++++++++++++++++++----
include/template/dashboard.php | 2 +-
include/template/todo_list_display.php | 4 +++-
4 files changed, 50 insertions(+), 6 deletions(-)
diff --git a/html/js/todo_list.js b/html/js/todo_list.js
index 5ebcb04..e729d19 100644
--- a/html/js/todo_list.js
+++ b/html/js/todo_list.js
@@ -243,4 +243,30 @@ function todo_list_set_share(note_id,p_login,p_dossier)
}
}
)
+}
+function todo_list_remove_share(note_id,p_login,p_dossier)
+{
+ waiting_node();
+ new Ajax.Request('ajax_todo_list.php',{
+ parameters : {
+ 'gDossier':p_dossier,
+ 'todo_id':note_id,
+ 'login':p_login,
+ 'act':"remove_share"
+ },
+ method:"get",
+ onSuccess:function (p_xml) {
+ remove_waiting_node();
+ var answer=p_xml.responseXML;
+ var status=answer.getElementsByTagName('status');
+ if ( status.length == 0) {
+ alert ('erreur reponse ');
+ }
+ var status_code=getNodeText(status[0]);
+ if ( status_code == 'ok') {
+ $("tr" + note_id).hide();
+
+ }
+ }
+ });
}
\ No newline at end of file
diff --git a/include/class_todo_list.php b/include/class_todo_list.php
index 41b86c8..31cd6c3 100644
--- a/include/class_todo_list.php
+++ b/include/class_todo_list.php
@@ -322,10 +322,26 @@ class Todo_List
'<a class="line" href="javascript:void(0)"
onclick="todo_list_show(\''.$this->tl_id.'\')">'.
htmlspecialchars($this->tl_title).
'</a>'.
- '</td>'.
- '<td>'.
-
HtmlInput::button('del','X','onClick="todo_list_remove('.$this->tl_id.')"','smallbutton').
- '</td>';
+ '</td>';
+ if ( $this->is_public == 'Y' && $this->use_login !=
$_SESSION['g_user'] )
+ { // This is a public note, cannot be removed
+ $r.= '<td></td>';
+ }
+ elseif ($this->use_login == $_SESSION['g_user'] )
+ {
+ // This a note the user owns
+ $r.= '<td>'.
+
HtmlInput::button('del','X','onClick="todo_list_remove('.$this->tl_id.')"','smallbutton').
+ '</td>';
+ }
+ else
+ {
+ // this is a note shared by someone else
+ $r.= '<td>'.
+
HtmlInput::button('del','X','onClick="todo_list_remove_share('.$this->tl_id.',\''.$this->use_login.'\','.Dossier::id().')"','smallbutton').
+ '</td>';
+ }
+
if ( $with_tag == 'Y') $r .= '</tr>';
return $r;
}
diff --git a/include/template/dashboard.php b/include/template/dashboard.php
index 91ecdc9..3bcbeb5 100644
--- a/include/template/dashboard.php
+++ b/include/template/dashboard.php
@@ -21,7 +21,7 @@ $a_todo=Todo_List::to_object($cn,$array);
echo HtmlInput::button('add',_('Ajout'),'onClick="add_todo()"','smallbutton');
if ( ! empty ($array) ) {
echo '<table id="table_todo" class="sortable" width="100%">';
- echo '<tr><th class=" sorttable_sorted_reverse">Date <span
id="sorttable_sortrevind"> ▴</span></th><th>Titre</th><th></th>';
+ echo '<tr><th class=" sorttable_sorted_reverse" id="todo_list_date">Date
<span
id="sorttable_sortrevind"> ▴</span></th><th>Titre</th><th></th>';
$nb=0;
$today=date('d.m.Y');
diff --git a/include/template/todo_list_display.php
b/include/template/todo_list_display.php
index adc7a42..9427c2b 100644
--- a/include/template/todo_list_display.php
+++ b/include/template/todo_list_display.php
@@ -97,7 +97,9 @@ echo
HtmlInput::title_box("Note","todo_list_div".$this->tl_id);
<?php echo dossier::hidden(); ?>
<?php echo HtmlInput::hidden('act','save') ?>
<?php echo HtmlInput::hidden('id',$this->tl_id) ?>
+ <?php if ($this->use_login == $_SESSION['g_user']) : ?>
<p style='text-align: center'>
- <input type="submit" class="smallbutton" value="<?php echo _('Sauve');?>"
onclick="todo_list_save(<?php echo $this->tl_id?>);return false">
+ <input type="submit" class="smallbutton" value="<?php echo
_('Sauve');?>" onclick="todo_list_save(<?php echo $this->tl_id?>);return false">
</p>
+ <?php endif; ?>
</form>
\ No newline at end of file