Sourced wnframework-modules from Google Code as erpnext
diff --git a/knowledge_base/Module Def/Knowledge Base/Knowledge Base.txt b/knowledge_base/Module Def/Knowledge Base/Knowledge Base.txt
new file mode 100644
index 0000000..8aee002
--- /dev/null
+++ b/knowledge_base/Module Def/Knowledge Base/Knowledge Base.txt
@@ -0,0 +1,42 @@
+[
+	{
+		'creation': '2010-08-08 17:35:42',
+		'disabled': 'Yes',
+		'docstatus': 0,
+		'doctype': u'Module Def',
+		'doctype_list': None,
+		'file_list': None,
+		'idx': None,
+		'is_hidden': None,
+		'last_updated_date': None,
+		'modified': '2011-05-02 12:40:40',
+		'modified_by': 'Administrator',
+		'module_desc': '<p>Maintain your knowledge base of Questions &amp; Answers</p>',
+		'module_icon': 'help.png',
+		'module_label': 'Knowledge Base',
+		'module_name': 'Knowledge Base',
+		'module_page': 'questions',
+		'module_seq': 13,
+		'name': 'Knowledge Base',
+		'owner': 'Administrator',
+		'parent': None,
+		'parentfield': None,
+		'parenttype': None,
+		'trash_reason': None,
+		'widget_code': None
+	},
+	{
+		'creation': '2010-08-08 17:35:42',
+		'docstatus': 0,
+		'doctype': 'Module Def Role',
+		'idx': 1,
+		'modified': '2010-08-08 17:35:42',
+		'modified_by': 'Administrator',
+		'name': 'MDR00106',
+		'owner': 'Administrator',
+		'parent': 'Knowledge Base',
+		'parentfield': 'roles',
+		'parenttype': 'Module Def',
+		'role': 'All'
+	}
+]
\ No newline at end of file
diff --git a/knowledge_base/__init__.py b/knowledge_base/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/knowledge_base/__init__.py
diff --git a/knowledge_base/doctype/__init__.py b/knowledge_base/doctype/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/knowledge_base/doctype/__init__.py
diff --git a/knowledge_base/doctype/answer/__init__.py b/knowledge_base/doctype/answer/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/knowledge_base/doctype/answer/__init__.py
diff --git a/knowledge_base/doctype/answer/answer.txt b/knowledge_base/doctype/answer/answer.txt
new file mode 100644
index 0000000..2702398
--- /dev/null
+++ b/knowledge_base/doctype/answer/answer.txt
@@ -0,0 +1,220 @@
+[
+	{
+		'_last_update': None,
+		'_user_tags': None,
+		'allow_attach': 0,
+		'allow_copy': None,
+		'allow_email': None,
+		'allow_print': None,
+		'allow_rename': None,
+		'allow_trash': 1,
+		'autoname': '_ANS.#######',
+		'change_log': None,
+		'client_script': None,
+		'client_script_core': None,
+		'client_string': None,
+		'colour': 'White:FFF',
+		'creation': '2011-05-09 11:04:37',
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocType',
+		'document_type': None,
+		'dt_template': None,
+		'hide_heading': None,
+		'hide_toolbar': None,
+		'idx': None,
+		'in_create': 1,
+		'in_dialog': None,
+		'is_transaction_doc': None,
+		'issingle': None,
+		'istable': None,
+		'max_attachments': None,
+		'menu_index': None,
+		'modified': '2011-04-26 14:56:57',
+		'modified_by': 'Administrator',
+		'module': 'Knowledge Base',
+		'name': 'Answer',
+		'name_case': None,
+		'owner': 'Administrator',
+		'parent': None,
+		'parent_node': None,
+		'parentfield': None,
+		'parenttype': None,
+		'print_outline': None,
+		'read_only': 1,
+		'read_only_onload': None,
+		'search_fields': None,
+		'section_style': 'Simple',
+		'server_code': None,
+		'server_code_compiled': None,
+		'server_code_core': None,
+		'server_code_error': ' ',
+		'show_in_menu': 0,
+		'smallicon': None,
+		'use_template': None,
+		'version': 3
+	},
+	{
+		'amend': None,
+		'cancel': 1,
+		'create': 1,
+		'creation': '2011-05-09 11:04:37',
+		'docstatus': 0,
+		'doctype': 'DocPerm',
+		'execute': None,
+		'idx': 1,
+		'match': None,
+		'modified': '2011-05-09 11:04:37',
+		'modified_by': 'Administrator',
+		'name': '000000475',
+		'owner': 'Administrator',
+		'parent': 'Answer',
+		'parentfield': 'permissions',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'read': 1,
+		'role': 'All',
+		'submit': None,
+		'write': 1
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-05-09 11:04:37',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'question',
+		'fieldtype': 'Link',
+		'hidden': None,
+		'icon': None,
+		'idx': 1,
+		'in_filter': None,
+		'label': 'Question',
+		'modified': '2011-05-09 11:04:37',
+		'modified_by': 'Administrator',
+		'name': '000000476',
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': 'Question',
+		'owner': 'Administrator',
+		'parent': 'Answer',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-05-09 11:04:37',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'answer',
+		'fieldtype': 'Text',
+		'hidden': None,
+		'icon': None,
+		'idx': 2,
+		'in_filter': None,
+		'label': 'Answer',
+		'modified': '2011-05-09 11:04:37',
+		'modified_by': 'Administrator',
+		'name': '000000477',
+		'no_copy': None,
+		'oldfieldname': 'question',
+		'oldfieldtype': 'Text',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Answer',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-05-09 11:04:37',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'points',
+		'fieldtype': 'Int',
+		'hidden': None,
+		'icon': None,
+		'idx': 3,
+		'in_filter': None,
+		'label': 'Points',
+		'modified': '2011-05-09 11:04:37',
+		'modified_by': 'Administrator',
+		'name': '000000478',
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Answer',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-05-09 11:04:37',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': '_users_voted',
+		'fieldtype': 'Text',
+		'hidden': 1,
+		'icon': None,
+		'idx': 4,
+		'in_filter': None,
+		'label': 'Users Voted',
+		'modified': '2011-05-09 11:04:37',
+		'modified_by': 'Administrator',
+		'name': '000000479',
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Answer',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	}
+]
\ No newline at end of file
diff --git a/knowledge_base/doctype/question/__init__.py b/knowledge_base/doctype/question/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/knowledge_base/doctype/question/__init__.py
diff --git a/knowledge_base/doctype/question/question.txt b/knowledge_base/doctype/question/question.txt
new file mode 100644
index 0000000..066b75b
--- /dev/null
+++ b/knowledge_base/doctype/question/question.txt
@@ -0,0 +1,395 @@
+[
+	{
+		'_last_update': None,
+		'_user_tags': None,
+		'allow_attach': 0,
+		'allow_copy': None,
+		'allow_email': None,
+		'allow_print': None,
+		'allow_rename': None,
+		'allow_trash': 1,
+		'autoname': 'QUES.#######',
+		'change_log': None,
+		'client_script': None,
+		'client_script_core': None,
+		'client_string': None,
+		'colour': 'White:FFF',
+		'creation': '2010-08-08 17:09:17',
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocType',
+		'document_type': None,
+		'dt_template': None,
+		'hide_heading': None,
+		'hide_toolbar': None,
+		'idx': None,
+		'in_create': 1,
+		'in_dialog': None,
+		'is_transaction_doc': None,
+		'issingle': None,
+		'istable': None,
+		'max_attachments': None,
+		'menu_index': None,
+		'modified': '2011-04-20 18:22:44',
+		'modified_by': 'Administrator',
+		'module': 'Knowledge Base',
+		'name': 'Question',
+		'name_case': None,
+		'owner': 'Administrator',
+		'parent': None,
+		'parent_node': None,
+		'parentfield': None,
+		'parenttype': None,
+		'print_outline': None,
+		'read_only': 1,
+		'read_only_onload': None,
+		'search_fields': None,
+		'section_style': 'Simple',
+		'server_code': None,
+		'server_code_compiled': None,
+		'server_code_core': None,
+		'server_code_error': ' ',
+		'show_in_menu': 0,
+		'smallicon': None,
+		'use_template': None,
+		'version': 7
+	},
+	{
+		'amend': None,
+		'cancel': 1,
+		'create': 1,
+		'creation': '2010-08-08 17:09:17',
+		'docstatus': 0,
+		'doctype': 'DocPerm',
+		'execute': None,
+		'idx': 1,
+		'match': None,
+		'modified': '2010-08-08 17:09:17',
+		'modified_by': 'Administrator',
+		'name': 'PERM00433',
+		'owner': 'Administrator',
+		'parent': 'Question',
+		'parentfield': 'permissions',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'read': 1,
+		'role': 'All',
+		'submit': None,
+		'write': 1
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:17',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'question',
+		'fieldtype': 'Text',
+		'hidden': None,
+		'icon': None,
+		'idx': 1,
+		'in_filter': None,
+		'label': 'Question',
+		'modified': '2011-05-09 11:04:36',
+		'modified_by': 'Administrator',
+		'name': 'FL02621',
+		'no_copy': None,
+		'oldfieldname': 'question',
+		'oldfieldtype': 'Text',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Question',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-05-09 11:04:36',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'points',
+		'fieldtype': 'Int',
+		'hidden': 1,
+		'icon': None,
+		'idx': 2,
+		'in_filter': None,
+		'label': 'Points',
+		'modified': '2011-05-09 11:04:36',
+		'modified_by': 'Administrator',
+		'name': '000000472',
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Question',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:17',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'answer',
+		'fieldtype': 'Text Editor',
+		'hidden': None,
+		'icon': None,
+		'idx': 3,
+		'in_filter': None,
+		'label': 'Answer',
+		'modified': '2010-08-08 17:09:17',
+		'modified_by': 'Administrator',
+		'name': 'FL02622',
+		'no_copy': None,
+		'oldfieldname': 'answer',
+		'oldfieldtype': 'Text Editor',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Question',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-05-09 11:04:36',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': '_user_tags',
+		'fieldtype': 'Data',
+		'hidden': 1,
+		'icon': None,
+		'idx': 4,
+		'in_filter': None,
+		'label': 'User Tags',
+		'modified': '2011-05-09 11:04:36',
+		'modified_by': 'Administrator',
+		'name': '000000473',
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Question',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:17',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'tag_1',
+		'fieldtype': 'Link',
+		'hidden': None,
+		'icon': None,
+		'idx': 5,
+		'in_filter': None,
+		'label': 'Tag 1',
+		'modified': '2010-08-08 17:09:17',
+		'modified_by': 'Administrator',
+		'name': 'FL02623',
+		'no_copy': None,
+		'oldfieldname': 'tag_1',
+		'oldfieldtype': 'Link',
+		'options': 'Question Tag',
+		'owner': 'Administrator',
+		'parent': 'Question',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2011-05-09 11:04:36',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': '_users_voted',
+		'fieldtype': 'Text',
+		'hidden': None,
+		'icon': None,
+		'idx': 6,
+		'in_filter': None,
+		'label': 'Users Voted',
+		'modified': '2011-05-09 11:04:36',
+		'modified_by': 'Administrator',
+		'name': '000000474',
+		'no_copy': None,
+		'oldfieldname': None,
+		'oldfieldtype': None,
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Question',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:17',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'tag_2',
+		'fieldtype': 'Link',
+		'hidden': None,
+		'icon': None,
+		'idx': 7,
+		'in_filter': None,
+		'label': 'Tag 2',
+		'modified': '2010-08-08 17:09:17',
+		'modified_by': 'Administrator',
+		'name': 'FL02624',
+		'no_copy': None,
+		'oldfieldname': 'tag_2',
+		'oldfieldtype': 'Link',
+		'options': 'Question Tag',
+		'owner': 'Administrator',
+		'parent': 'Question',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:17',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'tag_3',
+		'fieldtype': 'Link',
+		'hidden': None,
+		'icon': None,
+		'idx': 8,
+		'in_filter': None,
+		'label': 'Tag 3',
+		'modified': '2010-08-08 17:09:17',
+		'modified_by': 'Administrator',
+		'name': 'FL02625',
+		'no_copy': None,
+		'oldfieldname': 'tag_3',
+		'oldfieldtype': 'Link',
+		'options': 'Question Tag',
+		'owner': 'Administrator',
+		'parent': 'Question',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	},
+	{
+		'allow_on_submit': None,
+		'colour': None,
+		'creation': '2010-08-08 17:09:17',
+		'default': None,
+		'depends_on': None,
+		'description': None,
+		'docstatus': 0,
+		'doctype': 'DocField',
+		'fieldname': 'file_list',
+		'fieldtype': 'Text',
+		'hidden': 1,
+		'icon': None,
+		'idx': 9,
+		'in_filter': None,
+		'label': 'File List',
+		'modified': '2010-08-08 17:09:17',
+		'modified_by': 'Administrator',
+		'name': 'FL02626',
+		'no_copy': None,
+		'oldfieldname': 'file_list',
+		'oldfieldtype': 'Text',
+		'options': None,
+		'owner': 'Administrator',
+		'parent': 'Question',
+		'parentfield': 'fields',
+		'parenttype': 'DocType',
+		'permlevel': 0,
+		'print_hide': None,
+		'report_hide': None,
+		'reqd': None,
+		'search_index': None,
+		'trigger': None,
+		'width': None
+	}
+]
\ No newline at end of file
diff --git a/knowledge_base/page/__init__.py b/knowledge_base/page/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/knowledge_base/page/__init__.py
diff --git a/knowledge_base/page/kb_common/kb_common.comp.js b/knowledge_base/page/kb_common/kb_common.comp.js
new file mode 100644
index 0000000..47bf0dd
--- /dev/null
+++ b/knowledge_base/page/kb_common/kb_common.comp.js
@@ -0,0 +1,23 @@
+
+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.line2=$a(this.wrapper,'div','',{marginBottom:'7px'});this.make_timestamp();this.make_vote();if(this.with_tags)
+this.make_tags();}
+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)})}
+this.make_vote=function(){new KBPoints(this.line2,this.det.points,this.det._users_voted,this.doctype,this.det.name,this.det.owner);}
+this.make_tags=function(){this.tags_area=$a(this.line2,'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)}
+this.make();}
+KBPoints=function(parent,points,voted,dt,dn,owner){var me=this;voted=voted?voted.split(','):[];this.wrapper=$a(parent,'span','',{fontSize:'11px',marginRight:'13px'});this.render_points=function(p){if(!this.points_area)
+this.points_area=$a(this.wrapper,'span');this.points_area.innerHTML=cint(p)+' point'+(p>1?'s':'');}
+this.render_points(points);if(user!='Guest'&&!in_list(voted,user)&&user!=owner){this.vote_up=$a(this.wrapper,'img','images/ui/vote_up.gif',{margin:'0px 0px -2px 7px',cursor:'pointer'});this.vote_down=$a(this.wrapper,'img','images/ui/vote_down.gif',{margin:'0px 0px -3px 0px',cursor:'pointer'});this.vote_up.title='Vote Up';this.vote_down.title='Vote Down';var callback=function(r,rt){if(r.exc){msgprint(r.exc);return;}
+$dh(me.vote_up);$dh(me.vote_down);me.render_points(r.message);}
+this.vote_up.onclick=function(){$c_page('knowledge_base','questions','vote',{vote:'up',dn:dn,dt:dt},callback);}
+this.vote_down.onclick=function(){$c_page('knowledge_base','questions','vote',{vote:'down',dn:dn,dt:dt},callback);}}}
+EditableText=function(args){$.extend(this,args);var me=this;this.display=$a(me.parent,'div',me.disp_class,'',me.text);this.input=$a(me.parent,'textarea',me.inp_class,{display:'none'});var div=$a(me.parent,'div','',{marginTop:'5px',height:'23px'});this.edit_btn=$a(div,'span','',{color:'#333',marginLeft:'-2px',cursor:'pointer',padding:'3px',backgroundColor:'#ddd',cssFloat:'left'});$br(this.edit_btn,'3px')
+$a(this.edit_btn,'div','wn-icon ic-pencil',{marginBottom:'-2px',cssFloat:'left'});$a(this.edit_btn,'span','link_type',{marginLeft:'3px',color:'#555',fontSize:'11px'},'Edit');this.edit_btn.onclick=function(){me.input.value=me.display.innerHTML;me.show_as_input();}
+this.save_btn=$btn(div,'Save',function(){var v=me.rich_text?wn.tinymce.get_value(me.input):me.input.value;if(!v){msgprint('Please write something!');return;}
+me.save_btn.set_working();$c_page('knowledge_base','question_view','update_item',{dt:me.dt,dn:me.dn,fn:me.fieldname,text:v},function(r,rt){me.save_btn.done_working();if(r.exc){msgprint(r.exc);return;}
+me.display.innerHTML=v;me.show_as_text();});},{display:'none'});this.cancel_btn=$a(div,'span','link_type',{color:'#555',display:'none'},'Cancel',{marginLeft:'7px'});this.cancel_btn.onclick=function(){me.show_as_text();}
+this.show_as_text=function(){$ds(me.display);$ds(me.edit_btn);if(me.rich_text)
+wn.tinymce.remove(me.input);$dh(me.input);$dh(me.save_btn);$dh(me.cancel_btn);}
+this.show_as_input=function(){$ds(me.input);$ds(me.save_btn);$ds(me.cancel_btn);$dh(me.edit_btn);$dh(me.display);if(me.rich_text)
+wn.tinymce.add_simple(me.input,'300px');}}
\ No newline at end of file
diff --git a/knowledge_base/page/kb_common/kb_common.js b/knowledge_base/page/kb_common/kb_common.js
new file mode 100644
index 0000000..1826f05
--- /dev/null
+++ b/knowledge_base/page/kb_common/kb_common.js
@@ -0,0 +1,146 @@
+// question toolbar
+// contains - voting widget / tag list and user info / timestamp
+// By XXXXXX on YYYYY
+
+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.line2 = $a(this.wrapper, 'div','',{marginBottom:'7px'});
+		this.make_timestamp();
+		this.make_vote();
+		if(this.with_tags)
+			this.make_tags();
+	}
+	
+	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)
+		})
+	}
+
+	this.make_vote = function() {
+		new KBPoints(this.line2, this.det.points, this.det._users_voted, this.doctype, this.det.name, this.det.owner);
+		
+	}
+	
+	this.make_tags = function() {
+		this.tags_area = $a(this.line2, '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)		
+	}
+
+	this.make();
+}
+
+
+// kb points
+// x points | Vote Up | Vote Down (if not voted and not guest)
+KBPoints = function(parent, points, voted, dt, dn, owner) {
+	var me = this;
+	voted = voted ? voted.split(',') : [];
+
+	this.wrapper = $a(parent, 'span', '', {fontSize: '11px', marginRight: '13px'});
+	
+	this.render_points = function(p) {
+		if(!this.points_area)
+			this.points_area = $a(this.wrapper, 'span');
+		this.points_area.innerHTML = cint(p) + ' point' + (p>1 ? 's' : '');			
+	}
+	
+	this.render_points(points);
+	
+	// vote up or down
+	// if user has not already voted
+	
+	if(user!='Guest' && !in_list(voted, user) && user!=owner) {
+		this.vote_up = $a(this.wrapper, 'img', 'images/ui/vote_up.gif', {margin:'0px 0px -2px 7px', cursor: 'pointer'});
+		this.vote_down = $a(this.wrapper, 'img', 'images/ui/vote_down.gif', {margin:'0px 0px -3px 0px', cursor: 'pointer'});
+		
+		this.vote_up.title = 'Vote Up'; this.vote_down.title = 'Vote Down';
+		
+		var callback = function(r, rt) {
+			if(r.exc) { msgprint(r.exc); return; }
+			$dh(me.vote_up); $dh(me.vote_down);
+			me.render_points(r.message);
+		}
+		
+		this.vote_up.onclick = function() {
+			$c_page('knowledge_base', 'questions', 'vote', {vote:'up', dn:dn, dt:dt}, callback);
+		}
+		this.vote_down.onclick = function() {
+			$c_page('knowledge_base', 'questions', 'vote', {vote:'down', dn:dn, dt:dt}, callback);
+		}
+	}
+}
+
+// displays an editable text,
+// needs parent, text, disp_class, inp_class
+// dt, dn
+
+EditableText = function(args) {
+	$.extend(this, args);
+	var me = this;
+	
+	this.display = $a(me.parent, 'div', me.disp_class, '', me.text);
+	this.input = $a(me.parent, 'textarea', me.inp_class, {display:'none'});
+	
+	var div = $a(me.parent, 'div', '', {marginTop:'5px', height:'23px'});
+	
+	// edit text
+	this.edit_btn = $a(div, 'span', '', {color:'#333', marginLeft:'-2px', cursor:'pointer', padding:'3px', backgroundColor:'#ddd', cssFloat: 'left'});
+	$br(this.edit_btn, '3px')
+	$a(this.edit_btn, 'div', 'wn-icon ic-pencil', {marginBottom:'-2px', cssFloat:'left'} );
+	$a(this.edit_btn, 'span', 'link_type', {marginLeft:'3px', color:'#555', fontSize:'11px'}, 'Edit');
+
+	this.edit_btn.onclick = function() {
+		me.input.value = me.display.innerHTML;
+		me.show_as_input();
+	}
+	
+	// save button - save the new text
+	// check if text is written
+	this.save_btn = $btn(div, 'Save', function() {
+		var v = me.rich_text ? wn.tinymce.get_value(me.input) : me.input.value;
+		if(!v) {
+			msgprint('Please write something!');
+			return;
+		}
+		me.save_btn.set_working();
+		$c_page('knowledge_base', 'question_view', 'update_item', {
+				dt: me.dt, dn: me.dn, fn: me.fieldname, text: v
+			}, 
+			function(r, rt) {
+				me.save_btn.done_working();
+				if(r.exc) {msgprint(r.exc); return; }
+				me.display.innerHTML = v;
+				me.show_as_text();
+			});
+	}, {display: 'none'});
+
+	// cancel button
+	this.cancel_btn = $a(div, 'span', 'link_type', {color: '#555', display:'none'}, 'Cancel', {marginLeft:'7px'});
+	this.cancel_btn.onclick = function() {
+		me.show_as_text();		
+	}
+
+	this.show_as_text = function() {
+		$ds(me.display); $ds(me.edit_btn);
+		if(me.rich_text)
+			wn.tinymce.remove(me.input);
+		$dh(me.input); $dh(me.save_btn); $dh(me.cancel_btn);
+				
+	}
+
+	this.show_as_input = function() {
+		$ds(me.input); $ds(me.save_btn); $ds(me.cancel_btn); 
+		$dh(me.edit_btn); $dh(me.display);
+		if(me.rich_text)
+			wn.tinymce.add_simple(me.input, '300px');
+	}	
+
+}
\ No newline at end of file
diff --git a/knowledge_base/page/question_view/__init__.py b/knowledge_base/page/question_view/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/knowledge_base/page/question_view/__init__.py
diff --git a/knowledge_base/page/question_view/question_view.comp.js b/knowledge_base/page/question_view/question_view.comp.js
new file mode 100644
index 0000000..6f6d5bf
--- /dev/null
+++ b/knowledge_base/page/question_view/question_view.comp.js
@@ -0,0 +1,24 @@
+
+pscript['onload_question-view']=function(){var w=page_body.pages['question-view'];w.className='layout_wrapper';new PageHeader(w,'Knowledge Base');w.link=$ln($a(w,'div'),'< Back to all questions',function(){loadpage('questions');})
+w.body=$a(w,'div','qv-body');}
+pscript['refresh_question-view']=function(){var qid=window.location.hash.split('/')[1];if(qid){pscript.question_view(qid);}}
+pscript.question_view=function(qid,qtext){var w=page_body.pages['question-view'];new KBQuestionView(w,qid,qtext);}
+KBQuestionView=function(w,qid,qtext){var me=this;w.body.innerHTML='';w.question_area=$a(w.body,'div','social qv-question-wrapper');w.answer_area=$a(w.body,'div','social qv-answer-wrapper');w.add_answer_link=$a(w.body,'div','',{margin:'3px 0px'});w.add_answer_area=$a(w.body,'div','qv-add-answer');this.make_question=function(){new EditableText({parent:w.question_area,dt:'Question',dn:qid,fieldname:'question',text:qtext,inp_class:'qv-input',disp_class:'qv-text'});}
+this.make_answer_list=function(){this.ans_list=new KBAnswerList({parent:w.answer_area,qid:qid})}
+this.make_add_answer=function(){$c_page('knowledge_base','question_view','has_answered',qid,function(r,rt){if(r.message=='No'){me.make_answer_box_link();}});}
+this.make_answer_box_link=function(){$a(w.add_answer_link,'span','link_type',null,'+ Add your answer',function(){$dh(w.add_answer_link);me.make_answer_box();});}
+this.make_answer_box=function(){$ds(w.add_answer_area);$a(w.add_answer_area,'h3','',{},'Add Your Answer')
+this.input=$a(w.add_answer_area,'textarea');wn.tinymce.add_simple(this.input);this.btn=$btn($a(w.add_answer_area,'div'),'Post',function(){var v=wn.tinymce.get_value(me.input);if(!v){msgprint('Write something!');return;}
+me.btn.set_working();$c_page('knowledge_base','question_view','add_answer',{qid:qid,answer:v},function(r,rt){me.btn.done_working();me.ans_list.list.run();$dh(w.add_answer_area);});});}
+this.setup=function(){if(qtext){this.make();}
+else{$c_page('knowledge_base','question_view','get_question',qid,function(r,rt){qtext=r.message;me.make();});}}
+this.make=function(){set_title(qtext);this.make_question();this.make_answer_list();this.make_add_answer();}
+this.setup();}
+KBAnswerList=function(args){var me=this;$.extend(this,args);this.make_list=function(){this.list=new wn.widgets.Listing({parent:me.parent,as_dict:1,no_results_message:'No answers yet, be the first one to answer!',render_row:function(body,data){new KBAnswer(body,data)},get_query:function(){return repl("SELECT t1.name, t1.owner, t1.answer, t1.points, t1._users_voted, t2.first_name, "
++"t2.last_name, t1.modified from tabAnswer t1, tabProfile t2 "
++"where question='%(qid)s' and t1.owner = t2.name "
++"order by t1.points desc, t1.modified desc",{qid:me.qid})}});this.list.run();}
+this.make_list();}
+KBAnswer=function(body,data){body.className='qv-answer';new EditableText({parent:body,dt:'Answer',dn:data.name,fieldname:'answer',text:data.answer,inp_class:'qv-ans-input',disp_class:'qv-ans-text',rich_text:1});var div=$a(body,'div','',{})
+new KBItemToolbar({parent:div,det:data,with_tags:0,doctype:'Answer'},null)}
+$import(knowledge_base.kb_common);
\ No newline at end of file
diff --git a/knowledge_base/page/question_view/question_view.css b/knowledge_base/page/question_view/question_view.css
new file mode 100644
index 0000000..0c2526c
--- /dev/null
+++ b/knowledge_base/page/question_view/question_view.css
@@ -0,0 +1,49 @@
+.qv-body {
+	padding: 13px;
+}
+
+
+.qv-input {
+	font-size: 14px;
+	height: 2.5em;
+	width: 100%;
+}
+
+.qv-text {
+	font-size: 20px;
+	font-weight: bold;
+}
+
+.qv-ans-input {
+	height: 5em;
+}
+
+.qv-ans-text {
+	color: #444;
+	line-height: 1.7em;
+}
+
+.qv-question-wrapper {
+	margin: 7px 0px 13px 0px;
+	padding-bottom: 7px;
+	border-bottom: 1px solid #CCC;
+}
+
+.qv-add-answer {
+	width: 50%;
+	margin: 7px 0px;
+	padding: 7px;
+	background-color: #E2E2EE;
+	display: none;
+}
+
+.qv-add-answer textarea {
+	height: 17em;
+	font-size: 12px;
+}
+
+.qv-answer {
+	margin: 7px 0px 7px 0px;
+	padding-bottom: 7px;
+	border-bottom: 1px solid #CCC;	
+}
\ No newline at end of file
diff --git a/knowledge_base/page/question_view/question_view.js b/knowledge_base/page/question_view/question_view.js
new file mode 100644
index 0000000..895c6f7
--- /dev/null
+++ b/knowledge_base/page/question_view/question_view.js
@@ -0,0 +1,177 @@
+pscript['onload_question-view'] = function() {
+//
+	var w = page_body.pages['question-view'];
+	w.className = 'layout_wrapper';
+	new PageHeader(w, 'Knowledge Base');
+	w.link = $ln($a(w, 'div'), '< Back to all questions', function() { loadpage('questions'); })
+	w.body = $a(w, 'div', 'qv-body');
+
+}
+
+pscript['refresh_question-view'] = function() {
+	// href
+	var qid = window.location.hash.split('/')[1];
+	if(qid) {
+		pscript.question_view(qid);
+	}
+}
+
+pscript.question_view = function(qid, qtext) {
+	var w = page_body.pages['question-view'];
+	new KBQuestionView(w, qid, qtext);
+}
+
+KBQuestionView = function(w, qid, qtext) {
+	var me = this;
+	
+	w.body.innerHTML = '';
+	w.question_area = $a(w.body, 'div', 'social qv-question-wrapper');
+	w.answer_area = $a(w.body, 'div', 'social qv-answer-wrapper');
+	w.add_answer_link = $a(w.body, 'div', '', {margin:'3px 0px'});
+	w.add_answer_area = $a(w.body, 'div', 'qv-add-answer');
+	
+	this.make_question = function() {
+		new EditableText({
+			parent: w.question_area,
+			dt: 'Question',
+			dn: qid,
+			fieldname: 'question',
+			text: qtext,
+			inp_class: 'qv-input',
+			disp_class: 'qv-text'
+		});
+
+		// show tags
+	}
+	
+	// answer list
+	this.make_answer_list = function() {
+		this.ans_list = new KBAnswerList({
+			parent: w.answer_area,
+			qid: qid
+		})
+	}
+	
+	// check if users has answered 
+	// (if no) then add a box to add a new answer
+	this.make_add_answer = function() {
+		$c_page('knowledge_base', 'question_view', 'has_answered', qid, function(r, rt) {
+			if(r.message=='No') {
+				me.make_answer_box_link();
+			}
+		});
+	}
+	
+	// add a link to open add answer
+	this.make_answer_box_link = function() {
+		$a(w.add_answer_link, 'span', 'link_type', null, '+ Add your answer', 
+			function() { 
+				$dh(w.add_answer_link);
+				me.make_answer_box();
+			});
+	}
+	
+	// answer box
+	// text area + add button
+	this.make_answer_box = function() {
+		$ds(w.add_answer_area);
+		$a(w.add_answer_area, 'h3', '', {}, 'Add Your Answer')
+		this.input = $a(w.add_answer_area, 'textarea');
+		wn.tinymce.add_simple(this.input);
+		
+		this.btn = $btn($a(w.add_answer_area, 'div'), 'Post', function() {
+			var v = wn.tinymce.get_value(me.input);
+			if(!v) { msgprint('Write something!'); return; }
+			me.btn.set_working();
+			$c_page('knowledge_base', 'question_view', 'add_answer', {qid: qid, answer:v}, 
+				function(r, rt) {
+					me.btn.done_working();
+					me.ans_list.list.run();
+					$dh(w.add_answer_area);
+				}
+			);
+		});
+	}
+	
+	this.setup = function() {
+		if(qtext) {
+			this.make();
+		}
+		else {
+			$c_page('knowledge_base', 'question_view', 'get_question', qid, function(r, rt) {
+				qtext = r.message;
+				me.make();
+			});
+		}
+	}
+	
+	this.make = function() {
+		set_title(qtext);
+		this.make_question();
+		this.make_answer_list();
+		this.make_add_answer();		
+	}
+	
+	this.setup();
+}
+
+
+// kb answer list
+KBAnswerList = function(args) {
+	var me = this;
+	$.extend(this, args);
+	
+	this.make_list = function() {
+	
+		this.list = new wn.widgets.Listing({
+			parent: me.parent,
+			as_dict: 1,
+			no_results_message: 'No answers yet, be the first one to answer!',
+			render_row: function(body, data) {
+				new KBAnswer(body, data)
+			},
+			get_query: function() {
+				return repl("SELECT t1.name, t1.owner, t1.answer, t1.points, t1._users_voted, t2.first_name, "
+					+"t2.last_name, t1.modified from tabAnswer t1, tabProfile t2 "
+					+"where question='%(qid)s' and t1.owner = t2.name "
+					+"order by t1.points desc, t1.modified desc", {qid: me.qid})
+			}
+		});
+		
+		this.list.run();
+		
+	}
+	
+	this.make_list();
+	
+}
+
+// kb answer
+// answer
+// by xxx | on xxx
+// points yyy
+KBAnswer = function(body, data) {
+	body.className = 'qv-answer';
+	new EditableText({
+		parent: body,
+		dt: 'Answer',
+		dn: data.name,
+		fieldname: 'answer',
+		text: data.answer,
+		inp_class: 'qv-ans-input',
+		disp_class: 'qv-ans-text',
+		rich_text: 1
+	});	
+	
+	var div = $a(body, 'div', '', {})
+	new KBItemToolbar({
+		parent: div,
+		det: data,
+		with_tags: 0,
+		doctype: 'Answer'
+	}, null)
+	
+}
+
+
+$import(knowledge_base.kb_common);
\ No newline at end of file
diff --git a/knowledge_base/page/question_view/question_view.py b/knowledge_base/page/question_view/question_view.py
new file mode 100644
index 0000000..a2eafbc
--- /dev/null
+++ b/knowledge_base/page/question_view/question_view.py
@@ -0,0 +1,28 @@
+import webnotes
+from webnotes.utils import load_json, cstr, now
+
+# update the editable text item
+def update_item(args):
+	args = load_json(args)
+	
+	webnotes.conn.sql("update `tab%s` set `%s`=%s, modified=%s where name=%s" \
+		% (args['dt'], args['fn'], '%s', '%s', '%s'), (args['text'], now(), args['dn']))
+		
+def has_answered(arg):
+	return webnotes.conn.sql("select name from tabAnswer where owner=%s and question=%s", (webnotes.user.name, arg)) and 'Yes' or 'No'
+
+def get_question(arg):
+	return cstr(webnotes.conn.sql("select question from tabQuestion where name=%s", arg)[0][0])
+
+def add_answer(args):
+	args = load_json(args)
+	
+	from webnotes.model.doc import Document
+	
+	a = Document('Answer')
+	a.answer = args['answer']
+	a.question = args['qid']
+	a.points = 1
+	a.save(1)
+	
+	webnotes.conn.set_value('Question', args['qid'], 'modified', now())
\ No newline at end of file
diff --git a/knowledge_base/page/question_view/question_view.txt b/knowledge_base/page/question_view/question_view.txt
new file mode 100644
index 0000000..0840e63
--- /dev/null
+++ b/knowledge_base/page/question_view/question_view.txt
@@ -0,0 +1,26 @@
+[
+	{
+		'content': None,
+		'creation': '2011-05-09 11:04:37',
+		'docstatus': 0,
+		'doctype': 'Page',
+		'icon': None,
+		'idx': None,
+		'menu_index': None,
+		'modified': '2011-03-29 13:54:27',
+		'modified_by': 'Administrator',
+		'module': 'Knowledge Base',
+		'name': 'Question View',
+		'owner': 'Administrator',
+		'page_name': 'Question View',
+		'parent': None,
+		'parent_node': None,
+		'parentfield': None,
+		'parenttype': None,
+		'script': None,
+		'show_in_menu': None,
+		'standard': 'Yes',
+		'static_content': None,
+		'style': None
+	}
+]
\ No newline at end of file
diff --git a/knowledge_base/page/questions/__init__.py b/knowledge_base/page/questions/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/knowledge_base/page/questions/__init__.py
diff --git a/knowledge_base/page/questions/questions.comp.js b/knowledge_base/page/questions/questions.comp.js
new file mode 100644
index 0000000..50c6731
--- /dev/null
+++ b/knowledge_base/page/questions/questions.comp.js
@@ -0,0 +1,27 @@
+
+pscript.onload_questions=function(){var w=page_body.pages['questions'];var tab=make_table(w,1,2,'100%',['75%','25%'],{});var body=$a($td(tab,0,0),'div','layout_wrapper');new PageHeader(body,'Knowledge Base');var kb=new KnowledgeBase(body);$y($td(tab,0,1),{paddingTop:'53px'});this.sidebar=new wn.widgets.PageSidebar($td(tab,0,1),{sections:[{title:'Top Tags',render:function(body){new wn.widgets.TagCloud(body,'Question',function(tag){kb.set_tag_filter(tag)});}}]});set_title('Knowledge Base');}
+function KnowledgeBase(w){var me=this;this.sort_by='modified';this.tag_filter_dict={};this.make_search_bar=function(){this.search=$a($a(w,'div','kb-search-wrapper'),'textarea');$(this.search).add_default_text('Enter keywords or a new Question');var div=$a(w,'div','kb-btn-wrapper');$btn(div,'Search',function(){me.run()},{fontSize:'14px'});$btn(div,'Ask',function(){me.ask()},{fontSize:'14px'});}
+this.ask=function(){if(this.search.value==$(this.search).attr('default_text')){msgprint('Please enter some text');return;}
+this.suggest();}
+this.suggest=function(){this.dialog=new wn.widgets.Dialog({title:'Suggest a users',width:400,fields:[{fieldtype:'HTML',options:'Optional: Suggest a few users who can help you answer this question<br>'},{fieldtype:'Link',fieldname:'profile1',label:'1st User',options:'Profile'},{fieldtype:'Link',fieldname:'profile2',label:'2nd User',options:'Profile'},{fieldtype:'Link',fieldname:'profile3',label:'3rd User',options:'Profile'},{fieldtype:'Button',fieldname:'ask',label:'Add the Question'}]});this.dialog.fields_dict.ask.input.onclick=function(){me.dialog.hide();me.add_question(values(me.dialog.get_values()));}
+this.dialog.show();}
+this.add_question=function(suggest_list){$c_page('knowledge_base','questions','add_question',{question:this.search.value,suggest:suggest_list},function(r,rt){$(me.search).val('').blur();me.run();})}
+this.make_tag_filter_area=function(){this.tag_filters=$a(w,'div','kb-tag-filter-area');$a(this.tag_filters,'span','',{marginRight:'4px',color:'#442'},'<i>Showing for:</i>');this.tag_area=$a(this.tag_filters,'span');}
+this.make_list=function(){this.make_tag_filter_area();this.list_area=$a(w,'div','',{marginRight:'13px'})
+this.no_result=$a(w,'div','help_box',{display:'none'},'No questions asked yet! Be the first one to ask')
+this.list=new wn.widgets.Listing({parent:this.list_area,no_results_message:'No questions found. Ask a new question!',as_dict:1,get_query:function(){var v=me.search.value==$(me.search).attr('default_text')?'':me.search.value;cond=v?(' and t1.question like "%'+v+'%"'):'';if(me.tag_filter_dict){for(f in me.tag_filter_dict){cond+=' and t1.`_user_tags` like "%'+f+'%"'}}
+return repl('select t1.name, t1.owner, t1.question, t1.points, 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})},render_row:function(parent,data,listing){new KBQuestion(parent,data,me);}});this.list.run();}
+this.set_tag_filter=function(tag){if(in_list(keys(me.tag_filter_dict),tag.label))return;var filter_tag=new SingleTag({parent:me.tag_area,label:tag.label,dt:'Question',color:tag.color});filter_tag.remove=function(tag_remove){$(tag_remove.body).fadeOut();delete me.tag_filter_dict[tag_remove.label];if(!keys(me.tag_filter_dict).length){$(me.tag_filters).slideUp();}
+me.run();}
+me.tag_filter_dict[tag.label]=filter_tag;$ds(me.tag_filters);me.run();}
+this.run=function(){this.list.run();}
+this.make_search_bar();this.make_list();}
+KBQuestion=function(parent,det,kb){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.onclick=function(){var q=this;window.location.href='#!question-view/'+q.id;}
+this.q_area.id=det.name;this.q_area.txt=det.question;new KBItemToolbar({parent:this.wrapper,det:det,with_tags:1,doctype:'Question'},kb)}
+this.make()}
+$import(knowledge_base.kb_common);
\ No newline at end of file
diff --git a/knowledge_base/page/questions/questions.css b/knowledge_base/page/questions/questions.css
new file mode 100644
index 0000000..b8a80c4
--- /dev/null
+++ b/knowledge_base/page/questions/questions.css
@@ -0,0 +1,29 @@
+div.kb-search-wrapper textarea {
+	height: 2.2em;
+	width: 80%;
+	font-size: 14px;
+	padding: 3px;
+	margin-bottom: 7px;
+}
+
+.kb-question-wrapper {
+	border-bottom: 1px solid #AAA;
+	padding-bottom: 3px;
+	margin-bottom: 3px;
+}
+
+.kb-questions {
+	color: #000;
+}
+
+.kb-question-details {
+	margin: 11px 0px 11px 29px;
+}
+
+.kb-tag-filter-area {
+	padding: 7px;
+	background-color: #F2F2E8;
+	color: #222;
+	margin: 7px 0px;
+	display: none;
+}
\ No newline at end of file
diff --git a/knowledge_base/page/questions/questions.html b/knowledge_base/page/questions/questions.html
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/knowledge_base/page/questions/questions.html
diff --git a/knowledge_base/page/questions/questions.js b/knowledge_base/page/questions/questions.js
new file mode 100644
index 0000000..993a38e
--- /dev/null
+++ b/knowledge_base/page/questions/questions.js
@@ -0,0 +1,206 @@
+pscript.onload_questions = function() {
+	var w = page_body.pages['questions'];
+	
+	var tab = make_table(w, 1, 2, '100%', ['75%', '25%'], {});
+	var body = $a($td(tab,0,0),'div','layout_wrapper');
+
+	new PageHeader(body, 'Knowledge Base');
+
+	// kb
+	var kb = new KnowledgeBase(body);
+	
+	// sidebar
+	$y($td(tab, 0, 1), {paddingTop:'53px'});
+	this.sidebar = new wn.widgets.PageSidebar($td(tab, 0, 1), {
+		sections: [
+			{
+				title: 'Top Tags',
+				render: function(body) {
+					new wn.widgets.TagCloud(body, 'Question', function(tag) { kb.set_tag_filter(tag) });
+				}				
+			}
+		]
+	});
+	set_title('Knowledge Base');
+}
+
+// knowledge base object
+// has a box for search or ask a question
+// and list of top rated search results
+//
+function KnowledgeBase(w) {
+	var me = this;
+	this.sort_by = 'modified';
+	this.tag_filter_dict = {};
+	
+	this.make_search_bar = function() {
+		this.search = $a($a(w,'div','kb-search-wrapper'), 'textarea');
+
+		$(this.search).add_default_text('Enter keywords or a new Question');
+		
+		var div = $a(w,'div','kb-btn-wrapper');
+		$btn(div, 'Search', function() { me.run() }, {fontSize:'14px'});
+		$btn(div, 'Ask', function() { me.ask() }, {fontSize:'14px'});
+	}
+	
+	// ask a new question
+	this.ask = function() {
+		if(this.search.value==$(this.search).attr('default_text')) {
+			msgprint('Please enter some text'); return;
+		}
+		this.suggest();
+	}
+	
+	// suggest a few users who can answer
+	this.suggest = function() {
+		this.dialog = new wn.widgets.Dialog({
+			title: 'Suggest a users',
+			width: 400,
+			fields: [
+				{fieldtype:'HTML', options:'Optional: Suggest a few users who can help you answer this question<br>'},
+				{fieldtype:'Link', fieldname:'profile1', label:'1st User',options:'Profile'},
+				{fieldtype:'Link', fieldname:'profile2', label:'2nd User',options:'Profile'},
+				{fieldtype:'Link', fieldname:'profile3', label:'3rd User',options:'Profile'},
+				{fieldtype:'Button', fieldname:'ask', label:'Add the Question'}
+			]
+		});
+		this.dialog.fields_dict.ask.input.onclick = function() {
+			me.dialog.hide();
+			me.add_question(values(me.dialog.get_values()));
+		}
+		this.dialog.show();
+	}
+	
+	// add a new question to the database
+	this.add_question = function(suggest_list) {
+		$c_page('knowledge_base', 'questions', 'add_question', {
+			question: this.search.value,
+			suggest: suggest_list
+		}, function(r,rt) {
+			$(me.search).val('').blur();
+			me.run();
+		})
+	}
+	
+	// where tags that filter will be displayed
+	this.make_tag_filter_area = function() {
+		this.tag_filters = $a(w, 'div', 'kb-tag-filter-area');
+		$a(this.tag_filters,'span','',{marginRight:'4px',color:'#442'}, '<i>Showing for:</i>');
+		this.tag_area = $a(this.tag_filters, 'span');
+	}
+	
+	// make a list of questions
+	this.make_list = function() {
+		this.make_tag_filter_area();
+		this.list_area = $a(w, 'div', '', {marginRight:'13px'})
+		this.no_result = $a(w, 'div','help_box',{display:'none'},'No questions asked yet! Be the first one to ask')
+
+		this.list = new wn.widgets.Listing({
+			parent: this.list_area,
+			no_results_message: 'No questions found. Ask a new question!',
+			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 + '%"'
+					}
+				}
+				return repl('select t1.name, t1.owner, t1.question, t1.points, 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})
+			},
+			render_row: function(parent, data, listing) {
+				new KBQuestion(parent, data, me);
+			}
+		});
+		
+		this.list.run();
+
+	}
+
+	// add a tag filter to the search in the
+	// main page
+	this.set_tag_filter = function(tag) {
+
+		// check if exists
+		if(in_list(keys(me.tag_filter_dict), tag.label)) return;
+
+		// create a tag in filters
+		var filter_tag = new SingleTag({
+			parent: me.tag_area,
+			label: tag.label,
+			dt: 'Question',
+			color: tag.color
+		});
+
+		// remove tag from filters
+		filter_tag.remove = function(tag_remove) {
+			$(tag_remove.body).fadeOut();
+			delete me.tag_filter_dict[tag_remove.label];
+
+			// hide everything?
+			if(!keys(me.tag_filter_dict).length) {
+				$(me.tag_filters).slideUp(); // hide
+			}
+
+			// run
+			me.run();
+		}
+
+		// add to dict
+		me.tag_filter_dict[tag.label] = filter_tag;
+		$ds(me.tag_filters);
+
+		// run
+		me.run();
+	}	
+	this.run = function() {
+		this.list.run();
+	}
+
+	this.make_search_bar();
+	this.make_list();
+	
+}
+
+// single kb question
+// "question
+//  points | tag list"
+
+KBQuestion = function(parent, det, kb) {
+	
+	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.onclick = function() {
+			var q = this;
+			window.location.href = '#!question-view/' + q.id;
+			//loadpage('question-view', function() { pscript.question_view(q.id, q.txt) })
+		}
+		
+		this.q_area.id = det.name; this.q_area.txt = det.question;
+
+		new KBItemToolbar({
+			parent: this.wrapper,
+			det: det,
+			with_tags: 1,
+			doctype: 'Question'
+		}, kb)
+		
+	}
+	
+
+	this.make()
+}
+
+$import(knowledge_base.kb_common);
\ No newline at end of file
diff --git a/knowledge_base/page/questions/questions.py b/knowledge_base/page/questions/questions.py
new file mode 100644
index 0000000..d87579f
--- /dev/null
+++ b/knowledge_base/page/questions/questions.py
@@ -0,0 +1,37 @@
+import webnotes
+
+from webnotes.utils import load_json, cint, cstr
+
+# add a new question
+def add_question(arg):
+	args = load_json(arg)
+	
+	from webnotes.model.doc import Document
+	d = Document('Question')
+	d.question = args['question'].title()
+	d.points = 1
+	d.save(1)
+	
+	if args['suggest']:
+		from my_company.page.my_company.my_company import post_comment
+		for s in args['suggest']:
+			if s:
+				post_comment({
+					'uid': s,
+					'comment': 'Please help me and answer the question "%s" in the Knowledge Base' % d.question,
+					'notify': 1
+				})
+	
+	
+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
\ No newline at end of file
diff --git a/knowledge_base/page/questions/questions.txt b/knowledge_base/page/questions/questions.txt
new file mode 100644
index 0000000..22cc3ed
--- /dev/null
+++ b/knowledge_base/page/questions/questions.txt
@@ -0,0 +1,26 @@
+[
+	{
+		'content': None,
+		'creation': '2011-05-09 11:04:37',
+		'docstatus': 0,
+		'doctype': 'Page',
+		'icon': None,
+		'idx': None,
+		'menu_index': None,
+		'modified': '2011-03-29 13:53:57',
+		'modified_by': 'Administrator',
+		'module': 'Knowledge Base',
+		'name': 'Questions',
+		'owner': 'Administrator',
+		'page_name': 'Questions',
+		'parent': None,
+		'parent_node': None,
+		'parentfield': None,
+		'parenttype': None,
+		'script': None,
+		'show_in_menu': None,
+		'standard': 'Yes',
+		'static_content': None,
+		'style': None
+	}
+]
\ No newline at end of file