Subversion Repositories Applications.referentiel

Compare Revisions

Ignore whitespace Rev 48 → Rev 49

/trunk/interfaces/referentiel.php
15,7 → 15,8
function __autoload($nom_classe) {
// Tableau des chemins à inclure pour trouver une classe relatif à ce fichier
$chemins = array(
'..'.DS.'bibliotheque'.DS.'dao',
'..'.DS.'bibliotheque'.DS.'dao',
'..'.DS.'bibliotheque'.DS.'utilitaires',
'bibliotheque'.DS.'pear',
'composants');
foreach ($chemins as $chemin) {
/trunk/interfaces/squelettes/form_version.tpl.html
85,6 → 85,8
<fieldset id="champs-domaine">
<legend>Domaines couverts par le référentiel</legend>
<p> Vous pouvez choisir plusieurs éléments par liste.</p>
<label for="classification">Classification par défaut <span class="obligatoire">*</span></label>
<p><input id="classification" name="classification" type="text" value="<?=$version['classification']?>"/></p>
<label for="ref-ver-dom-tax">Domaine taxonomique <span class="obligatoire">*</span></label>
<div id="ref-ver-dom-tax" class="case-a-cocher-scroll" />
<ul class="liste-simple">
121,11 → 123,11
</li>
<li>
<label for="copyright">Copyright</label>
<input type="text" id="copyright" name="mention_legale" value="© Tela Botanica - <?=date('Y')?>." readonly="readonly"/>
<input type="text" id="copyright" name="mention_legale" value="Copyright © Tela Botanica (<?=date('Y')?>). Tout droits réservés." readonly="readonly"/>
</li>
<li>
<label for="licence">Licence</label>
<input type="text" id="licence" name="licence" value="" readonly="readonly"/>
<input type="text" id="licence" name="licence" value="http://creativecommons.org/licenses/by-sa/2.0/fr/" readonly="readonly"/>
</li>
<li>
<label for="referencement">Comment citer ce référentiel? <span class="obligatoire">*</span></label>
/trunk/interfaces/controleurs/Versionnage.php
19,7 → 19,7
private $version = array('titre', 'acronyme', 'version', 'date_prod',
'auteur_principal', 'coordinateur', 'editeur', 'contact',
'contributeur',
'dom_tax', 'dom_geo', 'dom_code',
'classification', 'dom_tax', 'dom_geo', 'dom_code',
'source', 'copyright', 'licence', 'referencement');
private $referentiel = null;
private $traitementDao = null;
99,7 → 99,7
$version = array();
foreach ($this->version as $champ) {
if (isset($_POST[$champ])) {
$version[$champ] = strip_tags(stripslashes($_POST[$champ]));
$version[$champ] = stripslashes($_POST[$champ]);
} else {
$version[$champ] = $this->getValeurParDefaut($champ);
121,7 → 121,9
*/
public function demanderTraitement() {
if ($this->verifierMetadonnees()) {
$this->ajouterTraitement($this->referentiel, self::SCRIPT_A_LANCER);
$parametres = $this->instancierChampsVersionnage();
$parametres_serialises = serialize($parametres);
$this->ajouterTraitementParametre($this->referentiel, $parametres_serialises, self::SCRIPT_A_LANCER);
}
$this->afficherInterface();
}
131,7 → 133,18
*/
public function verifierMetadonnees() {
$ok = true;
$ok = ($this->verifierChampsObligatoires()) ? true : false;
if (! $this->verifierChampsObligatoires()) {
$ok = false;
}
if (! $this->verifierChampsMajuscule()) {
$ok = false;
}
if (! $this->verifierChampsContact()) {
$ok = false;
}
if (! $this->verifierChampsCourriel()) {
$ok = false;
}
return $ok;
}
143,6 → 156,7
'auteur_principal' => 'Auteur Principal',
'coordinateur' => 'coordinateur',
'contact' => 'Courriel de contact',
'classification' => 'Classification par défaut',
'dom_tax' => 'Domaine taxonomique',
'dom_geo' => 'Domaine géographique',
'dom_code' => 'Codes botaniques utilisés',
155,5 → 169,84
}
return $ok;
}
public function verifierChampsMajuscule() {
$ok = true;
$champs_en_majuscule = array('acronyme' => 'Acronyme');
foreach ($champs_en_majuscule as $champ_id => $champ_nom) {
if (isset($_POST[$champ_id]) && ! $this->verifierMajusculeSansAccent($_POST[$champ_id])) {
$this->addMessage("Le champ '$champ_nom' doit être obligatoirement composé de majuscules non accentuées.");
$ok = false;
}
}
return $ok;
}
/**
* Vérifie la mise en majuscule
*/
public function verifierMajusculeSansAccent($txt) {
$ok = (preg_match('/^[A-Z]+$/', $txt)) ? true : false;
return $ok;
}
public function verifierChampsContact() {
$ok = true;
$champs_contact = array('auteur_principal' => 'Auteur Principal',
'coordinateur' => 'coordinateur',
'contributeur' => 'Auteurs/Contributeurs');
foreach ($champs_contact as $champ_id => $champ_nom) {
if (isset($_POST[$champ_id]) && ! $this->verifierContact($_POST[$champ_id])) {
$this->addMessage("Le champ '$champ_nom' n'est pas au format : Prénom1 NOM1 (Organisation1) <courriel1>, Prénom2 NOM2 (Organisation2) <courriel2>.");
$ok = false;
}
}
return $ok;
}
/**
* Vérifie que le texte est au format :
* Prénom1 NOM1 (Organisation1) <courriel1>,
* Prénom2 NOM2 (Organisation2) <courriel2>.
*/
public function verifierContact($txt) {
$ok = true;
if ($txt != '') {
$pp = Pattern::PRENOM;
$pn = Pattern::NOM;
$po = "\([^\)]+\)";// Pattern organisation
$pc = Pattern::COURRIEL;
 
$contacts = explode(',', $txt);
foreach ($contacts as $contact) {
$contact = trim($contact);
if (! preg_match("/^$pp $pn $po <$pc>(?:|.)$/u", $contact)) {
$ok = false;
}
}
}
return $ok;
}
public function verifierChampsCourriel() {
$ok = true;
$champs_courriel = array('contact' => 'Courriel de contact');
foreach ($champs_courriel as $champ_id => $champ_nom) {
if (isset($_POST[$champ_id]) && ! $this->verifierCourriel($_POST[$champ_id])) {
$this->addMessage("Le champ '$champ_nom' ne comptient pas une adresse de courriel valide.");
$ok = false;
}
}
return $ok;
}
/**
* Vérifie que le texte est une adresse de courriel valide.
*/
public function verifierCourriel($txt) {
$pattern_courriel = Pattern::COURRIEL;
$ok = (preg_match('/^'.$pattern_courriel.'+$/', $txt)) ? true : false;
return $ok;
}
}
?>