annotate popoto_dev/js/app-template.js @ 12:d67c5ad47709

implementation with dropdown popup, unfinished
author alistair
date Fri, 02 Oct 2015 01:08:46 -0400
parents
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
12
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
1 /**
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
2 * URL used to access Neo4j REST API to execute queries.
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
3 * Update this parameter to your running server instance.
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
4 *
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
5 * For more information on Neo4J REST API the documentation is available here: http://neo4j.com/docs/stable/rest-api-cypher.html
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
6 */
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
7 popoto.rest.CYPHER_URL = "https://ismi-dev.mpiwg-berlin.mpg.de/neo4j-ismi/db/data/transaction/commit";
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
8
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
9 /**
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
10 * Add this authorization property if your Neo4j server uses basic HTTP authentication.
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
11 * The value of this property must be "Basic <payload>", where "payload" is a base64 encoded string of "username:password".
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
12 *
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
13 * "btoa" is a JavaScript function that can be used to encode the user and password value in base64 but it is recommended to directly use the Base64 value.
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
14 *
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
15 * For example Base64 encoding value of "neo4j:password" is "bmVvNGo6cGFzc3dvcmQ="
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
16 */
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
17 popoto.rest.AUTHORIZATION = "Basic " + btoa("neo4j:neo5j");
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
18
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
19 /**
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
20 * Define the Label provider you need for your application.
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
21 * This configuration is mandatory and should contain at least all the labels you could find in your graph model.
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
22 *
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
23 * In this alpha version only nodes with a label are supported.
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
24 *
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
25 * By default If no attributes are specified Neo4j internal ID will be used.
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
26 * These label provider configuration can be used to customize the node display in the graph.
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
27 * See www.popotojs.com or example for more details on available configuration options.
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
28 */
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
29 popoto.provider.nodeProviders = {
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
30 "CODEX": {
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
31 "returnAttributes": ["label", "ismi_id", "identifier"],
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
32 "constraintAttribute": "ismi_id"
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
33 },
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
34 "WITNESS": {
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
35 "returnAttributes": ["label", "ismi_id", "folios"],
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
36 "constraintAttribute": "ismi_id"
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
37 },
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
38 "TEXT": {
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
39 "returnAttributes": ["label", "full_title", "ismi_id"],
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
40 "constraintAttribute": "ismi_id"
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
41 },
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
42 "PERSON": {
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
43 "returnAttributes": ["label", "ismi_id", "death_date_text", "url"],
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
44 "constraintAttribute": "ismi_id"
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
45 },
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
46 "REPOSITORY": {
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
47 "returnAttributes": ["label", "ismi_id"],
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
48 "constraintAttribute": "ismi_id"
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
49 }
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
50 };
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
51
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
52 /**
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
53 * Here a listener is used to retrieve the total results count and update the page accordingly.
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
54 * This listener will be called on every graph modification.
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
55 */
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
56 popoto.result.onTotalResultCount(function (count) {
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
57 document.getElementById("result-total-count").innerHTML = "(" + count + ")";
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
58 });
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
59
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
60 /**
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
61 * The number of results returned can be changed with the following parameter.
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
62 * Default value is 100.
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
63 *
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
64 * Note that in this current alpha version no pagination mechanism is available in displayed results
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
65 */
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
66 //popoto.query.RESULTS_PAGE_SIZE = 100;
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
67
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
68
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
69 /**
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
70 * For the alpha version, popoto.js has been generated with debug traces you can activate with the following properties:
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
71 * The value can be one in DEBUG, INFO, WARN, ERROR, NONE.
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
72 *
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
73 * With INFO level all the executed cypher query can be seen in the navigator console.
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
74 * Default is NONE
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
75 */
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
76 popoto.logger.LEVEL = popoto.logger.LogLevels.INFO;
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
77
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
78 /**
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
79 * Start popoto.js generation.
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
80 * The function requires the label to use as root element in the graph.
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
81 */
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
82 popoto.start("PERSON");
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
83
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
84 /* do not zoom with scroll wheel */
d67c5ad47709 implementation with dropdown popup, unfinished
alistair
parents:
diff changeset
85 popoto.graph.WHEEL_ZOOM_ENABLED = false;