Jump to content
Froxlor Forum
  • 0

Javascript-Counter shows next Cron-Config-Reload


Kaltenbach

Question

Hy everybody,

 

i will also let you know that i developed a little modification for SysCP, which also works in Froxlor.

 

A counter in the header, which shows you when the Cron nexttime will reload the config files.

 

An actual example could you see on the following page:

 

https://www.kaltenbach-edv.at/

 

the necessary files can be downloaded from the following address:

 

http://www.kaltenbach-edv.at/froxlor/counter.tar

 

Here the descripton how to install:

***********************************

00. Change Directory into your Froxlor-Root

01. Create the following Directory: /scripts/counter/

02. Download the counter.tar from http://www.kaltenbach-edv.at/froxlor/counter.tar

03. Extract the files to the directory /scripts/counter/ (tar -xvf counter.tar /scripts/counter/)

04. Edit the file /lib/init.php

 

Add the following lines after line 405:

 

$header .= "<script language='javascript' src='./scripts/counter/jquery-1.2.6.js'></script>";

$header .= "<script language='javascript' src='./scripts/counter/counter.js'></script>";

 

now it should look like this:

 

eval("\$header = \"" . getTemplate('header', '1') . "\";");

$header .= "<script language='javascript' src='./scripts/counter/jquery-1.2.6.js'></script>";

$header .= "<script language='javascript' src='./scripts/counter/counter.js'></script>";

eval("\$footer = \"" . getTemplate('footer', '1') . "\";");

 

05. Edit the file /templates/header.tpl:

 

Add the following line after line 26:

 

<div id="weiter"></div>

 

now it should look like this:

 

<td class="header">

<div id="weiter"></div>

</td>

 

06. Edit the file /scripts/counter/counter.js:

 

Change the Value "300" in line 5, to a value which is equivalent to the intervall of your CronJob for SysCP

(in seconds)

 

Intervall = 300;

 

07. Thats it!

Link to comment
Share on other sites

7 answers to this question

Recommended Posts

Nice to see some contribution =)

 

1. it's javascript, not java. That's a huge difference!

2. use it at your own risk

3. it could be better positioned, like complete in the blue part or half half. It doesn't look too good atm

Link to comment
Share on other sites

Sorry guys, i wrote the topic a little bit to fast.

 

Sure, its javascript :)

 

The problem of the position is, that i didn't really analyze the structure of the header, therefore

i put it on a place, that it is shown in the header. Maybe i will correct the position, and the handling

when this counter is shown in future time :)

Link to comment
Share on other sites

Now i changed the script.

I think, the wish of d00p is now fullfilled ..

 

The counter will only be shown, if your are logged in.

 

And i moved the counter a little bit deeper ..

 

Changelog:

1. function restZeit() - extended after line 32

2. function getFileName() - add (Source: http://befused.com/javascript/get-filename-url, Thanx to "Deo Favente")

 

Changedfile: http://www.kaltenbach-edv.at/froxlor/counter.js

The Archiv: http://www.kaltenbach-edv.at/froxlor/counter.tar (has been updated)

Screenshot: http://www.kaltenbach-edv.at/froxlor/screen.jpg (because on the official site you wont see the counter ;) )

 

PS: Sorry for my bad english!

Link to comment
Share on other sites

Thats true, but you can change this easily in Line 39

 

instead of "Config-Reload in:" => "(Possible) Config-Reload in:"

 

An other Bugfix is available, since CSR is blocking the function "setTimeout()" in counter.js

(https://wiki.mozilla.org/Security/CSP/Deploying#setTimeout.28.29)

 

 

Workaround/Bugfix:

Line 21 + 40:

from: setTimeout('restZeit()',1000);

to: (setTimeout( function() { 'restZeit()' }, 1000));

change this, and everything will work fine again.

 

lg

 

PP2000

Link to comment
Share on other sites

There's one thing that is not true: it says "Config-Reload"...which is not always true, becausea re-building of the configuration only happens if there's a task for it in the table 'panel_tasks'. You can only say that the "next cron-run" is in [interval] seconds

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.



×
×
  • Create New...