diff --git a/ecrire/base/trouver_table.php b/ecrire/base/trouver_table.php index b83fe9605be91c83ae38f48e554f57beff0684e4..19d374634d1183312b0f89538b3bdf47a2cf1e7f 100644 --- a/ecrire/base/trouver_table.php +++ b/ecrire/base/trouver_table.php @@ -45,36 +45,38 @@ function base_trouver_table_dist($nom, $serveur='') // indirection (table principale avec nom!=type) $t = $table_des_tables[$nom]; $nom_sql = 'spip_' . $t; - if (!isset($connexions[$s]['tables'][$nom_sql])) { + if (isset($connexions[$s]['tables'][$nom_sql])) + return $connexions[$s]['tables'][$nom_sql]; + else { include_spip('base/serial'); - $connexions[$s]['tables'][$nom_sql] = $tables_principales[$nom_sql]; - $connexions[$s]['tables'][$nom_sql]['table']= $nom_sql; - $connexions[$s]['tables'][$nom_sql]['id_table']= $t; - } # table principale deja vue, ok. + $desc = $tables_principales[$nom_sql]; + $nom = $t; + } } else { include_spip('base/auxiliaires'); if (isset($tables_auxiliaires['spip_' .$nom])) { $nom_sql = 'spip_' . $nom; - if (!isset($connexions[$s]['tables'][$nom_sql])) { - $connexions[$s]['tables'][$nom_sql] = $tables_auxiliaires[$nom_sql]; - $connexions[$s]['tables'][$nom_sql]['table']= $nom_sql; - $connexions[$s]['tables'][$nom_sql]['id_table']= $nom; - } # table locale a cote de SPIP: noms egaux - } # auxiliaire deja vue, ok. + if (isset($connexions[$s]['tables'][$nom_sql])) + return $connexions[$s]['tables'][$nom_sql]; + else { + $desc = $tables_auxiliaires[$nom_sql]; + } + } # table locale a cote de SPIP, comme non SPIP: } } - - if (isset($connexions[$s]['tables'][$nom_sql])) - return $connexions[$s]['tables'][$nom_sql]; - - $desc = sql_showtable($nom_sql, $serveur, ($nom_sql != $nom)); - if (!$desc OR !$desc['field']) { - spip_log("table inconnue $serveur $nom"); - return null; - } else { - $desc['table']= $nom_sql; - $desc['id_table']= $nom; + if (!isset($connexions[$s]['tables'][$nom_sql])) { + + $desc = sql_showtable($nom_sql, $serveur, ($nom_sql != $nom)); + if (!$desc OR !$desc['field']) { + spip_log("table inconnue $serveur $nom"); + return null; + } } - return $connexions[$s]['tables'][$nom_sql] = $desc; + $desc['table']= $nom_sql; + $desc['id_table']= $nom; + $desc['connexion']= $serveur; + $connexions[$s]['tables'][$nom_sql] = $desc; + + return $connexions[$s]['tables'][$nom_sql]; } ?> diff --git a/ecrire/public/vertebrer.php b/ecrire/public/vertebrer.php index dc052d27d919470d2bd2b636d183c054f4800d85..6f435dbd652b15da09e5e2046fd1747f9640c4e9 100755 --- a/ecrire/public/vertebrer.php +++ b/ecrire/public/vertebrer.php @@ -34,8 +34,8 @@ function vertebrer_sort($fields, $direction) $tri = $direction . ((test_sql_int($t) OR test_sql_date($r)) ? 'tri_n' : 'tri'); - $url = "|parametre_url{" . $tri . ",'" . $n . "'}" - . vertebrer_sanstri($tri); + $url = vertebrer_sanstri($tri) + . "|parametre_url{" . $tri . ",'" . $n . "'}"; $res .= "\n\t\t<th><a href='[(#SELF$url)]'>$n</a></th>"; } @@ -55,7 +55,7 @@ function vertebrer_sanstri($sauf='') function vertebrer_form($fields) { - $res = '<td></td>'; + $res = "\t\t<td></td>"; $url = join('|', array_keys($fields)); $url = "#SELF|parametre_url{'$url',''}"; foreach($fields as $n => $t) { @@ -77,10 +77,8 @@ function vertebrer_form($fields) // http://doc.spip.org/@vertebrer_crit function vertebrer_crit($v) { - $res = "{pagination}" - . "\n\t{par #ENV{tri}}{!par #ENV{_tri}}{par num #ENV{tri_n}}{!par num #ENV{_tri_n}}"; - - foreach($v as $n => $t) { $res .= "\n\t{" . $n . " ?}"; } + $res = ""; + foreach($v as $n => $t) { $res .= "\n\t\t{" . $n . " ?}"; } return $res; } @@ -111,40 +109,50 @@ function public_vertebrer_dist($desc) { $nom = $desc['table']; $surnom = $desc['id_table']; + $connexion = $desc['connexion']; $field = $desc['field']; $key = $desc['key']; + ksort($field); + + $form = vertebrer_form($field); + $crit = vertebrer_crit($field); + $cell = vertebrer_cell($field); + $sort = vertebrer_sort($field,''); + $tros = vertebrer_sort($field,'_'); + $titre = "SPIPAdmin $connexion $surnom"; + $skel = "./?page=$surnom&var_mode=debug&var_mode_affiche=squelette#debug_boucle"; + return + "<!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.0 Strict//EN' 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd'> <html xmlns='http://www.w3.org/1999/xhtml' xml:lang='#LANG' lang='#LANG' dir='#LANG_DIR'> <head> -<title>SPIPAdmin $surnom [(#NOM_SITE_SPIP|textebrut)]</title> +<title>[(#NOM_SITE_SPIP|textebrut)] $titre</title> <INCLURE{fond=inc-head}> </head> <body class='page_rubrique'><div id='page'> -<h1 style='text-align:center'>SPIPAdmin $surnom</h1><br />\n" . - // au minimum: "<BOUCLE1($fond)></BOUCLE1>#TOTAL_BOUCLE<//B1>") - // au maximum: - "<B1>#ANCRE_PAGINATION" . - "\n<p class='pagination'>" . - "\n<a style='float:left;' " . - "href='./?page=$surnom&var_mode=debug&var_mode_affiche=squelette#debug_boucle'>squelette" . - "</a>" . - "\n#PAGINATION" . - "\n</p><br class='nettoyeur' />\n<table class='spip' border='1' width='90%'>" . - "\n\t<tr>\n\t\t<th>Nb</th>" . - vertebrer_sort($field,'') . - "\n\t</tr>\n\t\t<tr>" . - vertebrer_form($field) . - "\n\t</tr>\n<BOUCLE1($surnom)" . - vertebrer_crit($field) . - '>' . - vertebrer_cell($field) . - "\n\t</tr>\n</BOUCLE1>" . - "\n\t<tr>\n\t\t<th>Nb</th>" . - vertebrer_sort($field,'_') . - "\n\t</tr>\n</table>" . -"\n</B1>\n<h2 style='text-align:center'><:texte_vide:></h2>" . -"\n<//B1></div></body></html>"; +<INCLURE{fond=inc-entete}> +<div id='contenu'> +<h1 style='text-align:center'>$titre</h1><br /> +<B1> +<p class='pagination'>#ANCRE_PAGINATION#PAGINATION</p> +<table class='spip' border='1' width='90%'> +\t<tr> +\t\t<th><:info_numero_abbreviation:></th>$sort +\t</tr> +\t<tr> +$form +\t</tr>\n<BOUCLE1($surnom){pagination} +\t\t{par #ENV{tri}}{!par #ENV{_tri}}{par num #ENV{tri_n}}{!par num #ENV{_tri_n}}$crit>$cell +\t</tr> +</BOUCLE1> +\t<tr>\n\t\t<th><:info_numero_abbreviation:></th> +$tros +\t</tr>\n</table> +</B1>\n<h2 style='text-align:center'><:texte_vide:></h2> +<//B1></div> +<INCLURE{fond=inc-pied}{skel='$skel'}> +</div></body></html>"; } ?>