From a4be4d339000534ccf731cfbf91bd65cbdd346d1 Mon Sep 17 00:00:00 2001 From: Rushabh Mehta Date: Mon, 30 Apr 2012 14:22:02 +0530 Subject: [PATCH] website, product and grid bugfix --- css/all-app.css | 20 +- css/all-web.css | 34 ++- erpnext/startup/event_handlers.py | 2 +- erpnext/stock/doctype/item/item.py | 35 +++ erpnext/stock/doctype/item/item.txt | 171 ++++++----- erpnext/utilities/page/messages/messages.py | 1 + erpnext/website/css/website.css | 14 - erpnext/website/doctype/blog/blog.py | 4 + erpnext/website/doctype/product/__init__.py | 0 erpnext/website/doctype/product/product.js | 22 -- erpnext/website/doctype/product/product.py | 57 ---- erpnext/website/doctype/product/product.txt | 266 ------------------ .../website/doctype/product/product_page.js | 63 ----- erpnext/website/doctype/product/template.html | 32 --- .../website/doctype/product_group/__init__.py | 0 .../doctype/product_group/product_group.txt | 57 ---- .../doctype/products_settings/__init__.py | 0 .../products_settings/products_settings.py | 34 --- .../products_settings/products_settings.txt | 72 ----- erpnext/website/doctype/web_page/web_page.py | 13 +- erpnext/website/doctype/web_page/web_page.txt | 55 ++-- .../website_settings/website_settings.txt | 14 +- erpnext/website/js/product_category.js | 17 +- erpnext/website/page/products/products.html | 9 +- erpnext/website/page/products/products.js | 48 ++-- .../page/website_home/website_home.html | 21 +- js/all-app.js | 47 ++-- js/all-web.js | 31 +- 28 files changed, 339 insertions(+), 800 deletions(-) delete mode 100644 erpnext/website/doctype/product/__init__.py delete mode 100644 erpnext/website/doctype/product/product.js delete mode 100644 erpnext/website/doctype/product/product.py delete mode 100644 erpnext/website/doctype/product/product.txt delete mode 100644 erpnext/website/doctype/product/product_page.js delete mode 100644 erpnext/website/doctype/product/template.html delete mode 100644 erpnext/website/doctype/product_group/__init__.py delete mode 100644 erpnext/website/doctype/product_group/product_group.txt delete mode 100644 erpnext/website/doctype/products_settings/__init__.py delete mode 100644 erpnext/website/doctype/products_settings/products_settings.py delete mode 100644 erpnext/website/doctype/products_settings/products_settings.txt diff --git a/css/all-app.css b/css/all-app.css index 0e432d4e0f..3fb56921f2 100644 --- a/css/all-app.css +++ b/css/all-app.css @@ -1944,6 +1944,24 @@ h1, h2, h3, h4, h5 { body { font-family: "Helvetica Neue", Helvetica, "Helvetica Neue", sans-serif; font-size: 13px; + background-color: #eee; +} + +footer { + background: #b7b7b7; /* Old browsers */ + background: -moz-linear-gradient(top, #b7b7b7 0%, #eeeeee 36%); /* FF3.6+ */ + background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#b7b7b7), color-stop(36%,#eeeeee)); /* Chrome,Safari4+ */ + background: -webkit-linear-gradient(top, #b7b7b7 0%,#eeeeee 36%); /* Chrome10+,Safari5.1+ */ + background: -o-linear-gradient(top, #b7b7b7 0%,#eeeeee 36%); /* Opera 11.10+ */ + background: -ms-linear-gradient(top, #b7b7b7 0%,#eeeeee 36%); /* IE10+ */ + background: linear-gradient(top, #b7b7b7 0%,#eeeeee 36%); /* W3C */ + filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#b7b7b7', endColorstr='#eeeeee',GradientType=0 ); /* IE6-9 */ + border-top: 1px solid #999; + text-align: center; + color: inherit; + padding: 10px; + font-size: 12px; + line-height: 1.7; } span, div, td, input, textarea, button, select { @@ -2049,10 +2067,10 @@ div.comment { color: #444; } } div#body_div { - display: none; padding-right: 7px; padding-top: 70px; padding-bottom: 50px; + min-height: 400px; } .content { diff --git a/css/all-web.css b/css/all-web.css index 9fbfd3a90a..802b787c84 100644 --- a/css/all-web.css +++ b/css/all-web.css @@ -1805,6 +1805,24 @@ h1, h2, h3, h4, h5 { body { font-family: "Helvetica Neue", Helvetica, "Helvetica Neue", sans-serif; font-size: 13px; + background-color: #eee; +} + +footer { + background: #b7b7b7; /* Old browsers */ + background: -moz-linear-gradient(top, #b7b7b7 0%, #eeeeee 36%); /* FF3.6+ */ + background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#b7b7b7), color-stop(36%,#eeeeee)); /* Chrome,Safari4+ */ + background: -webkit-linear-gradient(top, #b7b7b7 0%,#eeeeee 36%); /* Chrome10+,Safari5.1+ */ + background: -o-linear-gradient(top, #b7b7b7 0%,#eeeeee 36%); /* Opera 11.10+ */ + background: -ms-linear-gradient(top, #b7b7b7 0%,#eeeeee 36%); /* IE10+ */ + background: linear-gradient(top, #b7b7b7 0%,#eeeeee 36%); /* W3C */ + filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#b7b7b7', endColorstr='#eeeeee',GradientType=0 ); /* IE6-9 */ + border-top: 1px solid #999; + text-align: center; + color: inherit; + padding: 10px; + font-size: 12px; + line-height: 1.7; } span, div, td, input, textarea, button, select { @@ -1910,10 +1928,10 @@ div.comment { color: #444; } } div#body_div { - display: none; padding-right: 7px; padding-top: 70px; padding-bottom: 50px; + min-height: 400px; } .content { @@ -2597,21 +2615,7 @@ pre { footer { - background-color: #eee; - box-shadow: inset 0 10px 10px rgba(0,0,0,0.3), inset 0 3px 3px rgba(0,0,0,0.3); - border-top: 1px solid #555; - padding-top: 10px; - text-align: center; -} -.web-footer { - color: inherit; - padding: 10px; - line-height: 1.7; -} - -.web-footer div, .web-footer a { - font-size: 12px; } .web-footer-menu { diff --git a/erpnext/startup/event_handlers.py b/erpnext/startup/event_handlers.py index 37ffe9b281..c58d378bd5 100644 --- a/erpnext/startup/event_handlers.py +++ b/erpnext/startup/event_handlers.py @@ -67,7 +67,7 @@ def boot_session(bootinfo): parent_label, parentfield from `tabTop Bar Item` where parent='Website Settings' order by idx asc""", as_dict=1) bootinfo['startup_code'] = \ - webnotes.conn.get_value('Website Settings', None, 'startup_code') + webnotes.conn.get_value('Website Settings', None, 'startup_code') else: bootinfo['letter_heads'] = get_letter_heads() diff --git a/erpnext/stock/doctype/item/item.py b/erpnext/stock/doctype/item/item.py index ab61f28bd2..aa77e85b30 100644 --- a/erpnext/stock/doctype/item/item.py +++ b/erpnext/stock/doctype/item/item.py @@ -156,6 +156,9 @@ class DocType: if self.doc.has_serial_no == 'Yes' and self.doc.is_stock_item == 'No': msgprint("'Has Serial No' can not be 'Yes' for non-stock item", raise_exception=1) + # make product page + self.make_page() + def check_non_asset_warehouse(self): if self.doc.is_asset_item == "Yes": existing_qty = sql("select t1.warehouse, t1.actual_qty from tabBin t1, tabWarehouse t2 where t1.item_code=%s and (t2.warehouse_type!='Fixed Asset' or t2.warehouse_type is null) and t1.warehouse=t2.name and t1.actual_qty > 0", self.doc.name) @@ -208,3 +211,35 @@ Total Available Qty: %s def on_rename(self,newdn,olddn): sql("update tabItem set item_code = %s where name = %s", (newdn, olddn)) + def make_page(self): + if self.doc.show_in_website=='Yes': + + import website.utils + + if self.doc.page_name: + import webnotes.model + webnotes.model.delete_doc('Page', self.doc.page_name) + + p = website.utils.add_page("Product " + self.doc.item_name) + self.doc.page_name = p.name + + from jinja2 import Template + import markdown2 + import os + + + self.doc.long_description_html = markdown2.markdown(self.doc.description or '') + + 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__), 'product_page.js'), 'r') as f: + p.script = Template(f.read()).render(doc=self.doc) + + p.save() + + website.utils.add_guest_access_to_page(p.name) + + del self.doc.fields['long_description_html'] + + \ No newline at end of file diff --git a/erpnext/stock/doctype/item/item.txt b/erpnext/stock/doctype/item/item.txt index 28efdf8ddc..9cdb99f008 100644 --- a/erpnext/stock/doctype/item/item.txt +++ b/erpnext/stock/doctype/item/item.txt @@ -3,9 +3,9 @@ # These values are common in all dictionaries { - 'creation': '2012-03-27 14:36:31', + 'creation': '2012-04-02 16:02:29', 'docstatus': 0, - 'modified': '2012-03-27 18:51:27', + 'modified': '2012-04-30 14:08:08', 'modified_by': u'Administrator', 'owner': u'Administrator' }, @@ -29,7 +29,7 @@ 'show_in_menu': 0, 'subject': u'%(item_name)s', 'tag_fields': u'item_group', - 'version': 172 + 'version': 1 }, # These values are common for all DocField @@ -57,6 +57,73 @@ 'name': u'Item' }, + # DocPerm + { + 'amend': 0, + 'cancel': 0, + 'create': 0, + 'doctype': u'DocPerm', + 'permlevel': 1, + 'role': u'Material Manager', + 'submit': 0, + 'write': 0 + }, + + # DocPerm + { + 'amend': 0, + 'cancel': 0, + 'create': 0, + 'doctype': u'DocPerm', + 'permlevel': 0, + 'role': u'Material Manager', + 'submit': 0, + 'write': 0 + }, + + # DocPerm + { + 'amend': 0, + 'cancel': 0, + 'create': 0, + 'doctype': u'DocPerm', + 'permlevel': 1, + 'role': u'Material User', + 'submit': 0, + 'write': 0 + }, + + # DocPerm + { + 'amend': 0, + 'cancel': 0, + 'create': 0, + 'doctype': u'DocPerm', + 'permlevel': 0, + 'role': u'Material User', + 'submit': 0, + 'write': 0 + }, + + # DocPerm + { + 'cancel': 1, + 'create': 1, + 'doctype': u'DocPerm', + 'permlevel': 0, + 'role': u'Material Master Manager', + 'write': 1 + }, + + # DocPerm + { + 'create': 0, + 'doctype': u'DocPerm', + 'permlevel': 1, + 'role': u'Material Master Manager', + 'write': 0 + }, + # DocPerm { 'cancel': 1, @@ -67,25 +134,6 @@ 'write': 1 }, - # DocPerm - { - 'create': 0, - 'doctype': u'DocPerm', - 'permlevel': 1, - 'role': u'Material Master Manager', - 'write': 0 - }, - - # DocPerm - { - 'cancel': 1, - 'create': 1, - 'doctype': u'DocPerm', - 'permlevel': 0, - 'role': u'Material Master Manager', - 'write': 1 - }, - # DocPerm { 'doctype': u'DocPerm', @@ -93,54 +141,6 @@ 'role': u'System Manager' }, - # DocPerm - { - 'amend': 0, - 'cancel': 0, - 'create': 0, - 'doctype': u'DocPerm', - 'permlevel': 1, - 'role': u'Material Manager', - 'submit': 0, - 'write': 0 - }, - - # DocPerm - { - 'amend': 0, - 'cancel': 0, - 'create': 0, - 'doctype': u'DocPerm', - 'permlevel': 0, - 'role': u'Material Manager', - 'submit': 0, - 'write': 0 - }, - - # DocPerm - { - 'amend': 0, - 'cancel': 0, - 'create': 0, - 'doctype': u'DocPerm', - 'permlevel': 1, - 'role': u'Material User', - 'submit': 0, - 'write': 0 - }, - - # DocPerm - { - 'amend': 0, - 'cancel': 0, - 'create': 0, - 'doctype': u'DocPerm', - 'permlevel': 0, - 'role': u'Material User', - 'submit': 0, - 'write': 0 - }, - # DocField { 'doctype': u'DocField', @@ -722,6 +722,26 @@ 'reqd': 1 }, + # DocField + { + 'doctype': u'DocField', + 'fieldname': u'show_in_website', + 'fieldtype': u'Select', + 'label': u'Show in Website', + 'options': u'No\nYes', + 'permlevel': 0 + }, + + # DocField + { + 'doctype': u'DocField', + 'fieldname': u'website_image', + 'fieldtype': u'Select', + 'label': u'website_image', + 'options': u'attach_files:', + 'permlevel': 0 + }, + # DocField { 'doctype': u'DocField', @@ -765,6 +785,17 @@ 'permlevel': 0 }, + # DocField + { + 'colour': u'White:FFF', + 'description': u'website page link', + 'doctype': u'DocField', + 'fieldname': u'page_name', + 'fieldtype': u'Data', + 'label': u'Page Name', + 'permlevel': 1 + }, + # DocField { 'doctype': u'DocField', diff --git a/erpnext/utilities/page/messages/messages.py b/erpnext/utilities/page/messages/messages.py index 212a2686b0..db27805e7e 100644 --- a/erpnext/utilities/page/messages/messages.py +++ b/erpnext/utilities/page/messages/messages.py @@ -55,6 +55,7 @@ def get_active_users(arg=None): @webnotes.whitelist() def post(arg=None): + import webnotes """post message""" if arg: import json diff --git a/erpnext/website/css/website.css b/erpnext/website/css/website.css index fa27d4a9f8..a68209f439 100644 --- a/erpnext/website/css/website.css +++ b/erpnext/website/css/website.css @@ -65,21 +65,7 @@ pre { footer { - background-color: #eee; - box-shadow: inset 0 10px 10px rgba(0,0,0,0.3), inset 0 3px 3px rgba(0,0,0,0.3); - border-top: 1px solid #555; - padding-top: 10px; - text-align: center; -} -.web-footer { - color: inherit; - padding: 10px; - line-height: 1.7; -} - -.web-footer div, .web-footer a { - font-size: 12px; } .web-footer-menu { diff --git a/erpnext/website/doctype/blog/blog.py b/erpnext/website/doctype/blog/blog.py index c78a9cc3b9..37f77a5c95 100644 --- a/erpnext/website/doctype/blog/blog.py +++ b/erpnext/website/doctype/blog/blog.py @@ -33,6 +33,10 @@ class DocType(): def validate(self): """write/update 'Page' with the blog""" + # we need the name for the templates + if not self.doc.name: + self.autoname() + if self.doc.page_name: webnotes.conn.sql("""delete from tabPage where name=%s""", self.doc.page_name) diff --git a/erpnext/website/doctype/product/__init__.py b/erpnext/website/doctype/product/__init__.py deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/erpnext/website/doctype/product/product.js b/erpnext/website/doctype/product/product.js deleted file mode 100644 index ebdc90aa10..0000000000 --- a/erpnext/website/doctype/product/product.js +++ /dev/null @@ -1,22 +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 . - -$.extend(cur_frm.cscript, { - onload: function() { - cur_frm.add_fetch('item', 'description', 'short_description'); - cur_frm.add_fetch('item', 'item_name', 'title'); - } -}); \ No newline at end of file diff --git a/erpnext/website/doctype/product/product.py b/erpnext/website/doctype/product/product.py deleted file mode 100644 index 4abddc037a..0000000000 --- a/erpnext/website/doctype/product/product.py +++ /dev/null @@ -1,57 +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 - -class DocType: - def __init__(self, d, dl): - self.doc, self.doclist = d, dl - - def validate(self): - """make page for this product""" - import website.utils - - p = website.utils.add_page("Product " + self.doc.title) - - from jinja2 import Template - import markdown2 - import os - - self.doc.item_group = webnotes.conn.get_value('Item', self.doc.item, 'item_group') - self.doc.long_description_html = markdown2.markdown(self.doc.long_description or '') - - 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__), 'product_page.js'), 'r') as f: - p.script = Template(f.read()).render(doc=self.doc) - - p.save() - - website.utils.add_guest_access_to_page(p.name) - self.doc.page_name = p.name - self.make_item_group_active() - - del self.doc.fields['long_description_html'] - del self.doc.fields['item_group'] - - def make_item_group_active(self): - """show item group in website""" - if self.doc.published: - from webnotes.model.doc import Document - ig = Document('Item Group', self.doc.item_group) - ig.show_in_website = 1 - ig.save() diff --git a/erpnext/website/doctype/product/product.txt b/erpnext/website/doctype/product/product.txt deleted file mode 100644 index 7d9c7704f5..0000000000 --- a/erpnext/website/doctype/product/product.txt +++ /dev/null @@ -1,266 +0,0 @@ -# DocType, Product -[ - - # These values are common in all dictionaries - { - 'creation': '2012-03-27 14:36:47', - 'docstatus': 0, - 'modified': '2012-03-27 14:36:47', - 'modified_by': u'Administrator', - 'owner': u'Administrator' - }, - - # These values are common for all DocType - { - '_last_update': u'1327997783', - 'allow_attach': 1, - 'autoname': u'field:item', - 'colour': u'White:FFF', - 'description': u'A Product is shown on the website and is linked to an item.', - 'doctype': 'DocType', - 'document_type': u'Master', - 'max_attachments': 5, - 'module': u'Website', - 'name': '__common__', - 'section_style': u'Simple', - 'show_in_menu': 0, - 'version': 12 - }, - - # These values are common for all DocField - { - 'doctype': u'DocField', - 'name': '__common__', - 'parent': u'Product', - 'parentfield': u'fields', - 'parenttype': u'DocType' - }, - - # These values are common for all DocPerm - { - 'amend': 0, - 'create': 1, - 'doctype': u'DocPerm', - 'name': '__common__', - 'parent': u'Product', - 'parentfield': u'permissions', - 'parenttype': u'DocType', - 'permlevel': 0, - 'read': 1, - 'submit': 0, - 'write': 1 - }, - - # DocType, Product - { - 'doctype': 'DocType', - 'name': u'Product' - }, - - # DocPerm - { - 'cancel': 0, - 'doctype': u'DocPerm', - 'role': u'Sales Manager' - }, - - # DocPerm - { - 'cancel': 0, - 'doctype': u'DocPerm', - 'role': u'Sales User' - }, - - # DocPerm - { - 'cancel': 1, - 'doctype': u'DocPerm', - 'role': u'Website Manager' - }, - - # DocField - { - 'colour': u'White:FFF', - 'doctype': u'DocField', - 'fieldname': u'item', - 'fieldtype': u'Link', - 'label': u'Item', - 'options': u'Item', - 'permlevel': 0, - 'reqd': 1 - }, - - # DocField - { - 'doctype': u'DocField', - 'fieldname': u'title', - 'fieldtype': u'Data', - 'label': u'Title', - 'permlevel': 0 - }, - - # DocField - { - 'doctype': u'DocField', - 'fieldname': u'published', - 'fieldtype': u'Check', - 'label': u'Published', - 'permlevel': 0 - }, - - # DocField - { - 'colour': u'White:FFF', - 'description': u'Select Price List for the web. Leave blank to hide price.', - 'doctype': u'DocField', - 'fieldname': u'price_list', - 'fieldtype': u'Link', - 'label': u'Price List', - 'options': u'Price List', - 'permlevel': 0 - }, - - # DocField - { - 'colour': u'White:FFF', - 'description': u'Select shipping warehouse to show "In Stock" or "Out of Stock". To hide, leave blank', - 'doctype': u'DocField', - 'fieldname': u'warehouse', - 'fieldtype': u'Link', - 'label': u'Warehouse', - 'options': u'Warehouse', - 'permlevel': 0 - }, - - # DocField - { - 'doctype': u'DocField', - 'fieldname': u'column_break0', - 'fieldtype': u'Column Break', - 'permlevel': 0 - }, - - # DocField - { - 'colour': u'White:FFF', - 'description': u'Image for listing (Width: 100px) (Attach First)', - 'doctype': u'DocField', - 'fieldname': u'thumbnail_image', - 'fieldtype': u'Select', - 'label': u'Thumbnail Image', - 'options': u'attach_files:', - 'permlevel': 0 - }, - - # DocField - { - 'colour': u'White:FFF', - 'description': u'Image for listing (Width: 300px) (Attach First)', - 'doctype': u'DocField', - 'fieldname': u'full_image', - 'fieldtype': u'Select', - 'label': u'Full Image', - 'options': u'attach_files:', - 'permlevel': 0 - }, - - # DocField - { - 'colour': u'White:FFF', - 'doctype': u'DocField', - 'fieldname': u'short_description', - 'fieldtype': u'Text', - 'label': u'Short Description', - 'permlevel': 0, - 'reqd': 1 - }, - - # DocField - { - 'doctype': u'DocField', - 'fieldname': u'section_break0', - 'fieldtype': u'Section Break', - 'permlevel': 0 - }, - - # DocField - { - 'colour': u'White:FFF', - 'description': u'Full description (formatted as markdown)', - 'doctype': u'DocField', - 'fieldname': u'long_description', - 'fieldtype': u'Code', - 'label': u'Long Description', - 'permlevel': 0, - 'reqd': 0 - }, - - # DocField - { - 'doctype': u'DocField', - 'fieldname': u'section_break1', - 'fieldtype': u'Section Break', - 'permlevel': 0 - }, - - # DocField - { - 'doctype': u'DocField', - 'fieldname': u'page_name', - 'fieldtype': u'Data', - 'label': u'Page Name', - 'permlevel': 1 - }, - - # DocField - { - 'colour': u'White:FFF', - 'doctype': u'DocField', - 'fieldname': u'price', - 'fieldtype': u'Currency', - 'hidden': 0, - 'label': u'Price', - 'permlevel': 1 - }, - - # DocField - { - 'colour': u'White:FFF', - 'doctype': u'DocField', - 'fieldname': u'sales', - 'fieldtype': u'Currency', - 'label': u'Sales', - 'permlevel': 1 - }, - - # DocField - { - 'doctype': u'DocField', - 'fieldname': u'stock', - 'fieldtype': u'Currency', - 'label': u'Stock', - 'permlevel': 1 - }, - - # DocField - { - 'doctype': u'DocField', - 'fieldname': u'currency', - 'fieldtype': u'Link', - 'label': u'Currency', - 'options': u'Currency', - '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 - } -] \ No newline at end of file diff --git a/erpnext/website/doctype/product/product_page.js b/erpnext/website/doctype/product/product_page.js deleted file mode 100644 index 926ef69f87..0000000000 --- a/erpnext/website/doctype/product/product_page.js +++ /dev/null @@ -1,63 +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.require('erpnext/website/js/product_category.js'); - -pscript["onload_{{ doc.page_name }}"] = function(wrapper) { - wrapper.product_group = "{{ doc.item_group }}"; - wrapper.product_name = "{{ doc.name }}"; - erpnext.make_product_categories(wrapper); - $(wrapper).find('.product-inquiry').click(function() { - loadpage('contact', function() { - $('#content-contact-us [name="contact-message"]').val("Hello,\n\n\ - Please send me more information on {{ doc.title }} (Item Code:{{ doc.item }})\n\n\ - My contact details are:\n\nThank you!\ - "); - }) - }); - - // similar products - wrapper.similar = new wn.ui.Listing({ - parent: $(wrapper).find('.similar-products').get(0), - hide_refresh: true, - page_length: 5, - get_query: function() { - args = { - cat: wrapper.product_group, - name: wrapper.product_name - }; - return repl('select t1.name, t1.title, t1.thumbnail_image, \ - t1.page_name, t1.short_description \ - from tabProduct t1, tabItem t2 \ - where t1.item = t2.name \ - and ifnull(t1.published,0)=1 \ - and t1.name != "%(name)s" \ - and t2.item_group="%(cat)s" order by t1.modified desc', args) - }, - render_row: function(parent, data) { - if(data.short_description.length > 100) { - data.short_description = data.short_description.substr(0,100) + '...'; - } - parent.innerHTML = repl('
\ -
\ -
\ - %(title)s\ -

%(short_description)s

\ -
', data); - } - }); - wrapper.similar.run(); -} \ No newline at end of file diff --git a/erpnext/website/doctype/product/template.html b/erpnext/website/doctype/product/template.html deleted file mode 100644 index 926b650847..0000000000 --- a/erpnext/website/doctype/product/template.html +++ /dev/null @@ -1,32 +0,0 @@ -
-
-

{{ doc.title }}

-
-
- - {{ doc.long_description_html }} - -
-
-
-
-

Item Code: {{ doc.item }}

-

{{ doc.short_description }}

-

-

-
-
-

More Categories

-
-
-

Similar Products

-
-
-
-
-
\ No newline at end of file diff --git a/erpnext/website/doctype/product_group/__init__.py b/erpnext/website/doctype/product_group/__init__.py deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/erpnext/website/doctype/product_group/product_group.txt b/erpnext/website/doctype/product_group/product_group.txt deleted file mode 100644 index e199b86fc6..0000000000 --- a/erpnext/website/doctype/product_group/product_group.txt +++ /dev/null @@ -1,57 +0,0 @@ -# DocType, Product Group -[ - - # 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': 1 - }, - - # These values are common for all DocField - { - 'doctype': u'DocField', - 'name': '__common__', - 'parent': u'Product Group', - 'parentfield': u'fields', - 'parenttype': u'DocType', - 'permlevel': 0 - }, - - # DocType, Product Group - { - 'doctype': 'DocType', - 'name': u'Product Group' - }, - - # DocField - { - 'doctype': u'DocField', - 'fieldname': u'item_group', - 'fieldtype': u'Link', - 'label': u'Item Group', - 'options': u'Item Group' - }, - - # DocField - { - 'doctype': u'DocField', - 'fieldname': u'label', - 'fieldtype': u'Data', - 'label': u'Label' - } -] \ No newline at end of file diff --git a/erpnext/website/doctype/products_settings/__init__.py b/erpnext/website/doctype/products_settings/__init__.py deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/erpnext/website/doctype/products_settings/products_settings.py b/erpnext/website/doctype/products_settings/products_settings.py deleted file mode 100644 index 23c247dfec..0000000000 --- a/erpnext/website/doctype/products_settings/products_settings.py +++ /dev/null @@ -1,34 +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 - -class DocType: - def __init__(self, d, dl): - self.doc, self.doclist = d, dl - - def on_update(self): - tmp = None - for d in self.doclist: - if d.doctype=="Product Group": - import json - tmp = json.dumps({"item_group": d.item_group, "label":d.label}) - break - - webnotes.conn.set_default("default_product_category", tmp) - - from webnotes.session_cache import clear_cache - clear_cache('Guest') \ No newline at end of file diff --git a/erpnext/website/doctype/products_settings/products_settings.txt b/erpnext/website/doctype/products_settings/products_settings.txt deleted file mode 100644 index 31d207475e..0000000000 --- a/erpnext/website/doctype/products_settings/products_settings.txt +++ /dev/null @@ -1,72 +0,0 @@ -# DocType, Products Settings -[ - - # 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 - { - '_last_update': u'1327911653', - 'colour': u'White:FFF', - 'description': u'\n\n', - 'doctype': 'DocType', - 'issingle': 1, - 'module': u'Website', - 'name': '__common__', - 'section_style': u'Simple', - 'show_in_menu': 0, - 'version': 4 - }, - - # These values are common for all DocField - { - 'colour': u'White:FFF', - 'description': u'Product Groups that are listed on the website. The first product group from this list will be listed by default on the "Products Page"', - 'doctype': u'DocField', - 'fieldname': u'groups', - 'fieldtype': u'Table', - 'label': u'Groups', - 'name': '__common__', - 'options': u'Product Group', - 'parent': u'Products Settings', - 'parentfield': u'fields', - 'parenttype': u'DocType', - 'permlevel': 0 - }, - - # These values are common for all DocPerm - { - 'create': 1, - 'doctype': u'DocPerm', - 'name': '__common__', - 'parent': u'Products Settings', - 'parentfield': u'permissions', - 'parenttype': u'DocType', - 'permlevel': 0, - 'read': 1, - 'role': u'Website Manager', - 'write': 1 - }, - - # DocType, Products Settings - { - 'doctype': 'DocType', - 'name': u'Products Settings' - }, - - # DocPerm - { - 'doctype': u'DocPerm' - }, - - # DocField - { - 'doctype': u'DocField' - } -] \ No newline at end of file diff --git a/erpnext/website/doctype/web_page/web_page.py b/erpnext/website/doctype/web_page/web_page.py index ff8a9049ac..7f50d53d1c 100644 --- a/erpnext/website/doctype/web_page/web_page.py +++ b/erpnext/website/doctype/web_page/web_page.py @@ -27,8 +27,13 @@ class DocType: def validate(self): """make page for this product""" - if not self.doc.name: - self.doc.name = website.utils.page_name(self.doc.title) + + # we need the name for the templates + if not self.doc.name: + self.autoname() + + 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.name) @@ -38,9 +43,7 @@ class DocType: self.doc.updated = global_date_format(self.doc.modified) website.utils.markdown(self.doc, ['head_section','main_section', 'side_section']) - - self.add_page_links() - + with open(os.path.join(os.path.dirname(__file__), 'template.html'), 'r') as f: p.content = Template(f.read()).render(doc=self.doc) diff --git a/erpnext/website/doctype/web_page/web_page.txt b/erpnext/website/doctype/web_page/web_page.txt index fb6febdbc7..f5d128005d 100644 --- a/erpnext/website/doctype/web_page/web_page.txt +++ b/erpnext/website/doctype/web_page/web_page.txt @@ -5,7 +5,7 @@ { 'creation': '2012-04-02 16:02:43', 'docstatus': 0, - 'modified': '2012-04-25 16:03:57', + 'modified': '2012-04-28 10:03:45', 'modified_by': u'Administrator', 'owner': u'Administrator' }, @@ -22,7 +22,7 @@ 'name': '__common__', 'section_style': u'Simple', 'show_in_menu': 0, - 'version': 16 + 'version': 17 }, # These values are common for all DocField @@ -31,8 +31,7 @@ 'name': '__common__', 'parent': u'Web Page', 'parentfield': u'fields', - 'parenttype': u'DocType', - 'permlevel': 0 + 'parenttype': u'DocType' }, # These values are common for all DocPerm @@ -71,7 +70,8 @@ 'doctype': u'DocField', 'fieldname': u'sb0', 'fieldtype': u'Section Break', - 'label': u'Title and Style' + 'label': u'Title and Style', + 'permlevel': 0 }, # DocField @@ -82,6 +82,7 @@ 'fieldname': u'title', 'fieldtype': u'Data', 'label': u'Title', + 'permlevel': 0, 'reqd': 1 }, @@ -90,6 +91,7 @@ 'doctype': u'DocField', 'fieldname': u'cb1', 'fieldtype': u'Column Break', + 'permlevel': 0, 'width': u'50%' }, @@ -99,7 +101,8 @@ 'fieldname': u'layout', 'fieldtype': u'Select', 'label': u'Layout', - 'options': u'Two column with header\nTwo column\nSingle column' + 'options': u'Two column with header\nTwo column\nSingle column', + 'permlevel': 0 }, # DocField @@ -109,7 +112,8 @@ 'doctype': u'DocField', 'fieldname': u'sb1', 'fieldtype': u'Section Break', - 'label': u'Content' + 'label': u'Content', + 'permlevel': 0 }, # DocField @@ -119,7 +123,8 @@ 'doctype': u'DocField', 'fieldname': u'head_section', 'fieldtype': u'Text', - 'label': u'Head Section' + 'label': u'Head Section', + 'permlevel': 0 }, # DocField @@ -129,7 +134,8 @@ 'doctype': u'DocField', 'fieldname': u'main_section', 'fieldtype': u'Code', - 'label': u'Main Section' + 'label': u'Main Section', + 'permlevel': 0 }, # DocField @@ -139,7 +145,8 @@ 'doctype': u'DocField', 'fieldname': u'side_section', 'fieldtype': u'Code', - 'label': u'Side Section' + 'label': u'Side Section', + 'permlevel': 0 }, # DocField @@ -149,7 +156,8 @@ 'doctype': u'DocField', 'fieldname': u'sb2', 'fieldtype': u'Section Break', - 'label': u'More' + 'label': u'More', + 'permlevel': 0 }, # DocField @@ -158,7 +166,8 @@ 'fieldname': u'text_align', 'fieldtype': u'Select', 'label': u'Text Align', - 'options': u'Left\nCenter\nRight' + 'options': u'Left\nCenter\nRight', + 'permlevel': 0 }, # DocField @@ -167,7 +176,8 @@ 'doctype': u'DocField', 'fieldname': u'insert_code', 'fieldtype': u'Check', - 'label': u'Insert Code' + 'label': u'Insert Code', + 'permlevel': 0 }, # DocField @@ -175,7 +185,8 @@ 'doctype': u'DocField', 'fieldname': u'javascript', 'fieldtype': u'Code', - 'label': u'Javascript' + 'label': u'Javascript', + 'permlevel': 0 }, # DocField @@ -183,7 +194,8 @@ 'doctype': u'DocField', 'fieldname': u'insert_style', 'fieldtype': u'Check', - 'label': u'Insert Style' + 'label': u'Insert Style', + 'permlevel': 0 }, # DocField @@ -191,7 +203,17 @@ 'doctype': u'DocField', 'fieldname': u'css', 'fieldtype': u'Code', - 'label': u'CSS' + 'label': u'CSS', + 'permlevel': 0 + }, + + # DocField + { + 'doctype': u'DocField', + 'fieldname': u'page_name', + 'fieldtype': u'Data', + 'label': u'Page Name', + 'permlevel': 1 }, # DocField @@ -202,6 +224,7 @@ 'hidden': 1, 'label': u'File List', 'no_copy': 1, + 'permlevel': 0, 'print_hide': 1 } ] \ No newline at end of file diff --git a/erpnext/website/doctype/website_settings/website_settings.txt b/erpnext/website/doctype/website_settings/website_settings.txt index ce2a18e0c2..71093dd180 100644 --- a/erpnext/website/doctype/website_settings/website_settings.txt +++ b/erpnext/website/doctype/website_settings/website_settings.txt @@ -5,7 +5,7 @@ { 'creation': '2012-04-02 16:38:02', 'docstatus': 0, - 'modified': '2012-04-27 16:41:40', + 'modified': '2012-04-30 14:20:56', 'modified_by': u'Administrator', 'owner': u'Administrator' }, @@ -23,7 +23,7 @@ 'name': '__common__', 'section_style': u'Simple', 'show_in_menu': 0, - 'version': 11 + 'version': 1 }, # These values are common for all DocField @@ -109,6 +109,16 @@ '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', diff --git a/erpnext/website/js/product_category.js b/erpnext/website/js/product_category.js index 956d7a65d3..8d3f898883 100644 --- a/erpnext/website/js/product_category.js +++ b/erpnext/website/js/product_category.js @@ -14,25 +14,16 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -// make sidelisting of categories -erpnext.product_item_group = {} - erpnext.make_product_categories = function(wrapper) { wrapper.category_list = new wn.ui.Listing({ parent: $(wrapper).find('.more-categories').get(0), - query: 'select label, count(t2.name) as items, t1.item_group \ - from `tabProduct Group` t1, `tabProduct` t2, tabItem t3\ - where t1.parent="Products Settings" \ - and t2.item = t3.name \ - and t3.item_group = t1.item_group \ - and ifnull(t2.published, 0)=1 \ - group by t1.item_group \ - order by t1.idx', + 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('%(label)s (%(items)s)', + parent.innerHTML = repl('%(item_group)s (%(items)s)', data); - erpnext.product_item_group[data.label] = data.item_group; } }); wrapper.category_list.run(); diff --git a/erpnext/website/page/products/products.html b/erpnext/website/page/products/products.html index 3e460d269b..30eca4a2e1 100644 --- a/erpnext/website/page/products/products.html +++ b/erpnext/website/page/products/products.html @@ -1,11 +1,12 @@ -
-

-
+
+
+

+
-
+

Categories

diff --git a/erpnext/website/page/products/products.js b/erpnext/website/page/products/products.js index 09ccba0ed2..d7abfe4d9a 100644 --- a/erpnext/website/page/products/products.js +++ b/erpnext/website/page/products/products.js @@ -19,11 +19,10 @@ erpnext.products = {} wn.require('erpnext/website/js/product_category.js'); pscript.onload_products = function(wrapper) { - sys_defaults.default_product_category = JSON.parse(sys_defaults.default_product_category); + erpnext.make_product_categories(wrapper); erpnext.products.wrapper = wrapper; // make lists - erpnext.make_product_categories(wrapper); erpnext.products.make_product_list(wrapper); // button @@ -42,15 +41,15 @@ pscript.onshow_products = function(wrapper) { } erpnext.products.get_group = function() { - var route = window.location.hash.split('/'); + route = wn.get_route(); if(route.length>1) { // from url - var grp = erpnext.product_item_group[route[1]]; + var grp = route[1]; var label = route[1]; } else { // default - var grp = sys_defaults.default_product_category.item_group; - var label = sys_defaults.default_product_category.label; + var grp = wn.boot.website_settings.default_product_category; + var label = wn.boot.website_settings.default_product_category; } erpnext.products.cur_group = grp; return {grp:grp, label:label}; @@ -58,32 +57,39 @@ erpnext.products.get_group = function() { erpnext.products.make_product_list = function(wrapper) { wrapper.mainlist = new wn.ui.Listing({ - parent: $(wrapper).find('.web-main-section').get(0), + parent: $(wrapper).find('.products-list').get(0), run_btn: $(wrapper).find('.products-search .btn').get(0), - hide_refresh: true, + no_toolbar: true, get_query: function() { var srch = $('input[name="products-search"]').val() - var search_cond = 'and (t1.short_description like "%%(srch)s%"\ - or t1.title like "%%(srch)s%")'; + var search_cond = 'and (description like "%%(srch)s%"\ + or item_name like "%%(srch)s%")'; args = { search_cond: srch ? repl(search_cond, {srch:srch}) : '', cat: erpnext.products.cur_group }; - return repl('select t1.name, t1.title, t1.thumbnail_image, \ - t1.page_name, t1.short_description \ - from tabProduct t1, tabItem t2 \ - where t1.item = t2.name \ - and ifnull(t1.published,0)=1 \ - and t2.item_group="%(cat)s" \ + return repl('select name, item_name, website_image, \ + description, page_name \ + from tabItem \ + where is_sales_item="Yes" \ + and item_group="%(cat)s" \ %(search_cond)s', args) }, render_row: function(parent, data) { - parent.innerHTML = repl('
\ -
\ + parent.innerHTML = repl('
\ +
\
\ -

%(title)s

\ -

%(short_description)s

\ -

', data); +

%(item_name)s

\ +

%(description)s

\ +
', data); + + if(data.website_image) { + $(parent).find('.img-area').append(repl( + '', data)) + } else { + $(parent).find('.img-area').append(wn.dom.placeholder(70, + data.item_name)); + } } }); } diff --git a/erpnext/website/page/website_home/website_home.html b/erpnext/website/page/website_home/website_home.html index ad8bb55fd9..76dab6a59c 100644 --- a/erpnext/website/page/website_home/website_home.html +++ b/erpnext/website/page/website_home/website_home.html @@ -3,13 +3,11 @@

Website


+

Web Page

Static (content) web page


-

Product

-

Product listed in catolog

-

Blog

Weblog (blog) entry

@@ -19,9 +17,6 @@

Style Settings

Setup of fonts and background

-
-

Products Settings

-

Setup product categories


@@ -31,9 +26,19 @@
-
+

Create website with static pages and blogs

+
    +
  • "Website Settings" - to setup header and footers. +
  • "Web Page" - for static web page. +
  • "Blog" - for blog entry. +
+

Notes:

+
    +
  • All pages are accessible via `#` + page name appended to your url. +
  • Product catalogue is updated from Item Master (set Show in Website = 'Yes', in + Sales Settings). +
-
\ No newline at end of file diff --git a/js/all-app.js b/js/all-app.js index 675bcabb93..2e8c721cec 100644 --- a/js/all-app.js +++ b/js/all-app.js @@ -170,17 +170,30 @@ var l=items.length;for(var i=0;i%(letter)s
',args);}} wn.get_cookie=function(c){var t=""+document.cookie;var ind=t.indexOf(c);if(ind==-1||c=="")return"";var ind1=t.indexOf(';',ind);if(ind1==-1)ind1=t.length;return unescape(t.substring(ind+c.length+1,ind1));} wn.dom.set_box_shadow=function(ele,spread){$(ele).css('-moz-box-shadow','0px 0px '+spread+'px rgba(0,0,0,0.3);') $(ele).css('-webkit-box-shadow','0px 0px '+spread+'px rgba(0,0,0,0.3);') @@ -313,7 +326,7 @@ if(this.args) $.extend(args,this.args) if(this.get_args){$.extend(args,this.get_args(opts));} return args;},render_results:function(r){if(this.start==0)this.clear();this.$w.find('.btn-more').toggle(false);if(r.message)r.values=r.message;if(r.values&&r.values.length){this.data=this.data.concat(r.values);this.render_list(r.values);this.update_paging(r.values);}else{if(this.start==0){this.$w.find('.result').toggle(false);this.$w.find('.no-result').toggle(true);}} -if(this.onrun)this.onrun();if(this.callback)this.callback(r);},render_list:function(values){var m=Math.min(values.length,this.page_length);for(var i=0;i=this.page_length){this.$w.find('.btn-more').toggle(true);this.start+=this.page_length;}},add_row:function(){return this.$w.find('.result-list').append('
').find('.list-row:last').get(0);},refresh:function(){this.run();},add_limits:function(){this.query+=' LIMIT '+this.start+','+(this.page_length+1);}}); +if(this.onrun)this.onrun();if(this.callback)this.callback(r);},render_list:function(values){var m=Math.min(values.length,this.page_length);for(var i=0;i=this.page_length){this.$w.find('.btn-more').toggle(true);this.start+=this.page_length;}},add_row:function(){return $('
').appendTo(this.$w.find('.result-list')).get(0);},refresh:function(){this.run();},add_limits:function(){this.query+=' LIMIT '+this.start+','+(this.page_length+1);}}); /* * lib/js/wn/ui/filters.js */ @@ -1368,7 +1381,7 @@ wn.ui.toolbar.NewDialog=wn.ui.toolbar.SelectorDialog.extend({init:function(){thi /* * lib/js/wn/ui/toolbar/search.js */ -wn.ui.toolbar.Search=wn.ui.toolbar.SelectorDialog.extend({init:function(){this._super({title:"Search",execute:function(val){selector.set_search(val);selector.show();},});this.set_values(profile.can_search.join(',').split(','));makeselector();}}); +wn.ui.toolbar.Search=wn.ui.toolbar.SelectorDialog.extend({init:function(){this._super({title:"Search",execute:function(val){selector.set_search(val);selector.show();},});this.set_values(wn.boot.profile.can_search.join(',').split(','));makeselector();}}); /* * lib/js/wn/ui/toolbar/report.js */ @@ -1904,22 +1917,20 @@ _f.Grid.prototype.refresh_cell=function(docname,fieldname){for(var r=0;r=37&&keycode<=40&&e.shiftKey){if(text_dialog&&text_dialog.display){return;}}else @@ -2201,7 +2212,7 @@ me.dialog.clear();me.dialog.show();}}); wn.Application=Class.extend({init:function(){this.load_bootinfo();this.make_page_container();this.make_nav_bar();this.set_favicon();$(document).trigger('startup');wn.route();},load_bootinfo:function(){LocalDB.sync(wn.boot.docs);wn.control_panel=wn.boot.control_panel;if(wn.boot.error_messages) console.log(wn.boot.error_messages) if(wn.boot.server_messages) -msgprint(wn.boot.server_messages);this.set_globals();},set_globals:function(){profile=wn.boot.profile;user=wn.boot.profile.name;user_fullname=wn.user_info(user).fullname;user_defaults=profile.defaults;user_roles=profile.roles;user_email=profile.email;sys_defaults=wn.boot.sysdefaults;},make_page_container:function(){wn.container=new wn.views.Container();wn.views.make_403();wn.views.make_404();$('#startup_div').toggle(false);$('#body_div').toggle(true);},make_nav_bar:function(){if(wn.user.name!='Guest'){wn.container.wntoolbar=new wn.ui.toolbar.Toolbar();}},logout:function(){var me=this;wn.call({method:'logout',callback:function(r){if(r.exc){console.log(r.exc);return;} +msgprint(wn.boot.server_messages);this.set_globals();},set_globals:function(){profile=wn.boot.profile;user=wn.boot.profile.name;user_fullname=wn.user_info(user).fullname;user_defaults=profile.defaults;user_roles=profile.roles;user_email=profile.email;sys_defaults=wn.boot.sysdefaults;},make_page_container:function(){wn.container=new wn.views.Container();wn.views.make_403();wn.views.make_404();},make_nav_bar:function(){if(wn.user.name!='Guest'){wn.container.wntoolbar=new wn.ui.toolbar.Toolbar();}},logout:function(){var me=this;wn.call({method:'logout',callback:function(r){if(r.exc){console.log(r.exc);return;} me.redirect_to_login();}})},redirect_to_login:function(){window.location.hash='';window.location.reload();},set_favicon:function(){var link=$('link[type="image/x-icon"]').remove().attr("href");var favicon='\ \ ' diff --git a/js/all-web.js b/js/all-web.js index 41512cd43d..42811f7e91 100644 --- a/js/all-web.js +++ b/js/all-web.js @@ -57,17 +57,30 @@ var l=items.length;for(var i=0;i%(letter)s
',args);}} wn.get_cookie=function(c){var t=""+document.cookie;var ind=t.indexOf(c);if(ind==-1||c=="")return"";var ind1=t.indexOf(';',ind);if(ind1==-1)ind1=t.length;return unescape(t.substring(ind+c.length+1,ind1));} wn.dom.set_box_shadow=function(ele,spread){$(ele).css('-moz-box-shadow','0px 0px '+spread+'px rgba(0,0,0,0.3);') $(ele).css('-webkit-box-shadow','0px 0px '+spread+'px rgba(0,0,0,0.3);') @@ -200,7 +213,7 @@ if(this.args) $.extend(args,this.args) if(this.get_args){$.extend(args,this.get_args(opts));} return args;},render_results:function(r){if(this.start==0)this.clear();this.$w.find('.btn-more').toggle(false);if(r.message)r.values=r.message;if(r.values&&r.values.length){this.data=this.data.concat(r.values);this.render_list(r.values);this.update_paging(r.values);}else{if(this.start==0){this.$w.find('.result').toggle(false);this.$w.find('.no-result').toggle(true);}} -if(this.onrun)this.onrun();if(this.callback)this.callback(r);},render_list:function(values){var m=Math.min(values.length,this.page_length);for(var i=0;i=this.page_length){this.$w.find('.btn-more').toggle(true);this.start+=this.page_length;}},add_row:function(){return this.$w.find('.result-list').append('
').find('.list-row:last').get(0);},refresh:function(){this.run();},add_limits:function(){this.query+=' LIMIT '+this.start+','+(this.page_length+1);}}); +if(this.onrun)this.onrun();if(this.callback)this.callback(r);},render_list:function(values){var m=Math.min(values.length,this.page_length);for(var i=0;i=this.page_length){this.$w.find('.btn-more').toggle(true);this.start+=this.page_length;}},add_row:function(){return $('
').appendTo(this.$w.find('.result-list')).get(0);},refresh:function(){this.run();},add_limits:function(){this.query+=' LIMIT '+this.start+','+(this.page_length+1);}}); /* * lib/js/wn/ui/filters.js */ @@ -808,7 +821,7 @@ if(errfld.length)msgprint('Mandatory fields required in '+ wn.Application=Class.extend({init:function(){this.load_bootinfo();this.make_page_container();this.make_nav_bar();this.set_favicon();$(document).trigger('startup');wn.route();},load_bootinfo:function(){LocalDB.sync(wn.boot.docs);wn.control_panel=wn.boot.control_panel;if(wn.boot.error_messages) console.log(wn.boot.error_messages) if(wn.boot.server_messages) -msgprint(wn.boot.server_messages);this.set_globals();},set_globals:function(){profile=wn.boot.profile;user=wn.boot.profile.name;user_fullname=wn.user_info(user).fullname;user_defaults=profile.defaults;user_roles=profile.roles;user_email=profile.email;sys_defaults=wn.boot.sysdefaults;},make_page_container:function(){wn.container=new wn.views.Container();wn.views.make_403();wn.views.make_404();$('#startup_div').toggle(false);$('#body_div').toggle(true);},make_nav_bar:function(){if(wn.user.name!='Guest'){wn.container.wntoolbar=new wn.ui.toolbar.Toolbar();}},logout:function(){var me=this;wn.call({method:'logout',callback:function(r){if(r.exc){console.log(r.exc);return;} +msgprint(wn.boot.server_messages);this.set_globals();},set_globals:function(){profile=wn.boot.profile;user=wn.boot.profile.name;user_fullname=wn.user_info(user).fullname;user_defaults=profile.defaults;user_roles=profile.roles;user_email=profile.email;sys_defaults=wn.boot.sysdefaults;},make_page_container:function(){wn.container=new wn.views.Container();wn.views.make_403();wn.views.make_404();},make_nav_bar:function(){if(wn.user.name!='Guest'){wn.container.wntoolbar=new wn.ui.toolbar.Toolbar();}},logout:function(){var me=this;wn.call({method:'logout',callback:function(r){if(r.exc){console.log(r.exc);return;} me.redirect_to_login();}})},redirect_to_login:function(){window.location.hash='';window.location.reload();},set_favicon:function(){var link=$('link[type="image/x-icon"]').remove().attr("href");var favicon='\ \ '