mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-17 06:53:15 +00:00
Fixed iconurl integration
This commit is contained in:
@@ -124,12 +124,14 @@ class Publications implements ControllerProviderInterface
|
||||
);
|
||||
$feed = $app["EM"]->find('Entities\Feed', $id);
|
||||
|
||||
if (null === $feed) {
|
||||
$app->abort(404, "Feed not found");
|
||||
}
|
||||
|
||||
$request = $app["request"];
|
||||
|
||||
if (!$feed->getOwner($app['authentication']->getUser())) {
|
||||
$datas['message'] = 'You are not allowed to do that';
|
||||
|
||||
return $app->json($datas);
|
||||
if (!$feed->isOwner($app['authentication']->getUser())) {
|
||||
$app->abort(403, "Access Forbidden");
|
||||
}
|
||||
|
||||
try {
|
||||
@@ -170,6 +172,15 @@ class Publications implements ControllerProviderInterface
|
||||
|
||||
unset($media);
|
||||
|
||||
$feed->setIconUrl(true);
|
||||
$app['EM']->persist($feed);
|
||||
$app['EM']->flush();
|
||||
|
||||
$baseDir = realpath(__DIR__ . '/../../../../../');
|
||||
|
||||
$app['filesystem']->copy($tmpname, $baseDir . '/config/feed_' . $feed->getId() . '.jpg');
|
||||
$app['filesystem']->copy($tmpname, 'custom/feed_' . $feed->getId() . '.jpg');
|
||||
|
||||
$app['filesystem']->remove($tmpname);
|
||||
|
||||
$datas['success'] = true;
|
||||
@@ -217,7 +228,7 @@ class Publications implements ControllerProviderInterface
|
||||
|
||||
$publisher = $app["EM"]->find('Entities\FeedPublisher', $request->request->get('publisher_id'));
|
||||
if (null === $publisher) {
|
||||
throw new \Exception_Feed_PublisherNotFound();
|
||||
$app->abort(404, "Feed Publisher not found");
|
||||
}
|
||||
|
||||
$user = $publisher->getUser($app);
|
||||
|
@@ -11,7 +11,11 @@
|
||||
<div class="control-group">
|
||||
<div id="pub_icon">
|
||||
<div class="thumb_wrapper">
|
||||
<img id="img_before" src="{{ feed.getIconUrl() }}" />
|
||||
<img id="img_before" src="{% if feed.getIconUrl() == false %}
|
||||
/skins/icons/rss32.gif
|
||||
{% else %}
|
||||
/custom/feed_{{ feed.getId() }}.jpg
|
||||
{% endif %}" />
|
||||
</div>
|
||||
</div>
|
||||
<div id="pub_fileupload">
|
||||
@@ -145,7 +149,7 @@
|
||||
{{ publisher.getUser(app).get_email() }}
|
||||
</td>
|
||||
<td valign="center" align="center">
|
||||
{% if publisher.getOwner() == true %}
|
||||
{% if publisher.isOwner() == true %}
|
||||
X
|
||||
{% else %}
|
||||
<form class="no-ajax form_publication" method="post" action="{{ path('admin_feeds_feed_remove_publisher', { 'id' : feed.getId() }) }}" style="margin:0;">
|
||||
|
@@ -64,7 +64,11 @@
|
||||
<td>
|
||||
<div style="border:1px solid #ccc; width:22px; height:22px; margin:2px;">
|
||||
<a href="{{ path('admin_feeds_feed', { 'id' : feed.getId() }) }}">
|
||||
<img src="{{feed.getIconUrl() ~ '?' ~ random(1000) }}" id="pub_icon" style="margin:3px; width:16px; height:16px;"/>
|
||||
<img src="{% if feed.getIconUrl() == false %}
|
||||
/skins/icons/rss32.gif
|
||||
{% else %}
|
||||
/custom/feed_{{ feed.getId() }}.jpg
|
||||
{% endif %}" id="pub_icon" style="margin:3px; width:16px; height:16px;"/>
|
||||
</a>
|
||||
</div>
|
||||
</td>
|
||||
|
@@ -107,32 +107,22 @@ class Module_Admin_Route_PublicationTest extends \PhraseanetWebTestCaseAuthentic
|
||||
|
||||
public function testIconUploadErrorOwner()
|
||||
{
|
||||
$this->markTestSkipped(); // icon upload being changed
|
||||
$feed = $this->insertOneFeed(self::$DI['user_alt1']);
|
||||
|
||||
$feed = \Feed_Adapter::create(self::$DI['app'], self::$DI['user_alt1'], "salut", 'coucou');
|
||||
|
||||
self::$DI['client']->request("POST", "/admin/publications/feed/" . $feed->get_id() . "/iconupload/", array(), array(), array('HTTP_ACCEPT' => 'application/json'));
|
||||
self::$DI['client']->request("POST", "/admin/publications/feed/" . $feed->getId() . "/iconupload/", array(), array(), array('HTTP_ACCEPT' => 'application/json'));
|
||||
|
||||
$response = self::$DI['client']->getResponse();
|
||||
|
||||
$this->assertTrue($response->isOk());
|
||||
|
||||
$content = json_decode($response->getContent());
|
||||
|
||||
$this->assertFalse($content->success);
|
||||
|
||||
$feed->delete();
|
||||
$this->assertEquals(403, $response->getStatusCode());
|
||||
}
|
||||
|
||||
public function testIconUploadErrorFileData()
|
||||
{
|
||||
$this->markTestSkipped(); // icon upload being changed
|
||||
|
||||
$feed = \Feed_Adapter::create(self::$DI['app'], self::$DI['user'], "salut", 'coucou');
|
||||
$feed = $this->insertOneFeed(self::$DI['user']);
|
||||
|
||||
self::$DI['client']->request(
|
||||
"POST"
|
||||
, "/admin/publications/feed/" . $feed->get_id() . "/iconupload/"
|
||||
, "/admin/publications/feed/" . $feed->getId() . "/iconupload/"
|
||||
, array()
|
||||
, array('Filedata' => array('error' => 1))
|
||||
);
|
||||
@@ -142,19 +132,15 @@ class Module_Admin_Route_PublicationTest extends \PhraseanetWebTestCaseAuthentic
|
||||
$content = json_decode($response->getContent());
|
||||
|
||||
$this->assertFalse($content->success);
|
||||
|
||||
$feed->delete();
|
||||
}
|
||||
|
||||
public function testIconUploadErrorFileType()
|
||||
{
|
||||
$this->markTestSkipped(); // icon upload being changed
|
||||
|
||||
$feed = \Feed_Adapter::create(self::$DI['app'], self::$DI['user'], "salut", 'coucou');
|
||||
$feed = $this->insertOneFeed(self::$DI['user']);
|
||||
|
||||
self::$DI['client']->request(
|
||||
"POST"
|
||||
, "/admin/publications/feed/" . $feed->get_id() . "/iconupload/"
|
||||
, "/admin/publications/feed/" . $feed->getId() . "/iconupload/"
|
||||
, array()
|
||||
, array('Filedata' => array('error' => 0, 'tmp_name' => __DIR__ . '/../../../../../files/test007.ppt'))
|
||||
);
|
||||
@@ -164,15 +150,11 @@ class Module_Admin_Route_PublicationTest extends \PhraseanetWebTestCaseAuthentic
|
||||
$content = json_decode($response->getContent());
|
||||
|
||||
$this->assertFalse($content->success);
|
||||
|
||||
$feed->delete();
|
||||
}
|
||||
|
||||
public function testIconUpload()
|
||||
{
|
||||
$this->markTestSkipped(); // icon upload being changed
|
||||
|
||||
$feed = \Feed_Adapter::create(self::$DI['app'], self::$DI['user'], "salut", 'coucou');
|
||||
$feed = $this->insertOneFeed(self::$DI['user']);
|
||||
|
||||
$files = array(
|
||||
'files' => array(
|
||||
@@ -184,7 +166,7 @@ class Module_Admin_Route_PublicationTest extends \PhraseanetWebTestCaseAuthentic
|
||||
|
||||
self::$DI['client']->request(
|
||||
"POST"
|
||||
, "/admin/publications/feed/" . $feed->get_id() . "/iconupload/"
|
||||
, "/admin/publications/feed/" . $feed->getId() . "/iconupload/"
|
||||
, array()
|
||||
, $files
|
||||
);
|
||||
@@ -196,10 +178,6 @@ class Module_Admin_Route_PublicationTest extends \PhraseanetWebTestCaseAuthentic
|
||||
$content = json_decode($response->getContent());
|
||||
|
||||
$this->assertTrue($content->success);
|
||||
|
||||
$feed = new \Feed_Adapter(self::$DI['app'], $feed->get_id());
|
||||
|
||||
$feed->delete();
|
||||
}
|
||||
|
||||
public function testAddPublisher()
|
||||
|
Reference in New Issue
Block a user