Merge branch 'master' of github.com:webnotes/erpnext into unicode

Conflicts:
	erpnext/stock/doctype/item/item.txt
diff --git a/erpnext/buying/Report/Supplier Quotations/Supplier Quotations.txt b/erpnext/buying/Report/Supplier Quotations/Supplier Quotations.txt
new file mode 100644
index 0000000..860a4328
--- /dev/null
+++ b/erpnext/buying/Report/Supplier Quotations/Supplier Quotations.txt
@@ -0,0 +1,26 @@
+# Report, Supplier Quotations
+[
+
+	# These values are common in all dictionaries
+	{
+		'creation': '2012-08-07 14:52:42',
+		'docstatus': 0,
+		'modified': '2012-08-07 14:57:57',
+		'modified_by': u'Administrator',
+		'owner': u'Administrator'
+	},
+
+	# These values are common for all Report
+	{
+		'doctype': 'Report',
+		'json': u'{"filters":[["Supplier Quotation","supplier","like","%%"],["Supplier Quotation Item","item_code","like","%%"]],"columns":[["name","Supplier Quotation"],["supplier","Supplier Quotation"],["item_code","Supplier Quotation Item"],["description","Supplier Quotation Item"],["qty","Supplier Quotation Item"],["currency","Supplier Quotation"],["import_rate","Supplier Quotation Item"],["import_amount","Supplier Quotation Item"]],"sort_by":"modified","sort_order":"desc","sort_by_next":"name","sort_order_next":"desc"}',
+		'name': '__common__',
+		'ref_doctype': u'Supplier Quotation'
+	},
+
+	# Report, Supplier Quotations
+	{
+		'doctype': 'Report',
+		'name': u'Supplier Quotations'
+	}
+]
\ No newline at end of file
diff --git a/erpnext/home/page/desktop/desktop.js b/erpnext/home/page/desktop/desktop.js
index 0db20fb..9ba5253 100644
--- a/erpnext/home/page/desktop/desktop.js
+++ b/erpnext/home/page/desktop/desktop.js
@@ -126,6 +126,7 @@
 	add_circle('todo', 'things_todo', 'Things To Do');
 	add_circle('calendar', 'todays_events', 'Todays Events');
 	add_circle('project', 'open_tasks', 'Open Tasks');
+	add_circle('kb', 'unanswered_questions', 'Unanswered Questions');
 
 	erpnext.update_messages();
 
diff --git a/erpnext/patches/august_2012/__init__.py b/erpnext/patches/august_2012/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/erpnext/patches/august_2012/__init__.py
diff --git a/erpnext/patches/august_2012/report_supplier_quotations.py b/erpnext/patches/august_2012/report_supplier_quotations.py
new file mode 100644
index 0000000..bb03479
--- /dev/null
+++ b/erpnext/patches/august_2012/report_supplier_quotations.py
@@ -0,0 +1,3 @@
+def execute():
+	from webnotes.modules import reload_doc
+	reload_doc("buying", "Report", "Supplier Quotations")
\ No newline at end of file
diff --git a/erpnext/patches/patch_list.py b/erpnext/patches/patch_list.py
index 735287e..e61a8ef 100644
--- a/erpnext/patches/patch_list.py
+++ b/erpnext/patches/patch_list.py
@@ -541,4 +541,8 @@
 		'patch_module': 'patches.july_2012',
 		'patch_file': 'supplier_quotation',
 	},
+	{
+		'patch_module': 'patches.august_2012',
+		'patch_file': 'report_supplier_quotations',
+	},
 ]
\ No newline at end of file
diff --git a/erpnext/startup/startup.js b/erpnext/startup/startup.js
index 9ea3c89..6010464 100644
--- a/erpnext/startup/startup.js
+++ b/erpnext/startup/startup.js
@@ -136,6 +136,7 @@
 				show_in_circle('things_todo', r.message.things_todo);
 				show_in_circle('todays_events', r.message.todays_events);
 				show_in_circle('open_tasks', r.message.open_tasks);
