StressFree Webmin theme version 2.04 released
Tags:
Printer-friendly version
In what is hopefully the last update in a while the StressFree Webmin theme version 2.04 is available. This release applies some spit and polish to the previous release by fixing a few browser bugs, internationalising strings and adding some missing images/styles.
One more thing, if you do not like the new "Installed Modules" menu system you can change back to the old system by editing the theme-stressfree/config file and setting the old_menu parameter to 1.
The updated theme can beĀ downloaded from here.
Speaking of bug fixes, I have one.
I love this theme to death but one of the things that has been bothering me is that when you go to another Webmin server via the 'Webmin Servers Index', the sidebar doesn't give you the status information for the linked server, but for the server you originally logged into.
I noticed this didn't occur with the default blue-theme: the status information from right.cgi shows the correct info. So the only thing I could think of is that the difference must be in the JavaScript somewhere.
So I installed the Firebug extension (really cool, if you aren't using it, and do JavaScript coding at all, you need this extension.) and started poking around at variables.
What I figured out was that in the initialize() function in application.js, no matter what hapens, webminpath is always getting set to "". I tracked it back to the Perl in theme.pl and noticed that it was passing $gconfig{'webprefix'}. Since this is a user-definable option, the value will always be "" unless the user has set something, as in the case of running Webmin through mod_proxy with a directory off the root like '/webmin'.
Unfortunately, Webmin itself doesn't set this to 'link.cgi/########/' when going through Webmin servers index, so this is not reliable. I simply modified application.js to look for 'link.cgi' in location.pathname and then take some stabs at setting webminpath to the location up to and including the 'link.cgi/##########/' part of the URL. The net effect is that the sidebar sysstats.cgi comes from the linked server and not from the server you first logged into.
Anyway, without further ado, here's my fix. Be forewarned: it is very ugly code and not for the feint of heart! It does, however, in my limited testing, seem to work.
First off, replace the first link application.js, which looks like this:
var webmin = "";
with this:
-----------------------------------------------
function dirname(path) {return path.match( /.*\// );
}
function basename(path) {
return path.replace( /.*\//, "" );
}
// this is ugly, but it works.
var myParent = dirname(location.pathname)[0];
if (myParent != "/") {
var testPath = dirname(myParent.substring(0,myParent.lastIndexOf('/')-1))[0];
var testPath1 = testPath.substring(0,testPath.lastIndexOf('/'));
}
if (myParent.indexOf('link.cgi', 0) >= 0) {
if (basename(testPath1) == 'link.cgi') {
var webminpath = myParent;
} else {
var webminpath = testPath;
}
} else {
var webminpath = '';
}
--------------------------------------------------------
Also, in the first line in the initialize() function, which looks like this:
webminpath = path;
should be changed to this:
--------------------------------------------------------------
if (path != '') {
--------------------------------------------------------------webminpath = path;
}
That way if someone is setting 'webprefix' things will still work.
I can email you diff patches if you like.
Thanks I will include this patch
I don't run a multi-server setup so I'll take your word that it works :-)
In the near future I will run some tests here to confirm it works and then push out an updated theme.
Patch included in version 2.05
This patch has been included in the latest theme release. More information can be found here.