mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-16 22:43:19 +00:00
PHRAS-2430 Restore jsonQuery
This commit is contained in:
@@ -161,7 +161,33 @@ class QueryController extends Controller
|
|||||||
$result = $engine->query($query, $options);
|
$result = $engine->query($query, $options);
|
||||||
|
|
||||||
if ($this->getSettings()->getUserSetting($user, 'start_page') === 'LAST_QUERY') {
|
if ($this->getSettings()->getUserSetting($user, 'start_page') === 'LAST_QUERY') {
|
||||||
$userManipulator->setUserSetting($user, 'start_page_query', $query);
|
// try to save the "fulltext" query which will be restored on next session
|
||||||
|
try {
|
||||||
|
// local code to find "FULLTEXT" value from jsonQuery
|
||||||
|
$findFulltext = function($clause) use(&$findFulltext) {
|
||||||
|
if(array_key_exists('_ux_zone', $clause) && $clause['_ux_zone']=='FULLTEXT') {
|
||||||
|
return $clause['value'];
|
||||||
|
}
|
||||||
|
if($clause['type']=='CLAUSES') {
|
||||||
|
foreach($clause['clauses'] as $c) {
|
||||||
|
if(($r = $findFulltext($c)) !== null) {
|
||||||
|
return $r;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
};
|
||||||
|
|
||||||
|
$userManipulator->setUserSetting($user, 'last_jsonquery', (string)$request->request->get('jsQuery'));
|
||||||
|
|
||||||
|
$jsQuery = @json_decode((string)$request->request->get('jsQuery'), true);
|
||||||
|
if(($ft = $findFulltext($jsQuery['query'])) !== null) {
|
||||||
|
$userManipulator->setUserSetting($user, 'start_page_query', $ft);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch(\Exception $e) {
|
||||||
|
// no-op
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// log array of collectionIds (from $options) for each databox
|
// log array of collectionIds (from $options) for each databox
|
||||||
|
@@ -264,10 +264,11 @@
|
|||||||
<div class="PNB" id="rightFrame" style="left:auto; width:{{ w2 ~ '%' }}">
|
<div class="PNB" id="rightFrame" style="left:auto; width:{{ w2 ~ '%' }}">
|
||||||
<div id="headBlock" class="PNB">
|
<div id="headBlock" class="PNB">
|
||||||
<div class="searchFormWrapper">
|
<div class="searchFormWrapper">
|
||||||
|
|
||||||
{% if app['settings'].getUserSetting(app.getAuthenticatedUser(), 'start_page') == 'QUERY' %}
|
{% if app['settings'].getUserSetting(app.getAuthenticatedUser(), 'start_page') == 'QUERY' %}
|
||||||
<div id="FIRST_QUERY_CONTAINER" style="display: none" data-format="text">{{app['settings'].getUserSetting(app.getAuthenticatedUser(), 'start_page_jsonquery') | raw}}</div>
|
<div id="FIRST_QUERY_CONTAINER" class="start-query" style="display: none" data-format="text">{{app['settings'].getUserSetting(app.getAuthenticatedUser(), 'start_page_jsonquery') | raw}}</div>
|
||||||
{% elseif app['settings'].getUserSetting(app.getAuthenticatedUser(), 'start_page') == 'LAST_QUERY' %}
|
{% elseif app['settings'].getUserSetting(app.getAuthenticatedUser(), 'start_page') == 'LAST_QUERY' %}
|
||||||
<div id="FIRST_QUERY_CONTAINER" style="display: none" data-format="json">{{app['settings'].getUserSetting(app.getAuthenticatedUser(), 'last_jsonquery') | raw}}</div>
|
<div id="FIRST_QUERY_CONTAINER" class="last-query" style="display: none" data-format="json">{{app['settings'].getUserSetting(app.getAuthenticatedUser(), 'last_jsonquery') | raw}}</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
<form id="searchForm" method="POST" action="{{ path('prod_query') }}" name="phrasea_query" class="phrasea_query">
|
<form id="searchForm" method="POST" action="{{ path('prod_query') }}" name="phrasea_query" class="phrasea_query">
|
||||||
<input id="SENT_query" name="qry" type="hidden" value="{{app['settings'].getUserSetting(app.getAuthenticatedUser(), 'start_page_query')}}">
|
<input id="SENT_query" name="qry" type="hidden" value="{{app['settings'].getUserSetting(app.getAuthenticatedUser(), 'start_page_query')}}">
|
||||||
@@ -414,7 +415,7 @@
|
|||||||
<option value="">{{ 'Select a field' | trans }}</option>
|
<option value="">{{ 'Select a field' | trans }}</option>
|
||||||
{% for field_id, field in search_datas['fields'] %}
|
{% for field_id, field in search_datas['fields'] %}
|
||||||
{# {% if field['type'] != 'date' %}#}
|
{# {% if field['type'] != 'date' %}#}
|
||||||
<option class="dbx db_{{field['sbas']|join(' db_')}}" value="{{field_id}}">{{field['fieldname']}}</option>
|
<option class="dbx db_{{field['sbas']|join(' db_')}}" data-fieldtype="{{ field['type'] }}-FIELD" value="{{field_id}}">{{field['fieldname']}}</option>
|
||||||
{#{% endif %}#}
|
{#{% endif %}#}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</select>
|
</select>
|
||||||
|
Reference in New Issue
Block a user