mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-18 07:23:13 +00:00
Fix PR
Conflicts: lib/Alchemy/Phrasea/Controller/Prod/Records.php templates/web/prod/Share/record.html.twig
This commit is contained in:
@@ -200,7 +200,7 @@ class Export implements ControllerProviderInterface
|
||||
|
||||
return $app->json(array(
|
||||
'success' => false,
|
||||
'message' => _('Something went wrong') . $e->getMessage()
|
||||
'message' => _('Something went wrong')
|
||||
));
|
||||
}
|
||||
}
|
||||
@@ -219,11 +219,14 @@ class Export implements ControllerProviderInterface
|
||||
session_write_close();
|
||||
ignore_user_abort(true);
|
||||
|
||||
$lst = $request->request->get('lst', '');
|
||||
$ssttid = $request->request->get('ssttid', '');
|
||||
|
||||
//prepare export
|
||||
$download = new \set_export($app, $request->get('lst', ''), $request->get('ssttid', ''));
|
||||
$list = $download->prepare_export($app['phraseanet.user'], $app['filesystem'], $request->get('obj'), $request->get("type") == "title" ? : false, $request->get('businessfields'));
|
||||
$download = new \set_export($app, $lst, $ssttid);
|
||||
$list = $download->prepare_export($app['phraseanet.user'], $app['filesystem'], $request->request->get('obj'), $request->request->get("type") == "title" ? : false, $request->request->get('businessfields'));
|
||||
$list['export_name'] = sprintf("%s.zip", $download->getExportName());
|
||||
$list['email'] = $request->get("destmail", "");
|
||||
$list['email'] = $request->request->get("destmail", "");
|
||||
|
||||
$destMails = array();
|
||||
//get destination mails
|
||||
@@ -233,8 +236,8 @@ class Export implements ControllerProviderInterface
|
||||
} else {
|
||||
$app['events-manager']->trigger('__EXPORT_MAIL_FAIL__', array(
|
||||
'usr_id' => $app['phraseanet.user']->get_id(),
|
||||
'lst' => $request->get('lst', ''),
|
||||
'ssttid' => $request->get('ssttid', ''),
|
||||
'lst' => $lst,
|
||||
'ssttid' => $ssttid,
|
||||
'dest' => $mail,
|
||||
'reason' => \eventsmanager_notify_downloadmailfail::MAIL_NO_VALID
|
||||
));
|
||||
@@ -260,7 +263,7 @@ class Export implements ControllerProviderInterface
|
||||
|
||||
//send mails
|
||||
foreach ($destMails as $key => $mail) {
|
||||
if (\mail::send_documents($app, trim($mail), $url, $from, $endDateObject, $request->get('textmail'), $request->get('reading_confirm') == '1' ? : false)) {
|
||||
if (\mail::send_documents($app, trim($mail), $url, $from, $endDateObject, $request->request->get('textmail'), $request->request->get('reading_confirm') == '1' ? : false)) {
|
||||
unset($remaingEmails[$key]);
|
||||
}
|
||||
}
|
||||
@@ -270,8 +273,8 @@ class Export implements ControllerProviderInterface
|
||||
foreach ($remaingEmails as $mail) {
|
||||
$app['events-manager']->trigger('__EXPORT_MAIL_FAIL__', array(
|
||||
'usr_id' => $app['phraseanet.user']->get_id(),
|
||||
'lst' => $request->get('lst', ''),
|
||||
'ssttid' => $request->get('ssttid', ''),
|
||||
'lst' => $lst,
|
||||
'ssttid' => $ssttid,
|
||||
'dest' => $mail,
|
||||
'reason' => \eventsmanager_notify_downloadmailfail::MAIL_FAIL
|
||||
));
|
||||
@@ -281,8 +284,8 @@ class Export implements ControllerProviderInterface
|
||||
foreach ($destMails as $mail) {
|
||||
$app['events-manager']->trigger('__EXPORT_MAIL_FAIL__', array(
|
||||
'usr_id' => $app['phraseanet.user']->get_id(),
|
||||
'lst' => $request->get('lst', ''),
|
||||
'ssttid' => $request->get('ssttid', ''),
|
||||
'lst' => $lst,
|
||||
'ssttid' => $ssttid,
|
||||
'dest' => $mail,
|
||||
'reason' => 0
|
||||
));
|
||||
|
@@ -101,7 +101,7 @@ class Query implements ControllerProviderInterface
|
||||
|
||||
$options = new \searchEngine_options();
|
||||
|
||||
$bas = is_array($request->request->get('bas')) ? $request->request->get('bas') : array_keys($user->ACL()->get_granted_base());
|
||||
$bas = is_array($request->request->get('bas')) ? $request->request->get('bas') : array_keys($app['phraseanet.user']->ACL()->get_granted_base());
|
||||
|
||||
if ($app['phraseanet.user']->ACL()->has_right('modifyrecord')) {
|
||||
$options->set_business_fields(array());
|
||||
@@ -279,7 +279,7 @@ class Query implements ControllerProviderInterface
|
||||
$searchEngine->set_options($options);
|
||||
}
|
||||
|
||||
$pos = $request->request->get('pos');
|
||||
$pos = (int) $request->request->get('pos');
|
||||
$query = $request->request->get('query', '');
|
||||
|
||||
$record = new \record_preview($app, 'RESULT', $pos, '', '', $searchEngine, $query);
|
||||
|
@@ -34,10 +34,7 @@ class Property implements ControllerProviderInterface
|
||||
$controllers = $app['controllers_factory'];
|
||||
|
||||
$controllers->before(function(Request $request) use ($app) {
|
||||
$response = $app['firewall']->requireNotGuest();
|
||||
if ($response instanceof Response) {
|
||||
return $response;
|
||||
}
|
||||
$app['firewall']->requireNotGuest();
|
||||
});
|
||||
|
||||
/**
|
||||
|
182
lib/Alchemy/Phrasea/Controller/Prod/Records.php
Normal file
182
lib/Alchemy/Phrasea/Controller/Prod/Records.php
Normal file
@@ -0,0 +1,182 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of Phraseanet
|
||||
*
|
||||
* (c) 2005-2012 Alchemy
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Alchemy\Phrasea\Controller\Prod\Records;
|
||||
|
||||
use Alchemy\Phrasea\Controller\RecordsRequest;
|
||||
use Silex\Application;
|
||||
use Silex\ControllerProviderInterface;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpFoundation\JsonResponse;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
|
||||
/**
|
||||
*
|
||||
* @license http://opensource.org/licenses/gpl-3.0 GPLv3
|
||||
* @link www.phraseanet.com
|
||||
*/
|
||||
class Deletion implements ControllerProviderInterface
|
||||
{
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function connect(Application $app)
|
||||
{
|
||||
$controllers = $app['controllers_factory'];
|
||||
$controllers->before(function(Request $request) use ($app) {
|
||||
$response = $app['firewall']->requireNotGuest();
|
||||
if ($response instanceof Response) {
|
||||
return $response;
|
||||
}
|
||||
});
|
||||
|
||||
/**
|
||||
* Delete a record or a list of records
|
||||
*
|
||||
* name : record_delete
|
||||
*
|
||||
* description : Delete a record or a list of records
|
||||
*
|
||||
* method : POST
|
||||
*
|
||||
* parameters : none
|
||||
*
|
||||
* return : JSON Response
|
||||
*/
|
||||
$controllers->post('/', $this->call('deleteRecord'))
|
||||
->bind('record_delete');
|
||||
|
||||
/**
|
||||
* Verify if I can delete records
|
||||
*
|
||||
* name : record_what_can_i_delete
|
||||
*
|
||||
* description : Save CSS preferences
|
||||
*
|
||||
* method : POST
|
||||
*
|
||||
* parameters : none
|
||||
*
|
||||
* return : JSON Response
|
||||
*/
|
||||
$controllers->get('/', $this->call('whatCanIDelete'))
|
||||
->bind('record_what_can_i_delete');
|
||||
|
||||
/**
|
||||
* Renew a record URL
|
||||
*
|
||||
* name : record_renew_url
|
||||
*
|
||||
* description : Renew a record URL
|
||||
*
|
||||
* method : POST
|
||||
*
|
||||
* parameters : none
|
||||
*
|
||||
* return : JSON Response
|
||||
*/
|
||||
$controllers->post('/renew-url/', $this->call('renewUrl'))
|
||||
->bind('record_renew_url');
|
||||
|
||||
return $controllers;
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete a record or a list of records
|
||||
*
|
||||
* @param Application $app
|
||||
* @param Request $request
|
||||
* @return HtmlResponse
|
||||
*/
|
||||
public function deleteRecord(Application $app, Request $request)
|
||||
{
|
||||
$records = RecordsRequest::fromRequest($app, $request, !!$app->request->get('del_children'), array(
|
||||
'candeleterecord'
|
||||
));
|
||||
|
||||
$basketElementsRepository = $app['EM']->getRepository('\Entities\BasketElement');
|
||||
$deleted = array();
|
||||
|
||||
foreach ($records as $record) {
|
||||
try {
|
||||
$basketElements = $basketElementsRepository->findElementsByRecord($record);
|
||||
|
||||
foreach ($basketElements as $element) {
|
||||
$app['EM']->remove($element);
|
||||
$deleted[] = $element->getRecord($app)->get_serialize_key();
|
||||
}
|
||||
|
||||
$record->delete();
|
||||
$deleted[] = $record->get_serialize_key();
|
||||
} catch (\Exception $e) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
$app['EM']->flush();
|
||||
|
||||
return $app->json($deleted);
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete a record or a list of records
|
||||
*
|
||||
* @param Application $app
|
||||
* @param Request $request
|
||||
* @return JsonResponse
|
||||
*/
|
||||
public function whatICanDelete(Application $app, Request $request)
|
||||
{
|
||||
$records = RecordsRequest::fromRequest($app, $request, !!$app->request->get('del_children'), array(
|
||||
'candeleterecord'
|
||||
));
|
||||
|
||||
return $app['twig']->render('prod/actions/delete_records_confirm.html.twig', array(
|
||||
'lst' => explode(';', $records->serializedList()),
|
||||
'groupings' => $records->stories()->count(),
|
||||
));
|
||||
}
|
||||
|
||||
/**
|
||||
* Renew url list of records
|
||||
*
|
||||
* @param Application $app
|
||||
* @param Request $request
|
||||
* @param integer $databox_id
|
||||
* @param integer $record_id
|
||||
* @return JsonResponse
|
||||
*/
|
||||
public function renewUrl(Application $app, Request $request)
|
||||
{
|
||||
$records = RecordsRequest::fromRequest($app, $request, !!$app->request->get('renew_children_url'));
|
||||
|
||||
$renewed = array();
|
||||
foreach ($records as $record) {
|
||||
$renewed[] = array(
|
||||
$record->get_serialized_key() => $record->get_preview()->renew_url(),
|
||||
);
|
||||
};
|
||||
|
||||
return $app->json($renewed);
|
||||
}
|
||||
|
||||
/**
|
||||
* Prefix the method to call with the controller class name
|
||||
*
|
||||
* @param string $method The method to call
|
||||
* @return string
|
||||
*/
|
||||
private function call($method)
|
||||
{
|
||||
return sprintf('%s::%s', __CLASS__, $method);
|
||||
}
|
||||
}
|
@@ -87,7 +87,7 @@ class Notifications implements ControllerProviderInterface
|
||||
$app['events-manager']->read(explode('_', (string) $request->request->get('notifications')), $app['phraseanet.user']->get_id());
|
||||
|
||||
return $app->json(array('success' => true, 'message' => ''));
|
||||
} catch (Exception $e) {
|
||||
} catch (\Exception $e) {
|
||||
|
||||
return $app->json(array('success' => false, 'message' => $e->getMessage()));
|
||||
}
|
||||
|
@@ -16,11 +16,6 @@ use Silex\ControllerProviderInterface;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpFoundation\JsonResponse;
|
||||
|
||||
/**
|
||||
*
|
||||
* @license http://opensource.org/licenses/gpl-3.0 GPLv3
|
||||
* @link www.phraseanet.com
|
||||
*/
|
||||
class Preferences implements ControllerProviderInterface
|
||||
{
|
||||
|
||||
@@ -85,13 +80,15 @@ class Preferences implements ControllerProviderInterface
|
||||
$prop = $request->request->get('prop');
|
||||
$value = $request->request->get('value');
|
||||
$success = false;
|
||||
$msg = _('Error while saving preference');
|
||||
|
||||
if ($prop && $value) {
|
||||
$app['session']->set('pref.' . $prop, $value);
|
||||
$success = true;
|
||||
$msg = _('Preference saved !');
|
||||
}
|
||||
|
||||
return new JsonResponse(array('success' => $success));
|
||||
return new JsonResponse(array('success' => $success, 'message' => $msg));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -1,13 +1,14 @@
|
||||
{% set preview = record.get_preview()%}
|
||||
{% set permalink = preview.get_permalink() %}
|
||||
|
||||
{% if preview is iterable %}
|
||||
<p>{% trans 'No preview available.' %}</p>
|
||||
{% elseif permalink is none %}
|
||||
{% elseif preview.get_permalink() is none %}
|
||||
<p>{% trans 'No permalink available.' %}</p>
|
||||
{% else %}
|
||||
{% set type = record.get_type() %}
|
||||
{% set url = permalink.get_url() %}
|
||||
{% set url = preview.get_permalink().get_url() %}
|
||||
|
||||
{% if url is not empty %}
|
||||
<div id="tabs">
|
||||
<ul>
|
||||
<li>
|
||||
@@ -15,15 +16,13 @@
|
||||
</li>
|
||||
</ul>
|
||||
<div id="share">
|
||||
|
||||
<div class="boxCloser" onclick="parent.hideDwnl();">{% trans 'boutton::fermer' %} ?></div>
|
||||
<div id="tweet">
|
||||
<div style="margin-left:20px;padding:10px 0 5px;"><a href="http://www.twitter.com/home/?status={{ url|url_encode }}view/" target="_blank"><img src="/skins/icons/twitter.ico" title="share this on twitter" style="vertical-align:middle;padding:0 5px;"/> Send to Twitter</a></div>
|
||||
<div style="margin-left:20px;padding:5px 0 10px;"><a href="http://www.facebook.com/sharer.php?u={{ url|url_encode }}view/" target="_blank"><img src="/skins/icons/facebook.ico" title="share on facebook" style="vertical-align:middle;padding:0 5px;"/> Send to Facebook</a></div>
|
||||
</div>
|
||||
<div id="embed" style="text-align:center;padding:10px 0;">
|
||||
<div style="text-align:left;margin-left:20px;padding:10px 0;">URL : </div>
|
||||
{% if url is not empty %}
|
||||
|
||||
<input style="width:90%;" readonly="true" type="text" value="{{ url|url_encode }}view/" onfocus="this.focus();this.select();" onclick="this.focus();this.select();" />
|
||||
<div style="text-align:left;margin-left:20px;padding:10px 0;">Embed :</div>
|
||||
<textarea onfocus="this.focus();this.select();" onclick="this.focus();this.select();" style="width:90%;height:50px;" readonly="true" >
|
||||
@@ -55,12 +54,8 @@
|
||||
{% endif %}
|
||||
</textarea>
|
||||
</div>
|
||||
{% else %}
|
||||
<div><{% trans 'Aucune URL disponible' %}</div>
|
||||
{% endif %}
|
||||
|
||||
<div style="text-align:center;padding:20px 0;">
|
||||
<input class="input-button" type="button" value="{% trans 'boutton::fermer' %}" onclick="parent.hideDwnl();" />
|
||||
<input class="input-button" type="button" value="{% trans 'boutton::fermer' %}" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -72,8 +67,10 @@
|
||||
function(){$(this).addClass('ui-state-hover')},
|
||||
function(){$(this).removeClass('ui-state-hover')}
|
||||
);
|
||||
|
||||
});
|
||||
</script>
|
||||
{% else %}
|
||||
<div><{% trans 'Aucune URL disponible' %}</div>
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
|
||||
|
@@ -14,11 +14,11 @@ class QueryTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
|
||||
*/
|
||||
public function testQueryAnswerTrain()
|
||||
{
|
||||
$this->markTestSkipped('Unable to create phrasea session');
|
||||
// $this->markTestSkipped('Unable to create phrasea session');
|
||||
|
||||
//populate phrasea_session
|
||||
$auth = new \Session_Authentication_None(self::$DI['user']);
|
||||
self::$DI['app']->openAccount($auth);
|
||||
// $auth = new \Session_Authentication_None(self::$DI['user']);
|
||||
// self::$DI['app']->openAccount($auth);
|
||||
|
||||
$query = new Query();
|
||||
$options = new \searchEngine_options();
|
||||
|
@@ -273,7 +273,6 @@ class ControllerRssFeedTest extends \PhraseanetWebTestCaseAbstract
|
||||
|
||||
public function testGetFeedFormat()
|
||||
{
|
||||
$this->markTestSkipped('');
|
||||
$feeds = Feed_Collection::load_public_feeds(self::$DI['app']);
|
||||
$all_feeds = $feeds->get_feeds();
|
||||
$feed = array_shift($all_feeds);
|
||||
|
@@ -718,7 +718,6 @@ abstract class PhraseanetPHPUnitAbstract extends WebTestCase
|
||||
return $collection_no_acces_by_status;
|
||||
});
|
||||
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -761,6 +760,7 @@ abstract class PhraseanetPHPUnitAbstract extends WebTestCase
|
||||
return $record;
|
||||
});
|
||||
}
|
||||
|
||||
foreach (range(1, 2) as $i) {
|
||||
self::$DI['record_story_' . $i] = self::$DI->share(function($DI) use ($i) {
|
||||
|
||||
|
@@ -1703,31 +1703,6 @@ function chgCollThis(datas)
|
||||
});
|
||||
}
|
||||
|
||||
//function chgStatusThis(url)
|
||||
//{
|
||||
// url = "docfunction.php?"+url;
|
||||
// $('#MODALDL').attr('src','about:blank');
|
||||
// $('#MODALDL').attr('src',url);
|
||||
//
|
||||
//
|
||||
// var t = (bodySize.y - 400) / 2;
|
||||
// var l = (bodySize.x - 550) / 2;
|
||||
//
|
||||
// $('#MODALDL').css({
|
||||
// 'display': 'block',
|
||||
// 'opacity': 0,
|
||||
// 'width': '550px',
|
||||
// 'position': 'absolute',
|
||||
// 'top': t,
|
||||
// 'left': l,
|
||||
// 'height': '400px'
|
||||
// }).fadeTo(500, 1);
|
||||
//
|
||||
// showOverlay(2);
|
||||
// $('#tooltip').hide();
|
||||
//}
|
||||
|
||||
|
||||
function pushThis(sstt_id, lst, story)
|
||||
{
|
||||
$dialog = p4.Dialog.Create({
|
||||
@@ -1735,20 +1710,15 @@ function pushThis(sstt_id, lst, story)
|
||||
title:'Push'
|
||||
});
|
||||
|
||||
$.post("/prod/push/sendform/"
|
||||
, {
|
||||
$.post("/prod/push/sendform/", {
|
||||
lst : lst,
|
||||
ssel : sstt_id,
|
||||
story : story
|
||||
}
|
||||
, function(data){
|
||||
}, function(data){
|
||||
$dialog.setContent(data);
|
||||
return;
|
||||
});
|
||||
}
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
|
||||
function feedbackThis(sstt_id, lst, story)
|
||||
{
|
||||
@@ -1758,17 +1728,14 @@ function feedbackThis(sstt_id, lst, story)
|
||||
title:'Feedback'
|
||||
});
|
||||
|
||||
$.post("/prod/push/validateform/"
|
||||
, {
|
||||
$.post("/prod/push/validateform/", {
|
||||
lst : lst,
|
||||
ssel : sstt_id,
|
||||
story : story
|
||||
}
|
||||
, function(data){
|
||||
}, function(data){
|
||||
$dialog.setContent(data);
|
||||
return;
|
||||
}
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
function toolREFACTOR(datas){
|
||||
|
Reference in New Issue
Block a user