forked from extern/egroupware
Etemplate: Add et2_nextmatch.set_disable_autorefresh() to change it dynamically
This commit is contained in:
parent
19b8cb25a8
commit
faed2f97d4
@ -1456,17 +1456,17 @@ var et2_nextmatch = /** @class */ (function (_super) {
|
|||||||
* @param time int Refresh period, in seconds
|
* @param time int Refresh period, in seconds
|
||||||
*/
|
*/
|
||||||
et2_nextmatch.prototype._set_autorefresh = function (time) {
|
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
|
// Store preference
|
||||||
var refresh_preference = "nextmatch-" + this.options.settings.columnselection_pref + "-autorefresh";
|
var refresh_preference = "nextmatch-" + this.options.settings.columnselection_pref + "-autorefresh";
|
||||||
var app = this._get_appname();
|
var app = this._get_appname();
|
||||||
if (this._get_autorefresh() != time) {
|
if (this._get_autorefresh() != time) {
|
||||||
this.egw().set_preference(app, refresh_preference, 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) {
|
if (time > 0) {
|
||||||
this._autorefresh_timer = setInterval(jQuery.proxy(this.controller.update, this.controller), time * 1000);
|
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
|
// Bind to tab show/hide events, so that we don't bother refreshing in the background
|
||||||
@ -1505,6 +1505,20 @@ var et2_nextmatch = /** @class */ (function (_super) {
|
|||||||
var refresh_preference = "nextmatch-" + this.options.settings.columnselection_pref + "-autorefresh";
|
var refresh_preference = "nextmatch-" + this.options.settings.columnselection_pref + "-autorefresh";
|
||||||
return this.egw().preference(refresh_preference, this._get_appname());
|
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
|
* 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
|
* that template and to fetch the grid which is inside of it. It then calls
|
||||||
|
@ -1997,6 +1997,13 @@ export class et2_nextmatch extends et2_DOMWidget implements et2_IResizeable, et2
|
|||||||
*/
|
*/
|
||||||
_set_autorefresh( time)
|
_set_autorefresh( time)
|
||||||
{
|
{
|
||||||
|
// Start / update timer
|
||||||
|
if (this._autorefresh_timer)
|
||||||
|
{
|
||||||
|
window.clearInterval(this._autorefresh_timer);
|
||||||
|
delete this._autorefresh_timer;
|
||||||
|
}
|
||||||
|
|
||||||
// Store preference
|
// Store preference
|
||||||
const refresh_preference = "nextmatch-" + this.options.settings.columnselection_pref + "-autorefresh";
|
const refresh_preference = "nextmatch-" + this.options.settings.columnselection_pref + "-autorefresh";
|
||||||
const app = this._get_appname();
|
const app = this._get_appname();
|
||||||
@ -2004,13 +2011,6 @@ export class et2_nextmatch extends et2_DOMWidget implements et2_IResizeable, et2
|
|||||||
{
|
{
|
||||||
this.egw().set_preference(app,refresh_preference,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)
|
if(time > 0)
|
||||||
{
|
{
|
||||||
this._autorefresh_timer = setInterval(jQuery.proxy(this.controller.update, this.controller), time * 1000);
|
this._autorefresh_timer = setInterval(jQuery.proxy(this.controller.update, this.controller), time * 1000);
|
||||||
@ -2057,6 +2057,22 @@ export class et2_nextmatch extends et2_DOMWidget implements et2_IResizeable, et2
|
|||||||
return this.egw().preference(refresh_preference,this._get_appname());
|
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
|
* 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
|
* that template and to fetch the grid which is inside of it. It then calls
|
||||||
|
Loading…
Reference in New Issue
Block a user