mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-07 10:04:27 +00:00
Merge branch '3.8'
Conflicts: lib/classes/Bridge/Api/Dailymotion.php lib/classes/Bridge/Api/Flickr.php lib/classes/Bridge/Api/Interface.php lib/classes/DailymotionWithoutOauth2.php
This commit is contained in:
@@ -32,7 +32,8 @@ class Bridge implements ControllerProviderInterface
|
|||||||
});
|
});
|
||||||
|
|
||||||
$controllers
|
$controllers
|
||||||
->post('/manager/', 'bridge.controller:doPostManager');
|
->post('/manager/', 'bridge.controller:doPostManager')
|
||||||
|
->bind('prod_bridge_manager');
|
||||||
|
|
||||||
$controllers
|
$controllers
|
||||||
->get('/login/{api_name}/', 'bridge.controller:doGetLogin')
|
->get('/login/{api_name}/', 'bridge.controller:doGetLogin')
|
||||||
|
@@ -425,7 +425,7 @@ class Bridge_Api_Dailymotion extends Bridge_Api_Abstract implements Bridge_Api_I
|
|||||||
return $this->get_container_from_id(self::CONTAINER_TYPE_PLAYLIST, $container_id);
|
return $this->get_container_from_id(self::CONTAINER_TYPE_PLAYLIST, $container_id);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
throw new Bridge_Exception_ContainerUnknown('Unknown element ' . $destination);
|
throw new Bridge_Exception_ContainerUnknown('Unknown element ' . $container);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@@ -570,8 +570,8 @@ class Bridge_Api_Dailymotion extends Bridge_Api_Abstract implements Bridge_Api_I
|
|||||||
{
|
{
|
||||||
switch ($record->get_type()) {
|
switch ($record->get_type()) {
|
||||||
case self::ELEMENT_TYPE_VIDEO :
|
case self::ELEMENT_TYPE_VIDEO :
|
||||||
$url_file = $this->_api->uploadFileWithToken($record->get_hd_file()->getRealPath(), $this->oauth_token);
|
$url_file = $this->_api->sendFile($record->get_hd_file()->getRealPath(), $this->oauth_token);
|
||||||
$options = array_merge(['url' => $url_file], $options);
|
$options = array_merge(array('url' => $url_file), $options);
|
||||||
$video = $this->_api->call('POST /me/videos', $options, $this->oauth_token);
|
$video = $this->_api->call('POST /me/videos', $options, $this->oauth_token);
|
||||||
|
|
||||||
return $video["id"];
|
return $video["id"];
|
||||||
|
@@ -193,7 +193,7 @@ class Bridge_Api_Flickr extends Bridge_Api_Abstract implements Bridge_Api_Interf
|
|||||||
throw new Bridge_Exception_ApiConnectorRequestFailed('Unable to retrieve photoset infos for ' . $object);
|
throw new Bridge_Exception_ApiConnectorRequestFailed('Unable to retrieve photoset infos for ' . $object);
|
||||||
|
|
||||||
$xml = $response->getXml();
|
$xml = $response->getXml();
|
||||||
$primary_photo = $this->get_element_from_id((string) $xml['primary'], self::ELEMENT_TYPE_PHOTO);
|
$primary_photo = $this->get_element_from_id((string) $xml->photo['id'], self::ELEMENT_TYPE_PHOTO);
|
||||||
|
|
||||||
return new Bridge_Api_Flickr_Container($xml, $this->get_user_id(), $object, $primary_photo->get_thumbnail());
|
return new Bridge_Api_Flickr_Container($xml, $this->get_user_id(), $object, $primary_photo->get_thumbnail());
|
||||||
break;
|
break;
|
||||||
|
@@ -9,6 +9,7 @@
|
|||||||
* file that was distributed with this source code.
|
* file that was distributed with this source code.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
use Symfony\Component\Routing\Generator\UrlGenerator;
|
||||||
use Symfony\Component\HttpFoundation\Request;
|
use Symfony\Component\HttpFoundation\Request;
|
||||||
|
|
||||||
interface Bridge_Api_Interface
|
interface Bridge_Api_Interface
|
||||||
|
@@ -64,7 +64,7 @@ class DailymotionWithoutOauth2 extends Dailymotion
|
|||||||
*
|
*
|
||||||
* @return String the resulting URL
|
* @return String the resulting URL
|
||||||
*/
|
*/
|
||||||
public function uploadFileWithToken($filePath, $oauth_token)
|
public function sendFile($filePath, $oauth_token)
|
||||||
{
|
{
|
||||||
$result = $this->call('file.upload', [], $oauth_token);
|
$result = $this->call('file.upload', [], $oauth_token);
|
||||||
$timeout = $this->timeout;
|
$timeout = $this->timeout;
|
||||||
|
@@ -6,7 +6,7 @@
|
|||||||
{% if error_message is empty %}
|
{% if error_message is empty %}
|
||||||
|
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
window.opener.publicator_reload_publicator();
|
window.opener.publicator_reload_publicator("{{ path("prod_bridge_manager") }}");
|
||||||
window.close();
|
window.close();
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
|
|
||||||
{% import "common/thumbnail.html.twig" as thumb %}
|
{% import "common/thumbnail.html.twig" as thumb %}
|
||||||
|
|
||||||
<div class="PNB" id='dialog_publicator'>
|
<div class="PNB" id='dialog_publicator' data-url="{{ path("prod_bridge_manager") }}">
|
||||||
<div id='publicator_selection' class="PNB10 ui-corner-all">
|
<div id='publicator_selection' class="PNB10 ui-corner-all">
|
||||||
<div class="PNB10">
|
<div class="PNB10">
|
||||||
{% for id, record in route.get_elements %}
|
{% for id, record in route.get_elements %}
|
||||||
@@ -86,6 +86,7 @@
|
|||||||
$(function() {
|
$(function() {
|
||||||
var pub_tabs = $("#pub_tabs");
|
var pub_tabs = $("#pub_tabs");
|
||||||
var container = $('#dialog_publicator');
|
var container = $('#dialog_publicator');
|
||||||
|
var managerUrl = container.data("url");
|
||||||
|
|
||||||
function popme(url) {
|
function popme(url) {
|
||||||
var newwindow=window.open(url,'logger','height=500,width=800');
|
var newwindow=window.open(url,'logger','height=500,width=800');
|
||||||
@@ -157,7 +158,7 @@ $(function() {
|
|||||||
success: function(datas){
|
success: function(datas){
|
||||||
if(datas.success) {
|
if(datas.success) {
|
||||||
confirmBox.Close();
|
confirmBox.Close();
|
||||||
publicator_reload_publicator();
|
publicator_reload_publicator(managerUrl);
|
||||||
} else {
|
} else {
|
||||||
confirmBox.Close();
|
confirmBox.Close();
|
||||||
var alertBox = p4.Dialog.Create({
|
var alertBox = p4.Dialog.Create({
|
||||||
|
@@ -607,7 +607,7 @@
|
|||||||
</li>
|
</li>
|
||||||
<li class="divider"></li>
|
<li class="divider"></li>
|
||||||
<li>
|
<li>
|
||||||
<a class="TOOL_bridge_btn results_window">
|
<a class="TOOL_bridge_btn results_window" href="{{ path("prod_bridge_manager") }}">
|
||||||
<img src="/skins/icons/door.png" height="16" width="16" />
|
<img src="/skins/icons/door.png" height="16" width="16" />
|
||||||
{{ 'action : bridge' | trans }}
|
{{ 'action : bridge' | trans }}
|
||||||
</a>
|
</a>
|
||||||
|
@@ -1665,27 +1665,28 @@ function activeIcons() {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
$('.TOOL_bridge_btn').live('click', function () {
|
$('.TOOL_bridge_btn').live('click', function (e) {
|
||||||
|
e.preventDefault();
|
||||||
|
var $button = $(this);
|
||||||
var datas = {};
|
var datas = {};
|
||||||
|
|
||||||
if ($(this).hasClass('results_window')) {
|
if ($button.hasClass('results_window')) {
|
||||||
if (p4.Results.Selection.length() > 0)
|
if (p4.Results.Selection.length() > 0)
|
||||||
datas.lst = p4.Results.Selection.serialize();
|
datas.lst = p4.Results.Selection.serialize();
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if ($(this).hasClass('basket_window')) {
|
if ($button.hasClass('basket_window')) {
|
||||||
if (p4.WorkZone.Selection.length() > 0)
|
if (p4.WorkZone.Selection.length() > 0)
|
||||||
datas.lst = p4.WorkZone.Selection.serialize();
|
datas.lst = p4.WorkZone.Selection.serialize();
|
||||||
else
|
else
|
||||||
datas.ssel = $('.SSTT.active').attr('id').split('_').slice(1, 2).pop();
|
datas.ssel = $('.SSTT.active').attr('id').split('_').slice(1, 2).pop();
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if ($(this).hasClass('basket_element')) {
|
if ($button.hasClass('basket_element')) {
|
||||||
datas.ssel = $('.SSTT.active').attr('id').split('_').slice(1, 2).pop();
|
datas.ssel = $('.SSTT.active').attr('id').split('_').slice(1, 2).pop();
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if ($(this).hasClass('story_window')) {
|
if ($button.hasClass('story_window')) {
|
||||||
if (p4.WorkZone.Selection.length() > 0) {
|
if (p4.WorkZone.Selection.length() > 0) {
|
||||||
datas.lst = p4.WorkZone.Selection.serialize();
|
datas.lst = p4.WorkZone.Selection.serialize();
|
||||||
}
|
}
|
||||||
@@ -1698,7 +1699,7 @@ function activeIcons() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (datas.ssel || datas.lst || datas.story) {
|
if (datas.ssel || datas.lst || datas.story) {
|
||||||
init_publicator(datas);
|
init_publicator($button.attr("href"), datas);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
alert(language.nodocselected);
|
alert(language.nodocselected);
|
||||||
|
@@ -1,15 +1,15 @@
|
|||||||
function publicator_reload_publicator() {
|
function publicator_reload_publicator(url) {
|
||||||
var options = $('#dialog_publicator form[name="current_datas"]').serializeArray();
|
var options = $('#dialog_publicator form[name="current_datas"]').serializeArray();
|
||||||
var dialog = p4.Dialog.get(1);
|
var dialog = p4.Dialog.get(1);
|
||||||
dialog.load('/prod/bridge/manager/', 'POST', options);
|
dialog.load(url, 'POST', options);
|
||||||
}
|
}
|
||||||
|
|
||||||
function init_publicator(datas) {
|
function init_publicator(url, datas) {
|
||||||
var dialog = p4.Dialog.Create({
|
var dialog = p4.Dialog.Create({
|
||||||
size: 'Full',
|
size: 'Full',
|
||||||
title: 'Bridge',
|
title: 'Bridge',
|
||||||
loading: false
|
loading: false
|
||||||
});
|
});
|
||||||
|
|
||||||
dialog.load('/prod/bridge/manager/', 'POST', datas);
|
dialog.load(url, 'POST', datas);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user