moved directory structure

This commit is contained in:
Rushabh Mehta
2012-09-24 19:13:42 +05:30
parent e47a6779e9
commit 2fa2f7178d
1637 changed files with 47 additions and 11450 deletions

View File

@@ -0,0 +1 @@
from __future__ import unicode_literals

View File

@@ -0,0 +1 @@
from __future__ import unicode_literals

View File

@@ -0,0 +1,25 @@
// ERPNext - web based ERP (http://erpnext.com)
// Copyright (C) 2012 Web Notes Technologies Pvt Ltd
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
cur_frm.cscript.refresh = function(doc) {
if(!doc.__islocal && doc.published && !doc.email_sent) {
cur_frm.add_custom_button('Email Subscribers', function() {
$c_obj(make_doclist(doc.doctype, doc.name), 'send_emails', '', function(r) {
cur_frm.refresh();
});
})
}
}

View File

@@ -0,0 +1,82 @@
# ERPNext - web based ERP (http://erpnext.com)
# Copyright (C) 2012 Web Notes Technologies Pvt Ltd
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
from __future__ import unicode_literals
import webnotes
import website.utils
import website.web_page
class DocType(website.web_page.Page):
def __init__(self, d, dl):
super(DocType, self).__init__('Blog')
self.doc, self.doclist = d, dl
def send_emails(self):
"""send emails to subscribers"""
if self.doc.email_sent:
webnotes.msgprint("""Blog Subscribers already updated""", raise_exception=1)
from webnotes.utils.email_lib.bulk import send
from markdown2 import markdown
import webnotes.utils
# get leads that are subscribed to the blog
recipients = [e[0] for e in webnotes.conn.sql("""select distinct email_id from tabLead where
ifnull(blog_subscriber,0)=1""")]
# make heading as link
content = '<h2><a href="%s/%s.html">%s</a></h2>\n\n%s' % (webnotes.utils.get_request_site_address(),
self.doc.page_name, self.doc.title, markdown(self.doc.content))
# send the blog
send(recipients = recipients, doctype='Lead', email_field='email_id',
first_name_field = 'lead_name', last_name_field="", subject=self.doc.title,
message = markdown(content))
webnotes.conn.set(self.doc, 'email_sent', 1)
webnotes.msgprint("""Scheduled to send to %s subscribers""" % len(recipients))
def on_update(self):
super(DocType, self).on_update()
if not webnotes.utils.cint(self.doc.published):
self.delete_web_cache(self.doc.page_name)
else:
import website.blog
website.blog.get_blog_content(self.doc.page_name)
def prepare_template_args(self):
import webnotes.utils
# this is for double precaution. usually it wont reach this code if not published
if not webnotes.utils.cint(self.doc.published):
raise Exception, "This blog has not been published yet!"
# temp fields
from webnotes.utils import global_date_format, get_fullname
self.doc.full_name = get_fullname(self.doc.owner)
self.doc.updated = global_date_format(self.doc.creation)
self.markdown_to_html(['content'])
comment_list = webnotes.conn.sql("""\
select comment, comment_by_fullname, creation
from `tabComment` where comment_doctype="Blog"
and comment_docname=%s order by creation""", self.doc.name, as_dict=1)
self.doc.comment_list = comment_list or []
for comment in self.doc.comment_list:
comment['comment_date'] = webnotes.utils.global_date_format(comment['creation'])

View File

