Subversion Repositories Applications.referentiel

Compare Revisions

Ignore whitespace Rev 57 → Rev 58

/trunk/.htaccess
6,4 → 6,6
RewriteRule ^$ interfaces/index.php
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
# La condition ci-dessous permet de tester l'existence des fichiers zip.
RewriteCond %{REQUEST_FILENAME} !^.+\.zip$
RewriteRule ^.*$ interfaces/index.php
/trunk/bibliotheque/dao/ResultatDao.php
37,7 → 37,7
}
/**
* Retourne des infos partilles des résultats (id, nom, resultat) d'un traitement donné.
* Retourne des infos partielles des résultats (id, nom, resultat) d'un traitement donné.
*
* @param integer l'id du traitement.
* @return mixed le tableau de tableau d'infos ou false en cas d'échec.
/trunk/bibliotheque/dao/ReferentielDao.php
39,7 → 39,7
$url = $this->url_jrest.self::SERVICE."/Tout/$code_projet";
$nbre = $this->getNombre($code_projet);
$noms = array();
$pas = 1000;
$pas = 10000;
for ($i = 0; $i < $nbre ; $i += $pas) {
$this->setLimitation($i, $pas);
$json = $this->envoyerRequeteConsultation($url);
/trunk/interfaces/index.php
28,6 → 28,7
<script type="text/javascript" src="interfaces/squelettes/js/jquery-1.4.2.min.js"></script>
<script type="text/javascript" src="interfaces/squelettes/js/jquery-ui-1.8.2.custom.min.js"></script>
<script type="text/javascript" src="interfaces/squelettes/js/jquery.chromatable.js"></script>
</head>
<body xml:lang="fr" lang="fr">
<div id="zone-centrale">
/trunk/interfaces/squelettes/traitement.tpl.html
13,31 → 13,49
<?php endforeach; ?>
<?php endif; ?>
 
<?php if (isset($urls_zip)) : ?>
<h2>Téléchargements</h2>
<ul>
<?php foreach ($urls_zip as $nom => $url) : ?>
<li><a href="<?=$url?>"><?=$nom?></a></li>
<?php endforeach; ?>
</ul>
<?php endif; ?>
 
<h2>Résultats</h2>
<?php if (isset($resultats)) : ?>
<table id="resultats">
<caption>Résultats</caption>
<thead>
<tr>
<th>Numero</th>
<th>Nom</th>
<th>Résultat</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<?php $i=1; ?>
<?php foreach ($resultats as $resultat) : ?>
<tr>
<td class="numero <?=$resultat['resultat'] ? 'ok' : 'ko';?>" title="Id:<?=$resultat['id_resultat']?>"><?=$i++?></td>
<td class="nom <?=$resultat['resultat'] ? 'ok' : 'ko';?>"><a href="<?=$resultat['url']?>"><?=$resultat['nom']?></a></td>
<td class="<?=$resultat['resultat'] ? 'ok' : 'ko';?>"><span class="resultat"><?=$resultat['resultat'] ? 'ok' : 'ko';?></span></td>
<td class="description"><?=$resultat['description']?></td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
<?php if ($traitement['script'] == 'tests') : ?>
<table id="resultats">
<caption>Résultats</caption>
<thead>
<tr>
<th>Numero</th>
<th>Nom</th>
<th>Résultat</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<?php $i=1; ?>
<?php foreach ($resultats as $resultat) : ?>
<tr>
<td class="numero <?=$resultat['resultat'] ? 'ok' : 'ko';?>" title="Id:<?=$resultat['id_resultat']?>"><?=$i++?></td>
<td class="nom <?=$resultat['resultat'] ? 'ok' : 'ko';?>"><a href="<?=$resultat['url']?>"><?=$resultat['nom']?></a></td>
<td class="<?=$resultat['resultat'] ? 'ok' : 'ko';?>"><span class="resultat"><?=$resultat['resultat'] ? 'ok' : 'ko';?></span></td>
<td class="description"><?=$resultat['description']?></td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
<?php endif; ?>
<?php if ($traitement['script'] == 'versionnage') : ?>
<?php $i=1; ?>
<?php foreach ($resultats as $resultat) : ?>
<h3><?=$resultat['nom']?> (Id:<?=$resultat['id_resultat']?>)</h3>
<p><?=$resultat['message']?></p>
<?php endforeach; ?>
<?php endif; ?>
<?php else : ?>
<p class="information">Aucun resultat pour ce traitement.</p>
<p class="information">Aucun resultat pour ce traitement.</p>
<?php endif; ?>
<!-- REF - FIN TRAITEMENT -->
/trunk/interfaces/squelettes/form_tests.tpl.html
8,6 → 8,8
}
return ok;
});
// Rend les tables portant la classe "defilante" srollable
$('.defilante').chromatable();
});
</script>
<h1>Tests du référentiel «&nbsp;<?=$ref;?>&nbsp;»</h1>
38,7 → 40,7
<?php endif; ?>
 
<h2>Tests</h2>
<table>
<table class="defilante">
<caption>Traitements <?=strftime('à %H:%M:%S le %d %B %Y')?></caption>
<thead>
<tr>
/trunk/interfaces/squelettes/css/referentiel/referentiel.css
54,16 → 54,19
hr{
color:#62210F;}
table{
border-collapse:collapse;}
table{
border:1px solid #36560B;
border-collapse: collapse;}
border-collapse: collapse;
width:100%;
margin:0;}
td,th{
border:1px solid #36560B;
padding:5px;}
padding:7px 5px;}
th{
background-color:#EEE;}
caption{
border:1px solid #36560B;
background-color:#EEE;
font-weight:bold;
margin:2px;}
padding:2px;}
img{
border:0;}
img a{
/trunk/interfaces/squelettes/form_version.tpl.html
8,6 → 8,8
}
return ok;
});
// Rend les tables portant la classe "defilante" srollable
$('.defilante').chromatable();
});
</script>
<h1>Versionnage du référentiel «&nbsp;<?=$ref?>&nbsp;»</h1>
150,7 → 152,7
 
<h2>Versions</h2>
 
<table>
<table class="defilante">
<caption>Versions <?=strftime('à %H:%M:%S le %d %B %Y')?></caption>
<thead>
<tr>
/trunk/interfaces/squelettes/js/jquery.chromatable.js
New file
0,0 → 1,146
/*
* File: chromatable.js
* Version: 1.3.0
* CVS: $Id$
* Description: Make a "sticky" header at the top of the table, so it stays put while the table scrolls
* Author: Zachary Siswick
* Created: Thursday 19 November 2009 8:53pm
* Language: Javascript
*
*/
(function($){
$.chromatable = {
// Default options
defaults: {
//specify a pixel dimension, auto, or 100%
width: "900px",
height: "300px",
scrolling: "yes"
}
};
$.fn.chromatable = function(options){
// Extend default options
var options = $.extend({}, $.chromatable.defaults, options);
 
return this.each(function(){
// Add jQuery methods to the element
var $this = $(this);
var $uniqueID = $(this).attr("ID") + ("wrapper");
//Add dimentsions from user or default parameters to the DOM elements
$(this).css('width', options.width).addClass("_scrolling");
$(this).wrap('<div class="scrolling_outer"><div id="'+$uniqueID+'" class="scrolling_inner"></div></div>');
$(".scrolling_outer").css({'position':'relative'});
$("#"+$uniqueID).css({'overflow-x':'hidden', 'overflow-y':'auto','padding-right':'17px'});
$("#"+$uniqueID).css('height', options.height);
$("#"+$uniqueID).css('width', options.width);
// clone an exact copy of the scrolling table and add to DOM before the original table
// replace old class with new to differentiate between the two
$(this).before($(this).clone().attr("id", "").addClass("_thead").css(
{'width' : 'auto',
'display' : 'block',
'position':'absolute',
'border':'none',
'border-bottom':'1px solid #CCC',
'top':'0'
}));
// remove all children within the cloned table after the thead element
$('._thead').children('tbody').remove();
$(this).each(function( $this ){
// if the width is auto, we need to remove padding-right on scrolling container
if (options.width == "100%" || options.width == "auto") {
$("#"+$uniqueID).css({'padding-right':'0px'});
}
if (options.scrolling == "no") {
$("#"+$uniqueID).before('<a href="#" class="expander" style="width:100%;">Expand table</a>');
$("#"+$uniqueID).css({'padding-right':'0px'});
$(".expander").each(
function(int){
$(this).attr("ID", int);
$( this ).bind ("click",function(){
$("#"+$uniqueID).css({'height':'auto'});
$("#"+$uniqueID+" ._thead").remove();
$(this).remove();
});
});
 
 
//this is dependant on the jQuery resizable UI plugin
$("#"+$uniqueID).resizable({ handles: 's' }).css("overflow-y", "hidden");
}
});
// Get a relative reference to the "sticky header"
$curr = $this.prev();
// Copy the cell widths across from the original table
$("thead:eq(0)>tr th",this).each( function (i) {
$("thead:eq(0)>tr th:eq("+i+")", $curr).width( $(this).width());
});
 
//check to see if the width is set to auto, if not, we don't need to call the resizer function
if (options.width == "100%" || "auto"){
// call the resizer function whenever the table width has been adjusted
$(window).resize(function(){
resizer($this);
});
}
});
};
// private function to temporarily hide the header when the browser is resized
function resizer($this) {
// Need a relative reference to the "sticky header"
$curr = $this.prev();
$("thead:eq(0)>tr th", $this).each( function (i) {
$("thead:eq(0)>tr th:eq("+i+")", $curr).width( $(this).width());
});
 
};
})(jQuery);
/trunk/interfaces/controleurs/Traitement.php
15,6 → 15,7
class Traitement extends AppliControleur {
private $referentiel = null;
private $traitement = null;
private $traitementId = null;
private $traitementDao = null;
private $resultatDao = null;
57,11 → 58,15
// Recherche d'info sur le traitement
$infos = $this->traitementDao->getInfos($this->traitementId);
if ($infos != false) {
$donnees['traitement'] = $infos;
$this->traitement = $infos;
$donnees['traitement'] = $this->traitement;
} else {
$this->addMessage("L'identifiant de traitement n'est pas indexé dans la base de données.");
}
 
// Spécificité du script de versionnage
$donnees['urls_zip'] = $this->traiterScriptVersionnage();
// Recherche des résultats du traitement
$infos = $this->resultatDao->getResultatsTraitement($this->traitementId);
if ($infos != false) {
81,5 → 86,30
$this->construireMenu($this->referentiel);
$this->construireFilAriane($this->referentiel, $this->traitementId);
}
private function traiterScriptVersionnage() {
$urls_zip = null;
if (isset($this->traitement['script']) && $this->traitement['script'] == 'versionnage') {
$meta = unserialize($this->traitement['script_parametres']);
$projet = strtolower($this->traitement['referentiel_code']);
$version = str_replace('.', '_', $meta['version']);
$fichier_zip_bdnt = $projet.'_v'.$version.'.zip';
$fichier_zip_partiel = $projet.'_v'.$version.'_partiel.zip';
$url_zip_bdnt = sprintf(Config::get('url_zip_tpl'), $fichier_zip_bdnt);
if ($this->testerUrl($url_zip_bdnt)) {
$urls_zip[$fichier_zip_bdnt] = $url_zip_bdnt;
}
$url_zip_partiel = sprintf(Config::get('url_zip_tpl'), $fichier_zip_partiel);
if ($this->testerUrl($url_zip_partiel)) {
$urls_zip[$fichier_zip_partiel] = $url_zip_partiel;
}
}
return $urls_zip;
}
private function testerUrl($url) {
ini_set('allow_url_fopen', '1');
return (@fclose(@fopen($url, 'r'))) ? true : false;
}
}
?>
/trunk/interfaces/controleurs/Versionnage.php
59,6 → 59,7
$donnees['url_action_rafraichir'] = 'afficherInterface';
$donnees['version'] = $this->instancierChampsVersionnage();
$donnees['version'] = $this->traiterCasesACocher($donnees['version']);
// Récupération des paramètres de configuration du manuel des référentiels
$donnees['domaine_geo'] = explode(';', $this->manuel['domaine_geo']);
101,7 → 102,6
foreach ($this->version as $champ) {
if (isset($_POST[$champ])) {
$version[$champ] = $this->supprimerSlash($_POST[$champ]);
$version[$champ] = $this->traiterCasesACocher($version[$champ]);
} else {
$version[$champ] = $this->getValeurParDefaut($champ);
110,13 → 110,6
return $version;
}
private function traiterCasesACocher($valeur_post) {
if (is_array($valeur_post)) {
$valeur_post = array_flip($valeur_post);
}
return $valeur_post;
}
public function getValeurParDefaut($champ) {
$valeur = '';
if ('date_prod' == $champ) {
124,6 → 117,16
}
return $valeur;
}
 
private function traiterCasesACocher(Array $donnees) {
foreach ($donnees as $cle => $valeur) {
if (is_array($valeur)) {
$this->traiterEsperluette($valeur);
$donnees[$cle] = array_flip($valeur);
}
}
return $donnees;
}
/**
* Lance l'ajout d'un traitement
/trunk/interfaces/controleurs/AppliControleur.php
150,11 → 150,9
protected function supprimerSlash($doc) {
if (is_string($doc)) {
$doc = stripslashes($doc);
} else if (is_array($doc)) {
if (count($doc) > 0) {
foreach ($doc as $cle => $valeur) {
$doc[$cle] = $this->supprimerSlash($valeur);
}
} else if (is_array($doc) && count($doc) > 0) {
foreach ($doc as $cle => $valeur) {
$doc[$cle] = $this->supprimerSlash($valeur);
}
}
return $doc;
/trunk/interfaces/configurations/config.default.ini
55,6 → 55,8
ddv_traitement_attente = 300
; Durée de vie en seconde d'un traitement en cours
ddv_traitement_en_cours = 300
; Squelete de l'url de téléchargement des fichiers zip
url_zip_tpl = "{url_base}zip/%s"
 
; +------------------------------------------------------------------------------------------------------+
; Url du Jrest utilisé pour les services web fournissant les données à l'application
/trunk/scripts/modules/versionnage/Versionnage.php
193,10 → 193,12
}
}
ksort($infos);
$infos = $this->remplacerTabulation($infos);
$infos = $this->remplacerSautsDeLigne($infos);
$donnees['noms'][] = $infos;
}
Debug::printr("Dernier element du tableau des noms [trié] : ".print_r($infos,true));
$bdnt_tsv = $this->getVue('versionnage/squelettes/bdnt', $donnees, '.tpl.tsv');
$bdnt_tsv =& $this->getVue('versionnage/squelettes/bdnt', $donnees, '.tpl.tsv');
$this->ecrireFichierBdnt($bdnt_tsv);
}
228,7 → 230,7
$this->messages[] = array('message' => $message, 'resultat' => true);
}
private function ecrireFichierBdnt($contenu) {
private function ecrireFichierBdnt(&$contenu) {
$fichier_nom = $this->getBaseNomFichier().$this->manuel['ext_fichier_bdnt'];
$fichier_chemin = $this->zip_chemin_dossier.$fichier_nom;
244,7 → 246,7
return strtolower($this->meta['acronyme'].'_v'.$this->meta['version']);
}
private function ecrireFichier($fichier_chemin, $contenu) {
private function ecrireFichier($fichier_chemin, &$contenu) {
$retour = true;
if (file_put_contents($fichier_chemin, $contenu) == false) {
$e = "Une erreur est survenu lors de l'écriture du fichier : $fichier_chemin";
269,9 → 271,9
} else {
$this->noms_precedents = $this->referentielDao->getTout($code_projet_precedent);
$donnees = array();
$donnees['diff'] = $this->realiserDiff();
$donnees['diff'] =& $this->realiserDiff();
$donnees['champs'] = $this->champs_nom;
$diff_tsv = $this->getVue('versionnage/squelettes/diff', $donnees, '.tpl.tsv');
$diff_tsv = $this->getVue('versionnage/squelettes/diff', &$donnees, '.tpl.tsv');
$this->ecrireFichierDiff($diff_tsv);
}
}
280,17 → 282,20
private function realiserDiff() {
$diff = array();
$this->noms_stat['modification'] = 0;
$i = 0;
foreach ($this->noms as $id => &$nom) {
$infos = array();
if (!isset($this->noms_precedents[$id])) {
$diff[$id] = $nom;
$diff[$id]['modification_type'] = 'A';
$diff[$id]['modification_type_1'] = '0';
$diff[$id]['modification_type_2'] = '0';
$diff[$id]['modification_type_3'] = '0';
$infos = $nom;
$infos['modification_type'] = 'A';
$infos['modification_type_1'] = '0';
$infos['modification_type_2'] = '0';
$infos['modification_type_3'] = '0';
$this->noms_stat['modification']++;
} else {
$nom_precedent =& $this->noms_precedents[$id];
$nom_diff = array_diff_assoc($nom, $nom_precedent);
Debug::printr($nom_diff);
if (count($nom_diff) > 0) {
$this->noms_stat['modification']++;
$modif['modification_type'] = 'M';
300,18 → 305,24
$this->chargerTableauChampsModifTypes();
foreach ($this->champs_nom as $champ) {
if (isset($nom_diff[$champ])) {
$diff[$id][$champ] = $nom_diff[$champ];
$infos[$champ] = $nom_diff[$champ];
$type = $this->getDiffType($champ);
$modif['modification_type_'.$type] = '1';
} else {
$diff[$id][$champ] = '';
$infos[$champ] = '';
}
}
foreach ($modif as $cle => $val) {
$diff[$id][$cle] = $val;
$infos[$cle] = $val;
}
}
}
$infos = $this->remplacerTabulation($infos);
$infos = $this->remplacerSautsDeLigne($infos);
Debug::printr($infos);
Debug::printr("-------------------------------------------------");
$diff[$id][] = $infos;
if ($i == 100) break;
}
return $diff;
}
319,7 → 330,7
private function chargerTableauChampsModifTypes() {
$champs = explode(',', $this->manuel['champs_diff_type']);
foreach ($champs as $champ) {
list($champ_nom, $type) = explode('=', $champ);
list($champ_nom, $type) = explode('=', trim($champ));
$this->diff_modif_types[$champ_nom] = $type;
}
}
343,10 → 354,37
$donnees = $this->meta;
$donnees['stats'] = $this->noms_stat;
$donnees['signature'] = $this->signature_md5;
$donnees = $this->remplacerTabulation($donnees);
$donnees = $this->remplacerSautsDeLigne($donnees);
$meta_tsv = $this->getVue('versionnage/squelettes/meta', $donnees, '.tpl.tsv');
$this->ecrireFichierMeta($meta_tsv);
}
private function remplacerTabulation($doc) {
if (is_string($doc)) {
$doc = str_replace("\t", ' ', $doc);
} else if (is_array($doc) && count($doc) > 0) {
foreach ($doc as $cle => $valeur) {
$doc[$cle] = $this->remplacerTabulation($valeur);
}
}
return $doc;
}
private function remplacerSautsDeLigne($doc) {
if (is_string($doc)) {
$a_remplacer = array("\r", "\n");
$doc = str_replace($a_remplacer, ' ', $doc);
} else if (is_array($doc) && count($doc) > 0) {
foreach ($doc as $cle => $valeur) {
$doc[$cle] = $this->remplacerSautsDeLigne($valeur);
}
}
return $doc;
}
private function ecrireFichierMeta($contenu) {
$fichier_nom = $this->getBaseNomFichier().$this->manuel['ext_fichier_meta'];
$fichier_chemin = $this->zip_chemin_dossier.$fichier_nom;
/trunk/scripts/modules/versionnage/squelettes/meta.tpl.tsv
2,11 → 2,11
 
code <?=$acronyme?>
 
domaine_taxo <?=$dom_tax?>
domaine_taxo <?=implode(', ', $dom_tax)?>
 
domaine_geo <?=$dom_geo?>
domaine_geo <?=implode(', ', $dom_geo)?>
 
domaine_nom <?=$dom_code?>
domaine_nom <?=implode(', ', $dom_code)?>
 
classification <?=$classification?>