Merge branch 'shf_rename' of github.com:webnotes/erpnext into shf_rename
diff --git a/css/all-app.css b/css/all-app.css
index ff022b7..21cf8fb 100644
--- a/css/all-app.css
+++ b/css/all-app.css
@@ -1923,9 +1923,9 @@
 }
 
 .layout_wrapper, .layout-wrapper {
-	-moz-box-shadow: 0px 0px 6px rgba(0,0,0,0.3);
-	-webkit-box-shadow: 0px 0px 6px rgba(0,0,0,0.3);
-	box-shadow: 0px 0px 6px rgba(0,0,0,0.3);
+	-moz-box-shadow: 0px 0px 9px rgba(0,0,0,0.5);
+	-webkit-box-shadow: 0px 0px 9px rgba(0,0,0,0.5);
+	box-shadow: 0px 0px 9px rgba(0,0,0,0.5);
 	background-color: #fff;
 	padding: 15px;
 	-webkit-border-radius: 5px;
@@ -1945,7 +1945,8 @@
 }
 
 .layout-main {
-	padding: 15px;	
+	padding: 15px;
+	background-color: #fff;
 }
 
 .layout-main-section {
diff --git a/css/all-web.css b/css/all-web.css
index 146d478..8ac14cb 100644
--- a/css/all-web.css
+++ b/css/all-web.css
@@ -1403,9 +1403,9 @@
 }
 
 .layout_wrapper, .layout-wrapper {
-	-moz-box-shadow: 0px 0px 6px rgba(0,0,0,0.3);
-	-webkit-box-shadow: 0px 0px 6px rgba(0,0,0,0.3);
-	box-shadow: 0px 0px 6px rgba(0,0,0,0.3);
+	-moz-box-shadow: 0px 0px 9px rgba(0,0,0,0.5);
+	-webkit-box-shadow: 0px 0px 9px rgba(0,0,0,0.5);
+	box-shadow: 0px 0px 9px rgba(0,0,0,0.5);
 	background-color: #fff;
 	padding: 15px;
 	-webkit-border-radius: 5px;
@@ -1425,7 +1425,8 @@
 }
 
 .layout-main {
-	padding: 15px;	
+	padding: 15px;
+	background-color: #fff;
 }
 
 .layout-main-section {
@@ -1946,8 +1947,8 @@
 	width: 900px;
 }
 
-.layout_wrapper {
-	padding: 27px;
+div#body_div {
+	margin-top: 90px;
 }
 
 p, li {
@@ -1965,10 +1966,6 @@
 	margin-bottom: 9px;
 }
 
-.web-content input[type="text"], .web-content input[type="password"], .web-content select {
-	min-width: 180px;
-}
-
 .web-head-section {
 	margin-bottom: 20px
 }
@@ -1991,6 +1988,7 @@
 
 .web-page-status {
 	padding: 7px;
+	margin-top: -20px;
 	color: #777;
 	clear: both;
 	text-align: right;
@@ -2021,20 +2019,12 @@
 }
 
 .web-footer div, .web-footer a {
-	font-size: 11px;
+	font-size: 14px;
 }
 
 .web-footer-menu {
 	margin-bottom: 7px;
 }
-footer a, footer a:visited {
-	color: #777;
-}
-
-footer a:hover {
-	background-color: #777;
-	color: #fff;
-}
 
 .web-footer-menu ul {
 	list-style: none;
@@ -2080,9 +2070,8 @@
 }
 
 .two-column {
-	width: 40%;
+	width: 50%;
 	float: left;
-	padding: 5%;
 }
 
 .clear {
diff --git a/erpnext/website/css/website.css b/erpnext/website/css/website.css
index 1fd0bb0..ad8702a 100644
--- a/erpnext/website/css/website.css
+++ b/erpnext/website/css/website.css
@@ -2,8 +2,8 @@
 	width: 900px;
 }
 
-.layout_wrapper {
-	padding: 27px;
+div#body_div {
+	margin-top: 90px;
 }
 
 p, li {
@@ -21,10 +21,6 @@
 	margin-bottom: 9px;
 }
 
-.web-content input[type="text"], .web-content input[type="password"], .web-content select {
-	min-width: 180px;
-}
-
 .web-head-section {
 	margin-bottom: 20px
 }
@@ -47,6 +43,7 @@
 
 .web-page-status {
 	padding: 7px;
+	margin-top: -20px;
 	color: #777;
 	clear: both;
 	text-align: right;
@@ -77,20 +74,12 @@
 }
 
 .web-footer div, .web-footer a {
-	font-size: 11px;
+	font-size: 14px;
 }
 
 .web-footer-menu {
 	margin-bottom: 7px;
 }
