Index: trunk/Makefile
===================================================================
--- trunk/Makefile	(revision 7)
+++ 	(revision )
@@ -1,39 +1,0 @@
-DESTDIR=
-
-LIBDIR=/usr/lib/biblehal
-CRONDIR=/etc/cron.d
-ETCDIR=/etc/biblehal
-
-.PHONY: all install update sync help
-
-all: help
-
-install: update
-	@id bib-le-hal > /dev/null || adduser --system --group --shell /bin/bash --home /var/lib/biblehal bib-le-hal
-	@install -d -m 0755 -o root -g root $(DESTDIR)/$(CRONDIR)
-	install     -m 0644 -o root -g root biblehal.cron $(DESTDIR)/$(CRONDIR)/klask
-
-update:
-	@install -d -m 0755 -o root -g root $(DESTDIR)/$(LIBDIR)
-	install     -m 0755 -o root -g root biblehal-clean $(DESTDIR)/$(LIBDIR)
-	install     -m 0755 -o root -g root biblehal-cleanall $(DESTDIR)/$(LIBDIR)
-	install     -m 0755 -o root -g root biblehal-count $(DESTDIR)/$(LIBDIR)
-	install     -m 0755 -o root -g root biblehal-explode $(DESTDIR)/$(LIBDIR)
-	install     -m 0755 -o root -g root biblehal-pop $(DESTDIR)/$(LIBDIR)
-	install     -m 0755 -o root -g root biblehal-popall $(DESTDIR)/$(LIBDIR)
-	install     -m 0755 -o root -g root biblehal-poplast $(DESTDIR)/$(LIBDIR)
-	install     -m 0755 -o root -g root biblehal-push $(DESTDIR)/$(LIBDIR)
-	install     -m 0755 -o root -g root biblehal-pushall $(DESTDIR)/$(LIBDIR)
-
-	@install -d -m 0755 -o root -g root $(DESTDIR)/$(ETCDIR)
-	install     -m 0644 -o root -g root biblehal-sample.conf $(DESTDIR)/$(ETCDIR)
-
-sync:
-	svn update
-
-help:
-	@echo "Possible target:"
-	@echo " * all     : this help"
-	@echo " * install : complete installation"
-	@echo " * update  : minimal installation"
-	@echo " * sync    : sync with subversion"
Index: trunk/biblehal-clean
===================================================================
--- trunk/biblehal-clean	(revision 7)
+++ 	(revision )
@@ -1,22 +1,0 @@
-#!/bin/bash
-#
-# gabriel 2010/06/03
-
-export PATH="/bin:/usr/bin:/usr/lib/biblehal"
-
-
-bibfile=$1; shift
-
-search=$(basename ${bibfile} .bib | cut -f 2-10 -d '-')
-
-CONFIG_FILE=/srv/refbase/initialize/db.inc.php
-
-CONNECT_NAME=$(grep '$username =' ${CONFIG_FILE} | cut -f 2 -d '"')
-CONNECT_PASS=$(grep '$password =' ${CONFIG_FILE} | cut -f 2 -d '"')
-
-cat <<END_SQL | mysql --user=${CONNECT_NAME} --password=${CONNECT_PASS}
-DELETE FROM refbaselegi.refs WHERE url RLIKE '/$search/';
-quit
-END_SQL
-
-rm /var/cache/biblehal/upload/${bibfile}
Index: trunk/biblehal-cleanall
===================================================================
--- trunk/biblehal-cleanall	(revision 7)
+++ 	(revision )
@@ -1,19 +1,0 @@
-#!/bin/bash
-#
-# gabriel 2010/04/02
-
-export PATH="/bin:/usr/bin:/usr/lib/biblehal"
-
-
-CONFIG_FILE=/srv/refbase/initialize/db.inc.php
-
-CONNECT_NAME=$(grep '$username =' ${CONFIG_FILE} | cut -f 2 -d '"')
-CONNECT_PASS=$(grep '$password =' ${CONFIG_FILE} | cut -f 2 -d '"')
-
-cat <<END_SQL | mysql --user=${CONNECT_NAME} --password=${CONNECT_PASS}
-DELETE FROM refbaselegi.refs;
-quit
-END_SQL
-
-
-rm /var/cache/biblehal/upload/*.bib
Index: trunk/biblehal-count
===================================================================
--- trunk/biblehal-count	(revision 7)
+++ 	(revision )
@@ -1,23 +1,0 @@
-#!/usr/bin/perl
-#
-# gabriel 2010/06/03
-
-# apt-get install libdbd-mysql-perl 
-
-use strict;
-
-use DBI;
-
-
-my $config_file = '/srv/refbase/initialize/db.inc.php';
-my $connect_name = qx{ grep '\$username =' $config_file | cut -f 2 -d '"' };
-my $connect_pass = qx{ grep '\$password =' $config_file | cut -f 2 -d '"' };
-chomp($connect_name, $connect_pass);
-
-my $dbh = DBI->connect( "DBI:mysql:database=refbaselegi;host=localhost",
-   "$connect_name", "$connect_pass", { 'RaiseError' => 1 } ); # refbase server
-
-my $sth = $dbh->prepare("SELECT serial FROM refs");
-   $sth->execute();
-
-print $sth->rows."\n";
Index: trunk/biblehal-explode
===================================================================
--- trunk/biblehal-explode	(revision 7)
+++ 	(revision )
@@ -1,30 +1,0 @@
-#!/bin/bash
-#
-# gabriel 2010/06/03
-
-export PATH="/bin:/usr/bin:/usr/lib/biblehal"
-
-
-year=$1; shift
-
-if [ ! -e /var/cache/biblehal/download/hal-extract-auto-${year}.bib ]
-then
-   echo "Usage biblehal-explode year"
-   echo " File /var/cache/biblehal/download/hal-extract-auto-${year}.bib must exist"
-   exit 1
-fi
-
-mkdir -p /var/cache/biblehal/explode
-
-index=0
-while read -r line ; do
-   echo ${line} | egrep '^%% .*-[[:digit:]]+, version' > /dev/null
-   if [[ $? -eq 0 ]]
-   then
-      index=$(echo ${line} | awk '{print $2}' | cut -f 1 -d ',')
-      [ -e /var/cache/biblehal/explode/hal-${index}.bib ] && rm /var/cache/biblehal/explode/hal-${index}.bib
-   fi
-   echo -E ${line} >> /var/cache/biblehal/explode/hal-${index}.bib
-done < /var/cache/biblehal/download/hal-extract-auto-${year}.bib
-
-rm /var/cache/biblehal/explode/hal-0.bib
Index: trunk/biblehal-pop
===================================================================
--- trunk/biblehal-pop	(revision 7)
+++ 	(revision )
@@ -1,204 +1,0 @@
-#!/usr/bin/perl
-#
-# gabriel 2010/06/03
-# gabriel 2011/04/01 update to biblehal
-#
-# apt-get install libwww-mechanize-perl libwww-perl
-
-use strict;
-
-use WWW::Mechanize;
-use Data::Dumper;
-use HTML::Form;
-
-my $laboratory = shift @ARGV;
-my $year       = shift @ARGV;
-
-die "Usage /usr/lib/biblehal/biblehal-pop laboratory year\n" if $year < 1990 or $year > 2020; 
-
-mkdir '/var/cache/biblehal/download', 0750;
-
-my $F = <<END_HTML;
-<form>
-<select name="wanted_meta[]" id="wanted_meta" class="formulaire"  size="20" multiple>
-<option value="id_article">Identifiant de l'article</option>
-<option value="domain">Domaine</option>
-<option value="title">Titre</option>
-<option value="auteur_nomprenom">Auteurs (nom prénom)</option>
-<option value="auteur_nominitial">Auteurs (nom initial prénom)</option>
-<option value="pauteur_etal">1er auteur et al.</option>
-<option value="laboratoire">Laboratoire</option>
-<option value="sstitle">Sous-titre</option>
-<option value="abstract">Résumé</option>
-<option value="abstract_ml">Résumé (autre langue)</option>
-<option value="langue">Langue du texte intégral</option>
-<option value="writing_date">Date de production, écriture</option>
-<option value="collaboration">Projet(s), collaboration(s)</option>
-<option value="researchteam">&Eacute;quipe(s) de recherche</option>
-<option value="doi">DOI</option>
-<option value="journal">Journal</option>
-<option value="titouv">Titre de l'ouvrage</option>
-<option value="audience">Audience</option>
-<option value="datepub">Date de publication</option>
-<option value="anneepub">Année de publication</option>
-<option value="dateepub">Date de publication électronique</option>
-<option value="volume">Volume</option>
-<option value="issue">Numéro</option>
-<option value="page">Page, identifiant, ...</option>
-<option value="edcom">Éditeur commercial</option>
-<option value="edsci">Éditeur scientifique</option>
-<option value="serie">Série/Collection</option>
-<option value="titconf">Titre de la conférence</option>
-<option value="dateconf">Date de la conférence</option>
-<option value="anneeconf">Année de la conférence</option>
-<option value="datefinconf">Date de la conférence (fin)</option>
-<option value="ville">Ville</option>
-<option value="pays">Pays</option>
-<option value="dircoll">Directeur de collection</option>
-<option value="description">Description</option>
-<option value="numbrevet">Numéro du brevet</option>
-<option value="datebrevet">Date de publication</option>
-<option value="keyword">Mots Clés</option>
-<option value="keyword_ml">Mots Clés (autre langue)</option>
-<option value="motcle">Thésaurus EIAH</option>
-<option value="keyword_mesh">Descripteur(s) MeSH</option>
-<option value="keyword_jel">Mots Clés du JEL</option>
-<option value="classification">Classification</option>
-<option value="comment">Commentaire</option>
-<option value="ref_interne">Référence interne</option>
-<option value="financement">Contrat, financement</option>
-<option value="projetanr">Projet ANR</option>
-<option value="projeteurope">Projet Européen</option>
-<option value="defencedate">date de soutenance</option>
-<option value="orgthe">organisme de délivrance</option>
-<option value="thesis_school">école doctorale</option>
-<option value="speciality">spécialit&eacute;</option>
-<option value="directeurThese">directeur de th&egrave;se</option>
-<option value="jury">composition du Jury</option>
-<option value="presidentHDR">pr&eacute;sident du jury</option>
-<option value="niveau">Niveau du cours</option>
-<option value="lieucours">Lieu du cours</option>
-<option value="arxivid">Identifiant arXiv</option>
-<option value="typdoc">Type de publication</option>
-<option value="havefile">Dépôt avec/sans fichier</option>
-<option value="yearstamp">Date de dépôt</option>
-<option value="file_url">URL fichier PDF</option>
-<option value="contributor">Contributeur</option>
-</select>
-</form>
-END_HTML
-
-# On intègre le second formulaire qui se remplit normalement via un javascript
-my $parser = HTML::Form->parse("$F", "http://hal.archives-ouvertes.fr/$laboratory");
-    print($@) if $@;
-#print Dumper $parser;
-
-
-# Création du bot
-my $url = "http://hal.archives-ouvertes.fr/$laboratory";
-my $bot = WWW::Mechanize->new;
-   $bot->env_proxy(); # Load proxy settings from *_proxy environment variables
- 
-# Hop, c'est parti, premiere page
-$bot->get($url);
-
-#my ( $firstoccur ) = grep /service_export/, split /\n/, $bot->content;
-# &halsid=tgtdq7gpp47p64fd67u2imrfv1&label
-#my ( $halsid ) = $firstoccur =~ m{ \& halsid = ([\w\d]+) \& label }xm;
-#print "SESSIONID : $halsid\n";
-#my $url2 = 'http://hal.archives-ouvertes.fr/view_by_stamp.php?&halsid='.$halsid.'&label=LEGI&langue=fr&action_todo=service_export';
-#$bot->get($url2);
-
-# On suit le lien pour exporter les publications du LEGI
-
-# <a class="niveau2" href="http://hal.archives-ouvertes.fr/view_by_stamp.php?&halsid=9ovethbls6kjlaje8ma9pf67b6&label=LEGI&langue=fr&action_todo=service_export" target="_self">Export d'une liste de publications</a>
-$bot->follow_link( text_regex => qr/Export\sd.une\sliste\sde\spublications/, url_regex => qr/action_todo=service_export/ );
-
-# Hop, seconde page, on choisis le premier (et seul) formulaire
-$bot->form_number(1);
-
-# Choix de l'année
-$bot->select( 'f_0' => 'YEAR' );
-$bot->select( 'p_0' => 'is_exactly' );
-$bot->field(  'v_0' => "$year" );
-
-# Format simplifié de la structure "current_form"
-#inputs
-#'name' => 'search_in_typdoc[]',
-#'menu' => [
-#            {
-#              'seen' => 1,
-#              'value' => undef,
-#              'name' => 'off'
-#            },
-#            {
-#              'value' => 'ART_ACL',
-#              'name' => 'Articles dans des revues avec comitÃ© de lecture'
-#            }
-#          ],
-#'name' => 'search_in_typdoc[]',
-
-# On récupère dans le formulaire la liste des types de documents
-my @typdoc = ();
-foreach my $item ( @{$bot->current_form->{inputs}} ) {
-   next if not $item->{'name'} eq 'search_in_typdoc[]';
-   
-   #print "TYPDOCi : ".$item->{'menu'}[1]{'value'}."\n";
-   push @typdoc, $item->{'menu'}[1]{'value'};
-   }
-#print "TYPDOC : @typdoc\n";
-
-$bot->select( 'search_in_typdoc[]' => \@typdoc );
-#$bot->select( 'search_in_typdoc[]' => [ 'THESE' ]);
-$bot->click( 'submit' );
-
-#print $bot->content;
-#print Dumper $bot->current_form;
-
-# Hop, troisième page, on prends le second formulaire
-$bot->form_number(2);
-
-#print Dumper $bot->current_form;
-
-# On intègre à la main les valeurs dans le formulaire 
-# qui se fait en javascript via firefox
-foreach my $input ( @{$parser->{inputs}} ) {
-   push @{$bot->current_form->{inputs}}, $input;
-   }
-
-# On récupère dans le formulaire la liste des items à exporter
-my @wanted_meta = ();
-foreach my $item ( @{$bot->current_form->{inputs}} ) {
-   next if not $item->{'name'} eq 'wanted_meta[]';
-   
-   #print "WANTED_METAi : ".$item->{'menu'}[1]{'value'}."\n";
-   push @wanted_meta, $item->{'menu'}[1]{'value'};
-   }
-#print "WANTED_META : @wanted_meta\n";
-
-#print Dumper $bot->current_form;
-
-$bot->select( 'wanted_meta[]' => \@wanted_meta);
-#$bot->select( 'wanted_meta[]' => [ 'id_article', 'title', 'auteur_nomprenom','yearstamp'  ]);
-$bot->select( 'export_format' => [ 'BIBTEX' ]);
-$bot->click( 'submit' );
-  
-print $bot->content;
-
-# Hop, quatrième page. On récupère l'URL du fichier temporaire sur le serveur
-
-my ( $biburlline ) = grep /http\:\/\/hal\.archives-ouvertes\.fr\/tmp\/hal/, split /\n/, $bot->content;
-my ( $biburl ) = $biburlline =~ m{ ( http://hal\.archives-ouvertes\.fr/ tmp/ hal[\w\d]+\.bib ) }xm;
-$bot->get("$biburl", ':content_file' => "/var/cache/biblehal/download/hal-extract-auto-$year.bib" );
-print "URLLINE : $biburlline\n";
-print "URL : $biburl\n";
-
-#<td align="left" class="help"><a href="http://hal.archives-ouvertes.fr/tmp/hal4ba60dfe813c7.bib" target="_blank"><span style="font-size:14px;font-weight:bold;">TÃ©lÃ©charger le fichier crÃ©Ã© ici</span></a></td>
-#<td align="left" class="help"><a href="http://hal.archives-ouvertes.fr/tmp/hal4bb4b8ed6cae6.bib" target="_blank"><span style="font-size:14px;font-weight:bold;">TÃ©lÃ©charger le fichier crÃ©Ã© ici</span></a></td>
-#my $biburl = $bot->find_link(text_regex => qr/ici/, url_regex  => qr/http:\/\/hal\.archives-ouvertes\.fr\/tmp\/hal[\d\w]+\.bib/);
-##my $biburl = $bot->find_link(url_regex  => qr/http:\/\/hal\.archives-ouvertes\.fr\/tmp\/hal[\d\w]+\.bib/);
-##sleep 5;
-##$bot->get( $biburl->url(), ':content_file' => '/tmp/hal-extract-auto.bib' );
-
-# Hop, le fichier .bib est sauvé sous /tmp/hal-extract-auto.bib
-# Mission accomplie
Index: trunk/biblehal-popall
===================================================================
--- trunk/biblehal-popall	(revision 7)
+++ 	(revision )
@@ -1,26 +1,0 @@
-#!/bin/bash
-#
-# gabriel 2010/06/03
-# gabriel 2011/04/01 update to biblehal
-
-export PATH="/bin:/usr/bin:/usr/lib/biblehal"
-
-
-if [ -f /etc/biblehal/biblehal.conf ]
-then
-   . /etc/biblehal/biblehal.conf
-fi
-
-if "z${LABORATORY}" = "z" ]
-then
-   echo "LABORATORY must be configure in /etc/biblehal/biblehal.conf"
-   exit 1
-fi
-
-
-for year in 1990 1994 1995 1996 1997 $(seq 1999 $(date +%Y))
-do
-   biblehal-pop ${LABORATORY} ${year}
-   
-   biblehal-explode ${year}
-done
Index: trunk/biblehal-poplast
===================================================================
--- trunk/biblehal-poplast	(revision 7)
+++ 	(revision )
@@ -1,26 +1,0 @@
-#!/bin/bash
-#
-# gabriel 2010/06/15
-# gabriel 2011/04/01 update to biblehal
-
-export PATH="/bin:/usr/bin:/usr/lib/biblehal"
-
-
-if [ -f /etc/biblehal/biblehal.conf ]
-then
-   . /etc/biblehal/biblehal.conf
-fi
-
-if "z${LABORATORY}" = "z" ]
-then
-   echo "LABORATORY must be configure in /etc/biblehal/biblehal.conf"
-   exit 1
-fi
-
-
-for year in  $(( $(date +%Y) -1 )) $(date +%Y)
-do
-   biblehal-pop ${LABORATORY} ${year}
-   
-   biblehal-explode ${year}
-done
Index: trunk/biblehal-push
===================================================================
--- trunk/biblehal-push	(revision 7)
+++ 	(revision )
@@ -1,133 +1,0 @@
-#!/usr/bin/perl
-#
-# gabriel 2010/06/03
-#
-# apt-get install libwww-mechanize-perl libwww-perl
-
-use strict;
-
-use WWW::Mechanize;
-use Data::Dumper;
-
-my $file_upload = $ARGV[0];
-die "Usage /usr/lib/biblehal/biblehal-push file.bib" if not -f $file_upload;
-
-
-my $config_file = '/etc/refbase.conf';
-my $connect_name = qx{ grep '\$adminLoginEmail =' $config_file | cut -f 2 -d "'" };
-my $connect_pass = qx{ grep '\$adminLoginPass ='  $config_file | cut -f 2 -d "'" };
-chomp($connect_name, $connect_pass);
-
-
-# Création du bot
-my $url = 'http://localhost/'; # refbase server
-my $bot = WWW::Mechanize->new;
-
-# Hop, c'est parti, premiere page
-$bot->get($url);
-
-
-#--1
-#
-#form numero 2
-#					<form action="user_login.php" method="POST" name="login">
-#						<fieldset>
-#							<legend>Login:</legend>
-#							<input type="hidden" name="referer" value="index.php">
-#							<div id="loginUser">
-#								<div id="loginUserLabel">
-#
-#									<label for="loginEmail">Email:</label>
-#								</div>
-#								<div id="loginUserInput">
-#									<input type="text" id="loginEmail" name="loginEmail">
-#								</div>
-#							</div>
-#							<div id="loginPwd">
-#								<div id="loginPwdLabel">
-#
-#									<label for="loginPassword">Password:</label>
-#								</div>
-#								<div id="loginPwdInput">
-#									<input type="password" id="loginPassword" name="loginPassword">
-#								</div>
-#							</div>
-#							<div id="loginSubmit">
-#								<input type="submit" value="Login">
-#
-#							</div>
-#						</fieldset>
-#					</form>
-
-# Hop, seconde page, on choisis le second formulaire
-$bot->form_number(2);
-
-$bot->field('loginEmail', "$connect_name");
-$bot->field('loginPassword', "$connect_pass");
-
-$bot->submit;
-
-$bot->get('import.php');
-
-
-$bot->form_number(2);
-
-$bot->field('uploadFile', "$file_upload");
-
-$bot->submit;
-
-$bot->form_number(2);
-$bot->submit;
-
-#print $bot->content;
-
-
-__END__ 
-
---2
-
-<a href="import.php" title="importer enregistrements dans la base de donn&eacute;es">Importer</a>
-
-suivre le lien
-
-
---3
-
-form numero 2 sur 3
-
-<form enctype="multipart/form-data" action="import_modify.php" method="POST">
-<input type="hidden" name="formType" value="import">
-<input type="hidden" name="submit" value="Import">
-<input type="hidden" name="showLinks" value="1">
-<input type="hidden" name="showSource" value="1">
-<table align="center" border="0" cellpadding="0" cellspacing="10" width="95%" summary="This table holds the main import form">
-<tr>
-	<td width="94" valign="top"><b>Records:</b></td>
-
-	<td width="10">&nbsp;</td>
-	<td colspan="3"><textarea name="sourceText" rows="6" cols="63" title="paste your records here"></textarea></td>
-</tr>
-<tr>
-	<td rowspan="2">&nbsp;</td>
-	<td rowspan="2">&nbsp;</td>
-	<td width="215" valign="top" rowspan="2"><input type="file" name="uploadFile" size="17" title="??import records from a file"></td>
-	<td width="98" valign="top" rowspan="2">Import records:</td>
-	<td valign="top"><input type="radio" name="importRecordsRadio" value="all" checked title="choose 'All' if you want to import all records at once">&nbsp;All</td>
-
-</tr>
-<tr>
-	<td valign="top"><input type="radio" name="importRecordsRadio" value="only" title="choose 'Only' if you just want to import particular records">&nbsp;Only:&nbsp;&nbsp;<input type="text" name="importRecords" value="1" size="5" title="enter record number(s): e.g. '1-5 7' imports the first five and the seventh"></td>
-</tr>
-<tr>
-	<td>&nbsp;</td>
-	<td>&nbsp;</td>
-	<td colspan="3">
-		<input type="submit" name="submit" value="Import" title="press this button to import the given source data">
-	</td>
-
-</tr>
-</table>
-</form>
-
---4
-
Index: trunk/biblehal-pushall
===================================================================
--- trunk/biblehal-pushall	(revision 7)
+++ 	(revision )
@@ -1,43 +1,0 @@
-#!/bin/bash
-#
-# gabriel 2010/06/03
-
-export PATH="/bin:/usr/bin:/usr/lib/biblehal"
-
-
-num_before=$(biblehal-count)
-
-mkdir -p /var/cache/biblehal/upload
-
-for bibfqname in /var/cache/biblehal/explode/hal-*.bib
-do
-   bibfile=$(basename $bibfqname)
-   if [ -e /var/cache/biblehal/upload/$bibfile ]
-   then
-      if cmp $bibfqname /var/cache/biblehal/upload/$bibfile
-      then
-         echo "Already have $bibfqname"
-         continue
-      fi
-      echo "Delete ref $bibfile on server refbase"
-      biblehal-clean $bibfile
-      num_before=$(( $num_before - 1 ))
-   fi
-
-   echo "Cache file $bibfqname"
-   cp $bibfqname /var/cache/biblehal/upload/
-   
-   echo "Push file $bibfqname - Counter at $num_before"
-   biblehal-push $bibfqname
-   num_after=$(biblehal-count)
-   if [[ $(( $num_after - $num_before )) == 1 ]]
-   then
-      num_before=$num_after
-   else
-      echo "Error on file $bibfqname (number of ref before $num_before / after $num_after)"
-      echo "Cleaning bib $bibfile on server refbase"
-      biblehal-clean $bibfile
-      num_before=$(biblehal-count)
-      continue
-   fi
-done
Index: trunk/biblehal-sample.conf
===================================================================
--- trunk/biblehal-sample.conf	(revision 7)
+++ 	(revision )
@@ -1,2 +1,0 @@
-
-LABORATORY=LEGI
Index: trunk/biblehal/Makefile
===================================================================
--- trunk/biblehal/Makefile	(revision 8)
+++ trunk/biblehal/Makefile	(revision 8)
@@ -0,0 +1,39 @@
+DESTDIR=
+
+LIBDIR=/usr/lib/biblehal
+CRONDIR=/etc/cron.d
+ETCDIR=/etc/biblehal
+
+.PHONY: all install update sync help
+
+all: help
+
+install: update
+	@id bib-le-hal > /dev/null || adduser --system --group --shell /bin/bash --home /var/lib/biblehal bib-le-hal
+	@install -d -m 0755 -o root -g root $(DESTDIR)/$(CRONDIR)
+	install     -m 0644 -o root -g root biblehal.cron $(DESTDIR)/$(CRONDIR)/klask
+
+update:
+	@install -d -m 0755 -o root -g root $(DESTDIR)/$(LIBDIR)
+	install     -m 0755 -o root -g root biblehal-clean $(DESTDIR)/$(LIBDIR)
+	install     -m 0755 -o root -g root biblehal-cleanall $(DESTDIR)/$(LIBDIR)
+	install     -m 0755 -o root -g root biblehal-count $(DESTDIR)/$(LIBDIR)
+	install     -m 0755 -o root -g root biblehal-explode $(DESTDIR)/$(LIBDIR)
+	install     -m 0755 -o root -g root biblehal-pop $(DESTDIR)/$(LIBDIR)
+	install     -m 0755 -o root -g root biblehal-popall $(DESTDIR)/$(LIBDIR)
+	install     -m 0755 -o root -g root biblehal-poplast $(DESTDIR)/$(LIBDIR)
+	install     -m 0755 -o root -g root biblehal-push $(DESTDIR)/$(LIBDIR)
+	install     -m 0755 -o root -g root biblehal-pushall $(DESTDIR)/$(LIBDIR)
+
+	@install -d -m 0755 -o root -g root $(DESTDIR)/$(ETCDIR)
+	install     -m 0644 -o root -g root biblehal-sample.conf $(DESTDIR)/$(ETCDIR)
+
+sync:
+	svn update
+
+help:
+	@echo "Possible target:"
+	@echo " * all     : this help"
+	@echo " * install : complete installation"
+	@echo " * update  : minimal installation"
+	@echo " * sync    : sync with subversion"
Index: trunk/biblehal/biblehal-clean
===================================================================
--- trunk/biblehal/biblehal-clean	(revision 8)
+++ trunk/biblehal/biblehal-clean	(revision 8)
@@ -0,0 +1,22 @@
+#!/bin/bash
+#
+# gabriel 2010/06/03
+
+export PATH="/bin:/usr/bin:/usr/lib/biblehal"
+
+
+bibfile=$1; shift
+
+search=$(basename ${bibfile} .bib | cut -f 2-10 -d '-')
+
+CONFIG_FILE=/srv/refbase/initialize/db.inc.php
+
+CONNECT_NAME=$(grep '$username =' ${CONFIG_FILE} | cut -f 2 -d '"')
+CONNECT_PASS=$(grep '$password =' ${CONFIG_FILE} | cut -f 2 -d '"')
+
+cat <<END_SQL | mysql --user=${CONNECT_NAME} --password=${CONNECT_PASS}
+DELETE FROM refbaselegi.refs WHERE url RLIKE '/$search/';
+quit
+END_SQL
+
+rm /var/cache/biblehal/upload/${bibfile}
Index: trunk/biblehal/biblehal-cleanall
===================================================================
--- trunk/biblehal/biblehal-cleanall	(revision 8)
+++ trunk/biblehal/biblehal-cleanall	(revision 8)
@@ -0,0 +1,19 @@
+#!/bin/bash
+#
+# gabriel 2010/04/02
+
+export PATH="/bin:/usr/bin:/usr/lib/biblehal"
+
+
+CONFIG_FILE=/srv/refbase/initialize/db.inc.php
+
+CONNECT_NAME=$(grep '$username =' ${CONFIG_FILE} | cut -f 2 -d '"')
+CONNECT_PASS=$(grep '$password =' ${CONFIG_FILE} | cut -f 2 -d '"')
+
+cat <<END_SQL | mysql --user=${CONNECT_NAME} --password=${CONNECT_PASS}
+DELETE FROM refbaselegi.refs;
+quit
+END_SQL
+
+
+rm /var/cache/biblehal/upload/*.bib
Index: trunk/biblehal/biblehal-count
===================================================================
--- trunk/biblehal/biblehal-count	(revision 8)
+++ trunk/biblehal/biblehal-count	(revision 8)
@@ -0,0 +1,23 @@
+#!/usr/bin/perl
+#
+# gabriel 2010/06/03
+
+# apt-get install libdbd-mysql-perl 
+
+use strict;
+
+use DBI;
+
+
+my $config_file = '/srv/refbase/initialize/db.inc.php';
+my $connect_name = qx{ grep '\$username =' $config_file | cut -f 2 -d '"' };
+my $connect_pass = qx{ grep '\$password =' $config_file | cut -f 2 -d '"' };
+chomp($connect_name, $connect_pass);
+
+my $dbh = DBI->connect( "DBI:mysql:database=refbaselegi;host=localhost",
+   "$connect_name", "$connect_pass", { 'RaiseError' => 1 } ); # refbase server
+
+my $sth = $dbh->prepare("SELECT serial FROM refs");
+   $sth->execute();
+
+print $sth->rows."\n";
Index: trunk/biblehal/biblehal-explode
===================================================================
--- trunk/biblehal/biblehal-explode	(revision 8)
+++ trunk/biblehal/biblehal-explode	(revision 8)
@@ -0,0 +1,30 @@
+#!/bin/bash
+#
+# gabriel 2010/06/03
+
+export PATH="/bin:/usr/bin:/usr/lib/biblehal"
+
+
+year=$1; shift
+
+if [ ! -e /var/cache/biblehal/download/hal-extract-auto-${year}.bib ]
+then
+   echo "Usage biblehal-explode year"
+   echo " File /var/cache/biblehal/download/hal-extract-auto-${year}.bib must exist"
+   exit 1
+fi
+
+mkdir -p /var/cache/biblehal/explode
+
+index=0
+while read -r line ; do
+   echo ${line} | egrep '^%% .*-[[:digit:]]+, version' > /dev/null
+   if [[ $? -eq 0 ]]
+   then
+      index=$(echo ${line} | awk '{print $2}' | cut -f 1 -d ',')
+      [ -e /var/cache/biblehal/explode/hal-${index}.bib ] && rm /var/cache/biblehal/explode/hal-${index}.bib
+   fi
+   echo -E ${line} >> /var/cache/biblehal/explode/hal-${index}.bib
+done < /var/cache/biblehal/download/hal-extract-auto-${year}.bib
+
+rm /var/cache/biblehal/explode/hal-0.bib
Index: trunk/biblehal/biblehal-pop
===================================================================
--- trunk/biblehal/biblehal-pop	(revision 8)
+++ trunk/biblehal/biblehal-pop	(revision 8)
@@ -0,0 +1,204 @@
+#!/usr/bin/perl
+#
+# gabriel 2010/06/03
+# gabriel 2011/04/01 update to biblehal
+#
+# apt-get install libwww-mechanize-perl libwww-perl
+
+use strict;
+
+use WWW::Mechanize;
+use Data::Dumper;
+use HTML::Form;
+
+my $laboratory = shift @ARGV;
+my $year       = shift @ARGV;
+
+die "Usage /usr/lib/biblehal/biblehal-pop laboratory year\n" if $year < 1990 or $year > 2020; 
+
+mkdir '/var/cache/biblehal/download', 0750;
+
+my $F = <<END_HTML;
+<form>
+<select name="wanted_meta[]" id="wanted_meta" class="formulaire"  size="20" multiple>
+<option value="id_article">Identifiant de l'article</option>
+<option value="domain">Domaine</option>
+<option value="title">Titre</option>
+<option value="auteur_nomprenom">Auteurs (nom prénom)</option>
+<option value="auteur_nominitial">Auteurs (nom initial prénom)</option>
+<option value="pauteur_etal">1er auteur et al.</option>
+<option value="laboratoire">Laboratoire</option>
+<option value="sstitle">Sous-titre</option>
+<option value="abstract">Résumé</option>
+<option value="abstract_ml">Résumé (autre langue)</option>
+<option value="langue">Langue du texte intégral</option>
+<option value="writing_date">Date de production, écriture</option>
+<option value="collaboration">Projet(s), collaboration(s)</option>
+<option value="researchteam">&Eacute;quipe(s) de recherche</option>
+<option value="doi">DOI</option>
+<option value="journal">Journal</option>
+<option value="titouv">Titre de l'ouvrage</option>
+<option value="audience">Audience</option>
+<option value="datepub">Date de publication</option>
+<option value="anneepub">Année de publication</option>
+<option value="dateepub">Date de publication électronique</option>
+<option value="volume">Volume</option>
+<option value="issue">Numéro</option>
+<option value="page">Page, identifiant, ...</option>
+<option value="edcom">Éditeur commercial</option>
+<option value="edsci">Éditeur scientifique</option>
+<option value="serie">Série/Collection</option>
+<option value="titconf">Titre de la conférence</option>
+<option value="dateconf">Date de la conférence</option>
+<option value="anneeconf">Année de la conférence</option>
+<option value="datefinconf">Date de la conférence (fin)</option>
+<option value="ville">Ville</option>
+<option value="pays">Pays</option>
+<option value="dircoll">Directeur de collection</option>
+<option value="description">Description</option>
+<option value="numbrevet">Numéro du brevet</option>
+<option value="datebrevet">Date de publication</option>
+<option value="keyword">Mots Clés</option>
+<option value="keyword_ml">Mots Clés (autre langue)</option>
+<option value="motcle">Thésaurus EIAH</option>
+<option value="keyword_mesh">Descripteur(s) MeSH</option>
+<option value="keyword_jel">Mots Clés du JEL</option>
+<option value="classification">Classification</option>
+<option value="comment">Commentaire</option>
+<option value="ref_interne">Référence interne</option>
+<option value="financement">Contrat, financement</option>
+<option value="projetanr">Projet ANR</option>
+<option value="projeteurope">Projet Européen</option>
+<option value="defencedate">date de soutenance</option>
+<option value="orgthe">organisme de délivrance</option>
+<option value="thesis_school">école doctorale</option>
+<option value="speciality">spécialit&eacute;</option>
+<option value="directeurThese">directeur de th&egrave;se</option>
+<option value="jury">composition du Jury</option>
+<option value="presidentHDR">pr&eacute;sident du jury</option>
+<option value="niveau">Niveau du cours</option>
+<option value="lieucours">Lieu du cours</option>
+<option value="arxivid">Identifiant arXiv</option>
+<option value="typdoc">Type de publication</option>
+<option value="havefile">Dépôt avec/sans fichier</option>
+<option value="yearstamp">Date de dépôt</option>
+<option value="file_url">URL fichier PDF</option>
+<option value="contributor">Contributeur</option>
+</select>
+</form>
+END_HTML
+
+# On intègre le second formulaire qui se remplit normalement via un javascript
+my $parser = HTML::Form->parse("$F", "http://hal.archives-ouvertes.fr/$laboratory");
+    print($@) if $@;
+#print Dumper $parser;
+
+
+# Création du bot
+my $url = "http://hal.archives-ouvertes.fr/$laboratory";
+my $bot = WWW::Mechanize->new;
+   $bot->env_proxy(); # Load proxy settings from *_proxy environment variables
+ 
+# Hop, c'est parti, premiere page
+$bot->get($url);
+
+#my ( $firstoccur ) = grep /service_export/, split /\n/, $bot->content;
+# &halsid=tgtdq7gpp47p64fd67u2imrfv1&label
+#my ( $halsid ) = $firstoccur =~ m{ \& halsid = ([\w\d]+) \& label }xm;
+#print "SESSIONID : $halsid\n";
+#my $url2 = 'http://hal.archives-ouvertes.fr/view_by_stamp.php?&halsid='.$halsid.'&label=LEGI&langue=fr&action_todo=service_export';
+#$bot->get($url2);
+
+# On suit le lien pour exporter les publications du LEGI
+
+# <a class="niveau2" href="http://hal.archives-ouvertes.fr/view_by_stamp.php?&halsid=9ovethbls6kjlaje8ma9pf67b6&label=LEGI&langue=fr&action_todo=service_export" target="_self">Export d'une liste de publications</a>
+$bot->follow_link( text_regex => qr/Export\sd.une\sliste\sde\spublications/, url_regex => qr/action_todo=service_export/ );
+
+# Hop, seconde page, on choisis le premier (et seul) formulaire
+$bot->form_number(1);
+
+# Choix de l'année
+$bot->select( 'f_0' => 'YEAR' );
+$bot->select( 'p_0' => 'is_exactly' );
+$bot->field(  'v_0' => "$year" );
+
+# Format simplifié de la structure "current_form"
+#inputs
+#'name' => 'search_in_typdoc[]',
+#'menu' => [
+#            {
+#              'seen' => 1,
+#              'value' => undef,
+#              'name' => 'off'
+#            },
+#            {
+#              'value' => 'ART_ACL',
+#              'name' => 'Articles dans des revues avec comitÃ© de lecture'
+#            }
+#          ],
+#'name' => 'search_in_typdoc[]',
+
+# On récupère dans le formulaire la liste des types de documents
+my @typdoc = ();
+foreach my $item ( @{$bot->current_form->{inputs}} ) {
+   next if not $item->{'name'} eq 'search_in_typdoc[]';
+   
+   #print "TYPDOCi : ".$item->{'menu'}[1]{'value'}."\n";
+   push @typdoc, $item->{'menu'}[1]{'value'};
+   }
+#print "TYPDOC : @typdoc\n";
+
+$bot->select( 'search_in_typdoc[]' => \@typdoc );
+#$bot->select( 'search_in_typdoc[]' => [ 'THESE' ]);
+$bot->click( 'submit' );
+
+#print $bot->content;
+#print Dumper $bot->current_form;
+
+# Hop, troisième page, on prends le second formulaire
+$bot->form_number(2);
+
+#print Dumper $bot->current_form;
+
+# On intègre à la main les valeurs dans le formulaire 
+# qui se fait en javascript via firefox
+foreach my $input ( @{$parser->{inputs}} ) {
+   push @{$bot->current_form->{inputs}}, $input;
+   }
+
+# On récupère dans le formulaire la liste des items à exporter
+my @wanted_meta = ();
+foreach my $item ( @{$bot->current_form->{inputs}} ) {
+   next if not $item->{'name'} eq 'wanted_meta[]';
+   
+   #print "WANTED_METAi : ".$item->{'menu'}[1]{'value'}."\n";
+   push @wanted_meta, $item->{'menu'}[1]{'value'};
+   }
+#print "WANTED_META : @wanted_meta\n";
+
+#print Dumper $bot->current_form;
+
+$bot->select( 'wanted_meta[]' => \@wanted_meta);
+#$bot->select( 'wanted_meta[]' => [ 'id_article', 'title', 'auteur_nomprenom','yearstamp'  ]);
+$bot->select( 'export_format' => [ 'BIBTEX' ]);
+$bot->click( 'submit' );
+  
+print $bot->content;
+
+# Hop, quatrième page. On récupère l'URL du fichier temporaire sur le serveur
+
+my ( $biburlline ) = grep /http\:\/\/hal\.archives-ouvertes\.fr\/tmp\/hal/, split /\n/, $bot->content;
+my ( $biburl ) = $biburlline =~ m{ ( http://hal\.archives-ouvertes\.fr/ tmp/ hal[\w\d]+\.bib ) }xm;
+$bot->get("$biburl", ':content_file' => "/var/cache/biblehal/download/hal-extract-auto-$year.bib" );
+print "URLLINE : $biburlline\n";
+print "URL : $biburl\n";
+
+#<td align="left" class="help"><a href="http://hal.archives-ouvertes.fr/tmp/hal4ba60dfe813c7.bib" target="_blank"><span style="font-size:14px;font-weight:bold;">TÃ©lÃ©charger le fichier crÃ©Ã© ici</span></a></td>
+#<td align="left" class="help"><a href="http://hal.archives-ouvertes.fr/tmp/hal4bb4b8ed6cae6.bib" target="_blank"><span style="font-size:14px;font-weight:bold;">TÃ©lÃ©charger le fichier crÃ©Ã© ici</span></a></td>
+#my $biburl = $bot->find_link(text_regex => qr/ici/, url_regex  => qr/http:\/\/hal\.archives-ouvertes\.fr\/tmp\/hal[\d\w]+\.bib/);
+##my $biburl = $bot->find_link(url_regex  => qr/http:\/\/hal\.archives-ouvertes\.fr\/tmp\/hal[\d\w]+\.bib/);
+##sleep 5;
+##$bot->get( $biburl->url(), ':content_file' => '/tmp/hal-extract-auto.bib' );
+
+# Hop, le fichier .bib est sauvé sous /tmp/hal-extract-auto.bib
+# Mission accomplie
Index: trunk/biblehal/biblehal-popall
===================================================================
--- trunk/biblehal/biblehal-popall	(revision 8)
+++ trunk/biblehal/biblehal-popall	(revision 8)
@@ -0,0 +1,26 @@
+#!/bin/bash
+#
+# gabriel 2010/06/03
+# gabriel 2011/04/01 update to biblehal
+
+export PATH="/bin:/usr/bin:/usr/lib/biblehal"
+
+
+if [ -f /etc/biblehal/biblehal.conf ]
+then
+   . /etc/biblehal/biblehal.conf
+fi
+
+if "z${LABORATORY}" = "z" ]
+then
+   echo "LABORATORY must be configure in /etc/biblehal/biblehal.conf"
+   exit 1
+fi
+
+
+for year in 1990 1994 1995 1996 1997 $(seq 1999 $(date +%Y))
+do
+   biblehal-pop ${LABORATORY} ${year}
+   
+   biblehal-explode ${year}
+done
Index: trunk/biblehal/biblehal-poplast
===================================================================
--- trunk/biblehal/biblehal-poplast	(revision 8)
+++ trunk/biblehal/biblehal-poplast	(revision 8)
@@ -0,0 +1,26 @@
+#!/bin/bash
+#
+# gabriel 2010/06/15
+# gabriel 2011/04/01 update to biblehal
+
+export PATH="/bin:/usr/bin:/usr/lib/biblehal"
+
+
+if [ -f /etc/biblehal/biblehal.conf ]
+then
+   . /etc/biblehal/biblehal.conf
+fi
+
+if "z${LABORATORY}" = "z" ]
+then
+   echo "LABORATORY must be configure in /etc/biblehal/biblehal.conf"
+   exit 1
+fi
+
+
+for year in  $(( $(date +%Y) -1 )) $(date +%Y)
+do
+   biblehal-pop ${LABORATORY} ${year}
+   
+   biblehal-explode ${year}
+done
Index: trunk/biblehal/biblehal-push
===================================================================
--- trunk/biblehal/biblehal-push	(revision 8)
+++ trunk/biblehal/biblehal-push	(revision 8)
@@ -0,0 +1,133 @@
+#!/usr/bin/perl
+#
+# gabriel 2010/06/03
+#
+# apt-get install libwww-mechanize-perl libwww-perl
+
+use strict;
+
+use WWW::Mechanize;
+use Data::Dumper;
+
+my $file_upload = $ARGV[0];
+die "Usage /usr/lib/biblehal/biblehal-push file.bib" if not -f $file_upload;
+
+
+my $config_file = '/etc/refbase.conf';
+my $connect_name = qx{ grep '\$adminLoginEmail =' $config_file | cut -f 2 -d "'" };
+my $connect_pass = qx{ grep '\$adminLoginPass ='  $config_file | cut -f 2 -d "'" };
+chomp($connect_name, $connect_pass);
+
+
+# Création du bot
+my $url = 'http://localhost/'; # refbase server
+my $bot = WWW::Mechanize->new;
+
+# Hop, c'est parti, premiere page
+$bot->get($url);
+
+
+#--1
+#
+#form numero 2
+#					<form action="user_login.php" method="POST" name="login">
+#						<fieldset>
+#							<legend>Login:</legend>
+#							<input type="hidden" name="referer" value="index.php">
+#							<div id="loginUser">
+#								<div id="loginUserLabel">
+#
+#									<label for="loginEmail">Email:</label>
+#								</div>
+#								<div id="loginUserInput">
+#									<input type="text" id="loginEmail" name="loginEmail">
+#								</div>
+#							</div>
+#							<div id="loginPwd">
+#								<div id="loginPwdLabel">
+#
+#									<label for="loginPassword">Password:</label>
+#								</div>
+#								<div id="loginPwdInput">
+#									<input type="password" id="loginPassword" name="loginPassword">
+#								</div>
+#							</div>
+#							<div id="loginSubmit">
+#								<input type="submit" value="Login">
+#
+#							</div>
+#						</fieldset>
+#					</form>
+
+# Hop, seconde page, on choisis le second formulaire
+$bot->form_number(2);
+
+$bot->field('loginEmail', "$connect_name");
+$bot->field('loginPassword', "$connect_pass");
+
+$bot->submit;
+
+$bot->get('import.php');
+
+
+$bot->form_number(2);
+
+$bot->field('uploadFile', "$file_upload");
+
+$bot->submit;
+
+$bot->form_number(2);
+$bot->submit;
+
+#print $bot->content;
+
+
+__END__ 
+
+--2
+
+<a href="import.php" title="importer enregistrements dans la base de donn&eacute;es">Importer</a>
+
+suivre le lien
+
+
+--3
+
+form numero 2 sur 3
+
+<form enctype="multipart/form-data" action="import_modify.php" method="POST">
+<input type="hidden" name="formType" value="import">
+<input type="hidden" name="submit" value="Import">
+<input type="hidden" name="showLinks" value="1">
+<input type="hidden" name="showSource" value="1">
+<table align="center" border="0" cellpadding="0" cellspacing="10" width="95%" summary="This table holds the main import form">
+<tr>
+	<td width="94" valign="top"><b>Records:</b></td>
+
+	<td width="10">&nbsp;</td>
+	<td colspan="3"><textarea name="sourceText" rows="6" cols="63" title="paste your records here"></textarea></td>
+</tr>
+<tr>
+	<td rowspan="2">&nbsp;</td>
+	<td rowspan="2">&nbsp;</td>
+	<td width="215" valign="top" rowspan="2"><input type="file" name="uploadFile" size="17" title="??import records from a file"></td>
+	<td width="98" valign="top" rowspan="2">Import records:</td>
+	<td valign="top"><input type="radio" name="importRecordsRadio" value="all" checked title="choose 'All' if you want to import all records at once">&nbsp;All</td>
+
+</tr>
+<tr>
+	<td valign="top"><input type="radio" name="importRecordsRadio" value="only" title="choose 'Only' if you just want to import particular records">&nbsp;Only:&nbsp;&nbsp;<input type="text" name="importRecords" value="1" size="5" title="enter record number(s): e.g. '1-5 7' imports the first five and the seventh"></td>
+</tr>
+<tr>
+	<td>&nbsp;</td>
+	<td>&nbsp;</td>
+	<td colspan="3">
+		<input type="submit" name="submit" value="Import" title="press this button to import the given source data">
+	</td>
+
+</tr>
+</table>
+</form>
+
+--4
+
Index: trunk/biblehal/biblehal-pushall
===================================================================
--- trunk/biblehal/biblehal-pushall	(revision 8)
+++ trunk/biblehal/biblehal-pushall	(revision 8)
@@ -0,0 +1,43 @@
+#!/bin/bash
+#
+# gabriel 2010/06/03
+
+export PATH="/bin:/usr/bin:/usr/lib/biblehal"
+
+
+num_before=$(biblehal-count)
+
+mkdir -p /var/cache/biblehal/upload
+
+for bibfqname in /var/cache/biblehal/explode/hal-*.bib
+do
+   bibfile=$(basename $bibfqname)
+   if [ -e /var/cache/biblehal/upload/$bibfile ]
+   then
+      if cmp $bibfqname /var/cache/biblehal/upload/$bibfile
+      then
+         echo "Already have $bibfqname"
+         continue
+      fi
+      echo "Delete ref $bibfile on server refbase"
+      biblehal-clean $bibfile
+      num_before=$(( $num_before - 1 ))
+   fi
+
+   echo "Cache file $bibfqname"
+   cp $bibfqname /var/cache/biblehal/upload/
+   
+   echo "Push file $bibfqname - Counter at $num_before"
+   biblehal-push $bibfqname
+   num_after=$(biblehal-count)
+   if [[ $(( $num_after - $num_before )) == 1 ]]
+   then
+      num_before=$num_after
+   else
+      echo "Error on file $bibfqname (number of ref before $num_before / after $num_after)"
+      echo "Cleaning bib $bibfile on server refbase"
+      biblehal-clean $bibfile
+      num_before=$(biblehal-count)
+      continue
+   fi
+done
Index: trunk/biblehal/biblehal-sample.conf
===================================================================
--- trunk/biblehal/biblehal-sample.conf	(revision 8)
+++ trunk/biblehal/biblehal-sample.conf	(revision 8)
@@ -0,0 +1,2 @@
+
+LABORATORY=LEGI
