[website] [cleanup] selectable images will now be relative urls (files/..) or full urls (http:..)

This commit is contained in:
Rushabh Mehta 2013-03-28 16:26:10 +05:30
parent f3c73013fe
commit 9eeb10dead
4 changed files with 9 additions and 13 deletions

View file

@ -65,7 +65,7 @@ cur_frm.cscript['set_from_image'] = function(doc, dt, dn) {
return;
}
img_link = '<div><img src="'+ wn.urllib.get_file_url(file_name) + '"/></div>'
img_link = '<div><img src="files/'+ file_name + '"/></div>'
doc.content = img_link;
refresh_field('content');

View file

@ -346,13 +346,6 @@ wn.urllib = {
var url= window.location.href.split('#')[0].split('?')[0].split('app.html')[0];
if(url.substr(url.length-1, 1)=='/') url = url.substr(0, url.length-1)
return url
},
// return the relative http url for
// a file upload / attachment
// by file id / name
get_file_url: function(file_id) {
return repl('files/%(fn)s', {fn:file_id})
}
}

View file

@ -1072,7 +1072,7 @@ SelectField.prototype.make_input = function() {
}
if(this.df.options == 'attach_files:') {
this.file_attach = true;
this.attach_files = true;
$(this.input).css({"width": "70%"});
$("<button class='btn' title='Add attachment'\
style='margin-bottom: 9px; \
@ -1098,7 +1098,7 @@ SelectField.prototype.make_input = function() {
if(options)
me.df.options = options;
if(this.file_attach)
if(this.attach_files)
this.set_attach_options();
if(typeof me.df.options=="object")
@ -1195,9 +1195,12 @@ SelectField.prototype.make_input = function() {
this.df.options = '';
var fl = fl.split('\n');
for(var i in fl) {
this.df.options += '\n' + fl[i].split(',')[0];
this.set_description("");
var fname = fl[i].split(',')[0];
if(fname.substr(0,4)!="http")
fname = "files/" + fname;
this.df.options += '\n' + fname;
}
this.set_description("");
} else {
this.df.options = ''
this.set_description(wn._("Please attach a file first."))

View file

@ -3,7 +3,7 @@
wn.provide("wn.ui");
wn.ui.set_user_background = function(src) {
set_style(repl('#body_div { background: url("files/%(src)s") repeat fixed;}',
set_style(repl('#body_div { background: url("%(src)s") repeat fixed;}',
{src:src}))
}