Merge branch 'master' into PHRDPL-86_xdebug

This commit is contained in:
jygaulier
2020-01-30 12:01:00 +01:00
committed by GitHub
16 changed files with 2891 additions and 2621 deletions

View File

@@ -21,6 +21,7 @@ class PDF
protected $pdf;
const LAYOUT_FEEDBACK = 'feedback';
const LAYOUT_FEEDBACKONLY = 'feedbackOnly';
const LAYOUT_PREVIEW = 'preview';
const LAYOUT_PREVIEWCAPTION = 'previewCaption';
const LAYOUT_PREVIEWCAPTIONTDM = 'previewCaptionTdm';

View File

@@ -15,6 +15,7 @@ use Alchemy\Phrasea\Application;
use Alchemy\Phrasea\Out\Tool\PhraseaPDF;
use Alchemy\Phrasea\Helper\Record\Printer;
use Alchemy\Phrasea\Model\Entities\ValidationParticipant;
use \IntlDateFormatter as DateFormatter;
class PDFRecords extends PDF
{
@@ -36,6 +37,7 @@ class PDFRecords extends PDF
throw new \Exception('Unknown layout');
break;
case self::LAYOUT_FEEDBACK:
case self::LAYOUT_FEEDBACKONLY:
case self::LAYOUT_PREVIEW:
case self::LAYOUT_PREVIEWCAPTION:
case self::LAYOUT_PREVIEWCAPTIONTDM:
@@ -87,6 +89,9 @@ class PDFRecords extends PDF
case self::LAYOUT_FEEDBACK:
$this->print_preview(false, true, true);
break;
case self::LAYOUT_FEEDBACKONLY:
$this->print_preview(false, false, true);
break;
case self::LAYOUT_PREVIEW:
$this->print_preview(false, false, false);
break;
@@ -349,6 +354,7 @@ class PDFRecords extends PDF
$this->pdf->SetY($y + 2);
foreach ($rec->get_caption()->get_fields() as $field) {
if ($field->get_databox_field()->get_gui_visible()) {
$this->pdf->SetFont(PhraseaPDF::FONT, 'B', 12);
$this->pdf->Write(5, $field->get_name() . " : ");
@@ -362,6 +368,7 @@ class PDFRecords extends PDF
$this->pdf->Write(6, "\n");
}
}
$this->pdf->SetY($this->pdf->GetY() + 10);
}
}
@@ -389,38 +396,38 @@ class PDFRecords extends PDF
$this->pdf->SetY($this->pdf->GetY()+10);
$this->pdf->SetFont(PhraseaPDF::FONT, 'B', 12);
$this->pdf->Write(5, $this->app->trans("print_feedback:: Document generated on : "));
$this->pdf->Write(5, $this->app->trans("print_feedback:: Document generated on : " . " "));
$this->pdf->SetFont(PhraseaPDF::FONT, '', 12);
$this->pdf->Write(5, $this->app['date-formatter']->getDate(new \DateTime('now')));
$this->pdf->Write(5, $this->formatDate(new \DateTime('now')));
$this->pdf->Write(12, "\n");
$this->pdf->SetFont(PhraseaPDF::FONT, 'B', 12);
$this->pdf->Write(5, $this->app->trans("print_feedback:: Feedback initiated by : "));
$this->pdf->Write(5, $this->app->trans("print_feedback:: Feedback initiated by : " . " "));
$this->pdf->SetFont(PhraseaPDF::FONT, '', 12);
$this->pdf->Write(5, $validation->getInitiator()->getLogin());
$this->pdf->Write(5, $this->getDisplayName($validation->getInitiator()));
$this->pdf->Write(6, "\n");
$this->pdf->SetFont(PhraseaPDF::FONT, 'B', 12);
$this->pdf->Write(5, $this->app->trans("print_feedback:: Feedback initiated on : "));
$this->pdf->Write(5, $this->app->trans("print_feedback:: Feedback initiated on : " . " "));
$this->pdf->SetFont(PhraseaPDF::FONT, '', 12);
$this->pdf->Write(5, $this->app['date-formatter']->getDate($validation->getCreated()));
$this->pdf->Write(5, $this->formatDate($validation->getCreated()));
$this->pdf->Write(6, "\n");
$this->pdf->SetFont(PhraseaPDF::FONT, 'B', 12);
$this->pdf->Write(5, $this->app->trans("print_feedback:: Feedback expiring on : "));
$this->pdf->Write(5, $this->app->trans("print_feedback:: Feedback expiring on : " . " "));
$this->pdf->SetFont(PhraseaPDF::FONT, '', 12);
$this->pdf->Write(5, $this->app['date-formatter']->getDate($validation->getExpires()));
$this->pdf->Write(5, $this->formatDate($validation->getExpires()));
$this->pdf->Write(12, "\n");
$this->pdf->SetFont(PhraseaPDF::FONT, 'B', 12);
$this->pdf->Write(5, $this->app->trans("print_feedback:: Feedback " . ($validation->isFinished() ? "expired" : "active")));
$validation->isFinished() ? $this->pdf->Write(5, $this->app->trans("print_feedback:: Feedback expired")) : $this->pdf->Write(5, $this->app->trans("print_feedback:: Feedback active"));
$this->pdf->Write(12, "\n");
$this->pdf->SetFont(PhraseaPDF::FONT, 'B', 12);
$this->pdf->Write(5, $this->app->trans("print_feedback:: Participants : "));
$this->pdf->SetFont(PhraseaPDF::FONT, '', 12);
foreach ($validation->getParticipants() as $participant) {
$this->pdf->Write(5, "\n - " . $participant->getUser()->getLogin());
$this->pdf->Write(5, "\n - " . $this->getDisplayName($participant->getUser()));
}
}
}
@@ -488,7 +495,7 @@ class PDFRecords extends PDF
$ord = $basket->getElementByRecord($this->app, $rec)->getOrd();
$this->pdf->SetY($y);
$this->pdf->SetX(10);
$this->pdf->Cell(190, $h, '#' . $ord, "", 1, "C", 0);
$this->pdf->Cell(190, $h, $ord, "", 1, "C", 0);
}
if ($LEFT__TEXT == "" && is_file($LEFT__IMG)) {
@@ -586,10 +593,96 @@ class PDFRecords extends PDF
}
$this->pdf->SetXY($lmargin, $y += ( $finalHeight + 5));
$this->pdf->SetFont(PhraseaPDF::FONT, 'B', 12);
$this->pdf->Write(5, $this->app->trans("print_feedback:: record title: ") . " ");
$this->pdf->SetFont(PhraseaPDF::FONT, '', 12);
$this->pdf->Write(5, $rec->get_title());
$this->pdf->Write(6, "\n");
$this->pdf->SetFont(PhraseaPDF::FONT, 'B', 12);
$this->pdf->Write(5, $this->app->trans("print_feedback:: record id: ") . " ");
$this->pdf->SetFont(PhraseaPDF::FONT, '', 12);
$this->pdf->Write(5, $rec->getRecordId());
$this->pdf->Write(6, "\n");
$this->pdf->SetFont(PhraseaPDF::FONT, 'B', 12);
$this->pdf->Write(5, $this->app->trans("print_feedback:: base name: ") . " ");
$this->pdf->SetFont(PhraseaPDF::FONT, '', 12);
$this->pdf->Write(5, $rec->getDatabox()->get_label($this->app['locale']));
$this->pdf->Write(6, "\n");
$this->pdf->SetFont(PhraseaPDF::FONT, 'B', 12);
$this->pdf->Write(5, $this->app->trans("print_feedback:: originale filename: ") . " ");
$this->pdf->SetFont(PhraseaPDF::FONT, '', 12);
$this->pdf->Write(5, $rec->get_original_name());
$this->pdf->Write(6, "\n");
$this->pdf->SetFont(PhraseaPDF::FONT, 'B', 12);
$this->pdf->Write(5, $this->app->trans("print_feedback:: document Uuid: ") . " ");
$this->pdf->SetFont(PhraseaPDF::FONT, '', 12);
$this->pdf->Write(5, $rec->getUUID());
$this->pdf->Write(6, "\n");
$nf = 0;
if($basket && $validation) {
/** @var ValidationParticipant $participant */
if ($nf > 0) {
$this->pdf->Write(6, "\n");
}
$this->pdf->Write(12, "\n");
$this->pdf->SetFont(PhraseaPDF::FONT, 'B', 12);
$this->pdf->Write(5, $this->app->trans("print_feedback:: Votes :"));
$this->pdf->SetFont(PhraseaPDF::FONT, '', 12);
$basketElement = $basket->getElementByRecord($this->app, $rec);
$iparticipant = 0;
foreach ($validation->getParticipants() as $participant) {
$this->pdf->Write(6, "\n");
if($iparticipant++ > 0) {
// $this->pdf->SetY($this->pdf->GetY()+1);
}
$validationData = $basketElement->getUserValidationDatas($participant->getUser());
$this->pdf->Write(5, '- ' . $this->getDisplayName($participant->getUser(), true). " : ");
$r = $validationData->getAgreement();
$this->pdf->SetX(100);
if ($r === null) {
$this->pdf->Write(0, $this->app->trans("print_feedback:: non voté"));
}
else {
if($r) {
$this->pdf->SetTextColor(0, 127, 0);
$this->pdf->Write(0, $this->app->trans("print_feedback:: Oui"));
}
else {
$this->pdf->SetTextColor(200, 0, 0);
$this->pdf->Write(0, $this->app->trans("print_feedback:: Non"));
}
$this->pdf->SetTextColor(0);
$this->pdf->Write(0, " (" . $this->formatDate($validationData->getUpdated()) . ")");
}
if (($note = (string)($validationData->getNote())) !== '') {
$this->pdf->SetFont(PhraseaPDF::FONT, 'I', 11);
$this->pdf->Write(5,"\n");
$this->pdf->SetX(100);
$this->pdf->MultiCell(95, 0, $note, '', "L", false);
$this->pdf->SetFont(PhraseaPDF::FONT, '', 12);
}
$nf++;
}
}
if ($write_caption) {
$this->pdf->Write(12, "\n");
foreach ($rec->get_caption()->get_fields() as $field) {
/* @var $field caption_field */
if ($field->get_databox_field()->get_gui_visible()) {
if ($nf > 0) {
$this->pdf->Write(6, "\n");
}
@@ -610,66 +703,87 @@ class PDFRecords extends PDF
$nf++;
}
}
if($basket && $validation) {
/** @var ValidationParticipant $participant */
if ($nf > 0) {
$this->pdf->Write(6, "\n");
}
$this->pdf->SetFont(PhraseaPDF::FONT, 'B', 12);
$this->pdf->Write(5, $this->app->trans("print_feedback:: Votes :"));
$this->pdf->SetFont(PhraseaPDF::FONT, '', 12);
$basketElement = $basket->getElementByRecord($this->app, $rec);
$iparticipant = 0;
foreach ($validation->getParticipants() as $participant) {
$this->pdf->Write(6, "\n");
if($iparticipant++ > 0) {
// $this->pdf->SetY($this->pdf->GetY()+1);
}
$validationData = $basketElement->getUserValidationDatas($participant->getUser());
$this->pdf->Write(5, '- ' . $participant->getUser()->getLogin() . " : ");
$r = $validationData->getAgreement();
$this->pdf->SetX(100);
if ($r === null) {
$this->pdf->Write(0, $this->app->trans("print_feedback:: non voté"));
}
else {
if($r) {
$this->pdf->SetTextColor(0, 127, 0);
$this->pdf->Write(0, $this->app->trans("print_feedback:: Oui"));
}
else {
$this->pdf->SetTextColor(200, 0, 0);
$this->pdf->Write(0, $this->app->trans("print_feedback:: Non"));
}
$this->pdf->SetTextColor(0);
$this->pdf->Write(0, " (" . $this->app['date-formatter']->getDate($validationData->getUpdated()) . ")");
}
if (($note = (string)($validationData->getNote())) !== '') {
$this->pdf->SetFont(PhraseaPDF::FONT, 'I', 11);
$this->pdf->Write(5,"\n");
$this->pdf->SetX(100);
$this->pdf->MultiCell(95, 0, $note, '', "L", false);
$this->pdf->SetFont(PhraseaPDF::FONT, '', 12);
}
$nf++;
}
}
}
return;
}
private function formatDate(DateTime $d)
private function formatDate(\DateTime $date)
{
// todo
$locale = $this->app['locale'];
switch ($locale) {
case 'fr':
$fmt = new DateFormatter(
'fr_FR',
DateFormatter::LONG,
DateFormatter::NONE
);
$date_formated = $fmt->format($date);
break;
case 'en':
$fmt = new DateFormatter(
'en_EN',
DateFormatter::LONG,
DateFormatter::NONE
);
$date_formated = $fmt->format($date);
break;
case 'de':
$fmt = new DateFormatter(
'de_DE',
DateFormatter::LONG,
DateFormatter::NONE
);
$date_formated = $fmt->format($date);
break;
default:
$fmt = new DateFormatter(
'en_EN',
DateFormatter::LONG,
DateFormatter::NONE ,
null,
null,
'yyyy/mm/dd'
);
$date_formated = $fmt->format($date);
break;
}
return $date_formated;
}
private function getDisplayName($user, $short = false)
{
$displayName = '';
if (trim($user->getLastName()) !== '' || trim($user->getFirstName()) !== '') {
$displayName = $user->getFirstName() . ('' !== $user->getFirstName() && '' !== $user->getLastName() ? ' ' : '') . $user->getLastName() ;
if ($short) {
return $displayName;
}
}
$email = trim($user->getEmail());
if ($email === '') {
$email = $user->getLogin();
}
if ($displayName !== '') {
return $displayName . ", " . $email;
} else {
return $email;
}
}
}

