Skip to content

Commit

Permalink
solved some issues
Browse files Browse the repository at this point in the history
  • Loading branch information
julianpoemp committed Apr 25, 2017
1 parent 5ffc61f commit 803a45b
Show file tree
Hide file tree
Showing 11 changed files with 59 additions and 31 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -397,3 +397,4 @@ xcuserdata/
/src/config/config.json
/src/config/markers.json
/doc/
/deployment/
8 changes: 4 additions & 4 deletions pdfconverter/GuidelinesConverter.php
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<?php

require_once("./fpdf181/fpdf.php");
include_once("./Converter.php");
include_once("./fpdf181/font/helvetica.php");
include_once("./pdf/GuidelinesPDF.php");
require_once("fpdf181/fpdf.php");
include_once("Converter.php");
include_once("fpdf181/font/helvetica.php");
include_once("pdf/GuidelinesPDF.php");

class GuidelinesConverter implements Converter
{
Expand Down
7 changes: 4 additions & 3 deletions pdfconverter/index.php
Original file line number Diff line number Diff line change
@@ -1,18 +1,19 @@
<?php

$result["state"] = "failed";
include("./GuidelinesConverter.php");
if(!empty($_POST) && !empty($_POST["json"])){
if (!empty($_POST) && !empty($_POST["json"])) {
//read json
$json = json_decode($_POST["json"]);

if(isset($json->translation) && $json->guidelines) {
if (!empty($json) && !empty($json->translation) && !empty($json->guidelines)) {
$language = json_decode($json->tanslation);
$guidelines = $json->guidelines;
$guidelinesconverter = new GuidelinesConverter($guidelines, $json->translation);
$guidelinesconverter->output();
$result["state"] = "success";
}
} else{
} else {
$result["state"] = "error";
}
echo json_encode($result);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

include_once('./fpdf181/fpdf.php');
include_once('fpdf181/fpdf.php');

class GuidelinesPDF extends FPDF
{
Expand All @@ -24,9 +24,9 @@ class GuidelinesPDF extends FPDF
private $innerwidth = 0;

//colors
const GRAY = array(100, 100, 100);
const LIGHTGRAY = array(220, 220, 220);
const BLACK = array(0, 0, 0);
private $GRAY = array(100, 100, 100);
private $LIGHTGRAY = array(220, 220, 220);
private $BLACK = array(0, 0, 0);

public function __construct($json, $language, $orientation = 'P', $unit = 'mm', $size = 'A4')
{
Expand All @@ -46,29 +46,29 @@ function init()
$this->addPage();
$this->SetFont(self::DEFAULTFONT, 'U', self::TITLE_FONT_SIZE);

$this->SetTitle($this->ud($this->language->guidelines." $project"));
$this->SetTitle($this->ud($this->language->guidelines . " $project"));
$this->SetDrawColor(0, 0, 0);

//Set title
$this->SetY(self::MARGIN_TOP + 10);
$this->MultiCell($this->innerwidth, 10, $this->ud($this->language->guidelines." - $project"));
$this->MultiCell($this->innerwidth, 10, $this->ud($this->language->guidelines . " - $project"));
//Set info
$this->SetX(self::MARGIN_LEFT);
$this->SetFont(self::DEFAULTFONT, '', self::INFO_FONT_SIZE);
$this->changeTextColor(self::GRAY);
$this->MultiCell($this->innerwidth, 5, $this->ud($this->language->authors.": " . $this->json->meta->authors));
$this->changeTextColor($this->GRAY);
$this->MultiCell($this->innerwidth, 5, $this->ud($this->language->authors . ": " . $this->json->meta->authors));
$this->MultiCell($this->innerwidth, 5, $this->ud("Version: " . $this->json->meta->version));

$this->SetAutoPageBreak(true, self::MARGIN_BOTTOM);
//Begin output
$this->SetY($this->GetY() + 5);
$this->changeTextColor(self::BLACK);
$this->changeTextColor($this->BLACK);

foreach ($this->json->instructions as $group) {
//new group
$this->SetFont(self::DEFAULTFONT, "U", 10);
if (!empty($group->group)) {
$this->changeFillColor(self::LIGHTGRAY);
$this->changeFillColor($this->LIGHTGRAY);
$this->SetFont(self::DEFAULTFONT, "B", 11);
$this->MultiCell($this->innerwidth, 5, $this->ud($group->group), 1, 'L', true);
$this->SetFont(self::DEFAULTFONT, "", 10);
Expand Down Expand Up @@ -186,7 +186,7 @@ function init()
$e++;
$this->SetY($this->GetY() + $cell_heights[$k]);
$maxheight += $cell_heights[$k];
} else if($k == sizeof($entry->examples) - 1){
} else if ($k == sizeof($entry->examples) - 1) {
//last example
$maxheight += $cell_heights[$k];
}
Expand All @@ -211,7 +211,7 @@ function init()
function Header()
{
$this->SetFont(self::DEFAULTFONT, "", self::HEADER_FONT_SIZE);
$this->changeTextColor(self::GRAY);
$this->changeTextColor($this->GRAY);
$this->SetY(self::MARGIN_TOP);
$this->Cell(100, 5, $this->ud(""), 0, 0, 'L');
$this->Cell($this->innerwidth - 100, 5, $this->ud("[" . $this->json->meta->date . " ] " . $this->json->meta->project), 0, 0, 'R');
Expand All @@ -224,7 +224,7 @@ function Footer()
// Position 1,5 cm von unten
$this->SetY(-self::MARGIN_BOTTOM);
$this->SetFont(self::DEFAULTFONT, "", self::FOOTER_FONT_SIZE);
$this->changeTextColor(self::GRAY);
$this->changeTextColor($this->GRAY);
$page = $this->PageNo();
$this->AliasNbPages();
$this->Cell(0, 10, "$page/{nb}", 0, 0, 'C');
Expand Down
3 changes: 2 additions & 1 deletion src/app/app.routes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ const APP_ROUTES:Routes = [
{ path: 'login', component: LoginComponent, canActivate: [SettingsGuard, ALoginGuard]},
{ path: 'logout', component: LogoutComponent, canActivate: [SettingsGuard, LogoutGuard]},
{ path: 'user', component: MembersAreaComponent, children : MEMBER_ROUTES},
{ path: 'user', component: MembersAreaComponent}
{ path: 'user', component: MembersAreaComponent},
{ path: '**', redirectTo:'/login', pathMatch: 'full'}
];

export const routing = RouterModule.forRoot(APP_ROUTES);
14 changes: 10 additions & 4 deletions src/app/gui/transcription-submit/transcription-submit.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,11 +77,17 @@ export class TranscriptionSubmitComponent implements OnInit, ComponentCanDeactiv
}

public back() {
this.transcrService.feedback.comment = this.transcrService.feedback.comment.replace(/(<)|(\/>)|(>)/g, "\s");
this.sessService.comment = this.transcrService.feedback.comment;
if(!this.sessService.offline) {
if(!isNullOrUndefined(this.transcrService.feedback.comment)
&& this.transcrService.feedback.comment !== "")
{
this.transcrService.feedback.comment = this.transcrService.feedback.comment.replace(/(<)|(\/>)|(>)/g, "\s");
}
this.sessService.comment = this.transcrService.feedback.comment;
this.saveForm();
this.sessService.save("feedback", this.transcrService.feedback.exportData());
}

this.saveForm();
this.sessService.save("feedback", this.transcrService.feedback.exportData());
this.router.navigate([ '/user/transcr' ]);
}

Expand Down
2 changes: 2 additions & 0 deletions src/app/gui/transcription/transcription.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,8 @@ <h3>{{"modal.shortcuts.2D-Editor" | translate}}</h3>
</button>
</modal-footer>
</modal>
<!-- <button (click)="test(textfield.value)">test</button>
<input type="text" value="" #textfield/> -->
<div *ngIf="loaded">
<span id='saving' *ngIf="saving != ''"><span style="color:#333333" class="glyphicon glyphicon-floppy-disk"></span></span>
<app-fastbar
Expand Down
7 changes: 4 additions & 3 deletions src/app/gui/transcription/transcription.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,6 @@ export class TranscriptionComponent implements OnInit, OnDestroy, AfterViewInit,
}

afterAudioLoaded = () => {

this.transcrService.load();
this.transcrService.guidelines = this.settingsService.guidelines;

Expand Down Expand Up @@ -296,9 +295,11 @@ export class TranscriptionComponent implements OnInit, OnDestroy, AfterViewInit,
this.modal_overview.close();
}

test(){
test(id:string){
console.log("test: " + id);

this.subscrmanager.add(
this.api.fetchAnnotation(this.sessService.data_id).subscribe(
this.api.fetchAnnotation(Number(id)).subscribe(
(result)=>{
console.log(result.json());
}
Expand Down
1 change: 1 addition & 0 deletions src/app/service/api.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ export class APIService implements API {
transcript.length > 0 &&
quality != null
) {
console.log(data_id);
let cmd_json = {
querytype : "continueannotation",
transcript: JSON.stringify(transcript),
Expand Down
17 changes: 16 additions & 1 deletion src/app/service/transcription.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,6 @@ export class TranscriptionService {
//format to annotJSON file
this.navbarServ.exportformats.annotJSON = this.getTranscriptString(button.format);
}
this.navbarServ.exportformats.filename = this.settingsService.filename;
}));
}

Expand All @@ -133,6 +132,22 @@ export class TranscriptionService {
public load(){
this.last_sample = this.audio.duration.samples;
this.loadSegments(this.audio.samplerate);

if(this.sessServ.offline){
this.filename = this.sessServ.file.name;
if(this.filename.indexOf(".wav") > -1) {
this.filename = this.filename.substr(0, this.filename.indexOf(".wav"));;
}
} else{
let start = this.sessServ.audio_url.search(/(%|-|\.|[A-ZÄÖÜß]|[a-zäöü]|_|[0-9])*.wav/g);
if(start > -1)
{
this.filename = this.sessServ.audio_url.substr(start, this.sessServ.audio_url.indexOf(".wav") - start);
} else{
this.filename = this.sessServ.audio_url;
}
}
this.navbarServ.exportformats.filename = this.filename;
}

public getTranscriptString(format: string): string {
Expand Down
4 changes: 2 additions & 2 deletions src/config/projectconfig.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"version": "1.1.0",
"logging":{
"forced": false
"forced": true
},
"navigation":{
"export": true,
Expand All @@ -19,7 +19,7 @@
},
"plugins":{
"pdfexport":{
"url": "http://localhost:6321/pdfconverter/"
"url": "https://www.phonetik.uni-muenchen.de/apps/octra/octra/pdfconverter/"
}
},
"languages": [
Expand Down

0 comments on commit 803a45b

Please sign in to comment.