mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
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:
parent
3eaa025df4
commit
0c7d39e792
@ -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;
|
||||
}
|
@ -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');
|
||||
}
|
||||
|
||||
}
|
||||
?>
|
@ -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';
|
||||
}
|
||||
}
|
@ -1,10 +0,0 @@
|
||||
<div class="ProgressBar" id="$Name">
|
||||
<p class="text">
|
||||
$Title
|
||||
</p>
|
||||
<div class="BarHolder">
|
||||
<div class="Bar">
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
Loading…
Reference in New Issue
Block a user