69 lines
1.5 KiB
JavaScript
69 lines
1.5 KiB
JavaScript
(function (context, $) {
|
|
|
|
"use strict";
|
|
context.JK = context.JK || {};
|
|
context.JK.DeleteVideoConfirmDialog = function (app) {
|
|
var logger = context.JK.logger;
|
|
var rest = context.JK.Rest();
|
|
var recordingId = null;
|
|
var $dialog = null;
|
|
var $deleteFromDiskChkBox = null;
|
|
var $deleteBtn = null;
|
|
var deleting = false;
|
|
function resetForm() {
|
|
|
|
}
|
|
|
|
function beforeShow(args) {
|
|
|
|
recordingId = args.d1;
|
|
|
|
if(!recordingId) throw "recordingId must be specified";
|
|
|
|
$dialog.data('result', null);
|
|
deleting = false;
|
|
|
|
}
|
|
|
|
function afterHide() {
|
|
|
|
}
|
|
|
|
function attemptDelete() {
|
|
if(deleting) return;
|
|
|
|
deleting = true;
|
|
|
|
rest.deleteRecordingVideoData(recordingId)
|
|
.done(function(){
|
|
$dialog.data('result', true);
|
|
app.layout.closeDialog('delete-video-confirm-dialog');
|
|
})
|
|
.fail(app.ajaxError)
|
|
}
|
|
|
|
function events() {
|
|
$deleteBtn.click(attemptDelete);
|
|
}
|
|
|
|
|
|
function initialize() {
|
|
var dialogBindings = {
|
|
'beforeShow': beforeShow,
|
|
'afterHide': afterHide
|
|
};
|
|
|
|
app.bindDialog('delete-video-confirm-dialog', dialogBindings);
|
|
|
|
$dialog = $('#deleteVideoConfirmDialog');
|
|
$deleteFromDiskChkBox = $dialog.find('.delete-from-disk');
|
|
$deleteBtn = $dialog.find('.delete-btn');
|
|
|
|
events();
|
|
|
|
context.JK.checkbox($deleteFromDiskChkBox);
|
|
};
|
|
|
|
this.initialize = initialize;
|
|
}
|
|
})(window, jQuery); |