X-Git-Url: http://mmka.chem.univ.gda.pl/gitweb/?a=blobdiff_plain;f=qcg%2Ftemplates%2Fqcg%2Fgridftp.html;h=e75e621d4c856cb0034d8d9fa5446df7b6f6e32c;hb=7e5bf1ffbcf2dd1d728102f531520258958602d2;hp=7b2cd6513913aabf56774360f8badf3c104d27fd;hpb=0898eeafb0687d5cfb97f1b5038e665a7d01ec60;p=qcg-portal.git diff --git a/qcg/templates/qcg/gridftp.html b/qcg/templates/qcg/gridftp.html index 7b2cd65..e75e621 100644 --- a/qcg/templates/qcg/gridftp.html +++ b/qcg/templates/qcg/gridftp.html @@ -1,107 +1,395 @@ {% extends 'qcg/base.html' %} -{% load staticfiles %} +{% load staticfiles bootstrap3 %} {% block extra_css %} + + {% endblock %} {% block extra_js %} - - - - + + + {% include 'filex/source.js.html' %} - + $('form').on('show.bs.modal', function() { + $(this).find('.alert').remove(); + this.reset(); + }).on('shown.bs.modal', function() { + $(this).find('input[type="text"]')[0].focus(); + }); - + $('#btn-upload').on('click', function() { + var url = '{% url 'gridftp_upload' %}?' + $.param({host: filex.host, path: filex.path.full()}); + + var win = window.open(url, url, 'height=500,width=800'); + win.focus(); + }); + + $('#btn-delete').on('click', function() { + var selected = _.groupBy(filex.selectedFiles(), function(item) { return item.get('type') }), + path = filex.path.full() + '/', + dirs = _.map(selected.directory || [], function (item) { return path + item.get('name') }), + files = _.map(selected.file || [], function (item) { return path + item.get('name') }), + data = { + host: filex.host, + dirs: dirs, + files: files + }, + $confirmModal = $('#confirm-modal'), + $confirmList = $confirmModal.find('ul').html(''); + + _.each(filex.selectedFiles(), function(item) { + $('
  • ', {text: item.get('name')}).appendTo($confirmList); + }); + + $('#btn-confirm').off().on('click', function() { + filex.busy(); + + $.post('{% url 'filex:delete' %}', data, function(response) { + var keys = Object.keys(response.fail); + + if (keys.length) { + var $errorModal = $('#error-modal'), + $errorBody = $errorModal.find('.modal-body') + .html($('

    ', {text: 'Wystąpiły problemy podczas usuwania:'})), + $errorList = $('
    ', {'class': 'dl-horizontal'}).appendTo($errorBody); + + $errorModal.find('#error-modal-label').text('Błąd'); + + for (var i in keys) { + if(keys.hasOwnProperty(i)) { + $('
    ', {text: keys[i].replace(path, '')}).appendTo($errorList); + $('
    ', {text: response.fail[keys[i]]}).appendTo($errorList); + } + } + + $errorModal.modal(); + filex.idle(); + } + else { + status('Usuwanie zakończone pomyślnie'); + } - {% endblock extra_js %} +{% block title %}Zarządzanie plikami GridFTP{% endblock %} + {% block container %} -

    {% block title %}Zarządzanie plikami GridFTP{% endblock %}

    - -
    -
    -
    -
    -
    - - -
    - + {% include 'filex/source.html' %} + + -
    - + -
    -
    - + - - - - - - - - - - -
    NazwaRozmiarData
    - -