Author: hnategh
Date: Mon Apr 18 12:37:08 2016
New Revision: 55761
URL: http://svn.stylite.de/viewvc/egroupware?rev=55761&view=rev
Log:
Implement readonly for file widget. Additionally, make a generic style for readonly widgets
Modified:
trunk/egroupware/api/js/etemplate/et2_widget_file.js
trunk/egroupware/api/templates/default/etemplate2.css
trunk/filemanager/js/app.js
Modified: trunk/egroupware/api/js/etemplate/et2_widget_file.js
URL: http://svn.stylite.de/viewvc/egroupware/trunk/egroupware/api/js/etemplate/et2_widget_file.js?rev=55761&r1=55760&r2=55761&view=diff
==============================================================================
--- trunk/egroupware/api/js/etemplate/et2_widget_file.js (original)
+++ trunk/egroupware/api/js/etemplate/et2_widget_file.js Mon Apr 18 12:37:08 2016
@@ -182,7 +182,7 @@
});
var self = this;
// 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
if(typeof File != "undefined" && typeof (new XMLHttpRequest()).upload != "undefined")
{
@@ -649,6 +649,29 @@
// In case it didn't make it to the list (error)
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);
Modified: trunk/egroupware/api/templates/default/etemplate2.css
URL: http://svn.stylite.de/viewvc/egroupware/trunk/egroupware/api/templates/default/etemplate2.css?rev=55761&r1=55760&r2=55761&view=diff
==============================================================================
--- trunk/egroupware/api/templates/default/etemplate2.css (original)
+++ trunk/egroupware/api/templates/default/etemplate2.css Mon Apr 18 12:37:08 2016
@@ -2639,4 +2639,12 @@
border-bottom: 1px solid #E6E6E6;
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;
+}
Modified: trunk/filemanager/js/app.js
URL: http://svn.stylite.de/viewvc/egroupware/trunk/filemanager/js/app.js?rev=55761&r1=55760&r2=55761&view=diff
==============================================================================
--- trunk/filemanager/js/app.js (original)
+++ trunk/filemanager/js/app.js Mon Apr 18 12:37:08 2016
@@ -889,20 +889,7 @@
var widget = etemplate2.getById(id).widgetContainer.getWidgetById(ids[i]);
if (widget)
{
- if (widget._type == 'button' || widget._type == 'buttononly')
- {
- 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);
- }
+ widget.set_readonly(_ro);
}
}
}
------------------------------------------------------------------------------
Find and fix application performance issues faster with Applications Manager
Applications Manager provides deep performance insights into multiple tiers of
your business applications. It resolves application problems quickly and
reduces your MTTR. Get your free trial!
https://ad.doubleclick.net/ddm/clk/302982198;130105516;z
lmpx.com only provides a reader for public news (NNTP) servers. It is not
affiliated with the servers or forums shown here and is not responsible for
the content of articles, which is written by their respective authors.