mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-10 03:23:19 +00:00
Add labels to databoxes
This commit is contained in:
@@ -532,6 +532,7 @@ class Application extends SilexApplication
|
|||||||
$twig->addFilter('min', new \Twig_Filter_Function('min'));
|
$twig->addFilter('min', new \Twig_Filter_Function('min'));
|
||||||
$twig->addFilter('bas_labels', new \Twig_Filter_Function('phrasea::bas_labels'));
|
$twig->addFilter('bas_labels', new \Twig_Filter_Function('phrasea::bas_labels'));
|
||||||
$twig->addFilter('sbas_names', new \Twig_Filter_Function('phrasea::sbas_names'));
|
$twig->addFilter('sbas_names', new \Twig_Filter_Function('phrasea::sbas_names'));
|
||||||
|
$twig->addFilter('sbas_labels', new \Twig_Filter_Function('phrasea::sbas_labels'));
|
||||||
$twig->addFilter('sbas_from_bas', new \Twig_Filter_Function('phrasea::sbasFromBas'));
|
$twig->addFilter('sbas_from_bas', new \Twig_Filter_Function('phrasea::sbasFromBas'));
|
||||||
$twig->addFilter('key_exists', new \Twig_Filter_Function('array_key_exists'));
|
$twig->addFilter('key_exists', new \Twig_Filter_Function('array_key_exists'));
|
||||||
$twig->addFilter('round', new \Twig_Filter_Function('round'));
|
$twig->addFilter('round', new \Twig_Filter_Function('round'));
|
||||||
|
@@ -116,7 +116,7 @@ class RecordAdd extends Command
|
|||||||
if ($elementCreated instanceof \record_adapter) {
|
if ($elementCreated instanceof \record_adapter) {
|
||||||
$output->writeln(
|
$output->writeln(
|
||||||
sprintf(
|
sprintf(
|
||||||
"Record id <info>%d</info> on collection `%s` (databox `%s`) has been created", $elementCreated->get_record_id(), $elementCreated->get_collection()->get_label($this->container['locale.I18n']), $elementCreated->get_databox()->get_viewname()
|
"Record id <info>%d</info> on collection `%s` (databox `%s`) has been created", $elementCreated->get_record_id(), $elementCreated->get_collection()->get_label($this->container['locale.I18n']), $elementCreated->get_databox()->get_label($this->container['locale.I18n'])
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
$this->container['phraseanet.SE']->addRecord($elementCreated);
|
$this->container['phraseanet.SE']->addRecord($elementCreated);
|
||||||
|
@@ -183,6 +183,12 @@ class Databox implements ControllerProviderInterface
|
|||||||
$app['firewall']->requireRightOnSbas($request->attributes->get('databox_id'), 'bas_modify_struct');
|
$app['firewall']->requireRightOnSbas($request->attributes->get('databox_id'), 'bas_modify_struct');
|
||||||
})->bind('admin_database_display_cgus');
|
})->bind('admin_database_display_cgus');
|
||||||
|
|
||||||
|
$controllers->post('/{databox_id}/labels/', $this->call('setLabels'))
|
||||||
|
->assert('databox_id', '\d+')
|
||||||
|
->before(function(Request $request) use ($app) {
|
||||||
|
$app['firewall']->requireRightOnSbas($request->attributes->get('databox_id'), 'bas_manage');
|
||||||
|
})->bind('admin_databox_labels');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Update database CGU
|
* Update database CGU
|
||||||
*
|
*
|
||||||
@@ -484,6 +490,40 @@ class Databox implements ControllerProviderInterface
|
|||||||
return $app->redirect('/admin/databox/' . $databox->get_sbas_id() . '/?success=' . (int) $success . ($databox->get_record_amount() > 0 ? '&error=databox-not-empty' : ''));
|
return $app->redirect('/admin/databox/' . $databox->get_sbas_id() . '/?success=' . (int) $success . ($databox->get_record_amount() > 0 ? '&error=databox-not-empty' : ''));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function setLabels(Application $app, Request $request, $databox_id)
|
||||||
|
{
|
||||||
|
if (null === $labels = $request->request->get('labels')) {
|
||||||
|
$app->abort(400, _('Missing labels parameter'));
|
||||||
|
}
|
||||||
|
if (false === is_array($labels)) {
|
||||||
|
$app->abort(400, _('Invalid labels parameter'));
|
||||||
|
}
|
||||||
|
|
||||||
|
$databox = $app['phraseanet.appbox']->get_databox($databox_id);
|
||||||
|
$success = true;
|
||||||
|
|
||||||
|
try {
|
||||||
|
foreach ($app['locales.I18n.available'] as $code => $language) {
|
||||||
|
if (!isset($labels[$code])) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
$value = $labels[$code] ?: null;
|
||||||
|
$databox->set_label($code, $value);
|
||||||
|
}
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
$success = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ('json' === $app['request']->getRequestFormat()) {
|
||||||
|
return $app->json(array(
|
||||||
|
'success' => $success,
|
||||||
|
'msg' => $success ? _('Successful update') : _('An error occured')
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
|
return $app->redirect('/admin/databox/' . $databox->get_sbas_id() . '/?success=' . (int) $success . '&reload-tree=1');
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Reindex databox content
|
* Reindex databox content
|
||||||
*
|
*
|
||||||
@@ -716,7 +756,7 @@ class Databox implements ControllerProviderInterface
|
|||||||
$success = false;
|
$success = false;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$app['phraseanet.appbox']->set_databox_viewname($app['phraseanet.appbox']->get_databox($databox_id), $viewName);
|
$app['phraseanet.appbox']->get_databox($databox_id)->set_viewname($viewName);
|
||||||
$success = true;
|
$success = true;
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
|
|
||||||
|
@@ -141,7 +141,7 @@ class Databoxes implements ControllerProviderInterface
|
|||||||
'version' => $databox->get_version(),
|
'version' => $databox->get_version(),
|
||||||
'image' => '/skins/icons/foldph20close_0.gif',
|
'image' => '/skins/icons/foldph20close_0.gif',
|
||||||
'server_info' => $databox->get_connection()->server_info(),
|
'server_info' => $databox->get_connection()->server_info(),
|
||||||
'name' => \phrasea::sbas_names($sbasId, $app)
|
'name' => \phrasea::sbas_labels($sbasId, $app)
|
||||||
);
|
);
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
|
|
||||||
|
@@ -120,7 +120,7 @@ class TOU implements ControllerProviderInterface
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
$data[$databox->get_viewname()] = $cgus[$app['locale']]['value'];
|
$data[$databox->get_label($app['locale.I18n'])] = $cgus[$app['locale']]['value'];
|
||||||
}
|
}
|
||||||
|
|
||||||
return new Response($app['twig']->render('/prod/TOU.html.twig', array(
|
return new Response($app['twig']->render('/prod/TOU.html.twig', array(
|
||||||
|
@@ -789,7 +789,7 @@ class Thesaurus implements ControllerProviderInterface
|
|||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
$bases[$row['sbas_id']] = \phrasea::sbas_names($row['sbas_id'], $app);
|
$bases[$row['sbas_id']] = \phrasea::sbas_labels($row['sbas_id'], $app);
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach (PhraseaApplication::getAvailableLanguages() as $lng_code => $lng) {
|
foreach (PhraseaApplication::getAvailableLanguages() as $lng_code => $lng) {
|
||||||
@@ -1065,7 +1065,7 @@ class Thesaurus implements ControllerProviderInterface
|
|||||||
$updated = false;
|
$updated = false;
|
||||||
$validThesaurus = true;
|
$validThesaurus = true;
|
||||||
$ctlist = array();
|
$ctlist = array();
|
||||||
$name = \phrasea::sbas_names($request->get('bid'), $app);
|
$name = \phrasea::sbas_labels($request->get('bid'), $app);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$databox = $app['phraseanet.appbox']->get_databox((int) $request->get('bid'));
|
$databox = $app['phraseanet.appbox']->get_databox((int) $request->get('bid'));
|
||||||
|
@@ -832,7 +832,7 @@ class Xmlhttp implements ControllerProviderInterface
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
$connbas = \connection::getPDOConnection($app, $sbid);
|
$connbas = \connection::getPDOConnection($app, $sbid);
|
||||||
$dbname = \phrasea::sbas_names($sbid, $app);
|
$dbname = \phrasea::sbas_labels($sbid, $app);
|
||||||
|
|
||||||
$t_nrec = array();
|
$t_nrec = array();
|
||||||
$lthid = strlen($thid);
|
$lthid = strlen($thid);
|
||||||
@@ -1632,7 +1632,7 @@ class Xmlhttp implements ControllerProviderInterface
|
|||||||
|
|
||||||
$html = "" . '<LI id="TX_P.' . $sbid . '.T" class="expandable">' . "\n";
|
$html = "" . '<LI id="TX_P.' . $sbid . '.T" class="expandable">' . "\n";
|
||||||
$html .= "\t" . '<div class="hitarea expandable-hitarea"></div>' . "\n";
|
$html .= "\t" . '<div class="hitarea expandable-hitarea"></div>' . "\n";
|
||||||
$html .= "\t" . '<span>' . \phrasea::sbas_names($sbid, $app) . '</span>' . "\n";
|
$html .= "\t" . '<span>' . \phrasea::sbas_labels($sbid, $app) . '</span>' . "\n";
|
||||||
|
|
||||||
if ($request->get('t')) {
|
if ($request->get('t')) {
|
||||||
if ($request->get('field') != '') {
|
if ($request->get('field') != '') {
|
||||||
|
@@ -342,7 +342,7 @@ class PDF
|
|||||||
$str = $databox->get_sxml_structure();
|
$str = $databox->get_sxml_structure();
|
||||||
$vn = (string) ($str->pdfPrintLogo);
|
$vn = (string) ($str->pdfPrintLogo);
|
||||||
if (($vn * 1) == 1) {
|
if (($vn * 1) == 1) {
|
||||||
$LEFT__TEXT = $databox->get_viewname();
|
$LEFT__TEXT = $databox->get_label($this->app['locale.I18n']);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -254,7 +254,7 @@ class ConfigurationPanel extends AbstractConfigurationPanel
|
|||||||
|
|
||||||
|
|
||||||
#------------------------------------------------------------------------------
|
#------------------------------------------------------------------------------
|
||||||
# ***************** ' . $databox->get_viewname() . '
|
# ***************** ' . $databox->get_dbname() . '
|
||||||
#------------------------------------------------------------------------------
|
#------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
@@ -615,7 +615,7 @@ class ConfigurationPanel extends AbstractConfigurationPanel
|
|||||||
}
|
}
|
||||||
|
|
||||||
#------------------------------------------------------------------------------
|
#------------------------------------------------------------------------------
|
||||||
# ***************** End configuration for ' . $databox->get_viewname() . '
|
# ***************** End configuration for ' . $databox->get_dbname() . '
|
||||||
#------------------------------------------------------------------------------
|
#------------------------------------------------------------------------------
|
||||||
|
|
||||||
';
|
';
|
||||||
|
@@ -1985,8 +1985,15 @@ class API_V1_adapter extends API_V1_Abstract
|
|||||||
$ret = array();
|
$ret = array();
|
||||||
|
|
||||||
$ret['databox_id'] = $databox->get_sbas_id();
|
$ret['databox_id'] = $databox->get_sbas_id();
|
||||||
$ret['name'] = $databox->get_viewname();
|
$ret['name'] = $databox->get_dbname();
|
||||||
$ret['version'] = $databox->get_version();
|
$ret['viewname'] = $databox->get_viewname();
|
||||||
|
$ret['labels'] = array(
|
||||||
|
'en' => $databox->get_label('en'),
|
||||||
|
'de' => $databox->get_label('de'),
|
||||||
|
'fr' => $databox->get_label('fr'),
|
||||||
|
'nl' => $databox->get_label('nl'),
|
||||||
|
);
|
||||||
|
$ret['version'] = $databox->get_version();
|
||||||
|
|
||||||
return $ret;
|
return $ret;
|
||||||
}
|
}
|
||||||
|
@@ -286,27 +286,6 @@ class appbox extends base
|
|||||||
return $indexable;
|
return $indexable;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @param databox $databox
|
|
||||||
* @param <type> $viewname
|
|
||||||
* @return appbox
|
|
||||||
*/
|
|
||||||
public function set_databox_viewname(databox $databox, $viewname)
|
|
||||||
{
|
|
||||||
$viewname = strip_tags($viewname);
|
|
||||||
$sql = 'UPDATE sbas SET viewname = :viewname WHERE sbas_id = :sbas_id';
|
|
||||||
|
|
||||||
$stmt = $this->get_connection()->prepare($sql);
|
|
||||||
$stmt->execute(array(':viewname' => $viewname, ':sbas_id' => $databox->get_sbas_id()));
|
|
||||||
$stmt->closeCursor();
|
|
||||||
|
|
||||||
$this->delete_data_from_cache(appbox::CACHE_LIST_BASES);
|
|
||||||
cache_databox::update($databox->get_sbas_id(), 'structure');
|
|
||||||
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @return const
|
* @return const
|
||||||
@@ -392,7 +371,7 @@ class appbox extends base
|
|||||||
* Step 7
|
* Step 7
|
||||||
*/
|
*/
|
||||||
foreach ($this->get_databoxes() as $s) {
|
foreach ($this->get_databoxes() as $s) {
|
||||||
$upgrader->set_current_message(sprintf(_('Upgrading %s'), $s->get_viewname()));
|
$upgrader->set_current_message(sprintf(_('Upgrading %s'), $s->get_label($this->app['locale.I18n'])));
|
||||||
$advices = array_merge($advices, $s->upgradeDB(true, $upgrader, $app));
|
$advices = array_merge($advices, $s->upgradeDB(true, $upgrader, $app));
|
||||||
$upgrader->add_steps_complete(1);
|
$upgrader->add_steps_complete(1);
|
||||||
}
|
}
|
||||||
|
@@ -11,6 +11,7 @@
|
|||||||
|
|
||||||
use Alchemy\Phrasea\Application;
|
use Alchemy\Phrasea\Application;
|
||||||
use Symfony\Component\Filesystem\Filesystem;
|
use Symfony\Component\Filesystem\Filesystem;
|
||||||
|
use Alchemy\Phrasea\Exception\InvalidArgumentException;
|
||||||
|
|
||||||
class databox extends base
|
class databox extends base
|
||||||
{
|
{
|
||||||
@@ -87,6 +88,7 @@ class databox extends base
|
|||||||
protected static $_sxml_thesaurus = array();
|
protected static $_sxml_thesaurus = array();
|
||||||
|
|
||||||
const BASE_TYPE = self::DATA_BOX;
|
const BASE_TYPE = self::DATA_BOX;
|
||||||
|
const CACHE_BASE_DATABOX = 'base_infos';
|
||||||
const CACHE_META_STRUCT = 'meta_struct';
|
const CACHE_META_STRUCT = 'meta_struct';
|
||||||
const CACHE_THESAURUS = 'thesaurus';
|
const CACHE_THESAURUS = 'thesaurus';
|
||||||
const CACHE_COLLECTIONS = 'collections';
|
const CACHE_COLLECTIONS = 'collections';
|
||||||
@@ -96,6 +98,10 @@ class databox extends base
|
|||||||
protected $cache;
|
protected $cache;
|
||||||
protected $connection;
|
protected $connection;
|
||||||
protected $app;
|
protected $app;
|
||||||
|
private $labels = array();
|
||||||
|
private $ord;
|
||||||
|
private $viewname;
|
||||||
|
private $loaded = false;
|
||||||
|
|
||||||
public function __construct(Application $app, $sbas_id)
|
public function __construct(Application $app, $sbas_id)
|
||||||
{
|
{
|
||||||
@@ -121,6 +127,69 @@ class databox extends base
|
|||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private function load()
|
||||||
|
{
|
||||||
|
if ($this->loaded) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
$row = $this->get_data_from_cache(static::CACHE_BASE_DATABOX);
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
$sql = 'SELECT ord, viewname, label_en, label_fr, label_de, label_nl
|
||||||
|
FROM sbas WHERE sbas_id = :sbas_id';
|
||||||
|
$stmt = $this->app['phraseanet.appbox']->get_connection()->prepare($sql);
|
||||||
|
$stmt->execute(array('sbas_id' => $this->id));
|
||||||
|
$row = $stmt->fetch(\PDO::FETCH_ASSOC);
|
||||||
|
$stmt->closeCursor();
|
||||||
|
|
||||||
|
$this->set_data_to_cache($row, static::CACHE_BASE_DATABOX);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!$row) {
|
||||||
|
throw new Exception_DataboxNotFound(sprintf('databox %d not found', $sbas_id));
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->ord = $row['ord'];
|
||||||
|
$this->viewname = $row['viewname'];
|
||||||
|
$this->labels['fr'] = $row['label_fr'];
|
||||||
|
$this->labels['en'] = $row['label_en'];
|
||||||
|
$this->labels['de'] = $row['label_de'];
|
||||||
|
$this->labels['nl'] = $row['label_nl'];
|
||||||
|
|
||||||
|
$this->loaded = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function get_viewname()
|
||||||
|
{
|
||||||
|
$this->load();
|
||||||
|
|
||||||
|
return $this->viewname ? : $this->dbname;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function set_viewname($viewname)
|
||||||
|
{
|
||||||
|
$sql = 'UPDATE sbas SET viewname = :viewname WHERE sbas_id = :sbas_id';
|
||||||
|
|
||||||
|
$stmt = $this->app['phraseanet.appbox']->get_connection()->prepare($sql);
|
||||||
|
$stmt->execute(array(':viewname' => $viewname, ':sbas_id' => $this->id));
|
||||||
|
$stmt->closeCursor();
|
||||||
|
|
||||||
|
$this->app['phraseanet.appbox']->delete_data_from_cache(appbox::CACHE_LIST_BASES);
|
||||||
|
cache_databox::update($this->app, $this->id, 'structure');
|
||||||
|
|
||||||
|
$this->viewname = $viewname;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function get_ord()
|
||||||
|
{
|
||||||
|
$this->load();
|
||||||
|
|
||||||
|
return $this->ord;
|
||||||
|
}
|
||||||
|
|
||||||
public function get_appbox()
|
public function get_appbox()
|
||||||
{
|
{
|
||||||
return $this->app['phraseanet.appbox'];
|
return $this->app['phraseanet.appbox'];
|
||||||
@@ -156,7 +225,7 @@ class databox extends base
|
|||||||
AND b.active = '1'
|
AND b.active = '1'
|
||||||
ORDER BY s.ord ASC, b.ord,b.base_id ASC";
|
ORDER BY s.ord ASC, b.ord,b.base_id ASC";
|
||||||
$stmt = $conn->prepare($sql);
|
$stmt = $conn->prepare($sql);
|
||||||
$stmt->execute(array(':sbas_id' => $this->get_sbas_id()));
|
$stmt->execute(array(':sbas_id' => $this->id));
|
||||||
$rs = $stmt->fetchAll(PDO::FETCH_ASSOC);
|
$rs = $stmt->fetchAll(PDO::FETCH_ASSOC);
|
||||||
$stmt->closeCursor();
|
$stmt->closeCursor();
|
||||||
|
|
||||||
@@ -178,12 +247,45 @@ class databox extends base
|
|||||||
*/
|
*/
|
||||||
public function get_record($record_id, $number = null)
|
public function get_record($record_id, $number = null)
|
||||||
{
|
{
|
||||||
return new record_adapter($this->app, $this->get_sbas_id(), $record_id, $number);
|
return new record_adapter($this->app, $this->id, $record_id, $number);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function get_viewname()
|
public function get_label($code, $substitute = true)
|
||||||
{
|
{
|
||||||
return phrasea::sbas_names($this->get_sbas_id(), $this->app);
|
$this->load();
|
||||||
|
|
||||||
|
if (!array_key_exists($code, $this->labels)) {
|
||||||
|
throw new InvalidArgumentException(sprintf('Code %s is not defined', $code));
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($substitute) {
|
||||||
|
return isset($this->labels[$code]) ? $this->labels[$code] : $this->get_viewname();
|
||||||
|
} else {
|
||||||
|
return $this->labels[$code];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function set_label($code, $label)
|
||||||
|
{
|
||||||
|
$this->load();
|
||||||
|
|
||||||
|
if (!array_key_exists($code, $this->labels)) {
|
||||||
|
throw new InvalidArgumentException(sprintf('Code %s is not defined', $code));
|
||||||
|
}
|
||||||
|
|
||||||
|
$sql = "UPDATE sbas SET label_$code = :label
|
||||||
|
WHERE sbas_id = :sbas_id";
|
||||||
|
$stmt = $this->app['phraseanet.appbox']->get_connection()->prepare($sql);
|
||||||
|
$stmt->execute(array(':label' => $label, ':sbas_id' => $this->id));
|
||||||
|
$stmt->closeCursor();
|
||||||
|
|
||||||
|
$this->labels[$code] = $label;
|
||||||
|
|
||||||
|
$this->delete_data_from_cache(static::CACHE_BASE_DATABOX);
|
||||||
|
|
||||||
|
phrasea::reset_sbasDatas($this->app['phraseanet.appbox']);
|
||||||
|
|
||||||
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -192,7 +294,7 @@ class databox extends base
|
|||||||
*/
|
*/
|
||||||
public function get_statusbits()
|
public function get_statusbits()
|
||||||
{
|
{
|
||||||
return databox_status::getStatus($this->app, $this->get_sbas_id());
|
return databox_status::getStatus($this->app, $this->id);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -329,7 +431,7 @@ class databox extends base
|
|||||||
}
|
}
|
||||||
|
|
||||||
$query = new User_Query($this->app);
|
$query = new User_Query($this->app);
|
||||||
$total = $query->on_sbas_ids(array($this->get_sbas_id()))
|
$total = $query->on_sbas_ids(array($this->id))
|
||||||
->include_phantoms(false)
|
->include_phantoms(false)
|
||||||
->include_special_users(true)
|
->include_special_users(true)
|
||||||
->include_invite(true)
|
->include_invite(true)
|
||||||
@@ -370,12 +472,12 @@ class databox extends base
|
|||||||
|
|
||||||
$sql = "DELETE FROM sbas WHERE sbas_id = :sbas_id";
|
$sql = "DELETE FROM sbas WHERE sbas_id = :sbas_id";
|
||||||
$stmt = $this->app['phraseanet.appbox']->get_connection()->prepare($sql);
|
$stmt = $this->app['phraseanet.appbox']->get_connection()->prepare($sql);
|
||||||
$stmt->execute(array(':sbas_id' => $this->get_sbas_id()));
|
$stmt->execute(array(':sbas_id' => $this->id));
|
||||||
$stmt->closeCursor();
|
$stmt->closeCursor();
|
||||||
|
|
||||||
$sql = "DELETE FROM sbasusr WHERE sbas_id = :sbas_id";
|
$sql = "DELETE FROM sbasusr WHERE sbas_id = :sbas_id";
|
||||||
$stmt = $this->app['phraseanet.appbox']->get_connection()->prepare($sql);
|
$stmt = $this->app['phraseanet.appbox']->get_connection()->prepare($sql);
|
||||||
$stmt->execute(array(':sbas_id' => $this->get_sbas_id()));
|
$stmt->execute(array(':sbas_id' => $this->id));
|
||||||
$stmt->closeCursor();
|
$stmt->closeCursor();
|
||||||
|
|
||||||
$this->app['phraseanet.appbox']->delete_data_from_cache(appbox::CACHE_LIST_BASES);
|
$this->app['phraseanet.appbox']->delete_data_from_cache(appbox::CACHE_LIST_BASES);
|
||||||
@@ -527,7 +629,7 @@ class databox extends base
|
|||||||
|
|
||||||
public function get_cache_key($option = null)
|
public function get_cache_key($option = null)
|
||||||
{
|
{
|
||||||
return 'databox_' . $this->get_sbas_id() . '_' . ($option ? $option . '_' : '');
|
return 'databox_' . $this->id . '_' . ($option ? $option . '_' : '');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -659,7 +761,7 @@ class databox extends base
|
|||||||
|
|
||||||
$sql = 'SELECT server_coll_id FROM bas WHERE sbas_id = :sbas_id';
|
$sql = 'SELECT server_coll_id FROM bas WHERE sbas_id = :sbas_id';
|
||||||
$stmt = $conn->prepare($sql);
|
$stmt = $conn->prepare($sql);
|
||||||
$stmt->execute(array(':sbas_id' => $this->get_sbas_id()));
|
$stmt->execute(array(':sbas_id' => $this->id));
|
||||||
$rs = $stmt->fetchAll(PDO::FETCH_ASSOC);
|
$rs = $stmt->fetchAll(PDO::FETCH_ASSOC);
|
||||||
$stmt->closeCursor();
|
$stmt->closeCursor();
|
||||||
|
|
||||||
@@ -694,7 +796,7 @@ class databox extends base
|
|||||||
|
|
||||||
$sql = 'SELECT base_id FROM bas WHERE sbas_id = :sbas_id AND active = "0"';
|
$sql = 'SELECT base_id FROM bas WHERE sbas_id = :sbas_id AND active = "0"';
|
||||||
$stmt = $conn->prepare($sql);
|
$stmt = $conn->prepare($sql);
|
||||||
$stmt->execute(array(':sbas_id' => $this->get_sbas_id()));
|
$stmt->execute(array(':sbas_id' => $this->id));
|
||||||
$rs = $stmt->fetchAll(PDO::FETCH_ASSOC);
|
$rs = $stmt->fetchAll(PDO::FETCH_ASSOC);
|
||||||
$stmt->closeCursor();
|
$stmt->closeCursor();
|
||||||
|
|
||||||
@@ -741,7 +843,7 @@ class databox extends base
|
|||||||
$this->delete_data_from_cache(self::CACHE_STRUCTURE);
|
$this->delete_data_from_cache(self::CACHE_STRUCTURE);
|
||||||
$this->delete_data_from_cache(self::CACHE_META_STRUCT);
|
$this->delete_data_from_cache(self::CACHE_META_STRUCT);
|
||||||
|
|
||||||
cache_databox::update($this->app, $this->get_sbas_id(), 'structure');
|
cache_databox::update($this->app, $this->id, 'structure');
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
@@ -870,9 +972,9 @@ class databox extends base
|
|||||||
$conn = connection::getPDOConnection($this->app);
|
$conn = connection::getPDOConnection($this->app);
|
||||||
|
|
||||||
$user->ACL()
|
$user->ACL()
|
||||||
->give_access_to_sbas(array($this->get_sbas_id()))
|
->give_access_to_sbas(array($this->id))
|
||||||
->update_rights_to_sbas(
|
->update_rights_to_sbas(
|
||||||
$this->get_sbas_id(), array(
|
$this->id, array(
|
||||||
'bas_manage' => 1, 'bas_modify_struct' => 1,
|
'bas_manage' => 1, 'bas_modify_struct' => 1,
|
||||||
'bas_modif_th' => 1, 'bas_chupub' => 1
|
'bas_modif_th' => 1, 'bas_chupub' => 1
|
||||||
)
|
)
|
||||||
@@ -892,7 +994,7 @@ class databox extends base
|
|||||||
$base_ids = array();
|
$base_ids = array();
|
||||||
foreach ($rs as $row) {
|
foreach ($rs as $row) {
|
||||||
try {
|
try {
|
||||||
$stmt->execute(array(':coll_id' => $row['coll_id'], ':sbas_id' => $this->get_sbas_id()));
|
$stmt->execute(array(':coll_id' => $row['coll_id'], ':sbas_id' => $this->id));
|
||||||
$base_ids[] = $base_id = $conn->lastInsertId();
|
$base_ids[] = $base_id = $conn->lastInsertId();
|
||||||
|
|
||||||
if ( ! empty($row['logo'])) {
|
if ( ! empty($row['logo'])) {
|
||||||
@@ -961,7 +1063,7 @@ class databox extends base
|
|||||||
*/
|
*/
|
||||||
public function get_dom_thesaurus()
|
public function get_dom_thesaurus()
|
||||||
{
|
{
|
||||||
$sbas_id = $this->get_sbas_id();
|
$sbas_id = $this->id;
|
||||||
if (isset(self::$_dom_thesaurus[$sbas_id])) {
|
if (isset(self::$_dom_thesaurus[$sbas_id])) {
|
||||||
return self::$_dom_thesaurus[$sbas_id];
|
return self::$_dom_thesaurus[$sbas_id];
|
||||||
}
|
}
|
||||||
@@ -985,7 +1087,7 @@ class databox extends base
|
|||||||
*/
|
*/
|
||||||
public function get_xpath_thesaurus()
|
public function get_xpath_thesaurus()
|
||||||
{
|
{
|
||||||
$sbas_id = $this->get_sbas_id();
|
$sbas_id = $this->id;
|
||||||
if (isset(self::$_xpath_thesaurus[$sbas_id])) {
|
if (isset(self::$_xpath_thesaurus[$sbas_id])) {
|
||||||
return self::$_xpath_thesaurus[$sbas_id];
|
return self::$_xpath_thesaurus[$sbas_id];
|
||||||
}
|
}
|
||||||
@@ -1005,7 +1107,7 @@ class databox extends base
|
|||||||
*/
|
*/
|
||||||
public function get_sxml_thesaurus()
|
public function get_sxml_thesaurus()
|
||||||
{
|
{
|
||||||
$sbas_id = $this->get_sbas_id();
|
$sbas_id = $this->id;
|
||||||
if (isset(self::$_sxml_thesaurus[$sbas_id])) {
|
if (isset(self::$_sxml_thesaurus[$sbas_id])) {
|
||||||
return self::$_sxml_thesaurus[$sbas_id];
|
return self::$_sxml_thesaurus[$sbas_id];
|
||||||
}
|
}
|
||||||
|
@@ -57,7 +57,7 @@ class databox_cgu
|
|||||||
|
|
||||||
if ( ! isset($cgus[$app['locale']]))
|
if ( ! isset($cgus[$app['locale']]))
|
||||||
throw new Exception('No CGus for this locale');
|
throw new Exception('No CGus for this locale');
|
||||||
$name = $databox->get_viewname();
|
$name = $databox->get_label($app['locale.I18n']);
|
||||||
|
|
||||||
$update = $cgus[$app['locale']]['updated_on'];
|
$update = $cgus[$app['locale']]['updated_on'];
|
||||||
$value = $cgus[$app['locale']]['value'];
|
$value = $cgus[$app['locale']]['value'];
|
||||||
|
@@ -185,7 +185,7 @@ function giveMeBaseUsr(Application $app, $usr, $lng)
|
|||||||
foreach ($inscriptions as $sbasId => $baseInsc) {
|
foreach ($inscriptions as $sbasId => $baseInsc) {
|
||||||
//je presente la base
|
//je presente la base
|
||||||
if (($baseInsc['CollsRegistered'] || $baseInsc['CollsRefuse'] || $baseInsc['CollsWait'] || $baseInsc['CollsIntime'] || $baseInsc['CollsOuttime'] || $baseInsc['CollsNonactif'] || $baseInsc['CollsCGU'] || $baseInsc['Colls']))//&& $baseInsc['inscript'])
|
if (($baseInsc['CollsRegistered'] || $baseInsc['CollsRefuse'] || $baseInsc['CollsWait'] || $baseInsc['CollsIntime'] || $baseInsc['CollsOuttime'] || $baseInsc['CollsNonactif'] || $baseInsc['CollsCGU'] || $baseInsc['Colls']))//&& $baseInsc['inscript'])
|
||||||
$out .= '<tr><td colspan="3" style="text-align:center;"><h3>' . phrasea::sbas_names($sbasId, $app) . '</h3></td></tr>';
|
$out .= '<tr><td colspan="3" style="text-align:center;"><h3>' . phrasea::sbas_labels($sbasId, $app) . '</h3></td></tr>';
|
||||||
|
|
||||||
if ($baseInsc['CollsRegistered']) {
|
if ($baseInsc['CollsRegistered']) {
|
||||||
foreach ($baseInsc['CollsRegistered'] as $collId => $isTrue) {
|
foreach ($baseInsc['CollsRegistered'] as $collId => $isTrue) {
|
||||||
@@ -347,7 +347,7 @@ function giveInscript(Application $app, $lng, $demandes = null)
|
|||||||
|
|
||||||
if (($baseInsc['CollsCGU'] || $baseInsc['Colls']) && $baseInsc['inscript']) {// il y a des coll ou s'inscrire !
|
if (($baseInsc['CollsCGU'] || $baseInsc['Colls']) && $baseInsc['inscript']) {// il y a des coll ou s'inscrire !
|
||||||
//je pr<70>sente la base
|
//je pr<70>sente la base
|
||||||
$out .= '<tr><td colspan="3" style="text-align:center;"><h3 style="margin: 15px 0pt 2px;" class="inscriptbase">' . phrasea::sbas_names($sbasId, $app) . '</h3></td></tr>';
|
$out .= '<tr><td colspan="3" style="text-align:center;"><h3 style="margin: 15px 0pt 2px;" class="inscriptbase">' . phrasea::sbas_labels($sbasId, $app) . '</h3></td></tr>';
|
||||||
|
|
||||||
if ($baseInsc['Colls']) {//des coll ou on peut s'inscrire sans cgu specifiques
|
if ($baseInsc['Colls']) {//des coll ou on peut s'inscrire sans cgu specifiques
|
||||||
//je check si ya des cgu pour la base
|
//je check si ya des cgu pour la base
|
||||||
|
@@ -38,7 +38,7 @@ class module_console_fieldsList extends Command
|
|||||||
$output->writeln(
|
$output->writeln(
|
||||||
sprintf(
|
sprintf(
|
||||||
"\n ---------------- \nOn databox %s (sbas_id %d) :\n"
|
"\n ---------------- \nOn databox %s (sbas_id %d) :\n"
|
||||||
, $databox->get_viewname()
|
, $databox->get_label($this->container['locale.I18n'])
|
||||||
, $databox->get_sbas_id()
|
, $databox->get_sbas_id()
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
@@ -53,7 +53,7 @@ class module_console_sphinxGenerateSuggestion extends Command
|
|||||||
|
|
||||||
$databox = $this->getService('phraseanet.appbox')->get_databox($sbas_id);
|
$databox = $this->getService('phraseanet.appbox')->get_databox($sbas_id);
|
||||||
|
|
||||||
$output->writeln("process Databox " . $databox->get_viewname() . " / $index\n");
|
$output->writeln("process Databox " . $databox->get_label($this->container['locale.I18n']) . " / $index\n");
|
||||||
|
|
||||||
if ( ! is_executable("/usr/local/bin/indexer")) {
|
if ( ! is_executable("/usr/local/bin/indexer")) {
|
||||||
$output->writeln("<error>'/usr/local/bin/indexer' is not executable</error>");
|
$output->writeln("<error>'/usr/local/bin/indexer' is not executable</error>");
|
||||||
|
@@ -126,7 +126,7 @@ class module_console_systemExport extends Command
|
|||||||
$total = $errors = 0;
|
$total = $errors = 0;
|
||||||
|
|
||||||
foreach ($this->getService('phraseanet.appbox')->get_databoxes() as $databox) {
|
foreach ($this->getService('phraseanet.appbox')->get_databoxes() as $databox) {
|
||||||
$output->writeln(sprintf("Processing <info>%s</info>", $databox->get_viewname()));
|
$output->writeln(sprintf("Processing <info>%s</info>", $databox->get_label($this->container['locale.I18n'])));
|
||||||
|
|
||||||
if (count($restrictSbasIds) > 0 && ! in_array($databox->get_sbas_id(), $restrictSbasIds)) {
|
if (count($restrictSbasIds) > 0 && ! in_array($databox->get_sbas_id(), $restrictSbasIds)) {
|
||||||
$output->writeln(sprintf("Databox not selected, bypassing ..."));
|
$output->writeln(sprintf("Databox not selected, bypassing ..."));
|
||||||
|
@@ -257,7 +257,7 @@ class module_report
|
|||||||
$this->app['date-formatter']->getPrettyString(new \DateTime($d1)),
|
$this->app['date-formatter']->getPrettyString(new \DateTime($d1)),
|
||||||
$this->app['date-formatter']->getPrettyString(new \DateTime($d2))
|
$this->app['date-formatter']->getPrettyString(new \DateTime($d2))
|
||||||
);
|
);
|
||||||
$this->dbname = phrasea::sbas_names($sbas_id, $app);
|
$this->dbname = phrasea::sbas_labels($sbas_id, $app);
|
||||||
$this->cor = $this->setCor();
|
$this->cor = $this->setCor();
|
||||||
$this->jour = $this->setDay();
|
$this->jour = $this->setDay();
|
||||||
$this->month = $this->setMonth();
|
$this->month = $this->setMonth();
|
||||||
|
@@ -248,7 +248,7 @@ class module_report_dashboard implements module_report_dashboard_componentInterf
|
|||||||
$sbas_id = $databox->get_sbas_id();
|
$sbas_id = $databox->get_sbas_id();
|
||||||
if ( ! isset($all_coll[$sbas_id])) {
|
if ( ! isset($all_coll[$sbas_id])) {
|
||||||
$all_coll[$sbas_id] = array();
|
$all_coll[$sbas_id] = array();
|
||||||
$all_coll[$sbas_id]['name_sbas'] = $databox->get_viewname();
|
$all_coll[$sbas_id]['name_sbas'] = $databox->get_label($this->app['locale.I18n']);
|
||||||
}
|
}
|
||||||
$all_coll[$sbas_id]['sbas_collections'][] = array(
|
$all_coll[$sbas_id]['sbas_collections'][] = array(
|
||||||
'base_id' => $base_id,
|
'base_id' => $base_id,
|
||||||
@@ -279,7 +279,7 @@ class module_report_dashboard implements module_report_dashboard_componentInterf
|
|||||||
$this->authorizedCollection[] = array(
|
$this->authorizedCollection[] = array(
|
||||||
'sbas_id' => (int) $sbas,
|
'sbas_id' => (int) $sbas,
|
||||||
'coll' => implode(',', $listeColl),
|
'coll' => implode(',', $listeColl),
|
||||||
'name' => phrasea::sbas_names($sbas, $this->app)
|
'name' => phrasea::sbas_labels($sbas, $this->app)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -298,7 +298,7 @@ class module_report_dashboard implements module_report_dashboard_componentInterf
|
|||||||
$all_coll = $this->getAllColl();
|
$all_coll = $this->getAllColl();
|
||||||
$liste = '';
|
$liste = '';
|
||||||
foreach ($all_coll as $sbas => $info) {
|
foreach ($all_coll as $sbas => $info) {
|
||||||
$liste .= phrasea::sbas_names($sbas, $this->app) . ' ' . $separator . ' ';
|
$liste .= phrasea::sbas_labels($sbas, $this->app) . ' ' . $separator . ' ';
|
||||||
}
|
}
|
||||||
|
|
||||||
return $liste;
|
return $liste;
|
||||||
|
@@ -15,6 +15,7 @@ class phrasea
|
|||||||
{
|
{
|
||||||
private static $_bas2sbas = false;
|
private static $_bas2sbas = false;
|
||||||
private static $_sbas_names = false;
|
private static $_sbas_names = false;
|
||||||
|
private static $_sbas_labels = false;
|
||||||
private static $_coll2bas = false;
|
private static $_coll2bas = false;
|
||||||
private static $_bas2coll = false;
|
private static $_bas2coll = false;
|
||||||
private static $_bas_labels = false;
|
private static $_bas_labels = false;
|
||||||
@@ -25,6 +26,7 @@ class phrasea
|
|||||||
const CACHE_BAS_2_COLL = 'bas_2_coll';
|
const CACHE_BAS_2_COLL = 'bas_2_coll';
|
||||||
const CACHE_BAS_LABELS = 'bas_labels';
|
const CACHE_BAS_LABELS = 'bas_labels';
|
||||||
const CACHE_SBAS_NAMES = 'sbas_names';
|
const CACHE_SBAS_NAMES = 'sbas_names';
|
||||||
|
const CACHE_SBAS_LABELS = 'sbas_labels';
|
||||||
const CACHE_SBAS_FROM_BAS = 'sbas_from_bas';
|
const CACHE_SBAS_FROM_BAS = 'sbas_from_bas';
|
||||||
const CACHE_SBAS_PARAMS = 'sbas_params';
|
const CACHE_SBAS_PARAMS = 'sbas_params';
|
||||||
|
|
||||||
@@ -196,12 +198,13 @@ class phrasea
|
|||||||
|
|
||||||
public static function reset_sbasDatas(appbox $appbox)
|
public static function reset_sbasDatas(appbox $appbox)
|
||||||
{
|
{
|
||||||
self::$_sbas_names = self::$_sbas_params = self::$_bas2sbas = null;
|
self::$_sbas_names = self::$_sbas_labels = self::$_sbas_params = self::$_bas2sbas = null;
|
||||||
$appbox->delete_data_from_cache(
|
$appbox->delete_data_from_cache(
|
||||||
array(
|
array(
|
||||||
self::CACHE_SBAS_NAMES
|
self::CACHE_SBAS_NAMES,
|
||||||
, self::CACHE_SBAS_FROM_BAS
|
self::CACHE_SBAS_LABELS,
|
||||||
, self::CACHE_SBAS_PARAMS
|
self::CACHE_SBAS_FROM_BAS,
|
||||||
|
self::CACHE_SBAS_PARAMS,
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -232,15 +235,8 @@ class phrasea
|
|||||||
try {
|
try {
|
||||||
self::$_sbas_names = $app['phraseanet.appbox']->get_data_from_cache(self::CACHE_SBAS_NAMES);
|
self::$_sbas_names = $app['phraseanet.appbox']->get_data_from_cache(self::CACHE_SBAS_NAMES);
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
$sql = 'SELECT sbas_id, viewname, dbname FROM sbas';
|
foreach ($app['phraseanet.appbox']->get_databoxes() as $databox) {
|
||||||
$stmt = $app['phraseanet.appbox']->get_connection()->prepare($sql);
|
self::$_sbas_names[$databox->get_sbas_id()] = $databox->get_viewname();
|
||||||
$stmt->execute();
|
|
||||||
$rs = $stmt->fetchAll(PDO::FETCH_ASSOC);
|
|
||||||
$stmt->closeCursor();
|
|
||||||
|
|
||||||
foreach ($rs as $row) {
|
|
||||||
$row['viewname'] = trim($row['viewname']);
|
|
||||||
self::$_sbas_names[$row['sbas_id']] = $row['viewname'] ? $row['viewname'] : $row['dbname'];
|
|
||||||
}
|
}
|
||||||
$app['phraseanet.appbox']->set_data_to_cache(self::$_sbas_names, self::CACHE_SBAS_NAMES);
|
$app['phraseanet.appbox']->set_data_to_cache(self::$_sbas_names, self::CACHE_SBAS_NAMES);
|
||||||
}
|
}
|
||||||
@@ -249,6 +245,31 @@ class phrasea
|
|||||||
return isset(self::$_sbas_names[$sbas_id]) ? self::$_sbas_names[$sbas_id] : 'Unknown base';
|
return isset(self::$_sbas_names[$sbas_id]) ? self::$_sbas_names[$sbas_id] : 'Unknown base';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static function sbas_labels($sbas_id, Application $app)
|
||||||
|
{
|
||||||
|
if (!self::$_sbas_labels) {
|
||||||
|
try {
|
||||||
|
self::$_sbas_labels = $app['phraseanet.appbox']->get_data_from_cache(self::CACHE_SBAS_LABELS);
|
||||||
|
} catch (Exception $e) {
|
||||||
|
foreach ($app['phraseanet.appbox']->get_databoxes() as $databox) {
|
||||||
|
self::$_sbas_labels[$databox->get_sbas_id()] = array(
|
||||||
|
'fr' => $databox->get_label('fr'),
|
||||||
|
'en' => $databox->get_label('en'),
|
||||||
|
'de' => $databox->get_label('de'),
|
||||||
|
'nl' => $databox->get_label('nl'),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
$app['phraseanet.appbox']->set_data_to_cache(self::$_sbas_labels, self::CACHE_SBAS_LABELS);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isset(self::$_sbas_labels[$sbas_id]) && isset(self::$_sbas_labels[$sbas_id][$app['locale.I18n']])) {
|
||||||
|
return self::$_sbas_labels[$sbas_id][$app['locale.I18n']];
|
||||||
|
}
|
||||||
|
|
||||||
|
return 'Unknown database';
|
||||||
|
}
|
||||||
|
|
||||||
public static function bas_labels($base_id, Application $app)
|
public static function bas_labels($base_id, Application $app)
|
||||||
{
|
{
|
||||||
if (!self::$_bas_labels) {
|
if (!self::$_bas_labels) {
|
||||||
|
@@ -494,7 +494,7 @@ class task_period_RecordMover extends task_appboxAbstract
|
|||||||
try {
|
try {
|
||||||
$dbox = $this->dependencyContainer['phraseanet.appbox']->get_databox($sbas_id);
|
$dbox = $this->dependencyContainer['phraseanet.appbox']->get_databox($sbas_id);
|
||||||
|
|
||||||
$ret['basename'] = $dbox->get_viewname();
|
$ret['basename'] = $dbox->get_label($this->dependencyContainer['locale.I18n']);
|
||||||
$ret['basename_htmlencoded'] = htmlentities($ret['basename']);
|
$ret['basename_htmlencoded'] = htmlentities($ret['basename']);
|
||||||
switch ($ret['action']) {
|
switch ($ret['action']) {
|
||||||
case 'UPDATE':
|
case 'UPDATE':
|
||||||
|
@@ -219,7 +219,7 @@ class task_period_archive extends task_abstract
|
|||||||
<?php
|
<?php
|
||||||
foreach ($this->dependencyContainer['phraseanet.appbox']->get_databoxes() as $databox) {
|
foreach ($this->dependencyContainer['phraseanet.appbox']->get_databoxes() as $databox) {
|
||||||
foreach ($databox->get_collections() as $collection) {
|
foreach ($databox->get_collections() as $collection) {
|
||||||
print("<option value=\"" . $collection->get_base_id() . "\">" . $databox->get_viewname() . " / " . $collection->get_label($this->dependencyContainer['locale.I18n']) . "</option>");
|
print("<option value=\"" . $collection->get_base_id() . "\">" . $databox->get_label($this->dependencyContainer['locale.I18n']) . " / " . $collection->get_label($this->dependencyContainer['locale.I18n']) . "</option>");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
|
@@ -466,7 +466,7 @@ class task_period_ftp extends task_appboxAbstract
|
|||||||
$state .= $line = sprintf(_('task::ftp:File "%1$s" (record %2$s) de la base "%3$s"' .
|
$state .= $line = sprintf(_('task::ftp:File "%1$s" (record %2$s) de la base "%3$s"' .
|
||||||
' (Export du Document) : Transfert cancelled (le document n\'existe plus)')
|
' (Export du Document) : Transfert cancelled (le document n\'existe plus)')
|
||||||
, basename($localfile), $record_id
|
, basename($localfile), $record_id
|
||||||
, phrasea::sbas_names(phrasea::sbasFromBas($this->dependencyContainer, $base_id), $this->dependencyContainer)) . "\n<br/>";
|
, phrasea::sbas_labels(phrasea::sbasFromBas($this->dependencyContainer, $base_id), $this->dependencyContainer)) . "\n<br/>";
|
||||||
|
|
||||||
$this->logger->addDebug($line);
|
$this->logger->addDebug($line);
|
||||||
|
|
||||||
@@ -615,13 +615,13 @@ class task_period_ftp extends task_appboxAbstract
|
|||||||
$transferts[] =
|
$transferts[] =
|
||||||
'<li>' . sprintf(_('task::ftp:Record %1$s - %2$s de la base (%3$s - %4$s) - %5$s')
|
'<li>' . sprintf(_('task::ftp:Record %1$s - %2$s de la base (%3$s - %4$s) - %5$s')
|
||||||
, $row["record_id"], $row["filename"]
|
, $row["record_id"], $row["filename"]
|
||||||
, phrasea::sbas_names(phrasea::sbasFromBas($this->dependencyContainer, $row["base_id"]), $this->dependencyContainer)
|
, phrasea::sbas_labels(phrasea::sbasFromBas($this->dependencyContainer, $row["base_id"]), $this->dependencyContainer)
|
||||||
, phrasea::bas_labels($row['base_id'], $this->dependencyContainer), $row['subdef']) . ' : ' . _('Transfert OK') . '</li>';
|
, phrasea::bas_labels($row['base_id'], $this->dependencyContainer), $row['subdef']) . ' : ' . _('Transfert OK') . '</li>';
|
||||||
} else {
|
} else {
|
||||||
$transferts[] =
|
$transferts[] =
|
||||||
'<li>' . sprintf(_('task::ftp:Record %1$s - %2$s de la base (%3$s - %4$s) - %5$s')
|
'<li>' . sprintf(_('task::ftp:Record %1$s - %2$s de la base (%3$s - %4$s) - %5$s')
|
||||||
, $row["record_id"], $row["filename"]
|
, $row["record_id"], $row["filename"]
|
||||||
, phrasea::sbas_names(phrasea::sbasFromBas($this->dependencyContainer, $row["base_id"]), $this->dependencyContainer), phrasea::bas_labels($row['base_id'], $this->dependencyContainer)
|
, phrasea::sbas_labels(phrasea::sbasFromBas($this->dependencyContainer, $row["base_id"]), $this->dependencyContainer), phrasea::bas_labels($row['base_id'], $this->dependencyContainer)
|
||||||
, $row['subdef']) . ' : ' . _('Transfert Annule') . '</li>';
|
, $row['subdef']) . ' : ' . _('Transfert Annule') . '</li>';
|
||||||
$transfert_status = _('task::ftp:Certains documents n\'ont pas pu etre tranferes');
|
$transfert_status = _('task::ftp:Certains documents n\'ont pas pu etre tranferes');
|
||||||
}
|
}
|
||||||
|
@@ -2522,19 +2522,8 @@
|
|||||||
<default></default>
|
<default></default>
|
||||||
<comment></comment>
|
<comment></comment>
|
||||||
</field>
|
</field>
|
||||||
<field>
|
|
||||||
<name>thesaurus_id</name>
|
|
||||||
<type>int(11) unsigned</type>
|
|
||||||
|
|
||||||
<null></null>
|
|
||||||
<extra></extra>
|
|
||||||
|
|
||||||
<default>0</default>
|
|
||||||
<comment></comment>
|
|
||||||
</field>
|
|
||||||
<field>
|
<field>
|
||||||
<name>viewname</name>
|
<name>viewname</name>
|
||||||
|
|
||||||
<type>char(128)</type>
|
<type>char(128)</type>
|
||||||
<null></null>
|
<null></null>
|
||||||
<extra></extra>
|
<extra></extra>
|
||||||
@@ -2543,7 +2532,6 @@
|
|||||||
<comment></comment>
|
<comment></comment>
|
||||||
</field>
|
</field>
|
||||||
<field>
|
<field>
|
||||||
|
|
||||||
<name>indexable</name>
|
<name>indexable</name>
|
||||||
<type>tinyint(1) unsigned</type>
|
<type>tinyint(1) unsigned</type>
|
||||||
<null></null>
|
<null></null>
|
||||||
@@ -2551,7 +2539,38 @@
|
|||||||
|
|
||||||
<default>1</default>
|
<default>1</default>
|
||||||
<comment></comment>
|
<comment></comment>
|
||||||
|
</field>
|
||||||
|
<field>
|
||||||
|
<name>label_en</name>
|
||||||
|
<type>char(50)</type>
|
||||||
|
<null>YES</null>
|
||||||
|
<extra></extra>
|
||||||
|
<default></default>
|
||||||
|
<comment></comment>
|
||||||
|
</field>
|
||||||
|
<field>
|
||||||
|
<name>label_fr</name>
|
||||||
|
<type>char(50)</type>
|
||||||
|
<null>YES</null>
|
||||||
|
<extra></extra>
|
||||||
|
<default></default>
|
||||||
|
<comment></comment>
|
||||||
|
</field>
|
||||||
|
<field>
|
||||||
|
<name>label_de</name>
|
||||||
|
<type>char(50)</type>
|
||||||
|
<null>YES</null>
|
||||||
|
<extra></extra>
|
||||||
|
<default></default>
|
||||||
|
<comment></comment>
|
||||||
|
</field>
|
||||||
|
<field>
|
||||||
|
<name>label_nl</name>
|
||||||
|
<type>char(50)</type>
|
||||||
|
<null>YES</null>
|
||||||
|
<extra></extra>
|
||||||
|
<default></default>
|
||||||
|
<comment></comment>
|
||||||
</field>
|
</field>
|
||||||
</fields>
|
</fields>
|
||||||
<indexes>
|
<indexes>
|
||||||
|
@@ -17,7 +17,7 @@
|
|||||||
{% for sbasId, baseInsc in inscriptions %}
|
{% for sbasId, baseInsc in inscriptions %}
|
||||||
{% if baseInsc["CollsRegistered"] or baseInsc["CollsRefuse"] or baseInsc["CollsWait"] or baseInsc["CollsIntime"] or baseInsc["CollsOuttime"] or baseInsc["CollsNonactif"] or baseInsc["CollsCGU"] or baseInsc["Colls"] %}
|
{% if baseInsc["CollsRegistered"] or baseInsc["CollsRefuse"] or baseInsc["CollsWait"] or baseInsc["CollsIntime"] or baseInsc["CollsOuttime"] or baseInsc["CollsNonactif"] or baseInsc["CollsCGU"] or baseInsc["Colls"] %}
|
||||||
<tr>
|
<tr>
|
||||||
<td colspan="3" style="text-align: center;"><h3>{{ sbasId | sbas_names(app) }}</h3></td>
|
<td colspan="3" style="text-align: center;"><h3>{{ sbasId | sbas_labels(app) }}</h3></td>
|
||||||
</tr>
|
</tr>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
@@ -27,7 +27,7 @@
|
|||||||
{% set base_id = sbasId |base_from_coll(collId, app) %}
|
{% set base_id = sbasId |base_from_coll(collId, app) %}
|
||||||
<tr>
|
<tr>
|
||||||
<td colspan="3" style="text-align:center;">
|
<td colspan="3" style="text-align:center;">
|
||||||
{% trans "login::register: acces authorise sur la collection " %}{{ sbasId |sbas_names(app) }}
|
{% trans "login::register: acces authorise sur la collection " %}{{ sbasId |sbas_labels(app) }}
|
||||||
{% if isTrue | trim != "" %}
|
{% if isTrue | trim != "" %}
|
||||||
<a class="inscriptlink" href="{{ path('get_tou', {'to_display[]' : sbasId}) }}">{% trans "login::register::CGU: lire les CGU" %}</a>
|
<a class="inscriptlink" href="{{ path('get_tou', {'to_display[]' : sbasId}) }}">{% trans "login::register::CGU: lire les CGU" %}</a>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
@@ -46,7 +46,7 @@
|
|||||||
{% set base_id = sbasId |base_from_coll(collId, app) %}
|
{% set base_id = sbasId |base_from_coll(collId, app) %}
|
||||||
<tr>
|
<tr>
|
||||||
<td colspan="3" style="text-align: center;">
|
<td colspan="3" style="text-align: center;">
|
||||||
<span style="color: red;">{% trans "login::register: acces refuse sur la collection " %}{{ sbasId |sbas_names(app) }}</span>
|
<span style="color: red;">{% trans "login::register: acces refuse sur la collection " %}{{ sbasId |sbas_labels(app) }}</span>
|
||||||
{% if isTrue | trim != "" %}
|
{% if isTrue | trim != "" %}
|
||||||
<a class="inscriptlink" href="{{ path('get_tou', {'to_display[]' : sbasId}) }}">{% trans "login::register::CGU: lire les CGU" %}</a>
|
<a class="inscriptlink" href="{{ path('get_tou', {'to_display[]' : sbasId}) }}">{% trans "login::register::CGU: lire les CGU" %}</a>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
@@ -64,7 +64,7 @@
|
|||||||
{% set base_id = sbasId |base_from_coll(collId, app) %}
|
{% set base_id = sbasId |base_from_coll(collId, app) %}
|
||||||
<tr>
|
<tr>
|
||||||
<td colspan="3" style="text-align: center;">
|
<td colspan="3" style="text-align: center;">
|
||||||
<span style="color: orange;">{% trans "login::register: en attente d\'acces sur" %} {{ sbasId |sbas_names(app) }}</span>
|
<span style="color: orange;">{% trans "login::register: en attente d\'acces sur" %} {{ sbasId |sbas_labels(app) }}</span>
|
||||||
{% if isTrue | trim != "" %}
|
{% if isTrue | trim != "" %}
|
||||||
<a class="inscriptlink" href="{{ path('get_tou', {'to_display[]' : sbasId}) }}">{% trans "login::register::CGU: lire les CGU" %}</a>
|
<a class="inscriptlink" href="{{ path('get_tou', {'to_display[]' : sbasId}) }}">{% trans "login::register::CGU: lire les CGU" %}</a>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
@@ -79,7 +79,7 @@
|
|||||||
{% set base_id = sbasId |base_from_coll(collId, app) %}
|
{% set base_id = sbasId |base_from_coll(collId, app) %}
|
||||||
<tr>
|
<tr>
|
||||||
<td colspan="3" style="text-align: center;">
|
<td colspan="3" style="text-align: center;">
|
||||||
<span>{% trans "login::register: acces temporaire sur" %} {{ sbasId |sbas_names(app) }}</span>
|
<span>{% trans "login::register: acces temporaire sur" %} {{ sbasId |sbas_labels(app) }}</span>
|
||||||
{% if isTrue |trim != "" %}
|
{% if isTrue |trim != "" %}
|
||||||
<a class="inscriptlink" href="{{ path('get_tou', {'to_display[]' : sbasId}) }}">{% trans "login::register::CGU: lire les CGU" %}</a>
|
<a class="inscriptlink" href="{{ path('get_tou', {'to_display[]' : sbasId}) }}">{% trans "login::register::CGU: lire les CGU" %}</a>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
@@ -94,7 +94,7 @@
|
|||||||
{% set base_id = sbasId |base_from_coll(collId, app) %}
|
{% set base_id = sbasId |base_from_coll(collId, app) %}
|
||||||
<tr>
|
<tr>
|
||||||
<td colspan="3" style="text-align: center;">
|
<td colspan="3" style="text-align: center;">
|
||||||
<span style="color:red;">{% trans "login::register: acces temporaire termine sur " %}{{ sbasId |sbas_names(app) }}</span>
|
<span style="color:red;">{% trans "login::register: acces temporaire termine sur " %}{{ sbasId |sbas_labels(app) }}</span>
|
||||||
{% if isTrue |trim != "" %}
|
{% if isTrue |trim != "" %}
|
||||||
<a class="inscriptlink" href="{{ path('get_tou', {'to_display[]' : sbasId}) }}">{% trans "login::register::CGU: lire les CGU" %}</a>
|
<a class="inscriptlink" href="{{ path('get_tou', {'to_display[]' : sbasId}) }}">{% trans "login::register::CGU: lire les CGU" %}</a>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
@@ -109,7 +109,7 @@
|
|||||||
{% set base_id = sbasId |base_from_coll(collId, app) %}
|
{% set base_id = sbasId |base_from_coll(collId, app) %}
|
||||||
<tr>
|
<tr>
|
||||||
<td colspan="3" style="text-align: center;">
|
<td colspan="3" style="text-align: center;">
|
||||||
<span style="color:red;">{% trans "login::register: acces supendu sur" %} {{ sbasId |sbas_names(app) }}</span>
|
<span style="color:red;">{% trans "login::register: acces supendu sur" %} {{ sbasId |sbas_labels(app) }}</span>
|
||||||
{% if isTrue |trim != "" %}
|
{% if isTrue |trim != "" %}
|
||||||
<a class="inscriptlink" href="{{ path('get_tou', {'to_display[]' : sbasId}) }}">{% trans "login::register::CGU: lire les CGU" %}</a>
|
<a class="inscriptlink" href="{{ path('get_tou', {'to_display[]' : sbasId}) }}">{% trans "login::register::CGU: lire les CGU" %}</a>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
@@ -26,7 +26,7 @@
|
|||||||
</tr>
|
</tr>
|
||||||
{% for databox in user.ACL().get_granted_sbas() %}
|
{% for databox in user.ACL().get_granted_sbas() %}
|
||||||
<tr>
|
<tr>
|
||||||
<td colspan="2" style="overflow:hidden;" >{{ databox.get_viewname() }}</td>
|
<td colspan="2" style="overflow:hidden;" >{{ databox.get_label(app['locale.I18n']) }}</td>
|
||||||
</tr>
|
</tr>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
<tr>
|
<tr>
|
||||||
|
@@ -29,7 +29,7 @@
|
|||||||
</li>
|
</li>
|
||||||
|
|
||||||
<li>
|
<li>
|
||||||
{% trans 'admin::base: Alias' %} : <span id="viewname">{{ databox.get_viewname() }}</span>
|
{% trans 'admin::base: Alias' %} : <span id="viewname">{{ databox.get_label(app['locale.I18n']) }}</span>
|
||||||
{% if app['authentication'].getUser().ACL().has_right_on_sbas(databox.get_sbas_id(), "bas_manage") %}
|
{% if app['authentication'].getUser().ACL().has_right_on_sbas(databox.get_sbas_id(), "bas_manage") %}
|
||||||
<img src="/skins/icons/edit_0.gif" id="show-view-name" />
|
<img src="/skins/icons/edit_0.gif" id="show-view-name" />
|
||||||
<div class="well well-small" id="change-view-name" style="display:none;">
|
<div class="well well-small" id="change-view-name" style="display:none;">
|
||||||
@@ -97,6 +97,33 @@
|
|||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class="well well-small action-block">
|
||||||
|
<form class="form-inline" method="post" action="{{ path('admin_databox_labels', { 'databox_id' : databox.get_sbas_id() }) }}" style="margin:0;">
|
||||||
|
<div class="input-append">
|
||||||
|
<div class="row">
|
||||||
|
{% for code, language in app['locales.I18n.available'] %}
|
||||||
|
<div class="span2">
|
||||||
|
<h6>{{ language }}</h6>
|
||||||
|
</div>
|
||||||
|
{% endfor %}
|
||||||
|
</div>
|
||||||
|
<div class="row">
|
||||||
|
{% for code, language in app['locales.I18n.available'] %}
|
||||||
|
<div class="span2">
|
||||||
|
<input name="labels[{{ code }}]" value="{{ databox.get_label(code, false) }}" class="span2" type="text">
|
||||||
|
</div>
|
||||||
|
{% endfor %}
|
||||||
|
<div class="span2">
|
||||||
|
<button class="btn" type="submit">
|
||||||
|
<img src="/skins/icons/edit_0.gif" />
|
||||||
|
{% trans 'Set labels' %}
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="btn-group well well-small">
|
<div class="btn-group well well-small">
|
||||||
|
|
||||||
<form method="post" action="{{ path('admin_database_reindex', {'databox_id': databox.get_sbas_id()}) }}">
|
<form method="post" action="{{ path('admin_database_reindex', {'databox_id': databox.get_sbas_id()}) }}">
|
||||||
|
@@ -203,7 +203,7 @@
|
|||||||
|
|
||||||
<tr>
|
<tr>
|
||||||
<td style="width:122px;overflow:hidden;white-space:nowrap;">
|
<td style="width:122px;overflow:hidden;white-space:nowrap;">
|
||||||
{{rights['sbas_id']|sbas_names(app)}}
|
{{rights['sbas_id']|sbas_labels(app)}}
|
||||||
</td>
|
</td>
|
||||||
<td class="users_col options">
|
<td class="users_col options">
|
||||||
<div>
|
<div>
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
<h1>Masks</h1>
|
<h1>Masks</h1>
|
||||||
<div>
|
<div>
|
||||||
Base {{ collection.get_databox().get_viewname() }}
|
Base {{ collection.get_databox().get_label(app['locale.I18n']) }}
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
Collection {{base_id|bas_labels(app)}}
|
Collection {{base_id|bas_labels(app)}}
|
||||||
|
@@ -38,7 +38,7 @@
|
|||||||
|
|
||||||
<h1>{% trans 'Quotas' %}</h1>
|
<h1>{% trans 'Quotas' %}</h1>
|
||||||
<div>
|
<div>
|
||||||
{% set base = collection.get_databox().get_viewname() %}
|
{% set base = collection.get_databox().get_label(app['locale.I18n']) %}
|
||||||
{% trans %}Base {{base}}{% endtrans %}
|
{% trans %}Base {{base}}{% endtrans %}
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
<h1>{% trans 'Limite temporelle' %}</h1>
|
<h1>{% trans 'Limite temporelle' %}</h1>
|
||||||
<div>
|
<div>
|
||||||
{% set base = collection.get_databox().get_viewname() %}
|
{% set base = collection.get_databox().get_label(app['locale.I18n']) %}
|
||||||
{% trans %}Base {{base}}{% endtrans %}
|
{% trans %}Base {{base}}{% endtrans %}
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
|
@@ -98,7 +98,7 @@
|
|||||||
<select id="edit_pub_base_id" class="input-large" name="base_id" {% if feed.is_public() %}disabled="disabled"{% endif %}>
|
<select id="edit_pub_base_id" class="input-large" name="base_id" {% if feed.is_public() %}disabled="disabled"{% endif %}>
|
||||||
<option value="">{% trans 'Non-Restreinte (publique)' %}</option>
|
<option value="">{% trans 'Non-Restreinte (publique)' %}</option>
|
||||||
{% for databox in app['authentication'].getUser().ACL().get_granted_sbas('bas_chupub') %}
|
{% for databox in app['authentication'].getUser().ACL().get_granted_sbas('bas_chupub') %}
|
||||||
<optgroup label="{{ databox.get_viewname() }}">
|
<optgroup label="{{ databox.get_label(app['locale.I18n']) }}">
|
||||||
{% for collection in databox.get_collections() %}
|
{% for collection in databox.get_collections() %}
|
||||||
<option {% if feed.get_collection() and feed.get_collection().get_base_id() == collection.get_base_id() %}selected="selected"{% endif %} value="{{ collection.get_base_id() }}">{{ collection.get_name() }}</option>
|
<option {% if feed.get_collection() and feed.get_collection().get_base_id() == collection.get_base_id() %}selected="selected"{% endif %} value="{{ collection.get_base_id() }}">{{ collection.get_name() }}</option>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
@@ -22,7 +22,7 @@
|
|||||||
<select id="add_pub_base_id" class="input-large" name="base_id">
|
<select id="add_pub_base_id" class="input-large" name="base_id">
|
||||||
<option value="">{% trans 'Non-Restreinte (publique)' %}</option>
|
<option value="">{% trans 'Non-Restreinte (publique)' %}</option>
|
||||||
{% for databox in app['authentication'].getUser().ACL().get_granted_sbas('bas_chupub') %}
|
{% for databox in app['authentication'].getUser().ACL().get_granted_sbas('bas_chupub') %}
|
||||||
<optgroup label="{{ databox.get_viewname() }}">
|
<optgroup label="{{ databox.get_label(app['locale.I18n']) }}">
|
||||||
{% for collection in databox.get_collections() %}
|
{% for collection in databox.get_collections() %}
|
||||||
<option value="{{ collection.get_base_id() }}">{{ collection.get_name() }}</option>
|
<option value="{{ collection.get_base_id() }}">{{ collection.get_name() }}</option>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
@@ -71,7 +71,7 @@
|
|||||||
</td>
|
</td>
|
||||||
<td valign="center" align="center">
|
<td valign="center" align="center">
|
||||||
{% if feed.get_collection() != null %}
|
{% if feed.get_collection() != null %}
|
||||||
{{ feed.get_collection().get_databox().get_viewname() }} /
|
{{ feed.get_collection().get_databox().get_label(app['locale.I18n']) }} /
|
||||||
{{ feed.get_collection().get_name() }}
|
{{ feed.get_collection().get_name() }}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</td>
|
</td>
|
||||||
|
@@ -98,7 +98,7 @@
|
|||||||
<div style="padding:0 0 2px 0;" class="{% if this_is_selected %}selected{% endif %}">
|
<div style="padding:0 0 2px 0;" class="{% if this_is_selected %}selected{% endif %}">
|
||||||
<a target="right" href="/admin/databox/{{ sbas_id }}/" class="ajax">
|
<a target="right" href="/admin/databox/{{ sbas_id }}/" class="ajax">
|
||||||
<img src="/skins/admin/Database.png"/>
|
<img src="/skins/admin/Database.png"/>
|
||||||
<span>{{ databox.get_viewname() }}</span>
|
<span>{{ databox.get_label(app['locale.I18n']) }}</span>
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
<ul>
|
<ul>
|
||||||
|
@@ -118,8 +118,8 @@
|
|||||||
{% set databox = databoxWrapper['databoxes'] %}
|
{% set databox = databoxWrapper['databoxes'] %}
|
||||||
{% set collections = databoxWrapper['collections'] %}
|
{% set collections = databoxWrapper['collections'] %}
|
||||||
{% if collections|length > 0 %}
|
{% if collections|length > 0 %}
|
||||||
<optgroup label="{{ databox.get_viewname() }}">
|
<optgroup label="{{ databox.get_label(app['locale.I18n']) }}">
|
||||||
<option value="{{ collection|keys|join(';') }}">{{ databox.get_viewname() }}</option>
|
<option value="{{ collection|keys|join(';') }}">{{ databox.get_label(app['locale.I18n']) }}</option>
|
||||||
{% for collId, collection in collections %}
|
{% for collId, collection in collections %}
|
||||||
<option value="{{ collId }}" checked="checked">{{ collection.get_name() }}</option>
|
<option value="{{ collId }}" checked="checked">{{ collection.get_name() }}</option>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
@@ -192,7 +192,7 @@
|
|||||||
<div class="basContTitle">
|
<div class="basContTitle">
|
||||||
<div class="basTitle">
|
<div class="basTitle">
|
||||||
<input class="basChecker checkbox" id="basChecker{{ sbasId }}" type="checkbox" onclick="chkSbas({{ sbasId }},this)" />
|
<input class="basChecker checkbox" id="basChecker{{ sbasId }}" type="checkbox" onclick="chkSbas({{ sbasId }},this)" />
|
||||||
<label for="basChecker{{ sbasId }}">{{ databox.get_viewname() }}</label>
|
<label for="basChecker{{ sbasId }}">{{ databox.get_label(app['locale.I18n']) }}</label>
|
||||||
<img onclick="removeFilters({{ sbasId }});" id="filter_danger{{ sbasId }}" class="filter_danger" src="/skins/icons/alert.png" title="{% trans "client::recherche: cliquez ici pour desactiver tous les filtres de cette base" %}" style="vertical-align:bottom;width:12px;height:12px;display:none;"/>
|
<img onclick="removeFilters({{ sbasId }});" id="filter_danger{{ sbasId }}" class="filter_danger" src="/skins/icons/alert.png" title="{% trans "client::recherche: cliquez ici pour desactiver tous les filtres de cette base" %}" style="vertical-align:bottom;width:12px;height:12px;display:none;"/>
|
||||||
</div>
|
</div>
|
||||||
{% set status_bit_filters = '' %}
|
{% set status_bit_filters = '' %}
|
||||||
|
@@ -3,7 +3,7 @@
|
|||||||
<label>{% trans 'Collection' %}</label>
|
<label>{% trans 'Collection' %}</label>
|
||||||
<select name="base_id">
|
<select name="base_id">
|
||||||
{% for collection in app['authentication'].getUser().ACL().get_granted_base(['canaddrecord']) %}
|
{% for collection in app['authentication'].getUser().ACL().get_granted_base(['canaddrecord']) %}
|
||||||
<option value="{{ collection.get_base_id() }}">{{ collection.get_databox().get_viewname() }} / {{ collection.get_label(app['locale.I18n']) }}</option>
|
<option value="{{ collection.get_base_id() }}">{{ collection.get_databox().get_label(app['locale.I18n']) }} / {{ collection.get_label(app['locale.I18n']) }}</option>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
@@ -46,7 +46,7 @@
|
|||||||
{% for file in list["files"] %}
|
{% for file in list["files"] %}
|
||||||
{% set size = 0 %}
|
{% set size = 0 %}
|
||||||
<tr valign="middle">
|
<tr valign="middle">
|
||||||
<td>{{ app|sbas_from_bas(file['base_id'])|sbas_names(app) }} {{ file['base_id']|bas_labels(app) }}</td>
|
<td>{{ app|sbas_from_bas(file['base_id'])|sbas_labels(app) }} {{ file['base_id']|bas_labels(app) }}</td>
|
||||||
<td>{{ file['original_name'] }}</td>
|
<td>{{ file['original_name'] }}</td>
|
||||||
<td>
|
<td>
|
||||||
{% if file['subdefs'] is iterable and file['subdefs']|length > 0 %}
|
{% if file['subdefs'] is iterable and file['subdefs']|length > 0 %}
|
||||||
|
@@ -43,7 +43,7 @@
|
|||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th colspan="6">
|
<th colspan="6">
|
||||||
{{ databox.get_viewname()|title }}
|
{{ databox.get_label(app['locale.I18n'])|title }}
|
||||||
</th>
|
</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
|
@@ -20,7 +20,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<input name="lst" type="hidden" value="{{ records.serializedList() }}"/>
|
<input name="lst" type="hidden" value="{{ records.serializedList() }}"/>
|
||||||
{% for sbasId,databoxTypes in recordsType %}
|
{% for sbasId,databoxTypes in recordsType %}
|
||||||
<h2 style="text-align:center;" clas="header">{{ sbasId|sbas_names(app) }}</h2>
|
<h2 style="text-align:center;" clas="header">{{ sbasId|sbas_labels(app) }}</h2>
|
||||||
{% for currentType, recordsByType in databoxTypes %}
|
{% for currentType, recordsByType in databoxTypes %}
|
||||||
<ul class="thumbnails" style="margin:20px auto;">
|
<ul class="thumbnails" style="margin:20px auto;">
|
||||||
{% for record in recordsByType %}
|
{% for record in recordsByType %}
|
||||||
|
@@ -245,7 +245,7 @@
|
|||||||
<div id='TH_Ofull'>
|
<div id='TH_Ofull'>
|
||||||
<div class='thesaurus' ondblclick='return(edit_dblclickThesaurus(event));' onclick='return(edit_clickThesaurus(event));'>
|
<div class='thesaurus' ondblclick='return(edit_dblclickThesaurus(event));' onclick='return(edit_clickThesaurus(event));'>
|
||||||
<p id='TH_T.{{ databox.get_sbas_id() }}.T'>
|
<p id='TH_T.{{ databox.get_sbas_id() }}.T'>
|
||||||
<u id='TH_P.{{ databox.get_sbas_id() }}.T'>+</u><a id='GL_W.{{ databox.get_sbas_id() }}.T' style='FONT-WEIGHT: bold;'>{{ databox.get_viewname() }}</a>
|
<u id='TH_P.{{ databox.get_sbas_id() }}.T'>+</u><a id='GL_W.{{ databox.get_sbas_id() }}.T' style='FONT-WEIGHT: bold;'>{{ databox.get_label(app['locale.I18n']) }}</a>
|
||||||
</p>
|
</p>
|
||||||
<div id='TH_K.{{ databox.get_sbas_id() }}.T' class='c'>{% trans 'phraseanet::chargement' %}</div>
|
<div id='TH_K.{{ databox.get_sbas_id() }}.T' class='c'>{% trans 'phraseanet::chargement' %}</div>
|
||||||
</div>
|
</div>
|
||||||
|
@@ -6,7 +6,7 @@
|
|||||||
<input type="hidden" name="reference" value="{{sbas_id}}"/>
|
<input type="hidden" name="reference" value="{{sbas_id}}"/>
|
||||||
<div class="clksbas" style="text-align: center;">
|
<div class="clksbas" style="text-align: center;">
|
||||||
<label class="checkbox" for="sbasChkr_{{sbas_id}}_{{unique_id}}" onclick="clksbas({{sbas_id}}, $('#sbasChkr_{{sbas_id}}_{{unique_id}}')); return false;">
|
<label class="checkbox" for="sbasChkr_{{sbas_id}}_{{unique_id}}" onclick="clksbas({{sbas_id}}, $('#sbasChkr_{{sbas_id}}_{{unique_id}}')); return false;">
|
||||||
<span>{{sbas_id|sbas_names(app)}}</span>
|
<span>{{sbas_id|sbas_labels(app)}}</span>
|
||||||
<span class="infos_sbas_{{sbas_id}}">
|
<span class="infos_sbas_{{sbas_id}}">
|
||||||
{{base["collections"]|length}}/{{base['collections']|length}}
|
{{base["collections"]|length}}/{{base['collections']|length}}
|
||||||
</span>
|
</span>
|
||||||
@@ -215,7 +215,7 @@
|
|||||||
{% if base['thesaurus'] %}
|
{% if base['thesaurus'] %}
|
||||||
<li id="TX_P.{{base['sbas_id']}}.T" class="expandable{% if loop.last %} last{% endif %}">
|
<li id="TX_P.{{base['sbas_id']}}.T" class="expandable{% if loop.last %} last{% endif %}">
|
||||||
<div class="hitarea expandable-hitarea"></div>
|
<div class="hitarea expandable-hitarea"></div>
|
||||||
<span>{{base['sbas_id']|sbas_names(app)}}</span>
|
<span>{{base['sbas_id']|sbas_labels(app)}}</span>
|
||||||
<ul style="display:none">{% trans 'chargement' %}</ul>
|
<ul style="display:none">{% trans 'chargement' %}</ul>
|
||||||
</li>
|
</li>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
@@ -233,7 +233,7 @@
|
|||||||
{% if base['cterms'] %}
|
{% if base['cterms'] %}
|
||||||
<li id="CX_P.{{base['sbas_id']}}.C" class="expandable{% if loop.last %} last{% endif %}">
|
<li id="CX_P.{{base['sbas_id']}}.C" class="expandable{% if loop.last %} last{% endif %}">
|
||||||
<div class="hitarea expandable-hitarea"></div>
|
<div class="hitarea expandable-hitarea"></div>
|
||||||
<span>{{base['sbas_id']|sbas_names(app)}}</span>
|
<span>{{base['sbas_id']|sbas_labels(app)}}</span>
|
||||||
<ul style="display:none">{% trans 'chargement' %}</ul>
|
<ul style="display:none">{% trans 'chargement' %}</ul>
|
||||||
</li>
|
</li>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
@@ -52,7 +52,7 @@
|
|||||||
{% if collections|length > 0 %}
|
{% if collections|length > 0 %}
|
||||||
<select name="base_id" class="span3" style="margin-left: 10px;">
|
<select name="base_id" class="span3" style="margin-left: 10px;">
|
||||||
{% for sbasId, availableCollections in collections %}
|
{% for sbasId, availableCollections in collections %}
|
||||||
<optgroup label="{{ availableCollections['databox'].get_viewname() }}" class="select-label">
|
<optgroup label="{{ availableCollections['databox'].get_label(app['locale.I18n']) }}" class="select-label">
|
||||||
{% for collection in availableCollections['databox_collections'] %}
|
{% for collection in availableCollections['databox_collections'] %}
|
||||||
<option value="{{ collection.get_base_id() }}" class="select-row">{{ collection.get_label(app['locale.I18n']) }}</option>
|
<option value="{{ collection.get_base_id() }}" class="select-row">{{ collection.get_label(app['locale.I18n']) }}</option>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
@@ -57,7 +57,7 @@
|
|||||||
{# collections list #}
|
{# collections list #}
|
||||||
<select name="base_id" class="span3" style="margin-left: 10px;">
|
<select name="base_id" class="span3" style="margin-left: 10px;">
|
||||||
{% for sbasId, availableCollections in collections %}
|
{% for sbasId, availableCollections in collections %}
|
||||||
<optgroup label="{{ availableCollections['databox'].get_viewname() }}" class="select-label">
|
<optgroup label="{{ availableCollections['databox'].get_label(app['locale.I18n']) }}" class="select-label">
|
||||||
{% for collection in availableCollections['databox_collections'] %}
|
{% for collection in availableCollections['databox_collections'] %}
|
||||||
<option value="{{ collection.get_base_id() }}" class="select-row">{{ collection.get_label(app['locale.I18n']) }}</option>
|
<option value="{{ collection.get_base_id() }}" class="select-row">{{ collection.get_label(app['locale.I18n']) }}</option>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
@@ -4,7 +4,7 @@
|
|||||||
<div id="liste_dash" class="center">
|
<div id="liste_dash" class="center">
|
||||||
{% for key in dashboard.authorizedCollection|keys %}
|
{% for key in dashboard.authorizedCollection|keys %}
|
||||||
{% if not loop.first %}
|
{% if not loop.first %}
|
||||||
<em id="em_{{ key }}" >{{ key|sbas_names(app) }}</em>
|
<em id="em_{{ key }}" >{{ key|sbas_labels(app) }}</em>
|
||||||
{% else %}
|
{% else %}
|
||||||
<em id="em_all" class="selected_em" >Toutes les bases</em>
|
<em id="em_all" class="selected_em" >Toutes les bases</em>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
@@ -3,7 +3,7 @@
|
|||||||
<div class="horizontal-scroller">
|
<div class="horizontal-scroller">
|
||||||
<ul class="tabb">
|
<ul class="tabb">
|
||||||
{% for key in selection|keys %}
|
{% for key in selection|keys %}
|
||||||
<li class ="number_{{ key }}"><a href="#tab-{{ key }}-{{ app['request'].get('tbl') }}">{{ key|sbas_names(app)}}</a></li>
|
<li class ="number_{{ key }}"><a href="#tab-{{ key }}-{{ app['request'].get('tbl') }}">{{ key|sbas_labels(app)}}</a></li>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
|
@@ -14,7 +14,7 @@
|
|||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
<tr>
|
<tr>
|
||||||
<th>{% trans "report:: Connexion" %} {{ sbas_id|sbas_names(app) }}</th>
|
<th>{% trans "report:: Connexion" %} {{ sbas_id|sbas_labels(app) }}</th>
|
||||||
{% for key, value in rs %}
|
{% for key, value in rs %}
|
||||||
<td>{{ value }}</td>
|
<td>{{ value }}</td>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
@@ -40,7 +40,7 @@
|
|||||||
{% for key, value in dashboard_array.dashboard.activity_day %}
|
{% for key, value in dashboard_array.dashboard.activity_day %}
|
||||||
{% if loop.index == 1 %}
|
{% if loop.index == 1 %}
|
||||||
<tr>
|
<tr>
|
||||||
<th>{% trans "report:: Connexion" %} {{ key|sbas_names(app)}}</th>
|
<th>{% trans "report:: Connexion" %} {{ key|sbas_labels(app)}}</th>
|
||||||
{% if value|length > 0 %}
|
{% if value|length > 0 %}
|
||||||
{% for k, v in value %}
|
{% for k, v in value %}
|
||||||
<td>{{ v }}</td>
|
<td>{{ v }}</td>
|
||||||
|
@@ -176,6 +176,12 @@ abstract class ApiAbstract extends \PhraseanetWebTestCaseAbstract
|
|||||||
$this->assertTrue(is_array($databox), 'Une databox est un objet');
|
$this->assertTrue(is_array($databox), 'Une databox est un objet');
|
||||||
$this->assertArrayHasKey('databox_id', $databox);
|
$this->assertArrayHasKey('databox_id', $databox);
|
||||||
$this->assertArrayHasKey('name', $databox);
|
$this->assertArrayHasKey('name', $databox);
|
||||||
|
$this->assertArrayHasKey('viewname', $databox);
|
||||||
|
$this->assertArrayHasKey('labels', $databox);
|
||||||
|
$this->assertArrayHasKey('fr', $databox['labels']);
|
||||||
|
$this->assertArrayHasKey('en', $databox['labels']);
|
||||||
|
$this->assertArrayHasKey('de', $databox['labels']);
|
||||||
|
$this->assertArrayHasKey('nl', $databox['labels']);
|
||||||
$this->assertArrayHasKey('version', $databox);
|
$this->assertArrayHasKey('version', $databox);
|
||||||
static::$databoxe_ids[] = $databox['databox_id'];
|
static::$databoxe_ids[] = $databox['databox_id'];
|
||||||
}
|
}
|
||||||
|
@@ -597,8 +597,42 @@ class DataboxTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
|
|||||||
$base->delete();
|
$base->delete();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function testSetLabelsDoesNotWorkIfNotAdmin()
|
||||||
|
{
|
||||||
|
$this->setAdmin(false);
|
||||||
|
$base = self::$DI['record_1']->get_databox();
|
||||||
|
self::$DI['client']->request('POST', '/admin/databox/' . $base->get_sbas_id() . '/labels/');
|
||||||
|
|
||||||
|
$this->assertForbiddenResponse(self::$DI['client']->getResponse());
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testSetLabels()
|
||||||
|
{
|
||||||
|
$this->setAdmin(true);
|
||||||
|
$base = self::$DI['record_1']->get_databox();
|
||||||
|
$this->XMLHTTPRequest('POST', '/admin/databox/' . $base->get_sbas_id() . '/labels/', array(
|
||||||
|
'labels' => array(
|
||||||
|
'fr' => 'frenchy label',
|
||||||
|
'en' => '',
|
||||||
|
'de' => 'Jaja label',
|
||||||
|
'nl' => 'dutch label',
|
||||||
|
)
|
||||||
|
));
|
||||||
|
|
||||||
|
$this->assertEquals(200, self::$DI['client']->getResponse()->getStatusCode());
|
||||||
|
$this->assertEquals('application/json', self::$DI['client']->getResponse()->headers->get('content-type'));
|
||||||
|
|
||||||
|
$data = json_decode(self::$DI['client']->getResponse()->getContent(), true);
|
||||||
|
$this->assertTrue($data['success']);
|
||||||
|
|
||||||
|
$this->assertEquals('frenchy label', $base->get_label('fr', false));
|
||||||
|
$this->assertEquals('', $base->get_label('en', false));
|
||||||
|
$this->assertEquals('Jaja label', $base->get_label('de', false));
|
||||||
|
$this->assertEquals('dutch label', $base->get_label('nl', false));
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @covers \Alchemy\Phrasea\Controller\Admin\Database::emptyDatabase
|
* @covers Alchemy\Phrasea\Controller\Admin\Database::emptyDatabase
|
||||||
*/
|
*/
|
||||||
public function testPostEmptyBaseWithHighRecordAmount()
|
public function testPostEmptyBaseWithHighRecordAmount()
|
||||||
{
|
{
|
||||||
|
@@ -71,4 +71,45 @@ class databoxTest extends PhraseanetWebTestCaseAuthenticatedAbstract
|
|||||||
$databox->unmount_databox();
|
$databox->unmount_databox();
|
||||||
$databox->delete();
|
$databox->delete();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function testViewname()
|
||||||
|
{
|
||||||
|
$databox = self::$DI['record_1']->get_databox();
|
||||||
|
$databox->set_viewname(null);
|
||||||
|
|
||||||
|
$this->assertEquals($databox->get_dbname(), $databox->get_viewname());
|
||||||
|
$databox->set_viewname('cool view name');
|
||||||
|
$this->assertEquals('cool view name', $databox->get_viewname());
|
||||||
|
$databox->set_viewname(null);
|
||||||
|
$this->assertEquals($databox->get_dbname(), $databox->get_viewname());
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testSet_label()
|
||||||
|
{
|
||||||
|
$databox = self::$DI['record_1']->get_databox();
|
||||||
|
|
||||||
|
$databox->set_viewname('pretty name');
|
||||||
|
$databox->set_label('fr', 'french label');
|
||||||
|
$databox->set_label('en', 'english label');
|
||||||
|
$databox->set_label('nl', null);
|
||||||
|
$databox->set_label('de', null);
|
||||||
|
$this->assertEquals('french label', $databox->get_label('fr'));
|
||||||
|
$this->assertEquals('english label', $databox->get_label('en'));
|
||||||
|
$this->assertEquals('pretty name', $databox->get_label('nl'));
|
||||||
|
$this->assertEquals('pretty name', $databox->get_label('de'));
|
||||||
|
$this->assertNull($databox->get_label('nl', false));
|
||||||
|
$this->assertNull($databox->get_label('de', false));
|
||||||
|
|
||||||
|
$databox->set_viewname(null);
|
||||||
|
$databox->set_label('fr', null);
|
||||||
|
$databox->set_label('en', null);
|
||||||
|
$databox->set_label('nl', 'dutch label');
|
||||||
|
$databox->set_label('de', 'german label');
|
||||||
|
$this->assertEquals($databox->get_dbname(), $databox->get_label('fr'));
|
||||||
|
$this->assertEquals($databox->get_dbname(), $databox->get_label('en'));
|
||||||
|
$this->assertEquals('dutch label', $databox->get_label('nl'));
|
||||||
|
$this->assertEquals('german label', $databox->get_label('de'));
|
||||||
|
$this->assertNull($databox->get_label('fr', false));
|
||||||
|
$this->assertNull($databox->get_label('en', false));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user