Add email and description in handle registry entries
authorymh <ymh.work@gmail.com>
Mon, 16 Oct 2017 15:22:08 +0200
changeset 552 2c579ea45608
parent 551 e70004b11b3b
child 553 251df6cb3afa
Add email and description in handle registry entries
server/src/.env.example
server/src/app/Console/Commands/ManageHandles.php
server/src/app/Libraries/Handle/HandleClient.php
server/src/config/corpusparole.php
server/src/phpunit.xml
server/src/tests/Libraries/Handle/HandleClientIntegrationTest.php
--- a/server/src/.env.example	Mon Oct 16 15:18:53 2017 +0200
+++ b/server/src/.env.example	Mon Oct 16 15:22:08 2017 +0200
@@ -54,6 +54,8 @@
 HANDLE_ADMIN_ID=CORPUS_ADMIN
 HANDLE_CERT_OR_PKEY=""
 HANDLE_PASSWORD=NULL
+HANDLE_TITLE_PREFIX="Trésors de la parole"
+HANDLE_CONTACT_EMAIL=""
 
 
 # Geonames user name (cf. http://www.geonames.org/login)
--- a/server/src/app/Console/Commands/ManageHandles.php	Mon Oct 16 15:18:53 2017 +0200
+++ b/server/src/app/Console/Commands/ManageHandles.php	Mon Oct 16 15:22:08 2017 +0200
@@ -47,7 +47,7 @@
     }
 
     private function registerHandle($doc) {
-        $this->handleClient->createHandleUrlRecord($doc->getId(), config('app.url')."/docs/".$doc->getId());
+        $this->handleClient->createHandleUrlRecord($doc->getId(), config('app.url')."/docs/".$doc->getId(), $doc->getTitle());
     }
 
     /**
--- a/server/src/app/Libraries/Handle/HandleClient.php	Mon Oct 16 15:18:53 2017 +0200
+++ b/server/src/app/Libraries/Handle/HandleClient.php	Mon Oct 16 15:22:08 2017 +0200
@@ -1,9 +1,9 @@
 <?php
 namespace CorpusParole\Libraries\Handle;
 
+use Config;
 use Log;
 
-
 use Illuminate\Pagination\LengthAwarePaginator;
 use Illuminate\Pagination\Paginator;
 
@@ -257,12 +257,14 @@
         Log::debug('Delete Handle: '.$delRes->getStatusCode().': '.$delRes->getReasonPhrase());
     }
 
-    public function createHandleUrlRecord($handle, $url) {
+    public function createHandleUrlRecord($handle, $url, $title) {
         $this->initSession();
         $currentDate = gmstrftime('%Y-%m-%dT%H:%M:%SZ');
         $handleRecord = [
           'values' => [
             ['index' => 1, 'ttl' => 86400, 'type' => 'URL', 'timestamp' => $currentDate, 'data' => ['value'=> $url, 'format'=> 'string']],
+            ['index' => 2, 'ttl' => 86400, 'type' => 'DESC', 'timestamp' => $currentDate, 'data' => ['value'=> config('corpusparole.handle_title_prefix')." : $title", 'format'=> 'string']],
+            ['index' => 3, 'ttl' => 86400, 'type' => 'EMAIL', 'timestamp' => $currentDate, 'data' => ['value'=> config('corpusparole.handle_contact_email'), 'format'=> 'string']],
             ['index' => 100, 'ttl' => 86400, 'type' => 'HS_ADMIN', 'timestamp' => $currentDate, 'data' => [
                 'value' => ['index' => 200, 'handle' => $this->adminId],
                 'permissions' => '011111110011',
--- a/server/src/config/corpusparole.php	Mon Oct 16 15:18:53 2017 +0200
+++ b/server/src/config/corpusparole.php	Mon Oct 16 15:22:08 2017 +0200
@@ -188,12 +188,14 @@
         "exportApplicationGlobal" => true
     ],
 
-    'handle_host'         => env('HANDLE_HOST'),
-    'handle_port'         => env('HANDLE_PORT', 8000),
-    'handle_admin_id'     => env('HANDLE_ADMIN_ID'),
-    'handle_prefix'       => env('HANDLE_PREFIX'),
-    'handle_cert_or_pkey' => env('HANDLE_CERT_OR_PKEY'),
-    'handle_password'     => env('HANDLE_PASSWORD'),
+    'handle_host'          => env('HANDLE_HOST'),
+    'handle_port'          => env('HANDLE_PORT', 8000),
+    'handle_admin_id'      => env('HANDLE_ADMIN_ID'),
+    'handle_prefix'        => env('HANDLE_PREFIX'),
+    'handle_cert_or_pkey'  => env('HANDLE_CERT_OR_PKEY'),
+    'handle_password'      => env('HANDLE_PASSWORD'),
+    'handle_title_prefix'  => env('HANDLE_TITLE_PREFIX','Trésors de la parole'),
+    'handle_contact_email' => env('HANDLE_CONTACT_EMAIL'),
 
     'transcript_default_creator' => 'Corpus de la Parole',
     'transcrit_decoder_mapping' => [
--- a/server/src/phpunit.xml	Mon Oct 16 15:18:53 2017 +0200
+++ b/server/src/phpunit.xml	Mon Oct 16 15:22:08 2017 +0200
@@ -35,6 +35,8 @@
         <env name="CORPUSPAROLE_RDF4J_REPOSITORY" value="cocoon_test"/>
         <env name="HANDLE_HOST" value="172.16.1.6"/>
         <env name="HANDLE_PORT" value="8000"/>
+        <env name="HANDLE_TITLE_PREFIX" value="Corpus de la parole"/>
+        <env name="HANDLE_CONTACT_EMAIL" value="contact@corpus.local"/>
         <env name="HANDLE_PREFIX" value="11280.100"/>
         <env name="HANDLE_ADMIN_ID" value="300:11280.100/CORPUS_ADMIN"/>
 
--- a/server/src/tests/Libraries/Handle/HandleClientIntegrationTest.php	Mon Oct 16 15:18:53 2017 +0200
+++ b/server/src/tests/Libraries/Handle/HandleClientIntegrationTest.php	Mon Oct 16 15:22:08 2017 +0200
@@ -182,7 +182,7 @@
 
         //$handle = "$this->testPrefix/TEST_HANDLE_CLIENT_";
 
-        $handleClient->createHandleUrlRecord($handle, "http://www.example.com");
+        $handleClient->createHandleUrlRecord($handle, "http://www.example.com", "Great title");
 
         $pagination = $handleClient->paginateAll($this->testPrefix);
 
@@ -206,7 +206,7 @@
 
         $handle = strtoupper(uniqid("$this->testPrefix/TEST_HANDLE_CLIENT_"));
 
-        $handleClient->createHandleUrlRecord($handle, "http://www.example.com");
+        $handleClient->createHandleUrlRecord($handle, "http://www.example.com", "Great title");
         $handleClient->deleteHandle($handle);