View File

@@ -65,7 +65,7 @@
"normalize-css": "^2.1.0",
"npm": "^6.0.0",
"npm-modernizr": "^2.8.3",
"phraseanet-production-client": "0.34.106-d",
"phraseanet-production-client": "0.34.116-d",
"requirejs": "^2.3.5",
"tinymce": "^4.0.28",
"underscore": "^1.8.3",

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<xliff xmlns="urn:oasis:names:tc:xliff:document:1.2" xmlns:jms="urn:jms:translation" version="1.2">
<file date="2020-01-15T09:38:21Z" source-language="en" target-language="de" datatype="plaintext" original="not.available">
<file date="2020-01-29T14:29:07Z" source-language="en" target-language="de" datatype="plaintext" original="not.available">
<header>
<tool tool-id="JMSTranslationBundle" tool-name="JMSTranslationBundle" tool-version="1.1.0-DEV"/>
<note>The source node in most cases contains the sample message as written by the developer. If it looks like a dot-delimitted string such as "form.label.firstname", then the developer has not provided a default message.</note>

View File

@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<xliff xmlns="urn:oasis:names:tc:xliff:document:1.2" xmlns:jms="urn:jms:translation" version="1.2">
<file date="2020-01-15T09:38:50Z" source-language="en" target-language="en" datatype="plaintext" original="not.available">
<file date="2020-01-29T14:29:20Z" source-language="en" target-language="en" datatype="plaintext" original="not.available">
<header>
<tool tool-id="JMSTranslationBundle" tool-name="JMSTranslationBundle" tool-version="1.1.0-DEV"/>
<note>The source node in most cases contains the sample message as written by the developer. If it looks like a dot-delimitted string such as "form.label.firstname", then the developer has not provided a default message.</note>

