Commit 4848d04f authored by Konstantin Schulz's avatar Konstantin Schulz
Browse files

added dynamic host URL detection and new exercise parameters

parent 2f496bdc
......@@ -16,6 +16,7 @@ import {ExerciseProvider} from '../providers/exercise/exercise';
import {PreviewPageModule} from "../pages/preview/preview.module";
import {AuthorPageModule} from "../pages/author/author.module";
import {HelperProvider} from '../providers/helper/helper';
import {FeedbackPageModule} from "../pages/feedback/feedback.module";
// The translate loader needs to know where to load i18n files
// in Ionic's static asset pipeline.
......@@ -50,6 +51,7 @@ class CustomErrorHandler extends IonicErrorHandler {
AuthorDetailPageModule,
AuthorPageModule,
CorpusDetailPageModule,
FeedbackPageModule,
PreviewPageModule,
ShowTextPageModule
],
......
......@@ -2,6 +2,8 @@
"AUTHORS": "Autoren",
"AUTHOR_SEARCH": "Autor suchen...",
"AUTHOR_SELECT": "Autor auswählen",
"CALLIDUS_PROJECT": "CALLIDUS-Projekt",
"EMAIL": "E-Mail",
"END": "Ende",
"EXERCISE_DOWNLOAD_NEXT_STEPS": "Nächste Schritte:",
"EXERCISE_FEEDBACK": "Feedback",
......@@ -13,9 +15,12 @@
"EXERCISE_FEEDBACK_INCORRECT_DEFAULT": "Das ist leider inkorrekt.",
"EXERCISE_FEEDBACK_PARTIALLY_CORRECT": "teilweise korrekt",
"EXERCISE_FEEDBACK_PARTIALLY_CORRECT_DEFAULT": "Das ist teilweise korrekt.",
"EXERCISE_FILL_THE_GAP": "Lückentext",
"EXERCISE_GENERATE": "Aufgabe erstellen",
"EXERCISE_TYPE": "Aufgabentyp",
"EXERCISE_TYPE_CLOZE": "Lückentext",
"EXERCISE_TYPE_MATCHING": "Zuordnung",
"FEEDBACK": "Feedback",
"HELP": "Hilfe",
"INSTRUCTION_CHOOSE_FORMAT_AND_IMPORT": "Wähle als Dateiformat das 'Moodle-XML-Format'. Lade anschließend die soeben heruntergeladene XML-Datei hoch und klicke auf 'Import'.",
"INSTRUCTION_COGWHEEL_MORE": "Klicke auf das Zahnrad-Symbol oben rechts, dann auf 'Mehr'.",
"INSTRUCTION_GO_TO_QUESTION_BANK": "Klicke auf 'Fragensammlung', dann auf 'Import'.",
......@@ -23,6 +28,8 @@
"INSTRUCTIONS": "Anweisungen",
"INSTRUCTIONS_FILL_THE_GAP": "Ordne die Wörter aus dem Pool den richtigen Lücken zu!",
"INVALID_TEXT_RANGE": "Ungültige Textauswahl",
"MACHINA_CALLIDA_BACKEND": "Machina Callida Backend",
"MACHINA_CALLIDA_FRONTEND": "Machina Callida Frontend",
"PART_OF_SPEECH_ADJECTIVE": "Adjektiv",
"PART_OF_SPEECH_ADVERB": "Adverb",
"PART_OF_SPEECH_AUXILIARY": "Auxiliarverb",
......@@ -40,6 +47,7 @@
"PART_OF_SPEECH_VERB": "Verb",
"PDF": "PDF",
"PHENOMENON_DEPENDENCY": "Dependenz",
"PHENOMENON_LEMMA": "Lemma",
"PHENOMENON_PART_OF_SPEECH": "Wortart",
"PREVIEW": "Vorschau",
"QUERY_PHENOMENON": "Phänomen",
......
......@@ -2,6 +2,8 @@
"AUTHORS": "Authors",
"AUTHOR_SEARCH": "Search author...",
"AUTHOR_SELECT": "Select author",
"CALLIDUS_PROJECT": "CALLIDUS Project",
"EMAIL": "E-Mail",
"END": "End",
"EXERCISE_DOWNLOAD_NEXT_STEPS": "Next steps:",
"EXERCISE_FEEDBACK": "Feedback",
......@@ -13,9 +15,12 @@
"EXERCISE_FEEDBACK_INCORRECT_DEFAULT": "Unfortunately, that is incorrect.",
"EXERCISE_FEEDBACK_PARTIALLY_CORRECT": "partially correct",
"EXERCISE_FEEDBACK_PARTIALLY_CORRECT_DEFAULT": "That is partially correct.",
"EXERCISE_FILL_THE_GAP": "Cloze",
"EXERCISE_GENERATE": "Create exercise",
"EXERCISE_TYPE": "Exercise type",
"EXERCISE_TYPE_CLOZE": "Cloze",
"EXERCISE_TYPE_MATCHING": "Matching",
"FEEDBACK": "Feedback",
"HELP": "Help",
"INSTRUCTION_CHOOSE_FORMAT_AND_IMPORT": "Choose 'Moodle XML format' as file format. Now upload the XML file that you just downloaded, then click on 'Import'.",
"INSTRUCTION_COGWHEEL_MORE": "Click on the cogwheel in the upper right corner, then on 'More'.",
"INSTRUCTION_GO_TO_QUESTION_BANK": "Click on 'Question bank', then on 'Import'.",
......@@ -23,6 +28,8 @@
"INSTRUCTIONS": "Instructions",
"INSTRUCTIONS_FILL_THE_GAP": "Assign the words from the pool to the correct gaps!",
"INVALID_TEXT_RANGE": "Invalid text range",
"MACHINA_CALLIDA_BACKEND": "Machina Callida Backend",
"MACHINA_CALLIDA_FRONTEND": "Machina Callida Frontend",
"PART_OF_SPEECH_ADJECTIVE": "Adjective",
"PART_OF_SPEECH_ADVERB": "Adverb",
"PART_OF_SPEECH_AUXILIARY": "Auxiliary verb",
......@@ -40,6 +47,7 @@
"PART_OF_SPEECH_VERB": "Verb",
"PDF": "PDF",
"PHENOMENON_DEPENDENCY": "Dependency",
"PHENOMENON_LEMMA": "Lemma",
"PHENOMENON_PART_OF_SPEECH": "Part of speech",
"PREVIEW": "Preview",
"QUERY_PHENOMENON": "Phenomenon",
......
......@@ -5,8 +5,12 @@ export class ConfigMC {
public static backendApiPath: string = "/mc/api/v1.0/";
public static backendApiRawtextPath: string = "rawtext";
public static backendApiValidReffPath: string = "validReff";
public static backendBaseUrl: string = "http://141.20.186.246:5000"; // 141.20.186.246 localhost
public static backendBaseUrl: string = location.protocol.concat("//").concat(window.location.hostname).concat(":5000");
public static callidusProjectUrl: string = "https://www.projekte.hu-berlin.de/de/callidus";
public static developerMailTo: string = "mailto:sulzkons@hu-berlin.de";
public static localStorageKeyCorpora: string = "mc/corpora";
public static machinaCallidaBackendUrl: string = "https://scm.cms.hu-berlin.de/callidus/mc-backend";
public static machinaCallidaFrontendUrl: string = "https://scm.cms.hu-berlin.de/callidus/mc-frontend";
public static maxTextLength: number = 2000;
public static perseidsCTSapiBaseUrl: string = "https://cts.perseids.org/api/cts?request=";
public static perseidsCTSapiGetCapabilities: string = "GetCapabilities";
......
......@@ -3,17 +3,30 @@ export enum CitationLevel {
}
export enum ExerciseType {
fillTheGap = <any>"fillTheGap"
cloze = <any>"cloze",
matching = <any>"matching",
}
export enum ExerciseTypeTranslation {
cloze = <any>"EXERCISE_TYPE_CLOZE",
matching = <any>"EXERCISE_TYPE_MATCHING",
}
export enum MoodleExerciseType {
cloze = <any>"ddwtos",
matching = <any>"matching",
}
export enum Phenomenon {
dependency = <any>"dependency",
lemma = <any>"lemma",
pos = <any>"pos",
// dependency = <any>"dependency"
}
export enum PhenomenonTranslations {
dependency = <any>"PHENOMENON_DEPENDENCY",
lemma = <any>"PHENOMENON_LEMMA",
pos = <any>"PHENOMENON_PART_OF_SPEECH",
dependency = <any>"PHENOMENON_DEPENDENCY"
}
export enum Dependency {
......
import {ExerciseType} from "./enum";
import {ExerciseType, ExerciseTypeTranslation} from "./enum";
import {QueryMC} from "./queryMC";
import {Feedback} from "./feedback";
export class Exercise {
public type: ExerciseType;
public typeTranslation: ExerciseTypeTranslation;
public query: QueryMC;
public feedback: Feedback;
constructor(init?:Partial<Exercise>) {
......
import {PartOfSpeech, Phenomenon} from "./enum";
import {Dependency, PartOfSpeech, Phenomenon} from "./enum";
export class QueryMC {
public phenomenon: Phenomenon;
public value: PartOfSpeech;
public value: PartOfSpeech | Dependency;
constructor(init?:Partial<QueryMC>) {
Object.assign(this, init);
}
......
......@@ -8,6 +8,11 @@
<ion-navbar>
<ion-title>{{corpusProvider.currentAuthor.name}}</ion-title>
<ion-buttons end>
<button ion-button icon-only color="primary" (click)="navCtrl.push(FeedbackPage)">
<ion-icon name="help-circle"></ion-icon>
</button>
</ion-buttons>
</ion-navbar>
</ion-header>
......
......@@ -5,6 +5,7 @@ import {CorpusMC} from "../../models/corpusMC";
import {TranslateService} from "@ngx-translate/core";
import {HttpClient} from "@angular/common/http";
import {CorpusDetailPage} from "../corpus-detail/corpus-detail";
import {FeedbackPage} from "../feedback/feedback";
/**
* Generated class for the AuthorDetailPage page.
......@@ -20,6 +21,8 @@ import {CorpusDetailPage} from "../corpus-detail/corpus-detail";
})
export class AuthorDetailPage {
FeedbackPage = FeedbackPage;
constructor(public navCtrl: NavController, public navParams: NavParams,
public corpusProvider: CorpusProvider,
public translate: TranslateService,
......
<ion-header>
<ion-navbar>
<ion-title>
{{ 'AUTHOR_SELECT' | translate }}
</ion-title>
</ion-navbar>
<ion-navbar>
<ion-title>
{{ 'AUTHOR_SELECT' | translate }}
</ion-title>
<ion-buttons end>
<button ion-button icon-only color="primary" (click)="navCtrl.push(FeedbackPage)">
<ion-icon name="help-circle"></ion-icon>
</button>
</ion-buttons>
</ion-navbar>
</ion-header>
<ion-content padding>
<ion-searchbar (ionInput)="getAuthors($event)" placeholder="{{ 'AUTHOR_SEARCH' | translate }}"></ion-searchbar>
<ion-list *ngIf="corpusProvider.availableAuthors.length > 0; else loading">
<ion-title>
{{ 'AUTHORS' | translate }}
</ion-title>
<ion-item-sliding *ngFor="let author of authorsDisplayed">
<button ion-item (click)="showCorpora(author)">
<p>{{author.name}}</p>
</button>
</ion-item-sliding>
</ion-list>
<ng-template #loading>
<ion-spinner></ion-spinner>
</ng-template>
<ion-searchbar (ionInput)="getAuthors($event)" placeholder="{{ 'AUTHOR_SEARCH' | translate }}"></ion-searchbar>
<ion-list *ngIf="corpusProvider.availableAuthors.length > 0; else loading">
<ion-title>
{{ 'AUTHORS' | translate }}
</ion-title>
<ion-item-sliding *ngFor="let author of authorsDisplayed">
<button ion-item (click)="showCorpora(author)">
<p>{{author.name}}</p>
</button>
</ion-item-sliding>
</ion-list>
<ng-template #loading>
<ion-spinner></ion-spinner>
</ng-template>
</ion-content>
......@@ -5,6 +5,7 @@ import {TranslateService} from "@ngx-translate/core";
import {Author} from "../../models/author";
import {CorpusProvider} from "../../providers/corpus/corpus";
import {AuthorDetailPage} from "../author-detail/author-detail";
import {FeedbackPage} from "../feedback/feedback";
/**
* Generated class for the AuthorPage page.
......@@ -20,6 +21,7 @@ import {AuthorDetailPage} from "../author-detail/author-detail";
})
export class AuthorPage {
public authorsDisplayed: Author[];
FeedbackPage = FeedbackPage;
constructor(public navCtrl: NavController,
public translate: TranslateService,
......
......@@ -8,6 +8,11 @@
<ion-navbar>
<ion-title>{{corpusProvider.currentAuthor.name}}: {{corpusProvider.currentCorpus.title}}</ion-title>
<ion-buttons end>
<button ion-button icon-only color="primary" (click)="navCtrl.push(FeedbackPage)">
<ion-icon name="help-circle"></ion-icon>
</button>
</ion-buttons>
</ion-navbar>
</ion-header>
......
......@@ -7,6 +7,7 @@ import {ShowTextPage} from "../show-text/show-text";
import {TextRange} from "../../models/textRange";
import {TranslateService} from "@ngx-translate/core";
import {Citation} from "../../models/citation";
import {FeedbackPage} from "../feedback/feedback";
/**
* Generated class for the CorpusDetailPage page.
......@@ -27,6 +28,7 @@ export class CorpusDetailPage {
public invalidTextRangeString: string;
public areReffEditable: boolean = true;
ObjectKeys = Object.keys;
FeedbackPage = FeedbackPage;
constructor(public navCtrl: NavController, public navParams: NavParams,
public corpusProvider: CorpusProvider,
......
<!--
Generated template for the FeedbackPage page.
See http://ionicframework.com/docs/components/#navigation for more info on
Ionic pages and navigation.
-->
<ion-header>
<ion-navbar>
<ion-title>{{ 'FEEDBACK' | translate }}</ion-title>
</ion-navbar>
</ion-header>
<ion-content padding>
<ion-list>
<ion-title>{{ 'HELP' | translate }}</ion-title>
<ion-item>
<button ion-button (click)="openUrl(machinaCallidaFrontendUrl)">{{ 'MACHINA_CALLIDA_FRONTEND' | translate
}}
</button>
</ion-item>
<ion-item>
<button ion-button (click)="openUrl(machinaCallidaBackendUrl)">{{ 'MACHINA_CALLIDA_BACKEND' | translate }}
</button>
</ion-item>
<ion-item>
<button ion-button (click)="openUrl(callidusProjectUrl)">{{ 'CALLIDUS_PROJECT' | translate }}</button>
</ion-item>
</ion-list>
<ion-list>
<ion-title>{{ 'FEEDBACK' | translate }}</ion-title>
<ion-item>
<a ion-button href="{{developerMailTo}}">{{ 'EMAIL' | translate }}</a>
</ion-item>
</ion-list>
</ion-content>
import {NgModule} from '@angular/core';
import {IonicPageModule} from 'ionic-angular';
import {FeedbackPage} from './feedback';
import {TranslateModule} from "@ngx-translate/core";
@NgModule({
declarations: [
FeedbackPage,
],
imports: [
IonicPageModule.forChild(FeedbackPage),
TranslateModule.forChild(),
],
})
export class FeedbackPageModule {
}
import {Component} from '@angular/core';
import {IonicPage, NavController, NavParams} from 'ionic-angular';
import {ConfigMC} from "../../config";
/**
* Generated class for the FeedbackPage page.
*
* See https://ionicframework.com/docs/components/#navigation for more info on
* Ionic pages and navigation.
*/
@IonicPage()
@Component({
selector: 'page-feedback',
templateUrl: 'feedback.html',
})
export class FeedbackPage {
machinaCallidaFrontendUrl = ConfigMC.machinaCallidaFrontendUrl;
machinaCallidaBackendUrl = ConfigMC.machinaCallidaBackendUrl;
callidusProjectUrl = ConfigMC.callidusProjectUrl;
developerMailTo = ConfigMC.developerMailTo;
constructor(public navCtrl: NavController, public navParams: NavParams) {
}
openUrl(url: string){
window.open(url, '_system', 'location=yes');
}
}
......@@ -3,6 +3,11 @@
<ion-title>
{{ 'WELCOME' | translate }}
</ion-title>
<ion-buttons end>
<button ion-button icon-only color="primary" (click)="navCtrl.push(FeedbackPage)">
<ion-icon name="help-circle"></ion-icon>
</button>
</ion-buttons>
</ion-navbar>
</ion-header>
......
......@@ -5,8 +5,15 @@ import {HttpClient} from "@angular/common/http";
import {ExerciseProvider} from "../../providers/exercise/exercise";
import {CorpusProvider} from "../../providers/corpus/corpus";
import {TranslateService} from "@ngx-translate/core";
import {PartOfSpeech, PartOfSpeechTranslations, Phenomenon} from "../../models/enum";
import {
ExerciseType,
ExerciseTypeTranslation, MoodleExerciseType,
PartOfSpeech,
PartOfSpeechTranslations,
Phenomenon
} from "../../models/enum";
import {HelperProvider} from "../../providers/helper/helper";
import {FeedbackPage} from "../feedback/feedback";
@Component({
selector: 'page-home',
......@@ -14,6 +21,8 @@ import {HelperProvider} from "../../providers/helper/helper";
})
export class HomePage {
public isProductionEnv = ['localhost', '127.0.0.1'].indexOf(window.location.hostname) > -1 ? '' : 'hide';
public FeedbackPage = FeedbackPage;
window = window;
constructor(public navCtrl: NavController, public navParams: NavParams,
public http: HttpClient,
......@@ -28,12 +37,9 @@ export class HomePage {
}
test() {
for (let key of Object.keys(PartOfSpeech)) { // Object.keys(PartOfSpeech) this.helperProvider.getStringEnumKeys(PartOfSpeech)
let a = PartOfSpeech[key];
let b = 0;
}
let c = PartOfSpeechTranslations;
let e = Object.keys(c);
let c = ExerciseTypeTranslation[ExerciseTypeTranslation[ExerciseType.cloze]];
let e = ExerciseTypeTranslation[ExerciseType.cloze];
let f = location.protocol.concat("//").concat(window.location.hostname).concat(":5000");
let d = 0;
}
}
......@@ -8,6 +8,11 @@
<ion-navbar>
<ion-title>{{ 'PREVIEW' | translate }}</ion-title>
<ion-buttons end>
<button ion-button icon-only color="primary" (click)="navCtrl.push(FeedbackPage)">
<ion-icon name="help-circle"></ion-icon>
</button>
</ion-buttons>
</ion-navbar>
</ion-header>
......@@ -16,7 +21,8 @@
<ion-content padding>
<div *ngIf="exerciseProvider.annisResponse; else loading">
<h1>{{ 'INSTRUCTIONS' | translate }}</h1>
<h4>{{ exerciseFillTheGapString }}: {{ instructionsFillTheGapString }}</h4>
<h4>{{ ExerciseTypeTranslation[this.exerciseProvider.exercise.type] | translate }}: {{
instructionsFillTheGapString }}</h4>
<div *ngFor="let solution of exerciseProvider.annisResponse?.solution | dictToIterable">{{solution}}&#32;</div>
<br>
<br>
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment