Skip to content

MuSSF/editor-timelines.cc

Repository files navigation

OCPTimeline, l'éditeur pour créer des timelines populaires

# Install

1. Install the dependencies:
sudo apt-get install\
     postgresql\
     libsodium-dev\
     libgeoip1\
     libgeoip-dev\
     libcurl4-gnutls-dev\
     curl\
     zlib1g-dev\
     pkg-config\
     libgmp-dev\
     opam

2. Edit the opam config file

Before installing and compiling the next dependencies, you need to disable
the sandbox mode of opam. Check the file `~/.opam/config`, and comment
the lines below if there are still there:

```
wrap-build-commands:
  ["%{hooks}%/sandbox.sh" "build"] {os = "linux" | os = "macos"}
wrap-install-commands:
  ["%{hooks}%/sandbox.sh" "install"] {os = "linux" | os = "macos"}
wrap-remove-commands:
  ["%{hooks}%/sandbox.sh" "remove"] {os = "linux" | os = "macos"}
```

3. Initialize.
   From here, "make init" should do the trick. If you want to customize
   your installation, here are the steps.

  You need a switch 4.07.1 (for ocp-build). You are strongly advised to
  create a new switch for the installation.

  $ opam switch create timeline 4.07.1

  Before installing and compiling all dependencies, you need to disable
  the sandbox mode of opam. Check the file `~/.opam/config`, and comment
  the lines below if there are still there:

```
  wrap-build-commands:
    ["%{hooks}%/sandbox.sh" "build"] {os = "linux" | os = "macos"}
  wrap-install-commands:
    ["%{hooks}%/sandbox.sh" "install"] {os = "linux" | os = "macos"}
  wrap-remove-commands:
    ["%{hooks}%/sandbox.sh" "remove"] {os = "linux" | os = "macos"}
```
Then, install dependnecies:
  $ opam install -y \
   	ocp-build base64 lwt.4.5 \
   	ocplib-json-typed \
   	js_of_ocaml \
	js_of_ocaml-tyxml \
	js_of_ocaml-ppx \
	js_of_ocaml-lwt \
	js_of_ocaml-ocamlbuild \
	js_of_ocaml-toplevel \
	faraday-async \
	ezjsonm \
	geoip \
	cohttp \
	cohttp-lwt-unix \
	lwt_log \
	extunix \
	httpaf \
	httpaf-lwt-unix \
	ocurl \
	yojson \
	calendar \
	camlp4 \
	pgocaml.3.2 \
	sexplib \
	omd \
	sha

4. Compile.
make

# Usage

## Transform data into JSON
Execute ./csv-parser 'data_file'.
The format is the following:

Title
Event#1
Event#2
...

with
Event#i =
   * Start year (integer)
   * Start month (integer)
   * End year (integer)
   * End month (integer)
   * Type (software, person, client)
   * Type 2 (custom string)
   * Level (integer)
   * Media
   * Title
   * Narration (optional)

This generates a data.json file compatible with the timeline js library

## Put data into database
Execute ./csv-parser 'data_file' --db.
This will put the data into the database.

If you wish to empty the database:
dropdb ocptl_db
make

# Locally start a website

cd www
php -S 127.0.0.1:8000 &
xdg-open http://127.0.0.1:8000