View File

@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<xliff xmlns="urn:oasis:names:tc:xliff:document:1.2" xmlns:jms="urn:jms:translation" version="1.2">
<file date="2020-01-15T09:39:45Z" source-language="en" target-language="fr" datatype="plaintext" original="not.available">
<file date="2020-01-29T14:29:36Z" source-language="en" target-language="fr" datatype="plaintext" original="not.available">
<header>
<tool tool-id="JMSTranslationBundle" tool-name="JMSTranslationBundle" tool-version="1.1.0-DEV"/>
<note>The source node in most cases contains the sample message as written by the developer. If it looks like a dot-delimitted string such as "form.label.firstname", then the developer has not provided a default message.</note>

View File

@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<xliff xmlns="urn:oasis:names:tc:xliff:document:1.2" xmlns:jms="urn:jms:translation" version="1.2">
<file date="2020-01-15T09:40:44Z" source-language="en" target-language="nl" datatype="plaintext" original="not.available">
<file date="2020-01-29T14:29:56Z" source-language="en" target-language="nl" datatype="plaintext" original="not.available">
<header>
<tool tool-id="JMSTranslationBundle" tool-name="JMSTranslationBundle" tool-version="1.1.0-DEV"/>
<note>The source node in most cases contains the sample message as written by the developer. If it looks like a dot-delimitted string such as "form.label.firstname", then the developer has not provided a default message.</note>

