diff --git a/app.db b/app.db index d1734623b4dd39f4992573f1e2ddfd7d1c1478de..0a7a1e2e1dbcbae3aead8584aa2ecce4834a8772 100644 Binary files a/app.db and b/app.db differ diff --git a/app/__init__.py b/app/__init__.py index b403534eb1983d0192a76211997ad207c43058a5..00098fcb58c7967e455d2427eeec1a96efcc1883 100644 --- a/app/__init__.py +++ b/app/__init__.py @@ -5,17 +5,64 @@ from flask_sqlalchemy import SQLAlchemy from flask_migrate import Migrate from flask_login import LoginManager from flask_babel import Babel +from flask import request +from flask import session +from flask import flash app = Flask(__name__) -app.config['BABEL_DEFAULT_LOCALE'] = 'en' +#app.config['BABEL_DEFAULT_LOCALE'] = 'fin' +#app.config['BABEL_TRANSLATION_DIRECTORIES'] ='C:/Users/Timo/git/pet-rating/app/translations' babel = Babel(app) +@babel.localeselector +def get_locale(): + if request.args.get('lang'): + + session['lang'] = request.args.get('lang') + + if session['lang'] == 'en': + session['language'] = 'English' + + if session['lang'] == 'fi': + session['language'] = 'Finnish' + + if session['lang'] == 'fa': + session['language'] = 'Persian' + + if session['lang'] == 'el': + session['language'] = 'Greek' + + if session['lang'] == 'it': + session['language'] = 'Italian' + + if session['lang'] == 'zh': + session['language'] = 'Chinese' + + + + return session.get('lang', 'en') + + + +""" +@babel.localeselector +def get_locale(): + if session: + + return 'fi' + + else: + + return 'en' +""" +""" @babel.localeselector def get_locale(): + return request.accept_languages.best_match(app.config['LANGUAGES']) +""" - return 'fin' #mariabd mysql portti 3306 tarkista? diff --git a/app/forms.py b/app/forms.py index cbfc28b4677e291c04e27fdaa3411b7b605348a0..4cf81189def89729ae45a56479eef1423a5baad6 100644 --- a/app/forms.py +++ b/app/forms.py @@ -5,8 +5,10 @@ from wtforms_sqlalchemy.fields import QuerySelectField from flask_bootstrap import Bootstrap from app.models import background_question from wtforms import Form, TextField, TextAreaField, SubmitField, FieldList, FormField -from wtforms import Form, BooleanField, StringField, PasswordField, validators, RadioField +from wtforms import Form, BooleanField, StringField, PasswordField, validators, RadioField, IntegerField from flask_wtf.file import FileField, FileAllowed, FileRequired +from flask_babel import _ +from flask_babel import lazy_gettext as _l class LoginForm(FlaskForm): @@ -31,13 +33,12 @@ class TaskForm(Form): class ContinueTaskForm(FlaskForm): participant_id = StringField('participant_id', validators=[DataRequired()]) - submit = SubmitField('Continue rating') - + submit = SubmitField( _l('Continue rating') ) class StartWithIdForm(FlaskForm): participant_id = StringField('participant_id', validators=[DataRequired()]) - submit = SubmitField('Start rating') + submit = SubmitField( _l('Start rating') ) class Questions(FlaskForm): @@ -80,7 +81,11 @@ class TestForm2(Form): class CreateExperimentForm(Form): name = StringField('Name', [validators.DataRequired()]) - instruction = StringField('Instruction', [validators.DataRequired()]) + creator_name = StringField('Creator_name', [validators.DataRequired()]) + single_sentence_instruction = StringField('Single_sentence_instruction', [validators.DataRequired()]) + short_instruction = TextAreaField('Short_instruction', [validators.DataRequired()]) + instruction = TextAreaField('Instruction', [validators.DataRequired()]) + consent_text = TextAreaField('Instruction', [validators.DataRequired()]) language = StringField('Language', [validators.DataRequired()]) submit = SubmitField('Send') @@ -88,10 +93,14 @@ class CreateExperimentForm(Form): class EditExperimentForm(Form): name = StringField('Name', [validators.DataRequired()]) - instruction = StringField('Instruction', [validators.DataRequired()]) + creator_name = StringField('Creator_name', [validators.DataRequired()]) + instruction = TextAreaField('Instruction', [validators.DataRequired()]) + consent_text = TextAreaField('Instruction', [validators.DataRequired()]) + short_instruction = TextAreaField('Short_instruction', [validators.DataRequired()]) + single_sentence_instruction = StringField('Single_sentece_instruction', [validators.DataRequired()]) language = SelectField('Language', choices=[ ('Afrikanns', 'Afrikanns'), ('Albanian', 'Albanian'), ('Arabic', 'Arabic'), ('Armenian', 'Armenian'), ('Basque', 'Basque'), ('Bengali', 'Bengali'), ('Bulgarian', 'Bulgarian'), - ('Catalan', 'Catalan'), ('Cambodian', 'Cambodian'), ('Chinese (Mandarin)', 'Chinese (Mandarin)'), ('Croation', 'Croation'), ('Czech', 'Czech'), ('Danish', 'Danish'), + ('Catalan', 'Catalan'), ('Cambodian', 'Cambodian'), ('Chinese', 'Chinese'), ('Croation', 'Croation'), ('Czech', 'Czech'), ('Danish', 'Danish'), ('Dutch', 'Dutch'), ('English', 'English'), ('Estonian', 'Estonian'), ('Fiji', 'Fiji'), ('Finnish', 'Finnish'), ('French', 'French'), ('Georgian', 'Georgian'), ('German', 'German'), ('Greek', 'Greek'), ('Gujarati', 'Gujarati'), ('Hebrew', 'Hebrew'), ('Hindi', 'Hindi'), ('Hungarian', 'Hungarian'), ('Icelandic', 'Icelandic'), ('Indonesian', 'Indonesian'), ('Irish', 'Irish'), ('Italian', 'Italian'), ('Japanese', 'Japanese'), ('Javanese', 'Javanese'), ('Korean', 'Korean'), ('Latin', 'Latin'), @@ -101,6 +110,9 @@ class EditExperimentForm(Form): ('Slovenian', 'Slovenian'), ('Spanish', 'Spanish'), ('Swahili', 'Swahili'), ('Swedish ', 'Swedish '), ('Tamil', 'Tamil'), ('Tatar', 'Tatar'), ('Telugu', 'Telugu'), ('Thai', 'Thai'), ('Tibetan', 'Tibetan'), ('Tonga', 'Tonga'), ('Turkish', 'Turkish'), ('Ukranian', 'Ukranian'), ('Urdu', 'Urdu'), ('Uzbek', 'Uzbek'), ('Vietnamese', 'Vietnamese'), ('Welsh', 'Welsh'), ('Xhosa', 'Xhosa')]) + stimulus_size = SelectField('Stimulus_size', choices=[ + ('1', '1'), ('2', '2'), ('3', '3'), ('4', '4'), ('5', '5'), ('6', '6'), ('7', '7'), ('8', '8'), ('9', '9'), ('10', '10'), ('11', '11'), ('12', '12')]) + submit = SubmitField('Send') @@ -137,6 +149,13 @@ class UploadStimuliForm(Form): media = TextAreaField('Media filename') file = FileField('Upload file') submit = SubmitField('Send') + + +class UploadResearchBulletinForm(Form): + + file = FileField('Upload file') + submit = SubmitField('Send') + class EditPageForm(Form): @@ -152,3 +171,9 @@ class RemoveExperimentForm(Form): remove = TextAreaField('Remove') submit = SubmitField('Send') +class GenerateIdForm(Form): + + number = IntegerField('number', [validators.DataRequired()]) + string = StringField('string', [validators.DataRequired()]) + submit = SubmitField('Submit') + diff --git a/app/messages.pot b/app/messages.pot deleted file mode 100644 index bcd5f63b6f1ff6a4f3ead642f9ecf3d8d90c68c2..0000000000000000000000000000000000000000 --- a/app/messages.pot +++ /dev/null @@ -1,19 +0,0 @@ -# Translations template for PROJECT. -# Copyright (C) 2018 ORGANIZATION -# This file is distributed under the same license as the PROJECT project. -# FIRST AUTHOR <EMAIL@ADDRESS>, 2018. -# -#, fuzzy -msgid "" -msgstr "" -"Project-Id-Version: PROJECT VERSION\n" -"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n" -"POT-Creation-Date: 2018-11-04 17:30+0200\n" -"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" -"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" -"Language-Team: LANGUAGE <LL@li.org>\n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=utf-8\n" -"Content-Transfer-Encoding: 8bit\n" -"Generated-By: Babel 2.6.0\n" - diff --git a/app/models.py b/app/models.py index 61159374b59868f79f535ebb49824e0ac94d030b..4686b9892d6de1494d21e4a67edf2440fce2dbc6 100644 --- a/app/models.py +++ b/app/models.py @@ -1,5 +1,5 @@ from app import db -from sqlalchemy import Column, Integer, String +from sqlalchemy import Column, Integer, String, Text from flask_sqlalchemy import SQLAlchemy from flask_wtf import FlaskForm from wtforms_sqlalchemy.fields import QuerySelectField, QuerySelectMultipleField @@ -7,6 +7,7 @@ from flask_bootstrap import Bootstrap from werkzeug.security import generate_password_hash, check_password_hash from flask_login import UserMixin from app import login +from datetime import datetime """DATABASE CLASSES""" @@ -38,14 +39,23 @@ class experiment (db.Model): __tablename__ = "experiment" idexperiment = db.Column(db.Integer, primary_key=True) name = db.Column(db.String(120), index=True) - instruction = db.Column(db.String(120), index=True) + instruction = db.Column(db.Text, index=True) directoryname = db.Column(db.String(120), index=True, unique=True) language = db.Column(db.String(120)) status = db.Column(db.String(120)) randomization = db.Column(db.String(120)) + short_instruction = db.Column(db.Text, index=True) + single_sentence_instruction = db.Column(db.Text, index=True) + is_archived = db.Column(db.String(120)) + creator_name = db.Column(db.String(120)) + research_notification_filename = db.Column(db.String(120)) + creation_time = db.Column(db.DateTime, index=True, default=datetime.utcnow) + stimulus_size = db.Column(db.String(120)) + consent_text = db.Column(db.Text, index=True) + use_forced_id = db.Column(db.String(120)) def __repr__(self): - return "<idexperiment = '%s', name='%s', instruction='%s', directoryname='%s', language='%s', status='%s', randomization='%s'>" % (self.idexperiment, self.name, self.instruction, self.directoryname, self.language, self.status, self.randomization) + return "<idexperiment = '%s', name='%s', instruction='%s', directoryname='%s', language='%s', status='%s', randomization='%s', short_instruction='%s', single_sentence_instruction='%s', is_archived='%s', creator_name='%s', research_notification_filename='%s', creation_time='%s', stimulus_size='%s', consent_text='%s', use_forced_id='%s'>" % (self.idexperiment, self.name, self.instruction, self.directoryname, self.language, self.status, self.randomization, self.short_instruction, self.single_sentence_instruction, self.is_archived, self.creator_name, self.research_notification_filename, self.creation_time, self.stimulus_size, self.consent_text, self.use_forced_id) class answer_set (db.Model): @@ -55,9 +65,11 @@ class answer_set (db.Model): session = db.Column(db.String(120)) agreement = db.Column(db.String(120)) answer_counter = db.Column(db.Integer) + registration_time = db.Column(db.DateTime, index=True, default=datetime.utcnow) + last_answer_time = db.Column(db.DateTime, index=True, default=datetime.utcnow) def __repr__(self): - return "<idanswer_set = '%s', experiment_idexperiment = '%s', session = '%s', agreement = '%s', answer_counter = '%s'>" % (self.idanswer_set, self.experiment_idexperiment, self.session, self.agreement, self.answer_counter) + return "<idanswer_set = '%s', experiment_idexperiment = '%s', session = '%s', agreement = '%s', answer_counter = '%s', registration_time = '%s', last_answer_time = '%s'>" % (self.idanswer_set, self.experiment_idexperiment, self.session, self.agreement, self.answer_counter, self.registration_time, self.last_answer_time) class background_question_answer(db.Model): @@ -148,6 +160,21 @@ class trial_randomization (db.Model): return "<idtrial_randomization = '%s', page_idpage = '%s', randomized_idpage = '%s', answer_set_idanswer_set = '%s', experiment_idexperiment = '%s'>" % (self.idtrial_randomization, self.page_idpage, self.randomized_idpage, self.answer_set_idanswer_set, self.experiment_idexperiment) +class forced_id (db.Model): + __tablename__ = "forced_id" + idforced_id = db.Column(db.Integer, primary_key=True) + experiment_idexperiment = db.Column(db.Integer, db.ForeignKey('experiment.idexperiment')) + pregenerated_id = db.Column(db.String(120)) + + def __repr__(self): + return "<idforced_id = '%s', experiment_idexperiment = '%s', pregenerated_id = '%s'>" % (self.idforced_id, self.experiment_idexperiment, self.pregenerated_id) + + + + + + + class user(UserMixin, db.Model): __tablename__ = "user" id = db.Column(db.Integer, primary_key=True) diff --git a/app/rating_tool.py b/app/rating_tool.py index 5223f6edafbda4b7f68fba8e62538ee43c6e5b48..05921815285c7c44ddd54f29d5dff536ff382e78 100644 --- a/app/rating_tool.py +++ b/app/rating_tool.py @@ -4,7 +4,7 @@ from app.models import experiment from app.models import answer_set from app.models import background_question_answer from app.models import question, page, answer -from app.models import user, trial_randomization +from app.models import user, trial_randomization, forced_id @@ -20,10 +20,12 @@ def make_shell_context(): 'page': page, 'answer': answer, 'user': user, - 'trial_randomization': trial_randomization + 'trial_randomization': trial_randomization, + 'forced_id': forced_id } + """ from app import app, db diff --git a/app/routes.py b/app/routes.py index 394a89eb1e0b29ca8547cee5d7f84d2093a9185f..991bb632620ee08df11e504c0950988f0d4c630c 100644 --- a/app/routes.py +++ b/app/routes.py @@ -4,7 +4,7 @@ from app.models import background_question, experiment from app.models import background_question_answer from app.models import page, question from app.models import background_question_option -from app.models import answer_set, answer +from app.models import answer_set, answer, forced_id from flask import session from app.forms import LoginForm, RegisterForm from flask import flash, redirect @@ -27,7 +27,7 @@ from flask_login import login_required from sqlalchemy import update from app.forms import StartWithIdForm import secrets -from app.forms import CreateExperimentForm, CreateBackgroundQuestionForm, CreateQuestionForm, UploadStimuliForm, EditBackgroundQuestionForm, EditQuestionForm, EditExperimentForm +from app.forms import CreateExperimentForm, CreateBackgroundQuestionForm, CreateQuestionForm, UploadStimuliForm, EditBackgroundQuestionForm, EditQuestionForm, EditExperimentForm, UploadResearchBulletinForm from app.forms import EditPageForm, RemoveExperimentForm import os import random @@ -40,8 +40,11 @@ from flask import send_file from flask import make_response from flask_babel import Babel from app import babel - - +from datetime import datetime +from app.forms import GenerateIdForm +import math +from flask_babel import _ +from flask_babel import lazy_gettext as _l #Stimuli upload folder setting APP_ROOT = os.path.dirname(os.path.abspath(__file__)) @@ -61,8 +64,8 @@ def index(): else: - flash("set lang") - session['language'] = "All" + #flash("sessio ei voimassa") + session['language'] = "English" return render_template('index.html', title='Home', experiments=experiments) @@ -70,8 +73,21 @@ def index(): @app.route('/consent') def consent(): exp_id = request.args.get('exp_id', None) - experiments = experiment.query.all() - return render_template('consent.html', exp_id=exp_id, experiments=experiments) + + experiment_info = experiment.query.filter_by(idexperiment=exp_id).first() + + + + + + if experiment_info.use_forced_id == 'On': + + return redirect(url_for('begin_with_id', exp_id=exp_id)) + + + + + return render_template('consent.html', exp_id=exp_id, experiment_info=experiment_info) @app.route('/set_language') @@ -79,10 +95,10 @@ def set_language(): session['language'] = request.args.get('language', None) + lang = request.args.get('lang', None) - - return redirect(url_for('index')) + return redirect(url_for('index', lang=lang)) @app.route('/remove_language') def remove_language(): @@ -131,7 +147,9 @@ def participant_session(): #create answer set for the participant in the database - participant_answer_set = answer_set(experiment_idexperiment=session['exp_id'], session=session['user'], agreement = session['agree'], answer_counter = '0') + the_time = datetime.now() + the_time = the_time.replace(microsecond=0) + participant_answer_set = answer_set(experiment_idexperiment=session['exp_id'], session=session['user'], agreement = session['agree'], answer_counter = '0', registration_time=the_time, last_answer_time=the_time) db.session.add(participant_answer_set) db.session.commit() @@ -333,6 +351,46 @@ def begin_with_id(): exp_id = request.args.get('exp_id', None) form = StartWithIdForm() + experiment_info = experiment.query.filter_by(idexperiment=exp_id).first() + + if form.validate_on_submit(): + + variable = form.participant_id.data + + #check if participant ID is found from db with this particular ID. If a match is found inform about error + participant = answer_set.query.filter(and_(answer_set.session==variable, answer_set.experiment_idexperiment==exp_id)).first() + is_id_valid = forced_id.query.filter(and_(forced_id.pregenerated_id==variable, forced_id.experiment_idexperiment==exp_id)).first() + + if participant is not None: + flash(_('ID already in use')) + return redirect(url_for('begin_with_id', exp_id=exp_id)) + + #if there was not a participant already in DB: + if participant is None: + + if is_id_valid is None: + + + flash(_('No such ID set for this experiment')) + return redirect(url_for('begin_with_id', exp_id=exp_id)) + + else: + + #save the participant ID in session list for now, this is deleted after the session has been started in participant_session-view + session['begin_with_id'] = form.participant_id.data + return render_template('consent.html', exp_id=exp_id, experiment_info=experiment_info) + + return render_template('begin_with_id.html', exp_id=exp_id, form=form) + + +@app.route('/admin_dryrun', methods=['GET', 'POST']) +@login_required +def admin_dryrun(): + + + exp_id = request.args.get('exp_id', None) + form = StartWithIdForm() + experiment_info = experiment.query.filter_by(idexperiment=exp_id).first() if form.validate_on_submit(): @@ -340,16 +398,17 @@ def begin_with_id(): participant = answer_set.query.filter(and_(answer_set.session==form.participant_id.data, answer_set.experiment_idexperiment==exp_id)).first() if participant is not None: flash('ID already in use') - return redirect(url_for('begin_with_id', exp_id=exp_id)) + return redirect(url_for('admin_dryrun', exp_id=exp_id)) #if there was not a participant already in DB: if participant is None: #save the participant ID in session list for now, this is deleted after the session has been started in participant_session-view session['begin_with_id'] = form.participant_id.data - return render_template('consent.html', exp_id=exp_id) + return render_template('consent.html', exp_id=exp_id, experiment_info=experiment_info) - return render_template('begin_with_id.html', exp_id=exp_id, form=form) + return render_template('admin_dryrun.html', exp_id=exp_id, form=form) + @app.route('/create_task') @@ -368,6 +427,15 @@ def instructions(): @app.route('/task/<int:page_num>', methods=['GET', 'POST']) def task(page_num): + + experiment_info = experiment.query.filter_by(idexperiment=session['exp_id']).first() + rating_instruction = experiment_info.single_sentence_instruction + stimulus_size = experiment_info.stimulus_size + + #for text stimuli the size needs to be calculated since the template element utilises h1-h6 tags. + #A value of stimulus size 12 gives h1 and value of 1 gives h6 + stimulus_size_text = 7-math.ceil((int(stimulus_size)/2)) + pages = page.query.filter_by(experiment_idexperiment=session['exp_id']).paginate(per_page=1, page=page_num, error_out=True) progress_bar_percentage = round((pages.page/pages.pages)*100) @@ -424,11 +492,15 @@ def task(page_num): - if check_answer is None: + if check_answer is None: + + the_time = datetime.now() + the_time = the_time.replace(microsecond=0) update_answer_counter = answer_set.query.filter_by(idanswer_set=session['answer_set']).first() update_answer_counter.answer_counter = int(update_answer_counter.answer_counter) + 1 - + update_answer_counter.last_answer_time = the_time + #flash("vastauksia:") #flash(update_answer_counter.answer_counter) db.session.commit() @@ -471,7 +543,7 @@ def task(page_num): return redirect ( url_for('task_completed')) - return render_template('task.html', pages=pages, progress_bar_percentage=progress_bar_percentage, form=form, randomized_stimulus=randomized_stimulus) + return render_template('task.html', pages=pages, progress_bar_percentage=progress_bar_percentage, form=form, randomized_stimulus=randomized_stimulus, rating_instruction=rating_instruction, stimulus_size=stimulus_size, stimulus_size_text=stimulus_size_text) @@ -491,7 +563,7 @@ def quit_task(): @app.route('/researcher_login', methods=['GET', 'POST']) def login(): if current_user.is_authenticated: - flash("allready logged in") + #flash("allready logged in") return redirect(url_for('index')) form = LoginForm() if form.validate_on_submit(): @@ -523,41 +595,128 @@ def experiment_statistics(): experiment_info = experiment.query.filter_by(idexperiment = exp_id).all() participants = answer_set.query.filter_by(experiment_idexperiment= exp_id).all() - participants_and_answers = {} - for participant in participants: - - answers = answer.query.filter_by(answer_set_idanswer_set=participant.idanswer_set).all() - answers_list = [(a.idanswer, a.question_idquestion, a.answer_set_idanswer_set, a.answer, a.page_idpage) for a in answers] - participants_and_answers[participant.session] = answers_list + #Rating task headers + question_headers = question.query.filter_by(experiment_idexperiment=exp_id).all() + stimulus_headers = page.query.filter_by(experiment_idexperiment=exp_id).all() + + pages = page.query.filter_by(experiment_idexperiment=exp_id).all() + questions = question.query.filter_by(experiment_idexperiment=exp_id).all() pages_and_questions = {} for p in pages: - questions = question.query.filter_by(experiment_idexperiment=exp_id).all() - questions_list = [(p.idpage, a.question) for a in questions] + questions_list = [(p.idpage, a.idquestion) for a in questions] pages_and_questions[p.idpage] = questions_list + + + + + #List of answers per participant in format question Stimulus ID/Question ID + #those are in answer table as page_idpage and question_idquestion respectively + + + + """ + pages = page.query.filter_by(experiment_idexperiment=exp_id).all() + + participants_and_answers = {} + + #participants on kaikki expin osallistujat + for participant in participants: + + + #kaikki yhden khn vastaukset ko experimentille koska answer_setin id matchaa answereiden kanssa + + + flash(participant.session) + for p in pages: + answers = answer.query.filter_by(answer_set_idanswer_set=participant.idanswer_set).all() + #kaikki yhden participantin vastaukset pagelle + answers_for_page = answer.query.filter(and_(answer.answer_set_idanswer_set==participant.idanswer_set, answer.page_idpage==p.idpage)).all() + + + for ans in answers: + + + + if ans.page_idpage == p.idpage: + + #flash(ans.page_idpage) + flash("X") + + + + + else: + + flash("NA") + + #pages on kaikki experimentin paget + + + + for a in answers: + + if p.idpage == a.page_idpage: + flash("match") + + else: + flash("no match") + flash("participant:") + flash(participant.session) + flash("stimulus:") + flash(a.page_idpage) + flash("Kysymys") + flash(a.question_idquestion) + flash("vastaus:") + flash(a.answer) + + + + + #answers_list = (a.idanswer, a.question_idquestion, a.answer_set_idanswer_set, a.answer, a.page_idpage) + + #participants_and_answers[participant.session] = answers_list + + + """ + + participants_and_answers = {} + + for participant in participants: + + answers = answer.query.filter_by(answer_set_idanswer_set=participant.idanswer_set).all() + answers_list = [(a.idanswer, a.question_idquestion, a.answer_set_idanswer_set, a.answer, a.page_idpage) for a in answers] + participants_and_answers[participant.session] = answers_list + + + + #Background question answers bg_questions = background_question.query.filter_by(experiment_idexperiment=exp_id).all() bg_answers_for_participants = {} - + for participant in participants: bg_answers = background_question_answer.query.filter_by(answer_set_idanswer_set=participant.idanswer_set).all() bg_answers_list = [(a.answer) for a in bg_answers] bg_answers_for_participants[participant.session] = bg_answers_list - + + #started and finished ratings counters started_ratings = answer_set.query.filter_by(experiment_idexperiment=exp_id).count() + experiment_page_count = page.query.filter_by(experiment_idexperiment=exp_id).count() + finished_ratings = answer_set.query.filter(and_(answer_set.answer_counter==experiment_page_count, answer_set.experiment_idexperiment==exp_id)).count() - return render_template('experiment_statistics.html', experiment_info=experiment_info, participants_and_answers=participants_and_answers, pages_and_questions=pages_and_questions, bg_questions=bg_questions, bg_answers_for_participants=bg_answers_for_participants, started_ratings=started_ratings) + return render_template('experiment_statistics.html', experiment_info=experiment_info, participants_and_answers=participants_and_answers, pages_and_questions=pages_and_questions, bg_questions=bg_questions, bg_answers_for_participants=bg_answers_for_participants, started_ratings=started_ratings, finished_ratings=finished_ratings, question_headers=question_headers, stimulus_headers=stimulus_headers) @@ -572,7 +731,11 @@ def create_experiment(): if request.method == 'POST' and form.validate(): - new_exp = experiment(name=request.form['name'], instruction=request.form['instruction'], language=request.form['language'], status='Hidden', randomization='Off') + + the_time = datetime.now() + the_time = the_time.replace(microsecond=0) + + new_exp = experiment(name=request.form['name'], instruction=request.form['instruction'], language=request.form['language'], status='Hidden', randomization='Off', single_sentence_instruction=request.form['single_sentence_instruction'], short_instruction=request.form['short_instruction'], creator_name=request.form['creator_name'], is_archived='False', creation_time=the_time, stimulus_size='7', consent_text=request.form['consent_text'], use_forced_id='Off') db.session.add(new_exp) db.session.commit() @@ -671,27 +834,33 @@ def create_experiment_questions(): list = str_list[a].split(';') - #If there are the right amount of values for the slider input values - if len(list) == 3: - - #flash("Question:") - #flash(list[0]) - #flash("Left:") - #flash(list[1]) - #flash("Right:") - #flash(list[2]) - - add_question = question(experiment_idexperiment=exp_id, question=list[0], left=list[1], right=list[2]) - db.session.add(add_question) - db.session.commit() - - - #If slider has too many or too litlle parameters give an error and redirect back to input form - else: + #If there are the wrong amount of values for any of the the slider input values + #redirect back to the form + if len(list) != 3: + + flash("Error Each slider must have 3 parameters separated by ; Some slider has:") flash(len(list)) return redirect(url_for('create_experiment_questions', exp_id=exp_id)) + + #If all the slider inputs were of length 3 items + #we can input them to db + for a in range(len(str_list)): + + list = str_list[a].split(';') + + #flash("Question:") + #flash(list[0]) + #flash("Left:") + #flash(list[1]) + #flash("Right:") + #flash(list[2]) + + add_question = question(experiment_idexperiment=exp_id, question=list[0], left=list[1], right=list[2]) + db.session.add(add_question) + db.session.commit() + return redirect(url_for('create_experiment_upload_stimuli', exp_id=exp_id)) @@ -788,7 +957,7 @@ def view_experiment(): #crap:3lines exp_id = request.args.get('exp_id', None) - media = page.query.filter_by(experiment_idexperiment=exp_id).paginate(per_page=20, page=1, error_out=True) + media = page.query.filter_by(experiment_idexperiment=exp_id).all() mtype = page.query.filter_by(experiment_idexperiment=exp_id).first() #experiment info @@ -950,41 +1119,53 @@ def edit_question(): def add_bg_question(): exp_id = request.args.get('exp_id', None) - form = CreateBackgroundQuestionForm(request.form) + exp_status = experiment.query.filter_by(idexperiment=exp_id).first() + + if exp_status.status == 'Public': - if request.method == 'POST' and form.validate(): - - str = form.bg_questions_and_options.data + flash("Experiment is public. Cannot modify structure.") - #Split the form data into a list that separates questions followed by the corresponding options - str_list = str.split('/n') + return redirect(url_for('view_experiment', exp_id=exp_id)) + + else: - #Iterate through the questions and options list - for a in range(len(str_list)): - #Split the list cells further into questions and options - list = str_list[a].split(';') - #Input the first item of the list as a question in db and the items followed by that as options for that question - for x in range(len(list)): - - if x == 0: - #flash("Kysymys") - #flash(list[x]) - add_bgquestion = background_question(background_question=list[x], experiment_idexperiment=exp_id) - db.session.add(add_bgquestion) - db.session.commit() - - else: - #flash("optio") - #flash(list[x]) - add_bgq_option = background_question_option(background_question_idbackground_question=add_bgquestion.idbackground_question, option=list[x]) - db.session.add(add_bgq_option) - db.session.commit() + form = CreateBackgroundQuestionForm(request.form) - return redirect(url_for('view_experiment', exp_id=exp_id)) - - return render_template('add_bg_question.html', form=form) + if request.method == 'POST' and form.validate(): + + str = form.bg_questions_and_options.data + + #Split the form data into a list that separates questions followed by the corresponding options + str_list = str.split('/n') + + #Iterate through the questions and options list + for a in range(len(str_list)): + + #Split the list cells further into questions and options + list = str_list[a].split(';') + + #Input the first item of the list as a question in db and the items followed by that as options for that question + for x in range(len(list)): + + if x == 0: + #flash("Kysymys") + #flash(list[x]) + add_bgquestion = background_question(background_question=list[x], experiment_idexperiment=exp_id) + db.session.add(add_bgquestion) + db.session.commit() + + else: + #flash("optio") + #flash(list[x]) + add_bgq_option = background_question_option(background_question_idbackground_question=add_bgquestion.idbackground_question, option=list[x]) + db.session.add(add_bgq_option) + db.session.commit() + + return redirect(url_for('view_experiment', exp_id=exp_id)) + + return render_template('add_bg_question.html', form=form) @@ -993,41 +1174,51 @@ def add_bg_question(): def add_questions(): exp_id = request.args.get('exp_id', None) - form = CreateQuestionForm(request.form) - - if request.method == 'POST' and form.validate(): - - str = form.questions_and_options.data - str_list = str.split('/n') + exp_status = experiment.query.filter_by(idexperiment=exp_id).first() - for a in range(len(str_list)): + if exp_status.status == 'Public': + + flash("Experiment is public. Cannot modify structure.") - list = str_list[a].split(';') - - #If there are the right amount of values for the slider input values - if len(list) == 3: - - #flash("Question:") - #flash(list[0]) - #flash("Left:") - #flash(list[1]) - #flash("Right:") - #flash(list[2]) - - add_question = question(experiment_idexperiment=exp_id, question=list[0], left=list[1], right=list[2]) - db.session.add(add_question) - db.session.commit() - - #If slider has too many or too litlle parameters give an error and redirect back to input form - else: - flash("Error Each slider must have 3 parameters separated by ; Some slider has:") - flash(len(list)) - - return redirect(url_for('create_experiment_questions', exp_id=exp_id)) + return redirect(url_for('view_experiment', exp_id=exp_id)) - return redirect(url_for('view_experiment', exp_id=exp_id)) - - return render_template('add_questions.html', form=form) + else: + + form = CreateQuestionForm(request.form) + + if request.method == 'POST' and form.validate(): + + str = form.questions_and_options.data + str_list = str.split('/n') + + for a in range(len(str_list)): + + list = str_list[a].split(';') + + #If there are the right amount of values for the slider input values + if len(list) == 3: + + #flash("Question:") + #flash(list[0]) + #flash("Left:") + #flash(list[1]) + #flash("Right:") + #flash(list[2]) + + add_question = question(experiment_idexperiment=exp_id, question=list[0], left=list[1], right=list[2]) + db.session.add(add_question) + db.session.commit() + + #If slider has too many or too litlle parameters give an error and redirect back to input form + else: + flash("Error Each slider must have 3 parameters separated by ; Some slider has:") + flash(len(list)) + + return redirect(url_for('create_experiment_questions', exp_id=exp_id)) + + return redirect(url_for('view_experiment', exp_id=exp_id)) + + return render_template('add_questions.html', form=form) @@ -1039,22 +1230,35 @@ def add_questions(): def remove_bg_question(): exp_id = request.args.get('exp_id', None) - remove_id = request.args.get('idbackground_question', None) - - remove_options = background_question_option.query.filter_by(background_question_idbackground_question=remove_id).all() + + + exp_status = experiment.query.filter_by(idexperiment=exp_id).first() + + if exp_status.status == 'Public': - for a in range(len(remove_options)): + flash("Experiment is public. Cannot modify structure.") + + return redirect(url_for('view_experiment', exp_id=exp_id)) + + else: - #flash(remove_options[a].idbackground_question_option) - db.session.delete(remove_options[a]) - db.session.commit() - + remove_id = request.args.get('idbackground_question', None) + + remove_options = background_question_option.query.filter_by(background_question_idbackground_question=remove_id).all() - remove_question = background_question.query.filter_by(idbackground_question=remove_id).first() + for a in range(len(remove_options)): + + #flash(remove_options[a].idbackground_question_option) + + db.session.delete(remove_options[a]) + db.session.commit() - db.session.delete(remove_question) - db.session.commit() + + remove_question = background_question.query.filter_by(idbackground_question=remove_id).first() + + db.session.delete(remove_question) + db.session.commit() return redirect(url_for('view_experiment', exp_id=exp_id)) @@ -1066,12 +1270,22 @@ def remove_bg_question(): def remove_question(): exp_id = request.args.get('exp_id', None) - remove_id = request.args.get('idquestion', None) - - remove_question = question.query.filter_by(idquestion=remove_id).first() + exp_status = experiment.query.filter_by(idexperiment=exp_id).first() + + if exp_status.status == 'Public': - db.session.delete(remove_question) - db.session.commit() + flash("Experiment is public. Cannot modify structure.") + + return redirect(url_for('view_experiment', exp_id=exp_id)) + + else: + + + remove_id = request.args.get('idquestion', None) + remove_question = question.query.filter_by(idquestion=remove_id).first() + + db.session.delete(remove_question) + db.session.commit() return redirect(url_for('view_experiment', exp_id=exp_id)) @@ -1081,121 +1295,153 @@ def remove_question(): def remove_experiment(): exp_id = request.args.get('exp_id', None) + exp_status = experiment.query.filter_by(idexperiment=exp_id).first() + + if exp_status.status == 'Public': - form = RemoveExperimentForm(request.form) - - if request.method == 'POST' and form.validate(): + flash("Experiment is public. Cannot modify structure.") - if form.remove.data == 'DELETE': + return redirect(url_for('view_experiment', exp_id=exp_id)) + + else: - - #This removes all experiment data from the database! - - - #Tables - - #background_question_option & background_question & background question answers: - remove_background_question = background_question.query.filter_by(experiment_idexperiment=exp_id).all() - - #cycle through all bg questions and delete their options - for a in range(len(remove_background_question)): - - remove_background_question_option = background_question_option.query.filter_by(background_question_idbackground_question=remove_background_question[a].idbackground_question).all() - - for b in range(len(remove_background_question_option)): - - db.session.delete(remove_background_question_option[b]) - db.session.commit() - - - #Remove all background questions and all answers given to each bg question - for a in range(len(remove_background_question)): - - remove_background_question_answers = background_question_answer.query.filter_by(background_question_idbackground_question=remove_background_question[a].idbackground_question).all() + + + form = RemoveExperimentForm(request.form) + + if request.method == 'POST' and form.validate(): + + if form.remove.data == 'DELETE': + - for b in range(len(remove_background_question_answers)): - - db.session.delete(remove_background_question_answers[b]) - db.session.commit() + #This removes all experiment data from the database! - db.session.delete(remove_background_question[a]) - db.session.commit() + #Remove research bulletin if it exists + empty_filevariable = experiment.query.filter_by(idexperiment=exp_id).first() + + if empty_filevariable.research_notification_filename is not None: + + target = os.path.join(APP_ROOT, empty_filevariable.research_notification_filename) + + if os.path.exists(target): + os.remove(target) + + + + + #Tables + + + remove_forced_id = forced_id.query.filter_by(experiment_idexperiment=exp_id).all() + + for b in range(len(remove_forced_id)): + db.session.delete(remove_forced_id[b]) + db.session.commit() - - #Remove all questions and answers - remove_question = question.query.filter_by(experiment_idexperiment=exp_id).all() - - for a in range(len(remove_question)): - remove_question_answers = answer.query.filter_by(question_idquestion=remove_question[a].idquestion).all() + #background_question_option & background_question & background question answers: + remove_background_question = background_question.query.filter_by(experiment_idexperiment=exp_id).all() - for b in range(len(remove_question_answers)): + #cycle through all bg questions and delete their options + for a in range(len(remove_background_question)): + + remove_background_question_option = background_question_option.query.filter_by(background_question_idbackground_question=remove_background_question[a].idbackground_question).all() + + for b in range(len(remove_background_question_option)): + + db.session.delete(remove_background_question_option[b]) + db.session.commit() + + + #Remove all background questions and all answers given to each bg question + for a in range(len(remove_background_question)): + + remove_background_question_answers = background_question_answer.query.filter_by(background_question_idbackground_question=remove_background_question[a].idbackground_question).all() - db.session.delete(remove_question_answers[b]) + for b in range(len(remove_background_question_answers)): + + db.session.delete(remove_background_question_answers[b]) + db.session.commit() + + db.session.delete(remove_background_question[a]) db.session.commit() - - db.session.delete(remove_question[a]) - db.session.commit() - - - #Remove all pages and datafiles - remove_pages = page.query.filter_by(experiment_idexperiment=exp_id).all() - - for a in range(len(remove_pages)): - - if remove_pages[a].type == 'text': + + + #Remove all questions and answers + remove_question = question.query.filter_by(experiment_idexperiment=exp_id).all() + + for a in range(len(remove_question)): + + remove_question_answers = answer.query.filter_by(question_idquestion=remove_question[a].idquestion).all() + + for b in range(len(remove_question_answers)): + + db.session.delete(remove_question_answers[b]) + db.session.commit() + + db.session.delete(remove_question[a]) + db.session.commit() + + + #Remove all pages and datafiles + remove_pages = page.query.filter_by(experiment_idexperiment=exp_id).all() + + for a in range(len(remove_pages)): + + if remove_pages[a].type == 'text': + + db.session.delete(remove_pages[a]) + db.session.commit() + + else: + + target = os.path.join(APP_ROOT, remove_pages[a].media) + + if os.path.exists(target): + os.remove(target) + + #Now that the files are removed we can delete the page db.session.delete(remove_pages[a]) db.session.commit() - else: - target = os.path.join(APP_ROOT, remove_pages[a].media) - - if os.path.exists(target): - os.remove(target) + #Remove all answer_sets and trial_randomization orders + remove_answer_set = answer_set.query.filter_by(experiment_idexperiment=exp_id).all() + + for a in range(len(remove_answer_set)): + + remove_trial_randomizations = trial_randomization.query.filter_by(answer_set_idanswer_set=remove_answer_set[a].idanswer_set).all() + + for b in range(len(remove_trial_randomizations)): + + db.session.delete(remove_trial_randomizations[b]) + db.session.commit() + + db.session.delete(remove_answer_set[a]) + db.session.commit() - #Now that the files are removed we can delete the page - db.session.delete(remove_pages[a]) + + #Remove experiment table + remove_experiment = experiment.query.filter_by(idexperiment=exp_id).first() + db.session.delete(remove_experiment) db.session.commit() - #Remove all answer_sets and trial_randomization orders - remove_answer_set = answer_set.query.filter_by(experiment_idexperiment=exp_id).all() - - for a in range(len(remove_answer_set)): + flash("Experiment was removed from database!") - remove_trial_randomizations = trial_randomization.query.filter_by(answer_set_idanswer_set=remove_answer_set[a].idanswer_set).all() + return redirect(url_for('index')) - for b in range(len(remove_trial_randomizations)): - - db.session.delete(remove_trial_randomizations[b]) - db.session.commit() + else: + + flash("Experiment was not removed!") + + return redirect(url_for('view_experiment', exp_id=exp_id)) - db.session.delete(remove_answer_set[a]) - db.session.commit() - - - #Remove experiment table - remove_experiment = experiment.query.filter_by(idexperiment=exp_id).first() - db.session.delete(remove_experiment) - db.session.commit() - - - flash("Experiment was removed from database!") - - return redirect(url_for('index')) - - else: - - flash("Experiment was not removed!") - - return redirect(url_for('view_experiment', exp_id=exp_id)) - - - return render_template('remove_experiment.html', form=form, exp_id=exp_id) + + return render_template('remove_experiment.html', form=form, exp_id=exp_id) @@ -1204,48 +1450,59 @@ def remove_experiment(): def remove_page(): exp_id = request.args.get('exp_id', None) - remove_id = request.args.get('idpage', None) - remove_page = page.query.filter_by(idpage=remove_id).first() - experiment_pages = page.query.filter_by(experiment_idexperiment=exp_id).all() + exp_status = experiment.query.filter_by(idexperiment=exp_id).first() + + if exp_status.status == 'Public': - #if stimulustype is text, the stimulus itself is text on the database, other stimulus types are real files - #on the server and need to be deleted - if remove_page.type != 'text': + flash("Experiment is public. Cannot modify structure.") + + return redirect(url_for('view_experiment', exp_id=exp_id)) - #helper variable - do_not_delete_file = 'False' - - #if the file to be deleted is in duplicate use of another page then we won't delete the file - for a in range(len(experiment_pages)): + else: - #flash("in da for") + + remove_id = request.args.get('idpage', None) + remove_page = page.query.filter_by(idpage=remove_id).first() + experiment_pages = page.query.filter_by(experiment_idexperiment=exp_id).all() + + #if stimulustype is text, the stimulus itself is text on the database, other stimulus types are real files + #on the server and need to be deleted + if remove_page.type != 'text': + + #helper variable + do_not_delete_file = 'False' - if experiment_pages[a].media == remove_page.media and experiment_pages[a].idpage != remove_page.idpage: - - #flash("in da if") - do_not_delete_file = 'True' - - #If no other page is using the file then lets remove it - if do_not_delete_file == 'False': - #remove old file - target = os.path.join(APP_ROOT, remove_page.media) - #flash("Remove:") - #flash(target) - os.remove(target) + #if the file to be deleted is in duplicate use of another page then we won't delete the file + for a in range(len(experiment_pages)): - db.session.delete(remove_page) - db.session.commit() - - return redirect(url_for('view_experiment', exp_id=exp_id)) + #flash("in da for") + + if experiment_pages[a].media == remove_page.media and experiment_pages[a].idpage != remove_page.idpage: - if remove_page.type == 'text': + #flash("in da if") + do_not_delete_file = 'True' + + #If no other page is using the file then lets remove it + if do_not_delete_file == 'False': + #remove old file + target = os.path.join(APP_ROOT, remove_page.media) + #flash("Remove:") + #flash(target) + os.remove(target) - db.session.delete(remove_page) - db.session.commit() + db.session.delete(remove_page) + db.session.commit() + + return redirect(url_for('view_experiment', exp_id=exp_id)) + + if remove_page.type == 'text': + + db.session.delete(remove_page) + db.session.commit() + + return redirect(url_for('view_experiment', exp_id=exp_id)) return redirect(url_for('view_experiment', exp_id=exp_id)) - - return redirect(url_for('view_experiment', exp_id=exp_id)) @app.route('/publish_experiment') @@ -1316,6 +1573,96 @@ def disable_randomization(): return redirect(url_for('view_experiment', exp_id=exp_id)) +@app.route('/enable_forced_id') +@login_required +def enable_forced_id(): + + exp_id = request.args.get('exp_id', None) + + enable_forced_id = experiment.query.filter_by(idexperiment = exp_id).first() + + enable_forced_id.use_forced_id = 'On' + + flash("Enabled forced ID login") + + db.session.commit() + + return redirect(url_for('view_experiment', exp_id=exp_id)) + + +@app.route('/disable_forced_id') +@login_required +def disable_forced_id(): + + exp_id = request.args.get('exp_id', None) + + disable_forced_id = experiment.query.filter_by(idexperiment = exp_id).first() + + disable_forced_id.use_forced_id = 'Off' + + flash("Disabled forced ID login") + + db.session.commit() + + return redirect(url_for('view_experiment', exp_id=exp_id)) + + +@app.route('/view_forced_id_list', methods=['GET', 'POST']) +@login_required +def view_forced_id_list(): + + exp_id = request.args.get('exp_id', None) + + id_list = forced_id.query.filter_by(experiment_idexperiment=exp_id).all() + + + form = GenerateIdForm(request.form) + + if request.method == 'POST' and form.validate(): + + + for i in range(int(request.form['number'])): + + random_id = str(request.form['string']) + str(secrets.token_hex(3)) + check_answer_set = answer_set.query.filter_by(session=random_id).first() + check_forced_id = forced_id.query.filter_by(pregenerated_id=random_id).first() + + + #here we check if the generated id is found from given answers from the whole database in answer_set table + #or from forced_id table. If so another id is generated instead to avoid a duplicate + if check_answer_set is not None or check_forced_id is not None: + + #flash("ID already existed; generated a new one") + random_id = secrets.token_hex(3) + check_answer_set = answer_set.query.filter_by(session=random_id).first() + check_forced_id = forced_id.query.filter_by(pregenerated_id=random_id).first() + + input_id = forced_id(experiment_idexperiment=exp_id, pregenerated_id=random_id) + db.session.add(input_id) + db.session.commit() + + + + + return redirect(url_for('view_forced_id_list', exp_id=exp_id)) + + + + + + + + return render_template('view_forced_id_list.html', exp_id=exp_id, id_list=id_list) + + + + + + + + + + @app.route('/edit_stimuli', methods=['GET', 'POST']) @login_required def edit_stimuli(): @@ -1395,79 +1742,194 @@ def edit_stimuli(): def add_stimuli(): exp_id = request.args.get('exp_id', None) - stimulus_type = request.args.get('stimulus_type', None) - - form = UploadStimuliForm(request.form) + + + exp_status = experiment.query.filter_by(idexperiment=exp_id).first() - if request.method == 'POST': - - if stimulus_type == 'text': - - #flash("db insert text") - - string = form.text.data - str_list = string.split('/n') + if exp_status.status == 'Public': + + flash("Experiment is public. Cannot modify structure.") - for a in range(len(str_list)): + return redirect(url_for('view_experiment', exp_id=exp_id)) + + else: - #flash("lisättiin:") - #flash(str_list[a]) - add_text_stimulus = page(experiment_idexperiment=exp_id, type='text', text=str_list[a], media='none') - db.session.add(add_text_stimulus) - db.session.commit() - #flash("Succes!") - - return redirect(url_for('view_experiment', exp_id=exp_id)) - - + #If there are no pages set for the experiment lets reroute user to create experiment stimuli upload instead + + is_there_any_stimuli = page.query.filter_by(experiment_idexperiment = exp_id).first() + + if is_there_any_stimuli is None: - else: + return redirect(url_for('create_experiment_upload_stimuli', exp_id=exp_id)) - #Upload stimuli into /static/experiment_stimuli/exp_id folder - #Create the pages for the stimuli by inserting experiment_id, stimulus type, text and names of the stimulus files (as a path to the folder) - path = 'static/experiment_stimuli/' + str(exp_id) - - target = os.path.join(APP_ROOT, path) - #flash(target) - - if not os.path.isdir(target): - os.mkdir(target) - #flash("make dir") - #This returns a list of filenames: request.files.getlist("file") + stimulus_type = request.args.get('stimulus_type', None) + + form = UploadStimuliForm(request.form) + + if request.method == 'POST': - for file in request.files.getlist("file"): - #save files in the correct folder - #flash(file.filename) - filename = file.filename - destination = "/".join([target, filename]) - #flash("destination") - #flash(destination) - file.save(destination) - - #add pages to the db - db_path = path + str('/') + str(filename) - - #flash("db path") - #flash(db_path) + if stimulus_type == 'text': + + #flash("db insert text") - new_page = page(experiment_idexperiment=exp_id, type=form.type.data, media=db_path) + string = form.text.data + str_list = string.split('/n') + + for a in range(len(str_list)): + + #flash("lisättiin:") + #flash(str_list[a]) + add_text_stimulus = page(experiment_idexperiment=exp_id, type='text', text=str_list[a], media='none') + db.session.add(add_text_stimulus) + db.session.commit() + + #flash("Succes!") + + return redirect(url_for('view_experiment', exp_id=exp_id)) + + + + else: + + #Upload stimuli into /static/experiment_stimuli/exp_id folder + #Create the pages for the stimuli by inserting experiment_id, stimulus type, text and names of the stimulus files (as a path to the folder) + path = 'static/experiment_stimuli/' + str(exp_id) + + target = os.path.join(APP_ROOT, path) + #flash(target) - db.session.add(new_page) - db.session.commit() + if not os.path.isdir(target): + os.mkdir(target) + #flash("make dir") + + + #This returns a list of filenames: request.files.getlist("file") + + for file in request.files.getlist("file"): - #flash("Succes!") + #save files in the correct folder + #flash(file.filename) + filename = file.filename + destination = "/".join([target, filename]) + #flash("destination") + #flash(destination) + file.save(destination) + + #add pages to the db + db_path = path + str('/') + str(filename) + + #flash("db path") + #flash(db_path) + + new_page = page(experiment_idexperiment=exp_id, type=form.type.data, media=db_path) + + db.session.add(new_page) + db.session.commit() + + #flash("Succes!") + + return redirect(url_for('view_experiment', exp_id=exp_id)) return redirect(url_for('view_experiment', exp_id=exp_id)) - return redirect(url_for('view_experiment', exp_id=exp_id)) + + return render_template('add_stimuli.html', form=form, stimulus_type=stimulus_type) + + + +@app.route('/upload_research_notification', methods=['GET', 'POST']) +@login_required +def upload_research_notification(): + + exp_id = request.args.get('exp_id', None) + + form = UploadResearchBulletinForm(request.form) + + if request.method == 'POST': + + path = 'static/experiment_stimuli/' + str(exp_id) + + target = os.path.join(APP_ROOT, path) + #flash(target) + + if not os.path.isdir(target): + os.mkdir(target) + #flash("make dir") + + + #This returns a list of filenames: request.files.getlist("file") + + for file in request.files.getlist("file"): - - return render_template('add_stimuli.html', form=form, stimulus_type=stimulus_type) + #save files in the correct folder + #flash(file.filename) + filename = file.filename + destination = "/".join([target, filename]) + #flash("destination") + #flash(destination) + file.save(destination) + + #add pages to the db + db_path = path + str('/') + str(filename) + + #flash("db path") + #flash(db_path) + + + bulletin = experiment.query.filter_by(idexperiment=exp_id).first() + + bulletin.research_notification_filename = db_path + db.session.commit() + + #flash("Succes!") + + return redirect(url_for('view_experiment', exp_id=exp_id)) + + + return render_template('upload_research_notification.html', exp_id=exp_id, form=form) + + +@app.route('/remove_research_notification') +@login_required +def remove_research_notification(): + + exp_id = request.args.get('exp_id', None) + + empty_filevariable = experiment.query.filter_by(idexperiment=exp_id).first() + + target = os.path.join(APP_ROOT, empty_filevariable.research_notification_filename) + + if os.path.exists(target): + os.remove(target) + + + empty_filevariable.research_notification_filename = None + + db.session.commit() + + return redirect(url_for('view_experiment', exp_id=exp_id)) + + + +@app.route('/view_research_notification') +@login_required +def view_research_notification(): + + exp_id = request.args.get('exp_id', None) + image = experiment.query.filter_by(idexperiment=exp_id).first() + + research_notification_filename = image.research_notification_filename + + return render_template('view_research_notification.html', research_notification_filename=research_notification_filename) + + + + @app.route('/download_csv') @@ -1497,3 +1959,18 @@ def researcher_info(): return render_template('researcher_info.html') + + + + +#TEST PAGE + +@app.route('/test_page') +def test_page(): + + flash('Please log in to access this page.') + + session.clear() + + return render_template('test_page.html') + diff --git a/app/static/css/custom.css b/app/static/css/custom.css index 238923060cc7e768a60ad8385d355df284cb6120..407f953044adc21af3f22e7b7565a6e864acf6ee 100644 --- a/app/static/css/custom.css +++ b/app/static/css/custom.css @@ -1,7 +1,5 @@ -.btn { - border-radius: 0px; -} -.navbar-custom{ - background-color:red; - border-color: green; -} +body{ + +background-color: #000000; + +} \ No newline at end of file diff --git a/app/static/css/slider.css b/app/static/css/slider.css new file mode 100644 index 0000000000000000000000000000000000000000..7cfc2e6e8385bc26f0e27953db85cb625cc0261b --- /dev/null +++ b/app/static/css/slider.css @@ -0,0 +1,6 @@ +input[type='range'] { + -webkit-appearance: none; + height: 50px; + + +} diff --git a/app/templates/add_stimuli.html b/app/templates/add_stimuli.html index f8617a13116da1bc530b46ca30dd1b7fd826ef84..334ce1f1196c89369d75dded195ed2f8dcb935e3 100644 --- a/app/templates/add_stimuli.html +++ b/app/templates/add_stimuli.html @@ -10,18 +10,33 @@ <legend>Paste the new texts to the textarea and mark the end of each stimulus with a /n. Do not place the marker at the end of the last text. Example: Text1/n Text2/n Text3</legend> <textarea class="form-control" rows="10" id="text" name="text"></textarea> </div> - {% else %} + {% endif %} + {% if stimulus_type == 'video' or stimulus_type == 'audio' or stimulus_type == 'picture' %} <div class="input-group mb-3"> <legend>Add files:</legend> <div class="input-group-prepend"> <span class="input-group-text">Upload:</span> </div> <div class="custom-file"> - <input type="file" class="custom-file-input" id="file" name="file" accept="audio/*,video/*,image/*" multiple> + <input type="file" class="custom-file-input" id="file" name="file" accept="audio/*,image/*, .mp4" multiple> <label class="custom-file-label" for="upload_file">Choose file</label> </div> </div> - {% endif %} + {% endif %} + + + + + + + + + + + + + + <br> <button type="submit" class="btn btn-primary">Submit</button> <a class="btn btn-primary" href="{{ request.referrer }}" role="button">Cancel</a> diff --git a/app/templates/admin_dryrun.html b/app/templates/admin_dryrun.html new file mode 100644 index 0000000000000000000000000000000000000000..2ee0d1ea9ec80d19f6d278123449ff5c8a6c7171 --- /dev/null +++ b/app/templates/admin_dryrun.html @@ -0,0 +1,29 @@ +{% extends "base.html" %} +{% block content %} + + +<div class="container text-center"> +<div class="row mt-5 display-4"><br></div> + +<h1 class="mt-5 display-4"><br>Run experiment with any ID:</h1><br> +<br> + +<h3 class="display-5 text-center text-danger"> Notice!</h3> +<div class="lead text-center">You can use any login name for a testrun that is not currently in database for this experiment.</div> + +<br><br> + <form action="" method="post"> + {{ form.hidden_tag() }} + <p> + {{ form.participant_id(size=32) }}<br> + {% for error in form.participant_id.errors %} + <span style="color: red;">[{{ error }}]</span> + {% endfor %} + </p> + <p>{{ form.submit() }}</p> + + </form> +</div> + + +{% endblock %} \ No newline at end of file diff --git a/app/templates/base.html b/app/templates/base.html index 3675532579503a389069aa8dc9b2a5e440bfd423..a1fb514638d81f080e044679e1daea5d56508834 100644 --- a/app/templates/base.html +++ b/app/templates/base.html @@ -2,7 +2,7 @@ {% import "bootstrap/wtf.html" as wtf %} <!doctype html> -<html lang="en"> +<html> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"> @@ -12,22 +12,24 @@ <script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin="anonymous"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.3/umd/popper.min.js" integrity="sha384-ZMP7rVo3mIykV+2+9J3UJ46jBk0WLaUAdn689aCwoqbBJiSnjAK/l8WvCWPIPm49" crossorigin="anonymous"></script> <script src="https://stackpath.bootstrapcdn.com/bootstrap/4.1.1/js/bootstrap.min.js" integrity="sha384-smHYKdLADwkXOn1EmN1qk/HfnUcbVRZyYmZ4qpPea6sjB/pTJ0euyQp0Mk8ck+5T" crossorigin="anonymous"></script> - <title>Mega-fMRI Stimulus Rating Tool</title> + <title>Onni</title> <!-- Bootstrap core CSS --> <link href="../../dist/css/bootstrap.min.css" rel="stylesheet"> <!-- Custom styles for this template --> - <link href="sticky-footer-navbar.css" rel="stylesheet"> + + <link href="/static/css/slider.css" rel="stylesheet"> + </head> <body> <header> <!-- Navigation --> -<nav class="navbar navbar-expand-md navbar-dark bg-dark fixed-top"> +<nav class="navbar navbar-expand navbar-dark bg-dark fixed-top"> <div class="col navbar-brand"> <img src="/static/img/madam-300x250.jpg" alt="Logo" style="width:70px;"> {% if pages %} - <a class="navbar-brand pl-5 font-weight-light">Participant ID: <span class="text-success font-weight-bold">{{ session['user']}}</span></a> + <a class="navbar-brand pl-5 font-weight-light"><span class="text-success font-weight-bold">{{ session['user']}}</span></a> {% else %} @@ -36,9 +38,9 @@ {% endif %} </div> - <div class="col-6 navbar-nav"> + <div class="navbar-nav w-50"> {% if pages %} - <div class="progress-bar bg-success progress-bar-striped" role="progressbar" style="width: {{ progress_bar_percentage }}%" aria-valuenow="50" aria-valuemin="0" aria-valuemax="100">Task progress: {{ progress_bar_percentage }}%</div> + <div class="progress-bar bg-success progress-bar-striped" role="progressbar" style="width: {{ progress_bar_percentage }}%" aria-valuemin="0" aria-valuemax="100">{{ _('Task progress:') }} {{ progress_bar_percentage }}%</div> {% endif %} </div> <div class="col text-success text-right"> @@ -52,7 +54,6 @@ {% endwith %} {% endblock %} {% if current_user.is_authenticated %} - <a class="nav-item" href="{{ url_for('researcher_info') }}" class="nav-link">Info |</a> @@ -62,16 +63,17 @@ </a> <div class="dropdown-menu" aria-labelledby="navbarDropdown"> - <a class="dropdown-item" href="{{ url_for('set_language', language='Finnish') }}">Finnish</a> - <a class="dropdown-item" href="{{ url_for('set_language', language='English') }}">English</a> - <a class="dropdown-item" href="{{ url_for('set_language', language='Persian') }}">Persian</a> - <a class="dropdown-item" href="{{ url_for('set_language', language='Greek') }}">Greek</a> - <a class="dropdown-item" href="{{ url_for('set_language', language='Italian') }}">Italian</a> - <a class="dropdown-item" href="{{ url_for('set_language', language='Chinese') }}">Chinese</a> - <a class="dropdown-item" href="{{ url_for('set_language', language='All') }}">Show all languages</a> + <a class="dropdown-item" href="{{ url_for('set_language', language='Finnish', lang='fi') }}">Finnish</a> + <a class="dropdown-item" href="{{ url_for('set_language', language='English', lang='en') }}">English</a> + <a class="dropdown-item" href="{{ url_for('set_language', language='Persian', lang='fa') }}">Persian</a> + <a class="dropdown-item" href="{{ url_for('set_language', language='Greek', lang='el') }}">Greek</a> + <a class="dropdown-item" href="{{ url_for('set_language', language='Italian', lang='it') }}">Italian</a> + <a class="dropdown-item" href="{{ url_for('set_language', language='Chinese', lang='zh') }}">Chinese</a> + <a class="dropdown-item" href="{{ url_for('set_language', language='All') }}">Show all experiments</a> </div> - - <a class="nav-item" href="{{ url_for('create_experiment') }}" class="nav-link">| Create experiment |</a> + <a class="nav-item" href="{{ url_for('researcher_info') }}" class="nav-link">| Info |</a> + <a class="nav-item" href="{{ url_for('create_experiment') }}" class="nav-link">Create |</a> + <a class="nav-item" href="" class="nav-link">Archives |</a> {% endif %} {% if current_user.is_anonymous %} @@ -83,13 +85,13 @@ </a> <div class="dropdown-menu" aria-labelledby="navbarDropdown"> - <a class="dropdown-item" href="{{ url_for('set_language', language='Finnish') }}">Finnish</a> - <a class="dropdown-item" href="{{ url_for('set_language', language='English') }}">English</a> - <a class="dropdown-item" href="{{ url_for('set_language', language='Persian') }}">Persian</a> - <a class="dropdown-item" href="{{ url_for('set_language', language='Greek') }}">Greek</a> - <a class="dropdown-item" href="{{ url_for('set_language', language='Italian') }}">Italian</a> - <a class="dropdown-item" href="{{ url_for('set_language', language='Chinese') }}">Chinese</a> - <a class="dropdown-item" href="{{ url_for('set_language', language='All') }}">Show all languages</a> + <a class="dropdown-item" href="{{ url_for('set_language', language='Finnish', lang='fi') }}">Finnish</a> + <a class="dropdown-item" href="{{ url_for('set_language', language='English', lang='en') }}">English</a> + <a class="dropdown-item" href="{{ url_for('set_language', language='Persian', lang='fa') }}">Persian</a> + <a class="dropdown-item" href="{{ url_for('set_language', language='Greek', lang='el') }}">Greek</a> + <a class="dropdown-item" href="{{ url_for('set_language', language='Italian', lang='it') }}">Italian</a> + <a class="dropdown-item" href="{{ url_for('set_language', language='Chinese', lang='zh') }}">Chinese</a> + <a class="dropdown-item" href="{{ url_for('set_language', language='All') }}">Show all experiments</a> </div> diff --git a/app/templates/begin_with_id.html b/app/templates/begin_with_id.html index 3e9bb98d5d01bde5659799c076ffba33ba903772..541a2e1484cb724d048a84d997364f56e8405cd9 100644 --- a/app/templates/begin_with_id.html +++ b/app/templates/begin_with_id.html @@ -5,11 +5,14 @@ <div class="container text-center"> <div class="row mt-5 display-4"><br></div> -<h1 class="mt-5 display-4"><br>Please insert your ID-code below:</h1><br> +<h1 class="mt-5 display-4"><br>{{ _('Please insert your ID-code below:') }}</h1><br> + <br> -<h3 class="display-5 text-center text-danger"> Notice!</h3> -<div class="row lead">This login is meant only for participants who have received an identification code from a researcher to be used in the rating task. If you have not received such please return to the previous page and select the "Begin task" function instead.</div> +<h3 class="display-5 text-center text-danger">{{ _('Notice!') }}</h3> +<div class="lead text-center">{{ _('Participation in this experiment requires a login with a predetermined ID code. Please input ID below.') }}</div> + + <br><br> <form action="" method="post"> diff --git a/app/templates/consent.html b/app/templates/consent.html index c6b5b6a3c536f658636d46c65a1a3d66baadc96a..58eaec314c8ec5265f3d36ead59bd67f9e73292d 100644 --- a/app/templates/consent.html +++ b/app/templates/consent.html @@ -1,22 +1,24 @@ {% extends "base.html" %} {% block content %} + + -<h1 class="row mt-5 display-4"><br>This is the consent page for experiment ID: {{ exp_id }}</h1> +<h1 class="container mt-5 display-4"><br> {{ experiment_info.name }}</h1> +<br> +<p class="lead">{{ experiment_info.short_instruction }}</p> <br> -<h4>Lue tutkimustiedote <a href="tiedote.pdf">tästä.</a></h4> -<br/> -<p class="lead">Prior to giving the consent I have read and understood the Experiment/ Research Bulletin I received, and I have received sufficient information about the course of the experiment. I have been clarified that the experiment data collected from me will be treated confidentially in such way that my identity can not be identified. I understand that my participation in the study is completely voluntary and that I can stop the experiment at any stage of the experiment without giving any reason. Furthermore, I have been clarified that I will receive further information about the general principles and the progress of the experiment from the researcher mentioned at the Experiment/ Research Bulletin, if I wish to do so. I understand that the data is collected only for purposes of the scientific research and it is not even partially disclosed to the participant himself/ herself and that my IP address or other identifying information will not be saved. -</p> -<p class="lead">By clicking on the button below, I give my consent to the collection and processing of the data in this experiment, as described in the Experiment/ Research Bulletin. +<h3>{{ _('Consent for participation:') }}</h3> -</p> -<p class="lead">Of this electronical consent, there will be a digital entry saved in the files of the researcher responsible for the experiment. +{% if experiment_info.research_notification_filename %} +<h5> {{ _('Research bulletin can be read') }} <a href="{{ url_for('view_research_notification', exp_id=experiment_info.idexperiment) }}">{{ _('here.') }}</a></h5> +{% endif %} -</p> -<p> - <a class="btn btn-primary" href="{{ url_for('participant_session', exp_id=exp_id, agree='true') }}" role="button">Agree</a> - <button type="button" class="btn btn-primary" data-toggle="modal" data-target="#myModal">Disagree</button> +<p class="lead"> {{ experiment_info.consent_text }} </p> + + + <a class="btn btn-primary" href="{{ url_for('participant_session', exp_id=exp_id, agree='true') }}" role="button">{{ _('Agree') }}</a> + <button type="button" class="btn btn-primary" data-toggle="modal" data-target="#myModal">{{ _('Disagree') }}</button> <!-- Modal --> <div class="modal fade" id="myModal" role="dialog"> <div class="modal-dialog modal-dialog-centered"> @@ -24,19 +26,20 @@ <div class="modal-content modal-dialog-centered"> <div class="modal-header"> <button type="button" class="close" data-dismiss="modal">×</button> - <h4 class="modal-title">Notice!</h4> + <h4 class="modal-title">{{ _('Notice!') }}</h4> </div> <div class="modal-body"> - <p>In order to participate for the study you need to agree with the terms presented.</p> + <p>{{ _('In order to participate for the study you need to agree with the terms presented.') }}</p> </div> <div class="modal-footer"> - <button type="button" class="btn btn-default" data-dismiss="modal">Close Notice</button> - <a class="btn btn-primary" href="/" role="button">Return Home</a> + <button type="button" class="btn btn-default" data-dismiss="modal">{{ _('Close Notice') }}</button> + <a class="btn btn-primary" href="/" role="button">{{ _('Return Home') }}</a> </div> </div> </div> </div> + {% endblock %} diff --git a/app/templates/continue_task.html b/app/templates/continue_task.html index ad2084d0a64987b6772fe1bd54d379d9fc7a7a25..7fb5d78eacb3a9acd34785536bbffcc05c186caa 100644 --- a/app/templates/continue_task.html +++ b/app/templates/continue_task.html @@ -6,7 +6,9 @@ <div class="row mt-5 display-4"><br></div> <br> -<h1 class="mt-5 display-4"><br>Please insert your participant ID:</h1><br> +<h1 class="mt-5 display-4"><br>{{ _('Please insert your participant ID:') }}</h1><br> + + <form action="" method="post"> {{ form.hidden_tag() }} <p> diff --git a/app/templates/create_experiment.html b/app/templates/create_experiment.html index 97c32750bc5003430c0edb997beb6ef618302be4..2243a5355bd56c3a414d6dd2e85d57ae61adacc0 100644 --- a/app/templates/create_experiment.html +++ b/app/templates/create_experiment.html @@ -11,15 +11,15 @@ <div class="col-12"> <form action="" method="post" role="form"> <div class="form-group"> - <label for="name">Experiment name:</label> - <input required type="text" class="form-control" id="name" name="name" placeholder="Name?"> + <label for="name">Your name:</label> + <input required type="text" class="form-control" id="creator_name" name="creator_name" placeholder="Creator name?"> + <br> + <label for="name">Name of the experiment:</label> + <input required type="text" class="form-control" id="name" name="name" placeholder="Experiment name?"> <br> - <label for="instruction">Instructions:</label> - <input required type="text" class="form-control" id="instruction" name="instruction" placeholder="Instructions?"> - <br> <div class="form-group"> - <label for="language">Language:</label> + <label for="language">Select a language for the experiment:</label> <select class="form-control" id="language" name="language"> <option disabled selected value></option> <option value="Afrikanns">Afrikanns</option> @@ -95,8 +95,35 @@ <option value="Welsh">Welsh</option> <option value="Xhosa">Xhosa</option> </select> - </div> - </div> + +<br> + <p>Instructions for the experiment come in three forms: + <br> (1) A single sentence instruction that is shown during the rating task above the sliders. + <br> (2) A short general description of the task that is shown on the experiment listing on Onni's front page and on the informed consent page. + <br> (3) a longer detailed explanation of the instructions that is shown to the participant after the consent and before the rating task begins. + <br> Please input all three types of instructions below: + </p> + + <label for="single_sentence_instruction">(1) Single sentence:</label> + <input required type="text" class="form-control" id="single_sentence_instruction" name="single_sentence_instruction" placeholder="Input here" required> + <br> + <label for="short_instruction">(2) Short description:</label> + <textarea class="form-control" rows="5" id="short_instruction" name="short_instruction" placeholder="Input here" required></textarea> + <br> + + + <label for="instruction">(3) Longer version:</label> + <textarea class="form-control" rows="15" id="instruction" name="instruction" placeholder="Input here" required></textarea> + <br> + + + <label for="instruction">Please input consent form text</label> + <textarea class="form-control" rows="15" id="consent_text" name="consent_text" placeholder="Input here" required></textarea> + <br> + + + </div> + </div> <br> <button type="submit" class="btn btn-primary">Submit</button> </form> diff --git a/app/templates/create_experiment_questions.html b/app/templates/create_experiment_questions.html index a3401e84a9609ec24e562d5abec5542232b462ba..8e990cf34731f4ec23bf72d3a04cfbb43434a9fa 100644 --- a/app/templates/create_experiment_questions.html +++ b/app/templates/create_experiment_questions.html @@ -5,7 +5,7 @@ <h1 class="container mt-5 display-4 text-center"><br>Create new experiment: (3/4)</h1> <br> <p class="lead">Please paste the slider set questions followed by the left and right ends of the scales separated with a ; Place a /n after the right scale to input another question - followed by the corresponding scales. Make sure you do not input the /n after the last question. + followed by the corresponding scales. Make sure you do not input the /n after the last question! <br> <br> @@ -25,7 +25,7 @@ <form action="" method="post" role="form"> <div class="form-group"> - <label for="questions_and_options">Question;left scale;right scale/n</label> + <label for="questions_and_options">(NOTE! Do not input /n after the last right scale)</label> <textarea class="form-control" rows="15" id="questions_and_options" name="questions_and_options"></textarea> </div> <button type="submit" class="btn btn-primary">Submit</button> diff --git a/app/templates/create_experiment_upload_stimuli.html b/app/templates/create_experiment_upload_stimuli.html index c718d5f672654af25782552990f23e595f79e3d6..979ed4a6d0a939d08bea1cc8fbf4d488ad7ff0a7 100644 --- a/app/templates/create_experiment_upload_stimuli.html +++ b/app/templates/create_experiment_upload_stimuli.html @@ -44,10 +44,6 @@ </div> </fieldset> - - - - <div class="form-group"> <legend>2. Use this box to upload text stimuli:</legend> <label for="text_stimulus font-weight-bold">Example: text1 /n text2 /n text3</label> @@ -62,7 +58,7 @@ <span class="input-group-text">Upload:</span> </div> <div class="custom-file"> - <input type="file" class="custom-file-input" id="file" name="file" accept="audio/*,video/*,image/*" multiple> + <input type="file" class="custom-file-input" id="file" name="file" accept="audio/*,image/*, .mp4" multiple> <label class="custom-file-label" for="upload_file">Choose file</label> </div> </div> diff --git a/app/templates/edit_experiment.html b/app/templates/edit_experiment.html index 8815f36c9f2636cbba298c256a9d6a979aa3702d..daac53719a8f2fd972c0e23ce31b30ad88bb1686 100644 --- a/app/templates/edit_experiment.html +++ b/app/templates/edit_experiment.html @@ -20,10 +20,27 @@ <label for="Name">Name:</label> <input type="text" class="form-control" id="name" name="name" placeholder={{ form.name }} <br> - <label for="Instruction">Instructions:</label> - <input required type="text" class="form-control" id="instruction" name="instruction" placeholder= {{ form.instruction }} + <label for="Name">Creator:</label> + <input type="text" class="form-control" id="creator_name" name="creator_name" placeholder={{ form.creator_name }} + <br> + <label for="Instruction">Single sentence instruction:</label> + <input required type="text" class="form-control" id="instruction" name="single_sentence_instruction" placeholder= {{ form.single_sentence_instruction }} + <br> + <label for="Instruction">Short description:</label> + <textarea required class="form-control" rows="5" id="short_instruction" name="short_instruction" placeholder= {{ form.short_instruction }} </textarea> + <br> + + <label for="Instruction">Long instructions:</label> + <textarea required class="form-control" rows="10" id="instruction" name="instruction" placeholder={{ form.instruction }} </textarea> <br> + + <label for="Consent_form_text">Consent form text:</label> + <textarea required class="form-control" rows="10" id="consent_text" name="consent_text" placeholder={{ form.consent_text }} </textarea> + <br> + + {{ render_field(form.language) }} + {{ render_field(form.stimulus_size) }} <p>Note. When sizing text stimuli the size changes only in increments of 2 of this variable. </div> <br> <button type="submit" class="btn btn-primary">Update</button> diff --git a/app/templates/experiment_statistics.html b/app/templates/experiment_statistics.html index 45fe3c5bb14d5509d7071cf85275c66cb0709c6f..d5c7b648cd770163e2c9404bfed649fab1508d60 100644 --- a/app/templates/experiment_statistics.html +++ b/app/templates/experiment_statistics.html @@ -35,7 +35,7 @@ </tr> <tr> <td>Number of finished ratings:</td> - <td>??</td> + <td>{{ finished_ratings }}</td> </tr> <tr> <td><a class="btn btn-primary btn-info" href="{{ url_for('download_csv', exp_id=exp.idexperiment) }}" role="button">Export results (csv)</a></td> @@ -46,18 +46,90 @@ {% endfor %} -<h1 class="container mt-5 display-4 text-left"><br>Rating task values:</h1> + + +<h1 class="container mt-5 display-4 text-left"><br>Rating task question headers:</h1> +<br> +<table class="table"> + <thead> + <tr> + <th scope="col" nowrap>Question ID:</td> + <th scope="col" nowrap>Question:</th> + <th scope="col" nowrap>Left scale</th> + <th scope="col" nowrap>Right scale</th> + </tr> + </thead> + <tbody> + {% for q in question_headers %} + <tr> + <td>{{ q.idquestion }}</td> + <td>{{ q.question }}</td> + <td>{{ q.left }}</td> + <td>{{ q.right }}</td> + </tr> + {% endfor %} + </tbody> +</table> + +<h1 class="container mt-5 display-4 text-left"><br>Rating task stimulus headers:</h1> +<br> +<table class="table"> + <thead> + <tr> + <th scope="col" nowrap>Stimulus ID:</td> + <th scope="col" nowrap>Stimulus:</th> + </tr> + </thead> + <tbody> + {% for s in stimulus_headers %} + <tr> + <td>{{ s.idpage }}</td> + {% if s.type == 'text' %} + <td>{{ s.text }}</td> + {% else %} + <td>{{ s.media }}</td> + {% endif %} + + </tr> + {% endfor %} + </tbody> +</table> + + + + + + + + + + + + + + + + + + + + + + + +<h1 class="container mt-5 display-4 text-left"><br>Rating task values: (Stimulus ID/Question ID)</h1> <br> <table class="table"> <thead> + <tr> - <th scope="col" nowrap>Page ID/Question:</td> + <th scope="col" nowrap>Participant ID:</th> {% for page in pages_and_questions %} {% for p in pages_and_questions[page] %} - <th scope="col" nowrap>{{ p[0]}} / {{ p[1]}} </th> + <th scope="col" nowrap>{{ p[0]}}/{{ p[1]}}</th> {% endfor %} {% endfor %} @@ -68,7 +140,7 @@ <tr> <td>{{ participant }}</td> {% for answer in participants_and_answers[participant] %} - <td align="center">{{ answer[3] }}</td> + <td>{{ answer[3] }}</td> {% endfor %} </tr> {% endfor %} diff --git a/app/templates/index.html b/app/templates/index.html index 5aa7c8c65c8b958484e6cf0e230bf65e2d64e450..aa611a6313be41ef4b21459b978aa4ec2b6508d3 100644 --- a/app/templates/index.html +++ b/app/templates/index.html @@ -2,50 +2,53 @@ {% block content %} + <h1 class="container mt-5 display-4 text-center"><br>{{ _('Welcome to Onni') }}</h1> <br> <br> - <p class="lead text-center">This is the Human Emotion Systems laboratorys stimulus rating tool. If you have previously started a rating task you can continue that task on this page. If you are a researcher you can create new rating tasks by <a href="{{ url_for('login') }}">logging in.</a> - Or you can start a new rating task and start rating by selecting a task from the database list below. + <p class="lead text-center">{{ _('This is the Human Emotion Systems laboratorys stimulus rating tool. If you have previously started a rating task you can continue that task on this page. If you are a researcher you can create new rating tasks by logging in. Or you can start a new rating task and start rating by selecting a task from the database list below.') }}</p> <br> <br> - You can choose the language suitable for you from the language menu in the upper right corner + + <p class="lead text-center">{{ _('You can choose the language suitable for you from the language menu in the upper right corner') }}</p> + </p> <div class="row"> <div class="col mt-5"> - <h3>List of experiments in database:</h3> + <h3>{{ _('List of experiments in database:') }}</h3> {% block attributes %} {% for exp in experiments %} {% if exp.status == 'Public' and session['language'] == exp.language %} <ul class="list-group mb-4"> - <li class="list-group-item active"><span class="font-weight-bold">Name:</span> {{ exp.name }} </li> - <li class="list-group-item"><span class="font-weight-bold">Instruction:</span> {{ exp.instruction }}</li> + <li class="list-group-item active"><span class="font-weight-bold">{{ _('Name:') }}</span> {{ exp.name }} </li> + <li class="list-group-item"><span class="font-weight-bold">{{ _('Instruction:') }}</span> {{ exp.short_instruction }}</li> {% if current_user.is_authenticated %} <li class="list-group-item"><span class="font-weight-bold">ID number:</span> {{ exp.idexperiment }} </li> <li class="list-group-item"><span class="font-weight-bold">Language:</span> {{ exp.language }}</li> <li class="list-group-item"><span class="font-weight-bold">Status:</span> {{ exp.status }}</li> {% endif %} + + {% if exp.use_forced_id == 'On'%} + <li class="list-group-item"><span class="font-weight-bold">{{ _('Participation ID is required for this task.') }}</li> + {% endif %} + <li class="list-group-item"> - <button class="btn btn-outline-success dropdown-toggle" type="button" id="dropdownMenuButton" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"> - Begin task - </button> - <div class="dropdown-menu" aria-labelledby="dropdownMenuButton"> - <a class="dropdown-item" href="{{ url_for('consent', exp_id=exp.idexperiment) }}">As a new participant</a> - <a class="dropdown-item" href="{{ url_for('begin_with_id', exp_id=exp.idexperiment) }}">I have received an ID to use for this task</a> - </div> - <a class="btn btn-outline-success" href="{{ url_for('continue_task', exp_id=exp.idexperiment) }}" role="button">Continue task</a> + + + <a class="btn btn-outline-success" href="{{ url_for('consent', exp_id=exp.idexperiment) }}" role="button">{{ _('Begin task') }}</a> + <a class="btn btn-outline-success" href="{{ url_for('continue_task', exp_id=exp.idexperiment) }}" role="button">{{ _('Continue task') }}</a> {% if current_user.is_authenticated %} - - - <a class="btn btn-outline-info" href="{{ url_for('experiment_statistics', exp_id=exp.idexperiment) }}" role="button">Statistics</a> - <a class="btn btn-outline-info" href="{{ url_for('view_experiment', exp_id=exp.idexperiment) }}" role="button">View / Edit</a> + <span class="text-right"> + <a class="btn btn-outline-info" href="{{ url_for('admin_dryrun', exp_id=exp.idexperiment) }}" role="button">{{ _('AdminRun') }}</a> + <a class="btn btn-outline-info" href="{{ url_for('experiment_statistics', exp_id=exp.idexperiment) }}" role="button">{{ _('Statistics') }}</a> + <a class="btn btn-outline-info" href="{{ url_for('view_experiment', exp_id=exp.idexperiment) }}" role="button">{{ _('View / Edit') }}</a> {% endif %} - + </li> </ul> <br> <br> @@ -55,32 +58,32 @@ {% if exp.status == 'Public' and session['language'] == "All" %} <ul class="list-group mb-4"> - <li class="list-group-item active"><span class="font-weight-bold">Name:</span> {{ exp.name }} </li> - <li class="list-group-item"><span class="font-weight-bold">Instruction:</span> {{ exp.instruction }}</li> + <li class="list-group-item active"><span class="font-weight-bold">{{ _('Name:') }}</span> {{ exp.name }} </li> + <li class="list-group-item"><span class="font-weight-bold">{{ _('Instruction:') }}</span> {{ exp.short_instruction }}</li> {% if current_user.is_authenticated %} <li class="list-group-item"><span class="font-weight-bold">ID number:</span> {{ exp.idexperiment }} </li> <li class="list-group-item"><span class="font-weight-bold">Language:</span> {{ exp.language }}</li> <li class="list-group-item"><span class="font-weight-bold">Status:</span> {{ exp.status }}</li> {% endif %} + {% if exp.use_forced_id == 'On'%} + <li class="list-group-item"><span class="font-weight-bold">{{ _('Participation ID is required for this task.') }}</li> + {% endif %} + + <li class="list-group-item"> - <button class="btn btn-outline-success dropdown-toggle" type="button" id="dropdownMenuButton" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"> - Begin task - </button> - <div class="dropdown-menu" aria-labelledby="dropdownMenuButton"> - <a class="dropdown-item" href="{{ url_for('consent', exp_id=exp.idexperiment) }}">As a new participant</a> - <a class="dropdown-item" href="{{ url_for('begin_with_id', exp_id=exp.idexperiment) }}">I have received an ID to use for this task</a> - </div> - <a class="btn btn-outline-success" href="{{ url_for('continue_task', exp_id=exp.idexperiment) }}" role="button">Continue task</a> + + <a class="btn btn-outline-success" href="{{ url_for('consent', exp_id=exp.idexperiment) }}" role="button">{{ _('Begin task') }}</a> + <a class="btn btn-outline-success" href="{{ url_for('continue_task', exp_id=exp.idexperiment) }}" role="button">{{ _('Continue task') }}</a {% if current_user.is_authenticated %} - - - <a class="btn btn-outline-info" href="{{ url_for('experiment_statistics', exp_id=exp.idexperiment) }}" role="button">Statistics</a> - <a class="btn btn-outline-info" href="{{ url_for('view_experiment', exp_id=exp.idexperiment) }}" role="button">View / Edit</a> + <span class="text-right"> + <a class="btn btn-outline-info" href="{{ url_for('admin_dryrun', exp_id=exp.idexperiment) }}" role="button">{{ _('AdminRun') }}</a> + <a class="btn btn-outline-info" href="{{ url_for('experiment_statistics', exp_id=exp.idexperiment) }}" role="button">{{ _('Statistics') }}</a> + <a class="btn btn-outline-info" href="{{ url_for('view_experiment', exp_id=exp.idexperiment) }}" role="button">{{ _('View / Edit') }}</a> {% endif %} - + </li> </ul> <br> <br> @@ -92,24 +95,23 @@ <h3>Unpublished experiment:</h3> <ul class="list-group mb-4"> <li class="list-group-item list-group-item-dark"><span class="font-weight-bold">Name:</span> {{ exp.name }} </li> - <li class="list-group-item"><span class="font-weight-bold">Instruction:</span> {{ exp.instruction }}</li> + <li class="list-group-item"><span class="font-weight-bold">Instruction:</span> {{ exp.short_instruction }}</li> {% if current_user.is_authenticated %} <li class="list-group-item"><span class="font-weight-bold">ID number:</span> {{ exp.idexperiment }} </li> <li class="list-group-item"><span class="font-weight-bold">Language:</span> {{ exp.language }}</li> <li class="list-group-item"><span class="font-weight-bold">Status:</span> {{ exp.status }}</li> {% endif %} + {% if exp.use_forced_id == 'On'%} + <li class="list-group-item"><span class="font-weight-bold">Participation ID is required for this task.</li> + {% endif %} + + <li class="list-group-item"> - <button class="btn btn-outline-success dropdown-toggle" type="button" id="dropdownMenuButton" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"> - Begin task - </button> - <div class="dropdown-menu" aria-labelledby="dropdownMenuButton"> - <a class="dropdown-item" href="{{ url_for('consent', exp_id=exp.idexperiment) }}">As a new participant</a> - <a class="dropdown-item" href="{{ url_for('begin_with_id', exp_id=exp.idexperiment) }}">I have received an ID to use for this task</a> - </div> + <a class="btn btn-outline-success" href="{{ url_for('consent', exp_id=exp.idexperiment) }}" role="button">Begin task</a> <a class="btn btn-outline-success" href="{{ url_for('continue_task', exp_id=exp.idexperiment) }}" role="button">Continue task</a> {% if current_user.is_authenticated %} - + <a class="btn btn-outline-info" href="{{ url_for('admin_dryrun', exp_id=exp.idexperiment) }}" role="button">AdminRun</a> <a class="btn btn-outline-info" href="{{ url_for('experiment_statistics', exp_id=exp.idexperiment) }}" role="button">Statistics</a> <a class="btn btn-outline-info" href="{{ url_for('view_experiment', exp_id=exp.idexperiment) }}" role="button">View / Edit</a> @@ -126,24 +128,23 @@ <h3>Unpublished experiment:</h3> <ul class="list-group mb-4"> <li class="list-group-item list-group-item-dark"><span class="font-weight-bold">Name:</span> {{ exp.name }} </li> - <li class="list-group-item"><span class="font-weight-bold">Instruction:</span> {{ exp.instruction }}</li> + <li class="list-group-item"><span class="font-weight-bold">Instruction:</span> {{ exp.short_instruction }}</li> {% if current_user.is_authenticated %} <li class="list-group-item"><span class="font-weight-bold">ID number:</span> {{ exp.idexperiment }} </li> <li class="list-group-item"><span class="font-weight-bold">Language:</span> {{ exp.language }}</li> <li class="list-group-item"><span class="font-weight-bold">Status:</span> {{ exp.status }}</li> {% endif %} + {% if exp.use_forced_id == 'On'%} + <li class="list-group-item"><span class="font-weight-bold">Participation ID is required for this task.</li> + {% endif %} + + <li class="list-group-item"> - <button class="btn btn-outline-success dropdown-toggle" type="button" id="dropdownMenuButton" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"> - Begin task - </button> - <div class="dropdown-menu" aria-labelledby="dropdownMenuButton"> - <a class="dropdown-item" href="{{ url_for('consent', exp_id=exp.idexperiment) }}">As a new participant</a> - <a class="dropdown-item" href="{{ url_for('begin_with_id', exp_id=exp.idexperiment) }}">I have received an ID to use for this task</a> - </div> + <a class="btn btn-outline-success" href="{{ url_for('consent', exp_id=exp.idexperiment) }}" role="button">Begin task</a> <a class="btn btn-outline-success" href="{{ url_for('continue_task', exp_id=exp.idexperiment) }}" role="button">Continue task</a> {% if current_user.is_authenticated %} - + <a class="btn btn-outline-info" href="{{ url_for('admin_dryrun', exp_id=exp.idexperiment) }}" role="button">AdminRun</a> <a class="btn btn-outline-info" href="{{ url_for('experiment_statistics', exp_id=exp.idexperiment) }}" role="button">Statistics</a> <a class="btn btn-outline-info" href="{{ url_for('view_experiment', exp_id=exp.idexperiment) }}" role="button">View / Edit</a> diff --git a/app/templates/instructions.html b/app/templates/instructions.html index 6c2c32016ea0eae0816aff45767be74ed826a5a5..0049144c856f0241a09a8eedc756c7fe1ba515aa 100644 --- a/app/templates/instructions.html +++ b/app/templates/instructions.html @@ -1,7 +1,7 @@ {% extends "base.html" %} {% block content %} -<h1 class="row mt-5 display-4"><br>Rating task instructions:</h1> +<h1 class="container mt-5 display-4"><br>{{ _('Instructions:') }}</h1> {% block attributes %} @@ -11,14 +11,14 @@ {% endblock %} <br> -<h3 class="row display-5 text-danger"> Notice!</h3> -<div class="row lead">If you wish to quit a rating task before it is fully completed, you can return to finish the task later but you will need your participant ID-number in order to do that. Please save your participant ID before starting the rating task!</div> +<h3 class="row display-5 text-danger">{{ _('Notice!') }}</h3> +<div class="row lead">{{ _('If you wish to quit a rating task before it is fully completed, you can return to finish the task later but you will need your participant ID-number in order to do that. Please save your participant ID before starting the rating task!') }}</div> <br> -<h4 class="row">Your participant ID is: <div class="text-danger"> {{ session['user'] }} </div></h4> +<h4 class="row">{{ _('Your participant ID is:') }} <div class="text-danger"> {{ session['user'] }} </div></h4> <br> -<a class="btn btn-primary" href="/task/1" role="button">I'm ready to start</a> +<a class="btn btn-primary" href="/task/1" role="button">{{ _('Ready to start') }}</a> {% endblock %} diff --git a/app/templates/quit_task.html b/app/templates/quit_task.html index 78efec3d46bc1ca0db1c095b4132130bbd02fc4d..9a82201a6bb4f1269ed033137f97af0b05e7ff2e 100644 --- a/app/templates/quit_task.html +++ b/app/templates/quit_task.html @@ -1,16 +1,16 @@ {% extends "base.html" %} {% block content %} -<h1 class="row mt-5 display-4"><br>Notice!</h1> +<h1 class="container mt-5 display-4"><br>{{ _('Notice!') }}</h1> <br> -<h3 class="row display-5 text-danger"> Notice!</h3> -<div class="row lead">Please write down your participant ID so you can return and finish the rating task later!</div> +<h3 class="row display-5 text-danger">{{ _('Notice!') }}</h3> +<div class="row lead">{{ _('Please write down your participant ID so you can return and finish the rating task later!') }}</div> <br> -<h4 class="row">Your participant ID is: <div class="text-danger"> {{ user_id }} </div></h4> +<h4 class="row">{{ _('Your participant ID is:') }} <div class="text-danger"> {{ user_id }} </div></h4> <br> -<a class="btn btn-primary" href="/" role="button">Quit!</a> +<a class="btn btn-primary" href="/" role="button">{{ _('Quit!') }}</a> {% endblock %} \ No newline at end of file diff --git a/app/templates/register.html b/app/templates/register.html index 95260751616e59f263bb3831bbdb04d4fe8f978b..aaf34c1e98cb187f6ce973d925a6ff590630fd38 100644 --- a/app/templates/register.html +++ b/app/templates/register.html @@ -3,15 +3,15 @@ {% block content %} <div class="container text-center mt-5"> - <h1 class="display-4"><br>This is the registration page.</h1> - <p class="lead"> Please fill in these background questions before starting the rating task:</p> + <h1 class="display-4"><br>{{ _('This is the registration page.') }}</h1> + <p class="lead">{{ _('Please fill in these background questions before starting the rating task:') }}</p> </div> <form class="form-group" action="" method="post"> {% for options in form.questions1 %} <div class="form-group"> <label for="{{ options[0] }}">{{ options[1] }}</label> <select required class="form-control" name="{{ options[0] }}"> - <option disabled selected value></option> + <option disabled selected value>{{ _('Please select') }}</option> {% for op in form.questions1[options] %} <option value="{{ op[0] }}" name="{{ op[0] }}">{{ op[0] }}</option> {% endfor %} @@ -19,7 +19,7 @@ </div> {% endfor %} <p> - <button type="submit" class="btn btn-primary">Submit</button> + <button type="submit" class="btn btn-primary">{{ _('Submit') }}</button> </p> </form> diff --git a/app/templates/researcher_info.html b/app/templates/researcher_info.html index 0a79d0d92bfbb0910a6e876465c50618a1f5e46e..62f79b915b10dc27f740219c16ada959fe06daa3 100644 --- a/app/templates/researcher_info.html +++ b/app/templates/researcher_info.html @@ -1,7 +1,7 @@ {% extends "base.html" %} {% block content %} -<h1 class="row mt-5 display-4"><br>How to prepare your stimuli before uploading:</h1> +<h1 class="container mt-5 display-4"><br>How to prepare your stimuli before uploading:</h1> <br> <h4 class="">How to split audiofiles into sections:</h4> diff --git a/app/templates/task.html b/app/templates/task.html index d0d8ade298f3e76f8bb1e0e11f71303766f60b71..558975d8de82996bd91276667c0334ff11d50423 100644 --- a/app/templates/task.html +++ b/app/templates/task.html @@ -1,7 +1,7 @@ {% extends "base.html" %} {% block content %} -<br> + <br> {% if session['randomization']=='Off' %} @@ -10,15 +10,15 @@ {% if session['type']=='text' %} <div class="container text-center mt-5 pt-5"> {% for page in pages.items %} - <h3 class="text-center mt-5"><br>{{ page.text }}</h3> + <h{{ stimulus_size_text }} class="text-center mt-5"><br>{{ page.text }}</h{{ stimulus_size_text }}> {% endfor %} </div> - <br><br><br><br><br> + <br><br> {% endif %} {% if session['type']=='picture' %} - <div class="container stimulus col-9 mt-5 pt-5"> + <div class="container stimulus col-{{stimulus_size}} mt-5 pt-5"> {% for page in pages.items %} <img src="/{{ page.media }}" class="img-fluid"> {% endfor %} @@ -27,7 +27,7 @@ {% if session['type']=='video' %} - <div class="col-9 container stimulus mt-5 pt-5"> + <div class="col-{{stimulus_size}} container stimulus mt-5 pt-5"> {% for page in pages.items %} <div class="embed-responsive embed-responsive-16by9"> <iframe class="embed-responsive-item" src="/{{ page.media }}" allowfullscreen></iframe> @@ -38,7 +38,7 @@ {% if session['type']=='audio' %} - <div class="col-4 container stimulus mt-5 pt-5"> + <div class="col-{{stimulus_size}} container stimulus mt-5 pt-5"> {% for page in pages.items %} <div class="embed-responsive embed-responsive-16by9"> <iframe class="embed-responsive-item" src="/{{ page.media }}" allowfullscreen></iframe> @@ -55,15 +55,15 @@ {% if session['type']=='text' %} <div class="container text-center mt-5 pt-5"> {% for page in pages.items %} - <h3 class="text-center mt-5"><br>{{ randomized_stimulus.text }}</h3> + <h{{ stimulus_size_text }} class="text-center mt-5"><br>{{ randomized_stimulus.text }}</h{{ stimulus_size_text }}> {% endfor %} </div> - <br><br><br><br><br> + <br><br> {% endif %} {% if session['type']=='picture' %} - <div class="container stimulus col-9 mt-5 pt-5"> + <div class="container stimulus col-{{stimulus_size}} mt-5 pt-5"> {% for page in pages.items %} <img src="/{{ randomized_stimulus.media }}" class="img-fluid"> {% endfor %} @@ -72,7 +72,7 @@ {% if session['type']=='video' %} - <div class="col-9 container stimulus mt-5 pt-5"> + <div class="col-{{stimulus_size}} container stimulus mt-5 pt-5"> {% for page in pages.items %} <div class="embed-responsive embed-responsive-16by9"> <iframe class="embed-responsive-item" src="/{{ randomized_stimulus.media }}" allowfullscreen></iframe> @@ -83,7 +83,7 @@ {% if session['type']=='audio' %} - <div class="col-4 container stimulus mt-5 pt-5"> + <div class="col-{{stimulus_size}} container stimulus mt-5 pt-5"> {% for page in pages.items %} <div class="embed-responsive embed-responsive-16by9"> <iframe class="embed-responsive-item" src="/{{ randomized_stimulus.media }}" allowfullscreen></iframe> @@ -96,39 +96,40 @@ {% endif %} - - - - - - <br> - <h4 class="text-center">Rate the above stimulus based on these categories</h4> + + + + <h4 class="text-center">{{ rating_instruction }}</h4> <form class="form-group mt-5" action="" method="post"> {% for category in form.categories1 %} {% for scale in form.categories1[category] %} - <div class="row form-group"> - <div class="col-2 text-center"> - <p>{{ scale[0] }}</p> - </div> - <div class="col text-center"> + <div class="row form-group mt-0 mb-0"> + <h6 class="col-3 text-right mt-0 mb-0"> + {{ scale[0] }} + </h6> + <h6 class="col text-center mt-0 mb-0"> <label for="customRange">{{ category[1] }}</label> <input type="range" class="custom-range" id="customRange" name={{ category[0] }}> - </div> - <div class="col-2 text-center"> - <p>{{ scale[1] }}</p> - </div> + </h6> + <h6 class="col-3 text-left mt-0 mb-0"> + {{ scale[1] }} + </h6> </div> {% endfor %} {% endfor %} <div class="form-row text-center"> <div class="col-12"> - <a class="btn btn-primary" href={{ url_for('quit_task') }} role="button">Quit task</a> - <button type="submit" class="btn btn-primary">Next page</button> + <a class="btn btn-primary" href={{ url_for('quit_task') }} role="button">{{ _('Quit task') }}</a> + <button type="submit" class="btn btn-primary">{{ _('Next page') }}</button> + </div> + <div class="col-12"> + <br> + <p>{{ _('You can zoom in/out the page view by pressing ctrl+/ctrl- (Windows) or ⌘+/⌘- (Mac)') }} </p> </div> </div> </form> diff --git a/app/templates/task_completed.html b/app/templates/task_completed.html index a12ea8d9e2c5d75ba9b02657213782b911f0a45d..631f82b0ec9a9753cb56d68af42fa7c6baa0273c 100644 --- a/app/templates/task_completed.html +++ b/app/templates/task_completed.html @@ -4,15 +4,15 @@ <h1 class="row mt-5 display-4"> <div class="container text-center"> - <br>Task completed!</h1> + <br>{{ _('Task completed!') }}</h1> <br> </div> <div class="container text-center lead"> - <p>You have completed the rating task. Thank you for your participation :)</p> + <p>{{ _('You have completed the rating task. Thank you for your participation.') }}</p> </div> <p> <div class="container text-center"> - <a class="btn btn-primary" href="/" role="button">Return Home</a> + <a class="btn btn-primary" href="/" role="button">{{ _('Return Home') }}</a> </div> diff --git a/app/templates/test_page.html b/app/templates/test_page.html new file mode 100644 index 0000000000000000000000000000000000000000..f204c39477795dadca6e12d1f1f75ea5fe1315f6 --- /dev/null +++ b/app/templates/test_page.html @@ -0,0 +1,12 @@ +{% extends "base.html" %} +{% block content %} + +<h1 class="container mt-5">moro</h1> + + +<h1 class="container mt-5">{{ _('File Not Found') }}</h1> + +{% endblock %} + + + diff --git a/app/templates/upload_research_notification.html b/app/templates/upload_research_notification.html new file mode 100644 index 0000000000000000000000000000000000000000..57ebed89cc706d10819be9f1e30100eb5f5c07fe --- /dev/null +++ b/app/templates/upload_research_notification.html @@ -0,0 +1,38 @@ +{% extends "base.html" %} +{% block content %} +<h1 class="container mt-5 display-4 text-center"><br>Upload research bulletin:</h1> +<br> +<p class="lead"></p> + {% from "_formhelpers.html" import render_field %} + <form id="UploadResearchBulletinForm" action="" method="POST" role="form" enctype="multipart/form-data"> + <div class="input-group mb-3"> + <legend>Add bulletin imagefile:</legend> + <div class="input-group-prepend"> + <span class="input-group-text">Upload:</span> + </div> + <div class="custom-file"> + <input type="file" class="custom-file-input" id="file" name="file" accept="image/*" required> + <label class="custom-file-label" for="upload_file">Choose file</label> + </div> + </div> + + + + + + + + + + + + + + + <br> + <button type="submit" class="btn btn-primary">Submit</button> + <a class="btn btn-primary" href="{{ request.referrer }}" role="button">Cancel</a> +</form> +{% endblock %} + + diff --git a/app/templates/view_experiment.html b/app/templates/view_experiment.html index 512a1d8ff6f867de2ea1477ff08bfe4876216199..095aae36107c7efe45f38a0fd2b8407285ca4ce4 100644 --- a/app/templates/view_experiment.html +++ b/app/templates/view_experiment.html @@ -11,8 +11,10 @@ {% for exp in experiment_info %} + + <tr> - <td>Name:</td> + <td nowrap>Name:</td> <td>{{ exp.name }}</td> <td> <button type="button" class="btn btn-primary btn-block btn-sm btn-dark" data-toggle="modal" data-target="#myModal-remove">Remove experiment</button> @@ -39,7 +41,7 @@ </td> </tr> <tr> - <td>Status:</td> + <td nowrap>Status:</td> <td>{{ exp.status }}</td> <td> {% if exp.status == 'Hidden' %} @@ -49,17 +51,33 @@ <a class="btn btn-primary btn-block btn-sm btn-info" href="{{ url_for('hide_experiment', exp_id=exp.idexperiment) }}" role="button">Hide experiment</a></td> {% endif %} </tr> + <tr> - <td class"col-1">Instructions:</td> - <td class"col-10">{{ exp.instruction }}</td> - <td class"col-1"> - <a class="btn btn-primary btn-block btn-sm btn-info" href="{{ url_for('edit_experiment', exp_id=exp.idexperiment) }}" role="button">Edit info</a> - </td> + <td nowrap>Creator:</td> + <td>{{ exp.creator_name }} - {{ exp.creation_time }}</td> + <td nowrap></td> </tr> <tr> - <td>Trial randomization:</td> + <td nowrap>Language:</td> + <td>{{ exp.language }}</td> + <td nowrap></td> + </tr> + <tr> + <td nowrap>Stimulus type:</td> + <td>{{ mtype.type }}</td> + <td nowrap></td> + </tr> + <tr> + <td nowrap>Stimulus size:</td> + <td>{{ exp.stimulus_size }}</td> + <td nowrap> + </td> + </tr> + + <tr> + <td nowrap>Trial randomization:</td> <td>{{ exp.randomization }}</td> - <td> + <td nowrap> {% if exp.randomization == 'Off' %} <a class="btn btn-primary btn-block btn-sm btn-info" href="{{ url_for('enable_randomization', exp_id=exp.idexperiment) }}" role="button">Enable</a></td> {% endif %} @@ -67,24 +85,65 @@ <a class="btn btn-primary btn-block btn-sm btn-info" href="{{ url_for('disable_randomization', exp_id=exp.idexperiment) }}" role="button">Disable</a></td> {% endif %} - </td> + </td> + </tr> + <td nowrap>Use forced ID for participants:</td> + <td>{{ exp.use_forced_id }}</td> + <td nowrap> + {% if exp.use_forced_id == 'Off' %} + <a class="btn btn-primary btn-block btn-sm btn-info" href="{{ url_for('enable_forced_id', exp_id=exp.idexperiment) }}" role="button">Enable</a> + + + {% endif %} + {% if exp.use_forced_id == 'On' %} + <a class="btn btn-primary w-50 btn-sm btn-info" href="{{ url_for('disable_forced_id', exp_id=exp.idexperiment) }}" role="button">Disable</a> + <a class="btn btn-primary w-50 btn-sm btn-info" href="{{ url_for('view_forced_id_list', exp_id=exp.idexperiment) }}" role="button">Check ID</a> + {% endif %} + + </td> </tr> <tr> - <td>Language:</td> - <td>{{ exp.language }}</td> - <td></td> + <td> Research bulletin:</td> + <td> {{ exp.research_notification_filename }}</td> + {% if exp.research_notification_filename %} + <td> <a class="btn btn-primary btn-block btn-sm btn-info" href="{{ url_for('remove_research_notification', exp_id=exp.idexperiment) }}" role="button">Remove</a></td> + {% else %} + <td> <a class="btn btn-primary btn-block btn-sm btn-info" href="{{ url_for('upload_research_notification', exp_id=exp.idexperiment) }}" role="button">Upload</a></td> + {% endif %} </tr> - <tr> - <td>Stimulus type:</td> - <td>{{ mtype.type }}</td> - <td></td> + + <tr> + <td nowrap>Detailed instructions:</td> + <td>{{ exp.instruction }}</td> + <td nowrap> + <a class="btn btn-primary btn-block btn-sm btn-info" href="{{ url_for('edit_experiment', exp_id=exp.idexperiment) }}" role="button">Edit properties</a> + </td> </tr> <tr> - <td>Experiment ID:</td> + <td nowrap>Short description:</td> + <td>{{ exp.short_instruction }}</td> + <td nowrap></td> + </tr> + + <tr> + <td nowrap>Single sentence instruction:</td> + <td>{{ exp.single_sentence_instruction }}</td> + <td nowrap></td> + </tr> + + <tr> + <td nowrap>Consent form text:</td> + <td>{{ exp.consent_text }}</td> + <td nowrap></td> + </tr> + <tr> + <td nowrap>Experiment database ID:</td> <td>{{ exp.idexperiment }}</td> - <td></td> + <td nowrap></td> </tr> + + {% endfor %} </tbody> </table> @@ -100,10 +159,10 @@ <table class="table"> <tbody> <tr> - <td class="col-8"> + <td class="col-11"> <label for="{{ options[0] }}">{{ options[1] }}</label> <select required class="form-control" name="{{ options[0] }}"> - <option disabled selected value></option> + <option disabled selected value>Please select</option> {% for op in questions1[options] %} <option value="{{ op[0] }}" name="{{ op[0] }}">{{ op[0] }}</option> {% endfor %} @@ -218,7 +277,7 @@ <table class="table col-12"> <tbody> {% if mtype.type=='text' %} - {% for page in media.items %} + {% for page in media %} <tr class="col-12"> <td class="text-nowrap">Page ID: {{ page.idpage }} </td> @@ -260,7 +319,7 @@ {% else %} <div class="container col-12"> - {% for page in media.items %} + {% for page in media %} <tr class="col-12 text-left"> <td class="col-2 text-nowrap">Page ID: {{ page.idpage }} </td> diff --git a/app/templates/view_forced_id_list.html b/app/templates/view_forced_id_list.html new file mode 100644 index 0000000000000000000000000000000000000000..f7127d98cf7b9c9b05ee89c7578d736dd6b3b005 --- /dev/null +++ b/app/templates/view_forced_id_list.html @@ -0,0 +1,49 @@ +{% extends "base.html" %} +{% block content %} + + + <h1 class="container mt-5 display-4 text-center"><br>Forced ID login for participants:</h1> + <br> + <p class="lead">By using forced ID login subjects can only participate to a rating task by logging in with a pregenerated ID. + </p> + <br> + + <form action="" method="post" role="form"> + <div class="form-inline"> + <div class="form-group"> + <label class="col-form-label" for="number">Generate</label> + <input required type="number" min="0" class="form-control ml-2" name="number" id="number" placeholder="number"> + <label class="col-form-label" for="name"> of random IDs starting with a</label> + <input type="text" class="form-control ml-2" name="string" id="string" placeholder="string"> + <label class="col-form-label" for="name"> for this experiment -> </label> + <button type="submit" class="btn btn-primary ml-3">Generate IDs</button> + </div> + </div> + <br> + </form> + +<h4 class="text-left"><br>Usable participant IDs for this experiment:</h1> +<br> + + +<div class="container col-12"> +<table class="table"> +<tbody> + + +{% for id in id_list %} + +<tr> +<td> +{{ id.pregenerated_id }} + +</td> +</tr> + + +{% endfor %} + +</tbody> +</table> + +{% endblock %} \ No newline at end of file diff --git a/app/templates/view_research_notification.html b/app/templates/view_research_notification.html new file mode 100644 index 0000000000000000000000000000000000000000..f452f1219b9e18cb099e5e26cbb4e290d0db73c1 --- /dev/null +++ b/app/templates/view_research_notification.html @@ -0,0 +1,13 @@ +{% extends "base.html" %} +{% block content %} + + +<br> + <div class="container stimulus col-{{stimulus_size}} mt-5 pt-5"> + + <img src="/{{ research_notification_filename }}" class="img-fluid"> + + </div> + + +{% endblock %} \ No newline at end of file diff --git a/app/translations/el/LC_MESSAGES/messages.mo b/app/translations/el/LC_MESSAGES/messages.mo new file mode 100644 index 0000000000000000000000000000000000000000..c17b67a75d1e960a4f129d99f437698ddf0dd9dc Binary files /dev/null and b/app/translations/el/LC_MESSAGES/messages.mo differ diff --git a/app/translations/el/LC_MESSAGES/messages.po b/app/translations/el/LC_MESSAGES/messages.po new file mode 100644 index 0000000000000000000000000000000000000000..19abfce0c8dfb72029bbfb66e080db566c5779eb --- /dev/null +++ b/app/translations/el/LC_MESSAGES/messages.po @@ -0,0 +1,290 @@ +# Greek translations for PROJECT. +# Copyright (C) 2018 ORGANIZATION +# This file is distributed under the same license as the PROJECT project. +# FIRST AUTHOR <EMAIL@ADDRESS>, 2018. +# +msgid "" +msgstr "" +"Project-Id-Version: PROJECT VERSION\n" +"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n" +"POT-Creation-Date: 2018-11-28 14:59+0200\n" +"PO-Revision-Date: 2018-11-27 16:38+0200\n" +"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" +"Language: el\n" +"Language-Team: el <LL@li.org>\n" +"Plural-Forms: nplurals=2; plural=(n != 1)\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=utf-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Generated-By: Babel 2.6.0\n" + +#: app/forms.py:36 +msgid "Continue rating" +msgstr "Συνεχίστε την εÏγασία βαθμολόγησης" + +#: app/forms.py:41 +msgid "Start rating" +msgstr "Είμαι Îτοιμος να ξεκινήσω" + +#: app/routes.py:359 +msgid "ID already in use" +msgstr "" + +#: app/routes.py:368 +msgid "No such ID set for this experiment" +msgstr "" + +#: app/templates/base.html:43 +msgid "Task progress:" +msgstr "" + +#: app/templates/begin_with_id.html:8 +msgid "Please insert your ID-code below:" +msgstr "ΠαÏακαλώ εισάγετε τον κωδικό σας εδω" + +#: app/templates/begin_with_id.html:12 app/templates/consent.html:29 +#: app/templates/instructions.html:14 app/templates/quit_task.html:4 +#: app/templates/quit_task.html:7 +msgid "Notice!" +msgstr "Î Ïοσοχή!" + +#: app/templates/begin_with_id.html:13 +msgid "" +"Participation in this experiment requires a login with a predetermined ID" +" code. Please input ID below." +msgstr "" + +#: app/templates/consent.html:11 +msgid "Consent for participation:" +msgstr "" + +#: app/templates/consent.html:14 +msgid "Research bulletin can be read" +msgstr "" + +#: app/templates/consent.html:14 +msgid "here." +msgstr "" + +#: app/templates/consent.html:20 +msgid "Agree" +msgstr "Συμφωνώ" + +#: app/templates/consent.html:21 +msgid "Disagree" +msgstr "Διαφωνώ" + +#: app/templates/consent.html:32 +msgid "" +"In order to participate for the study you need to agree with the terms " +"presented." +msgstr "" +"Για να συμμετάσχετε στο πείÏαμα, Ï€ÏÎπει να αποδεχθείτε τους ÏŒÏους " +"συμμετοχής." + +#: app/templates/consent.html:35 +msgid "Close Notice" +msgstr "Κλείσε την ενημÎÏωση" + +#: app/templates/consent.html:36 app/templates/task_completed.html:15 +msgid "Return Home" +msgstr "Πίσω στην ΑÏχική Σελίδα" + +#: app/templates/continue_task.html:9 +msgid "Please insert your participant ID:" +msgstr "ΠαÏακαλώ εισάγετε τον κωδικό αναγνώÏισης σας" + +#: app/templates/index.html:6 +msgid "Welcome to Onni" +msgstr "Καλώς ήÏθατε" + +#: app/templates/index.html:9 +msgid "" +"This is the Human Emotion Systems laboratorys stimulus rating tool. If " +"you have previously started a rating task you can continue that task on " +"this page. If you are a researcher you can create new rating tasks by " +"logging in. Or you can start a new rating task and start rating by " +"selecting a task from the database list below." +msgstr "" +"Αυτό είναι το εÏγαλείο βαθμολόγησης των εÏεθισμάτων του εÏγαστηÏίου των " +"ανθÏώπινων συναισθημάτων. Εάν Îχετε ήδη ξεκινήσει μια εÏγασία " +"βαθμολόγησης, μποÏείτε να συνεχίσετε την εÏγασία αυτή σε αυτή τη σελίδα. " +"Αν είστε εÏευνητής, μποÏείτε να δημιουÏγήσετε νÎες εÏγασίες αξιολόγησης " +"συνδεόμενοι με το σÏστημα. Ή μποÏείτε να ξεκινήσετε μια νÎα αξιολόγηση " +"και να ξεκινήσετε την αξιολόγηση επιλÎγοντας μια εÏγασία αξιολόγησης από " +"την παÏακάτω λίστα βάσης δεδομÎνων" + +#: app/templates/index.html:13 +msgid "" +"You can choose the language suitable for you from the language menu in " +"the upper right corner" +msgstr "" + +#: app/templates/index.html:18 +msgid "List of experiments in database:" +msgstr "Λίστα των πειÏαμάτων" + +#: app/templates/index.html:25 app/templates/index.html:61 +msgid "Name:" +msgstr "" + +#: app/templates/index.html:26 app/templates/index.html:62 +msgid "Instruction:" +msgstr "" + +#: app/templates/index.html:34 app/templates/index.html:69 +msgid "Participation ID is required for this task." +msgstr "" + +#: app/templates/index.html:40 app/templates/index.html:75 +msgid "Begin task" +msgstr "Ξεκίνα την άσκηση" + +#: app/templates/index.html:41 app/templates/index.html:76 +msgid "Continue task" +msgstr "ΣυνÎχιση της εÏγασίας" + +#: app/templates/index.html:45 app/templates/index.html:80 +msgid "AdminRun" +msgstr "" + +#: app/templates/index.html:46 app/templates/index.html:81 +msgid "Statistics" +msgstr "" + +#: app/templates/index.html:47 app/templates/index.html:82 +msgid "View / Edit" +msgstr "" + +#: app/templates/instructions.html:4 +msgid "Instructions:" +msgstr "" + +#: app/templates/instructions.html:15 +msgid "" +"If you wish to quit a rating task before it is fully completed, you can " +"return to finish the task later but you will need your participant ID-" +"number in order to do that. Please save your participant ID before " +"starting the rating task!" +msgstr "" +"Αν θÎλετε να τεÏματίσετε μια εÏγασία βαθμολόγησης Ï€Ïιν ολοκληÏωθεί, " +"μποÏείτε να επιστÏÎψετε για να ολοκληÏώσετε την εÏγασία αÏγότεÏα, αλλά θα" +" χÏειαστείτε τον κωδικό αναγνώÏισης του συμμετÎχοντα για να το κάνετε " +"αυτό. ΑποθηκεÏστε τον κωδικό αναγνώÏισης Ï€Ïιν ξεκινήσετε την εÏγασία " +"αξιολόγησης!" + +#: app/templates/instructions.html:18 app/templates/quit_task.html:11 +msgid "Your participant ID is:" +msgstr "Ο κωδικός αναγνώÏισης σας είναι" + +#: app/templates/instructions.html:21 +msgid "Ready to start" +msgstr "Είμαι Îτοιμος να ξεκινήσω" + +#: app/templates/quit_task.html:8 +msgid "" +"Please write down your participant ID so you can return and finish the " +"rating task later!" +msgstr "" +"ΠαÏακαλώ αποθηκεÏστε τον κωδικό αναγνώÏισης σας Îτσι ώστε να μποÏείτε να " +"γυÏίσετε και να συνεχίσετε την εÏγασία βαθμολόγησης αÏγότεÏα!" + +#: app/templates/quit_task.html:14 +msgid "Quit!" +msgstr "Εγκαταλείπω την εÏγασία" + +#: app/templates/register.html:6 +msgid "This is the registration page." +msgstr "Αυτή είναι η σελίδα εγγÏαφής" + +#: app/templates/register.html:7 +msgid "Please fill in these background questions before starting the rating task:" +msgstr "" +"ΠαÏακαλώ απαντήστε σε αυτÎÏ‚ τις εισαγωγικÎÏ‚ εÏωτήσεις Ï€Ïιν ξεκινήσετε την" +" εÏγασία" + +#: app/templates/register.html:14 +msgid "Please select" +msgstr "" + +#: app/templates/register.html:22 +msgid "Submit" +msgstr "Υποβολή" + +#: app/templates/task.html:127 +msgid "Quit task" +msgstr "Εγκαταλείπω την εÏγασία" + +#: app/templates/task.html:128 +msgid "Next page" +msgstr "Επόμενη σελίδα" + +#: app/templates/task.html:132 +msgid "" +"You can zoom in/out the page view by pressing ctrl+/ctrl- (Windows) or " +"⌘+/⌘- (Mac)" +msgstr "" + +#: app/templates/task_completed.html:7 +msgid "Task completed!" +msgstr "Η εÏγασία ολοκληÏώθηκε!" + +#: app/templates/task_completed.html:11 +msgid "You have completed the rating task. Thank you for your participation." +msgstr "" +"‘Εχετε ολοκληÏώσει την εÏγασία βαθμολόγησης. Σας ευχαÏιστοÏμε για τη " +"συμμετοχή σας " + +#: app/templates/test_page.html:7 +msgid "File Not Found" +msgstr "" + +#~ msgid "ID number:" +#~ msgstr "" + +#~ msgid "Language:" +#~ msgstr "" + +#~ msgid "Status:" +#~ msgstr "" + +#~ msgid "Welcome to Onni" +#~ msgstr "" + +#~ msgid "" +#~ "This is the Human Emotion Systems " +#~ "laboratorys stimulus rating tool. If you" +#~ " have previously started a rating " +#~ "task you can continue that task on" +#~ " this page. If you are a " +#~ "researcher you can create new rating " +#~ "tasks by logging in. Or you can" +#~ " start a new rating task and " +#~ "start rating by selecting a task " +#~ "from the database list below." +#~ msgstr "" + +#~ msgid "" +#~ "You can choose the language suitable " +#~ "for you from the language menu in" +#~ " the upper right corner" +#~ msgstr "" + +#~ msgid "List of experiments in database:" +#~ msgstr "" + +#~ msgid "Name:" +#~ msgstr "" + +#~ msgid "Instruction:" +#~ msgstr "" + +#~ msgid "Participation ID is required for this task." +#~ msgstr "" + +#~ msgid "Begin task" +#~ msgstr "" + +#~ msgid "Continue task" +#~ msgstr "" + diff --git a/app/translations/en/LC_MESSAGES/messages.mo b/app/translations/en/LC_MESSAGES/messages.mo new file mode 100644 index 0000000000000000000000000000000000000000..7e74cd37c37c13f5379212843af7a99dd9a2b35d Binary files /dev/null and b/app/translations/en/LC_MESSAGES/messages.mo differ diff --git a/app/translations/en/LC_MESSAGES/messages.po b/app/translations/en/LC_MESSAGES/messages.po new file mode 100644 index 0000000000000000000000000000000000000000..16a75e01d7adccc445e6dcd285e78a101be3b709 --- /dev/null +++ b/app/translations/en/LC_MESSAGES/messages.po @@ -0,0 +1,270 @@ +# English translations for PROJECT. +# Copyright (C) 2018 ORGANIZATION +# This file is distributed under the same license as the PROJECT project. +# FIRST AUTHOR <EMAIL@ADDRESS>, 2018. +# +msgid "" +msgstr "" +"Project-Id-Version: PROJECT VERSION\n" +"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n" +"POT-Creation-Date: 2018-11-28 14:59+0200\n" +"PO-Revision-Date: 2018-11-27 16:38+0200\n" +"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" +"Language: en\n" +"Language-Team: en <LL@li.org>\n" +"Plural-Forms: nplurals=2; plural=(n != 1)\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=utf-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Generated-By: Babel 2.6.0\n" + +#: app/forms.py:36 +msgid "Continue rating" +msgstr "" + +#: app/forms.py:41 +msgid "Start rating" +msgstr "" + +#: app/routes.py:359 +msgid "ID already in use" +msgstr "" + +#: app/routes.py:368 +msgid "No such ID set for this experiment" +msgstr "" + +#: app/templates/base.html:43 +msgid "Task progress:" +msgstr "" + +#: app/templates/begin_with_id.html:8 +msgid "Please insert your ID-code below:" +msgstr "" + +#: app/templates/begin_with_id.html:12 app/templates/consent.html:29 +#: app/templates/instructions.html:14 app/templates/quit_task.html:4 +#: app/templates/quit_task.html:7 +msgid "Notice!" +msgstr "" + +#: app/templates/begin_with_id.html:13 +msgid "" +"Participation in this experiment requires a login with a predetermined ID" +" code. Please input ID below." +msgstr "" + +#: app/templates/consent.html:11 +msgid "Consent for participation:" +msgstr "" + +#: app/templates/consent.html:14 +msgid "Research bulletin can be read" +msgstr "" + +#: app/templates/consent.html:14 +msgid "here." +msgstr "" + +#: app/templates/consent.html:20 +msgid "Agree" +msgstr "" + +#: app/templates/consent.html:21 +msgid "Disagree" +msgstr "" + +#: app/templates/consent.html:32 +msgid "" +"In order to participate for the study you need to agree with the terms " +"presented." +msgstr "" + +#: app/templates/consent.html:35 +msgid "Close Notice" +msgstr "" + +#: app/templates/consent.html:36 app/templates/task_completed.html:15 +msgid "Return Home" +msgstr "" + +#: app/templates/continue_task.html:9 +msgid "Please insert your participant ID:" +msgstr "" + +#: app/templates/index.html:6 +msgid "Welcome to Onni" +msgstr "" + +#: app/templates/index.html:9 +msgid "" +"This is the Human Emotion Systems laboratorys stimulus rating tool. If " +"you have previously started a rating task you can continue that task on " +"this page. If you are a researcher you can create new rating tasks by " +"logging in. Or you can start a new rating task and start rating by " +"selecting a task from the database list below." +msgstr "" + +#: app/templates/index.html:13 +msgid "" +"You can choose the language suitable for you from the language menu in " +"the upper right corner" +msgstr "" + +#: app/templates/index.html:18 +msgid "List of experiments in database:" +msgstr "" + +#: app/templates/index.html:25 app/templates/index.html:61 +msgid "Name:" +msgstr "" + +#: app/templates/index.html:26 app/templates/index.html:62 +msgid "Instruction:" +msgstr "" + +#: app/templates/index.html:34 app/templates/index.html:69 +msgid "Participation ID is required for this task." +msgstr "" + +#: app/templates/index.html:40 app/templates/index.html:75 +msgid "Begin task" +msgstr "" + +#: app/templates/index.html:41 app/templates/index.html:76 +msgid "Continue task" +msgstr "" + +#: app/templates/index.html:45 app/templates/index.html:80 +msgid "AdminRun" +msgstr "" + +#: app/templates/index.html:46 app/templates/index.html:81 +msgid "Statistics" +msgstr "" + +#: app/templates/index.html:47 app/templates/index.html:82 +msgid "View / Edit" +msgstr "" + +#: app/templates/instructions.html:4 +msgid "Instructions:" +msgstr "" + +#: app/templates/instructions.html:15 +msgid "" +"If you wish to quit a rating task before it is fully completed, you can " +"return to finish the task later but you will need your participant ID-" +"number in order to do that. Please save your participant ID before " +"starting the rating task!" +msgstr "" + +#: app/templates/instructions.html:18 app/templates/quit_task.html:11 +msgid "Your participant ID is:" +msgstr "" + +#: app/templates/instructions.html:21 +msgid "Ready to start" +msgstr "" + +#: app/templates/quit_task.html:8 +msgid "" +"Please write down your participant ID so you can return and finish the " +"rating task later!" +msgstr "" + +#: app/templates/quit_task.html:14 +msgid "Quit!" +msgstr "" + +#: app/templates/register.html:6 +msgid "This is the registration page." +msgstr "" + +#: app/templates/register.html:7 +msgid "Please fill in these background questions before starting the rating task:" +msgstr "" + +#: app/templates/register.html:14 +msgid "Please select" +msgstr "" + +#: app/templates/register.html:22 +msgid "Submit" +msgstr "" + +#: app/templates/task.html:127 +msgid "Quit task" +msgstr "" + +#: app/templates/task.html:128 +msgid "Next page" +msgstr "" + +#: app/templates/task.html:132 +msgid "" +"You can zoom in/out the page view by pressing ctrl+/ctrl- (Windows) or " +"⌘+/⌘- (Mac)" +msgstr "" + +#: app/templates/task_completed.html:7 +msgid "Task completed!" +msgstr "" + +#: app/templates/task_completed.html:11 +msgid "You have completed the rating task. Thank you for your participation." +msgstr "" + +#: app/templates/test_page.html:7 +msgid "File Not Found" +msgstr "" + +#~ msgid "ID number:" +#~ msgstr "" + +#~ msgid "Language:" +#~ msgstr "" + +#~ msgid "Status:" +#~ msgstr "" + +#~ msgid "Welcome to Onni" +#~ msgstr "" + +#~ msgid "" +#~ "This is the Human Emotion Systems " +#~ "laboratorys stimulus rating tool. If you" +#~ " have previously started a rating " +#~ "task you can continue that task on" +#~ " this page. If you are a " +#~ "researcher you can create new rating " +#~ "tasks by logging in. Or you can" +#~ " start a new rating task and " +#~ "start rating by selecting a task " +#~ "from the database list below." +#~ msgstr "" + +#~ msgid "" +#~ "You can choose the language suitable " +#~ "for you from the language menu in" +#~ " the upper right corner" +#~ msgstr "" + +#~ msgid "List of experiments in database:" +#~ msgstr "" + +#~ msgid "Name:" +#~ msgstr "" + +#~ msgid "Instruction:" +#~ msgstr "" + +#~ msgid "Participation ID is required for this task." +#~ msgstr "" + +#~ msgid "Begin task" +#~ msgstr "" + +#~ msgid "Continue task" +#~ msgstr "" + diff --git a/app/translations/fa/LC_MESSAGES/messages.mo b/app/translations/fa/LC_MESSAGES/messages.mo new file mode 100644 index 0000000000000000000000000000000000000000..2b8f7a6fed6c73200e0d101caa0d0fd052414a10 Binary files /dev/null and b/app/translations/fa/LC_MESSAGES/messages.mo differ diff --git a/app/translations/fa/LC_MESSAGES/messages.po b/app/translations/fa/LC_MESSAGES/messages.po new file mode 100644 index 0000000000000000000000000000000000000000..6ecbb8d3ced7a1b70b53359d159758b0b0c5a963 --- /dev/null +++ b/app/translations/fa/LC_MESSAGES/messages.po @@ -0,0 +1,280 @@ +# Persian translations for PROJECT. +# Copyright (C) 2018 ORGANIZATION +# This file is distributed under the same license as the PROJECT project. +# FIRST AUTHOR <EMAIL@ADDRESS>, 2018. +# +msgid "" +msgstr "" +"Project-Id-Version: PROJECT VERSION\n" +"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n" +"POT-Creation-Date: 2018-11-28 14:59+0200\n" +"PO-Revision-Date: 2018-11-27 16:38+0200\n" +"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" +"Language: fa\n" +"Language-Team: fa <LL@li.org>\n" +"Plural-Forms: nplurals=1; plural=0\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=utf-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Generated-By: Babel 2.6.0\n" + +#: app/forms.py:36 +msgid "Continue rating" +msgstr "ادامه امتیازدهی" + +#: app/forms.py:41 +msgid "Start rating" +msgstr "برای شروع آزمایش آماده ام" + +#: app/routes.py:359 +msgid "ID already in use" +msgstr "" + +#: app/routes.py:368 +msgid "No such ID set for this experiment" +msgstr "" + +#: app/templates/base.html:43 +msgid "Task progress:" +msgstr "" + +#: app/templates/begin_with_id.html:8 +msgid "Please insert your ID-code below:" +msgstr "لطÙا شناسه خود را اینجا وارد کنید:" + +#: app/templates/begin_with_id.html:12 app/templates/consent.html:29 +#: app/templates/instructions.html:14 app/templates/quit_task.html:4 +#: app/templates/quit_task.html:7 +msgid "Notice!" +msgstr "توجه!" + +#: app/templates/begin_with_id.html:13 +msgid "" +"Participation in this experiment requires a login with a predetermined ID" +" code. Please input ID below." +msgstr "" + +#: app/templates/consent.html:11 +msgid "Consent for participation:" +msgstr "" + +#: app/templates/consent.html:14 +msgid "Research bulletin can be read" +msgstr "" + +#: app/templates/consent.html:14 +msgid "here." +msgstr "" + +#: app/templates/consent.html:20 +msgid "Agree" +msgstr "مواÙقم" + +#: app/templates/consent.html:21 +msgid "Disagree" +msgstr "مواÙÙ‚ نیستم" + +#: app/templates/consent.html:32 +msgid "" +"In order to participate for the study you need to agree with the terms " +"presented." +msgstr "برای شرکت در این آزمایش باید مواÙقت خود را با این موارد اعلام کنید." + +#: app/templates/consent.html:35 +msgid "Close Notice" +msgstr "بستن توجه" + +#: app/templates/consent.html:36 app/templates/task_completed.html:15 +msgid "Return Home" +msgstr "بازگشت به صÙØÙ‡ اصلی" + +#: app/templates/continue_task.html:9 +msgid "Please insert your participant ID:" +msgstr "لطÙا شناسه خود را اینجا وارد کنید:" + +#: app/templates/index.html:6 +msgid "Welcome to Onni" +msgstr "خوش آمدید" + +#: app/templates/index.html:9 +msgid "" +"This is the Human Emotion Systems laboratorys stimulus rating tool. If " +"you have previously started a rating task you can continue that task on " +"this page. If you are a researcher you can create new rating tasks by " +"logging in. Or you can start a new rating task and start rating by " +"selecting a task from the database list below." +msgstr "" +"این صÙØÙ‡ مربوط به امتیازدهی به Ù…Øرک ها در گروه تØقیقاتی سیسنم اØساسات " +"انسانها Ù…ÛŒ باشد. چنانچه شما قبلا وارد این سامانه شده اید میتوانید در این " +"صÙØÙ‡ به ادامه بپردازید. اگر شما یکی از پژوهشگرهای گروه هستید Ù…ÛŒ توانید با" +" ورود به سامانه سیستم امتیازدهی خود را طراØÛŒ کنید." + +#: app/templates/index.html:13 +msgid "" +"You can choose the language suitable for you from the language menu in " +"the upper right corner" +msgstr "" + +#: app/templates/index.html:18 +msgid "List of experiments in database:" +msgstr "لیست تØقیقات موجود در بانک اطلاعاتی::" + +#: app/templates/index.html:25 app/templates/index.html:61 +msgid "Name:" +msgstr "" + +#: app/templates/index.html:26 app/templates/index.html:62 +msgid "Instruction:" +msgstr "" + +#: app/templates/index.html:34 app/templates/index.html:69 +msgid "Participation ID is required for this task." +msgstr "" + +#: app/templates/index.html:40 app/templates/index.html:75 +msgid "Begin task" +msgstr "آزمایش را شروع کنید" + +#: app/templates/index.html:41 app/templates/index.html:76 +msgid "Continue task" +msgstr "ادامه آزمایش" + +#: app/templates/index.html:45 app/templates/index.html:80 +msgid "AdminRun" +msgstr "" + +#: app/templates/index.html:46 app/templates/index.html:81 +msgid "Statistics" +msgstr "" + +#: app/templates/index.html:47 app/templates/index.html:82 +msgid "View / Edit" +msgstr "" + +#: app/templates/instructions.html:4 +msgid "Instructions:" +msgstr "" + +#: app/templates/instructions.html:15 +msgid "" +"If you wish to quit a rating task before it is fully completed, you can " +"return to finish the task later but you will need your participant ID-" +"number in order to do that. Please save your participant ID before " +"starting the rating task!" +msgstr "" +"چنانچه مایل به خروج از بخش امتیازدهی پیش از تکمیل این بخش Ù…ÛŒ باشید شما Ù…ÛŒ" +" توانید بعدا به منظور اتمام این بخش به این صÙØÙ‡ برگردید. برای انجام این " +"کار شما به کد شناسایی خود نیاز دارید. لذا لطÙا پیش از شروع آزمایش کد " +"شناسایی خود را ذخیره کنید. " + +#: app/templates/instructions.html:18 app/templates/quit_task.html:11 +msgid "Your participant ID is:" +msgstr "کد شناسایی شما" + +#: app/templates/instructions.html:21 +msgid "Ready to start" +msgstr "برای شروع آزمایش آماده ام" + +#: app/templates/quit_task.html:8 +msgid "" +"Please write down your participant ID so you can return and finish the " +"rating task later!" +msgstr "" +"لطÙا شناسه خود را یادداشت نمایید تا در صورت نیاز در زمان دیگری امتیازدهی " +"را به اتمام برسانید" + +#: app/templates/quit_task.html:14 +msgid "Quit!" +msgstr "خروج" + +#: app/templates/register.html:6 +msgid "This is the registration page." +msgstr "صÙØÙ‡ ثبت نام" + +#: app/templates/register.html:7 +msgid "Please fill in these background questions before starting the rating task:" +msgstr "لطÙا قبل از شروع امتیازدهی به سوالات زمینه پاسخ دهید" + +#: app/templates/register.html:14 +msgid "Please select" +msgstr "" + +#: app/templates/register.html:22 +msgid "Submit" +msgstr "ارسال" + +#: app/templates/task.html:127 +msgid "Quit task" +msgstr "خروج از آزمایش" + +#: app/templates/task.html:128 +msgid "Next page" +msgstr "صÙØÙ‡ بعد" + +#: app/templates/task.html:132 +msgid "" +"You can zoom in/out the page view by pressing ctrl+/ctrl- (Windows) or " +"⌘+/⌘- (Mac)" +msgstr "" + +#: app/templates/task_completed.html:7 +msgid "Task completed!" +msgstr "عملیات با موÙقیت انجام شد!" + +#: app/templates/task_completed.html:11 +msgid "You have completed the rating task. Thank you for your participation." +msgstr "بخش امتیازدهی با موÙقیت انجام شد. سپاس ازمشارکت شما در این بخش" + +#: app/templates/test_page.html:7 +msgid "File Not Found" +msgstr "" + +#~ msgid "ID number:" +#~ msgstr "" + +#~ msgid "Language:" +#~ msgstr "" + +#~ msgid "Status:" +#~ msgstr "" + +#~ msgid "Welcome to Onni" +#~ msgstr "" + +#~ msgid "" +#~ "This is the Human Emotion Systems " +#~ "laboratorys stimulus rating tool. If you" +#~ " have previously started a rating " +#~ "task you can continue that task on" +#~ " this page. If you are a " +#~ "researcher you can create new rating " +#~ "tasks by logging in. Or you can" +#~ " start a new rating task and " +#~ "start rating by selecting a task " +#~ "from the database list below." +#~ msgstr "" + +#~ msgid "" +#~ "You can choose the language suitable " +#~ "for you from the language menu in" +#~ " the upper right corner" +#~ msgstr "" + +#~ msgid "List of experiments in database:" +#~ msgstr "" + +#~ msgid "Name:" +#~ msgstr "" + +#~ msgid "Instruction:" +#~ msgstr "" + +#~ msgid "Participation ID is required for this task." +#~ msgstr "" + +#~ msgid "Begin task" +#~ msgstr "" + +#~ msgid "Continue task" +#~ msgstr "" + diff --git a/app/translations/fi/LC_MESSAGES/messages.mo b/app/translations/fi/LC_MESSAGES/messages.mo new file mode 100644 index 0000000000000000000000000000000000000000..a95738971ca115e7d99054bb272894bbec3799bc Binary files /dev/null and b/app/translations/fi/LC_MESSAGES/messages.mo differ diff --git a/app/translations/fi/LC_MESSAGES/messages.po b/app/translations/fi/LC_MESSAGES/messages.po new file mode 100644 index 0000000000000000000000000000000000000000..77adc3f2b44cf44de32e922ba8d02a66f4d18e8f --- /dev/null +++ b/app/translations/fi/LC_MESSAGES/messages.po @@ -0,0 +1,281 @@ +# Finnish translations for PROJECT. +# Copyright (C) 2018 ORGANIZATION +# This file is distributed under the same license as the PROJECT project. +# FIRST AUTHOR <EMAIL@ADDRESS>, 2018. +# +msgid "" +msgstr "" +"Project-Id-Version: PROJECT VERSION\n" +"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n" +"POT-Creation-Date: 2018-11-28 14:59+0200\n" +"PO-Revision-Date: 2018-11-27 16:38+0200\n" +"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" +"Language: fi\n" +"Language-Team: fi <LL@li.org>\n" +"Plural-Forms: nplurals=2; plural=(n != 1)\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=utf-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Generated-By: Babel 2.6.0\n" + +#: app/forms.py:36 +msgid "Continue rating" +msgstr "Jatka tehtävää" + +#: app/forms.py:41 +msgid "Start rating" +msgstr "Aloita" + +#: app/routes.py:359 +msgid "ID already in use" +msgstr "Kyseinen ID on jo käytössä" + +#: app/routes.py:368 +msgid "No such ID set for this experiment" +msgstr "Kyseistä ID:tä ei löydy" + +#: app/templates/base.html:43 +msgid "Task progress:" +msgstr "Kokeesta tehty:" + +#: app/templates/begin_with_id.html:8 +msgid "Please insert your ID-code below:" +msgstr "Syötä koehenkilötunnuksesi:" + +#: app/templates/begin_with_id.html:12 app/templates/consent.html:29 +#: app/templates/instructions.html:14 app/templates/quit_task.html:4 +#: app/templates/quit_task.html:7 +msgid "Notice!" +msgstr "Huom!" + +#: app/templates/begin_with_id.html:13 +msgid "" +"Participation in this experiment requires a login with a predetermined ID" +" code. Please input ID below." +msgstr "" +"Tähän kokeeseen osallistumiseen vaaditaan ID-tunnus. Syötä ID-tunnuksesi " +"alla olevaan kenttään." + +#: app/templates/consent.html:11 +msgid "Consent for participation:" +msgstr "Suostumus osallistumiseksi:" + +#: app/templates/consent.html:14 +msgid "Research bulletin can be read" +msgstr "Tutkimustiedote on luettavissa" + +#: app/templates/consent.html:14 +msgid "here." +msgstr "täällä" + +#: app/templates/consent.html:20 +msgid "Agree" +msgstr "Suostun" + +#: app/templates/consent.html:21 +msgid "Disagree" +msgstr "En suostu" + +#: app/templates/consent.html:32 +msgid "" +"In order to participate for the study you need to agree with the terms " +"presented." +msgstr "Osallistuaksesi kokeeseen sinun on hyväksyttävä esitetyt ehdot." + +#: app/templates/consent.html:35 +msgid "Close Notice" +msgstr "Sulje" + +#: app/templates/consent.html:36 app/templates/task_completed.html:15 +msgid "Return Home" +msgstr "Palaa etusivulle" + +#: app/templates/continue_task.html:9 +msgid "Please insert your participant ID:" +msgstr "Syötä ID-tunnuksesi:" + +#: app/templates/index.html:6 +msgid "Welcome to Onni" +msgstr "Tervetuloa" + +#: app/templates/index.html:9 +msgid "" +"This is the Human Emotion Systems laboratorys stimulus rating tool. If " +"you have previously started a rating task you can continue that task on " +"this page. If you are a researcher you can create new rating tasks by " +"logging in. Or you can start a new rating task and start rating by " +"selecting a task from the database list below." +msgstr "" +"Tämä on Human Emotion Systems Laboratoryn arviointityökalu. Jos olet " +"aiemmin aloittanut arviointitehtävän voit jatkaa tehtävää tällä sivulla. " +"Jos olet tutkija voit luoda uuden arviointitehtävän kirjautumalla sisään." +" Tai voit aloittaa uuden arvointitehtävän ja aloittaa arvioinnin " +"valitsemalla arviointitehtävän alla olevasta listasta." + +#: app/templates/index.html:13 +msgid "" +"You can choose the language suitable for you from the language menu in " +"the upper right corner" +msgstr "Voit valita kielen oikeassa yläkulmassa olevasta language-valikosta" + +#: app/templates/index.html:18 +msgid "List of experiments in database:" +msgstr "Tietokannassa olevat kokeet:" + +#: app/templates/index.html:25 app/templates/index.html:61 +msgid "Name:" +msgstr "Nimi:" + +#: app/templates/index.html:26 app/templates/index.html:62 +msgid "Instruction:" +msgstr "Ohjeet:" + +#: app/templates/index.html:34 app/templates/index.html:69 +msgid "Participation ID is required for this task." +msgstr "Tähän kokeeseen osallistumiseen vaaditaan ID-tunnus." + +#: app/templates/index.html:40 app/templates/index.html:75 +msgid "Begin task" +msgstr "Aloita" + +#: app/templates/index.html:41 app/templates/index.html:76 +msgid "Continue task" +msgstr "Jatka" + +#: app/templates/index.html:45 app/templates/index.html:80 +msgid "AdminRun" +msgstr "AdminRun" + +#: app/templates/index.html:46 app/templates/index.html:81 +msgid "Statistics" +msgstr "Statistics" + +#: app/templates/index.html:47 app/templates/index.html:82 +msgid "View / Edit" +msgstr "View / Edit" + +#: app/templates/instructions.html:4 +msgid "Instructions:" +msgstr "Ohjeet:" + +#: app/templates/instructions.html:15 +msgid "" +"If you wish to quit a rating task before it is fully completed, you can " +"return to finish the task later but you will need your participant ID-" +"number in order to do that. Please save your participant ID before " +"starting the rating task!" +msgstr "" + +#: app/templates/instructions.html:18 app/templates/quit_task.html:11 +msgid "Your participant ID is:" +msgstr "ID-numerosi on:" + +#: app/templates/instructions.html:21 +msgid "Ready to start" +msgstr "Olen valmis aloittamaan" + +#: app/templates/quit_task.html:8 +msgid "" +"Please write down your participant ID so you can return and finish the " +"rating task later!" +msgstr "" +"Kirjoita ID-numerosi ylös jotta voit palata jatkamaan arviointitehtävää " +"tarvittaessa myöhemmin!" + +#: app/templates/quit_task.html:14 +msgid "Quit!" +msgstr "Lopeta!" + +#: app/templates/register.html:6 +msgid "This is the registration page." +msgstr "Rekisteröityminen" + +#: app/templates/register.html:7 +msgid "Please fill in these background questions before starting the rating task:" +msgstr "Ennen tehtävän aloittamista, vastaa näihin taustakysymyksiin:" + +#: app/templates/register.html:14 +msgid "Please select" +msgstr "Valitse" + +#: app/templates/register.html:22 +msgid "Submit" +msgstr "Jatka" + +#: app/templates/task.html:127 +msgid "Quit task" +msgstr "Lopeta" + +#: app/templates/task.html:128 +msgid "Next page" +msgstr "Seuraava" + +#: app/templates/task.html:132 +msgid "" +"You can zoom in/out the page view by pressing ctrl+/ctrl- (Windows) or " +"⌘+/⌘- (Mac)" +msgstr "" +"Voit zoomata sivunäkymää isommaksi/pienemmäksi painamalla ctrl+/ctrl- " +"(Windows) tai ⌘+/⌘- (Mac)" + +#: app/templates/task_completed.html:7 +msgid "Task completed!" +msgstr "Tehtävä on valmis!" + +#: app/templates/task_completed.html:11 +msgid "You have completed the rating task. Thank you for your participation." +msgstr "Olet suorittanut tämän arviointitehtävän. Kiitos osallistumisestasi." + +#: app/templates/test_page.html:7 +msgid "File Not Found" +msgstr "" + +#~ msgid "Welcome to Onni" +#~ msgstr "Tervetuloa" + +#~ msgid "" +#~ "This is the Human Emotion Systems " +#~ "laboratorys stimulus rating tool. If you" +#~ " have previously started a rating " +#~ "task you can continue that task on" +#~ " this page. If you are a " +#~ "researcher you can create new rating " +#~ "tasks by logging in. Or you can" +#~ " start a new rating task and " +#~ "start rating by selecting a task " +#~ "from the database list below." +#~ msgstr "" +#~ "Tämä on Human Emotion Systems " +#~ "Laboratoryn arviointityökalu.Jos olet aiemmin " +#~ "aloittanut arviointitehtävän voit jatkaa " +#~ "tehtävää tällä sivulla. Jos olet tutkija" +#~ " voit luoda uuden arviointitehtävän " +#~ "kirjautumalla sisään. Tai voit aloittaa " +#~ "uuden arvointitehtävän ja aloittaa arvioinnin" +#~ " valitsemalla arviointitehtävän alla olevasta " +#~ "listasta." + +#~ msgid "" +#~ "You can choose the language suitable " +#~ "for you from the language menu in" +#~ " the upper right corner" +#~ msgstr "Voit vaihtaa kieltä oikeassa yläkulmassa olevasta valikosta." + +#~ msgid "List of experiments in database:" +#~ msgstr "Tietokannassa olevat kokeet:" + +#~ msgid "Name:" +#~ msgstr "Nimi:" + +#~ msgid "Instruction:" +#~ msgstr "Ohjeet:" + +#~ msgid "Participation ID is required for this task." +#~ msgstr "Tähän kokeeseen osallistumiseen tarvitaan koehenkilötunnus" + +#~ msgid "Begin task" +#~ msgstr "Aloita" + +#~ msgid "Continue task" +#~ msgstr "Jatka" + diff --git a/app/translations/fin/LC_MESSAGES/messages.mo b/app/translations/fin/LC_MESSAGES/messages.mo deleted file mode 100644 index 699bab536246627e73eee1a2fea29e5490bf4da7..0000000000000000000000000000000000000000 Binary files a/app/translations/fin/LC_MESSAGES/messages.mo and /dev/null differ diff --git a/app/translations/fin/LC_MESSAGES/messages.po b/app/translations/fin/LC_MESSAGES/messages.po deleted file mode 100644 index 5d1d64e81d97b9a9fc77597e81e229cd2e3ecda2..0000000000000000000000000000000000000000 --- a/app/translations/fin/LC_MESSAGES/messages.po +++ /dev/null @@ -1,24 +0,0 @@ -# Finnish (Finland) translations for PROJECT. -# Copyright (C) 2018 ORGANIZATION -# This file is distributed under the same license as the PROJECT project. -# FIRST AUTHOR <EMAIL@ADDRESS>, 2018. -# -msgid "" -msgstr "" -"Project-Id-Version: PROJECT VERSION\n" -"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n" -"POT-Creation-Date: 2018-11-04 17:35+0200\n" -"PO-Revision-Date: 2018-11-04 17:35+0200\n" -"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" -"Language: fi_FI\n" -"Language-Team: fi_FI <LL@li.org>\n" -"Plural-Forms: nplurals=2; plural=(n != 1)\n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=utf-8\n" -"Content-Transfer-Encoding: 8bit\n" -"Generated-By: Babel 2.6.0\n" - -#: app/templates/index.html:5 -msgid "Welcome" -msgstr "Tervetuloa" - diff --git a/app/translations/it/LC_MESSAGES/messages.mo b/app/translations/it/LC_MESSAGES/messages.mo new file mode 100644 index 0000000000000000000000000000000000000000..279cea7af6189b542ed597194d4e14c657964701 Binary files /dev/null and b/app/translations/it/LC_MESSAGES/messages.mo differ diff --git a/app/translations/it/LC_MESSAGES/messages.po b/app/translations/it/LC_MESSAGES/messages.po new file mode 100644 index 0000000000000000000000000000000000000000..69b586bff4128a64733cb237cc363e65b35bb486 --- /dev/null +++ b/app/translations/it/LC_MESSAGES/messages.po @@ -0,0 +1,270 @@ +# Italian translations for PROJECT. +# Copyright (C) 2018 ORGANIZATION +# This file is distributed under the same license as the PROJECT project. +# FIRST AUTHOR <EMAIL@ADDRESS>, 2018. +# +msgid "" +msgstr "" +"Project-Id-Version: PROJECT VERSION\n" +"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n" +"POT-Creation-Date: 2018-11-28 14:59+0200\n" +"PO-Revision-Date: 2018-11-27 16:38+0200\n" +"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" +"Language: it\n" +"Language-Team: it <LL@li.org>\n" +"Plural-Forms: nplurals=2; plural=(n != 1)\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=utf-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Generated-By: Babel 2.6.0\n" + +#: app/forms.py:36 +msgid "Continue rating" +msgstr "" + +#: app/forms.py:41 +msgid "Start rating" +msgstr "" + +#: app/routes.py:359 +msgid "ID already in use" +msgstr "" + +#: app/routes.py:368 +msgid "No such ID set for this experiment" +msgstr "" + +#: app/templates/base.html:43 +msgid "Task progress:" +msgstr "" + +#: app/templates/begin_with_id.html:8 +msgid "Please insert your ID-code below:" +msgstr "" + +#: app/templates/begin_with_id.html:12 app/templates/consent.html:29 +#: app/templates/instructions.html:14 app/templates/quit_task.html:4 +#: app/templates/quit_task.html:7 +msgid "Notice!" +msgstr "" + +#: app/templates/begin_with_id.html:13 +msgid "" +"Participation in this experiment requires a login with a predetermined ID" +" code. Please input ID below." +msgstr "" + +#: app/templates/consent.html:11 +msgid "Consent for participation:" +msgstr "" + +#: app/templates/consent.html:14 +msgid "Research bulletin can be read" +msgstr "" + +#: app/templates/consent.html:14 +msgid "here." +msgstr "" + +#: app/templates/consent.html:20 +msgid "Agree" +msgstr "" + +#: app/templates/consent.html:21 +msgid "Disagree" +msgstr "" + +#: app/templates/consent.html:32 +msgid "" +"In order to participate for the study you need to agree with the terms " +"presented." +msgstr "" + +#: app/templates/consent.html:35 +msgid "Close Notice" +msgstr "" + +#: app/templates/consent.html:36 app/templates/task_completed.html:15 +msgid "Return Home" +msgstr "" + +#: app/templates/continue_task.html:9 +msgid "Please insert your participant ID:" +msgstr "" + +#: app/templates/index.html:6 +msgid "Welcome to Onni" +msgstr "" + +#: app/templates/index.html:9 +msgid "" +"This is the Human Emotion Systems laboratorys stimulus rating tool. If " +"you have previously started a rating task you can continue that task on " +"this page. If you are a researcher you can create new rating tasks by " +"logging in. Or you can start a new rating task and start rating by " +"selecting a task from the database list below." +msgstr "" + +#: app/templates/index.html:13 +msgid "" +"You can choose the language suitable for you from the language menu in " +"the upper right corner" +msgstr "" + +#: app/templates/index.html:18 +msgid "List of experiments in database:" +msgstr "" + +#: app/templates/index.html:25 app/templates/index.html:61 +msgid "Name:" +msgstr "" + +#: app/templates/index.html:26 app/templates/index.html:62 +msgid "Instruction:" +msgstr "" + +#: app/templates/index.html:34 app/templates/index.html:69 +msgid "Participation ID is required for this task." +msgstr "" + +#: app/templates/index.html:40 app/templates/index.html:75 +msgid "Begin task" +msgstr "" + +#: app/templates/index.html:41 app/templates/index.html:76 +msgid "Continue task" +msgstr "" + +#: app/templates/index.html:45 app/templates/index.html:80 +msgid "AdminRun" +msgstr "" + +#: app/templates/index.html:46 app/templates/index.html:81 +msgid "Statistics" +msgstr "" + +#: app/templates/index.html:47 app/templates/index.html:82 +msgid "View / Edit" +msgstr "" + +#: app/templates/instructions.html:4 +msgid "Instructions:" +msgstr "" + +#: app/templates/instructions.html:15 +msgid "" +"If you wish to quit a rating task before it is fully completed, you can " +"return to finish the task later but you will need your participant ID-" +"number in order to do that. Please save your participant ID before " +"starting the rating task!" +msgstr "" + +#: app/templates/instructions.html:18 app/templates/quit_task.html:11 +msgid "Your participant ID is:" +msgstr "" + +#: app/templates/instructions.html:21 +msgid "Ready to start" +msgstr "" + +#: app/templates/quit_task.html:8 +msgid "" +"Please write down your participant ID so you can return and finish the " +"rating task later!" +msgstr "" + +#: app/templates/quit_task.html:14 +msgid "Quit!" +msgstr "" + +#: app/templates/register.html:6 +msgid "This is the registration page." +msgstr "" + +#: app/templates/register.html:7 +msgid "Please fill in these background questions before starting the rating task:" +msgstr "" + +#: app/templates/register.html:14 +msgid "Please select" +msgstr "" + +#: app/templates/register.html:22 +msgid "Submit" +msgstr "" + +#: app/templates/task.html:127 +msgid "Quit task" +msgstr "" + +#: app/templates/task.html:128 +msgid "Next page" +msgstr "" + +#: app/templates/task.html:132 +msgid "" +"You can zoom in/out the page view by pressing ctrl+/ctrl- (Windows) or " +"⌘+/⌘- (Mac)" +msgstr "" + +#: app/templates/task_completed.html:7 +msgid "Task completed!" +msgstr "" + +#: app/templates/task_completed.html:11 +msgid "You have completed the rating task. Thank you for your participation." +msgstr "" + +#: app/templates/test_page.html:7 +msgid "File Not Found" +msgstr "" + +#~ msgid "ID number:" +#~ msgstr "" + +#~ msgid "Language:" +#~ msgstr "" + +#~ msgid "Status:" +#~ msgstr "" + +#~ msgid "Welcome to Onni" +#~ msgstr "" + +#~ msgid "" +#~ "This is the Human Emotion Systems " +#~ "laboratorys stimulus rating tool. If you" +#~ " have previously started a rating " +#~ "task you can continue that task on" +#~ " this page. If you are a " +#~ "researcher you can create new rating " +#~ "tasks by logging in. Or you can" +#~ " start a new rating task and " +#~ "start rating by selecting a task " +#~ "from the database list below." +#~ msgstr "" + +#~ msgid "" +#~ "You can choose the language suitable " +#~ "for you from the language menu in" +#~ " the upper right corner" +#~ msgstr "" + +#~ msgid "List of experiments in database:" +#~ msgstr "" + +#~ msgid "Name:" +#~ msgstr "" + +#~ msgid "Instruction:" +#~ msgstr "" + +#~ msgid "Participation ID is required for this task." +#~ msgstr "" + +#~ msgid "Begin task" +#~ msgstr "" + +#~ msgid "Continue task" +#~ msgstr "" + diff --git a/app/translations/zh/LC_MESSAGES/messages.mo b/app/translations/zh/LC_MESSAGES/messages.mo new file mode 100644 index 0000000000000000000000000000000000000000..92ea41779f8fe60a11f458613e50c52aa67abfd6 Binary files /dev/null and b/app/translations/zh/LC_MESSAGES/messages.mo differ diff --git a/app/translations/zh/LC_MESSAGES/messages.po b/app/translations/zh/LC_MESSAGES/messages.po new file mode 100644 index 0000000000000000000000000000000000000000..9e15cd95acf6a652a47d9d2072c8ced732f950e2 --- /dev/null +++ b/app/translations/zh/LC_MESSAGES/messages.po @@ -0,0 +1,270 @@ +# Chinese translations for PROJECT. +# Copyright (C) 2018 ORGANIZATION +# This file is distributed under the same license as the PROJECT project. +# FIRST AUTHOR <EMAIL@ADDRESS>, 2018. +# +msgid "" +msgstr "" +"Project-Id-Version: PROJECT VERSION\n" +"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n" +"POT-Creation-Date: 2018-11-28 14:59+0200\n" +"PO-Revision-Date: 2018-11-27 16:38+0200\n" +"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" +"Language: zh\n" +"Language-Team: zh <LL@li.org>\n" +"Plural-Forms: nplurals=1; plural=0\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=utf-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Generated-By: Babel 2.6.0\n" + +#: app/forms.py:36 +msgid "Continue rating" +msgstr "继ç»è¯„分" + +#: app/forms.py:41 +msgid "Start rating" +msgstr "我准备开始了" + +#: app/routes.py:359 +msgid "ID already in use" +msgstr "" + +#: app/routes.py:368 +msgid "No such ID set for this experiment" +msgstr "" + +#: app/templates/base.html:43 +msgid "Task progress:" +msgstr "" + +#: app/templates/begin_with_id.html:8 +msgid "Please insert your ID-code below:" +msgstr "请输入您的å‚与者ID:" + +#: app/templates/begin_with_id.html:12 app/templates/consent.html:29 +#: app/templates/instructions.html:14 app/templates/quit_task.html:4 +#: app/templates/quit_task.html:7 +msgid "Notice!" +msgstr "注æ„ï¼" + +#: app/templates/begin_with_id.html:13 +msgid "" +"Participation in this experiment requires a login with a predetermined ID" +" code. Please input ID below." +msgstr "" + +#: app/templates/consent.html:11 +msgid "Consent for participation:" +msgstr "" + +#: app/templates/consent.html:14 +msgid "Research bulletin can be read" +msgstr "" + +#: app/templates/consent.html:14 +msgid "here." +msgstr "" + +#: app/templates/consent.html:20 +msgid "Agree" +msgstr "åŒæ„" + +#: app/templates/consent.html:21 +msgid "Disagree" +msgstr "ä¸åŒæ„" + +#: app/templates/consent.html:32 +msgid "" +"In order to participate for the study you need to agree with the terms " +"presented." +msgstr "è¦å‚ä¸Žæœ¬ç ”ç©¶ï¼Œæ‚¨éœ€è¦åŒæ„所æ供的æ¡æ¬¾ã€‚" + +#: app/templates/consent.html:35 +msgid "Close Notice" +msgstr "å…³é—通知" + +#: app/templates/consent.html:36 app/templates/task_completed.html:15 +msgid "Return Home" +msgstr "返回主页" + +#: app/templates/continue_task.html:9 +msgid "Please insert your participant ID:" +msgstr "请输入您的å‚与者ID:" + +#: app/templates/index.html:6 +msgid "Welcome to Onni" +msgstr "欢迎" + +#: app/templates/index.html:9 +msgid "" +"This is the Human Emotion Systems laboratorys stimulus rating tool. If " +"you have previously started a rating task you can continue that task on " +"this page. If you are a researcher you can create new rating tasks by " +"logging in. Or you can start a new rating task and start rating by " +"selecting a task from the database list below." +msgstr "这是人类情感系统实验室刺激评级工具。如果您之å‰å·²ç»å¼€å§‹äº†ä¸€ä¸ªè¯„级工具,您å¯ä»¥åœ¨æ¤é¡µé¢ç»§ç»è¯¥ä»»åŠ¡ã€‚如果您是一åç ”ç©¶å‘˜ï¼Œæ‚¨å¯ä»¥é€šè¿‡ç™»å½•æ¥åˆ›å»ºæ–°çš„评级任务。或者,您å¯ä»¥å¯åŠ¨ä¸€ä¸ªæ–°çš„评级任务,并通过从下é¢çš„æ•°æ®åº“列表ä¸é€‰æ‹©ä¸€ä¸ªè¯„级任务开始评级。" + +#: app/templates/index.html:13 +msgid "" +"You can choose the language suitable for you from the language menu in " +"the upper right corner" +msgstr "" + +#: app/templates/index.html:18 +msgid "List of experiments in database:" +msgstr "æ•°æ®åº“ä¸çš„实验列表:" + +#: app/templates/index.html:25 app/templates/index.html:61 +msgid "Name:" +msgstr "" + +#: app/templates/index.html:26 app/templates/index.html:62 +msgid "Instruction:" +msgstr "" + +#: app/templates/index.html:34 app/templates/index.html:69 +msgid "Participation ID is required for this task." +msgstr "" + +#: app/templates/index.html:40 app/templates/index.html:75 +msgid "Begin task" +msgstr "开始任务" + +#: app/templates/index.html:41 app/templates/index.html:76 +msgid "Continue task" +msgstr "继ç»ä»»åŠ¡" + +#: app/templates/index.html:45 app/templates/index.html:80 +msgid "AdminRun" +msgstr "" + +#: app/templates/index.html:46 app/templates/index.html:81 +msgid "Statistics" +msgstr "" + +#: app/templates/index.html:47 app/templates/index.html:82 +msgid "View / Edit" +msgstr "" + +#: app/templates/instructions.html:4 +msgid "Instructions:" +msgstr "" + +#: app/templates/instructions.html:15 +msgid "" +"If you wish to quit a rating task before it is fully completed, you can " +"return to finish the task later but you will need your participant ID-" +"number in order to do that. Please save your participant ID before " +"starting the rating task!" +msgstr "如果您希望在完æˆè¯„估任务之å‰é€€å‡ºè¯„级任务,您å¯ä»¥è¿”回以åŽå®Œæˆä»»åŠ¡ï¼Œä½†æ˜¯éœ€è¦æ‚¨çš„å‚与者IDå·æ‰èƒ½æ‰§è¡Œæ¤æ“作。 请在开始评级任务å‰ä¿å˜æ‚¨çš„å‚与者IDï¼" + +#: app/templates/instructions.html:18 app/templates/quit_task.html:11 +msgid "Your participant ID is:" +msgstr "您的å‚与者ID是:" + +#: app/templates/instructions.html:21 +msgid "Ready to start" +msgstr "我准备开始了" + +#: app/templates/quit_task.html:8 +msgid "" +"Please write down your participant ID so you can return and finish the " +"rating task later!" +msgstr "请记下您的å‚与者ID,以便ç¨åŽè¿”回并完æˆè¯„级任务ï¼" + +#: app/templates/quit_task.html:14 +msgid "Quit!" +msgstr "退出" + +#: app/templates/register.html:6 +msgid "This is the registration page." +msgstr "这是注册页é¢ã€‚" + +#: app/templates/register.html:7 +msgid "Please fill in these background questions before starting the rating task:" +msgstr "请在开始评分å‰å¡«å†™ä»¥ä¸‹ç›¸å…³çš„问题:" + +#: app/templates/register.html:14 +msgid "Please select" +msgstr "" + +#: app/templates/register.html:22 +msgid "Submit" +msgstr "æ交" + +#: app/templates/task.html:127 +msgid "Quit task" +msgstr "退出任务" + +#: app/templates/task.html:128 +msgid "Next page" +msgstr "下一页" + +#: app/templates/task.html:132 +msgid "" +"You can zoom in/out the page view by pressing ctrl+/ctrl- (Windows) or " +"⌘+/⌘- (Mac)" +msgstr "" + +#: app/templates/task_completed.html:7 +msgid "Task completed!" +msgstr "任务完æˆäº†ï¼" + +#: app/templates/task_completed.html:11 +msgid "You have completed the rating task. Thank you for your participation." +msgstr "您已完æˆè¯„级任务。 感谢您的å‚与 :)" + +#: app/templates/test_page.html:7 +msgid "File Not Found" +msgstr "" + +#~ msgid "ID number:" +#~ msgstr "" + +#~ msgid "Language:" +#~ msgstr "" + +#~ msgid "Status:" +#~ msgstr "" + +#~ msgid "Welcome to Onni" +#~ msgstr "" + +#~ msgid "" +#~ "This is the Human Emotion Systems " +#~ "laboratorys stimulus rating tool. If you" +#~ " have previously started a rating " +#~ "task you can continue that task on" +#~ " this page. If you are a " +#~ "researcher you can create new rating " +#~ "tasks by logging in. Or you can" +#~ " start a new rating task and " +#~ "start rating by selecting a task " +#~ "from the database list below." +#~ msgstr "" + +#~ msgid "" +#~ "You can choose the language suitable " +#~ "for you from the language menu in" +#~ " the upper right corner" +#~ msgstr "" + +#~ msgid "List of experiments in database:" +#~ msgstr "" + +#~ msgid "Name:" +#~ msgstr "" + +#~ msgid "Instruction:" +#~ msgstr "" + +#~ msgid "Participation ID is required for this task." +#~ msgstr "" + +#~ msgid "Begin task" +#~ msgstr "" + +#~ msgid "Continue task" +#~ msgstr "" + diff --git a/babel.cfg b/babel.cfg index 5ce6e47cab3f347785b00d5d49a24f2a108df4a7..c40b2e89a2c60b2d01e6e17aca5e0dc954cd2b25 100644 --- a/babel.cfg +++ b/babel.cfg @@ -1,3 +1,3 @@ [python: app/**.py] [jinja2: app/templates/**.html] -extensions=jinja2.ext.autoescape,jinja2.ext.with_ \ No newline at end of file +extensions=jinja2.ext.autoescape,jinja2.ext.with_ diff --git a/config.py b/config.py index ce6f05c6ad42b45e175f50ec0706eac598162a72..f5a8ed48b4356b1a6536a19085d85e4b0fe5b46f 100644 --- a/config.py +++ b/config.py @@ -7,21 +7,25 @@ class Config(object): #SECRET_KEY = os.environ.get('SECRET_KEY') or 'you-will-never-guess' + LANGUAGES = ['en', 'fi', 'fa', 'el', 'it', 'zh'] - + """ #SQLITE3 connection settings: SQLALCHEMY_DATABASE_URI = os.environ.get('DATABASE_URL') or \ 'sqlite:///' + os.path.join(basedir, 'app.db') SQLALCHEMY_TRACK_MODIFICATIONS = False - + """ #MariaDB mysql database settings - """ - 'mysql+pymysql://'+MYSQL_USER+':'+MYSQL_PASSWORD+'@'+MYSQL_SERVER+'/'+MYSQL_DB+'?charset=utf8mb4' + + + MYSQL_USER = 'rating' + MYSQL_PASSWORD = 'timotimo' + MYSQL_SERVER = 'localhost' + MYSQL_DB = 'rating_tool_db' + + SQLALCHEMY_DATABASE_URI = 'mysql+pymysql://'+MYSQL_USER+':'+MYSQL_PASSWORD+'@'+MYSQL_SERVER+'/'+MYSQL_DB+'?charset=utf8mb4' - MYSQL_USER rating - MYSQL_PASSWORD timotimo - MYSQL_SERVER localhost - MYSQL_DB rating_tool_db - """ \ No newline at end of file + SQLALCHEMY_TRACK_MODIFICATIONS = False + \ No newline at end of file diff --git a/create_rating_db.txt b/create_rating_db.txt new file mode 100644 index 0000000000000000000000000000000000000000..1eaafe77ab7083b3d1897ff5dfb89c9b19076357 --- /dev/null +++ b/create_rating_db.txt @@ -0,0 +1,119 @@ +CREATE TABLE background_question ( + idbackground_question INTEGER NOT NULL AUTO_INCREMENT, + background_question VARCHAR(120), + experiment_idexperiment INTEGER, + PRIMARY KEY (idbackground_question) +); +CREATE TABLE experiment ( + idexperiment INTEGER NOT NULL AUTO_INCREMENT, + name VARCHAR(120), + instruction TEXT, + directoryname VARCHAR(120), + language VARCHAR(120), + status VARCHAR(120), + randomization VARCHAR(120), + short_instruction TEXT, + single_sentence_instruction TEXT, + is_archived VARCHAR(120), + creator_name VARCHAR(120), + research_notification_filename VARCHAR(120), + creation_time DATETIME, + stimulus_size VARCHAR(120), + consent_text TEXT, + use_forced_id VARCHAR(120), + PRIMARY KEY (idexperiment) +); +CREATE TABLE trial_randomization ( + idtrial_randomization INTEGER NOT NULL AUTO_INCREMENT, + page_idpage INTEGER, + randomized_idpage INTEGER, + answer_set_idanswer_set INTEGER, + experiment_idexperiment INTEGER, + PRIMARY KEY (idtrial_randomization) +); +CREATE TABLE user ( + id INTEGER NOT NULL AUTO_INCREMENT, + username VARCHAR(64), + email VARCHAR(120), + password_hash VARCHAR(128), + PRIMARY KEY (id) +); +INSERT INTO user VALUES(1,'Yngwie',NULL,'pbkdf2:sha256:50000$QioS5ICE$17a468394e72aef1243576aa80d29c296c6482ada48be9d25bd7c3b6e8129b40'); +CREATE TABLE answer_set ( + idanswer_set INTEGER NOT NULL AUTO_INCREMENT, + experiment_idexperiment INTEGER, + session VARCHAR(120), + agreement VARCHAR(120), + answer_counter INTEGER, + registration_time DATETIME, + last_answer_time DATETIME, + PRIMARY KEY (idanswer_set), + FOREIGN KEY(experiment_idexperiment) REFERENCES experiment (idexperiment) +); +CREATE TABLE background_question_option ( + idbackground_question_option INTEGER NOT NULL AUTO_INCREMENT, + background_question_idbackground_question INTEGER, + option VARCHAR(120), + PRIMARY KEY (idbackground_question_option), + FOREIGN KEY(background_question_idbackground_question) REFERENCES background_question (idbackground_question) +); +CREATE TABLE forced_id ( + idforced_id INTEGER NOT NULL AUTO_INCREMENT, + experiment_idexperiment INTEGER, + pregenerated_id VARCHAR(120), + PRIMARY KEY (idforced_id), + FOREIGN KEY(experiment_idexperiment) REFERENCES experiment (idexperiment) +); +CREATE TABLE page ( + idpage INTEGER NOT NULL AUTO_INCREMENT, + experiment_idexperiment INTEGER, + type VARCHAR(120), + text VARCHAR(120), + media VARCHAR(120), + PRIMARY KEY (idpage), + FOREIGN KEY(experiment_idexperiment) REFERENCES experiment (idexperiment) +); +CREATE TABLE question ( + idquestion INTEGER NOT NULL AUTO_INCREMENT, + experiment_idexperiment INTEGER, + question VARCHAR(120), + `left` VARCHAR(120), + `right` VARCHAR(120), + PRIMARY KEY (idquestion), + FOREIGN KEY(experiment_idexperiment) REFERENCES experiment (idexperiment) +); +CREATE TABLE answer ( + idanswer INTEGER NOT NULL AUTO_INCREMENT, + question_idquestion INTEGER, + answer_set_idanswer_set INTEGER, + answer VARCHAR(120), + page_idpage INTEGER, + PRIMARY KEY (idanswer), + FOREIGN KEY(answer_set_idanswer_set) REFERENCES answer_set (idanswer_set), + FOREIGN KEY(page_idpage) REFERENCES page (idpage), + FOREIGN KEY(question_idquestion) REFERENCES question (idquestion) +); +CREATE TABLE background_question_answer ( + idbackground_question_answer INTEGER NOT NULL AUTO_INCREMENT, + answer_set_idanswer_set INTEGER, + answer VARCHAR(120), + background_question_idbackground_question INTEGER, + PRIMARY KEY (idbackground_question_answer), + FOREIGN KEY(answer_set_idanswer_set) REFERENCES answer_set (idanswer_set), + FOREIGN KEY(background_question_idbackground_question) REFERENCES background_question (idbackground_question) +); +CREATE INDEX ix_experiment_consent_text ON experiment (consent_text); +CREATE INDEX ix_experiment_creation_time ON experiment (creation_time); +CREATE UNIQUE INDEX ix_experiment_directoryname ON experiment (directoryname); +CREATE INDEX ix_experiment_instruction ON experiment (instruction); +CREATE INDEX ix_experiment_name ON experiment (name); +CREATE INDEX ix_experiment_short_instruction ON experiment (short_instruction); +CREATE INDEX ix_experiment_single_sentence_instruction ON experiment (single_sentence_instruction); +CREATE UNIQUE INDEX ix_user_email ON user (email); +CREATE UNIQUE INDEX ix_user_username ON user (username); +CREATE INDEX ix_answer_set_last_answer_time ON answer_set (last_answer_time); +CREATE INDEX ix_answer_set_registration_time ON answer_set (registration_time); +CREATE INDEX ix_page_media ON page (media); +CREATE INDEX ix_page_text ON page (text); +CREATE INDEX ix_page_type ON page (type); + diff --git a/messages.pot b/messages.pot index f6a2d81e80d01dac199534c0da3eea9b5e693887..edc5cc77c6fe78c52e31226b9c62732899858515 100644 --- a/messages.pot +++ b/messages.pot @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PROJECT VERSION\n" "Report-Msgid-Bugs-To: EMAIL@ADDRESS\n" -"POT-Creation-Date: 2018-11-04 17:35+0200\n" +"POT-Creation-Date: 2018-11-28 14:59+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Language-Team: LANGUAGE <LL@li.org>\n" @@ -17,7 +17,204 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "Generated-By: Babel 2.6.0\n" -#: app/templates/index.html:5 -msgid "Welcome" +#: app/forms.py:36 +msgid "Continue rating" +msgstr "" + +#: app/forms.py:41 +msgid "Start rating" +msgstr "" + +#: app/routes.py:359 +msgid "ID already in use" +msgstr "" + +#: app/routes.py:368 +msgid "No such ID set for this experiment" +msgstr "" + +#: app/templates/base.html:43 +msgid "Task progress:" +msgstr "" + +#: app/templates/begin_with_id.html:8 +msgid "Please insert your ID-code below:" +msgstr "" + +#: app/templates/begin_with_id.html:12 app/templates/consent.html:29 +#: app/templates/instructions.html:14 app/templates/quit_task.html:4 +#: app/templates/quit_task.html:7 +msgid "Notice!" +msgstr "" + +#: app/templates/begin_with_id.html:13 +msgid "" +"Participation in this experiment requires a login with a predetermined ID" +" code. Please input ID below." +msgstr "" + +#: app/templates/consent.html:11 +msgid "Consent for participation:" +msgstr "" + +#: app/templates/consent.html:14 +msgid "Research bulletin can be read" +msgstr "" + +#: app/templates/consent.html:14 +msgid "here." +msgstr "" + +#: app/templates/consent.html:20 +msgid "Agree" +msgstr "" + +#: app/templates/consent.html:21 +msgid "Disagree" +msgstr "" + +#: app/templates/consent.html:32 +msgid "" +"In order to participate for the study you need to agree with the terms " +"presented." +msgstr "" + +#: app/templates/consent.html:35 +msgid "Close Notice" +msgstr "" + +#: app/templates/consent.html:36 app/templates/task_completed.html:15 +msgid "Return Home" +msgstr "" + +#: app/templates/continue_task.html:9 +msgid "Please insert your participant ID:" +msgstr "" + +#: app/templates/index.html:6 +msgid "Welcome to Onni" +msgstr "" + +#: app/templates/index.html:9 +msgid "" +"This is the Human Emotion Systems laboratorys stimulus rating tool. If " +"you have previously started a rating task you can continue that task on " +"this page. If you are a researcher you can create new rating tasks by " +"logging in. Or you can start a new rating task and start rating by " +"selecting a task from the database list below." +msgstr "" + +#: app/templates/index.html:13 +msgid "" +"You can choose the language suitable for you from the language menu in " +"the upper right corner" +msgstr "" + +#: app/templates/index.html:18 +msgid "List of experiments in database:" +msgstr "" + +#: app/templates/index.html:25 app/templates/index.html:61 +msgid "Name:" +msgstr "" + +#: app/templates/index.html:26 app/templates/index.html:62 +msgid "Instruction:" +msgstr "" + +#: app/templates/index.html:34 app/templates/index.html:69 +msgid "Participation ID is required for this task." +msgstr "" + +#: app/templates/index.html:40 app/templates/index.html:75 +msgid "Begin task" +msgstr "" + +#: app/templates/index.html:41 app/templates/index.html:76 +msgid "Continue task" +msgstr "" + +#: app/templates/index.html:45 app/templates/index.html:80 +msgid "AdminRun" +msgstr "" + +#: app/templates/index.html:46 app/templates/index.html:81 +msgid "Statistics" +msgstr "" + +#: app/templates/index.html:47 app/templates/index.html:82 +msgid "View / Edit" +msgstr "" + +#: app/templates/instructions.html:4 +msgid "Instructions:" +msgstr "" + +#: app/templates/instructions.html:15 +msgid "" +"If you wish to quit a rating task before it is fully completed, you can " +"return to finish the task later but you will need your participant ID-" +"number in order to do that. Please save your participant ID before " +"starting the rating task!" +msgstr "" + +#: app/templates/instructions.html:18 app/templates/quit_task.html:11 +msgid "Your participant ID is:" +msgstr "" + +#: app/templates/instructions.html:21 +msgid "Ready to start" +msgstr "" + +#: app/templates/quit_task.html:8 +msgid "" +"Please write down your participant ID so you can return and finish the " +"rating task later!" +msgstr "" + +#: app/templates/quit_task.html:14 +msgid "Quit!" +msgstr "" + +#: app/templates/register.html:6 +msgid "This is the registration page." +msgstr "" + +#: app/templates/register.html:7 +msgid "Please fill in these background questions before starting the rating task:" +msgstr "" + +#: app/templates/register.html:14 +msgid "Please select" +msgstr "" + +#: app/templates/register.html:22 +msgid "Submit" +msgstr "" + +#: app/templates/task.html:127 +msgid "Quit task" +msgstr "" + +#: app/templates/task.html:128 +msgid "Next page" +msgstr "" + +#: app/templates/task.html:132 +msgid "" +"You can zoom in/out the page view by pressing ctrl+/ctrl- (Windows) or " +"⌘+/⌘- (Mac)" +msgstr "" + +#: app/templates/task_completed.html:7 +msgid "Task completed!" +msgstr "" + +#: app/templates/task_completed.html:11 +msgid "You have completed the rating task. Thank you for your participation." +msgstr "" + +#: app/templates/test_page.html:7 +msgid "File Not Found" msgstr "" diff --git a/migrations/versions/75ace1b8b1e0_.py b/migrations/versions/aea4a0f982b4_.py similarity index 73% rename from migrations/versions/75ace1b8b1e0_.py rename to migrations/versions/aea4a0f982b4_.py index d34fc9a96ca801f6e97cfd38edfa9f893addd82f..c42c4389f507d6255537a48a6875fe85f9b3c7e9 100644 --- a/migrations/versions/75ace1b8b1e0_.py +++ b/migrations/versions/aea4a0f982b4_.py @@ -1,8 +1,8 @@ """empty message -Revision ID: 75ace1b8b1e0 +Revision ID: aea4a0f982b4 Revises: -Create Date: 2018-11-04 18:40:37.722652 +Create Date: 2018-11-28 17:07:11.577139 """ from alembic import op @@ -10,7 +10,7 @@ import sqlalchemy as sa # revision identifiers, used by Alembic. -revision = '75ace1b8b1e0' +revision = 'aea4a0f982b4' down_revision = None branch_labels = None depends_on = None @@ -27,16 +27,29 @@ def upgrade(): op.create_table('experiment', sa.Column('idexperiment', sa.Integer(), nullable=False), sa.Column('name', sa.String(length=120), nullable=True), - sa.Column('instruction', sa.String(length=120), nullable=True), + sa.Column('instruction', sa.Text(), nullable=True), sa.Column('directoryname', sa.String(length=120), nullable=True), sa.Column('language', sa.String(length=120), nullable=True), sa.Column('status', sa.String(length=120), nullable=True), sa.Column('randomization', sa.String(length=120), nullable=True), + sa.Column('short_instruction', sa.Text(), nullable=True), + sa.Column('single_sentence_instruction', sa.Text(), nullable=True), + sa.Column('is_archived', sa.String(length=120), nullable=True), + sa.Column('creator_name', sa.String(length=120), nullable=True), + sa.Column('research_notification_filename', sa.String(length=120), nullable=True), + sa.Column('creation_time', sa.DateTime(), nullable=True), + sa.Column('stimulus_size', sa.String(length=120), nullable=True), + sa.Column('consent_text', sa.Text(), nullable=True), + sa.Column('use_forced_id', sa.String(length=120), nullable=True), sa.PrimaryKeyConstraint('idexperiment') ) + op.create_index(op.f('ix_experiment_consent_text'), 'experiment', ['consent_text'], unique=False) + op.create_index(op.f('ix_experiment_creation_time'), 'experiment', ['creation_time'], unique=False) op.create_index(op.f('ix_experiment_directoryname'), 'experiment', ['directoryname'], unique=True) op.create_index(op.f('ix_experiment_instruction'), 'experiment', ['instruction'], unique=False) op.create_index(op.f('ix_experiment_name'), 'experiment', ['name'], unique=False) + op.create_index(op.f('ix_experiment_short_instruction'), 'experiment', ['short_instruction'], unique=False) + op.create_index(op.f('ix_experiment_single_sentence_instruction'), 'experiment', ['single_sentence_instruction'], unique=False) op.create_table('trial_randomization', sa.Column('idtrial_randomization', sa.Integer(), nullable=False), sa.Column('page_idpage', sa.Integer(), nullable=True), @@ -60,9 +73,13 @@ def upgrade(): sa.Column('session', sa.String(length=120), nullable=True), sa.Column('agreement', sa.String(length=120), nullable=True), sa.Column('answer_counter', sa.Integer(), nullable=True), + sa.Column('registration_time', sa.DateTime(), nullable=True), + sa.Column('last_answer_time', sa.DateTime(), nullable=True), sa.ForeignKeyConstraint(['experiment_idexperiment'], ['experiment.idexperiment'], ), sa.PrimaryKeyConstraint('idanswer_set') ) + op.create_index(op.f('ix_answer_set_last_answer_time'), 'answer_set', ['last_answer_time'], unique=False) + op.create_index(op.f('ix_answer_set_registration_time'), 'answer_set', ['registration_time'], unique=False) op.create_table('background_question_option', sa.Column('idbackground_question_option', sa.Integer(), nullable=False), sa.Column('background_question_idbackground_question', sa.Integer(), nullable=True), @@ -70,6 +87,13 @@ def upgrade(): sa.ForeignKeyConstraint(['background_question_idbackground_question'], ['background_question.idbackground_question'], ), sa.PrimaryKeyConstraint('idbackground_question_option') ) + op.create_table('forced_id', + sa.Column('idforced_id', sa.Integer(), nullable=False), + sa.Column('experiment_idexperiment', sa.Integer(), nullable=True), + sa.Column('pregenerated_id', sa.String(length=120), nullable=True), + sa.ForeignKeyConstraint(['experiment_idexperiment'], ['experiment.idexperiment'], ), + sa.PrimaryKeyConstraint('idforced_id') + ) op.create_table('page', sa.Column('idpage', sa.Integer(), nullable=False), sa.Column('experiment_idexperiment', sa.Integer(), nullable=True), @@ -123,15 +147,22 @@ def downgrade(): op.drop_index(op.f('ix_page_text'), table_name='page') op.drop_index(op.f('ix_page_media'), table_name='page') op.drop_table('page') + op.drop_table('forced_id') op.drop_table('background_question_option') + op.drop_index(op.f('ix_answer_set_registration_time'), table_name='answer_set') + op.drop_index(op.f('ix_answer_set_last_answer_time'), table_name='answer_set') op.drop_table('answer_set') op.drop_index(op.f('ix_user_username'), table_name='user') op.drop_index(op.f('ix_user_email'), table_name='user') op.drop_table('user') op.drop_table('trial_randomization') + op.drop_index(op.f('ix_experiment_single_sentence_instruction'), table_name='experiment') + op.drop_index(op.f('ix_experiment_short_instruction'), table_name='experiment') op.drop_index(op.f('ix_experiment_name'), table_name='experiment') op.drop_index(op.f('ix_experiment_instruction'), table_name='experiment') op.drop_index(op.f('ix_experiment_directoryname'), table_name='experiment') + op.drop_index(op.f('ix_experiment_creation_time'), table_name='experiment') + op.drop_index(op.f('ix_experiment_consent_text'), table_name='experiment') op.drop_table('experiment') op.drop_table('background_question') # ### end Alembic commands ###