diff --git a/src/messenger/build.xml b/src/messenger/build.xml index 23e7a9f3..ad36371b 100644 --- a/src/messenger/build.xml +++ b/src/messenger/build.xml @@ -16,6 +16,7 @@ default_app_js - Build JavaScript files related to default application chat_app_js - Build JavaScript files related to chat application + thread_log_app_js - Build JavaScript files related to thread log application users_app_js - Build JavaScript files related to users application core_handlebars - Compile Handlebars templates of the Core @@ -272,6 +273,14 @@ Users JavaScript application built. + + + + + + Thread log JavaScript application built. + + Compile Handlebars templates of the Core @@ -301,7 +310,7 @@ - + Mibew Messenger built. diff --git a/src/messenger/webim/js/compiled/thread_log/app.js b/src/messenger/webim/js/compiled/thread_log/app.js new file mode 100644 index 00000000..ef2454bf --- /dev/null +++ b/src/messenger/webim/js/compiled/thread_log/app.js @@ -0,0 +1,8 @@ +/* + This file is part of Mibew Messenger project. + http://mibew.org + + Copyright (c) 2005-2011 Mibew Messenger Community + License: http://mibew.org/license.php +*/ +(function(b,c){var a=new c.Marionette.Application;a.addRegions({messagesRegion:"#messages-region"});a.addInitializer(function(c){a.messagesRegion.show(new b.Views.MessagesCollection({collection:new b.Collections.Messages(c.messages)}))});b.Application=a})(Mibew,Backbone); diff --git a/src/messenger/webim/js/compiled/thread_log/collection_views/messages_collection.js b/src/messenger/webim/js/compiled/thread_log/collection_views/messages_collection.js new file mode 100644 index 00000000..e935244f --- /dev/null +++ b/src/messenger/webim/js/compiled/thread_log/collection_views/messages_collection.js @@ -0,0 +1,8 @@ +/* + This file is part of Mibew Messenger project. + http://mibew.org + + Copyright (c) 2005-2011 Mibew Messenger Community + License: http://mibew.org/license.php +*/ +(function(a){a.Views.MessagesCollection=a.Views.CollectionBase.extend({itemView:a.Views.Message,className:"messages-collection"})})(Mibew); diff --git a/src/messenger/webim/js/compiled/thread_log/collections/messages.js b/src/messenger/webim/js/compiled/thread_log/collections/messages.js new file mode 100644 index 00000000..3a56b125 --- /dev/null +++ b/src/messenger/webim/js/compiled/thread_log/collections/messages.js @@ -0,0 +1,8 @@ +/* + This file is part of Mibew Messenger project. + http://mibew.org + + Copyright (c) 2005-2011 Mibew Messenger Community + License: http://mibew.org/license.php +*/ +(function(a,b){a.Collections.Messages=b.Collection.extend({model:a.Models.Message})})(Mibew,Backbone,_); diff --git a/src/messenger/webim/js/compiled/thread_log_app.js b/src/messenger/webim/js/compiled/thread_log_app.js new file mode 100644 index 00000000..7ab9fab8 --- /dev/null +++ b/src/messenger/webim/js/compiled/thread_log_app.js @@ -0,0 +1,3 @@ +;(function(a,b){a.Collections.Messages=b.Collection.extend({model:a.Models.Message})})(Mibew,Backbone,_); +(function(a){a.Views.MessagesCollection=a.Views.CollectionBase.extend({itemView:a.Views.Message,className:"messages-collection"})})(Mibew); +(function(b,c){var a=new c.Marionette.Application;a.addRegions({messagesRegion:"#messages-region"});a.addInitializer(function(c){a.messagesRegion.show(new b.Views.MessagesCollection({collection:new b.Collections.Messages(c.messages)}))});b.Application=a})(Mibew,Backbone); diff --git a/src/messenger/webim/js/source/thread_log/app.js b/src/messenger/webim/js/source/thread_log/app.js new file mode 100644 index 00000000..287f3733 --- /dev/null +++ b/src/messenger/webim/js/source/thread_log/app.js @@ -0,0 +1,27 @@ +/** + * @preserve This file is part of Mibew Messenger project. + * http://mibew.org + * + * Copyright (c) 2005-2011 Mibew Messenger Community + * License: http://mibew.org/license.php + */ + +(function (Mibew, Backbone) { + + // Create application instance + var App = new Backbone.Marionette.Application(); + + // Define regions + App.addRegions({ + messagesRegion: '#messages-region' + }); + + // Initialize application + App.addInitializer(function(options){ + App.messagesRegion.show(new Mibew.Views.MessagesCollection({ + collection: new Mibew.Collections.Messages(options.messages) + })); + }); + + Mibew.Application = App; +})(Mibew, Backbone); \ No newline at end of file diff --git a/src/messenger/webim/js/source/thread_log/collection_views/messages_collection.js b/src/messenger/webim/js/source/thread_log/collection_views/messages_collection.js new file mode 100644 index 00000000..11fee5c1 --- /dev/null +++ b/src/messenger/webim/js/source/thread_log/collection_views/messages_collection.js @@ -0,0 +1,31 @@ +/** + * @preserve This file is part of Mibew Messenger project. + * http://mibew.org + * + * Copyright (c) 2005-2011 Mibew Messenger Community + * License: http://mibew.org/license.php + */ + +(function(Mibew) { + + /** + * @class Represents messages list view + */ + Mibew.Views.MessagesCollection = Mibew.Views.CollectionBase.extend( + /** @lends Mibew.Views.MessagesCollection.prototype */ + { + /** + * Default item view constructor. + * @type Function + */ + itemView: Mibew.Views.Message, + + /** + * Class name for view's DOM element + * @type String + */ + className: 'messages-collection' + } + ); + +})(Mibew); \ No newline at end of file diff --git a/src/messenger/webim/js/source/thread_log/collections/messages.js b/src/messenger/webim/js/source/thread_log/collections/messages.js new file mode 100644 index 00000000..40d8858d --- /dev/null +++ b/src/messenger/webim/js/source/thread_log/collections/messages.js @@ -0,0 +1,25 @@ +/** + * @preserve This file is part of Mibew Messenger project. + * http://mibew.org + * + * Copyright (c) 2005-2011 Mibew Messenger Community + * License: http://mibew.org/license.php + */ + +(function(Mibew, Backbone, _){ + + /** + * @class Represents messages list + */ + Mibew.Collections.Messages = Backbone.Collection.extend( + /** @lends Mibew.Collections.Message.prototype */ + { + /** + * Default contructor for model + * @type Function + */ + model: Mibew.Models.Message + } + ); + +})(Mibew, Backbone, _); \ No newline at end of file diff --git a/src/messenger/webim/operator/threadprocessor.php b/src/messenger/webim/operator/threadprocessor.php index 748ef70a..e7178261 100644 --- a/src/messenger/webim/operator/threadprocessor.php +++ b/src/messenger/webim/operator/threadprocessor.php @@ -53,12 +53,13 @@ if (isset($_GET['threadid'])) { // Build messages list $lastid = -1; $messages = $thread_info['thread']->getMessages(false, $lastid); - foreach ($messages as $key => $msg) { - if ($msg['kind'] == Thread::KIND_AVATAR) { - unset($messages[$key]); + $result = array(); + foreach ($messages as $msg) { + if ($msg['kind'] != Thread::KIND_AVATAR) { + $result[] = $msg; } } - $page['threadMessages'] = json_encode($messages); + $page['threadMessages'] = json_encode($result); } prepare_menu($operator, false); diff --git a/src/messenger/webim/view/thread_log.php b/src/messenger/webim/view/thread_log.php index dd841dbb..1b17bfd8 100644 --- a/src/messenger/webim/view/thread_log.php +++ b/src/messenger/webim/view/thread_log.php @@ -18,24 +18,28 @@ $page['title'] = getlocal("thread.chat_log"); function tpl_header() { global $page, $webimroot; ?> - - - - - + + + + + + + + + + + + + + + +//--> -
- -
+