diff --git a/.gitignore b/.gitignore index f412dfcb2..8562b9a52 100755 --- a/.gitignore +++ b/.gitignore @@ -14,7 +14,6 @@ Virtualenviroment/ env/ build/ develop-eggs/ -dist/ downloads/ eggs/ .eggs/ diff --git a/profapp/__init__.py b/profapp/__init__.py index 36999f865..400d3ecf3 100755 --- a/profapp/__init__.py +++ b/profapp/__init__.py @@ -1,6 +1,7 @@ #from .db import db from flask import Flask -from profapp.controllers.views import article_bp, index , filemanager_bp +from profapp.controllers.views import article_bp, index, filemanager_bp +from profapp.controllers.ctrl_filemanager import static_bp #from profapp import views def create_app(config='config.ProductionDevelopmentConfig'): @@ -9,7 +10,7 @@ def create_app(config='config.ProductionDevelopmentConfig'): #db.init_app(app) app.add_url_rule('/', 'index', index) - + app.register_blueprint(static_bp,url_prefix='/static') app.register_blueprint(article_bp, url_prefix='/articles') app.register_blueprint(filemanager_bp, url_prefix='/filemanager') return app diff --git a/profapp/controllers/ctrl_filemanager.py b/profapp/controllers/ctrl_filemanager.py new file mode 100644 index 000000000..f2033e328 --- /dev/null +++ b/profapp/controllers/ctrl_filemanager.py @@ -0,0 +1,36 @@ +import os +from time import gmtime, strftime +from stat import * +from flask import jsonify, request, Blueprint + +files = os.listdir('/home/viktor/Downloads') +static_bp = Blueprint('static', __name__) + +@static_bp.route('/filemanager/bridges/python/ctrl_filemanager.py', methods=['GET', 'POST']) +def ctrl_filemanager(): + for params in request.json.values(): + if params['mode'] == 'list': + print(listing()) + return jsonify(listing()) + + + +def listing(): + + info = [] + for file in files: + st = os.stat('/home/viktor/Downloads/'+file) + params = dict() + params['size'] = st[ST_SIZE] + params['date'] = strftime("%Y-%d-%m %X", gmtime(st[ST_MTIME])) + params['name'] = os.path.basename(file) + params['rights'] = 'drwxr-xr-x' + if os.path.isfile('/home/viktor/Downloads/'+file): + params['type'] = 'file' + else : + params['type'] = 'dir' + info.append(params) + file_list = {"result": info} + return file_list + + diff --git a/profapp/controllers/views.py b/profapp/controllers/views.py index 2fe43062a..165437be7 100755 --- a/profapp/controllers/views.py +++ b/profapp/controllers/views.py @@ -1,23 +1,24 @@ -from flask import render_template, redirect, url_for, request +from flask import render_template, redirect, url_for, request, jsonify from profapp.controllers.forms import ArticleForm from profapp.models.articles import Article, ArticleHistory from profapp.models.users import User from profapp.models.company import Company from db_connect import sql_session #from config import POSTS_PER_PAGE - +import os from flask import Blueprint article_bp = Blueprint('articles', __name__) filemanager_bp = Blueprint('filemanager', __name__) + #filemanager_bp = Blueprint('filemanager', __name__,static_folder='../static',static_url_path='') -@article_bp.route('/article/', methods=['GET','POST']) +@article_bp.route('/article/', methods=['GET', 'POST']) @article_bp.route('/article/', methods=['GET', 'POST']) def article(page=1): form = ArticleForm() - posts = ArticleHistory.query.filter(ArticleHistory.id==page) + posts = ArticleHistory.query.filter(ArticleHistory.id == page) if form.validate_on_submit(): article_history=ArticleHistory(form.name.data,form.article.data, 0, @@ -46,7 +47,7 @@ def article(page=1): def index(): return render_template('index.html') -@filemanager_bp.route('/',methods=['GET','POST']) +@filemanager_bp.route('/', methods=['GET', 'POST']) def filemanager(): #return filemanager_bp.send_static_file('index.html') return render_template('filemanager.html') diff --git a/profapp/static/angular-filemanager/.bower.json b/profapp/static/angular-filemanager/.bower.json deleted file mode 100644 index 36fe33094..000000000 --- a/profapp/static/angular-filemanager/.bower.json +++ /dev/null @@ -1,38 +0,0 @@ -{ - "name": "angular-filemanager", - "version": "1.0.0", - "homepage": "https://github.com/joni2back/angular-filemanager", - "authors": [ - "Jonas Sciangula Street " - ], - "description": "A very smart filemanager to manage your files in the browser.", - "main": "js/app.js", - "keywords": [ - "filemanager" - ], - "license": "MIT", - "ignore": [ - "**/.*", - "node_modules", - "bower_components", - "test", - "tests" - ], - "dependencies": { - "angular": "~1.3.15", - "angular-translate": "~2.4.0", - "angular-cookies": "~1.3.17", - "bootstrap": "~3.3.2", - "jquery": "~2.1.3" - }, - "_release": "1.0.0", - "_resolution": { - "type": "version", - "tag": "1.0.0", - "commit": "21bbcc6f778f76b401e22eeb882a3609d85e8f04" - }, - "_source": "git://github.com/joni2back/angular-filemanager.git", - "_target": "~1.0.0", - "_originalSource": "angular-filemanager", - "_direct": true -} \ No newline at end of file diff --git a/profapp/static/angular-filemanager/assets/js/config.js b/profapp/static/angular-filemanager/assets/js/config.js deleted file mode 100644 index 75521f8e5..000000000 --- a/profapp/static/angular-filemanager/assets/js/config.js +++ /dev/null @@ -1,39 +0,0 @@ -(function(angular) { - "use strict"; - angular.module('FileManagerApp').constant("fileManagerConfig", { - appName: "https://github.com/joni2back/angular-filemanager", - defaultLang: "en", - - listUrl: "/angular-filemanager/bridges/python/ctrl_filemanager.py", - uploadUrl: "/angular-filemanager/bridges/python/ctrl_filemanager.py", - renameUrl: "/angular-filemanager/bridges/python/ctrl_filemanager.py", - copyUrl: "/angular-filemanager/bridges/python/ctrl_filemanager.py", - removeUrl: "/angular-filemanager/bridges/python/ctrl_filemanager.py", - editUrl: "/angular-filemanager/bridges/python/ctrl_filemanager.py", - getContentUrl: "/angular-filemanager/bridges/python/ctrl_filemanager.py", - createFolderUrl: "/angular-filemanager/bridges/python/ctrl_filemanager.py", - downloadFileUrl: "/angular-filemanager/bridges/python/ctrl_filemanager.py", - compressUrl: "/angular-filemanager/bridges/python/ctrl_filemanager.py", - extractUrl: "/angular-filemanager/bridges/python/ctrl_filemanager.py", - permissionsUrl: "/angular-filemanager/bridges/python/ctrl_filemanager.py", - - allowedActions: { - rename: true, - copy: true, - edit: true, - changePermissions: true, - compress: true, - compressChooseName: true, - extract: true, - download: true, - preview: true, - remove: true - }, - - enablePermissionsRecursive: true, - - isEditableFilePattern: '\\.(txt|html|htm|aspx|asp|ini|pl|py|md|php|css|js|log|htaccess|htpasswd|json|sql|xml|xslt|sh|rb|as|bat|cmd|coffee|php[3-6]|java|c|cbl|go|h|scala|vb)$', - isImageFilePattern: '\\.(jpg|jpeg|gif|bmp|png|svg|tiff)$', - isExtractableFilePattern: '\\.(zip|gz|tar|rar|gzip)$' - }); -})(angular); diff --git a/profapp/static/angular-filemanager/bridges/pyhon/ctrl_filemanager.py b/profapp/static/angular-filemanager/bridges/pyhon/ctrl_filemanager.py deleted file mode 100644 index bb4b235fb..000000000 --- a/profapp/static/angular-filemanager/bridges/pyhon/ctrl_filemanager.py +++ /dev/null @@ -1,4 +0,0 @@ -from profapp.controllers.views import filemanager_bp -@filemanager_bp.route('/',methods=['GET','POST']) -def filemanager(): - return filemanager_bp.send_static_file('index.html') \ No newline at end of file diff --git a/profapp/static/angular-filemanager/API.md b/profapp/static/filemanager/API.md similarity index 100% rename from profapp/static/angular-filemanager/API.md rename to profapp/static/filemanager/API.md diff --git a/profapp/static/angular-filemanager/LICENSE b/profapp/static/filemanager/LICENSE similarity index 100% rename from profapp/static/angular-filemanager/LICENSE rename to profapp/static/filemanager/LICENSE diff --git a/profapp/static/angular-filemanager/README.md b/profapp/static/filemanager/README.md similarity index 100% rename from profapp/static/angular-filemanager/README.md rename to profapp/static/filemanager/README.md diff --git a/profapp/static/filemanager/__init__.py b/profapp/static/filemanager/__init__.py new file mode 100644 index 000000000..064286bdb --- /dev/null +++ b/profapp/static/filemanager/__init__.py @@ -0,0 +1 @@ +__author__ = 'viktor' diff --git a/profapp/static/angular-filemanager/angular-filemanager-mobile.png b/profapp/static/filemanager/angular-filemanager-mobile.png similarity index 100% rename from profapp/static/angular-filemanager/angular-filemanager-mobile.png rename to profapp/static/filemanager/angular-filemanager-mobile.png diff --git a/profapp/static/angular-filemanager/angular-filemanager.png b/profapp/static/filemanager/angular-filemanager.png similarity index 100% rename from profapp/static/angular-filemanager/angular-filemanager.png rename to profapp/static/filemanager/angular-filemanager.png diff --git a/profapp/static/angular-filemanager/assets/css/angular-filemanager.css b/profapp/static/filemanager/assets/css/angular-filemanager.css similarity index 100% rename from profapp/static/angular-filemanager/assets/css/angular-filemanager.css rename to profapp/static/filemanager/assets/css/angular-filemanager.css diff --git a/profapp/static/angular-filemanager/assets/ext/angular-cookies.min.js b/profapp/static/filemanager/assets/ext/angular-cookies.min.js similarity index 100% rename from profapp/static/angular-filemanager/assets/ext/angular-cookies.min.js rename to profapp/static/filemanager/assets/ext/angular-cookies.min.js diff --git a/profapp/static/angular-filemanager/assets/ext/angular-translate.min.js b/profapp/static/filemanager/assets/ext/angular-translate.min.js similarity index 100% rename from profapp/static/angular-filemanager/assets/ext/angular-translate.min.js rename to profapp/static/filemanager/assets/ext/angular-translate.min.js diff --git a/profapp/static/angular-filemanager/assets/ext/angular.min.js b/profapp/static/filemanager/assets/ext/angular.min.js similarity index 100% rename from profapp/static/angular-filemanager/assets/ext/angular.min.js rename to profapp/static/filemanager/assets/ext/angular.min.js diff --git a/profapp/static/angular-filemanager/assets/ext/bootstrap.min.js b/profapp/static/filemanager/assets/ext/bootstrap.min.js similarity index 100% rename from profapp/static/angular-filemanager/assets/ext/bootstrap.min.js rename to profapp/static/filemanager/assets/ext/bootstrap.min.js diff --git a/profapp/static/angular-filemanager/assets/ext/jquery.min.js b/profapp/static/filemanager/assets/ext/jquery.min.js similarity index 100% rename from profapp/static/angular-filemanager/assets/ext/jquery.min.js rename to profapp/static/filemanager/assets/ext/jquery.min.js diff --git a/profapp/static/angular-filemanager/assets/js/app.js b/profapp/static/filemanager/assets/js/app.js similarity index 100% rename from profapp/static/angular-filemanager/assets/js/app.js rename to profapp/static/filemanager/assets/js/app.js diff --git a/profapp/static/angular-filemanager/assets/js/chmod.js b/profapp/static/filemanager/assets/js/chmod.js similarity index 100% rename from profapp/static/angular-filemanager/assets/js/chmod.js rename to profapp/static/filemanager/assets/js/chmod.js diff --git a/profapp/static/filemanager/assets/js/config.js b/profapp/static/filemanager/assets/js/config.js new file mode 100644 index 000000000..adc1d9059 --- /dev/null +++ b/profapp/static/filemanager/assets/js/config.js @@ -0,0 +1,39 @@ +(function(angular) { + "use strict"; + angular.module('FileManagerApp').constant("fileManagerConfig", { + appName: "https://github.com/joni2back/angular-filemanager", + defaultLang: "en", + + listUrl: "/filemanager/bridges/python/ctrl_filemanager.py", + uploadUrl: "/filemanager/bridges/python/ctrl_filemanager.py", + renameUrl: "/filemanager/bridges/python/ctrl_filemanager.py", + copyUrl: "/filemanager/bridges/python/ctrl_filemanager.py", + removeUrl: "/filemanager/bridges/python/ctrl_filemanager.py", + editUrl: "/filemanager/bridges/python/ctrl_filemanager.py", + getContentUrl: "/filemanager/bridges/python/ctrl_filemanager.py", + createFolderUrl: "/filemanager/bridges/python/ctrl_filemanager.py", + downloadFileUrl: "/filemanager/bridges/python/ctrl_filemanager.py", + compressUrl: "/filemanager/bridges/python/ctrl_filemanager.py", + extractUrl: "/filemanager/bridges/python/ctrl_filemanager.py", + permissionsUrl: "/filemanager/bridges/python/ctrl_filemanager.py", + + allowedActions: { + rename: true, + copy: true, + edit: true, + changePermissions: true, + compress: true, + compressChooseName: true, + extract: true, + download: true, + preview: true, + remove: true + }, + + enablePermissionsRecursive: true, + + isEditableFilePattern: '\\.(txt|html|htm|aspx|asp|ini|pl|py|md|php|css|js|log|htaccess|htpasswd|json|sql|xml|xslt|sh|rb|as|bat|cmd|coffee|php[3-6]|java|c|cbl|go|h|scala|vb)$', + isImageFilePattern: '\\.(jpg|jpeg|gif|bmp|png|svg|tiff)$', + isExtractableFilePattern: '\\.(zip|gz|tar|rar|gzip)$' + }); +})(angular); diff --git a/profapp/static/angular-filemanager/assets/js/controller.js b/profapp/static/filemanager/assets/js/controller.js similarity index 100% rename from profapp/static/angular-filemanager/assets/js/controller.js rename to profapp/static/filemanager/assets/js/controller.js diff --git a/profapp/static/angular-filemanager/assets/js/filenavigator.js b/profapp/static/filemanager/assets/js/filenavigator.js similarity index 99% rename from profapp/static/angular-filemanager/assets/js/filenavigator.js rename to profapp/static/filemanager/assets/js/filenavigator.js index 93d740e02..0f2ff77cf 100644 --- a/profapp/static/angular-filemanager/assets/js/filenavigator.js +++ b/profapp/static/filemanager/assets/js/filenavigator.js @@ -8,7 +8,7 @@ var FileNavigator = function() { this.requesting = false; this.fileList = []; - this.currentPath = []; + this.currentPath =[]; this.history = []; this.error = ''; }; diff --git a/profapp/static/angular-filemanager/assets/js/fileuploader.js b/profapp/static/filemanager/assets/js/fileuploader.js similarity index 100% rename from profapp/static/angular-filemanager/assets/js/fileuploader.js rename to profapp/static/filemanager/assets/js/fileuploader.js diff --git a/profapp/static/angular-filemanager/assets/js/item.js b/profapp/static/filemanager/assets/js/item.js similarity index 100% rename from profapp/static/angular-filemanager/assets/js/item.js rename to profapp/static/filemanager/assets/js/item.js diff --git a/profapp/static/angular-filemanager/assets/js/selector-controller.js b/profapp/static/filemanager/assets/js/selector-controller.js similarity index 100% rename from profapp/static/angular-filemanager/assets/js/selector-controller.js rename to profapp/static/filemanager/assets/js/selector-controller.js diff --git a/profapp/static/angular-filemanager/assets/js/translations.js b/profapp/static/filemanager/assets/js/translations.js similarity index 100% rename from profapp/static/angular-filemanager/assets/js/translations.js rename to profapp/static/filemanager/assets/js/translations.js diff --git a/profapp/static/angular-filemanager/assets/templates/current-folder-breadcrumb.html b/profapp/static/filemanager/assets/templates/current-folder-breadcrumb.html similarity index 100% rename from profapp/static/angular-filemanager/assets/templates/current-folder-breadcrumb.html rename to profapp/static/filemanager/assets/templates/current-folder-breadcrumb.html diff --git a/profapp/static/angular-filemanager/assets/templates/index.html b/profapp/static/filemanager/assets/templates/index.html similarity index 100% rename from profapp/static/angular-filemanager/assets/templates/index.html rename to profapp/static/filemanager/assets/templates/index.html diff --git a/profapp/static/angular-filemanager/assets/templates/item-context-menu.html b/profapp/static/filemanager/assets/templates/item-context-menu.html similarity index 100% rename from profapp/static/angular-filemanager/assets/templates/item-context-menu.html rename to profapp/static/filemanager/assets/templates/item-context-menu.html diff --git a/profapp/static/angular-filemanager/assets/templates/item-toolbar.html b/profapp/static/filemanager/assets/templates/item-toolbar.html similarity index 100% rename from profapp/static/angular-filemanager/assets/templates/item-toolbar.html rename to profapp/static/filemanager/assets/templates/item-toolbar.html diff --git a/profapp/static/angular-filemanager/assets/templates/main-icons.html b/profapp/static/filemanager/assets/templates/main-icons.html similarity index 100% rename from profapp/static/angular-filemanager/assets/templates/main-icons.html rename to profapp/static/filemanager/assets/templates/main-icons.html diff --git a/profapp/static/angular-filemanager/assets/templates/main-table-modal.html b/profapp/static/filemanager/assets/templates/main-table-modal.html similarity index 100% rename from profapp/static/angular-filemanager/assets/templates/main-table-modal.html rename to profapp/static/filemanager/assets/templates/main-table-modal.html diff --git a/profapp/static/angular-filemanager/assets/templates/main-table.html b/profapp/static/filemanager/assets/templates/main-table.html similarity index 100% rename from profapp/static/angular-filemanager/assets/templates/main-table.html rename to profapp/static/filemanager/assets/templates/main-table.html diff --git a/profapp/static/angular-filemanager/assets/templates/modals.html b/profapp/static/filemanager/assets/templates/modals.html similarity index 100% rename from profapp/static/angular-filemanager/assets/templates/modals.html rename to profapp/static/filemanager/assets/templates/modals.html diff --git a/profapp/static/angular-filemanager/assets/templates/navbar.html b/profapp/static/filemanager/assets/templates/navbar.html similarity index 100% rename from profapp/static/angular-filemanager/assets/templates/navbar.html rename to profapp/static/filemanager/assets/templates/navbar.html diff --git a/profapp/static/angular-filemanager/assets/templates/sidebar.html b/profapp/static/filemanager/assets/templates/sidebar.html similarity index 100% rename from profapp/static/angular-filemanager/assets/templates/sidebar.html rename to profapp/static/filemanager/assets/templates/sidebar.html diff --git a/profapp/static/angular-filemanager/bower.json b/profapp/static/filemanager/bower.json similarity index 100% rename from profapp/static/angular-filemanager/bower.json rename to profapp/static/filemanager/bower.json diff --git a/profapp/static/filemanager/bridges/__init__.py b/profapp/static/filemanager/bridges/__init__.py new file mode 100644 index 000000000..064286bdb --- /dev/null +++ b/profapp/static/filemanager/bridges/__init__.py @@ -0,0 +1 @@ +__author__ = 'viktor' diff --git a/profapp/static/angular-filemanager/bridges/java/AngularFileManagerServlet.java b/profapp/static/filemanager/bridges/java/AngularFileManagerServlet.java similarity index 100% rename from profapp/static/angular-filemanager/bridges/java/AngularFileManagerServlet.java rename to profapp/static/filemanager/bridges/java/AngularFileManagerServlet.java diff --git a/profapp/static/angular-filemanager/bridges/php/handler.php b/profapp/static/filemanager/bridges/php/handler.php similarity index 100% rename from profapp/static/angular-filemanager/bridges/php/handler.php rename to profapp/static/filemanager/bridges/php/handler.php diff --git a/profapp/static/filemanager/bridges/pyhon/__init__.py b/profapp/static/filemanager/bridges/pyhon/__init__.py new file mode 100644 index 000000000..064286bdb --- /dev/null +++ b/profapp/static/filemanager/bridges/pyhon/__init__.py @@ -0,0 +1 @@ +__author__ = 'viktor' diff --git a/profapp/static/filemanager/bridges/pyhon/ctrl_filemanager.py b/profapp/static/filemanager/bridges/pyhon/ctrl_filemanager.py new file mode 100644 index 000000000..e69de29bb diff --git a/profapp/static/angular-filemanager/build.sh b/profapp/static/filemanager/build.sh similarity index 100% rename from profapp/static/angular-filemanager/build.sh rename to profapp/static/filemanager/build.sh diff --git a/profapp/static/filemanager/dist/angular-filemanager.css b/profapp/static/filemanager/dist/angular-filemanager.css new file mode 100644 index 000000000..2fc5f21f3 --- /dev/null +++ b/profapp/static/filemanager/dist/angular-filemanager.css @@ -0,0 +1,5 @@ +/*! + * Angular FileManager v1.0.1 (https://github.com/joni2back/angular-filemanager) + * Jonas Sciangula Street + * Licensed under MIT (https://github.com/joni2back/angular-filemanager/blob/master/LICENSE) + */.detail-sources,.modal{word-wrap:break-word}.detail-sources,.ellipsis{overflow:hidden;text-overflow:ellipsis}body{padding-top:50px;font-size:13px}textarea.code{font-family:Menlo,Monaco,Consolas,"Courier New",monospace;font-size:13px;min-height:250px;resize:vertical;color:#000}.modal .label.error-msg{display:block;font-size:12px;padding:5px;margin-top:10px;text-align:left}*{outline:0!important}div,span{cursor:default}a,a *,a:focus,a:focus *,a:hover,a:hover *{cursor:pointer;text-decoration:none}.btn,.dropdown-menu,.input-sm,.modal .modal-content,.panel,.panel-heading,input,select,textarea{border-radius:0!important}.bold{font-weight:700}.mb0{margin-bottom:0}.sub-header{padding-bottom:10px;border-bottom:1px solid #eee}.navbar-fixed-top{border:0}.sidebar{display:none}@media (min-width:768px){.sidebar{position:fixed;top:51px;bottom:0;left:0;z-index:1000;display:block;padding:5px 0;overflow-x:hidden;overflow-y:auto;background-color:#f5f5f5;border-right:1px solid #eee}}@media (max-width:768px){.navbar-form .btn{margin-top:5px}}.nav-sidebar{margin-right:-21px;margin-bottom:20px;margin-left:-20px}.nav-sidebar>li>a{padding-right:20px;padding-left:20px}.nav-sidebar>.active>a,.nav-sidebar>.active>a:focus,.nav-sidebar>.active>a:hover{color:#fff;background-color:#428bca}.main{padding:0}@media (min-width:768px){.main{padding-right:0;padding-left:0}}.main .page-header{margin-top:0}.file-tree ul.nav.nav-sidebar{margin:0;padding:0 0 0 12px}.file-tree ul.nav.nav-sidebar>li{border-left:1px solid #ddd;padding-left:4px}.file-tree ul.nav.nav-sidebar>li>a{padding:2px 2px 2px 4px}.file-tree ul.nav.nav-sidebar:first-child{padding-left:0}.file-tree .file-tree-root>li{border-left:none!important;padding-left:0!important}.mr2{margin-right:2px}.mr5{margin-right:5px}.table-files td{padding:3px 8px!important;vertical-align:middle!important}#context-menu{position:absolute;display:none;z-index:9999}.iconset{padding:10px}.col-120{width:100px;max-height:100px;float:left;margin-bottom:9px;margin-right:9px}.col-120:last-child{margin-right:0}.iconset .thumbnail{border-radius:0;overflow:hidden;margin:0;padding:10px 0}.iconset .thumbnail .item-icon{font-size:32px}.modal-fullscreen .modal-content,.modal-fullscreen .modal-dialog{bottom:0;left:0;position:absolute;right:0;top:0}.modal-fullscreen .modal-dialog{margin:0;width:100%}.modal-fullscreen .modal-content{border:none;-moz-border-radius:0;border-radius:0;-webkit-box-shadow:inherit;-moz-box-shadow:inherit;-o-box-shadow:inherit;box-shadow:inherit}.modal-fullscreen textarea.code{min-height:450px}.animated{-webkit-animation-duration:.7s;animation-duration:.7s;-webkit-animation-fill-mode:both;animation-fill-mode:both}.animated.fast,.modal.animated{-webkit-animation-duration:.2s;animation-duration:.2s}@-webkit-keyframes fadeIn{0%{opacity:0}100%{opacity:1}}@keyframes fadeIn{0%{opacity:0}100%{opacity:1}}@-webkit-keyframes fadeInDown{0%{opacity:0;-webkit-transform:translate3d(0,-100%,0);transform:translate3d(0,-100%,0)}100%{opacity:1;-webkit-transform:none;transform:none}}@keyframes fadeInDown{0%{opacity:0;-webkit-transform:translate3d(0,-100%,0);transform:translate3d(0,-100%,0)}100%{opacity:1;-webkit-transform:none;transform:none}}.fadeInDown{-webkit-animation-name:fadeInDown;animation-name:fadeInDown}.fadeIn{-webkit-animation-name:fadeIn;animation-name:fadeIn}.mt10{margin-top:10px}.pointer{cursor:pointer}.block{display:block}.ellipsis{white-space:nowrap}::-webkit-scrollbar{width:10px;height:10px;background-color:#fff;box-shadow:inset 1px 1px 0 rgba(0,0,0,.1),inset -1px -1px 0 rgba(0,0,0,.07)}::-webkit-scrollbar:hover{background-color:#eee}::-webkit-scrollbar-thumb{min-height:.8em;min-width:.8em;background-color:rgba(0,0,0,.2);box-shadow:inset 1px 1px 0 rgba(0,0,0,.1),inset -1px -1px 0 rgba(0,0,0,.07)}::-webkit-scrollbar-thumb:hover{background-color:#bbb}::-webkit-scrollbar-thumb:active{background-color:#888}.dropdown-menu.dropdown-right-click{display:block;position:static;margin-bottom:5px;font-size:1em}.dropdown-menu.dropdown-right-click>li>a{padding:5px 12px}.dropdown-menu.dropdown-right-click>li>a>i{font-size:.9em;margin-right:1px}.dropdown-menu.dropdown-right-click .divider{margin:3px 0} \ No newline at end of file diff --git a/profapp/static/filemanager/dist/angular-filemanager.min.js b/profapp/static/filemanager/dist/angular-filemanager.min.js new file mode 100644 index 000000000..0f0cb60f1 --- /dev/null +++ b/profapp/static/filemanager/dist/angular-filemanager.min.js @@ -0,0 +1 @@ +!function(e,r,o){"use strict";var t=r.module("FileManagerApp",["pascalprecht.translate","ngCookies"]);t.directive("angularFileManager",["$parse","fileManagerConfig",function(e,r){return{restrict:"EA",templateUrl:r.tplPath+"/index.html"}}]),t.directive("ngFile",["$parse",function(e){return{restrict:"A",link:function(r,o,t){var n=e(t.ngFile),i=n.assign;o.bind("change",function(){r.$apply(function(){i(r,o[0].files)})})}}}]),t.directive("ngRightClick",["$parse",function(e){return function(r,o,t){var n=e(t.ngRightClick);o.bind("contextmenu",function(e){r.$apply(function(){e.preventDefault(),n(r,{$event:e})})})}}]),t.filter("strLimit",["$filter",function(e){return function(r,o){return r.length<=o?r:e("limitTo")(r,o)+"..."}}]);var n=".main-navigation .table-files td a, .iconset a.thumbnail";o(e.document).on("shown.bs.modal",".modal",function(){var e=this,r=setTimeout(function(){o("[autofocus]",e).focus(),r&&clearTimeout(r)},100)}),o(e.document).on("click",function(){o("#context-menu").hide()}),o(e.document).on("contextmenu",n,function(e){o("#context-menu").hide().css({left:e.pageX,top:e.pageY}).show(),e.preventDefault()})}(window,angular,jQuery),function(e){"use strict";e.module("FileManagerApp").service("chmod",function(){var e=function(e){if(this.owner=this.getRwxObj(),this.group=this.getRwxObj(),this.others=this.getRwxObj(),e){var r=isNaN(e)?this.convertfromCode(e):this.convertfromOctal(e);if(!r)throw new Error("Invalid input data");this.owner=r.owner,this.group=r.group,this.others=r.others}};return e.prototype.toOctal=function(e,r){var o=["owner","group","others"],t=[];for(var n in o){var i=o[n];t[n]=this[i].read&&this.octalValues.read||0,t[n]+=this[i].write&&this.octalValues.write||0,t[n]+=this[i].exec&&this.octalValues.exec||0}return(e||"")+t.join("")+(r||"")},e.prototype.toCode=function(e,r){var o=["owner","group","others"],t=[];for(var n in o){var i=o[n];t[n]=this[i].read&&this.codeValues.read||"-",t[n]+=this[i].write&&this.codeValues.write||"-",t[n]+=this[i].exec&&this.codeValues.exec||"-"}return(e||"")+t.join("")+(r||"")},e.prototype.getRwxObj=function(){return{read:!1,write:!1,exec:!1}},e.prototype.octalValues={read:4,write:2,exec:1},e.prototype.codeValues={read:"r",write:"w",exec:"x"},e.prototype.convertfromCode=function(e){if(e=(""+e).replace(/\s/g,""),e=10===e.length?e.substr(1):e,/^[-rwx]{9}$/.test(e)){var r=[],o=e.match(/.{1,3}/g);for(var t in o){var n=this.getRwxObj();n.read=/r/.test(o[t]),n.write=/w/.test(o[t]),n.exec=/x/.test(o[t]),r.push(n)}return{owner:r[0],group:r[1],others:r[2]}}},e.prototype.convertfromOctal=function(e){if(e=(""+e).replace(/\s/g,""),e=4===e.length?e.substr(1):e,/^[0-7]{3}$/.test(e)){var r=[],o=e.match(/.{1}/g);for(var t in o){var n=this.getRwxObj();n.read=/[4567]/.test(o[t]),n.write=/[2367]/.test(o[t]),n.exec=/[1357]/.test(o[t]),r.push(n)}return{owner:r[0],group:r[1],others:r[2]}}},e})}(angular),function(e){"use strict";e.module("FileManagerApp").constant("fileManagerConfig",{appName:"https://github.com/joni2back/filemanager",defaultLang:"en",listUrl:"../static/filemanager/bridges/python/ctrl_filemanager.py",uploadUrl:"../static/filemanager/bridges/python/ctrl_filemanager.py",renameUrl:"../static/filemanager/bridges/python/ctrl_filemanager.py",copyUrl:"../static/filemanager/bridges/python/ctrl_filemanager.py",removeUrl:"../static/filemanager/bridges/python/ctrl_filemanager.py",editUrl:"../static/filemanager/bridges/python/ctrl_filemanager.py",getContentUrl:"../static/filemanager/bridges/python/ctrl_filemanager.py",createFolderUrl:"../static/filemanager/bridges/python/ctrl_filemanager.py",downloadFileUrl:"../static/filemanager/bridges/python/ctrl_filemanager.py",compressUrl:"../static/filemanager/bridges/python/ctrl_filemanager.py",extractUrl:"../static/filemanager/bridges/python/ctrl_filemanager.py",permissionsUrl:"../static/filemanager/bridges/python/ctrl_filemanager.py",allowedActions:{rename:!0,copy:!0,edit:!0,changePermissions:!0,compress:!0,compressChooseName:!0,extract:!0,download:!0,preview:!0,remove:!0},enablePermissionsRecursive:!0,isEditableFilePattern:/\.(txt|html?|aspx?|ini|pl|py|md|css|js|log|htaccess|htpasswd|json|sql|xml|xslt?|sh|rb|as|bat|cmd|coffee|php[3-6]?|java|c|cbl|go|h|scala|vb)$/i,isImageFilePattern:/\.(jpe?g|gif|bmp|png|svg|tiff?)$/i,isExtractableFilePattern:/\.(gz|tar|rar|g?zip)$/i,tplPath:"assets/templates"})}(angular),function(e,r,o){"use strict";r.module("FileManagerApp").controller("FileManagerCtrl",["$scope","$translate","$cookies","fileManagerConfig","item","fileNavigator","fileUploader",function(r,t,n,i,a,s,l){r.config=i,r.appName=i.appName,r.orderProp=["model.type","model.name"],r.query="",r.temp=new a,r.fileNavigator=new s,r.fileUploader=l,r.uploadFileList=[],r.viewTemplate=n.viewTemplate||"main-table.html",r.setTemplate=function(e){r.viewTemplate=n.viewTemplate=e},r.changeLanguage=function(e){return e?t.use(n.language=e):void t.use(n.language||i.defaultLang)},r.touch=function(e){e=e&&e.revert&&e||new a,e.revert&&e.revert(),r.temp=e},r.smartRightClick=function(e){r.touch(e)},r.smartClick=function(e){return e.isFolder()?r.fileNavigator.folderClick(e):e.isImage()?e.preview():e.isEditable()?(e.getContent(),r.touch(e),void o("#edit").modal("show")):void 0},r.edit=function(e){e.edit(function(){o("#edit").modal("hide")})},r.changePermissions=function(e){e.changePermissions(function(){o("#changepermissions").modal("hide")})},r.copy=function(e){var n=e.tempModel.path.join()===e.model.path.join();return n&&r.fileNavigator.fileNameExists(e.tempModel.name)?(e.error=t.instant("error_invalid_filename"),!1):void e.copy(function(){r.fileNavigator.refresh(),o("#copy").modal("hide")})},r.compress=function(e){e.compress(function(){e.success=!0,r.fileNavigator.refresh()},function(){e.success=!1})},r.extract=function(e){e.extract(function(){e.success=!0,r.fileNavigator.refresh()},function(){e.success=!1})},r.remove=function(e){e.remove(function(){r.fileNavigator.refresh(),o("#delete").modal("hide")})},r.rename=function(e){var n=e.tempModel.path.join()===e.model.path.join();return n&&r.fileNavigator.fileNameExists(e.tempModel.name)?(e.error=t.instant("error_invalid_filename"),!1):void e.rename(function(){r.fileNavigator.refresh(),o("#rename").modal("hide")})},r.createFolder=function(e){var n=e.tempModel.name&&e.tempModel.name.trim();return e.tempModel.type="dir",e.tempModel.path=r.fileNavigator.currentPath,!n||r.fileNavigator.fileNameExists(n)?(r.temp.error=t.instant("error_invalid_filename"),!1):void e.createFolder(function(){r.fileNavigator.refresh(),o("#newfolder").modal("hide")})},r.uploadFiles=function(){r.fileUploader.upload(r.uploadFileList,r.fileNavigator.currentPath).success(function(){r.fileNavigator.refresh(),o("#uploadfile").modal("hide")}).error(function(e){var o=e.result&&e.result.error||t.instant("error_uploading_files");r.temp.error=o})},r.getQueryParam=function(r){var o;return e.location.search.substr(1).split("&").forEach(function(e){r===e.split("=")[0]&&(o=e.split("=")[1])}),o},r.changeLanguage(r.getQueryParam("lang")),r.isWindows="Windows"===r.getQueryParam("server"),r.fileNavigator.refresh()}])}(window,angular,jQuery),function(e){"use strict";e.module("FileManagerApp").service("fileNavigator",["$http","fileManagerConfig","item",function(r,o,t){r.defaults.headers.common["X-Requested-With"]="XMLHttpRequest";var n=function(){this.requesting=!1,this.fileList=[],this.currentPath=[],this.history=[],this.error=""};return n.prototype.refresh=function(n,i){var a=this,s=a.currentPath.join("/"),l={params:{mode:"list",onlyFolders:!1,path:"/home/viktor/Downloads"+s}};a.requesting=!0,a.fileList=[],a.error="",r.post(o.listUrl,l).success(function(r){return a.fileList=[],e.forEach(r.result,function(e){a.fileList.push(new t(e,a.currentPath))}),a.requesting=!1,a.buildTree(s),r.error?(a.error=r.error,"function"==typeof i&&i(r)):void("function"==typeof n&&n(r))}).error(function(e){a.requesting=!1,"function"==typeof i&&i(e)})},n.prototype.buildTree=function(e){function r(e,o,t){var n=t?t+"/"+o.name:o.name;if(e.name.trim()&&0!==t.trim().indexOf(e.name)&&(e.nodes=[]),e.name!==t)for(var i in e.nodes)r(e.nodes[i],o,t);else{for(var a in e.nodes)if(e.nodes[a].name===n)return;e.nodes.push({name:n,nodes:[]})}e.nodes=e.nodes.sort(function(e,r){return e.name\n
  • \n \n \n \n
  • \n
  • \n \n {{dir}}\n \n {{dir}}\n
  • \n
  • \n"); +$templateCache.put("assets/templates/index.html","
    \n
    \n\n
    \n
    \n\n
    \n
    \n
    \n
    \n
    \n
    \n
    \n\n
    \n
    \n
    "); +$templateCache.put("assets/templates/item-context-menu.html",""); +$templateCache.put("assets/templates/item-toolbar.html","
    \n \n \n \n \n \n \n \n \n \n
    \n
    \n {{\"wait\" | translate}} ...\n
    "); +$templateCache.put("assets/templates/main-icons.html","
    \n \n
    \n {{\"loading\" | translate}}...\n
    \n
    \n {{\"no_files_in_folder\" | translate}}...\n
    \n
    \n {{ fileNavigator.error }}\n
    \n
    "); +$templateCache.put("assets/templates/main-table-modal.html","\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n
    {{\"name\" | translate}}{{\"date\" | translate}}{{\"actions\" | translate}}
    \n {{\"loading\" | translate}}...\n
    \n {{\"no_folders_in_folder\" | translate}}...\n \n \n
    \n {{ fileNavigator.error }}\n
    \n \n \n {{item.model.name | strLimit : 32}}\n \n \n {{item.model.date.toString()}}\n \n \n
    "); +$templateCache.put("assets/templates/main-table.html","\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n
    {{\"name\" | translate}}{{\"size\" | translate}}{{\"date\" | translate}}{{\"permissions\" | translate}}{{\"actions\" | translate}}
    \n {{\"loading\" | translate}}...\n
    \n {{\"no_files_in_folder\" | translate}}...\n
    \n {{ fileNavigator.error }}\n
    \n \n \n \n {{item.model.name | strLimit : 64}}\n \n \n {{item.model.sizeKb()}}kb\n \n {{item.model.date.toString()}}\n \n {{item.model.perms.toCode(item.model.type === \'dir\'?\'d\':\'-\')}}\n \n
    \n
    "); +$templateCache.put("assets/templates/modals.html","
    \n
    \n
    \n
    \n
    \n \n

    {{\"confirm\" | translate}}

    \n
    \n
    \n {{\'sure_to_delete\' | translate}} {{temp.model.name}} ?\n
    \n
    \n
    \n \n \n
    \n
    \n
    \n
    \n
    \n\n
    \n
    \n
    \n
    \n
    \n \n

    {{\'change_name_move\' | translate}}

    \n
    \n
    \n \n \n\n
    \n
    \n
    \n
    \n \n \n
    \n
    \n
    \n
    \n
    \n\n
    \n
    \n
    \n
    \n
    \n \n

    {{\'copy_file\' | translate}}

    \n
    \n
    \n \n \n\n
    \n
    \n
    \n
    \n \n \n
    \n
    \n
    \n
    \n
    \n\n
    \n
    \n
    \n
    \n
    \n \n

    {{\'compress\' | translate}}

    \n
    \n
    \n
    \n
    {{\'compression_started\' | translate}}
    \n
    \n
    \n
    \n {{\'sure_to_start_compression_with\' | translate}} {{temp.model.name}} ?\n
    \n
    \n \n \n
    \n
    \n\n
    \n
    \n
    \n
    \n \n
    \n
    \n \n \n
    \n
    \n
    \n
    \n
    \n
    \n\n
    \n
    \n
    \n
    \n
    \n \n

    {{\'extract_item\' | translate}}

    \n
    \n
    \n
    \n
    {{\'extraction_started\' | translate}}
    \n
    \n
    \n \n \n
    \n
    \n
    \n
    \n
    \n
    \n \n
    \n
    \n \n \n
    \n
    \n
    \n
    \n
    \n
    \n\n
    \n
    \n
    \n
    \n
    \n \n \n

    {{\'edit_file\' | translate}}

    \n
    \n
    \n \n {{\'loading\' | translate}} ...\n \n
    \n
    \n
    \n \n \n
    \n
    \n
    \n
    \n
    \n\n
    \n
    \n
    \n
    \n
    \n \n

    {{\'create_folder\' | translate}}

    \n
    \n
    \n \n \n
    \n
    \n
    \n \n \n
    \n
    \n
    \n
    \n
    \n\n
    \n
    \n
    \n
    \n
    \n \n

    {{\"upload_file\" | translate}}

    \n
    \n
    \n \n \n
    \n
    \n
    \n
    \n \n \n
    \n
    \n {{\"uploading\" | translate}} ...\n
    \n
    \n
    \n
    \n
    \n
    \n\n
    \n
    \n
    \n
    \n
    \n \n

    {{\'change_permissions\' | translate}}

    \n
    \n
    \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n
    {{\'permissions\' | translate}}{{\'exec\' | translate}}{{\'read\' | translate}}{{\'write\' | translate}}
    {{permTypeKey | translate}}\n \n
    \n
    \n \n
    \n
    \n \n {{\'original\' | translate}}: {{temp.model.perms.toCode(temp.model.type === \'dir\'?\'d\':\'-\')}} ({{temp.model.perms.toOctal()}})\n \n \n {{\'changes\' | translate}}: {{temp.tempModel.perms.toCode(temp.model.type === \'dir\'?\'d\':\'-\')}} ({{temp.tempModel.perms.toOctal()}})\n \n
    \n
    \n
    \n
    \n \n \n
    \n
    \n
    \n
    \n
    \n\n
    \n
    \n
    \n
    \n \n

    {{\"select_destination_folder\" | translate}}

    \n
    \n
    \n
    \n
    \n
    \n
    \n
    \n
    \n \n
    \n
    \n
    \n
    \n\n\n\n"); +$templateCache.put("assets/templates/navbar.html",""); +$templateCache.put("assets/templates/sidebar.html","
      \n
    • \n
    \n\n");}]); \ No newline at end of file diff --git a/profapp/static/angular-filemanager/gulpfile.js b/profapp/static/filemanager/gulpfile.js similarity index 100% rename from profapp/static/angular-filemanager/gulpfile.js rename to profapp/static/filemanager/gulpfile.js diff --git a/profapp/static/angular-filemanager/index.html b/profapp/static/filemanager/index.html similarity index 100% rename from profapp/static/angular-filemanager/index.html rename to profapp/static/filemanager/index.html diff --git a/profapp/static/angular-filemanager/package.json b/profapp/static/filemanager/package.json similarity index 100% rename from profapp/static/angular-filemanager/package.json rename to profapp/static/filemanager/package.json diff --git a/profapp/templates/filemanager.html b/profapp/templates/filemanager.html index 237858350..949e2f760 100644 --- a/profapp/templates/filemanager.html +++ b/profapp/templates/filemanager.html @@ -9,11 +9,11 @@ angular-filemanager - - - - - + + + + + - - - + + + - + + diff --git a/profapp/templates/index.html b/profapp/templates/index.html index 982e28099..cea58a4f3 100755 --- a/profapp/templates/index.html +++ b/profapp/templates/index.html @@ -16,7 +16,7 @@ - + diff --git a/profapp/templates/index_[file_manager].html b/profapp/templates/index_[file_manager].html new file mode 100644 index 000000000..3b6408d29 --- /dev/null +++ b/profapp/templates/index_[file_manager].html @@ -0,0 +1,16 @@ + + + + + Profireader + Filemanager + + + + + + \ No newline at end of file diff --git a/run.py b/run.py index 96c593c6f..4bd8f8db6 100644 --- a/run.py +++ b/run.py @@ -2,4 +2,4 @@ if __name__ == '__main__': app = create_app() - app.run(host='127.13.4.5',port=8080) #app.run(debug=True) + app.run(host='127.40.71.100', port=8080) #app.run(debug=True)