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 0000000000..769463a590
--- /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 2ea10cd308..5502385b2f 100644
--- a/patches/patch_list.py
+++ b/patches/patch_list.py
@@ -224,4 +224,5 @@ patch_list = [
"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 931b7762d3..802771cce1 100644
--- a/stock/doctype/item/item.py
+++ b/stock/doctype/item/item.py
@@ -235,9 +235,8 @@ class DocType(DocListController):
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 e291aa85d0..fb3dcc915d 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 @@ class DocType:
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 ff6cc9931e..90f72f205b 100644
--- a/website/doctype/blog_post/blog_post.py
+++ b/website/doctype/blog_post/blog_post.py
@@ -78,8 +78,6 @@ class DocType:
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 fcb2276ca0..f055b782fe 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 @@ div.web-footer, div.web-footer a {
/* 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 67e494154f..5858926ce2 100644
--- a/website/doctype/website_settings/website_settings.js
+++ b/website/doctype/website_settings/website_settings.js
@@ -48,7 +48,6 @@ cur_frm.cscript.set_banner_from_image = function(doc) {
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", "");
}
\ No newline at end of file
diff --git a/website/helpers/blog.py b/website/helpers/blog.py
index 1f25ac0145..404435332c 100644
--- a/website/helpers/blog.py
+++ b/website/helpers/blog.py
@@ -46,8 +46,6 @@ def get_blog_list(start=0, by=None, category=None):
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_blog_template_args():
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 ef433b1a29..f79d2070c3 100644
--- a/website/helpers/product.py
+++ b/website/helpers/product.py
@@ -5,7 +5,7 @@ from __future__ import unicode_literals
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 @@ def scrub_item_for_list(r):
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 0afd80a0a3..4c64c55c85 100644
--- a/website/helpers/slideshow.py
+++ b/website/helpers/slideshow.py
@@ -20,7 +20,4 @@ def get_slideshow(obj):
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 6889d6707a..cfba1a5ca0 100644
--- a/website/templates/html/base.html
+++ b/website/templates/html/base.html
@@ -10,13 +10,8 @@
- {%- if favicon %}
-
-
- {% else %}
-
-
- {% endif -%}
+
+
{% if description -%}
{%- endif %}
diff --git a/website/utils.py b/website/utils.py
index 14e3e13cda..252885983b 100644
--- a/website/utils.py
+++ b/website/utils.py
@@ -192,6 +192,7 @@ def get_source_doc(page_name):
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 @@ def get_outer_env(page_name, args):
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 get_all_pages():
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):