' +
@@ -171,6 +171,12 @@ var support_actions = {
}
});
}
+ },
+ "Support.upload" : {
+ type: "single",
+ call: function() {
+ $upload_support_file.foundation("reveal", "open");
+ }
}
}
@@ -181,10 +187,17 @@ var support_buttons = {
text: '
',
alwaysActive: true
},
+ "Support.upload" : {
+ type: "action",
+ layout: "main",
+ text: ' '+tr("Upload a file"),
+ custom_classes: "only-right-info"
+ },
"Support.signout" : {
type: "action",
layout: "main",
- text: "Sign out of Commercial Support",
+ text: '',
+ tip: "Sign out of Commercial Support",
alwaysActive: true
},
"Support.create_dialog" : {
@@ -310,6 +323,105 @@ var support_tab = {
}
}
+function setup_upload_support_file_dialog() {
+ dialogs_context.append('');
+ $upload_support_file = $('#upload_support_file',dialogs_context);
+ var dialog = $upload_support_file;
+
+ dialog.html('\
+ \
+ \
+ ×\
+ ');
+
+ dialog.addClass("reveal-modal").attr("data-reveal", "");
+ $vnc_dialog.foundation();
+
+ var uploader = new Resumable({
+ target: '/upload_chunk',
+ chunkSize: 10*1024*1024,
+ maxFiles: 1,
+ testChunks: false,
+ query: {
+ csrftoken: csrftoken
+ }
+ });
+
+ uploader.assignBrowse($('#support_file-uploader-input'));
+
+ var fileName = '';
+ var file_input = false;
+
+ uploader.on('fileAdded', function(file){
+ $(".upload_support_file_form_button").removeAttr("disabled");
+ fileName = file.fileName;
+ file_input = fileName;
+ });
+
+ uploader.on('uploadStart', function() {
+ $(".upload_support_file_form_button").attr("disabled", "disabled");
+ $('.support_upload_progress_bars').append('\
+
\
+ '+tr("Uploading...")+'\
+
\
+
\
+
\
+ \
+
\
+
'+fileName+'
\
+
\
+
');
+ });
+
+ uploader.on('progress', function() {
+ $('span.meter', $('div[id="'+fileName+'progressBar"]')).css('width', uploader.progress()*100.0+'%')
+ });
+
+ uploader.on('fileSuccess', function(file) {
+ $('div[id="'+fileName+'-info"]').text(tr('Registering in OpenNebula'));
+ $.ajax({
+ url: '/support/request/' + $("#submit_support_comment").data("request_id") + '/upload',
+ type: "POST",
+ data: {
+ csrftoken: csrftoken,
+ file: fileName,
+ tempfile: file.uniqueIdentifier
+ },
+ success: function(){
+ notifyMessage("File uploaded correctly");
+ $('div[id="'+fileName+'progressBar"]').remove();
+ Sunstone.runAction("Support.refresh");
+ $upload_support_file.foundation('reveal', 'close');
+ },
+ error: function(response){
+ onError({}, OpenNebula.Error(response));
+ $('div[id="'+fileName+'progressBar"]').remove();
+ }
+ });
+ });
+
+ $("#upload_support_file_form").on("submit", function(){
+ uploader.upload();
+ $upload_support_file.foundation("reveal", "close")
+ return false;
+ })
+}
+
function initialize_create_support_request_dialog() {
$('#create_support_request_form_wizard').foundation();
@@ -428,6 +540,11 @@ function updateSupportInfo(request, response){
})
}
+ html += '';
+
html += '