@@ -0,0 +1,137 @@
# DocType, Blog
[
# These values are common in all dictionaries
{
'creation': '2012-07-27 19:32:53',
'docstatus': 0,
'modified': '2012-08-03 12:18:36',
'modified_by': u'Administrator',
'owner': u'Administrator'
},
# These values are common for all DocType
{
'_last_update': u'1328599743',
'allow_attach': 1,
'colour': u'White:FFF',
'doctype': 'DocType',
'max_attachments': 5,
'module': u'Website',
'name': '__common__',
'section_style': u'Simple',
'show_in_menu': 0,
'version': 1
},
# These values are common for all DocField
{
'doctype': u'DocField',
'name': '__common__',
'parent': u'Blog',
'parentfield': u'fields',
'parenttype': u'DocType'
},
# These values are common for all DocPerm
{
'doctype': u'DocPerm',
'name': '__common__',
'parent': u'Blog',
'parentfield': u'permissions',
'parenttype': u'DocType',
'permlevel': 0,
'read': 1
},
# DocType, Blog
{
'doctype': 'DocType',
'name': u'Blog'
},
# DocPerm
{
'create': 1,
'doctype': u'DocPerm',
'role': u'Website Manager',
'write': 1
},
# DocPerm
{
'create': 1,
'doctype': u'DocPerm',
'role': u'Blogger',
'write': 1
},
# DocPerm
{
'doctype': u'DocPerm',
'role': u'Guest',
'write': 0
},
# DocField
{
'doctype': u'DocField',
'fieldname': u'title',
'fieldtype': u'Data',
'label': u'Title',
'permlevel': 0,
'reqd': 1
},
# DocField
{
'doctype': u'DocField',
'fieldname': u'published',
'fieldtype': u'Check',
'label': u'Published',
'permlevel': 0
},
# DocField
{
'doctype': u'DocField',
'fieldname': u'content',
'fieldtype': u'Code',
'label': u'Content',
'options': u'Markdown',
'permlevel': 0,
'reqd': 0
},
# DocField
{
'doctype': u'DocField',
'fieldname': u'page_name',
'fieldtype': u'Data',
'hidden': 1,
'label': u'Page Name',
'permlevel': 1
},
# DocField
{
'doctype': u'DocField',
'fieldname': u'email_sent',
'fieldtype': u'Check',
'hidden': 1,
'label': u'Email Sent',
'permlevel': 0
},
# DocField
{
'doctype': u'DocField',
'fieldname': u'file_list',
'fieldtype': u'Text',
'hidden': 1,
'label': u'File List',
'no_copy': 1,
'permlevel': 0,
'print_hide': 1
}
]

View File

@@ -0,0 +1 @@
from __future__ import unicode_literals

View File

@@ -0,0 +1,49 @@
# DocType, Related Page
[
# These values are common in all dictionaries
{
'creation': '2012-03-27 14:36:48',
'docstatus': 0,
'modified': '2012-03-27 14:36:48',
'modified_by': u'Administrator',
'owner': u'Administrator'
},
# These values are common for all DocType
{
'colour': u'White:FFF',
'doctype': 'DocType',
'istable': 1,
'module': u'Website',
'name': '__common__',
'section_style': u'Simple',
'show_in_menu': 0,
'version': 3
},
# These values are common for all DocField
{
'doctype': u'DocField',
'fieldname': u'page',
'fieldtype': u'Link',
'label': u'Page',
'name': '__common__',
'options': u'Page',
'parent': u'Related Page',
'parentfield': u'fields',
'parenttype': u'DocType',
'permlevel': 0
},
# DocType, Related Page
{
'doctype': 'DocType',
'name': u'Related Page'
},
# DocField
{
'doctype': u'DocField'
}
]

View File

@@ -0,0 +1 @@
from __future__ import unicode_literals

View File

@@ -0,0 +1,26 @@
#body_div {
{% if doc.background_image %}
background: url("../files/{{ doc.background_image }}") repeat;
{% elif doc.background_color %}
background-color: #{{ doc.background_color }};
background-image: none;
{% endif %}
{% if doc.font %}
font-family: '{{ doc.font }}', Verdana, Sans !important;
{% endif %}
{% if doc.font_size %}
font-size: {{ doc.font_size }} !important;
{% endif %}
}
{% if doc.font_size %}
.small {
font-size: {{ doc.small_font_size }} !important;
}
{% endif %}
{% if doc.heading_font %}
h1, h2, h3, h4, h5 {
font-family: '{{ doc.heading_font}}', Arial, 'Helvetica Neue' !important;
}
{% endif %}

