--- a/client/css/renkan.css Mon Jan 14 16:00:07 2013 +0100
+++ b/client/css/renkan.css Thu Jan 31 18:53:08 2013 +0100
@@ -193,7 +193,7 @@
font-size: 16px; font-weight: bold;
}
-.Rk-Editor p {
+.Rk-Editor p, .Rk-Editor-p {
margin: 5px 0; font-size: 12px;
}
@@ -222,10 +222,23 @@
width: 225px; height: 120px; resize: none;
}
-.Rk-UserColor {
+.Rk-UserColor, .Rk-Edit-Color {
display: inline-block; width: 1em; height: 1em; border: 1px solid #666666; margin: -2px 2px;
}
+.Rk-Edit-ColorPicker-Wrapper {
+ display: inline-block; height: 1em; position: relative;
+}
+
+.Rk-Edit-ColorPicker {
+ position: absolute; top: -2px; left: 15px; width: 60px; height: 72px; border: 1px solid #CCCCCC;
+ padding: 5px 4px 4px 5px; background: #ffffff; border-radius: 5px; display: none;
+}
+
+.Rk-Edit-ColorPicker li {
+ float: left; width: 14px; height: 11px; margin: 0 1px 1px 0; cursor: pointer;
+}
+
.Rk-ZoomButtons {
position: absolute; left: 0; top: 0; cursor: pointer;
}
--- a/client/data/test-data.json Mon Jan 14 16:00:07 2013 +0100
+++ b/client/data/test-data.json Thu Jan 31 18:53:08 2013 +0100
@@ -1,8 +1,8 @@
{
"users": [
{
- "_id": "u-anonymous",
- "title": "anonymous",
+ "_id": "u-iri",
+ "title": "IRI",
"uri": "",
"description": "",
"color": "#dd00dd"
@@ -284,7 +284,7 @@
"description": "",
"from": "node-2012-08-22-b778a9fc31296d6b-000a",
"to": "node-2012-08-22-9da6eef6c6391d05-000b",
- "created_by": "u-anonymous"
+ "created_by": "u-iri"
}, {
"_id": "edge-2012-09-06-70cc0c2d5e1112d3-0002",
"title": "tool used",
@@ -292,7 +292,7 @@
"description": "",
"from": "node-2012-08-22-5b349e49066c1b01-0001",
"to": "node-2012-08-22-b778a9fc31296d6b-000a",
- "created_by": "u-anonymous"
+ "created_by": "u-iri"
}
]
}
\ No newline at end of file
--- a/client/js/main.js Mon Jan 14 16:00:07 2013 +0100
+++ b/client/js/main.js Thu Jan 31 18:53:08 2013 +0100
@@ -26,6 +26,8 @@
Rkns._ = _;
+Rkns.pickerColors = ["#a80000","#ff0000","#d27979","#ffb2b2","#a36100","#f99500","#d1ac75","#fedead","#00890d","#00e016","#62ca6c","#93ff9e","#0043a8","#0065ff","#799cd2","#b2d1ff","#760093","#bb00ea","#b969cd","#eb9eff","#000000","#555555","#aaaaaa","#ffffff"];
+
Rkns._BaseBin = function(_renkan, _opts) {
if (typeof _renkan !== "undefined") {
this.renkan = _renkan;
--- a/client/js/models.js Mon Jan 14 16:00:07 2013 +0100
+++ b/client/js/models.js Thu Jan 31 18:53:08 2013 +0100
@@ -88,6 +88,7 @@
description: this.get("description"),
position: this.get("position"),
image: this.get("image"),
+ color: this.get("color"),
created_by: this.get("created_by") ? this.get("created_by").get("_id") : null
};
},
@@ -128,6 +129,7 @@
description: this.get("description"),
from: this.get("from") ? this.get("from").get("_id") : null,
to: this.get("to") ? this.get("to").get("_id") : null,
+ color: this.get("color"),
created_by: this.get("created_by") ? this.get("created_by").get("_id") : null
};
},
--- a/client/js/paper-renderer.js Mon Jan 14 16:00:07 2013 +0100
+++ b/client/js/paper-renderer.js Thu Jan 31 18:53:08 2013 +0100
@@ -236,6 +236,7 @@
this.circle = new paper.Path.Circle([0, 0], Rkns.Renderer._NODE_RADIUS);
this.circle.fillColor = '#ffffff';
this.circle.__representation = this;
+ this.circle.strokeWidth = 2;
this.title = new paper.PointText([0,0]);
this.title.characterStyle = {
fontSize: Rkns.Renderer._NODE_FONT_SIZE,
@@ -256,7 +257,7 @@
this.circle.position = this.paper_coords;
this.title.content = this.model.get("title");
this.title.position = this.paper_coords.add([0, Rkns.Renderer._NODE_RADIUS + 1.5 *Rkns.Renderer._NODE_FONT_SIZE]);
- this.circle.strokeColor = this.model.get("created_by").get("color");
+ this.circle.strokeColor = this.model.get("color") || this.model.get("created_by").get("color") || "#000000";
this.edit_button.moveTo(this.paper_coords);
this.remove_button.moveTo(this.paper_coords);
this.link_button.moveTo(this.paper_coords);
@@ -317,7 +318,7 @@
}
Rkns.Renderer.Node.prototype.select = function() {
- this.circle.strokeWidth = 3;
+ this.circle.strokeWidth = 4;
this.edit_button.show();
this.remove_button.show();
this.link_button.show();
@@ -335,7 +336,7 @@
this.edit_button.hide();
this.remove_button.hide();
this.link_button.hide();
- this.circle.strokeWidth = 1;
+ this.circle.strokeWidth = 2;
Rkns.$('.Rk-Bin-Item').removeClass("selected");
}
}
@@ -387,6 +388,7 @@
this.line = new paper.Path();
this.line.add([0,0],[0,0],[0,0]);
this.line.__representation = this;
+ this.line.strokeWidth = 2;
this.arrow = new paper.Path();
this.arrow.add([0,0],[Rkns.Renderer._ARROW_LENGTH,Rkns.Renderer._ARROW_WIDTH / 2],[0,Rkns.Renderer._ARROW_WIDTH]);
this.arrow.__representation = this;
@@ -416,7 +418,7 @@
_p1b = _p1a.add(_delta), /* to differentiate inbound and outbound links */
_a = _v.angle,
_handle = _v.divide(3),
- _color = this.model.get("created_by").get("color");
+ _color = this.model.get("color") || this.model.get("created_by").get("color") || "#000000";
this.paper_coords = _p0b.add(_p1b).divide(2);
this.line.strokeColor = _color;
this.line.segments[0].point = _p0a;
@@ -450,7 +452,7 @@
}
Rkns.Renderer.Edge.prototype.select = function() {
- this.line.strokeWidth = 3;
+ this.line.strokeWidth = 4;
this.edit_button.show();
this.remove_button.show();
}
@@ -459,7 +461,7 @@
if (!_newTarget || _newTarget.edge_representation !== this) {
this.edit_button.hide();
this.remove_button.hide();
- this.line.strokeWidth = 1;
+ this.line.strokeWidth = 2;
}
}
@@ -498,7 +500,7 @@
this.renderer.edge_layer.activate();
this.type = "temp-edge";
- var _color = this.project.get("users").get(this.renderer.renkan.current_user).get("color");
+ var _color = this.project.get("users").get(this.renderer.renkan.current_user).get("color") || "#000000";
this.line = new paper.Path();
this.line.strokeColor = _color;
this.line.add([0,0],[0,0]);
@@ -590,6 +592,8 @@
+ '<p><label><%=l10n.edit_title%></label><input class="Rk-Edit-Title" type="text" value="<%=node.title%>"/></p>'
+ '<p><label><%=l10n.edit_uri%></label><input class="Rk-Edit-URI" type="text" value="<%=node.uri%>"/><a class="Rk-Edit-Goto" href="<%=node.uri%>" target="_blank"></a></p>'
+ '<p><label><%=l10n.edit_description%></label><textarea class="Rk-Edit-Description"><%=node.description%></textarea></p>'
+ + '<div class="Rk-Editor-p"><label>Node color</label><div class="Rk-Edit-ColorPicker-Wrapper"><span class="Rk-Edit-Color" style="background:<%=node.color%>;"></span><ul class="Rk-Edit-ColorPicker">'
+ + '<% print(Rkns.pickerColors.reduce(function(m,c) { return m + "<li data-color=\'" + c + "\' style=\'background: " + c + "\'></li>"},"")); %></ul></div></div>'
+ '<p><label><%=l10n.edit_image%></label><input class="Rk-Edit-Image" type="text" value="<%=node.image%>"/><img class="Rk-Edit-ImgPreview" src="<%=node.image%>" /></p>'
+ '<p><label><%=l10n.created_by%></label> <span class="Rk-UserColor" style="background:<%=node.created_by_color%>;"></span><%=node.created_by_title%></p>'
);
@@ -603,6 +607,7 @@
uri: _model.get("uri"),
description: _model.get("description"),
image: _model.get("image") || "",
+ color: _model.get("color") || _model.get("created_by").get("color") || "#000000",
created_by_color: _model.get("created_by").get("color"),
created_by_title: _model.get("created_by").get("title")
},
@@ -632,6 +637,17 @@
_this.redraw();
})
this.editor_$.find(".Rk-Edit-Title")[0].focus();
+ this.editor_$.find(".Rk-Edit-ColorPicker-Wrapper").hover(
+ function() { _this.editor_$.find(".Rk-Edit-ColorPicker").show(); },
+ function() { _this.editor_$.find(".Rk-Edit-ColorPicker").hide(); }
+ );
+ this.editor_$.find(".Rk-Edit-ColorPicker li").hover(
+ function() { _this.editor_$.find(".Rk-Edit-Color").css("background", $(this).attr("data-color")); },
+ function() { _this.editor_$.find(".Rk-Edit-Color").css("background", _model.get("color") || _model.get("created_by").get("color") || "#000000") }
+ ).click(function() {
+ _model.set("color", $(this).attr("data-color"));
+ _this.redraw();
+ });
}
Rkns.Renderer.NodeEditor.prototype.redraw = function() {
@@ -673,6 +689,8 @@
'<h2><span class="Rk-CloseX">×</span><%=l10n.edit_edge%></span></h2>'
+ '<p><label><%=l10n.edit_title%></label><input class="Rk-Edit-Title" type="text" value="<%=edge.title%>"/></p>'
+ '<p><label><%=l10n.edit_uri%></label><input class="Rk-Edit-URI" type="text" value="<%=edge.uri%>"/><a class="Rk-Edit-Goto" href="<%=edge.uri%>" target="_blank"></a></p>'
+ + '<div class="Rk-Editor-p"><label>Edge color:</label><div class="Rk-Edit-ColorPicker-Wrapper"><span class="Rk-Edit-Color" style="background:<%=edge.color%>;"></span><ul class="Rk-Edit-ColorPicker">'
+ + '<% print(Rkns.pickerColors.reduce(function(m,c) { return m + "<li data-color=\'" + c + "\' style=\'background: " + c + "\'></li>"},"")); %></ul></div></div>'
+ '<p><label><%=l10n.edit_from%></label><span class="Rk-UserColor" style="background:<%=edge.from_created_by_color%>;"></span><%=edge.from_title%></p>'
+ '<p><label><%=l10n.edit_to%></label><span class="Rk-UserColor" style="background:<%=edge.to_created_by_color%>;"></span><%=edge.to_title%></p>'
+ '<p><label><%=l10n.created_by%> </label><span class="Rk-UserColor" style="background:<%=edge.created_by_color%>;"></span><%=edge.created_by_title%></p>'
@@ -686,6 +704,7 @@
title: _model.get("title"),
uri: _model.get("uri"),
description: _model.get("description"),
+ color: _model.get("color") || _model.get("created_by").get("color") || "#000000",
from_title: _model.get("from").get("title"),
to_title: _model.get("to").get("title"),
from_created_by_color: _model.get("from").get("created_by").get("color"),
@@ -710,6 +729,17 @@
_model.set(_data);
_this.redraw();
});
+ this.editor_$.find(".Rk-Edit-ColorPicker-Wrapper").hover(
+ function() { _this.editor_$.find(".Rk-Edit-ColorPicker").show(); },
+ function() { _this.editor_$.find(".Rk-Edit-ColorPicker").hide(); }
+ );
+ this.editor_$.find(".Rk-Edit-ColorPicker li").hover(
+ function() { _this.editor_$.find(".Rk-Edit-Color").css("background", $(this).attr("data-color")); },
+ function() { _this.editor_$.find(".Rk-Edit-Color").css("background", _model.get("color") || _model.get("created_by").get("color") || "#000000") }
+ ).click(function() {
+ _model.set("color", $(this).attr("data-color"));
+ _this.redraw();
+ });
}
Rkns.Renderer.EdgeEditor.prototype.redraw = function() {
var _coords = this.edge_representation.paper_coords;
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/client/js/retrieve-kc.js Thu Jan 31 18:53:08 2013 +0100
@@ -0,0 +1,52 @@
+/* Imports a KC graph */
+
+Rkns.retrieveKC = function(_renkan, _opts) {
+ if (typeof _opts === "undefined") {
+ var _opts = {}
+ }
+ var _proj = _renkan.project,
+ _username = _opts.user_name || "Yves-Marie",
+ _userid = _opts.user_id || "yves-marie.haussonne@centrepompidou.fr",
+ _usercolor = _opts.user_color || "#800000",
+ _allid = _opts.all_id || "B0000044",
+ _projid = _opts.proj || "ozu_silent",
+ _kcept = _opts.endpoint || "/sites/kcproxy/allRetrieve.jsp"
+ var _load = function() {
+ Rkns.$.getJSON(_kcept,
+ {
+ all_id: _allid,
+ proj: _projid,
+ uid: _userid
+ },
+ function(_data) {
+ _proj.addUser({
+ id: _userid,
+ color: _usercolor,
+ title: _username
+ });
+ Rkns._(_data.node).each(function(_node) {
+ _proj.addNode({
+ id: _node.id,
+ title: _node.name,
+ description: 'Knowledge concierge node from project "' + _projid + '" belonging to group "' + _node.grp + '"',
+ position: {
+ x: _node.x,
+ y: _node.y
+ },
+ created_by: _userid
+ })
+ });
+ Rkns._(_data.edge).each(function(_edge) {
+ _proj.addEdge({
+ id: _edge.asc_id,
+ from: _edge.id,
+ to: _edge.to_id,
+ created_by: _userid,
+ title: _edge.r_name
+ });
+ });
+ _renkan.renderer.autoScale();
+ });
+ }
+ _load();
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/client/js/save-once.js Thu Jan 31 18:53:08 2013 +0100
@@ -0,0 +1,75 @@
+/* Saves the Full JSON once */
+
+Rkns.jsonIO = function(_renkan, _opts) {
+ var _proj = _renkan.project,
+ _saveWarn = false,
+ _onLeave = function() {
+ return "Project not saved";
+ };
+ if (typeof _opts.http_method == "undefined") {
+ _opts.http_method = 'POST';
+ }
+ var _load = function() {
+ var getdata = {},
+ rx = /id=([^&#?=]+)/,
+ matches = document.location.hash.match(rx);
+ if (matches) {
+ getdata.id = matches[1];
+ }
+ Rkns.$.ajax({
+ url: _opts.url,
+ data: getdata,
+ success: function(_data) {
+ _proj.set(_data);
+ _renkan.renderer.autoScale();
+ }
+ });
+ }
+ var _save = function() {
+ _proj.set("saved_at", new Date());
+ var _data = _proj.toJSON();
+ Rkns.$.ajax({
+ type: _opts.http_method,
+ url: _opts.url,
+ contentType: "application/json",
+ data: JSON.stringify(_data),
+ success: function(data, textStatus, jqXHR) {
+ $(window).off("beforeunload", _onLeave);
+ _saveWarn = false;
+ document.location.hash = "#id=" + data.id;
+ $(".Rk-Notifications").text("Saved as "+document.location.href).fadeIn().delay(2000).fadeOut();
+ }
+ });
+ }
+ var _checkLeave = function() {
+ var title = _proj.get("title");
+ if (title && _proj.get("nodes").length) {
+ $(".Rk-Save-Button").removeClass("disabled");
+ } else {
+ $(".Rk-Save-Button").addClass("disabled");
+ }
+ if (title) {
+ $(".Rk-PadTitle").css("border-color","#333333");
+ }
+ if (!_saveWarn) {
+ _saveWarn = true;
+ $(window).on("beforeunload", _onLeave);
+ }
+ }
+ _load();
+ _proj.on("add:nodes add:edges add:users change", function(_model) {
+ _model.on("change remove", function(_model) {
+ _checkLeave();
+ });
+ _checkLeave();
+ });
+ $(".Rk-Save-Button").click(function() {
+ if ($(this).hasClass("disabled")) {
+ if (!_proj.get("title")) {
+ $(".Rk-PadTitle").css("border-color","#ff0000");
+ }
+ } else {
+ _save();
+ }
+ });
+}
--- a/client/js/wikipedia-bin.js Mon Jan 14 16:00:07 2013 +0100
+++ b/client/js/wikipedia-bin.js Thu Jan 31 18:53:08 2013 +0100
@@ -49,7 +49,8 @@
return _text.replace(_rgxp, "<span class='searchmatch'>$1</span>");
}
var _html = "",
- _this = this;
+ _this = this,
+ count = 0;
Rkns._(this.data.query.search).each(function(_result) {
var title = _result.title,
url = "http://" + _this.lang + ".wikipedia.org/wiki/" + encodeURI(title.replace(/ /g,"_")),
--- a/client/render-test.html Mon Jan 14 16:00:07 2013 +0100
+++ b/client/render-test.html Thu Jan 31 18:53:08 2013 +0100
@@ -22,31 +22,11 @@
<script src="js/ldtjson-bin.js"></script>
<script src="js/paper-renderer.js"></script>
<script type="text/javascript">
- var _proj;
+ var _renkan;
$(function() {
_renkan = new Rkns.Renkan({
url: "data/simple-persist.php",
bins: [
- {
- bin: Rkns.Wikipedia.Bin,
- lang: "en",
- search: "Digital Humanities"
- },
- {
- bin: Rkns.Wikipedia.Bin,
- lang: "ja",
- search: "Digital Humanities"
- },
- {
- bin: Rkns.Twitter.Bin,
- search: "Digital Humanities"
- },
- {
- title: "LDT Project",
- bin: Rkns.Ldt.ProjectBin,
- project_id: "67280b1c-ff30-11e0-a82d-00145ea49a02",
- ldt_platform: "http://ldt.iri.centrepompidou.fr/"
- }
],
search: [
{
@@ -65,7 +45,9 @@
type: Rkns.Twitter.Search
}
],
- user_id: "u-anonymous"
+ user: {
+ id: "u-iri"
+ }
});
/* _renkan.project.addUser({
id: "u-anonymous",
@@ -76,6 +58,7 @@
url: "data/simple-persist.php"
});
// Rkns.randomData(_renkan);
+
});
</script>
<link rel="stylesheet" href="css/renkan.css" />
Binary file crea/buttons.psd has changed
--- a/metadataplayer/renkan.htm Mon Jan 14 16:00:07 2013 +0100
+++ b/metadataplayer/renkan.htm Thu Jan 31 18:53:08 2013 +0100
@@ -17,7 +17,6 @@
width: 600px;
height: 500px;
margin: 5px;
- background: #fff;
}
</style>
</head>
@@ -33,6 +32,7 @@
IriSP.language = 'fr';
IriSP.widgetsDir = "metadataplayer";
var _metadata = {
+// url: 'json/ldt-jwplayer.json',
url: 'http://ldt.iri.centrepompidou.fr/ldtplatform/ldt/cljson/id/67280b1c-ff30-11e0-a82d-00145ea49a02?callback=?',
format: 'ldt'
};
@@ -49,6 +49,7 @@
{ type: "Controller" },
{ type: "Polemic" },
{ type: "Segments" },
+ { type: "Slice" },
{
type: "Arrow",
base_height: 4
@@ -58,7 +59,7 @@
{
type: "Renkan",
container: "RenkanContainer",
- data: "json/renkan.json"
+ data: [ "json/renkan.json", "json/renkan-2.json" ]
},
{ type: "Mediafragment"}
]
@@ -82,7 +83,7 @@
}
};
- _myPlayer = new IriSP.Metadataplayer(_config);
+ var _myPlayer = new IriSP.Metadataplayer(_config);
</script>
</body>
--- a/server/src/main/webapp/static/js/config.js Mon Jan 14 16:00:07 2013 +0100
+++ b/server/src/main/webapp/static/js/config.js Thu Jan 31 18:53:08 2013 +0100
@@ -5,7 +5,7 @@
// Copyright (c) The Dojo Foundation 2011. All Rights Reserved.
//
var dojoConfig = {
- baseUrl: '/renkan',
+ baseUrl: '/', /* WAS /renkan */
async:true,
paths : {
coweb : 'lib/coweb',