View File

@@ -15,7 +15,11 @@
{% set previewHtml5 = null %}
{% if app.getAclForUser(app.getAuthenticatedUser()).has_access_to_subdef(record, 'preview') and record.has_preview == true %}
{# first check if type audio and there is no preview , fallback to thumbnail #}
{% if app.getAclForUser(app.getAuthenticatedUser()).has_access_to_subdef(record, 'preview') and record.getType == 'audio' and record.has_preview == false %}
{% set preview_obj = record.get_thumbnail() %}
{% elseif app.getAclForUser(app.getAuthenticatedUser()).has_access_to_subdef(record, 'preview') %}
{% set preview_obj = record.get_preview() %}
{% else %}
{% set preview_obj = record.get_thumbnail() %}

View File

@@ -41,7 +41,7 @@
<div style='position:absolute; top:0px; left:0px; height:20px'>
<img class="require_alert" src="/assets/common/images/icons/alert.png" style="display:none;cursor:help;" title="{{ 'edit::Certains champs doivent etre remplis pour valider cet editing' | trans }}">
</div>
<div style='position:absolute; bottom:0px; left:0px; height:20px' class="bottom actions">
<div style='position:absolute; bottom:7px; left:8px; height:20px' class="bottom actions">
<span class="fa-stack previewTips"
tooltipsrc="{{ path('prod_tooltip_preview', { 'sbas_id' : record.get_sbas_id(), 'record_id' : record.get_record_id() }) }}">
@@ -73,9 +73,9 @@
</tbody>
</table>
</div>
<div class="editDiaButtons" style="position:absolute; bottom:0px; right:0px; width:30px; height:12px; display:none">
<img id="idEditDiaButtonsP_{{i}}" style="cursor:pointer" src="/assets/common/images/icons/plus11.png"/>
<img id="idEditDiaButtonsM_{{i}}" style="cursor:pointer" src="/assets/common/images/icons/minus11.png"/>
<div class="editDiaButtons" style="position:absolute; bottom:8px; right:3px; width:30px; display:none">
<span id="idEditDiaButtonsP_{{i}}" style="cursor:pointer"><i class="fa fa-plus editIcon">&nbsp;</i></span>
<span id="idEditDiaButtonsM_{{i}}" style="cursor:pointer"><i class="fa fa-minus editIcon">&nbsp;</i></span>
</div>
</div>
{% endmacro %}
@@ -198,7 +198,7 @@
</div>
<div style="position:absolute; top:4px; width:60px; right:6px; height:24px;">
<button type="submit" class="submit-multivalued">
<img id="EditButAddMultiValued" style="cursor:pointer" src="/assets/common/images/icons/plus16.png" />
<i id="EditButAddMultiValued" class="icon-round-add_box-24px icomoon" style="font-size: 24px;color: grey;">&nbsp;</i>
</button>
</div>
</form>
@@ -411,12 +411,32 @@
</div>
<script type="text/javascript">
{% if multipleDataboxes == 1 %}
$(function() {
$('#EDITWINDOW').hide();
// a workaround for a flaw in the demo system (http://dev.jqueryui.com/ticket/4375), ignore!
$( "#dialog-edit-many-sbas:ui-dialog" ).dialog( "destroy" );
$( "#dialog-edit-many-sbas" ).dialog({
modal: true,
resizable:false,
buttons: {
Ok: function() {
$( this ).dialog( "close" );
}
}
});
$('#dialog-edit-many-sbas').on('dialogclose', function(event) {
location.reload();
});
});
{% else %}
{% set notActionableMsg = '' %}
{% if not_actionable > 1 %}
{% set notActionableMsg = 'prod::editing: %not_actionable% documents ne peuvent etre edites car vos droits sont induffisants' | trans({'%not_actionable%' : not_actionable}) %}
{% elseif not_actionable == 1 %}
{% set notActionableMsg = 'prod::editing: 1 document ne peut etre edite car vos droits sont induffisants' | trans | e('js')%}
{% endif %}
var recordEditorConfig = {
hasMultipleDatabases: {% if multipleDataboxes or recordsRequest|length == 0 %}true{% else %}false{% endif %},
databoxId: {{ databox.get_sbas_id }},
@@ -477,4 +497,6 @@
{% endfor %}
]
};
{% endif %}
</script>

