mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-23 18:03:17 +00:00
Merge branch 'master' into PHRAS-2127/fix-geoname-on-registration
This commit is contained in:
@@ -944,7 +944,7 @@ class V1Controller extends Controller
|
||||
}
|
||||
|
||||
$originalName = $pi['filename'] . '.' . $pi['extension'];
|
||||
$newPathname = $tempfile;
|
||||
$uploadedFilename = $newPathname = $tempfile;
|
||||
}
|
||||
}
|
||||
else {
|
||||
@@ -956,8 +956,11 @@ class V1Controller extends Controller
|
||||
if (!$file->isValid()) {
|
||||
return $this->getBadRequestAction($request, 'Data corrupted, please try again');
|
||||
}
|
||||
|
||||
$uploadedFilename = $file->getPathname();
|
||||
$originalName = $file->getClientOriginalName();
|
||||
$newPathname = $file->getPathname() . '.' . $file->getClientOriginalExtension();
|
||||
|
||||
if (false === rename($file->getPathname(), $newPathname)) {
|
||||
return Result::createError($request, 403, 'Error while renaming file')->createResponse();
|
||||
}
|
||||
@@ -1010,6 +1013,11 @@ class V1Controller extends Controller
|
||||
$nosubdef = $request->get('nosubdefs') === '' || \p4field::isyes($request->get('nosubdefs'));
|
||||
$this->getBorderManager()->process($session, $Package, $callback, $behavior, $nosubdef);
|
||||
|
||||
// remove $newPathname on temporary directory
|
||||
if ($newPathname !== $uploadedFilename) {
|
||||
@rename($newPathname, $uploadedFilename);
|
||||
}
|
||||
|
||||
$ret = ['entity' => null];
|
||||
|
||||
if ($output instanceof \record_adapter) {
|
||||
@@ -1081,6 +1089,11 @@ class V1Controller extends Controller
|
||||
}
|
||||
}
|
||||
|
||||
// remove $newPathname on temporary directory
|
||||
if ($renamedFilename !== $uploadedFilename) {
|
||||
@rename($renamedFilename, $uploadedFilename);
|
||||
}
|
||||
|
||||
return Result::create($request, $ret)->createResponse();
|
||||
}
|
||||
|
||||
|
@@ -179,7 +179,6 @@ class QueryController extends Controller
|
||||
};
|
||||
|
||||
$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);
|
||||
@@ -317,7 +316,7 @@ class QueryController extends Controller
|
||||
</tfoot>
|
||||
</table></div></div>'
|
||||
. '</div><a href="#" class="search-display-info" data-infos="' . str_replace('"', '"', $explain) . '">'
|
||||
. $this->app->trans('%total% reponses', ['%total%' => '<span>'.$result->getTotal().'</span>']) . '</a>';
|
||||
. $this->app->trans('%total% reponses', ['%total%' => '<span>'.number_format($result->getTotal(),null, null, ' ').'</span>']) . '</a>';
|
||||
|
||||
$json['infos'] = $infoResult;
|
||||
$json['navigationTpl'] = $string;
|
||||
|
@@ -212,8 +212,7 @@ class BasketRepository extends EntityRepository
|
||||
case self::RECEIVED:
|
||||
$dql = 'SELECT b
|
||||
FROM Phraseanet:Basket b
|
||||
JOIN b.elements e
|
||||
WHERE b.user = :usr_id AND b.pusher_id IS NOT NULL';
|
||||
JOIN b.elements e';
|
||||
$params = [
|
||||
'usr_id' => $user->getId()
|
||||
];
|
||||
|
@@ -1,7 +1,7 @@
|
||||
|
||||
<div class="PNB" id="BasketBrowser">
|
||||
<div class="PNB BasketBrowser" id="BasketBrowser">
|
||||
<div class="PNB10 Browser">
|
||||
<div class="PNB10" style="width:190px;right:auto;">
|
||||
<div class="PNB10 leftBrowser">
|
||||
<form name="BasketBrowser" method="GET" action="{{ path('prod_workzone_search') }}">
|
||||
<input name="Query" class="Query search" placeholder="{{ 'Search baskets' | trans }}" type="text"/>
|
||||
|
||||
@@ -78,9 +78,28 @@
|
||||
</form>
|
||||
|
||||
</div>
|
||||
<div class="PNB results" style="left:220px;">
|
||||
<div class="PNB results rightBrowser">
|
||||
</div>
|
||||
</div>
|
||||
<div class="PNB10 Basket">
|
||||
</div>
|
||||
</div>
|
||||
<style>
|
||||
.dialog-Medium {
|
||||
height: 523px!important;
|
||||
}
|
||||
.paginator a {
|
||||
background: none!important;
|
||||
border: 0;
|
||||
border-radius: 0;
|
||||
padding: 0 9px;
|
||||
font-weight: bold;
|
||||
}
|
||||
.result_loader {
|
||||
position: absolute;
|
||||
left: 50%;
|
||||
top: 50%;
|
||||
transform: translate(-50%, -50%);
|
||||
}
|
||||
</style>
|
||||
|
||||
|
@@ -4,28 +4,9 @@
|
||||
<table>
|
||||
<tr>
|
||||
<td>
|
||||
{% if Total == 0 %}
|
||||
{{ 'No results' | trans }}
|
||||
{% elseif Total == 1 %}
|
||||
{{ '1 result' | trans }}
|
||||
{% else %}
|
||||
{% trans with {'%Total%' : Total} %}%Total% results{% endtrans %}
|
||||
{% endif %}
|
||||
</td>
|
||||
<td class="paginator">
|
||||
{% if Page - 1 > 0 %}
|
||||
<a href="{{ path('prod_workzone_search', { 'Query' : Query, 'Year' : Year, 'Type' : Type, 'Page' : (Page - 1) }) }}" class="result">
|
||||
<img src="/assets/prod/images/Basket/Browser/left.png" />
|
||||
</a>
|
||||
{% endif %}
|
||||
<span>
|
||||
Page {{ Page }} / {{ MaxPage }}
|
||||
</span>
|
||||
{% if Page + 1 <= MaxPage %}
|
||||
<a href="{{ path('prod_workzone_search', { 'Query' : Query, 'Year' : Year, 'Type' : Type, 'Page' : (Page + 1) }) }}" class="result">
|
||||
<img src="/assets/prod/images/Basket/Browser/right.png" />
|
||||
</a>
|
||||
{% endif %}
|
||||
{% transchoice Total %}
|
||||
{0} No results|{1} Result|]1,Inf[ Results
|
||||
{% endtranschoice %}
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
@@ -35,18 +16,16 @@
|
||||
{% for Basket in Baskets %}
|
||||
<div class="result {% if loop.index is odd %}odd{% endif %}">
|
||||
<a href="{{ path('basket_delete', {basket: Basket.getId()}) }}" class="delete-basket close" title="{% trans %}Delete basket{% endtrans %}" style="color:#fff;padding:2px">×</a>
|
||||
<div class="PNB10" style="right:15px;">
|
||||
<div class="PNB10 rightBrowserInner">
|
||||
<table>
|
||||
<tr>
|
||||
<td class="thumbnail">
|
||||
{% set BasketElement = Basket.getElements().first() %}
|
||||
{% if BasketElement %}
|
||||
{{thumbnail.format(BasketElement.getRecord(app).get_thumbnail(), 80, 80, '', true, false)}}
|
||||
{{thumbnail.format(BasketElement.getRecord(app).get_thumbnail(), 150, 106, '', true, false)}}
|
||||
{% endif %}
|
||||
<div class="counter">
|
||||
{{ Basket.getElements().count() }}
|
||||
</div>
|
||||
</td>
|
||||
<td class="" width="12" style="font-size: 0"> </td>
|
||||
<td class="content">
|
||||
<h1 class="title">
|
||||
<img class="loader" src="/assets/prod/images/Basket/Browser/loader.gif" />
|
||||
@@ -64,12 +43,15 @@
|
||||
{% endif %}
|
||||
<a class="basket_link" href="{{ path('prod_workzone_basket', { basket : Basket.getId() }) }}">
|
||||
{{ Basket.getName() }}
|
||||
</a>
|
||||
<br><span class="basketCount">
|
||||
{{ Basket.getElements().count() }} {{ ' records' }}
|
||||
</span></a>
|
||||
</h1>
|
||||
|
||||
|
||||
{% if Basket.getPusher() %}
|
||||
<p>
|
||||
{% set user_name = '<a href="/user/' ~ Basket.getPusher().get_id() ~ '/" tooltipsrc="' ~ path('prod_tooltip_user', { 'usr_id' : Basket.getPusher(app).getId() }) ~ '" class="UserTips">' ~ Basket.getPusher(app).get_display_name() ~ '</a>' %}
|
||||
{% set user_name = '<a href="/user/' ~ Basket.getPusher().getId() ~ '/" tooltipsrc="' ~ path('prod_tooltip_user', { 'usr_id' : Basket.getPusher(app).getId() }) ~ '" class="UserTips">' ~ Basket.getPusher(app).getDisplayName() ~ '</a>' %}
|
||||
{% trans with {'%user_name%' : user_name} %}Received from %user_name%{% endtrans %}
|
||||
</p>
|
||||
{% endif %}
|
||||
@@ -117,19 +99,37 @@
|
||||
</td>
|
||||
<td class="paginator">
|
||||
{% if Page - 1 > 0 %}
|
||||
<a href="{{ path('prod_workzone_search', { 'Query' : Query, 'Year' : Year, 'Type' : Type, 'Page' : (Page - 1) }) }}" class="result">
|
||||
<img src="/assets/prod/images/Basket/Browser/left.png" />
|
||||
<a href="{{ path('prod_workzone_search', { 'Query' : Query, 'Year' : Year, 'Type' : Type, 'Page' : (Page - 1) }) }}" class="result prev_res">
|
||||
<
|
||||
</a>
|
||||
{% endif %}
|
||||
<span>
|
||||
Page {{ Page }} / {{ MaxPage }}
|
||||
</span>
|
||||
{% if Page + 1 <= MaxPage %}
|
||||
<a href="{{ path('prod_workzone_search', { 'Query' : Query, 'Year' : Year, 'Type' : Type, 'Page' : (Page + 1) }) }}" class="result">
|
||||
<img src="/assets/prod/images/Basket/Browser/right.png" />
|
||||
<a href="{{ path('prod_workzone_search', { 'Query' : Query, 'Year' : Year, 'Type' : Type, 'Page' : (Page + 1) }) }}" class="result next_res">
|
||||
>
|
||||
</a>
|
||||
{% endif %}
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
<script>
|
||||
//load the next result page
|
||||
jQuery(document).ready(function(){
|
||||
jQuery('.next_res').click(function(){
|
||||
jQuery('.results').append('<img class="result_loader" src="/assets/common/images/icons/loading.svg">');
|
||||
jQuery('.results').load($(this).attr('href'));
|
||||
return false;
|
||||
});
|
||||
});
|
||||
//load the prev result page
|
||||
jQuery(document).ready(function(){
|
||||
jQuery('.prev_res').click(function(){
|
||||
jQuery('.results').append('<img class="result_loader" src="/assets/common/images/icons/loading.svg">');
|
||||
jQuery('.results').load($(this).attr('href'));
|
||||
return false;
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
@@ -14,6 +14,7 @@ use Alchemy\Phrasea\Model\Entities\LazaretSession;
|
||||
use Alchemy\Phrasea\Model\Entities\Task;
|
||||
use Alchemy\Phrasea\Model\Entities\User;
|
||||
use Alchemy\Phrasea\SearchEngine\SearchEngineOptions;
|
||||
use Alchemy\Phrasea\Status\StatusStructureProviderInterface;
|
||||
use Doctrine\Common\Collections\ArrayCollection;
|
||||
use Guzzle\Common\Exception\GuzzleException;
|
||||
use Ramsey\Uuid\Uuid;
|
||||
@@ -1256,13 +1257,33 @@ class ApiJsonTest extends ApiTestCase
|
||||
$record1 = $this->getRecord1();
|
||||
$route = '/api/v1/records/' . $record1->getDataboxId() . '/' . $record1->getRecordId() . '/setstatus/';
|
||||
|
||||
$record_status = strrev($record1->getStatus());
|
||||
$initialRecordStatus = $record_status = strrev($record1->getStatus());
|
||||
|
||||
/** @var StatusStructureProviderInterface $statusProvider */
|
||||
$statusProvider = $app['status.provider'];
|
||||
|
||||
// initialize status structure for test eg: 4 to 15 bit
|
||||
foreach (range(4, 15) as $n) {
|
||||
$properties = [
|
||||
'searchable' => '0',
|
||||
'printable' => '0',
|
||||
'name' => 'status_test_' . $n,
|
||||
'labelon' => '',
|
||||
'labeloff' => '',
|
||||
'labels_on' => [],
|
||||
'labels_off' => [],
|
||||
];
|
||||
|
||||
$statusProvider->updateStatus($record1->getStatusStructure(), $n, $properties);
|
||||
}
|
||||
|
||||
$statusStructure = $record1->getStatusStructure();
|
||||
|
||||
$tochange = [];
|
||||
foreach ($statusStructure as $n => $datas) {
|
||||
$tochange[$n] = substr($record_status, ($n - 1), 1) == '0' ? '1' : '0';
|
||||
}
|
||||
|
||||
$this->evaluateMethodNotAllowedRoute($route, ['GET', 'PUT', 'DELETE']);
|
||||
|
||||
$response = $this->request('POST', $route, $this->getParameters(['status' => $tochange]), ['HTTP_Accept' => $this->getAcceptMimeType()]);
|
||||
@@ -1281,6 +1302,27 @@ class ApiJsonTest extends ApiTestCase
|
||||
$this->assertEquals(substr($record_status, ($n), 1), $tochange[$n]);
|
||||
}
|
||||
|
||||
// test record_status in string
|
||||
$record_status_expected = $record_status;
|
||||
|
||||
$pos = strpos($record_status, '1');
|
||||
$bitToChange[$pos] = '1';
|
||||
|
||||
$response = $this->request('POST', $route, $this->getParameters(['status' => $bitToChange]), ['HTTP_Accept' => $this->getAcceptMimeType()]);
|
||||
$content = $this->unserialize($response->getContent());
|
||||
|
||||
// Get fresh record_1
|
||||
$testRecord = new \record_adapter($app, $testRecord->getDataboxId(), $testRecord->getRecordId());
|
||||
|
||||
$this->evaluateResponse200($response);
|
||||
$this->evaluateMeta200($content);
|
||||
|
||||
$this->evaluateRecordsStatusResponse($testRecord, $content);
|
||||
|
||||
$record_new_status = strrev($testRecord->getStatus());
|
||||
$this->assertEquals($record_status_expected, $record_new_status);
|
||||
|
||||
|
||||
foreach ($tochange as $n => $value) {
|
||||
$tochange[$n] = $value == '0' ? '1' : '0';
|
||||
}
|
||||
@@ -1301,6 +1343,8 @@ class ApiJsonTest extends ApiTestCase
|
||||
$this->assertEquals(substr($record_status, ($n), 1), $tochange[$n]);
|
||||
}
|
||||
|
||||
$this->assertEquals($initialRecordStatus, $record_status);
|
||||
|
||||
$record1->setStatus(str_repeat('0', 32));
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user