Skip to content

Commit

Permalink
merged
Browse files Browse the repository at this point in the history
  • Loading branch information
vincy committed May 30, 2018
2 parents c7772cb + 4c20aa8 commit a6e7d28
Show file tree
Hide file tree
Showing 7 changed files with 76 additions and 14 deletions.
18 changes: 18 additions & 0 deletions lib/Features/Microsoft.php
Original file line number Diff line number Diff line change
Expand Up @@ -148,4 +148,22 @@ public function overrideReviseJobQA( $jobQA, $id_job, $password_job, $job_words
];
}

/**
* Because of a bug in filters we force languages conversion to it-IT when isCJK
* @param array $array
*
* @return array
*/
public function overrideConversionRequest( $language ){
if( \CatUtils::isCJK( $language ) ){
$language = 'it-IT';
}
return $language;
}

public function overrideConversionResult( $documentContent, $language ){
return preg_replace( '/target-language=".*?"/', "target-language=\"{$language}\"", $documentContent );
}


}
Original file line number Diff line number Diff line change
Expand Up @@ -11,21 +11,27 @@
use API\V2\KleinController;
use API\V2\Validators\JobPasswordValidator;
use API\V2\Json\ProjectUrls;
use DataAccess\ShapelessConcreteStruct;
use Features\Microsoft\Utils\Email\ConfirmedQuotationEmail;
use Features\Microsoft\Utils\Email\ErrorQuotationEmail;
use Features\Microsoft\View\API\JSON\MicrosoftUrlsDecorator;
use Features\Microsoft;
use \Features\Outsource\Traits\Translated as TranslatedTrait;

class TranslatedConnectorController extends KleinController {

use TranslatedTrait;

protected $job;
protected $project;

protected function afterConstruct() {
$jobValidator = ( new JobPasswordValidator( $this ) );

$jobValidator->onSuccess( function () use ( $jobValidator ) {
$this->job = $jobValidator->getJob();
$job = new \Jobs_JobStruct();
$job->id = $jobValidator->getJob()->id;
$job->password = $jobValidator->getJob()->password;
$this->job = ( new \Jobs_JobDao() )->read( $job )[ 0 ];
$this->project = $this->job->getProject();
} );

Expand All @@ -45,15 +51,15 @@ public function sendJob() {

$this->config = Microsoft::getConfig();

$eq_word = \Jobs_JobDao::getTODOWords($this->job);
$eq_word = \Jobs_JobDao::getTODOWords( $this->job );

$this->setSuccessMailSender( new ConfirmedQuotationEmail( Microsoft::getPluginBasePath() . '/Features/Microsoft/View/Emails/confirmed_quotation.html' ) );
$this->setFailureMailSender( new ErrorQuotationEmail( Microsoft::getPluginBasePath() . '/Features/Microsoft/View/Emails/error_quotation.html' ) );
$response = $this->requestJobQuote($this->job, $eq_word, $this->project, $formatted);
if(!empty($response)){
$this->response->body( "ok - ".$this->getExternalProjectId() );
}else{
$this->response->body( "ko" );
$response = $this->requestJobQuote( $this->job, $eq_word, $this->project, $formatted );
if ( !empty( $response ) ) {
$this->response->body( "ok - " . $this->getExternalProjectId() );
} else {
$this->response->body( "ko" );
}

}
Expand Down
19 changes: 19 additions & 0 deletions lib/Features/Microsoft/Decorator/AnalyzeDecorator.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?php

namespace Features\Microsoft\Decorator;

use AbstractDecorator;
use Features\Microsoft\Utils\Routes;

class AnalyzeDecorator extends AbstractDecorator {
/**
* @var \PHPTALWithAppend
*/
protected $template;

public function decorate() {
$this->template->enable_outsource = false;
}


}
2 changes: 2 additions & 0 deletions lib/Features/Microsoft/Decorator/ManageDecorator.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ class ManageDecorator extends AbstractDecorator {

public function decorate() {
$this->template->append( 'css_resources', Routes::staticBuild( '/microsoft-build.css' ) );

$this->template->enable_outsource = false;
}


Expand Down
9 changes: 4 additions & 5 deletions lib/Features/Microsoft/Utils/Constants/Revise.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,10 @@ class Revise extends \Constants_Revise{
* Max allowed errors for category
*/
const WORD_INTERVAL = 1000;
const MAX_TYPING = 1;
const MAX_TRANSLATION = 1;
const MAX_TYPING = 2;
const MAX_TRANSLATION = 2;
const MAX_TERMINOLOGY = 1;
const MAX_QUALITY = 1;
const MAX_STYLE = 5;

const MAX_QUALITY = 3;
const MAX_STYLE = 7;

}
8 changes: 8 additions & 0 deletions static/src/css/sass/microsoft-core.scss
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,14 @@ body.review {
display: none;
}
}

body:not(.review) {
footer {
.wrapper nav ul li:nth-child(2) {
display: none;
}
}
}
body .tab-switcher-notes {
display: none;
}
Expand Down
12 changes: 11 additions & 1 deletion static/src/js/cat_source/microsoft-core.extension.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@


(function(SF, QA_GLOSSARY) {
let original_closeFilter = SF.closeFilter;
let filte_size = '50';
let filter_type = 'regular_intervals';

$.extend(UI, {
showFixWarningsModal: function ( ) {
APP.confirm({
Expand All @@ -14,6 +14,16 @@
cancelTxt: 'Mark as complete',
msg: 'Unresolved glossary and/or tag issues are preventing you from completing your translation. <br>Please fix the issues.'
});
},
showFixWarningsOnDownload( continueDownloadFunction ) {
APP.confirm({
name: 'confirmDownload', // <-- this is the name of the function that gets invoked?
cancelTxt: 'Fix errors',
onCancel: 'goToFirstError',
callback: continueDownloadFunction,
okTxt: 'Download anyway',
msg: 'Unresolved glossary and/or tag issues may prevent downloading your translation. Please fix the issues. <br /><br /> If you continue downloading, part of the content may be untranslated - look for the string UNTRANSLATED_CONTENT in the downloaded files.'
});
}
});

Expand Down

0 comments on commit a6e7d28

Please sign in to comment.