View File

@@ -6,6 +6,10 @@
<h4>{{ 'phraseanet:: basket feedback' | trans }}</h4>
<input type="hidden" name="ssel" value="{{ basketFeedbackId }}" />
<div style="margin: 10px 0 20px 0; padding: 0 10px;">
<label for="RADI_PRE_FBO" class="radio">
<input type="radio" name="lay" checked value="feedbackOnly" id="RADI_PRE_FBO" />
{{ 'print:: basket feedback only' | trans }}
</label>
<label for="RADI_PRE_BF" class="radio">
<input type="radio" name="lay" value="feedback" id="RADI_PRE_BF" />
{{ 'print:: basket feedback' | trans }}
@@ -43,7 +47,7 @@
{{ 'print:: liste d\'imagettes' | trans }}
</label>
<label for="RADI_PRE_THUMGRI" class="radio">
<input type="radio" name="lay" checked value="thumbnailGrid" id="RADI_PRE_THUMGRI" />
<input type="radio" name="lay" {% if not basketFeedbackId %} checked {% endif %} value="thumbnailGrid" id="RADI_PRE_THUMGRI" />
{{ 'print:: planche contact (mosaique)' | trans }}
</label>
</div>
@@ -63,3 +67,12 @@
</div>
</div>
</form>
<script type="text/javascript">
$(document).ready(function() {
var $form = $("form[name=formprintpage]");
$form.bind('submit', function(){
$("#DIALOG").dialog('destroy');
});
});
</script>

