mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-19 16:03:14 +00:00
PHRAS-2563_subdef-task-alldb_4.1
subdef task : if the "all" databox is checked, the task runs on every dbox (even the new ones) also : changed the task-manager notification timeout to 1s to be more responsive.
This commit is contained in:
@@ -43,7 +43,7 @@ class SubdefsEditor extends AbstractEditor
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<tasksettings>
|
<tasksettings>
|
||||||
<embedded>1</embedded>
|
<embedded>1</embedded>
|
||||||
<sbas/>
|
<sbas>0</sbas>
|
||||||
<type_image>1</type_image>
|
<type_image>1</type_image>
|
||||||
<type_video>1</type_video>
|
<type_video>1</type_video>
|
||||||
<type_audio>1</type_audio>
|
<type_audio>1</type_audio>
|
||||||
|
@@ -70,12 +70,13 @@ class SubdefsJob extends AbstractJob
|
|||||||
|
|
||||||
$app->getApplicationBox()->get_connection();
|
$app->getApplicationBox()->get_connection();
|
||||||
|
|
||||||
|
$allDb = count($settings->xpath('sbas[text()="0"]')) > 0;
|
||||||
foreach ($app->getDataboxes() as $databox) {
|
foreach ($app->getDataboxes() as $databox) {
|
||||||
if (!$this->isStarted()) {
|
if (!$this->isStarted()) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(count($settings->xpath("sbas[text()=".$databox->get_sbas_id() ."]")) == 0) {
|
if(!$allDb && count($settings->xpath("sbas[text()=".$databox->get_sbas_id() ."]")) == 0) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -25,7 +25,7 @@ class Notifier implements NotifierInterface
|
|||||||
private $logger;
|
private $logger;
|
||||||
|
|
||||||
/** @var integer */
|
/** @var integer */
|
||||||
private $timeout = 10;
|
private $timeout = 1;
|
||||||
|
|
||||||
public function __construct(\ZMQSocket $socket, LoggerInterface $logger)
|
public function __construct(\ZMQSocket $socket, LoggerInterface $logger)
|
||||||
{
|
{
|
||||||
|
@@ -4,9 +4,12 @@
|
|||||||
<div class="control-group">
|
<div class="control-group">
|
||||||
<label class="control-label"> {{ 'Databox' | trans }}</label>
|
<label class="control-label"> {{ 'Databox' | trans }}</label>
|
||||||
<div class="controls">
|
<div class="controls">
|
||||||
|
<label class="checkbox inline">
|
||||||
|
<input class="subdef_task_sbas" type="checkbox" name="sbas[]" value="0"> {{ 'All' | trans }}
|
||||||
|
</label>
|
||||||
{% for databox in app.getApplicationBox().get_databoxes() %}
|
{% for databox in app.getApplicationBox().get_databoxes() %}
|
||||||
<label class="checkbox inline">
|
<label class="checkbox inline">
|
||||||
<input type="checkbox" name="sbas[]" value="{{ databox.get_sbas_id() }}"> {{ databox.get_viewname() }}
|
<input class="subdef_task_sbas" type="checkbox" name="sbas[]" value="{{ databox.get_sbas_id() }}"> {{ databox.get_viewname() }}
|
||||||
({{ databox.get_sbas_id() }})
|
({{ databox.get_sbas_id() }})
|
||||||
</label>
|
</label>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
@@ -68,6 +71,10 @@
|
|||||||
{% block javascript %}
|
{% block javascript %}
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
|
|
||||||
|
$(".subdef_task_sbas").change(function (e) {
|
||||||
|
checkSbas();
|
||||||
|
});
|
||||||
|
|
||||||
function minmax(v, _min, _max)
|
function minmax(v, _min, _max)
|
||||||
{
|
{
|
||||||
if(isNaN(v) || v < _min)
|
if(isNaN(v) || v < _min)
|
||||||
@@ -80,6 +87,16 @@
|
|||||||
}
|
}
|
||||||
return v;
|
return v;
|
||||||
}
|
}
|
||||||
|
function checkSbas()
|
||||||
|
{
|
||||||
|
var alldb = $(".subdef_task_sbas[value=0]").prop('checked');
|
||||||
|
if(alldb) {
|
||||||
|
$(".subdef_task_sbas[value!=0]").prop('checked', true).attr('disabled', true);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$(".subdef_task_sbas[value!=0]").attr('disabled', false);
|
||||||
|
}
|
||||||
|
}
|
||||||
function taskFillGraphic(xml)
|
function taskFillGraphic(xml)
|
||||||
{
|
{
|
||||||
if (xml) {
|
if (xml) {
|
||||||
@@ -98,12 +115,14 @@
|
|||||||
gform.flush.value = minmax(parseInt(xml.find("flush").text()), 1, 100);
|
gform.flush.value = minmax(parseInt(xml.find("flush").text()), 1, 100);
|
||||||
gform.maxrecs.value = minmax(parseInt(xml.find("maxrecs").text()), 10, 100);
|
gform.maxrecs.value = minmax(parseInt(xml.find("maxrecs").text()), 10, 100);
|
||||||
gform.maxmegs.value = minmax(parseInt(xml.find("maxmegs").text()), 64, 512);
|
gform.maxmegs.value = minmax(parseInt(xml.find("maxmegs").text()), 64, 512);
|
||||||
|
|
||||||
var $databoxes = $(gform).find("input[name='sbas[]']");
|
var $databoxes = $(gform).find("input[name='sbas[]']");
|
||||||
for(i=0; i < $databoxes.length; i++) {
|
for(i=0; i < $databoxes.length; i++) {
|
||||||
var sbid = $($databoxes[i]).attr('value');
|
var sbid = $($databoxes[i]).attr('value');
|
||||||
|
|
||||||
$($databoxes[i]).prop('checked', (xml.find("sbas").filter(function(){return $(this).text()==sbid}).length > 0));
|
$($databoxes[i]).prop('checked', (xml.find("sbas").filter(function(){return $(this).text()==sbid}).length > 0));
|
||||||
}
|
}
|
||||||
|
checkSbas();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
Reference in New Issue
Block a user