[website] [cleanup] selectable images will now be relative urls (files/..) or full urls (http:..)
diff --git a/patches/march_2013/p11_update_attach_files.py b/patches/march_2013/p11_update_attach_files.py
new file mode 100644
index 0000000..769463a
--- /dev/null
+++ b/patches/march_2013/p11_update_attach_files.py
@@ -0,0 +1,16 @@
+import webnotes
+
+def execute():
+	for f in webnotes.conn.sql("""select parent, fieldname 
+		from tabDocField where options="attach_files:" """, as_dict=1):
+		if webnotes.conn.get_value("DocType", f.parent, "issingle"):
+			fname = webnotes.conn.get_value(f.parent, None, f.fieldname)
+			if fname:
+				if not (fname.startswith("http") or fname.startswith("files")):
+					webnotes.conn.set_value(f.parent, None, f.fieldname, "files/" + fname)
+		else:
+			webnotes.conn.sql("""update `tab%(parent)s`
+				set %(fieldname)s = 
+					if(substr(%(fieldname)s,0,4)='http' or substr(%(fieldname)s, 0, 5)='files',
+					 	%(fieldname)s, 
+						concat('files/', %(fieldname)s))""" % f)
\ No newline at end of file
diff --git a/patches/patch_list.py b/patches/patch_list.py
index 2ea10cd..5502385 100644
--- a/patches/patch_list.py
+++ b/patches/patch_list.py
@@ -224,4 +224,5 @@
 	"execute:webnotes.conn.set_value('Email Settings', None, 'send_print_in_body_and_attachment', 1)",
 	"patches.march_2013.p09_unset_user_type_partner",
 	"patches.march_2013.p10_set_fiscal_year_for_stock",
+	"patches.march_2013.p11_update_attach_files",
 ]
\ No newline at end of file
diff --git a/stock/doctype/item/item.py b/stock/doctype/item/item.py
index 931b776..802771c 100644
--- a/stock/doctype/item/item.py
+++ b/stock/doctype/item/item.py
@@ -235,9 +235,8 @@
 			clear_cache(self.doc.page_name)
 			
 	def prepare_template_args(self):
-		from website.helpers.product import get_parent_item_groups, url_for_website
+		from website.helpers.product import get_parent_item_groups
 		self.parent_groups = get_parent_item_groups(self.doc.item_group) + [{"name":self.doc.name}]
-		self.doc.website_image = url_for_website(self.doc.website_image)
 		self.doc.title = self.doc.item_name
 
 		if self.doc.slideshow:
diff --git a/website/doctype/about_us_settings/about_us_settings.py b/website/doctype/about_us_settings/about_us_settings.py
index e291aa8..fb3dcc9 100644
--- a/website/doctype/about_us_settings/about_us_settings.py
+++ b/website/doctype/about_us_settings/about_us_settings.py
@@ -2,7 +2,6 @@
 
 from __future__ import unicode_literals
 import webnotes
-from website.utils import url_for_website
 
 class DocType:
 	def __init__(self, d, dl):
@@ -14,9 +13,6 @@
 		
 def get_args():
 	obj = webnotes.get_obj("About Us Settings")
-	for d in obj.doclist.get({"doctype":"About Us Team Member"}):
-		if not "/" in d.image_link:
-			d.image_link = "files/" + d.image_link
 	return {
 		"obj": obj
 	}
\ No newline at end of file
diff --git a/website/doctype/blog_post/blog_post.py b/website/doctype/blog_post/blog_post.py
index ff6cc99..90f72f2 100644
--- a/website/doctype/blog_post/blog_post.py
+++ b/website/doctype/blog_post/blog_post.py
@@ -78,8 +78,6 @@
 		self.doc.content_html = self.doc.content
 		if self.doc.blogger:
 			self.doc.blogger_info = webnotes.doc("Blogger", self.doc.blogger).fields
-			if self.doc.blogger_info.avatar and not "/" in self.doc.blogger_info.avatar:
-				self.doc.blogger_info.avatar = "files/" + self.doc.blogger_info.avatar
 		
 		self.doc.description = self.doc.blog_intro or self.doc.content[:140]
 		
diff --git a/website/doctype/style_settings/custom_template.css b/website/doctype/style_settings/custom_template.css
index fcb2276..f055b78 100644
--- a/website/doctype/style_settings/custom_template.css
+++ b/website/doctype/style_settings/custom_template.css
@@ -4,7 +4,7 @@
 
 body {
 {% if doc.background_image %}
-	background: url("../files/{{ doc.background_image }}") repeat;
+	background: url("../{{ doc.background_image }}") repeat;
 {% elif doc.background_color %}
 	background-color: #{{ doc.background_color }};
 	background-image: none;
@@ -67,16 +67,10 @@
 
 /* Bootstrap Navbar */
 .navbar-inverse .navbar-inner {
+	box-shadow: none;
     background-color: #{{ doc.top_bar_background or "444444"}};
     background-repeat: repeat-x;
 	background-image: none;
-}
-
-.navbar-inner {
-	box-shadow: none;
-}
-
-.navbar-inner {
 	border-bottom: 1px solid {% if doc.top_bar_background == doc.page_background -%}
 		#{{ get_hex_shade(doc.page_background or "ffffff", 15) }};
 	{%- else -%}
diff --git a/website/doctype/website_settings/website_settings.js b/website/doctype/website_settings/website_settings.js
index 67e4941..5858926 100644
--- a/website/doctype/website_settings/website_settings.js
+++ b/website/doctype/website_settings/website_settings.js
@@ -48,7 +48,6 @@
 		msgprint(wn._("Select a Banner Image first."));
 	}
 	var src = doc.banner_image;
-	if(src.indexOf("/")==-1) src = "files/" + src;
 	cur_frm.set_value("banner_html", "<a href='/'><img src='"+ src
 		+"' style='max-width: 200px;'></a>");
 }
