diff --git a/install.py b/install.py index 087dd1b..26e3dc6 100755 --- a/install.py +++ b/install.py @@ -1,5 +1,5 @@ -#!/usr/bin/python3 -import re +#!/usr/bin/python + import os from os.path import join, abspath, basename, dirname @@ -45,14 +45,11 @@ os.symlink(basename(target), t) for root, folders, files in os.walk(join(base, 'scripts')): for f in files: - if f.endswith('.pyc'): - continue src = join(root, f) target = src.replace(base, '/srv/pandora') rel_src = os.path.relpath(src, dirname(target)) if os.path.exists(target) or os.path.islink(target): os.unlink(target) - print(rel_src, target) os.symlink(rel_src, target) if os.path.exists('__init__.py'): diff --git a/static/js/importDocumentsDialog.amp.js b/static/js/importDocumentsDialog.amp.js index 7f13620..fccd08c 100644 --- a/static/js/importDocumentsDialog.amp.js +++ b/static/js/importDocumentsDialog.amp.js @@ -2,7 +2,7 @@ pandora.ui.importDocumentsDialog = function() { - var dialogHeight = 128 + 16, + var dialogHeight = 100, dialogWidth = 512 + 16, formWidth = getFormWidth(), @@ -10,9 +10,8 @@ pandora.ui.importDocumentsDialog = function() { $content = Ox.Element(), value, $input = [ - Ox.Input({ - type: 'textarea', - height: 128, + Ox.TextArea({ + labelWidth: 96, width: 512 }).css({ margin: '8px' @@ -36,7 +35,7 @@ pandora.ui.importDocumentsDialog = function() { } }), $button = Ox.Button({ - disabled: false, + disabled: true, id: 'import', title: Ox._('Import URLs') }) @@ -74,16 +73,10 @@ pandora.ui.importDocumentsDialog = function() { pandora.api.importDocuments({ urls: urls }, function(result) { - Ox.Request.clearCache() if (result.data.taskId) { pandora.wait(result.data.taskId, function(result) { that.close(); - if (pandora.user.ui.section == 'documents' && !pandora.user.ui.document.length) { - pandora.$ui.list.reloadList() - } else { - pandora.URL.push('/documents/grid/created') - } - }) + } } else { that.options({content: 'Failed'}); } diff --git a/static/js/localInit.amp.js b/static/js/localInit.amp.js index b552335..f75dfee 100644 --- a/static/js/localInit.amp.js +++ b/static/js/localInit.amp.js @@ -27,7 +27,7 @@ pandora.localInit = function() { $item = Ox.MenuButton({ items: [ ].concat(pandora.user.level == 'admin' ? [ - ] : [], pandora.user.level == 'gurest' ? [] : [ + ] : [], [ {id: 'import_documents', title: 'Import Documents...'}, ]), style: 'rounded', @@ -37,7 +37,7 @@ pandora.localInit = function() { }).css(css).bindEvent({ click: function(data) { if (data.id == 'import_documents') { - pandora.ui.importDocumentsDialog().open(); + pandora.ui.importDocumentsDialog().open() } }, }), diff --git a/tasks.py b/tasks.py index a1984d7..1dd8a6f 100644 --- a/tasks.py +++ b/tasks.py @@ -8,6 +8,5 @@ base = os.path.dirname(__file__) @task(queue="encoding") def import_documents(urls): for url in urls: - url = url.strip() - if url and url.startswith('http'): + if url.startswith('http'): subprocess.call(['/srv/pandora/bin/python', os.path.join(base, 'add_website_as_pdf.py'), url]) diff --git a/views.py b/views.py index d142065..68d0ef7 100644 --- a/views.py +++ b/views.py @@ -2,15 +2,14 @@ from __future__ import division, print_function, absolute_import from oxdjango.decorators import login_required_json -from oxdjango.shortcuts import render_to_json_response, json_response +from oxdjango.shortcuts import render_to_json_response from oxdjango.api import actions from .tasks import import_documents @login_required_json def importDocuments(request, data): - response = json_response({}) - t = import_documents.delay(urls=data['urls']) + t = tasks.import_documents.delay(urls=data['urls']) response['data']['taskId'] = t.task_id return render_to_json_response(response) actions.register(importDocuments)