$this->target_file_path = ( isset( $opt['target_file_path'] ) ) ? $opt['target_file_path'] : false;
$this->upload_session_key = ( isset( $opt['upload_session_key'] ) ) ? $opt['upload_session_key'] : false;
$this->headers_only = ( isset( $opt['headers_only'] ) ) ? $opt['headers_only'] : false;
- $this->do_close_session_update = ( isset( $opt['do_close_session_update'] ) ) ? $opt['do_close_session_update'] : false;
+ $this->do_close_session_update = ( isset( $opt['do_close_session_update'] ) ) ? true : false;
}
/**
// set the write back function (if we are writing to a file)
if( $this->target_file_path ){
- $cwrite = new simpleFileWriter( $this->target_file_path, $this->upload_session_key );
+ $cwrite = new simpleFileWriter( $this->target_file_path, $this->upload_session_key, $this->do_close_session_update );
if( !$cwrite->status->isOK() ){
wfDebug( __METHOD__ . "ERROR in setting up simpleFileWriter\n" );
$status = $cwrite->status;
}
// if more than session_update_interval second have passed update_session_progress
- if( $this->do_close_session_update &&
- $this->upload_session_key && ( ( time() - $this->prevTime ) > $this->session_update_interval ) ) {
- $this->prevTime = time();
- $session_status = $this->update_session_progress();
- if( !$session_status->isOK() ){
- $this->status = $session_status;
- wfDebug( __METHOD__ . ' update session failed or was canceled');
- return 0;
- }
+ if( $this->do_close_session_update && $this->upload_session_key &&
+ ( ( time() - $this->prevTime ) > $this->session_update_interval ) ) {
+ $this->prevTime = time();
+ $session_status = $this->update_session_progress();
+ if( !$session_status->isOK() ){
+ $this->status = $session_status;
+ wfDebug( __METHOD__ . ' update session failed or was canceled');
+ return 0;
+ }
}
return strlen( $data_packet );
}
$this->dieUsageMsg( $this->mUpload->status['error'] );
} else if( $this->mParams['internalhttpsession'] ){
- $sd = & $_SESSION['wsDownload'][$this->mParams['internalhttpsession']];
+ $sd = & $_SESSION['wsDownload'][ $this->mParams['internalhttpsession'] ];
+ wfDebug("InternalHTTP:: " . print_r($this->mParams, true));
// get the params from the init session:
$this->mUpload = new UploadFromFile();
array_flip( $imProp ),
$this->getResult() );
- wfDebug( "\n\n return result: " . print_r( $result, true ) );
-
return $result;
}
var httpUpConf ={
'url' : $j('#wpUploadFileURL').val(),
'filename' : $j('#wpDestFile').val(),
- 'comment' : $j('#wpUploadDescription').val(),
- 'ignorewarnings' : ($j('#wpIgnoreWarning').is(':checked')) ?'true':'false' ,
+ 'comment' : $j('#wpUploadDescription').val(),
'watch' : ($j('#wpWatchthis').is(':checked'))?'true':'false'
}
+ if( $j('#wpIgnoreWarning').is(':checked') ){
+ httpUpConf[ 'ignorewarnings'] = 'true';
+ }
//check for editToken
_this.etoken = $j("input[name='wpEditToken']").val();
_this.doHttpUpload( httpUpConf );
_this.warnings_sessionkey = apiRes.upload.warnings.sessionkey;
var bObj = {};
bObj[ gM('ignorewarning') ] = function() {
- js_error('todo: ignore warnings action ');
- };
+ //re-inciate the upload proccess
+ $j('#wpIgnoreWarning').attr('checked', true);
+ $j( '#mw-upload-form' ).submit();
+ };
+ bObj[ gM('return-to-form') ] = function(){
+ $j(this).dialog('close');
+ }
_this.updateProgressWin( gM('uploadwarning'), '<h3>' + gM('uploadwarning') + '</h3>' +wmsg + '<p>',bObj);
return false;
}
//not sure if we can do remote url uploads (so just do a local post)
js_log('got token for new page:' +editToken);
var postVars = {
- 'wpSourceType' :'web',
- 'wpUploadFileURL' : rObj.src,
- 'wpDestFile' : rObj.target_resource_title,
- 'wpUploadDescription' : $j('#rsd_import_ta').val(),
- 'wpWatchthis' : $j('#wpWatchthis').val(),
- 'wpUpload' : 'Upload file'
+ 'wpSourceType' :'web',
+ 'wpUploadFileURL' : rObj.src,
+ 'wpDestFile' : rObj.target_resource_title,
+ 'wpUploadDescription' : $j('#rsd_import_ta').val(),
+ 'wpWatchthis' : $j('#wpWatchthis').val(),
+ 'wpUpload' : 'Upload file'
}
//set to uploading:
$j('#rsd_resource_import').append('<div id="rsd_import_progress"'+