-footer a, footer a:visited {
-	color: #777;
-}
-
-footer a:hover {
-	background-color: #777;
-	color: #fff;
-}
 
 .web-footer-menu ul {
 	list-style: none;
@@ -136,9 +125,8 @@
 }
 
 .two-column {
-	width: 40%;
+	width: 50%;
 	float: left;
-	padding: 5%;
 }
 
 .clear {
diff --git a/erpnext/website/doctype/style_settings/custom_template.css b/erpnext/website/doctype/style_settings/custom_template.css
index 72c15a1..8c987f8 100644
--- a/erpnext/website/doctype/style_settings/custom_template.css
+++ b/erpnext/website/doctype/style_settings/custom_template.css
@@ -3,6 +3,7 @@
 	background: url("files/{{ doc.background_image }}") repeat;
 {% elif doc.background_color %}
 	background-color: #{{ doc.background_color }};
+	background-image: none;
 {% endif %}	
 {% if doc.font %}
 	font-family: '{{ doc.font }}', Verdana, Sans !important;
diff --git a/erpnext/website/doctype/style_settings/style_settings.py b/erpnext/website/doctype/style_settings/style_settings.py
index 282cd93..db26a15 100644
--- a/erpnext/website/doctype/style_settings/style_settings.py
+++ b/erpnext/website/doctype/style_settings/style_settings.py
@@ -28,6 +28,8 @@
 		self.doc.small_font_size = str(int(self.doc.font_size[:-2])-2) + 'px'
 		
 		self.doc.custom_css = temp.render(doc = self.doc)
+		if self.doc.add_css:
+			self.doc.custom_css += '\n\n/* User CSS */\n\n' + self.doc.add_css
 		
 		from webnotes.session_cache import clear_cache
 		clear_cache('Guest')
diff --git a/erpnext/website/doctype/style_settings/style_settings.txt b/erpnext/website/doctype/style_settings/style_settings.txt
index b87a02c..dd962d5 100644
--- a/erpnext/website/doctype/style_settings/style_settings.txt
+++ b/erpnext/website/doctype/style_settings/style_settings.txt
@@ -5,7 +5,7 @@
 	{
 		'creation': '2012-04-02 16:02:43',
 		'docstatus': 0,
-		'modified': '2012-04-16 13:36:48',
+		'modified': '2012-04-25 10:00:35',
 		'modified_by': u'Administrator',
 		'owner': u'Administrator'
 	},
@@ -23,7 +23,7 @@
 		'name': '__common__',
 		'section_style': u'Simple',
 		'show_in_menu': 0,
-		'version': 19
+		'version': 23
 	},
 
 	# These values are common for all DocField
