Thesaurus refactor

This commit is contained in:
Romain Neutron
2013-02-28 15:49:03 +01:00
parent ff38ac67a4
commit 7343b164c1
64 changed files with 2897 additions and 4766 deletions

View File

@@ -10,7 +10,7 @@ rewrite ^/login/.*$ /index.php last;
rewrite ^/developers/.*$ /index.php last;
rewrite ^/permalink/.*$ /index.php last;
rewrite ^/datafiles/.*$ /index.php last;
rewrite ^/thesaurus2/xmlhttp/.*$ /index.php last;
rewrite ^/thesaurus/$ /index.php last;
rewrite ^/xmlhttp/.*$ /index.php last;
rewrite ^/prod/records/.*$ /index.php last;
rewrite ^/prod/records/edit/.*$ /index.php last;

View File

@@ -661,7 +661,7 @@ class Application extends SilexApplication
$this->mount('/report/informations', new ReportInformations());
$this->mount('/report/export', new ReportExport());
$this->mount('/thesaurus2', new Thesaurus());
$this->mount('/thesaurus', new Thesaurus());
$this->mount('/xmlhttp', new ThesaurusXMLHttp());
}

File diff suppressed because it is too large Load Diff

View File

@@ -24,6 +24,11 @@ class Xmlhttp implements ControllerProviderInterface
{
$controllers = $app['controllers_factory'];
$controllers->before(function() use ($app) {
$app['firewall']->requireAuthentication();
$app['firewall']->requireAccessToModule('thesaurus');
});
$controllers->match('acceptcandidates.j.php', $this->call('AcceptCandidatesJson'));
$controllers->match('checkcandidatetarget.j.php', $this->call('CheckCandidateTargetJson'));
$controllers->match('editing_presets.j.php', $this->call('EditingPresetsJson'));

View File

@@ -68,73 +68,6 @@ class gatekeeper
return $this;
}
/**
* Check the current sub_directory on the domain name
* Redirect if access is denied
*
* @return Void
*/
public function check_directory(Request $request)
{
if (isset($_SERVER['PHP_SELF']) && trim($_SERVER['PHP_SELF'])) {
$this->_PHP_SELF = $_SERVER['PHP_SELF'];
$php_script = explode('/', $_SERVER['PHP_SELF']);
if (trim($php_script[0]) == 0)
array_shift($php_script);
if (count($php_script) > 1)
$this->_directory = $php_script[0];
else
$this->_directory = '';
$this->_script_name = array_pop($php_script);
}
if (!$this->app->isAuthenticated()) {
switch ($this->_directory) {
case 'client':
$this->give_guest_access();
if ($request->isXmlHttpRequest()) {
phrasea::headers(404);
} else {
phrasea::redirect('/login/?redirect=' . $_SERVER['REQUEST_URI']);
}
break;
case 'thesaurus2':
if ($this->_PHP_SELF == '/thesaurus2/xmlhttp/getterm.x.php'
|| $this->_PHP_SELF == '/thesaurus2/xmlhttp/searchcandidate.x.php'
|| $this->_PHP_SELF == '/thesaurus2/xmlhttp/getsy.x.php') {
return;
}
phrasea::redirect('/login/?redirect=/thesaurus2');
break;
case 'report':
phrasea::redirect('/login/?redirect=' . $_SERVER['REQUEST_URI']);
break;
}
} elseif ($_SERVER['PHP_SELF'] === '/login/logout/') {
return;
}
switch ($this->_directory) {
case 'thesaurus2':
if (!$this->app['phraseanet.user']->ACL()->has_access_to_module('thesaurus')) {
phrasea::headers(403);
}
break;
case 'report':
if (!$this->app['phraseanet.user']->ACL()->has_right('report')) {
phrasea::headers(403);
}
break;
default:
break;
}
return;
}
/**
* Redirect to the correct guest location
*

View File

@@ -14,10 +14,10 @@
* @license http://opensource.org/licenses/gpl-3.0 GPLv3
* @link www.phraseanet.com
*/
class patch_th_
class patchthesaurus_100
{
function patch($version, &$domct, &$domth, connection_pdo &$connbas)
public function patch($version, &$domct, &$domth, connection_pdo &$connbas)
{
if ($version == "") {
$th = $domth->documentElement;
@@ -32,7 +32,7 @@ class patch_th_
$th->setAttribute("nextid", $te0->getAttribute("nextid"));
$te = $xp->query("te", $te0);
$te1 = array();
for ($i = 0; $i < $te->length; $i ++ ) {
for ($i = 0; $i < $te->length; $i ++) {
$te1[] = $te->item($i);
}
foreach ($te1 as $tei) {
@@ -52,7 +52,7 @@ class patch_th_
return($version);
}
function fixThesaurus2(&$domth, &$tenode, $depth = 0)
public function fixThesaurus2(&$domth, &$tenode, $depth = 0)
{
$unicode = new unicode();
$sy = $tenode->appendChild($domth->createElement("sy"));
@@ -80,5 +80,3 @@ class patch_th_
}
}
}
?>

View File

@@ -14,10 +14,10 @@
* @license http://opensource.org/licenses/gpl-3.0 GPLv3
* @link www.phraseanet.com
*/
class patch_th_2_0_0
class patchthesaurus_200
{
function patch($version, &$domct, &$domth, connection_pdo &$connbas)
public function patch($version, &$domct, &$domth, connection_pdo &$connbas)
{
if ($version == "2.0.0") {
$th = $domth->documentElement;
@@ -26,7 +26,7 @@ class patch_th_2_0_0
$xp = new DOMXPath($domth);
$te = $xp->query("/thesaurus//te");
for ($i = 0; $i < $te->length; $i ++ ) {
for ($i = 0; $i < $te->length; $i ++) {
$id = $te->item($i)->getAttribute("id");
if ($id[0] >= "0" && $id[0] <= "9")
$te->item($i)->setAttribute("id", "T" . $id);

View File

@@ -14,10 +14,10 @@
* @license http://opensource.org/licenses/gpl-3.0 GPLv3
* @link www.phraseanet.com
*/
class patch_th_2_0_1
class patchthesaurus_201
{
function patch($version, &$domct, &$domth, connection_pdo &$connbas)
public function patch($version, &$domct, &$domth, connection_pdo &$connbas)
{
if ($version == "2.0.1") {
$th = $domth->documentElement;
@@ -25,7 +25,7 @@ class patch_th_2_0_1
$xp = new DOMXPath($domth);
$te = $xp->query("/thesaurus//te");
for ($i = 0; $i < $te->length; $i ++ ) {
for ($i = 0; $i < $te->length; $i ++) {
// $id = "S" . substr($te->item($i)->getAttribute("id"), 1);
$id = $te->item($i)->getAttribute("id");
$nid = (int) ($te->item($i)->getAttribute("nextid"));
@@ -48,7 +48,7 @@ class patch_th_2_0_1
$stmt->closeCursor();
$domct = new DOMDocument();
$domct->load("../thesaurus2/blank_cterms.xml");
$domct->load(__DIR__ . "/../../../lib/conf.d/blank_cterms.xml");
$ct = $domct->documentElement;
$ct->setAttribute("creation_date", $now = date("YmdHis"));
$ct->setAttribute("modification_date", $now);

View File

@@ -14,10 +14,10 @@
* @license http://opensource.org/licenses/gpl-3.0 GPLv3
* @link www.phraseanet.com
*/
class patch_th_2_0_2
class patchthesaurus_202
{
function patch($version, &$domct, &$domth, connection_pdo &$connbas)
public function patch($version, &$domct, &$domth, connection_pdo &$connbas)
{
if ($version == "2.0.2") {
$th = $domth->documentElement;

View File

@@ -14,10 +14,10 @@
* @license http://opensource.org/licenses/gpl-3.0 GPLv3
* @link www.phraseanet.com
*/
class patch_th_2_0_3
class patchthesaurus_203
{
function patch($version, &$domct, &$domth, connection_pdo &$connbas)
public function patch($version, &$domct, &$domth, connection_pdo &$connbas)
{
global $debug;
global $ctchanged, $thchanged, $needreindex;
@@ -26,7 +26,7 @@ class patch_th_2_0_3
if ($version == "2.0.3") {
$xp = new DOMXPath($domth);
$sy = $xp->query("//sy");
for ($i = 0; $i < $sy->length; $i ++ ) {
for ($i = 0; $i < $sy->length; $i ++) {
if (($k = $sy->item($i)->getAttribute("k"))) {
$v = $sy->item($i)->getAttribute("v");
if (strpos($v, "(") === false) {
@@ -78,7 +78,7 @@ class patch_th_2_0_3
}
$sy = $xp->query("//sy");
for ($i = 0; $i < $sy->length; $i ++ ) {
for ($i = 0; $i < $sy->length; $i ++) {
if (($k = $sy->item($i)->getAttribute("k"))) {
if (strpos($v = $sy->item($i)->getAttribute("v"), "(") === false)
$sy->item($i)->setAttribute("v", $v . " (" . $k . ")");
@@ -104,7 +104,7 @@ class patch_th_2_0_3
return($version);
}
function fixRejected(connection_pdo &$connbas, &$node, $rejected)
public function fixRejected(connection_pdo &$connbas, &$node, $rejected)
{
global $debug;
@@ -136,7 +136,7 @@ class patch_th_2_0_3
$this->fixRejected($connbas, $n, $rejected);
}
function fixIds(connection_pdo &$connbas, &$node)
public function fixIds(connection_pdo &$connbas, &$node)
{
global $debug;

View File

@@ -14,10 +14,10 @@
* @license http://opensource.org/licenses/gpl-3.0 GPLv3
* @link www.phraseanet.com
*/
class patch_th_2_0_4
class patchthesaurus_204
{
function patch($version, &$domct, &$domth, connection_pdo &$connbas)
public function patch($version, &$domct, &$domth, connection_pdo &$connbas)
{
global $debug;
global $ctchanged, $thchanged, $needreindex;
@@ -27,7 +27,7 @@ class patch_th_2_0_4
if ($version == "2.0.4") {
$xp = new DOMXPath($domth);
$sy = $xp->query("//sy");
for ($i = 0; $i < $sy->length; $i ++ ) {
for ($i = 0; $i < $sy->length; $i ++) {
if (($k = $sy->item($i)->getAttribute("k"))) {
$v = $sy->item($i)->getAttribute("v");
if (strpos($v, "(") === false) {
@@ -80,7 +80,7 @@ class patch_th_2_0_4
}
$sy = $xp->query("//sy");
for ($i = 0; $i < $sy->length; $i ++ ) {
for ($i = 0; $i < $sy->length; $i ++) {
if (($k = $sy->item($i)->getAttribute("k"))) {
if (strpos($v = $sy->item($i)->getAttribute("v"), "(") === false) {
$sy->item($i)->setAttribute("v", $v . " (" . $k . ")");
@@ -107,7 +107,7 @@ class patch_th_2_0_4
return($version);
}
function fixRejected(connection_pdo &$connbas, &$node, $rejected)
public function fixRejected(connection_pdo &$connbas, &$node, $rejected)
{
global $debug;
@@ -139,7 +139,7 @@ class patch_th_2_0_4
$this->fixRejected($connbas, $n, $rejected);
}
function fixIds(connection_pdo &$connbas, &$node)
public function fixIds(connection_pdo &$connbas, &$node)
{
global $debug;

View File

@@ -35,7 +35,7 @@
{% if app['browser'].isNewGeneration and app['phraseanet.registry'].get('GV_thesaurus') == true and app['phraseanet.user'].ACL.has_access_to_module('thesaurus') %}
<li>
<a target="_blank" href="/thesaurus2/">
<a target="_blank" href="/thesaurus/">
<span class="{% if module == "thesaurus" %}selected{% endif %}">
{% trans 'admin::monitor: module thesaurus' %}
</span>

View File

@@ -0,0 +1,187 @@
{% if dlg %}
{% set opener = "window.dialogArguments.win" %}
{% else %}
{% set opener = "opener" %}
{% endif %}
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html lang="{{ app['locale.I18n'] }}">
<head>
<title>{% trans 'thesaurus:: accepter...' %}</title>
<link REL="stylesheet" TYPE="text/css" HREF="/skins/thesaurus/thesaurus.css" />
<style type="text/css">
.path_separator
{
color:#ffff00;
}
.main_term
{
font-weight:900;
}
</style>
<script type="text/javascript" src="/skins/thesaurus/xmlhttp.js"></script>
<script type="text/javascript">
function loaded()
{
window.name="ACCEPT";
self.focus();
}
function ok()
{
as = "";
if((n=document.forms[0].as.length) > 0)
{
for(i=0; i<n && as==""; i++)
{
if(document.forms[0].as[i].checked)
as = document.forms[0].as[i].value;
}
}
else
{
as = document.forms[0].as.value;
}
if(as == "TS")
{
url = "xmlhttp/acceptcandidates.x.php";
parms = "bid={{ bid | url_encode }}";
parms += "&piv={{ piv | url_encode }}";
parms += "&cid[]={{ src | url_encode }}";
parms += "&pid={{ tgt | url_encode }}";
parms += "&typ=TS";
ret = loadXMLDoc(url, parms, true);
refresh = ret.getElementsByTagName("refresh");
for(i=0; i<refresh.length; i++)
{
switch(refresh.item(i).getAttribute("type"))
{
case "CT":
{{ opener }}.reloadCtermsBranch(refresh.item(i).getAttribute("id"));
break;
case "TH":
{{ opener }}.reloadThesaurusBranch(refresh.item(i).getAttribute("id"));
break;
}
}
self.close();
}
else if(as == "SY")
{
url = "xmlhttp/acceptcandidates.x.php";
parms = "bid={{ bid | url_encode }}";
parms += "&piv={{ piv | url_encode }}";
parms += "&cid[]={{ src | url_encode }}";
parms += "&pid={{ tgt | url_encode }}";
parms += "&typ=SY";
ret = loadXMLDoc(url, parms, true);
refresh = ret.getElementsByTagName("refresh");
for(i=0; i<refresh.length; i++)
{
switch(refresh.item(i).getAttribute("type"))
{
case "CT":
{{ opener }}.reloadCtermsBranch(refresh.item(i).getAttribute("id"));
break;
case "TH":
{{ opener }}.reloadThesaurusBranch(refresh.item(i).getAttribute("id"));
break;
}
}
self.close();
}
}
</script>
</head>
<body id="desktop" onload="loaded();" class="dialog">
{% if not cterm_found %}
<center>
<br/>
<br/>
<br/>
{% trans 'thesaurus:: removed_src' %}
<br/>
<br/>
{% trans 'thesaurus:: refresh' %}
<br/>
<br/>
<br/>
<br/>
<br/>
<input style="position:relative; z-index:2; width:100px" type="button" id="cancel_button" value="{% trans 'boutton::fermer' %}" onclick="self.close();">
{% else %}
{% if not term_found %}
<center>
<br/>
<br/>
<br/>
{% trans 'thesaurus:: removed tgt' %}
<br/>
<br/>
{% trans 'thesaurus:: refresh' %}
<br/>
<br/>
<br/>
<br/>
<br/>
<input style="position:relative; z-index:2; width:100px" type="button" id="cancel_button" value="{% trans 'boutton::fermer' %}" onclick="self.close();">
{% else %}
{% if acceptable %}
<center>
<br/>
<form method="?" action="?" target="?" onsubmit="return(false);">
<input type="hidden" name="bid" value="{{ bid | url_encode }}">
<input type="hidden" name="piv" value="{{ piv | url_encode }}">
<input type="hidden" name="src" value="{{ src | url_encode }}">
<input type="hidden" name="tgt" value="{{ tgt | url_encode }}">
<input type="hidden" name="tgt" value="{{ tgt | url_encode }}">
{% if nts == 0 %}
{% trans 'thesaurus:: Accepter le terme comme' %}
<br/><br/><h4>{{ fullpath_src | raw }}</h4><br/><br/>
<br/>
<input type='radio' name='as' value='TS' checked>{% trans 'thesaurus:: comme terme specifique' %}
<br/><br/>
<input type='radio' name='as' value='SY'>
{% set fullpath_tgt_raw = fullpath_tgt | raw %}
{% trans %}
thesaurus:: comme synonyme de {{ fullpath_tgt_raw }}
{% endtrans %}
<br/>
{% else %}
<br/><br/><h4>{{ fullpath_src | raw }}</h4><br/><br/>
{% trans 'thesaurus:: Accepter la branche comme' %}
&nbsp;{% trans 'thesaurus:: comme terme specifique' %}
<br/><br/><h4>{{ fullpath_tgt | raw }}</h4><br/><br/>
<input type='hidden' name='as' value='TS'>
{% endif %}
<br/>
<br/>
<input style="position:relative; z-index:2; width:100px" type="button" id="ok_button" value="{% trans 'boutton::valider' %}" onclick="ok();">
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<input style="position:relative; z-index:2; width:100px" type="button" id="cancel_button" value="{% trans 'boutton::annuler' %}" onclick="self.close();">
</form>
</center>
{% else %}
<center>
<br/>
<br/>
<br/>
{% trans %}
thesaurus:: A cet emplacement du thesaurus , un candidat du champ {{ cfield }} ne peut etre accepte
{% endtrans %}
<br/>
<br/>
<br/>
<br/>
<br/>
<br/>
<br/>
<input style="position:relative; z-index:2; width:100px" type="button" id="cancel_button" value="{% trans 'boutton::annuler' %}" onclick="self.close();">
{% endif %}
{% endif %}
{% endif %}
</body>
</html>

View File

@@ -0,0 +1,119 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html lang="{{ app['locale.I18n'] }}">
<head>
<title>{% trans 'thesaurus:: export au format texte' %}</title>
<link REL="stylesheet" TYPE="text/css" HREF="/skins/thesaurus/thesaurus.css" />
<script type="text/javascript">
var format = "text";
function clkBut(button)
{
switch(button)
{
case "submit":
document.forms[0].action = "export_" + format + ".php";
document.forms[0].submit();
break;
case "cancel":
self.returnValue = null;
self.close();
break;
}
}
function loaded()
{
chgFormat();
}
function ckis()
{
document.getElementById("submit_button").disabled = document.forms[0].t.value=="";
}
function enable_inputs(o, stat)
{
if(o.nodeType==1) // element
{
if(o.nodeName=='INPUT')
{
if(stat)
o.removeAttribute('disabled');
else
o.setAttribute('disabled', true);
}
for(var oo=o.firstChild; oo; oo=oo.nextSibling)
enable_inputs(oo, stat)
}
}
function chgFormat()
{
var i, f;
url = "./export_"+format+".php?bid={{ bid }}&piv={{ piv }}&id={{ id }}&typ={{ typ }}&dlg=0&smp=1";
url += "&osl=" + (document.forms[0].osl[0].checked ? "1" : "0");
url += "&iln=" + (document.forms[0].iln.checked ? "1" : "0");
url += "&hit=" + (document.forms[0].hit.checked ? "1" : "0");
url += "&ilg=" + (document.forms[0].ilg.checked ? "1" : "0");
document.getElementById("ifrsample").src = url;
}
</script>
</head>
<body onload="loaded();" class="dialog">
<center>
<br/>
<form onsubmit="clkBut('submit');return(false);" action="export_topics.php" target="EXPORT2">
<input type="hidden" name="bid" value="{{ bid }}" >
<input type="hidden" name="piv" value="{{ piv }}" >
<input type="hidden" name="id" value="{{ id }}" >
<input type="hidden" name="typ" value="{{ typ }}" >
<input type="hidden" name="dlg" value="{{ dlg }}" >
<table>
<thead>
<tr>
<th>{% trans 'thesaurus:: options d\'export : ' %}</th>
<th>{% trans 'thesaurus:: example' %}</th>
</tr>
</thead>
<tbody>
<tr>
<td valign="top" style="padding:5px">
<div style="white-space:nowrap">
<input type='radio' name='ofm' checked value='text'>
{% trans 'thesaurus:: export au format texte' %}
</div>
<div id='subform_text' style="margin-left:10px;">
<div style="white-space:nowrap">
<input type='radio' name='osl' checked value='1' onclick="chgFormat();">
{% trans 'thesaurus:: exporter avec les synonymes sur la meme ligne' %}
</div>
<div style="white-space:nowrap">
<input type='radio' name='osl' value='0' onclick="chgFormat();">
{% trans 'thesaurus:: exporter avec une ligne par synonyme' %}
</div>
<div style="white-space:nowrap">
<input type='checkbox' name='iln' value='1' onclick="chgFormat();">
{% trans 'thesaurus:: export : numeroter les lignes ' %}
</div>
<div style="white-space:nowrap">
<input type='checkbox' name='ilg' value='1' onclick="chgFormat();">
{% trans 'thesaurus:: export : inclure la langue' %}
</div>
<div style="white-space:nowrap">
<input type='checkbox' name='hit' value='1' onclick="chgFormat();">
{% trans 'thesaurus:: export : inclure les hits' %}
</div>
</div>
</td>
<td valign="top" style="padding:10px">
<iframe id="ifrsample" frameborder="0" scrolling="No" style="width:400px;height:150px;overflow:hidden;border: 0px solid #b0b0b0; " ></iframe>
</td>
</tr>
</tbody>
</table>
<br/>
<br/>
<input type="button" id="cancel_button" value="{% trans 'boutton::annuler' %}" onclick="clkBut('cancel');" style="width:100px;">
&nbsp;&nbsp;&nbsp;
<input type="button" id="submit_button" value="{% trans 'boutton::valider' %}" onclick="clkBut('submit');" style="width:100px;">
</form>
</center>
</body>
</html>

View File

@@ -0,0 +1,18 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html lang="{{ app['locale.I18n'] }}">
<head>
<title>{% trans 'thesaurus:: export au format texte' %}</title>
<link REL="stylesheet" TYPE="text/css" HREF="/skins/thesaurus/thesaurus.css" />
<script type="text/javascript">
function loaded()
{
self.focus();
}
</script>
</head>
<body id="idbody" onload="loaded();" style="background-color:#ffffff" >
<pre style='font-size: {% if smp %}9{% else %}12{% endif %}px;'>
{{ output }}
</pre>
</body>
</html>

View File

@@ -1,46 +1,8 @@
<?php
/*
* This file is part of Phraseanet
*
* (c) 2005-2013 Alchemy
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
use Alchemy\Phrasea\Application;
/**
*
* @license http://opensource.org/licenses/gpl-3.0 GPLv3
* @link www.phraseanet.com
*/
require_once __DIR__ . "/../../vendor/autoload.php";
phrasea::headers(200, true);
$app = new Application();
$request = http_request::getInstance();
$parm = $request->get_parms(
"bid"
, "piv"
, "id"
, "typ"
, "dlg"
, 'obr' // liste des branches ouvertes
);
if ($parm["dlg"]) {
$opener = "window.dialogArguments.win";
} else {
$opener = "opener";
}
?>
<html lang="<?php echo $app['locale.I18n']; ?>">
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html lang="{{ app['locale.I18n'] }}">
<head>
<title><?php echo p4string::MakeString(_('thesaurus:: export en topics')) ?></title>
<link REL="stylesheet" TYPE="text/css" HREF="./thesaurus.css?u=<?php echo mt_rand() ?>" />
<title>{% trans 'thesaurus:: export en topics' %}</title>
<link REL="stylesheet" TYPE="text/css" HREF="/skins/thesaurus/thesaurus.css" />
<script type="text/javascript">
var format = '???';
function clkBut(button)
@@ -59,7 +21,6 @@ if ($parm["dlg"]) {
}
function loaded()
{
// document.forms[0].t.focus();
chgFormat();
}
function ckis()
@@ -89,13 +50,8 @@ if ($parm["dlg"]) {
f = document.forms[0].ofm[i].value;
if(document.forms[0].ofm[i].checked)
{
// enable_inputs(document.getElementById('subform_'+f), true);
format = f;
}
else
{
// enable_inputs(document.getElementById('subform_'+f), false);
}
}
}
</script>
@@ -103,87 +59,85 @@ if ($parm["dlg"]) {
<body onload="loaded();" class="dialog">
<center>
<form onsubmit="clkBut('submit');return(false);" action="export_topics.php">
<input type="hidden" name="bid" value="<?php echo $parm["bid"] ?>" >
<input type="hidden" name="piv" value="<?php echo $parm["piv"] ?>" >
<input type="hidden" name="id" value="<?php echo $parm["id"] ?>" >
<input type="hidden" name="typ" value="<?php echo $parm["typ"] ?>" >
<input type="hidden" name="dlg" value="<?php echo $parm["dlg"] ?>" >
<input type="hidden" name="obr" value="<?php echo $parm["obr"] ?>" >
<input type="hidden" name="bid" value="{{ bid }}" >
<input type="hidden" name="piv" value="{{ piv }}" >
<input type="hidden" name="id" value="{{ id }}" >
<input type="hidden" name="typ" value="{{ typ }}" >
<input type="hidden" name="dlg" value="{{ dlg }}" >
<input type="hidden" name="obr" value="{{ obr }}" >
<div style="padding:10px;">
<div class="x3Dbox">
<span class="title"><?php echo p4string::MakeString(_('thesaurus:: exporter')) /* export */ ?></span>
<span class="title">{% trans 'thesaurus:: exporter' %}</span>
<div style="white-space:nowrap">
<input type='radio' name='ofm' checked value='tofiles' onclick="chgFormat();">
<?php echo p4string::MakeString(_('thesaurus:: exporter vers topics pour toutes les langues')) /* vers les topics, pour toutes les langues */ ?>
{% trans 'thesaurus:: exporter vers topics pour toutes les langues' %}
</div>
<!--
<div id='subform_tofiles' style="margin-left:10px;">
</div>
-->
<div style="white-space:nowrap">
<input type='radio' name='ofm' value='toscreen' onclick="chgFormat();">
<?php echo p4string::MakeString(_('thesaurus:: exporter a l\'ecran pour la langue _langue_')) . $parm['piv']; ?>
{% trans %}
thesaurus:: exporter a l'ecran pour la langue {{ piv }}
{% endtrans %}
</div>
</div>
<br/>
<div class="x3Dbox">
<span class="title"><?php echo p4string::MakeString(_('phraseanet:: tri')) /* tri */ ?></span>
<span class="title">{% trans 'phraseanet:: tri' %}</span>
<div style="white-space:nowrap">
<input type='checkbox' name='srt' checked onclick="chgFormat();">
<?php echo p4string::MakeString(_('phraseanet:: tri par date')) /* tri */ ?>
{% trans 'phraseanet:: tri par date' %}
</div>
</div>
<br/>
<div class="x3Dbox">
<span class="title"><?php echo p4string::MakeString(_('thesaurus:: recherche')); ?></span>
<span class="title">{% trans 'thesaurus:: recherche' %}</span>
<div style="white-space:nowrap">
<input type='radio' name='sth' value="1" checked onclick="chgFormat();">
<?php echo p4string::MakeString(_('thesaurus:: recherche thesaurus *:"query"')); ?>
{% trans 'thesaurus:: recherche thesaurus *:"query"' %}
</div>
<div style="white-space:nowrap">
<input type='radio' name='sth' value="0" onclick="chgFormat();">
<?php echo p4string::MakeString(_('thesaurus:: recherche fulltext')); /* recherche thesaurus */ ?>
{% trans 'thesaurus:: recherche fulltext' %}
</div>
<div style="white-space:nowrap">
<input type='checkbox' name='sand' onclick="chgFormat();">
<?php echo p4string::MakeString(_('thesaurus:: question complete (avec operateurs)')); /* full query, with 'and's */ ?>
{% trans 'thesaurus:: question complete (avec operateurs)' %}
</div>
</div>
<br/>
<div class="x3Dbox">
<span class="title"><?php echo p4string::MakeString(_('thesaurus:: presentation')) ?></span>
<span class="title">{% trans 'thesaurus:: presentation' %}</span>
<div style="white-space:nowrap">
<input type='radio' name='obrf' value="from_itf_closable" checked onclick="chgFormat();">
<?php echo p4string::MakeString(_('thesaurus:: presentation : branches refermables')) ?>
{% trans 'thesaurus:: presentation : branches refermables' %}
</div>
<div style="white-space:nowrap">
<input type='radio' name='obrf' value="from_itf_static" onclick="chgFormat();">
<?php echo p4string::MakeString(_('thesaurus:: presentation : branche ouvertes')) ?>
{% trans 'thesaurus:: presentation : branche ouvertes' %}
</div>
<div style="white-space:nowrap">
<input type='radio' name='obrf' value="all_opened_closable" onclick="chgFormat();">
<?php echo p4string::MakeString(_('thesaurus:: tout deployer - refermable')) /* Tout dployer (refermable) */ ?>
{% trans 'thesaurus:: tout deployer - refermable' %}
</div>
<div style="white-space:nowrap">
<input type='radio' name='obrf' value="all_opened_static" onclick="chgFormat();">
<?php echo p4string::MakeString(_('thesaurus:: tout deployer - statique')) /* Tout dployer (statique) */ ?>
{% trans 'thesaurus:: tout deployer - statique' %}
</div>
<div style="white-space:nowrap">
<input type='radio' name='obrf' value="all_closed" onclick="chgFormat();">
<?php echo p4string::MakeString(_('thesaurus:: tout fermer')) /* Tout fermer */ ?>
{% trans 'thesaurus:: tout fermer' %}
</div>
</div>
</div>
<input type="button" id="cancel_button" value="<?php echo p4string::MakeString(_('boutton::annuler')) ?>" onclick="clkBut('cancel');" style="width:100px;">
<input type="button" id="cancel_button" value="{% trans 'boutton::annuler' %}" onclick="clkBut('cancel');" style="width:100px;">
&nbsp;&nbsp;&nbsp;
<input type="button" id="submit_button" value="<?php echo p4string::MakeString(_('boutton::valider')) ?>" onclick="clkBut('submit');" style="width:100px;">
<input type="button" id="submit_button" value="{% trans 'boutton::valider' %}" onclick="clkBut('submit');" style="width:100px;">
</form>
</center>
</body>

View File

@@ -0,0 +1,43 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html lang="{{ app['locale.I18n'] }}">
<head>
<title>{% trans 'thesaurus:: export en topics' %}</title>
<link REL="stylesheet" TYPE="text/css" HREF="/skins/thesaurus/thesaurus.css" />
<style>
.toscreen
{
background-color:#ffffff;
}
.tofiles
{
margin: 20px;
}
</style>
<script type="text/javascript">
function loaded()
{
self.focus();
}
</script>
</head>
<body id="idbody" onload="loaded();" class="dialog">
<div class="{{ ofm }}">
{% for lng, export in lngs %}
<pre style='font-size: 12px;'>
{{ export }}
</pre>
{% endfor %}
{% if ofm == 'tofiles' %}
<center>
<br/>
<br/>
<br/>
<input type="button" value="{% trans 'boutton::fermer' %}" onclick="self.close();" style="width:100px;">
</center>
{% endif %}
</div>
</body>
</html>

View File

@@ -0,0 +1,76 @@
{% if dlg is not none %}
{% set opener = "window.dialogArguments.win" %}
{% else %}
{% set opener = "opener" %}
{% endif %}
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html lang="{{ app['locale.I18n'] }}">
<head>
<base target="_self">
<title>{% trans 'thesaurus:: Importer' %}</title>
<link REL="stylesheet" TYPE="text/css" HREF="/skins/thesaurus/thesaurus.css" />
<script type="text/javascript">
function clkBut(button)
{
switch(button)
{
case "submit":
document.forms[0].target='IFRIM';
document.forms[0].submit();
break;
case "cancel":
self.returnValue = null;
self.close();
break;
}
}
function loaded()
{
}
function importDone(err)
{
if(!err)
{
{{ opener }}.reload();
self.close();
}
else
{
alert(err);
}
}
</script>
</head>
<body onload="loaded();" class="dialog">
<br/>
<form onsubmit="clkBut('submit');return(false);" action="import.php" enctype="multipart/form-data" method="post">
<input type="hidden" name="bid" value="{{ bid }}" >
<input type="hidden" name="piv" value="{{ piv }}" >
<input type="hidden" name="id" value="{{ id }}" >
<input type="hidden" name="dlg" value="{{ dlg }}" >
<div>
<div style="float:right">{% trans 'thesaurus:: langue par default' %} <img src='/skins/icons/flag_18.gif' /> {{ piv }}</div>
</div>
<br/>
{% trans 'Fichier ASCII tabule' %}
<input type="file" name="fil" /> (max 16Mo)
<br/>
<div style="text-align:center">
<table>
<tr>
<td style="text-align:left"><input type="checkbox" disabled="disabled" name="dlk" checked="checked">{% trans 'thesaurus:: supprimer les liens des champs tbranch' %}</td>
</tr>
<tr>
<td style="text-align:left"><input type="checkbox" disabled="disabled" name="rdx">{% trans 'thesaurus:: reindexer la base apres l\'import' %}</td>
</tr>
</table>
<br/>
<input type="button" id="cancel_button" value="{% trans 'boutton::annuler' %}" onclick="clkBut('cancel');" style="width:100px;">
&nbsp;&nbsp;&nbsp;
<input type="button" id="submit_button" value="{% trans 'boutton::valider' %}" onclick="clkBut('submit');" style="width:100px;">
</div>
</form>
<iframe style="display:block; height:50px;" name="IFRIM"></iframe>
</body>
</html>

View File

@@ -0,0 +1,5 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html lang="{{ app['locale.I18n'] }}">
<body onload='parent.importDone("{{ err | e('js') }}");'>
</body>
</html>

View File

@@ -0,0 +1,58 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html lang="{{ app['locale.I18n'] }}">
<head>
<meta http-equiv="X-UA-Compatible" content="chrome=1">
<title>{{ app['phraseanet.registry'].get('GV_homeTitle') }} - {% trans 'phraseanet:: thesaurus' %}</title>
<link rel="shortcut icon" type="image/x-icon" href="/skins/thesaurus/favicon.ico">
<link REL="stylesheet" TYPE="text/css" HREF="/skins/thesaurus/thesaurus.css" />
</head>
<body>
<br/>
<br/>
<br/>
<center>
{% set count_bases = bases | length %}
{% if count_bases > 0 %}
<form name="fBase" action="/thesaurus/thesaurus.php" method="post">
{% trans 'thesaurus:: Editer le thesaurus' %}
<select name="bid" onchange="ckok();return(true);">
<option value="">{% trans 'phraseanet:: choisir' %}</option>
{% for sbas_id, name in bases %}
<option value="{{ sbas_id }}">{{ name }}</option>
{% endfor %}
</select>
<br/>
<br/>
<script type="text/javascript">
function ckok()
{
ck = false;
fl = document.getElementsByName("piv");
for(i=0; !ck && i<fl.length; i++)
ck = fl[i].checked;
ck &= document.forms[0].bid.selectedIndex > 0;
document.getElementById("button_ok").disabled = !ck;
}
</script>
<table>
<tr>
<td>{% trans 'thesaurus:: langue pivot' %}</td>
{% for code, language in languages %}
<td style="text-align:left">
<input type='radio' onclick="ckok();return(true);" value='{{ code }}' name='piv'>
<img src='/skins/lng/{{ code }}_flag_18.gif' />( {{ language }} )
</td>
{% endfor %}
</tr>
</table>
<br/>
<br/>
<input disabled="disabled" id="button_ok" type="submit" style="width:80px;" value="{% trans 'boutton::valider' %}" /><br/>
</form>
{% else %}
{% trans 'thesaurus:: Vous n\'avez acces a aucune base' %}
{% endif %}
</center>
</body>
</html>

View File

@@ -0,0 +1,66 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html lang="{{ app['locale.I18n'] }}">
<head>
<title>{% trans 'thesaurus:: Lier la branche de thesaurus au champ' %}</title>
<link REL="stylesheet" TYPE="text/css" HREF="/skins/thesaurus/thesaurus.css" />
<script type="text/javascript">
function ckField()
{
fields = document.getElementsByName("field[]");
changed = false;
for(i=0; i<fields.length && !changed; i++)
{
if( (fields[i].checked?"1":"0") != fields[i].ck0)
changed = true;
}
document.getElementById("submit_button").disabled = !changed;
return(true);
}
function clkBut(button)
{
switch(button)
{
case "submit":
// document.forms[0].target="LINKFIELD";
document.forms[0].submit();
break;
case "cancel":
self.close();
break;
}
}
function loaded()
{
window.name="LINKFIELD";
ckField();
}
</script>
</head>
<body onload="loaded();" class="dialog">
<center>
<form action="linkfield2.php" method="post" target="LINKFIELD">
<input type="hidden" name="piv" value="{{ piv }}">
<input type="hidden" name="bid" value="{{ bid }}">
<input type="hidden" name="tid" value="{{ tid }}">
{% set branch = "<br/><b>" ~ fullBranch ~ "</b><br/>" %}
{% trans %}
thesaurus:: Lier la branche de thesaurus au champ {{ branch }}
{% endtrans %}
<div style="width:70%; height:200px; overflow:scroll;" class="x3Dbox">
{% for fieldname, checked in fieldnames %}
<input type="checkbox" name="field[]" value="{{ fieldname }}" {% if checked %}checked{% endif %} ck0="{% if checked %}1{% else %}0{% endif %}" onclick="return(ckField());">{{ fieldname }}<br/>
{% endfor %}
</div>
<br/>
<input type="button" id="submit_button" value="{% trans 'boutton::valider' %}" onclick="clkBut('submit');">
&nbsp;&nbsp;&nbsp;
<input type="button" id="cancel_button" value="{% trans 'boutton::annuler' %}" onclick="clkBut('cancel');">
</form>
</center>
</body>
</html>

View File

@@ -0,0 +1,79 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html lang="{{ app['locale.I18n'] }}">
<head>
<title>{% trans 'thesaurus:: Lier la branche de thesaurus' %}</title>
<link REL="stylesheet" TYPE="text/css" HREF="/skins/thesaurus/thesaurus.css" />
<script type="text/javascript">
function clkBut(button)
{
switch(button)
{
case "submit":
document.forms[0].submit();
break;
case "cancel":
self.close();
break;
}
}
function loaded()
{
window.name="LINKFIELD";
}
</script>
</head>
<body onload="loaded();" class="dialog">
<center>
<form action="linkfield3.php" method="post" target="LINKFIELD">
<input type="hidden" name="piv" value="{{ piv }}">
<input type="hidden" name="bid" value="{{ bid }}">
<input type="hidden" name="tid" value="{{ tid }}">
<br/>
<br/>
<br/>
<div style="width:70%; height:200px; overflow:scroll;" class="x3Dbox">
{% for fieldname, branches in oldlinks %}
{% if branches['old_branch'] %}
{% set old_branch = branches['old_branch'] %}
<b>{{ fieldname }}</b>
{% trans %}
thesaurus:: Ce champ a ete modifie ; ancienne branche : {{ old_branch }}
{% endtrans %}
<br/>
{% endif %}
{% trans 'thesaurus:: nouvelle branche' %} : {{ branches['new_branch'] }}
<br/>
{% if branches['old_branch'] is not none and '' == branches['new_branch'] %}
<b>{{ fieldname }}</b>{% trans 'thesaurus:: ce champ n\'est plus lie au thesaurus, les termes indexes et candidats seront supprimes' %}
<br/>
<input type="hidden" name="f2unlk[]" value="{{ fieldname }}">
{% endif %}
{% if '' != branches['new_branch'] %}
{% if '' == branches['old_branch'] %}
<b>{{ fieldname }}</b>{% trans 'thesaurus:: ce champ doit etre lie au thesaurus. La reindexation de la base est necessaire' %}
{% else %}
<b>{{ fieldname }}</b>{% trans 'thesaurus:: le lien au thesaurus doit etre modifie, la reindexation de la base est necessaire' %}
{% endif %}
<br/>
<input type="hidden" name="fbranch[]" value="{{fieldname}}<{{ branches['new_branch'] }}"/>
{% endif %}
{% endfor %}
</div>
{% if need_reindex %}
<input type="hidden" name="reindex" value="1">
<div style='position:absolute; top:5px; left:0px; width:100%; text-align:center; color:red'>{% trans 'thesaurus:: reindexation necessaire' %}</div>
{% else %}
<div style='position:absolute; top:5px; left:0px; width:100%; text-align:center; color:green'>{% trans 'thesaurus:: pas de reindexation' %}</div>
{% endif %}
<br/>
<input type="button" id="submit_button" value="{% trans 'boutton::valider' %}" onclick="clkBut('submit');">
&nbsp;&nbsp;&nbsp;
<input type="button" id="cancel_button" value="{% trans 'boutton::annuler' %}" onclick="clkBut('cancel');">
</form>
</center>
</body>
</html>

View File

@@ -0,0 +1,56 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html lang="{{ app['locale.I18n'] }}">
<head>
<title>{% trans 'thesaurus:: Lier la branche de thesaurus' %}</title>
<link REL="stylesheet" TYPE="text/css" HREF="/skins/thesaurus/thesaurus.css" />
</head>
<body class="dialog">
<center>
<br/>
<br/>
<br/>
<form onsubmit="return(false);">
<div style="width:70%; height:200px; overflow:scroll;" class="x3Dbox">
{% for field in field2del %}
{% trans %}
thesaurus:: suppression du lien du champ {{ field }}
{% endtrans %}
<br/>
{% endfor %}
{% for candidate in candidates2del %}
{% set field = candidate2del["field"] %}
{% trans %}
thesaurus:: suppression de la branche de mot candidats pour le champ {{ field }}
{% endtrans %}
<br/>
{% endfor %}
{% for field in branch2del %}
{% trans %}
thesaurus:: suppression de la branche de mot candidats pour le champ {{ field }}
{% endtrans %}
<br/>
{% endfor %}
{% if ctchanged %}
{% trans 'thesaurus:: enregistrement de la liste modifiee des mots candidats.' %}
<br/>
{% endif %}
{% for field in field2del %}
{% trans %}
thesaurus:: suppression des indexes vers le thesaurus pour le champ {{ field }}
{% endtrans %}
<br/>
{% endfor %}
{% if reindexed %}
{% trans 'thesaurus:: reindexer tous les enregistrements' %}
<br/>
{% endif %}
</div>
<br/>
<input type="button" value="{% trans 'boutton::fermer' %}" onclick="self.close();">
</form>
</center>
</body>
</html>

View File

@@ -0,0 +1,43 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<script language="javascript">
{% if updated %}
alert('{{ 'thesaurus has been updated' | trans | e('js') }}');
{% endif %}
{% if valid_thesaurus %}
parent.currentBaseId = {{ bid }};
parent.currentBaseName = "{{ name | e('js') }}";
parent.document.title = "{{ 'phraseanet:: thesaurus' | trans | e('js') }}";
parent.document.getElementById("baseName").innerHTML = "{{ 'phraseanet:: thesaurus' | e('js') }}";
parent.thesaurusChanged = false;
parent.document.getElementById("T0").innerHTML='<DIV class="glossaire" id="CTERMS">' +
'' +
'<div id="TCE_C" class="s_" style="font-weight:900"><u id="THP_C">-</u>{{ name }}</div>' +
'<div id="THB_C" class="OB">' +
{% for cterm in cterms %}
'<div id="TCE_{{ cterm['id'] }}" class="s_"><u id="THP_{{ cterm['id'] }}">+</u>{{ cterm['field'] }}</div>' +
'<div id="THB_{{ cterm['id'] }}" class="ob">' +
'</div>'+
{% endfor %}
'</div></DIV>';
parent.document.getElementById("T1").innerHTML = '<DIV class="glossaire">' +
'<div id="THE_T" class="s_" style="font-weight:900"><u id="THP_T">+</u>{{ name }}</div>' +
'<div id="THB_T" class="ob">' +
'</div>' +
'</DIV>';
{% else %}
if(confirm("{{ "Thesaurus ou CTerms invalide\n effacer (OK) ou quitter (Annuler) ?" | trans | e('js') }}"))
{
parent.document.forms['fBase'].repair.value = "on";
parent.document.forms['fBase'].submit();
}
else
{
parent.window.close();
}
{% endif %}
</script>

View File

@@ -0,0 +1,86 @@
{% if 'TS' == typ %}
{% set title = 'thesaurus:: Nouveau terme' | trans %}
{% set label = 'thesaurus:: terme' | trans %}
{% elseif 'SY' == typ %}
{% set title = 'thesaurus:: Nouveau synonyme' | trans %}
{% set label = 'thesaurus:: synonyme' | trans %}
{% else %}
{% set title = '' %}
{% set label = '' %}
{% endif %}
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html lang="{{ app['locale.I18n'] }}">
<head>
<title>{{ title }}</title>
<link REL="stylesheet" TYPE="text/css" HREF="/skins/thesaurus/thesaurus.css" />
<script type="text/javascript">
self.returValue = null;
function clkBut(button)
{
switch(button)
{
case "submit":
t = document.forms[0].term.value;
k = document.forms[0].context.value;
if(k != "")
t += " ("+k+")";
self.returnValue = {"t":t, "lng":null };
for(i=0; i<(n=document.getElementsByName("lng")).length; i++)
{
if(n[i].checked)
{
self.returnValue.lng = n[i].value;
break;
}
}
self.close();
break;
case "cancel":
self.close();
break;
}
}
</script>
</head>
<body class="dialog" onload="self.document.forms[0].term.focus();">
<br/>
<form onsubmit="return(false);">
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td style="text-align:right; width:80px;">{{ label }} :&nbsp;</td>
<td></td>
<td><input type="text" style="width:250px;" name="term"></td>
</tr>
<tr>
<td style="text-align:right">{% trans 'thesaurus:: contexte' %} : </td>
<td><b>(</b>&nbsp;</td>
<td><input type="text" style="width:250px;" name="context">&nbsp;<b>)</b></td>
</tr>
<tr>
<td valign="bottom" style="text-align:right">{% trans 'phraseanet:: language' %} :&nbsp;</td>
<td></td>
<td valign="bottom">
{% for code, language in languages %}
<span style="display:inline-block">
<input type="radio" {% if code == piv %}checked{% endif %} name="lng" value="{{ code }}" id="lng_{{ code }}">
<label for="lng_{{ code }}"><img src="/skins/lng/{{ code }}_flag_18.gif" />({{ language }})</label>
</span>
&nbsp;&nbsp;
{% endfor %}
</td>
</tr>
</table>
<br/>
<div style="position:absolute; left:0px; bottom:0px; width:100%; text-align:center">
<input type="button" style="width:80px;" id="cancel_button" value="{% trans 'boutton::annuler' %}" onclick="clkBut('cancel');" style="width:80px">
&nbsp;&nbsp;
<input type="button" style="width:80px;" id="submit_button" value="{% trans 'boutton::valider' %}" onclick="clkBut('submit');" style="width:80px">
<br/>
<br/>
</div>
</form>
</body>
</html>

View File

@@ -0,0 +1,205 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html lang="{{ app['locale.I18n'] }}">
<head>
<title>{% if typ == "TS" %}{% trans 'thesaurus:: Nouveau terme specifique' %}{% else %}{% trans 'thesaurus:: Nouveau synonyme' %}{% endif %}</title>
<link REL="stylesheet" TYPE="text/css" HREF="/skins/thesaurus/thesaurus.css" />
<script type="text/javascript" src="/skins//thesaurus/xmlhttp.js"></script>
</head>
<body onload="loaded();" class="dialog" style="text-align:center">
{% if dlg is not none %}
{% set opener = 'window.dialogArguments.win' %}
{% else %}
{% set opener = 'opener' %}
{% endif %}
{% if context is not none %}
{% set zterm %}
{% trans %}
thesaurus:: le terme {{ term }} avec contexte {{ context }}
{% endtrans %}
{% endset %}
{% else %}
{% set zterm %}
{% trans %}
thesaurus:: le terme {{ term }} sans contexte
{% endtrans %}
{% endset %}
{% endif %}
{% if nb_candidates_ok > 0 %}
{% if nb_candidates_ok == 1 %}
{% set prop_label = 'thesaurus:: est deja candidat en provenance du champ acceptable : ' | trans %}
{% else %}
{% set prop_label = 'thesaurus:: est deja candidat en provenance des champs acceptables : ' | trans %}
{% endif %}
<br/>
<br/>
{{ zterm }}
<br/>
<br/>
{{ prop_label }}
<br/>
<center>
<form onsubmit="return(false);">
<input type="hidden" name="bid" value="{{ bid }} ">
<input type="hidden" name="pid" value="{{ pid }}">
<div class='x3Dbox' style='margin:15px; height:100px; overflow:auto;'>
{% for candidate in candidates %}
<input type="radio" name="cid" value="{{ candidate['id'] }}" onclick="return(clkCid());">{{ candidate['field'] }}<br/>
{% endfor %}
</div>
{% if nb_candidates_ok > 1 %}
{{ 'thesaurus:: selectionner la provenance a accepter' | trans }}
{% endif %}
<br/>
<input type="button" id="cancel_button" value="{% trans 'boutton::annuler' %}" onclick="clkBut('cancel');" style="width:100px;">
&nbsp;&nbsp;&nbsp;
<input type="button" id="submit_button" value="{% trans 'boutton::valider' %}" onclick="clkBut('submit');" style="width:100px;">
</form>
</center>
{% else %}
{% if nb_candidates_bad > 0 %}
// 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 %}
{% else %}
{% set prop_label = 'thesaurus:: est candidat en provenance des champs mais ne peut etre accepte a cet emplacement du thesaurus' | trans %}
{% endif %}
{% else %}
// pas present dans les candidats
{% set prop_label = 'thesaurus:: n\'est pas present dans les candidats' | trans %}
{% endif %}
<br/>
<h3>{% trans 'thesaurus:: attention :' %}</h3>
<br/>
<br/>
{{ zterm }}
<br/>
<br/>
{{ prop_label }}
<br/>
<form>
<center>
<div class='x3Dbox' style='margin:15px; height:90px; overflow:auto;'>
<input type="radio" name="reindex" value="0" id="rad0" checked><label for="rad0">{% trans 'thesaurus:: Ajouter le terme dans reindexer' %}</label><br/>
<br/>
<input type="radio" name="reindex" value="1" id="rad1"><label for="rad1">{% trans 'thesaurus:: ajouter le terme et reindexer' %}</label><br/>
</div>
</center>
<input type="button" id="cancel_button" value="{% trans 'boutton::annuler' %}" onclick="clkBut('cancel');" style="width:100px;">
&nbsp;&nbsp;&nbsp;
<input type="button" id="submit_button" value="{% trans 'boutton::valider' %}" onclick="clkBut('submit');" style="width:100px;">
</form>
{% endif %}
</body>
<script type="text/javascript">
{% if nb_candidates_ok > 0 %}
function clkCid()
{
cids = document.getElementsByName("cid");
f = false;
for(i=0; i<cids.length && !f; i++)
{
if(cids[i].checked)
f = true;
}
document.getElementById("submit_button").disabled = !f;
return(true);
}
function clkBut(button)
{
switch(button)
{
case "submit":
url = "xmlhttp/acceptcandidates.x.php";
parms = "bid={{ bid }}";
parms += "&pid={{ pid }}";
parms += "&typ={{ typ }}";
for(i=0; i<(n=document.getElementsByName("cid")).length; i++)
{
if(n[i].checked)
parms += "&cid[]=" + encodeURIComponent(n[i].value);
}
ret = loadXMLDoc(url, parms, true);
refresh = ret.getElementsByTagName("refresh");
for(i=0; i<refresh.length; i++)
{
switch(refresh.item(i).getAttribute("type"))
{
case "CT":
{{ opener }}.reloadCtermsBranch(refresh.item(i).getAttribute("id"));
break;
case "TH":
{{ opener }}.reloadThesaurusBranch(refresh.item(i).getAttribute("id"));
break;
}
}
self.close();
break;
case "cancel":
self.close();
break;
}
}
{% else %}
function clkCid()
{}
function clkBut(button)
{
switch(button)
{
case "submit":
{% if typ == "TS" %}
url = "xmlhttp/newts.x.php";
{% else %}
url = "xmlhttp/newsy.x.php";
{% endif %}
parms = "bid={{ bid }}";
parms += "&piv={{ piv }}";
parms += "&pid={{ pid }}";
parms += "&t={{ term | url_encode }}";
{% if context is not none %}
parms += "&k={{ context | url_encode }}";
{% endif %}
parms += "&sylng={{ sylng }}";
for(i=0; i<(n=document.getElementsByName("reindex")).length; i++)
{
if(n[i].checked)
{
parms += "&reindex=" + encodeURIComponent(n[i].value);
break;
}
}
ret = loadXMLDoc(url, parms, true);
refresh = ret.getElementsByTagName("refresh");
for(i=0; i<refresh.length; i++)
{
switch(refresh.item(i).getAttribute("type"))
{
case "CT":
{{ opener }}.reloadCtermsBranch(refresh.item(i).getAttribute("id"));
break;
case "TH":
{{ opener }}.reloadThesaurusBranch(refresh.item(i).getAttribute("id"));
break;
}
}
self.close();
break;
case "cancel":
self.close();
break;
}
}
{% endif %}
function loaded()
{
clkCid();
self.focus();
}
</script>
</html>

View File

@@ -0,0 +1,427 @@
{% if dlg is not none %}
{% set opener = "window.dialogArguments.win" %}
{% else %}
{% set opener = "opener" %}
{% endif %}
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html lang="{{ app['locale.I18n'] }}">
<head>
<title>{% trans 'thesaurus:: Proprietes' %}</title>
<link REL="stylesheet" TYPE="text/css" HREF="/skins/thesaurus/thesaurus.css" />
<style type="text/css">
a
{
text-decoration:none;
font-size: 10px;
}
.path_separator
{
color:#ffff00;
}
.main_term
{
font-weight:900;
}
</style>
<script type="text/javascript" src="/skins/thesaurus/win.js"></script>
<script type="text/javascript" src="/skins/thesaurus/xmlhttp.js"></script>
<script type="text/javascript" src="/include/minify/f=include/jslibs/jquery-1.7.1.js,include/jslibs/jquery.sprintf.1.0.3.js"></script>
<script type="text/javascript" src="/skins/thesaurus/sprintf.js"></script>
<script type="text/javascript">
function loaded()
{
window.name="PROPERTIES";
self.focus();
}
</script>
</head>
<body id="desktop" onload="loaded();" class="dialog">
<div class="menu" id="flagsMenu" style="z-index:50">
{% for code, language in languages %}
<a id='flagMenu_{{ code }}' href='javascript:void(0)' class=''>
<img src='/skins/lng/{{ code }}_flag_18.gif' />{{ language }}</a>
{% endfor %}
</div>
<div class="menu" id="syMenu" style="z-index:50">
<a href="javascript:void(0)" id="delete_sy">{% trans 'thesaurus::menu: supprimer' %}</a>
<a href="javascript:void(0)" id="replace_sy" class="disabled">{% trans 'thesaurus:: remplacer' %}</a>
</div>
<div style='text-align:right'>
<b>id:</b>&nbsp;{{ id }}
</div>
<H4>{{ fullpath | raw }}</H4><br/>
{% if typ == "CT" %}
<br/>
{% elseif typ == "TH" %}
{% trans %}
thesaurus:: {{ hits }} reponses retournees
{% endtrans %}
<br/>
<br/>
{% endif %}
<div id="TSY" class="tableContainer" style="margin:10px; position:relative; top:0px; left:0px">
<div>
<table border="0" cellpadding="0" cellspacing="0" style="width:100%; ">
<col style="width:40px;" />
<col style="width:30px;" />
<col style="width:auto;" />
<col style="width:40px;" />
<col style="width:140px;" />
<col style="width:14px;" />
<thead>
<tr>
<th>&nbsp;</th>
<th>&nbsp;</th>
<th>{% trans 'thesaurus:: synonymes' %}</th>
<th>{% trans 'thesaurus:: hits' %}</th>
<th>{% trans 'thesaurus:: ids' %}</th>
<th></th>
</tr>
</thead>
</table>
</div>
<div style="position:relative; height:150px; overflow:scroll">
<div style="position:relative; height:150px; ">
<table border="0" cellpadding="0" cellspacing="0" style="width:100%;">
<col style="width:40px;" />
<col style="width:30px;" />
<col style="width:auto;" />
<col style="width:40px;" />
<col style="width:140px;" />
<tbody id="LSY" style="">
{% for data in synonyms %}
<tr class='s_' id='SYN_{{ data['id'] }}' hits='{{ data['hits'] }}'>
<td style='text-align:center;'>
{% if loop.index > 0 %}
<img id="BTNU_{{ data['id'] }}" src="/skins/thesaurus/images/up.gif" />
{% endif %}
{% if not loop.last %}
<img id="BTND_{{ data['id'] }}" src="/skins/thesaurus/images/down.gif" />
{% endif %}
</td>
{% if data['lng'] %}
<td id='FLG_{{ data['id'] }}'><img src='/skins/lng/{{ data['lng'] }}_flag_18.gif' /></td>
{% else %}
<td id='FLG_{{ data['id'] }}'><img src='/skins/thesaurus/images/noflag.gif' /></td>
{% endif %}
<td>{{ data['t'] }}</td>
<td>{{ data['hits'] }}</td>
<td>{{ data['id'] }}</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
</div>
</div>
<center>
<form onsubmit="return(false);">
<input style="position:relative; z-index:2" type="button" id="close_button" value="{% trans 'boutton::fermer' %}" onclick="self.close();">
</form>
</center>
<script type="text/javascript">
// gui callback du menu des drapeaux
var nsy = {{ synonyms | length }};
function cbME_flags(action, cbParm, menuelem_id)
{
if(action != "SELECT" || !menuelem_id) {
return;
}
lng = menuelem_id.substr(9,2);
url = "xmlhttp/changesylng.x.php";
parms = "bid={{ bid | url_encode }}";
parms += "&typ={{ typ | url_encode }}";
parms += "&piv={{ piv | url_encode }}";
parms += "&id=" + cbParm.id.substr(4);
parms += "&newlng=" + encodeURIComponent(lng);
ret = loadXMLDoc(url, parms, true);
sy_list = ret.getElementsByTagName("sy_list").item(0);
refresh_sy(sy_list);
refresh = ret.getElementsByTagName("refresh");
for(i=0; i<refresh.length; i++)
{
switch(refresh.item(i).getAttribute("type"))
{
case "CT":
{{ opener }}.reloadCtermsBranch(refresh.item(i).getAttribute("id"));
{{ opener }}.myGUI.select({{ opener }}.document.getElementById("THE_{{ id }}"));
break;
case "TH":
{{ opener }}.reloadThesaurusBranch(refresh.item(i).getAttribute("id"));
{{ opener }}.myGUI.select({{ opener }}.document.getElementById("THE_{{ id }}"));
break;
}
}
}
// gui callback du menu des synonymes
function cbME_synonym(action, cbParm, menuelem_id)
{
if(action == "INIT")
{
if(nsy <= 1)
{
// pas d'action possible s'il ne reste qu'un seul synonyme
// alert(nsy);
document.getElementById("delete_sy").className = "disabled";
// document.getElementById("reject_sy").className = "disabled";
}
else
{
if(cbParm && cbParm.hits > 0)
{
// y'a des hits, on peut pas supprimer
// document.getElementById("reject_sy").className = "";
document.getElementById("delete_sy").className = "";
}
else
{
// pas de hits : on peut supprimer
// document.getElementById("reject_sy").className = "";
document.getElementById("delete_sy").className = "";
}
}
// si on ne connait pas encore le client mais que start est ouvert, on lui demande
// if(!opener.wClient && opener.opener.wClient)
// opener.wClient = opener.opener.wClient;
// si on connait le client et qu'on peut s'en servir pour chercher, on active l'option dans le menu
// if(opener.wClient && opener.wClient.externQuery)
// document.getElementById("searchcli_sy").className = "";
// else
// document.getElementById("searchcli_sy").className = "disabled";
return;
}
if(action != "SELECT" || !menuelem_id) {
return; // pas d'option de menu : on est sorti du menu sans cliquer
}
switch(menuelem_id)
{
case "delete_sy": // cbParm = objet 'TR'
url = "xmlhttp/getsy.x.php";
url += "?bid={{ bid | url_encode }}";
url += "&id=" + cbParm.id.substr(4);
url += "&typ={{ typ | url_encode }}";
ret = loadXMLDoc(url, null, true);
// alert(ret);
fullpath = ret.getElementsByTagName("fullpath").item(0).firstChild.nodeValue;
//alert("delete : cbParm.obj={id:'" + cbParm.id + "'} ; menuelem_id='" + menuelem_id + "'");
url = "xmlhttp/delsy.x.php";
parms = "bid={{ bid | url_encode }}";
parms += "&piv={{ piv | url_encode }}";
parms += "&typ={{ typ | url_encode }}";
parms += "&id=" + cbParm.id.substr(4);
if(confirm($.sprintf("{{ 'thesaurus:: Confirmer la suppression du terme %s' | trans | e('js') }}","\n\n"+fullpath+"\n\n")))
{
ret = loadXMLDoc(url, parms, true);
sy_list = ret.getElementsByTagName("sy_list").item(0);
refresh_sy(sy_list);
refresh = ret.getElementsByTagName("refresh");
for(i=0; i<refresh.length; i++)
{
switch(refresh.item(i).getAttribute("type"))
{
case "CT":
{{ opener }}.reloadCtermsBranch(refresh.item(i).getAttribute("id"));
{{ opener }}.myGUI.select({{ opener }}.document.getElementById("THE_{{ id }}"));
break;
case "TH":
{{ opener }}.reloadThesaurusBranch(refresh.item(i).getAttribute("id"));
{{ opener }}.myGUI.select({{ opener }}.document.getElementById("THE_{{ id }}"));
break;
}
}
}
break;
case "searchcli_sy": // cbParm = objet 'TR'
url = "xmlhttp/getsy.x.php";
url += "?bid={{ bid | url_encode }}";
url += "&id=" + cbParm.id.substr(4);
url += "&typ={{ typ | url_encode }}";
ret = loadXMLDoc(url, null, true);
t = ret.getElementsByTagName("sy").item(0).getAttribute("t");
if(opener.wClient && opener.wClient.externQuery)
{
opener.wClient.focus();
opener.wClient.externQuery(opener.currentBaseId, t);
}
break;
case "replace_sy":
url = "replace.php";
url += "?bid={{ bid }}";
url += "&piv={{ piv }}";
url += "&pid={{ id }}"
url += "&id=" + o.id.substr(4);
url += "&typ={{ typ | url_encode }}";
w = window.open(url, "REPLACE", "directories=no, height=300, width=500, location=no, menubar=no, resizable=yes, scrollbars=yes, status=no, toolbar=no");
break;
}
}
function refresh_sy(sy_list)
{
oldtbody = document.getElementById("LSY");
tbody = document.createElement("tbody");
tbody.setAttribute("id", "LSY");
for(nsy=0, n=sy_list.firstChild; n; n=n.nextSibling, nsy++)
{
tr = tbody.appendChild(document.createElement("tr"));
// tr.className = n.getAttribute("sel") ? "S_" : "s_";
tr.className = "s_";
tr.id = "SYN_" + (id=n.getAttribute("id"));
td = tr.appendChild(document.createElement("td"));
td.style.textAlign = "center";
if(nsy > 0)
{
img = td.appendChild(document.createElement("img"));
img.id = "BTNU_" + id;
img.src = "/skins/thesaurus/images/up.gif";
if(n.nextSibling)
{
td.appendChild(document.createTextNode(" "));
}
}
if(n.nextSibling)
{
img = td.appendChild(document.createElement("img"));
img.id = "BTND_" + id;
img.src = "/skins/thesaurus/images/down.gif";
}
td = tr.appendChild(document.createElement("td"));
td.id = "FLG_"+(nsy+1);
// td.innerText = n.getAttribute("lng");
img = td.appendChild(document.createElement("img"));
img.setAttribute("src", "/skins/lng/"+n.getAttribute("lng")+"_flag_18.gif");
td = tr.appendChild(document.createElement("td"));
// td.colSpan = "2";
// td.setAttribute("colSpan", "3"); // attention au 'S' majuscule !!!
td.innerHTML = n.getAttribute("t");
td = tr.appendChild(document.createElement("td"));
td.innerHTML = n.getAttribute("hits");
td = tr.appendChild(document.createElement("td"));
td.innerHTML = n.getAttribute("id");
if(n.getAttribute("sel")) {
myGUI.select(tr);
}
}
newtbody = oldtbody.parentNode.replaceChild(tbody, oldtbody);
}
function cbDD_TSY(evt, type, eventObj)
{
ret = true;
switch(type)
{
case "RMOUSEDOWN":
if(o = eventObj.Src0)
{
for(tr=o; tr && (tr.nodeName!="TR" || !tr.id || tr.id.substr(0, 4)!="SYN_"); tr=tr.parentNode)
;
if(tr)
myGUI.select(tr);
switch(o.id.substr(0, 4))
{
case "FLG_": // le drapeau
document.getElementById("flagsMenu").runAsMenu( evt, tr );
break;
case "SYN_": // le synonyme
document.getElementById("syMenu").runAsMenu( evt, tr );
break;
}
}
break;
case "MOUSEDOWN":
if(o = eventObj.Src0)
{
for(tr=o; tr && (tr.nodeName!="TR" || !tr.id || tr.id.substr(0, 4)!="SYN_"); tr=tr.parentNode)
;
if(tr)
myGUI.select(tr);
switch(o.id.substr(0, 5))
{
case "BTNU_":
syChgPos(1);
break;
case "BTND_":
syChgPos(-1);
break;
}
}
break;
case "DBLCLICK":
break;
}
return(ret);
}
function syChgPos(dir)
{
if(!myGUI.selectedObject || myGUI.selectedObject.id.substr(0, 4)!="SYN_") {
return;
}
url = "xmlhttp/changesypos.x.php";
parms = "bid={{ bid | url_encode }}";
parms += "&piv={{ piv | url_encode }}";
parms += "&typ={{ typ | url_encode }}";
parms += "&id=" + myGUI.selectedObject.id.substr(4);
parms += "&dir=" + dir;
ret = loadXMLDoc(url, parms, true);
sy_list = ret.getElementsByTagName("sy_list").item(0);
refresh_sy(sy_list);
refresh = ret.getElementsByTagName("refresh");
for(i=0; i<refresh.length; i++)
{
switch(refresh.item(i).getAttribute("type"))
{
case "CT":
{{ opener }}.reloadCtermsBranch(refresh.item(i).getAttribute("id"));
{{ opener }}.myGUI.select({{ opener }}.document.getElementById("THE_{{ id }}"));
break;
case "TH":
{{ opener }}.reloadThesaurusBranch(refresh.item(i).getAttribute("id"));
{{ opener }}.myGUI.select({{ opener }}.document.getElementById("THE_{{ id }}"));
break;
}
}
}
myGUI = new GUI("myGUI", "desktop", "FR");
myGUI.setClickable("TSY", cbDD_TSY);
myGUI.setAsMenu("flagsMenu", cbME_flags);
myGUI.setAsMenu("syMenu", cbME_synonym);
</script>
</body>
</html>

View File

@@ -1,42 +1,8 @@
<?php
/*
* This file is part of Phraseanet
*
* (c) 2005-2013 Alchemy
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
use Alchemy\Phrasea\Application;
/**
*
* @license http://opensource.org/licenses/gpl-3.0 GPLv3
* @link www.phraseanet.com
*/
require_once __DIR__ . "/../../vendor/autoload.php";
phrasea::headers(200, true);
$app = new Application();
$request = http_request::getInstance();
$parm = $request->get_parms(
"dlg"
, "piv"
);
if ($parm["dlg"]) {
$opener = "window.dialogArguments.win";
} else {
$opener = "opener";
}
?>
<html lang="<?php echo $app['locale.I18n']; ?>">
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html lang="{{ app['locale.I18n'] }}">
<head>
<title>Chercher</title>
<link REL="stylesheet" TYPE="text/css" HREF="./thesaurus.css?u=<?php echo mt_rand() ?>" />
<title>{% trans 'Chercher' %}</title>
<link REL="stylesheet" TYPE="text/css" HREF="/skins/thesaurus/thesaurus.css" />
<script type="text/javascript">
function clkBut(button)
{
@@ -72,32 +38,26 @@ if ($parm["dlg"]) {
<form onsubmit="clkBut('submit');return(false);">
<table>
<tr>
<td><?php echo p4string::MakeString(_('thesaurus:: le terme')) ?></td>
<td><input type="radio" name="m" value="equal"><?php echo p4string::MakeString(_('thesaurus:: est egal a ')) /* est egal e */ ?></td>
<td>{% trans 'thesaurus:: le terme' %}</td>
<td><input type="radio" name="m" value="equal">{% trans 'thesaurus:: est egal a ' %}</td>
</tr>
<tr>
<td />
<td><input type="radio" checked name="m" value="begins"><?php echo p4string::MakeString(_('thesaurus:: commence par')) /* commence par */ ?></td>
<td><input type="radio" checked name="m" value="begins">{% trans 'thesaurus:: commence par' %}</td>
</tr>
<tr>
<td />
<td><input type="radio" name="m" value="contains"><?php echo p4string::MakeString(_('thesaurus:: contient')) /* contient */ ?></td>
<td><input type="radio" name="m" value="contains">{% trans 'thesaurus:: contient' %}</td>
</tr>
<!--
<tr>
<td />
<td><input type="radio" name="m" value="ends"><?php echo p4string::MakeString(_('thesaurus:: fini par')) /* finit par */ ?></td>
</tr>
-->
</table>
<br/>
<input type="text" name="t" value="" style="width:200px" onkeyup="ckis();return(true);">
<br/>
<br/>
<br/>
<input type="button" id="cancel_button" value="<?php echo p4string::MakeString(_('boutton::annuler')) ?>" onclick="clkBut('cancel');" style="width:80px;">
<input type="button" id="cancel_button" value="{% trans 'boutton::annuler' %}" onclick="clkBut('cancel');" style="width:80px;">
&nbsp;&nbsp;&nbsp;
<input type="button" id="submit_button" value="<?php echo p4string::MakeString(_('boutton::chercher')) ?>" onclick="clkBut('submit');" disabled style="width:80px;">
<input type="button" id="submit_button" value="{% trans 'boutton::chercher' %}" onclick="clkBut('submit');" disabled style="width:80px;">
</form>
</center>
</body>

View File

@@ -1,54 +1,19 @@
<?php
/*
* This file is part of Phraseanet
*
* (c) 2005-2013 Alchemy
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
use Alchemy\Phrasea\Application;
/**
*
* @license http://opensource.org/licenses/gpl-3.0 GPLv3
* @link www.phraseanet.com
*/
require_once __DIR__ . "/../../vendor/autoload.php";
phrasea::headers();
$app = new Application();
$request = http_request::getInstance();
$parm = $request->get_parms(
"piv", "res", "dbg", "bid"
);
$dispdbg = $parm["dbg"] ? "" : " visibility:hidden; ";
$lng = $app['locale'];
User_Adapter::updateClientInfos($app, 5);
?>
<html lang="<?php echo $app['locale.I18n'] ?>">
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html lang="{{ app['locale.I18n'] }}">
<head>
<title><?php echo $app['phraseanet.registry']->get('GV_homeTitle'); ?> - <?php echo p4string::MakeString(_('phraseanet:: thesaurus')) ?></title>
<title>{{ app['phraseanet.registry'].get('GV_homeTitle') }} - {% trans 'phraseanet:: thesaurus' %}</title>
<style id="STYLES">
DIV.glossaire DIV.r1_
{
display: none;
}
</style>
<link REL="stylesheet" TYPE="text/css" HREF="./thesaurus.css?u=<?php echo mt_rand() ?>" />
<link REL="stylesheet" TYPE="text/css" HREF="/skins/thesaurus/thesaurus.css" />
<script type="text/javascript">
var p4 = {};
</script>
<link rel="shortcut icon" type="image/x-icon" href="/thesaurus2/favicon.ico">
<link rel="shortcut icon" type="image/x-icon" href="/skins/thesaurus/favicon.ico">
<script type="text/javascript" src="/include/jslibs/jquery-1.7.1.js"></script>
<script type="text/javascript" src="/include/jslibs/jquery-ui-1.8.17/js/jquery-ui-1.8.17.custom.min.js"></script>
<script type="text/javascript" src="/include/minify/g=thesaurus"></script>
@@ -68,14 +33,11 @@ User_Adapter::updateClientInfos($app, 5);
// recharger tout
function reload()
{
self.location.replace("thesaurus.php?piv=<?php echo $parm['piv'] ?>&bid=<?php echo $parm['bid'] ?>") ;
self.location.replace("thesaurus.php?piv={{ piv }}&bid={{ bid }}") ;
}
function test(div)
{
// alert(deb);
// return;
// alert("div");
t = document.getElementById(div).innerHTML;
t = t.replace(/&/g, "&amp;");
t = t.replace(/</g, "&lt;");
@@ -101,13 +63,10 @@ User_Adapter::updateClientInfos($app, 5);
f = document.forms["fBase"];
// document.getElementById("T2").style.visibility = "hidden";
document.getElementById("T0").innerHTML = document.getElementById("T1").innerHTML = "<?php echo p4string::MakeString(_('phraseanet::chargement'), "js") ?>";
document.getElementById("T0").innerHTML = document.getElementById("T1").innerHTML = "{% trans 'phraseanet::chargement' %}";
f.target = "IFR0";
f.submit();
// loadForm("?");
}
function chgCkShowRejected()
@@ -134,22 +93,6 @@ User_Adapter::updateClientInfos($app, 5);
function scrollEnd(n)
{
document.getElementById("desktop").scrollTop = 0;
/*
if(n==0)
window.setTimeout("scrollEnd(1);", 500);
else
{
// alert('zerzerzer');
// o_thbox_bck.style.width = (0)+"px";
// o_thbox_bck.style.height = (0)+"px";
// o_thbox_bck.style.visibility = "hidden";
// o_thbox_bck.style.visibility = "visible";
// window.setTimeout("resizeEnd();", 25);
// window.setTimeout("o_thbox_bck.style.visibility = \"visible\";", 25);
evtResize();
}
*/
}
var xhr_object;
function sessionactive(){
@@ -159,7 +102,7 @@ User_Adapter::updateClientInfos($app, 5);
dataType: 'json',
data: {
module : 5,
usr : <?php echo $app['phraseanet.user']->get_id() ?>
usr : {{ app['phraseanet.user'].get_id() }}
},
error: function(){
window.setTimeout("sessionactive();", 10000);
@@ -187,72 +130,46 @@ User_Adapter::updateClientInfos($app, 5);
<body id="desktop" style="background-color:#808080; overflow:hidden" onload="loaded();" onscroll="evtScrollBody();" >
<div class="menu" id="flagsMenu" style="z-index:50">
<?php
// on liste tous les drapeaux
$jsFlags = "";
foreach (Application::getAvailableLanguages() as $lng_code => $lng) {
$lng_code = explode('_', $lng_code);
$lng_code = $lng_code[0];
if (file_exists("/skins/lng/" . $lng_code . "_flag_18.gif") && ($s = getimagesize("/skins/lng/" . $lng_code . "_flag_18.gif") )) {
printf("\t<img id='flagMenu_%s' src='/skins/lng/%s_flag_18.gif' />\n", $lng_code, $lng_code);
$jsFlags .= ( $jsFlags ? ', ' : '') . $lng_code . ":{ w:" . $s[0] . ", h:" . $s[1] . " }";
}
}
$jsFlags = '{ ' . $jsFlags . ' }';
?>
{% for code, language in flags %}
<img id='flagMenu_{{ code }}' src='/skins/lng/{{ code }}_flag_18.gif' />
{% endfor %}
</div>
<div class="menu" id="kctermMenu" style="z-index:50; width:240px;">
<a href="javascript:void(0)" class="" id="kcterm_properties" style="font-weight:700"><?php echo p4string::MakeString(_('thesaurus::menu: proprietes')) /* Proprietes... */ ?></a>
<a href="javascript:void(0)" class="" id="kcterm_reject"><?php echo p4string::MakeString(_('thesaurus::menu: refuser')) /* refuser... */ ?></a>
<a href="javascript:void(0)" class="disabled" id="kcterm_accept"><?php echo p4string::MakeString(_('thesaurus::menu: accepter')) /* Retablir comme candidat... */ ?></a>
<a href="javascript:void(0)" class="" id="kcterm_properties" style="font-weight:700">{% trans 'thesaurus::menu: proprietes' %}</a>
<a href="javascript:void(0)" class="" id="kcterm_reject">{% trans 'thesaurus::menu: refuser' %}</a>
<a href="javascript:void(0)" class="disabled" id="kcterm_accept">{% trans 'thesaurus::menu: accepter' %}</a>
<div class="line"></div>
<a href="javascript:void(0)" class="" id="kcterm_delete"><?php echo p4string::MakeString(_('thesaurus::menu: supprimer')) /* Supprimer... */ ?></a>
<a href="javascript:void(0)" class="" id="kcterm_delete0hits"><?php echo p4string::MakeString(_('thesaurus::menu: supprimer les candidats a 0 hits')) /* Supprimer... */ ?></a>
<!--
<a href="javascript:void(0)" class="disabled" id="kcterm_replace"><?php echo p4string::MakeString(_('thesaurus::menu: remplacer')) /* Remplacer par... */ ?></a>
<a href="javascript:void(0)" class="" id="kcterm_candidate">candidat</a>
-->
<a href="javascript:void(0)" class="" id="kcterm_delete">{% trans 'thesaurus::menu: supprimer' %}</a>
<a href="javascript:void(0)" class="" id="kcterm_delete0hits">{% trans 'thesaurus::menu: supprimer les candidats a 0 hits' %}</a>
<div class="line"></div>
<a href="javascript:void(0)" class="" id="kcterm_search"><?php echo p4string::MakeString(_('thesaurus::menu: chercher')) /* Chercher... */ ?></a>
<a href="javascript:void(0)" class="" id="kcterm_export"><?php echo p4string::MakeString(_('thesaurus::menu: exporter')) /* Exporter... */ ?></a>
<!--
<div class="line"></div>
<a href="javascript:void(0)" class="disabled" id="kcterm_rescan"><?php echo p4string::MakeString(_('thesaurus::menu: relire les candidats')) /* Relire les candidats... */ ?></a>
<div class="line"></div>
-->
<a href="javascript:void(0)" class="" id="kcterm_search">{% trans 'thesaurus::menu: chercher' %}</a>
<a href="javascript:void(0)" class="" id="kcterm_export">{% trans 'thesaurus::menu: exporter' %}</a>
</div>
<div class="menu" id="kThMenu" style="z-index:50; width:200px;">
<a href="javascript:void(0)" class="" id="kth_import"><?php echo p4string::MakeString(_('thesaurus::menu: importer')) /* Importer... */ ?></a>
<a href="javascript:void(0)" class="" id="kth_import">{% trans 'thesaurus::menu: importer' %}</a>
</div>
<div class="menu" id="ktermMenu" style="z-index:50; width:200px;">
<a href="javascript:void(0)" class="" id="kterm_properties" style="font-weight:700"><?php echo p4string::MakeString(_('thesaurus::menu: proprietes')) /* Proprietes... */ ?></a>
<a href="javascript:void(0)" class="" id="kterm_newts"><?php echo p4string::MakeString(_('thesaurus::menu: Nouveau terme')) /* Nouveau terme specifique... */ ?></a>
<a href="javascript:void(0)" class="" id="kterm_newsy"><?php echo p4string::MakeString(_('thesaurus::menu: Nouveau synonyme')) /* Nouveau synonyme... */ ?></a>
<!-- <a href="javascript:void(0)" class="" id="kterm_replace"><?php echo p4string::MakeString(_('thesaurus::menu: remplacer')) /* remplacer par... */ ?></a> -->
<a href="javascript:void(0)" class="" id="kterm_delete"><?php echo p4string::MakeString(_('thesaurus::menu: supprimer')) /* Supprimer... */ ?></a>
<a href="javascript:void(0)" class="" id="kterm_properties" style="font-weight:700">{% trans 'thesaurus::menu: proprietes' %}</a>
<a href="javascript:void(0)" class="" id="kterm_newts">{% trans 'thesaurus::menu: Nouveau terme' %}</a>
<a href="javascript:void(0)" class="" id="kterm_newsy">{% trans 'thesaurus::menu: Nouveau synonyme' %}</a>
<a href="javascript:void(0)" class="" id="kterm_delete">{% trans 'thesaurus::menu: supprimer' %}</a>
<div class="line"></div>
<a href="javascript:void(0)" class="" id="kterm_search"><?php echo p4string::MakeString(_('thesaurus::menu: chercher')) /* Chercher... */ ?></a>
<a href="javascript:void(0)" class="" id="kterm_export"><?php echo p4string::MakeString(_('thesaurus::menu: exporter')) /* Exporter... */ ?></a>
<a href="javascript:void(0)" class="" id="kterm_topics"><?php echo p4string::MakeString(_('thesaurus::menu: export topics')) /* Exporter comme topics... */ ?></a>
<a href="javascript:void(0)" class="" id="kterm_search">{% trans 'thesaurus::menu: chercher' %}</a>
<a href="javascript:void(0)" class="" id="kterm_export">{% trans 'thesaurus::menu: exporter' %}</a>
<a href="javascript:void(0)" class="" id="kterm_topics">{% trans 'thesaurus::menu: export topics' %}</a>
<div class="line"></div>
<a href="javascript:void(0)" class="" id="kterm_link"><?php echo p4string::MakeString(_('thesaurus::menu: lier au champ')) /* Lier au champ... */ ?></a>
<a href="javascript:void(0)" class="" id="kterm_link">{% trans 'thesaurus::menu: lier au champ' %}</a>
</div>
<!--
<div class="menu" id="ktsMenu" style="z-index:50; width:200px;">
<a href="javascript:void(0)" id="kcterm_reject">refuser</a>
</div>
-->
<form name="fBase" action="./loadth.php" method="post" target="?">
<input type="hidden" name="bid" value="<?php echo $parm["bid"] ?>" />
<input type="hidden" name="piv" value="<?php echo $parm["piv"] ?>" />
<form name="fBase" action="/thesaurus/loadth.php" method="post" target="?">
<input type="hidden" name="bid" value="{{ bid }}" />
<input type="hidden" name="piv" value="{{ piv }}" />
<input type="hidden" name="repair" value="" />
</form>
<form name="fSave" action="./savethesaurus1.php" method="post">
<form name="fSave" action="/thesaurus/savethesaurus1.php" method="post">
<input type="hidden" name="bid" value="?" />
<input type="hidden" name="th" value="?" />
<input type="hidden" name="ch" value="?" />
@@ -265,20 +182,18 @@ $jsFlags = '{ ' . $jsFlags . ' }';
<div id="id_thbox_bck" class="thbox" style="position:absolute; top:28px; left:8px; right:8px; bottom:8px; background-color:#f4f4f4; xoverflow:hidden">
<div class="onglet" style="background-color:#f0f0f0; border-bottom:1px solid #f4f4f4">
<span id="baseName"><?php echo p4string::MakeString(_('phraseanet:: thesaurus')) ?></span>
<a href="javascript:void();" onclick="fixTh();return(false);" style="<?php echo $dispdbg ?>">X</a>
<span id="baseName">{% trans 'phraseanet:: thesaurus' %}</span>
<a href="javascript:void();" onclick="fixTh();return(false);" style="visibility:hidden;">X</a>
</div>
<div id="TabT0" style="position:absolute; top:28px; left:0px; bottom:0px; width:40%;">
<div class="thbox" style="position:absolute; top:0px; bottom:8px; left:6px; right:3px;">
<div class="onglet"><?php echo p4string::MakeString(_('thesaurus:: onglet stock')) /* Stock */ ?>
&nbsp;
<a href="javascript:void();" onclick="test('T0');return(false);" style="<?php echo $dispdbg ?>">X</a>
<div class="onglet">{% trans 'thesaurus:: onglet stock' %} <a href="javascript:void();" onclick="test('T0');return(false);" style="visibility:hidden;">X</a>
</div>
<div style="width:100%; overflow:hidden">
<input type="checkbox" name="ckShowRejected" onClick="return(chgCkShowRejected());" /><span style="white-space:nowrap; overflow:hidden"><?php echo p4string::MakeString(_('thesaurus:: afficher les termes refuses')) /* Afficher les termes refuses */ ?></span>
<input type="checkbox" name="ckShowRejected" onClick="return(chgCkShowRejected());" /><span style="white-space:nowrap; overflow:hidden">{% trans 'thesaurus:: afficher les termes refuses' %}</span>
</div>
<div id="TabT0k" style="position:absolute; top:20px; bottom:0px; left:0px; right:0px; overflow:scroll; border:0px #000000 none">
<div id="T0" style="position:absolute; top:0px; left:0px;">
@@ -288,13 +203,10 @@ $jsFlags = '{ ' . $jsFlags . ' }';
</div>
<div id="TabT1" style="position:absolute; top:28px; right:0px; bottom:0px; width:60%;">
<!--
<input type="text" name="textT1" value="" onkeyup="evt_kup_T1();return(true);" /> <span id="WT1" style="visibility:hidden">searching...</span>
-->
<div class="thbox" style="position:absolute; top:0px; bottom:8px; left:3px; right:6px;">
<div class="onglet"><span id='TabT1Title' style="cursor:pointer"><?php echo p4string::MakeString(_('thesaurus:: onglet thesaurus')) /* Thesaurus */ ?></span>
<div class="onglet"><span id='TabT1Title' style="cursor:pointer">{% trans 'thesaurus:: onglet thesaurus' %}</span>
&nbsp;
<a href="javascript:void();" onclick="test('T1');return(false);" style="<?php echo $dispdbg ?>">X</a>
<a href="javascript:void();" onclick="test('T1');return(false);" style="visibility:hidden;">X</a>
</div>
<div id="TabT1k" style="position:absolute; top:0px; bottom:0px; left:0px; right:0px; overflow:scroll; border:0px #000000 none">
<div id="T1" style="position:absolute; top:0px; left:0px;">
@@ -311,8 +223,8 @@ $jsFlags = '{ ' . $jsFlags . ' }';
<div id="clipboard" style="position:absolute; top:0px; left:0px; z-index:99">&nbsp;</div>
<iframe src="about:blank" name="IFRsave" id="IFRsave" style="<?php echo $dispdbg ?> ; position:absolute; top:<?php echo $parm["dbg"] ? 600 : 0 ?>px; left:5px; height:<?php echo $parm["dbg"] ? 150 : 50 ?>px; width:<?php echo $parm["dbg"] ? 340 : 50 ?>px; overflow:scroll"></iframe>
<iframe src="about:blank" name="IFR0" id="IFR0" style="<?php echo $dispdbg ?> ; position:absolute; top:<?php echo $parm["dbg"] ? 600 : 0 ?>px; left:400px; height:<?php echo $parm["dbg"] ? 150 : 50 ?>px; width:<?php echo $parm["dbg"] ? 340 : 50 ?>px; overflow:scroll"></iframe>
<iframe src="about:blank" name="IFRsave" id="IFRsave" style="visibility:hidden; ; position:absolute; top:0px; left:5px; height:50px; width:50px; overflow:scroll"></iframe>
<iframe src="about:blank" name="IFR0" id="IFR0" style="visibility:hidden; ; position:absolute; top:0px; left:400px; height:50px; width:50px; overflow:scroll"></iframe>
<script type="text/javascript">
@@ -320,7 +232,7 @@ $jsFlags = '{ ' . $jsFlags . ' }';
return false;
}
tFlags = <?php echo $jsFlags ?> ;
tFlags = {{ jsFlags | raw }};
myGUI = new GUI("myGUI", "desktop", "FR");
@@ -408,15 +320,11 @@ $jsFlags = '{ ' . $jsFlags . ' }';
// om.className = "disabled";
if(om=document.getElementById("kcterm_search"))
om.className = "";
if(om=document.getElementById("kcterm_rescan"))
om.className = "disabled";
break;
case "THE_": // terme candidat
// alert("id: "+o.id+" ; p: "+o.parentNode.id);
if(om=document.getElementById("kcterm_delete0hits"))
om.className = "disabled";
if(om=document.getElementById("kcterm_rescan"))
om.className = "disabled";
if(o.id.substr(4, 1)=="R")
{
if(om=document.getElementById("kcterm_reject"))
@@ -481,7 +389,7 @@ $jsFlags = '{ ' . $jsFlags . ' }';
{
case "kcterm_delete":
url = "xmlhttp/getterm.x.php";
url += "?bid=<?php echo urlencode($parm["bid"]) ?>";
url += "?bid={{ bid }}";
url += "&id=" + o.id.substr(4);
url += "&typ=CT";
@@ -492,16 +400,16 @@ $jsFlags = '{ ' . $jsFlags . ' }';
allhits = ret.getElementsByTagName("allhits").item(0).firstChild.nodeValue;
if(allhits==0)
msg = "<?php echo p4string::MakeString(_('thesaurus:: Supprimer cette branche ?&#10;(les termes concernes remonteront en candidats a la prochaine indexation)'), "js") /* Supprimer cette branche ?\\n(les termes concernes remonteront en candidats e la prochaine indexation) */ ?>";
msg = "{% trans 'thesaurus:: Supprimer cette branche ?&#10;(les termes concernes remonteront en candidats a la prochaine indexation)' %}";
else
msg = "<?php echo p4string::MakeString(_('thesaurus:: Des reponses sont retournees par cette branche. &#10;Supprimer quand meme ?&#10;(les termes concernes remonteront en candidats a la prochaine indexation)'), "js") /* cette branche retourne %s reponses.... */ ?>";
msg = "{% trans 'thesaurus:: Des reponses sont retournees par cette branche. &#10;Supprimer quand meme ?&#10;(les termes concernes remonteront en candidats a la prochaine indexation)' %}";
if(confirm(msg))
{
var myObj = { "win":window };
url = "./xmlhttp/killterm.x.php";
url += "?bid=<?php echo $parm["bid"] ?>";
url += "&piv=<?php echo $parm["piv"] ?>";
url = "/thesaurus/xmlhttp/killterm.x.php";
url += "?bid={{ bid }}";
url += "&piv={{ piv }}";
url += "&id=" + o.id.substr(4);
// url += "&typ=CT";
@@ -526,7 +434,7 @@ $jsFlags = '{ ' . $jsFlags . ' }';
break;
case "kcterm_delete0hits":
url = "xmlhttp/searchnohits.x.php";
url += "?bid=<?php echo urlencode($parm["bid"]) ?>";
url += "?bid={{ bid }}";
url += "&id=" + o.id.substr(4);
url += "&typ=CT";
@@ -536,16 +444,16 @@ $jsFlags = '{ ' . $jsFlags . ' }';
if(n_nohits==0)
{
alert("<?php echo p4string::MakeString(_('thesaurus:: Tous les termes ont des hits'), "js") /* Cette branche ne contient aucun terme 'e 0 hits' */ ?>");
alert("{{ 'thesaurus:: Tous les termes ont des hits' | trans | e('js') }}");
return;
}
else
{
if(confirm("<?php echo p4string::MakeString(_('thesaurus:: Des termes de cette branche ne renvoient pas de hits. Les supprimer ?'), "js") ?>"));
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=<?php echo urlencode($parm["bid"]) ?>";
url += "?bid={{ bid }}";
url += "&id=" + o.id.substr(4);
url += "&typ=CT";
@@ -558,9 +466,9 @@ $jsFlags = '{ ' . $jsFlags . ' }';
case "kcterm_reject":
var myObj = { "win":window };
url = "./xmlhttp/reject.x.php";
url += "?bid=<?php echo $parm["bid"] ?>";
url += "&piv=<?php echo $parm["piv"] ?>";
url = "/thesaurus/xmlhttp/reject.x.php";
url += "?bid={{ bid }}";
url += "&piv={{ piv }}";
url += "&id=" + o.id.substr(4);
// url += "&typ=CT";
@@ -584,9 +492,9 @@ $jsFlags = '{ ' . $jsFlags . ' }';
break;
case "kcterm_accept":
var myObj = { "win":window };
url = "./xmlhttp/accept.x.php";
url += "?bid=<?php echo $parm["bid"] ?>";
url += "&piv=<?php echo $parm["piv"] ?>";
url = "/thesaurus/xmlhttp/accept.x.php";
url += "?bid={{ bid }}";
url += "&piv={{ piv }}";
url += "&id=" + o.id.substr(4);
// url += "&typ=CT";
@@ -614,7 +522,6 @@ $jsFlags = '{ ' . $jsFlags . ' }';
o.className = o.className.replace("R_", "r_");
if(!o.oldid)
{
// o.oldid = o.id.substr(4);
o.setAttribute("oldid", o.id.substr(4) );
}
o.id = "TCE_C" + o.id.substr(5);
@@ -623,29 +530,19 @@ $jsFlags = '{ ' . $jsFlags . ' }';
case "kcterm_properties":
var myObj = { "win":window };
url = "properties.php";
url += "?bid=<?php echo $parm["bid"] ?>";
url += "&piv=<?php echo $parm["piv"] ?>";
url += "?bid={{ bid }}";
url += "&piv={{ piv }}";
url += "&id=" + o.id.substr(4);
url += "&typ=CT";
url += "&dlg=1";
ret = window.showModalDialog(url, myObj, "dialogHeight:340px; dialogWidth:500px; center:yes; help:no; resizable:no; scroll:no; status:no; unadorned:yes");
break;
case "kcterm_rescan":
// if(confirm("<?php echo p4string::MakeString(_('thesaurus:: Supprimer tous les candidats et placer toutes les fiches en reindexation-thesaurus ?'), "js") /* Supprimer tous les candidats et placer toutes les fiches en reindexation-thesaurus ? */ ?>"))
// {
var myObj = { "win":window };
url = "rescan_dlg.php";
url += "?bid=<?php echo $parm["bid"] ?>";
url += "&piv=<?php echo $parm["piv"] ?>";
w = window.open(url, "RESCAN", "directories=no, height=300, width=500, location=no, menubar=no, resizable=yes, scrollbars=no, status=no, toolbar=no");
// }
break;
case "kcterm_search":
ret = window.showModalDialog("search.php?dlg=1", null, "dialogHeight:240px; dialogWidth:300px; center:yes; help:no; resizable:yes; scroll:no; status:no; unadorned:yes");
if(ret && ret.t != "")
{
url = "./xmlhttp/openbranches.x.php";
parms = "bid=<?php echo $parm["bid"] ?>";
url = "/thesaurus/xmlhttp/openbranches.x.php";
parms = "bid={{ bid }}";
parms += "&id=" + cbParm.id.substr(4);
parms += "&typ=CT";
parms += "&method=" + ret.method;
@@ -668,8 +565,8 @@ $jsFlags = '{ ' . $jsFlags . ' }';
case "kcterm_export":
var myObj = { "win":window };
url = "export_text_dlg.php";
url += "?bid=<?php echo $parm["bid"] ?>";
url += "&piv=<?php echo $parm["piv"] ?>";
url += "?bid={{ bid }}";
url += "&piv={{ piv }}";
url += "&id=" + o.id.substr(4);
url += "&typ=CT";
w = window.open(url, "EXPORT", "directories=no, height=300, width=700, location=no, menubar=no, resizable=yes, scrollbars=yes, status=no, toolbar=no");
@@ -729,8 +626,8 @@ $jsFlags = '{ ' . $jsFlags . ' }';
{
var myObj = { "win":window };
url = "properties.php";
url += "?bid=<?php echo $parm["bid"] ?>";
url += "&piv=<?php echo $parm["piv"] ?>";
url += "?bid={{ bid }}";
url += "&piv={{ piv }}";
url += "&id=" + o.id.substr(4);
url += "&typ=CT";
url += "&dlg=1";
@@ -853,8 +750,8 @@ $jsFlags = '{ ' . $jsFlags . ' }';
if(o.id.substr(0, 4)=="THE_") // && o.id.substr(4)!="T")
{
var url = "xmlhttp/getterm.x.php";
var parms = "bid=<?php echo $parm["bid"] ?>";
parms += "&piv=<?php echo $parm["piv"] ?>";
var parms = "bid={{ bid }}";
parms += "&piv={{ piv }}";
parms += "&sortsy=0";
parms += "&id=" + o.id.substr(4);
parms += "&typ=CT";
@@ -884,8 +781,8 @@ $jsFlags = '{ ' . $jsFlags . ' }';
// alert(thb.id);
new_thb = null;
url = "xmlhttp/getterm.x.php";
parms = "bid=<?php echo $parm["bid"] ?>";
parms += "&piv=<?php echo $parm["piv"] ?>";
parms = "bid={{ bid }}";
parms += "&piv={{ piv }}";
parms += "&sortsy=1";
parms += "&id=" + thid;
parms += "&typ=" + typ;
@@ -1021,7 +918,7 @@ $jsFlags = '{ ' . $jsFlags . ' }';
{
case "kterm_newts": // nouveau terme specifique
var myObj = { "win":window };
url = "newsy_dlg.php?piv=<?php echo $parm["piv"] ?>&typ=TS";
url = "newsy_dlg.php?piv={{ piv }}&typ=TS";
ret = window.showModalDialog(url, myObj, "dialogHeight:200px; dialogWidth:400px; center:yes; help:no; resizable:yes; scroll:no; status:no; unadorned:yes");
@@ -1029,8 +926,8 @@ $jsFlags = '{ ' . $jsFlags . ' }';
{
var myObj = { "win":window };
url = "newterm.php";
url += "?bid=<?php echo $parm["bid"] ?>";
url += "&piv=<?php echo $parm["piv"] ?>";
url += "?bid={{ bid }}";
url += "&piv={{ piv }}";
url += "&pid=" + o.id.substr(4);
// url += "&t=" + escape(newts); // PAS avec un prompt UTF8
url += "&t=" + encodeURIComponent(ret.t);
@@ -1042,14 +939,14 @@ $jsFlags = '{ ' . $jsFlags . ' }';
break;
case "kterm_newsy":
var myObj = { "win":window };
url = "newsy_dlg.php?piv=<?php echo $parm["piv"] ?>&typ=SY";
url = "newsy_dlg.php?piv={{ piv }}&typ=SY";
ret = window.showModalDialog(url, myObj, "dialogHeight:200px; dialogWidth:400px; center:yes; help:no; resizable:yes; scroll:no; status:no; unadorned:yes");
if(ret && ret.t)
{
var myObj = { "win":window };
url = "newterm.php";
url += "?bid=<?php echo $parm["bid"] ?>";
url += "&piv=<?php echo $parm["piv"] ?>";
url += "?bid={{ bid }}";
url += "&piv={{ piv }}";
url += "&pid=" + o.id.substr(4);
// url += "&t=" + escape(newts); // PAS avec un prompt UTF8
url += "&t=" + encodeURIComponent(ret.t);
@@ -1061,9 +958,9 @@ $jsFlags = '{ ' . $jsFlags . ' }';
break;
case "kterm_delete":
tid = o.id.substr(4);
url = "./xmlhttp/getterm.x.php";
url += "?bid=<?php echo $parm["bid"] ?>";
url += "&piv=<?php echo $parm["piv"] ?>";
url = "/thesaurus/xmlhttp/getterm.x.php";
url += "?bid={{ bid }}";
url += "&piv={{ piv }}";
url += "&id=" + tid;
url += "&typ=TH";
ret = loadXMLDoc(url, null, true);
@@ -1071,11 +968,11 @@ $jsFlags = '{ ' . $jsFlags . ' }';
fullpath = ret.getElementsByTagName("fullpath").item(0).firstChild.nodeValue;
url = "xmlhttp/delts.x.php";
parms = "bid=<?php echo $parm["bid"] ?>";
parms += "&piv=<?php echo $parm["piv"] ?>";
parms = "bid={{ bid }}";
parms += "&piv={{ piv }}";
parms += "&id=" + tid;
if(confirm("<?php echo p4string::MakeString(_('thesaurus:: deplacer le terme dans la corbeille ?'), "js") ?>"+"\n\n"+fullpath+"\n\n"))
if(confirm("{{ 'thesaurus:: deplacer le terme dans la corbeille ?' | trans | e('js') }}"+"\n\n"+fullpath+"\n\n"))
{
// xmlhttp/delts.x.php?bid=15&id=T1.629&debug=1
// alert(url+"?"+parms);
@@ -1103,8 +1000,8 @@ $jsFlags = '{ ' . $jsFlags . ' }';
case "kterm_link":
var myObj = { "win":window };
url = "linkfield.php";
url += "?bid=<?php echo $parm["bid"] ?>";
url += "&piv=<?php echo $parm["piv"] ?>";
url += "?bid={{ bid }}";
url += "&piv={{ piv }}";
url += "&tid=" + o.id.substr(4);
url += "&dlg=1";
ret = window.showModalDialog(url, myObj, "dialogHeight:340px; dialogWidth:500px; center:yes; help:no; resizable:yes; scroll:no; status:no; unadorned:yes");
@@ -1112,8 +1009,8 @@ $jsFlags = '{ ' . $jsFlags . ' }';
case "kterm_properties":
var myObj = { "win":window };
url = "properties.php";
url += "?bid=<?php echo $parm["bid"] ?>";
url += "&piv=<?php echo $parm["piv"] ?>";
url += "?bid={{ bid }}";
url += "&piv={{ piv }}";
url += "&id=" + o.id.substr(4);
url += "&typ=TH";
@@ -1123,8 +1020,8 @@ $jsFlags = '{ ' . $jsFlags . ' }';
ret = window.showModalDialog("search.php?dlg=1", myObj, "dialogHeight:240px; dialogWidth:300px; center:yes; help:no; resizable:yes; scroll:no; status:no; unadorned:yes");
if(ret && ret.t != "")
{
url = "./xmlhttp/openbranches.x.php";
parms = "bid=<?php echo $parm["bid"] ?>";
url = "/thesaurus/xmlhttp/openbranches.x.php";
parms = "bid={{ bid }}";
parms += "&id=" + cbParm.id.substr(4);
parms += "&typ=TH";
parms += "&method=" + ret.method;
@@ -1148,8 +1045,8 @@ $jsFlags = '{ ' . $jsFlags . ' }';
case "kterm_export":
var myObj = { "win":window };
url = "export_text_dlg.php";
url += "?bid=<?php echo $parm["bid"] ?>";
url += "&piv=<?php echo $parm["piv"] ?>";
url += "?bid={{ bid }}";
url += "&piv={{ piv }}";
url += "&id=" + o.id.substr(4);
url += "&typ=TH";
w = window.open(url, "EXPORT", "directories=no, height=300, width=700, location=no, menubar=no, resizable=yes, scrollbars=yes, status=no, toolbar=no");
@@ -1157,8 +1054,8 @@ $jsFlags = '{ ' . $jsFlags . ' }';
case "kterm_topics":
var myObj = { "win":window };
url = "export_topics_dlg.php";
url += "?bid=<?php echo $parm["bid"] ?>";
url += "&piv=<?php echo $parm["piv"] ?>";
url += "?bid={{ bid }}";
url += "&piv={{ piv }}";
url += "&id=" + o.id.substr(4);
url += "&typ=TH";
url += "&obr=" + list_opened_branches(o.parentNode);
@@ -1262,8 +1159,8 @@ $jsFlags = '{ ' . $jsFlags . ' }';
{
var myObj = { "win":window };
url = "properties.php";
url += "?bid=<?php echo $parm["bid"] ?>";
url += "&piv=<?php echo $parm["piv"] ?>";
url += "?bid={{ bid }}";
url += "&piv={{ piv }}";
url += "&id=" + o.id.substr(4);
url += "&typ=TH";
url += "&dlg=1";
@@ -1277,8 +1174,8 @@ $jsFlags = '{ ' . $jsFlags . ' }';
if(o.id.substr(0, 4)=="THE_") // && o.id.substr(4)!="T")
{
var url = "xmlhttp/getterm.x.php";
var parms = "bid=<?php echo $parm["bid"] ?>";
parms += "&piv=<?php echo $parm["piv"] ?>";
var parms = "bid={{ bid }}";
parms += "&piv={{ piv }}";
parms += "&sortsy=0";
parms += "&id=" + o.id.substr(4);
parms += "&typ=TH";
@@ -1336,8 +1233,8 @@ $jsFlags = '{ ' . $jsFlags . ' }';
{
var myObj = { "win":window };
url = "accept.php";
url += "?bid=<?php echo $parm["bid"] ?>";
url += "&piv=<?php echo $parm["piv"] ?>";
url += "?bid={{ bid }}";
url += "&piv={{ piv }}";
url += "&src=" + eventObj.Src0.id.substr(4);
url += "&tgt=" + tgt0.id.substr(4);
w = window.open(url, "ACCEPT", "directories=no, height=300, width=500, location=no, menubar=no, resizable=yes, scrollbars=no, status=no, toolbar=no");
@@ -1390,9 +1287,9 @@ $jsFlags = '{ ' . $jsFlags . ' }';
{
case "kth_import": // importer
var myObj = { "win":window };
url = "import_dlg.php?piv=<?php echo $parm["piv"] ?>&bid=<?php echo $parm["bid"] ?>&id=&dlg=1";
url = "import_dlg.php?piv={{ piv }}&bid={{ bid }}&id=&dlg=1";
window.showModalDialog(url, myObj, "dialogHeight:400px; dialogWidth:600px; center:yes; help:no; resizable:yes; scroll:no; status:no; unadorned:yes");
// url = "import_dlg.php?piv=<?php echo $parm["piv"] ?>&bid=<?php echo $parm["bid"] ?>&id=";
// url = "import_dlg.php?piv={{ piv }}&bid={{ bid }}&id=";
// w = window.open(url, "IMPORT", "directories=no, height=300, width=500, location=no, menubar=no, resizable=yes, scrollbars=no, status=no, toolbar=no");
break;
}
@@ -1432,7 +1329,7 @@ $jsFlags = '{ ' . $jsFlags . ' }';
{
new_thb = null;
url = "xmlhttp/gethtmlbranch.x.php";
parms = "bid=<?php echo $parm["bid"] ?>";
parms = "bid={{ bid }}";
parms += "&id=" + thid;
parms += "&typ=" + typ;

View File

@@ -12,8 +12,8 @@
RewriteRule ^account/.*$ /index.php [L]
RewriteRule ^developers/.*$ /index.php [L]
RewriteRule ^login/.*$ /index.php [L]
RewriteRule ^thesaurus2/xmlhttp/.*$ /index.php [L]
RewriteRule ^xmlhttp/.*$ /index.php [L]
RewriteRule ^thesaurus/.*$ /index.php [L]
RewriteRule ^prod/records/.*$ /index.php [L]
RewriteRule ^prod/records/edit/.*$ /index.php [L]
RewriteRule ^prod/records/property/.*$ /index.php [L]

View File

@@ -102,9 +102,10 @@ $groups = array(
'//include/jslibs/jquery.cookie.js'
, '//include/jslibs/jquery.contextmenu_scroll.js'
, '//include/jquery.common.js'
, '//thesaurus2/win.js'
, '//thesaurus2/xmlhttp.js'
, '//thesaurus2/thesaurus.js'
, '//skins/thesaurus/win.js'
, '//skins/thesaurus/xmlhttp.js'
, '//skins/thesaurus/thesaurus.js'
, '//skins/thesaurus/sprintf.js'
),
'lightbox' => array(
'//include/jslibs/jquery.mousewheel.js'

Binary file not shown.

Before

Width:  |  Height:  |  Size: 360 B

After

Width:  |  Height:  |  Size: 1.3 KiB

View File

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 1.1 KiB

View File

Before

Width:  |  Height:  |  Size: 54 B

After

Width:  |  Height:  |  Size: 54 B

View File

Before

Width:  |  Height:  |  Size: 173 B

After

Width:  |  Height:  |  Size: 173 B

View File

Before

Width:  |  Height:  |  Size: 43 B

After

Width:  |  Height:  |  Size: 43 B

View File

Before

Width:  |  Height:  |  Size: 54 B

After

Width:  |  Height:  |  Size: 54 B

View File

@@ -1,292 +0,0 @@
<?php
/*
* This file is part of Phraseanet
*
* (c) 2005-2013 Alchemy
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
use Alchemy\Phrasea\Application;
/**
*
* @license http://opensource.org/licenses/gpl-3.0 GPLv3
* @link www.phraseanet.com
*/
require_once __DIR__ . "/../../vendor/autoload.php";
phrasea::headers(200, true);
$app = new Application();
require($app['phraseanet.registry']->get('GV_RootPath') . "www/thesaurus2/xmlhttp.php");
$request = http_request::getInstance();
$parm = $request->get_parms(
"bid"
, "piv"
, "src"
, "tgt"
, "dlg"
);
if ($parm["dlg"]) {
$opener = "window.dialogArguments.win";
} else {
$opener = "opener";
}
?>
<html lang="<?php echo $app['locale.I18n']; ?>">
<head>
<title><?php echo p4string::MakeString(_('thesaurus:: accepter...')) ?></title>
<link REL="stylesheet" TYPE="text/css" HREF="./thesaurus.css?u=<?php echo mt_rand() ?>" />
<style type="text/css">
.path_separator
{
color:#ffff00;
}
.main_term
{
font-weight:900;
}
</style>
<script type="text/javascript" src="./xmlhttp.js"></script>
<script type="text/javascript">
function loaded()
{
window.name="ACCEPT";
self.focus();
}
function ok()
{
as = "";
if((n=document.forms[0].as.length) > 0)
{
for(i=0; i<n && as==""; i++)
{
if(document.forms[0].as[i].checked)
as = document.forms[0].as[i].value;
}
}
else
{
as = document.forms[0].as.value;
}
if(as == "TS")
{
url = "xmlhttp/acceptcandidates.x.php";
parms = "bid=<?php echo urlencode($parm["bid"]) ?>";
parms += "&piv=<?php echo urlencode($parm["piv"]) ?>";
parms += "&cid[]=<?php echo urlencode($parm["src"]) ?>";
parms += "&pid=<?php echo urlencode($parm["tgt"]) ?>";
parms += "&typ=TS";
//alert(url + "?" + parms);
// return;
ret = loadXMLDoc(url, parms, true);
//alert(ret);
refresh = ret.getElementsByTagName("refresh");
//alert(refresh.length);
for(i=0; i<refresh.length; i++)
{
//alert(i + " : '" + refresh.item(i).getAttribute("type") + "' id='"+refresh.item(i).getAttribute("id")+"'");
switch(refresh.item(i).getAttribute("type"))
{
case "CT":
<?php echo $opener ?>.reloadCtermsBranch(refresh.item(i).getAttribute("id"));
break;
case "TH":
<?php echo $opener ?>.reloadThesaurusBranch(refresh.item(i).getAttribute("id"));
break;
}
}
self.close();
}
else if(as == "SY")
{
url = "xmlhttp/acceptcandidates.x.php";
parms = "bid=<?php echo urlencode($parm["bid"]) ?>";
parms += "&piv=<?php echo urlencode($parm["piv"]) ?>";
parms += "&cid[]=<?php echo urlencode($parm["src"]) ?>";
parms += "&pid=<?php echo urlencode($parm["tgt"]) ?>";
parms += "&typ=SY";
ret = loadXMLDoc(url, parms, true);
refresh = ret.getElementsByTagName("refresh");
for(i=0; i<refresh.length; i++)
{
switch(refresh.item(i).getAttribute("type"))
{
case "CT":
<?php echo $opener ?>.reloadCtermsBranch(refresh.item(i).getAttribute("id"));
break;
case "TH":
<?php echo $opener ?>.reloadThesaurusBranch(refresh.item(i).getAttribute("id"));
break;
}
}
self.close();
}
}
</script>
</head>
<body id="desktop" onload="loaded();" class="dialog">
<?php
if ($parm["bid"] !== null) {
$url = "thesaurus2/xmlhttp/getterm.x.php";
$url .= "?bid=" . urlencode($parm["bid"]);
$url .= "&piv=" . urlencode($parm["piv"]);
$url .= "&sortsy=0";
$url .= "&id=" . urlencode($parm["src"]);
$url .= "&typ=CT";
$url .= "&nots=1";
//print("URL='$url'<br/>\n");
$dom = xmlhttp($url);
if ((int) ($dom->documentElement->getAttribute('found')) == 0) {
?>
<center>
<br/>
<br/>
<br/>
<?php echo p4string::MakeString(_('thesaurus:: removed_src'), "html") ?>
<br/>
<br/>
<?php echo p4string::MakeString(_('thesaurus:: refresh'), "html") ?>
<br/>
<br/>
<br/>
<br/>
<br/>
<input style="position:relative; z-index:2; width:100px" type="button" id="cancel_button" value="<?php echo p4string::MakeString(_('boutton::fermer')) ?>" onclick="self.close();">
<?php
} else {
$fullpath_src = $dom->getElementsByTagName("fullpath_html")->item(0)->firstChild->nodeValue;
$nts = $dom->getElementsByTagName("ts_list")->item(0)->getAttribute("nts");
if (($cfield = $dom->getElementsByTagName("cfield")->item(0))) {
if ($cfield->getAttribute("delbranch"))
$cfield = '*';
else
$cfield = $cfield->getAttribute("field");
}
else {
$cfield = NULL;
}
// {
// if( ($cfield_tbranch = $cfield->getAttribute("tbranch")) )
// {
// }
// }
// print("cfield='$cfield'<br/>\n");
// print($fullpath);
$url = "thesaurus2/xmlhttp/getterm.x.php";
$url .= "?bid=" . urlencode($parm["bid"]);
$url .= "&piv=" . urlencode($parm["piv"]);
$url .= "&sortsy=0";
$url .= "&id=" . urlencode($parm["tgt"]);
$url .= "&typ=TH";
if ($cfield)
$url .= "&acf=" . urlencode($cfield);
$url .= "&nots=1";
// print("URL='$url'<br/>\n");
// print($url. "<br/>\n");
$dom = xmlhttp($url);
if ((int) ($dom->documentElement->getAttribute('found')) == 0) {
// on n'a pas trouve le node de destination (il a ete deplace par qqun d'autre)
?>
<center>
<br/>
<br/>
<br/>
<?php echo p4string::MakeString(_('thesaurus:: removed tgt'), "html") ?>
<br/>
<br/>
<?php echo p4string::MakeString(_('thesaurus:: refresh'), "html") ?>
<br/>
<br/>
<br/>
<br/>
<br/>
<input style="position:relative; z-index:2; width:100px" type="button" id="cancel_button" value="<?php echo p4string::MakeString(_('boutton::fermer')) ?>" onclick="self.close();">
<?php
} else {
// printf("%s", $dom->saveXML());
$fullpath_tgt = $dom->getElementsByTagName("fullpath_html")->item(0)->firstChild->nodeValue;
$acceptable = 0 + $dom->getElementsByTagName("cfield")->item(0)->getAttribute("acceptable");
// print("acceptable=$acceptable<br/>\n");
if ($acceptable) {
?>
<center>
<br/>
<form method="?" action="?" target="?" onsubmit="return(false);">
<input type="hidden" name="bid" value="<?php echo urlencode($parm["bid"]) ?>">
<input type="hidden" name="piv" value="<?php echo urlencode($parm["piv"]) ?>">
<input type="hidden" name="src" value="<?php echo urlencode($parm["src"]) ?>">
<input type="hidden" name="tgt" value="<?php echo urlencode($parm["tgt"]) ?>">
<input type="hidden" name="tgt" value="<?php echo urlencode($parm["tgt"]) ?>">
<?php
if ($nts == 0) {
print(p4string::MakeString(_('thesaurus:: Accepter le terme comme'), "html"));
print('<br/><br/><h4>' . $fullpath_src . '</h4><br/><br/>');
print("<br/>&nbsp;&nbsp;<input type='radio' name='as' value='TS' checked>" . p4string::MakeString(_('thesaurus:: comme terme specifique')));
print("&nbsp;&nbsp;&nbsp;");
print("<input type='radio' name='as' value='SY'>");
// print("<br/><br/>\n");
printf(p4string::MakeString(_('thesaurus:: comme synonyme de %s'), "html"), "<br/><br/>\n<h4>" . $fullpath_tgt . "</h4><br/>\n");
} else {
printf("<br/><br/><h4>" . $fullpath_src . "</h4><br/><br/>\n");
print(p4string::MakeString(_('thesaurus:: Accepter la branche comme'), "html") . '<br/>');
print("&nbsp;" . p4string::MakeString(_('thesaurus:: comme terme specifique')));
printf("<br/><br/>\n<h4>" . $fullpath_tgt . "</h4><br/><br/>\n");
print("<input type='hidden' name='as' value='TS'>\n");
}
// print($fullpath);
?>
<br/>
<br/>
<input style="position:relative; z-index:2; width:100px" type="button" id="ok_button" value="<?php echo p4string::MakeString(_('boutton::valider')) ?>" onclick="ok();">
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<input style="position:relative; z-index:2; width:100px" type="button" id="cancel_button" value="<?php echo p4string::MakeString(_('boutton::annuler')) ?>" onclick="self.close();">
</form>
</center>
<?php
} else {
// non acceptable
?>
<center>
<br/>
<br/>
<br/>
<?php printf(_('thesaurus:: A cet emplacement du thesaurus , un candidat du champ %s ne peut etre accepte'), "<br/><br/><b>" . $cfield . "</b><br/><br/>") ?>
<br/>
<br/>
<br/>
<br/>
<br/>
<br/>
<br/>
<input style="position:relative; z-index:2; width:100px" type="button" id="cancel_button" value="<?php echo p4string::MakeString(_('boutton::annuler')) ?>" onclick="self.close();">
<?php
}
}
}
}
?>
</body>
</html>

View File

@@ -1,261 +0,0 @@
<?php
/*
* This file is part of Phraseanet
*
* (c) 2005-2013 Alchemy
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
use Alchemy\Phrasea\Application;
/**
*
* @license http://opensource.org/licenses/gpl-3.0 GPLv3
* @link www.phraseanet.com
*/
require_once __DIR__ . "/../../vendor/autoload.php";
$app = new Application();
set_time_limit(60 * 60);
phrasea::headers(200, true);
$request = http_request::getInstance();
$parm = $request->get_parms(
"bid"
, "piv"
, "id"
, "typ"
, "dlg"
, "osl"
, "iln"
, "ilg"
, "hit"
, "smp"
);
if ($parm["dlg"]) {
$opener = "window.dialogArguments.win";
} else {
$opener = "opener";
}
?>
<html lang="<?php echo $app['locale.I18n']; ?>">
<head>
<title><?php echo p4string::MakeString(_('thesaurus:: export au format texte')) ?></title>
<link REL="stylesheet" TYPE="text/css" HREF="./thesaurus.css?u=<?php echo mt_rand() ?>" />
<script type="text/javascript">
function loaded()
{
// window.name="EXPORT2";
self.focus();
}
</script>
</head>
<body id="idbody" onload="loaded();" style="background-color:#ffffff" >
<?php
$thits = array();
if ($parm["typ"] == "TH" || $parm["typ"] == "CT") {
$loaded = false;
try {
$databox = $app['phraseanet.appbox']->get_databox((int) $parm['bid']);
$connbas = connection::getPDOConnection($app, $parm['bid']);
if ($parm["typ"] == "TH") {
$domth = $databox->get_dom_thesaurus();
} else {
$domth = $databox->get_dom_cterms();
}
if ($domth) {
$sql = "SELECT value, SUM(1) as hits FROM thit GROUP BY value";
$stmt = $connbas->prepare($sql);
$stmt->execute();
$rs = $stmt->fetchAll(PDO::FETCH_ASSOC);
$stmt->closeCursor();
foreach ($rs as $rowbas2) {
$thits[str_replace('d', '.', $rowbas2["value"])] = $rowbas2["hits"];
}
$xpathth = new DOMXPath($domth);
printf("<pre style='font-size: %dpx;'>\n", $parm["smp"] ? 9 : 12);
if ($parm["id"] == "T")
$q = "/thesaurus";
elseif ($parm["id"] == "C")
$q = "/cterms";
else
$q = "//te[@id='" . $parm["id"] . "']";
export0($xpathth->query($q)->item(0));
print("</pre>\n");
}
} catch (Exception $e) {
}
}
$tnodes = NULL;
function printTNodes()
{
global $tnodes;
global $thits;
global $parm;
$numlig = ($parm["iln"] == "1");
$hits = ($parm["hit"] == "1");
$ilg = ($parm["ilg"] == "1");
$oneline = ($parm["osl"] == "1");
$ilig = 1;
foreach ($tnodes as $node) {
$tabs = str_repeat("\t", $node["depth"]);
switch ($node["type"]) {
case "ROOT":
if ($numlig)
print($ilig ++ . "\t");
if ($hits && ! $oneline)
print("\t");
print($tabs . $node["name"] . "\n");
break;
case "TRASH":
if ($numlig)
print($ilig ++ . "\t");
if ($hits && ! $oneline)
print("\t");
print($tabs . "{TRASH}\n");
break;
case "FIELD":
if ($numlig)
print($ilig ++ . "\t");
if ($hits && ! $oneline)
print("\t");
print($tabs . $node["name"] . "\n");
break;
case "TERM":
$isyn = 0;
if ($oneline) {
if ($numlig)
print($ilig ++ . "\t");
print($tabs);
$isyn = 0;
foreach ($node["syns"] as $syn) {
if ($isyn > 0)
print(" ; ");
print($syn["v"]);
if ($ilg)
print(" [" . $syn["lng"] . "]");
if ($hits)
print(" [" . $syn["hits"] . "]");
$isyn ++;
}
print("\n");
}
else {
$isyn = 0;
foreach ($node["syns"] as $syn) {
if ($numlig)
print($ilig ++ . "\t");
if ($hits)
print( $syn["hits"] . "\t");
print($tabs);
if ($isyn > 0)
print("; ");
print($syn["v"]);
if ($ilg)
print(" [" . $syn["lng"] . "]");
print("\n");
$isyn ++;
}
}
break;
}
if ( ! $oneline) {
if ($numlig)
print($ilig ++ . "\t");
print("\n");
}
}
}
function exportNode(&$node, $depth)
{
global $thits;
global $tnodes;
if ($node->nodeType == XML_ELEMENT_NODE) {
if (($nname = $node->nodeName) == "thesaurus" || $nname == "cterms") {
$tnodes[] = array("type" => "ROOT", "depth" => $depth, "name" => $nname, "cdate" => $node->getAttribute("creation_date"), "mdate" => $node->getAttribute("modification_date"));
} elseif (($fld = $node->getAttribute("field"))) {
if ($node->getAttribute("delbranch"))
$tnodes[] = array("type" => "TRASH", "depth" => $depth, "name" => $fld);
else
$tnodes[] = array("type" => "FIELD", "depth" => $depth, "name" => $fld);
}
else {
$tsy = array();
for ($n = $node->firstChild; $n; $n = $n->nextSibling) {
if ($n->nodeName == "sy") {
$id = $n->getAttribute("id");
if (array_key_exists($id . '.', $thits))
$hits = 0 + $thits[$id . '.'];
else
$hits = 0;
$tsy[] = array("v" => $n->getAttribute("v"), "lng" => $n->getAttribute("lng"), "hits" => $hits);
}
}
$tnodes[] = array("type" => "TERM", "depth" => $depth, "syns" => $tsy);
}
}
}
function export0($znode)
{
global $tnodes;
$tnodes = array();
$nodes = array();
$depth = 0;
for ($node = $znode->parentNode; $node; $node = $node->parentNode) {
if ($node->nodeType == XML_ELEMENT_NODE)
$nodes[] = $node;
}
$nodes = array_reverse($nodes);
foreach ($nodes as $depth => $node) {
// print( exportNode($node, $depth) );
exportNode($node, $depth);
}
export($znode, count($nodes));
printTNodes();
}
function export($node, $depth = 0)
{
global $tnodes;
if ($node->nodeType == XML_ELEMENT_NODE) {
// print( exportNode($node, $depth) );
exportNode($node, $depth);
}
for ($n = $node->firstChild; $n; $n = $n->nextSibling) {
if ($n->nodeName == "te")
export($n, $depth + 1);
}
}
?>
</body>
</html>

View File

@@ -1,191 +0,0 @@
<?php
/*
* This file is part of Phraseanet
*
* (c) 2005-2013 Alchemy
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
use Alchemy\Phrasea\Application;
/**
*
* @license http://opensource.org/licenses/gpl-3.0 GPLv3
* @link www.phraseanet.com
*/
require_once __DIR__ . "/../../vendor/autoload.php";
phrasea::headers(200, true);
$app = new Application();
$request = http_request::getInstance();
$parm = $request->get_parms(
"bid"
, "piv"
, "id"
, "typ"
, "dlg"
);
if ($parm["dlg"]) {
$opener = "window.dialogArguments.win";
} else {
$opener = "opener";
}
?>
<html lang="<?php echo $app['locale.I18n']; ?>">
<head>
<title><?php echo p4string::MakeString(_('thesaurus:: export au format texte')) ?></title>
<link REL="stylesheet" TYPE="text/css" HREF="./thesaurus.css?u=<?php echo mt_rand() ?>" />
<script type="text/javascript">
var format = "text";
function clkBut(button)
{
switch(button)
{
case "submit":
document.forms[0].action = "export_" + format + ".php";
document.forms[0].submit();
break;
case "cancel":
self.returnValue = null;
self.close();
break;
}
}
function loaded()
{
// document.forms[0].t.focus();
chgFormat();
}
function ckis()
{
document.getElementById("submit_button").disabled = document.forms[0].t.value=="";
}
function enable_inputs(o, stat)
{
if(o.nodeType==1) // element
{
if(o.nodeName=='INPUT')
{
if(stat)
o.removeAttribute('disabled');
else
o.setAttribute('disabled', true);
}
for(var oo=o.firstChild; oo; oo=oo.nextSibling)
enable_inputs(oo, stat)
}
}
function chgFormat()
{
var i, f;
/*
for(i=0; i<document.forms[0].ofm.length; i++)
{
f = document.forms[0].ofm[i].value;
if(document.forms[0].ofm[i].checked)
{
enable_inputs(document.getElementById('subform_'+f), true);
format = f;
}
else
{
enable_inputs(document.getElementById('subform_'+f), false);
}
}
*/
url = "./export_"+format+".php?bid=<?php echo $parm["bid"] ?>&piv=<?php echo $parm["piv"] ?>&id=<?php echo $parm["id"] ?>&typ=<?php echo $parm["typ"] ?>&dlg=0&smp=1";
/*
if(format == "text")
{
*/
url += "&osl=" + (document.forms[0].osl[0].checked ? "1" : "0");
url += "&iln=" + (document.forms[0].iln.checked ? "1" : "0");
url += "&hit=" + (document.forms[0].hit.checked ? "1" : "0");
url += "&ilg=" + (document.forms[0].ilg.checked ? "1" : "0");
/*
}
else
{
url += "&obr=<?php echo $parm['obr'] ?>";
}
*/
// alert(url);
document.getElementById("ifrsample").src = url;
}
</script>
</head>
<body onload="loaded();" class="dialog">
<center>
<br/>
<form onsubmit="clkBut('submit');return(false);" action="export_topics.php" target="EXPORT2">
<input type="hidden" name="bid" value="<?php echo $parm["bid"] ?>" >
<input type="hidden" name="piv" value="<?php echo $parm["piv"] ?>" >
<input type="hidden" name="id" value="<?php echo $parm["id"] ?>" >
<input type="hidden" name="typ" value="<?php echo $parm["typ"] ?>" >
<input type="hidden" name="dlg" value="<?php echo $parm["dlg"] ?>" >
<table>
<thead>
<tr>
<th><?php echo p4string::MakeString(_('thesaurus:: options d\'export : ')) ?></th>
<th><?php echo p4string::MakeString(_('thesaurus:: example')) ?></th>
</tr>
</thead>
<tbody>
<tr>
<td valign="top" style="padding:5px">
<div style="white-space:nowrap">
<input type='radio' name='ofm' checked value='text'>
<?php echo p4string::MakeString(_('thesaurus:: export au format texte')); ?>
</div>
<div id='subform_text' style="margin-left:10px;">
<div style="white-space:nowrap">
<input type='radio' name='osl' checked value='1' onclick="chgFormat();">
<?php echo p4string::MakeString(_('thesaurus:: exporter avec les synonymes sur la meme ligne')) /* Les synonymes sur la mme ligne */ ?>
</div>
<div style="white-space:nowrap">
<input type='radio' name='osl' value='0' onclick="chgFormat();">
<?php echo p4string::MakeString(_('thesaurus:: exporter avec une ligne par synonyme')) /* Une ligne par synonyme */ ?>
</div>
<div style="white-space:nowrap">
<input type='checkbox' name='iln' value='1' onclick="chgFormat();">
<?php echo p4string::MakeString(_('thesaurus:: export : numeroter les lignes ')) /* Numroter les lignes */ ?>
</div>
<div style="white-space:nowrap">
<input type='checkbox' name='ilg' value='1' onclick="chgFormat();">
<?php echo p4string::MakeString(_('thesaurus:: export : inclure la langue')) /* Inclure la langue */ ?>
</div>
<div style="white-space:nowrap">
<input type='checkbox' name='hit' value='1' onclick="chgFormat();">
<?php echo p4string::MakeString(_('thesaurus:: export : inclure les hits')) /* Inclure les 'hits' */ ?>
</div>
</div>
<!--
<div style="white-space:nowrap">
<input type='radio' name='ofm' value='topics' onclick="chgFormat();">
<?php echo p4string::MakeString(_('thesaurus:: export : format topics')) /* format topics */ ?>
</div>
<div id='subform_topics' style="margin-left:10px;">
</div>
-->
</td>
<td valign="top" style="padding:10px">
<iframe id="ifrsample" frameborder="0" scrolling="No" style="width:400px;height:150px;overflow:hidden;border: 0px solid #b0b0b0; " ></iframe>
</td>
</tr>
</tbody>
</table>
<br/>
<br/>
<input type="button" id="cancel_button" value="<?php echo p4string::MakeString(_('boutton::annuler')) ?>" onclick="clkBut('cancel');" style="width:100px;">
&nbsp;&nbsp;&nbsp;
<input type="button" id="submit_button" value="<?php echo p4string::MakeString(_('boutton::valider')) ?>" onclick="clkBut('submit');" style="width:100px;">
</form>
</center>
</body>
</html>

View File

@@ -1,274 +0,0 @@
<?php
/*
* This file is part of Phraseanet
*
* (c) 2005-2013 Alchemy
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
use Alchemy\Phrasea\Application;
/**
*
* @license http://opensource.org/licenses/gpl-3.0 GPLv3
* @link www.phraseanet.com
*/
require_once __DIR__ . "/../../vendor/autoload.php";
phrasea::headers(200, true);
$app = new Application();
$request = http_request::getInstance();
$parm = $request->get_parms(
"bid"
, "piv"
, "id"
, "typ"
, "dlg"
, 'obr' // liste des branches ouvertes
, 'ofm' // 'toscreen' ; 'tofiles'
, 'srt' // trie
, 'sth' // recherche 'thesaurus'
, 'sand' // full query, with 'and's
, 'obrf' // opened br format
);
if ($parm['ofm'] == 'toscreen') {
//header('Content-type: text/xml');
//header('Content-Disposition: attachment; filename="topics.xml"');
}
$lng = $app['locale'];
if ($parm["dlg"]) {
$opener = "window.dialogArguments.win";
} else {
$opener = "opener";
}
$obr = explode(';', $parm['obr']);
$t_lng = array();
if ($parm['ofm'] == 'tofiles') {
foreach (Application::getAvailableLanguages() as $lng_code => $lng) {
$lng_code = explode('_', $lng_code);
$lng_code = $lng_code[0];
$t_lng[] = $lng_code;
}
} else {
$t_lng[] = $parm['piv'];
}
switch ($parm['obrf']) {
case 'from_itf_closable':
$default_display = 'closed';
$opened_display = 'opened';
break;
case 'from_itf_static':
$default_display = 'closed';
$opened_display = 'static';
break;
case 'all_opened_closable':
$default_display = 'opened';
$opened_display = '';
break;
case 'all_opened_static':
$default_display = 'static';
$opened_display = '';
break;
case 'all_closed':
$default_display = 'closed';
$opened_display = '';
break;
}
$now = date('YmdHis');
?>
<html lang="<?php echo $app['locale.I18n']; ?>">
<head>
<title><?php echo p4string::MakeString(_('thesaurus:: export en topics')) ?></title>
<link REL="stylesheet" TYPE="text/css" HREF="./thesaurus.css?u=<?php echo mt_rand() ?>" />
<style>
.toscreen
{
background-color:#ffffff;
}
.tofiles
{
margin: 20px;
}
</style>
<script type="text/javascript">
function loaded()
{
// window.name="EXPORT2";
self.focus();
}
</script>
</head>
<body id="idbody" onload="loaded();" class="dialog">
<div class="<?php echo $parm['ofm'] ?>">
<?php
if ($parm["typ"] == "TH" || $parm["typ"] == "CT") {
$loaded = false;
try {
$databox = $app['phraseanet.appbox']->get_databox((int) $parm['bid']);
if ($parm["typ"] == "TH") {
$domth = $databox->get_dom_thesaurus();
} else {
$domth = $databox->get_dom_cterms();
}
if ($domth) {
$xpathth = new DOMXPath($domth);
if ($parm["id"] == "T")
$q = "/thesaurus";
elseif ($parm["id"] == "C")
$q = "/cterms";
else
$q = "//te[@id='" . $parm["id"] . "']";
if ($parm['ofm'] == 'toscreen')
printf("<pre style='font-size: 12px;'>\n");
foreach ($t_lng as $lng) {
$dom = new DOMDocument("1.0", "UTF-8");
$dom->standalone = true;
$dom->preserveWhiteSpace = false;
$dom->formatOutput = true;
$root = $dom->appendChild($dom->createElementNS('www.phraseanet.com', 'phraseanet:topics'));
$root->appendChild($dom->createComment(sprintf(_('thesaurus:: fichier genere le %s'), $now)));
$root->appendChild($dom->createElement('display'))
->appendChild($dom->createElement('defaultview'))
->appendChild($dom->createTextNode($default_display));
export0($xpathth->query($q)->item(0), $dom, $root, $lng);
if ($parm['ofm'] == 'toscreen') {
print(str_replace(array('&', '<', '>'), array('&amp;', '&lt;', '&gt;'), $dom->saveXML()));
} elseif ($parm['ofm'] == 'tofiles') {
$fname = 'topics_' . $lng . '.xml';
@rename($app['phraseanet.registry']->get('GV_RootPath') . 'config/topics/' . $fname, $app['phraseanet.registry']->get('GV_RootPath') . 'config/topics/topics_' . $lng . '_BKP_' . $now . '.xml');
if ($dom->save($app['phraseanet.registry']->get('GV_RootPath') . 'config/topics/' . $fname))
echo p4string::MakeString(sprintf(_('thesaurus:: fichier genere : %s'), $fname));
else
echo p4string::MakeString(_('thesaurus:: erreur lors de l\'enregsitrement du fichier'));
print("<br/><br/>\n");
}
}
if ($parm['ofm'] == 'toscreen')
print("</pre>\n");
}
} catch (Exception $e) {
}
}
if ($parm['ofm'] == 'tofiles') {
?>
<center>
<br/>
<br/>
<br/>
<input type="button" value="<?php echo p4string::MakeString(_('boutton::fermer')) ?>" onclick="self.close();" style="width:100px;">
</center>
<?php
}
?>
</div>
</body>
</html>
<?php
function export0($znode, &$dom, &$root, $lng)
{
$topics = $root->appendChild($dom->createElement('topics'));
export($znode, $dom, $topics, '', $lng, 0);
}
function export($node, &$dom, &$topics, $prevQuery, $lng, $depth = 0)
{
global $parm;
global $tnodes;
global $obr;
global $opened_display;
$ntopics = 0;
if ($node->nodeType == XML_ELEMENT_NODE) {
$t_node = array();
$t_sort = array();
$i = 0;
for ($n = $node->firstChild; $n; $n = $n->nextSibling) {
if ($n->nodeName == "te") {
$ntopics ++;
$label0 = $label = "";
$query0 = $query = "";
for ($n2 = $n->firstChild; $n2; $n2 = $n2->nextSibling) {
if ($n2->nodeName == "sy") {
if ( ! $query0) {
$query0 = $n2->getAttribute("w");
if ($n2->getAttribute("k"))
$query0 .= ( ' (' . $n2->getAttribute("k") . ')');
$label0 = $n2->getAttribute("v");
}
if ($n2->getAttribute("lng") == $lng) {
$query = $n2->getAttribute("w");
if ($n2->getAttribute("k"))
$query .= ( ' (' . $n2->getAttribute("k") . ')');
$label = $n2->getAttribute("v");
break;
}
}
}
if ( ! $query)
$query = $query0;
if ( ! $label)
$label = $label0;
$t_sort[$i] = $query; // tri sur w
$t_node[$i] = array('label' => $label, 'node' => $n);
$i ++;
}
}
if ($parm['srt'])
natcasesort($t_sort);
foreach ($t_sort as $i => $query) {
$topic = $topics->appendChild($dom->createElement('topic'));
// $topic->setAttribute('id', $n->getAttribute('id'));
if ($opened_display != '' && in_array($t_node[$i]['node']->getAttribute('id'), $obr))
$topic->setAttribute('view', $opened_display);
$topic->appendChild($dom->createElement('label'))->appendChild($dom->createTextNode($t_node[$i]['label']));
$query = '"' . $query . '"';
if ($parm['sth']) {
$query = '*:' . $query;
if ($parm['sand'])
$query = '(' . $query . ')';
}
if ($parm['sand'] && $prevQuery != '')
$query = $prevQuery . ' ' . _('phraseanet::technique:: et') . ' ' . $query . '';
$topic->appendChild($dom->createElement('query'))->appendChild($dom->createTextNode('' . $query . ''));
$topics2 = $dom->createElement('topics');
if (export($t_node[$i]['node'], $dom, $topics2, $query, $lng, $depth + 1) > 0)
$topic->appendChild($topics2);
}
}
return($ntopics);
}

View File

@@ -1,373 +0,0 @@
<?php
/*
* This file is part of Phraseanet
*
* (c) 2005-2013 Alchemy
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
use Alchemy\Phrasea\Application;
/**
*
* @license http://opensource.org/licenses/gpl-3.0 GPLv3
* @link www.phraseanet.com
*/
require_once __DIR__ . "/../../vendor/autoload.php";
phrasea::headers(200, true);
$app = new Application();
$request = http_request::getInstance();
$parm = $request->get_parms(
"bid"
, 'piv'
, "id"
, 't'
, 'dlg'
);
set_time_limit(300);
$imported = false;
$err = '';
if ($parm["bid"] !== null) {
$loaded = false;
try {
$databox = $app['phraseanet.appbox']->get_databox((int) $parm['bid']);
$connbas = connection::getPDOConnection($app, $parm['bid']);
$dom = $databox->get_dom_thesaurus();
if ($dom) {
$err = '';
if ($parm['id'] == '') {
// on importe un theaurus entier
$node = $dom->documentElement;
while ($node->firstChild)
$node->removeChild($node->firstChild);
$err = importFile($dom, $node);
} else {
// on importe dans une branche
$err = 'not implemented';
}
if ( ! $err) {
$imported = true;
$databox->saveThesaurus($dom);
}
}
if ( ! $err) {
$meta_struct = $databox->get_meta_structure();
foreach ($meta_struct->get_elements() as $meta_field) {
$meta_field->set_tbranch('')->save();
}
$dom = $databox->get_dom_cterms();
if ($dom) {
$node = $dom->documentElement;
while ($node->firstChild)
$node->removeChild($node->firstChild);
$databox->saveCterms($dom);
}
$sql = 'UPDATE RECORD SET status=status & ~3';
$stmt = $connbas->prepare($sql);
$stmt->execute();
$stmt->closeCursor();
}
} catch (Exception $e) {
}
}
if ($parm["dlg"]) {
$opener = "window.dialogArguments.win";
} else {
$opener = "opener";
}
?>
<html lang="<?php echo $app['locale.I18n']; ?>">
<body onload='parent.importDone("<?php print(p4string::MakeString($err, 'js')); ?>");'>
</body>
</html>
<?php
function checkEncoding($string, $string_encoding)
{
$fs = $string_encoding == 'UTF-8' ? 'UTF-32' : $string_encoding;
$ts = $string_encoding == 'UTF-32' ? 'UTF-8' : $string_encoding;
return $string === mb_convert_encoding(mb_convert_encoding($string, $fs, $ts), $ts, $fs);
}
function importFile($dom, $node)
{
global $parm;
$err = '';
$unicode = new unicode();
$cbad = array();
$cok = array();
for ($i = 0; $i < 32; $i ++ ) {
$cbad[] = chr($i);
$cok[] = '_';
}
if (($fp = fopen($_FILES['fil']['tmp_name'], 'rb'))) {
$iline = 0;
$curdepth = -1;
$tid = array(-1 => -1, 0 => -1);
while ( ! $err && ! feof($fp) && ($line = fgets($fp)) !== FALSE) {
$iline ++;
if (trim($line) == '')
continue;
for ($depth = 0; $line != '' && $line[0] == "\t"; $depth ++ )
$line = substr($line, 1);
if ($depth > $curdepth + 1) {
$err = sprintf(_("over-indent at line %s"), $iline);
continue;
}
$line = trim($line);
if ( ! checkEncoding($line, 'UTF-8')) {
$err = sprintf(_("bad encoding at line %s"), $iline);
continue;
}
$line = str_replace($cbad, $cok, ($oldline = $line));
if ($line != $oldline) {
$err = sprintf(_("bad character at line %s"), $iline);
continue;
}
while ($curdepth >= $depth) {
$curdepth --;
$node = $node->parentNode;
}
$curdepth = $depth;
$nid = (int) ($node->getAttribute('nextid'));
$id = $node->getAttribute('id') . '.' . $nid;
$pid = $node->getAttribute('id');
$te_id = ($pid ? ($pid . '.') : 'T') . $nid;
$node->setAttribute('nextid', (string) ($nid + 1));
$te = $node->appendChild($dom->createElement('te'));
$te->setAttribute('id', $te_id);
$node = $te;
$tsy = explode(';', $line);
$nsy = 0;
foreach ($tsy as $syn) {
$lng = $parm['piv'];
$hit = '';
$kon = '';
if (($ob = strpos($syn, '[')) !== false) {
if (($cb = strpos($syn, ']', $ob)) !== false) {
$lng = trim(substr($syn, $ob + 1, $cb - $ob - 1));
$syn = substr($syn, 0, $ob) . substr($syn, $cb + 1);
} else {
$lng = trim(substr($syn, $ob + 1));
$syn = substr($syn, 0, $ob);
}
if (($ob = strpos($syn, '[')) !== false) {
if (($cb = strpos($syn, ']', $ob)) !== false) {
$hit = trim(substr($syn, $ob + 1, $cb - $ob - 1));
$syn = substr($syn, 0, $ob) . substr($syn, $cb + 1);
} else {
$hit = trim(substr($syn, $ob + 1));
$syn = substr($syn, 0, $ob);
}
}
}
if (($ob = strpos($syn, '(')) !== false) {
if (($cb = strpos($syn, ')', $ob)) !== false) {
$kon = trim(substr($syn, $ob + 1, $cb - $ob - 1));
$syn = substr($syn, 0, $ob) . substr($syn, $cb + 1);
} else {
$kon = trim(substr($syn, $ob + 1));
$syn = substr($syn, 0, $ob);
}
}
$syn = trim($syn);
$sy = $node->appendChild($dom->createElement('sy'));
$sy->setAttribute('id', $te_id . '.' . $nsy);
$v = $syn;
if ($kon)
$v .= ' (' . $kon . ')';
$sy->setAttribute('v', $v);
$sy->setAttribute('w', $unicode->remove_indexer_chars($syn));
if ($kon)
$sy->setAttribute('k', $unicode->remove_indexer_chars($kon));
$sy->setAttribute('lng', $lng);
$nsy ++;
}
$te->setAttribute('nextid', (string) $nsy);
}
fclose($fp);
}
return($err);
}
function no_dof($dom, $node)
{
global $parm;
$unicode = new unicode();
$t = $parm['t'];
$t = preg_replace('/\\r|\\n/', '£', $t);
$t = preg_replace('/££*/', '£', $t);
$t = preg_replace('/£\\s*;/', ' ;', $t);
$tlig = explode('£', $t);
$mindepth = 999999;
foreach ($tlig as $lig) {
// echo('.');
// flush();
if (trim($lig) == '')
continue;
for ($depth = 0; $lig != '' && $lig[$depth] == "\t"; $depth ++ )
;
if ($depth < $mindepth)
$mindepth = $depth;
}
$curdepth = -1;
$tid = array(-1 => -1, 0 => -1);
foreach ($tlig as $lig) {
// echo('-');
// flush();
$lig = substr($lig, $mindepth);
if (trim($lig) == '')
continue;
for ($depth = 0; $lig != '' && $lig[0] == "\t"; $depth ++ )
$lig = substr($lig, 1);
// printf("curdepth=%s, depth=%s : %s\n", $curdepth, $depth, $lig);
if ($depth > $curdepth + 1) {
// error
// print('<span style="color:#ff0000">error over-indent at</span> \'' . $lig . "'\n");
continue;
}
while ($curdepth >= $depth) {
$curdepth --;
$node = $node->parentNode;
}
$curdepth = $depth;
$nid = (int) ($node->getAttribute('nextid'));
$id = $node->getAttribute('id') . '.' . $nid;
$pid = $node->getAttribute('id');
// print("pid=".$pid);
$te_id = ($pid ? ($pid . '.') : 'T') . $nid;
$node->setAttribute('nextid', (string) ($nid + 1));
$te = $node->appendChild($dom->createElement('te'));
$te->setAttribute('id', $te_id);
$node = $te;
$tsy = explode(';', $lig);
$nsy = 0;
foreach ($tsy as $syn) {
$lng = $parm['piv'];
$hit = '';
$kon = '';
if (($ob = strpos($syn, '[')) !== false) {
if (($cb = strpos($syn, ']', $ob)) !== false) {
$lng = trim(substr($syn, $ob + 1, $cb - $ob - 1));
$syn = substr($syn, 0, $ob) . substr($syn, $cb + 1);
} else {
$lng = trim(substr($syn, $ob + 1));
$syn = substr($syn, 0, $ob);
}
if (($ob = strpos($syn, '[')) !== false) {
if (($cb = strpos($syn, ']', $ob)) !== false) {
$hit = trim(substr($syn, $ob + 1, $cb - $ob - 1));
$syn = substr($syn, 0, $ob) . substr($syn, $cb + 1);
} else {
$hit = trim(substr($syn, $ob + 1));
$syn = substr($syn, 0, $ob);
}
}
}
if (($ob = strpos($syn, '(')) !== false) {
if (($cb = strpos($syn, ')', $ob)) !== false) {
$kon = trim(substr($syn, $ob + 1, $cb - $ob - 1));
$syn = substr($syn, 0, $ob) . substr($syn, $cb + 1);
} else {
$kon = trim(substr($syn, $ob + 1));
$syn = substr($syn, 0, $ob);
}
}
/*
*/
$syn = trim($syn);
// for($id='T',$i=0; $i<=$curdepth; $i++)
// $id .= '.' . $tid[$i];
// $id = '?';
// printf("depth=%s (%s) ; sy='%s', kon='%s', lng='%s', hit='%s' \n", $depth, $id, $syn, $kon, $lng, $hit);
/*
$nid = (int)($node->getAttribute('nextid'));
$pid = $node->getAttribute('id');
$id = ($pid ? ($pid.'.'):'T') . $nid ;
$node->setAttribute('nextid', (string)($nid+1));
*/
$sy = $node->appendChild($dom->createElement('sy'));
$sy->setAttribute('id', $te_id . '.' . $nsy);
$v = $syn;
if ($kon)
$v .= ' (' . $kon . ')';
$sy->setAttribute('v', $v);
$sy->setAttribute('w', $unicode->remove_indexer_chars($syn));
if ($kon)
$sy->setAttribute('k', $unicode->remove_indexer_chars($kon));
$sy->setAttribute('lng', $lng);
$nsy ++;
}
$te->setAttribute('nextid', (string) $nsy);
}
}

View File

@@ -1,122 +0,0 @@
<?php
/*
* This file is part of Phraseanet
*
* (c) 2005-2013 Alchemy
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
use Alchemy\Phrasea\Application;
/**
*
* @license http://opensource.org/licenses/gpl-3.0 GPLv3
* @link www.phraseanet.com
*/
require_once __DIR__ . "/../../vendor/autoload.php";
$app = new Application();
phrasea::headers(200, true);
$request = http_request::getInstance();
$parm = $request->get_parms(
"bid"
, "piv"
, "id"
, "dlg"
);
if ($parm["dlg"]) {
$opener = "window.dialogArguments.win";
} else {
$opener = "opener";
}
?>
<html lang="<?php echo $app['locale.I18n']; ?>">
<head>
<base target="_self">
<title><?php echo p4string::MakeString(_('thesaurus:: Importer')) ?></title>
<link REL="stylesheet" TYPE="text/css" HREF="./thesaurus.css?u=<?php echo mt_rand() ?>" />
<script type="text/javascript">
function clkBut(button)
{
switch(button)
{
case "submit":
document.forms[0].target='IFRIM';
document.forms[0].submit();
break;
case "cancel":
self.returnValue = null;
self.close();
break;
}
}
function loaded()
{
}
function importDone(err)
{
if(!err)
{
<?php echo $opener ?>.reload();
self.close();
}
else
{
alert(err);
}
}
</script>
</head>
<body onload="loaded();" class="dialog">
<br/>
<form onsubmit="clkBut('submit');return(false);" action="import.php" enctype="multipart/form-data" method="post">
<input type="hidden" name="bid" value="<?php echo $parm["bid"] ?>" >
<input type="hidden" name="piv" value="<?php echo $parm["piv"] ?>" >
<input type="hidden" name="id" value="<?php echo $parm["id"] ?>" >
<input type="hidden" name="dlg" value="<?php echo $parm["dlg"] ?>" >
<div>
<!--<div style="float:left"><?php echo p4string::MakeString(_('thesaurus:: coller ici la liste des termes a importer')); /* Coller ici la liste des termes e importer : */ ?></div>-->
<div style="float:right"><?php echo p4string::MakeString(_('thesaurus:: langue par default')) . "&nbsp;<img src='/skins/icons/flag_18.gif' />" . '&nbsp;' . $parm['piv']; ?></div>
</div>
<br/>
<!--<textarea name="t" style="width:550px; height:200px" value=""></textarea>
<br/>-->
<input type="hidden" name="MAX_FILE_SIZE" value="<?php echo(16 * 1024 * 1024) ?>" />
<!-- OU envoyer le fichier :-->
<?php echo _('Fichier ASCII tabule') ?>
<input type="file" name="fil" />&nbsp;(max 16Mo)
<br/>
<div style="text-align:center">
<!--
<div style="text-align:left; position:relative; top:0px; left:0px; display:inline; background-color:#ff0000; white-space:nowrap; xmargin-left:auto; xmargin-right:auto">
<p style="white-space:nowrap; width:auto">
<input type="checkbox" name="dlk" checked="1">Supprimer les liens des champs (tbranch)
</p>
<p style="white-space:nowrap; width:auto">
<input type="checkbox" name="rdx" checked="1">Reindexer la base apres l'import
</p>
</div>
-->
<table>
<tr>
<td style="text-align:left"><input type="checkbox" disabled="disabled" name="dlk" checked="checked"><?php echo p4string::MakeString(_('thesaurus:: supprimer les liens des champs tbranch')); /* Supprimer les liens des champs (tbranch) */ ?></td>
</tr>
<tr>
<td style="text-align:left"><input type="checkbox" disabled="disabled" name="rdx"><?php echo p4string::MakeString(_('thesaurus:: reindexer la base apres l\'import')); /* Reindexer la base apres l'import */ ?></td>
</tr>
</table>
<br/>
<input type="button" id="cancel_button" value="<?php echo p4string::MakeString(_('boutton::annuler')) ?>" onclick="clkBut('cancel');" style="width:100px;">
&nbsp;&nbsp;&nbsp;
<input type="button" id="submit_button" value="<?php echo p4string::MakeString(_('boutton::valider')) ?>" onclick="clkBut('submit');" style="width:100px;">
</div>
</form>
<iframe style="display:none; height:50px;" name="IFRIM"></iframe>
</body>
</html>

View File

@@ -1,159 +0,0 @@
<?php
/*
* This file is part of Phraseanet
*
* (c) 2005-2013 Alchemy
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
use Alchemy\Phrasea\Application;
/**
*
* @license http://opensource.org/licenses/gpl-3.0 GPLv3
* @link www.phraseanet.com
*/
require_once __DIR__ . "/../../vendor/autoload.php";
$app = new Application();
$request = http_request::getInstance();
$parm = $request->get_parms(
"bas", "res"
);
$conn = $app['phraseanet.appbox']->get_connection();
phrasea::headers();
// on liste les bases dont on peut éditer le thésaurus
// todo : ajouter 'bas_edit_thesaurus' dans sbasusr. pour l'instant on simule avec bas_edit_thesaurus=bas_bas_modify_struct
$sql = "SELECT
sbas.sbas_id,
(sbasusr.bas_manage) AS bas_manage,
(sbasusr.bas_modify_struct) AS bas_modify_struct,
(sbasusr.bas_modif_th) AS bas_edit_thesaurus
FROM
(usr INNER JOIN sbasusr ON usr.usr_id = :usr_id AND usr.usr_id=sbasusr.usr_id AND model_of=0)
INNER JOIN sbas ON sbas.sbas_id=sbasusr.sbas_id
HAVING bas_edit_thesaurus>0
ORDER BY sbas.ord";
?>
<html lang="<?php echo $app['locale.I18n']; ?>">
<head>
<meta http-equiv="X-UA-Compatible" content="chrome=1">
<title><?php echo $app['phraseanet.registry']->get('GV_homeTitle'); ?> - <?php echo p4string::MakeString(_('phraseanet:: thesaurus')) ?></title>
<link rel="shortcut icon" type="image/x-icon" href="/thesaurus2/favicon.ico">
<link REL="stylesheet" TYPE="text/css" HREF="./thesaurus.css?u=<?php echo mt_rand() ?>" />
</head>
<body onload="ckok();">
<br/>
<br/>
<br/>
<center>
<?php
$select_bases = "";
$nbases = 0;
$last_base = null;
$usr_id = $app['phraseanet.user']->get_id();
$stmt = $conn->prepare($sql);
$stmt->execute(array(':usr_id' => $app['phraseanet.user']->get_id()));
$rs = $stmt->fetchAll(PDO::FETCH_ASSOC);
$stmt->closeCursor();
foreach ($rs as $row) {
try {
$connbas = connection::getPDOConnection($app, $row['sbas_id']);
} catch (Exception $e) {
continue;
}
$name = phrasea::sbas_names($row['sbas_id'], $app);
$select_bases .= "<option value=\"" . $row["sbas_id"] . "\">" . $name . "</option>\n";
$last_base = array("sbid" => $row["sbas_id"], "name" => $name);
$nbases ++;
}
if ($nbases > 0) {
?>
<form name="fBase" action="./thesaurus.php" method="post">
<input type="hidden" name="res" value="<?php echo $parm["res"] ?>" />
<input type="hidden" name="uid" value="<?php echo $usr_id ?>" />
<?php echo p4string::MakeString(_('thesaurus:: Editer le thesaurus')) ?>
<?php
if ($nbases == 1) {
printf("\t<input type=\"hidden\" name=\"bid\" value=\"%s\"><b>%s</b><br/>\n", $last_base["sbid"], $last_base["name"]);
?>
<script type="text/javascript">
function ckok()
{
ck = false;
fl = document.getElementsByName("piv");
for(i=0; !ck && i<fl.length; i++)
ck = fl[i].checked;
document.getElementById("button_ok").disabled = !ck;
}
</script>
<?php
} else {
?>
<select name="bid" onchange="ckok();return(true);">
<option value=""><?php echo p4string::MakeString(_('phraseanet:: choisir')) /* Editer le thesaurus de la base : */ ?></option>
<?php echo $select_bases ?>
</select>
<?php ?>
<br/>
<script type="text/javascript">
function ckok()
{
ck = false;
fl = document.getElementsByName("piv");
for(i=0; !ck && i<fl.length; i++)
ck = fl[i].checked;
ck &= document.forms[0].bid.selectedIndex > 0;
document.getElementById("button_ok").disabled = !ck;
}
</script>
<br/>
<table>
<?php
}
$nf = 0;
foreach (Application::getAvailableLanguages() as $lng_code => $lng) {
$lng_code = explode('_', $lng_code);
$lng_code = $lng_code[0];
printf("<tr><td>%s</td>", $nf == 0 ? p4string::MakeString(_('thesaurus:: langue pivot')) /* Langue pivot : */ : "");
print("<td style=\"text-align:left\"><input type='radio' onclick=\"ckok();return(true);\" value='$lng_code' name='piv'><img src='/skins/lng/" . $lng_code . "_flag_18.gif' />&nbsp;(" . $lng_code . ")</td></tr>\n");
$nf ++;
}
?>
</table>
<br/>
<br/>
<input id="button_ok" type="submit" style="width:80px;" value="<?php echo p4string::MakeString(_('boutton::valider')) ?>" /><br/>
</form>
<?php
} else {
?>
<?php echo p4string::MakeString(_('thesaurus:: Vous n\'avez acces a aucune base')) ?>
<script type="text/javascript">
function ckok()
{
}
</script>
<?php
}
?>
</center>
</body>
</html>

View File

@@ -1,145 +0,0 @@
<?php
/*
* This file is part of Phraseanet
*
* (c) 2005-2013 Alchemy
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
use Alchemy\Phrasea\Application;
/**
*
* @license http://opensource.org/licenses/gpl-3.0 GPLv3
* @link www.phraseanet.com
*/
require_once __DIR__ . "/../../vendor/autoload.php";
phrasea::headers(200, true);
$app = new Application();
$request = http_request::getInstance();
$parm = $request->get_parms(
"bid"
, "piv"
, "tid"
);
?>
<html lang="<?php echo $app['locale.I18n']; ?>">
<head>
<title><?php echo p4string::MakeString(_('thesaurus:: Lier la branche de thesaurus au champ')) ?></title>
<link REL="stylesheet" TYPE="text/css" HREF="./thesaurus.css?u=<?php echo mt_rand() ?>" />
<script type="text/javascript">
function ckField()
{
fields = document.getElementsByName("field[]");
changed = false;
for(i=0; i<fields.length && !changed; i++)
{
if( (fields[i].checked?"1":"0") != fields[i].ck0)
changed = true;
}
document.getElementById("submit_button").disabled = !changed;
return(true);
}
function clkBut(button)
{
switch(button)
{
case "submit":
// document.forms[0].target="LINKFIELD";
document.forms[0].submit();
break;
case "cancel":
self.close();
break;
}
}
function loaded()
{
window.name="LINKFIELD";
ckField();
}
</script>
</head>
<body onload="loaded();" class="dialog">
<?php
if ($parm["bid"] !== null) {
$loaded = false;
try {
$databox = $app['phraseanet.appbox']->get_databox((int) $parm['bid']);
$domstruct = $databox->get_dom_structure();
$domth = $databox->get_dom_thesaurus();
if ($domstruct && $domth) {
$xpathth = new DOMXPath($domth);
$xpathstruct = new DOMXPath($domstruct);
if ($parm["tid"] !== "")
$q = "//te[@id='" . $parm["tid"] . "']";
else
$q = "//te[not(@id)]";
$nodes = $xpathth->query($q);
$fullBranch = "";
if ($nodes->length == 1) {
for ($n = $nodes->item(0); $n && $n->nodeType == XML_ELEMENT_NODE && $n->getAttribute("id") !== ""; $n = $n->parentNode) {
$sy = $xpathth->query("sy", $n)->item(0);
$sy = $sy ? $sy->getAttribute("v") : "";
if ( ! $sy)
$sy = $sy = "...";
$fullBranch = " / " . $sy . $fullBranch;
}
}
?>
<center>
<form action="linkfield2.php" method="post" target="LINKFIELD">
<input type="hidden" name="piv" value="<?php echo $parm["piv"] ?>">
<input type="hidden" name="bid" value="<?php echo $parm["bid"] ?>">
<input type="hidden" name="tid" value="<?php echo $parm["tid"] ?>">
<?php
$fbhtml = "<br/><b>" . $fullBranch . "</b><br/>";
printf(_('thesaurus:: Lier la branche de thesaurus au champ %s'), $fbhtml);
?>
<div style="width:70%; height:200px; overflow:scroll;" class="x3Dbox">
<?php
$nodes = $xpathstruct->query("/record/description/*");
for ($i = 0; $i < $nodes->length; $i ++ ) {
$fieldname = $nodes->item($i)->nodeName;
$tbranch = $nodes->item($i)->getAttribute("tbranch");
$ck = "";
if ($tbranch) {
// ce champ a deje un tbranch, est-ce qu'il pointe sur la branche selectionnee ?
$thnodes = $xpathth->query($tbranch);
for ($j = 0; $j < $thnodes->length; $j ++ ) {
if ($thnodes->item($j)->getAttribute("id") == $parm["tid"]) {
$ck = "checked";
}
}
}
printf("\t\t<input type=\"checkbox\" name=\"field[]\" value=\"%s\" %s ck0=\"%s\" onclick=\"return(ckField());\">%s<br/>\n"
, $fieldname, $ck, $ck ? "1" : "0", $fieldname);
}
?>
</div>
<br/>
<input type="button" id="submit_button" value="<?php echo p4string::MakeString(_('boutton::valider')) ?>" onclick="clkBut('submit');">
&nbsp;&nbsp;&nbsp;
<input type="button" id="cancel_button" value="<?php echo p4string::MakeString(_('boutton::annuler')) ?>" onclick="clkBut('cancel');">
</form>
</center>
<?php
}
} catch (Exception $e) {
}
}
?>
</body>
</html>

View File

@@ -1,175 +0,0 @@
<?php
/*
* This file is part of Phraseanet
*
* (c) 2005-2013 Alchemy
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
use Alchemy\Phrasea\Application;
/**
*
* @license http://opensource.org/licenses/gpl-3.0 GPLv3
* @link www.phraseanet.com
*/
require_once __DIR__ . "/../../vendor/autoload.php";
phrasea::headers(200, true);
$app = new Application();
$request = http_request::getInstance();
$parm = $request->get_parms(
"bid"
, "piv"
, "tid"
, "field"
);
?>
<html lang="<?php echo $app['locale.I18n']; ?>">
<head>
<title><?php echo p4string::MakeString(_('thesaurus:: Lier la branche de thesaurus')) ?></title>
<link REL="stylesheet" TYPE="text/css" HREF="./thesaurus.css?u=<?php echo mt_rand() ?>" />
<script type="text/javascript">
function clkBut(button)
{
switch(button)
{
case "submit":
document.forms[0].submit();
break;
case "cancel":
self.close();
break;
}
}
function loaded()
{
window.name="LINKFIELD";
}
</script>
</head>
<body onload="loaded();" class="dialog">
<center>
<?php
if ($parm["field"] == NULL)
$parm["field"] = array();
$parm["field"] = array_flip($parm["field"]);
if ($parm["bid"] !== null) {
$loaded = false;
try {
$databox = $app['phraseanet.appbox']->get_databox((int) $parm['bid']);
$domstruct = $databox->get_dom_structure();
$domth = $databox->get_dom_thesaurus();
if ($domstruct && $domth) {
$xpathth = new DOMXPath($domth);
$xpathstruct = new DOMXPath($domstruct);
?>
<form action="linkfield3.php" method="post" target="LINKFIELD">
<input type="hidden" name="piv" value="<?php echo $parm["piv"] ?>">
<input type="hidden" name="bid" value="<?php echo $parm["bid"] ?>">
<input type="hidden" name="tid" value="<?php echo $parm["tid"] ?>">
<br/>
<br/>
<br/>
<div style="width:70%; height:200px; overflow:scroll;" class="x3Dbox">
<?php
$needreindex = false;
$nodes = $xpathstruct->query("/record/description/*");
for ($i = 0; $i < $nodes->length; $i ++ ) {
$fieldname = $nodes->item($i)->nodeName;
$tbranch = $nodes->item($i)->getAttribute("tbranch");
$ck = false;
$tids = array(); // les ids de branches liees e ce champ
if ($tbranch) {
// ce champ a deje un tbranch, on balaye les branches auxquelles il est lie
$thnodes = $xpathth->query($tbranch);
for ($j = 0; $j < $thnodes->length; $j ++ ) {
if ($thnodes->item($j)->getAttribute("id") == $parm["tid"]) {
// il etait deje lie e la branche selectionnee
$tids[$thnodes->item($j)->getAttribute("id")] = $thnodes->item($j);
$ck = true;
} else {
// il etait lie e une autre branche
$tids[$thnodes->item($j)->getAttribute("id")] = $thnodes->item($j);
}
}
}
// printf("'%s' avant:%s apres:%s<br/>\n", $fieldname, $ck, array_key_exists($fieldname, $parm["field"]));
if (array_key_exists($fieldname, $parm["field"]) != $ck) {
print("\t\t<hr/>");
echo "<b>" . $fieldname . "</b>" . p4string::MakeString(sprintf(_('thesaurus:: Ce champ a ete modifie ; ancienne branche : %s '), $tbranch));
print("<br/>\n");
if ($ck) {
// print("il etait lie a la branche, il ne l'est plus<br/>\n");
unset($tids[$parm["tid"]]);
} else {
// print("il n'etait pas lie a la branche, il l'est maintenant<br/>\n");
$tids[$parm["tid"]] = $xpathth->query("/thesaurus//te[@id='" . thesaurus::xquery_escape($parm["tid"]) . "']")->item(0);
}
$newtbranch = "";
foreach ($tids as $kitd => $node) {
if ($kitd === "")
$newtbranch .= ( $newtbranch ? " | " : "") . "/thesaurus";
else {
// $newtbranch .= ($newtbranch?" | ":"") . "/thesaurus//te[@id='" . $kitd . "']";
$neb = "";
while ($node && $node->nodeName == "te") {
$neb = "/te[@id='" . $node->getAttribute("id") . "']" . $neb;
$node = $node->parentNode;
}
$newtbranch .= ( $newtbranch ? " | " : "") . "/thesaurus" . $neb;
}
}
echo p4string::MakeString(_('thesaurus:: nouvelle branche')) . $newtbranch;
print("<br/>\n");
if ($tbranch != "" && $newtbranch == "") {
echo "<b>" . $fieldname . "</b>" . p4string::MakeString(_('thesaurus:: ce champ n\'est plus lie au thesaurus, les termes indexes et candidats seront supprimes'));
print("<br/>\n");
printf("\t\t<input type=\"hidden\" name=\"f2unlk[]\" value=\"%s\">\n", $fieldname);
}
if ($newtbranch != "") {
if ($tbranch == "") {
echo "<b>" . $fieldname . "</b>" . p4string::MakeString(_('thesaurus:: ce champ doit etre lie au thesaurus. La reindexation de la base est necessaire'));
} else {
echo "<b>" . $fieldname . "</b>" . p4string::MakeString(_('thesaurus:: le lien au thesaurus doit etre modifie, la reindexation de la base est necessaire'));
}
print("<br/>\n");
$needreindex = true;
printf("\t\t<input type=\"hidden\" name=\"fbranch[]\" value=\"%s\">\n", $fieldname . "<" . $newtbranch);
}
}
}
?>
</div>
<?php
if ($needreindex) {
print("\t\t<input type=\"hidden\" name=\"reindex\" value=\"1\">\n");
print("<div style='position:absolute; top:5px; left:0px; width:100%; text-align:center; color:red'>" . p4string::MakeString(_('thesaurus:: reindexation necessaire')) /* Reindexation necessaire ! */ . "</div>");
} else {
print("<div style='position:absolute; top:5px; left:0px; width:100%; text-align:center; color:green'>" . p4string::MakeString(_('thesaurus:: pas de reindexation')) /* Pas de reindexation necessaire ! */ . "</div>");
}
?>
<br/>
<input type="button" id="submit_button" value="<?php echo p4string::MakeString(_('boutton::valider')) ?>" onclick="clkBut('submit');">
&nbsp;&nbsp;&nbsp;
<input type="button" id="cancel_button" value="<?php echo p4string::MakeString(_('boutton::annuler')) ?>" onclick="clkBut('cancel');">
</form>
<?php
}
} catch (Exception $e) {
}
}
?>
</center>
</body>
</html>

View File

@@ -1,138 +0,0 @@
<?php
/*
* This file is part of Phraseanet
*
* (c) 2005-2013 Alchemy
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
use Alchemy\Phrasea\Application;
/**
*
* @license http://opensource.org/licenses/gpl-3.0 GPLv3
* @link www.phraseanet.com
*/
require_once __DIR__ . "/../../vendor/autoload.php";
phrasea::headers(200, true);
$app = new Application();
$request = http_request::getInstance();
$parm = $request->get_parms(
"bid"
, "piv"
, "f2unlk"
, "fbranch"
, "reindex"
);
?>
<html lang="<?php echo $app['locale.I18n']; ?>">
<head>
<title><?php echo p4string::MakeString(_('thesaurus:: Lier la branche de thesaurus')) ?></title>
<link REL="stylesheet" TYPE="text/css" HREF="./thesaurus.css?u=<?php echo mt_rand() ?>" />
</head>
<body class="dialog">
<center>
<br/>
<br/>
<br/>
<form onsubmit="return(false);">
<div style="width:70%; height:200px; overflow:scroll;" class="x3Dbox">
<?php
if ($parm["f2unlk"] == NULL)
$parm["f2unlk"] = array();
if ($parm["fbranch"] == NULL)
$parm["fbranch"] = array();
if ($parm["bid"] !== null) {
$loaded = false;
try {
$databox = $app['phraseanet.appbox']->get_databox((int) $parm['bid']);
$connbas = connection::getPDOConnection($app, $parm['bid']);
$meta_struct = $databox->get_meta_structure();
$domct = $databox->get_dom_cterms();
$domst = $databox->get_dom_structure();
if ($domct && $domst) {
$xpathct = new DOMXPath($domct);
$xpathst = new DOMXPath($domst);
$ctchanged = false;
$candidates2del = array();
foreach ($parm["f2unlk"] as $f2unlk) {
$q = "/cterms/te[@field='" . thesaurus::xquery_escape($f2unlk) . "']";
$nodes = $xpathct->query($q);
for ($i = 0; $i < $nodes->length; $i ++ ) {
$candidates2del[] = array("field" => $f2unlk, "node" => $nodes->item($i));
}
echo p4string::MakeString(sprintf(_('thesaurus:: suppression du lien du champ %s'), $f2unlk));
print("<br/>\n");
$field = $meta_struct->get_element_by_name($f2unlk);
if ($field)
$field->set_tbranch('')->save();
}
foreach ($candidates2del as $candidate2del) {
echo p4string::MakeString(sprintf(_('thesaurus:: suppression de la branche de mot candidats pour le champ %s'), $candidate2del["field"]));
print("<br/>\n");
$candidate2del["node"]->parentNode->removeChild($candidate2del["node"]);
$ctchanged = true;
}
foreach ($parm["fbranch"] as $fbranch) {
$p = strpos($fbranch, "<");
if ($p > 1) {
$fieldname = substr($fbranch, 0, $p);
$tbranch = substr($fbranch, $p + 1);
$field = $meta_struct->get_element_by_name($fieldname);
if ($field)
$field->set_tbranch($tbranch)->save();
echo p4string::MakeString(sprintf(_('thesaurus:: suppression de la branche de mot candidats pour le champ %s'), $fieldname));
print("<br/>\n");
}
}
if ($ctchanged) {
if ($ctchanged) {
$databox->saveCterms($domct);
print(p4string::MakeString(_('thesaurus:: enregistrement de la liste modifiee des mots candidats.')));
print("<br/>\n");
}
}
}
$sql = "DELETE FROM thit WHERE name = :name";
$stmt = $connbas->prepare($sql);
foreach ($parm["f2unlk"] as $f2unlk) {
$stmt->execute(array(':name' => $f2unlk));
echo p4string::MakeString(_('thesaurus:: suppression des indexes vers le thesaurus pour le champ') . " <b>" . $f2unlk . "</b>");
print("<br/>\n");
}
$stmt->closeCursor();
if ($parm["reindex"]) {
$sql = "UPDATE record SET status=status & ~2";
$stmt = $connbas->prepare($sql);
$stmt->execute();
$stmt->closeCursor();
echo p4string::MakeString(_('thesaurus:: reindexer tous les enregistrements'));
print("<br/>\n");
}
} catch (Exception $e) {
}
}
?>
</div>
<br/>
<input type="button" value="<?php echo p4string::MakeString(_('boutton::fermer')) ?>" onclick="self.close();">
</form>
</center>
</body>
</html>

View File

@@ -1,206 +0,0 @@
<?php
/*
* This file is part of Phraseanet
*
* (c) 2005-2013 Alchemy
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
use Alchemy\Phrasea\Application;
/**
*
* @license http://opensource.org/licenses/gpl-3.0 GPLv3
* @link www.phraseanet.com
*/
require_once __DIR__ . "/../../vendor/autoload.php";
$app = new Application();
phrasea::headers();
$request = http_request::getInstance();
$parm = $request->get_parms(
"bid", "piv", "repair"
);
function fixW(&$node, $depth = 0)
{
if ($node && $node->nodeType == XML_ELEMENT_NODE) {
if (($v = $node->getAttribute("v")) != "") {
$unicode = new unicode();
$node->setAttribute("w", $unicode->remove_indexer_chars($v));
}
for ($c = $node->firstChild; $c; $c = $c->nextSibling)
fixW($c, $depth + 1);
}
}
if ($hdir = opendir($app['phraseanet.registry']->get('GV_RootPath') . "www/thesaurus2/patch")) {
while (false !== ($file = readdir($hdir))) {
if (substr($file, 0, 1) == ".")
continue;
if (is_file($f = $app['phraseanet.registry']->get('GV_RootPath') . "www/thesaurus2/patch/" . $file)) {
require_once($f);
print("<!-- patch '$f' included -->\n");
}
}
closedir($hdir);
}
function fixThesaurus(&$domct, &$domth, &$connbas)
{
$oldversion = $version = $domth->documentElement->getAttribute("version");
// $cls = "patch_th_".str_replace(".","_",$version);
//printf("---- %s %s %s \n", $version, $cls, class_exists($cls) );
//printf("---- %s %s \n", $version, $cls );
while (class_exists($cls = "patch_th_" . str_replace(".", "_", $version), false)) {
print("// ============== patching from version='$version'\n");
$last_version = $version;
$zcls = new $cls;
print("// ----------- calling class '$cls'\n");
$version = $zcls->patch($version, $domct, $domth, $connbas);
print("// ----------- method 'patch' -> returned '$version'\n");
if ($version == $last_version)
break;
}
return($version);
}
?>
<script language="javascript">
<?php
$th = $ct = $name = "";
$found = false;
if ($parm["bid"] !== null) {
$name = phrasea::sbas_names($parm['bid'], $app);
$loaded = false;
try {
$databox = $app['phraseanet.appbox']->get_databox((int) $parm['bid']);
$connbas = connection::getPDOConnection($app, $parm['bid']);
$domct = $databox->get_dom_cterms();
$domth = $databox->get_dom_thesaurus();
?>
parent.currentBaseId = <?php echo $parm["bid"] ?>;
parent.currentBaseName = "<?php echo p4string::MakeString($name, "js") ?>";
parent.document.title = "<?php echo p4string::MakeString(_('phraseanet:: thesaurus'), "js") ?>";
parent.document.getElementById("baseName").innerHTML = "<?php echo p4string::MakeString(_('phraseanet:: thesaurus'), "js") /* thesaurus de la base xxx */ ?>";
parent.thesaurusChanged = false;
<?php
$now = date("YmdHis");
if ( ! $domct && $parm['repair'] == 'on') {
$domct = new DOMDocument();
$domct->load("./blank_cterms.xml");
$domct->documentElement->setAttribute("creation_date", $now);
$databox->saveCterms($domct);
}
if ( ! $domth && $parm['repair'] == 'on') {
$domth = new DOMDocument();
$domth->load("./blank_thesaurus.xml");
$domth->documentElement->setAttribute("creation_date", $now);
$databox->saveThesaurus($domth);
}
if ($domct && $domth) {
$oldversion = $domth->documentElement->getAttribute("version");
if (($version = fixThesaurus($domct, $domth, $connbas)) != $oldversion) {
print("alert('" . utf8_encode("le thesaurus a ete converti en version $version") . "');\n");
$databox->saveCterms($domct);
$databox->saveThesaurus($domth);
}
$xpathct = new DOMXPath($domct);
// on cherche la branche 'deleted' dans les cterms
$nodes = $xpathct->query("/cterms/te[@delbranch='1']");
if ($nodes && ($nodes->length > 0)) {
// on change le nom e la volee
$nodes->item(0)->setAttribute("field", _('thesaurus:: corbeille'));
}
print("parent.document.getElementById(\"T0\").innerHTML='");
print(str_replace(array("'", "\n", "\r"), array("\\'", "", ""), $html = cttohtml($domct, $name)));
print("';\n");
print("parent.document.getElementById(\"T1\").innerHTML='");
print(str_replace(array("'", "\n", "\r"), array("\\'", "", ""), $html = thtohtml($domth, "THE", $name)));
print("';\n");
} else {
?>
if(confirm("Thesaurus ou CTerms invalide\n effacer (OK) ou quitter (Annuler) ?"))
{
parent.document.forms['fBase'].repair.value = "on";
parent.document.forms['fBase'].submit();
}
else
{
parent.window.close();
}
<?php
}
} catch (Exception $e) {
}
}
function cttohtml($ctdom, $name)
{
$html = "<DIV class='glossaire' id='CTERMS'>";
// $html .= " <div id='TCE_C' class='s_' style='display:none'><u id='THP_C'>-</u>STOCK</div>\n";
$html .= " <div id='TCE_C' class='s_' style='font-weight:900'><u id='THP_C'>-</u>" . ($name) . "</div>\n";
// $html .= " <div id='THB_C' class='ctroot'>\n";
$html .= " <div id='THB_C' class='OB'>\n";
for ($ct = $ctdom->documentElement->firstChild; $ct; $ct = $ct->nextSibling) {
if ($ct->nodeName == "te") {
$id = $ct->getAttribute("id");
$t = $ct->getAttribute("field");
$html .= " <div id='TCE_$id' class='s_'><u id='THP_$id'>+</u>" . ($t) . "</div>\n";
$html .= " <div id='THB_$id' class='ob'>\n";
$html .= " </div>\n";
}
}
$html .= " </div>";
$html .= "</DIV>";
return($html);
}
function thtohtml($thdom, $typ, $name)
{
$html = "<DIV class='glossaire'>\n";
$html .= " <div id='" . $typ . "_T' class='s_' style='font-weight:900'><u id='THP_T'>+</u>" . ($name) . "</div>\n";
$html .= " <div id='THB_T' class='ob'>\n";
for ($n = $thdom->documentElement->firstChild; $n; $n = $n->nextSibling) {
// if($n->nodeName=="te")
// tetohtml($n, $html);
}
$html .= " </div>\n";
$html .= "</DIV>";
return($html);
}
function tetohtml($tenode, &$html, $depth = 0)
{
$tab = str_repeat("\t", $depth);
$id = $tenode->getAttribute("id");
$nextid = $tenode->getAttribute("nextid");
$t = "";
for ($n = $tenode->firstChild; $n; $n = $n->nextSibling) {
if ($n->nodeName == "sy")
$t .= $t ? " ; " : "" . $n->getAttribute("v");
}
// if($t=="")
// $t = $depth==0 ? "THESAURUS" : "!vide/empty!";
$t = str_replace(array("&", "<", ">", "\""), array("&amp;", "&lt;", "&gt;", "&quot;"), $t);
$html .= "$tab<div id='THE_$id' class='s_'><u id='THP_$id'>+</u>" . $t . "</div>\n";
$html .= "$tab<div id='THB_$id' class='ob'>\n";
$html .= "$tab</div>\n";
}
?>
</script>

View File

@@ -1,126 +0,0 @@
<?php
/*
* This file is part of Phraseanet
*
* (c) 2005-2013 Alchemy
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
use Alchemy\Phrasea\Application;
/**
*
* @license http://opensource.org/licenses/gpl-3.0 GPLv3
* @link www.phraseanet.com
*/
require_once __DIR__ . "/../../vendor/autoload.php";
phrasea::headers(200, true);
$app = new Application();
$request = http_request::getInstance();
$parm = $request->get_parms(
"piv"
, "typ" // type de dlg : "TS"=nouvo terme specifique ; "SY"=nouvo synonyme
);
$lng = $app['locale'];
switch ($parm["typ"]) {
case "TS":
$tstr = array(p4string::MakeString(_('thesaurus:: Nouveau terme')), p4string::MakeString(_('thesaurus:: terme')));
break;
case "SY":
$tstr = array(p4string::MakeString(_('thesaurus:: Nouveau synonyme')), p4string::MakeString(_('thesaurus:: synonyme')));
break;
default:
$tstr = array("", "");
break;
}
?>
<html lang="<?php echo $app['locale.I18n']; ?>">
<head>
<title><?php echo $tstr[0] ?></title>
<link REL="stylesheet" TYPE="text/css" HREF="./thesaurus.css?u=<?php echo mt_rand() ?>" />
<script type="text/javascript">
self.returValue = null;
function clkBut(button)
{
switch(button)
{
case "submit":
t = document.forms[0].term.value;
k = document.forms[0].context.value;
if(k != "")
t += " ("+k+")";
self.returnValue = {"t":t, "lng":null };
for(i=0; i<(n=document.getElementsByName("lng")).length; i++)
{
if(n[i].checked)
{
self.returnValue.lng = n[i].value;
break;
}
}
// self.setTimeout('self.close();', 3000);
self.close();
break;
case "cancel":
self.close();
break;
}
}
</script>
</head>
<body class="dialog" onload="self.document.forms[0].term.focus();">
<br/>
<form onsubmit="return(false);">
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td style="text-align:right; width:80px;"><?php echo $tstr[1] ?> :&nbsp;</td>
<td></td>
<td><input type="text" style="width:250px;" name="term"></td>
</tr>
<tr>
<td style="text-align:right"><?php echo p4string::MakeString(_('thesaurus:: contexte')) /* Contexte */ ?> :&nbsp;</td>
<td><b>(</b>&nbsp;</td>
<td><input type="text" style="width:250px;" name="context">&nbsp;<b>)</b></td>
</tr>
<tr>
<td valign="bottom" style="text-align:right"><?php echo p4string::MakeString(_('phraseanet:: language')) /* Langue */ ?> :&nbsp;</td>
<td></td>
<td valign="bottom">
<?php
foreach (Application::getAvailableLanguages() as $lng_code => $lng) {
$lng_code = explode('_', $lng_code);
$lng_code = $lng_code[0];
$ck = $lng_code == $parm["piv"] ? " checked" : "";
?>
<span style="display:inline-block">
<input type="radio" <?php echo $ck ?> name="lng" value="<?php echo $lng_code ?>" id="lng_<?php echo $lng_code ?>">
<label for="lng_<?php echo $lng_code ?>"><img src="/skins/lng/<?php echo $lng_code ?>_flag_18.gif" />(<?php echo $lng_code ?>)</label>
</span>
&nbsp;&nbsp;
<?php
}
?>
</td>
</tr>
</table>
<br/>
<div style="position:absolute; left:0px; bottom:0px; width:100%; text-align:center">
<input type="button" style="width:80px;" id="cancel_button" value="<?php echo p4string::MakeString(_('boutton::annuler')) ?>" onclick="clkBut('cancel');" style="width:80px">
&nbsp;&nbsp;
<input type="button" style="width:80px;" id="submit_button" value="<?php echo p4string::MakeString(_('boutton::valider')) ?>" onclick="clkBut('submit');" style="width:80px">
<br/>
<br/>
</div>
</form>
</body>
</html>

View File

@@ -1,327 +0,0 @@
<?php
/*
* This file is part of Phraseanet
*
* (c) 2005-2013 Alchemy
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
use Alchemy\Phrasea\Application;
/**
*
* @license http://opensource.org/licenses/gpl-3.0 GPLv3
* @link www.phraseanet.com
*/
require_once __DIR__ . "/../../vendor/autoload.php";
phrasea::headers(200, true);
$app = new Application();
require($app['phraseanet.registry']->get('GV_RootPath') . "www/thesaurus2/xmlhttp.php");
$request = http_request::getInstance();
$parm = $request->get_parms(
"bid"
, "piv" // pivot
, "pid"
, "t"
, "sylng" // lng nouvo sy
, "typ" // "TS" ou "SY"
, "dlg"
);
?>
<html lang="<?php echo $app['locale.I18n']; ?>">
<head>
<title><?php echo $parm["typ"] == "TS" ? p4string::MakeString(_('thesaurus:: Nouveau terme specifique')) : p4string::MakeString(_('thesaurus:: Nouveau synonyme')) ?></title>
<link REL="stylesheet" TYPE="text/css" HREF="./thesaurus.css?u=<?php echo mt_rand() ?>" />
<script type="text/javascript" src="./xmlhttp.js"></script>
<script type="text/javascript">
</script>
</head>
<body onload="loaded();" class="dialog" style="text-align:center">
<?php
if ($parm["dlg"]) {
$opener = "window.dialogArguments.win";
} else {
$opener = "opener";
}
// print($parm["t"]);
list($term, $context) = splitTermAndContext($parm["t"]);
$url = "thesaurus2/xmlhttp/searchcandidate.x.php";
$url .= "?bid=" . $parm["bid"];
$url .= "&pid=" . $parm["pid"];
$url .= "&piv=" . $parm["piv"];
$url .= "&t=" . urlencode($term);
// if($context != "")
$url .= "&k=" . urlencode($context);
$dom = xmlhttp($url);
$zterm = p4string::MakeString(sprintf(_('thesaurus:: le terme %s'), "<b>" . $term . "</b> "));
if ($context != "")
$zterm .= p4string::MakeString(sprintf(_('thesaurus:: avec contexte %s'), "<b>" . $context . "</b>"));
else
$zterm .= p4string::MakeString(_('thesaurus:: sans contexte'));
// print($dom->saveXML());
$xpath = new DOMXPath($dom);
$candidates = $xpath->query("/result/candidates_list/ct");
// on verifie si au moins un champ candidat est acceptable
$nb_candidates_ok = $nb_candidates_bad = 0;
$flist_ok = $flist_bad = "";
for ($i = 0; $i < $candidates->length; $i ++ ) {
if ($candidates->item($i)->getAttribute("sourceok") == "1") { // && $candidates->item($i)->getAttribute("cid"))
$flist_ok .= ( $flist_ok ? ", " : "") . $candidates->item($i)->getAttribute("field");
$nb_candidates_ok ++;
} else {
$flist_bad .= ( $flist_bad ? ", " : "") . $candidates->item($i)->getAttribute("field");
$nb_candidates_bad ++;
}
}
if ($nb_candidates_ok > 0) {
// au moins un champ est acceptable : on presente des radio
if ($nb_candidates_ok == 1)
$t = p4string::MakeString(_('thesaurus:: est deja candidat en provenance du champ acceptable : '));
else
$t = p4string::MakeString(_('thesaurus:: est deja candidat en provenance des champs acceptables : '));
?>
<br/>
<br/>
<?php echo $zterm ?>
<br/>
<br/>
<?php echo $t ?>
<br/>
<center>
<form onsubmit="return(false);">
<input type="hidden" name="bid" value="<?php echo $parm["bid"] ?>">
<input type="hidden" name="pid" value="<?php echo $parm["pid"] ?>">
<?php
print("\t\t\t<div class='x3Dbox' style='margin:15px; height:100px; overflow:auto;'>\n");
// if($nb_candidates_bad)
// printf("\t\t\t\t<span style=\"color:#606060\">%s</span><br/>\n", $flist_bad);
// if($nb_candidates_ok)
// printf("\t\t\t\t<span style=\"color:#000000\">%s</span><br/>\n", $flist_ok);
// $ck = "checked";
for ($i = 0; $i < $candidates->length; $i ++ ) {
if ($candidates->item($i)->getAttribute("sourceok") == "1") {
// printf("\t\t\t<input type=\"hidden\" name=\"cid\" value=\"%s\">\n", $candidates->item($i)->getAttribute("id") );
printf("\t\t<input type=\"radio\" name=\"cid\" value=\"%s\" onclick=\"return(clkCid());\">%s<br/>\n"
, $candidates->item($i)->getAttribute("id")
, $candidates->item($i)->getAttribute("field"));
// $ck = "";
} else {
// printf("\t\t<input type=\"radio\" disabled name=\"cid\" value=\"%s\" onclick=\"return(clkCid());\"><span style=\"color:#606060\">%s</span><br/>\n"
// , $candidates->item($i)->getAttribute("id")
// , $candidates->item($i)->getAttribute("field") );
}
}
print("\t\t\t</div>\n");
if ($nb_candidates_ok > 1)
print(p4string::MakeString(_('thesaurus:: selectionner la provenance a accepter')) . "<br/>\n");
?>
<br/>
<input type="button" id="cancel_button" value="<?php echo p4string::MakeString(_('boutton::annuler')) ?>" onclick="clkBut('cancel');" style="width:100px;">
&nbsp;&nbsp;&nbsp;
<input type="button" id="submit_button" value="<?php echo p4string::MakeString(_('boutton::valider')) ?>" onclick="clkBut('submit');" style="width:100px;">
</form>
</center>
<?php
}
else {
if ($nb_candidates_bad > 0) {
// present dans les candidats, mais aucun champ acceptable : on informe
if ($nb_candidates_bad == 1)
$t = p4string::MakeString(_('thesaurus:: est candidat en provenance des champs mais ne peut etre accepte a cet emplacement du thesaurus'));
else
$t = p4string::MakeString(_('thesaurus:: est candidat en provenance des champs mais ne peut etre accepte a cet emplacement du thesaurus'));
}
else {
// pas present dans les candidats
$t = p4string::MakeString(_('thesaurus:: n\'est pas present dans les candidats')) . "\n";
}
?>
<br/>
<h3><?php echo p4string::MakeString(_('thesaurus:: attention :')) ?></h3>
<br/>
<br/>
<?php echo $zterm ?>
<br/>
<br/>
<?php echo $t ?>
<br/>
<form>
<center>
<div class='x3Dbox' style='margin:15px; height:90px; overflow:auto;'>
<input type="radio" name="reindex" value="0" id="rad0" checked><label for="rad0"><?php echo p4string::MakeString(_('thesaurus:: Ajouter le terme dans reindexer')) /* Ce terme n'est pas present dans la base, l'ajouter au thesaurus sans reindexer */ ?></label><br/>
<br/>
<input type="radio" name="reindex" value="1" id="rad1"><label for="rad1"><?php echo p4string::MakeString(_('thesaurus:: ajouter le terme et reindexer')) /* Ce terme est peut-etre present dans la base, marquer tous les documents comme 'e reindexer' */ ?></label><br/>
</div>
</center>
<input type="button" id="cancel_button" value="<?php echo p4string::MakeString(_('boutton::annuler')) ?>" onclick="clkBut('cancel');" style="width:100px;">
&nbsp;&nbsp;&nbsp;
<input type="button" id="submit_button" value="<?php echo p4string::MakeString(_('boutton::valider')) ?>" onclick="clkBut('submit');" style="width:100px;">
</form>
<?php
}
?>
</body>
<script type="text/javascript">
<?php
if ($nb_candidates_ok > 0) {
?>
function clkCid()
{
cids = document.getElementsByName("cid");
f = false;
for(i=0; i<cids.length && !f; i++)
{
if(cids[i].checked)
f = true;
}
document.getElementById("submit_button").disabled = !f;
return(true);
}
function clkBut(button)
{
switch(button)
{
case "submit":
url = "xmlhttp/acceptcandidates.x.php";
parms = "bid=<?php echo $parm["bid"] ?>";
parms += "&pid=<?php echo $parm["pid"] ?>";
parms += "&typ=<?php echo $parm["typ"] ?>";
for(i=0; i<(n=document.getElementsByName("cid")).length; i++)
{
if(n[i].checked)
parms += "&cid[]=" + encodeURIComponent(n[i].value);
}
// if(!confirm(url+"?"+parms))
// return;
ret = loadXMLDoc(url, parms, true);
//alert(ret);
//return;
refresh = ret.getElementsByTagName("refresh");
for(i=0; i<refresh.length; i++)
{
switch(refresh.item(i).getAttribute("type"))
{
case "CT":
<?php echo $opener ?>.reloadCtermsBranch(refresh.item(i).getAttribute("id"));
break;
case "TH":
<?php echo $opener ?>.reloadThesaurusBranch(refresh.item(i).getAttribute("id"));
break;
}
}
self.close();
break;
case "cancel":
self.close();
break;
}
}
<?php
} else {
?>
function clkCid()
{}
function clkBut(button)
{
switch(button)
{
case "submit":
<?php if ($parm["typ"] == "TS") {
?>
url = "xmlhttp/newts.x.php";
<?php
} else {
?>
url = "xmlhttp/newsy.x.php";
<?php } ?>
parms = "bid=<?php echo $parm["bid"] ?>";
parms += "&piv=<?php echo $parm["piv"] ?>";
parms += "&pid=<?php echo $parm["pid"] ?>";
parms += "&t=<?php echo urlencode($term) ?>";
<?php if ($context != "") {
?>
parms += "&k=<?php echo urlencode($context) ?>";
<?php } ?>
parms += "&sylng=<?php echo $parm["sylng"] ?>";
// alert(url + "?" + parms);
for(i=0; i<(n=document.getElementsByName("reindex")).length; i++)
{
if(n[i].checked)
{
parms += "&reindex=" + encodeURIComponent(n[i].value);
break;
}
}
// alert(url + "?" + parms);
ret = loadXMLDoc(url, parms, true);
refresh = ret.getElementsByTagName("refresh");
for(i=0; i<refresh.length; i++)
{
// alert("type : " + refresh.item(i).getAttribute("type"));
// alert("id : " + refresh.item(i).getAttribute("id"));
switch(refresh.item(i).getAttribute("type"))
{
case "CT":
<?php echo $opener ?>.reloadCtermsBranch(refresh.item(i).getAttribute("id"));
break;
case "TH":
<?php echo $opener ?>.reloadThesaurusBranch(refresh.item(i).getAttribute("id"));
break;
}
}
self.close();
break;
case "cancel":
self.close();
break;
}
}
<?php
}
?>
function loaded()
{
clkCid();
self.focus();
}
</script>
</html>
<?php
function splitTermAndContext($word)
{
$term = trim($word);
$context = "";
if (($po = strpos($term, "(")) !== false) {
if (($pc = strpos($term, ")", $po)) !== false) {
$context = trim(substr($term, $po + 1, $pc - $po - 1));
$term = trim(substr($term, 0, $po));
}
}
return(array($term, $context));
}
?>

View File

@@ -1,527 +0,0 @@
<?php
/*
* This file is part of Phraseanet
*
* (c) 2005-2013 Alchemy
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
use Alchemy\Phrasea\Application;
/**
*
* @license http://opensource.org/licenses/gpl-3.0 GPLv3
* @link www.phraseanet.com
*/
require_once __DIR__ . "/../../vendor/autoload.php";
phrasea::headers(200, true);
$app = new Application();
require($app['phraseanet.registry']->get('GV_RootPath') . "www/thesaurus2/xmlhttp.php");
$request = http_request::getInstance();
$parm = $request->get_parms(
"bid"
, "piv"
, "id"
, "typ"
, "dlg"
);
$lng = $app['locale'];
if ($parm["dlg"]) {
$opener = "window.dialogArguments.win";
} else {
$opener = "opener";
}
?>
<html lang="<?php echo $app['locale.I18n']; ?>">
<head>
<title><?php echo p4string::MakeString(_('thesaurus:: Proprietes')) ?></title>
<link REL="stylesheet" TYPE="text/css" HREF="./thesaurus.css?u=<?php echo mt_rand() ?>" />
<style type="text/css">
a
{
text-decoration:none;
font-size: 10px;
}
.path_separator
{
color:#ffff00;
}
.main_term
{
font-weight:900;
xcolor:#ff0000;
}
</style>
<script type="text/javascript" src="./win.js"></script>
<script type="text/javascript" src="./xmlhttp.js"></script>
<script type="text/javascript" src="/include/minify/f=include/jslibs/jquery-1.7.1.js,include/jslibs/jquery.sprintf.1.0.3.js"></script>
<script type="text/javascript" src="./xmlhttp.js"></script>
<script type="text/javascript">
function loaded()
{
window.name="PROPERTIES";
self.focus();
}
</script>
</head>
<body id="desktop" onload="loaded();" class="dialog">
<div class="menu" id="flagsMenu" style="z-index:50">
<?php
// on liste tous les drapeaux
foreach ($app->getAvailableLanguages() as $lng_code => $lng) {
$lng_code = explode('_', $lng_code);
$lng_code = $lng_code[0];
print("<a id='flagMenu_$lng_code' href='javascript:void(0)' class=''><img src='/skins/lng/" . $lng_code . "_flag_18.gif' />$lng_code</a>");
}
?>
</div>
<div class="menu" id="syMenu" style="z-index:50">
<a href="javascript:void(0)" id="delete_sy"><?php echo p4string::MakeString(_('thesaurus::menu: supprimer')) /* Supprimer... */ ?></a>
<a href="javascript:void(0)" id="replace_sy" class="disabled"><?php echo p4string::MakeString(_('thesaurus:: remplacer')) /* Corriger... */ ?></a>
</div>
<?php
$nsy = 0;
if ($parm["bid"] !== null) {
$url = "thesaurus2/xmlhttp/getterm.x.php";
$url .= "?bid=" . urlencode($parm["bid"]);
$url .= "&piv=" . urlencode($parm["piv"]);
$url .= "&sortsy=0";
$url .= "&id=" . urlencode($parm["id"]);
$url .= "&typ=" . urlencode($parm["typ"]);
$url .= "&nots=1";
// print($url. "<br/>\n");
$dom = xmlhttp($url);
printf("<div style='text-align:right'><b>id:</b>&nbsp;%s</div>\n", $parm["id"]);
$fullpath = $dom->getElementsByTagName("fullpath_html")->item(0)->firstChild->nodeValue;
print("<H4>" . $fullpath . "</H4><br/>\n");
if ($parm["typ"] == "CT") {
// printf("present dans %s fiche(s).<br/>\n", $dom->getElementsByTagName("hits")->item(0)->firstChild->nodeValue );
print("<br/>\n");
} elseif ($parm["typ"] == "TH") {
echo p4string::MakeString(sprintf(_('thesaurus:: %s reponses retournees'), $dom->getElementsByTagName("allhits")->item(0)->firstChild->nodeValue));
print("<br/>\n");
print("<br/>\n");
}
?>
<div id="TSY" class="tableContainer" style="margin:10px; position:relative; top:0px; left:0px">
<div>
<table border="0" cellpadding="0" cellspacing="0" style="width:100%; ">
<col style="width:40px;" />
<col style="width:30px;" />
<col style="width:auto;" />
<col style="width:40px;" />
<col style="width:140px;" />
<!-- <col style="width:10px;" /> -->
<col style="width:14px;" />
<thead>
<tr>
<?php
if ($parm["typ"] == "TH") {
?>
<th>&nbsp;</th>
<?php
} elseif ($parm["typ"] == "CT") {
?>
<th>&nbsp;</th>
<?php } ?>
<th>&nbsp;</th>
<th><?php echo p4string::MakeString(_('thesaurus:: synonymes')) /* synonymes */ ?></th>
<th><?php echo p4string::MakeString(_('thesaurus:: hits')) /* hits */ ?></th>
<th><?php echo p4string::MakeString(_('thesaurus:: ids')) /* id */ ?></th>
<th></th>
</tr>
</thead>
</table>
</div>
<div style="position:relative; height:150px; overflow:scroll">
<div style="position:relative; height:150px; ">
<table border="0" cellpadding="0" cellspacing="0" style="width:100%;">
<col style="width:40px;" />
<col style="width:30px;" />
<col style="width:auto;" />
<col style="width:40px;" />
<col style="width:140px;" />
<!-- <col style="width:20px;" /> -->
<tbody id="LSY" style="">
<?php
$sy_list = $dom->getElementsByTagName("sy_list")->item(0);
$nsy = 0;
for ($n = $sy_list->firstChild; $n; $n = $n->nextSibling) {
printf("\t\t\t\t\t\t<tr class='s_' id='SYN_%s' hits='%s'>\n", $id = $n->getAttribute("id"), $n->getAttribute("hits"));
printf("\t\t\t\t\t\t\t<td style='text-align:center;'>\n");
if ($nsy > 0)
printf("\t\t\t\t\t\t\t\t<img id=\"BTNU_$id\" src=\"./images/up.gif\" />\n");
if ($nsy > 0 && $n->nextSibling)
print(" ");
if ($n->nextSibling)
printf("\t\t\t\t\t\t\t\t<img id=\"BTND_$id\" src=\"./images/down.gif\" /></td>\n");
printf("\t\t\t\t\t\t\t</td>\n");
if (($lng = $n->getAttribute("lng")))
printf("\t\t\t\t\t\t\t<td id='FLG_%s'><img src='/skins/lng/%s_flag_18.gif' /></td>\n", $n->getAttribute("id"), $lng);
else
printf("\t\t\t\t\t\t\t<td id='FLG_%s'><img src='./images/noflag.gif' /></td>\n", $n->getAttribute("id"));
printf("\t\t\t\t\t\t\t<td>%s</td>\n", $n->getAttribute("t"));
printf("\t\t\t\t\t\t\t<td>%s</td>\n", $n->getAttribute("hits"));
printf("\t\t\t\t\t\t\t<td>%s</td>\n", $id);
// printf("<td></td>\n");
print("\t\t\t\t\t\t</tr>\n");
$nsy ++;
}
// if($parm["typ"]=="TH")
// {
// print("<tr><td colspan='4'><a href='javascript:void(0)' onclick='newsy();return(false);'>nouveau synonyme...</a></td></tr>\n");
// }
?>
</tbody>
</table>
</div>
</div>
</div>
<center>
<form onsubmit="return(false);">
<input style="position:relative; z-index:2" type="button" id="close_button" value="<?php echo p4string::MakeString(_('boutton::fermer')) ?>" onclick="self.close();">
</form>
</center>
<?php
//indentXML($dom);
// printf("<pre>%s</pre>\n", htmlentities($dom->saveXML()));
}
?>
</body>
<script type="text/javascript">
// gui callback du menu des drapeaux
var nsy = <?php echo $nsy ?>;
function cbME_flags(action, cbParm, menuelem_id)
{
// cbParm = objet 'TR'
// alert("cbParm.obj={obj:'" + cbParm.obj + "', id:'" + cbParm.id + "'} ; menuelem_id='" + menuelem_id + "'");
if(action != "SELECT" || !menuelem_id)
return; // pas d'option de menu : on est sorti du menu sans cliquer
lng = menuelem_id.substr(9,2); // id de l'option de menu : flagMenu_xx
url = "xmlhttp/changesylng.x.php";
parms = "bid=<?php echo urlencode($parm["bid"]) ?>";
// parms += "&id=<?php echo urlencode($parm["id"]) ?>";
parms += "&typ=<?php echo urlencode($parm["typ"]) ?>";
parms += "&piv=<?php echo urlencode($parm["piv"]) ?>";
parms += "&id=" + cbParm.id.substr(4);
// parms += "&u=" + encodeURIComponent(cbParm.getAttribute("u"));
parms += "&newlng=" + encodeURIComponent(lng);
// alert(url + "?" + parms);
// return;
ret = loadXMLDoc(url, parms, true);
sy_list = ret.getElementsByTagName("sy_list").item(0);
refresh_sy(sy_list);
refresh = ret.getElementsByTagName("refresh");
for(i=0; i<refresh.length; i++)
{
switch(refresh.item(i).getAttribute("type"))
{
case "CT":
<?php echo $opener ?>.reloadCtermsBranch(refresh.item(i).getAttribute("id"));
<?php echo $opener ?>.myGUI.select(<?php echo $opener ?>.document.getElementById("THE_<?php echo $parm["id"] ?>"));
break;
case "TH":
<?php echo $opener ?>.reloadThesaurusBranch(refresh.item(i).getAttribute("id"));
<?php echo $opener ?>.myGUI.select(<?php echo $opener ?>.document.getElementById("THE_<?php echo $parm["id"] ?>"));
break;
}
}
}
// gui callback du menu des synonymes
function cbME_synonym(action, cbParm, menuelem_id)
{
if(action == "INIT")
{
if(nsy <= 1)
{
// pas d'action possible s'il ne reste qu'un seul synonyme
// alert(nsy);
document.getElementById("delete_sy").className = "disabled";
// document.getElementById("reject_sy").className = "disabled";
}
else
{
if(cbParm && cbParm.hits > 0)
{
// y'a des hits, on peut pas supprimer
// document.getElementById("reject_sy").className = "";
document.getElementById("delete_sy").className = "";
}
else
{
// pas de hits : on peut supprimer
// document.getElementById("reject_sy").className = "";
document.getElementById("delete_sy").className = "";
}
}
// si on ne connait pas encore le client mais que start est ouvert, on lui demande
// if(!opener.wClient && opener.opener.wClient)
// opener.wClient = opener.opener.wClient;
// si on connait le client et qu'on peut s'en servir pour chercher, on active l'option dans le menu
// if(opener.wClient && opener.wClient.externQuery)
// document.getElementById("searchcli_sy").className = "";
// else
// document.getElementById("searchcli_sy").className = "disabled";
return;
}
if(action != "SELECT" || !menuelem_id)
return; // pas d'option de menu : on est sorti du menu sans cliquer
switch(menuelem_id)
{
case "delete_sy": // cbParm = objet 'TR'
url = "xmlhttp/getsy.x.php";
url += "?bid=<?php echo urlencode($parm["bid"]) ?>";
url += "&id=" + cbParm.id.substr(4);
url += "&typ=<?php echo urlencode($parm["typ"]) ?>";
ret = loadXMLDoc(url, null, true);
// alert(ret);
fullpath = ret.getElementsByTagName("fullpath").item(0).firstChild.nodeValue;
//alert("delete : cbParm.obj={id:'" + cbParm.id + "'} ; menuelem_id='" + menuelem_id + "'");
url = "xmlhttp/delsy.x.php";
parms = "bid=<?php echo urlencode($parm["bid"]) ?>";
parms += "&piv=<?php echo urlencode($parm["piv"]) ?>";
parms += "&typ=<?php echo urlencode($parm["typ"]) ?>";
parms += "&id=" + cbParm.id.substr(4);
// alert(url + "?" + parms);
if(confirm($.sprintf("<?php echo p4string::MakeString(_('thesaurus:: Confirmer la suppression du terme %s'), "js") ?>","\n\n"+fullpath+"\n\n")))
{
ret = loadXMLDoc(url, parms, true);
sy_list = ret.getElementsByTagName("sy_list").item(0);
refresh_sy(sy_list);
refresh = ret.getElementsByTagName("refresh");
for(i=0; i<refresh.length; i++)
{
switch(refresh.item(i).getAttribute("type"))
{
case "CT":
<?php echo $opener ?>.reloadCtermsBranch(refresh.item(i).getAttribute("id"));
<?php echo $opener ?>.myGUI.select(<?php echo $opener ?>.document.getElementById("THE_<?php echo $parm["id"] ?>"));
break;
case "TH":
<?php echo $opener ?>.reloadThesaurusBranch(refresh.item(i).getAttribute("id"));
<?php echo $opener ?>.myGUI.select(<?php echo $opener ?>.document.getElementById("THE_<?php echo $parm["id"] ?>"));
break;
}
}
}
break;
case "searchcli_sy": // cbParm = objet 'TR'
url = "xmlhttp/getsy.x.php";
url += "?bid=<?php echo urlencode($parm["bid"]) ?>";
url += "&id=" + cbParm.id.substr(4);
url += "&typ=<?php echo urlencode($parm["typ"]) ?>";
ret = loadXMLDoc(url, null, true);
// alert(ret);
t = ret.getElementsByTagName("sy").item(0).getAttribute("t");
//alert("delete : cbParm.obj={id:'" + cbParm.id + "'} ; menuelem_id='" + menuelem_id + "'");
if(opener.wClient && opener.wClient.externQuery)
{
opener.wClient.focus();
opener.wClient.externQuery(opener.currentBaseId, t);
}
break;
case "replace_sy":
url = "replace.php";
url += "?bid=<?php echo $parm["bid"] ?>";
url += "&piv=<?php echo $parm["piv"] ?>";
url += "&pid=<?php echo $parm["id"] ?>"
url += "&id=" + o.id.substr(4);
url += "&typ=<?php echo urlencode($parm["typ"]) ?>";
w = window.open(url, "REPLACE", "directories=no, height=300, width=500, location=no, menubar=no, resizable=yes, scrollbars=yes, status=no, toolbar=no");
break;
}
}
function refresh_sy(sy_list)
{
oldtbody = document.getElementById("LSY");
tbody = document.createElement("tbody");
tbody.setAttribute("id", "LSY");
// tr = tbody.appendChild(document.createElement("tr"));
// for(i=0; i<3; i++)
// tr.appendChild(document.createElement("td"));
for(nsy=0, n=sy_list.firstChild; n; n=n.nextSibling, nsy++)
{
tr = tbody.appendChild(document.createElement("tr"));
// tr.className = n.getAttribute("sel") ? "S_" : "s_";
tr.className = "s_";
tr.id = "SYN_" + (id=n.getAttribute("id"));
td = tr.appendChild(document.createElement("td"));
td.style.textAlign = "center";
if(nsy > 0)
{
img = td.appendChild(document.createElement("img"));
img.id = "BTNU_" + id;
img.src = "./images/up.gif";
if(n.nextSibling)
{
// td.appendChild(document.createEntityReference("nbsp"));
td.appendChild(document.createTextNode(" "));
// img.insertAdjacentHTML("afterEnd", "&nbsp;");
}
}
if(n.nextSibling)
{
img = td.appendChild(document.createElement("img"));
img.id = "BTND_" + id;
img.src = "./images/down.gif";
}
td = tr.appendChild(document.createElement("td"));
td.id = "FLG_"+(nsy+1);
// td.innerText = n.getAttribute("lng");
img = td.appendChild(document.createElement("img"));
img.setAttribute("src", "/skins/lng/"+n.getAttribute("lng")+"_flag_18.gif");
td = tr.appendChild(document.createElement("td"));
// td.colSpan = "2";
// td.setAttribute("colSpan", "3"); // attention au 'S' majuscule !!!
td.innerHTML = n.getAttribute("t");
td = tr.appendChild(document.createElement("td"));
td.innerHTML = n.getAttribute("hits");
td = tr.appendChild(document.createElement("td"));
td.innerHTML = n.getAttribute("id");
//td.innerText = " ";
// td = tr.appendChild(document.createElement("td"));
//td.innerText = " ";
if(n.getAttribute("sel"))
myGUI.select(tr);
}
<?php if ($parm["typ"] == "TH") {
?>
<?php } ?>
newtbody = oldtbody.parentNode.replaceChild(tbody, oldtbody);
}
function cbDD_TSY(evt, type, eventObj)
{
ret = true;
switch(type)
{
case "RMOUSEDOWN":
if(o = eventObj.Src0)
{
for(tr=o; tr && (tr.nodeName!="TR" || !tr.id || tr.id.substr(0, 4)!="SYN_"); tr=tr.parentNode)
;
if(tr)
myGUI.select(tr);
switch(o.id.substr(0, 4))
{
case "FLG_": // le drapeau
// myGUI.select(o);
document.getElementById("flagsMenu").runAsMenu( evt, tr );
break;
case "SYN_": // le synonyme
// myGUI.select(o);
// document.getElementById("syMenu").runAsMenu( {id:o.id.substr(4)} );
document.getElementById("syMenu").runAsMenu( evt, tr );
break;
}
}
break;
case "MOUSEDOWN":
if(o = eventObj.Src0)
{
for(tr=o; tr && (tr.nodeName!="TR" || !tr.id || tr.id.substr(0, 4)!="SYN_"); tr=tr.parentNode)
;
if(tr)
myGUI.select(tr);
switch(o.id.substr(0, 5))
{
case "BTNU_":
syChgPos(1);
break;
case "BTND_":
syChgPos(-1);
break;
}
}
break;
case "DBLCLICK":
break;
}
return(ret);
}
function syChgPos(dir)
{
if(!myGUI.selectedObject || myGUI.selectedObject.id.substr(0, 4)!="SYN_")
return;
url = "xmlhttp/changesypos.x.php";
parms = "bid=<?php echo urlencode($parm["bid"]) ?>";
parms += "&piv=<?php echo urlencode($parm["piv"]) ?>";
parms += "&typ=<?php echo urlencode($parm["typ"]) ?>";
parms += "&id=" + myGUI.selectedObject.id.substr(4);
parms += "&dir=" + dir;
// alert(url + "?" + parms);
ret = loadXMLDoc(url, parms, true);
// alert(ret);
sy_list = ret.getElementsByTagName("sy_list").item(0);
refresh_sy(sy_list);
refresh = ret.getElementsByTagName("refresh");
for(i=0; i<refresh.length; i++)
{
switch(refresh.item(i).getAttribute("type"))
{
case "CT":
<?php echo $opener ?>.reloadCtermsBranch(refresh.item(i).getAttribute("id"));
<?php echo $opener ?>.myGUI.select(<?php echo $opener ?>.document.getElementById("THE_<?php echo $parm["id"] ?>"));
break;
case "TH":
<?php echo $opener ?>.reloadThesaurusBranch(refresh.item(i).getAttribute("id"));
<?php echo $opener ?>.myGUI.select(<?php echo $opener ?>.document.getElementById("THE_<?php echo $parm["id"] ?>"));
break;
}
}
}
myGUI = new GUI("myGUI", "desktop", "FR");
myGUI.setClickable("TSY", cbDD_TSY);
myGUI.setAsMenu("flagsMenu", cbME_flags);
myGUI.setAsMenu("syMenu", cbME_synonym);
</script>
</html>

View File

@@ -1,201 +0,0 @@
<?php
/*
* This file is part of Phraseanet
*
* (c) 2005-2013 Alchemy
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
use Alchemy\Phrasea\Application;
/**
*
* @license http://opensource.org/licenses/gpl-3.0 GPLv3
* @link www.phraseanet.com
*/
require_once __DIR__ . "/../../vendor/autoload.php";
phrasea::headers(200, true);
$app = new Application();
require($app['phraseanet.registry']->get('GV_RootPath') . "www/thesaurus2/xmlhttp.php");
$request = http_request::getInstance();
$parm = $request->get_parms(
"bid"
, "piv"
, "pid" // id du pere (te)
, "id" // id du synonyme (sy)
, "typ"
, "dlg"
);
if ($parm["dlg"]) {
$opener = "window.dialogArguments.win";
} else {
$opener = "opener";
}
$url = "thesaurus2/xmlhttp/getsy.x.php";
$url .= "?bid=" . urlencode($parm["bid"]);
$url .= "&piv=" . urlencode($parm["piv"]);
$url .= "&sortsy=0";
$url .= "&id=" . urlencode($parm["id"]);
$url .= "&typ=" . urlencode($parm["typ"]);
$dom = xmlhttp($url);
$fullpath = $dom->getElementsByTagName("fullpath_html")->item(0)->firstChild->nodeValue;
$zterm = $dom->getElementsByTagName("sy")->item(0)->getAttribute("t");
$hits = $dom->getElementsByTagName("hits")->item(0)->firstChild->nodeValue;
?>
<html lang="<?php echo $app['locale.I18n']; ?>">
<head>
<title>Corriger...</title>
<link REL="stylesheet" TYPE="text/css" HREF="./thesaurus.css?u=<?php echo mt_rand() ?>" />
<style type="text/css">
a
{
text-decoration:none;
font-size: 10px;
}
.path_separator
{
color:#ffff00;
}
.main_term
{
font-weight:900;
xcolor:#ff0000;
}
</style>
<script type="text/javascript" src="./xmlhttp.js"></script>
<script type="text/javascript">
function loaded()
{
window.name="REPLACE";
self.focus();
ckField();
}
function ckField()
{
fields = document.getElementsByName("field[]");
chk = false;
for(i=0; i<fields.length && !chk; i++)
{
if( fields[i].checked )
chk = true;
}
// document.getElementById("submit_button").disabled = (!chk) || (document.forms[0].rpl.value==document.forms[0].src.value);
document.getElementById("submit_button").disabled = (document.forms[0].rpl.value==document.forms[0].src.value);
document.getElementById("rplrec").disabled = !chk;
document.getElementById("rplrec").checked = chk;
return(true);
}
function clkBut(button)
{
switch(button)
{
case "submit":
// document.forms[0].target="LINKFIELD";
document.forms[0].submit();
break;
case "cancel":
self.close();
break;
}
}
function clkRepl()
{
var o;
if(!(o=document.getElementById("rplrec")).checked)
{
fields = document.getElementsByName("field[]");
for(i=0; i<fields.length; i++)
fields[i].checked = false;
o.disabled = true;
}
}
</script>
</head>
<body onload="loaded();" class="dialog">
<div style='text-align:right'><b>id:</b>&nbsp;<?php echo $parm["id"] ?></div>
<H4><?php echo $fullpath ?></H4><br/><br/>
<?php
// printf("present dans %s fiche(s).<br/>\n", $dom->getElementsByTagName("hits")->item(0)->firstChild->nodeValue );
if ($parm["typ"] == "TH") {
$loaded = false;
try {
$databox = $app['phraseanet.appbox']->get_databox((int) $parm['bid']);
$domstruct = $databox->get_dom_structure();
$domth = $databox->get_dom_thesaurus();
if ($domstruct && $domth) {
$xpathth = new DOMXPath($domth);
$xpathstruct = new DOMXPath($domstruct);
?>
<center>
<form action="replace2.php" method="post" target="REPLACE">
<input type="hidden" name="bid" value="<?php echo $parm["bid"] ?>">
<input type="hidden" name="piv" value="<?php echo $parm["piv"] ?>">
<input type="hidden" name="dlg" value="<?php echo $parm["dlg"] ?>">
<input type="hidden" name="pid" value="<?php echo $parm["pid"] ?>">
<input type="hidden" name="id" value="<?php echo $parm["id"] ?>">
<?php echo utf8_encode("Corriger le terme") ?>
<b><?php echo $zterm ?></b><input type="hidden" name="src" value="<?php echo p4string::MakeString($zterm, "js") ?>">
<?php echo utf8_encode("par : ") ?><input type="text" name="rpl" style="width:150px;" onkeyup="ckField();return(true);" value="<?php echo p4string::MakeString($zterm, "js") ?>">
<br/>
<br/>
<input type="checkbox" id="rplrec" name="rplrec" onclick="clkRepl();return(true);" disabled>
<label for="rplrec"><?php echo utf8_encode("et corriger egalement dans le champ :") ?></label>
<br/>
<br/>
<div style="width:70%; height:110px; overflow:scroll;" class="x3Dbox">
<?php
$fields = $xpathstruct->query("/record/description/*");
for ($i = 0; $i < $fields->length; $i ++ ) {
$fieldname = $fields->item($i)->nodeName;
$tbranch = $fields->item($i)->getAttribute("tbranch");
$ck = "";
if ($tbranch) {
// ce champ a un tbranch, est-ce qu'il permet d'atteindre le terme selectionne ?
$branches = $xpathth->query($tbranch);
for ($j = 0; $j < $branches->length; $j ++ ) {
$q = ".//sy[@id='" . $parm["id"] . "']";
// printf("searching %s against id=%s<br/>\n", $q, $branches->item($j)->getAttribute("id"));
if ($xpathth->query($q, $branches->item($j))->length > 0) {
// oui
$ck = true;
}
}
}
if ($ck) {
printf("\t\t<input type=\"radio\" name=\"field[]\" value=\"%s\" onclick=\"return(ckField());\"><b>%s</b><br/>\n"
, $fieldname, $fieldname);
} else {
printf("\t\t<input type=\"radio\" name=\"field[]\" value=\"%s\" onclick=\"return(ckField());\">%s<br/>\n"
, $fieldname, $fieldname);
}
}
?>
</div>
<br/>
<input type="button" id="cancel_button" value="Annuler" onclick="clkBut('cancel');" style="width:80px;">
&nbsp;&nbsp;&nbsp;
<input type="button" id="submit_button" value="Corriger" onclick="clkBut('submit');" style="width:80px;">
</form>
</center>
<?php
}
} catch (Exception $e) {
}
}
?>
</body>
</html>

View File

@@ -1,275 +0,0 @@
<?php
/*
* This file is part of Phraseanet
*
* (c) 2005-2013 Alchemy
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
use Alchemy\Phrasea\Application;
/**
*
* @license http://opensource.org/licenses/gpl-3.0 GPLv3
* @link www.phraseanet.com
*/
require_once __DIR__ . "/../../vendor/autoload.php";
phrasea::headers(200, true);
$app = new Application();
require($app['phraseanet.registry']->get('GV_RootPath') . "www/thesaurus2/xmlhttp.php");
$request = http_request::getInstance();
$parm = $request->get_parms(
"bid"
, "piv"
, "pid" // id du pere (te)
, "id" // id du synonyme (sy)
, "src"
, "rpl"
, "rplrec"
, "field"
, "dlg"
);
if ($parm["dlg"]) {
$opener = "window.dialogArguments.win";
} else {
$opener = "opener";
}
$url3 = "./replace3.php";
$url3 .= "?bid=" . urlencode($parm["bid"]);
$url3 .= "&piv=" . urlencode($parm["piv"]);
$url3 .= "&id=" . urlencode($parm["id"]);
$url3 .= "&src=" . urlencode($parm["src"]);
$url3 .= "&rplrec=" . urlencode($parm["rplrec"]);
$url3 .= "&rpl=" . urlencode($parm["rpl"]);
$lstfld = "";
if ($parm["rplrec"] && is_array($parm["field"])) {
foreach ($parm["field"] as $f) {
$url3 .= "&field[]=" . urlencode($f);
$lstfld .= ( $lstfld ? ", " : "") . "<b>" . $f . "</b>";
}
}
$url3 .= "&dlg=" . urlencode($parm["dlg"] ? 1 : 0);
?>
<html lang="<?php echo $app['locale.I18n']; ?>">
<head>
<title>Corriger...</title>
<link REL="stylesheet" TYPE="text/css" HREF="./thesaurus.css?u=<?php echo mt_rand() ?>" />
<style type="text/css">
#baranchor DIV
{
POSITION:absolute;
LEFT:0px;
TOP:0px;
BORDER:#0000FF 1px solid;
FONT-WEIGHT:bold;
FONT-SIZE: 13px;
OVERFLOW:hidden;
}
#barBg
{
BACKGROUND-COLOR:#ffffff;
COLOR:#0000FF;
}
#barMv
{
CLIP:rect(0px 0px auto 0px);
BACKGROUND-POSITION: left top;
BACKGROUND-IMAGE: url(./images/pbar.gif);
COLOR:#FFFFFF;
}
</style>
<script type="text/javascript" src="./xmlhttp.js"></script>
<script type="text/javascript">
function loaded()
{
window.name="REPLACE";
self.focus();
}
function doContinue()
{
baranchor.style.visibility="visible";
msg.innerText = "";
cmd = "document.getElementById(\"REPL3\").src = \"<?php echo $url3 ?>\"";
self.setTimeout(cmd, 100);
}
function pbar( newtraite , newnbtotal )
{
if(newtraite < 0)
newtraite = 0;
else
if(newtraite > newnbtotal)
newtraite = newnbtotal;
percent = Math.round( (newtraite/newnbtotal) *100 );
widthIE = barBg.style.pixelWidth;
clipright = Math.floor(widthIE * (newtraite/newnbtotal) );
document.getElementById("barMv").style.clip="rect(0px "+(clipright+1)+"px auto 0px)";
document.getElementById("barMv").innerHTML = document.getElementById("barBg").innerHTML = percent + "%";
document.getElementById("barCptr").innerHTML = "( " + newtraite + " / " + newnbtotal + ")";
}
function pdone(nrecdone, nrectot, nrecchanged, nspot)
{
msg.innerText = nspot + "<?php echo utf8_encode(" remplacements effectues dans ") ?>" + nrecchanged + " documents.";
}
</script>
</head>
<?php
$out = "";
try {
if ($parm["bid"] === null)
throw new Exception("bid is null");
$connbas = connection::getPDOConnection($app, $parm['bid']);
list($term, $context) = splitTermAndContext($parm["rpl"]);
$url = "thesaurus2/xmlhttp/searchcandidate.x.php";
$url .= "?bid=" . $parm["bid"];
$url .= "&pid=" . $parm["pid"];
$url .= "&t=" . urlencode($term);
// if($context != "")
$url .= "&k=" . urlencode($context);
$dom = xmlhttp($url);
print("<!-- $url -->\n");
// print($dom->saveXML());
$xpath = new DOMXPath($dom);
$candidates = $xpath->query("/result/candidates_list/ct");
if ($candidates->length > 0) {
// le terme saisi existait dans les candidats, on peut choisir qui accepter
?>
<form onsubmit="return(false);">
<input type="hidden" name="bid" value="<?php echo $parm["bid"] ?>">
<input type="hidden" name="pid" value="<?php echo $parm["pid"] ?>">
<center>
<?php
$t = "<br/>le terme <b>" . $term . "</b>";
if ($context != "")
$t .= " (avec contexte <b>" . $context . "</b>)";
$t .= utf8_encode(" est deje candidat en provenance");
$t .= ( $candidates->length == 1) ? " du champ :" : " des champs suivants :";
$t .= "<br/><br/>\n";
print($t);
$candidates_ok = 0;
for ($i = 0; $i < $candidates->length; $i ++ ) {
if ($candidates->item($i)->getAttribute("sourceok") == "1")
$candidates_ok ++;
}
print("<div class='x3Dbox' style='width:70%; height:120px; overflow:auto'>\n");
for ($i = 0; $i < $candidates->length; $i ++ ) {
if ($candidates->item($i)->getAttribute("sourceok") == "1") {
printf("\t\t<input type=\"radio\" name=\"cid\" value=\"%s\" onclick=\"return(clkCid());\">%s<br/>\n"
, $candidates->item($i)->getAttribute("id")
, $candidates->item($i)->getAttribute("field"));
} else {
printf("\t\t<input type=\"radio\" disabled name=\"cid\" value=\"%s\" onclick=\"return(clkCid());\">%s<br/>\n"
, $candidates->item($i)->getAttribute("id")
, $candidates->item($i)->getAttribute("field"));
}
}
print("</div><br/>\n");
if ($candidates_ok > 1)
print(utf8_encode("selectionnez la provenance e accepter.<br/>\n"));
}
$nrec = 0;
if ($parm["rplrec"]) { // remplacer egalement dans les record
// table temporaire
$sql = "CREATE TEMPORARY TABLE IF NOT EXISTS `tmprecord` (`xml` TEXT COLLATE utf8_general_ci) SELECT record_id, xml FROM record";
$stmt = $connbas->prepare($sql);
$stmt->execute();
$stmt->closeCursor();
$unicode = new unicode();
$src_noacc = $unicode->remove_indexer_chars($parm["src"]);
$src_noacc_len = mb_strlen($src_noacc, "UTF-8");
$src_noacc_tchar = array();
for ($i = 0; $i < $src_noacc_len; $i ++ )
$src_noacc_tchar[$i] = mb_substr($src_noacc, $i, 1, "UTF-8");
$sql = "";
$params = array();
$n = 0;
foreach ($parm["field"] as $field) {
$params[':like' . $n] = "%<$field>%" . $src_noacc . "%</$field>%";
$sql .= ( $sql == "" ? "" : " OR ") . "(xml LIKE :like" . $n . ")";
$n ++;
}
$sql = "SELECT record_id, BINARY xml AS xml FROM tmprecord WHERE $sql";
$stmt = $connbas->prepare($sql);
$stmt->execute($params);
$nrec = $stmt->rowCount();
$stmt->closeCursor();
$out .= "remplacement de <b>" . $parm["src"] . "</b> par <b>" . $parm["rpl"] . "</b> dans le champ " . $lstfld . "<br/>\n";
$out .= " <br/>\n";
$out .= " <DIV id=\"baranchor\" style=\"position:relative; width:400px; height:18px; visibility:hidden;\">\n";
$out .= " <div id=\"barBg\" align=\"center\" style=\"width:400px; height:18px; z-index:9\">0%</div>\n";
$out .= " <div id=\"barMv\" align=\"center\" style=\"width:400px; height:18px; z-index:10\">0%</div>\n";
$out .= " </DIV>\n";
$out .= " <div id=\"barCptr\">&nbsp;</div>\n";
$out .= " <br/>\n";
if ($nrec >= 0) {
$out .= " <div id=\"msg\">" . utf8_encode(" $nrec documents concernes !") . "</div>\n";
$out .= " <br/>\n <br/>\n";
$out .= " <input type=\"button\" style=\"width:80px\" value=\"Annuler\" onclick=\"self.close();return(false);\">\n";
$out .= " &nbsp;&nbsp;&nbsp;\n";
$out .= " <input type=\"button\" style=\"width:80px\" value=\"Remplacer\" onclick=\"doContinue();return(false);\">\n";
$onload = "loaded();";
} else {
$out .= " <div id=\"msg\">" . utf8_encode(" $nrec records concernes !") . "</div>\n";
$out .= " <br/>\n <br/>\n";
$out .= " <input type=\"button\" style=\"width:80px\" value=\"Annuler\" onclick=\"self.close();return(false);\">\n";
$onload = "loaded();doContinue();";
}
} else {
$onload = "loaded();";
}
?>
<body onload="<?php echo $onload ?>" class="dialog">
<center>
<br/>
<form onsubmit="return(false);">
<?php echo $out ?>
</form>
<br/>
<iframe src="about:blank" id="REPL3"></iframe>
</center>
</body>
<?php
} catch (Exception $err) {
echo $err;
}
function splitTermAndContext($word)
{
$term = trim($word);
$context = "";
if (($po = strpos($term, "(")) !== false) {
if (($pc = strpos($term, ")", $po)) !== false) {
$context = trim(substr($term, $po + 1, $pc - $po - 1));
$term = trim(substr($term, 0, $po));
}
}
return(array($term, $context));
}
?>
</html>

View File

@@ -1,171 +0,0 @@
<?php
/*
* This file is part of Phraseanet
*
* (c) 2005-2013 Alchemy
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
use Alchemy\Phrasea\Application;
/**
*
* @license http://opensource.org/licenses/gpl-3.0 GPLv3
* @link www.phraseanet.com
*/
require_once __DIR__ . "/../../vendor/autoload.php";
phrasea::headers(200, true);
$app = new Application();
$request = http_request::getInstance();
$parm = $request->get_parms(
"bid"
, "piv"
, "id"
, "src"
, "rpl"
, "field"
, "dlg"
);
if ($parm["dlg"]) {
$opener = "window.dialogArguments.win";
} else {
$opener = "opener";
}
?>
<html lang="<?php echo $app['locale.I18n']; ?>">
<body>
<?php
if ($parm["bid"] !== null) {
try {
$connbas = connection::getPDOConnection($app, $parm['bid']);
$sql = "CREATE TEMPORARY TABLE IF NOT EXISTS `tmprecord` (`xml` TEXT COLLATE utf8_general_ci) SELECT record_id, xml FROM record";
$stmt = $connbas->prepare($sql);
$stmt->execute();
$stmt->closeCursor();
$unicode = new unicode();
$src_noacc = $unicode->remove_indexer_chars($parm["src"]);
$src_noacc_len = mb_strlen($src_noacc, "UTF-8");
$src_noacc_tchar = array();
for ($i = 0; $i < $src_noacc_len; $i ++ )
$src_noacc_tchar[$i] = mb_substr($src_noacc, $i, 1, "UTF-8");
$sql = "";
$params = array();
$n = 0;
foreach ($parm["field"] as $field) {
$params[':like' . $n] = "%<$field>%" . $src_noacc . "%</$field>%";
$sql .= ( $sql == "" ? "" : " OR ") . "(xml LIKE :like" . $n . ")";
}
$sql = "SELECT record_id, BINARY xml AS xml FROM tmprecord WHERE $sql";
$stmt = $connbas->prepare($sql);
$stmt->execute($params);
$rsbas2 = $stmt->fetchAll(PDO::FETCH_ASSOC);
$nrectot = $stmt->rowCount();
$stmt->closeCursor();
$nrecdone = $nrecchanged = $nspot = 0;
foreach ($rsbas2 as $rowbas2) {
$nrecdone ++;
printf("<script type=\"text/javascript\">parent.pbar($nrecdone, $nrectot);</script>\n");
flush();
set_time_limit(30);
$xml = $rowbas2["xml"];
$spots = array();
foreach ($parm["field"] as $field) {
$ibyte_min = $ichar_min = 0;
while (true) {
if (($ibyte_min = strpos($xml, "<$field>", $ibyte_min)) === false)
break;
$ibyte_min += strlen("<$field>");
if (($ibyte_max = strpos($xml, "</$field>", $ibyte_min)) === false)
break;
$ichar_min = mb_strpos($xml, "<$field>", $ichar_min, "UTF-8") + mb_strlen("<$field>");
$ichar_max = mb_strpos($xml, "</$field>", $ichar_min, "UTF-8"); // + mb_strlen("</$field>");
$txml = substr($xml, $ibyte_min, $ibyte_max - $ibyte_min);
$xml_noacc_tchar = array(); // buffer circulaire taille+2 (car prec. et car suiv. pour trouver uniquement les mots entiers)
$xml_noacc_tchar[0] = array(">", ">", 1); // car precedent
for ($i = 0; $i < $src_noacc_len + 1; $i ++ ) {
$c = mb_substr($txml, 0, 1, "UTF-8");
$xml_noacc_tchar[$i + 1] = array($c, $unicode->remove_indexer_chars($c), $l = strlen($c));
$txml = substr($txml, $l);
}
for ($ib = $ibyte_min, $ic = $ichar_min; $ic <= $ichar_max - $src_noacc_len; $ic ++ ) {
if (isdelim($xml_noacc_tchar[0][0]) && isdelim($xml_noacc_tchar[$src_noacc_len + 1][0])) {
for ($i = 0; $i < $src_noacc_len; $i ++ ) {
if ($xml_noacc_tchar[$i + 1][1] !== $src_noacc_tchar[$i])
break;
}
if ($i == $src_noacc_len) {
for ($l = 0, $i = 1; $i < $src_noacc_len + 1; $i ++ )
$l += $xml_noacc_tchar[$i][2];
if (count($spots) == 0) {
$nrecchanged ++;
}
$nspot ++;
$spots[$ib] = array("p" => $ib, "l" => $l);
}
}
$lost = array_shift($xml_noacc_tchar);
$c = mb_substr($txml, 0, 1, "UTF-8");
$xml_noacc_tchar[] = array($c, $unicode->remove_indexer_chars($c), $l = strlen($c));
// $txml = mb_substr($txml, 1, 9999, "UTF-8");
$txml = substr($txml, $l);
$ib += $lost[2];
$ibyte_min = $ibyte_max + strlen("</$field>");
$ichar_min = $ichar_max + mb_strlen("</$field>");
}
}
}
if (count($spots) > 0) {
ksort($spots);
$dp = 0;
$ddp = (strlen($parm["rpl"]) - strlen($parm["src"]));
foreach ($spots as $spot) {
$xml = substr($xml, 0, $dp + $spot["p"]) . $parm["rpl"] . substr($xml, $dp + $spot["p"] + $spot["l"]);
$dp += $ddp; // strlen("<em></em>");
}
print($xml);
print("<br/>\n");
$sql = "UPDATE tmprecord SET xml = :xml";
$stmt = $connbas->prepare($sql);
$stmt->execute(array(':xml' => $xml));
$stmt->closeCursor();
}
}
printf("found %d times in %d records<br/>\n", $nspot, $nrecdone);
printf("<script type=\"text/javascript\">parent.pdone($nrecdone, $nrectot, $nrecchanged, $nspot);</script>\n");
} catch (Exception $e) {
}
}
function isdelim($utf8char)
{
$unicode = new unicode();
return in_array($utf8char, $unicode->get_indexer_bad_chars());
}
?>
</body>
</html>

View File

@@ -1,122 +0,0 @@
<?php
/*
* This file is part of Phraseanet
*
* (c) 2005-2013 Alchemy
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
use Alchemy\Phrasea\Application;
/**
*
* @license http://opensource.org/licenses/gpl-3.0 GPLv3
* @link www.phraseanet.com
*/
require_once __DIR__ . "/../../vendor/autoload.php";
phrasea::headers(200, true);
$app = new Application();
$request = http_request::getInstance();
$parm = $request->get_parms(
"bid"
, "piv"
, "dlg"
, "dct" // delete candidates terms
, "drt" // delete rejected terms
);
if ($parm["dlg"]) {
$opener = "window.dialogArguments.win";
} else {
$opener = "opener";
}
?>
<html lang="<?php echo $app['locale.I18n']; ?>">
<head>
<title>Relire les candidats</title>
<link REL="stylesheet" TYPE="text/css" HREF="./thesaurus.css?u=<?php echo mt_rand() ?>" />
</head>
<body onload="loaded();" class="dialog">
<?php
if ($parm["bid"] !== null) {
$loaded = false;
try {
$databox = $app['phraseanet.appbox']->get_databox((int) $parm['bid']);
$connbas = connection::getPDOConnection($app, $parm['bid']);
$domct = $databox->get_dom_cterms();
if ($domct) {
$nodestodel = array();
removeCandidates($domct->documentElement, $nodestodel);
foreach ($nodestodel as $nodetodel) {
$nodetodel->parentNode->removeChild($nodetodel);
}
if ($parm["dct"]) {
$sql = "DELETE FROM thit WHERE value LIKE 'C%'";
$stmt = $connbas->prepare($sql);
$stmt->execute();
$stmt->closeCursor();
}
if ($parm["drt"]) {
$sql = "DELETE FROM thit WHERE value LIKE 'R%'";
$stmt = $connbas->prepare($sql);
$stmt->execute();
$stmt->closeCursor();
}
$databox->saveCterms($domct);
$sql = "UPDATE record SET status=status & ~2";
$stmt = $connbas->prepare($sql);
$stmt->execute();
$stmt->closeCursor();
?>
<form onsubmit="return(false);">
<div style="padding:50px; text-align:center">
<?php echo utf8_encode("Termine") ?>
<br/>
<br/>
<input type="button" style="width:120px;" id="submit_button" value="<?php echo utf8_encode("Fermer la fenetre") ?>" onclick="refreshCterms();self.close();">
</div>
</form>
<?php
}
} catch (Exception $e) {
}
}
function removeCandidates(&$node, &$nodestodel)
{
global $parm;
if ($node->nodeType == XML_ELEMENT_NODE && $node->nodeName == "te" && $node->getAttribute("field") == "") {
$id0 = substr($node->getAttribute("id"), 0, 1);
if (($parm["dct"] && $id0 == "C") || ($parm["drt"] && $id0 == "R"))
$nodestodel[] = $node;
}
else {
for ($n = $node->firstChild; $n; $n = $n->nextSibling)
removeCandidates($n, $nodestodel);
}
}
?>
</body>
<script type="text/javascript">
function refreshCterms()
{
if( (thb = <?php echo $opener ?>.document.getElementById("THB_C")) )
thb.className = thb.className.replace(/OB/, "ob");
if( (thp = <?php echo $opener ?>.document.getElementById("THP_C")) )
thp.innerHTML = "+";
}
</script>
</html>

View File

@@ -1,145 +0,0 @@
<?php
/*
* This file is part of Phraseanet
*
* (c) 2005-2013 Alchemy
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
use Alchemy\Phrasea\Application;
/**
*
* @license http://opensource.org/licenses/gpl-3.0 GPLv3
* @link www.phraseanet.com
*/
require_once __DIR__ . "/../../vendor/autoload.php";
phrasea::headers(200, true);
$app = new Application();
$request = http_request::getInstance();
$parm = $request->get_parms(
"bid"
, "piv"
, "dlg"
);
if ($parm["dlg"]) {
$opener = "window.dialogArguments.win";
} else {
$opener = "opener";
}
?>
<html lang="<?php echo $app['locale.I18n']; ?>">
<head>
<title>Relire les candidats</title>
<link REL="stylesheet" TYPE="text/css" HREF="./thesaurus.css?u=<?php echo mt_rand() ?>" />
<script type="text/javascript">
function loaded()
{
window.name="RESCAN";
self.focus();
ckbut();
}
function clkBut(but)
{
switch(but)
{
case 'cancel':
self.close();
break;
case 'submit':
self.document.forms[0].submit();
break;
}
}
function ckbut()
{
if(document.forms[0].dct.checked || document.forms[0].drt.checked)
document.getElementById("submit_button").disabled = false;
else
document.getElementById("submit_button").disabled = true;
}
</script>
</head>
<body onload="loaded();" class="dialog">
<form onsubmit="return(false);" action="./rescan.php" method="post">
<div style="padding:30px">
<?php
if ($parm["bid"] !== null) {
$loaded = false;
try {
$databox = $app['phraseanet.appbox']->get_databox((int) $parm['bid']);
$connbas = connection::getPDOConnection($app, $parm['bid']);
$nrec = 0;
$sql = "SELECT COUNT(*) AS nrec FROM record";
$stmt = $connbas->prepare($sql);
$stmt->execute();
$rowbas = $stmt->fetch(PDO::FETCH_ASSOC);
$stmt->closeCursor();
if ($rowbas)
$nrec = $rowbas["nrec"];
$domct = $databox->get_dom_cterms();
if ($domct) {
$r = countCandidates($domct->documentElement);
printf(utf8_encode("%s termes candidats, %s termes refuses<br/><br/>\n"), $r["nc"], $r["nr"]);
?>
<input type="hidden" name="bid" value="<?php echo $parm["bid"] ?>">
<input type="hidden" name="piv" value="<?php echo $parm["piv"] ?>">
<input type="hidden" name="dlg" value="<?php echo $parm["dlg"] ?>">
<input type="checkbox" name="dct" onchange="ckbut();"><?php echo utf8_encode("Supprimer les " . $r["nc"] . " candidats...") ?><br/>
<input type="checkbox" name="drt" onchange="ckbut();"><?php echo utf8_encode("Supprimer les " . $r["nr"] . " termes refuses...") ?><br/>
<br/>
<?php echo utf8_encode("...et placer les $nrec fiches en reindexation-thesaurus ?<br/>\n"); ?>
<br/>
</div>
<div style="position:absolute; left:0px; bottom:0px; width:100%; text-align:center">
<input type="button" style="width:80px;" id="cancel_button" value="Annuler" onclick="clkBut('cancel');">
&nbsp;&nbsp;
<input type="button" style="width:80px;" id="submit_button" value="Ok" onclick="clkBut('submit');">
<br/>
<br/>
</div>
</form>
<?php
}
} catch (Exception $e) {
}
}
function countCandidates(&$node)
{
global $parm;
$ret = array("nc" => 0, "nr" => 0);
if ($node->nodeType == XML_ELEMENT_NODE && $node->nodeName == "sy" && strlen($id = $node->getAttribute("id")) > 1) {
if (substr($id, 0, 1) == "C")
$ret["nc"] ++;
elseif (substr($id, 0, 1) == "R")
$ret["nr"] ++;
}
for ($n = $node->firstChild; $n; $n = $n->nextSibling) {
$r = countCandidates($n);
$ret["nc"] += $r["nc"];
$ret["nr"] += $r["nr"];
}
return($ret);
}
?>
</body>
<script type="text/javascript">
</script>
</html>

View File

@@ -1,60 +0,0 @@
<?php
/*
* This file is part of Phraseanet
*
* (c) 2005-2013 Alchemy
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
use Alchemy\Phrasea\Application;
/**
*
* @license http://opensource.org/licenses/gpl-3.0 GPLv3
* @link www.phraseanet.com
*/
function xmlhttp($url)
{
$app = new Application();
$fullurl = $app['phraseanet.registry']->get('GV_ServerName') . $url;
$xml = http_query::getUrl($fullurl);
$ret = new DOMDocument();
$ret->loadXML($xml);
return($ret);
}
function indentXML(&$dom)
{
indentXML2($dom, $dom->documentElement, 0, 0);
}
function indentXML2(&$dom, $node, $depth, $ichild)
{
$tab = str_repeat("\t", $depth);
$fc = null;
if ($node->nodeType == XML_ELEMENT_NODE) {
if ($ichild == 0)
$node->parentNode->insertBefore($dom->createTextNode($tab), $node);
else
$node->parentNode->insertBefore($dom->createTextNode("\n" . $tab), $node);
$fc = $node->firstChild;
if ($fc) {
if ($fc->nodeType == XML_TEXT_NODE && ! $fc->nextSibling) {
} else {
$node->insertBefore($dom->createTextNode("\n"), $fc);
for ($i = 0, $n = $fc; $n; $n = $n->nextSibling, $i ++ ) {
indentXML2($dom, $n, $depth + 1, $i);
}
$node->appendChild($dom->createTextNode("\n" . $tab));
}
}
} elseif ($node->nodeType == XML_TEXT_NODE) {
$node->parentNode->insertBefore($dom->createTextNode($tab), $node);
}
}
?>