diff --git a/lib/Alchemy/Phrasea/Controller/Admin/Root.php b/lib/Alchemy/Phrasea/Controller/Admin/Root.php
index 45c2acd2c7..5a73d7531f 100644
--- a/lib/Alchemy/Phrasea/Controller/Admin/Root.php
+++ b/lib/Alchemy/Phrasea/Controller/Admin/Root.php
@@ -240,9 +240,9 @@ class Root implements ControllerProviderInterface
$databox = $app['phraseanet.appbox']->get_databox($databox_id);
$databox->saveStructure($domst);
- return $app->redirectPath('database_display_stucture', array('sbas_id' => $databox_id, 'success' => 1));
+ return $app->redirectPath('database_display_stucture', array('databox_id' => $databox_id, 'success' => 1));
} else {
- return $app->redirectPath('database_display_stucture', array('sbas_id' => $databox_id, 'success' => 0, 'error' => 'struct'));
+ return $app->redirectPath('database_display_stucture', array('databox_id' => $databox_id, 'success' => 0, 'error' => 'struct'));
}
})->assert('databox_id', '\d+')
->bind('database_submit_stucture');
@@ -326,7 +326,9 @@ class Root implements ControllerProviderInterface
'printable' => $request->request->get('printable') ? '1' : '0',
'name' => $request->request->get('name', ''),
'labelon' => $request->request->get('label_on', ''),
- 'labeloff' => $request->request->get('label_off', '')
+ 'labeloff' => $request->request->get('label_off', ''),
+ 'labels_on' => $request->request->get('labels_on', array()),
+ 'labels_off' => $request->request->get('labels_off', array()),
);
\databox_status::updateStatus($app, $databox_id, $bit, $properties);
@@ -423,7 +425,7 @@ class Root implements ControllerProviderInterface
}
}
- return $app->redirectPath('database_display_stucture', array('sbas_id' => $databox_id, 'success' => 1));
+ return $app->redirectPath('database_display_statusbit', array('databox_id' => $databox_id, 'success' => 1));
})->assert('databox_id', '\d+')
->assert('bit', '\d+')
->bind('database_submit_statusbit');
diff --git a/lib/Alchemy/Phrasea/Controller/Prod/Edit.php b/lib/Alchemy/Phrasea/Controller/Prod/Edit.php
index 3400ef4622..ff4673ce38 100644
--- a/lib/Alchemy/Phrasea/Controller/Prod/Edit.php
+++ b/lib/Alchemy/Phrasea/Controller/Prod/Edit.php
@@ -125,8 +125,8 @@ class Edit implements ControllerProviderInterface
if (isset($dbstatus[$databox->get_sbas_id()])) {
foreach ($dbstatus[$databox->get_sbas_id()] as $n => $statbit) {
$status[$n] = array();
- $status[$n]['label0'] = $statbit['labeloff'];
- $status[$n]['label1'] = $statbit['labelon'];
+ $status[$n]['label0'] = $statbit['labels_off_i18n'][$app['locale.I18n']];
+ $status[$n]['label1'] = $statbit['labels_on_i18n'][$app['locale.I18n']];
$status[$n]['img_off'] = $statbit['img_off'];
$status[$n]['img_on'] = $statbit['img_on'];
$status[$n]['_value'] = 0;
diff --git a/lib/Alchemy/Phrasea/Helper/User/Edit.php b/lib/Alchemy/Phrasea/Helper/User/Edit.php
index 673fbc1dc1..486ce8ac1e 100644
--- a/lib/Alchemy/Phrasea/Helper/User/Edit.php
+++ b/lib/Alchemy/Phrasea/Helper/User/Edit.php
@@ -259,11 +259,11 @@ class Edit extends \Alchemy\Phrasea\Helper\Helper
foreach ($status as $bit => $datas) {
$tbits_left[$bit]["nset"] = 0;
- $tbits_left[$bit]["name"] = $datas["labeloff"];
+ $tbits_left[$bit]["name"] = $datas['labels_off_i18n'][$this->app['locale.I18n']];
$tbits_left[$bit]["icon"] = $datas["img_off"];
$tbits_right[$bit]["nset"] = 0;
- $tbits_right[$bit]["name"] = $datas["labelon"];
+ $tbits_right[$bit]["name"] = $datas['labels_on_i18n'][$this->app['locale.I18n']];
$tbits_right[$bit]["icon"] = $datas["img_on"];
}
diff --git a/lib/classes/API/V1/adapter.php b/lib/classes/API/V1/adapter.php
index 87bdae0ebc..2e55214895 100644
--- a/lib/classes/API/V1/adapter.php
+++ b/lib/classes/API/V1/adapter.php
@@ -2053,6 +2053,12 @@ class API_V1_adapter extends API_V1_Abstract
'bit' => $n,
'label_on' => $datas['labelon'],
'label_off' => $datas['labeloff'],
+ 'labels' => array(
+ 'en' => $datas['labels_on_i18n']['en'],
+ 'fr' => $datas['labels_on_i18n']['fr'],
+ 'de' => $datas['labels_on_i18n']['de'],
+ 'nl' => $datas['labels_on_i18n']['nl'],
+ ),
'img_on' => $datas['img_on'],
'img_off' => $datas['img_off'],
'searchable' => !!$datas['searchable'],
diff --git a/lib/classes/databox/status.php b/lib/classes/databox/status.php
index e4bfa0d48b..953c966b45 100644
--- a/lib/classes/databox/status.php
+++ b/lib/classes/databox/status.php
@@ -86,6 +86,20 @@ class databox_status
$this->status[$bit]["labeloff"] = (string) $sb['labelOff'];
$this->status[$bit]["labelon"] = (string) $sb['labelOn'];
+ foreach ($app['locales.I18n.available'] as $code => $language){
+ $this->status[$bit]['labels_on'][$code] = null;
+ $this->status[$bit]['labels_off'][$code] = null;
+ }
+
+ foreach ($sb->label as $label) {
+ $this->status[$bit]['labels_'.$label['switch']][(string) $label['code']] = (string) $label;
+ }
+
+ foreach ($app['locales.I18n.available'] as $code => $language){
+ $this->status[$bit]['labels_on_i18n'][$code] = isset($this->status[$bit]['labels_on'][$code]) ? $this->status[$bit]['labels_on'][$code] : $this->status[$bit]["labelon"];
+ $this->status[$bit]['labels_off_i18n'][$code] = isset($this->status[$bit]['labels_off'][$code]) ? $this->status[$bit]['labels_off'][$code] : $this->status[$bit]["labeloff"];
+ }
+
$this->status[$bit]["img_off"] = null;
$this->status[$bit]["img_on"] = null;
@@ -189,11 +203,13 @@ class databox_status
}
if (! $set) {
$stats[$bit][] = array(
- 'sbas' => array($sbas_id),
- 'labeloff' => $props['labeloff'],
- 'labelon' => $props['labelon'],
- 'imgoff' => $props['img_off'],
- 'imgon' => $props['img_on']
+ 'sbas' => array($sbas_id),
+ 'labeloff' => $props['labeloff'],
+ 'labelon' => $props['labelon'],
+ 'labels_on_i18n' => $props['labels_on_i18n'],
+ 'labels_off_i18n' => $props['labels_off_i18n'],
+ 'imgoff' => $props['img_off'],
+ 'imgon' => $props['img_on']
);
$set = true;
}
@@ -202,11 +218,13 @@ class databox_status
if (! $set) {
$stats[$bit] = array(
array(
- 'sbas' => array($sbas_id),
- 'labeloff' => $props['labeloff'],
- 'labelon' => $props['labelon'],
- 'imgoff' => $props['img_off'],
- 'imgon' => $props['img_on']
+ 'sbas' => array($sbas_id),
+ 'labeloff' => $props['labeloff'],
+ 'labelon' => $props['labelon'],
+ 'labels_on_i18n' => $props['labels_on_i18n'],
+ 'labels_off_i18n' => $props['labels_off_i18n'],
+ 'imgoff' => $props['img_off'],
+ 'imgon' => $props['img_on']
)
);
}
@@ -309,6 +327,10 @@ class databox_status
$sbit = $statbits->appendChild($doc->createElement("bit"));
+ if ($n = $sbit->appendChild($doc->createAttribute("n"))) {
+ $n->value = $bit;
+ }
+
if ($labOn = $sbit->appendChild($doc->createAttribute("labelOn"))) {
$labOn->value = $properties['labelon'];
}
@@ -324,6 +346,24 @@ class databox_status
if ($labOff = $sbit->appendChild($doc->createAttribute("labelOff"))) {
$labOff->value = $properties['labeloff'];
}
+
+ foreach ($properties['labels_off'] as $code => $label) {
+ $labelTag = $sbit->appendChild($doc->createElement("label"));
+ $switch = $labelTag->appendChild($doc->createAttribute("switch"));
+ $switch->value = 'off';
+ $codeTag = $labelTag->appendChild($doc->createAttribute("code"));
+ $codeTag->value = $code;
+ $labelTag->appendChild($doc->createTextNode($label));
+ }
+
+ foreach ($properties['labels_on'] as $code => $label) {
+ $labelTag = $sbit->appendChild($doc->createElement("label"));
+ $switch = $labelTag->appendChild($doc->createAttribute("switch"));
+ $switch->value = 'on';
+ $codeTag = $labelTag->appendChild($doc->createAttribute("code"));
+ $codeTag->value = $code;
+ $labelTag->appendChild($doc->createTextNode($label));
+ }
}
$databox->saveStructure($doc);
diff --git a/lib/classes/record/adapter.php b/lib/classes/record/adapter.php
index 660507d2d8..2cba1076f6 100644
--- a/lib/classes/record/adapter.php
+++ b/lib/classes/record/adapter.php
@@ -430,11 +430,11 @@ class record_adapter implements record_Interface, cache_cacheableInterface
$status .= 'base_id . '_'
. $this->record_id . '_' . $n . '_1" ' .
- 'src="' . $source1 . '" title="' . $statbit["labelon"] . '"/>';
+ 'src="' . $source1 . '" title="' . $statbit['labels_on_i18n'][$this->app['locale.I18n']] . '"/>';
$status .= '
base_id . '_'
. $this->record_id . '_' . $n . '_0" ' .
- 'src="' . $source0 . '" title="' . $statbit["labeloff"] . '"/>';
+ 'src="' . $source0 . '" title="' . $statbit['labels_off_i18n'][$this->app['locale.I18n']] . '"/>';
}
}
diff --git a/templates/web/admin/statusbit.html.twig b/templates/web/admin/statusbit.html.twig
index 2516f5c120..08e741bb40 100644
--- a/templates/web/admin/statusbit.html.twig
+++ b/templates/web/admin/statusbit.html.twig
@@ -42,14 +42,14 @@
{% set statusbit = attribute(status, bit) %}