mirror of
https://github.com/EGroupware/egroupware.git
synced 2025-06-26 12:51:52 +02:00
Fix readonly link-to widget was not read-only
This commit is contained in:
parent
cac463749e
commit
4696246b7b
@ -174,14 +174,16 @@ var et2_link_to = (function(){ "use strict"; return et2_inputWidget.extend(
|
|||||||
application_list: this.options.application_list,
|
application_list: this.options.application_list,
|
||||||
blur: this.options.search_label ? this.options.search_label : this.egw().lang('Search...'),
|
blur: this.options.search_label ? this.options.search_label : this.egw().lang('Search...'),
|
||||||
query: function() { self.link_button.hide(); return true;},
|
query: function() { self.link_button.hide(); return true;},
|
||||||
select: function() {self.link_button.show(); return true;}
|
select: function() {self.link_button.show(); return true;},
|
||||||
|
readonly: this.options.readonly
|
||||||
};
|
};
|
||||||
this.link_entry = et2_createWidget("link-entry", link_entry_attrs,this);
|
this.link_entry = et2_createWidget("link-entry", link_entry_attrs,this);
|
||||||
|
|
||||||
// Filemanager select
|
// Filemanager select
|
||||||
var select_attrs = {
|
var select_attrs = {
|
||||||
button_label: egw.lang('Link'),
|
button_label: egw.lang('Link'),
|
||||||
button_caption: ''
|
button_caption: '',
|
||||||
|
readonly: this.options.readonly
|
||||||
};
|
};
|
||||||
// only set server-side callback, if we have a real application-id (not null or array)
|
// only set server-side callback, if we have a real application-id (not null or array)
|
||||||
// otherwise it only gives an error on server-side
|
// otherwise it only gives an error on server-side
|
||||||
@ -190,6 +192,7 @@ var et2_link_to = (function(){ "use strict"; return et2_inputWidget.extend(
|
|||||||
select_attrs.method_id = self.options.value.to_app + ':' + self.options.value.to_id;
|
select_attrs.method_id = self.options.value.to_app + ':' + self.options.value.to_id;
|
||||||
}
|
}
|
||||||
this.vfs_select = et2_createWidget("vfs-select", select_attrs,this);
|
this.vfs_select = et2_createWidget("vfs-select", select_attrs,this);
|
||||||
|
this.vfs_select.set_readonly(this.options.readonly);
|
||||||
jQuery(this.vfs_select.getDOMNode()).change( function() {
|
jQuery(this.vfs_select.getDOMNode()).change( function() {
|
||||||
var values = true;
|
var values = true;
|
||||||
// If entry not yet saved, store for linking on server
|
// If entry not yet saved, store for linking on server
|
||||||
@ -197,16 +200,19 @@ var et2_link_to = (function(){ "use strict"; return et2_inputWidget.extend(
|
|||||||
{
|
{
|
||||||
values = self.options.value.to_id || {};
|
values = self.options.value.to_id || {};
|
||||||
var files = self.vfs_select.getValue();
|
var files = self.vfs_select.getValue();
|
||||||
for(var i = 0; i < files.length; i++)
|
if(typeof files !== 'undefined')
|
||||||
{
|
{
|
||||||
values['link:'+files[i]] = {
|
for(var i = 0; i < files.length; i++)
|
||||||
app: 'link',
|
{
|
||||||
id: files[i],
|
values['link:'+files[i]] = {
|
||||||
type: 'unknown',
|
app: 'link',
|
||||||
icon: 'link',
|
id: files[i],
|
||||||
remark: '',
|
type: 'unknown',
|
||||||
title: files[i]
|
icon: 'link',
|
||||||
};
|
remark: '',
|
||||||
|
title: files[i]
|
||||||
|
};
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
self._link_result(values);
|
self._link_result(values);
|
||||||
@ -219,6 +225,7 @@ var et2_link_to = (function(){ "use strict"; return et2_inputWidget.extend(
|
|||||||
label: '',
|
label: '',
|
||||||
// Make the whole template a drop target
|
// Make the whole template a drop target
|
||||||
drop_target: this.getInstanceManager().DOMContainer.getAttribute("id"),
|
drop_target: this.getInstanceManager().DOMContainer.getAttribute("id"),
|
||||||
|
readonly: this.options.readonly,
|
||||||
|
|
||||||
// Change to this tab when they drop
|
// Change to this tab when they drop
|
||||||
onStart: function(event, file_count) {
|
onStart: function(event, file_count) {
|
||||||
@ -252,6 +259,7 @@ var et2_link_to = (function(){ "use strict"; return et2_inputWidget.extend(
|
|||||||
};
|
};
|
||||||
|
|
||||||
this.file_upload = et2_createWidget("file", file_attrs,this);
|
this.file_upload = et2_createWidget("file", file_attrs,this);
|
||||||
|
this.file_upload.set_readonly(this.options.readonly);
|
||||||
return true;
|
return true;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -916,6 +916,11 @@ var et2_vfsSelect = (function(){ "use strict"; return et2_inputWidget.extend(
|
|||||||
.addClass("et2_button et2_vfs_btn")
|
.addClass("et2_button et2_vfs_btn")
|
||||||
.css("background-image","url("+this.egw().image("filemanager/navbar")+")");
|
.css("background-image","url("+this.egw().image("filemanager/navbar")+")");
|
||||||
|
|
||||||
|
if(this.options.readonly)
|
||||||
|
{
|
||||||
|
this.button.hide();
|
||||||
|
}
|
||||||
|
|
||||||
if (this.options.button_caption != "")
|
if (this.options.button_caption != "")
|
||||||
{
|
{
|
||||||
this.button.text(this.options.button_caption);
|
this.button.text(this.options.button_caption);
|
||||||
@ -1025,6 +1030,19 @@ var et2_vfsSelect = (function(){ "use strict"; return et2_inputWidget.extend(
|
|||||||
this.options.method_id = id;
|
this.options.method_id = id;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
set_readonly: function(readonly) {
|
||||||
|
this.options.readonly = Boolean(readonly);
|
||||||
|
debugger;
|
||||||
|
if(this.options.readonly)
|
||||||
|
{
|
||||||
|
this.button.hide();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
this.button.show();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
getValue: function() {
|
getValue: function() {
|
||||||
return this.value;
|
return this.value;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user