X-Git-Url: http://mmka.chem.univ.gda.pl/gitweb/?a=blobdiff_plain;f=qcg%2Ftemplates%2Fqcg%2Fgridftp.html;h=5e3e7a81bbb4c8bf7aba99e14fd3210ff61161b9;hb=a0feb25389615e9d2ab2b036a491a1aeeb059a52;hp=7b2cd6513913aabf56774360f8badf3c104d27fd;hpb=0898eeafb0687d5cfb97f1b5038e665a7d01ec60;p=qcg-portal.git diff --git a/qcg/templates/qcg/gridftp.html b/qcg/templates/qcg/gridftp.html index 7b2cd65..5e3e7a8 100644 --- a/qcg/templates/qcg/gridftp.html +++ b/qcg/templates/qcg/gridftp.html @@ -1,107 +1,350 @@ {% extends 'qcg/base.html' %} -{% load staticfiles %} +{% load staticfiles bootstrap3 %} {% block extra_css %} {% endblock %} {% block extra_js %} - - - - + + + {% include 'filex/source.js.html' %} - + $('#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') }), + dirs = _.map(selected.directory || [], function (item) { return item.get('name') }), + files = _.map(selected.file || [], function (item) { return item.get('name') }), + data = { + host: filex.host, + path: filex.path.full() + '/', + 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) { + $('
    ', {text: keys[i]}).appendTo($errorList); + $('
    ', {text: response.fail[keys[i]]}).appendTo($errorList); + } + + $errorModal.modal(); + filex.idle(); + } + else { + status('Usuwanie zakończone pomyślnie'); + } + + if (response.done.length) + filex.reloadFiles(); + + }, 'json').fail(failModal('Nie udało się usunąć plików')); + + $confirmModal.modal('hide'); + }); + + $confirmModal.modal(); + }); + + $('#mkdir-form').on('submit', function(e) { + var $this = $(this); + + e.preventDefault(); + filex.busy(); + $this.modal('hide'); + + $this.find('#id_host').val(filex.host); + $this.find('#id_path').val(filex.path.full()); + + $.post($this.attr('action'), $this.serialize(), function() { + status('Katalog utworzono pomyślnie'); + filex.reloadFiles(); + }, 'json').fail(failModal('Nie udało się utworzyć katalogu')); + }); + + $('#rename-form').on('show.bs.modal', function() { + var $this = $(this); + + var file = filex.selectedFiles()[0]; + + $this.find('#id_host').val(filex.host); + $this.find('#id_path').val(filex.path.full()); + $this.find('#id_src').val(file.get('name')); + $this.find('#id_dst').val(file.get('name')); + }).on('submit', function(e) { + var $this = $(this); + + e.preventDefault(); + filex.busy(); + $this.modal('hide'); + + $.post($this.attr('action'), $this.serialize(), function() { + status('Nazwę zmieniono pomyślnie'); + filex.reloadFiles(); + }, 'json').fail(failModal('Nie udało się zmienić nazwy')); + }); - {% endblock extra_js %} +{% block title %}Zarządzanie plikami GridFTP{% endblock %} + {% block container %} -

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

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