mirror of
https://github.com/ZoneMinder/zoneminder.git
synced 2026-10-25 15:58:24 -04:00
1 parent
a6a2239e5b
commit
547e80b1a9
5 files changed
+36
-16
No files matched your search
+12
-4
@@ -101,11 +101,19 @@ if ( canView('Events') ) {
|
||||
if ( $exportFile = exportEvents(
|
||||
$exportIds,
|
||||
(isset($_REQUEST['connkey'])?$_REQUEST['connkey']:''),
|
||||
false,false, false,
|
||||
$exportVideo, false, $exportFormat, $exportStructure ) )
|
||||
ajaxResponse(array('exportFile'=>$exportFile));
|
||||
else
|
||||
false,#detail
|
||||
false,#frames
|
||||
false,#images
|
||||
$exportVideo,
|
||||
false,#Misc
|
||||
$exportFormat,
|
||||
false#,#Compress
|
||||
#$exportStructure
|
||||
) ) {
|
||||
ajaxResponse(array('exportFile'=>$exportFile,'exportFormat'=>$exportFormat, 'connkey'=>(isset($_REQUEST['connkey'])?$_REQUEST['connkey']:'')));
|
||||
} else {
|
||||
ajaxError('Export Failed');
|
||||
}
|
||||
break;
|
||||
}
|
||||
} // end if canView('Events')
|
||||
|
||||
@@ -26,7 +26,7 @@ if ( !canView('Events') ) {
|
||||
$total_size = 0;
|
||||
if ( isset($_SESSION['montageReviewFilter']) and !isset($_REQUEST['eids']) ) {
|
||||
# Handles montageReview filter
|
||||
$eventsSql = 'SELECT E.Id,E.DiskSpace FROM Events as E WHERE 1';
|
||||
$eventsSql = 'SELECT E.Id, E.DiskSpace FROM Events AS E WHERE 1';
|
||||
$eventsSql .= $_SESSION['montageReviewFilter']['sql'];
|
||||
$results = dbQuery($eventsSql);
|
||||
$eids = [];
|
||||
@@ -48,17 +48,16 @@ if ( isset($_SESSION['montageReviewFilter']) and !isset($_REQUEST['eids']) ) {
|
||||
$exportFormat = '';
|
||||
if ( isset($_REQUEST['exportFormat']) ) {
|
||||
if ( !in_array($_REQUEST['exportFormat'], array('zip', 'tar')) ) {
|
||||
ZM\Error('Invalid exportFormat');
|
||||
return;
|
||||
ZM\Error('Invalid exportFormat: '.$_REQUEST['exportFormat']);
|
||||
} else {
|
||||
$exportFormat = $_REQUEST['exportFormat'];
|
||||
}
|
||||
$exportFormat = $_REQUEST['exportFormat'];
|
||||
}
|
||||
|
||||
if ( !empty($_REQUEST['eid']) ) {
|
||||
$Event = new ZM\Event($_REQUEST['eid']);
|
||||
if ( !$Event->Id ) {
|
||||
Error('Invalid event id');
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -120,7 +119,8 @@ if ( !empty($_REQUEST['eid']) ) {
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<button type="button" id="exportButton" name="exportButton" value="GenerateDownload" onclick="exportEvent(this.form);">
|
||||
<button type="button" id="exportButton" name="exportButton" value="GenerateDownload">
|
||||
<!--data-on-click-this="exportEvent">-->
|
||||
<?php echo translate('GenerateDownload') ?>
|
||||
</button>
|
||||
</form>
|
||||
|
||||
@@ -11,6 +11,7 @@ function configureExportButton( element ) {
|
||||
}
|
||||
|
||||
function startDownload( exportFile ) {
|
||||
console.log("Starting download from " + exportFile);
|
||||
window.location.replace( exportFile );
|
||||
}
|
||||
|
||||
@@ -26,12 +27,21 @@ function exportProgress() {
|
||||
}
|
||||
|
||||
function exportResponse( respObj, respText ) {
|
||||
window.location.replace( thisUrl+'?view='+currentView+'&'+eidParm+'&exportFormat='+respObj.exportFormat+'&generated='+((respObj.result=='Ok')?1:0) );
|
||||
console.log(respObj);
|
||||
window.location.replace(
|
||||
thisUrl+'?view='+currentView+'&'+eidParm
|
||||
+'&exportFormat='+respObj.exportFormat
|
||||
+'&exportFile='+respObj.exportFile
|
||||
+'&generated='+((respObj.result=='Ok')?1:0)
|
||||
+'&connkey='+connkey
|
||||
);
|
||||
}
|
||||
|
||||
function exportEvent( form ) {
|
||||
function exportEvent( element ) {
|
||||
var form = element.form;
|
||||
var parms = 'view=request&request=event&action=download';
|
||||
parms += '&'+$(form).toQueryString();
|
||||
console.log(parms);
|
||||
var query = new Request.JSON( {url: thisUrl, method: 'post', data: parms, onSuccess: exportResponse} );
|
||||
query.send();
|
||||
$('exportProgress').removeClass( 'hidden' );
|
||||
@@ -46,7 +56,7 @@ function initPage() {
|
||||
startDownload.pass( exportFile ).delay( 1500 );
|
||||
}
|
||||
document.getElementById('exportButton').addEventListener("click", function onClick(evt) {
|
||||
exportEvent(this.form);
|
||||
exportEvent(this);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -14,6 +14,7 @@ var eidParm = 'eid=<?php echo validInt($_REQUEST['eid']) ?>';
|
||||
?>
|
||||
|
||||
var exportReady = <?php echo !empty($_REQUEST['generated'])?'true':'false' ?>;
|
||||
var exportFile = '?view=archive&type=<?php echo $exportFormat; ?>';
|
||||
var exportFile = '?view=archive&type=<?php echo $exportFormat; ?>&connkey=<?php echo $connkey; ?>';
|
||||
var connkey = '<?php echo $connkey ?>';
|
||||
|
||||
var exportProgressString = '<?php echo addslashes(translate('Exporting')) ?>';
|
||||
@@ -100,8 +100,9 @@ function downloadVideo( element ) {
|
||||
|
||||
function exportEvents( element ) {
|
||||
var form = element.form;
|
||||
form.attr('action', '?view=export');
|
||||
form[0].elements['view'].value='export';
|
||||
console.log(form);
|
||||
form.action = '?view=export';
|
||||
form.elements['view'].value='export';
|
||||
form.submit();
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user