Browse Source

Merge branch 'master' of github.com:hugoroy/exegetes-citron

Hugo Roy 8 years ago
parent
commit
54bd094a38

+ 1 - 0
.gitignore

@@ -1 +1,2 @@
 bootstrap3
+/nbproject/private/

+ 17 - 2
abro-tele2.html

@@ -26,7 +26,7 @@
     </div>
 
     <div class="éditer">
-	<form>
+	<form action="/bartender/shake" method="get">
 	<div class="form-group hidden">
 	    <label for="projetId">Identifiant:</label>
 	    <input type="text" class="form-control" id="projetId" name="projetId" value="abro-tele2" placeholder="">
@@ -64,8 +64,10 @@
       <a class="docx" href="http://citron.exegetes.eu.org/abroretention/abro-tele2.docx">Docx</a>
       <a class="html5" href="http://citron.exegetes.eu.org/abroretention/abro-tele2.html">HTML</a>
       <a class="txt" href="http://citron.exegetes.eu.org/abroretention/abro-tele2.txt">Texte</a>
+      Dernière compilation :&nbsp;<div id="statusmsg"></div>
     </div>
-    
+
+
     <nav class="projets dossiers">
       <span class="heading">Projets</span>
       <a href="/replique-premierministre-csi.html">Réplique Premier Ministre CSI</a>
