mirror of
https://github.com/EGroupware/egroupware.git
synced 2025-06-27 05:11:41 +02:00
Implement readonly for file widget. Additionally, make a generic style for readonly widgets
This commit is contained in:
parent
0010284404
commit
bb59879064
@ -182,7 +182,7 @@ var et2_file = (function(){ "use strict"; return et2_inputWidget.extend(
|
|||||||
});
|
});
|
||||||
var self = this;
|
var self = this;
|
||||||
// trigger native input upload file
|
// trigger native input upload file
|
||||||
this.span.click(function(){self.input.click()});
|
if (!this.options.readonly) this.span.click(function(){self.input.click()});
|
||||||
// Check for File interface, should fall back to normal form submit if missing
|
// Check for File interface, should fall back to normal form submit if missing
|
||||||
if(typeof File != "undefined" && typeof (new XMLHttpRequest()).upload != "undefined")
|
if(typeof File != "undefined" && typeof (new XMLHttpRequest()).upload != "undefined")
|
||||||
{
|
{
|
||||||
@ -649,6 +649,29 @@ var et2_file = (function(){ "use strict"; return et2_inputWidget.extend(
|
|||||||
// In case it didn't make it to the list (error)
|
// In case it didn't make it to the list (error)
|
||||||
target.remove();
|
target.remove();
|
||||||
$j(e.target).remove();
|
$j(e.target).remove();
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set readonly
|
||||||
|
*
|
||||||
|
* @param {boolean} _ro boolean readonly state, true means readonly
|
||||||
|
*/
|
||||||
|
set_readonly: function(_ro)
|
||||||
|
{
|
||||||
|
if (typeof _ro != "undefined")
|
||||||
|
{
|
||||||
|
this.options.readonly = _ro;
|
||||||
|
this.span.toggleClass('et2_file_ro',_ro);
|
||||||
|
if (this.options.readonly)
|
||||||
|
{
|
||||||
|
this.span.unbind('click');
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
var self = this;
|
||||||
|
this.span.off().bind('click',function(){self.input.click()});
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});}).call(this);
|
});}).call(this);
|
||||||
|
|
||||||
|
@ -2639,4 +2639,12 @@ tr.dialogOperators td,.dialogFooterToolbar {
|
|||||||
border-bottom: 1px solid #E6E6E6;
|
border-bottom: 1px solid #E6E6E6;
|
||||||
height: 50px;
|
height: 50px;
|
||||||
}
|
}
|
||||||
tr.dialogHeader2 td {padding-top:15px;}
|
tr.dialogHeader2 td {padding-top:15px;}
|
||||||
|
|
||||||
|
/*readonly widget style*/
|
||||||
|
.et2_button_ro,.et2_file_span.et2_button.et2_file_ro {
|
||||||
|
opacity: 0.5;
|
||||||
|
background-color: initial !important;
|
||||||
|
box-shadow: none !important;
|
||||||
|
cursor: not-allowed !important;
|
||||||
|
}
|
@ -889,20 +889,7 @@ app.classes.filemanager = AppJS.extend(
|
|||||||
var widget = etemplate2.getById(id).widgetContainer.getWidgetById(ids[i]);
|
var widget = etemplate2.getById(id).widgetContainer.getWidgetById(ids[i]);
|
||||||
if (widget)
|
if (widget)
|
||||||
{
|
{
|
||||||
if (widget._type == 'button' || widget._type == 'buttononly')
|
widget.set_readonly(_ro);
|
||||||
{
|
|
||||||
widget.set_readonly(_ro);
|
|
||||||
}
|
|
||||||
// upload
|
|
||||||
else if (widget.disabled != _ro)
|
|
||||||
{
|
|
||||||
// fix width of path-widget to kope with hidden/shown upload
|
|
||||||
var path_parent = jQuery(this.path_widget[id].getDOMNode().parentNode);
|
|
||||||
var width = jQuery(widget.getDOMNode()).outerWidth(true);
|
|
||||||
path_parent.css('right', (parseInt(path_parent.css('right'))+(_ro?-1:1)*width)+'px');
|
|
||||||
|
|
||||||
widget.set_disabled(_ro);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user