Domain Name list in Website Settings

This commit is contained in:
Anand Doshi 2012-02-13 14:04:54 +05:30
parent ba746dfb2f
commit 945b3c4680
3 changed files with 170 additions and 83 deletions

View File

@ -35,13 +35,24 @@ class DocType:
# set account details # set account details
#----------------------- #-----------------------
def set_account_details(self, args): 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.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']) self.create_profile(args['user'], args['first_name'], args['last_name'])
from server_tools.gateway_utils import update_client_control # Domain related updates
update_client_control(args['total_users']) 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 # Account Setup

View File

@ -3,8 +3,21 @@ class DocType:
self.doc, self.doclist = d, dl self.doc, self.doclist = d, dl
def validate(self): 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 import webnotes
from webnotes.model.doc import Document from webnotes.model.doc import Document
@ -15,6 +28,20 @@ class DocType:
d.role = 'Guest' d.role = 'Guest'
d.home_page = self.doc.home_page d.home_page = self.doc.home_page
d.save() 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

View File

@ -3,158 +3,207 @@
# These values are common in all dictionaries # These values are common in all dictionaries
{ {
'creation': '2012-02-02 13:19:50', 'creation': '2012-02-02 13:51:29',
'docstatus': 0, 'docstatus': 0,
'modified': '2012-02-02 13:31:24', 'modified': '2012-02-13 12:23:36',
'modified_by': 'Administrator', 'modified_by': u'Administrator',
'owner': 'Administrator' 'owner': u'Administrator'
}, },
# These values are common for all DocType # These values are common for all DocType
{ {
'_last_update': '1328169455', '_last_update': u'1329115882',
'allow_attach': 1, 'allow_attach': 1,
'colour': 'White:FFF', 'colour': u'White:FFF',
'doctype': 'DocType', 'doctype': 'DocType',
'document_type': 'Other', 'document_type': u'Other',
'issingle': 1, 'issingle': 1,
'max_attachments': 1, 'max_attachments': 1,
'module': 'Website', 'module': u'Website',
'name': '__common__', 'name': '__common__',
'section_style': 'Simple', 'section_style': u'Simple',
'show_in_menu': 0, 'show_in_menu': 0,
'version': 3 'version': 8
}, },
# These values are common for all DocField # These values are common for all DocField
{ {
'doctype': 'DocField', 'doctype': u'DocField',
'name': '__common__', 'name': '__common__',
'parent': 'Website Settings', 'parent': u'Website Settings',
'parentfield': 'fields', 'parentfield': u'fields',
'parenttype': 'DocType', 'parenttype': u'DocType'
'permlevel': 0
}, },
# These values are common for all DocPerm # These values are common for all DocPerm
{ {
'create': 1, 'doctype': u'DocPerm',
'doctype': 'DocPerm',
'name': '__common__', 'name': '__common__',
'parent': 'Website Settings', 'parent': u'Website Settings',
'parentfield': 'permissions', 'parentfield': u'permissions',
'parenttype': 'DocType', 'parenttype': u'DocType',
'permlevel': 0, 'read': 1
'read': 1,
'write': 1
}, },
# DocType, Website Settings # DocType, Website Settings
{ {
'doctype': 'DocType', 'doctype': 'DocType',
'name': 'Website Settings' 'name': u'Website Settings'
}, },
# DocPerm # DocPerm
{ {
'doctype': 'DocPerm', 'create': 1,
'role': 'System Manager' 'doctype': u'DocPerm',
'permlevel': 0,
'role': u'System Manager',
'write': 1
}, },
# DocPerm # DocPerm
{ {
'doctype': 'DocPerm', 'create': 1,
'role': 'Website Manager' 'doctype': u'DocPerm',
'permlevel': 0,
'role': u'Website Manager',
'write': 1
},
# DocPerm
{
'doctype': u'DocPerm',
'permlevel': 1,
'role': u'All'
}, },
# DocField # DocField
{ {
'doctype': 'DocField', 'doctype': u'DocField',
'fieldtype': 'Section Break', 'fieldtype': u'Section Break',
'label': 'Top Bar' 'label': u'Top Bar',
'permlevel': 0
}, },
# DocField # DocField
{ {
'colour': 'White:FFF', 'colour': u'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.', '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': 'DocField', 'doctype': u'DocField',
'fieldname': 'title_prefix', 'fieldname': u'title_prefix',
'fieldtype': 'Data', 'fieldtype': u'Data',
'label': 'Title Prefix' 'label': u'Title Prefix',
'permlevel': 0
}, },
# DocField # DocField
{ {
'colour': 'White:FFF', 'colour': u'White:FFF',
'description': 'The "Web Page" that is the website home page', 'description': u'The "Web Page" that is the website home page',
'doctype': 'DocField', 'doctype': u'DocField',
'fieldname': 'home_page', 'fieldname': u'home_page',
'fieldtype': 'Link', 'fieldtype': u'Link',
'label': 'Home Page', 'label': u'Home Page',
'options': 'Web Page', 'options': u'Web Page',
'permlevel': 0,
'reqd': 1 'reqd': 1
}, },
# DocField # DocField
{ {
'colour': 'White:FFF', 'colour': u'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', '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': 'DocField', 'doctype': u'DocField',
'fieldname': 'brand_html', 'fieldname': u'brand_html',
'fieldtype': 'Text', 'fieldtype': u'Text',
'label': 'Brand HTML' 'label': u'Brand HTML',
'permlevel': 0
}, },
# DocField # DocField
{ {
'doctype': 'DocField', 'doctype': u'DocField',
'fieldname': 'top_bar_items', 'fieldname': u'top_bar_items',
'fieldtype': 'Table', 'fieldtype': u'Table',
'label': 'Top Bar Items', 'label': u'Top Bar Items',
'options': 'Top Bar Item' 'options': u'Top Bar Item',
'permlevel': 0
}, },
# DocField # DocField
{ {
'doctype': 'DocField', 'doctype': u'DocField',
'fieldtype': 'Section Break', 'fieldtype': u'Section Break',
'label': 'Footer' 'label': u'Footer',
'permlevel': 0
}, },
# DocField # DocField
{ {
'doctype': 'DocField', 'doctype': u'DocField',
'fieldname': 'address', 'fieldname': u'address',
'fieldtype': 'Text', 'fieldtype': u'Text',
'label': 'Address' 'label': u'Address',
'permlevel': 0
}, },
# DocField # DocField
{ {
'doctype': 'DocField', 'doctype': u'DocField',
'fieldname': 'copyright', 'fieldname': u'copyright',
'fieldtype': 'Data', 'fieldtype': u'Data',
'label': 'Copyright' 'label': u'Copyright',
'permlevel': 0
}, },
# DocField # DocField
{ {
'doctype': 'DocField', 'doctype': u'DocField',
'fieldname': 'footer_items', 'fieldname': u'footer_items',
'fieldtype': 'Table', 'fieldtype': u'Table',
'label': 'Footer Items', 'label': u'Footer Items',
'options': 'Top Bar Item' 'options': u'Top Bar Item',
'permlevel': 0
}, },
# DocField # DocField
{ {
'doctype': 'DocField', 'doctype': u'DocField',
'fieldname': 'file_list', 'fieldname': u'file_list',
'fieldtype': 'Text', 'fieldtype': u'Text',
'hidden': 1, 'hidden': 1,
'label': 'File List', 'label': u'File List',
'no_copy': 1, 'no_copy': 1,
'permlevel': 0,
'print_hide': 1 '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
} }
] ]