ERPNext - Open Source, web based ERP
Copyright © 2012, Web Notes Technologies Pvt Ltd, India
diff --git a/setup/doctype/item_group/item_group.py b/setup/doctype/item_group/item_group.py
index 01790eb77b8..b2a0843af47 100644
--- a/setup/doctype/item_group/item_group.py
+++ b/setup/doctype/item_group/item_group.py
@@ -37,7 +37,10 @@ class DocType(DocTypeNestedSet):
page_name = "products"
update_page_name(self.doc, self.doc.name)
-
+
+ from website.helpers.product import invalidate_cache_for
+ invalidate_cache_for(self.doc.name)
+
def prepare_template_args(self):
from website.helpers.product import get_product_list_for_group, \
get_parent_item_groups, get_group_item_count
@@ -51,4 +54,4 @@ class DocType(DocTypeNestedSet):
self.doc.items = get_product_list_for_group(product_group = self.doc.name, limit=20)
self.parent_groups = get_parent_item_groups(self.doc.name)
-
\ No newline at end of file
+
\ No newline at end of file
diff --git a/stock/doctype/item/item.py b/stock/doctype/item/item.py
index 7f17a3b830b..7db903d9a38 100644
--- a/stock/doctype/item/item.py
+++ b/stock/doctype/item/item.py
@@ -40,9 +40,8 @@ class DocType:
def on_update(self):
if self.doc.show_in_website:
# webpage updates
- from website.utils import update_page_name
- update_page_name(self.doc, self.doc.item_name)
-
+ self.update_website()
+
bin = sql("select stock_uom from `tabBin` where item_code = '%s' " % self.doc.item_code)
if bin and cstr(bin[0][0]) != cstr(self.doc.stock_uom):
msgprint("Please Update Stock UOM with the help of Stock UOM Replace Utility.")
@@ -76,6 +75,16 @@ class DocType:
child.conversion_factor = 1
child.save()
+ def update_website(self):
+ from website.utils import update_page_name
+ update_page_name(self.doc, self.doc.item_name)
+
+ from website.helpers.product import invalidate_cache_for
+ invalidate_cache_for(self.doc.item_group)
+
+ [invalidate_cache_for(d.item_group) for d in \
+ self.doclist.get({"doctype":"Website Item Group"})]
+
# On delete 1. Delete BIN (if none of the corrosponding transactions present, it gets deleted. if present, rolled back due to exception)
def on_trash(self):
sql("""delete from tabBin where item_code=%s""", self.doc.item_code)
diff --git a/website/css/website.css b/website/css/website.css
index a633be4b1e4..b392f5e79ad 100644
--- a/website/css/website.css
+++ b/website/css/website.css
@@ -36,10 +36,6 @@ p, li {
padding: 8px;
}
-footer {
-
-}
-
.web-footer-menu {
margin-bottom: 7px;
}
@@ -64,11 +60,6 @@ footer {
border-right: 0px solid #777 !important;
}
-.web-footer-powered, .web-footer-powered a {
- color: #888;
- margin-top: 20px;
-}
-
.two-column {
width: 50%;
float: left;
diff --git a/website/doctype/web_page/web_page.py b/website/doctype/web_page/web_page.py
index 8a0016b326a..324893dcc62 100644
--- a/website/doctype/web_page/web_page.py
+++ b/website/doctype/web_page/web_page.py
@@ -41,5 +41,10 @@ class DocType():
clear_cache('index')
def prepare_template_args(self):
- self.doc.main_section_html = self.doc.main_section
- self.doc.side_section_html = self.doc.side_section
\ No newline at end of file
+ if self.doc.slideshow:
+ slideshow = webnotes.model_wrapper("Website Slideshow", self.doc.slideshow)
+ self.slides = slideshow.doclist.get({"doctype":"Website Slideshow Item"})
+ self.doc.slideshow_header = slideshow.doc.header or ""
+ for s in self.slides:
+ if s.image and not s.image.lower().startswith("http"):
+ s.image = "files/" + s.image
diff --git a/website/doctype/web_page/web_page.txt b/website/doctype/web_page/web_page.txt
index 527b24fcab7..56c73443222 100644
--- a/website/doctype/web_page/web_page.txt
+++ b/website/doctype/web_page/web_page.txt
@@ -2,9 +2,9 @@
{
"owner": "Administrator",
"docstatus": 0,
- "creation": "2012-11-30 18:14:18",
+ "creation": "2012-12-07 15:15:17",
"modified_by": "Administrator",
- "modified": "2012-12-06 15:59:02"
+ "modified": "2012-12-25 17:04:19"
},
{
"allow_attach": 1,
@@ -26,9 +26,7 @@
"name": "__common__",
"parent": "Web Page",
"read": 1,
- "submit": 0,
"doctype": "DocPerm",
- "amend": 0,
"parenttype": "DocType",
"role": "Website Manager",
"parentfield": "permissions"
@@ -37,16 +35,8 @@
"name": "Web Page",
"doctype": "DocType"
},
- {
- "doctype": "DocField",
- "label": "Title and Style",
- "fieldname": "sb0",
- "fieldtype": "Section Break",
- "permlevel": 0
- },
{
"description": "Title / headline of your page",
- "colour": "White:FFF",
"doctype": "DocField",
"label": "Title",
"fieldname": "title",
@@ -54,15 +44,6 @@
"reqd": 1,
"permlevel": 0
},
- {
- "description": "Page url name (auto-generated) ",
- "colour": "White:FFF",
- "doctype": "DocField",
- "label": "Page Name",
- "fieldname": "page_name",
- "fieldtype": "Data",
- "permlevel": 1
- },
{
"doctype": "DocField",
"width": "50%",
@@ -78,43 +59,40 @@
"permlevel": 0
},
{
+ "description": "Page url name (auto-generated) (add \".html\")",
"doctype": "DocField",
- "label": "Layout",
- "options": "Single column\nTwo column",
- "fieldname": "layout",
- "fieldtype": "Select",
- "permlevel": 0
+ "label": "Page Name",
+ "fieldname": "page_name",
+ "fieldtype": "Data",
+ "permlevel": 1
},
{
"description": "Page content",
- "colour": "White:FFF",
"doctype": "DocField",
"label": "Content",
"fieldname": "sb1",
"fieldtype": "Section Break",
"permlevel": 0
},
+ {
+ "description": "Begin this page with a slideshow of images",
+ "doctype": "DocField",
+ "label": "Slideshow",
+ "options": "Website Slideshow",
+ "fieldname": "slideshow",
+ "fieldtype": "Link",
+ "permlevel": 0
+ },
{
"description": "Content in markdown format that appears on the main side of your page",
- "colour": "White:FFF",
"doctype": "DocField",
"label": "Main Section",
"fieldname": "main_section",
"fieldtype": "Text Editor",
"permlevel": 0
},
- {
- "description": "Content in markdown format that appears on the right side",
- "colour": "White:FFF",
- "doctype": "DocField",
- "label": "Side Section",
- "fieldname": "side_section",
- "fieldtype": "Text Editor",
- "permlevel": 0
- },
{
"description": "Link to other pages in the side bar and next section",
- "colour": "White:FFF",
"doctype": "DocField",
"label": "More",
"fieldname": "sb2",
@@ -131,7 +109,6 @@
},
{
"description": "Add code as <script>",
- "colour": "White:FFF",
"doctype": "DocField",
"label": "Insert Code",
"fieldname": "insert_code",
@@ -175,14 +152,10 @@
"create": 1,
"doctype": "DocPerm",
"write": 1,
- "cancel": 1,
"permlevel": 0
},
{
- "create": 0,
"doctype": "DocPerm",
- "write": 0,
- "cancel": 0,
"permlevel": 1
}
]
\ No newline at end of file
diff --git a/website/doctype/website_settings/website_settings.txt b/website/doctype/website_settings/website_settings.txt
index b02b55e44cb..4ef8addde56 100644
--- a/website/doctype/website_settings/website_settings.txt
+++ b/website/doctype/website_settings/website_settings.txt
@@ -4,7 +4,7 @@
"docstatus": 0,
"creation": "2012-07-12 23:29:36",
"modified_by": "Administrator",
- "modified": "2012-12-20 14:28:46"
+ "modified": "2012-12-25 15:41:48"
},
{
"issingle": 1,
@@ -104,10 +104,11 @@
"permlevel": 0
},
{
+ "description": "Address and other legal information you may want to put in the footer.",
"doctype": "DocField",
"label": "Address",
"fieldname": "address",
- "fieldtype": "Text",
+ "fieldtype": "Text Editor",
"permlevel": 0
},
{
diff --git a/website/doctype/website_slideshow/__init__.py b/website/doctype/website_slideshow/__init__.py
new file mode 100644
index 00000000000..e69de29bb2d
diff --git a/website/doctype/website_slideshow/website_slideshow.js b/website/doctype/website_slideshow/website_slideshow.js
new file mode 100644
index 00000000000..bde6d26ea1b
--- /dev/null
+++ b/website/doctype/website_slideshow/website_slideshow.js
@@ -0,0 +1,9 @@
+cur_frm.cscript.refresh = function(doc) {
+ cur_frm.set_intro("");
+ if(doc.__islocal) {
+ cur_frm.set_intro("First set the name and save the record.");
+ }
+ else {
+ cur_frm.set_intro("Attach files / urls and add in table.");
+ }
+}
\ No newline at end of file
diff --git a/website/doctype/website_slideshow/website_slideshow.py b/website/doctype/website_slideshow/website_slideshow.py
new file mode 100644
index 00000000000..928aa9ff9f2
--- /dev/null
+++ b/website/doctype/website_slideshow/website_slideshow.py
@@ -0,0 +1,8 @@
+# For license information, please see license.txt
+
+from __future__ import unicode_literals
+import webnotes
+
+class DocType:
+ def __init__(self, d, dl):
+ self.doc, self.doclist = d, dl
\ No newline at end of file
diff --git a/website/doctype/website_slideshow/website_slideshow.txt b/website/doctype/website_slideshow/website_slideshow.txt
new file mode 100644
index 00000000000..0097665a8e1
--- /dev/null
+++ b/website/doctype/website_slideshow/website_slideshow.txt
@@ -0,0 +1,85 @@
+[
+ {
+ "owner": "Administrator",
+ "docstatus": 0,
+ "creation": "2012-12-25 16:47:53",
+ "modified_by": "Administrator",
+ "modified": "2012-12-25 16:56:34"
+ },
+ {
+ "autoname": "field:slideshow_name",
+ "allow_attach": 1,
+ "name": "__common__",
+ "doctype": "DocType",
+ "module": "Website",
+ "max_attachments": 10,
+ "document_type": "Transaction",
+ "description": "Slideshow like display for the website"
+ },
+ {
+ "name": "__common__",
+ "parent": "Website Slideshow",
+ "doctype": "DocField",
+ "parenttype": "DocType",
+ "permlevel": 0,
+ "parentfield": "fields"
+ },
+ {
+ "parent": "Website Slideshow",
+ "read": 1,
+ "cancel": 1,
+ "name": "__common__",
+ "create": 1,
+ "doctype": "DocPerm",
+ "write": 1,
+ "parenttype": "DocType",
+ "role": "Website Manager",
+ "permlevel": 0,
+ "parentfield": "permissions"
+ },
+ {
+ "name": "Website Slideshow",
+ "doctype": "DocType"
+ },
+ {
+ "read_only": 0,
+ "doctype": "DocField",
+ "label": "Slideshow Name",
+ "fieldname": "slideshow_name",
+ "fieldtype": "Data",
+ "reqd": 1
+ },
+ {
+ "depends_on": "eval:!doc.__islocal",
+ "doctype": "DocField",
+ "label": "Slideshow Items",
+ "fieldname": "sb0",
+ "fieldtype": "Section Break"
+ },
+ {
+ "depends_on": "eval:!doc.__islocal",
+ "doctype": "DocField",
+ "label": "Slideshow Items",
+ "fieldname": "slideshow_items",
+ "fieldtype": "Table",
+ "options": "Website Slideshow Item"
+ },
+ {
+ "description": "This goes above the slideshow.",
+ "depends_on": "eval:!doc.__islocal",
+ "doctype": "DocField",
+ "label": "Header",
+ "fieldname": "header",
+ "fieldtype": "Text Editor"
+ },
+ {
+ "doctype": "DocField",
+ "label": "File List",
+ "fieldname": "file_list",
+ "fieldtype": "Text",
+ "hidden": 1
+ },
+ {
+ "doctype": "DocPerm"
+ }
+]
\ No newline at end of file
diff --git a/website/doctype/website_slideshow_item/__init__.py b/website/doctype/website_slideshow_item/__init__.py
new file mode 100644
index 00000000000..e69de29bb2d
diff --git a/website/doctype/website_slideshow_item/website_slideshow_item.py b/website/doctype/website_slideshow_item/website_slideshow_item.py
new file mode 100644
index 00000000000..928aa9ff9f2
--- /dev/null
+++ b/website/doctype/website_slideshow_item/website_slideshow_item.py
@@ -0,0 +1,8 @@
+# For license information, please see license.txt
+
+from __future__ import unicode_literals
+import webnotes
+
+class DocType:
+ def __init__(self, d, dl):
+ self.doc, self.doclist = d, dl
\ No newline at end of file
diff --git a/website/doctype/website_slideshow_item/website_slideshow_item.txt b/website/doctype/website_slideshow_item/website_slideshow_item.txt
new file mode 100644
index 00000000000..d74005e6c34
--- /dev/null
+++ b/website/doctype/website_slideshow_item/website_slideshow_item.txt
@@ -0,0 +1,59 @@
+[
+ {
+ "owner": "Administrator",
+ "docstatus": 0,
+ "creation": "2012-12-25 16:48:49",
+ "modified_by": "Administrator",
+ "modified": "2012-12-25 16:55:40"
+ },
+ {
+ "istable": 1,
+ "allow_attach": 0,
+ "doctype": "DocType",
+ "module": "Website",
+ "max_attachments": 10,
+ "name": "__common__"
+ },
+ {
+ "name": "__common__",
+ "parent": "Website Slideshow Item",
+ "doctype": "DocField",
+ "parenttype": "DocType",
+ "permlevel": 0,
+ "parentfield": "fields"
+ },
+ {
+ "name": "Website Slideshow Item",
+ "doctype": "DocType"
+ },
+ {
+ "doctype": "DocField",
+ "label": "Image",
+ "fieldname": "image",
+ "fieldtype": "Select",
+ "options": "attach_files:"
+ },
+ {
+ "doctype": "DocField",
+ "label": "Heading",
+ "width": "200px",
+ "fieldname": "heading",
+ "fieldtype": "Data"
+ },
+ {
+ "doctype": "DocField",
+ "label": "Description",
+ "width": "200px",
+ "fieldname": "description",
+ "fieldtype": "Text"
+ },
+ {
+ "print_hide": 1,
+ "no_copy": 1,
+ "doctype": "DocField",
+ "label": "File List",
+ "fieldname": "file_list",
+ "fieldtype": "Text",
+ "hidden": 1
+ }
+]
\ No newline at end of file
diff --git a/website/helpers/product.py b/website/helpers/product.py
index 6fa422d72af..0497124c17d 100644
--- a/website/helpers/product.py
+++ b/website/helpers/product.py
@@ -99,4 +99,9 @@ def get_parent_item_groups(item_group_name):
return webnotes.conn.sql("""select name, page_name from `tabItem Group`
where lft <= %s and rgt >= %s
and ifnull(show_in_website,0)=1
- order by lft asc""", (item_group.lft, item_group.rgt), as_dict=True)
\ No newline at end of file
+ order by lft asc""", (item_group.lft, item_group.rgt), as_dict=True)
+
+def invalidate_cache_for(item_group):
+ from website.utils import delete_page_cache
+ for i in get_parent_item_groups(item_group):
+ delete_page_cache(i.page_name)
\ No newline at end of file
diff --git a/website/page/website_home/website_home.html b/website/page/website_home/website_home.html
index a8d2bb1abf2..8c986cc6975 100644
--- a/website/page/website_home/website_home.html
+++ b/website/page/website_home/website_home.html
@@ -3,17 +3,20 @@
-
Static (content) web page
+
Static (content) web page.
-
Weblog (blog) entry
+
Weblog (blog) entr.y
+
+
+
Slideshows for adding in website pages.
-
Setup of top navigation bar, footer and logo
+
Setup of top navigation bar, footer and logo.
-
Setup of fonts and background
+
Setup of fonts and background.
Settings for Product Catalog on the website.
diff --git a/website/templates/html/outer.html b/website/templates/html/outer.html
index fcd65f955f8..aef91a9d558 100644
--- a/website/templates/html/outer.html
+++ b/website/templates/html/outer.html
@@ -1,5 +1,5 @@
{#
- requires, brand, top_bar_items, footer_items, copyright, content
+ requires, brand_html, top_bar_items, footer_items, copyright, content, address
#}
{% extends "html/base.html" %}
@@ -13,7 +13,7 @@
style="margin-bottom: 0px;">
-
{{ brand }}
+
{{ brand_html }}
{% for page in top_bar_items %}
{% if not page.parent_label %}
@@ -77,7 +77,10 @@
{% if copyright %}
{% endif %}
-
+ {% if address %}
+ {{ address }}
+ {% endif %}
+ ERPNext Powered
diff --git a/website/templates/html/web_page.html b/website/templates/html/web_page.html
index 6fa7d27b99b..78da9639505 100644
--- a/website/templates/html/web_page.html
+++ b/website/templates/html/web_page.html
@@ -9,21 +9,30 @@
{% block content %}
-
- {% if layout and layout.startswith('Two column') %}
-
- {% else %}
- {% endif %}
- {{ main_section_html }}
+ {% if slideshow %}
+ {{ slideshow_header }}
+
+
+ {% for slide in obj.slides %}
+
+

+
+
{{ slide.heading }}
+
{{ slide.description }}
+
+
+ {% endfor %}
+
+
‹
+
›
+
+
+ {% endif %}
+ {{ main_section }}
-
- {% if layout and layout.startswith('Two column') %}
-
- {{ side_section_html }}
-
- {% endif %}
-
{% endblock %}
\ No newline at end of file
diff --git a/website/templates/pages/attributions.html b/website/templates/pages/attributions.html
new file mode 100644
index 00000000000..bc9d3689216
--- /dev/null
+++ b/website/templates/pages/attributions.html
@@ -0,0 +1,112 @@
+{% extends "html/outer.html" %}
+
+{% block header %}
+
+{% endblock %}
+
+{% block title %}
+ ERPNext - Web Based, Open Source ERP
+{% endblock %}
+
+{% block content %}
+
+
+
This website is made using these Awesome Open Source Projects
+
+
+
+
+ | ERPNext |
+ Web based, Open Source ERP.
+ Get top class hosting and support at ERPNext.com |
+
+
+ | wnframework |
+ The full stack Python + Javascript web application framework on which ERPNext is built. |
+
+
+ | Linux Operating System |
+ The operating system that brought a revolution in Open Source software. |
+
+
+ | MySQL Database |
+ The world's most popular Open Source Database. |
+
+
+ | Apache HTTPD web server |
+ The Number One HTTP Server On The Internet. |
+
+
+ | Python Programming Language |
+ The "batteries included" language that lets you write elegant code, quickly.
Python Libraries:
+
+ - MySQLdb
+
- pytz
+
- jinja2
+
- markdown2
+
- dateutil
+
- termcolor
+
- python-memcached
+
+ |
+
+
+ | Git - Source Code Management |
+ Git is a free and open source distributed version control system designed to handle everything from small to very large projects with speed and efficiency.
+ Kindly hosted on the web by GitHub: The service that makes it easier for individuals and teams to write better code, faster. |
+
+
+ | JQuery Javascript Libary |
+ The write less, do more Javascript Library. |
+
+
+ | JQuery UI - User Interface Library |
+ A curated set of user interface interactions, effects, widgets, and themes built on top of the jQuery JavaScript Library. |
+
+
+ | Bootstrap CSS Framework |
+ Sleek, intuitive, and powerful front-end framework for faster and easier web development. |
+
+
+ | Font Awesome - Icons |
+ The iconic font designed for use with Twitter Bootstrap. |
+
+
+ | TinyMCE Rich Text Editor |
+ TinyMCE is a platform independent web based Javascript HTML WYSIWYG editor control released as Open Source under LGPL by Moxiecode Systems AB. |
+
+
+ | SlickGrid |
+ A lightning fast JavaScript grid/spreadsheet. |
+
+
+ | Flot Charting Library |
+ Attractive JavaScript plotting for jQuery. |
+
+
+ | Ace Code Editor |
+ High Performance Code Editor for the web. |
+
+
+ | JQuery.Gantt - Gantt Charts |
+ Draw Gantt charts with the famous jQuery ease of development. |
+
+
+ | JSColor - Color Picker |
+ HTML/Javascript Color Picker. |
+
+
+ | Downloadify - Flash Download Widget |
+ A tiny javascript + Flash library that enables the creation and download of text files without server interaction. |
+
+
+
+
+
Note: A link to this page must be easily accessible.
+
+
+{% endblock %}
\ No newline at end of file
diff --git a/website/utils.py b/website/utils.py
index ef73672d817..4af498159e6 100644
--- a/website/utils.py
+++ b/website/utils.py
@@ -73,7 +73,7 @@ def get_html(page_name):
html = get_html("404")
if page_name=="error":
- html = html % {"error": webnotes.getTraceback()}
+ html = html.replace("%(error)s", webnotes.getTraceback())
else:
comments = "\n\npage:"+page_name+\
"\nload status: " + (from_cache and "cache" or "fresh")
@@ -215,18 +215,24 @@ def get_outer_env():
products_item = filter(lambda d: d.url and d.url.split(".")[0]=="products", top_items)[0]
products_item.child_items = products
- return {
+ ret = webnotes._dict({
'top_bar_items': top_items,
'footer_items': webnotes.conn.sql("""\
select * from `tabTop Bar Item`
where parent='Website Settings' and parentfield='footer_items'
order by idx asc""", as_dict=1),
- 'brand': webnotes.conn.get_value('Website Settings', None, 'brand_html') or 'ERPNext',
- 'copyright': webnotes.conn.get_value('Website Settings', None, 'copyright'),
- 'favicon': webnotes.conn.get_value('Website Settings', None, 'favicon'),
'int':int
- }
+ })
+
+ settings = webnotes.doc("Website Settings", "Website Settings")
+ for k in ["brand_html", "copyright", "address"]:
+ if k in settings.fields:
+ ret[k] = settings.fields[k]
+
+ if not ret.brand_html:
+ ret.brand_html = "ERPNext"
+ return ret
def get_home_page():
doc_name = webnotes.conn.get_value('Website Settings', None, 'home_page')