\ No newline at end of file
diff --git a/website/helpers/blog.py b/website/helpers/blog.py
index 1f25ac0..4044353 100644
--- a/website/helpers/blog.py
+++ b/website/helpers/blog.py
@@ -46,8 +46,6 @@
 		if not res['content']:
 			res['content'] = website.utils.get_html(res['page_name'])
 		res['content'] = res['content'][:140]
-		if res.avatar and not "/" in res.avatar:
-			res.avatar = "files/" + res.avatar
 		
 	return result
 
@@ -133,9 +131,6 @@
 def get_writers_args():
 	bloggers = webnotes.conn.sql("""select * from `tabBlogger` 
 	 	order by posts desc""", as_dict=1)
-	for blogger in bloggers:
-		if blogger.avatar and not "/" in blogger.avatar:
-			blogger.avatar = "files/" + blogger.avatar
 		
 	args = {
 		"bloggers": bloggers,
diff --git a/website/helpers/product.py b/website/helpers/product.py
index ef433b1..f79d207 100644
--- a/website/helpers/product.py
+++ b/website/helpers/product.py
@@ -5,7 +5,7 @@
 
 import webnotes
 from webnotes.utils import cstr
-from website.utils import build_html, url_for_website, delete_page_cache
+from website.utils import build_html, delete_page_cache
 
 
 @webnotes.whitelist(allow_guest=True)
@@ -90,7 +90,6 @@
 		r.website_description = "No description given"
 	if len(r.website_description.split(" ")) > 24:
 		r.website_description = " ".join(r.website_description.split(" ")[:24]) + "..."
-	r.website_image = url_for_website(r.website_image)
 
 def get_parent_item_groups(item_group_name):
 	item_group = webnotes.doc("Item Group", item_group_name)
diff --git a/website/helpers/slideshow.py b/website/helpers/slideshow.py
index 0afd80a..4c64c55 100644
--- a/website/helpers/slideshow.py
+++ b/website/helpers/slideshow.py
@@ -20,7 +20,4 @@
 	slideshow = webnotes.bean("Website Slideshow", obj.doc.slideshow)
 	obj.slides = slideshow.doclist.get({"doctype":"Website Slideshow Item"})
 	obj.doc.slideshow_header = slideshow.doc.header or ""
-	for s in obj.slides:
-		if s.image and not s.image.lower().startswith("http"):
-			s.image = "files/" + s.image
 	
\ No newline at end of file
diff --git a/website/templates/html/base.html b/website/templates/html/base.html
index 6889d67..cfba1a5 100644
--- a/website/templates/html/base.html
+++ b/website/templates/html/base.html
@@ -10,13 +10,8 @@
 	<script type="text/javascript" src="js/wn-web.js"></script>
 	<link type="text/css" rel="stylesheet" href="css/all-web.css">
 	<link type="text/css" rel="stylesheet" href="css/wn-web.css">
-	{%- if favicon %}
-	<link rel="shortcut icon" href="files/{{ favicon }}" type="image/x-icon">
-	<link rel="icon" href="files/{{ favicon }}" type="image/x-icon">
-	{% else %}
-	<link rel="shortcut icon" href="app/images/favicon.ico" type="image/x-icon">
-	<link rel="icon" href="app/images/favicon.ico" type="image/x-icon">
-	{% endif -%}	
+	<link rel="shortcut icon" href="{{ favicon }}" type="image/x-icon">
+	<link rel="icon" href="{{ favicon }}" type="image/x-icon">
 	{% if description -%}
 	<meta name="description" content="{{ description }}">	
 	{%- endif %}
diff --git a/website/utils.py b/website/utils.py
index 14e3e13..2528859 100644
--- a/website/utils.py
+++ b/website/utils.py
@@ -192,6 +192,7 @@
 	return None, None
 	
 def get_outer_env(page_name, args):
+	
 	from webnotes.utils import get_request_site_address
 	from urllib import quote
 	
@@ -238,7 +239,7 @@
 	args.update(ret)
 	
 	settings = webnotes.doc("Website Settings", "Website Settings")
-	for k in ["banner_html", "brand_html", "copyright", "address", "twitter_share_via"
+	for k in ["banner_html", "brand_html", "copyright", "address", "twitter_share_via",
 		"favicon", "facebook_share", "google_plus_one", "twitter_share", "linked_in_share"]:
 		if k in settings.fields:
 			args[k] = settings.fields.get(k)
@@ -280,13 +281,7 @@
 def delete_page_cache(page_name):
 	if page_name:
 		webnotes.cache().delete_value("page:" + page_name)
-	
-def url_for_website(url):
-	if url and not url.lower().startswith("http"):
-		return "files/" + url
-	else:
-		return url
-		
+			
 def get_hex_shade(color, percent):
 	
 	def p(c):