|
|
|
|
@ -1,8 +1,4 @@ |
|
|
|
|
<?php |
|
|
|
|
/** |
|
|
|
|
* Xajax action to handle the real progress bar for an upload |
|
|
|
|
* @author Eric Marguin |
|
|
|
|
*/ |
|
|
|
|
|
|
|
|
|
include("../global.inc.php"); |
|
|
|
|
require_once api_get_path(LIBRARY_PATH).'xajax/xajax.inc.php'; |
|
|
|
|
@ -15,13 +11,20 @@ $xajax_upload -> processRequests(); |
|
|
|
|
* @param div_id where the progress bar is displayed |
|
|
|
|
* @param upload_id the identifier given in the field UPLOAD_IDENTIFIER |
|
|
|
|
*/ |
|
|
|
|
function updateProgress($div_id, $upload_id){ |
|
|
|
|
function updateProgress($div_id, $upload_id, $waitAfterupload=false){ |
|
|
|
|
|
|
|
|
|
$objResponse = new XajaxResponse(); |
|
|
|
|
$objResponse = new XajaxResponse(); |
|
|
|
|
$ul_info = uploadprogress_get_info($upload_id); |
|
|
|
|
$percent = intval($ul_info['bytes_uploaded']*100/$ul_info['bytes_total']); |
|
|
|
|
$objResponse -> addAssign($div_id.'_label' , 'innerHTML', get_lang('Uploading').' : '.$percent.' %'); |
|
|
|
|
$objResponse -> addAssign($div_id.'_filled' , 'style.width', $percent.'%'); |
|
|
|
|
if($waitAfterupload && $ul_info['est_sec']<5) { |
|
|
|
|
$objResponse -> addAssign($div_id.'_frame','innerHTML','<img src="'.api_get_path(WEB_CODE_PATH).'img/progress_bar.gif" />'); |
|
|
|
|
$objResponse -> addAssign($div_id.'_label','innerHTML',get_lang('ProcessingDatas')); |
|
|
|
|
$objResponse -> addScript('clearInterval("myUpload.__progress_bar_interval")'); |
|
|
|
|
} |
|
|
|
|
else { |
|
|
|
|
$objResponse -> addAssign($div_id.'_label' , 'innerHTML', get_lang('Uploading').' : '.$percent.' %'); |
|
|
|
|
$objResponse -> addAssign($div_id.'_filled' , 'style.width', $percent.'%'); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return $objResponse; |
|
|
|
|
|