View File

@@ -0,0 +1,22 @@
// ERPNext - web based ERP (http://erpnext.com)
// Copyright (C) 2012 Web Notes Technologies Pvt Ltd
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
wn.require('lib/js/lib/jscolor/jscolor.js');
cur_frm.cscript.onload_post_render = function() {
cur_frm.fields_dict.background_color.input.className = 'color';
jscolor.bind();
}

View File

@@ -0,0 +1,50 @@
# ERPNext - web based ERP (http://erpnext.com)
# Copyright (C) 2012 Web Notes Technologies Pvt Ltd
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
from __future__ import unicode_literals
class DocType:
def __init__(self, d, dl):
self.doc, self.doclist = d, dl
def validate(self):
"""make custom css"""
from jinja2 import Template
import os
with open(os.path.join(
os.path.dirname(os.path.abspath(__file__)),
'custom_template.css'), 'r') as f:
temp = Template(f.read())
if not self.doc.font_size:
self.doc.font_size = '13px'
self.doc.small_font_size = str(int(self.doc.font_size[:-2])-2) + 'px'
self.doc.custom_css = temp.render(doc = self.doc)
if self.doc.add_css:
self.doc.custom_css += '\n\n/* User CSS */\n\n' + self.doc.add_css
from webnotes.session_cache import clear_cache
clear_cache('Guest')
del self.doc.fields['small_font_size']
def on_update(self):
"""rebuild pages"""
from webnotes.cms.make import make_web_core
make_web_core()

View File

@@ -0,0 +1,172 @@
# DocType, Style Settings
[
# These values are common in all dictionaries
{
'creation': '2012-04-02 16:02:43',
'docstatus': 0,
'modified': '2012-05-01 15:58:16',
'modified_by': u'Administrator',
'owner': u'Administrator'
},
# These values are common for all DocType
{
'_last_update': u'1330594969',
'allow_attach': 1,
'colour': u'White:FFF',
'description': u'Set your background color, font and image (tiled)',
'doctype': 'DocType',
'issingle': 1,
'max_attachments': 1,
'module': u'Website',
'name': '__common__',
'section_style': u'Simple',
'show_in_menu': 0,
'version': 1
},
# These values are common for all DocField
{
'doctype': u'DocField',
'name': '__common__',
'parent': u'Style Settings',
'parentfield': u'fields',
'parenttype': u'DocType'
},
# These values are common for all DocPerm
{
'doctype': u'DocPerm',
'name': '__common__',
'parent': u'Style Settings',
'parentfield': u'permissions',
'parenttype': u'DocType',
'read': 1,
'role': u'Website Manager'
},
# DocType, Style Settings
{
'doctype': 'DocType',
'name': u'Style Settings'
},
# DocPerm
{
'create': 1,
'doctype': u'DocPerm',
'permlevel': 0,
'write': 1
},
# DocPerm
{
'doctype': u'DocPerm',
'permlevel': 1
},
# DocField
{
'colour': u'White:FFF',
'description': u'If image is selected, color will be ignored (attach first)',
'doctype': u'DocField',
'fieldname': u'background_image',
'fieldtype': u'Select',
'label': u'Background Image',
'options': u'attach_files:',
'permlevel': 0
},
# DocField
{
'colour': u'White:FFF',
'description': u'Solid background color (default light gray)',
'doctype': u'DocField',
'fieldname': u'background_color',
'fieldtype': u'Data',
'label': u'Background Color',
'permlevel': 0
},
# DocField
{
'doctype': u'DocField',
'fieldtype': u'Column Break',
'permlevel': 0,
'width': u'50%'
},
# DocField
{
'doctype': u'DocField',
'fieldname': u'font',
'fieldtype': u'Select',
'label': u'Font',
'options': u'\nHelvetica Neue\nLucida Grande\nVerdana\nArial\nGeorgia\nTahoma\nLato\nOpen Sans',
'permlevel': 0
},
# DocField
{
'doctype': u'DocField',
'fieldname': u'font_size',
'fieldtype': u'Select',
'label': u'Font Size',
'options': u'\n12px\n13px\n14px\n15px\n16px',
'permlevel': 0
},
# DocField
{
'doctype': u'DocField',
'fieldname': u'heading_font',
'fieldtype': u'Select',
'label': u'Heading Font',
'options': u'\nHelvetica Neue\nLucida Grande\nVerdana\nArial\nGeorgia\nTahoma\nLato\nOpen Sans',
'permlevel': 0
},
# DocField
{
'doctype': u'DocField',
'fieldname': u'css',
'fieldtype': u'Section Break',
'label': u'CSS',
'permlevel': 0
},
# DocField
{
'colour': u'White:FFF',
'description': u'add your own CSS (careful!)',
'doctype': u'DocField',
'fieldname': u'add_css',
'fieldtype': u'Code',
'label': u'Add CSS',
'permlevel': 0
},
# DocField
{
'colour': u'White:FFF',
'description': u'Auto generated',
'doctype': u'DocField',
'fieldname': u'custom_css',
'fieldtype': u'Code',
'label': u'Custom CSS',
'permlevel': 1
},
# DocField
{
'doctype': u'DocField',
'fieldname': u'file_list',
'fieldtype': u'Text',
'hidden': 1,
'label': u'File List',
'no_copy': 1,
'permlevel': 0,
'print_hide': 1
}
]