@@ -91,6 +91,27 @@
 
 	# DocField
 	{
+		'colour': u'White:FFF',
+		'description': u'Select a white footer foreground color if you have a dark background',
+		'doctype': u'DocField',
+		'fieldname': u'footer_font_color',
+		'fieldtype': u'Select',
+		'label': u'Footer Font Color',
+		'options': u'\nwhite',
+		'permlevel': 0
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldtype': u'Column Break',
+		'label': u'Fonts',
+		'permlevel': 0,
+		'width': u'50%'
+	},
+
+	# DocField
+	{
 		'doctype': u'DocField',
 		'fieldname': u'font',
 		'fieldtype': u'Select',
@@ -121,13 +142,20 @@
 
 	# DocField
 	{
-		'colour': u'White:FFF',
-		'description': u'Select a white footer foreground color if you have a dark background',
 		'doctype': u'DocField',
-		'fieldname': u'footer_font_color',
-		'fieldtype': u'Select',
-		'label': u'Footer Font Color',
-		'options': u'\nwhite',
+		'fieldtype': u'Section Break',
+		'label': u'CSS',
+		'permlevel': 0
+	},
+
+	# DocField
+	{
+		'colour': u'White:FFF',
+		'description': u'add your own CSS (careful!)',
+		'doctype': u'DocField',
+		'fieldname': u'add_css',
+		'fieldtype': u'Code',
+		'label': u'Add CSS',
 		'permlevel': 0
 	},
 
diff --git a/erpnext/website/doctype/web_page/template.html b/erpnext/website/doctype/web_page/template.html
index 2c92a25..471c95c 100644
--- a/erpnext/website/doctype/web_page/template.html
+++ b/erpnext/website/doctype/web_page/template.html
@@ -1,5 +1,5 @@
 <div class="layout-wrapper layout-wrapper-background">
-	<div class="web-content" id="content-{{ doc.name }}" 
+	<div class="web-content" 
 		style="text-align: {{ doc.text_align }};">
 		
 		{% if doc.layout.startswith('Two column') %}
diff --git a/erpnext/website/doctype/web_page/web_page.js b/erpnext/website/doctype/web_page/web_page.js
index 4429075..0b7b78d 100644
--- a/erpnext/website/doctype/web_page/web_page.js
+++ b/erpnext/website/doctype/web_page/web_page.js
@@ -1,15 +1,33 @@
 $.extend(cur_frm.cscript, {
 	layout: function(doc) {
 		if(!doc.layout) doc.layout = 'Two column with header'
-		hide_field(['head_section', 'side_section']);
+		hide_field(['head_section', 'side_section', 'javascript', 'css']);
 		if(doc.layout=='Two column with header') {
 			unhide_field(['head_section', 'side_section']);
 		}
 		if(doc.layout=='Two column') {
 			unhide_field('side_section');
 		}
+		if(doc.insert_code) {
+			if(!doc.javascript) {
+				doc.javascript = 'wn.pages["'+doc.name+'"].onload = function(wrapper) { }';				
+			}
+			unhide_field('javascript');
+		}
+		if(doc.insert_style) {
+			if(!doc.css) {
+				doc.css = '#page-'+doc.name+' { }';	
+			}
+			unhide_field('css');
+		}
 	},
 	refresh: function(doc) {
 		cur_frm.cscript.layout(doc);
+	},
+	insert_style: function() {
+		cur_frm.cscript.layout(doc);		
+	},
+	insert_code: function() {
+		cur_frm.cscript.layout(doc);		
 	}
 })
\ 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 6b0f074..ff8a904 100644
--- a/erpnext/website/doctype/web_page/web_page.py
+++ b/erpnext/website/doctype/web_page/web_page.py
@@ -44,6 +44,14 @@
 		with open(os.path.join(os.path.dirname(__file__), 'template.html'), 'r') as f:
 			p.content = Template(f.read()).render(doc=self.doc)
 
+		p.title = self.doc.title
+		
+		if self.doc.insert_code:
+			p.script = self.doc.javascript
+
+		if self.doc.insert_style:
+			p.style = self.doc.css
+
 		p.save()
 		
 		website.utils.add_guest_access_to_page(p.name)
diff --git a/erpnext/website/doctype/web_page/web_page.txt b/erpnext/website/doctype/web_page/web_page.txt
index 7c155d7..fb6febd 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-10 10:41:00',
+		'modified': '2012-04-25 16:03:57',
 		'modified_by': u'Administrator',
 		'owner': u'Administrator'
 	},
@@ -22,7 +22,7 @@
 		'name': '__common__',
 		'section_style': u'Simple',
 		'show_in_menu': 0,
-		'version': 11
+		'version': 16
 	},
 
 	# These values are common for all DocField
@@ -88,15 +88,6 @@
 	# DocField
 	{
 		'doctype': u'DocField',
-		'fieldname': u'layout',
-		'fieldtype': u'Select',
-		'label': u'Layout',
-		'options': u'Two column with header\nTwo column\nSingle column'
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
 		'fieldname': u'cb1',
 		'fieldtype': u'Column Break',
 		'width': u'50%'
@@ -105,10 +96,10 @@
 	# DocField
 	{
 		'doctype': u'DocField',
-		'fieldname': u'text_align',
+		'fieldname': u'layout',
 		'fieldtype': u'Select',
-		'label': u'Text Align',
-		'options': u'Left\nCenter\nRight'
+		'label': u'Layout',
+		'options': u'Two column with header\nTwo column\nSingle column'
 	},
 
 	# DocField
@@ -158,29 +149,49 @@
 		'doctype': u'DocField',
 		'fieldname': u'sb2',
 		'fieldtype': u'Section Break',
-		'label': u'Links'
+		'label': u'More'
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'text_align',
+		'fieldtype': u'Select',
+		'label': u'Text Align',
+		'options': u'Left\nCenter\nRight'
 	},
 
 	# DocField
 	{
 		'colour': u'White:FFF',
-		'description': u'Link for next page appears at the bottom of the page',
 		'doctype': u'DocField',
-		'fieldname': u'next_page',
-		'fieldtype': u'Link',
-		'label': u'Next Page',
-		'options': u'Page'
+		'fieldname': u'insert_code',
+		'fieldtype': u'Check',
+		'label': u'Insert Code'
 	},
 
 	# DocField
 	{
-		'colour': u'White:FFF',
-		'description': u'Related pages appear on the right side of the link and are linked both ways.',
 		'doctype': u'DocField',
-		'fieldname': u'related_pages',
-		'fieldtype': u'Table',
-		'label': u'Related Pages',
-		'options': u'Related Page'
+		'fieldname': u'javascript',
+		'fieldtype': u'Code',
+		'label': u'Javascript'
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'insert_style',
+		'fieldtype': u'Check',
+		'label': u'Insert Style'
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'css',
+		'fieldtype': u'Code',
+		'label': u'CSS'
 	},
 
 	# DocField
