API CHANGE Moved ProgressBar and support files to newsletter/trunk module, as this is the module where it's used

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@62309 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
Sean Harvey 2008-09-12 03:22:20 +00:00
parent 3eaa025df4
commit 0c7d39e792
4 changed files with 0 additions and 105 deletions

View File

@ -1,23 +0,0 @@
div.ProgressBar {
text-align: center;
display: none;
}
div.ProgressBar p.text {
text-align: center;
margin-left: auto;
margin-right: auto;
}
div.ProgressBar div.BarHolder {
width: 100%;
border: solid 1px #777;
background-color: #FFF;
padding: 2px;
text-align: left;
}
div.ProgressBar div.BarHolder div.Bar {
width: 0%;
background-color: #0074C6;
}

View File

@ -1,19 +0,0 @@
<?php
/**
* Displays a progress bar in a form.
* These are currently only linked to Batch Processes.
* @see BatchProcess
* @package forms
* @subpackage fields-dataless
*/
class ProgressBar extends FormField {
function FieldHolder() {
Requirements::javascript('sapphire/javascript/ProgressBar.js');
Requirements::css('sapphire/css/ProgressBar.css');
return $this->renderWith('ProgressBar');
}
}
?>

View File

@ -1,53 +0,0 @@
/**
* Create a progress bar that can be updated clientside
*
*/
ProgressBar = Class.create();
ProgressBar.applyTo('div.ProgressBar');
ProgressBar.prototype = {
initialize: function() {
this.statusText = this.getElementsByTagName('p')[0];
this.progressBar = this.getElementsByTagName('div')[0].getElementsByTagName('div')[0];
this.progress = 0;
this.startTime = 0;
this.lastProgressUpdate = 0;
this.defaultText = this.statusText.innerHTML;
this.defaultDisplay = this.style.display;
},
setProgress: function( progress ) {
this.progress = progress;
this.progressBar.style.width = '' + parseInt( progress ) + '%';
this.progressBar.width = '' + parseInt( progress ) + '%';
var now = new Date();
this.lastProgressUpdate = now.getTime();
},
setText: function( text ) {
this.statusText.innerHTML = text;
},
reset: function() {
this.setProgress(0);
this.setText( this.defaultText );
this.style.display = this.defaultDisplay;
},
estimateTime: function() {
var time = ( this.lastProgressUpdate - this.startTime ) * ( ( 100 - this.progress ) / this.progress );
if( time < 60000 )
return Math.round( time / 1000 ) + ' seconds';
if( time < 3600000 )
return Math.round( time / 60000 ) + ' minutes';
return Math.round( time / 3600000 ) + ' hours';
},
start: function() {
var now = new Date();
this.startTime = now.getTime();
this.style.display = 'block';
}
}

View File

@ -1,10 +0,0 @@
<div class="ProgressBar" id="$Name">
<p class="text">
$Title
</p>
<div class="BarHolder">
<div class="Bar">
&nbsp;
</div>
</div>
</div>