mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-13 13:03:20 +00:00
fix #728 check if thumbExtractor is supported
remove fileReader its not needed fix unit tests fix typo remove unecessary message
This commit is contained in:
@@ -17,6 +17,8 @@ use Doctrine\ORM\EntityManager;
|
|||||||
use Entities\LazaretAttribute;
|
use Entities\LazaretAttribute;
|
||||||
use Entities\LazaretFile;
|
use Entities\LazaretFile;
|
||||||
use Entities\LazaretSession;
|
use Entities\LazaretSession;
|
||||||
|
use MediaAlchemyst\Exception\Exception as MediaAlchemystException;
|
||||||
|
use MediaAlchemyst\Specification\Image as ImageSpec;
|
||||||
use Monolog\Logger;
|
use Monolog\Logger;
|
||||||
use PHPExiftool\Driver\Metadata\Metadata;
|
use PHPExiftool\Driver\Metadata\Metadata;
|
||||||
use PHPExiftool\Driver\Value\Mono as MonoValue;
|
use PHPExiftool\Driver\Value\Mono as MonoValue;
|
||||||
@@ -398,9 +400,9 @@ class Manager
|
|||||||
|
|
||||||
$this->filesystem->copy($file->getFile()->getRealPath(), $lazaretPathname, true);
|
$this->filesystem->copy($file->getFile()->getRealPath(), $lazaretPathname, true);
|
||||||
|
|
||||||
$spec = new \MediaAlchemyst\Specification\Image();
|
$spec = new ImageSpec();
|
||||||
|
|
||||||
$spec->setResizeMode(\MediaAlchemyst\Specification\Image::RESIZE_MODE_INBOUND_FIXEDRATIO);
|
$spec->setResizeMode(ImageSpec::RESIZE_MODE_INBOUND_FIXEDRATIO);
|
||||||
$spec->setDimensions(375, 275);
|
$spec->setDimensions(375, 275);
|
||||||
|
|
||||||
$core = \bootstrap::getCore();
|
$core = \bootstrap::getCore();
|
||||||
@@ -410,7 +412,7 @@ class Manager
|
|||||||
->open($file->getFile()->getPathname())
|
->open($file->getFile()->getPathname())
|
||||||
->turnInto($lazaretPathname, $spec)
|
->turnInto($lazaretPathname, $spec)
|
||||||
->close();
|
->close();
|
||||||
} catch (\MediaAlchemyst\Exception\Exception $e) {
|
} catch (MediaAlchemystException $e) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -98,6 +98,7 @@ class Language implements ControllerProviderInterface
|
|||||||
$out['errorAjaxRequest'] = _('An error occured, please retry');
|
$out['errorAjaxRequest'] = _('An error occured, please retry');
|
||||||
$out['fileBeingDownloaded'] = _('Some files are being downloaded');
|
$out['fileBeingDownloaded'] = _('Some files are being downloaded');
|
||||||
$out['warning'] = _('Attention');
|
$out['warning'] = _('Attention');
|
||||||
|
$out['browserFeatureSupport'] = _('This feature is not supported by your browser');
|
||||||
|
|
||||||
$Serializer = $app['Core']['Serializer'];
|
$Serializer = $app['Core']['Serializer'];
|
||||||
|
|
||||||
|
@@ -438,7 +438,7 @@ class media_subdef extends media_abstract implements cache_cacheableInterface
|
|||||||
*/
|
*/
|
||||||
public function get_size()
|
public function get_size()
|
||||||
{
|
{
|
||||||
return @filesize($this->get_pathfile());
|
return (int) @filesize($this->get_pathfile());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@@ -374,22 +374,23 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
$(document).ready(function(){
|
|
||||||
|
$(document).ready(function(){
|
||||||
var scope = $("#prod-tool-box");
|
var scope = $("#prod-tool-box");
|
||||||
var width = 0;
|
var width = 0;
|
||||||
|
|
||||||
$("#tool-tabs", scope).tabs();
|
$("#tool-tabs", scope).tabs();
|
||||||
|
|
||||||
$(".iframe_submiter", scope).bind("click", function(){
|
$(".iframe_submiter", scope).bind("click", function(){
|
||||||
var form = $(this).closest("form");
|
var form = $(this).closest("form");
|
||||||
form.submit();
|
form.submit();
|
||||||
form.find('.load').empty().html(language.loading + ' ...');
|
form.find('.load').empty().html(language.loading + ' ...');
|
||||||
$("#uploadHdsub").contents().find(".content").empty();
|
$("#uploadHdsub").contents().find(".content").empty();
|
||||||
$("#uploadHdsub").load(function(){
|
$("#uploadHdsub").load(function(){
|
||||||
form.find('.load').empty();
|
form.find('.load').empty();
|
||||||
var iframeContent = $("#uploadHdsub").contents().find(".content").html();
|
var iframeContent = $("#uploadHdsub").contents().find(".content").html();
|
||||||
form.closest('div').find('.resultAction').empty().append(iframeContent);
|
form.closest('div').find('.resultAction').empty().append(iframeContent);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
$(".action_submiter", scope).bind("click", function(){
|
$(".action_submiter", scope).bind("click", function(){
|
||||||
@@ -419,276 +420,281 @@
|
|||||||
});
|
});
|
||||||
|
|
||||||
$(".action_cancel", scope).bind("click", function(){
|
$(".action_cancel", scope).bind("click", function(){
|
||||||
var dialog = p4.Dialog.get(1);
|
var dialog = p4.Dialog.get(1);
|
||||||
dialog.Close();
|
dialog.Close();
|
||||||
});
|
});
|
||||||
|
|
||||||
//thumbExtractor
|
//thumbExtractor
|
||||||
|
|
||||||
$("#slider-brightness", scope).slider({
|
|
||||||
slide: function() {
|
|
||||||
$("#value-brightness").val(Math.round($("#slider-brightness").slider("value") / 100 * 300) - 150);
|
|
||||||
}
|
|
||||||
}).slider( "option", "value", 50);
|
|
||||||
|
|
||||||
$("#slider-contrast").slider({
|
|
||||||
slide: function() {
|
|
||||||
$("#value-contrast").val(
|
|
||||||
(
|
|
||||||
(
|
|
||||||
$("#slider-contrast").slider("value") / 100 * 4
|
|
||||||
)
|
|
||||||
-1
|
|
||||||
).toFixed(1));
|
|
||||||
}
|
|
||||||
}).slider( "option", "value", 1/3*100);
|
|
||||||
|
|
||||||
var sliderWrapper = $("#thumb_wrapper", scope);
|
|
||||||
|
|
||||||
var ThumbEditor = new this.THUMB_EDITOR("thumb_video", "thumb_canvas");
|
var ThumbEditor = new this.THUMB_EDITOR("thumb_video", "thumb_canvas");
|
||||||
|
|
||||||
$("#thumb_reset_button",scope).bind("click", function(){
|
if(ThumbEditor.isSupported()) {
|
||||||
var curImg = sliderWrapper.find(".selected");
|
$("#slider-brightness", scope).slider({
|
||||||
var id = curImg.attr("id").split("_").pop();
|
slide: function() {
|
||||||
var originalScreenShot = ThumbEditor.store.get(id);
|
$("#value-brightness").val(Math.round($("#slider-brightness").slider("value") / 100 * 300) - 150);
|
||||||
var newImg = $("<img />");
|
}
|
||||||
|
}).slider( "option", "value", 50);
|
||||||
|
|
||||||
curImg.after(newImg).remove();
|
$("#slider-contrast").slider({
|
||||||
|
slide: function() {
|
||||||
|
$("#value-contrast").val(
|
||||||
|
(
|
||||||
|
(
|
||||||
|
$("#slider-contrast").slider("value") / 100 * 4
|
||||||
|
)
|
||||||
|
-1
|
||||||
|
).toFixed(1));
|
||||||
|
}
|
||||||
|
}).slider( "option", "value", 1/3*100);
|
||||||
|
|
||||||
newImg
|
var sliderWrapper = $("#thumb_wrapper", scope);
|
||||||
.attr("id", "#working_"+ id)
|
|
||||||
.attr("src", originalScreenShot.getDataURI())
|
|
||||||
.trigger("click");
|
|
||||||
});
|
|
||||||
|
|
||||||
$("#thumb_delete_button", scope).bind("click", function(){
|
$("#thumb_reset_button",scope).bind("click", function(){
|
||||||
var img = sliderWrapper.find(".selected");
|
var curImg = sliderWrapper.find(".selected");
|
||||||
var id = img.attr("id").split("_").pop();
|
var id = curImg.attr("id").split("_").pop();
|
||||||
var previous = img.prev();
|
var originalScreenShot = ThumbEditor.store.get(id);
|
||||||
var next = img.next();
|
var newImg = $("<img />");
|
||||||
|
|
||||||
if(previous.length > 0)
|
curImg.after(newImg).remove();
|
||||||
{
|
|
||||||
previous.trigger("click");
|
|
||||||
}
|
|
||||||
else if(next.length > 0)
|
|
||||||
{
|
|
||||||
next.trigger("click");
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$(this).hide();
|
|
||||||
$("#thumb_reset_button",scope).hide();
|
|
||||||
$("#thumb_info", scope).show();
|
|
||||||
ThumbEditor.resetCanva();
|
|
||||||
}
|
|
||||||
|
|
||||||
img.remove();
|
newImg
|
||||||
ThumbEditor.store.remove(id);
|
.attr("id", "#working_"+ id)
|
||||||
});
|
.attr("src", originalScreenShot.getDataURI())
|
||||||
|
.trigger("click");
|
||||||
|
});
|
||||||
|
|
||||||
$(".close_action_frame", scope).bind("click", function(){
|
$("#thumb_delete_button", scope).bind("click", function(){
|
||||||
$(this).closest(".action_frame").hide();
|
var img = sliderWrapper.find(".selected");
|
||||||
});
|
var id = img.attr("id").split("_").pop();
|
||||||
|
var previous = img.prev();
|
||||||
|
var next = img.next();
|
||||||
|
|
||||||
$("#flipV", scope).bind("click", function(){
|
if(previous.length > 0)
|
||||||
Pixastic.process($("#thumb_canvas").get(0),
|
|
||||||
"flipv",
|
|
||||||
null,
|
|
||||||
function(canvas){$("#thumb_canvas").trigger("tool_event");}
|
|
||||||
);
|
|
||||||
});
|
|
||||||
|
|
||||||
$("#flipH", scope).bind("click", function(){
|
|
||||||
Pixastic.process($("#thumb_canvas").get(0),
|
|
||||||
"fliph",
|
|
||||||
null, function(canvas){$("#thumb_canvas").trigger("tool_event");}
|
|
||||||
);
|
|
||||||
});
|
|
||||||
|
|
||||||
$("#brightness", scope).bind("click", function(){
|
|
||||||
$("#action_frame_brightness", scope).show();
|
|
||||||
$("#action_frame_contrast", scope).hide();
|
|
||||||
});
|
|
||||||
|
|
||||||
$("#contrast", scope).bind("click", function(){
|
|
||||||
$("#action_frame_brightness", scope).hide();
|
|
||||||
$("#action_frame_contrast", scope).show();
|
|
||||||
});
|
|
||||||
|
|
||||||
$(".apply-brightness", scope).bind("click", function(){
|
|
||||||
Pixastic.process($("#thumb_canvas").get(0), "brightness", {
|
|
||||||
brightness: $("#value-brightness").val(),
|
|
||||||
contrast: $("#value-contrast").val(),
|
|
||||||
legacy: false
|
|
||||||
}, null, function(canvas){$("#thumb_canvas").trigger("tool_event");});
|
|
||||||
});
|
|
||||||
|
|
||||||
$(".apply-contrast").bind("click", function(){
|
|
||||||
Pixastic.process($("#thumb_canvas").get(0), "brightness", {
|
|
||||||
brightness: $("#value-brightness").val(),
|
|
||||||
contrast: $("#value-contrast").val(),
|
|
||||||
legacy: false
|
|
||||||
}, null, function(canvas){$("#thumb_canvas").trigger("tool_event");});
|
|
||||||
});
|
|
||||||
|
|
||||||
$("img", sliderWrapper).live("click", function(){
|
|
||||||
$('.selected', sliderWrapper).removeClass('selected');
|
|
||||||
$(this).addClass('selected');
|
|
||||||
|
|
||||||
ThumbEditor.copy($(this).get(0));
|
|
||||||
});
|
|
||||||
|
|
||||||
$("#thumb_camera_button", scope).bind("click", function(){
|
|
||||||
$("#thumb_info", scope).hide();
|
|
||||||
$("#thumb_delete_button", scope).show();
|
|
||||||
$("#thumb_reset_button",scope).show();
|
|
||||||
|
|
||||||
var screenshot = ThumbEditor.screenshot();
|
|
||||||
var img = $("<img />");
|
|
||||||
$('.selected', sliderWrapper).removeClass('selected');
|
|
||||||
img.addClass('selected')
|
|
||||||
.attr('id', 'working_'+ screenshot.getId())
|
|
||||||
.attr('src', screenshot.getDataURI())
|
|
||||||
.attr("alt", screenshot.getVideoTime())
|
|
||||||
.appendTo(sliderWrapper);
|
|
||||||
});
|
|
||||||
|
|
||||||
$("#thumb_canvas").live('tool_event', function(){
|
|
||||||
var thumbnail = $('.selected', sliderWrapper);
|
|
||||||
|
|
||||||
if(thumbnail.length === 0)
|
|
||||||
{
|
|
||||||
console.error('No image selected');
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
thumbnail.attr('src', ThumbEditor.getCanvaImage());
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
$("#thumb_validate_button", scope).bind("click", function(){
|
|
||||||
|
|
||||||
var thumbnail = $('.selected', sliderWrapper);
|
|
||||||
|
|
||||||
if(thumbnail.length === 0)
|
|
||||||
{
|
|
||||||
var dialog = p4.Dialog.Create({
|
|
||||||
size:'Alert',
|
|
||||||
title: '{% trans "alert" %}',
|
|
||||||
closeOnEscape:true
|
|
||||||
}, 3);
|
|
||||||
|
|
||||||
var content = $("<div />").css({
|
|
||||||
'text-align':'center',
|
|
||||||
'width': '100%',
|
|
||||||
'font-size':'14px'
|
|
||||||
}).append('{% trans "no image selected" %}');
|
|
||||||
dialog.setContent(content);
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
var buttons = {};
|
|
||||||
|
|
||||||
var record_id = $("input[name=record_id]").val();
|
|
||||||
var sbas_id = $("input[name=sbas_id]").val();
|
|
||||||
|
|
||||||
|
|
||||||
function disableConfirmButton(dialog){
|
|
||||||
dialog.getDomElement().closest('.ui-dialog').find(".ui-dialog-buttonpane button").filter(function() {
|
|
||||||
return $(this).text() == language.valider;
|
|
||||||
}).addClass("ui-state-disabled").attr("disabled", true);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
function enableConfirmButton(dialog){
|
|
||||||
dialog.getDomElement().closest('.ui-dialog').find(".ui-dialog-buttonpane button").filter(function() {
|
|
||||||
return $(this).text() == language.valider;
|
|
||||||
}).removeClass("ui-state-disabled").attr("disabled", false);
|
|
||||||
}
|
|
||||||
|
|
||||||
buttons[language.valider] = function(){
|
|
||||||
var dialog = p4.Dialog.get(2);
|
|
||||||
var buttonPanel = dialog.getDomElement().closest('.ui-dialog').find(".ui-dialog-buttonpane");
|
|
||||||
var loadingDiv = buttonPanel.find('.info-div');
|
|
||||||
|
|
||||||
if(loadingDiv.length == 0)
|
|
||||||
{
|
|
||||||
loadingDiv = $("<div />").css({
|
|
||||||
'width' : '120px',
|
|
||||||
'height' : '40px',
|
|
||||||
'float':'left',
|
|
||||||
'line-height' : '40px',
|
|
||||||
'padding-left' : '40px',
|
|
||||||
'text-align' : 'left',
|
|
||||||
'background-position' : 'left center'
|
|
||||||
}).attr('class', 'info-div').prependTo(buttonPanel);
|
|
||||||
}
|
|
||||||
|
|
||||||
$.ajax({
|
|
||||||
type: "POST",
|
|
||||||
url: "/prod/tools/thumb-extractor/apply/",
|
|
||||||
data: {
|
|
||||||
image: $("#thumb_confirm img.selected").attr('src'),
|
|
||||||
record_id : record_id,
|
|
||||||
sbas_id: sbas_id
|
|
||||||
},
|
|
||||||
beforeSend: function(){
|
|
||||||
disableConfirmButton(dialog);
|
|
||||||
loadingDiv.empty().addClass('loading').append('{% trans "processing" %}');
|
|
||||||
},
|
|
||||||
success: function(data){
|
|
||||||
loadingDiv.empty().removeClass('loading');
|
|
||||||
|
|
||||||
if(data.success)
|
|
||||||
{
|
{
|
||||||
dialog.Close();
|
previous.trigger("click");
|
||||||
p4.Dialog.get(1).Close();
|
}
|
||||||
|
else if(next.length > 0)
|
||||||
|
{
|
||||||
|
next.trigger("click");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
var content = $("<div />").css({'color':'#a00'}).append("{% trans "an error occured" %} " + data.message);
|
$(this).hide();
|
||||||
loadingDiv.append(content);
|
$("#thumb_reset_button",scope).hide();
|
||||||
enableConfirmButton(dialog);
|
$("#thumb_info", scope).show();
|
||||||
|
ThumbEditor.resetCanva();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
img.remove();
|
||||||
|
ThumbEditor.store.remove(id);
|
||||||
});
|
});
|
||||||
};
|
|
||||||
|
|
||||||
//show confirm box, content is loaded here /prod/tools/thumb-extractor/confirm-box/
|
$(".close_action_frame", scope).bind("click", function(){
|
||||||
var dialog = p4.Dialog.Create({
|
$(this).closest(".action_frame").hide();
|
||||||
size:'Small',
|
});
|
||||||
title:"{% trans 'thumbnail validation' %}",
|
|
||||||
cancelButton:true,
|
|
||||||
buttons: buttons
|
|
||||||
}, 2);
|
|
||||||
|
|
||||||
var datas = {
|
$("#flipV", scope).bind("click", function(){
|
||||||
image: $('.selected', sliderWrapper).attr("src"),
|
Pixastic.process($("#thumb_canvas").get(0),
|
||||||
sbas_id: sbas_id,
|
"flipv",
|
||||||
record_id: record_id
|
null,
|
||||||
};
|
function(canvas){$("#thumb_canvas").trigger("tool_event");}
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
$.ajax({
|
$("#flipH", scope).bind("click", function(){
|
||||||
type: "POST",
|
Pixastic.process($("#thumb_canvas").get(0),
|
||||||
url: "/prod/tools/thumb-extractor/confirm-box/",
|
"fliph",
|
||||||
data: datas,
|
null, function(canvas){$("#thumb_canvas").trigger("tool_event");}
|
||||||
success: function(data){
|
);
|
||||||
|
});
|
||||||
|
|
||||||
if(data.error)
|
$("#brightness", scope).bind("click", function(){
|
||||||
{
|
$("#action_frame_brightness", scope).show();
|
||||||
var content = $("<div />").css({'font-size':'16px', 'text-align':'center'}).append(data.datas);
|
$("#action_frame_contrast", scope).hide();
|
||||||
dialog.setContent(content);
|
});
|
||||||
disableConfirmButton(dialog);
|
|
||||||
}
|
$("#contrast", scope).bind("click", function(){
|
||||||
else
|
$("#action_frame_brightness", scope).hide();
|
||||||
{
|
$("#action_frame_contrast", scope).show();
|
||||||
dialog.setContent(data.datas);
|
});
|
||||||
}
|
|
||||||
}
|
$(".apply-brightness", scope).bind("click", function(){
|
||||||
});
|
Pixastic.process($("#thumb_canvas").get(0), "brightness", {
|
||||||
});
|
brightness: $("#value-brightness").val(),
|
||||||
});
|
contrast: $("#value-contrast").val(),
|
||||||
|
legacy: false
|
||||||
|
}, null, function(canvas){$("#thumb_canvas").trigger("tool_event");});
|
||||||
|
});
|
||||||
|
|
||||||
|
$(".apply-contrast").bind("click", function(){
|
||||||
|
Pixastic.process($("#thumb_canvas").get(0), "brightness", {
|
||||||
|
brightness: $("#value-brightness").val(),
|
||||||
|
contrast: $("#value-contrast").val(),
|
||||||
|
legacy: false
|
||||||
|
}, null, function(canvas){$("#thumb_canvas").trigger("tool_event");});
|
||||||
|
});
|
||||||
|
|
||||||
|
$("img", sliderWrapper).live("click", function(){
|
||||||
|
$('.selected', sliderWrapper).removeClass('selected');
|
||||||
|
$(this).addClass('selected');
|
||||||
|
|
||||||
|
ThumbEditor.copy($(this).get(0));
|
||||||
|
});
|
||||||
|
|
||||||
|
$("#thumb_camera_button", scope).bind("click", function(){
|
||||||
|
$("#thumb_info", scope).hide();
|
||||||
|
$("#thumb_delete_button", scope).show();
|
||||||
|
$("#thumb_reset_button",scope).show();
|
||||||
|
|
||||||
|
var screenshot = ThumbEditor.screenshot();
|
||||||
|
var img = $("<img />");
|
||||||
|
$('.selected', sliderWrapper).removeClass('selected');
|
||||||
|
img.addClass('selected')
|
||||||
|
.attr('id', 'working_'+ screenshot.getId())
|
||||||
|
.attr('src', screenshot.getDataURI())
|
||||||
|
.attr("alt", screenshot.getVideoTime())
|
||||||
|
.appendTo(sliderWrapper);
|
||||||
|
});
|
||||||
|
|
||||||
|
$("#thumb_canvas").live('tool_event', function(){
|
||||||
|
var thumbnail = $('.selected', sliderWrapper);
|
||||||
|
|
||||||
|
if(thumbnail.length === 0)
|
||||||
|
{
|
||||||
|
console.error('No image selected');
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
thumbnail.attr('src', ThumbEditor.getCanvaImage());
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
$("#thumb_validate_button", scope).bind("click", function(){
|
||||||
|
|
||||||
|
var thumbnail = $('.selected', sliderWrapper);
|
||||||
|
|
||||||
|
if(thumbnail.length === 0)
|
||||||
|
{
|
||||||
|
var dialog = p4.Dialog.Create({
|
||||||
|
size:'Alert',
|
||||||
|
title: '{% trans "alert" %}',
|
||||||
|
closeOnEscape:true
|
||||||
|
}, 3);
|
||||||
|
|
||||||
|
var content = $("<div />").css({
|
||||||
|
'text-align':'center',
|
||||||
|
'width': '100%',
|
||||||
|
'font-size':'14px'
|
||||||
|
}).append('{% trans "no image selected" %}');
|
||||||
|
dialog.setContent(content);
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
var buttons = {};
|
||||||
|
|
||||||
|
var record_id = $("input[name=record_id]").val();
|
||||||
|
var sbas_id = $("input[name=sbas_id]").val();
|
||||||
|
|
||||||
|
|
||||||
|
function disableConfirmButton(dialog){
|
||||||
|
dialog.getDomElement().closest('.ui-dialog').find(".ui-dialog-buttonpane button").filter(function() {
|
||||||
|
return $(this).text() == language.valider;
|
||||||
|
}).addClass("ui-state-disabled").attr("disabled", true);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function enableConfirmButton(dialog){
|
||||||
|
dialog.getDomElement().closest('.ui-dialog').find(".ui-dialog-buttonpane button").filter(function() {
|
||||||
|
return $(this).text() == language.valider;
|
||||||
|
}).removeClass("ui-state-disabled").attr("disabled", false);
|
||||||
|
}
|
||||||
|
|
||||||
|
buttons[language.valider] = function(){
|
||||||
|
var dialog = p4.Dialog.get(2);
|
||||||
|
var buttonPanel = dialog.getDomElement().closest('.ui-dialog').find(".ui-dialog-buttonpane");
|
||||||
|
var loadingDiv = buttonPanel.find('.info-div');
|
||||||
|
|
||||||
|
if(loadingDiv.length == 0)
|
||||||
|
{
|
||||||
|
loadingDiv = $("<div />").css({
|
||||||
|
'width' : '120px',
|
||||||
|
'height' : '40px',
|
||||||
|
'float':'left',
|
||||||
|
'line-height' : '40px',
|
||||||
|
'padding-left' : '40px',
|
||||||
|
'text-align' : 'left',
|
||||||
|
'background-position' : 'left center'
|
||||||
|
}).attr('class', 'info-div').prependTo(buttonPanel);
|
||||||
|
}
|
||||||
|
|
||||||
|
$.ajax({
|
||||||
|
type: "POST",
|
||||||
|
url: "/prod/tools/thumb-extractor/apply/",
|
||||||
|
data: {
|
||||||
|
image: $("#thumb_confirm img.selected").attr('src'),
|
||||||
|
record_id : record_id,
|
||||||
|
sbas_id: sbas_id
|
||||||
|
},
|
||||||
|
beforeSend: function(){
|
||||||
|
disableConfirmButton(dialog);
|
||||||
|
loadingDiv.empty().addClass('loading').append('{% trans "processing" %}');
|
||||||
|
},
|
||||||
|
success: function(data){
|
||||||
|
loadingDiv.empty().removeClass('loading');
|
||||||
|
|
||||||
|
if(data.success)
|
||||||
|
{
|
||||||
|
dialog.Close();
|
||||||
|
p4.Dialog.get(1).Close();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
//var content = $("<div />").css({'color':'#a00'}).append("{% trans "an error occured" %} " + data.message);
|
||||||
|
loadingDiv.append(content);
|
||||||
|
enableConfirmButton(dialog);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
//show confirm box, content is loaded here /prod/tools/thumb-extractor/confirm-box/
|
||||||
|
var dialog = p4.Dialog.Create({
|
||||||
|
size:'Small',
|
||||||
|
title:"{% trans 'thumbnail validation' %}",
|
||||||
|
cancelButton:true,
|
||||||
|
buttons: buttons
|
||||||
|
}, 2);
|
||||||
|
|
||||||
|
var datas = {
|
||||||
|
image: $('.selected', sliderWrapper).attr("src"),
|
||||||
|
sbas_id: sbas_id,
|
||||||
|
record_id: record_id
|
||||||
|
};
|
||||||
|
|
||||||
|
$.ajax({
|
||||||
|
type: "POST",
|
||||||
|
url: "/prod/tools/thumb-extractor/confirm-box/",
|
||||||
|
data: datas,
|
||||||
|
success: function(data){
|
||||||
|
|
||||||
|
if(data.error)
|
||||||
|
{
|
||||||
|
var content = $("<div />").css({'font-size':'16px', 'text-align':'center'}).append(data.datas);
|
||||||
|
dialog.setContent(content);
|
||||||
|
disableConfirmButton(dialog);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
dialog.setContent(data.datas);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
//not supported
|
||||||
|
$("#thumbExtractor").empty().append(language.browserFeatureSupport);
|
||||||
|
}
|
||||||
|
});
|
||||||
</script>
|
</script>
|
||||||
|
@@ -28,6 +28,8 @@ class LazaretTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
|
|||||||
$app['debug'] = true;
|
$app['debug'] = true;
|
||||||
unset($app['exception_handler']);
|
unset($app['exception_handler']);
|
||||||
|
|
||||||
|
$app['Core']['file-system'] = $this->getMock('Symfony\Component\Filesystem\Filesystem', array('remove'));
|
||||||
|
|
||||||
return $app;
|
return $app;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -276,6 +276,10 @@ class API_V1_adapterTest extends PhraseanetPHPUnitAuthenticatedAbstract
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(null === $statusbit) {
|
||||||
|
$this->markTestSkipped('No status bit defined in databox');
|
||||||
|
}
|
||||||
|
|
||||||
$request = new Request(array("salut" => "salut c'est la fete"), array(), array(), array(), array(), array('HTTP_Accept' => 'application/json'));
|
$request = new Request(array("salut" => "salut c'est la fete"), array(), array(), array(), array(), array('HTTP_Accept' => 'application/json'));
|
||||||
$result = $stub->set_record_status($request, static::$records['record_1']->get_sbas_id(), static::$records['record_1']->get_record_id());
|
$result = $stub->set_record_status($request, static::$records['record_1']->get_sbas_id(), static::$records['record_1']->get_record_id());
|
||||||
$this->assertEquals(400, $result->get_http_code());
|
$this->assertEquals(400, $result->get_http_code());
|
||||||
|
@@ -178,6 +178,11 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
isSupported : function () {
|
||||||
|
var elem = document.createElement('canvas');
|
||||||
|
|
||||||
|
return !! elem.getContext && !! elem.getContext('2d');
|
||||||
|
},
|
||||||
screenshot : function(){
|
screenshot : function(){
|
||||||
var screenshot = new ScreenShot(
|
var screenshot = new ScreenShot(
|
||||||
store.getLength() + 1,
|
store.getLength() + 1,
|
||||||
|
Reference in New Issue
Block a user