mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-11-23 08:23:12 +01:00
Etemplate: Add et2_nextmatch.set_disable_autorefresh() to change it dynamically
This commit is contained in:
parent
9e310cea24
commit
a562867671
@ -1457,17 +1457,17 @@ var et2_nextmatch = /** @class */ (function (_super) {
|
||||
* @param time int Refresh period, in seconds
|
||||
*/
|
||||
et2_nextmatch.prototype._set_autorefresh = function (time) {
|
||||
// Start / update timer
|
||||
if (this._autorefresh_timer) {
|
||||
window.clearInterval(this._autorefresh_timer);
|
||||
delete this._autorefresh_timer;
|
||||
}
|
||||
// Store preference
|
||||
var refresh_preference = "nextmatch-" + this.options.settings.columnselection_pref + "-autorefresh";
|
||||
var app = this._get_appname();
|
||||
if (this._get_autorefresh() != time) {
|
||||
this.egw().set_preference(app, refresh_preference, time);
|
||||
}
|
||||
// Start / update timer
|
||||
if (this._autorefresh_timer) {
|
||||
window.clearInterval(this._autorefresh_timer);
|
||||
delete this._autorefresh_timer;
|
||||
}
|
||||
if (time > 0) {
|
||||
this._autorefresh_timer = setInterval(jQuery.proxy(this.controller.update, this.controller), time * 1000);
|
||||
// Bind to tab show/hide events, so that we don't bother refreshing in the background
|
||||
@ -1506,6 +1506,20 @@ var et2_nextmatch = /** @class */ (function (_super) {
|
||||
var refresh_preference = "nextmatch-" + this.options.settings.columnselection_pref + "-autorefresh";
|
||||
return this.egw().preference(refresh_preference, this._get_appname());
|
||||
};
|
||||
/**
|
||||
* Enable or disable autorefresh
|
||||
*
|
||||
* If false, autorefresh will be shown in column selection. If the user already has an autorefresh preference
|
||||
* for this nextmatch, the timer will be started.
|
||||
*
|
||||
* If true, the timer will be stopped and autorefresh will not be shown in column selection
|
||||
*
|
||||
* @param disabled
|
||||
*/
|
||||
et2_nextmatch.prototype.set_disable_autorefresh = function (disabled) {
|
||||
this.options.disable_autorefresh = disabled;
|
||||
this._set_autorefresh(this._get_autorefresh());
|
||||
};
|
||||
/**
|
||||
* When the template attribute is set, the nextmatch widget tries to load
|
||||
* that template and to fetch the grid which is inside of it. It then calls
|
||||
|
@ -1998,6 +1998,13 @@ export class et2_nextmatch extends et2_DOMWidget implements et2_IResizeable, et2
|
||||
*/
|
||||
_set_autorefresh( time)
|
||||
{
|
||||
// Start / update timer
|
||||
if (this._autorefresh_timer)
|
||||
{
|
||||
window.clearInterval(this._autorefresh_timer);
|
||||
delete this._autorefresh_timer;
|
||||
}
|
||||
|
||||
// Store preference
|
||||
const refresh_preference = "nextmatch-" + this.options.settings.columnselection_pref + "-autorefresh";
|
||||
const app = this._get_appname();
|
||||
@ -2005,13 +2012,6 @@ export class et2_nextmatch extends et2_DOMWidget implements et2_IResizeable, et2
|
||||
{
|
||||
this.egw().set_preference(app,refresh_preference,time);
|
||||
}
|
||||
|
||||
// Start / update timer
|
||||
if (this._autorefresh_timer)
|
||||
{
|
||||
window.clearInterval(this._autorefresh_timer);
|
||||
delete this._autorefresh_timer;
|
||||
}
|
||||
if(time > 0)
|
||||
{
|
||||
this._autorefresh_timer = setInterval(jQuery.proxy(this.controller.update, this.controller), time * 1000);
|
||||
@ -2058,6 +2058,22 @@ export class et2_nextmatch extends et2_DOMWidget implements et2_IResizeable, et2
|
||||
return this.egw().preference(refresh_preference,this._get_appname());
|
||||
}
|
||||
|
||||
/**
|
||||
* Enable or disable autorefresh
|
||||
*
|
||||
* If false, autorefresh will be shown in column selection. If the user already has an autorefresh preference
|
||||
* for this nextmatch, the timer will be started.
|
||||
*
|
||||
* If true, the timer will be stopped and autorefresh will not be shown in column selection
|
||||
*
|
||||
* @param disabled
|
||||
*/
|
||||
set_disable_autorefresh( disabled : boolean)
|
||||
{
|
||||
this.options.disable_autorefresh = disabled;
|
||||
this._set_autorefresh(this._get_autorefresh());
|
||||
}
|
||||
|
||||
/**
|
||||
* When the template attribute is set, the nextmatch widget tries to load
|
||||
* that template and to fetch the grid which is inside of it. It then calls
|
||||
|
Loading…
Reference in New Issue
Block a user