summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 7b2e8ac)
raw | patch | inline | side by side (parent: 7b2e8ac)
author | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Fri, 21 May 2010 08:16:57 +0000 (08:16 +0000) | ||
committer | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Fri, 21 May 2010 08:16:57 +0000 (08:16 +0000) |
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@18608 594d385d-05f5-0310-b6e9-bd551577e9d8
gosa-core/html/include/gosa.js | patch | blob | history | |
gosa-core/ihtml/themes/default/framework.tpl | patch | blob | history |
index 862975fef8866350a8a55bdbe876b1e6ad9dd19f..25098d8057bc521163b8f7841c3e106eb73639a4 100644 (file)
/* Install event handlers */
Event.observe(window, 'resize', resizeHandler);
Event.observe(window, 'load', resizeHandler);
+Event.observe(window, 'load', initProgressPie);
Event.observe(window, 'keypress', keyHandler);
return false;
}
+function setProgressPie(context, percent)
+{
+ context.clearRect(0, 0, 22, 22);
+
+ var r = "FF";
+ var g = "FF";
+ var b = "FF";
+
+ // Fade yellow
+ if (percent > 50) {
+ d = 255 - parseInt((percent-50) * 255 / 50)
+ b = d.toString(16);
+ }
+
+ // Fade red
+ if (percent > 75) {
+ d = 255 - parseInt((percent-75) * 255 / 25)
+ g = d.toString(16);
+ }
+ context.strokeStyle = "#" + r + g + b
+ context.fillStyle = context.strokeStyle;
+
+ context.beginPath();
+ context.moveTo(11,11)
+ context.arc(11,11,8,-Math.PI/2,-Math.PI/2 + Math.PI*percent/50,true);
+ context.closePath();
+ context.fill();
+
+ context.moveTo(11,11)
+ context.beginPath();
+ context.arc(11,11,8,0,Math.PI*2,false);
+ context.closePath();
+ context.stroke();
+}
+
+function initProgressPie(){
+ var canvas = $('sTimeout');
+
+ // Check the element is in the DOM and the browser supports canvas
+ if(canvas && canvas.getContext) {
+ var percent = 0.01;
+ var context = canvas.getContext('2d');
+ setProgressPie(context, percent);
+
+ // Extract timeout and title string out out canvas.title
+ var data = canvas.title;
+ var timeout = data.replace(/\|.*$/,'');
+ var title = data.replace(/^.*\|/,'');
+ var interval = 1;
+ var time = 0;
+ setInterval(function() {
+
+ // Calculate percentage
+ percent+= (interval / timeout) * 100;
+
+ // Increase current time by interval
+ time += interval;
+
+ // Generate title
+ var minutes = parseInt((timeout-time) / 60 );
+ var seconds = '' + parseInt((timeout-time) % 60);
+ if(seconds.length == 1) seconds = '0' + seconds ;
+ minutes = minutes + ':' + seconds;
+
+ // Set new canval title
+ canvas.title= title.replace(/%d/ ,minutes);
+ setProgressPie(context, percent);
+
+ if (percent>99) percent= 99;
+ }, (interval * 1000));
+ }
+}
/* Scroll down the body frame */
function scrollDown2()
diff --git a/gosa-core/ihtml/themes/default/framework.tpl b/gosa-core/ihtml/themes/default/framework.tpl
index 0bf462501c624c1a1cb1aaa8ab26de7ed0e145b5..e7c8772fe9feb932e9c701e36a31c5751d712fc1 100644 (file)
</div>
</li>
<li class='right table-wrapper'>
- <div class='logged-in-label'>{$loggedin}</div>
+ <div class='logged-in-label'>{$loggedin}</div>
+ </li>
+ <li class='right table-wrapper'>
+ <div class='logout-label'>
+ <canvas id="sTimeout" width="22" height="22" title="{$sessionLifetime}|{t}Session expires in %d minutes{/t}"></canvas>
+ </div>
</li>
</ul>
</div>