+				show_in_circle('unanswered_questions', r.message.unanswered_questions);
 
 			} else {
 				clearInterval(wn.updates.id);
diff --git a/erpnext/startup/startup.py b/erpnext/startup/startup.py
index c990207..0ae3114 100644
--- a/erpnext/startup/startup.py
+++ b/erpnext/startup/startup.py
@@ -12,9 +12,7 @@
 		""", webnotes.user.name, as_list=1)
 
 def get_open_support_tickets():
-	"""
-		Returns a count of open support tickets
-	"""
+	"""Returns a count of open support tickets"""
 	from webnotes.utils import cint
 	open_support_tickets = webnotes.conn.sql("""\
 		SELECT COUNT(*) FROM `tabSupport Ticket`
@@ -22,18 +20,14 @@
 	return open_support_tickets and cint(open_support_tickets[0][0]) or 0
 
 def get_open_tasks():
-	"""
-		Returns a count of open tasks
-	"""
+	"""Returns a count of open tasks"""
 	from webnotes.utils import cint
 	return webnotes.conn.sql("""\
 		SELECT COUNT(*) FROM `tabTask`
 		WHERE status = 'Open'""")[0][0]
 
 def get_things_todo():
-	"""
-		Returns a count of incomplete todos
-	"""
+	"""Returns a count of incomplete todos"""
 	from webnotes.utils import cint
 	incomplete_todos = webnotes.conn.sql("""\
 		SELECT COUNT(*) FROM `tabToDo`
@@ -42,9 +36,7 @@
 	return incomplete_todos and cint(incomplete_todos[0][0]) or 0
 
 def get_todays_events():
-	"""
-		Returns a count of todays events in calendar
-	"""
+	"""Returns a count of todays events in calendar"""
 	from webnotes.utils import nowdate, cint
 	todays_events = webnotes.conn.sql("""\
 		SELECT COUNT(*) FROM `tabEvent`
@@ -54,6 +46,11 @@
 		webnotes.session.get('user'), nowdate()))
 	return todays_events and cint(todays_events[0][0]) or 0
 
+def get_unanswered_questions():
+	return len(filter(lambda d: d[0]==0,
+		webnotes.conn.sql("""select (select count(*) from tabAnswer 
+		where tabAnswer.question = tabQuestion.name) as answers from tabQuestion""")))
+	
 @webnotes.whitelist()
 def get_global_status_messages(arg=None):
 	return {
@@ -61,5 +58,6 @@
 		'open_support_tickets': get_open_support_tickets(),
 		'things_todo': get_things_todo(),
 		'todays_events': get_todays_events(),
-		'open_tasks': get_open_tasks()
+		'open_tasks': get_open_tasks(),
+		'unanswered_questions': get_unanswered_questions()
 	}
diff --git a/erpnext/utilities/page/kb_common/kb_common.js b/erpnext/utilities/page/kb_common/kb_common.js
index d77a938..9d6b7e8 100644
--- a/erpnext/utilities/page/kb_common/kb_common.js
+++ b/erpnext/utilities/page/kb_common/kb_common.js
@@ -25,6 +25,7 @@
 		this.wrapper = $a(this.parent, 'div', '', {});
 		this.line1 = $a(this.wrapper, 'div', '', {color: '#888', fontSize:'11px', margin:'7px 0px'});
 		this.make_timestamp();
+		this.make_answers();
 		if(this.with_tags)
 			this.make_tags();
 		this.setup_del();
@@ -43,6 +44,18 @@
 		}
 	}
 
