X-Git-Url: http://mmka.chem.univ.gda.pl/gitweb/?a=blobdiff_plain;f=qcg%2Ftemplates%2Fqcg%2Fgridftp.html;h=6bf6a5d3236517279537990c28d4fda1de9ec1ba;hb=368ebd66507c4d45cbc6e77cb3d45624172d0995;hp=7b2cd6513913aabf56774360f8badf3c104d27fd;hpb=0898eeafb0687d5cfb97f1b5038e665a7d01ec60;p=qcg-portal.git diff --git a/qcg/templates/qcg/gridftp.html b/qcg/templates/qcg/gridftp.html index 7b2cd65..6bf6a5d 100644 --- a/qcg/templates/qcg/gridftp.html +++ b/qcg/templates/qcg/gridftp.html @@ -1,107 +1,377 @@ {% 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'); + } + + 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(); + + if (conflictingName($this.find('#id_name').val(), $this)) + return; + + 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')); + }); - {% endblock extra_js %} +{% block title %}Zarządzanie plikami GridFTP{% endblock %} + {% block container %} -

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

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