diff --git a/js/all-app.js b/js/all-app.js
index beca5f6..bec4220 100644
--- a/js/all-app.js
+++ b/js/all-app.js
@@ -353,7 +353,7 @@
 /*
  *	lib/js/wn/views/container.js
  */
-wn.provide('wn.pages');wn.provide('wn.views');wn.views.Container=Class.extend({init:function(){this.container=$('#body_div').get(0);this.page=null;this.pagewidth=$('#body_div').width();this.pagemargin=50;},add_page:function(label,onshow,onhide){var page=$('<div class="content"></div>').appendTo(this.container).get(0);if(onshow)
+wn.provide('wn.pages');wn.provide('wn.views');wn.views.Container=Class.extend({init:function(){this.container=$('#body_div').get(0);this.page=null;this.pagewidth=$('#body_div').width();this.pagemargin=50;},add_page:function(label,onshow,onhide){var page=$('<div class="content"></div>').attr('id',"page-"+label).appendTo(this.container).get(0);if(onshow)
 $(page).bind('show',onshow);if(onshow)
 $(page).bind('hide',onhide);page.label=label;wn.pages[label]=page;return page;},change_to:function(label){if(this.page&&this.page.label==label){return;}
 var me=this;if(label.tagName){var page=label;}else{var page=wn.pages[label];}
@@ -1710,7 +1710,8 @@
 c.appendChild(this.print_sel);c.cur_sel=this.print_sel;_e.dialog.widgets['Send With Attachments'].checked=0;if(cur_frm.doc.file_list){$ds(_e.dialog.rows['Send With Attachments']);}else{$dh(_e.dialog.rows['Send With Attachments']);}
 _e.dialog.widgets['Subject'].value=get_doctype_label(this.meta.name)+': '+this.docname;_e.dialog.show();}
 _f.Frm.prototype.rename_notify=function(dt,old,name){this.is_editable[name]=this.is_editable[old];delete this.is_editable[old];if(this.docname==old)
-this.docname=name;if(this&&this.opendocs[old]){local_dt[dt][name]=local_dt[dt][old];local_dt[dt][old]=null;}
+this.docname=name;else
+return;if(this&&this.opendocs[old]){local_dt[dt][name]=local_dt[dt][old];local_dt[dt][old]=null;}
 delete this.opendocs[old];this.opendocs[name]=true;wn.re_route[window.location.hash]='Form/'+encodeURIComponent(this.doctype)+'/'+encodeURIComponent(name);wn.set_route('Form',this.doctype,name);}
 _f.Frm.prototype.setup_meta=function(){this.meta=get_local('DocType',this.doctype);this.perm=get_perm(this.doctype);if(this.meta.istable){this.meta.in_dialog=1}
 this.setup_print();}
diff --git a/js/all-web.js b/js/all-web.js
index 1e0a541..6ec421e 100644
--- a/js/all-web.js
+++ b/js/all-web.js
@@ -240,7 +240,7 @@
 /*
  *	lib/js/wn/views/container.js
  */
-wn.provide('wn.pages');wn.provide('wn.views');wn.views.Container=Class.extend({init:function(){this.container=$('#body_div').get(0);this.page=null;this.pagewidth=$('#body_div').width();this.pagemargin=50;},add_page:function(label,onshow,onhide){var page=$('<div class="content"></div>').appendTo(this.container).get(0);if(onshow)
+wn.provide('wn.pages');wn.provide('wn.views');wn.views.Container=Class.extend({init:function(){this.container=$('#body_div').get(0);this.page=null;this.pagewidth=$('#body_div').width();this.pagemargin=50;},add_page:function(label,onshow,onhide){var page=$('<div class="content"></div>').attr('id',"page-"+label).appendTo(this.container).get(0);if(onshow)
 $(page).bind('show',onshow);if(onshow)
 $(page).bind('hide',onhide);page.label=label;wn.pages[label]=page;return page;},change_to:function(label){if(this.page&&this.page.label==label){return;}
 var me=this;if(label.tagName){var page=label;}else{var page=wn.pages[label];}