Merge branch 'navupdate' of github.com:webnotes/erpnext into navupdate
diff --git a/erpnext/utilities/page/calendar/calendar.css b/erpnext/utilities/page/calendar/calendar.css
index 2f3356f..9adae7a 100644
--- a/erpnext/utilities/page/calendar/calendar.css
+++ b/erpnext/utilities/page/calendar/calendar.css
@@ -28,6 +28,7 @@
 }
 
 div.cal_toolbar {
+	width: 80%;
 }
 
 div.cal_toolbar .btn {
@@ -155,14 +156,6 @@
 	cursor:pointer;
 }
 
-div.cal_event {
-	overflow-x: hidden;
-	font-size: 11px;
-	color: #00B;
-	margin-bottom: 2px;
-	text-decoration: underline;
-}
-
 div.cal_event_Public {
 	color: GREEN;
 }
diff --git a/erpnext/utilities/page/calendar/calendar.html b/erpnext/utilities/page/calendar/calendar.html
index 2a5150e..456566d 100644
--- a/erpnext/utilities/page/calendar/calendar.html
+++ b/erpnext/utilities/page/calendar/calendar.html
@@ -1,5 +1,5 @@
 <div class="cal_body">
-	<a class="close" href="#" onclick="window.history.back();return false;">&times;</a>
+	<a class="close" onclick="window.history.back();">&times;</a>
 	<div class="cal_toolbar btn-group">
 		<button class="btn btn-small" onclick="erpnext.calendar.add_event()">
 			<i class="icon-plus"></i> Add Event
diff --git a/erpnext/utilities/page/messages/messages.js b/erpnext/utilities/page/messages/messages.js
index b59a212..39f7974 100644
--- a/erpnext/utilities/page/messages/messages.js
+++ b/erpnext/utilities/page/messages/messages.js
@@ -38,6 +38,7 @@
 wn.pages.messages.onshow = function(wrapper) {
 	erpnext.messages.show();
 	setTimeout(erpnext.messages.refresh, 5000);
+	$('#message-post-text').focus();
 }
 
 erpnext.messages = {
@@ -83,19 +84,40 @@
 				data.creation = dateutil.comment_when(data.creation);
 				data.comment_by_fullname = wn.boot.user_fullnames[data.owner];
 
+				data.reply_html = '';
 				if(data.owner==user) {
 					data.cls = 'message-self';
 					data.comment_by_fullname = 'You';	
+					data.delete_html = repl('<a class="close" \
+						onclick="erpnext.messages.delete(this)"\
+						data-name="%(name)s">&times;</a>', data);
 				} else {
-					data.cls = 'message-other'
+					data.cls = 'message-other';
+					data.delete_html = '';
+					if(erpnext.messages.contact==user) {
+						data.reply_html = repl('<a href="#!messages/%(owner)s">\
+							<i class="icon-share-alt"></i> Reply</a>', data)
+					}
 				}
 
-				wrapper.innerHTML = repl('<div class="message %(cls)s"><b>%(comment)s</b>\
-					<div class="help">by %(comment_by_fullname)s, %(creation)s</div></div>\
+				wrapper.innerHTML = repl('<div class="message %(cls)s">%(delete_html)s\
+						<b>%(comment)s</b>\
+						<div class="help">by %(comment_by_fullname)s, %(creation)s</div>\
+						%(reply_html)s</div>\
 					<div style="clear: both;"></div>', data);
 			}
 		});
 	},
+	delete: function(ele) {
+		$(ele).parent().css('opacity', 0.6);
+		wn.call({
+			method:'utilities.page.messages.messages.delete',
+			args: {name : $(ele).attr('data-name')},
+			callback: function() {
+				$(ele).parent().toggle(false);
+			}
+		});
+	},
 	show_active_users: function() {
 		wn.call({
 			module:'utilities',
diff --git a/erpnext/utilities/page/messages/messages.py b/erpnext/utilities/page/messages/messages.py
index 6ca2817..d7c6026 100644
--- a/erpnext/utilities/page/messages/messages.py
+++ b/erpnext/utilities/page/messages/messages.py
@@ -47,4 +47,9 @@
 	d.comment_docname = arg['contact']
 	d.comment_doctype = 'Message'
 	d.save()
+	
+@webnotes.whitelist()
+def delete(arg=None):
+	webnotes.conn.sql("""delete from `tabComment Widget Record` where name=%s""", 
+		webnotes.form_dict['name']);
 	
\ No newline at end of file