mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-16 06:23:18 +00:00
PHRAS-1038 - fix story navigation in workzone context
This commit is contained in:

committed by
Benoît Burnichon

parent
4910beb251
commit
755aac9e3e
@@ -39,7 +39,7 @@ class eventsmanager_notify_push extends eventsmanager_notifyAbstract
|
||||
$sender = $user->getDisplayName();
|
||||
|
||||
$ret = [
|
||||
'text' => $this->app->trans('%user% vous a envoye un %before_link% panier %after_link%', ['%user%' => $sender, '%before_link%' => '<a href="#" onclick="openPreview(\'BASK\',1,\''
|
||||
'text' => $this->app->trans('%user% vous a envoye un %before_link% panier %after_link%', ['%user%' => $sender, '%before_link%' => '<a href="#" onclick="openPreview(this, \'BASK\',1,\''
|
||||
. $data['ssel_id'] . '\');return false;">', '%after_link%' => '</a>'])
|
||||
, 'class' => ($unread == 1 ? 'reload_baskets' : '')
|
||||
];
|
||||
|
@@ -53,7 +53,7 @@ class eventsmanager_notify_validationreminder extends eventsmanager_notifyAbstra
|
||||
$basket_name = $this->app->trans('Une selection');
|
||||
}
|
||||
|
||||
$bask_link = '<a href="#" onclick="openPreview(\'BASK\',1,\''
|
||||
$bask_link = '<a href="#" onclick="openPreview(this, \'BASK\',1,\''
|
||||
. $ssel_id . '\');return false;">'
|
||||
. $basket_name . '</a>';
|
||||
|
||||
|
@@ -34,13 +34,21 @@ function getNewVideoToken(lst, obj) {
|
||||
* @param contId
|
||||
* @param reload
|
||||
*/
|
||||
function openPreview(env, pos, contId, reload) {
|
||||
|
||||
function openPreview(event, env, pos, contId, reload) {
|
||||
if (contId == undefined)
|
||||
contId = '';
|
||||
var roll = 0;
|
||||
var justOpen = false;
|
||||
|
||||
var options_serial = p4.tot_options;
|
||||
var query = p4.tot_query;
|
||||
var navigation = p4.navigation;
|
||||
var navigationContext = '';
|
||||
|
||||
// keep relative position for answer train:
|
||||
var relativePos = pos;
|
||||
var absolutePos = 0;
|
||||
|
||||
if (!p4.preview.open) {
|
||||
showOverlay();
|
||||
|
||||
@@ -66,6 +74,15 @@ function openPreview(env, pos, contId, reload) {
|
||||
if (env == 'BASK')
|
||||
roll = 1;
|
||||
|
||||
// if comes from story and in workzone
|
||||
if (env == 'REG') {
|
||||
navigationContext = 'storyFromResults';
|
||||
var $source = $(event);
|
||||
if( $source.hasClass('CHIM')) {
|
||||
navigationContext = 'storyFromWorkzone';
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (reload === true)
|
||||
@@ -78,21 +95,14 @@ function openPreview(env, pos, contId, reload) {
|
||||
|
||||
$('#PREVIEWIMGCONT').empty();
|
||||
|
||||
var options_serial = p4.tot_options;
|
||||
var query = p4.tot_query;
|
||||
var navigation = p4.navigation;
|
||||
|
||||
// keep relative position for answer train:
|
||||
var relativePos = pos;
|
||||
// update real absolute position with pagination:
|
||||
var absolutePos = parseInt(navigation.perPage,10) * (parseInt(navigation.page, 10) - 1) + parseInt(pos,10);
|
||||
|
||||
// if comes from story, work with relative positionning
|
||||
if (env == 'REG') {
|
||||
// @TODO - if event comes from workzone (basket|story),
|
||||
// we can use the relative position in order to display the doubleclicked records
|
||||
// except we can't know the original event in this implementation
|
||||
if (navigationContext === 'storyFromWorkzone') {
|
||||
// if event comes from workzone, set to relative position (CHIM == chutier image)
|
||||
absolutePos = relativePos;
|
||||
} else if (navigationContext === 'storyFromResults') {
|
||||
absolutePos = 0;
|
||||
} else {
|
||||
// update real absolute position with pagination for records:
|
||||
absolutePos = parseInt(navigation.perPage, 10) * (parseInt(navigation.page, 10) - 1) + parseInt(pos, 10);
|
||||
}
|
||||
|
||||
prevAjax = $.ajax({
|
||||
@@ -361,7 +371,7 @@ function getNext() {
|
||||
if (p4.preview.mode == 'RESULT') {
|
||||
posAsk = parseInt(p4.preview.current.pos) + 1;
|
||||
posAsk = (posAsk >= parseInt(p4.tot) || isNaN(posAsk)) ? 0 : posAsk;
|
||||
openPreview('RESULT', posAsk, '', false);
|
||||
openPreview(false, 'RESULT', posAsk, '', false);
|
||||
}
|
||||
else {
|
||||
if (!$('#PREVIEWCURRENT li.selected').is(':last-child'))
|
||||
@@ -383,7 +393,7 @@ function getPrevious() {
|
||||
// may go to last result
|
||||
posAsk = (posAsk < 0) ? ((parseInt(p4.tot) - 1)) : posAsk;
|
||||
}
|
||||
openPreview('RESULT', posAsk, '', false);
|
||||
openPreview(false, 'RESULT', posAsk, '', false);
|
||||
}
|
||||
else {
|
||||
if (!$('#PREVIEWCURRENT li.selected').is(':first-child'))
|
||||
@@ -431,7 +441,7 @@ function setCurrent(current) {
|
||||
var absolutePos = jsopt[1];
|
||||
var relativePos = parseInt(absolutePos, 10) - parseInt(p4.navigation.perPage, 10) * (parseInt(p4.navigation.page, 10) - 1);
|
||||
// keep relative position for answer train:
|
||||
openPreview(jsopt[0], relativePos, jsopt[2],false);
|
||||
openPreview(this, jsopt[0], relativePos, jsopt[2],false);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
@@ -277,7 +277,7 @@
|
||||
|
||||
{% import 'common/thumbnail.html.twig' as thumbnail %}
|
||||
|
||||
<div ondblclick="{% if wz_scope == 'groupings' %}openPreview('REG',{{ ord }},'{{container.get_sbas_id()}}_{{container.get_record_id()}}');{% else %}openPreview('BASK',{{ ord }},{{container.getId()}});{% endif %}"
|
||||
<div ondblclick="{% if wz_scope == 'groupings' %}openPreview(this, 'REG',{{ ord }},'{{container.get_sbas_id()}}_{{container.get_record_id()}}');{% else %}openPreview(this, 'BASK',{{ ord }},{{container.getId()}});{% endif %}"
|
||||
class="CHIM diapo CHIM_{{record.get_serialize_key()}}" style="height:{{box_height}}px;"
|
||||
id="CHIM_{% if wz_scope == 'groupings' %}{{record.get_serialize_key()}}{% else %}{{ contained.getId() }}{% endif %}">
|
||||
<input type="hidden" name="id" value="{{ record.get_serialize_key() }}"/>
|
||||
|
@@ -3,7 +3,7 @@
|
||||
<ul>
|
||||
<li class="title">{{ 'Apparait aussi dans ces reportages' | trans }}</li>
|
||||
{% for par in parents %}
|
||||
<li onclick="openPreview('REG',0,'{{par.get_serialize_key()}}', true); return(false);"
|
||||
<li onclick="openPreview(this, 'REG',0,'{{par.get_serialize_key()}}', true); return(false);"
|
||||
class="otherRegToolTip" {% if app['conf'].get(['registry', 'classic', 'stories-preview']) %}tooltipsrc="{{ path('prod_tooltip_caption', { 'sbas_id' : par.get_sbas_id(), 'record_id' : par.get_record_id(), 'context' : 'basket' }) }}" {% endif %}>
|
||||
<img src="{{par.get_thumbnail().get_url()}}" style="width:25px;height:25px;"/>
|
||||
<span class="title" title="{{ par.get_title() }}"> {{ par.get_title() }} </span>
|
||||
@@ -16,7 +16,7 @@
|
||||
<ul>
|
||||
<li class="title">{{ 'Apparait aussi dans ces paniers' | trans }}</li>
|
||||
{% for basket in baskets %}
|
||||
<li onclick="openPreview('BASK',0,'{{basket.getId()}}',true); return(false);"
|
||||
<li onclick="openPreview(this, 'BASK',0,'{{basket.getId()}}',true); return(false);"
|
||||
class="otherBaskToolTip" title="{{basket.getDescription()}}">
|
||||
{#<img style="vertical-align:middle" src="/assets/common/images/icons/basket.png" width="16">#}
|
||||
|
||||
|
@@ -25,7 +25,7 @@
|
||||
%}
|
||||
|
||||
<div id="PREVMAINREG" class="PNB10">
|
||||
<img onclick="openPreview('REG',0,'{{story.get_serialize_key}}')"
|
||||
<img onclick="openPreview(this, 'REG',0,'{{story.get_serialize_key}}')"
|
||||
src="{{url}}"
|
||||
style="
|
||||
width:{{fit_size.width}}px;
|
||||
|
@@ -6,7 +6,7 @@
|
||||
sbas="{{ record.databoxId }}"
|
||||
id="{{'PUBLI_' ~ entry.id ~ '_' ~ record.id }}"
|
||||
class="IMGT diapo type-{{ record.type }}"
|
||||
onDblClick="openPreview('FEED',{{ record.getNumber }},{{ entry.id }});"
|
||||
onDblClick="openPreview(this, 'FEED',{{ record.getNumber }},{{ entry.id }});"
|
||||
>
|
||||
<div style="padding: 4px;">
|
||||
<div style="height:40px; position: relative; z-index: 95;margin-bottom:0;border-bottom:none;">
|
||||
|
@@ -5,7 +5,7 @@
|
||||
sbas="{{ record.databoxId }}"
|
||||
id="{{ prefix|default('IMGT') }}_{{ record.id }}"
|
||||
class="IMGT diapo {% if record.story %}grouping{% endif %} type-{{ record.type }}"
|
||||
onDblClick="openPreview('{{ record.story ? 'REG' : 'RESULT' }}', '{{ record.position|default(0) }}', '{{ record.id }}');">
|
||||
onDblClick="openPreview(this, '{{ record.story ? 'REG' : 'RESULT' }}', '{{ record.position|default(0) }}', '{{ record.id }}');">
|
||||
<div style="padding: 4px;">
|
||||
<div style="height:40px; position: relative; z-index: 95;margin-bottom:0;border-bottom:none;">
|
||||
<div class="title" style="max-height:100%" title="{{ record.title(app.locale) }}">
|
||||
|
Reference in New Issue
Block a user