[form/list] ui fixes, [note] new table to merge question + answer

This commit is contained in:
Rushabh Mehta 2013-05-24 16:00:56 +05:30
parent 8e95af35d3
commit 9b10e362f7
7 changed files with 152 additions and 4 deletions

View File

@ -68,11 +68,12 @@
"icon": "icon-play",
"label": "Activity"
},
"Knowledge Base": {
"type": "page",
"link": "questions",
"Notes": {
"type": "list",
"doctype": "Note",
"link": "List/Note",
"color": "#01372b",
"label": "Knowledge Base",
"label": "Notes",
"icon": "icon-question-sign"
}
},

View File

View File

@ -0,0 +1,19 @@
# For license information, please see license.txt
from __future__ import unicode_literals
import webnotes
class DocType:
def __init__(self, d, dl):
self.doc, self.doclist = d, dl
def onload(self):
if webnotes.session.user != self.doc.owner:
if webnotes.session.user not in [d.user for d in self.doclist if d.doctype=="Note User"]:
webnotes.msgprint("You are not authorized to read this record.", raise_exception=True)
def validate(self):
if webnotes.session.user != self.doc.owner:
if webnotes.session.user not in webnotes.conn.sql_list("""select user from `tabNote User`
where parent=%s and permission='Edit'""", self.doc.name):
webnotes.msgprint("You are not authorized to edit this record.", raise_exception=True)

View File

@ -0,0 +1,75 @@
[
{
"creation": "2013-05-24 13:41:00",
"docstatus": 0,
"modified": "2013-05-24 15:47:11",
"modified_by": "Administrator",
"owner": "Administrator"
},
{
"allow_rename": 1,
"autoname": "field:title",
"description": "Note is a free page where users can share documents / notes",
"doctype": "DocType",
"document_type": "Transaction",
"module": "Utilities",
"name": "__common__",
"read_only_onload": 1
},
{
"doctype": "DocField",
"name": "__common__",
"parent": "Note",
"parentfield": "fields",
"parenttype": "DocType",
"permlevel": 0
},
{
"cancel": 1,
"create": 1,
"doctype": "DocPerm",
"name": "__common__",
"parent": "Note",
"parentfield": "permissions",
"parenttype": "DocType",
"permlevel": 0,
"read": 1,
"role": "All",
"write": 1
},
{
"doctype": "DocType",
"name": "Note"
},
{
"doctype": "DocField",
"fieldname": "title",
"fieldtype": "Data",
"label": "Title",
"print_hide": 1
},
{
"description": "Help: To link to another record in the system, use \"#Form/Note/[Note Name]\" as the Link URL. (don't use \"http://\")",
"doctype": "DocField",
"fieldname": "content",
"fieldtype": "Text Editor",
"in_list_view": 0,
"label": "Content"
},
{
"doctype": "DocField",
"fieldname": "share",
"fieldtype": "Section Break",
"label": "Share"
},
{
"doctype": "DocField",
"fieldname": "share_with",
"fieldtype": "Table",
"label": "Share With",
"options": "Note User"
},
{
"doctype": "DocPerm"
}
]

View File

View File

@ -0,0 +1,8 @@
# For license information, please see license.txt
from __future__ import unicode_literals
import webnotes
class DocType:
def __init__(self, d, dl):
self.doc, self.doclist = d, dl

View File

@ -0,0 +1,45 @@
[
{
"creation": "2013-05-24 14:24:48",
"docstatus": 0,
"modified": "2013-05-24 14:24:48",
"modified_by": "Administrator",
"owner": "Administrator"
},
{
"description": "List of users who can edit a particular Note",
"doctype": "DocType",
"document_type": "Other",
"istable": 1,
"module": "Utilities",
"name": "__common__"
},
{
"doctype": "DocField",
"name": "__common__",
"parent": "Note User",
"parentfield": "fields",
"parenttype": "DocType",
"permlevel": 0
},
{
"doctype": "DocType",
"name": "Note User"
},
{
"doctype": "DocField",
"fieldname": "user",
"fieldtype": "Link",
"label": "User",
"options": "Profile",
"reqd": 1
},
{
"default": "Edit",
"doctype": "DocField",
"fieldname": "permission",
"fieldtype": "Select",
"label": "Permission",
"options": "Edit\nRead"
}
]