[website] [cleanup] selectable images will now be relative urls (files/..) or full urls (http:..)
This commit is contained in:
parent
f3c73013fe
commit
9eeb10dead
4 changed files with 9 additions and 13 deletions
|
|
@ -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');
|
||||
|
|
|
|||
|
|
@ -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})
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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."))
|
||||
|
|
|
|||
|
|
@ -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}))
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue