Domain Name list in Website Settings
This commit is contained in:
parent
ba746dfb2f
commit
945b3c4680
@ -35,13 +35,24 @@ class DocType:
|
||||
# set account details
|
||||
#-----------------------
|
||||
def set_account_details(self, args):
|
||||
args = eval(args)
|
||||
"""
|
||||
Called from gateway after allocation
|
||||
"""
|
||||
import json
|
||||
args = json.loads(args)
|
||||
|
||||
self.set_cp_defaults(args['company'], args['industry'], args['time_zone'], args['country'], args['account_name'])
|
||||
self.create_profile(args['user'], args['first_name'], args['last_name'])
|
||||
|
||||
from server_tools.gateway_utils import update_client_control
|
||||
update_client_control(args['total_users'])
|
||||
# Domain related updates
|
||||
try:
|
||||
from server_tools.gateway_utils import add_domain_map
|
||||
add_domain_map(args)
|
||||
except ImportError, e:
|
||||
pass
|
||||
|
||||
# add record in domain_list of Website Settings
|
||||
webnotes.conn.set_value('Website Settings', 'Website Settings', 'subdomain', args['url_name'] + ".erpnext.com")
|
||||
|
||||
|
||||
# Account Setup
|
||||
|
@ -3,8 +3,21 @@ class DocType:
|
||||
self.doc, self.doclist = d, dl
|
||||
|
||||
def validate(self):
|
||||
"""clear cache"""
|
||||
# set home page
|
||||
"""
|
||||
* set home page
|
||||
* validate domain list
|
||||
* clear cache
|
||||
"""
|
||||
self.set_home_page()
|
||||
|
||||
self.validate_domain_list()
|
||||
|
||||
from webnotes.session_cache import clear_cache
|
||||
clear_cache('Guest')
|
||||
|
||||
|
||||
def set_home_page(self):
|
||||
|
||||
import webnotes
|
||||
from webnotes.model.doc import Document
|
||||
|
||||
@ -15,6 +28,20 @@ class DocType:
|
||||
d.role = 'Guest'
|
||||
d.home_page = self.doc.home_page
|
||||
d.save()
|
||||
|
||||
from webnotes.session_cache import clear_cache
|
||||
clear_cache('Guest')
|
||||
|
||||
|
||||
def validate_domain_list(self):
|
||||
"""
|
||||
Validate domain list if SaaS
|
||||
"""
|
||||
import webnotes
|
||||
|
||||
try:
|
||||
from server_tools.gateway_utils import validate_domain_list
|
||||
res = validate_domain_list(self.doc.domain_list, webnotes.conn.cur_db_name)
|
||||
if not res:
|
||||
webnotes.msgprint("""\
|
||||
There was some error in validating the domain list.
|
||||
Please contact us at support@erpnext.com""", raise_exception=1)
|
||||
except ImportError, e:
|
||||
pass
|
||||
|
@ -3,158 +3,207 @@
|
||||
|
||||
# These values are common in all dictionaries
|
||||
{
|
||||
'creation': '2012-02-02 13:19:50',
|
||||
'creation': '2012-02-02 13:51:29',
|
||||
'docstatus': 0,
|
||||
'modified': '2012-02-02 13:31:24',
|
||||
'modified_by': 'Administrator',
|
||||
'owner': 'Administrator'
|
||||
'modified': '2012-02-13 12:23:36',
|
||||
'modified_by': u'Administrator',
|
||||
'owner': u'Administrator'
|
||||
},
|
||||
|
||||
# These values are common for all DocType
|
||||
{
|
||||
'_last_update': '1328169455',
|
||||
'_last_update': u'1329115882',
|
||||
'allow_attach': 1,
|
||||
'colour': 'White:FFF',
|
||||
'colour': u'White:FFF',
|
||||
'doctype': 'DocType',
|
||||
'document_type': 'Other',
|
||||
'document_type': u'Other',
|
||||
'issingle': 1,
|
||||
'max_attachments': 1,
|
||||
'module': 'Website',
|
||||
'module': u'Website',
|
||||
'name': '__common__',
|
||||
'section_style': 'Simple',
|
||||
'section_style': u'Simple',
|
||||
'show_in_menu': 0,
|
||||
'version': 3
|
||||
'version': 8
|
||||
},
|
||||
|
||||
# These values are common for all DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'doctype': u'DocField',
|
||||
'name': '__common__',
|
||||
'parent': 'Website Settings',
|
||||
'parentfield': 'fields',
|
||||
'parenttype': 'DocType',
|
||||
'permlevel': 0
|
||||
'parent': u'Website Settings',
|
||||
'parentfield': u'fields',
|
||||
'parenttype': u'DocType'
|
||||
},
|
||||
|
||||
# These values are common for all DocPerm
|
||||
{
|
||||
'create': 1,
|
||||
'doctype': 'DocPerm',
|
||||
'doctype': u'DocPerm',
|
||||
'name': '__common__',
|
||||
'parent': 'Website Settings',
|
||||
'parentfield': 'permissions',
|
||||
'parenttype': 'DocType',
|
||||
'permlevel': 0,
|
||||
'read': 1,
|
||||
'write': 1
|
||||
'parent': u'Website Settings',
|
||||
'parentfield': u'permissions',
|
||||
'parenttype': u'DocType',
|
||||
'read': 1
|
||||
},
|
||||
|
||||
# DocType, Website Settings
|
||||
{
|
||||
'doctype': 'DocType',
|
||||
'name': 'Website Settings'
|
||||
'name': u'Website Settings'
|
||||
},
|
||||
|
||||
# DocPerm
|
||||
{
|
||||
'doctype': 'DocPerm',
|
||||
'role': 'System Manager'
|
||||
'create': 1,
|
||||
'doctype': u'DocPerm',
|
||||
'permlevel': 0,
|
||||
'role': u'System Manager',
|
||||
'write': 1
|
||||
},
|
||||
|
||||
# DocPerm
|
||||
{
|
||||
'doctype': 'DocPerm',
|
||||
'role': 'Website Manager'
|
||||
'create': 1,
|
||||
'doctype': u'DocPerm',
|
||||
'permlevel': 0,
|
||||
'role': u'Website Manager',
|
||||
'write': 1
|
||||
},
|
||||
|
||||
# DocPerm
|
||||
{
|
||||
'doctype': u'DocPerm',
|
||||
'permlevel': 1,
|
||||
'role': u'All'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldtype': 'Section Break',
|
||||
'label': 'Top Bar'
|
||||
'doctype': u'DocField',
|
||||
'fieldtype': u'Section Break',
|
||||
'label': u'Top Bar',
|
||||
'permlevel': 0
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'colour': 'White:FFF',
|
||||
'description': 'The name of your company / website as you want to appear on browser title bar. All pages will have this as the prefix to the title.',
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'title_prefix',
|
||||
'fieldtype': 'Data',
|
||||
'label': 'Title Prefix'
|
||||
'colour': u'White:FFF',
|
||||
'description': u'The name of your company / website as you want to appear on browser title bar. All pages will have this as the prefix to the title.',
|
||||
'doctype': u'DocField',
|
||||
'fieldname': u'title_prefix',
|
||||
'fieldtype': u'Data',
|
||||
'label': u'Title Prefix',
|
||||
'permlevel': 0
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'colour': 'White:FFF',
|
||||
'description': 'The "Web Page" that is the website home page',
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'home_page',
|
||||
'fieldtype': 'Link',
|
||||
'label': 'Home Page',
|
||||
'options': 'Web Page',
|
||||
'colour': u'White:FFF',
|
||||
'description': u'The "Web Page" that is the website home page',
|
||||
'doctype': u'DocField',
|
||||
'fieldname': u'home_page',
|
||||
'fieldtype': u'Link',
|
||||
'label': u'Home Page',
|
||||
'options': u'Web Page',
|
||||
'permlevel': 0,
|
||||
'reqd': 1
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'colour': 'White:FFF',
|
||||
'description': 'Brand is what appears on the top-right of the toolbar. If it is an image, make sure it\nhas a transparent background and use the <img /> tag',
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'brand_html',
|
||||
'fieldtype': 'Text',
|
||||
'label': 'Brand HTML'
|
||||
'colour': u'White:FFF',
|
||||
'description': u'Brand is what appears on the top-right of the toolbar. If it is an image, make sure it\nhas a transparent background and use the <img /> tag',
|
||||
'doctype': u'DocField',
|
||||
'fieldname': u'brand_html',
|
||||
'fieldtype': u'Text',
|
||||
'label': u'Brand HTML',
|
||||
'permlevel': 0
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'top_bar_items',
|
||||
'fieldtype': 'Table',
|
||||
'label': 'Top Bar Items',
|
||||
'options': 'Top Bar Item'
|
||||
'doctype': u'DocField',
|
||||
'fieldname': u'top_bar_items',
|
||||
'fieldtype': u'Table',
|
||||
'label': u'Top Bar Items',
|
||||
'options': u'Top Bar Item',
|
||||
'permlevel': 0
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldtype': 'Section Break',
|
||||
'label': 'Footer'
|
||||
'doctype': u'DocField',
|
||||
'fieldtype': u'Section Break',
|
||||
'label': u'Footer',
|
||||
'permlevel': 0
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'address',
|
||||
'fieldtype': 'Text',
|
||||
'label': 'Address'
|
||||
'doctype': u'DocField',
|
||||
'fieldname': u'address',
|
||||
'fieldtype': u'Text',
|
||||
'label': u'Address',
|
||||
'permlevel': 0
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'copyright',
|
||||
'fieldtype': 'Data',
|
||||
'label': 'Copyright'
|
||||
'doctype': u'DocField',
|
||||
'fieldname': u'copyright',
|
||||
'fieldtype': u'Data',
|
||||
'label': u'Copyright',
|
||||
'permlevel': 0
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'footer_items',
|
||||
'fieldtype': 'Table',
|
||||
'label': 'Footer Items',
|
||||
'options': 'Top Bar Item'
|
||||
'doctype': u'DocField',
|
||||
'fieldname': u'footer_items',
|
||||
'fieldtype': u'Table',
|
||||
'label': u'Footer Items',
|
||||
'options': u'Top Bar Item',
|
||||
'permlevel': 0
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'file_list',
|
||||
'fieldtype': 'Text',
|
||||
'doctype': u'DocField',
|
||||
'fieldname': u'file_list',
|
||||
'fieldtype': u'Text',
|
||||
'hidden': 1,
|
||||
'label': 'File List',
|
||||
'label': u'File List',
|
||||
'no_copy': 1,
|
||||
'permlevel': 0,
|
||||
'print_hide': 1
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': u'DocField',
|
||||
'fieldtype': u'Section Break',
|
||||
'label': u'Domains',
|
||||
'permlevel': 0
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'description': u'Sub-domain provided by erpnext.com',
|
||||
'doctype': u'DocField',
|
||||
'fieldname': u'subdomain',
|
||||
'fieldtype': u'Text',
|
||||
'label': u'Your ERPNext provided hostname',
|
||||
'permlevel': 1,
|
||||
'reqd': 0
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'description': u'Enter domain names associated to this website, each on a new line',
|
||||
'doctype': u'DocField',
|
||||
'fieldname': u'domain_list',
|
||||
'fieldtype': u'Text',
|
||||
'label': u'Domain List',
|
||||
'permlevel': 0,
|
||||
'reqd': 0
|
||||
}
|
||||
]
|
Loading…
x
Reference in New Issue
Block a user