";
// affichage du tableau des z_attr
$requete = "SELECT attr_bib_id, attr_libelle, attr_attr FROM z_attr where attr_bib_id ='$bib_id' ORDER BY attr_libelle, attr_attr ";
$res = mysql_query($requete, $dbh);
$nbr = mysql_num_rows($res);
// loading the localized attributes labels
$la = new XMLlist($include_path."/marc_tables/z3950attributes.xml", 0);
$la->analyser();
$codici = $la->table;
$parity=1;
for($i=0;$i<$nbr;$i++) {
$row=mysql_fetch_object($res);
if ($parity % 2) {
$pair_impair = "even";
} else {
$pair_impair = "odd";
}
$parity += 1;
$tr_javascript=" onmouseover=\"this.className='surbrillance'\" onmouseout=\"this.className='$pair_impair'\" onmousedown=\"document.location='./admin.php?categ=z3950&sub=zattr&action=modif&bib_id=$row->attr_bib_id&attr_libelle=$row->attr_libelle';\" ";
print "";
print "
";
print "
".$msg["z3950_".$codici[$row->attr_libelle]]."
";
print "
".$row->attr_attr."
";
print "
";
}
print "
";
}
function zattr_form($zbib_id="", $zattr_libelle="", $zattr_attr="") {
global $msg;
global $admin_zattr_form;
global $include_path ;
global $lang;
global $charset;
// loading the localized attributes labels
$la = new XMLlist($include_path."/marc_tables/z3950attributes.xml", 0);
$la->analyser();
$codici = $la->table;
if (!$zattr_libelle) {
$admin_zattr_form = str_replace('!!form_title!!', $msg["zattr_ajouter_attr"], $admin_zattr_form);
$admin_zattr_form = str_replace('!!bib_id!!', "", $admin_zattr_form);
// here the combo box must be enabled because the user is adding a new attr.
$select = "
";
$select .= "
";
} else {
$admin_zattr_form = str_replace('!!form_title!!', $msg["zattr_modifier_attr"]." : ".$msg["z3950_".$codici[$zattr_libelle]], $admin_zattr_form);
$admin_zattr_form = str_replace('!!bib_id!!', $zbib_id, $admin_zattr_form);
// here the combo box doesn't appear because the user can't change the attr. label
$select = "";
}
$admin_zattr_form = str_replace('!!code!!', $select, $admin_zattr_form);
$admin_zattr_form = str_replace('!!attr_bib_id!!', $zbib_id, $admin_zattr_form);
$admin_zattr_form = str_replace('!!attr_libelle!!', $zattr_libelle, $admin_zattr_form);
$admin_zattr_form = str_replace('!!attr_attr!!', $zattr_attr, $admin_zattr_form);
$admin_zattr_form = str_replace('!!local_attr_libelle!!', $msg["z3950_".$codici[$zattr_libelle]], $admin_zattr_form);
print confirmation_delete("./admin.php?categ=z3950&sub=zattr&action=del&");
print $admin_zattr_form;
}
$requete = "SELECT bib_nom, base, search_type FROM z_bib where bib_id ='$bib_id' or bib_id='$form_attr_bib_id' ";
$res = mysql_query($requete, $dbh);
$row=mysql_fetch_object($res);
echo "$row->bib_nom - $row->base - $row->search_type";
switch($action) {
case 'update':
if(!empty($form_attr_bib_id) && !empty($form_attr_libelle) && !empty($form_attr_attr)) {
if($bib_id) {
$requete = "UPDATE z_attr SET attr_libelle='$form_attr_libelle', attr_attr='$form_attr_attr' WHERE attr_bib_id='$bib_id' and attr_libelle='$form_attr_libelle' ";
$res = mysql_query($requete, $dbh);
} else {
$requete = "INSERT INTO z_attr (attr_bib_id, attr_libelle, attr_attr) VALUES ('$form_attr_bib_id', '$form_attr_libelle', '$form_attr_attr') ";
$res = mysql_query($requete, $dbh);
$bib_id = $form_attr_bib_id ;
}
}
show_zattr($dbh,$bib_id);
break;
case 'add':
if(empty($form_attr_bib_id) || empty($form_attr_libelle) || empty($form_attr_attr)) {
zattr_form($bib_id, $form_attr_libelle, $form_attr_attr);
} else {
show_zattr($dbh, $bib_id);
}
break;
case 'modif':
if($bib_id){
$requete = "SELECT attr_bib_id, attr_libelle, attr_attr FROM z_attr WHERE attr_bib_id=$bib_id and attr_libelle='$attr_libelle' ";
$res = mysql_query($requete, $dbh);
if(mysql_num_rows($res)) {
$row=mysql_fetch_object($res);
zattr_form ($row->attr_bib_id, $row->attr_libelle, $row->attr_attr );
} else {
show_zattr($dbh,$bib_id);
}
} else {
show_zattr($dbh,$bib_id);
}
break;
case 'del':
if (($bib_id) && ($attr_libelle)) {
$requete = "DELETE FROM z_attr WHERE attr_bib_id='$bib_id' and attr_libelle='$attr_libelle' ";
$res = mysql_query($requete, $dbh);
show_zattr($dbh,$bib_id);
} else show_zattr($dbh,$bib_id);
break;
default:
show_zattr($dbh,$bib_id);
break;
}