[website] [minor] moving to framework
diff --git a/config.json b/config.json
index 19f787e..76ab832 100644
--- a/config.json
+++ b/config.json
@@ -102,7 +102,7 @@
 			"order": {
 				"no_cache": true,
 				"template": "app/website/templates/pages/sale",
-				"args_method": "website.helpers.transaction.get_order_args",
+				"args_method": "utilities.website_transactions.get_order_args",
 				"portal": {
 					"doctype": "Sales Order",
 					"conditions": {
@@ -113,12 +113,12 @@
 			"orders": {
 				"no_cache": true,
 				"template": "app/website/templates/pages/sales_transactions",
-				"args_method": "website.helpers.transaction.order_list_args"
+				"args_method": "utilities.website_transactions.order_list_args"
 			},
 			"invoice": {
 				"no_cache": true,
 				"template": "app/website/templates/pages/sale",
-				"args_method": "website.helpers.transaction.get_invoice_args",
+				"args_method": "utilities.website_transactions.get_invoice_args",
 				"portal": {
 					"doctype": "Sales Invoice",
 					"conditions": {
@@ -129,12 +129,12 @@
 			"invoices": {
 				"no_cache": true,
 				"template": "app/website/templates/pages/sales_transactions",
-				"args_method": "website.helpers.transaction.invoice_list_args"
+				"args_method": "utilities.website_transactions.invoice_list_args"
 			},
 			"shipment": {
 				"no_cache": true,
 				"template": "app/website/templates/pages/sale",
-				"args_method": "website.helpers.transaction.get_shipment_args",
+				"args_method": "utilities.website_transactions.get_shipment_args",
 				"portal": {
 					"doctype": "Delivery Note",
 					"conditions": {
@@ -145,7 +145,7 @@
 			"shipments": {
 				"no_cache": true,
 				"template": "app/website/templates/pages/sales_transactions",
-				"args_method": "website.helpers.transaction.shipment_list_args"
+				"args_method": "utilities.website_transactions.shipment_list_args"
 			},
 			"product_search": {
 				"template": "app/website/templates/pages/product_search"
@@ -160,7 +160,7 @@
 			},
 			"tickets": {
 				"template": "app/website/templates/pages/tickets",
-				"args_method": "website.helpers.transaction.ticket_list_args"
+				"args_method": "utilities.website_transactions.ticket_list_args"
 			},
 			"address": {
 				"no_cache": true,
diff --git a/patches/patch_list.py b/patches/patch_list.py
index 3c13e0e..68bb005 100644
--- a/patches/patch_list.py
+++ b/patches/patch_list.py
@@ -263,4 +263,5 @@
 	"patches.september_2013.p01_update_communication",
 	"execute:webnotes.reload_doc('setup', 'doctype', 'features_setup') # 2013-09-05",
 	"patches.september_2013.p02_fix_serial_no_status",
+	"patches.september_2013.p03_move_website_to_framework"
 ]
\ No newline at end of file
diff --git a/patches/september_2013/p03_move_website_to_framework.py b/patches/september_2013/p03_move_website_to_framework.py
new file mode 100644
index 0000000..69bd505
--- /dev/null
+++ b/patches/september_2013/p03_move_website_to_framework.py
@@ -0,0 +1,17 @@
+# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd.
+# License: GNU General Public License v3. See license.txt
+
+from __future__ import unicode_literals
+import webnotes
+from webnotes.utils import get_base_path
+import os
+
+def execute():
+	# remove pyc files
+	utils_pyc = os.path.join(get_base_path(), "app", "selling", "utils.pyc")
+	if os.path.exists(utils_pyc):
+		print exists
+		os.remove(utils_pyc)
+	
+	# TODO remove website folder
+	
\ No newline at end of file
diff --git a/public/js/website_utils.js b/public/js/website_utils.js
index 9b78326..b5fea13 100644
--- a/public/js/website_utils.js
+++ b/public/js/website_utils.js
@@ -9,7 +9,7 @@
 erpnext.send_message = function(opts) {
 	return wn.call({
 		type: "POST",
-		method: "website.helpers.contact.send_message",
+		method: "selling.utils.contact.send_message",
 		args: opts,
 		callback: opts.callback
 	});
@@ -206,7 +206,7 @@
 		} else {
 			return wn.call({
 				type: "POST",
-				method: "website.helpers.cart.update_cart",
+				method: "selling.utils.cart.update_cart",
 				args: {
 					item_code: opts.item_code,
 					qty: opts.qty,
diff --git a/selling/utils.py b/selling/utils/__init__.py
similarity index 100%
rename from selling/utils.py
rename to selling/utils/__init__.py
diff --git a/website/helpers/cart.py b/selling/utils/cart.py
similarity index 100%
rename from website/helpers/cart.py
rename to selling/utils/cart.py
diff --git a/website/helpers/contact.py b/selling/utils/contact.py
similarity index 100%
rename from website/helpers/contact.py
rename to selling/utils/contact.py
diff --git a/website/helpers/product.py b/selling/utils/product.py
similarity index 98%
rename from website/helpers/product.py
rename to selling/utils/product.py
index 031339a..fb0605e 100644
--- a/website/helpers/product.py
+++ b/selling/utils/product.py
@@ -6,7 +6,7 @@
 import webnotes
 from webnotes.utils import cstr, cint, fmt_money
 from webnotes.webutils import build_html, delete_page_cache
-from website.helpers.cart import _get_cart_quotation
+from selling.utils.cart import _get_cart_quotation
 
 @webnotes.whitelist(allow_guest=True)
 def get_product_info(item_code):
diff --git a/setup/doctype/item_group/item_group.py b/setup/doctype/item_group/item_group.py
index e2eb5e9..ccc6c29 100644
--- a/setup/doctype/item_group/item_group.py
+++ b/setup/doctype/item_group/item_group.py
@@ -18,7 +18,7 @@
 		
 		self.validate_name_with_item()
 		
-		from website.helpers.product import invalidate_cache_for
+		from selling.utils.product import invalidate_cache_for
 		
 		if self.doc.show_in_website:
 			from webnotes.webutils import update_page_name
@@ -45,7 +45,7 @@
 				item group name or rename the item" % self.doc.name, raise_exception=1)
 	
 	def prepare_template_args(self):
-		from website.helpers.product import get_product_list_for_group, \
+		from selling.utils.product import get_product_list_for_group, \
 			get_parent_item_groups, get_group_item_count
 
 		self.doc.sub_groups = webnotes.conn.sql("""select name, page_name
diff --git a/website/templates/html/partner_page.html b/setup/doctype/sales_partner/templates/partner_page.html
similarity index 100%
rename from website/templates/html/partner_page.html
rename to setup/doctype/sales_partner/templates/partner_page.html
diff --git a/website/templates/pages/partners.html b/setup/doctype/sales_partner/templates/partners.html
similarity index 100%
rename from website/templates/pages/partners.html
rename to setup/doctype/sales_partner/templates/partners.html
diff --git a/startup/event_handlers.py b/startup/event_handlers.py
index 84a91a4..57345f3 100644
--- a/startup/event_handlers.py
+++ b/startup/event_handlers.py
@@ -31,7 +31,7 @@
 		webnotes.conn.commit()
 		
 	if webnotes.conn.get_value("Profile", webnotes.session.user, "user_type") == "Website User":
-		from website.helpers.cart import set_cart_count
+		from selling.utils.cart import set_cart_count
 		set_cart_count()
 		
 def on_logout(login_manager):
diff --git a/startup/webutils.py b/startup/webutils.py
index eab4948..b9b6182 100644
--- a/startup/webutils.py
+++ b/startup/webutils.py
@@ -71,14 +71,14 @@
 	
 @webnotes.whitelist()
 def update_profile(fullname, password=None, company_name=None, mobile_no=None, phone=None):
-	from website.helpers.cart import update_party
+	from selling.utils.cart import update_party
 	update_party(fullname, company_name, mobile_no, phone)
 	
 	from core.doctype.profile import profile
 	return profile.update_profile(fullname, password)
 	
 def get_profile_args():
-	from website.helpers.cart import get_lead_or_customer
+	from selling.utils.cart import get_lead_or_customer
 	party = get_lead_or_customer()
 	if party.doctype == "Lead":
 		mobile_no = party.mobile_no
diff --git a/stock/doctype/item/item.py b/stock/doctype/item/item.py
index dab7dea..f6f8d51 100644
--- a/stock/doctype/item/item.py
+++ b/stock/doctype/item/item.py
@@ -228,7 +228,7 @@
 
 	def update_website(self):
 		def _invalidate_cache():
-			from website.helpers.product import invalidate_cache_for
+			from selling.utils.product import invalidate_cache_for
 			
 			invalidate_cache_for(self.doc.item_group)
 
@@ -259,7 +259,7 @@
 		return { "tax_rate": webnotes.conn.get_value("Account", tax_type, "tax_rate") }
 
 	def prepare_template_args(self):
-		from website.helpers.product import get_parent_item_groups
+		from selling.utils.product import get_parent_item_groups
 		self.parent_groups = get_parent_item_groups(self.doc.item_group) + [{"name":self.doc.name}]
 		self.doc.title = self.doc.item_name
 
diff --git a/website/templates/html/product_breadcrumbs.html b/stock/doctype/item/templates/includes/product_breadcrumbs.html
similarity index 100%
rename from website/templates/html/product_breadcrumbs.html
rename to stock/doctype/item/templates/includes/product_breadcrumbs.html
diff --git a/website/templates/html/product_in_grid.html b/stock/doctype/item/templates/includes/product_in_grid.html
similarity index 100%
rename from website/templates/html/product_in_grid.html
rename to stock/doctype/item/templates/includes/product_in_grid.html
diff --git a/website/templates/html/product_in_list.html b/stock/doctype/item/templates/includes/product_in_list.html
similarity index 100%
rename from website/templates/html/product_in_list.html
rename to stock/doctype/item/templates/includes/product_in_list.html
diff --git a/website/templates/html/product_missing_image.html b/stock/doctype/item/templates/includes/product_missing_image.html
similarity index 100%
rename from website/templates/html/product_missing_image.html
rename to stock/doctype/item/templates/includes/product_missing_image.html
diff --git a/website/templates/html/product_search_box.html b/stock/doctype/item/templates/includes/product_search_box.html
similarity index 100%
rename from website/templates/html/product_search_box.html
rename to stock/doctype/item/templates/includes/product_search_box.html
diff --git a/website/templates/html/product_group.html b/stock/doctype/item/templates/product_group.html
similarity index 100%
rename from website/templates/html/product_group.html
rename to stock/doctype/item/templates/product_group.html
diff --git a/website/templates/html/product_page.html b/stock/doctype/item/templates/product_page.html
similarity index 100%
rename from website/templates/html/product_page.html
rename to stock/doctype/item/templates/product_page.html
diff --git a/website/templates/pages/product_search.html b/stock/doctype/item/templates/product_search.html
similarity index 100%
rename from website/templates/pages/product_search.html
rename to stock/doctype/item/templates/product_search.html
diff --git a/website/templates/pages/ticket.html b/support/doctype/support_ticket/templates/ticket.html
similarity index 100%
rename from website/templates/pages/ticket.html
rename to support/doctype/support_ticket/templates/ticket.html
diff --git a/website/templates/pages/tickets.html b/support/doctype/support_ticket/templates/tickets.html
similarity index 100%
rename from website/templates/pages/tickets.html
rename to support/doctype/support_ticket/templates/tickets.html
diff --git a/utilities/demo/demo_control_panel.py b/utilities/demo/demo_control_panel.py
index c70913e..a1113ae 100644
--- a/utilities/demo/demo_control_panel.py
+++ b/utilities/demo/demo_control_panel.py
@@ -6,7 +6,7 @@
       if webnotes.form_dict.lead_email and validate_email_add(webnotes.form_dict.lead_email):
         import requests
         response = requests.post(conf.demo_notify_url, data={
-          "cmd":"website.helpers.contact.send_message",
+          "cmd":"selling.utils.contact.send_message",
           "subject":"Logged into Demo",
           "sender": webnotes.form_dict.lead_email,
           "message": "via demo.erpnext.com"
diff --git a/website/helpers/transaction.py b/utilities/website_transactions.py
similarity index 92%
rename from website/helpers/transaction.py
rename to utilities/website_transactions.py
index 8943575..f871096 100644
--- a/website/helpers/transaction.py
+++ b/utilities/website_transactions.py
@@ -40,7 +40,7 @@
 	args = get_common_args()
 	args.update({
 		"title": "My Orders",
-		"method": "website.helpers.transaction.get_orders",
+		"method": "utilities.website_transactions.get_orders",
 		"icon": "icon-list",
 		"empty_list_message": "No Orders Yet",
 		"page": "order",
@@ -55,7 +55,7 @@
 	args = get_common_args()
 	args.update({
 		"title": "Invoices",
-		"method": "website.helpers.transaction.get_invoices",
+		"method": "utilities.website_transactions.get_invoices",
 		"icon": "icon-file-text",
 		"empty_list_message": "No Invoices Found",
 		"page": "invoice"
@@ -70,7 +70,7 @@
 	args = get_common_args()
 	args.update({
 		"title": "Shipments",
-		"method": "website.helpers.transaction.get_shipments",
+		"method": "utilities.website_transactions.get_shipments",
 		"icon": "icon-truck",
 		"empty_list_message": "No Shipments Found",
 		"page": "shipment"
@@ -91,7 +91,7 @@
 def ticket_list_args():
 	return {
 		"title": "My Tickets",
-		"method": "website.helpers.transaction.get_tickets",
+		"method": "utilities.website_transactions.get_tickets",
 		"icon": "icon-ticket",
 		"empty_list_message": "No Tickets Raised",
 		"page": "ticket"
diff --git a/website/templates/pages/blog.html b/website/doctype/blog_post/templates/blog.html
similarity index 100%
rename from website/templates/pages/blog.html
rename to website/doctype/blog_post/templates/blog.html
diff --git a/website/templates/html/blog_page.html b/website/doctype/blog_post/templates/blog_post.html
similarity index 100%
rename from website/templates/html/blog_page.html
rename to website/doctype/blog_post/templates/blog_post.html
diff --git a/website/templates/html/blog_footer.html b/website/doctype/blog_post/templates/includes/blog_footer.html
similarity index 100%
rename from website/templates/html/blog_footer.html
rename to website/doctype/blog_post/templates/includes/blog_footer.html
diff --git a/website/templates/html/blog_subscribe.html b/website/doctype/blog_post/templates/includes/blog_subscribe.html
similarity index 100%
rename from website/templates/html/blog_subscribe.html
rename to website/doctype/blog_post/templates/includes/blog_subscribe.html
diff --git a/website/templates/html/blogger.html b/website/doctype/blog_post/templates/includes/blogger.html
similarity index 100%
rename from website/templates/html/blogger.html
rename to website/doctype/blog_post/templates/includes/blogger.html
diff --git a/website/templates/html/comment.html b/website/doctype/blog_post/templates/includes/comment.html
similarity index 100%
rename from website/templates/html/comment.html
rename to website/doctype/blog_post/templates/includes/comment.html
diff --git a/website/templates/pages/writers.html b/website/doctype/blogger/templates/writers.html
similarity index 100%
rename from website/templates/pages/writers.html
rename to website/doctype/blogger/templates/writers.html
diff --git a/website/templates/js/blog_page.js b/website/templates/js/blog_page.js
index 665dbf4..3d45925 100644
--- a/website/templates/js/blog_page.js
+++ b/website/templates/js/blog_page.js
@@ -14,6 +14,7 @@
 			.parent().append("<div class='alert alert-warning'>Comments are closed.</div>")
 	}
 	$(".add-comment").click(function() {
+		$(this).toggle(false);
 		$("#comment-form").toggle();
 		$("#comment-form input, #comment-form, textarea").val("");
 	})
diff --git a/website/templates/js/cart.js b/website/templates/js/cart.js
index 20090ca..63c6463 100644
--- a/website/templates/js/cart.js
+++ b/website/templates/js/cart.js
@@ -7,7 +7,7 @@
 	wn.cart.bind_events();
 	return wn.call({
 		type: "POST",
-		method: "website.helpers.cart.get_cart_quotation",
+		method: "selling.utils.cart.get_cart_quotation",
 		callback: function(r) {
 			console.log(r);
 			$("#cart-container").removeClass("hide");
@@ -194,7 +194,7 @@
 		return wn.call({
 			btn: btn,
 			type: "POST",
-			method: "website.helpers.cart.apply_shipping_rule",
+			method: "selling.utils.cart.apply_shipping_rule",
 			args: { shipping_rule: rule },
 			callback: function(r) {
 				if(!r.exc) {
@@ -242,7 +242,7 @@
 				
 				return wn.call({
 					type: "POST",
-					method: "website.helpers.cart.update_cart_address",
+					method: "selling.utils.cart.update_cart_address",
 					args: {
 						address_fieldname: $address_wrapper.attr("data-fieldname"),
 						address_name: $(this).attr("data-address-name")
@@ -273,7 +273,7 @@
 	place_order: function() {
 		return wn.call({
 			type: "POST",
-			method: "website.helpers.cart.place_order",
+			method: "selling.utils.cart.place_order",
 			callback: function(r) {
 				if(r.exc) {
 					var msg = "";
diff --git a/website/templates/js/product_list.js b/website/templates/js/product_list.js
index 729499c..2856bde 100644
--- a/website/templates/js/product_list.js
+++ b/website/templates/js/product_list.js
@@ -15,7 +15,7 @@
 		url: "server.py",
 		dataType: "json",
 		data: {
-			cmd: "website.helpers.product.get_product_list",
+			cmd: "selling.utils.product.get_product_list",
 			start: window.start,
 			search: window.search,
 			product_group: window.product_group
diff --git a/website/templates/js/product_page.js b/website/templates/js/product_page.js
index b8c65ec..b2a122e 100644
--- a/website/templates/js/product_page.js
+++ b/website/templates/js/product_page.js
@@ -7,7 +7,7 @@
 	
 	wn.call({
 		type: "POST",
-		method: "website.helpers.product.get_product_info",
+		method: "selling.utils.product.get_product_info",
 		args: {
 			item_code: "{{ name }}"
 		},
diff --git a/website/templates/pages/address.html b/website/templates/pages/address.html
index 6544b12..6d4273c 100644
--- a/website/templates/pages/address.html
+++ b/website/templates/pages/address.html
@@ -89,7 +89,7 @@
 			wn.call({
 				btn: $(this),
 				type: "POST",
-				method: "website.helpers.cart.save_address",
+				method: "selling.utils.cart.save_address",
 				args: { fields: fields, address_fieldname: get_url_arg("address_fieldname") },
 				callback: function(r) {
 					if(r.exc) {
diff --git a/website/templates/pages/addresses.html b/website/templates/pages/addresses.html
index 04fc47b..b19780a 100644
--- a/website/templates/pages/addresses.html
+++ b/website/templates/pages/addresses.html
@@ -26,7 +26,7 @@
 	
 	var fetch_addresses = function() {
 		wn.call({
-			method: "website.helpers.cart.get_addresses",
+			method: "selling.utils.cart.get_addresses",
 			callback: function(r) {
 				$("#address-list .progress").remove();
 				var $list = $("#address-list");
diff --git a/website/templates/pages/messages.html b/website/templates/pages/messages.html
deleted file mode 100644
index e1ea8d0..0000000
--- a/website/templates/pages/messages.html
+++ /dev/null
@@ -1,31 +0,0 @@
-{% extends "app/website/templates/html/transactions.html" %}
-
-{% block javascript -%}
-{{ super() }}
-
-var render = function(doc) {
-	doc.sender = doc.sender ? doc.sender : "To ";
-	doc.recipients = doc.recipients ? (" to " + doc.recipients) : "";
-	doc.content = remove_script_and_style(doc.content);
-	
-	if(!is_html(doc.content)) {
-		doc.content = doc.content.replace("\n", "<br>");
-	}
-		
-	$(repl('<a class="list-group-item">\
-			<div class="row col-md-12">%(subject)s</div>\
-			<div class="row text-muted">\
-				<div class="col-md-6">%(sender)s%(recipients)s</div>\
-				<div class="col-md-6 text-right">%(creation)s</div>\
-			</div>\
-			<div class="row col-md-12 msg-content" style="display: none;"><hr>%(content)s</div>\
-		</a>', doc))
-		.appendTo($list)
-		.on("click", function() {
-			$(this).find(".msg-content").toggle();
-		});
-	
-	
-}
-
-{%- endblock %}
\ No newline at end of file