mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-18 07:23:13 +00:00
Merge remote-tracking branch 'upstream/master' into feature/controller-as-service
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -66,6 +66,7 @@ class Xmlhttp implements ControllerProviderInterface
|
|||||||
$sbas_id = $request->get('sbid');
|
$sbas_id = $request->get('sbid');
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
/** @var \databox $databox */
|
||||||
$databox = $app['phraseanet.appbox']->get_databox($sbas_id);
|
$databox = $app['phraseanet.appbox']->get_databox($sbas_id);
|
||||||
$connbas = $databox->get_connection();
|
$connbas = $databox->get_connection();
|
||||||
|
|
||||||
@@ -125,22 +126,6 @@ class Xmlhttp implements ControllerProviderInterface
|
|||||||
printf("newid=%s<br/>\n", $te->getAttribute("id"));
|
printf("newid=%s<br/>\n", $te->getAttribute("id"));
|
||||||
}
|
}
|
||||||
|
|
||||||
$soldid = str_replace(".", "d", $oldid) . "d";
|
|
||||||
$snewid = str_replace(".", "d", $pid) . "d";
|
|
||||||
$l = strlen($soldid) + 1;
|
|
||||||
|
|
||||||
$sql = "UPDATE thit
|
|
||||||
SET value=CONCAT('$snewid', SUBSTRING(value FROM $l))
|
|
||||||
WHERE value LIKE :like";
|
|
||||||
|
|
||||||
if ($request->get("debug")) {
|
|
||||||
printf("soldid=%s ; snewid=%s<br/>\nsql=%s<br/>\n", $soldid, $snewid, $sql);
|
|
||||||
} else {
|
|
||||||
$stmt = $connbas->prepare($sql);
|
|
||||||
$stmt->execute([':like' => $soldid . '%']);
|
|
||||||
$stmt->closeCursor();
|
|
||||||
}
|
|
||||||
|
|
||||||
$refreshid = $parentnode->getAttribute('id');
|
$refreshid = $parentnode->getAttribute('id');
|
||||||
$refresh['T' . $refreshid] = [
|
$refresh['T' . $refreshid] = [
|
||||||
'type' => 'T',
|
'type' => 'T',
|
||||||
@@ -185,22 +170,6 @@ class Xmlhttp implements ControllerProviderInterface
|
|||||||
printf("newid=%s<br/>\n", $te->getAttribute("id"));
|
printf("newid=%s<br/>\n", $te->getAttribute("id"));
|
||||||
}
|
}
|
||||||
|
|
||||||
$soldid = str_replace(".", "d", $oldid) . "d";
|
|
||||||
$snewid = str_replace(".", "d", $pid) . "d";
|
|
||||||
$l = strlen($soldid) + 1;
|
|
||||||
|
|
||||||
$sql = "UPDATE thit
|
|
||||||
SET value = CONCAT('$snewid', SUBSTRING(value FROM $l))
|
|
||||||
WHERE value LIKE :like";
|
|
||||||
|
|
||||||
if ($request->get("debug")) {
|
|
||||||
printf("soldid=%s ; snewid=%s<br/>\nsql=%s<br/>\n", $soldid, $snewid, $sql);
|
|
||||||
} else {
|
|
||||||
$stmt = $connbas->prepare($sql);
|
|
||||||
$stmt->execute([':like' => $soldid . '%']);
|
|
||||||
$stmt->closeCursor();
|
|
||||||
}
|
|
||||||
|
|
||||||
$thchanged = true;
|
$thchanged = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -237,7 +206,7 @@ class Xmlhttp implements ControllerProviderInterface
|
|||||||
return $app->json($ret);
|
return $app->json($ret);
|
||||||
}
|
}
|
||||||
|
|
||||||
private function renumerate($lang, $node, $id, &$chgids, $depth = 0)
|
private function renumerate($lang, \DOMElement $node, $id, &$chgids, $depth = 0)
|
||||||
{
|
{
|
||||||
$node->setAttribute("id", $id);
|
$node->setAttribute("id", $id);
|
||||||
|
|
||||||
@@ -265,6 +234,7 @@ class Xmlhttp implements ControllerProviderInterface
|
|||||||
return $app->json($json);
|
return $app->json($json);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** @var \databox $databox */
|
||||||
$databox = $app['phraseanet.appbox']->get_databox((int) $sbas_id);
|
$databox = $app['phraseanet.appbox']->get_databox((int) $sbas_id);
|
||||||
|
|
||||||
$dom_thesau = $databox->get_dom_thesaurus();
|
$dom_thesau = $databox->get_dom_thesaurus();
|
||||||
@@ -442,7 +412,7 @@ class Xmlhttp implements ControllerProviderInterface
|
|||||||
], true)));
|
], true)));
|
||||||
|
|
||||||
if (null !== $request->get('bid')) {
|
if (null !== $request->get('bid')) {
|
||||||
|
/** @var \databox $databox */
|
||||||
$databox = $app['phraseanet.appbox']->get_databox((int) $request->get('bid'));
|
$databox = $app['phraseanet.appbox']->get_databox((int) $request->get('bid'));
|
||||||
$dom = $databox->get_dom_thesaurus();
|
$dom = $databox->get_dom_thesaurus();
|
||||||
|
|
||||||
@@ -468,7 +438,7 @@ class Xmlhttp implements ControllerProviderInterface
|
|||||||
if (null === $request->get("bid")) {
|
if (null === $request->get("bid")) {
|
||||||
return new Response('Missing bid parameter', 400);
|
return new Response('Missing bid parameter', 400);
|
||||||
}
|
}
|
||||||
|
/** @var \databox $databox */
|
||||||
$databox = $app['phraseanet.appbox']->get_databox((int) $request->get("bid"));
|
$databox = $app['phraseanet.appbox']->get_databox((int) $request->get("bid"));
|
||||||
$dom = $databox->get_dom_thesaurus();
|
$dom = $databox->get_dom_thesaurus();
|
||||||
|
|
||||||
@@ -614,6 +584,7 @@ class Xmlhttp implements ControllerProviderInterface
|
|||||||
return new Response('Missing bid parameter', 400);
|
return new Response('Missing bid parameter', 400);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** @var \databox $databox */
|
||||||
$databox = $app['phraseanet.appbox']->get_databox((int) $request->get('bid'));
|
$databox = $app['phraseanet.appbox']->get_databox((int) $request->get('bid'));
|
||||||
$dom = $databox->get_dom_thesaurus();
|
$dom = $databox->get_dom_thesaurus();
|
||||||
if (!$dom) {
|
if (!$dom) {
|
||||||
@@ -770,6 +741,7 @@ class Xmlhttp implements ControllerProviderInterface
|
|||||||
$thid = implode('.', $tids);
|
$thid = implode('.', $tids);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
/** @var \databox $databox */
|
||||||
$databox = $app['phraseanet.appbox']->get_databox($sbid);
|
$databox = $app['phraseanet.appbox']->get_databox($sbid);
|
||||||
$connbas = $databox->get_connection();
|
$connbas = $databox->get_connection();
|
||||||
$dbname = \phrasea::sbas_labels($sbid, $app);
|
$dbname = \phrasea::sbas_labels($sbid, $app);
|
||||||
@@ -872,6 +844,7 @@ class Xmlhttp implements ControllerProviderInterface
|
|||||||
$tts = array_reverse($tts);
|
$tts = array_reverse($tts);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** @var \DOMElement[] $ts */
|
||||||
foreach ($tts as $ts) {
|
foreach ($tts as $ts) {
|
||||||
$class = '';
|
$class = '';
|
||||||
if ($ts['nts'] > 0) {
|
if ($ts['nts'] > 0) {
|
||||||
@@ -926,7 +899,7 @@ class Xmlhttp implements ControllerProviderInterface
|
|||||||
], 'html' => $html]);
|
], 'html' => $html]);
|
||||||
}
|
}
|
||||||
|
|
||||||
private function buildBranchLabel($dbname, $language, $n, &$key0, &$nts0)
|
private function buildBranchLabel($dbname, $language, \DOMElement $n, &$key0, &$nts0)
|
||||||
{
|
{
|
||||||
$key0 = null; // key of the sy in the current language
|
$key0 = null; // key of the sy in the current language
|
||||||
// (or key of the first sy if we can't find good lng)
|
// (or key of the first sy if we can't find good lng)
|
||||||
@@ -987,6 +960,7 @@ class Xmlhttp implements ControllerProviderInterface
|
|||||||
|
|
||||||
$html = '';
|
$html = '';
|
||||||
|
|
||||||
|
/** @var \databox $databox */
|
||||||
$databox = $app['phraseanet.appbox']->get_databox((int) $bid);
|
$databox = $app['phraseanet.appbox']->get_databox((int) $bid);
|
||||||
$dom = $databox->get_dom_thesaurus();
|
$dom = $databox->get_dom_thesaurus();
|
||||||
|
|
||||||
@@ -1055,7 +1029,7 @@ class Xmlhttp implements ControllerProviderInterface
|
|||||||
return [$term, $context];
|
return [$term, $context];
|
||||||
}
|
}
|
||||||
|
|
||||||
private function getBranchesHTML($bid, $srcnode, &$html, $depth)
|
private function getBranchesHTML($bid, \DOMElement $srcnode, &$html, $depth)
|
||||||
{
|
{
|
||||||
$tid = $srcnode->getAttribute('id');
|
$tid = $srcnode->getAttribute('id');
|
||||||
$class = 'h';
|
$class = 'h';
|
||||||
@@ -1138,8 +1112,8 @@ class Xmlhttp implements ControllerProviderInterface
|
|||||||
return json_encode($ret);
|
return json_encode($ret);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** @var \databox $databox */
|
||||||
$databox = $app['phraseanet.appbox']->get_databox((int) $bid);
|
$databox = $app['phraseanet.appbox']->get_databox((int) $bid);
|
||||||
$dom = $databox->get_dom_thesaurus();
|
$dom = $databox->get_dom_thesaurus();
|
||||||
|
|
||||||
if (!$dom) {
|
if (!$dom) {
|
||||||
@@ -1216,6 +1190,7 @@ class Xmlhttp implements ControllerProviderInterface
|
|||||||
return new Response('Missing bid parameter', 400);
|
return new Response('Missing bid parameter', 400);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** @var \databox $databox */
|
||||||
$databox = $app['phraseanet.appbox']->get_databox((int) $bid);
|
$databox = $app['phraseanet.appbox']->get_databox((int) $bid);
|
||||||
$dom = $databox->get_dom_thesaurus();
|
$dom = $databox->get_dom_thesaurus();
|
||||||
|
|
||||||
@@ -1226,6 +1201,7 @@ class Xmlhttp implements ControllerProviderInterface
|
|||||||
$xpath = $databox->get_xpath_thesaurus();
|
$xpath = $databox->get_xpath_thesaurus();
|
||||||
$q = '/thesaurus';
|
$q = '/thesaurus';
|
||||||
|
|
||||||
|
$zhtml = '';
|
||||||
if (($znode = $xpath->query($q)->item(0))) {
|
if (($znode = $xpath->query($q)->item(0))) {
|
||||||
$q2 = '//sy';
|
$q2 = '//sy';
|
||||||
if ($request->get('t')) {
|
if ($request->get('t')) {
|
||||||
@@ -1244,10 +1220,8 @@ class Xmlhttp implements ControllerProviderInterface
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$zhtml = '';
|
|
||||||
$this->getBrancheXML($bid, $znode, $zhtml, 0);
|
$this->getBrancheXML($bid, $znode, $zhtml, 0);
|
||||||
} else {
|
} else {
|
||||||
$zhtml = '';
|
|
||||||
for ($i = 0; $i < $nodes->length; $i++) {
|
for ($i = 0; $i < $nodes->length; $i++) {
|
||||||
$n = $nodes->item($i);
|
$n = $nodes->item($i);
|
||||||
$t = $n->getAttribute('v');
|
$t = $n->getAttribute('v');
|
||||||
@@ -1264,7 +1238,7 @@ class Xmlhttp implements ControllerProviderInterface
|
|||||||
return new Response($zhtml, 200, array('Content-Type' => 'text/xml'));
|
return new Response($zhtml, 200, array('Content-Type' => 'text/xml'));
|
||||||
}
|
}
|
||||||
|
|
||||||
private function getBrancheJson($bid, $srcnode, &$ret, $depth)
|
private function getBrancheJson($bid, \DOMElement $srcnode, &$ret, $depth)
|
||||||
{
|
{
|
||||||
$tid = $srcnode->getAttribute('id');
|
$tid = $srcnode->getAttribute('id');
|
||||||
$nts = 0;
|
$nts = 0;
|
||||||
@@ -1301,7 +1275,7 @@ class Xmlhttp implements ControllerProviderInterface
|
|||||||
return $nret;
|
return $nret;
|
||||||
}
|
}
|
||||||
|
|
||||||
private function getBrancheXML($bid, $srcnode, &$html, $depth)
|
private function getBrancheXML($bid, \DOMElement $srcnode, &$html, $depth)
|
||||||
{
|
{
|
||||||
$tid = $srcnode->getAttribute('id');
|
$tid = $srcnode->getAttribute('id');
|
||||||
$class = 'h';
|
$class = 'h';
|
||||||
@@ -1424,9 +1398,9 @@ class Xmlhttp implements ControllerProviderInterface
|
|||||||
$tsbas[$ksbas]['lid'] = "'" . implode("','", $lids) . "'";
|
$tsbas[$ksbas]['lid'] = "'" . implode("','", $lids) . "'";
|
||||||
|
|
||||||
// count records
|
// count records
|
||||||
$sql = 'SELECT DISTINCT record_id AS r
|
$sql = 'SELECT DISTINCT record_id AS r'
|
||||||
FROM thit WHERE value IN (:lids)
|
. ' FROM thit WHERE value IN (:lids)'
|
||||||
ORDER BY record_id';
|
. ' ORDER BY record_id';
|
||||||
$stmt = $connbas->prepare($sql);
|
$stmt = $connbas->prepare($sql);
|
||||||
$stmt->execute(['lids' => $lids]);
|
$stmt->execute(['lids' => $lids]);
|
||||||
$tsbas[$ksbas]['trids'] = $stmt->fetchAll(\PDO::FETCH_COLUMN, 0);
|
$tsbas[$ksbas]['trids'] = $stmt->fetchAll(\PDO::FETCH_COLUMN, 0);
|
||||||
@@ -1441,7 +1415,6 @@ class Xmlhttp implements ControllerProviderInterface
|
|||||||
/* @var $databox databox */
|
/* @var $databox databox */
|
||||||
try {
|
try {
|
||||||
$databox = $appbox->get_databox($sbas['sbas_id']);
|
$databox = $appbox->get_databox($sbas['sbas_id']);
|
||||||
$connbas = $databox->get_connection();
|
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@@ -1471,6 +1444,7 @@ class Xmlhttp implements ControllerProviderInterface
|
|||||||
foreach ($field->get_values() as $v) {
|
foreach ($field->get_values() as $v) {
|
||||||
$keep = true;
|
$keep = true;
|
||||||
$vtxt = $app['unicode']->remove_indexer_chars($v->getValue());
|
$vtxt = $app['unicode']->remove_indexer_chars($v->getValue());
|
||||||
|
/** @var \DOMElement $sy */
|
||||||
foreach ($sbas['tvals'][$fname] as $sy) {
|
foreach ($sbas['tvals'][$fname] as $sy) {
|
||||||
if ($sy->getAttribute('w') == $vtxt) {
|
if ($sy->getAttribute('w') == $vtxt) {
|
||||||
$keep = false;
|
$keep = false;
|
||||||
@@ -1539,6 +1513,7 @@ class Xmlhttp implements ControllerProviderInterface
|
|||||||
$sbid = (int) $request->get('sbid');
|
$sbid = (int) $request->get('sbid');
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
/** @var \databox $databox */
|
||||||
$databox = $app['phraseanet.appbox']->get_databox($sbid);
|
$databox = $app['phraseanet.appbox']->get_databox($sbid);
|
||||||
|
|
||||||
$html = "" . '<LI id="TX_P.' . $sbid . '.T" class="expandable">' . "\n";
|
$html = "" . '<LI id="TX_P.' . $sbid . '.T" class="expandable">' . "\n";
|
||||||
@@ -1546,6 +1521,7 @@ class Xmlhttp implements ControllerProviderInterface
|
|||||||
$html .= "\t" . '<span>' . \phrasea::sbas_labels($sbid, $app) . '</span>' . "\n";
|
$html .= "\t" . '<span>' . \phrasea::sbas_labels($sbid, $app) . '</span>' . "\n";
|
||||||
|
|
||||||
if ($request->get('t')) {
|
if ($request->get('t')) {
|
||||||
|
$dom_struct = null;
|
||||||
if ($request->get('field') != '') {
|
if ($request->get('field') != '') {
|
||||||
$domth = $databox->get_dom_thesaurus();
|
$domth = $databox->get_dom_thesaurus();
|
||||||
$dom_struct = $databox->get_dom_structure();
|
$dom_struct = $databox->get_dom_structure();
|
||||||
@@ -1607,7 +1583,7 @@ class Xmlhttp implements ControllerProviderInterface
|
|||||||
], 'html' => $html]);
|
], 'html' => $html]);
|
||||||
}
|
}
|
||||||
|
|
||||||
private function buildTermLabel($language, $n, &$key0, &$nts0)
|
private function buildTermLabel($language, \DOMElement $n, &$key0, &$nts0)
|
||||||
{
|
{
|
||||||
$lngfound = false; // true when wet met a first synonym in the current language
|
$lngfound = false; // true when wet met a first synonym in the current language
|
||||||
$key0 = null; // key of the sy in the current language (or key of the first sy if we can't find good lng)
|
$key0 = null; // key of the sy in the current language (or key of the first sy if we can't find good lng)
|
||||||
@@ -1649,7 +1625,7 @@ class Xmlhttp implements ControllerProviderInterface
|
|||||||
return $label;
|
return $label;
|
||||||
}
|
}
|
||||||
|
|
||||||
private function getHTMLTerm($sbid, $lng, $srcnode, &$html, $depth = 0)
|
private function getHTMLTerm($sbid, $lng, \DOMElement $srcnode, &$html, $depth = 0)
|
||||||
{
|
{
|
||||||
$tid = $srcnode->getAttribute('id');
|
$tid = $srcnode->getAttribute('id');
|
||||||
|
|
||||||
@@ -1691,6 +1667,7 @@ class Xmlhttp implements ControllerProviderInterface
|
|||||||
} else {
|
} else {
|
||||||
$html .= $tab . '<UL>' . "\n";
|
$html .= $tab . '<UL>' . "\n";
|
||||||
// dump every ts
|
// dump every ts
|
||||||
|
/** @var \DOMElement[] $ts */
|
||||||
foreach ($tts as $ts) {
|
foreach ($tts as $ts) {
|
||||||
$class = '';
|
$class = '';
|
||||||
if ($ts['nts'] > 0) {
|
if ($ts['nts'] > 0) {
|
||||||
|
@@ -0,0 +1,29 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This file is part of Phraseanet
|
||||||
|
*
|
||||||
|
* (c) 2005-2014 Alchemy
|
||||||
|
*
|
||||||
|
* For the full copyright and license information, please view the LICENSE
|
||||||
|
* file that was distributed with this source code.
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace Alchemy\Phrasea\Core\Event\Thesaurus;
|
||||||
|
|
||||||
|
|
||||||
|
class CandidateAccepted extends ThesaurusEvent
|
||||||
|
{
|
||||||
|
private $new_id;
|
||||||
|
|
||||||
|
public function __construct(\databox $databox, $new_id)
|
||||||
|
{
|
||||||
|
parent::__construct($databox);
|
||||||
|
$this->new_id = $new_id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getID()
|
||||||
|
{
|
||||||
|
return $this->new_id;
|
||||||
|
}
|
||||||
|
}
|
36
lib/Alchemy/Phrasea/Core/Event/Thesaurus/ConceptDeleted.php
Normal file
36
lib/Alchemy/Phrasea/Core/Event/Thesaurus/ConceptDeleted.php
Normal file
@@ -0,0 +1,36 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This file is part of Phraseanet
|
||||||
|
*
|
||||||
|
* (c) 2005-2014 Alchemy
|
||||||
|
*
|
||||||
|
* For the full copyright and license information, please view the LICENSE
|
||||||
|
* file that was distributed with this source code.
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace Alchemy\Phrasea\Core\Event\Thesaurus;
|
||||||
|
|
||||||
|
|
||||||
|
class ConceptDeleted extends ThesaurusEvent
|
||||||
|
{
|
||||||
|
private $parent_id; // the former parent
|
||||||
|
private $deleted_synonyms; // the former synonyms (deleted)
|
||||||
|
|
||||||
|
public function __construct(\databox $databox, $parent_id, array $deleted_synonyms)
|
||||||
|
{
|
||||||
|
parent::__construct($databox);
|
||||||
|
$this->parent_id = $parent_id;
|
||||||
|
$this->deleted_synonyms = $deleted_synonyms;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getParentID()
|
||||||
|
{
|
||||||
|
return $this->parent_id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getSynonyms()
|
||||||
|
{
|
||||||
|
return $this->deleted_synonyms;
|
||||||
|
}
|
||||||
|
}
|
17
lib/Alchemy/Phrasea/Core/Event/Thesaurus/FieldLinked.php
Normal file
17
lib/Alchemy/Phrasea/Core/Event/Thesaurus/FieldLinked.php
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This file is part of Phraseanet
|
||||||
|
*
|
||||||
|
* (c) 2005-2014 Alchemy
|
||||||
|
*
|
||||||
|
* For the full copyright and license information, please view the LICENSE
|
||||||
|
* file that was distributed with this source code.
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace Alchemy\Phrasea\Core\Event\Thesaurus;
|
||||||
|
|
||||||
|
|
||||||
|
class FieldLinked extends ThesaurusEvent
|
||||||
|
{
|
||||||
|
}
|
17
lib/Alchemy/Phrasea/Core/Event/Thesaurus/Imported.php
Normal file
17
lib/Alchemy/Phrasea/Core/Event/Thesaurus/Imported.php
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This file is part of Phraseanet
|
||||||
|
*
|
||||||
|
* (c) 2005-2014 Alchemy
|
||||||
|
*
|
||||||
|
* For the full copyright and license information, please view the LICENSE
|
||||||
|
* file that was distributed with this source code.
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace Alchemy\Phrasea\Core\Event\Thesaurus;
|
||||||
|
|
||||||
|
|
||||||
|
class Imported extends ThesaurusEvent
|
||||||
|
{
|
||||||
|
}
|
30
lib/Alchemy/Phrasea/Core/Event/Thesaurus/ItemAdded.php
Normal file
30
lib/Alchemy/Phrasea/Core/Event/Thesaurus/ItemAdded.php
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This file is part of Phraseanet
|
||||||
|
*
|
||||||
|
* (c) 2005-2014 Alchemy
|
||||||
|
*
|
||||||
|
* For the full copyright and license information, please view the LICENSE
|
||||||
|
* file that was distributed with this source code.
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace Alchemy\Phrasea\Core\Event\Thesaurus;
|
||||||
|
|
||||||
|
|
||||||
|
class ItemAdded extends ThesaurusEvent
|
||||||
|
{
|
||||||
|
private $new_id; // the new id
|
||||||
|
|
||||||
|
public function __construct(\databox $databox, $new_id)
|
||||||
|
{
|
||||||
|
parent::__construct($databox);
|
||||||
|
$this->new_id = $new_id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getID()
|
||||||
|
{
|
||||||
|
return $this->new_id;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
36
lib/Alchemy/Phrasea/Core/Event/Thesaurus/ItemTrashed.php
Normal file
36
lib/Alchemy/Phrasea/Core/Event/Thesaurus/ItemTrashed.php
Normal file
@@ -0,0 +1,36 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This file is part of Phraseanet
|
||||||
|
*
|
||||||
|
* (c) 2005-2014 Alchemy
|
||||||
|
*
|
||||||
|
* For the full copyright and license information, please view the LICENSE
|
||||||
|
* file that was distributed with this source code.
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace Alchemy\Phrasea\Core\Event\Thesaurus;
|
||||||
|
|
||||||
|
|
||||||
|
class ItemTrashed extends ThesaurusEvent
|
||||||
|
{
|
||||||
|
private $parent_id; // the former parent
|
||||||
|
private $trash_id; // the new id in cterms
|
||||||
|
|
||||||
|
public function __construct(\databox $databox, $parent_id, $trash_id)
|
||||||
|
{
|
||||||
|
parent::__construct($databox);
|
||||||
|
$this->parent_id = $parent_id;
|
||||||
|
$this->trash_id = $trash_id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getParentID()
|
||||||
|
{
|
||||||
|
return $this->parent_id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getNewID()
|
||||||
|
{
|
||||||
|
return $this->trash_id;
|
||||||
|
}
|
||||||
|
}
|
@@ -0,0 +1,29 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This file is part of Phraseanet
|
||||||
|
*
|
||||||
|
* (c) 2005-2014 Alchemy
|
||||||
|
*
|
||||||
|
* For the full copyright and license information, please view the LICENSE
|
||||||
|
* file that was distributed with this source code.
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace Alchemy\Phrasea\Core\Event\Thesaurus;
|
||||||
|
|
||||||
|
|
||||||
|
class SynonymLngChanged extends ThesaurusEvent
|
||||||
|
{
|
||||||
|
private $synonym_id;
|
||||||
|
|
||||||
|
public function __construct(\databox $databox, $synonym_id)
|
||||||
|
{
|
||||||
|
parent::__construct($databox);
|
||||||
|
$this->synonym_id = $synonym_id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getID()
|
||||||
|
{
|
||||||
|
return $this->synonym_id;
|
||||||
|
}
|
||||||
|
}
|
47
lib/Alchemy/Phrasea/Core/Event/Thesaurus/SynonymParm.php
Normal file
47
lib/Alchemy/Phrasea/Core/Event/Thesaurus/SynonymParm.php
Normal file
@@ -0,0 +1,47 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This file is part of Phraseanet
|
||||||
|
*
|
||||||
|
* (c) 2005-2015 Alchemy
|
||||||
|
*
|
||||||
|
* For the full copyright and license information, please view the LICENSE
|
||||||
|
* file that was distributed with this source code.
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace Alchemy\Phrasea\Core\Event\Thesaurus;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class SynonymParm
|
||||||
|
* @package Alchemy\Phrasea\Core\Event\Thesaurus
|
||||||
|
*
|
||||||
|
* a small object passed as parameter to thesaurus events.
|
||||||
|
* usefull when the synonym does not exists anymore in the thesaurus (after deletion)
|
||||||
|
*/
|
||||||
|
class SynonymParm
|
||||||
|
{
|
||||||
|
private $value; // as the <sy> 'v' attribute in xml
|
||||||
|
private $lng; // the 'lng' attribute
|
||||||
|
|
||||||
|
public function __construct($value, $lng)
|
||||||
|
{
|
||||||
|
$this->value = $value;
|
||||||
|
$this->lng = $lng;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return \string
|
||||||
|
*/
|
||||||
|
public function getValue()
|
||||||
|
{
|
||||||
|
return $this->value;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return \string
|
||||||
|
*/
|
||||||
|
public function getLng()
|
||||||
|
{
|
||||||
|
return $this->lng;
|
||||||
|
}
|
||||||
|
}
|
@@ -0,0 +1,29 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This file is part of Phraseanet
|
||||||
|
*
|
||||||
|
* (c) 2005-2014 Alchemy
|
||||||
|
*
|
||||||
|
* For the full copyright and license information, please view the LICENSE
|
||||||
|
* file that was distributed with this source code.
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace Alchemy\Phrasea\Core\Event\Thesaurus;
|
||||||
|
|
||||||
|
|
||||||
|
class SynonymPositionChanged extends ThesaurusEvent
|
||||||
|
{
|
||||||
|
private $synonym_id;
|
||||||
|
|
||||||
|
public function __construct(\databox $databox, $synonym_id)
|
||||||
|
{
|
||||||
|
parent::__construct($databox);
|
||||||
|
$this->synonym_id = $synonym_id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getID()
|
||||||
|
{
|
||||||
|
return $this->synonym_id;
|
||||||
|
}
|
||||||
|
}
|
32
lib/Alchemy/Phrasea/Core/Event/Thesaurus/ThesaurusEvent.php
Normal file
32
lib/Alchemy/Phrasea/Core/Event/Thesaurus/ThesaurusEvent.php
Normal file
@@ -0,0 +1,32 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This file is part of Phraseanet
|
||||||
|
*
|
||||||
|
* (c) 2005-2015 Alchemy
|
||||||
|
*
|
||||||
|
* For the full copyright and license information, please view the LICENSE
|
||||||
|
* file that was distributed with this source code.
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace Alchemy\Phrasea\Core\Event\Thesaurus;
|
||||||
|
|
||||||
|
use Symfony\Component\EventDispatcher\Event;
|
||||||
|
|
||||||
|
abstract class ThesaurusEvent extends Event
|
||||||
|
{
|
||||||
|
private $databox;
|
||||||
|
|
||||||
|
public function __construct(\databox $databox)
|
||||||
|
{
|
||||||
|
$this->databox = $databox;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return \databox
|
||||||
|
*/
|
||||||
|
public function getDatabox()
|
||||||
|
{
|
||||||
|
return $this->databox;
|
||||||
|
}
|
||||||
|
}
|
@@ -50,4 +50,16 @@ final class PhraseaEvents
|
|||||||
|
|
||||||
const RECORD_EDIT = 'record.edit';
|
const RECORD_EDIT = 'record.edit';
|
||||||
const RECORD_UPLOAD = 'record.upload';
|
const RECORD_UPLOAD = 'record.upload';
|
||||||
|
|
||||||
|
const THESAURUS_IMPORTED = 'thesaurus.imported';
|
||||||
|
const THESAURUS_FIELD_LINKED = 'thesaurus.field-linked';
|
||||||
|
const THESAURUS_CANDIDATE_ACCEPTED_AS_CONCEPT = 'thesaurus.candidate-accepted-as-concept';
|
||||||
|
const THESAURUS_CANDIDATE_ACCEPTED_AS_SYNONYM = 'thesaurus.candidate-accepted-as-synonym';
|
||||||
|
const THESAURUS_SYNONYM_LNG_CHANGED = 'thesaurus.synonym-lng-changed';
|
||||||
|
const THESAURUS_SYNONYM_POSITION_CHANGED = 'thesaurus.synonym-position-changed';
|
||||||
|
const THESAURUS_SYNONYM_TRASHED = 'thesaurus.synonym-trashed';
|
||||||
|
const THESAURUS_CONCEPT_TRASHED = 'thesaurus.concept-trashed';
|
||||||
|
const THESAURUS_CONCEPT_DELETED = 'thesaurus.concept-deleted';
|
||||||
|
const THESAURUS_SYNONYM_ADDED = 'thesaurus.synonym-added';
|
||||||
|
const THESAURUS_CONCEPT_ADDED = 'thesaurus.concept-added';
|
||||||
}
|
}
|
||||||
|
@@ -57,11 +57,7 @@
|
|||||||
{% else %}
|
{% else %}
|
||||||
{% if nb_candidates_bad > 0 %}
|
{% if nb_candidates_bad > 0 %}
|
||||||
// present dans les candidats, mais aucun champ acceptable : on informe
|
// present dans les candidats, mais aucun champ acceptable : on informe
|
||||||
{% if nb_candidates_bad == 1 %}
|
{% set prop_label = 'thesaurus:: est candidat en provenance des champs mais ne peut etre accepte a cet emplacement du thesaurus' | trans %}
|
||||||
{% set prop_label = 'thesaurus:: est candidat en provenance des champs mais ne peut etre accepte a cet emplacement du thesaurus' | trans %}
|
|
||||||
{% else %}
|
|
||||||
{% set prop_label = 'thesaurus:: est candidat en provenance des champs mais ne peut etre accepte a cet emplacement du thesaurus' | trans %}
|
|
||||||
{% endif %}
|
|
||||||
{% else %}
|
{% else %}
|
||||||
// pas present dans les candidats
|
// pas present dans les candidats
|
||||||
{% set prop_label = 'thesaurus:: n\'est pas present dans les candidats' | trans %}
|
{% set prop_label = 'thesaurus:: n\'est pas present dans les candidats' | trans %}
|
||||||
|
@@ -165,7 +165,6 @@
|
|||||||
// gui callback du menu des synonymes
|
// gui callback du menu des synonymes
|
||||||
function cbME_synonym(action, cbParm, menuelem_id)
|
function cbME_synonym(action, cbParm, menuelem_id)
|
||||||
{
|
{
|
||||||
|
|
||||||
if(action == "INIT")
|
if(action == "INIT")
|
||||||
{
|
{
|
||||||
if(nsy <= 1)
|
if(nsy <= 1)
|
||||||
|
@@ -160,7 +160,6 @@
|
|||||||
<a href="javascript:void(0)" class="disabled" id="kcterm_accept">{{ 'thesaurus::menu: accepter' | trans }}</a>
|
<a href="javascript:void(0)" class="disabled" id="kcterm_accept">{{ 'thesaurus::menu: accepter' | trans }}</a>
|
||||||
<div class="line"></div>
|
<div class="line"></div>
|
||||||
<a href="javascript:void(0)" class="" id="kcterm_delete">{{ 'thesaurus::menu: supprimer' | trans }}</a>
|
<a href="javascript:void(0)" class="" id="kcterm_delete">{{ 'thesaurus::menu: supprimer' | trans }}</a>
|
||||||
<a href="javascript:void(0)" class="" id="kcterm_delete0hits">{{ 'thesaurus::menu: supprimer les candidats a 0 hits' | trans }}</a>
|
|
||||||
<div class="line"></div>
|
<div class="line"></div>
|
||||||
<a href="javascript:void(0)" class="" id="kcterm_search">{{ 'thesaurus::menu: chercher' | trans }}</a>
|
<a href="javascript:void(0)" class="" id="kcterm_search">{{ 'thesaurus::menu: chercher' | trans }}</a>
|
||||||
<a href="javascript:void(0)" class="" id="kcterm_export">{{ 'thesaurus::menu: exporter' | trans }}</a>
|
<a href="javascript:void(0)" class="" id="kcterm_export">{{ 'thesaurus::menu: exporter' | trans }}</a>
|
||||||
@@ -375,18 +374,6 @@
|
|||||||
{
|
{
|
||||||
case "TCE_": // racine (STOCK) ou premier niveau (champ ou [trash])
|
case "TCE_": // racine (STOCK) ou premier niveau (champ ou [trash])
|
||||||
// alert(o.id);
|
// alert(o.id);
|
||||||
if(o.id == "TCE_C")
|
|
||||||
{
|
|
||||||
// racine
|
|
||||||
if(om=document.getElementById("kcterm_delete0hits"))
|
|
||||||
om.className = "disabled";
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// premier niveau
|
|
||||||
if(om=document.getElementById("kcterm_delete0hits"))
|
|
||||||
om.className = "";
|
|
||||||
}
|
|
||||||
if(om=document.getElementById("kcterm_reject"))
|
if(om=document.getElementById("kcterm_reject"))
|
||||||
om.className = "disabled";
|
om.className = "disabled";
|
||||||
if(om=document.getElementById("kcterm_accept"))
|
if(om=document.getElementById("kcterm_accept"))
|
||||||
@@ -402,8 +389,6 @@
|
|||||||
break;
|
break;
|
||||||
case "THE_": // terme candidat
|
case "THE_": // terme candidat
|
||||||
// alert("id: "+o.id+" ; p: "+o.parentNode.id);
|
// alert("id: "+o.id+" ; p: "+o.parentNode.id);
|
||||||
if(om=document.getElementById("kcterm_delete0hits"))
|
|
||||||
om.className = "disabled";
|
|
||||||
if(o.id.substr(4, 1)=="R")
|
if(o.id.substr(4, 1)=="R")
|
||||||
{
|
{
|
||||||
if(om=document.getElementById("kcterm_reject"))
|
if(om=document.getElementById("kcterm_reject"))
|
||||||
@@ -511,37 +496,6 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case "kcterm_delete0hits":
|
|
||||||
url = "xmlhttp/searchnohits.x.php";
|
|
||||||
url += "?bid={{ bid }}";
|
|
||||||
url += "&id=" + o.id.substr(4);
|
|
||||||
url += "&typ=CT";
|
|
||||||
|
|
||||||
ret = loadXMLDoc(url, null, true);
|
|
||||||
// alert(ret);
|
|
||||||
n_nohits = ret.documentElement.getAttribute("n_nohits");
|
|
||||||
|
|
||||||
if(n_nohits==0)
|
|
||||||
{
|
|
||||||
alert("{{ 'thesaurus:: Tous les termes ont des hits' | trans | e('js') }}");
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if(confirm("{{ 'thesaurus:: Des termes de cette branche ne renvoient pas de hits. Les supprimer ?' | trans | e('js') }}"));
|
|
||||||
{
|
|
||||||
url = "xmlhttp/deletenohits.x.php";
|
|
||||||
url += "?bid={{ bid }}";
|
|
||||||
url += "&id=" + o.id.substr(4);
|
|
||||||
url += "&typ=CT";
|
|
||||||
|
|
||||||
ret = loadXMLDoc(url, null, true);
|
|
||||||
|
|
||||||
reloadCtermsBranch(o.id.substr(4));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
case "kcterm_reject":
|
case "kcterm_reject":
|
||||||
var myObj = { "win":window };
|
var myObj = { "win":window };
|
||||||
@@ -1434,52 +1388,6 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function reloadbranch2(thb, thid, typ)
|
|
||||||
{
|
|
||||||
new_thb = null;
|
|
||||||
url = "xmlhttp/gethtmlbranch.x.php";
|
|
||||||
parms = "bid={{ bid }}";
|
|
||||||
parms += "&id=" + thid;
|
|
||||||
parms += "&typ=" + typ;
|
|
||||||
|
|
||||||
alert(url + "?" + parms);
|
|
||||||
|
|
||||||
ret = loadXMLDoc(url, parms, true);
|
|
||||||
|
|
||||||
alert(ret);
|
|
||||||
|
|
||||||
ts = ret.getElementsByTagName("html");
|
|
||||||
if(ts.length==1)
|
|
||||||
{
|
|
||||||
/*
|
|
||||||
thb.innerHTML = ts.item(0).firstChild.nodeValue;
|
|
||||||
*/
|
|
||||||
if(document.importNode) // safari ?
|
|
||||||
{
|
|
||||||
thb.innerHTML = "";
|
|
||||||
for(n=ts.item(0).firstChild; n; n=n.nextSibling)
|
|
||||||
docImport(n, thb);
|
|
||||||
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
t = "";
|
|
||||||
for(n=ts.item(0).firstChild; n; n=n.nextSibling)
|
|
||||||
t += n.xml; // marche pas sous safari...
|
|
||||||
// IE fails to recognize <tag/> as a closed tag when using innerHTML, so replace it with <tag></tag>
|
|
||||||
// except for br, img, and hr elements.
|
|
||||||
var expr = new RegExp("<(?:(?!br|img|hr)([a-zA-Z]+))([^>]*)/>", "ig");
|
|
||||||
t = t.replace(expr, "<$1$2></$1>");
|
|
||||||
|
|
||||||
// alert(t);
|
|
||||||
|
|
||||||
thb.innerHTML = t;
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
myGUI.setClickable("T0", cbDD_T0);
|
myGUI.setClickable("T0", cbDD_T0);
|
||||||
|
|
||||||
myGUI.setDraggable("T0", cbDD_T0);
|
myGUI.setDraggable("T0", cbDD_T0);
|
||||||
|
Reference in New Issue
Block a user