@@ -618,3 +618,11 @@ def get_template(path): | |||||
def get_website_sitemap(doctype, name): | def get_website_sitemap(doctype, name): | ||||
return conn.get_value("Website Sitemap", {"ref_doctype": doctype, "docname": name}) | return conn.get_value("Website Sitemap", {"ref_doctype": doctype, "docname": name}) | ||||
def add_version(doclist): | |||||
bean({ | |||||
"doctype": "Version", | |||||
"ref_doctype": doclist[0].get("doctype"), | |||||
"docname": doclist[0].get("name"), | |||||
"doclist_json": json.dumps([d.fields for d in doclist]) | |||||
}).insert() |
@@ -0,0 +1,12 @@ | |||||
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors | |||||
# MIT License. See license.txt | |||||
# For license information, please see license.txt | |||||
from __future__ import unicode_literals | |||||
import frappe, json | |||||
class DocType: | |||||
def __init__(self, d, dl): | |||||
self.doc, self.doclist = d, dl | |||||
@@ -0,0 +1,63 @@ | |||||
[ | |||||
{ | |||||
"creation": "2014-02-20 17:22:37", | |||||
"docstatus": 0, | |||||
"modified": "2014-02-20 17:22:38", | |||||
"modified_by": "Administrator", | |||||
"owner": "Administrator" | |||||
}, | |||||
{ | |||||
"autoname": "_VER.######", | |||||
"doctype": "DocType", | |||||
"document_type": "Master", | |||||
"module": "Core", | |||||
"name": "__common__" | |||||
}, | |||||
{ | |||||
"doctype": "DocField", | |||||
"name": "__common__", | |||||
"parent": "Version", | |||||
"parentfield": "fields", | |||||
"parenttype": "DocType", | |||||
"permlevel": 0, | |||||
"reqd": 1 | |||||
}, | |||||
{ | |||||
"doctype": "DocPerm", | |||||
"export": 1, | |||||
"name": "__common__", | |||||
"parent": "Version", | |||||
"parentfield": "permissions", | |||||
"parenttype": "DocType", | |||||
"permlevel": 0, | |||||
"read": 1, | |||||
"report": 1, | |||||
"role": "System Manager" | |||||
}, | |||||
{ | |||||
"doctype": "DocType", | |||||
"name": "Version" | |||||
}, | |||||
{ | |||||
"doctype": "DocField", | |||||
"fieldname": "ref_doctype", | |||||
"fieldtype": "Link", | |||||
"label": "Ref DocType", | |||||
"options": "DocType" | |||||
}, | |||||
{ | |||||
"doctype": "DocField", | |||||
"fieldname": "docname", | |||||
"fieldtype": "Data", | |||||
"label": "Docname" | |||||
}, | |||||
{ | |||||
"doctype": "DocField", | |||||
"fieldname": "doclist_json", | |||||
"fieldtype": "Code", | |||||
"label": "Doclist JSON" | |||||
}, | |||||
{ | |||||
"doctype": "DocPerm" | |||||
} | |||||
] |
@@ -45,6 +45,8 @@ def rename_doc(doctype, old, new, force=False, merge=False, ignore_permissions=F | |||||
# call after_rename | # call after_rename | ||||
frappe.bean(doctype, new).run_method("after_rename", old, new, merge) | frappe.bean(doctype, new).run_method("after_rename", old, new, merge) | ||||
rename_versions(doctype, old, new) | |||||
# update restrictions | # update restrictions | ||||
frappe.conn.sql("""update tabDefaultValue set defvalue=%s where parenttype='Restriction' | frappe.conn.sql("""update tabDefaultValue set defvalue=%s where parenttype='Restriction' | ||||
and defkey=%s and defvalue=%s""", (new, doctype, old)) | and defkey=%s and defvalue=%s""", (new, doctype, old)) | ||||
@@ -60,6 +62,10 @@ def update_attachments(doctype, old, new): | |||||
if e.args[0]!=1054: # in patch? | if e.args[0]!=1054: # in patch? | ||||
raise | raise | ||||
def rename_versions(doctype, old, new): | |||||
frappe.conn.sql("""update tabVersion set docname=%s where doctype=%s and docname=%s""", | |||||
(new, doctype, old)) | |||||
def rename_parent_and_child(doctype, old, new, doclist): | def rename_parent_and_child(doctype, old, new, doclist): | ||||
# rename the doc | # rename the doc | ||||
frappe.conn.sql("update `tab%s` set name=%s where name=%s" \ | frappe.conn.sql("update `tab%s` set name=%s where name=%s" \ | ||||
@@ -13,7 +13,7 @@ | |||||
</div> | </div> | ||||
<div class="row"> | <div class="row"> | ||||
<div class="col-sm-8"> | <div class="col-sm-8"> | ||||
{% if copyright %}<div class="web-footer-copyright">© {{ copyright }}</div>{% endif %} | |||||
{% if copyright %}<div class="web-footer-copyright text-muted">© {{ copyright }}</div>{% endif %} | |||||
{% if footer_address %}{{ footer_address }}{% endif %} | {% if footer_address %}{{ footer_address }}{% endif %} | ||||
</div> | </div> | ||||
<div class="col-sm-4 text-right"> | <div class="col-sm-4 text-right"> | ||||
@@ -23,7 +23,7 @@ class DocType(WebsiteGenerator): | |||||
if self.doclist.get({"parentfield": "toc"}): | if self.doclist.get({"parentfield": "toc"}): | ||||
from frappe.website.render import clear_cache | from frappe.website.render import clear_cache | ||||
clear_cache() | clear_cache() | ||||
def on_trash(self): | def on_trash(self): | ||||
# delete entry from Table of Contents of other pages | # delete entry from Table of Contents of other pages | ||||
WebsiteGenerator.on_trash(self) | WebsiteGenerator.on_trash(self) | ||||
@@ -35,6 +35,7 @@ class WebsiteGenerator(DocListController): | |||||
def on_update(self): | def on_update(self): | ||||
self.update_sitemap() | self.update_sitemap() | ||||
frappe.add_version(self.doclist) | |||||
def after_rename(self, olddn, newdn, merge): | def after_rename(self, olddn, newdn, merge): | ||||
frappe.conn.sql("""update `tabWebsite Sitemap` | frappe.conn.sql("""update `tabWebsite Sitemap` | ||||