|
|
|
@ -26,6 +26,7 @@ config = configparser.ConfigParser()
|
|
|
|
|
config.read('config.ini')
|
|
|
|
|
config = config['DEFAULT']
|
|
|
|
|
|
|
|
|
|
SERVER_NAME = config['SERVER_NAME']
|
|
|
|
|
MAIL_HOST = config['MAIL_HOST']
|
|
|
|
|
MAIL_LOGIN = config['MAIL_LOGIN']
|
|
|
|
|
MAIL_PASS = config['MAIL_PASS']
|
|
|
|
@ -47,6 +48,8 @@ if not UPLOADS_DIR.exists:
|
|
|
|
|
UPLOADS_DIR.mkdir(parents=True)
|
|
|
|
|
|
|
|
|
|
# Override configs with environment variables, if set
|
|
|
|
|
if 'PORTALDS4DS1_SERVER_NAME' in os.environ:
|
|
|
|
|
SERVER_NAME = os.environ['PORTALDS4DS1_SERVER_NAME']
|
|
|
|
|
if 'PORTALDS4DS1_MAIL_HOST' in os.environ:
|
|
|
|
|
MAIL_HOST = os.environ['PORTALDS4DS1_MAIL_HOST']
|
|
|
|
|
if 'PORTALDS4DS1_MAIL_LOGIN' in os.environ:
|
|
|
|
@ -80,6 +83,7 @@ if 'PORTALDS4DS1_SQL_CONN_STR' in os.environ:
|
|
|
|
|
app = Flask(__name__)
|
|
|
|
|
|
|
|
|
|
app.config.update(
|
|
|
|
|
SERVER_NAME = SERVER_NAME,
|
|
|
|
|
SECRET_KEY = APP_SECRET_KEY,
|
|
|
|
|
UPLOADED_PATH = UPLOADS_DIR,
|
|
|
|
|
MAX_CONTENT_LENGTH = MAX_UPLOAD_SIZE,
|
|
|
|
@ -99,6 +103,7 @@ manager.add_command('db', MigrateCommand)
|
|
|
|
|
dropzone = Dropzone(app)
|
|
|
|
|
|
|
|
|
|
upload_handler_solar = portal.solar.UploadHandlerSolar(
|
|
|
|
|
SERVER_NAME = SERVER_NAME,
|
|
|
|
|
UPLOADS_DIR=UPLOADS_DIR,
|
|
|
|
|
MAIL_HOST=MAIL_HOST,
|
|
|
|
|
MAIL_LOGIN=MAIL_LOGIN,
|
|
|
|
@ -305,8 +310,6 @@ def solar(text):
|
|
|
|
|
show_upload_form = True
|
|
|
|
|
contract_school = portal.solar.get_institution_contract(current_user_institution.id)
|
|
|
|
|
cooperation_history = portal.solar.get_institution_cooperation_history(current_user_institution.id)
|
|
|
|
|
logging.info('TEEEEEEEEEEEEEEEEEEEEEEEsst')
|
|
|
|
|
logging.info(cooperation_history[0].name)
|
|
|
|
|
if portal.solar.is_institution_coordinator(current_user_obj.id, current_user_institution.id):
|
|
|
|
|
contracts_students = portal.solar.get_institution_student_contracts(current_user_institution.id)
|
|
|
|
|
enable_upload_school_contract = True
|
|
|
|
@ -461,10 +464,16 @@ def solar_topuploads():
|
|
|
|
|
return jsonify(portal.solar.get_top_uploading_institutions())
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@app.route('/topuploads-by-user')
|
|
|
|
|
@app.route('/topuploads-institution/<institution_id>')
|
|
|
|
|
@login_required
|
|
|
|
|
def solar_topuploads_by_user():
|
|
|
|
|
return jsonify(portal.solar.get_top_uploading_users())
|
|
|
|
|
def solar_topuploads_institution(institution_id):
|
|
|
|
|
return jsonify(portal.solar.get_top_uploading_users(institution_id))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@app.route('/uploadstats-institution/<institution_id>')
|
|
|
|
|
@login_required
|
|
|
|
|
def solar_uploadstats_institution(institution_id):
|
|
|
|
|
return jsonify(portal.solar.get_institution_upload_stats(institution_id))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@app.route('/deluser', methods=['POST'])
|
|
|
|
|