View File

@@ -0,0 +1 @@
from __future__ import unicode_literals

View File

@@ -0,0 +1,75 @@
# DocType, Top Bar Item
[
# These values are common in all dictionaries
{
'creation': '2012-04-02 16:02:43',
'docstatus': 0,
'modified': '2012-05-07 15:21:00',
'modified_by': u'Administrator',
'owner': u'Administrator'
},
# These values are common for all DocType
{
'colour': u'White:FFF',
'doctype': 'DocType',
'istable': 1,
'module': u'Website',
'name': '__common__',
'section_style': u'Simple',
'show_in_menu': 0,
'version': 1
},
# These values are common for all DocField
{
'doctype': u'DocField',
'name': '__common__',
'parent': u'Top Bar Item',
'parentfield': u'fields',
'parenttype': u'DocType',
'permlevel': 0
},
# DocType, Top Bar Item
{
'doctype': 'DocType',
'name': u'Top Bar Item'
},
# DocField
{
'doctype': u'DocField',
'fieldname': u'label',
'fieldtype': u'Data',
'label': u'Label',
'width': u'120px'
},
# DocField
{
'doctype': u'DocField',
'fieldname': u'url',
'fieldtype': u'Data',
'label': u'URL',
'width': u'200px'
},
# DocField
{
'doctype': u'DocField',
'fieldname': u'target',
'fieldtype': u'Select',
'label': u'Target',
'options': u'\ntarget = "_blank"'
},
# DocField
{
'doctype': u'DocField',
'fieldname': u'parent_label',
'fieldtype': u'Select',
'label': u'Parent Label'
}
]

View File

@@ -0,0 +1 @@
from __future__ import unicode_literals

View File