View File

@@ -150,6 +150,8 @@
<div class="control-group">
<input id="PushSendFormName" placeholder="{% trans %}Name{% endtrans %}" type="text" name="name"
class="input-block-level"/>
<input id="feedbackTitle" type="hidden" value="{% trans %}prod::feedback:feedback_set_title{% endtrans %}" />
<input id="pushTitle" type="hidden" value="{% trans %}prod::push:push_set_title{% endtrans %}" />
</div>
<div class="control-group">
<textarea id="PushSendFormMessage" placeholder="{% trans %}Message{% endtrans %}" name="message"

View File

@@ -7577,10 +7577,10 @@ phraseanet-common@^0.4.5-d:
js-cookie "^2.1.0"
pym.js "^1.3.1"
phraseanet-production-client@0.34.106-d:
version "0.34.106-d"
resolved "https://registry.yarnpkg.com/phraseanet-production-client/-/phraseanet-production-client-0.34.106-d.tgz#020379df0fc6023eebd5e188c7047b2e83892070"
integrity sha512-Z8XPVe++0oQ6LYubGMHovOhJg1qbSPoCyAD0HMazmtg+TzklfNcvPmUKWxKev2mP9qMLwYr5h4ts7XueyangAQ==
phraseanet-production-client@0.34.116-d:
version "0.34.116-d"
resolved "https://registry.yarnpkg.com/phraseanet-production-client/-/phraseanet-production-client-0.34.116-d.tgz#74d2d3e14e68a66f3a64aeb1f857bad04a4491f0"
integrity sha512-x0IB2zQu0L+jQ/TXpHae8CPqCHsv9yanp254hAcnuwEQ88cig4oNU8JLKxPvwt0d3WUQ5J2S0BdshdbfpFxBbw==
dependencies:
"@mapbox/mapbox-gl-language" "^0.9.2"
"@turf/turf" "^5.1.6"