+	this.make_answers = function() {
+		if(this.doctype=='Question') {
+			if(this.det.answers==0) {
+				this.line1.innerHTML += ' | no answers';
+			} else if(this.det.answers==1) {
+				this.line1.innerHTML += ' | 1 answer';
+			} else {
+				this.line1.innerHTML += ' | '+this.det.answers+' answers';
+			}
+		}
+	}
+	
 	this.make_tags = function() {
 		this.line1.innerHTML += ' | '
 		this.tags_area = $a(this.line1, 'span', 'kb-tags')
@@ -80,7 +93,7 @@
 		<div class="ed-text-display %(disp_class)s"></div>\
 		<a class="ed-text-edit" style="cursor: pointer; float: right; margin-top: -16px;">[edit]</a>\
 		<textarea class="ed-text-input %(inp_class)s hide"></textarea>\
-		<div class="help hide"><br>Formatted as <a href="http://en.wikipedia.org/wiki/Markdown#Syntax_examples"\
+		<div class="help hide"><br>Formatted as <a href="#markdown-reference"\
 		 	target="_blank">markdown</a></div>\
 		<button class="btn btn-small btn-info hide ed-text-save">Save</button>\
 		<a class="ed-text-cancel hide" style="cursor: pointer;">Cancel</a>\
diff --git a/erpnext/utilities/page/markdown_reference/__init__.py b/erpnext/utilities/page/markdown_reference/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/erpnext/utilities/page/markdown_reference/__init__.py
diff --git a/erpnext/utilities/page/markdown_reference/markdown_reference.css b/erpnext/utilities/page/markdown_reference/markdown_reference.css
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/erpnext/utilities/page/markdown_reference/markdown_reference.css
diff --git a/erpnext/utilities/page/markdown_reference/markdown_reference.html b/erpnext/utilities/page/markdown_reference/markdown_reference.html
new file mode 100644
index 0000000..5af414f
--- /dev/null
+++ b/erpnext/utilities/page/markdown_reference/markdown_reference.html
@@ -0,0 +1,150 @@
+<div class="layout-wrapper layout-wrapper-background">
+	<div class="layout-appframe">
+		<div class="appframe-titlebar">
+			<span class="appframe-title">Markdown Reference</span>
+			<span class="close" onclick="window.history.back()">&times;</span>
+		</div>
+	</div>
+	<div class="layout-main">
+		<div style="width: 60%">
+<h3>Phrase Emphasis</h3>
+<pre><code>*italic*   **bold**
+_italic_   __bold__
+</code></pre>
+
+<h3>Links</h3>
+
+<p>Inline:</p>
+
+<pre><code>An [example](http://url.com/ "Title")
+</code></pre>
+
+<p>Reference-style labels (titles are optional):</p>
+
+<pre><code>An [example][id]. Then, anywhere
+else in the doc, define the link:
+
+   [id]: http://example.com/  "Title"
+</code></pre>
+
+<h3>Images</h3>
+
+<p>Inline (titles are optional):</p>
+
+<pre><code>![alt text](/path/img.jpg "Title")
+</code></pre>
+
+<p>Reference-style:</p>
+
+<pre><code>![alt text][id]
+
+    [id]: /url/to/img.jpg "Title"
+</code></pre>
+
+<h3>Headers</h3>
+
+<p>Setext-style:</p>
+
+<pre><code>Header 1
+========
+
+Header 2
+--------
+
+</code></pre>
+
+<p>atx-style (closing #'s are optional):</p>
+
+<pre><code># Header 1 #
+
+
+</code></pre>
+
+<h3>Lists</h3>
+
+<p>Ordered, without paragraphs:</p>
+
+<pre><code>1.  Foo
+2.  Bar
+</code></pre>
+
+<p>Unordered, with paragraphs:</p>
+
+<pre><code>*   A list item.
+
+    With multiple paragraphs.
+
+*   Bar
+</code></pre>
+
+<p>You can nest them:</p>
+
+<pre><code>*   Abacus
+    * ass
+*   Bastard
+    1.  bitch
+    2.  bupkis
+        * BELITTLER
+    3. burper
+*   Cunning
+</code></pre>
+
+<h3>Blockquotes</h3>
+
+<pre><code>&gt; Email-style angle brackets
+
+&gt; are used for blockquotes.
+
+&gt; &gt; And, they can be nested.
+
+&gt; &gt;
+&gt; * You can quote a list.
+&gt; * Etc.
+</code></pre>
+
+<h3>Code Spans</h3>
+
+<pre><code>`&lt;code&gt;` spans are delimited
+by backticks.
+
+You can include literal backticks
+like `` `this` ``.
+</code></pre>
+
+<h3>Preformatted Code Blocks</h3>
+
+<p>Indent every line of a code block by at least 4 spaces or 1 tab, and use a colon at the end of the preceding paragraph.</p>
+
+<pre><code>This is a normal paragraph:
+
+    This is a preformatted
+    code block.
+
+Preceded by a space, the colon
+disappears. :
+
+    This is a preformatted
+    code block.
+</code></pre>
+
+<h3>Horizontal Rules</h3>
+
+<p>Three or more dashes or asterisks:</p>
+
+<pre><code>---
+
+* * *
+
+- - - -
+</code></pre>
+
+<h3>Manual Line Breaks</h3>
+
+<p>End a line with two or more spaces:</p>
+
+<pre><code>Roses are red,
+Violets are blue.
+</code></pre>
+		</div>
+	</div>
+</div>
\ No newline at end of file
diff --git a/erpnext/utilities/page/markdown_reference/markdown_reference.js b/erpnext/utilities/page/markdown_reference/markdown_reference.js
new file mode 100644
index 0000000..8e8fbac
--- /dev/null
+++ b/erpnext/utilities/page/markdown_reference/markdown_reference.js
@@ -0,0 +1 @@
+wn.pages['markdown-reference'].onload = function(wrapper) { }
\ No newline at end of file
diff --git a/erpnext/utilities/page/markdown_reference/markdown_reference.py b/erpnext/utilities/page/markdown_reference/markdown_reference.py
new file mode 100644
index 0000000..f807eb0
--- /dev/null
+++ b/erpnext/utilities/page/markdown_reference/markdown_reference.py
@@ -0,0 +1 @@
+import webnotes
\ No newline at end of file
diff --git a/erpnext/utilities/page/markdown_reference/markdown_reference.txt b/erpnext/utilities/page/markdown_reference/markdown_reference.txt
new file mode 100644
index 0000000..304f2e3
--- /dev/null
+++ b/erpnext/utilities/page/markdown_reference/markdown_reference.txt
@@ -0,0 +1,28 @@
+# Page, markdown-reference
+[
+
+	# These values are common in all dictionaries
+	{
+		'creation': '2012-08-07 12:35:30',
+		'docstatus': 0,
+		'modified': '2012-08-07 12:35:30',
+		'modified_by': u'Administrator',
+		'owner': u'Administrator'
+	},
+
+	# These values are common for all Page
+	{
+		'doctype': 'Page',
+		'module': u'Utilities',
+		'name': '__common__',
+		'page_name': u'Markdown Reference',
+		'standard': u'Yes',
+		'title': u'Markdown Reference'
+	},
+
+	# Page, markdown-reference
+	{
+		'doctype': 'Page',
+		'name': u'markdown-reference'
+	}
+]
\ No newline at end of file
diff --git a/erpnext/utilities/page/questions/questions.css b/erpnext/utilities/page/questions/questions.css
index 52e8a38..779da55 100644
--- a/erpnext/utilities/page/questions/questions.css
+++ b/erpnext/utilities/page/questions/questions.css
@@ -14,6 +14,10 @@
 .kb-questions {
 }
 
+.un-answered {
+	color: #f33;
+}
+
 .kb-question-details {
 	margin: 11px 0px 11px 29px;
 }
diff --git a/erpnext/utilities/page/questions/questions.js b/erpnext/utilities/page/questions/questions.js
index 048ed54..22a70d8 100644
--- a/erpnext/utilities/page/questions/questions.js
+++ b/erpnext/utilities/page/questions/questions.js
@@ -115,24 +115,16 @@
 			no_results_message: 'No questions found. Ask a new question!',
 			appframe: wn.pages.questions.appframe,
 			as_dict: 1,
-			get_query: function() {
-				
-				// filter by search string
-				var v = me.search.value==$(me.search).attr('default_text') ? '' : me.search.value;
-				cond = v ? (' and t1.question like "%'+v+'%"') : '';
-				
-				// filter by tags
-				if(me.tag_filter_dict) {
-					for(f in me.tag_filter_dict) {
-						cond += ' and t1.`_user_tags` like "%' + f + '%"'
-					}
+			method: 'utilities.page.questions.questions.get_questions',
+			get_args: function() {
+				var args = {};
+				if(me.search.value) {
+					args.search_text = me.search.value;
 				}
-				return repl('select t1.name, t1.owner, t1.question, t1.modified, t1._user_tags, '
-				+'t1._users_voted, t2.first_name, t2.last_name '
-				+'from tabQuestion t1, tabProfile t2 '
-				+'where t1.docstatus!=2 '
-				+'and t1.owner = t2.name'
-				+'%(cond)s order by t1.modified desc', {user:user, cond: cond})
+				if(me.tag_filter_dict) {
+					args.tag_filters = keys(me.tag_filter_dict);
+				}
+				return args
 			},
 			render_row: function(parent, data, listing) {
 				new KBQuestion(parent, data, me);
@@ -196,7 +188,11 @@
 	
 	this.make = function() {
 		this.wrapper = $a(parent, 'div', 'kb-question-wrapper');
-		this.q_area = $a($a(this.wrapper, 'div'), 'h3', 'kb-questions link_type', {display:'inline', textDecoration:'none'}, det.question);
+		this.q_area = $a($a(this.wrapper, 'div'), 'h3', 
+			'kb-questions link_type', {display:'inline', textDecoration:'none'}, det.question);
+		if(det.answers==0) {
+			$(this.q_area).addClass('un-answered')
+		}
 
 		this.q_area.onclick = function() {
 			var q = this;
diff --git a/erpnext/utilities/page/questions/questions.py b/erpnext/utilities/page/questions/questions.py
index a16c058..459a32f 100644
--- a/erpnext/utilities/page/questions/questions.py
+++ b/erpnext/utilities/page/questions/questions.py
@@ -20,6 +20,29 @@
 from webnotes.utils import load_json, cint, cstr
 import json
 
+@webnotes.whitelist()
+def get_questions():
+	"""get list of questions"""
+	import json
+	conds = ''
+	
+	if 'search_text' in webnotes.form_dict:
+		conds = ' and t1.question like "%'+ webnotes.form_dict['search_text'] + '%"'
+		
+	if 'tag_filters' in webnotes.form_dict:
+		tag_filters = json.loads(webnotes.form_dict['tag_filters'])
+		for t in tag_filters:
+			conds += ' and t1._user_tags like "%'+ t +'%"'
+	
+	return webnotes.conn.sql("""select t1.name, t1.owner, t1.question, t1.modified, t1._user_tags,
+			t2.first_name, t2.last_name, (select count(*) from tabAnswer where
+			tabAnswer.question = t1.name) as answers
+		from tabQuestion t1, tabProfile t2
+		where t1.docstatus!=2
+		and t1.owner = t2.name
+		%(conds)s
+		order by t1.modified desc""" % {"conds":conds}, as_dict=1)
+
 # add a new question
 @webnotes.whitelist()
 def add_question(arg):
@@ -27,7 +50,7 @@
 	
 	from webnotes.model.doc import Document
 	d = Document('Question')
-	d.question = args['question'].title()
+	d.question = args['question']
 	d.points = 1
 	d.save(1)
 	
@@ -40,20 +63,6 @@
 					'txt': 'Please help me and answer the question "%s" in the Knowledge Base' % d.question,
 					'notify': 1
 				}))
-	
-@webnotes.whitelist()
-def vote(arg):
-	args = load_json(arg)
-	
-	res = webnotes.conn.sql("select points, _users_voted from `tab%s` where name=%s" % (args['dt'], '%s'), args['dn'])[0]
-	p = cint(res[0])
-	p = args['vote']=='up' and p+1 or p-1
-	
-	# update
-	webnotes.conn.sql("update `tab%s` set points=%s, _users_voted=%s where name=%s" % (args['dt'], '%s', '%s', '%s'), \
-		(p, cstr(res[1]) + ',' + webnotes.user.name, args['dn']))
-	
-	return p
 
 @webnotes.whitelist()
 def delete(arg):
diff --git a/erpnext/utilities/page/todo/todo.js b/erpnext/utilities/page/todo/todo.js
index 786e757..1ab8982 100644
--- a/erpnext/utilities/page/todo/todo.js
+++ b/erpnext/utilities/page/todo/todo.js
@@ -89,7 +89,7 @@
 		}
 		if(!todo.description) todo.description = '';
 		
-		todo.desc = todo.description.replace(/\n/g, "<br>");
+		todo.desc = wn.markdown(todo.description);
 		
 		$(parent_list).append(repl('\
 			<div class="todoitem">\
@@ -145,7 +145,9 @@
 			title: 'To Do', 
 			fields: [
 				{fieldtype:'Date', fieldname:'date', label:'Event Date', reqd:1},
-				{fieldtype:'Text', fieldname:'description', label:'Description', reqd:1},
+				{fieldtype:'Text', fieldname:'description', label:'Description', 
+					reqd:1, description:'Use <a href="#markdown-reference">markdown</a> to \
+						format content'},
 				{fieldtype:'Check', fieldname:'checked', label:'Completed'},
 				{fieldtype:'Select', fieldname:'priority', label:'Priority', reqd:1, 'options':['Medium','High','Low'].join('\n')},
 				{fieldtype:'Button', fieldname:'save', label:'Save'}
diff --git a/erpnext/utilities/page/todo/todo.py b/erpnext/utilities/page/todo/todo.py
index 5f358b9..37f9295 100644
--- a/erpnext/utilities/page/todo/todo.py
+++ b/erpnext/utilities/page/todo/todo.py
@@ -29,6 +29,7 @@
 
 @webnotes.whitelist()		
 def edit(arg=None):
+	import markdown2
 	args = webnotes.form_dict
 
 	d = Document('ToDo', args.get('name') or None)
diff --git a/public/css/all-app.css b/public/css/all-app.css
index 32d2f6b..fe41bef 100644
--- a/public/css/all-app.css
+++ b/public/css/all-app.css
@@ -1969,7 +1969,25 @@
 }
 
 
-pre { margin: 0px; padding: 0px; }
+pre {
+    background-color: #F5F5F5;
+    border: 1px solid rgba(0, 0, 0, 0.15);
+    border-radius: 4px 4px 4px 4px;
+    display: block;
+    font-size: 12.025px;
+    line-height: 18px;
+    margin: 0 0 15px;
+    padding: 8.5px;
+    white-space: pre-wrap;
+    word-wrap: break-word;
+}
+
+code, pre {
+    border-radius: 3px 3px 3px 3px;
+    color: #333333;
+    font-family: Menlo,Monaco,Consolas,"Courier New",monospace;
+    font-size: 12px;
+}
 
 button { margin: 2px; margin-left: 0px; }
 
diff --git a/public/css/all-web.css b/public/css/all-web.css
index 322cb25..7ae3ff6 100644
--- a/public/css/all-web.css
+++ b/public/css/all-web.css
@@ -1830,7 +1830,25 @@
 }
 
 
-pre { margin: 0px; padding: 0px; }
+pre {
+    background-color: #F5F5F5;
+    border: 1px solid rgba(0, 0, 0, 0.15);
+    border-radius: 4px 4px 4px 4px;
+    display: block;
+    font-size: 12.025px;
+    line-height: 18px;
+    margin: 0 0 15px;
+    padding: 8.5px;
+    white-space: pre-wrap;
+    word-wrap: break-word;
+}
+
+code, pre {
+    border-radius: 3px 3px 3px 3px;
+    color: #333333;
+    font-family: Menlo,Monaco,Consolas,"Courier New",monospace;
+    font-size: 12px;
+}
 
 button { margin: 2px; margin-left: 0px; }
 
diff --git a/public/js/all-app.js b/public/js/all-app.js
index 1921530..bfd16e9 100644
--- a/public/js/all-app.js
+++ b/public/js/all-app.js
@@ -1913,7 +1913,7 @@
 if(this.df['default'].toLowerCase()=='no add rows'){this.grid.can_add_rows=false;}}
 if(st=='Write'){this.grid.show();}else if(st=='Read'){this.grid.show();}else{this.grid.hide();}
 this.grid.refresh();}
-_f.TableField.prototype.set=function(v){};_f.TableField.prototype.set_input=function(v){};_f.CodeField=function(){};_f.CodeField.prototype=new Field();_f.CodeField.prototype.make_input=function(){var me=this;this.label_span.innerHTML=this.df.label;if(this.df.fieldtype=='Text Editor'){this.input=$a(this.input_area,'text_area','',{fontSize:'12px'});this.myid=wn.dom.set_unique_id(this.input);$(me.input).tinymce({script_url:'js/lib/tiny_mce_33/tiny_mce.js',theme:"advanced",plugins:"style,inlinepopups,table",extended_valid_elements:"div[id|dir|class|align|style]",width:'100%',height:'360px',theme_advanced_buttons1:"bold,italic,underline,strikethrough,hr,|,justifyleft,justifycenter,justifyright,|,formatselect,fontselect,fontsizeselect",theme_advanced_buttons2:"bullist,numlist,|,outdent,indent,|,undo,redo,|,link,unlink,code,|,forecolor,backcolor,|,tablecontrols",theme_advanced_buttons3:"",theme_advanced_toolbar_location:"top",theme_advanced_toolbar_align:"left",content_css:"js/lib/tiny_mce_33/custom_content.css",oninit:function(){me.init_editor();}});this.input.set_input=function(v){if(me.editor){me.editor.setContent(v);}else{$(me.input).val(v);}}
+_f.TableField.prototype.set=function(v){};_f.TableField.prototype.set_input=function(v){};_f.CodeField=function(){};_f.CodeField.prototype=new Field();_f.CodeField.prototype.make_input=function(){var me=this;this.label_span.innerHTML=this.df.label;if(this.df.fieldtype=='Text Editor'){this.input=$a(this.input_area,'text_area','',{fontSize:'12px'});this.myid=wn.dom.set_unique_id(this.input);$(me.input).tinymce({script_url:'js/lib/tiny_mce_33/tiny_mce.js',theme:"advanced",plugins:"style,inlinepopups,table",extended_valid_elements:"div[id|dir|class|align|style]",width:'100%',height:'360px',theme_advanced_buttons1:"bold,italic,underline,strikethrough,hr,|,justifyleft,justifycenter,justifyright,|,formatselect,fontselect,fontsizeselect",theme_advanced_buttons2:"bullist,numlist,|,outdent,indent,|,undo,redo,|,link,unlink,code,|,forecolor,backcolor,|,tablecontrols",theme_advanced_buttons3:"",theme_advanced_toolbar_location:"top",theme_advanced_toolbar_align:"left",content_css:"js/lib/tiny_mce_33/custom_content.css?q=1",oninit:function(){me.init_editor();}});this.input.set_input=function(v){if(me.editor){me.editor.setContent(v);}else{$(me.input).val(v);}}
 this.input.onchange=function(){me.set(me.editor.getContent());me.run_trigger();}
 this.get_value=function(){return me.editor.getContent();}}else{wn.require('js/lib/ace/ace.js');$(this.input_area).css('border','1px solid #aaa');this.pre=$a(this.input_area,'pre','',{position:'relative',height:'400px',width:'100%'});this.input={};this.myid=wn.dom.set_unique_id(this.pre);this.editor=ace.edit(this.myid);if(me.df.options=='Markdown'||me.df.options=='HTML'){wn.require('js/lib/ace/mode-html.js');var HTMLMode=require("ace/mode/html").Mode;me.editor.getSession().setMode(new HTMLMode());}
 else if(me.df.options=='Javascript'){wn.require('js/lib/ace/mode-javascript.js');var JavascriptMode=require("ace/mode/javascript").Mode;me.editor.getSession().setMode(new JavascriptMode());}
@@ -2270,7 +2270,7 @@
   href="http://erpnext.com" target="_blank"></a>')}
 erpnext.update_messages=function(reset){if(inList(['Guest'],user)||!wn.session_alive){return;}
 if(!reset){var set_messages=function(r){if(!r.exc){erpnext.toolbar.set_new_comments(r.message.unread_messages);var show_in_circle=function(parent_id,msg){var parent=$('#'+parent_id);if(parent){if(msg){parent.find('span:first').text(msg);parent.toggle(true);}else{parent.toggle(false);}}}
-show_in_circle('unread_messages',r.message.unread_messages.length);show_in_circle('open_support_tickets',r.message.open_support_tickets);show_in_circle('things_todo',r.message.things_todo);show_in_circle('todays_events',r.message.todays_events);show_in_circle('open_tasks',r.message.open_tasks);}else{clearInterval(wn.updates.id);}}
+show_in_circle('unread_messages',r.message.unread_messages.length);show_in_circle('open_support_tickets',r.message.open_support_tickets);show_in_circle('things_todo',r.message.things_todo);show_in_circle('todays_events',r.message.todays_events);show_in_circle('open_tasks',r.message.open_tasks);show_in_circle('unanswered_questions',r.message.unanswered_questions);}else{clearInterval(wn.updates.id);}}
 wn.call({method:'startup.startup.get_global_status_messages',callback:set_messages});}else{erpnext.toolbar.set_new_comments(0);$('#unread_messages').toggle(false);}}
 erpnext.startup.set_periodic_updates=function(){wn.updates={};if(wn.updates.id){clearInterval(wn.updates.id);}
 wn.updates.id=setInterval(erpnext.update_messages,60000);}
diff --git a/public/js/all-web.js b/public/js/all-web.js
index 9f4d63b..979f8e9 100644
--- a/public/js/all-web.js
+++ b/public/js/all-web.js
@@ -730,7 +730,7 @@
   href="http://erpnext.com" target="_blank"></a>')}
 erpnext.update_messages=function(reset){if(inList(['Guest'],user)||!wn.session_alive){return;}
 if(!reset){var set_messages=function(r){if(!r.exc){erpnext.toolbar.set_new_comments(r.message.unread_messages);var show_in_circle=function(parent_id,msg){var parent=$('#'+parent_id);if(parent){if(msg){parent.find('span:first').text(msg);parent.toggle(true);}else{parent.toggle(false);}}}
-show_in_circle('unread_messages',r.message.unread_messages.length);show_in_circle('open_support_tickets',r.message.open_support_tickets);show_in_circle('things_todo',r.message.things_todo);show_in_circle('todays_events',r.message.todays_events);show_in_circle('open_tasks',r.message.open_tasks);}else{clearInterval(wn.updates.id);}}
+show_in_circle('unread_messages',r.message.unread_messages.length);show_in_circle('open_support_tickets',r.message.open_support_tickets);show_in_circle('things_todo',r.message.things_todo);show_in_circle('todays_events',r.message.todays_events);show_in_circle('open_tasks',r.message.open_tasks);show_in_circle('unanswered_questions',r.message.unanswered_questions);}else{clearInterval(wn.updates.id);}}
 wn.call({method:'startup.startup.get_global_status_messages',callback:set_messages});}else{erpnext.toolbar.set_new_comments(0);$('#unread_messages').toggle(false);}}
 erpnext.startup.set_periodic_updates=function(){wn.updates={};if(wn.updates.id){clearInterval(wn.updates.id);}
 wn.updates.id=setInterval(erpnext.update_messages,60000);}
diff --git a/public/js/kb_common.js b/public/js/kb_common.js
index e61b5ef..bbd57f1 100644
--- a/public/js/kb_common.js
+++ b/public/js/kb_common.js
@@ -2,10 +2,11 @@
 /*
  *	erpnext/utilities/page/kb_common/kb_common.js
  */
-KBItemToolbar=function(args,kb){$.extend(this,args);var me=this;this.make=function(){this.wrapper=$a(this.parent,'div','',{});this.line1=$a(this.wrapper,'div','',{color:'#888',fontSize:'11px',margin:'7px 0px'});this.make_timestamp();if(this.with_tags)
+KBItemToolbar=function(args,kb){$.extend(this,args);var me=this;this.make=function(){this.wrapper=$a(this.parent,'div','',{});this.line1=$a(this.wrapper,'div','',{color:'#888',fontSize:'11px',margin:'7px 0px'});this.make_timestamp();this.make_answers();if(this.with_tags)
 this.make_tags();this.setup_del();}
 this.make_timestamp=function(){this.line1.innerHTML=repl('By %(name)s | %(when)s',{name:wn.utils.full_name(this.det.first_name,this.det.last_name),when:wn.datetime.comment_when(this.det.modified)});if(has_common(user_roles,['Administrator','System Manager'])){this.line1.innerHTML+=' | <a style="cursor:pointer;"\
     class="del-link">delete</a>';}}
+this.make_answers=function(){if(this.doctype=='Question'){if(this.det.answers==0){this.line1.innerHTML+=' | no answers';}else if(this.det.answers==1){this.line1.innerHTML+=' | 1 answer';}else{this.line1.innerHTML+=' | '+this.det.answers+' answers';}}}
 this.make_tags=function(){this.line1.innerHTML+=' | '
 this.tags_area=$a(this.line1,'span','kb-tags')
 this.tags=new TagList(this.tags_area,this.det._user_tags&&(this.det._user_tags.split(',')),this.doctype,this.det.name,0,kb.set_tag_filter)}