@@ -75,6 +77,19 @@
 
     <!-- jQuery (necessary for Bootstrap's JavaScript plugins) -->
     <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
+<script>
+$(document).ready(function() {
+  setTimeout(bartender_get_compilation_status, 1000);
+});
+function bartender_get_compilation_status () {
+    jQuery.get('/bartender/status?dossier=abroretention&projetId=abro-tele2', function(data) {
+        $("#statusmsg").html(data["text"]);
+        if(data.status === 'IN PROGRESS') {
+          setTimeout(bartender_get_compilation_status, 5000);
+	}		
+    });
+};
+</script>
     <!-- Include all compiled plugins (below), or include individual files as needed -->
     <script src="bootstrap3/js/bootstrap.min.js"></script>
   </body>

+ 33 - 0
editer.php

@@ -0,0 +1,33 @@
+<?php
+
+require_once 'objects.php';
+
+
+if (isset($_POST['action']))
+	switch ($_POST['action']) {
+		case 'create-edit':
+			$ret = $db->CreateOrEdit($_POST['type'],$_POST);
+			if (!$ret)
+				echo "<pre>erreur</pre>";
+			else {
+				header("Location: voir.php?type={$_POST['type']}&id=$ret");
+				die();
+			}
+			break;
+		
+		case 'delete':
+			if ($db->Delete($_POST['type'],$_POST['id'])) {
+				header('Location: index.php');
+				die();
+			}
+	}
+
+if ($_GET['type'] == 'dossier') {
+	$o = isset($_GET['id']) ? $dossiers[$_GET['id']] : $db->GetEmptyObject($_GET['type']);
+	include_once 'templates/tpl-create-edit-dossier.php';
+} else {
+	$o = isset($_GET['id']) ? $projects[$_GET['id']] : $db->GetEmptyObject($_GET['type']);
+	include_once 'templates/tpl-create-edit-project.php';
+}
+
+

+ 0 - 71
index.html

@@ -1,71 +0,0 @@
-<!DOCTYPE html>
-<html lang="fr-fr">
-  <head>
-    <meta charset="utf-8">
-    <meta http-equiv="X-UA-Compatible" content="IE=edge">
-    <meta name="viewport" content="width=device-width, initial-scale=1">
-    <title>Exégètes - Presse à Citron</title>
-
-    <!-- Bootstrap -->
-    <!-- <link href="bootstrap3/css/bootstrap.min.css" rel="stylesheet"> -->
-    <link href="style.css" rel="stylesheet">
-
-    <!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
-    <!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
-    <!--[if lt IE 9]>
-      <script src="https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js"></script>
-      <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
-    <![endif]-->
-  </head>
-  <body id="index">
-    <h1>Presse à Citron</h1>
-
-    <p class="bievenue">
-      Choisis un projet ou bien <a href="#ajouter">ajoute un nouveau projet</a> !
-    </p>
-
-    <div class="éditer" id="ajouter">
-	<form>
-	<div class="form-group">
-	    <label for="projetNom">Nom du projet:</label>
-	    <input type="text" class="form-control" id="projetNom" name="projetNom" placeholder="Projet de mémoire">
-	</div>
-	<div class="form-group">
-	    <label for="projetId">Identifiant:</label>
-	    <input type="text" class="form-control" id="projetId" name="projetId" placeholder="(automatiquement suggéré en fonction du nom)">
-	</div>
-	<div class="form-group">
-	    <label for="projetDossier">Dossier: <a href="ajout-dossier.html">(Nouveau dossier ?)</a></label>
-	    <select name="dossier" id="dossiers" multiple="" class="form-control input-lg select2 select2-offscreen" tabindex="-1">
-		<option value="intveld">In 't Veld</option>
-		<option value="abroretention">Abrogation de la rétention des données</option>
-		<option value="tes">Fichier TES</option>
-		<option value="orangefail">#OrangeFail</option>
-		<option value="prishield">Privacy Shield</option>
-	    </select>
-	</div>
-	<div class="actions"> 
-	    <button type="submit" class="bouton">Ajouter</button>
-	</div>
-	</form>
-    </div>
-
-    <nav class="dossiers">
-    <h2>Liste des dossiers</h2>
-      <a href="/intveld/">In 't Veld</a>
-      <a href="/abroretention/">Abrogation de la rétention des données</a>
-    </nav>
-    
-    <nav class="projets">
-      <span class="heading">Projets</span>
-      <a href="/replique-premierministre-csi.html">Réplique Premier Ministre CSI</a>
-      <a href="/abro-tele2.html">MA Abrogation Tele2</a>
-    </nav>
-
-
-    <!-- jQuery (necessary for Bootstrap's JavaScript plugins) -->
-    <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
-    <!-- Include all compiled plugins (below), or include individual files as needed -->
-    <script src="bootstrap3/js/bootstrap.min.js"></script>
-  </body>
-</html>

+ 8 - 0
index.php

@@ -0,0 +1,8 @@
+<?php
+
+require_once 'objects.php';
+
+
+include_once 'templates/tpl-index.php';
+
+

+ 268 - 0
lib/db.php

@@ -0,0 +1,268 @@
+<?php
+
+class DB extends SQLite3 {
+	
+	private $open = false;
+	
+	public function __construct () {}
+	
+	
+	private function ensure_connection () {
+		
+		if (!$this->open) {
+			$this->open('db.sqlite');
+			$this->open = true;
+		} else {
+			$this->close();
+			$this->open('db.sqlite');
+		}
+		
+		if (!@$this->query('SELECT * FROM dossiers LIMIT 1')) {
+			$res = $this->query('
+				CREATE TABLE dossiers (
+					name varchar(128),
+					slugname varchar(128),
+					cloud_link varchar(1024),
+					wiki_link varchar(1024),
+					last_edit_date datetime
+				)
+			');
+			if ($res)
+				echo "<pre>created dossiers table</pre>";
+			else
+				echo "<pre>error creating dossiers table: ".$this->lastErrorMsg()."</pre>";
+		}
+		if (!@$this->query('SELECT * FROM projects LIMIT 1')) {
+			$res = $this->query('
+				CREATE TABLE projects (
+					name varchar(128),
+					slugname varchar(128),
+					dossier_id integer,
+					main_pad varchar(1024),
+					cover_pad varchar(1024),
+					pads text,
+					last_edit_date datetime
+				)
+			');
+			if ($res)
+				echo "<pre>created projects table</pre>";
+			else
+				echo "<pre>error creating projects table: ".$this->lastErrorMsg()."</pre>";
+		}
+		return true;
+	}
+	
+	
+	public function GetObjects ($type) {
+		$this->ensure_connection();
+		
+		if (!in_array($type,['dossiers','projects'])) {
+			echo "<pre>mistake '$type'</pre>";
+			return [];
+		}
+		
+		$results = $this->query("SELECT rowid, * FROM $type");
+		$objects = [];
+		
+		while ($o = $results->fetchArray(SQLITE3_ASSOC))
+			$objects[$o['rowid']] = $o;
+		
+		return $objects;
+	}
+	
+	
+	public function GetEmptyObject ($type) {
+		switch ($type) {
+			case 'dossier':
+				return [
+					'rowid'=>'',
+					'name'=>'',
+					'slugname'=>'',
+					'cloud_link'=>'',
+					'wiki_link'=>'',
+					'last_edit_date'=>'',
+				];
+			
+			case 'project':
+				return [
+					'rowid'=>'',
+					'name'=>'',
+					'slugname'=>'',
+					'dossier_id'=>'',
+					'dossier'=>'',
+					'main_pad'=>'',
+					'cover_pad'=>'',
+					'last_edit_date'=>'',
+				];
+		}
+	}
+	
+	
+	public function CreateOrEdit ($type,$params) {
+		switch ($type) {
+			case 'dossier':
+				return $this->CreateOrEditDossier($params);
+			case 'project':
+				return $this->CreateOrEditProject($params);
+		}
+	}
+	
+	
+	public function CreateOrEditDossier ($params) {
+		$this->ensure_connection();
+		
+		// EDITION
+		if (isset($params['rowid']) && $params['rowid']) {
+			
+			$q = $this->prepare("
+				UPDATE dossiers
+				SET
+					name = :name,
+					cloud_link = :cloud_link,
+					wiki_link = :wiki_link,
+					last_edit_date = datetime('now')
+				WHERE
+					rowid = :rowid
+			");
+			
+			$q->bindValue(':name', $params['name'], SQLITE3_TEXT);
+			$q->bindValue(':cloud_link', $params['cloud_link'], SQLITE3_TEXT);
+			$q->bindValue(':wiki_link', $params['wiki_link'], SQLITE3_TEXT);
+			$q->bindValue(':rowid', $params['rowid'], SQLITE3_INTEGER);
+			
+			$result = $q->execute();
+			
+			if (!$result)
+				echo "<pre>Erreur à l'édition: ".$this->lastErrorMsg()."</pre>";
+			else
+				return $params['rowid'];
+		}
+		
+		// CREATION
+		else {
+			$slug = preg_replace('_\W+_','-',strtolower($params['name']));
+			$slug = preg_replace('_^-|-$_','',$slug);
+			
+			$q = $this->prepare("
+				INSERT INTO dossiers
+					(name, slugname, cloud_link, wiki_link, last_edit_date)
+				VALUES
+					(:name, :slugname, :cloud_link, :wiki_link, datetime('now'))
+			");
+			
+			$q->bindValue(':name', $params['name'], SQLITE3_TEXT);
+			$q->bindValue(':slugname', $slug, SQLITE3_TEXT);
+			$q->bindValue(':cloud_link', $params['cloud_link'], SQLITE3_TEXT);
+			$q->bindValue(':wiki_link', $params['wiki_link'], SQLITE3_TEXT);
+			
+			$result = $q->execute();
+			
+			if ($result)
+				return $this->lastInsertRowID();
+		}
+		
+		return false;
+	}
+	
+	
+	public function CreateOrEditProject ($params) {
+		$this->ensure_connection();
+		
+		$params['pads'] = json_encode($params['pads']);
+		
+		// EDITION
+		if (isset($params['rowid']) && $params['rowid']) {
+			
+			$q = $this->prepare("
+				UPDATE projects
+				SET
+					name = :name,
+					dossier_id = :dossier_id,
+					main_pad = :main_pad,
+					cover_pad = :cover_pad,
+					pads = :pads,
+					last_edit_date = datetime('now')
+				WHERE
+					rowid = :rowid
+			");
+			
+			$q->bindValue(':name', $params['name'], SQLITE3_TEXT);
+			$q->bindValue(':dossier_id', $params['dossier_id'], SQLITE3_INTEGER);
+			$q->bindValue(':main_pad', $params['main_pad'], SQLITE3_TEXT);
+			$q->bindValue(':cover_pad', $params['cover_pad'], SQLITE3_TEXT);
+			$q->bindValue(':pads', 'TODO', SQLITE3_TEXT);
+			$q->bindValue(':rowid', $params['rowid'], SQLITE3_INTEGER);
+			
+			$result = $q->execute();
+			
+			if (!$result)
+				echo "<pre>Erreur à l'édition: ".$this->lastErrorMsg()."</pre>";
+			else
+				return $params['rowid'];
+		}
+		
+		// CREATION
+		else {
+			$slug = preg_replace('_\W+_','-',strtolower($params['name']));
+			$slug = preg_replace('_^-|-$_','',$slug);
+			
+			$q = $this->prepare("
+				INSERT INTO projects
+					(name, slugname, dossier_id, main_pad, cover_pad, last_edit_date)
+				VALUES
+					(:name, :slugname, :dossier_id, :main_pad, :cover_pad, datetime('now'))
+			");
+			
+			$q->bindValue(':name', $params['name'], SQLITE3_TEXT);
+			$q->bindValue(':slugname', $slug, SQLITE3_TEXT);
+			$q->bindValue(':dossier_id', $params['dossier_id'], SQLITE3_INTEGER);
+			$q->bindValue(':main_pad', $params['main_pad'], SQLITE3_TEXT);
+			$q->bindValue(':cover_pad', $params['cover_pad'], SQLITE3_TEXT);
+			$q->bindValue(':pads', $params['pads'], SQLITE3_TEXT);
+			
+			$result = $q->execute();
+			
+			if ($result)
+				return $this->lastInsertRowID();
+		}
+		
+		return false;
+	}
+	
+	
+	public function Delete ($type,$id) {
+		switch ($type) {
+			case 'dossier':
+				return $this->DeleteDossier($id);
+			case 'project':
+				return $this->DeleteProject($id);
+		}
+	}
+	
+	public function DeleteDossier ($id) {
+		$this->ensure_connection();
+		
+		$q = $this->prepare("DELETE FROM dossiers WHERE rowid = :rowid");
+		$q->bindValue(':rowid', $id, SQLITE3_INTEGER);
+		$result = $q->execute();
+		
+		if (!$result)
+			echo "<pre>Error deleting dossier $id: ".$this->lastErrorMsg()."</pre>";
+		
+		return $result?true:false;
+	}
+	
+	public function DeleteProject ($id) {
+		$this->ensure_connection();
+		
+		$q = $this->prepare("DELETE FROM projects WHERE rowid = :rowid");
+		$q->bindValue(':rowid', $id, SQLITE3_INTEGER);
+		$result = $q->execute();
+		
+		if (!$result)
+			echo "<pre>Error deleting project $id: ".$this->lastErrorMsg()."</pre>";
+		
+		return $result?true:false;
+	}
+	
+}

+ 4 - 0
mep.sh

@@ -0,0 +1,4 @@
+
+
+rsync -avc --delete -e 'ssh -p 2222' --chown=www-data:www-data /home/nicolas/Projets/exegetes-citron/ root@ksi:/home/nicolas/citron/
+

+ 16 - 0
objects.php

@@ -0,0 +1,16 @@
+<?php
+
+require_once 'lib/db.php';
+
+ini_set('display_errors', 1);
+ini_set('display_startup_errors', 1);
+error_reporting(E_ALL);
+
+$db = new DB();
+$projects = $db->GetObjects('projects');
+$dossiers = $db->GetObjects('dossiers');
+
+foreach ($projects as &$p)
+	$p['dossier'] = isset($dossiers[$p['dossier_id']]) ? $dossiers[$p['dossier_id']]['name'] : '';
+
+//echo "<pre>".count($dossiers)." dossiers et ".count($projects)." projets\n</pre>";

+ 58 - 0
templates/tpl-create-edit-dossier.php

@@ -0,0 +1,58 @@
+<?php
+include_once 'templates/tpl-main-top.php';
+?>
+
+<h1><?php echo $o['rowid'] ? "Éditer « {$o['name']} »" : 'Créer un dossier'; ?></h1>
+
+<div class="éditer">
+	<form method="post">
+		
+		<input type="hidden" name="action" value="create-edit" />
+		<input type="hidden" name="type" value="dossier" />
+		<input type="hidden" name="rowid" value="<?php echo $o['rowid']; ?>" />
+		
+		<div class="form-group">
+			<label>Nom du dossier :</label>
+			<input type="text" class="form-control" name="name" value="<?php echo $o['name']; ?>" placeholder="Dossier de mémoire">
+		</div>
+<!--		<div class="form-group">
+			<label>Dossier :</label>
+			<input type="text" class="form-control" name="dossier" value="<?php echo $o['dossier']; ?>" placeholder="Le dossier de rattachement">
+			<select name="dossier" id="dossiers" multiple="" class="form-control input-lg select2 select2-offscreen" tabindex="-1">
+				<option value="intveld">In 't Veld</option>
+				<option value="abroretention">Abrogation de la rétention des données</option>
+				<option value="tes">Fichier TES</option>
+				<option value="orangefail">#OrangeFail</option>
+				<option value="prishield">Privacy Shield</option>
+			</select>
+		</div>-->
+		<div class="form-group">
+			<label>Lien cloud :</label>
+			<input type="text" class="form-control" name="cloud_link" value="<?php echo $o['cloud_link']; ?>" placeholder="Lien vers le nuage">
+		</div>
+		<div class="form-group">
+			<label>Lien wiki :</label>
+			<input type="text" class="form-control" name="wiki_link" value="<?php echo $o['wiki_link']; ?>" placeholder="Lien vers le wiki">
+		</div>
+		<div class="actions">
+			<button type="submit" class="bouton">
+				<?php echo $o['rowid'] ? 'Enregistrer': 'Créer'; ?>
+			</button>
+		</div>
+	</form>
+	<div class="actions">
+		<form method="post">
+			<input type="hidden" name="action" value="delete" />
+			<input type="hidden" name="type" value="dossier" />
+			<input type="hidden" name="id" value="<?php echo $o['rowid']; ?>" />
+			<button type="submit" class="bouton" style="font-size: 80%;">
+				Supprimer
+			</button>
+		</form>
+	</div>
+</div>
+
+
+<?php
+include_once 'templates/tpl-main-bottom.php';
+?>

+ 62 - 0
templates/tpl-create-edit-project.php

@@ -0,0 +1,62 @@
+<?php
+include_once 'templates/tpl-main-top.php';
+?>
+
+<h1><?php echo $o['rowid'] ? "Éditer le projet « {$o['name']} »" : 'Créer un projet'; ?></h1>
+
+<div class="éditer">
+	<form method="post">
+		
+		<input type="hidden" name="action" value="create-edit" />
+		<input type="hidden" name="type" value="project" />
+		<input type="hidden" name="rowid" value="<?php echo $o['rowid']; ?>" />
+		
+		<div class="form-group">
+			<label>Nom du projet :</label>
+			<input type="text" class="form-control" name="name" value="<?php echo $o['name']; ?>" placeholder="Nom du projet">
+		</div>
+		<div class="form-group">
+			<label>Dossier :</label>
+			<select name="dossier_id" id="dossiers" multiple="" class="form-control input-lg select2 select2-offscreen" tabindex="-1">
+				<?php foreach ($dossiers as $d) { ?>
+					<option value="<?php echo $d['rowid']; ?>"
+						<?php
+							if ($d['rowid'] === $o['dossier_id'])
+								echo " selected ";
+						?>
+					>
+						<?php echo $d['name']; ?>
+					</option>
+				<?php } ?>
+			</select>
+		</div>
+		<div class="form-group">
+			<label>Pad principal :</label>
+			<input type="text" class="form-control" name="main_pad" value="<?php echo $o['main_pad']; ?>" placeholder="Pad principal">
+		</div>
+		<div class="form-group">
+			<label>Page de garde :</label>
+			<input type="text" class="form-control" name="cover_pad" value="<?php echo $o['cover_pad']; ?>" placeholder="Page de garde">
+		</div>
+		<div class="actions">
+			<button type="submit" class="bouton">
+				<?php echo $o['rowid'] ? 'Enregistrer': 'Créer'; ?>
+			</button>
+		</div>
+	</form>
+	<div class="actions">
+		<form method="post">
+			<input type="hidden" name="action" value="delete" />
+			<input type="hidden" name="type" value="project" />
+			<input type="hidden" name="id" value="<?php echo $o['rowid']; ?> />" />
+			<button type="submit" class="bouton" style="font-size: 80%;">
+				Supprimer
+			</button>
+		</form>
+	</div>
+</div>
+
+
+<?php
+include_once 'templates/tpl-main-bottom.php';
+?>

+ 43 - 0
templates/tpl-index.php

@@ -0,0 +1,43 @@
+<?php
+include_once 'templates/tpl-main-top.php';
+?>
+
+
+    <h1>Presse à Citron</h1>
+
+    <p class="bievenue">
+	Bienvenue ! Le presse citron est encore en version beta. <strong>Sélectionne un projet à gauche</strong> ou bien
+        <a href="editer.php?type=project">ajoute un nouveau projet</a> !
+    </p>
+
+    <div class="éditer" id="ajouter">
+	<form>
+	<div class="form-group">
+	    <label for="projetNom">Nom du projet:</label>
+	    <input type="text" class="form-control" id="projetNom" name="projetNom" placeholder="Projet de mémoire">
+	</div>
+	<!--div class="form-group">
+	    <label for="projetId">Identifiant:</label>
+	    <input type="text" class="form-control" id="projetId" name="projetId" placeholder="(automatiquement suggéré en fonction du nom)">
+	</div-->
+	<div class="form-group">
+	    <label for="projetDossier">Dossier: <a href="/ajout-dossier.html">(Nouveau dossier ?)</a></label>
+	    <select name="dossier" id="dossiers" multiple="" class="form-control input-lg select2 select2-offscreen" tabindex="-1">
+		<option value="intveld">In 't Veld</option>
+		<option value="abroretention">Abrogation de la rétention des données</option>
+		<option value="tes">Fichier TES</option>
+		<option value="orangefail">#OrangeFail</option>
+		<option value="prishield">Privacy Shield</option>
+	    </select>
+	</div>
+	<div class="actions"> 
+	    <button type="submit" class="disabled btn btn-lg">Ajouter</button>
+	</div>
+	</form>
+    </div>
+
+
+
+<?php
+include_once 'templates/tpl-main-bottom.php';
+?>

+ 30 - 0
templates/tpl-main-bottom.php

@@ -0,0 +1,30 @@
+
+    <nav class="dossiers hide">
+    <h2>Liste des dossiers</h2>
+			<?php
+			foreach ($dossiers as $main_d) {
+				echo "
+					<a href='voir.php?type=dossier&id={$main_d['rowid']}'>{$main_d['name']}</a>
+				";
+			}
+			?>
+    </nav>
+    
+    <nav class="projets">
+      <span class="heading">Projets</span>
+			<?php
+			foreach ($projects as $main_p) {
+				echo "
+					<a href='voir.php?type=project&id={$main_p['rowid']}'>{$main_p['name']}</a>
+				";
+			}
+			?>
+      <a href="index.html" class="vers-index">Revenir à l'index des dossiers</a>
+    </nav>
+
+    <!-- jQuery (necessary for Bootstrap's JavaScript plugins) -->
+    <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
+    <!-- Include all compiled plugins (below), or include individual files as needed -->
+    <script src="bootstrap3/js/bootstrap.min.js"></script>
+  </body>
+</html>

+ 20 - 0
templates/tpl-main-top.php

@@ -0,0 +1,20 @@
+<!DOCTYPE html>
+<html lang="fr-fr">
+  <head>
+    <meta charset="utf-8">
+    <meta http-equiv="X-UA-Compatible" content="IE=edge">
+    <meta name="viewport" content="width=device-width, initial-scale=1">
+    <title>Exégètes - Presse à Citron</title>
+
+    <!-- Bootstrap -->
+    <!-- <link href="bootstrap3/css/bootstrap.min.css" rel="stylesheet"> -->
+    <link href="/style.css" rel="stylesheet">
+
+    <!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
+    <!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
+    <!--[if lt IE 9]>
+      <script src="https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js"></script>
+      <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
+    <![endif]-->
+  </head>
+  <body id="index">

+ 23 - 0
templates/tpl-view-dossier.php

@@ -0,0 +1,23 @@
+<?php
+include_once 'templates/tpl-main-top.php';
+?>
+
+<h1 class="app titre">Dossier « <?php echo $o['name']; ?> »</h1>
+
+<div class="métadonnées">
+	<span class="heading">Liens</span>
+	<a href="<?php echo $o['cloud_link']; ?>" class="nuage">Nuage</a>
+	<a href="<?php echo $o['wiki_link']; ?>" class="wiki">Wiki</a>
+</div>
+
+<div class="actions">
+	<a href="editer.php?type=dossier&id=<?php echo $o['rowid']; ?>" type="submit" class="bouton">
+		Éditer
+	</a>
+</div>
+
+
+
+<?php
+include_once 'templates/tpl-main-bottom.php';
+?>

+ 56 - 0
templates/tpl-view-project.php

@@ -0,0 +1,56 @@
+<?php
+include_once 'templates/tpl-main-top.php';
+?>
+
+    <h1 class="app titre"><?php echo $o['name']; ?></h1>
+
+    <div class="métadonnées">
+      <span class="heading">Dossier</span>
+      <a href="<?php echo $o['dossier']; ?>" class="dossier" id="<?php echo $o['dossier']; ?>"><?php echo $o['dossier']; ?></a>
+    </div>
+</div>
+
+
+    <div class="éditer">
+	<form action="/bartender/shake" method="get">
+	<div class="form-group hidden">
+	    <label for="projetId">Identifiant:</label>
+	    <input type="text" class="form-control" id="projetId" name="projetId" value="<?php echo $o['rowid']; ?>" placeholder="">
+	</div>
+	<div class="form-group">
+	    <label for="projetPadPrincipal">Pad principal:</label>
+	    <input type="url" class="form-control" id="projetPadPrincipal" name="projetPadPrincipal" placeholder="https://pad.exegetes.eu.org/" value="<?php echo $o['main_pad']; ?>">
+	</div>
+	<div class="form-group">
+	    <label for="projetPadGarde">Page de garde:</label>
+	    <input type="url" class="form-control" id="projetPadGarde" name="projetPadGarde" placeholder="https://pad.exegetes.eu.org/" value="<?php echo $o['cover_pad']; ?>">
+	</div>
+	<div class="form-group">
+	    <label for="projetPadAutre1">Autre pad: <a href="#">Ajouter</a></label>
+	    <input type="url" class="form-control hidden" id="projetPadAutre1" name="projetPadAutre1" placeholder="https://pad.exegetes.eu.org/">
+	</div>
+	<div class="form-group hidden">
+	    <label for="projetDossier">Dossier: <a href="ajout-dossier.html">(Nouveau dossier ?)</a></label>
+	    <select name="dossier" id="dossiers" multiple="" class="form-control input-lg select2 select2-offscreen" tabindex="-1">
+		<option value="intveld" selected="selected">In 't Veld</option>
+		<option value="abroretention">Abrogation de la rétention des données</option>
+		<option value="tes">Fichier TES</option>
+		<option value="orangefail">#OrangeFail</option>
+		<option value="prishield">Privacy Shield</option>
+	    </select>
+	</div>
+	<div class="actions"> 
+	    <button type="submit" class="bouton presse">Presser</button>
+	    <a href="editer.php?type=project&id=<?php echo $o['rowid']; ?>" type="submit" class="bouton">
+		    Éditer
+	    </a>
+	</div>
+	</form>
+    </div>
+
+
+
+
+<?php
+include_once 'templates/tpl-main-bottom.php';
+?>

+ 16 - 0
voir.php

@@ -0,0 +1,16 @@
+<?php
+
+require_once 'objects.php';
+
+if (!isset($_GET['id'])) {
+	header('Location: index.php');
+	die();
+}
+
+if ($_GET['type'] == 'dossier') {
+	$o = $dossiers[$_GET['id']];
+	include_once 'templates/tpl-view-dossier.php';
+} else {
+	$o = $projects[$_GET['id']];
+	include_once 'templates/tpl-view-project.php';
+}