@@ -0,0 +1,99 @@
# DocType, Web Cache
[
# These values are common in all dictionaries
{
u'creation': '2012-07-12 22:19:44',
u'docstatus': 0,
u'modified': '2012-09-17 10:48:17',
u'modified_by': u'Administrator',
u'owner': u'Administrator'
},
# These values are common for all DocType
{
u'doctype': u'DocType',
'document_type': u'System',
'module': u'Website',
u'name': u'__common__',
'version': 1
},
# These values are common for all DocField
{
u'doctype': u'DocField',
u'name': u'__common__',
'parent': u'Web Cache',
'parentfield': u'fields',
'parenttype': u'DocType',
'permlevel': 0
},
# These values are common for all DocPerm
{
u'doctype': u'DocPerm',
u'name': u'__common__',
'parent': u'Web Cache',
'parentfield': u'permissions',
'parenttype': u'DocType',
'permlevel': 0,
'read': 1,
'write': 1
},
# DocType, Web Cache
{
u'doctype': u'DocType',
u'name': u'Web Cache'
},
# DocField
{
u'doctype': u'DocField',
'fieldname': u'doc_type',
'fieldtype': u'Link',
'in_filter': 1,
'label': u'DocType',
'options': u'DocType',
'reqd': 1
},
# DocField
{
u'doctype': u'DocField',
'fieldname': u'doc_name',
'fieldtype': u'Data',
'in_filter': 0,
'label': u'DocName',
'reqd': 1
},
# DocField
{
u'doctype': u'DocField',
'fieldname': u'html',
'fieldtype': u'Long Text',
'label': u'HTML'
},
# DocPerm
{
'create': 0,
u'doctype': u'DocPerm',
'role': u'Guest'
},
# DocPerm
{
'create': 1,
u'doctype': u'DocPerm',
'role': u'Website Manager'
},
# DocPerm
{
'create': 1,
u'doctype': u'DocPerm',
'role': u'Blogger'
}
]

View File

@@ -0,0 +1 @@
from __future__ import unicode_literals

View File

@@ -0,0 +1,33 @@
$.extend(cur_frm.cscript, {
layout: function(doc) {
if(!doc.layout) doc.layout = 'Two column with header'
hide_field(['head_section', 'side_section', 'javascript', 'css']);
if(doc.layout=='Two column with header') {
unhide_field(['head_section', 'side_section']);
}
if(doc.layout=='Two column') {
unhide_field('side_section');
}
if(doc.insert_code) {
if(!doc.javascript) {
doc.javascript = 'wn.pages["'+doc.name+'"].onload = function(wrapper) { }';
}
unhide_field('javascript');
}
if(doc.insert_style) {
if(!doc.css) {
doc.css = '#page-'+doc.name+' { }';
}
unhide_field('css');
}
},
refresh: function(doc) {
cur_frm.cscript.layout(doc);
},
insert_style: function(doc) {
cur_frm.cscript.layout(doc);
},
insert_code: function(doc) {
cur_frm.cscript.layout(doc);
}
})

View File

@@ -0,0 +1,41 @@
# ERPNext - web based ERP (http://erpnext.com)
# Copyright (C) 2012 Web Notes Technologies Pvt Ltd
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
from __future__ import unicode_literals
import webnotes
import website.utils
import website.web_page
class DocType(website.web_page.Page):
def __init__(self, d, dl):
super(DocType, self).__init__('Web Page')
self.doc, self.doclist = d, dl
def on_update(self):
super(DocType, self).on_update()
self.if_home_clear_cache()
def if_home_clear_cache(self):
"""if home page, clear cache"""
if webnotes.conn.get_value("Website Settings", None, "home_page")==self.doc.name:
from webnotes.session_cache import clear_cache
clear_cache('Guest')
import website.web_cache
website.web_cache.clear_cache(self.doc.page_name)
website.web_cache.clear_cache('index')
def prepare_template_args(self):
self.markdown_to_html(['head_section','main_section', 'side_section'])

View File

@@ -0,0 +1,244 @@
# DocType, Web Page
[
# These values are common in all dictionaries
{
'creation': '2012-06-19 15:02:20',
'docstatus': 0,
'modified': '2012-06-22 18:49:02',
'modified_by': u'Administrator',
'owner': u'Administrator'
},
# These values are common for all DocType
{
'_last_update': u'1328093379',
'allow_attach': 1,
'colour': u'White:FFF',
'description': u'A custom page is a simple page with the layout - headline, main section, side section\n\nEditing:\n\n- Editing is in [markdown format](http://daringfireball.net/projects/markdown/syntax)\n- You can also add images and embed html code\n\nAccessing the page:\n\n- The page can be accessed as #![page-name] after the main url\n\nIdeal for pages like FAQ, Terms and Conditions, Help etc.\n\n',
'doctype': 'DocType',
'max_attachments': 20,
'module': u'Website',
'name': '__common__',
'section_style': u'Simple',
'show_in_menu': 0,
'version': 1
},
# These values are common for all DocField
{
'doctype': u'DocField',
'name': '__common__',
'parent': u'Web Page',
'parentfield': u'fields',
'parenttype': u'DocType'
},
# These values are common for all DocPerm
{
'amend': 0,
'doctype': u'DocPerm',
'name': '__common__',
'parent': u'Web Page',
'parentfield': u'permissions',
'parenttype': u'DocType',
'read': 1,
'role': u'Website Manager',
'submit': 0
},
# DocType, Web Page
{
'doctype': 'DocType',
'name': u'Web Page'
},
# DocPerm
{
'cancel': 1,
'create': 1,
'doctype': u'DocPerm',
'permlevel': 0,
'write': 1
},
# DocPerm
{
'cancel': 0,
'create': 0,
'doctype': u'DocPerm',
'permlevel': 1,
'write': 0
},
# DocField
{
'doctype': u'DocField',
'fieldname': u'sb0',
'fieldtype': u'Section Break',
'label': u'Title and Style',
'permlevel': 0
},
# DocField
{
'colour': u'White:FFF',
'description': u'Title / headline of your page',
'doctype': u'DocField',
'fieldname': u'title',
'fieldtype': u'Data',
'label': u'Title',
'permlevel': 0,
'reqd': 1
},
# DocField
{
'colour': u'White:FFF',
'description': u'Page url name (auto-generated) ',
'doctype': u'DocField',
'fieldname': u'page_name',
'fieldtype': u'Data',
'label': u'Page Name',
'permlevel': 1
},
# DocField
{
'doctype': u'DocField',
'fieldname': u'cb1',
'fieldtype': u'Column Break',
'permlevel': 0,
'width': u'50%'
},
# DocField
{
'doctype': u'DocField',
'fieldname': u'layout',
'fieldtype': u'Select',
'label': u'Layout',
'options': u'Single column\nTwo column\nTwo column with header',
'permlevel': 0
},
# DocField
{
'colour': u'White:FFF',
'description': u'Page content',
'doctype': u'DocField',
'fieldname': u'sb1',
'fieldtype': u'Section Break',
'label': u'Content',
'permlevel': 0
},
# DocField
{
'colour': u'White:FFF',
'description': u'Section that will span 2 columns, formatted as markdown. If no head, leave blank. If you are displaying a banner, it must be 860px',
'doctype': u'DocField',
'fieldname': u'head_section',
'fieldtype': u'Text',
'label': u'Head Section',
'options': u'Markdown',
'permlevel': 0
},
# DocField
{
'colour': u'White:FFF',
'description': u'Content in markdown format that appears on the main side of your page',
'doctype': u'DocField',
'fieldname': u'main_section',
'fieldtype': u'Code',
'label': u'Main Section',
'options': u'Markdown',
'permlevel': 0
},
# DocField
{
'colour': u'White:FFF',
'description': u'Content in markdown format that appears on the right side',
'doctype': u'DocField',
'fieldname': u'side_section',
'fieldtype': u'Code',
'label': u'Side Section',
'options': u'Markdown',
'permlevel': 0
},
# DocField
{
'colour': u'White:FFF',
'description': u'Link to other pages in the side bar and next section',
'doctype': u'DocField',
'fieldname': u'sb2',
'fieldtype': u'Section Break',
'label': u'More',
'permlevel': 0
},
# DocField
{
'doctype': u'DocField',
'fieldname': u'text_align',
'fieldtype': u'Select',
'label': u'Text Align',
'options': u'Left\nCenter\nRight',
'permlevel': 0
},
# DocField
{
'colour': u'White:FFF',
'description': u'Add code as &lt;script&gt;',
'doctype': u'DocField',
'fieldname': u'insert_code',
'fieldtype': u'Check',
'label': u'Insert Code',
'permlevel': 0
},
# DocField
{
'doctype': u'DocField',
'fieldname': u'javascript',
'fieldtype': u'Code',
'label': u'Javascript',
'options': u'Javascript',
'permlevel': 0
},
# DocField
{
'doctype': u'DocField',
'fieldname': u'insert_style',
'fieldtype': u'Check',
'label': u'Insert Style',
'permlevel': 0
},
# DocField
{
'doctype': u'DocField',
'fieldname': u'css',
'fieldtype': u'Code',
'label': u'CSS',
'options': u'CSS',
'permlevel': 0
},
# DocField
{
'doctype': u'DocField',
'fieldname': u'file_list',
'fieldtype': u'Text',
'hidden': 1,
'label': u'File List',
'no_copy': 1,
'permlevel': 0,
'print_hide': 1
}
]

