Subversion Repositories Applications.referentiel

Compare Revisions

Ignore whitespace Rev 57 → Rev 58

/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/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/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/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/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/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;
}
}
?>