[form/list] ui fixes, [note] new table to merge question + answer
This commit is contained in:
parent
8e95af35d3
commit
9b10e362f7
@ -68,11 +68,12 @@
|
|||||||
"icon": "icon-play",
|
"icon": "icon-play",
|
||||||
"label": "Activity"
|
"label": "Activity"
|
||||||
},
|
},
|
||||||
"Knowledge Base": {
|
"Notes": {
|
||||||
"type": "page",
|
"type": "list",
|
||||||
"link": "questions",
|
"doctype": "Note",
|
||||||
|
"link": "List/Note",
|
||||||
"color": "#01372b",
|
"color": "#01372b",
|
||||||
"label": "Knowledge Base",
|
"label": "Notes",
|
||||||
"icon": "icon-question-sign"
|
"icon": "icon-question-sign"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
0
utilities/doctype/note/__init__.py
Normal file
0
utilities/doctype/note/__init__.py
Normal file
19
utilities/doctype/note/note.py
Normal file
19
utilities/doctype/note/note.py
Normal 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)
|
75
utilities/doctype/note/note.txt
Normal file
75
utilities/doctype/note/note.txt
Normal 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"
|
||||||
|
}
|
||||||
|
]
|
0
utilities/doctype/note_user/__init__.py
Normal file
0
utilities/doctype/note_user/__init__.py
Normal file
8
utilities/doctype/note_user/note_user.py
Normal file
8
utilities/doctype/note_user/note_user.py
Normal 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
|
45
utilities/doctype/note_user/note_user.txt
Normal file
45
utilities/doctype/note_user/note_user.txt
Normal 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"
|
||||||
|
}
|
||||||
|
]
|
Loading…
x
Reference in New Issue
Block a user