[Isocial-svn] SF.net SVN: isocial: [69] app
Status: Pre-Alpha
Brought to you by:
aguidrevitch
From: <di...@us...> - 2008-03-13 10:27:19
|
Revision: 69 http://isocial.svn.sourceforge.net/isocial/?rev=69&view=rev Author: dim0s77 Date: 2008-03-13 03:27:24 -0700 (Thu, 13 Mar 2008) Log Message: ----------- added deleted dialog for inbox messages Modified Paths: -------------- app/controllers/message_controller.php app/models/message.php app/views/message/inbox.tpl app/views/message/outbox.tpl Modified: app/controllers/message_controller.php =================================================================== --- app/controllers/message_controller.php 2008-03-12 20:37:58 UTC (rev 68) +++ app/controllers/message_controller.php 2008-03-13 10:27:24 UTC (rev 69) @@ -160,20 +160,20 @@ function _delete_thread () { if (!empty($this->params['check_messages'])) { $threads = $this->Message->find('all', - array('conditions' => - array("id IN (" . $this->Message->_make_in_statement_from_array('id', $this->params['check_messages']) . ") AND sender_id = ? OR recipient_id = ?", - $this->current_user->getId(), $this->current_user->getId() - ) - ) - ); + array('conditions' => + array("id IN (" . $this->Message->_make_in_statement_from_array('id', $this->params['check_messages']) . ") AND (sender_id = ? OR recipient_id = ?)", + $this->current_user->getId(), $this->current_user->getId() + ) + ) + ); if ($threads) { foreach ($threads as $thread_loop_key => $thread) { $this->Message->updateAll("is_sender_del = 1", "sender_id = " . $this->current_user->getId() . " AND thread_id = " . $thread->thread_id); $this->Message->updateAll("is_recipient_del = 1", "recipient_id = " . $this->current_user->getId() . " AND thread_id = " . $thread->thread_id); - $thread->reload(); - if ($thread->is_sender_del && $thread->is_recipient_del) { + $thread->reload(); + if ($thread->is_sender_del && $thread->is_recipient_del) { $this->Message->destroyAll("thread_id = " . $thread->thread_id); - } + } } } } Modified: app/models/message.php =================================================================== --- app/models/message.php 2008-03-12 20:37:58 UTC (rev 68) +++ app/models/message.php 2008-03-13 10:27:24 UTC (rev 69) @@ -6,7 +6,7 @@ 'recipient' => array('class_name' => 'User', 'primary_key_name' => 'recipient_id')); function unread_messages_count ( $recipient_id ) { - return $this->count('id', array('conditions' => array("recipient_id = ? AND is_read = 0", $recipient_id))); + return $this->count('id', array('conditions' => array("recipient_id = ? AND is_read = 0 AND is_recipient_del = 0", $recipient_id))); } } Modified: app/views/message/inbox.tpl =================================================================== --- app/views/message/inbox.tpl 2008-03-12 20:37:58 UTC (rev 68) +++ app/views/message/inbox.tpl 2008-03-13 10:27:24 UTC (rev 69) @@ -86,33 +86,54 @@ } function delete_threads (element) { - new Ajax.Updater('messages', - '/message/delete_inbox_thread', - { method:'post', - asynchronous:true, - parameters:$('messages_form').serialize(), - onSuccess: function () { - disable_action_links(); - } - }); + new Dialog.Box({ + reference: element, + title: '_{Delete Threads}', + body: '_{Are you sure you want to delete selected threads}?', + yes: '_{Delete}', + cancel: '_{Cancel}', + onYes : function () { + new Ajax.Updater('messages', + '/message/delete_inbox_thread', + { method:'post', + asynchronous:true, + parameters:$('messages_form').serialize(), + onSuccess: function () { + disable_action_links(); + } + }); + } + }); + return false; } function delete_single_thread (element) { - new Ajax.Updater('messages', - '/message/delete_inbox_thread', - { method:'post', - asynchronous:true, - parameters: 'check_messages[]=' + element.name, - onComplete: function () { - disable_action_links(); - tocheck = new Array(); - $$('input[type=checkbox]').each( function (el) { - if (checkids.indexOf(el.value) != -1) { tocheck.push(el); } + new Dialog.Box({ + reference: element, + title: '_{Delete Thread}', + body: '_{Are you sure you want to delete this thread}?', + yes: '_{Delete}', + cancel: '_{Cancel}', + onYes : function () { + new Ajax.Updater('messages', + '/message/delete_inbox_thread', + { method:'post', + asynchronous:true, + parameters: 'check_messages[]=' + element.name, + onComplete: function () { + disable_action_links(); + tocheck = new Array(); + $$('input[type=checkbox]').each( + function (el) { + if (checkids.indexOf(el.value) != -1) { tocheck.push(el); } + }); + tocheck.invoke('click'); + } }); - tocheck.invoke('click'); - } - }); + } + }); + return false; } Modified: app/views/message/outbox.tpl =================================================================== --- app/views/message/outbox.tpl 2008-03-12 20:37:58 UTC (rev 68) +++ app/views/message/outbox.tpl 2008-03-13 10:27:24 UTC (rev 69) @@ -53,6 +53,12 @@ function delete_threads (element) { new Dialog.Box({ + reference: element, + title: '_{Delete Threads}', + body: '_{Are you sure you want to delete selected threads}?', + yes: '_{Delete}', + cancel: '_{Cancel}', + hfloat: 'left', onYes : function () { new Ajax.Updater('messages', '/message/delete_outbox_thread', @@ -73,23 +79,24 @@ new Dialog.Box({ reference: element, title: '_{Delete Thread}', - body: '_{Are you sure you want to delete this thread} ?', + body: '_{Are you sure you want to delete this thread}?', yes: '_{Delete}', - cancel: '_{Cancel}', + cancel: '_{Cancel}', onYes : function () { - new Ajax.Updater('messages', - '/message/delete_outbox_thread', - { method:'post', - asynchronous:true, - parameters: 'check_messages[]=' + element.name, - onComplete: function () { - $("delete_link").addClassName('disabled'); - tocheck = new Array(); - $$('input[type=checkbox]').each( function (el) { - if (checkids.indexOf(el.value) != -1) { tocheck.push(el); } - }); - tocheck.invoke('click'); - } + new Ajax.Updater('messages', + '/message/delete_outbox_thread', + { method:'post', + asynchronous:true, + parameters: 'check_messages[]=' + element.name, + onComplete: function () { + $("delete_link").addClassName('disabled'); + tocheck = new Array(); + $$('input[type=checkbox]').each( + function (el) { + if (checkids.indexOf(el.value) != -1) { tocheck.push(el); } + }); + tocheck.invoke('click'); + } } ); }, This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |