\
- ', data);
- }
- });
- wrapper.similar.run();
-}
\ No newline at end of file
diff --git a/erpnext/stock/doctype/item/template.html b/erpnext/stock/doctype/item/template.html
deleted file mode 100644
index 8a2f4a9731d..00000000000
--- a/erpnext/stock/doctype/item/template.html
+++ /dev/null
@@ -1,25 +0,0 @@
-
-
-
-
{{ doc.item_name }}
-
-
-
-
- {{ doc.long_description_html }}
-
-
-
-
-
More Categories
-
-
-
Similar Products
-
-
-
-
-
\ No newline at end of file
diff --git a/erpnext/website/blog.py b/erpnext/website/blog.py
new file mode 100644
index 00000000000..0c287ad1a1c
--- /dev/null
+++ b/erpnext/website/blog.py
@@ -0,0 +1,67 @@
+import webnotes
+
+@webnotes.whitelist(allow_guest=True)
+def get_recent_blog_list(args=None):
+ """
+ args = {
+ 'limit_start': 0,
+ 'limit_page_length': 5,
+ 'name': '',
+ }
+ """
+ import webnotes
+
+ if not args: args = webnotes.form_dict
+
+ query = """\
+ select name, title, left(content, 100) as content
+ from tabBlog
+ where ifnull(published,0)=1 and
+ name!=%(name)s order by creation desc"""
+
+ from webnotes.widgets.query_builder import add_limit_to_query
+ query, args = add_limit_to_query(query, args)
+
+ result = webnotes.conn.sql(query, args, as_dict=1)
+
+ # strip html tags from content
+ import webnotes.utils
+ for res in result:
+ res['content'] = webnotes.utils.strip_html(res['content'])
+
+ return result
+
+@webnotes.whitelist(allow_guest=True)
+def add_comment(args=None):
+ """
+ args = {
+ 'comment': '',
+ 'comment_by': '',
+ 'comment_by_fullname': '',
+ 'comment_doctype': '',
+ 'comment_docname': '',
+ 'page_name': '',
+ }
+ """
+ import webnotes
+
+ if not args: args = webnotes.form_dict
+
+ import webnotes.widgets.form.comments
+ comment = webnotes.widgets.form.comments.add_comment(args)
+
+ # since comments are embedded in the page, clear the web cache
+ import website.web_cache
+ website.web_cache.clear_cache(args.get('page_name'),
+ args.get('comment_doctype'), args.get('comment_docname'))
+
+ import webnotes.utils
+
+ comment['comment_date'] = webnotes.utils.pretty_date(comment['creation'])
+ template_args = { 'comment_list': [comment], 'template': 'html/comment.html' }
+
+ # get html of comment row
+ comment_html = website.web_cache.build_html(template_args)
+
+ return comment_html
+
\ No newline at end of file
diff --git a/erpnext/website/doctype/blog/blog.py b/erpnext/website/doctype/blog/blog.py
index 919b8303991..bb7b66071f3 100644
--- a/erpnext/website/doctype/blog/blog.py
+++ b/erpnext/website/doctype/blog/blog.py
@@ -22,52 +22,37 @@ naming for same name files: file.gif, file-1.gif, file-2.gif etc
import webnotes
import website.utils
+import website.web_page
-class DocType():
+class DocType(website.web_page.Page):
def __init__(self, d, dl):
+ super(DocType, self).__init__('Blog')
self.doc, self.doclist = d, dl
+
+ 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)
+
+ def prepare_template_args(self):
+ import webnotes.utils
- def autoname(self):
- """save file by its name"""
- self.doc.name = website.utils.page_name(self.doc.title)
-
- def validate(self):
- """write/update 'Page' with the blog"""
- # we need the name for the templates
- if not self.doc.name:
- self.autoname()
+ # 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!"
- if self.doc.page_name:
- webnotes.conn.sql("""delete from tabPage where name=%s""", self.doc.page_name)
-
- p = website.utils.add_page(self.doc.title)
-
- from jinja2 import Template
- import markdown2
- import os
+ # temp fields
from webnotes.utils import global_date_format, get_fullname
- from webnotes.model.code import get_obj
-
- self.doc.content_html = unicode(markdown2.markdown(self.doc.content or ''))
self.doc.full_name = get_fullname(self.doc.owner)
self.doc.updated = global_date_format(self.doc.modified)
-
- with open(os.path.join(os.path.dirname(__file__), 'template.html'), 'r') as f:
- p.content = Template(f.read()).render(doc=self.doc)
-
- with open(os.path.join(os.path.dirname(__file__), 'blog_page.js'), 'r') as f:
- p.script = Template(f.read()).render(doc=self.doc)
-
- p.web_page = 'Yes'
- p.save()
- get_obj(doc=p).write_cms_page()
-
- website.utils.add_guest_access_to_page(p.name)
- self.doc.page_name = p.name
-
- # cleanup
- for f in ['full_name', 'updated', 'content_html']:
- if f in self.doc.fields:
- del self.doc.fields[f]
-
\ No newline at end of file
+ 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.pretty_date(comment['creation'])
\ No newline at end of file
diff --git a/erpnext/website/doctype/blog/blog.txt b/erpnext/website/doctype/blog/blog.txt
index ad44d13d964..24187e3bf30 100644
--- a/erpnext/website/doctype/blog/blog.txt
+++ b/erpnext/website/doctype/blog/blog.txt
@@ -3,9 +3,9 @@
# These values are common in all dictionaries
{
- 'creation': '2012-04-02 16:02:43',
+ 'creation': '2012-05-28 19:22:38',
'docstatus': 0,
- 'modified': '2012-04-26 16:58:27',
+ 'modified': '2012-06-22 18:56:16',
'modified_by': u'Administrator',
'owner': u'Administrator'
},
@@ -21,7 +21,7 @@
'name': '__common__',
'section_style': u'Simple',
'show_in_menu': 0,
- 'version': 5
+ 'version': 1
},
# These values are common for all DocField
@@ -51,6 +51,7 @@
# DocPerm
{
+ 'cancel': 1,
'create': 1,
'doctype': u'DocPerm',
'permlevel': 0,
@@ -71,7 +72,14 @@
{
'doctype': u'DocPerm',
'permlevel': 1,
- 'role': u'All'
+ 'role': u'Website Manager'
+ },
+
+ # DocPerm
+ {
+ 'doctype': u'DocPerm',
+ 'permlevel': 1,
+ 'role': u'Blogger'
},
# DocField
@@ -99,26 +107,19 @@
'fieldname': u'content',
'fieldtype': u'Code',
'label': u'Content',
+ 'options': u'Markdown',
'permlevel': 0,
'reqd': 0
},
- # DocField
- {
- 'doctype': u'DocField',
- 'fieldname': u'content_html',
- 'fieldtype': u'Text',
- 'label': u'Content HTML',
- 'permlevel': 1
- },
-
# DocField
{
'doctype': u'DocField',
'fieldname': u'page_name',
'fieldtype': u'Data',
+ 'hidden': 1,
'label': u'Page Name',
- 'permlevel': 0
+ 'permlevel': 1
},
# DocField
diff --git a/erpnext/website/doctype/blog/blog_page.js b/erpnext/website/doctype/blog/blog_page.js
deleted file mode 100644
index 4b283920fab..00000000000
--- a/erpnext/website/doctype/blog/blog_page.js
+++ /dev/null
@@ -1,83 +0,0 @@
-// 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 .
-
-// js inside blog page
-
-pscript['onload_{{ doc.name }}'] = function(wrapper) {
- // sidebar
- wrapper.recent_list = new wn.ui.Listing({
- parent: $(wrapper).find('.recent-posts'),
- no_toolbar: true,
- query: 'select name, title, left(content, 100) as content from tabBlog\
- where ifnull(published,0)=1 and name!="{{ doc.name }}" order by creation desc',
- hide_refresh: true,
- render_row: function(parent, data) {
- //console.log(data);
- if(data.content && data.content.length==100) data.content += '...';
- parent.innerHTML = repl('%(title)s\
-
%(content)s
', data);
- },
- page_length: 5,
- });
- wrapper.recent_list.run();
-
- wrapper.comment_list = new wn.ui.Listing({
- parent: $(wrapper).find('.blog-comments').get(0),
- no_toolbar: true,
- query: 'select comment, comment_by_fullname, creation\
- from `tabComment` where comment_doctype="Page"\
- and comment_docname="{{ doc.name }}" order by creation desc',
- no_result_message: 'Be the first one to comment',
- render_row: function(parent, data) {
- data.comment_date = prettyDate(data.creation);
- $(parent).html(repl("
""" % tmp
-
- def cleanup_temp(self):
- """cleanup temp fields"""
- fl = ['main_section_html', 'side_section_html', 'see_also', \
- 'next_page_html', 'head_section_html', 'updated']
- for f in fl:
- if f in self.doc.fields:
- del self.doc.fields[f]
-
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')
-
\ No newline at end of file
+ clear_cache('Guest')
+
+ def prepare_template_args(self):
+ self.markdown_to_html(['head_section','main_section', 'side_section'])
\ No newline at end of file
diff --git a/erpnext/website/doctype/web_page/web_page.txt b/erpnext/website/doctype/web_page/web_page.txt
index c40caff7de9..a1fd8949f90 100644
--- a/erpnext/website/doctype/web_page/web_page.txt
+++ b/erpnext/website/doctype/web_page/web_page.txt
@@ -3,9 +3,9 @@
# These values are common in all dictionaries
{
- 'creation': '2012-04-02 16:02:43',
+ 'creation': '2012-06-19 15:02:20',
'docstatus': 0,
- 'modified': '2012-05-02 15:24:31',
+ 'modified': '2012-06-22 18:49:02',
'modified_by': u'Administrator',
'owner': u'Administrator'
},
@@ -36,13 +36,15 @@
# 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'
+ 'role': u'Website Manager',
+ 'submit': 0
},
# DocType, Web Page
@@ -53,6 +55,7 @@
# DocPerm
{
+ 'cancel': 1,
'create': 1,
'doctype': u'DocPerm',
'permlevel': 0,
@@ -61,8 +64,11 @@
# DocPerm
{
+ 'cancel': 0,
+ 'create': 0,
'doctype': u'DocPerm',
- 'permlevel': 1
+ 'permlevel': 1,
+ 'write': 0
},
# DocField
@@ -86,6 +92,17 @@
'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',
@@ -101,7 +118,7 @@
'fieldname': u'layout',
'fieldtype': u'Select',
'label': u'Layout',
- 'options': u'Two column with header\nTwo column\nSingle column',
+ 'options': u'Single column\nTwo column\nTwo column with header',
'permlevel': 0
},
@@ -176,6 +193,7 @@
# DocField
{
'colour': u'White:FFF',
+ 'description': u'Add code as <script>',
'doctype': u'DocField',
'fieldname': u'insert_code',
'fieldtype': u'Check',
@@ -212,15 +230,6 @@
'permlevel': 0
},
- # DocField
- {
- 'doctype': u'DocField',
- 'fieldname': u'page_name',
- 'fieldtype': u'Data',
- 'label': u'Page Name',
- 'permlevel': 1
- },
-
# DocField
{
'doctype': u'DocField',
diff --git a/erpnext/website/doctype/website_settings/website_settings.py b/erpnext/website/doctype/website_settings/website_settings.py
index 9390e740b8d..b08e674ab47 100644
--- a/erpnext/website/doctype/website_settings/website_settings.py
+++ b/erpnext/website/doctype/website_settings/website_settings.py
@@ -28,38 +28,17 @@ class DocType:
self.validate_domain_list()
def on_update(self):
- self.rewrite_pages()
-
- from webnotes.session_cache import clear_cache
- clear_cache('Guest')
-
- def rewrite_pages(self):
- """rewrite all web pages"""
- import webnotes
- from webnotes.model.doclist import DocList
- from webnotes.model.code import get_obj
-
- # rewrite all web pages
- for name in webnotes.conn.sql("""select name, modified from `tabWeb Page`
- where docstatus=0"""):
- DocList('Web Page', name[0]).save()
- webnotes.conn.set_value('Web Page', name[0], 'modified', name[1])
-
- # rewrite all blog pages
- for name in webnotes.conn.sql("""select name, modified from `tabBlog`
- where docstatus=0 and ifnull(published,0)=1"""):
- DocList('Blog', name[0]).save()
- webnotes.conn.set_value('Blog', name[0], 'modified', name[1])
-
+ # make js and css
from webnotes.cms.make import make_web_core
make_web_core()
- get_obj('Page', 'blog').write_cms_page(force=True)
- get_obj('Page', 'Login Page').write_cms_page(force=True)
-
- webnotes.msgprint('Rebuilt all blogs and pages')
-
+ # clear web cache
+ import website.web_cache
+ website.web_cache.refresh_cache()
+ from webnotes.session_cache import clear_cache
+ clear_cache('Guest')
+
def set_home_page(self):
import webnotes
diff --git a/erpnext/website/doctype/website_settings/website_settings.txt b/erpnext/website/doctype/website_settings/website_settings.txt
index 368f963c24e..3ae0fbe2441 100644
--- a/erpnext/website/doctype/website_settings/website_settings.txt
+++ b/erpnext/website/doctype/website_settings/website_settings.txt
@@ -3,9 +3,9 @@
# These values are common in all dictionaries
{
- 'creation': '2012-05-03 18:43:46',
+ 'creation': '2012-05-21 15:54:09',
'docstatus': 0,
- 'modified': '2012-05-21 14:59:25',
+ 'modified': '2012-07-09 16:20:58',
'modified_by': u'Administrator',
'owner': u'Administrator'
},
@@ -18,7 +18,7 @@
'doctype': 'DocType',
'document_type': u'Other',
'issingle': 1,
- 'max_attachments': 1,
+ 'max_attachments': 10,
'module': u'Website',
'name': '__common__',
'section_style': u'Simple',
@@ -180,21 +180,21 @@
# 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
+ '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. [favicon-generator.org]',
'doctype': u'DocField',
- 'fieldname': u'domains',
- 'fieldtype': u'Section Break',
- 'label': u'Domains',
+ 'fieldname': u'favicon',
+ 'fieldtype': u'Select',
+ 'label': u'FavIcon',
+ 'options': u'attach_files:',
'permlevel': 0
},
@@ -221,6 +221,18 @@
'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',
diff --git a/erpnext/website/js/product_category.js b/erpnext/website/js/product_category.js
deleted file mode 100644
index 8d3f8988838..00000000000
--- a/erpnext/website/js/product_category.js
+++ /dev/null
@@ -1,30 +0,0 @@
-// 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 .
-
-erpnext.make_product_categories = function(wrapper) {
- wrapper.category_list = new wn.ui.Listing({
- parent: $(wrapper).find('.more-categories').get(0),
- query: 'select count(name) as items, item_group \
- from tabItem where is_sales_item="Yes" \
- group by item_group order by items desc',
- hide_refresh: true,
- render_row: function(parent, data) {
- parent.innerHTML = repl('%(item_group)s (%(items)s)',
- data);
- }
- });
- wrapper.category_list.run();
-}
diff --git a/erpnext/website/js/topbar.js b/erpnext/website/js/topbar.js
deleted file mode 100644
index 88cbe8b035a..00000000000
--- a/erpnext/website/js/topbar.js
+++ /dev/null
@@ -1,130 +0,0 @@
-// 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 .
-
-wn.provide('erpnext.navbar');
-
-/*
-
\ No newline at end of file
diff --git a/erpnext/website/page/blog/blog.py b/erpnext/website/page/blog/blog.py
deleted file mode 100644
index 97901141544..00000000000
--- a/erpnext/website/page/blog/blog.py
+++ /dev/null
@@ -1,29 +0,0 @@
-# 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 .
-
-import webnotes
-
-@webnotes.whitelist()
-def subscribe(arg):
- """subscribe to blog (blog_subscriber)"""
- if webnotes.conn.sql("""select name from `tabBlog Subscriber` where name=%s""", arg):
- webnotes.msgprint("Already a subscriber. Thanks!")
- else:
- from webnotes.model.doc import Document
- d = Document('Blog Subscriber')
- d.name = arg
- d.save()
- webnotes.msgprint("Thank you for subscribing!")
\ No newline at end of file
diff --git a/erpnext/website/page/blog/blog.txt b/erpnext/website/page/blog/blog.txt
deleted file mode 100644
index 4443ec813d9..00000000000
--- a/erpnext/website/page/blog/blog.txt
+++ /dev/null
@@ -1,44 +0,0 @@
-# Page, blog
-[
-
- # These values are common in all dictionaries
- {
- 'creation': '2012-01-27 15:47:52',
- 'docstatus': 0,
- 'modified': '2012-01-27 15:47:52',
- 'modified_by': 'Administrator',
- 'owner': 'Administrator'
- },
-
- # These values are common for all Page
- {
- 'doctype': 'Page',
- 'module': 'Website',
- 'name': '__common__',
- 'page_name': 'blog',
- 'standard': 'Yes',
- 'title': 'Blog'
- },
-
- # These values are common for all Page Role
- {
- '__islocal': 1,
- 'doctype': 'Page Role',
- 'name': '__common__',
- 'parent': 'blog',
- 'parentfield': 'roles',
- 'parenttype': 'Page',
- 'role': 'Guest'
- },
-
- # Page, blog
- {
- 'doctype': 'Page',
- 'name': 'blog'
- },
-
- # Page Role
- {
- 'doctype': 'Page Role'
- }
-]
\ No newline at end of file
diff --git a/erpnext/website/page/contact/__init__.py b/erpnext/website/page/contact/__init__.py
deleted file mode 100644
index e69de29bb2d..00000000000
diff --git a/erpnext/website/page/contact/contact.js b/erpnext/website/page/contact/contact.js
deleted file mode 100644
index c7943256319..00000000000
--- a/erpnext/website/page/contact/contact.js
+++ /dev/null
@@ -1,46 +0,0 @@
-// 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 .
-
-pscript.onload_contact = function(wrapper) {
- $('#content-contact-us .btn.primary').click(function() {
- var me = this;
- var args = {};
- args.name = $('#content-contact-us [name="contact-name"]').val();
- args.email = $('#content-contact-us [name="contact-email"]').val();
- args.message = $('#content-contact-us [name="contact-message"]').val();
-
- if(!validate_email(args.email)) {
- msgprint('Please enter a valid email id');
- return;
- }
-
- if(args.name && args.email && args.message) {
- $(this).set_working();
- $c_page('website', 'contact', 'send', args, function(r) {
- $('#content-contact-us [name*="contact"]').val('');
- $(me).done_working();
- });
- } else {
- msgprint("Please enter info in all the fields.")
- }
- });
-
- $('#content-contact-us :input').keyup(function(ev) {
- if(ev.which == 13) {
- $('#content-contact-us .btn.primary').click();
- }
- });
-}
\ No newline at end of file
diff --git a/erpnext/website/page/contact/contact.py b/erpnext/website/page/contact/contact.py
deleted file mode 100644
index 1ee3ab9efc3..00000000000
--- a/erpnext/website/page/contact/contact.py
+++ /dev/null
@@ -1,32 +0,0 @@
-# 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 .
-
-import json, webnotes
-
-@webnotes.whitelist(allow_guest=True)
-def send(args):
- """create support ticket"""
- args = json.loads(args)
-
- from webnotes.model.doc import Document
- d = Document('Support Ticket')
- d.raised_by = args['email']
- d.description = 'From: ' + args['name'] + '\n\n' + args['message']
- d.subject = 'Website Query'
- d.status = 'Open'
- d.owner = 'Guest'
- d.save(1)
- webnotes.msgprint("Thank you for your query. We will respond as soon as we can.")
\ No newline at end of file
diff --git a/erpnext/website/page/contact/contact.txt b/erpnext/website/page/contact/contact.txt
deleted file mode 100644
index 6051c6f2c95..00000000000
--- a/erpnext/website/page/contact/contact.txt
+++ /dev/null
@@ -1,42 +0,0 @@
-# Page, contact
-[
-
- # These values are common in all dictionaries
- {
- 'creation': '2012-01-25 16:02:15',
- 'docstatus': 0,
- 'modified': '2012-01-25 16:02:15',
- 'modified_by': 'Administrator',
- 'owner': 'Administrator'
- },
-
- # These values are common for all Page
- {
- 'doctype': 'Page',
- 'module': 'Website',
- 'name': '__common__',
- 'page_name': 'contact',
- 'standard': 'Yes'
- },
-
- # These values are common for all Page Role
- {
- 'doctype': 'Page Role',
- 'name': '__common__',
- 'parent': 'contact',
- 'parentfield': 'roles',
- 'parenttype': 'Page',
- 'role': 'Guest'
- },
-
- # Page, contact
- {
- 'doctype': 'Page',
- 'name': 'contact'
- },
-
- # Page Role
- {
- 'doctype': 'Page Role'
- }
-]
\ No newline at end of file
diff --git a/erpnext/website/page/products/README.md b/erpnext/website/page/products/README.md
deleted file mode 100644
index e40b44629f1..00000000000
--- a/erpnext/website/page/products/README.md
+++ /dev/null
@@ -1,27 +0,0 @@
-## Products
-
-Contains
-
-- List of Products tagged by Item master
- - image
- - short description (md)
- - pricing info (if public) (public pricelist)
- - stock info (website warehouse)
-- Search
-- Sidebar contains categories (# of items in each category)
-
-When Item is Saved, a page for that item is created with
-
-- Large image
-- Smaller images
-- Long Description
-- Pricing info
-- Stock info
-- Contact Button (instead of Buy / Add to cart)
-
-### Steps
-
-- update item master
-- update item category (show in web + priority) (or in a products settings page)
-- # of public items in each category
-- validation - item cannot have show in item if parent does not have it
\ No newline at end of file
diff --git a/erpnext/website/page/products/__init__.py b/erpnext/website/page/products/__init__.py
deleted file mode 100644
index e69de29bb2d..00000000000
diff --git a/erpnext/website/page/products/products.html b/erpnext/website/page/products/products.html
deleted file mode 100644
index 30eca4a2e13..00000000000
--- a/erpnext/website/page/products/products.html
+++ /dev/null
@@ -1,14 +0,0 @@
-
-
-
-
-
-
-
-
-
-
Categories
-
-
-
-
\ No newline at end of file
diff --git a/erpnext/website/page/products/products.txt b/erpnext/website/page/products/products.txt
deleted file mode 100644
index f00a05b8e84..00000000000
--- a/erpnext/website/page/products/products.txt
+++ /dev/null
@@ -1,43 +0,0 @@
-# Page, products
-[
-
- # These values are common in all dictionaries
- {
- 'creation': '2012-01-30 10:49:01',
- 'docstatus': 0,
- 'modified': '2012-01-30 10:49:01',
- 'modified_by': 'Administrator',
- 'owner': 'Administrator'
- },
-
- # These values are common for all Page
- {
- 'doctype': 'Page',
- 'module': 'Website',
- 'name': '__common__',
- 'page_name': 'products',
- 'standard': 'Yes',
- 'title': 'Products'
- },
-
- # These values are common for all Page Role
- {
- 'doctype': 'Page Role',
- 'name': '__common__',
- 'parent': 'products',
- 'parentfield': 'roles',
- 'parenttype': 'Page',
- 'role': 'Guest'
- },
-
- # Page, products
- {
- 'doctype': 'Page',
- 'name': 'products'
- },
-
- # Page Role
- {
- 'doctype': 'Page Role'
- }
-]
\ No newline at end of file
diff --git a/erpnext/website/product.py b/erpnext/website/product.py
new file mode 100644
index 00000000000..aff15d95f3f
--- /dev/null
+++ b/erpnext/website/product.py
@@ -0,0 +1,116 @@
+import webnotes
+
+@webnotes.whitelist(allow_guest=True)
+def get_product_list(args=None):
+ """
+ args = {
+ 'limit_start': 0,
+ 'limit_page_length': 20,
+ 'search': '',
+ 'product_group': '',
+ }
+ """
+ import webnotes
+ from webnotes.utils import cstr, cint
+
+ if not args: args = webnotes.form_dict
+
+ # base query
+ query = """\
+ select name, item_name, page_name, website_image,
+ description, web_short_description
+ from `tabItem`
+ where is_sales_item = 'Yes'
+ and docstatus = 0
+ and show_in_website = 1"""
+
+ # search term condition
+ if args.get('search'):
+ query += """
+ and (
+ web_short_description like %(search)s or
+ web_long_description like %(search)s or
+ description like %(search)s or
+ item_name like %(search)s or
+ name like %(search)s
+ )"""
+ args['search'] = "%" + cstr(args.get('search')) + "%"
+
+ # product group condition
+ if args.get('product_group') and args.get('product_group') != 'All Products':
+ query += """
+ and item_group = %(product_group)s"""
+
+ # order by
+ query += """
+ order by item_name asc, name asc"""
+
+ from webnotes.widgets.query_builder import add_limit_to_query
+ query, args = add_limit_to_query(query, args)
+
+ return webnotes.conn.sql(query, args, as_dict=1)
+
+@webnotes.whitelist(allow_guest=True)
+def get_product_category_list(args=None):
+ """
+ args = {
+ 'limit_start': 0,
+ 'limit_page_length': 5,
+ }
+ """
+ import webnotes
+
+ if not args: args = webnotes.form_dict
+
+ query = """\
+ select count(name) as items, item_group
+ from `tabItem`
+ where is_sales_item = 'Yes'
+ and docstatus = 0
+ and show_in_website = 1
+ group by item_group
+ order by items desc"""
+
+ from webnotes.widgets.query_builder import add_limit_to_query
+ query, args = add_limit_to_query(query, args)
+
+
+ result = webnotes.conn.sql(query, args, as_dict=1)
+
+ # add All Products link
+ total_count = sum((r.get('items') or 0 for r in result))
+ result = [{'items': total_count, 'item_group': 'All Products'}] + (result or [])
+
+ return result
+
+@webnotes.whitelist(allow_guest=True)
+def get_similar_product_list(args=None):
+ """
+ args = {
+ 'limit_start': 0,
+ 'limit_page_length': 5,
+ 'product_name': '',
+ 'product_group': '',
+ }
+ """
+ import webnotes
+
+ if not args: args = webnotes.form_dict
+
+ query = """\
+ select name, item_name, page_name, website_image,
+ description, web_short_description
+ from `tabItem`
+ where is_sales_item = 'Yes'
+ and docstatus = 0
+ and show_in_website = 1
+ and name != %(product_name)s
+ and item_group = %(product_group)s
+ order by item_name"""
+
+ from webnotes.widgets.query_builder import add_limit_to_query
+ query, args = add_limit_to_query(query, args)
+
+ result = webnotes.conn.sql(query, args, as_dict=1)
+
+ return result
\ No newline at end of file
diff --git a/erpnext/website/page/blog/__init__.py b/erpnext/website/templates/__init__.py
similarity index 100%
rename from erpnext/website/page/blog/__init__.py
rename to erpnext/website/templates/__init__.py
diff --git a/erpnext/website/templates/css/blog.css b/erpnext/website/templates/css/blog.css
new file mode 100644
index 00000000000..199df1ac779
--- /dev/null
+++ b/erpnext/website/templates/css/blog.css
@@ -0,0 +1,7 @@
+
\ No newline at end of file
diff --git a/erpnext/website/templates/css/blog_page.css b/erpnext/website/templates/css/blog_page.css
new file mode 100644
index 00000000000..928b8acb373
--- /dev/null
+++ b/erpnext/website/templates/css/blog_page.css
@@ -0,0 +1,9 @@
+
\ No newline at end of file
diff --git a/erpnext/website/templates/css/login.css b/erpnext/website/templates/css/login.css
new file mode 100644
index 00000000000..4e3e4b122ce
--- /dev/null
+++ b/erpnext/website/templates/css/login.css
@@ -0,0 +1,10 @@
+
\ No newline at end of file
diff --git a/erpnext/website/templates/css/product_page.css b/erpnext/website/templates/css/product_page.css
new file mode 100644
index 00000000000..2708625cf23
--- /dev/null
+++ b/erpnext/website/templates/css/product_page.css
@@ -0,0 +1,34 @@
+
\ No newline at end of file
diff --git a/erpnext/website/templates/css/products.css b/erpnext/website/templates/css/products.css
new file mode 100644
index 00000000000..73289c4e203
--- /dev/null
+++ b/erpnext/website/templates/css/products.css
@@ -0,0 +1,11 @@
+
\ No newline at end of file
diff --git a/erpnext/website/templates/html/base.html b/erpnext/website/templates/html/base.html
new file mode 100644
index 00000000000..8639a8f546e
--- /dev/null
+++ b/erpnext/website/templates/html/base.html
@@ -0,0 +1,27 @@
+
+
+
+ {% block title %}{% endblock %}
+
+
+
+
+
+
+
+ {% if favicon %}
+
+
+ {% else %}
+
+
+ {% endif %}
+
+
+ {% block header %}
+ {% endblock %}
+
+
+ {% block body %}
+ {% endblock %}
+
\ No newline at end of file
diff --git a/erpnext/website/templates/html/blog_page.html b/erpnext/website/templates/html/blog_page.html
new file mode 100644
index 00000000000..c07706af4bd
--- /dev/null
+++ b/erpnext/website/templates/html/blog_page.html
@@ -0,0 +1,57 @@
+{% extends "html/page.html" %}
+
+{% block javascript %}
+ {% include "js/blog_page.js" %}
+{% endblock %}
+
+{% block css %}
+ {% include "css/blog_page.css" %}
+{% endblock %}
+
+{% block content %}
+
+{% endblock %}
\ No newline at end of file
diff --git a/erpnext/website/templates/html/comment.html b/erpnext/website/templates/html/comment.html
new file mode 100644
index 00000000000..1323e094d22
--- /dev/null
+++ b/erpnext/website/templates/html/comment.html
@@ -0,0 +1,14 @@
+{#
+ this template generates comment rows for a blog
+ it is to be included in the blog/blog.html template
+#}
+
+{% for comment in comment_list %}
+
{{ comment.comment }}
++