View File

@@ -0,0 +1 @@
from __future__ import unicode_literals

View File

@@ -0,0 +1,44 @@
// ERPNext - web based ERP (http://erpnext.com)
// Copyright (C) 2012 Web Notes Technologies Pvt Ltd
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
// update parent select
$.extend(cur_frm.cscript, {
onload_post_render: function(doc) {
// get labels of parent items
var get_parent_options = function(table_field) {
var items = getchildren('Top Bar Item', doc.name, table_field);
var main_items = [''];
for(var i in items) {
var d = items[i];
if(!d.parent_label) {
main_items.push(d.label);
}
}
return main_items.join('\n');
}
// bind function to refresh fields
// when "Parent Label" is select, it
// should automatically update
// options
$(cur_frm.fields_dict['top_bar_items'].grid.get_field('parent_label').wrapper)
.bind('refresh', function() {
this.fieldobj.refresh_options(get_parent_options('top_bar_items'));
});
}
});

View File

@@ -0,0 +1,74 @@
# ERPNext - web based ERP (http://erpnext.com)
# Copyright (C) 2012 Web Notes Technologies Pvt Ltd
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
from __future__ import unicode_literals
class DocType:
def __init__(self, d, dl):
self.doc, self.doclist = d, dl
def validate(self):
"""
* set home page
* validate domain list
* clear cache
"""
self.set_home_page()
self.validate_domain_list()
def on_update(self):
# make js and css
from webnotes.cms.make import make_web_core
make_web_core()
# clear web cache
import website.web_cache
#website.web_cache.refresh_cache(build=['Blog'])
website.web_cache.refresh_cache()
from webnotes.session_cache import clear_cache
clear_cache('Guest')
def set_home_page(self):
import webnotes
from webnotes.model.doc import Document
webnotes.conn.sql("""delete from `tabDefault Home Page` where role='Guest'""")
d = Document('Default Home Page')
d.parent = 'Control Panel'
d.parenttype = 'Control Panel'
d.parentfield = 'default_home_pages'
d.role = 'Guest'
d.home_page = self.doc.home_page
d.save()
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

