@@ -208,7 +208,6 @@ def validate_fields(meta): | |||
3. Fields that do have database columns are not mandatory. | |||
4. `Link` and `Table` options are valid. | |||
5. **Hidden** and **Mandatory** are not set simultaneously. | |||
6. Sets default `in_list_view`. | |||
7. `Check` type field has default as 0 or 1. | |||
8. `Dynamic Links` are correctly defined. | |||
9. Precision is set in numeric fields and is between 1 & 6. | |||
@@ -244,14 +243,6 @@ def validate_fields(meta): | |||
if d.hidden and d.reqd and not d.default: | |||
frappe.throw(_("Field {0} in row {1} cannot be hidden and mandatory without default").format(d.label, d.idx)) | |||
def check_min_items_in_list(fields): | |||
if not meta.get("__islocal"): | |||
return | |||
if len(filter(lambda d: d.in_list_view, fields))==0: | |||
for d in fields[:5]: | |||
if d.fieldtype in type_map: | |||
d.in_list_view = 1 | |||
def check_width(d): | |||
if d.fieldtype == "Currency" and cint(d.width) < 100: | |||
frappe.throw(_("Max width for type Currency is 100px in row {0}").format(d.idx)) | |||
@@ -314,7 +305,6 @@ def validate_fields(meta): | |||
check_in_list_view(d) | |||
check_illegal_default(d) | |||
check_min_items_in_list(fields) | |||
check_fold(fields) | |||
check_search_fields(meta) | |||
@@ -18,7 +18,7 @@ | |||
"default": "1", | |||
"fieldname": "enabled", | |||
"fieldtype": "Check", | |||
"in_list_view": 1, | |||
"in_list_view": 0, | |||
"label": "Enabled", | |||
"no_copy": 0, | |||
"oldfieldname": "enabled", | |||
@@ -49,7 +49,7 @@ | |||
{ | |||
"fieldname": "first_name", | |||
"fieldtype": "Data", | |||
"in_list_view": 1, | |||
"in_list_view": 0, | |||
"label": "First Name", | |||
"no_copy": 0, | |||
"oldfieldname": "first_name", | |||
@@ -69,7 +69,7 @@ | |||
{ | |||
"fieldname": "last_name", | |||
"fieldtype": "Data", | |||
"in_list_view": 1, | |||
"in_list_view": 0, | |||
"label": "Last Name", | |||
"oldfieldname": "last_name", | |||
"oldfieldtype": "Data", | |||
@@ -325,6 +325,7 @@ | |||
"description": "User Type \"System User\" can access Desktop. \"Website User\" can only be logged into the website and portal pages. ", | |||
"fieldname": "user_type", | |||
"fieldtype": "Select", | |||
"in_list_view": 1, | |||
"label": "User Type", | |||
"oldfieldname": "user_type", | |||
"oldfieldtype": "Select", | |||
@@ -462,7 +463,7 @@ | |||
"issingle": 0, | |||
"istable": 0, | |||
"max_attachments": 5, | |||
"modified": "2014-09-08 06:07:20.157915", | |||
"modified": "2015-01-07 15:54:30.153456", | |||
"modified_by": "Administrator", | |||
"module": "Core", | |||
"name": "User", | |||
@@ -1,31 +0,0 @@ | |||
<div class="row" style="max-height: 30px;"> | |||
<div class="col-xs-12"> | |||
<div class="text-ellipsis"> | |||
{%= list.get_avatar_and_id(doc) %} | |||
<span style="margin-right: 8px;" class="filterable" | |||
data-filter="first_name,=,{%= doc.first_name %}"> | |||
{%= doc.first_name %}</span> | |||
<span style="margin-right: 8px;" class="filterable" | |||
data-filter="last_name,=,{%= doc.last_name %}"> | |||
{%= doc.last_name %}</span> | |||
{% if(doc.enabled) { %} | |||
<span style="margin-right: 8px;" | |||
title="{%= __("Enabled") %}" class="filterable" | |||
data-filter="enabled,=,Yes"> | |||
<i class="icon-ok"></i> | |||
</span> | |||
{% } %} | |||
{% if(doc.user_type==="System User") { %} | |||
<span style="margin-right: 8px;" | |||
title="{%= __("System User") %}" class="filterable" | |||
data-filter="user_type,=,System User"> | |||
<i class="icon-lock"></i> | |||
</span> | |||
{% } %} | |||
</div> | |||
</div> | |||
</div> |
@@ -2,9 +2,16 @@ | |||
// MIT License. See license.txt | |||
frappe.listview_settings['User'] = { | |||
add_fields: ["enabled", "first_name", "last_name", "user_type"], | |||
add_fields: ["enabled", "user_type"], | |||
filters: [["enabled","=","Yes"], ["user_type","=","System User"]], | |||
prepare_data: function(data) { | |||
data["user_for_avatar"] = data["name"]; | |||
}, | |||
get_indicator: function(doc) { | |||
if(doc.enabled) { | |||
return [__("Active"), "green", "enabled,=,Yes"]; | |||
} else { | |||
return [__("Disabled"), "grey", "enabled,=,No"]; | |||
} | |||
} | |||
}; |
@@ -1,71 +1,71 @@ | |||
{ | |||
"allow_rename": 1, | |||
"creation": "2013-05-24 13:41:00", | |||
"description": "Note is a free page where users can share documents / notes", | |||
"docstatus": 0, | |||
"doctype": "DocType", | |||
"document_type": "Transaction", | |||
"allow_rename": 1, | |||
"creation": "2013-05-24 13:41:00", | |||
"description": "Note is a free page where users can share documents / notes", | |||
"docstatus": 0, | |||
"doctype": "DocType", | |||
"document_type": "Transaction", | |||
"fields": [ | |||
{ | |||
"fieldname": "title", | |||
"fieldtype": "Data", | |||
"in_list_view": 0, | |||
"label": "Title", | |||
"permlevel": 0, | |||
"print_hide": 1, | |||
"fieldname": "title", | |||
"fieldtype": "Data", | |||
"in_list_view": 0, | |||
"label": "Title", | |||
"permlevel": 0, | |||
"print_hide": 1, | |||
"reqd": 1 | |||
}, | |||
}, | |||
{ | |||
"description": "Help: To link to another record in the system, use \"#Form/Note/[Note Name]\" as the Link URL. (don't use \"http://\")", | |||
"fieldname": "content", | |||
"fieldtype": "Text Editor", | |||
"in_list_view": 0, | |||
"label": "Content", | |||
"description": "Help: To link to another record in the system, use \"#Form/Note/[Note Name]\" as the Link URL. (don't use \"http://\")", | |||
"fieldname": "content", | |||
"fieldtype": "Text Editor", | |||
"in_list_view": 0, | |||
"label": "Content", | |||
"permlevel": 0 | |||
}, | |||
}, | |||
{ | |||
"fieldname": "share", | |||
"fieldtype": "Section Break", | |||
"label": "Share", | |||
"fieldname": "share", | |||
"fieldtype": "Section Break", | |||
"label": "Share", | |||
"permlevel": 0 | |||
}, | |||
}, | |||
{ | |||
"description": "Everyone can read", | |||
"fieldname": "public", | |||
"fieldtype": "Check", | |||
"in_list_view": 1, | |||
"label": "Public", | |||
"permlevel": 0, | |||
"description": "Everyone can read", | |||
"fieldname": "public", | |||
"fieldtype": "Check", | |||
"in_list_view": 0, | |||
"label": "Public", | |||
"permlevel": 0, | |||
"print_hide": 1 | |||
}, | |||
}, | |||
{ | |||
"fieldname": "share_with", | |||
"fieldtype": "Table", | |||
"label": "Share With", | |||
"options": "Note User", | |||
"permlevel": 0, | |||
"fieldname": "share_with", | |||
"fieldtype": "Table", | |||
"label": "Share With", | |||
"options": "Note User", | |||
"permlevel": 0, | |||
"print_hide": 1 | |||
} | |||
], | |||
"icon": "icon-file-text", | |||
"idx": 1, | |||
"modified": "2014-07-30 03:24:38.302921", | |||
"modified_by": "Administrator", | |||
"module": "Desk", | |||
"name": "Note", | |||
"owner": "Administrator", | |||
], | |||
"icon": "icon-file-text", | |||
"idx": 1, | |||
"modified": "2015-01-07 11:06:04.494940", | |||
"modified_by": "Administrator", | |||
"module": "Desk", | |||
"name": "Note", | |||
"owner": "Administrator", | |||
"permissions": [ | |||
{ | |||
"apply_user_permissions": 1, | |||
"create": 1, | |||
"delete": 1, | |||
"email": 1, | |||
"permlevel": 0, | |||
"print": 1, | |||
"read": 1, | |||
"role": "All", | |||
"apply_user_permissions": 1, | |||
"create": 1, | |||
"delete": 1, | |||
"email": 1, | |||
"permlevel": 0, | |||
"print": 1, | |||
"read": 1, | |||
"role": "All", | |||
"write": 1 | |||
} | |||
], | |||
], | |||
"read_only_onload": 1 | |||
} | |||
} |
@@ -1,16 +0,0 @@ | |||
<div class="row" style="max-height: 30px;"> | |||
<div class="col-xs-12"> | |||
<div class="text-ellipsis"> | |||
{%= list.get_avatar_and_id(doc) %} | |||
{% if(!doc.public) { %} | |||
<span style="margin-right: 8px;" | |||
title="{%= __("Private") %}" class="filterable" | |||
data-filter="public,=,Yes"> | |||
<i class="icon-lock text-muted"></i> | |||
</span> | |||
{% } %} | |||
</div> | |||
</div> | |||
</div> |
@@ -3,4 +3,11 @@ frappe.listview_settings['Note'] = { | |||
me.page.set_title(__("Notes"), frappe.get_module("Notes").icon); | |||
}, | |||
add_fields: ["title", "public"], | |||
get_indicator: function(doc) { | |||
if(doc.public) { | |||
return [__("Public"), "green", "public,=,Yes"]; | |||
} else { | |||
return [__("Private"), "darkgrey", "public,=,No"]; | |||
} | |||
} | |||
} |
@@ -1,210 +1,210 @@ | |||
{ | |||
"allow_copy": 0, | |||
"allow_rename": 0, | |||
"autoname": "TDI.########", | |||
"creation": "2012-07-03 13:30:35", | |||
"docstatus": 0, | |||
"doctype": "DocType", | |||
"allow_copy": 0, | |||
"allow_rename": 0, | |||
"autoname": "TDI.########", | |||
"creation": "2012-07-03 13:30:35", | |||
"docstatus": 0, | |||
"doctype": "DocType", | |||
"fields": [ | |||
{ | |||
"fieldname": "description_and_status", | |||
"fieldtype": "Section Break", | |||
"label": "Description and Status", | |||
"fieldname": "description_and_status", | |||
"fieldtype": "Section Break", | |||
"label": "Description and Status", | |||
"permlevel": 0 | |||
}, | |||
}, | |||
{ | |||
"allow_on_submit": 0, | |||
"fieldname": "description", | |||
"fieldtype": "Text", | |||
"hidden": 0, | |||
"in_filter": 0, | |||
"in_list_view": 1, | |||
"label": "Description", | |||
"no_copy": 0, | |||
"oldfieldname": "description", | |||
"oldfieldtype": "Text", | |||
"permlevel": 0, | |||
"print_hide": 0, | |||
"print_width": "300px", | |||
"report_hide": 0, | |||
"reqd": 1, | |||
"search_index": 0, | |||
"allow_on_submit": 0, | |||
"fieldname": "description", | |||
"fieldtype": "Text", | |||
"hidden": 0, | |||
"in_filter": 0, | |||
"in_list_view": 0, | |||
"label": "Description", | |||
"no_copy": 0, | |||
"oldfieldname": "description", | |||
"oldfieldtype": "Text", | |||
"permlevel": 0, | |||
"print_hide": 0, | |||
"print_width": "300px", | |||
"report_hide": 0, | |||
"reqd": 1, | |||
"search_index": 0, | |||
"width": "300px" | |||
}, | |||
}, | |||
{ | |||
"fieldname": "column_break_2", | |||
"fieldtype": "Column Break", | |||
"fieldname": "column_break_2", | |||
"fieldtype": "Column Break", | |||
"permlevel": 0 | |||
}, | |||
}, | |||
{ | |||
"default": "Open", | |||
"fieldname": "status", | |||
"fieldtype": "Select", | |||
"in_list_view": 1, | |||
"label": "Status", | |||
"options": "Open\nClosed", | |||
"default": "Open", | |||
"fieldname": "status", | |||
"fieldtype": "Select", | |||
"in_list_view": 1, | |||
"label": "Status", | |||
"options": "Open\nClosed", | |||
"permlevel": 0 | |||
}, | |||
}, | |||
{ | |||
"allow_on_submit": 0, | |||
"default": "Medium", | |||
"fieldname": "priority", | |||
"fieldtype": "Select", | |||
"hidden": 0, | |||
"in_filter": 0, | |||
"in_list_view": 1, | |||
"label": "Priority", | |||
"no_copy": 0, | |||
"oldfieldname": "priority", | |||
"oldfieldtype": "Data", | |||
"options": "High\nMedium\nLow", | |||
"permlevel": 0, | |||
"print_hide": 0, | |||
"report_hide": 0, | |||
"reqd": 0, | |||
"allow_on_submit": 0, | |||
"default": "Medium", | |||
"fieldname": "priority", | |||
"fieldtype": "Select", | |||
"hidden": 0, | |||
"in_filter": 0, | |||
"in_list_view": 1, | |||
"label": "Priority", | |||
"no_copy": 0, | |||
"oldfieldname": "priority", | |||
"oldfieldtype": "Data", | |||
"options": "High\nMedium\nLow", | |||
"permlevel": 0, | |||
"print_hide": 0, | |||
"report_hide": 0, | |||
"reqd": 0, | |||
"search_index": 0 | |||
}, | |||
}, | |||
{ | |||
"allow_on_submit": 0, | |||
"fieldname": "date", | |||
"fieldtype": "Date", | |||
"hidden": 0, | |||
"in_filter": 0, | |||
"in_list_view": 1, | |||
"label": "Due Date", | |||
"no_copy": 0, | |||
"oldfieldname": "date", | |||
"oldfieldtype": "Date", | |||
"permlevel": 0, | |||
"print_hide": 0, | |||
"report_hide": 0, | |||
"reqd": 0, | |||
"allow_on_submit": 0, | |||
"fieldname": "date", | |||
"fieldtype": "Date", | |||
"hidden": 0, | |||
"in_filter": 0, | |||
"in_list_view": 1, | |||
"label": "Due Date", | |||
"no_copy": 0, | |||
"oldfieldname": "date", | |||
"oldfieldtype": "Date", | |||
"permlevel": 0, | |||
"print_hide": 0, | |||
"report_hide": 0, | |||
"reqd": 0, | |||
"search_index": 0 | |||
}, | |||
}, | |||
{ | |||
"fieldname": "owner", | |||
"fieldtype": "Link", | |||
"ignore_user_permissions": 1, | |||
"in_list_view": 0, | |||
"label": "Assigned To", | |||
"options": "User", | |||
"permlevel": 0, | |||
"fieldname": "owner", | |||
"fieldtype": "Link", | |||
"ignore_user_permissions": 1, | |||
"in_list_view": 0, | |||
"label": "Assigned To", | |||
"options": "User", | |||
"permlevel": 0, | |||
"reqd": 1 | |||
}, | |||
}, | |||
{ | |||
"fieldname": "section_break_6", | |||
"fieldtype": "Section Break", | |||
"label": "Reference", | |||
"fieldname": "section_break_6", | |||
"fieldtype": "Section Break", | |||
"label": "Reference", | |||
"permlevel": 0 | |||
}, | |||
}, | |||
{ | |||
"allow_on_submit": 0, | |||
"fieldname": "reference_type", | |||
"fieldtype": "Link", | |||
"hidden": 0, | |||
"in_filter": 0, | |||
"label": "Reference Type", | |||
"no_copy": 0, | |||
"oldfieldname": "reference_type", | |||
"oldfieldtype": "Data", | |||
"options": "DocType", | |||
"permlevel": 0, | |||
"print_hide": 0, | |||
"report_hide": 0, | |||
"reqd": 0, | |||
"allow_on_submit": 0, | |||
"fieldname": "reference_type", | |||
"fieldtype": "Link", | |||
"hidden": 0, | |||
"in_filter": 0, | |||
"label": "Reference Type", | |||
"no_copy": 0, | |||
"oldfieldname": "reference_type", | |||
"oldfieldtype": "Data", | |||
"options": "DocType", | |||
"permlevel": 0, | |||
"print_hide": 0, | |||
"report_hide": 0, | |||
"reqd": 0, | |||
"search_index": 0 | |||
}, | |||
}, | |||
{ | |||
"allow_on_submit": 0, | |||
"fieldname": "reference_name", | |||
"fieldtype": "Dynamic Link", | |||
"hidden": 0, | |||
"in_filter": 0, | |||
"label": "Reference Name", | |||
"no_copy": 0, | |||
"oldfieldname": "reference_name", | |||
"oldfieldtype": "Data", | |||
"options": "reference_type", | |||
"permlevel": 0, | |||
"print_hide": 0, | |||
"report_hide": 0, | |||
"reqd": 0, | |||
"allow_on_submit": 0, | |||
"fieldname": "reference_name", | |||
"fieldtype": "Dynamic Link", | |||
"hidden": 0, | |||
"in_filter": 0, | |||
"label": "Reference Name", | |||
"no_copy": 0, | |||
"oldfieldname": "reference_name", | |||
"oldfieldtype": "Data", | |||
"options": "reference_type", | |||
"permlevel": 0, | |||
"print_hide": 0, | |||
"report_hide": 0, | |||
"reqd": 0, | |||
"search_index": 0 | |||
}, | |||
}, | |||
{ | |||
"fieldname": "column_break_10", | |||
"fieldtype": "Column Break", | |||
"fieldname": "column_break_10", | |||
"fieldtype": "Column Break", | |||
"permlevel": 0 | |||
}, | |||
}, | |||
{ | |||
"allow_on_submit": 0, | |||
"fieldname": "role", | |||
"fieldtype": "Link", | |||
"hidden": 0, | |||
"in_filter": 0, | |||
"label": "Role", | |||
"no_copy": 0, | |||
"oldfieldname": "role", | |||
"oldfieldtype": "Link", | |||
"options": "Role", | |||
"permlevel": 0, | |||
"print_hide": 0, | |||
"report_hide": 0, | |||
"reqd": 0, | |||
"allow_on_submit": 0, | |||
"fieldname": "role", | |||
"fieldtype": "Link", | |||
"hidden": 0, | |||
"in_filter": 0, | |||
"label": "Role", | |||
"no_copy": 0, | |||
"oldfieldname": "role", | |||
"oldfieldtype": "Link", | |||
"options": "Role", | |||
"permlevel": 0, | |||
"print_hide": 0, | |||
"report_hide": 0, | |||
"reqd": 0, | |||
"search_index": 0 | |||
}, | |||
}, | |||
{ | |||
"fieldname": "assigned_by", | |||
"fieldtype": "Link", | |||
"ignore_user_permissions": 1, | |||
"label": "Assigned By", | |||
"options": "User", | |||
"fieldname": "assigned_by", | |||
"fieldtype": "Link", | |||
"ignore_user_permissions": 1, | |||
"label": "Assigned By", | |||
"options": "User", | |||
"permlevel": 0 | |||
} | |||
], | |||
"hide_heading": 0, | |||
"hide_toolbar": 0, | |||
"icon": "icon-check", | |||
"idx": 1, | |||
"in_create": 0, | |||
"in_dialog": 0, | |||
"issingle": 0, | |||
"max_attachments": 0, | |||
"modified": "2014-06-30 05:40:15.471437", | |||
"modified_by": "Administrator", | |||
"module": "Desk", | |||
"name": "ToDo", | |||
"owner": "Administrator", | |||
], | |||
"hide_heading": 0, | |||
"hide_toolbar": 0, | |||
"icon": "icon-check", | |||
"idx": 1, | |||
"in_create": 0, | |||
"in_dialog": 0, | |||
"issingle": 0, | |||
"max_attachments": 0, | |||
"modified": "2015-01-07 10:56:03.251872", | |||
"modified_by": "Administrator", | |||
"module": "Desk", | |||
"name": "ToDo", | |||
"owner": "Administrator", | |||
"permissions": [ | |||
{ | |||
"apply_user_permissions": 1, | |||
"create": 1, | |||
"delete": 0, | |||
"email": 1, | |||
"export": 0, | |||
"permlevel": 0, | |||
"print": 1, | |||
"read": 1, | |||
"report": 1, | |||
"role": "All", | |||
"submit": 0, | |||
"apply_user_permissions": 1, | |||
"create": 1, | |||
"delete": 0, | |||
"email": 1, | |||
"export": 0, | |||
"permlevel": 0, | |||
"print": 1, | |||
"read": 1, | |||
"report": 1, | |||
"role": "All", | |||
"submit": 0, | |||
"write": 1 | |||
}, | |||
}, | |||
{ | |||
"create": 1, | |||
"delete": 0, | |||
"email": 1, | |||
"export": 1, | |||
"permlevel": 0, | |||
"print": 1, | |||
"read": 1, | |||
"report": 1, | |||
"role": "System Manager", | |||
"create": 1, | |||
"delete": 0, | |||
"email": 1, | |||
"export": 1, | |||
"permlevel": 0, | |||
"print": 1, | |||
"read": 1, | |||
"report": 1, | |||
"role": "System Manager", | |||
"write": 1 | |||
} | |||
], | |||
"read_only": 0, | |||
"read_only_onload": 0, | |||
"search_fields": "description, reference_type, reference_name", | |||
], | |||
"read_only": 0, | |||
"read_only_onload": 0, | |||
"search_fields": "description, reference_type, reference_name", | |||
"title_field": "description" | |||
} | |||
} |
@@ -1,29 +0,0 @@ | |||
<div class="row" style="max-height: 32px; margin-bottom: 3px;"> | |||
<div class="col-xs-11"> | |||
<div class="text-ellipsis"> | |||
{%= list.get_avatar_and_id(doc) %} | |||
<span class="label label-{%= frappe.utils.guess_style(doc.status) %} filterable" | |||
data-filter="status,=,{%= doc.status %}">{%= __(doc.status) %}</span> | |||
<span class="label label-{%= frappe.utils.guess_style(doc.priority) %} | |||
filterable" | |||
data-filter="priority,=,{%= doc.priority %}">{%= __(doc.priority) %}</span> | |||
{% if (doc.reference_name) { %} | |||
{% var reference_href = ("#Form/" + encodeURIComponent(doc.reference_type) + "/" | |||
+ encodeURIComponent(doc.reference_name)) %} | |||
<a href="{%= reference_href %}" style="text-decoration: none;"> | |||
<span class="label label-default"> | |||
<i class="{%= frappe.boot.doctype_icons[doc.reference_type] %}"></i> | |||
{%= doc.reference_name %} | |||
</span> | |||
</a> | |||
{% } %} | |||
</div> | |||
</div> | |||
<div class="col-xs-1 text-right" style="margin-bottom: 3px;"> | |||
<span class="filterable" data-filter="owner,=,{%= doc.owner %}"> | |||
{%= frappe.avatar(doc.owner) %} | |||
</span> | |||
</div> | |||
</div> |
@@ -140,13 +140,14 @@ class FormMeta(Meta): | |||
if not dt in ret: | |||
ret[dt] = {"get_parent": True} | |||
self.set("__linked_with", ret) | |||
self.set("__linked_with", ret, as_value=True) | |||
def load_print_formats(self): | |||
print_formats = frappe.db.sql("""select * FROM `tabPrint Format` | |||
WHERE doc_type=%s AND docstatus<2 and ifnull(disabled, 0)=0""", (self.name,), as_dict=1, | |||
update={"doctype":"Print Format"}) | |||
self.set("__print_formats", print_formats) | |||
self.set("__print_formats", print_formats, as_value=True) | |||
def load_workflows(self): | |||
# get active workflow | |||
@@ -160,7 +161,7 @@ class FormMeta(Meta): | |||
for d in workflow.get("states"): | |||
workflow_docs.append(frappe.get_doc("Workflow State", d.state)) | |||
self.set("__workflow_docs", workflow_docs) | |||
self.set("__workflow_docs", workflow_docs, as_value=True) | |||
def load_templates(self): | |||
@@ -182,6 +183,6 @@ class FormMeta(Meta): | |||
for content in self.get("__form_grid_templates").values(): | |||
messages = extract_messages_from_code(content) | |||
messages = make_dict_from_messages(messages) | |||
self.get("__messages").update(messages) | |||
self.get("__messages").update(messages, as_value=True) | |||
@@ -38,6 +38,6 @@ def toggle_star(doctype, name, add=False): | |||
except Exception, e: | |||
if e.args[0]==1054: | |||
add_column(doctype, "_starred_by", "Text") | |||
toggle_star(doctype, name) | |||
toggle_star(doctype, name, add) | |||
else: | |||
raise |
@@ -87,7 +87,7 @@ | |||
"hidden": 0, | |||
"ignore_user_permissions": 0, | |||
"in_filter": 0, | |||
"in_list_view": 1, | |||
"in_list_view": 0, | |||
"label": "Email Account Name", | |||
"no_copy": 0, | |||
"permlevel": 0, | |||
@@ -362,7 +362,7 @@ | |||
"is_submittable": 0, | |||
"issingle": 0, | |||
"istable": 0, | |||
"modified": "2014-12-15 15:20:22.723848", | |||
"modified": "2015-01-07 15:58:10.079334", | |||
"modified_by": "Administrator", | |||
"module": "Email", | |||
"name": "Email Account", | |||
@@ -76,8 +76,8 @@ class BaseDocument(object): | |||
def getone(self, key, filters=None): | |||
return self.get(key, filters=filters, limit=1)[0] | |||
def set(self, key, value): | |||
if isinstance(value, list): | |||
def set(self, key, value, as_value=False): | |||
if isinstance(value, list) and not as_value: | |||
self.__dict__[key] = [] | |||
self.extend(key, value) | |||
else: | |||
@@ -133,7 +133,7 @@ em.link-option { | |||
border-top: 0px; | |||
} | |||
.form-intro-area { | |||
padding: 15px 22px; | |||
padding: 15px; | |||
} | |||
.page-form { | |||
margin: 0px; | |||
@@ -452,6 +452,13 @@ em.link-option { | |||
font-size: 32px; | |||
color: #d1d8dd; | |||
} | |||
.missing-image.small { | |||
width: 20px; | |||
height: 20px; | |||
} | |||
.missing-image.small .octicon { | |||
font-size: 16px; | |||
} | |||
/* form */ | |||
.timeline { | |||
border: 1px solid #d1d8dd; | |||
@@ -583,6 +590,8 @@ ul.linked-with-list li { | |||
.grid-heading-row { | |||
color: #8c99a5; | |||
font-size: 85%; | |||
} | |||
.control-label { | |||
margin-bottom: 2px; | |||
} | |||
.like-disabled-input { | |||
@@ -13,7 +13,7 @@ frappe.ui.form.Sidebar = Class.extend({ | |||
}); | |||
}, | |||
add_user_action: function(label, click) { | |||
$('<a>').html(label).appendTo($('<li>') | |||
return $('<a>').html(label).appendTo($('<li>') | |||
.appendTo(this.$user_actions.removeClass("hide"))).on("click", click); | |||
}, | |||
clear_user_actions: function() { | |||
@@ -225,14 +225,22 @@ frappe.ui.form.Toolbar = Class.extend({ | |||
var me = this; | |||
$(this.frm.wrapper).on("dirty", function() { | |||
me.show_title_as_dirty(); | |||
}) | |||
// clear workflow actions | |||
me.frm.page.clear_actions_menu(); | |||
// enable save action | |||
if(!me.frm.save_disabled) { | |||
me.set_primary_action(true); | |||
} | |||
}); | |||
}, | |||
show_title_as_dirty: function() { | |||
if(this.frm.save_disabled) | |||
return; | |||
if(this.frm.doc.__unsaved) { | |||
this.page.set_indicator(__("Not Saved"), "orange") | |||
this.page.set_indicator(__("Not Saved"), "orange"); | |||
} | |||
$(this.frm.wrapper).attr("data-state", this.frm.doc.__unsaved ? "dirty" : "clean"); | |||
@@ -15,31 +15,12 @@ frappe.ui.form.States = Class.extend({ | |||
var me = this; | |||
$(this.frm.wrapper).bind("render_complete", function() { | |||
me.refresh(); | |||
}) | |||
}, | |||
make: function() { | |||
this.parent = this.frm.page.main | |||
.find(".workflow-button-area") | |||
.empty() | |||
.removeClass("hide"); | |||
console.log(this.parent); | |||
this.workflow_button = $('<button class="btn btn-default dropdown-toggle" data-toggle="dropdown">\ | |||
<i class="icon-small"></i> <span class="state-text"></span>\ | |||
<span class="caret"></span></button>') | |||
.appendTo(this.parent).dropdown(); | |||
this.dropdown = $('<ul class="dropdown-menu">').insertAfter(this.workflow_button); | |||
this.help_btn = $('<button class="btn btn-default"><i class="icon-question-sign"></i></button'). | |||
insertBefore(this.workflow_button); | |||
this.setup_help(); | |||
this.bind_action(); | |||
}); | |||
}, | |||
setup_help: function() { | |||
var me = this; | |||
this.help_btn.click(function() { | |||
this.frm.page.add_action_item(__("Help"), function() { | |||
frappe.workflow.setup(me.frm.doctype); | |||
var state = me.get_state(); | |||
var d = new frappe.ui.Dialog({ | |||
@@ -61,69 +42,91 @@ frappe.ui.form.States = Class.extend({ | |||
+ "<p class='help'>"+__("Note: Other permission rules may also apply")+"</p>" | |||
).css({padding: '15px'}); | |||
d.show(); | |||
}); | |||
}, true); | |||
}, | |||
refresh: function() { | |||
// hide if its not yet saved | |||
if(this.frm.doc.__islocal) { | |||
this.set_default_state(); | |||
this.parent && this.parent.toggle(false); | |||
return; | |||
} | |||
this.make(); | |||
// state text | |||
var state = this.get_state(); | |||
if(state) { | |||
// show current state on the button | |||
this.workflow_button.find(".state-text").text(state); | |||
var state_doc = frappe.get_doc("Workflow State", state); | |||
if (state_doc) { | |||
// set the icon | |||
this.workflow_button.find('i').removeClass() | |||
.addClass("icon-white") | |||
.addClass("icon-" + state_doc.icon); | |||
// set the style | |||
this.workflow_button.removeClass().addClass("btn btn-default dropdown-toggle") | |||
if(state_doc && state_doc.style) | |||
this.workflow_button.addClass("btn-" + state_doc.style.toLowerCase()); | |||
} | |||
// show actions from that state | |||
this.show_actions(state); | |||
if(this.frm.doc.__islocal) { | |||
this.workflow_button.prop('disabled', true); | |||
} | |||
} | |||
}, | |||
show_actions: function(state) { | |||
var $ul = this.dropdown; | |||
$ul.empty(); | |||
var added = false, | |||
me = this; | |||
this.frm.page.clear_actions_menu(); | |||
$.each(frappe.workflow.get_transitions(this.frm.doctype, state), function(i, d) { | |||
if(in_list(user_roles, d.allowed)) { | |||
d.icon = frappe.get_list("Workflow State", d.next_state).icon; | |||
$(repl('<li><a href="#" data-action="%(action)s">\ | |||
<i class="icon icon-%(icon)s"></i> %(action)s</a></li>', d)) | |||
.appendTo($ul); | |||
added = true; | |||
me.frm.page.add_action_item(__(d.action), function() { | |||
var action = d.action; | |||
// capture current state | |||
var doc_before_action = copy_dict(me.frm.doc); | |||
// set new state | |||
var next_state = frappe.workflow.get_next_state(me.frm.doctype, | |||
me.frm.doc[me.state_fieldname], action); | |||
me.frm.doc[me.state_fieldname] = next_state; | |||
var new_state = frappe.workflow.get_document_state(me.frm.doctype, next_state); | |||
var new_docstatus = cint(new_state.doc_status); | |||
// update field and value | |||
console.log(new_state); | |||
if(new_state.update_field) { | |||
me.frm.set_value(new_state.update_field, new_state.update_value); | |||
} | |||
// revert state on error | |||
var on_error = function() { | |||
// reset in locals | |||
frappe.model.add_to_locals(doc_before_action); | |||
me.frm.refresh(); | |||
} | |||
// success - add a comment | |||
var success = function() { | |||
me.frm.comments.insert_comment("Workflow", next_state); | |||
} | |||
if(new_docstatus==1 && me.frm.doc.docstatus==0) { | |||
me.frm.savesubmit(null, success, on_error); | |||
} else if(new_docstatus==0 && me.frm.doc.docstatus==0) { | |||
me.frm.save("Save", success, null, on_error); | |||
} else if(new_docstatus==1 && me.frm.doc.docstatus==1) { | |||
me.frm.save("Update", success, null, on_error); | |||
} else if(new_docstatus==2 && me.frm.doc.docstatus==1) { | |||
me.frm.savecancel(null, success, on_error); | |||
} else { | |||
msgprint(__("Document Status transition from ") + me.frm.doc.docstatus + " " | |||
+ __("to") + | |||
new_docstatus + " " + __("is not allowed.")); | |||
msgprint(__("Document Status transition from {0} to {1} is not allowed", [me.frm.doc.docstatus, new_docstatus])); | |||
return false; | |||
} | |||
return false; | |||
}); | |||
} | |||
}); | |||
// disable the button if user cannot change state | |||
var is_final = !$ul.find("li").length; | |||
this.workflow_button | |||
.prop('disabled', is_final); | |||
this.workflow_button.find(".caret").toggle(is_final ? false : true) | |||
if(added) { | |||
this.frm.page.btn_primary.addClass("hide"); | |||
this.frm.toolbar.current_status = ""; | |||
this.setup_help(); | |||
} | |||
}, | |||
set_default_state: function() { | |||
@@ -143,53 +146,6 @@ frappe.ui.form.States = Class.extend({ | |||
bind_action: function() { | |||
var me = this; | |||
this.dropdown.on("click", "[data-action]", function() { | |||
var action = $(this).attr("data-action"); | |||
// capture current state | |||
var doc_before_action = copy_dict(me.frm.doc); | |||
// set new state | |||
var next_state = frappe.workflow.get_next_state(me.frm.doctype, | |||
me.frm.doc[me.state_fieldname], action); | |||
me.frm.doc[me.state_fieldname] = next_state; | |||
var new_state = frappe.workflow.get_document_state(me.frm.doctype, next_state); | |||
var new_docstatus = cint(new_state.doc_status); | |||
// update field and value | |||
if(new_state.update_field) { | |||
me.frm.set_value(new_state.update_field, new_state.update_value); | |||
} | |||
// revert state on error | |||
var on_error = function() { | |||
// reset in locals | |||
frappe.model.add_to_locals(doc_before_action); | |||
me.frm.refresh(); | |||
} | |||
// success - add a comment | |||
var success = function() { | |||
me.frm.comments.insert_comment("Workflow", next_state); | |||
} | |||
if(new_docstatus==1 && me.frm.doc.docstatus==0) { | |||
me.frm.savesubmit(null, success, on_error); | |||
} else if(new_docstatus==0 && me.frm.doc.docstatus==0) { | |||
me.frm.save("Save", success, null, on_error); | |||
} else if(new_docstatus==1 && me.frm.doc.docstatus==1) { | |||
me.frm.save("Update", success, null, on_error); | |||
} else if(new_docstatus==2 && me.frm.doc.docstatus==1) { | |||
me.frm.savecancel(null, success, on_error); | |||
} else { | |||
msgprint(__("Document Status transition from ") + me.frm.doc.docstatus + " " | |||
+ __("to") + | |||
new_docstatus + " " + __("is not allowed.")); | |||
msgprint(__("Document Status transition from {0} to {1} is not allowed", [me.frm.doc.docstatus, new_docstatus])); | |||
return false; | |||
} | |||
// hide dropdown | |||
me.workflow_button.dropdown('toggle'); | |||
return false; | |||
}) | |||
} | |||
}); |
@@ -158,15 +158,15 @@ frappe.views.DocListView = frappe.ui.Listing.extend({ | |||
if (or_match_text.length) { | |||
frappe.utils.set_footnote(this, this.$page.find(".layout-main-section"), | |||
"<p style=\"margin-bottom: 7px;\">" | |||
+ __("Additional filters based on User Permissions, having:") + "</p>" | |||
'<p>' | |||
+ __("Additional filters based on User Permissions:") + "</p>" | |||
+ or_match_text.join("<p class=\"strong\" \ | |||
style=\"margin-left: 40px; margin-top: 7px; margin-bottom: 7px;\">" | |||
+ __("or") + "</p>") | |||
+ "<p class=\"text-muted\" style=\"margin-top: 15px;\">" | |||
+ "<p class=\"text-muted\" style=\"margin-top: 15px; margin-bottom: 0px;\">" | |||
+ __("Note: fields having empty value for above criteria are not filtered out.") | |||
+ "</p>"); | |||
$(this.footnote_area).css({"margin-top":"0px", "margin-bottom":"20px"}); | |||
$(this.footnote_area).css({"margin-top":"0px"}); | |||
} | |||
} | |||
}, | |||
@@ -10,7 +10,11 @@ | |||
{% } else if (col.type==="Indicator") { %} | |||
{%= me.get_indicator(data) %} | |||
{% } else if (col.fieldtype==="Image") { %} | |||
<img src="{%= value %}" style="max-height: 30px; max-width: 100%;"> | |||
{% if(data[col.df.options]) { %} | |||
<img src="{%= data[col.df.options] %}" style="max-height: 30px; max-width: 100%;"> | |||
{% } else { %} | |||
<div class="missing-image small"><span class="octicon octicon-circle-slash"></span></div> | |||
{% } %} | |||
{% } else if(col.fieldtype==="Select") { %} | |||
<span class="filterable indicator {%= frappe.utils.guess_colour(value) %}" | |||
data-filter="{%= col.fieldname %},=,{%= value %}">{%= value %}</span> | |||
@@ -98,6 +98,7 @@ frappe.views.ListView = Class.extend({ | |||
} | |||
}, | |||
set_columns: function() { | |||
var me = this; | |||
this.columns = []; | |||
this.columns.push({ | |||
colspan: this.settings.colwidths && this.settings.colwidths.subject || 6, | |||
@@ -105,8 +106,9 @@ frappe.views.ListView = Class.extend({ | |||
}); | |||
this.total_colspans = this.columns[0].colspan; | |||
// indicator | |||
if(frappe.model.is_submittable(this.doctype) || this.settings.get_indicator) { | |||
if(frappe.model.is_submittable(this.doctype) | |||
|| this.settings.get_indicator || this.workflow_state_fieldname) { | |||
// indicator | |||
this.columns.push({ | |||
colspan: this.settings.colwidths && this.settings.colwidths.indicator || 3, | |||
type: "Indicator", | |||
@@ -114,15 +116,6 @@ frappe.views.ListView = Class.extend({ | |||
this.total_colspans += this.columns[1].colspan; | |||
} | |||
var me = this; | |||
if(this.workflow_state_fieldname) { | |||
this.columns.push({ | |||
colspan: 3, | |||
content: this.workflow_state_fieldname, | |||
type:"select" | |||
}); | |||
this.total_colspans += 3; | |||
} | |||
// overridden | |||
var overridden = $.map(this.settings.add_columns || [], function(d) { | |||
@@ -167,7 +160,7 @@ frappe.views.ListView = Class.extend({ | |||
var colspan = 3; | |||
if(in_list(["Int", "Percent", "Select"], df.fieldtype)) { | |||
colspan = 2; | |||
} else if(df.fieldtype=="Check") { | |||
} else if(in_list(["Check", "Image"], df.fieldtype)) { | |||
colspan = 1; | |||
} else if(in_list(["name", "subject", "title"], df.fieldname)) { // subjects are longer | |||
colspan = 4; | |||
@@ -119,7 +119,8 @@ frappe.utils = { | |||
}, | |||
set_footnote: function(me, wrapper, txt) { | |||
if(!me.footnote_area) { | |||
me.footnote_area = $('<div class="text-muted form-intro-area" style="margin-top: 10px;">') | |||
$("<hr>").appendTo(wrapper).css({"margin-bottom": "0px"}); | |||
me.footnote_area = $('<div class="text-muted form-intro-area small">') | |||
.appendTo(wrapper); | |||
} | |||
@@ -182,10 +183,10 @@ frappe.utils = { | |||
var style = default_style || "default"; | |||
var colour = "darkgrey"; | |||
if(text) { | |||
if(has_words(["Pending", "Review", "Medium"], text)) { | |||
if(has_words(["Pending", "Review", "Medium", "Not Approved", "Pending"], text)) { | |||
style = "warning"; | |||
colour = "orange"; | |||
} else if(has_words(["Open", "Rejected", "Urgent", "High"], text)) { | |||
} else if(has_words(["Open", "Urgent", "High"], text)) { | |||
style = "danger"; | |||
colour = "red"; | |||
} else if(has_words(["Closed", "Finished", "Converted", "Completed", "Confirmed", | |||
@@ -9,7 +9,8 @@ frappe.get_indicator = function(doc, doctype) { | |||
var _get_indicator = frappe.listview_settings[doctype] | |||
&& frappe.listview_settings[doctype].get_indicator, | |||
is_submittable = frappe.model.is_submittable(doctype); | |||
is_submittable = frappe.model.is_submittable(doctype), | |||
workflow_fieldname = frappe.workflow.get_state_fieldname(doctype); | |||
if(is_submittable && doc.docstatus==0) { | |||
return [__("Draft"), "red", "docstatus,=,0"]; | |||
@@ -19,6 +20,18 @@ frappe.get_indicator = function(doc, doctype) { | |||
return [__("Cancelled"), "red", "docstatus,=,2"]; | |||
} | |||
// workflow | |||
if(workflow_fieldname) { | |||
var value = doc[workflow_fieldname]; | |||
var colour = { | |||
"Success": "green", | |||
"Warning": "orange", | |||
"Danger": "red", | |||
"Primary": "blue", | |||
}[locals["Workflow State"][value].style] || "darkgrey"; | |||
return [__(value), colour, workflow_fieldname + ',=,' + value]; | |||
} | |||
if(_get_indicator) { | |||
var indicator = _get_indicator(doc); | |||
if(indicator) return indicator; | |||
@@ -62,7 +62,10 @@ $.extend(frappe.model, { | |||
return r.docs; | |||
}, | |||
add_to_locals: function(doc) { | |||
if(!locals[doc.doctype]) locals[doc.doctype] = {}; | |||
if(!locals[doc.doctype]) | |||
locals[doc.doctype] = {}; | |||
if(!doc.name && doc.__islocal) { // get name (local if required) | |||
if(!doc.parentfield) frappe.model.clear_doc(doc); | |||
@@ -70,14 +73,17 @@ $.extend(frappe.model, { | |||
if(!doc.parentfield) frappe.provide("frappe.model.docinfo." + doc.doctype + "." + doc.name); | |||
} | |||
locals[doc.doctype][doc.name] = doc; | |||
// add child docs to locals | |||
if(!doc.parentfield) { | |||
for(var i in doc) { | |||
var value = doc[i]; | |||
if($.isArray(value)) { | |||
$.each(value, function(i, d) { | |||
if(!d.parent) d.parent = doc.name; | |||
if(!d.parent) | |||
d.parent = doc.name; | |||
frappe.model.add_to_locals(d); | |||
}); | |||
} | |||
@@ -10,7 +10,7 @@ | |||
</div> | |||
<div class="page-actions text-right col-sm-4"> | |||
<span class="page-icon-group hide"></span> | |||
<div class="btn-group hide"> | |||
<div class="btn-group menu-btn-group hide"> | |||
<button type="button" class="btn btn-default btn-sm dropdown-toggle" | |||
data-toggle="dropdown" aria-expanded="false"> | |||
{%= __("Menu") %} <span class="caret"></span> | |||
@@ -19,7 +19,15 @@ | |||
</ul> | |||
</div> | |||
<button class="btn btn-secondary btn-default btn-sm hide"></button> | |||
<button class="btn btn-primary btn-sm hide"></button> | |||
<div class="btn-group actions-btn-group hide"> | |||
<button type="button" class="btn btn-primary btn-sm dropdown-toggle" | |||
data-toggle="dropdown" aria-expanded="false"> | |||
{%= __("Actions") %} <span class="caret"></span> | |||
</button> | |||
<ul class="dropdown-menu" role="menu"> | |||
</ul> | |||
</div> | |||
<button class="btn btn-primary btn-sm hide primary-action"></button> | |||
</div> | |||
</div> | |||
</div> | |||
@@ -29,7 +29,6 @@ frappe.ui.Page = Class.extend({ | |||
this.views = {}; | |||
this.make(); | |||
this.setup_iconbar(); | |||
}, | |||
@@ -64,12 +63,19 @@ frappe.ui.Page = Class.extend({ | |||
this.main = this.wrapper.find(".layout-main-section"); | |||
this.sidebar = this.wrapper.find(".layout-side-section"); | |||
this.page_actions = this.wrapper.find(".page-actions"); | |||
this.menu = this.page_actions.find(".dropdown-menu"); | |||
this.indicator = this.wrapper.find(".indicator"); | |||
this.btn_primary = this.page_actions.find(".btn-primary"); | |||
this.page_actions = this.wrapper.find(".page-actions"); | |||
this.btn_primary = this.page_actions.find(".primary-action"); | |||
this.btn_secondary = this.page_actions.find(".btn-secondary"); | |||
this.menu_btn_group = this.page_actions.find(".btn-group"); | |||
this.menu = this.page_actions.find(".menu-btn-group .dropdown-menu"); | |||
this.menu_btn_group = this.page_actions.find(".menu-btn-group"); | |||
this.actions = this.page_actions.find(".actions-btn-group .dropdown-menu"); | |||
this.actions_btn_group = this.page_actions.find(".actions-btn-group"); | |||
this.page_form = $('<div class="page-form row hide"></div>').prependTo(this.main); | |||
this.icon_group = this.page_actions.find(".page-icon-group"); | |||
}, | |||
@@ -109,18 +115,48 @@ frappe.ui.Page = Class.extend({ | |||
this.icon_group.addClass("hide").empty(); | |||
}, | |||
//--- Menu --// | |||
add_menu_item: function(label, click, standard) { | |||
this.show_menu(); | |||
return this.add_dropdown_item(label, click, standard, this.menu); | |||
}, | |||
clear_menu: function() { | |||
this.clear_btn_group(this.menu); | |||
}, | |||
show_menu: function() { | |||
this.menu_btn_group.removeClass("hide"); | |||
}, | |||
hide_menu: function() { | |||
this.menu_btn_group.addClass("hide"); | |||
}, | |||
//--- Actions (workflow) --// | |||
add_action_item: function(label, click, standard) { | |||
return this.add_dropdown_item(label, click, standard, this.actions); | |||
}, | |||
clear_actions_menu: function() { | |||
this.clear_btn_group(this.actions); | |||
}, | |||
//-- Generic --// | |||
add_dropdown_item: function(label, click, standard, parent) { | |||
parent.parent().removeClass("hide"); | |||
var $li = $('<li><a class="grey-link">'+ label +'</a><li>'), | |||
$link = $li.find("a").on("click", click); | |||
if(standard===true) { | |||
$li.appendTo(this.menu); | |||
$li.appendTo(parent); | |||
} else { | |||
this.divider = this.menu.find(".divider"); | |||
this.divider = parent.find(".divider"); | |||
if(!this.divider.length) { | |||
this.divider = $('<li class="divider user-action"></li>').prependTo(this.menu); | |||
this.divider = $('<li class="divider user-action"></li>').prependTo(parent); | |||
} | |||
$li.addClass("user-action").insertBefore(this.divider); | |||
} | |||
@@ -128,40 +164,21 @@ frappe.ui.Page = Class.extend({ | |||
return $link; | |||
}, | |||
add_divider: function() { | |||
return $('<li class="divider"></li>').appendTo(this.menu); | |||
}, | |||
hide_menu: function() { | |||
this.menu_btn_group.addClass("hide"); | |||
clear_btn_group: function(parent) { | |||
parent.empty(); | |||
parent.parent().addClass("hide"); | |||
}, | |||
show_menu: function() { | |||
this.menu_btn_group.removeClass("hide"); | |||
add_divider: function() { | |||
return $('<li class="divider"></li>').appendTo(this.menu); | |||
}, | |||
clear_menu: function() { | |||
this.menu.empty(); | |||
this.hide_menu(); | |||
}, | |||
//---// | |||
clear_user_actions: function() { | |||
this.menu.find(".user-action").remove(); | |||
}, | |||
setup_iconbar: function() { | |||
var me = this; | |||
this.iconbar = new frappe.ui.IconBar(this.wrapper.find(".page-toolbar .container"), 3); | |||
this.iconbar.$wrapper.find(".iconbar-3").addClass("pull-right"); | |||
this.iconbar.$wrapper.on("shown", function() { | |||
me.wrapper.find(".page-toolbar").removeClass("hide") | |||
}) | |||
this.iconbar.$wrapper.on("hidden", function() { | |||
me.wrapper.find(".page-toolbar").addClass("hide") | |||
}) | |||
}, | |||
// page::title | |||
get_title_area: function() { | |||
return this.$title_area; | |||
@@ -87,7 +87,7 @@ frappe.views.Container = Class.extend({ | |||
} | |||
if(breadcrumbs.module && breadcrumbs.module != "Desk") { | |||
if(in_list(["Core", "Email", "Custom"], breadcrumbs.module)) | |||
if(in_list(["Core", "Email", "Custom", "Workflow"], breadcrumbs.module)) | |||
breadcrumbs.module = "Setup"; | |||
var module_info = frappe.get_module(breadcrumbs.module), | |||
icon = module_info && module_info.icon, | |||
@@ -98,23 +98,25 @@ frappe.views.Page = Class.extend({ | |||
}) | |||
frappe.show_not_found = function(page_name) { | |||
frappe.show_message_page(page_name, '<i class="icon-exclamation-sign"></i> ' + __("Not Found"), | |||
__("Sorry we were unable to find what you were looking for.")); | |||
frappe.show_message_page(page_name, __("Page Not Found"), | |||
__("Sorry we were unable to find what you were looking for."), "octicon octicon-circle-slash"); | |||
} | |||
frappe.show_not_permitted = function(page_name) { | |||
frappe.show_message_page(page_name, '<i class="icon-exclamation-sign"></i> ' +__("Not Permitted"), | |||
__("Sorry you are not permitted to view this page.")); | |||
frappe.show_message_page(page_name, __("Not Permitted"), | |||
__("Sorry you are not permitted to view this page."), "octicon octicon-circle-slash"); | |||
} | |||
frappe.show_message_page = function(page_name, title, message) { | |||
frappe.show_message_page = function(page_name, title, message, icon) { | |||
if(!page_name) page_name = frappe.get_route_str(); | |||
var page = frappe.pages[page_name] || frappe.container.add_page(page_name); | |||
if(icon) { | |||
icon = '<span class="'+ icon +' text-extra-muted" style="font-size: 120%;"></span> '; | |||
} | |||
$(page).html('<div class="page">\ | |||
<div style="margin: 50px; text-align:center;">\ | |||
<h3>'+title+'</h3><br>\ | |||
<p>'+message+'</p><br>\ | |||
<p><a href="#">Home <i class="icon-home"></i></a></p>\ | |||
<h2>'+ (icon ? icon : "") + title+'</h2><br><br><br>\ | |||
<p><a class="btn btn-default btn-sm" href="#">Home</a></p>\ | |||
</div>\ | |||
</div>'); | |||
frappe.container.change_to(page_name); | |||
@@ -328,13 +328,12 @@ _f.Frm.prototype.refresh_header = function() { | |||
} | |||
_f.Frm.prototype.show_web_link = function() { | |||
var doc = this.doc; | |||
if(this.fields_dict.parent_website_route) { | |||
if(!doc.__islocal && doc.__onload && doc.__onload.published) { | |||
cur_frm.set_intro(__("Published on website at: {0}", | |||
[repl('<a href="/%(website_route)s" target="_blank">/%(website_route)s</a>', doc.__onload)])); | |||
} else { | |||
cur_frm.set_intro(""); | |||
var doc = this.doc, me = this; | |||
if(!doc.__islocal && doc.__onload && doc.__onload.is_website_generator) { | |||
me.web_link && me.web_link.remove(); | |||
if(doc.__onload.published) { | |||
me.web_link = me.sidebar.add_user_action("See on Website", | |||
function() {}).attr("href", "/" + doc.__onload.website_route).attr("target", "_blank"); | |||
} | |||
} | |||
} | |||
@@ -155,7 +155,7 @@ em.link-option { | |||
} | |||
.form-intro-area { | |||
padding: 15px 22px; | |||
padding: 15px; | |||
} | |||
.page-form { | |||
@@ -541,10 +541,20 @@ em.link-option { | |||
width: 140px; | |||
height: 140px; | |||
} | |||
.missing-image .octicon { | |||
font-size: 32px; | |||
color: @border-color; | |||
} | |||
.missing-image.small { | |||
width: 20px; | |||
height: 20px; | |||
} | |||
.missing-image.small .octicon { | |||
font-size: 16px; | |||
} | |||
/* form */ | |||
.timeline { | |||
@@ -707,6 +717,9 @@ ul.linked-with-list li { | |||
.control-label, .grid-heading-row { | |||
color: #8c99a5; | |||
font-size: 85%; | |||
} | |||
.control-label { | |||
margin-bottom: 2px; | |||
} | |||
@@ -1,5 +1,5 @@ | |||
{ | |||
"allow_import": 1, | |||
"allow_import": 1, | |||
"creation": "2013-03-28 10:35:30", | |||
"docstatus": 0, | |||
"doctype": "DocType", | |||
@@ -30,20 +30,20 @@ | |||
"permlevel": 0 | |||
}, | |||
{ | |||
"fieldname": "blogger", | |||
"fieldname": "blog_category", | |||
"fieldtype": "Link", | |||
"in_list_view": 1, | |||
"label": "Blogger", | |||
"options": "Blogger", | |||
"label": "Blog Category", | |||
"options": "Blog Category", | |||
"permlevel": 0, | |||
"reqd": 1 | |||
}, | |||
{ | |||
"fieldname": "blog_category", | |||
"fieldname": "blogger", | |||
"fieldtype": "Link", | |||
"in_list_view": 1, | |||
"label": "Blog Category", | |||
"options": "Blog Category", | |||
"label": "Blogger", | |||
"options": "Blogger", | |||
"permlevel": 0, | |||
"reqd": 1 | |||
}, | |||
@@ -65,7 +65,7 @@ | |||
"description": "Description for listing page, in plain text, only a couple of lines. (max 140 characters)", | |||
"fieldname": "blog_intro", | |||
"fieldtype": "Small Text", | |||
"in_list_view": 1, | |||
"in_list_view": 0, | |||
"label": "Blog Intro", | |||
"permlevel": 0, | |||
"reqd": 0 | |||
@@ -97,7 +97,7 @@ | |||
"icon": "icon-quote-left", | |||
"idx": 1, | |||
"max_attachments": 5, | |||
"modified": "2014-08-18 07:08:56.343029", | |||
"modified": "2015-01-07 15:40:56.177198", | |||
"modified_by": "Administrator", | |||
"module": "Website", | |||
"name": "Blog Post", | |||
@@ -1,24 +0,0 @@ | |||
<div class="row" style="max-height: 30px;"> | |||
<div class="col-xs-12"> | |||
<div class="text-ellipsis"> | |||
{%= list.get_avatar_and_id(doc) %} | |||
<span style="margin-right: 8px;" | |||
title="{%= doc.published | |||
? __("Published") : __("Not Published") %}" class="filterable" | |||
data-filter="published,=,{%= doc.published ? "Yes" : "No" %}"> | |||
<i class="icon-globe text-{%= doc.published ? "success" : "muted" %}"></i> | |||
</span> | |||
<span class="label label-info filterable" title="{%= __("Category") %}" | |||
data-filter="blog_category,=,{%= doc.blog_category %}"> | |||
<i class="icon-tag"></i> {%= doc.blog_category %} | |||
</span> | |||
<span class="label label-default filterable" title="{%= __("Blogger") %}" | |||
data-filter="blogger,=,{%= doc.blogger %}"> | |||
<i class="icon-user"></i> {%= doc.blogger %} | |||
</span> | |||
</div> | |||
</div> | |||
</div> |
@@ -1,3 +1,10 @@ | |||
frappe.listview_settings['Blog Post'] = { | |||
add_fields: ["title", "published", "blogger", "blog_category"], | |||
get_indicator: function(doc) { | |||
if(doc.published) { | |||
return [__("Published"), "green", "published,=,Yes"]; | |||
} else { | |||
return [__("Not Published"), "darkgrey", "published,=,Yes"]; | |||
} | |||
} | |||
}; |
@@ -16,7 +16,7 @@ | |||
"hidden": 0, | |||
"ignore_user_permissions": 0, | |||
"in_filter": 0, | |||
"in_list_view": 1, | |||
"in_list_view": 0, | |||
"label": "Title", | |||
"no_copy": 0, | |||
"permlevel": 0, | |||
@@ -35,7 +35,7 @@ | |||
"hidden": 0, | |||
"ignore_user_permissions": 0, | |||
"in_filter": 0, | |||
"in_list_view": 1, | |||
"in_list_view": 0, | |||
"label": "Page Name", | |||
"no_copy": 0, | |||
"permlevel": 0, | |||
@@ -95,7 +95,7 @@ | |||
"hidden": 0, | |||
"ignore_user_permissions": 0, | |||
"in_filter": 0, | |||
"in_list_view": 1, | |||
"in_list_view": 0, | |||
"label": "Login Required", | |||
"no_copy": 0, | |||
"permlevel": 0, | |||
@@ -230,7 +230,7 @@ | |||
"is_submittable": 0, | |||
"issingle": 0, | |||
"istable": 0, | |||
"modified": "2014-10-15 11:47:58.064235", | |||
"modified": "2015-01-07 15:43:22.517391", | |||
"modified_by": "Administrator", | |||
"module": "Website", | |||
"name": "Web Form", | |||
@@ -259,5 +259,6 @@ | |||
"read_only": 0, | |||
"read_only_onload": 0, | |||
"sort_field": "modified", | |||
"sort_order": "DESC" | |||
"sort_order": "DESC", | |||
"title_field": "title" | |||
} |
@@ -23,7 +23,7 @@ | |||
"description": "Page url name (auto-generated)", | |||
"fieldname": "page_name", | |||
"fieldtype": "Data", | |||
"in_list_view": 1, | |||
"in_list_view": 0, | |||
"label": "Page Name", | |||
"no_copy": 1, | |||
"permlevel": 0, | |||
@@ -173,7 +173,7 @@ | |||
"icon": "icon-file-alt", | |||
"idx": 1, | |||
"max_attachments": 20, | |||
"modified": "2014-11-28 15:00:09.806213", | |||
"modified": "2015-01-07 15:39:53.076894", | |||
"modified_by": "Administrator", | |||
"module": "Website", | |||
"name": "Web Page", | |||
@@ -1,15 +0,0 @@ | |||
<div class="row" style="max-height: 30px;"> | |||
<div class="col-xs-12"> | |||
<div class="text-ellipsis"> | |||
{%= list.get_avatar_and_id(doc) %} | |||
<!-- sample icon --> | |||
<span style="margin-right: 8px;" | |||
title="{%= doc.published | |||
? __("Published") : __("Not Published") %}" class="filterable" | |||
data-filter="published,=,{%= doc.published ? "Yes" : "No" %}"> | |||
<i class="icon-globe text-{%= doc.published ? "success" : "muted" %}"></i> | |||
</span> | |||
</div> | |||
</div> | |||
</div> |
@@ -1,3 +1,10 @@ | |||
frappe.listview_settings['Web Page'] = { | |||
add_fields: ["title", "published"], | |||
get_indicator: function(doc) { | |||
if(doc.published) { | |||
return [__("Published"), "green", "published,=,Yes"]; | |||
} else { | |||
return [__("Not Published"), "darkgrey", "published,=,Yes"]; | |||
} | |||
} | |||
}; |
@@ -2,10 +2,6 @@ frappe.provide("frappe.core") | |||
frappe.core.Workflow = frappe.ui.form.Controller.extend({ | |||
refresh: function(doc) { | |||
this.frm.set_intro(""); | |||
if(doc.is_active) { | |||
this.frm.set_intro("This Workflow is active."); | |||
} | |||
this.update_field_options(doc); | |||
}, | |||
document_type: function(doc) { | |||
@@ -1,98 +1,98 @@ | |||
{ | |||
"autoname": "field:workflow_name", | |||
"creation": "2012-12-28 10:49:55", | |||
"description": "Defines workflow states and rules for a document.", | |||
"docstatus": 0, | |||
"doctype": "DocType", | |||
"document_type": "Transaction", | |||
"autoname": "field:workflow_name", | |||
"creation": "2012-12-28 10:49:55", | |||
"description": "Defines workflow states and rules for a document.", | |||
"docstatus": 0, | |||
"doctype": "DocType", | |||
"document_type": "Transaction", | |||
"fields": [ | |||
{ | |||
"fieldname": "workflow_name", | |||
"fieldtype": "Data", | |||
"in_list_view": 1, | |||
"label": "Workflow Name", | |||
"permlevel": 0, | |||
"read_only": 0, | |||
"fieldname": "workflow_name", | |||
"fieldtype": "Data", | |||
"in_list_view": 0, | |||
"label": "Workflow Name", | |||
"permlevel": 0, | |||
"read_only": 0, | |||
"reqd": 1 | |||
}, | |||
}, | |||
{ | |||
"description": "DocType on which this Workflow is applicable.", | |||
"fieldname": "document_type", | |||
"fieldtype": "Link", | |||
"in_list_view": 1, | |||
"label": "Document Type", | |||
"options": "DocType", | |||
"permlevel": 0, | |||
"description": "DocType on which this Workflow is applicable.", | |||
"fieldname": "document_type", | |||
"fieldtype": "Link", | |||
"in_list_view": 0, | |||
"label": "Document Type", | |||
"options": "DocType", | |||
"permlevel": 0, | |||
"reqd": 1 | |||
}, | |||
}, | |||
{ | |||
"description": "If checked, all other workflows become inactive.", | |||
"fieldname": "is_active", | |||
"fieldtype": "Check", | |||
"in_list_view": 1, | |||
"label": "Is Active", | |||
"description": "If checked, all other workflows become inactive.", | |||
"fieldname": "is_active", | |||
"fieldtype": "Check", | |||
"in_list_view": 0, | |||
"label": "Is Active", | |||
"permlevel": 0 | |||
}, | |||
}, | |||
{ | |||
"description": "Different \"States\" this document can exist in. Like \"Open\", \"Pending Approval\" etc.", | |||
"fieldname": "states", | |||
"fieldtype": "Section Break", | |||
"label": "States", | |||
"description": "Different \"States\" this document can exist in. Like \"Open\", \"Pending Approval\" etc.", | |||
"fieldname": "states_head", | |||
"fieldtype": "Section Break", | |||
"label": "States", | |||
"permlevel": 0 | |||
}, | |||
}, | |||
{ | |||
"description": "All possible Workflow States and roles of the workflow. <br>Docstatus Options: 0 is\"Saved\", 1 is \"Submitted\" and 2 is \"Cancelled\"", | |||
"fieldname": "states", | |||
"fieldtype": "Table", | |||
"label": "Document States", | |||
"options": "Workflow Document State", | |||
"permlevel": 0, | |||
"description": "All possible Workflow States and roles of the workflow. <br>Docstatus Options: 0 is\"Saved\", 1 is \"Submitted\" and 2 is \"Cancelled\"", | |||
"fieldname": "states", | |||
"fieldtype": "Table", | |||
"label": "Document States", | |||
"options": "Workflow Document State", | |||
"permlevel": 0, | |||
"reqd": 1 | |||
}, | |||
}, | |||
{ | |||
"description": "Rules for how states are transitions, like next state and which role is allowed to change state etc.", | |||
"fieldname": "transition_rules", | |||
"fieldtype": "Section Break", | |||
"label": "Transition Rules", | |||
"description": "Rules for how states are transitions, like next state and which role is allowed to change state etc.", | |||
"fieldname": "transition_rules", | |||
"fieldtype": "Section Break", | |||
"label": "Transition Rules", | |||
"permlevel": 0 | |||
}, | |||
}, | |||
{ | |||
"description": "Rules defining transition of state in the workflow.", | |||
"fieldname": "transitions", | |||
"fieldtype": "Table", | |||
"label": "Transitions", | |||
"options": "Workflow Transition", | |||
"permlevel": 0, | |||
"description": "Rules defining transition of state in the workflow.", | |||
"fieldname": "transitions", | |||
"fieldtype": "Table", | |||
"label": "Transitions", | |||
"options": "Workflow Transition", | |||
"permlevel": 0, | |||
"reqd": 1 | |||
}, | |||
}, | |||
{ | |||
"default": "workflow_state", | |||
"description": "Field that represents the Workflow State of the transaction (if field is not present, a new hidden Custom Field will be created)", | |||
"fieldname": "workflow_state_field", | |||
"fieldtype": "Data", | |||
"label": "Workflow State Field", | |||
"default": "workflow_state", | |||
"description": "Field that represents the Workflow State of the transaction (if field is not present, a new hidden Custom Field will be created)", | |||
"fieldname": "workflow_state_field", | |||
"fieldtype": "Data", | |||
"label": "Workflow State Field", | |||
"permlevel": 0 | |||
} | |||
], | |||
"icon": "icon-random", | |||
"idx": 1, | |||
"modified": "2014-12-26 16:53:17.720709", | |||
"modified_by": "Administrator", | |||
"module": "Workflow", | |||
"name": "Workflow", | |||
"owner": "Administrator", | |||
], | |||
"icon": "icon-random", | |||
"idx": 1, | |||
"modified": "2015-01-07 14:17:35.546155", | |||
"modified_by": "Administrator", | |||
"module": "Workflow", | |||
"name": "Workflow", | |||
"owner": "Administrator", | |||
"permissions": [ | |||
{ | |||
"cancel": 0, | |||
"create": 1, | |||
"delete": 1, | |||
"email": 1, | |||
"permlevel": 0, | |||
"print": 1, | |||
"read": 1, | |||
"role": "System Manager", | |||
"submit": 0, | |||
"cancel": 0, | |||
"create": 1, | |||
"delete": 1, | |||
"email": 1, | |||
"permlevel": 0, | |||
"print": 1, | |||
"read": 1, | |||
"role": "System Manager", | |||
"submit": 0, | |||
"write": 1 | |||
} | |||
] | |||
} | |||
} |
@@ -30,6 +30,7 @@ class Workflow(Document): | |||
"fieldname": self.workflow_state_field, | |||
"label": self.workflow_state_field.replace("_", " ").title(), | |||
"hidden": 1, | |||
"allow_on_submit": 1, | |||
"fieldtype": "Link", | |||
"options": "Workflow State", | |||
}).save() | |||
@@ -0,0 +1,10 @@ | |||
frappe.listview_settings['Workflow'] = { | |||
add_fields: ["is_active"], | |||
get_indicator: function(doc) { | |||
if(doc.is_active) { | |||
return [__("Active"), "green", "is_active,=,Yes"]; | |||
} else if(!doc.is_active) { | |||
return [__("Not active"), "darkgrey", "is_active,=,No"]; | |||
} | |||
} | |||
}; |