@@ -0,0 +1,256 @@
# DocType, Website Settings
[
# These values are common in all dictionaries
{
'creation': '2012-05-21 15:54:09',
'docstatus': 0,
'modified': '2012-07-09 16:20:58',
'modified_by': u'Administrator',
'owner': u'Administrator'
},
# These values are common for all DocType
{
'_last_update': u'1329115882',
'allow_attach': 1,
'colour': u'White:FFF',
'doctype': 'DocType',
'document_type': u'Other',
'issingle': 1,
'max_attachments': 10,
'module': u'Website',
'name': '__common__',
'section_style': u'Simple',
'show_in_menu': 0,
'version': 1
},
# These values are common for all DocField
{
'doctype': u'DocField',
'name': '__common__',
'parent': u'Website Settings',
'parentfield': u'fields',
'parenttype': u'DocType'
},
# These values are common for all DocPerm
{
'doctype': u'DocPerm',
'name': '__common__',
'parent': u'Website Settings',
'parentfield': u'permissions',
'parenttype': u'DocType',
'read': 1
},
# DocType, Website Settings
{
'doctype': 'DocType',
'name': u'Website Settings'
},
# DocPerm
{
'create': 1,
'doctype': u'DocPerm',
'permlevel': 0,
'role': u'System Manager',
'write': 1
},
# DocPerm
{
'create': 1,
'doctype': u'DocPerm',
'permlevel': 0,
'role': u'Website Manager',
'write': 1
},
# DocPerm
{
'doctype': u'DocPerm',
'permlevel': 1,
'role': u'All'
},
# DocField
{
'doctype': u'DocField',
'fieldname': u'top_bar',
'fieldtype': u'Section Break',
'label': u'Top Bar',
'permlevel': 0
},
# DocField
{
'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': 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
{
'doctype': u'DocField',
'fieldname': u'default_product_category',
'fieldtype': u'Link',
'label': u'Default Product Category',
'options': u'Item Group',
'permlevel': 0
},
# DocField
{
'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 &lt;img /&gt; tag',
'doctype': u'DocField',
'fieldname': u'brand_html',
'fieldtype': u'Text',
'label': u'Brand HTML',
'permlevel': 0
},
# DocField
{
'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': u'DocField',
'fieldname': u'footer',
'fieldtype': u'Section Break',
'label': u'Footer',
'permlevel': 0
},
# DocField
{
'doctype': u'DocField',
'fieldname': u'address',
'fieldtype': u'Text',
'label': u'Address',
'permlevel': 0
},
# DocField
{
'doctype': u'DocField',
'fieldname': u'copyright',
'fieldtype': u'Data',
'label': u'Copyright',
'permlevel': 0
},
# DocField
{
'doctype': u'DocField',
'fieldname': u'footer_items',
'fieldtype': u'Table',
'label': u'Footer Items',
'options': u'Top Bar Item',
'permlevel': 0
},
# DocField
{
'doctype': u'DocField',
'fieldname': u'misc_section',
'fieldtype': u'Section Break',
'label': u'Misc',
'permlevel': 0
},
# DocField
{
'colour': u'White:FFF',
'description': u'An icon file with .ico extension. Should be 16 x 16 px. Generated using a favicon generator. [<a href="http://favicon-generator.org/" target="_blank">favicon-generator.org</a>]',
'doctype': u'DocField',
'fieldname': u'favicon',
'fieldtype': u'Select',
'label': u'FavIcon',
'options': u'attach_files:',
'permlevel': 0
},
# DocField
{
'description': u'Sub-domain provided by erpnext.com',
'doctype': u'DocField',
'fieldname': u'subdomain',
'fieldtype': u'Text',
'label': u'Subdomain',
'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',
'hidden': 1,
'label': u'Domain List',
'permlevel': 0,
'reqd': 0
},
# DocField
{
'doctype': u'DocField',
'fieldname': u'file_list',
'fieldtype': u'Text',
'hidden': 1,
'label': u'File List',
'no_copy': 1,
'permlevel': 0,
'print_hide': 1
},
# DocField
{
'doctype': u'DocField',
'fieldname': u'analytics',
'fieldtype': u'Section Break',
'label': u'Startup',
'permlevel': 0
},
# DocField
{
'colour': u'White:FFF',
'description': u'Bind events on startup and page change',
'doctype': u'DocField',
'fieldname': u'startup_code',
'fieldtype': u'Code',
'label': u'Startup Code',
'options': u'Javascript',
'permlevel': 0
}
]