| author | ymh <ymh.work@gmail.com> |
| Fri, 19 Jun 2015 13:35:23 +0200 | |
| changeset 489 | 7f25a4453865 |
| parent 488 | 1324bd8747ff |
| child 490 | 8b05c7322e93 |
| permissions | -rw-r--r-- |
| 442 | 1 |
/*! |
2 |
* _____ _ |
|
3 |
* | __ \ | | |
|
4 |
* | |__) |___ _ __ | | ____ _ _ __ |
|
5 |
* | _ // _ \ '_ \| |/ / _` | '_ \ |
|
6 |
* | | \ \ __/ | | | < (_| | | | | |
|
7 |
* |_| \_\___|_| |_|_|\_\__,_|_| |_| |
|
8 |
* |
|
9 |
* Copyright 2012-2015 Institut de recherche et d'innovation |
|
10 |
* contributor(s) : Yves-Marie Haussonne, Raphael Velt, Samuel Huron, |
|
11 |
* Thibaut Cavalié, Julien Rougeron. |
|
12 |
* |
|
13 |
* contact@iri.centrepompidou.fr |
|
14 |
* http://www.iri.centrepompidou.fr |
|
15 |
* |
|
16 |
* This software is a computer program whose purpose is to show and add annotations on a video . |
|
17 |
* This software is governed by the CeCILL-C license under French law and |
|
18 |
* abiding by the rules of distribution of free software. You can use, |
|
19 |
* modify and/ or redistribute the software under the terms of the CeCILL-C |
|
20 |
* license as circulated by CEA, CNRS and INRIA at the following URL |
|
21 |
* "http://www.cecill.info". |
|
22 |
* |
|
23 |
* The fact that you are presently reading this means that you have had |
|
24 |
* knowledge of the CeCILL-C license and that you accept its terms. |
|
25 |
*/ |
|
26 |
||
| 464 | 27 |
/*! renkan - v0.10.0 - Copyright © IRI 2015 */ |
| 442 | 28 |
|
29 |
this["renkanJST"] = this["renkanJST"] || {};
|
|
30 |
||
31 |
this["renkanJST"]["templates/colorpicker.html"] = function(obj) {
|
|
32 |
obj || (obj = {});
|
|
33 |
var __t, __p = '', __e = _.escape; |
|
34 |
with (obj) {
|
|
35 |
__p += '<li data-color="' + |
|
36 |
((__t = (c)) == null ? '' : __t) + |
|
37 |
'" style="background: ' + |
|
38 |
((__t = (c)) == null ? '' : __t) + |
|
39 |
'"></li>'; |
|
40 |
||
41 |
} |
|
42 |
return __p |
|
43 |
}; |
|
44 |
||
45 |
this["renkanJST"]["templates/edgeeditor.html"] = function(obj) {
|
|
46 |
obj || (obj = {});
|
|
47 |
var __t, __p = '', __e = _.escape, __j = Array.prototype.join; |
|
48 |
function print() { __p += __j.call(arguments, '') }
|
|
49 |
with (obj) {
|
|
50 |
__p += '<h2>\n <span class="Rk-CloseX">×</span>' + |
|
51 |
__e(renkan.translate("Edit Edge")) +
|
|
52 |
'</span>\n</h2>\n<p>\n <label>' + |
|
53 |
__e(renkan.translate("Title:")) +
|
|
54 |
'</label>\n <input class="Rk-Edit-Title" type="text" value="' + |
|
55 |
__e(edge.title) + |
|
56 |
'" />\n</p>\n'; |
|
57 |
if (options.show_edge_editor_uri) { ;
|
|
58 |
__p += '\n <p>\n <label>' + |
|
59 |
__e(renkan.translate("URI:")) +
|
|
60 |
'</label>\n <input class="Rk-Edit-URI" type="text" value="' + |
|
61 |
__e(edge.uri) + |
|
62 |
'" />\n <a class="Rk-Edit-Goto" href="' + |
|
63 |
__e(edge.uri) + |
|
64 |
'" target="_blank"></a>\n </p>\n '; |
|
65 |
if (options.properties.length) { ;
|
|
66 |
__p += '\n <p>\n <label>' + |
|
67 |
__e(renkan.translate("Choose from vocabulary:")) +
|
|
68 |
'</label>\n <select class="Rk-Edit-Vocabulary">\n '; |
|
69 |
_.each(options.properties, function(ontology) { ;
|
|
70 |
__p += '\n <option class="Rk-Edit-Vocabulary-Class" value="">\n ' + |
|
71 |
__e( renkan.translate(ontology.label) ) + |
|
72 |
'\n </option>\n '; |
|
73 |
_.each(ontology.properties, function(property) { var uri = ontology["base-uri"] + property.uri; ;
|
|
74 |
__p += '\n <option class="Rk-Edit-Vocabulary-Property" value="' + |
|
75 |
__e( uri ) + |
|
76 |
'"\n '; |
|
77 |
if (uri === edge.uri) { ;
|
|
78 |
__p += ' selected'; |
|
79 |
} ; |
|
80 |
__p += '>\n ' + |
|
81 |
__e( renkan.translate(property.label) ) + |
|
82 |
'\n </option>\n '; |
|
83 |
}) ; |
|
84 |
__p += '\n '; |
|
85 |
}) ; |
|
86 |
__p += '\n </select>\n </p>\n'; |
|
87 |
} } ; |
|
88 |
__p += '\n'; |
|
|
460
bdf851bb1c4f
add style to node and edge in java. implement data migration for schema version 2
ymh <ymh.work@gmail.com>
parents:
444
diff
changeset
|
89 |
if (options.show_edge_editor_style) { ;
|
|
bdf851bb1c4f
add style to node and edge in java. implement data migration for schema version 2
ymh <ymh.work@gmail.com>
parents:
444
diff
changeset
|
90 |
__p += '\n <div class="Rk-Editor-p">\n '; |
|
bdf851bb1c4f
add style to node and edge in java. implement data migration for schema version 2
ymh <ymh.work@gmail.com>
parents:
444
diff
changeset
|
91 |
if (options.show_edge_editor_style_color) { ;
|
|
bdf851bb1c4f
add style to node and edge in java. implement data migration for schema version 2
ymh <ymh.work@gmail.com>
parents:
444
diff
changeset
|
92 |
__p += '\n <div id="Rk-Editor-p-color">\n <span class="Rk-Editor-Label">' + |
| 442 | 93 |
__e(renkan.translate("Edge color:")) +
|
94 |
'</span>\n <div class="Rk-Edit-ColorPicker-Wrapper">\n <span class="Rk-Edit-Color" style="background: <%-edge.color%>;">\n <span class="Rk-Edit-ColorTip"></span>\n </span>\n ' + |
|
95 |
((__t = ( renkan.colorPicker )) == null ? '' : __t) + |
|
96 |
'\n <span class="Rk-Edit-ColorPicker-Text">' + |
|
97 |
__e( renkan.translate("Choose color") ) +
|
|
|
460
bdf851bb1c4f
add style to node and edge in java. implement data migration for schema version 2
ymh <ymh.work@gmail.com>
parents:
444
diff
changeset
|
98 |
'</span>\n </div>\n </div>\n '; |
|
bdf851bb1c4f
add style to node and edge in java. implement data migration for schema version 2
ymh <ymh.work@gmail.com>
parents:
444
diff
changeset
|
99 |
} ; |
|
bdf851bb1c4f
add style to node and edge in java. implement data migration for schema version 2
ymh <ymh.work@gmail.com>
parents:
444
diff
changeset
|
100 |
__p += '\n '; |
|
bdf851bb1c4f
add style to node and edge in java. implement data migration for schema version 2
ymh <ymh.work@gmail.com>
parents:
444
diff
changeset
|
101 |
if (options.show_edge_editor_style_dash) { ;
|
|
bdf851bb1c4f
add style to node and edge in java. implement data migration for schema version 2
ymh <ymh.work@gmail.com>
parents:
444
diff
changeset
|
102 |
__p += '\n <div id="Rk-Editor-p-dash">\n <span class="Rk-Editor-Label">' + |
|
bdf851bb1c4f
add style to node and edge in java. implement data migration for schema version 2
ymh <ymh.work@gmail.com>
parents:
444
diff
changeset
|
103 |
__e(renkan.translate("Dash:")) +
|
|
bdf851bb1c4f
add style to node and edge in java. implement data migration for schema version 2
ymh <ymh.work@gmail.com>
parents:
444
diff
changeset
|
104 |
'</span>\n <input type="checkbox" name="Rk-Edit-Dash" class="Rk-Edit-Dash" ' + |
|
bdf851bb1c4f
add style to node and edge in java. implement data migration for schema version 2
ymh <ymh.work@gmail.com>
parents:
444
diff
changeset
|
105 |
__e( edge.dash ) + |
|
bdf851bb1c4f
add style to node and edge in java. implement data migration for schema version 2
ymh <ymh.work@gmail.com>
parents:
444
diff
changeset
|
106 |
' />\n </div>\n '; |
|
bdf851bb1c4f
add style to node and edge in java. implement data migration for schema version 2
ymh <ymh.work@gmail.com>
parents:
444
diff
changeset
|
107 |
} ; |
|
bdf851bb1c4f
add style to node and edge in java. implement data migration for schema version 2
ymh <ymh.work@gmail.com>
parents:
444
diff
changeset
|
108 |
__p += '\n '; |
|
bdf851bb1c4f
add style to node and edge in java. implement data migration for schema version 2
ymh <ymh.work@gmail.com>
parents:
444
diff
changeset
|
109 |
if (options.show_edge_editor_style_thickness) { ;
|
|
bdf851bb1c4f
add style to node and edge in java. implement data migration for schema version 2
ymh <ymh.work@gmail.com>
parents:
444
diff
changeset
|
110 |
__p += '\n <div id="Rk-Editor-p-thickness">\n <span class="Rk-Editor-Label">' + |
|
bdf851bb1c4f
add style to node and edge in java. implement data migration for schema version 2
ymh <ymh.work@gmail.com>
parents:
444
diff
changeset
|
111 |
__e(renkan.translate("Thickness:")) +
|
|
bdf851bb1c4f
add style to node and edge in java. implement data migration for schema version 2
ymh <ymh.work@gmail.com>
parents:
444
diff
changeset
|
112 |
'</span>\n <a href="#" class="Rk-Edit-Size-Btn" id="Rk-Edit-Thickness-Down">-</a>\n <span class="Rk-Edit-Size-Disp" id="Rk-Edit-Thickness-Value">' + |
|
bdf851bb1c4f
add style to node and edge in java. implement data migration for schema version 2
ymh <ymh.work@gmail.com>
parents:
444
diff
changeset
|
113 |
__e( edge.thickness ) + |
|
bdf851bb1c4f
add style to node and edge in java. implement data migration for schema version 2
ymh <ymh.work@gmail.com>
parents:
444
diff
changeset
|
114 |
'</span>\n <a href="#" class="Rk-Edit-Size-Btn" id="Rk-Edit-Thickness-Up">+</a>\n </div>\n '; |
|
bdf851bb1c4f
add style to node and edge in java. implement data migration for schema version 2
ymh <ymh.work@gmail.com>
parents:
444
diff
changeset
|
115 |
} ; |
|
bdf851bb1c4f
add style to node and edge in java. implement data migration for schema version 2
ymh <ymh.work@gmail.com>
parents:
444
diff
changeset
|
116 |
__p += '\n '; |
|
bdf851bb1c4f
add style to node and edge in java. implement data migration for schema version 2
ymh <ymh.work@gmail.com>
parents:
444
diff
changeset
|
117 |
if (options.show_edge_editor_style_arrow) { ;
|
|
bdf851bb1c4f
add style to node and edge in java. implement data migration for schema version 2
ymh <ymh.work@gmail.com>
parents:
444
diff
changeset
|
118 |
__p += '\n <div id="Rk-Editor-p-arrow">\n <span class="Rk-Editor-Label">' + |
|
bdf851bb1c4f
add style to node and edge in java. implement data migration for schema version 2
ymh <ymh.work@gmail.com>
parents:
444
diff
changeset
|
119 |
__e(renkan.translate("Arrow:")) +
|
|
bdf851bb1c4f
add style to node and edge in java. implement data migration for schema version 2
ymh <ymh.work@gmail.com>
parents:
444
diff
changeset
|
120 |
'</span>\n <input type="checkbox" name="Rk-Edit-Arrow" class="Rk-Edit-Arrow" ' + |
|
bdf851bb1c4f
add style to node and edge in java. implement data migration for schema version 2
ymh <ymh.work@gmail.com>
parents:
444
diff
changeset
|
121 |
__e( edge.arrow ) + |
|
bdf851bb1c4f
add style to node and edge in java. implement data migration for schema version 2
ymh <ymh.work@gmail.com>
parents:
444
diff
changeset
|
122 |
' />\n </div>\n '; |
|
bdf851bb1c4f
add style to node and edge in java. implement data migration for schema version 2
ymh <ymh.work@gmail.com>
parents:
444
diff
changeset
|
123 |
} ; |
|
bdf851bb1c4f
add style to node and edge in java. implement data migration for schema version 2
ymh <ymh.work@gmail.com>
parents:
444
diff
changeset
|
124 |
__p += '\n </div>\n'; |
| 442 | 125 |
} ; |
126 |
__p += '\n'; |
|
127 |
if (options.show_edge_editor_direction) { ;
|
|
128 |
__p += '\n <p>\n <span class="Rk-Edit-Direction">' + |
|
129 |
__e( renkan.translate("Change edge direction") ) +
|
|
130 |
'</span>\n </p>\n'; |
|
131 |
} ; |
|
132 |
__p += '\n'; |
|
133 |
if (options.show_edge_editor_nodes) { ;
|
|
134 |
__p += '\n <p>\n <span class="Rk-Editor-Label">' + |
|
135 |
__e(renkan.translate("From:")) +
|
|
136 |
'</span>\n <span class="Rk-UserColor" style="background: ' + |
|
137 |
__e(edge.from_color) + |
|
138 |
';"></span>\n ' + |
|
139 |
__e( shortenText(edge.from_title, 25) ) + |
|
140 |
'\n </p>\n <p>\n <span class="Rk-Editor-Label">' + |
|
141 |
__e(renkan.translate("To:")) +
|
|
142 |
'</span>\n <span class="Rk-UserColor" style="background: >%-edge.to_color%>;"></span>\n ' + |
|
143 |
__e( shortenText(edge.to_title, 25) ) + |
|
144 |
'\n </p>\n'; |
|
145 |
} ; |
|
146 |
__p += '\n'; |
|
147 |
if (options.show_edge_editor_creator && edge.has_creator) { ;
|
|
148 |
__p += '\n <p>\n <span class="Rk-Editor-Label">' + |
|
149 |
__e(renkan.translate("Created by:")) +
|
|
150 |
'</span>\n <span class="Rk-UserColor" style="background: <%-edge.created_by_color%>;"></span>\n ' + |
|
151 |
__e( shortenText(edge.created_by_title, 25) ) + |
|
152 |
'\n </p>\n'; |
|
153 |
} ; |
|
154 |
__p += '\n'; |
|
155 |
||
156 |
} |
|
157 |
return __p |
|
158 |
}; |
|
159 |
||
160 |
this["renkanJST"]["templates/edgeeditor_readonly.html"] = function(obj) {
|
|
161 |
obj || (obj = {});
|
|
162 |
var __t, __p = '', __e = _.escape, __j = Array.prototype.join; |
|
163 |
function print() { __p += __j.call(arguments, '') }
|
|
164 |
with (obj) {
|
|
165 |
__p += '<h2>\n <span class="Rk-CloseX">×</span>\n '; |
|
166 |
if (options.show_edge_tooltip_color) { ;
|
|
167 |
__p += '\n <span class="Rk-UserColor" style="background: ' + |
|
168 |
__e( edge.color ) + |
|
169 |
';"></span>\n '; |
|
170 |
} ; |
|
171 |
__p += '\n <span class="Rk-Display-Title">\n '; |
|
172 |
if (edge.uri) { ;
|
|
173 |
__p += '\n <a href="' + |
|
174 |
__e(edge.uri) + |
|
175 |
'" target="_blank">\n '; |
|
176 |
} ; |
|
177 |
__p += '\n ' + |
|
178 |
__e(edge.title) + |
|
179 |
'\n '; |
|
180 |
if (edge.uri) { ;
|
|
181 |
__p += ' </a> '; |
|
182 |
} ; |
|
183 |
__p += '\n </span>\n</h2>\n'; |
|
184 |
if (options.show_edge_tooltip_uri && edge.uri) { ;
|
|
185 |
__p += '\n <p class="Rk-Display-URI">\n <a href="' + |
|
186 |
__e(edge.uri) + |
|
187 |
'" target="_blank">' + |
|
188 |
__e( edge.short_uri ) + |
|
189 |
'</a>\n </p>\n'; |
|
190 |
} ; |
|
191 |
__p += '\n<p>' + |
|
| 488 | 192 |
((__t = (edge.description)) == null ? '' : __t) + |
| 442 | 193 |
'</p>\n'; |
194 |
if (options.show_edge_tooltip_nodes) { ;
|
|
195 |
__p += '\n <p>\n <span class="Rk-Editor-Label">' + |
|
196 |
__e(renkan.translate("From:")) +
|
|
197 |
'</span>\n <span class="Rk-UserColor" style="background: ' + |
|
198 |
__e( edge.from_color ) + |
|
199 |
';"></span>\n ' + |
|
200 |
__e( shortenText(edge.from_title, 25) ) + |
|
201 |
'\n </p>\n <p>\n <span class="Rk-Editor-Label">' + |
|
202 |
__e(renkan.translate("To:")) +
|
|
203 |
'</span>\n <span class="Rk-UserColor" style="background: ' + |
|
204 |
__e( edge.to_color ) + |
|
205 |
';"></span>\n ' + |
|
206 |
__e( shortenText(edge.to_title, 25) ) + |
|
207 |
'\n </p>\n'; |
|
208 |
} ; |
|
209 |
__p += '\n'; |
|
210 |
if (options.show_edge_tooltip_creator && edge.has_creator) { ;
|
|
211 |
__p += '\n <p>\n <span class="Rk-Editor-Label">' + |
|
212 |
__e(renkan.translate("Created by:")) +
|
|
213 |
'</span>\n <span class="Rk-UserColor" style="background: ' + |
|
214 |
__e( edge.created_by_color ) + |
|
215 |
';"></span>\n ' + |
|
216 |
__e( shortenText(edge.created_by_title, 25) ) + |
|
217 |
'\n </p>\n'; |
|
218 |
} ; |
|
219 |
__p += '\n'; |
|
220 |
||
221 |
} |
|
222 |
return __p |
|
223 |
}; |
|
224 |
||
225 |
this["renkanJST"]["templates/ldtjson-bin/annotationtemplate.html"] = function(obj) {
|
|
226 |
obj || (obj = {});
|
|
227 |
var __t, __p = '', __e = _.escape; |
|
228 |
with (obj) {
|
|
229 |
__p += '<li class="Rk-Bin-Item" draggable="true"\n data-image="' + |
|
230 |
__e( Rkns.Utils.getFullURL(image) ) + |
|
231 |
'"\n data-uri="' + |
|
232 |
((__t = (ldt_platform)) == null ? '' : __t) + |
|
233 |
'ldtplatform/ldt/front/player/' + |
|
234 |
((__t = (mediaid)) == null ? '' : __t) + |
|
235 |
'/#id=' + |
|
236 |
((__t = (annotationid)) == null ? '' : __t) + |
|
237 |
'"\n data-title="' + |
|
238 |
__e(title) + |
|
239 |
'" data-description="' + |
|
240 |
__e(description) + |
|
241 |
'">\n\n <img class="Rk-Ldt-Annotation-Icon" src="' + |
|
242 |
((__t = (image)) == null ? '' : __t) + |
|
243 |
'" />\n <h4>' + |
|
244 |
((__t = (htitle)) == null ? '' : __t) + |
|
245 |
'</h4>\n <p>' + |
|
246 |
((__t = (hdescription)) == null ? '' : __t) + |
|
247 |
'</p>\n <p>Start: ' + |
|
248 |
((__t = (start)) == null ? '' : __t) + |
|
249 |
', End: ' + |
|
250 |
((__t = (end)) == null ? '' : __t) + |
|
251 |
', Duration: ' + |
|
252 |
((__t = (duration)) == null ? '' : __t) + |
|
253 |
'</p>\n <div class="Rk-Clear"></div>\n</li>\n'; |
|
254 |
||
255 |
} |
|
256 |
return __p |
|
257 |
}; |
|
258 |
||
259 |
this["renkanJST"]["templates/ldtjson-bin/segmenttemplate.html"] = function(obj) {
|
|
260 |
obj || (obj = {});
|
|
261 |
var __t, __p = '', __e = _.escape; |
|
262 |
with (obj) {
|
|
263 |
__p += '<li class="Rk-Bin-Item" draggable="true"\n data-image="' + |
|
264 |
__e( Rkns.Utils.getFullURL(image) ) + |
|
265 |
'"\n data-uri="' + |
|
266 |
((__t = (ldt_platform)) == null ? '' : __t) + |
|
267 |
'ldtplatform/ldt/front/player/' + |
|
268 |
((__t = (mediaid)) == null ? '' : __t) + |
|
269 |
'/#id=' + |
|
270 |
((__t = (annotationid)) == null ? '' : __t) + |
|
271 |
'"\n data-title="' + |
|
272 |
__e(title) + |
|
273 |
'" data-description="' + |
|
274 |
__e(description) + |
|
275 |
'">\n\n <img class="Rk-Ldt-Annotation-Icon" src="' + |
|
276 |
((__t = (image)) == null ? '' : __t) + |
|
277 |
'" />\n <h4>' + |
|
278 |
((__t = (htitle)) == null ? '' : __t) + |
|
279 |
'</h4>\n <p>' + |
|
280 |
((__t = (hdescription)) == null ? '' : __t) + |
|
281 |
'</p>\n <p>Start: ' + |
|
282 |
((__t = (start)) == null ? '' : __t) + |
|
283 |
', End: ' + |
|
284 |
((__t = (end)) == null ? '' : __t) + |
|
285 |
', Duration: ' + |
|
286 |
((__t = (duration)) == null ? '' : __t) + |
|
287 |
'</p>\n <div class="Rk-Clear"></div>\n</li>\n'; |
|
288 |
||
289 |
} |
|
290 |
return __p |
|
291 |
}; |
|
292 |
||
293 |
this["renkanJST"]["templates/ldtjson-bin/tagtemplate.html"] = function(obj) {
|
|
294 |
obj || (obj = {});
|
|
295 |
var __t, __p = '', __e = _.escape; |
|
296 |
with (obj) {
|
|
297 |
__p += '<li class="Rk-Bin-Item" draggable="true"\n data-image="' + |
|
298 |
__e( Rkns.Utils.getFullURL(static_url+'img/ldt-tag.png') ) + |
|
299 |
'"\n data-uri="' + |
|
300 |
((__t = (ldt_platform)) == null ? '' : __t) + |
|
301 |
'ldtplatform/ldt/front/search/?search=' + |
|
302 |
((__t = (encodedtitle)) == null ? '' : __t) + |
|
303 |
'&field=all"\n data-title="' + |
|
304 |
__e(title) + |
|
305 |
'" data-description="Tag \'' + |
|
306 |
__e(title) + |
|
307 |
'\'">\n\n <img class="Rk-Ldt-Tag-Icon" src="' + |
|
308 |
__e(static_url) + |
|
309 |
'img/ldt-tag.png" />\n <h4>' + |
|
310 |
((__t = (htitle)) == null ? '' : __t) + |
|
311 |
'</h4>\n <div class="Rk-Clear"></div>\n</li>\n'; |
|
312 |
||
313 |
} |
|
314 |
return __p |
|
315 |
}; |
|
316 |
||
317 |
this["renkanJST"]["templates/list-bin.html"] = function(obj) {
|
|
318 |
obj || (obj = {});
|
|
319 |
var __t, __p = '', __e = _.escape, __j = Array.prototype.join; |
|
320 |
function print() { __p += __j.call(arguments, '') }
|
|
321 |
with (obj) {
|
|
322 |
__p += '<li class="Rk-Bin-Item Rk-ResourceList-Item" draggable="true"\n data-uri="' + |
|
323 |
__e(url) + |
|
324 |
'" data-title="' + |
|
325 |
__e(title) + |
|
326 |
'"\n data-description="' + |
|
327 |
__e(description) + |
|
328 |
'"\n '; |
|
329 |
if (image) { ;
|
|
330 |
__p += '\n data-image="' + |
|
331 |
__e( Rkns.Utils.getFullURL(image) ) + |
|
332 |
'"\n '; |
|
333 |
} else { ;
|
|
334 |
__p += '\n data-image=""\n '; |
|
335 |
} ; |
|
336 |
__p += '\n>'; |
|
337 |
if (image) { ;
|
|
338 |
__p += '\n <img class="Rk-ResourceList-Image" src="' + |
|
339 |
__e(image) + |
|
340 |
'" />\n'; |
|
341 |
} ; |
|
342 |
__p += '\n<h4 class="Rk-ResourceList-Title">\n '; |
|
343 |
if (url) { ;
|
|
344 |
__p += '\n <a href="' + |
|
345 |
__e(url) + |
|
346 |
'" target="_blank">\n '; |
|
347 |
} ; |
|
348 |
__p += '\n ' + |
|
349 |
((__t = (htitle)) == null ? '' : __t) + |
|
350 |
'\n '; |
|
351 |
if (url) { ;
|
|
352 |
__p += '</a>'; |
|
353 |
} ; |
|
354 |
__p += '\n </h4>\n '; |
|
355 |
if (description) { ;
|
|
356 |
__p += '\n <p class="Rk-ResourceList-Description">' + |
|
357 |
((__t = (hdescription)) == null ? '' : __t) + |
|
358 |
'</p>\n '; |
|
359 |
} ; |
|
360 |
__p += '\n '; |
|
361 |
if (image) { ;
|
|
362 |
__p += '\n <div style="clear: both;"></div>\n '; |
|
363 |
} ; |
|
364 |
__p += '\n</li>\n'; |
|
365 |
||
366 |
} |
|
367 |
return __p |
|
368 |
}; |
|
369 |
||
370 |
this["renkanJST"]["templates/main.html"] = function(obj) {
|
|
371 |
obj || (obj = {});
|
|
372 |
var __t, __p = '', __e = _.escape, __j = Array.prototype.join; |
|
373 |
function print() { __p += __j.call(arguments, '') }
|
|
374 |
with (obj) {
|
|
375 |
||
376 |
if (options.show_bins) { ;
|
|
377 |
__p += '\n <div class="Rk-Bins">\n <div class="Rk-Bins-Head">\n <h2 class="Rk-Bins-Title">' + |
|
378 |
__e( translate("Select contents:")) +
|
|
379 |
'</h2>\n <form class="Rk-Web-Search-Form Rk-Search-Form">\n <input class="Rk-Web-Search-Input Rk-Search-Input" type="search"\n placeholder="' + |
|
380 |
__e( translate('Search the Web') ) +
|
|
381 |
'" />\n <div class="Rk-Search-Select">\n <div class="Rk-Search-Current"></div>\n <ul class="Rk-Search-List"></ul>\n </div>\n <input type="submit" value=""\n class="Rk-Web-Search-Submit Rk-Search-Submit" title="' + |
|
382 |
__e( translate('Search the Web') ) +
|
|
383 |
'" />\n </form>\n <form class="Rk-Bins-Search-Form Rk-Search-Form">\n <input class="Rk-Bins-Search-Input Rk-Search-Input" type="search"\n placeholder="' + |
|
384 |
__e( translate('Search in Bins') ) +
|
|
385 |
'" /> <input\n type="submit" value=""\n class="Rk-Bins-Search-Submit Rk-Search-Submit"\n title="' + |
|
386 |
__e( translate('Search in Bins') ) +
|
|
387 |
'" />\n </form>\n </div>\n <ul class="Rk-Bin-List"></ul>\n </div>\n'; |
|
388 |
} ; |
|
389 |
__p += ' '; |
|
390 |
if (options.show_editor) { ;
|
|
391 |
__p += '\n <div class="Rk-Render Rk-Render-'; |
|
392 |
if (options.show_bins) { ;
|
|
393 |
__p += 'Panel'; |
|
394 |
} else { ;
|
|
395 |
__p += 'Full'; |
|
396 |
} ; |
|
397 |
__p += '"></div>\n'; |
|
398 |
} ; |
|
399 |
__p += '\n'; |
|
400 |
||
401 |
} |
|
402 |
return __p |
|
403 |
}; |
|
404 |
||
405 |
this["renkanJST"]["templates/nodeeditor.html"] = function(obj) {
|
|
406 |
obj || (obj = {});
|
|
407 |
var __t, __p = '', __e = _.escape, __j = Array.prototype.join; |
|
408 |
function print() { __p += __j.call(arguments, '') }
|
|
409 |
with (obj) {
|
|
|
460
bdf851bb1c4f
add style to node and edge in java. implement data migration for schema version 2
ymh <ymh.work@gmail.com>
parents:
444
diff
changeset
|
410 |
|
|
bdf851bb1c4f
add style to node and edge in java. implement data migration for schema version 2
ymh <ymh.work@gmail.com>
parents:
444
diff
changeset
|
411 |
//TODO: change class to id ; |
|
bdf851bb1c4f
add style to node and edge in java. implement data migration for schema version 2
ymh <ymh.work@gmail.com>
parents:
444
diff
changeset
|
412 |
__p += '\n<h2>\n <span class="Rk-CloseX">×</span>' + |
| 442 | 413 |
__e(renkan.translate("Edit Node")) +
|
414 |
'</span>\n</h2>\n<p>\n <label>' + |
|
415 |
__e(renkan.translate("Title:")) +
|
|
416 |
'</label>\n <input class="Rk-Edit-Title" type="text" value="' + |
|
417 |
__e(node.title) + |
|
418 |
'" />\n</p>\n'; |
|
419 |
if (options.show_node_editor_uri) { ;
|
|
420 |
__p += '\n <p>\n <label>' + |
|
421 |
__e(renkan.translate("URI:")) +
|
|
422 |
'</label>\n <input class="Rk-Edit-URI" type="text" value="' + |
|
423 |
__e(node.uri) + |
|
424 |
'" />\n <a class="Rk-Edit-Goto" href="' + |
|
425 |
__e(node.uri) + |
|
426 |
'" target="_blank"></a>\n </p>\n'; |
|
427 |
} ; |
|
428 |
__p += ' '; |
|
| 488 | 429 |
if (options.change_types) { ;
|
430 |
__p += '\n <p>\n <label>' + |
|
431 |
__e(renkan.translate("Types available")) +
|
|
432 |
':</label>\n <select class="Rk-Edit-Type">\n '; |
|
433 |
_.each(types, function(type) { ;
|
|
434 |
__p += '\n <option class="Rk-Edit-Vocabulary-Property" value="' + |
|
435 |
__e( type ) + |
|
436 |
'"'; |
|
437 |
if (node.type === type) { ;
|
|
438 |
__p += ' selected'; |
|
439 |
} ; |
|
440 |
__p += '>\n ' + |
|
441 |
__e( renkan.translate(type.charAt(0).toUpperCase() + type.substring(1)) ) + |
|
442 |
'\n </option>\n '; |
|
443 |
}); ; |
|
444 |
__p += '\n </select>\n </p>\n'; |
|
445 |
} ; |
|
446 |
__p += ' '; |
|
| 442 | 447 |
if (options.show_node_editor_description) { ;
|
448 |
__p += '\n <p>\n <label>' + |
|
449 |
__e(renkan.translate("Description:")) +
|
|
| 488 | 450 |
'</label>\n '; |
451 |
if (options.show_node_editor_description_richtext) { ;
|
|
452 |
__p += '\n <div class="Rk-Edit-Description" contenteditable="true">' + |
|
453 |
((__t = (node.description)) == null ? '' : __t) + |
|
454 |
'</div>\n '; |
|
455 |
} else { ;
|
|
456 |
__p += '\n <textarea class="Rk-Edit-Description">' + |
|
457 |
((__t = (node.description)) == null ? '' : __t) + |
|
458 |
'</textarea>\n '; |
|
459 |
} ; |
|
460 |
__p += '\n </p>\n'; |
|
| 442 | 461 |
} ; |
462 |
__p += ' '; |
|
463 |
if (options.show_node_editor_size) { ;
|
|
464 |
__p += '\n <p>\n <span class="Rk-Editor-Label">' + |
|
465 |
__e(renkan.translate("Size:")) +
|
|
|
460
bdf851bb1c4f
add style to node and edge in java. implement data migration for schema version 2
ymh <ymh.work@gmail.com>
parents:
444
diff
changeset
|
466 |
'</span>\n <a href="#" class="Rk-Edit-Size-Btn" id="Rk-Edit-Size-Down">-</a>\n <span class="Rk-Edit-Size-Disp" id="Rk-Edit-Size-Value">' + |
| 442 | 467 |
__e(node.size) + |
|
460
bdf851bb1c4f
add style to node and edge in java. implement data migration for schema version 2
ymh <ymh.work@gmail.com>
parents:
444
diff
changeset
|
468 |
'</span>\n <a href="#" class="Rk-Edit-Size-Btn" id="Rk-Edit-Size-Up">+</a>\n </p>\n'; |
| 442 | 469 |
} ; |
470 |
__p += ' '; |
|
|
460
bdf851bb1c4f
add style to node and edge in java. implement data migration for schema version 2
ymh <ymh.work@gmail.com>
parents:
444
diff
changeset
|
471 |
if (options.show_node_editor_style) { ;
|
|
bdf851bb1c4f
add style to node and edge in java. implement data migration for schema version 2
ymh <ymh.work@gmail.com>
parents:
444
diff
changeset
|
472 |
__p += '\n <div class="Rk-Editor-p">\n '; |
|
bdf851bb1c4f
add style to node and edge in java. implement data migration for schema version 2
ymh <ymh.work@gmail.com>
parents:
444
diff
changeset
|
473 |
if (options.show_node_editor_style_color) { ;
|
|
bdf851bb1c4f
add style to node and edge in java. implement data migration for schema version 2
ymh <ymh.work@gmail.com>
parents:
444
diff
changeset
|
474 |
__p += '\n <div id="Rk-Editor-p-color">\n <span class="Rk-Editor-Label">\n ' + |
| 442 | 475 |
__e(renkan.translate("Node color:")) +
|
476 |
'</span>\n <div class="Rk-Edit-ColorPicker-Wrapper">\n <span class="Rk-Edit-Color" style="background: ' + |
|
477 |
__e(node.color) + |
|
478 |
';">\n <span class="Rk-Edit-ColorTip"></span>\n </span>\n ' + |
|
479 |
((__t = ( renkan.colorPicker )) == null ? '' : __t) + |
|
480 |
'\n <span class="Rk-Edit-ColorPicker-Text">' + |
|
481 |
__e( renkan.translate("Choose color") ) +
|
|
|
460
bdf851bb1c4f
add style to node and edge in java. implement data migration for schema version 2
ymh <ymh.work@gmail.com>
parents:
444
diff
changeset
|
482 |
'</span>\n </div>\n </div>\n '; |
|
bdf851bb1c4f
add style to node and edge in java. implement data migration for schema version 2
ymh <ymh.work@gmail.com>
parents:
444
diff
changeset
|
483 |
} ; |
|
bdf851bb1c4f
add style to node and edge in java. implement data migration for schema version 2
ymh <ymh.work@gmail.com>
parents:
444
diff
changeset
|
484 |
__p += '\n '; |
|
bdf851bb1c4f
add style to node and edge in java. implement data migration for schema version 2
ymh <ymh.work@gmail.com>
parents:
444
diff
changeset
|
485 |
if (options.show_node_editor_style_dash) { ;
|
|
bdf851bb1c4f
add style to node and edge in java. implement data migration for schema version 2
ymh <ymh.work@gmail.com>
parents:
444
diff
changeset
|
486 |
__p += '\n <div id="Rk-Editor-p-dash">\n <span class="Rk-Editor-Label">' + |
|
bdf851bb1c4f
add style to node and edge in java. implement data migration for schema version 2
ymh <ymh.work@gmail.com>
parents:
444
diff
changeset
|
487 |
__e(renkan.translate("Dash:")) +
|
|
bdf851bb1c4f
add style to node and edge in java. implement data migration for schema version 2
ymh <ymh.work@gmail.com>
parents:
444
diff
changeset
|
488 |
'</span>\n <input type="checkbox" name="Rk-Edit-Dash" class="Rk-Edit-Dash" ' + |
|
bdf851bb1c4f
add style to node and edge in java. implement data migration for schema version 2
ymh <ymh.work@gmail.com>
parents:
444
diff
changeset
|
489 |
__e( node.dash ) + |
|
bdf851bb1c4f
add style to node and edge in java. implement data migration for schema version 2
ymh <ymh.work@gmail.com>
parents:
444
diff
changeset
|
490 |
' />\n </div>\n '; |
|
bdf851bb1c4f
add style to node and edge in java. implement data migration for schema version 2
ymh <ymh.work@gmail.com>
parents:
444
diff
changeset
|
491 |
} ; |
|
bdf851bb1c4f
add style to node and edge in java. implement data migration for schema version 2
ymh <ymh.work@gmail.com>
parents:
444
diff
changeset
|
492 |
__p += '\n '; |
|
bdf851bb1c4f
add style to node and edge in java. implement data migration for schema version 2
ymh <ymh.work@gmail.com>
parents:
444
diff
changeset
|
493 |
if (options.show_node_editor_style_thickness) { ;
|
|
bdf851bb1c4f
add style to node and edge in java. implement data migration for schema version 2
ymh <ymh.work@gmail.com>
parents:
444
diff
changeset
|
494 |
__p += '\n <div id="Rk-Editor-p-thickness">\n <span class="Rk-Editor-Label">' + |
|
bdf851bb1c4f
add style to node and edge in java. implement data migration for schema version 2
ymh <ymh.work@gmail.com>
parents:
444
diff
changeset
|
495 |
__e(renkan.translate("Thickness:")) +
|
|
bdf851bb1c4f
add style to node and edge in java. implement data migration for schema version 2
ymh <ymh.work@gmail.com>
parents:
444
diff
changeset
|
496 |
'</span>\n <a href="#" class="Rk-Edit-Size-Btn" id="Rk-Edit-Thickness-Down">-</a>\n <span class="Rk-Edit-Size-Disp" id="Rk-Edit-Thickness-Value">' + |
|
bdf851bb1c4f
add style to node and edge in java. implement data migration for schema version 2
ymh <ymh.work@gmail.com>
parents:
444
diff
changeset
|
497 |
__e(node.thickness) + |
|
bdf851bb1c4f
add style to node and edge in java. implement data migration for schema version 2
ymh <ymh.work@gmail.com>
parents:
444
diff
changeset
|
498 |
'</span>\n <a href="#" class="Rk-Edit-Size-Btn" id="Rk-Edit-Thickness-Up">+</a>\n </div>\n '; |
|
bdf851bb1c4f
add style to node and edge in java. implement data migration for schema version 2
ymh <ymh.work@gmail.com>
parents:
444
diff
changeset
|
499 |
} ; |
|
bdf851bb1c4f
add style to node and edge in java. implement data migration for schema version 2
ymh <ymh.work@gmail.com>
parents:
444
diff
changeset
|
500 |
__p += '\n </div>\n'; |
| 442 | 501 |
} ; |
502 |
__p += ' '; |
|
503 |
if (options.show_node_editor_image) { ;
|
|
504 |
__p += '\n <div class="Rk-Edit-ImgWrap">\n <div class="Rk-Edit-ImgPreview">\n <img src="' + |
|
505 |
__e(node.image || node.image_placeholder) + |
|
506 |
'" />\n '; |
|
507 |
if (node.clip_path) { ;
|
|
508 |
__p += '\n <svg xmlns="http://www.w3.org/2000/svg" version="1.1" viewbox="0 0 1 1" preserveAspectRatio="none">\n <path style="stroke-width: .02; stroke:red; fill-opacity:.3; fill:red;" d="' + |
|
509 |
__e( node.clip_path ) + |
|
510 |
'" />\n </svg>\n '; |
|
511 |
}; |
|
512 |
__p += '\n </div>\n </div>\n <p>\n <label>' + |
|
513 |
__e(renkan.translate("Image URL:")) +
|
|
514 |
'</label>\n <div>\n <a class="Rk-Edit-Image-Del" href="#"></a>\n <input class="Rk-Edit-Image" type="text" value=\'' + |
|
515 |
__e(node.image) + |
|
516 |
'\' />\n </div>\n </p>\n'; |
|
517 |
if (options.allow_image_upload) { ;
|
|
518 |
__p += '\n <p>\n <label>' + |
|
519 |
__e(renkan.translate("Choose Image File:")) +
|
|
520 |
'</label>\n <input class="Rk-Edit-Image-File" type="file" accept="image/*" />\n </p>\n'; |
|
521 |
}; |
|
522 |
||
523 |
} ; |
|
524 |
__p += ' '; |
|
525 |
if (options.show_node_editor_creator && node.has_creator) { ;
|
|
526 |
__p += '\n <p>\n <span class="Rk-Editor-Label">' + |
|
527 |
__e(renkan.translate("Created by:")) +
|
|
528 |
'</span>\n <span class="Rk-UserColor" style="background: ' + |
|
529 |
__e(node.created_by_color) + |
|
530 |
';"></span>\n ' + |
|
531 |
__e( shortenText(node.created_by_title, 25) ) + |
|
532 |
'\n </p>\n'; |
|
533 |
} ; |
|
534 |
__p += ' '; |
|
535 |
if (options.change_shapes) { ;
|
|
536 |
__p += '\n <p>\n <label>' + |
|
537 |
__e(renkan.translate("Shapes available")) +
|
|
|
460
bdf851bb1c4f
add style to node and edge in java. implement data migration for schema version 2
ymh <ymh.work@gmail.com>
parents:
444
diff
changeset
|
538 |
':</label>\n <select class="Rk-Edit-Shape">\n '; |
|
bdf851bb1c4f
add style to node and edge in java. implement data migration for schema version 2
ymh <ymh.work@gmail.com>
parents:
444
diff
changeset
|
539 |
_.each(shapes, function(shape) { ;
|
|
bdf851bb1c4f
add style to node and edge in java. implement data migration for schema version 2
ymh <ymh.work@gmail.com>
parents:
444
diff
changeset
|
540 |
__p += '\n <option class="Rk-Edit-Vocabulary-Property" value="' + |
|
bdf851bb1c4f
add style to node and edge in java. implement data migration for schema version 2
ymh <ymh.work@gmail.com>
parents:
444
diff
changeset
|
541 |
__e( shape ) + |
|
bdf851bb1c4f
add style to node and edge in java. implement data migration for schema version 2
ymh <ymh.work@gmail.com>
parents:
444
diff
changeset
|
542 |
'"'; |
|
bdf851bb1c4f
add style to node and edge in java. implement data migration for schema version 2
ymh <ymh.work@gmail.com>
parents:
444
diff
changeset
|
543 |
if (node.shape === shape) { ;
|
| 442 | 544 |
__p += ' selected'; |
545 |
} ; |
|
546 |
__p += '>\n ' + |
|
|
460
bdf851bb1c4f
add style to node and edge in java. implement data migration for schema version 2
ymh <ymh.work@gmail.com>
parents:
444
diff
changeset
|
547 |
__e( renkan.translate(shape.charAt(0).toUpperCase() + shape.substring(1)) ) + |
|
bdf851bb1c4f
add style to node and edge in java. implement data migration for schema version 2
ymh <ymh.work@gmail.com>
parents:
444
diff
changeset
|
548 |
'\n </option>\n '; |
|
bdf851bb1c4f
add style to node and edge in java. implement data migration for schema version 2
ymh <ymh.work@gmail.com>
parents:
444
diff
changeset
|
549 |
}); ; |
|
bdf851bb1c4f
add style to node and edge in java. implement data migration for schema version 2
ymh <ymh.work@gmail.com>
parents:
444
diff
changeset
|
550 |
__p += '\n </select>\n </p>\n'; |
| 442 | 551 |
} ; |
552 |
__p += '\n'; |
|
553 |
||
554 |
} |
|
555 |
return __p |
|
556 |
}; |
|
557 |
||
558 |
this["renkanJST"]["templates/nodeeditor_readonly.html"] = function(obj) {
|
|
559 |
obj || (obj = {});
|
|
560 |
var __t, __p = '', __e = _.escape, __j = Array.prototype.join; |
|
561 |
function print() { __p += __j.call(arguments, '') }
|
|
562 |
with (obj) {
|
|
563 |
__p += '<h2>\n <span class="Rk-CloseX">×</span>\n '; |
|
564 |
if (options.show_node_tooltip_color) { ;
|
|
565 |
__p += '\n <span class="Rk-UserColor" style="background: ' + |
|
566 |
__e(node.color) + |
|
567 |
';"></span>\n '; |
|
568 |
} ; |
|
569 |
__p += '\n <span class="Rk-Display-Title">\n '; |
|
570 |
if (node.uri) { ;
|
|
571 |
__p += '\n <a href="' + |
|
572 |
__e(node.uri) + |
|
573 |
'" target="_blank">\n '; |
|
574 |
} ; |
|
575 |
__p += '\n ' + |
|
576 |
__e(node.title) + |
|
577 |
'\n '; |
|
578 |
if (node.uri) { ;
|
|
579 |
__p += '</a>'; |
|
580 |
} ; |
|
581 |
__p += '\n </span>\n</h2>\n'; |
|
582 |
if (node.uri && options.show_node_tooltip_uri) { ;
|
|
583 |
__p += '\n <p class="Rk-Display-URI">\n <a href="' + |
|
584 |
__e(node.uri) + |
|
585 |
'" target="_blank">' + |
|
586 |
__e(node.short_uri) + |
|
587 |
'</a>\n </p>\n'; |
|
588 |
} ; |
|
589 |
__p += ' '; |
|
590 |
if (options.show_node_tooltip_description) { ;
|
|
591 |
__p += '\n <p class="Rk-Display-Description">' + |
|
| 488 | 592 |
((__t = (node.description)) == null ? '' : __t) + |
| 442 | 593 |
'</p>\n'; |
594 |
} ; |
|
595 |
__p += ' '; |
|
596 |
if (node.image && options.show_node_tooltip_image) { ;
|
|
597 |
__p += '\n <img class="Rk-Display-ImgPreview" src="' + |
|
598 |
__e(node.image) + |
|
599 |
'" />\n'; |
|
600 |
} ; |
|
601 |
__p += ' '; |
|
602 |
if (node.has_creator && options.show_node_tooltip_creator) { ;
|
|
603 |
__p += '\n <p>\n <span class="Rk-Editor-Label">' + |
|
604 |
__e(renkan.translate("Created by:")) +
|
|
605 |
'</span>\n <span class="Rk-UserColor" style="background: ' + |
|
606 |
__e(node.created_by_color) + |
|
607 |
';"></span>\n ' + |
|
608 |
__e( shortenText(node.created_by_title, 25) ) + |
|
609 |
'\n </p>\n'; |
|
610 |
} ; |
|
| 488 | 611 |
__p += '\n <a href="#?idnode=' + |
612 |
__e(node._id) + |
|
613 |
'">' + |
|
614 |
__e(renkan.translate("Link to the node")) +
|
|
615 |
'</a>\n'; |
|
616 |
||
617 |
} |
|
618 |
return __p |
|
619 |
}; |
|
620 |
||
621 |
this["renkanJST"]["templates/nodeeditor_video.html"] = function(obj) {
|
|
622 |
obj || (obj = {});
|
|
623 |
var __t, __p = '', __e = _.escape, __j = Array.prototype.join; |
|
624 |
function print() { __p += __j.call(arguments, '') }
|
|
625 |
with (obj) {
|
|
626 |
__p += '<h2>\n <span class="Rk-CloseX">×</span>\n '; |
|
627 |
if (options.show_node_tooltip_color) { ;
|
|
628 |
__p += '\n <span class="Rk-UserColor" style="background: ' + |
|
629 |
__e(node.color) + |
|
630 |
';"></span>\n '; |
|
631 |
} ; |
|
632 |
__p += '\n <span class="Rk-Display-Title">\n '; |
|
633 |
if (node.uri) { ;
|
|
634 |
__p += '\n <a href="' + |
|
635 |
__e(node.uri) + |
|
636 |
'" target="_blank">\n '; |
|
637 |
} ; |
|
638 |
__p += '\n ' + |
|
639 |
__e(node.title) + |
|
640 |
'\n '; |
|
641 |
if (node.uri) { ;
|
|
642 |
__p += '</a>'; |
|
643 |
} ; |
|
644 |
__p += '\n </span>\n</h2>\n'; |
|
645 |
if (node.uri && options.show_node_tooltip_uri) { ;
|
|
646 |
__p += '\n <video width="320" height="240" controls>\n <source src="' + |
|
647 |
__e(node.uri) + |
|
648 |
'" type="video/mp4">\n </video> \n'; |
|
649 |
} ; |
|
650 |
__p += '\n <a href="#?idnode=' + |
|
651 |
__e(node._id) + |
|
652 |
'">' + |
|
653 |
__e(renkan.translate("Link to the node")) +
|
|
654 |
'</a>\n'; |
|
| 442 | 655 |
|
656 |
} |
|
657 |
return __p |
|
658 |
}; |
|
659 |
||
660 |
this["renkanJST"]["templates/scene.html"] = function(obj) {
|
|
661 |
obj || (obj = {});
|
|
662 |
var __t, __p = '', __e = _.escape, __j = Array.prototype.join; |
|
663 |
function print() { __p += __j.call(arguments, '') }
|
|
664 |
with (obj) {
|
|
665 |
||
666 |
if (options.show_top_bar) { ;
|
|
667 |
__p += '\n <div class="Rk-TopBar">\n <div class="loader"></div>\n '; |
|
668 |
if (!options.editor_mode) { ;
|
|
669 |
__p += '\n <h2 class="Rk-PadTitle">\n ' + |
|
670 |
__e( project.get("title") || translate("Untitled project")) +
|
|
671 |
'\n </h2>\n '; |
|
672 |
} else { ;
|
|
673 |
__p += '\n <input type="text" class="Rk-PadTitle" value="' + |
|
674 |
__e( project.get('title') || '' ) +
|
|
675 |
'" placeholder="' + |
|
676 |
__e(translate('Untitled project')) +
|
|
677 |
'" />\n '; |
|
678 |
} ; |
|
679 |
__p += '\n '; |
|
680 |
if (options.show_user_list) { ;
|
|
681 |
__p += '\n <div class="Rk-Users">\n <div class="Rk-CurrentUser">\n '; |
|
682 |
if (options.show_user_color) { ;
|
|
683 |
__p += '\n <div class="Rk-Edit-ColorPicker-Wrapper">\n <span class="Rk-CurrentUser-Color">\n '; |
|
684 |
if (options.user_color_editable) { ;
|
|
685 |
__p += '\n <span class="Rk-Edit-ColorTip"></span>\n '; |
|
686 |
} ; |
|
687 |
__p += '\n </span>\n '; |
|
688 |
if (options.user_color_editable) { print(colorPicker) } ;
|
|
689 |
__p += '\n </div>\n '; |
|
690 |
} ; |
|
691 |
__p += '\n <span class="Rk-CurrentUser-Name"><unknown user></span>\n </div>\n <ul class="Rk-UserList"></ul>\n </div>\n '; |
|
692 |
} ; |
|
693 |
__p += '\n '; |
|
694 |
if (options.home_button_url) {;
|
|
695 |
__p += '\n <div class="Rk-TopBar-Separator"></div>\n <a class="Rk-TopBar-Button Rk-Home-Button" href="' + |
|
696 |
__e( options.home_button_url ) + |
|
697 |
'">\n <div class="Rk-TopBar-Tooltip">\n <div class="Rk-TopBar-Tooltip-Contents">\n ' + |
|
698 |
__e( translate(options.home_button_title) ) + |
|
699 |
'\n </div>\n </div>\n </a>\n '; |
|
700 |
} ; |
|
701 |
__p += '\n '; |
|
702 |
if (options.show_fullscreen_button) { ;
|
|
703 |
__p += '\n <div class="Rk-TopBar-Separator"></div>\n <div class="Rk-TopBar-Button Rk-FullScreen-Button">\n <div class="Rk-TopBar-Tooltip">\n <div class="Rk-TopBar-Tooltip-Contents">\n ' + |
|
704 |
__e(translate("Full Screen")) +
|
|
705 |
'\n </div>\n </div>\n </div>\n '; |
|
706 |
} ; |
|
707 |
__p += '\n '; |
|
708 |
if (options.editor_mode) { ;
|
|
709 |
__p += '\n '; |
|
710 |
if (options.show_addnode_button) { ;
|
|
711 |
__p += '\n <div class="Rk-TopBar-Separator"></div>\n <div class="Rk-TopBar-Button Rk-AddNode-Button">\n <div class="Rk-TopBar-Tooltip">\n <div class="Rk-TopBar-Tooltip-Contents">\n ' + |
|
712 |
__e(translate("Add Node")) +
|
|
713 |
'\n </div>\n </div>\n </div>\n '; |
|
714 |
} ; |
|
715 |
__p += '\n '; |
|
716 |
if (options.show_addedge_button) { ;
|
|
717 |
__p += '\n <div class="Rk-TopBar-Separator"></div>\n <div class="Rk-TopBar-Button Rk-AddEdge-Button">\n <div class="Rk-TopBar-Tooltip">\n <div class="Rk-TopBar-Tooltip-Contents">\n ' + |
|
718 |
__e(translate("Add Edge")) +
|
|
719 |
'\n </div>\n </div>\n </div>\n '; |
|
720 |
} ; |
|
721 |
__p += '\n '; |
|
722 |
if (options.show_export_button) { ;
|
|
723 |
__p += '\n <div class="Rk-TopBar-Separator"></div>\n <div class="Rk-TopBar-Button Rk-Export-Button">\n <div class="Rk-TopBar-Tooltip">\n <div class="Rk-TopBar-Tooltip-Contents">\n ' + |
|
724 |
__e(translate("Download Project")) +
|
|
725 |
'\n </div>\n </div>\n </div>\n '; |
|
726 |
} ; |
|
727 |
__p += '\n '; |
|
728 |
if (options.show_save_button) { ;
|
|
729 |
__p += '\n <div class="Rk-TopBar-Separator"></div>\n <div class="Rk-TopBar-Button Rk-Save-Button">\n <div class="Rk-TopBar-Tooltip">\n <div class="Rk-TopBar-Tooltip-Contents"></div>\n </div>\n </div>\n '; |
|
730 |
} ; |
|
731 |
__p += '\n '; |
|
732 |
if (options.show_open_button) { ;
|
|
733 |
__p += '\n <div class="Rk-TopBar-Separator"></div>\n <div class="Rk-TopBar-Button Rk-Open-Button">\n <div class="Rk-TopBar-Tooltip">\n <div class="Rk-TopBar-Tooltip-Contents">\n ' + |
|
734 |
__e(translate("Open Project")) +
|
|
735 |
'\n </div>\n </div>\n </div>\n '; |
|
736 |
} ; |
|
737 |
__p += '\n '; |
|
738 |
if (options.show_bookmarklet) { ;
|
|
739 |
__p += '\n <div class="Rk-TopBar-Separator"></div>\n <a class="Rk-TopBar-Button Rk-Bookmarklet-Button" href="#">\n <div class="Rk-TopBar-Tooltip">\n <div class="Rk-TopBar-Tooltip-Contents">\n ' + |
|
740 |
__e(translate("Renkan \'Drag-to-Add\' bookmarklet")) +
|
|
741 |
'\n </div>\n </div>\n </a>\n <div class="Rk-TopBar-Separator"></div>\n '; |
|
742 |
} ; |
|
743 |
__p += '\n '; |
|
744 |
} else { ;
|
|
745 |
__p += '\n '; |
|
746 |
if (options.show_export_button) { ;
|
|
747 |
__p += '\n <div class="Rk-TopBar-Separator"></div>\n <div class="Rk-TopBar-Button Rk-Export-Button">\n <div class="Rk-TopBar-Tooltip">\n <div class="Rk-TopBar-Tooltip-Contents">\n ' + |
|
748 |
__e(translate("Download Project")) +
|
|
749 |
'\n </div>\n </div>\n </div>\n <div class="Rk-TopBar-Separator"></div>\n '; |
|
750 |
} ; |
|
751 |
__p += '\n '; |
|
752 |
}; ; |
|
753 |
__p += '\n '; |
|
754 |
if (options.show_search_field) { ;
|
|
755 |
__p += '\n <form action="#" class="Rk-GraphSearch-Form">\n <input type="search" class="Rk-GraphSearch-Field" placeholder="' + |
|
756 |
__e( translate('Search in graph') ) +
|
|
757 |
'" />\n </form>\n <div class="Rk-TopBar-Separator"></div>\n '; |
|
758 |
} ; |
|
759 |
__p += '\n </div>\n'; |
|
760 |
} ; |
|
761 |
__p += '\n<div class="Rk-Editing-Space'; |
|
762 |
if (!options.show_top_bar) { ;
|
|
763 |
__p += ' Rk-Editing-Space-Full'; |
|
764 |
} ; |
|
765 |
__p += '">\n <div class="Rk-Labels"></div>\n <canvas class="Rk-Canvas" '; |
|
766 |
if (options.resize) { ;
|
|
767 |
__p += ' resize="" '; |
|
768 |
} ; |
|
|
463
41325cc50574
make hidden nodes work on java + correct projects export
ymh <ymh.work@gmail.com>
parents:
461
diff
changeset
|
769 |
__p += ' ></canvas>\n <div class="Rk-Notifications"></div>\n <div class="Rk-Editor">\n '; |
| 442 | 770 |
if (options.show_bins) { ;
|
771 |
__p += '\n <div class="Rk-Fold-Bins">«</div>\n '; |
|
772 |
} ; |
|
773 |
__p += '\n '; |
|
774 |
if (options.show_zoom) { ;
|
|
775 |
__p += '\n <div class="Rk-ZoomButtons">\n <div class="Rk-ZoomIn" title="' + |
|
776 |
__e(translate('Zoom In')) +
|
|
777 |
'"></div>\n <div class="Rk-ZoomFit" title="' + |
|
778 |
__e(translate('Zoom Fit')) +
|
|
779 |
'"></div>\n <div class="Rk-ZoomOut" title="' + |
|
780 |
__e(translate('Zoom Out')) +
|
|
781 |
'"></div>\n '; |
|
782 |
if (options.editor_mode && options.save_view) { ;
|
|
783 |
__p += '\n <div class="Rk-ZoomSave" title="' + |
|
| 488 | 784 |
__e(translate('Save view')) +
|
| 442 | 785 |
'"></div>\n '; |
786 |
} ; |
|
787 |
__p += '\n '; |
|
788 |
if (options.save_view) { ;
|
|
789 |
__p += '\n <div class="Rk-ZoomSetSaved" title="' + |
|
| 488 | 790 |
__e(translate('View saved view')) +
|
791 |
'"></div>\n '; |
|
792 |
if (options.hide_nodes) { ;
|
|
793 |
__p += '\n \t <div class="Rk-ShowHiddenNodes" title="' + |
|
| 456 | 794 |
__e(translate('Show hidden nodes')) +
|
| 488 | 795 |
'"></div>\n '; |
796 |
} ; |
|
797 |
__p += ' \n '; |
|
| 442 | 798 |
} ; |
799 |
__p += '\n </div>\n '; |
|
800 |
} ; |
|
801 |
__p += '\n </div>\n</div>\n'; |
|
802 |
||
803 |
} |
|
804 |
return __p |
|
805 |
}; |
|
806 |
||
807 |
this["renkanJST"]["templates/search.html"] = function(obj) {
|
|
808 |
obj || (obj = {});
|
|
809 |
var __t, __p = '', __e = _.escape; |
|
810 |
with (obj) {
|
|
811 |
__p += '<li class="' + |
|
812 |
((__t = ( className )) == null ? '' : __t) + |
|
813 |
'" data-key="' + |
|
814 |
((__t = ( key )) == null ? '' : __t) + |
|
815 |
'">' + |
|
816 |
((__t = ( title )) == null ? '' : __t) + |
|
817 |
'</li>'; |
|
818 |
||
819 |
} |
|
820 |
return __p |
|
821 |
}; |
|
822 |
||
823 |
this["renkanJST"]["templates/wikipedia-bin/resulttemplate.html"] = function(obj) {
|
|
824 |
obj || (obj = {});
|
|
825 |
var __t, __p = '', __e = _.escape; |
|
826 |
with (obj) {
|
|
827 |
__p += '<li class="Rk-Wikipedia-Result Rk-Bin-Item" draggable="true"\n data-uri="' + |
|
828 |
__e(url) + |
|
829 |
'" data-title="Wikipedia: ' + |
|
830 |
__e(title) + |
|
831 |
'"\n data-description="' + |
|
832 |
__e(description) + |
|
833 |
'"\n data-image="' + |
|
834 |
__e( Rkns.Utils.getFullURL( static_url + 'img/wikipedia.png' ) ) + |
|
835 |
'">\n\n <img class="Rk-Wikipedia-Icon" src="' + |
|
836 |
__e(static_url) + |
|
837 |
'img/wikipedia.png">\n <h4 class="Rk-Wikipedia-Title">\n <a href="' + |
|
838 |
__e(url) + |
|
839 |
'" target="_blank">' + |
|
840 |
((__t = (htitle)) == null ? '' : __t) + |
|
841 |
'</a>\n </h4>\n <p class="Rk-Wikipedia-Snippet">' + |
|
842 |
((__t = (hdescription)) == null ? '' : __t) + |
|
843 |
'</p>\n</li>\n'; |
|
844 |
||
845 |
} |
|
846 |
return __p |
|
847 |
}; |
|
848 |
/* Declaring the Renkan Namespace Rkns and Default values */ |
|
849 |
||
850 |
(function(root) {
|
|
851 |
||
|
444
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
852 |
"use strict"; |
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
853 |
|
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
854 |
if (typeof root.Rkns !== "object") {
|
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
855 |
root.Rkns = {};
|
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
856 |
} |
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
857 |
|
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
858 |
var Rkns = root.Rkns; |
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
859 |
var $ = Rkns.$ = root.jQuery; |
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
860 |
var _ = Rkns._ = root._; |
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
861 |
|
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
862 |
Rkns.pickerColors = ["#8f1919", "#a80000", "#d82626", "#ff0000", "#e87c7c", "#ff6565", "#f7d3d3", "#fecccc", |
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
863 |
"#8f5419", "#a85400", "#d87f26", "#ff7f00", "#e8b27c", "#ffb265", "#f7e5d3", "#fee5cc", |
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
864 |
"#8f8f19", "#a8a800", "#d8d826", "#feff00", "#e8e87c", "#feff65", "#f7f7d3", "#fefecc", |
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
865 |
"#198f19", "#00a800", "#26d826", "#00ff00", "#7ce87c", "#65ff65", "#d3f7d3", "#ccfecc", |
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
866 |
"#198f8f", "#00a8a8", "#26d8d8", "#00feff", "#7ce8e8", "#65feff", "#d3f7f7", "#ccfefe", |
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
867 |
"#19198f", "#0000a8", "#2626d8", "#0000ff", "#7c7ce8", "#6565ff", "#d3d3f7", "#ccccfe", |
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
868 |
"#8f198f", "#a800a8", "#d826d8", "#ff00fe", "#e87ce8", "#ff65fe", "#f7d3f7", "#feccfe", |
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
869 |
"#000000", "#242424", "#484848", "#6d6d6d", "#919191", "#b6b6b6", "#dadada", "#ffffff" |
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
870 |
]; |
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
871 |
|
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
872 |
Rkns.__renkans = []; |
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
873 |
|
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
874 |
var _BaseBin = Rkns._BaseBin = function(_renkan, _opts) {
|
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
875 |
if (typeof _renkan !== "undefined") {
|
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
876 |
this.renkan = _renkan; |
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
877 |
this.renkan.$.find(".Rk-Bin-Main").hide();
|
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
878 |
this.$ = Rkns.$('<li>')
|
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
879 |
.addClass("Rk-Bin")
|
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
880 |
.appendTo(_renkan.$.find(".Rk-Bin-List"));
|
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
881 |
this.title_icon_$ = Rkns.$('<span>')
|
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
882 |
.addClass("Rk-Bin-Title-Icon")
|
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
883 |
.appendTo(this.$); |
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
884 |
|
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
885 |
var _this = this; |
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
886 |
|
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
887 |
Rkns.$('<a>')
|
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
888 |
.attr({
|
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
889 |
href: "#", |
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
890 |
title: _renkan.translate("Close bin")
|
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
891 |
}) |
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
892 |
.addClass("Rk-Bin-Close")
|
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
893 |
.html('×')
|
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
894 |
.appendTo(this.$) |
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
895 |
.click(function() {
|
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
896 |
_this.destroy(); |
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
897 |
if (!_renkan.$.find(".Rk-Bin-Main:visible").length) {
|
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
898 |
_renkan.$.find(".Rk-Bin-Main:last").slideDown();
|
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
899 |
} |
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
900 |
_renkan.resizeBins(); |
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
901 |
return false; |
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
902 |
}); |
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
903 |
Rkns.$('<a>')
|
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
904 |
.attr({
|
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
905 |
href: "#", |
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
906 |
title: _renkan.translate("Refresh bin")
|
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
907 |
}) |
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
908 |
.addClass("Rk-Bin-Refresh")
|
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
909 |
.appendTo(this.$) |
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
910 |
.click(function() {
|
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
911 |
_this.refresh(); |
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
912 |
return false; |
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
913 |
}); |
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
914 |
this.count_$ = Rkns.$('<div>')
|
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
915 |
.addClass("Rk-Bin-Count")
|
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
916 |
.appendTo(this.$); |
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
917 |
this.title_$ = Rkns.$('<h2>')
|
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
918 |
.addClass("Rk-Bin-Title")
|
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
919 |
.appendTo(this.$); |
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
920 |
this.main_$ = Rkns.$('<div>')
|
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
921 |
.addClass("Rk-Bin-Main")
|
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
922 |
.appendTo(this.$) |
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
923 |
.html('<h4 class="Rk-Bin-Loading">' + _renkan.translate("Loading, please wait") + '</h4>');
|
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
924 |
this.title_$.html(_opts.title || '(new bin)'); |
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
925 |
this.renkan.resizeBins(); |
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
926 |
|
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
927 |
if (_opts.auto_refresh) {
|
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
928 |
window.setInterval(function() {
|
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
929 |
_this.refresh(); |
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
930 |
}, _opts.auto_refresh); |
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
931 |
} |
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
932 |
} |
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
933 |
}; |
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
934 |
|
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
935 |
_BaseBin.prototype.destroy = function() {
|
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
936 |
this.$.detach(); |
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
937 |
this.renkan.resizeBins(); |
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
938 |
}; |
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
939 |
|
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
940 |
/* Point of entry */ |
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
941 |
|
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
942 |
var Renkan = Rkns.Renkan = function(_opts) {
|
| 442 | 943 |
var _this = this; |
944 |
||
|
444
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
945 |
Rkns.__renkans.push(this); |
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
946 |
|
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
947 |
this.options = _.defaults(_opts, Rkns.defaults, {
|
| 488 | 948 |
templates: _.defaults(_opts.templates, renkanJST) || renkanJST, |
949 |
node_editor_templates: _.defaults(_opts.node_editor_templates, Rkns.defaults.node_editor_templates) |
|
|
444
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
950 |
}); |
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
951 |
this.template = renkanJST['templates/main.html']; |
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
952 |
|
| 488 | 953 |
var types_templates = {};
|
954 |
_.each(this.options.node_editor_templates, function(value, key) {
|
|
955 |
types_templates[key] = _this.options.templates[value]; |
|
956 |
delete _this.options.templates[value]; |
|
957 |
}); |
|
958 |
this.options.node_editor_templates = types_templates; |
|
959 |
||
|
444
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
960 |
_.each(this.options.property_files, function(f) {
|
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
961 |
Rkns.$.getJSON(f, function(data) {
|
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
962 |
_this.options.properties = _this.options.properties.concat(data); |
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
963 |
}); |
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
964 |
}); |
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
965 |
|
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
966 |
this.read_only = this.options.read_only || !this.options.editor_mode; |
| 488 | 967 |
|
968 |
this.router = new Rkns.Router(); |
|
969 |
||
|
444
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
970 |
this.project = new Rkns.Models.Project(); |
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
971 |
this.dataloader = new Rkns.DataLoader.Loader(this.project, this.options); |
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
972 |
|
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
973 |
this.setCurrentUser = function(user_id, user_name) {
|
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
974 |
this.project.addUser({
|
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
975 |
_id: user_id, |
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
976 |
title: user_name |
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
977 |
}); |
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
978 |
this.current_user = user_id; |
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
979 |
this.renderer.redrawUsers(); |
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
980 |
}; |
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
981 |
|
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
982 |
if (typeof this.options.user_id !== "undefined") {
|
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
983 |
this.current_user = this.options.user_id; |
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
984 |
} |
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
985 |
this.$ = Rkns.$("#" + this.options.container);
|
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
986 |
this.$ |
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
987 |
.addClass("Rk-Main")
|
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
988 |
.html(this.template(this)); |
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
989 |
|
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
990 |
this.tabs = []; |
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
991 |
this.search_engines = []; |
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
992 |
|
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
993 |
this.current_user_list = new Rkns.Models.UsersList(); |
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
994 |
|
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
995 |
this.current_user_list.on("add remove", function() {
|
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
996 |
if (this.renderer) {
|
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
997 |
this.renderer.redrawUsers(); |
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
998 |
} |
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
999 |
}); |
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1000 |
|
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1001 |
this.colorPicker = (function() {
|
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1002 |
var _tmpl = renkanJST['templates/colorpicker.html']; |
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1003 |
return '<ul class="Rk-Edit-ColorPicker">' + Rkns.pickerColors.map(function(c) {
|
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1004 |
return _tmpl({
|
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1005 |
c: c |
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1006 |
}); |
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1007 |
}).join("") + '</ul>';
|
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1008 |
})(); |
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1009 |
|
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1010 |
if (this.options.show_editor) {
|
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1011 |
this.renderer = new Rkns.Renderer.Scene(this); |
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1012 |
} |
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1013 |
|
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1014 |
if (!this.options.search.length) {
|
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1015 |
this.$.find(".Rk-Web-Search-Form").detach();
|
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1016 |
} else {
|
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1017 |
var _tmpl = renkanJST['templates/search.html'], |
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1018 |
_select = this.$.find(".Rk-Search-List"),
|
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1019 |
_input = this.$.find(".Rk-Web-Search-Input"),
|
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1020 |
_form = this.$.find(".Rk-Web-Search-Form");
|
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1021 |
_.each(this.options.search, function(_search, _key) {
|
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1022 |
if (Rkns[_search.type] && Rkns[_search.type].Search) {
|
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1023 |
_this.search_engines.push(new Rkns[_search.type].Search(_this, _search)); |
| 442 | 1024 |
} |
1025 |
}); |
|
|
444
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1026 |
_select.html( |
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1027 |
_(this.search_engines).map(function(_search, _key) {
|
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1028 |
return _tmpl({
|
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1029 |
key: _key, |
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1030 |
title: _search.getSearchTitle(), |
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1031 |
className: _search.getBgClass() |
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1032 |
}); |
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1033 |
}).join("")
|
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1034 |
); |
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1035 |
_select.find("li").click(function() {
|
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1036 |
var _el = Rkns.$(this); |
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1037 |
_this.setSearchEngine(_el.attr("data-key"));
|
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1038 |
_form.submit(); |
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1039 |
}); |
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1040 |
_form.submit(function() {
|
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1041 |
if (_input.val()) {
|
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1042 |
var _search = _this.search_engine; |
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1043 |
_search.search(_input.val()); |
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1044 |
} |
| 442 | 1045 |
return false; |
1046 |
}); |
|
|
444
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1047 |
this.$.find(".Rk-Search-Current").mouseenter(
|
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1048 |
function() {
|
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1049 |
_select.slideDown(); |
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1050 |
} |
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1051 |
); |
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1052 |
this.$.find(".Rk-Search-Select").mouseleave(
|
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1053 |
function() {
|
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1054 |
_select.hide(); |
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1055 |
} |
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1056 |
); |
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1057 |
this.setSearchEngine(0); |
| 442 | 1058 |
} |
|
444
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1059 |
_.each(this.options.bins, function(_bin) {
|
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1060 |
if (Rkns[_bin.type] && Rkns[_bin.type].Bin) {
|
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1061 |
_this.tabs.push(new Rkns[_bin.type].Bin(_this, _bin)); |
| 442 | 1062 |
} |
1063 |
}); |
|
1064 |
||
|
444
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1065 |
var elementDropped = false; |
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1066 |
|
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1067 |
this.$.find(".Rk-Bins")
|
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1068 |
.on("click", ".Rk-Bin-Title,.Rk-Bin-Title-Icon", function() {
|
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1069 |
var _mainDiv = Rkns.$(this).siblings(".Rk-Bin-Main");
|
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1070 |
if (_mainDiv.is(":hidden")) {
|
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1071 |
_this.$.find(".Rk-Bin-Main").slideUp();
|
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1072 |
_mainDiv.slideDown(); |
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1073 |
} |
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1074 |
}); |
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1075 |
|
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1076 |
if (this.options.show_editor) {
|
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1077 |
|
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1078 |
this.$.find(".Rk-Bins").on("mouseover", ".Rk-Bin-Item", function(_e) {
|
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1079 |
var _t = Rkns.$(this); |
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1080 |
if (_t && $(_t).attr("data-uri")) {
|
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1081 |
var _models = _this.project.get("nodes").where({
|
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1082 |
uri: $(_t).attr("data-uri")
|
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1083 |
}); |
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1084 |
_.each(_models, function(_model) {
|
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1085 |
_this.renderer.highlightModel(_model); |
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1086 |
}); |
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1087 |
} |
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1088 |
}).mouseout(function() {
|
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1089 |
_this.renderer.unhighlightAll(); |
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1090 |
}).on("mousemove", ".Rk-Bin-Item", function(e) {
|
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1091 |
try {
|
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1092 |
this.dragDrop(); |
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1093 |
} catch (err) {}
|
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1094 |
}).on("touchstart", ".Rk-Bin-Item", function(e) {
|
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1095 |
elementDropped = false; |
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1096 |
}).on("touchmove", ".Rk-Bin-Item", function(e) {
|
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1097 |
e.preventDefault(); |
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1098 |
var touch = e.originalEvent.changedTouches[0], |
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1099 |
off = _this.renderer.canvas_$.offset(), |
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1100 |
w = _this.renderer.canvas_$.width(), |
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1101 |
h = _this.renderer.canvas_$.height(); |
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1102 |
if (touch.pageX >= off.left && touch.pageX < (off.left + w) && touch.pageY >= off.top && touch.pageY < (off.top + h)) {
|
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1103 |
if (elementDropped) {
|
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1104 |
_this.renderer.onMouseMove(touch, true); |
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1105 |
} else {
|
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1106 |
elementDropped = true; |
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1107 |
var div = document.createElement('div');
|
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1108 |
div.appendChild(this.cloneNode(true)); |
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1109 |
_this.renderer.dropData({
|
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1110 |
"text/html": div.innerHTML |
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1111 |
}, touch); |
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1112 |
_this.renderer.onMouseDown(touch, true); |
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1113 |
} |
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1114 |
} |
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1115 |
}).on("touchend", ".Rk-Bin-Item", function(e) {
|
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1116 |
if (elementDropped) {
|
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1117 |
_this.renderer.onMouseUp(e.originalEvent.changedTouches[0], true); |
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1118 |
} |
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1119 |
elementDropped = false; |
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1120 |
}).on("dragstart", ".Rk-Bin-Item", function(e) {
|
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1121 |
var div = document.createElement('div');
|
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1122 |
div.appendChild(this.cloneNode(true)); |
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1123 |
try {
|
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1124 |
e.originalEvent.dataTransfer.setData("text/html", div.innerHTML);
|
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1125 |
} catch (err) {
|
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1126 |
e.originalEvent.dataTransfer.setData("text", div.innerHTML);
|
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1127 |
} |
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1128 |
}); |
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1129 |
|
| 442 | 1130 |
} |
|
444
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1131 |
|
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1132 |
Rkns.$(window).resize(function() {
|
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1133 |
_this.resizeBins(); |
| 442 | 1134 |
}); |
1135 |
||
|
444
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1136 |
var lastsearch = false, |
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1137 |
lastval = ''; |
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1138 |
|
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1139 |
this.$.find(".Rk-Bins-Search-Input").on("change keyup paste input", function() {
|
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1140 |
var val = Rkns.$(this).val(); |
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1141 |
if (val === lastval) {
|
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1142 |
return; |
| 442 | 1143 |
} |
|
444
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1144 |
var search = Rkns.Utils.regexpFromTextOrArray(val.length > 1 ? val : null); |
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1145 |
if (search.source === lastsearch) {
|
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1146 |
return; |
| 442 | 1147 |
} |
|
444
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1148 |
lastsearch = search.source; |
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1149 |
_.each(_this.tabs, function(tab) {
|
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1150 |
tab.render(search); |
| 442 | 1151 |
}); |
1152 |
||
|
444
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1153 |
}); |
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1154 |
this.$.find(".Rk-Bins-Search-Form").submit(function() {
|
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1155 |
return false; |
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1156 |
}); |
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1157 |
}; |
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1158 |
|
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1159 |
Renkan.prototype.translate = function(_text) {
|
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1160 |
if (Rkns.i18n[this.options.language] && Rkns.i18n[this.options.language][_text]) {
|
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1161 |
return Rkns.i18n[this.options.language][_text]; |
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1162 |
} |
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1163 |
if (this.options.language.length > 2 && Rkns.i18n[this.options.language.substr(0, 2)] && Rkns.i18n[this.options.language.substr(0, 2)][_text]) {
|
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1164 |
return Rkns.i18n[this.options.language.substr(0, 2)][_text]; |
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1165 |
} |
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1166 |
return _text; |
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1167 |
}; |
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1168 |
|
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1169 |
Renkan.prototype.onStatusChange = function() {
|
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1170 |
this.renderer.onStatusChange(); |
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1171 |
}; |
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1172 |
|
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1173 |
Renkan.prototype.setSearchEngine = function(_key) {
|
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1174 |
this.search_engine = this.search_engines[_key]; |
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1175 |
this.$.find(".Rk-Search-Current").attr("class", "Rk-Search-Current " + this.search_engine.getBgClass());
|
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1176 |
var listClasses = this.search_engine.getBgClass().split(" ");
|
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1177 |
var classes = ""; |
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1178 |
for (var i = 0; i < listClasses.length; i++) {
|
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1179 |
classes += "." + listClasses[i]; |
| 442 | 1180 |
} |
|
444
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1181 |
this.$.find(".Rk-Web-Search-Input.Rk-Search-Input").attr("placeholder", this.translate("Search in ") + this.$.find(".Rk-Search-List " + classes).html());
|
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1182 |
}; |
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1183 |
|
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1184 |
Renkan.prototype.resizeBins = function() {
|
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1185 |
var _d = +this.$.find(".Rk-Bins-Head").outerHeight();
|
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1186 |
this.$.find(".Rk-Bin-Title:visible").each(function() {
|
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1187 |
_d += Rkns.$(this).outerHeight(); |
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1188 |
}); |
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1189 |
this.$.find(".Rk-Bin-Main").css({
|
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1190 |
height: this.$.find(".Rk-Bins").height() - _d
|
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1191 |
}); |
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1192 |
}; |
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1193 |
|
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1194 |
/* Utility functions */ |
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1195 |
var getUUID4 = function() {
|
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1196 |
return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function(c) {
|
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1197 |
var r = Math.random() * 16 | 0, |
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1198 |
v = c === 'x' ? r : (r & 0x3 | 0x8); |
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1199 |
return v.toString(16); |
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1200 |
}); |
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1201 |
}; |
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1202 |
|
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1203 |
Rkns.Utils = {
|
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1204 |
getUUID4: getUUID4, |
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1205 |
getUID: (function() {
|
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1206 |
function pad(n) {
|
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1207 |
return n < 10 ? '0' + n : n; |
| 442 | 1208 |
} |
|
444
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1209 |
var _d = new Date(), |
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1210 |
ID_AUTO_INCREMENT = 0, |
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1211 |
ID_BASE = _d.getUTCFullYear() + '-' + |
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1212 |
pad(_d.getUTCMonth() + 1) + '-' + |
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1213 |
pad(_d.getUTCDate()) + '-' + |
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1214 |
getUUID4(); |
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1215 |
return function(_base) {
|
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1216 |
var _n = (++ID_AUTO_INCREMENT).toString(16), |
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1217 |
_uidbase = (typeof _base === "undefined" ? "" : _base + "-"); |
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1218 |
while (_n.length < 4) {
|
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1219 |
_n = '0' + _n; |
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1220 |
} |
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1221 |
return _uidbase + ID_BASE + '-' + _n; |
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1222 |
}; |
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1223 |
})(), |
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1224 |
getFullURL: function(url) {
|
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1225 |
|
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1226 |
if (typeof(url) === 'undefined' || url == null) {
|
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1227 |
return ""; |
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1228 |
} |
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1229 |
if (/https?:\/\//.test(url)) {
|
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1230 |
return url; |
| 442 | 1231 |
} |
|
444
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1232 |
var img = new Image(); |
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1233 |
img.src = url; |
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1234 |
var res = img.src; |
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1235 |
img.src = null; |
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1236 |
return res; |
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1237 |
|
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1238 |
}, |
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1239 |
inherit: function(_baseClass, _callbefore) {
|
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1240 |
|
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1241 |
var _class = function(_arg) {
|
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1242 |
if (typeof _callbefore === "function") {
|
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1243 |
_callbefore.apply(this, Array.prototype.slice.call(arguments, 0)); |
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1244 |
} |
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1245 |
_baseClass.apply(this, Array.prototype.slice.call(arguments, 0)); |
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1246 |
if (typeof this._init === "function" && !this._initialized) {
|
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1247 |
this._init.apply(this, Array.prototype.slice.call(arguments, 0)); |
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1248 |
this._initialized = true; |
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1249 |
} |
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1250 |
}; |
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1251 |
_.extend(_class.prototype, _baseClass.prototype); |
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1252 |
|
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1253 |
return _class; |
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1254 |
|
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1255 |
}, |
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1256 |
regexpFromTextOrArray: (function() {
|
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1257 |
var charsub = [ |
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1258 |
'[aáàâä]', |
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1259 |
'[cç]', |
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1260 |
'[eéèêë]', |
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1261 |
'[iíìîï]', |
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1262 |
'[oóòôö]', |
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1263 |
'[uùûü]' |
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1264 |
], |
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1265 |
removeChars = [ |
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1266 |
String.fromCharCode(768), String.fromCharCode(769), String.fromCharCode(770), String.fromCharCode(771), String.fromCharCode(807), |
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1267 |
"{", "}", "(", ")", "[", "]", "【", "】", "、", "・", "‥", "。", "「", "」", "『", "』", "〜", ":", "!", "?", " ", |
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1268 |
",", " ", ";", "(", ")", ".", "*", "+", "\\", "?", "|", "{", "}", "[", "]", "^", "#", "/"
|
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1269 |
], |
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1270 |
remsrc = "[\\" + removeChars.join("\\") + "]",
|
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1271 |
remrx = new RegExp(remsrc, "gm"), |
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1272 |
charsrx = _.map(charsub, function(c) {
|
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1273 |
return new RegExp(c); |
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1274 |
}); |
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1275 |
|
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1276 |
function replaceText(_text) {
|
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1277 |
var txt = _text.toLowerCase().replace(remrx, ""), |
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1278 |
src = ""; |
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1279 |
|
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1280 |
function makeReplaceFunc(l) {
|
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1281 |
return function(k, v) {
|
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1282 |
l = l.replace(charsrx[k], v); |
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1283 |
}; |
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1284 |
} |
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1285 |
for (var j = 0; j < txt.length; j++) {
|
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1286 |
if (j) {
|
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1287 |
src += remsrc + "*"; |
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1288 |
} |
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1289 |
var l = txt[j]; |
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1290 |
_.each(charsub, makeReplaceFunc(l)); |
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1291 |
src += l; |
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1292 |
} |
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1293 |
return src; |
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1294 |
} |
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1295 |
|
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1296 |
function getSource(inp) {
|
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1297 |
switch (typeof inp) {
|
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1298 |
case "string": |
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1299 |
return replaceText(inp); |
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1300 |
case "object": |
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1301 |
var src = ''; |
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1302 |
_.each(inp, function(v) {
|
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1303 |
var res = getSource(v); |
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1304 |
if (res) {
|
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1305 |
if (src) {
|
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1306 |
src += '|'; |
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1307 |
} |
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1308 |
src += res; |
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1309 |
} |
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1310 |
}); |
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1311 |
return src; |
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1312 |
} |
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1313 |
return ''; |
| 442 | 1314 |
} |
|
444
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1315 |
|
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1316 |
return function(_textOrArray) {
|
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1317 |
var source = getSource(_textOrArray); |
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1318 |
if (source) {
|
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1319 |
var testrx = new RegExp(source, "im"), |
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1320 |
replacerx = new RegExp('(' + source + ')', "igm");
|
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1321 |
return {
|
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1322 |
isempty: false, |
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1323 |
source: source, |
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1324 |
test: function(_t) {
|
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1325 |
return testrx.test(_t); |
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1326 |
}, |
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1327 |
replace: function(_text, _replace) {
|
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1328 |
return _text.replace(replacerx, _replace); |
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1329 |
} |
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1330 |
}; |
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1331 |
} else {
|
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1332 |
return {
|
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1333 |
isempty: true, |
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1334 |
source: '', |
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1335 |
test: function() {
|
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1336 |
return true; |
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1337 |
}, |
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1338 |
replace: function(_text) {
|
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1339 |
return text; |
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1340 |
} |
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1341 |
}; |
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1342 |
} |
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1343 |
}; |
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1344 |
})(), |
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1345 |
/* The minimum distance (in pixels) the mouse has to move to consider an element was dragged */ |
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1346 |
_MIN_DRAG_DISTANCE: 2, |
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1347 |
/* Distance between the inner and outer radius of buttons that appear when hovering on a node */ |
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1348 |
_NODE_BUTTON_WIDTH: 40, |
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1349 |
|
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1350 |
_EDGE_BUTTON_INNER: 2, |
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1351 |
_EDGE_BUTTON_OUTER: 40, |
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1352 |
/* Constants used to know if a specific action is to be performed when clicking on the canvas */ |
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1353 |
_CLICKMODE_ADDNODE: 1, |
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1354 |
_CLICKMODE_STARTEDGE: 2, |
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1355 |
_CLICKMODE_ENDEDGE: 3, |
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1356 |
/* Node size step: Used to calculate the size change when clicking the +/- buttons */ |
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1357 |
_NODE_SIZE_STEP: Math.LN2 / 4, |
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1358 |
_MIN_SCALE: 1 / 20, |
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1359 |
_MAX_SCALE: 20, |
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1360 |
_MOUSEMOVE_RATE: 80, |
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1361 |
_DOUBLETAP_DELAY: 800, |
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1362 |
/* Maximum distance in pixels (squared, to reduce calculations) |
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1363 |
* between two taps when double-tapping on a touch terminal */ |
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1364 |
_DOUBLETAP_DISTANCE: 20 * 20, |
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1365 |
/* A placeholder so a default colour is displayed when a node has a null value for its user property */ |
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1366 |
_USER_PLACEHOLDER: function(_renkan) {
|
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1367 |
return {
|
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1368 |
color: _renkan.options.default_user_color, |
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1369 |
title: _renkan.translate("(unknown user)"),
|
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1370 |
get: function(attr) {
|
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1371 |
return this[attr] || false; |
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1372 |
} |
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1373 |
}; |
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1374 |
}, |
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1375 |
/* The code for the "Drag and Add Bookmarklet", slightly minified and with whitespaces removed, though |
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1376 |
* it doesn't seem that it's still a requirement in newer browsers (i.e. the ones compatibles with canvas drawing) |
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1377 |
*/ |
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1378 |
_BOOKMARKLET_CODE: function(_renkan) {
|
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1379 |
return "(function(a,b,c,d,e,f,h,i,j,k,l,m,n,o,p,q,r){a=document;b=a.body;c=a.location.href;j='draggable';m='text/x-iri-';d=a.createElement('div');d.innerHTML='<p_style=\"position:fixed;top:0;right:0;font:bold_18px_sans-serif;color:#fff;background:#909;padding:10px;z-index:100000;\">" +
|
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1380 |
_renkan.translate("Drag items from this website, drop them in Renkan").replace(/ /g, "_") +
|
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1381 |
"</p>'.replace(/_/g,String.fromCharCode(32));b.appendChild(d);e=[{r:/https?:\\/\\/[^\\/]*twitter\\.com\\//,s:'.tweet',n:'twitter'},{r:/https?:\\/\\/[^\\/]*google\\.[^\\/]+\\//,s:'.g',n:'google'},{r:/https?:\\/\\/[^\\/]*lemonde\\.fr\\//,s:'[data-vr-contentbox]',n:'lemonde'}];f=false;e.forEach(function(g){if(g.r.test(c)){f=g;}});if(f){h=function(){Array.prototype.forEach.call(a.querySelectorAll(f.s),function(i){i[j]=true;k=i.style;k.borderWidth='2px';k.borderColor='#909';k.borderStyle='solid';k.backgroundColor='rgba(200,0,180,.1)';})};window.setInterval(h,500);h();};a.addEventListener('dragstart',function(k){l=k.dataTransfer;l.setData(m+'source-uri',c);l.setData(m+'source-title',a.title);n=k.target;if(f){o=n;while(!o.attributes[j]){o=o.parentNode;if(o==b){break;}}}if(f&&o.attributes[j]){p=o.cloneNode(true);l.setData(m+'specific-site',f.n)}else{q=a.getSelection();if(q.type==='Range'||!q.type){p=q.getRangeAt(0).cloneContents();}else{p=n.cloneNode();}}r=a.createElement('div');r.appendChild(p);l.setData('text/x-iri-selected-text',r.textContent.trim());l.setData('text/x-iri-selected-html',r.innerHTML);},false);})();";
|
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1382 |
}, |
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1383 |
/* Shortens text to the required length then adds ellipsis */ |
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1384 |
shortenText: function(_text, _maxlength) {
|
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1385 |
return (_text.length > _maxlength ? (_text.substr(0, _maxlength) + '…') : _text); |
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1386 |
}, |
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1387 |
/* Drawing an edit box with an arrow and positioning the edit box according to the position of the node/edge being edited |
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1388 |
* Called by Rkns.Renderer.NodeEditor and Rkns.Renderer.EdgeEditor */ |
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1389 |
drawEditBox: function(_options, _coords, _path, _xmargin, _selector) {
|
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1390 |
_selector.css({
|
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1391 |
width: (_options.tooltip_width - 2 * _options.tooltip_padding) |
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1392 |
}); |
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1393 |
var _height = _selector.outerHeight() + 2 * _options.tooltip_padding, |
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1394 |
_isLeft = (_coords.x < paper.view.center.x ? 1 : -1), |
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1395 |
_left = _coords.x + _isLeft * (_xmargin + _options.tooltip_arrow_length), |
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1396 |
_right = _coords.x + _isLeft * (_xmargin + _options.tooltip_arrow_length + _options.tooltip_width), |
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1397 |
_top = _coords.y - _height / 2; |
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1398 |
if (_top + _height > (paper.view.size.height - _options.tooltip_margin)) {
|
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1399 |
_top = Math.max(paper.view.size.height - _options.tooltip_margin, _coords.y + _options.tooltip_arrow_width / 2) - _height; |
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1400 |
} |
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1401 |
if (_top < _options.tooltip_margin) {
|
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1402 |
_top = Math.min(_options.tooltip_margin, _coords.y - _options.tooltip_arrow_width / 2); |
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1403 |
} |
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1404 |
var _bottom = _top + _height; |
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1405 |
/* jshint laxbreak:true */ |
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1406 |
_path.segments[0].point = _path.segments[7].point = _coords.add([_isLeft * _xmargin, 0]); |
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1407 |
_path.segments[1].point.x = _path.segments[2].point.x = _path.segments[5].point.x = _path.segments[6].point.x = _left; |
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1408 |
_path.segments[3].point.x = _path.segments[4].point.x = _right; |
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1409 |
_path.segments[2].point.y = _path.segments[3].point.y = _top; |
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1410 |
_path.segments[4].point.y = _path.segments[5].point.y = _bottom; |
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1411 |
_path.segments[1].point.y = _coords.y - _options.tooltip_arrow_width / 2; |
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1412 |
_path.segments[6].point.y = _coords.y + _options.tooltip_arrow_width / 2; |
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1413 |
_path.closed = true; |
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1414 |
_path.fillColor = new paper.GradientColor(new paper.Gradient([_options.tooltip_top_color, _options.tooltip_bottom_color]), [0, _top], [0, _bottom]); |
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1415 |
_selector.css({
|
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1416 |
left: (_options.tooltip_padding + Math.min(_left, _right)), |
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1417 |
top: (_options.tooltip_padding + _top) |
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1418 |
}); |
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1419 |
return _path; |
|
460
bdf851bb1c4f
add style to node and edge in java. implement data migration for schema version 2
ymh <ymh.work@gmail.com>
parents:
444
diff
changeset
|
1420 |
}, |
|
bdf851bb1c4f
add style to node and edge in java. implement data migration for schema version 2
ymh <ymh.work@gmail.com>
parents:
444
diff
changeset
|
1421 |
// from http://stackoverflow.com/a/6444043 |
|
bdf851bb1c4f
add style to node and edge in java. implement data migration for schema version 2
ymh <ymh.work@gmail.com>
parents:
444
diff
changeset
|
1422 |
increaseBrightness: function (hex, percent){
|
|
bdf851bb1c4f
add style to node and edge in java. implement data migration for schema version 2
ymh <ymh.work@gmail.com>
parents:
444
diff
changeset
|
1423 |
// strip the leading # if it's there |
|
bdf851bb1c4f
add style to node and edge in java. implement data migration for schema version 2
ymh <ymh.work@gmail.com>
parents:
444
diff
changeset
|
1424 |
hex = hex.replace(/^\s*#|\s*$/g, ''); |
|
bdf851bb1c4f
add style to node and edge in java. implement data migration for schema version 2
ymh <ymh.work@gmail.com>
parents:
444
diff
changeset
|
1425 |
|
|
bdf851bb1c4f
add style to node and edge in java. implement data migration for schema version 2
ymh <ymh.work@gmail.com>
parents:
444
diff
changeset
|
1426 |
// convert 3 char codes --> 6, e.g. `E0F` --> `EE00FF` |
|
bdf851bb1c4f
add style to node and edge in java. implement data migration for schema version 2
ymh <ymh.work@gmail.com>
parents:
444
diff
changeset
|
1427 |
if(hex.length === 3){
|
|
bdf851bb1c4f
add style to node and edge in java. implement data migration for schema version 2
ymh <ymh.work@gmail.com>
parents:
444
diff
changeset
|
1428 |
hex = hex.replace(/(.)/g, '$1$1'); |
|
bdf851bb1c4f
add style to node and edge in java. implement data migration for schema version 2
ymh <ymh.work@gmail.com>
parents:
444
diff
changeset
|
1429 |
} |
|
bdf851bb1c4f
add style to node and edge in java. implement data migration for schema version 2
ymh <ymh.work@gmail.com>
parents:
444
diff
changeset
|
1430 |
|
|
bdf851bb1c4f
add style to node and edge in java. implement data migration for schema version 2
ymh <ymh.work@gmail.com>
parents:
444
diff
changeset
|
1431 |
var r = parseInt(hex.substr(0, 2), 16), |
|
bdf851bb1c4f
add style to node and edge in java. implement data migration for schema version 2
ymh <ymh.work@gmail.com>
parents:
444
diff
changeset
|
1432 |
g = parseInt(hex.substr(2, 2), 16), |
|
bdf851bb1c4f
add style to node and edge in java. implement data migration for schema version 2
ymh <ymh.work@gmail.com>
parents:
444
diff
changeset
|
1433 |
b = parseInt(hex.substr(4, 2), 16); |
|
bdf851bb1c4f
add style to node and edge in java. implement data migration for schema version 2
ymh <ymh.work@gmail.com>
parents:
444
diff
changeset
|
1434 |
|
|
bdf851bb1c4f
add style to node and edge in java. implement data migration for schema version 2
ymh <ymh.work@gmail.com>
parents:
444
diff
changeset
|
1435 |
return '#' + |
|
bdf851bb1c4f
add style to node and edge in java. implement data migration for schema version 2
ymh <ymh.work@gmail.com>
parents:
444
diff
changeset
|
1436 |
((0|(1<<8) + r + (256 - r) * percent / 100).toString(16)).substr(1) + |
|
bdf851bb1c4f
add style to node and edge in java. implement data migration for schema version 2
ymh <ymh.work@gmail.com>
parents:
444
diff
changeset
|
1437 |
((0|(1<<8) + g + (256 - g) * percent / 100).toString(16)).substr(1) + |
|
bdf851bb1c4f
add style to node and edge in java. implement data migration for schema version 2
ymh <ymh.work@gmail.com>
parents:
444
diff
changeset
|
1438 |
((0|(1<<8) + b + (256 - b) * percent / 100).toString(16)).substr(1); |
| 442 | 1439 |
} |
|
444
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1440 |
}; |
| 442 | 1441 |
})(window); |
1442 |
||
1443 |
/* END main.js */ |
|
1444 |
||
|
444
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1445 |
(function(root) {
|
| 488 | 1446 |
"use strict"; |
1447 |
||
1448 |
var Backbone = root.Backbone; |
|
1449 |
||
1450 |
var Router = root.Rkns.Router = Backbone.Router.extend({
|
|
1451 |
routes: {
|
|
1452 |
'': 'index' |
|
1453 |
}, |
|
1454 |
||
1455 |
index: function (parameters) {
|
|
1456 |
||
1457 |
var result = {};
|
|
1458 |
if (parameters === null){
|
|
1459 |
return; |
|
1460 |
} |
|
1461 |
parameters.split("&").forEach(function(part) {
|
|
1462 |
var item = part.split("=");
|
|
1463 |
result[item[0]] = decodeURIComponent(item[1]); |
|
1464 |
}); |
|
1465 |
this.trigger('router', result);
|
|
1466 |
} |
|
1467 |
}); |
|
1468 |
||
1469 |
})(window); |
|
1470 |
(function(root) {
|
|
|
444
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1471 |
|
| 442 | 1472 |
"use strict"; |
|
444
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1473 |
|
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1474 |
var DataLoader = root.Rkns.DataLoader = {
|
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1475 |
converters: {
|
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1476 |
from1to2: function(data) {
|
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1477 |
|
|
460
bdf851bb1c4f
add style to node and edge in java. implement data migration for schema version 2
ymh <ymh.work@gmail.com>
parents:
444
diff
changeset
|
1478 |
var i, len; |
|
bdf851bb1c4f
add style to node and edge in java. implement data migration for schema version 2
ymh <ymh.work@gmail.com>
parents:
444
diff
changeset
|
1479 |
if(typeof data.nodes !== 'undefined') {
|
|
bdf851bb1c4f
add style to node and edge in java. implement data migration for schema version 2
ymh <ymh.work@gmail.com>
parents:
444
diff
changeset
|
1480 |
for(i=0, len=data.nodes.length; i<len; i++) {
|
|
bdf851bb1c4f
add style to node and edge in java. implement data migration for schema version 2
ymh <ymh.work@gmail.com>
parents:
444
diff
changeset
|
1481 |
var node = data.nodes[i]; |
|
bdf851bb1c4f
add style to node and edge in java. implement data migration for schema version 2
ymh <ymh.work@gmail.com>
parents:
444
diff
changeset
|
1482 |
if(node.color) {
|
|
bdf851bb1c4f
add style to node and edge in java. implement data migration for schema version 2
ymh <ymh.work@gmail.com>
parents:
444
diff
changeset
|
1483 |
node.style = {
|
|
bdf851bb1c4f
add style to node and edge in java. implement data migration for schema version 2
ymh <ymh.work@gmail.com>
parents:
444
diff
changeset
|
1484 |
color: node.color, |
|
bdf851bb1c4f
add style to node and edge in java. implement data migration for schema version 2
ymh <ymh.work@gmail.com>
parents:
444
diff
changeset
|
1485 |
}; |
|
bdf851bb1c4f
add style to node and edge in java. implement data migration for schema version 2
ymh <ymh.work@gmail.com>
parents:
444
diff
changeset
|
1486 |
} |
|
bdf851bb1c4f
add style to node and edge in java. implement data migration for schema version 2
ymh <ymh.work@gmail.com>
parents:
444
diff
changeset
|
1487 |
else {
|
|
bdf851bb1c4f
add style to node and edge in java. implement data migration for schema version 2
ymh <ymh.work@gmail.com>
parents:
444
diff
changeset
|
1488 |
node.style = {};
|
|
bdf851bb1c4f
add style to node and edge in java. implement data migration for schema version 2
ymh <ymh.work@gmail.com>
parents:
444
diff
changeset
|
1489 |
} |
|
bdf851bb1c4f
add style to node and edge in java. implement data migration for schema version 2
ymh <ymh.work@gmail.com>
parents:
444
diff
changeset
|
1490 |
} |
|
bdf851bb1c4f
add style to node and edge in java. implement data migration for schema version 2
ymh <ymh.work@gmail.com>
parents:
444
diff
changeset
|
1491 |
} |
|
bdf851bb1c4f
add style to node and edge in java. implement data migration for schema version 2
ymh <ymh.work@gmail.com>
parents:
444
diff
changeset
|
1492 |
if(typeof data.edges !== 'undefined') {
|
|
bdf851bb1c4f
add style to node and edge in java. implement data migration for schema version 2
ymh <ymh.work@gmail.com>
parents:
444
diff
changeset
|
1493 |
for(i=0, len=data.edges.length; i<len; i++) {
|
|
bdf851bb1c4f
add style to node and edge in java. implement data migration for schema version 2
ymh <ymh.work@gmail.com>
parents:
444
diff
changeset
|
1494 |
var edge = data.edges[i]; |
|
bdf851bb1c4f
add style to node and edge in java. implement data migration for schema version 2
ymh <ymh.work@gmail.com>
parents:
444
diff
changeset
|
1495 |
if(edge.color) {
|
|
bdf851bb1c4f
add style to node and edge in java. implement data migration for schema version 2
ymh <ymh.work@gmail.com>
parents:
444
diff
changeset
|
1496 |
edge.style = {
|
|
bdf851bb1c4f
add style to node and edge in java. implement data migration for schema version 2
ymh <ymh.work@gmail.com>
parents:
444
diff
changeset
|
1497 |
color: edge.color, |
|
bdf851bb1c4f
add style to node and edge in java. implement data migration for schema version 2
ymh <ymh.work@gmail.com>
parents:
444
diff
changeset
|
1498 |
}; |
|
bdf851bb1c4f
add style to node and edge in java. implement data migration for schema version 2
ymh <ymh.work@gmail.com>
parents:
444
diff
changeset
|
1499 |
} |
|
bdf851bb1c4f
add style to node and edge in java. implement data migration for schema version 2
ymh <ymh.work@gmail.com>
parents:
444
diff
changeset
|
1500 |
else {
|
|
bdf851bb1c4f
add style to node and edge in java. implement data migration for schema version 2
ymh <ymh.work@gmail.com>
parents:
444
diff
changeset
|
1501 |
edge.style = {};
|
|
bdf851bb1c4f
add style to node and edge in java. implement data migration for schema version 2
ymh <ymh.work@gmail.com>
parents:
444
diff
changeset
|
1502 |
} |
|
bdf851bb1c4f
add style to node and edge in java. implement data migration for schema version 2
ymh <ymh.work@gmail.com>
parents:
444
diff
changeset
|
1503 |
} |
|
bdf851bb1c4f
add style to node and edge in java. implement data migration for schema version 2
ymh <ymh.work@gmail.com>
parents:
444
diff
changeset
|
1504 |
} |
|
bdf851bb1c4f
add style to node and edge in java. implement data migration for schema version 2
ymh <ymh.work@gmail.com>
parents:
444
diff
changeset
|
1505 |
|
|
bdf851bb1c4f
add style to node and edge in java. implement data migration for schema version 2
ymh <ymh.work@gmail.com>
parents:
444
diff
changeset
|
1506 |
data.schema_version = "2"; |
|
444
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1507 |
|
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1508 |
return data; |
|
460
bdf851bb1c4f
add style to node and edge in java. implement data migration for schema version 2
ymh <ymh.work@gmail.com>
parents:
444
diff
changeset
|
1509 |
}, |
|
444
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1510 |
} |
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1511 |
}; |
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1512 |
|
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1513 |
|
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1514 |
DataLoader.Loader = function(project, options) {
|
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1515 |
this.project = project; |
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1516 |
this.dataConverters = _.defaults(options.converters || {}, DataLoader.converters);
|
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1517 |
}; |
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1518 |
|
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1519 |
|
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1520 |
DataLoader.Loader.prototype.convert = function(data) {
|
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1521 |
var schemaVersionFrom = this.project.getSchemaVersion(data); |
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1522 |
var schemaVersionTo = this.project.getSchemaVersion(); |
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1523 |
|
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1524 |
if (schemaVersionFrom !== schemaVersionTo) {
|
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1525 |
var converterName = "from" + schemaVersionFrom + "to" + schemaVersionTo; |
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1526 |
if (typeof this.dataConverters[converterName] === 'function') {
|
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1527 |
data = this.dataConverters[converterName](data); |
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1528 |
} |
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1529 |
} |
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1530 |
return data; |
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1531 |
}; |
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1532 |
|
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1533 |
DataLoader.Loader.prototype.load = function(data) {
|
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1534 |
this.project.set(this.convert(data), {
|
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1535 |
validate: true |
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1536 |
}); |
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1537 |
}; |
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1538 |
|
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1539 |
})(window); |
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1540 |
|
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1541 |
(function(root) {
|
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1542 |
"use strict"; |
| 442 | 1543 |
|
1544 |
var Backbone = root.Backbone; |
|
1545 |
||
1546 |
var Models = root.Rkns.Models = {};
|
|
1547 |
||
1548 |
Models.getUID = function(obj) {
|
|
1549 |
var guid = 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, |
|
1550 |
function(c) {
|
|
1551 |
var r = Math.random() * 16 | 0, v = c === 'x' ? r |
|
1552 |
: (r & 0x3 | 0x8); |
|
1553 |
return v.toString(16); |
|
1554 |
}); |
|
1555 |
if (typeof obj !== 'undefined') {
|
|
1556 |
return obj.type + "-" + guid; |
|
1557 |
} |
|
1558 |
else {
|
|
1559 |
return guid; |
|
1560 |
} |
|
1561 |
}; |
|
1562 |
||
1563 |
var RenkanModel = Backbone.RelationalModel.extend({
|
|
1564 |
idAttribute : "_id", |
|
1565 |
constructor : function(options) {
|
|
1566 |
||
1567 |
if (typeof options !== "undefined") {
|
|
1568 |
options._id = options._id || options.id || Models.getUID(this); |
|
1569 |
options.title = options.title || ""; |
|
1570 |
options.description = options.description || ""; |
|
1571 |
options.uri = options.uri || ""; |
|
1572 |
||
1573 |
if (typeof this.prepare === "function") {
|
|
1574 |
options = this.prepare(options); |
|
1575 |
} |
|
1576 |
} |
|
1577 |
Backbone.RelationalModel.prototype.constructor.call(this, options); |
|
1578 |
}, |
|
1579 |
validate : function() {
|
|
1580 |
if (!this.type) {
|
|
1581 |
return "object has no type"; |
|
1582 |
} |
|
1583 |
}, |
|
1584 |
addReference : function(_options, _propName, _list, _id, _default) {
|
|
1585 |
var _element = _list.get(_id); |
|
1586 |
if (typeof _element === "undefined" && |
|
1587 |
typeof _default !== "undefined") {
|
|
1588 |
_options[_propName] = _default; |
|
1589 |
} |
|
1590 |
else {
|
|
1591 |
_options[_propName] = _element; |
|
1592 |
} |
|
1593 |
} |
|
1594 |
}); |
|
1595 |
||
1596 |
// USER |
|
1597 |
var User = Models.User = RenkanModel.extend({
|
|
1598 |
type : "user", |
|
1599 |
prepare : function(options) {
|
|
1600 |
options.color = options.color || "#666666"; |
|
1601 |
return options; |
|
1602 |
}, |
|
1603 |
toJSON : function() {
|
|
1604 |
return {
|
|
1605 |
_id : this.get("_id"),
|
|
1606 |
title : this.get("title"),
|
|
1607 |
uri : this.get("uri"),
|
|
1608 |
description : this.get("description"),
|
|
1609 |
color : this.get("color")
|
|
1610 |
}; |
|
1611 |
} |
|
1612 |
}); |
|
1613 |
||
1614 |
// NODE |
|
1615 |
var Node = Models.Node = RenkanModel.extend({
|
|
1616 |
type : "node", |
|
1617 |
relations : [ {
|
|
1618 |
type : Backbone.HasOne, |
|
1619 |
key : "created_by", |
|
1620 |
relatedModel : User |
|
1621 |
} ], |
|
1622 |
prepare : function(options) {
|
|
1623 |
var project = options.project; |
|
1624 |
this.addReference(options, "created_by", project.get("users"),
|
|
1625 |
options.created_by, project.current_user); |
|
1626 |
options.description = options.description || ""; |
|
1627 |
return options; |
|
1628 |
}, |
|
1629 |
toJSON : function() {
|
|
1630 |
return {
|
|
1631 |
_id : this.get("_id"),
|
|
1632 |
title : this.get("title"),
|
|
1633 |
uri : this.get("uri"),
|
|
1634 |
description : this.get("description"),
|
|
1635 |
position : this.get("position"),
|
|
1636 |
image : this.get("image"),
|
|
|
460
bdf851bb1c4f
add style to node and edge in java. implement data migration for schema version 2
ymh <ymh.work@gmail.com>
parents:
444
diff
changeset
|
1637 |
style : this.get("style"),
|
| 442 | 1638 |
created_by : this.get("created_by") ? this.get("created_by")
|
1639 |
.get("_id") : null,
|
|
1640 |
size : this.get("size"),
|
|
1641 |
clip_path : this.get("clip_path"),
|
|
| 456 | 1642 |
shape : this.get("shape"),
|
1643 |
type : this.get("type")
|
|
| 442 | 1644 |
}; |
1645 |
} |
|
1646 |
}); |
|
1647 |
||
1648 |
// EDGE |
|
1649 |
var Edge = Models.Edge = RenkanModel.extend({
|
|
1650 |
type : "edge", |
|
1651 |
relations : [ {
|
|
1652 |
type : Backbone.HasOne, |
|
1653 |
key : "created_by", |
|
1654 |
relatedModel : User |
|
1655 |
}, {
|
|
1656 |
type : Backbone.HasOne, |
|
1657 |
key : "from", |
|
1658 |
relatedModel : Node |
|
1659 |
}, {
|
|
1660 |
type : Backbone.HasOne, |
|
1661 |
key : "to", |
|
1662 |
relatedModel : Node |
|
1663 |
} ], |
|
1664 |
prepare : function(options) {
|
|
1665 |
var project = options.project; |
|
1666 |
this.addReference(options, "created_by", project.get("users"),
|
|
1667 |
options.created_by, project.current_user); |
|
1668 |
this.addReference(options, "from", project.get("nodes"),
|
|
1669 |
options.from); |
|
1670 |
this.addReference(options, "to", project.get("nodes"), options.to);
|
|
1671 |
return options; |
|
1672 |
}, |
|
1673 |
toJSON : function() {
|
|
1674 |
return {
|
|
1675 |
_id : this.get("_id"),
|
|
1676 |
title : this.get("title"),
|
|
1677 |
uri : this.get("uri"),
|
|
1678 |
description : this.get("description"),
|
|
1679 |
from : this.get("from") ? this.get("from").get("_id") : null,
|
|
1680 |
to : this.get("to") ? this.get("to").get("_id") : null,
|
|
|
460
bdf851bb1c4f
add style to node and edge in java. implement data migration for schema version 2
ymh <ymh.work@gmail.com>
parents:
444
diff
changeset
|
1681 |
style : this.get("style"),
|
| 442 | 1682 |
created_by : this.get("created_by") ? this.get("created_by")
|
1683 |
.get("_id") : null
|
|
1684 |
}; |
|
1685 |
} |
|
1686 |
}); |
|
1687 |
||
1688 |
// View |
|
1689 |
var View = Models.View = RenkanModel.extend({
|
|
1690 |
type : "view", |
|
1691 |
relations : [ {
|
|
1692 |
type : Backbone.HasOne, |
|
1693 |
key : "created_by", |
|
1694 |
relatedModel : User |
|
1695 |
} ], |
|
1696 |
prepare : function(options) {
|
|
1697 |
var project = options.project; |
|
1698 |
this.addReference(options, "created_by", project.get("users"),
|
|
1699 |
options.created_by, project.current_user); |
|
1700 |
options.description = options.description || ""; |
|
1701 |
if (typeof options.offset !== "undefined") {
|
|
1702 |
var offset = {};
|
|
1703 |
if (Array.isArray(options.offset)) {
|
|
1704 |
offset.x = options.offset[0]; |
|
1705 |
offset.y = options.offset.length > 1 ? options.offset[1] |
|
1706 |
: options.offset[0]; |
|
1707 |
} |
|
1708 |
else if (options.offset.x != null) {
|
|
1709 |
offset.x = options.offset.x; |
|
1710 |
offset.y = options.offset.y; |
|
1711 |
} |
|
1712 |
options.offset = offset; |
|
1713 |
} |
|
1714 |
return options; |
|
1715 |
}, |
|
1716 |
toJSON : function() {
|
|
1717 |
return {
|
|
1718 |
_id : this.get("_id"),
|
|
1719 |
zoom_level : this.get("zoom_level"),
|
|
1720 |
offset : this.get("offset"),
|
|
1721 |
title : this.get("title"),
|
|
1722 |
description : this.get("description"),
|
|
1723 |
created_by : this.get("created_by") ? this.get("created_by")
|
|
| 456 | 1724 |
.get("_id") : null,
|
1725 |
hidden_nodes: this.get("hidden_nodes")
|
|
| 442 | 1726 |
// Don't need project id |
1727 |
}; |
|
1728 |
} |
|
1729 |
}); |
|
1730 |
||
1731 |
// PROJECT |
|
1732 |
var Project = Models.Project = RenkanModel.extend({
|
|
|
460
bdf851bb1c4f
add style to node and edge in java. implement data migration for schema version 2
ymh <ymh.work@gmail.com>
parents:
444
diff
changeset
|
1733 |
schema_version : "2", |
| 442 | 1734 |
type : "project", |
|
460
bdf851bb1c4f
add style to node and edge in java. implement data migration for schema version 2
ymh <ymh.work@gmail.com>
parents:
444
diff
changeset
|
1735 |
blacklist : [ 'saveStatus', 'loadingStatus'], |
| 442 | 1736 |
relations : [ {
|
1737 |
type : Backbone.HasMany, |
|
1738 |
key : "users", |
|
1739 |
relatedModel : User, |
|
1740 |
reverseRelation : {
|
|
1741 |
key : 'project', |
|
1742 |
includeInJSON : '_id' |
|
1743 |
} |
|
1744 |
}, {
|
|
1745 |
type : Backbone.HasMany, |
|
1746 |
key : "nodes", |
|
1747 |
relatedModel : Node, |
|
1748 |
reverseRelation : {
|
|
1749 |
key : 'project', |
|
1750 |
includeInJSON : '_id' |
|
1751 |
} |
|
1752 |
}, {
|
|
1753 |
type : Backbone.HasMany, |
|
1754 |
key : "edges", |
|
1755 |
relatedModel : Edge, |
|
1756 |
reverseRelation : {
|
|
1757 |
key : 'project', |
|
1758 |
includeInJSON : '_id' |
|
1759 |
} |
|
1760 |
}, {
|
|
1761 |
type : Backbone.HasMany, |
|
1762 |
key : "views", |
|
1763 |
relatedModel : View, |
|
1764 |
reverseRelation : {
|
|
1765 |
key : 'project', |
|
1766 |
includeInJSON : '_id' |
|
1767 |
} |
|
1768 |
} ], |
|
1769 |
addUser : function(_props, _options) {
|
|
1770 |
_props.project = this; |
|
1771 |
var _user = User.findOrCreate(_props); |
|
1772 |
this.get("users").push(_user, _options);
|
|
1773 |
return _user; |
|
1774 |
}, |
|
1775 |
addNode : function(_props, _options) {
|
|
1776 |
_props.project = this; |
|
1777 |
var _node = Node.findOrCreate(_props); |
|
1778 |
this.get("nodes").push(_node, _options);
|
|
1779 |
return _node; |
|
1780 |
}, |
|
1781 |
addEdge : function(_props, _options) {
|
|
1782 |
_props.project = this; |
|
1783 |
var _edge = Edge.findOrCreate(_props); |
|
1784 |
this.get("edges").push(_edge, _options);
|
|
1785 |
return _edge; |
|
1786 |
}, |
|
1787 |
addView : function(_props, _options) {
|
|
1788 |
_props.project = this; |
|
1789 |
// TODO: check if need to replace with create only |
|
1790 |
var _view = View.findOrCreate(_props); |
|
1791 |
// TODO: Should we remember only one view? |
|
1792 |
this.get("views").push(_view, _options);
|
|
1793 |
return _view; |
|
1794 |
}, |
|
1795 |
removeNode : function(_model) {
|
|
1796 |
this.get("nodes").remove(_model);
|
|
1797 |
}, |
|
1798 |
removeEdge : function(_model) {
|
|
1799 |
this.get("edges").remove(_model);
|
|
1800 |
}, |
|
1801 |
validate : function(options) {
|
|
1802 |
var _project = this; |
|
1803 |
_.each( |
|
1804 |
[].concat(options.users, options.nodes, options.edges,options.views), |
|
1805 |
function(_item) {
|
|
1806 |
if (_item) {
|
|
1807 |
_item.project = _project; |
|
1808 |
} |
|
1809 |
} |
|
1810 |
); |
|
1811 |
}, |
|
|
444
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1812 |
getSchemaVersion : function(data) {
|
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1813 |
var t = data; |
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1814 |
if(typeof(t) === "undefined") {
|
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1815 |
t = this; |
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1816 |
} |
|
460
bdf851bb1c4f
add style to node and edge in java. implement data migration for schema version 2
ymh <ymh.work@gmail.com>
parents:
444
diff
changeset
|
1817 |
var version = t.schema_version; |
|
444
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1818 |
if(!version) {
|
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1819 |
return 1; |
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1820 |
} |
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1821 |
else {
|
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1822 |
return version; |
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1823 |
} |
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1824 |
}, |
| 442 | 1825 |
// Add event handler to remove edges when a node is removed |
1826 |
initialize : function() {
|
|
1827 |
var _this = this; |
|
1828 |
this.on("remove:nodes", function(_node) {
|
|
1829 |
_this.get("edges").remove(
|
|
1830 |
_this.get("edges").filter(
|
|
1831 |
function(_edge) {
|
|
1832 |
return _edge.get("from") === _node ||
|
|
1833 |
_edge.get("to") === _node;
|
|
1834 |
})); |
|
1835 |
}); |
|
1836 |
}, |
|
1837 |
toJSON : function() {
|
|
1838 |
var json = _.clone(this.attributes); |
|
1839 |
for ( var attr in json) {
|
|
1840 |
if ((json[attr] instanceof Backbone.Model) || |
|
1841 |
(json[attr] instanceof Backbone.Collection) || |
|
1842 |
(json[attr] instanceof RenkanModel)) {
|
|
1843 |
json[attr] = json[attr].toJSON(); |
|
1844 |
} |
|
1845 |
} |
|
1846 |
return _.omit(json, this.blacklist); |
|
1847 |
} |
|
1848 |
}); |
|
1849 |
||
1850 |
var RosterUser = Models.RosterUser = Backbone.Model |
|
1851 |
.extend({
|
|
1852 |
type : "roster_user", |
|
1853 |
idAttribute : "_id", |
|
1854 |
||
1855 |
constructor : function(options) {
|
|
1856 |
||
1857 |
if (typeof options !== "undefined") {
|
|
1858 |
options._id = options._id || |
|
1859 |
options.id || |
|
1860 |
Models.getUID(this); |
|
1861 |
options.title = options.title || "(untitled " + this.type + ")"; |
|
1862 |
options.description = options.description || ""; |
|
1863 |
options.uri = options.uri || ""; |
|
1864 |
options.project = options.project || null; |
|
1865 |
options.site_id = options.site_id || 0; |
|
1866 |
||
1867 |
if (typeof this.prepare === "function") {
|
|
1868 |
options = this.prepare(options); |
|
1869 |
} |
|
1870 |
} |
|
1871 |
Backbone.Model.prototype.constructor.call(this, options); |
|
1872 |
}, |
|
1873 |
||
1874 |
validate : function() {
|
|
1875 |
if (!this.type) {
|
|
1876 |
return "object has no type"; |
|
1877 |
} |
|
1878 |
}, |
|
1879 |
||
1880 |
prepare : function(options) {
|
|
1881 |
options.color = options.color || "#666666"; |
|
1882 |
return options; |
|
1883 |
}, |
|
1884 |
||
1885 |
toJSON : function() {
|
|
1886 |
return {
|
|
1887 |
_id : this.get("_id"),
|
|
1888 |
title : this.get("title"),
|
|
1889 |
uri : this.get("uri"),
|
|
1890 |
description : this.get("description"),
|
|
1891 |
color : this.get("color"),
|
|
1892 |
project : (this.get("project") != null) ? this.get(
|
|
1893 |
"project").get("id") : null,
|
|
1894 |
site_id : this.get("site_id")
|
|
1895 |
}; |
|
1896 |
} |
|
1897 |
}); |
|
1898 |
||
1899 |
var UsersList = Models.UsersList = Backbone.Collection.extend({
|
|
1900 |
model : RosterUser |
|
1901 |
}); |
|
1902 |
||
|
444
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
1903 |
})(window); |
| 442 | 1904 |
|
1905 |
Rkns.defaults = {
|
|
1906 |
||
1907 |
language: (navigator.language || navigator.userLanguage || "en"), |
|
1908 |
/* GUI Language */ |
|
1909 |
container: "renkan", |
|
1910 |
/* GUI Container DOM element ID */ |
|
1911 |
search: [], |
|
1912 |
/* List of Search Engines */ |
|
1913 |
bins: [], |
|
1914 |
/* List of Bins */ |
|
1915 |
static_url: "", |
|
1916 |
/* URL for static resources */ |
|
| 456 | 1917 |
popup_editor: true, |
1918 |
/* show the node editor as a popup inside the renkan view */ |
|
1919 |
editor_panel: 'editor-panel', |
|
1920 |
/* GUI continer DOM element ID of the editor panel */ |
|
| 442 | 1921 |
show_bins: true, |
1922 |
/* Show bins in left column */ |
|
1923 |
properties: [], |
|
1924 |
/* Semantic properties for edges */ |
|
1925 |
show_editor: true, |
|
1926 |
/* Show the graph editor... Setting this to "false" only shows the bins part ! */ |
|
1927 |
read_only: false, |
|
1928 |
/* Allows editing of renkan without changing the rest of the GUI. Can be switched on/off on the fly to block/enable editing */ |
|
1929 |
editor_mode: true, |
|
1930 |
/* Switch for Publish/Edit GUI. If editor_mode is false, read_only will be true. */ |
|
1931 |
manual_save: false, |
|
1932 |
/* In snapshot mode, clicking on the floppy will save a snapshot. Otherwise, it will show the connection status */ |
|
1933 |
show_top_bar: true, |
|
1934 |
/* Show the top bar, (title, buttons, users) */ |
|
1935 |
default_user_color: "#303030", |
|
1936 |
size_bug_fix: true, |
|
1937 |
/* Resize the canvas after load (fixes a bug on iPad and FF Mac) */ |
|
1938 |
force_resize: false, |
|
1939 |
allow_double_click: true, |
|
1940 |
/* Allows Double Click to create a node on an empty background */ |
|
1941 |
zoom_on_scroll: true, |
|
1942 |
/* Allows to use the scrollwheel to zoom */ |
|
1943 |
element_delete_delay: 0, |
|
1944 |
/* Delay between clicking on the bin on an element and really deleting it |
|
1945 |
Set to 0 for delete confirm */ |
|
1946 |
autoscale_padding: 50, |
|
1947 |
resize: true, |
|
|
460
bdf851bb1c4f
add style to node and edge in java. implement data migration for schema version 2
ymh <ymh.work@gmail.com>
parents:
444
diff
changeset
|
1948 |
|
| 442 | 1949 |
/* zoom options */ |
1950 |
show_zoom: true, |
|
1951 |
/* show zoom buttons */ |
|
1952 |
save_view: true, |
|
1953 |
/* show buttons to save view */ |
|
1954 |
default_view: false, |
|
1955 |
/* Allows to load default view (zoom+offset) at start on read_only mode, instead of autoScale. the default_view will be the last */ |
|
|
460
bdf851bb1c4f
add style to node and edge in java. implement data migration for schema version 2
ymh <ymh.work@gmail.com>
parents:
444
diff
changeset
|
1956 |
|
|
bdf851bb1c4f
add style to node and edge in java. implement data migration for schema version 2
ymh <ymh.work@gmail.com>
parents:
444
diff
changeset
|
1957 |
|
| 442 | 1958 |
/* TOP BAR BUTTONS */ |
1959 |
show_search_field: true, |
|
1960 |
show_user_list: true, |
|
1961 |
user_name_editable: true, |
|
1962 |
user_color_editable: true, |
|
1963 |
show_user_color: true, |
|
1964 |
show_save_button: true, |
|
1965 |
show_export_button: true, |
|
1966 |
show_open_button: false, |
|
1967 |
show_addnode_button: true, |
|
1968 |
show_addedge_button: true, |
|
1969 |
show_bookmarklet: true, |
|
1970 |
show_fullscreen_button: true, |
|
1971 |
home_button_url: false, |
|
1972 |
home_button_title: "Home", |
|
1973 |
||
1974 |
/* MINI-MAP OPTIONS */ |
|
1975 |
||
1976 |
show_minimap: true, |
|
1977 |
/* Show a small map at the bottom right */ |
|
1978 |
minimap_width: 160, |
|
1979 |
minimap_height: 120, |
|
1980 |
minimap_padding: 20, |
|
1981 |
minimap_background_color: "#ffffff", |
|
1982 |
minimap_border_color: "#cccccc", |
|
1983 |
minimap_highlight_color: "#ffff00", |
|
1984 |
minimap_highlight_weight: 5, |
|
|
460
bdf851bb1c4f
add style to node and edge in java. implement data migration for schema version 2
ymh <ymh.work@gmail.com>
parents:
444
diff
changeset
|
1985 |
|
| 442 | 1986 |
|
1987 |
/* EDGE/NODE COMMON OPTIONS */ |
|
1988 |
||
1989 |
buttons_background: "#202020", |
|
1990 |
buttons_label_color: "#c000c0", |
|
1991 |
buttons_label_font_size: 9, |
|
1992 |
||
|
463
41325cc50574
make hidden nodes work on java + correct projects export
ymh <ymh.work@gmail.com>
parents:
461
diff
changeset
|
1993 |
ghost_opacity : 0.3, |
|
41325cc50574
make hidden nodes work on java + correct projects export
ymh <ymh.work@gmail.com>
parents:
461
diff
changeset
|
1994 |
/* opacity when the hidden element is revealed */ |
|
460
bdf851bb1c4f
add style to node and edge in java. implement data migration for schema version 2
ymh <ymh.work@gmail.com>
parents:
444
diff
changeset
|
1995 |
default_dash_array : [4, 5], |
|
463
41325cc50574
make hidden nodes work on java + correct projects export
ymh <ymh.work@gmail.com>
parents:
461
diff
changeset
|
1996 |
/* dash line genometry */ |
|
460
bdf851bb1c4f
add style to node and edge in java. implement data migration for schema version 2
ymh <ymh.work@gmail.com>
parents:
444
diff
changeset
|
1997 |
|
| 442 | 1998 |
/* NODE DISPLAY OPTIONS */ |
1999 |
||
2000 |
show_node_circles: true, |
|
2001 |
/* Show circles for nodes */ |
|
2002 |
clip_node_images: true, |
|
2003 |
/* Constraint node images to circles */ |
|
2004 |
node_images_fill_mode: false, |
|
2005 |
/* Set to false for "letterboxing" (height/width of node adapted to show full image) |
|
2006 |
Set to true for "crop" (adapted to fill circle) */ |
|
2007 |
node_size_base: 25, |
|
2008 |
node_stroke_width: 2, |
|
|
460
bdf851bb1c4f
add style to node and edge in java. implement data migration for schema version 2
ymh <ymh.work@gmail.com>
parents:
444
diff
changeset
|
2009 |
node_stroke_max_width: 12, |
| 442 | 2010 |
selected_node_stroke_width: 4, |
|
460
bdf851bb1c4f
add style to node and edge in java. implement data migration for schema version 2
ymh <ymh.work@gmail.com>
parents:
444
diff
changeset
|
2011 |
selected_node_stroke_max_width: 24, |
|
bdf851bb1c4f
add style to node and edge in java. implement data migration for schema version 2
ymh <ymh.work@gmail.com>
parents:
444
diff
changeset
|
2012 |
node_stroke_witdh_scale: 5, |
| 442 | 2013 |
node_fill_color: "#ffffff", |
2014 |
highlighted_node_fill_color: "#ffff00", |
|
2015 |
node_label_distance: 5, |
|
2016 |
/* Vertical distance between node and label */ |
|
2017 |
node_label_max_length: 60, |
|
2018 |
/* Maximum displayed text length */ |
|
2019 |
label_untitled_nodes: "(untitled)", |
|
2020 |
/* Label to display on untitled nodes */ |
|
| 488 | 2021 |
hide_nodes: true, |
| 489 | 2022 |
/* allow hide/show nodes */ |
| 442 | 2023 |
change_shapes: true, |
2024 |
/* Change shapes enabled */ |
|
| 488 | 2025 |
change_types: true, |
2026 |
/* Change type enabled */ |
|
2027 |
||
2028 |
/* NODE EDITOR TEMPLATE*/ |
|
2029 |
||
2030 |
node_editor_templates: {
|
|
2031 |
"default": "templates/nodeeditor_readonly.html", |
|
2032 |
"video": "templates/nodeeditor_video.html" |
|
2033 |
}, |
|
| 442 | 2034 |
|
2035 |
/* EDGE DISPLAY OPTIONS */ |
|
2036 |
||
2037 |
edge_stroke_width: 2, |
|
|
460
bdf851bb1c4f
add style to node and edge in java. implement data migration for schema version 2
ymh <ymh.work@gmail.com>
parents:
444
diff
changeset
|
2038 |
edge_stroke_max_width: 12, |
| 442 | 2039 |
selected_edge_stroke_width: 4, |
|
460
bdf851bb1c4f
add style to node and edge in java. implement data migration for schema version 2
ymh <ymh.work@gmail.com>
parents:
444
diff
changeset
|
2040 |
selected_edge_stroke_max_width: 24, |
|
bdf851bb1c4f
add style to node and edge in java. implement data migration for schema version 2
ymh <ymh.work@gmail.com>
parents:
444
diff
changeset
|
2041 |
edge_stroke_witdh_scale: 5, |
|
bdf851bb1c4f
add style to node and edge in java. implement data migration for schema version 2
ymh <ymh.work@gmail.com>
parents:
444
diff
changeset
|
2042 |
|
| 442 | 2043 |
edge_label_distance: 0, |
2044 |
edge_label_max_length: 20, |
|
2045 |
edge_arrow_length: 18, |
|
2046 |
edge_arrow_width: 12, |
|
|
460
bdf851bb1c4f
add style to node and edge in java. implement data migration for schema version 2
ymh <ymh.work@gmail.com>
parents:
444
diff
changeset
|
2047 |
edge_arrow_max_width: 32, |
| 442 | 2048 |
edge_gap_in_bundles: 12, |
2049 |
label_untitled_edges: "", |
|
2050 |
||
2051 |
/* CONTEXTUAL DISPLAY (TOOLTIP OR EDITOR) OPTIONS */ |
|
2052 |
||
2053 |
tooltip_width: 275, |
|
2054 |
tooltip_padding: 10, |
|
2055 |
tooltip_margin: 15, |
|
2056 |
tooltip_arrow_length : 20, |
|
2057 |
tooltip_arrow_width : 40, |
|
2058 |
tooltip_top_color: "#f0f0f0", |
|
2059 |
tooltip_bottom_color: "#d0d0d0", |
|
2060 |
tooltip_border_color: "#808080", |
|
2061 |
tooltip_border_width: 1, |
|
2062 |
||
| 488 | 2063 |
richtext_editor_config: {
|
2064 |
toolbarGroups: [ |
|
2065 |
{ name: 'basicstyles', groups: [ 'basicstyles', 'cleanup' ] },
|
|
2066 |
{ name: 'clipboard', groups: [ 'clipboard', 'undo' ] },
|
|
2067 |
'/', |
|
2068 |
{ name: 'styles'},
|
|
2069 |
], |
|
2070 |
removePlugins : 'colorbutton,find,flash,font,forms,iframe,image,newpage,smiley,specialchar,stylescombo,templates', |
|
2071 |
}, |
|
2072 |
||
| 442 | 2073 |
/* NODE EDITOR OPTIONS */ |
2074 |
||
2075 |
show_node_editor_uri: true, |
|
2076 |
show_node_editor_description: true, |
|
| 488 | 2077 |
show_node_editor_description_richtext: true, |
| 442 | 2078 |
show_node_editor_size: true, |
|
460
bdf851bb1c4f
add style to node and edge in java. implement data migration for schema version 2
ymh <ymh.work@gmail.com>
parents:
444
diff
changeset
|
2079 |
show_node_editor_style: true, |
|
bdf851bb1c4f
add style to node and edge in java. implement data migration for schema version 2
ymh <ymh.work@gmail.com>
parents:
444
diff
changeset
|
2080 |
show_node_editor_style_color: true, |
|
bdf851bb1c4f
add style to node and edge in java. implement data migration for schema version 2
ymh <ymh.work@gmail.com>
parents:
444
diff
changeset
|
2081 |
show_node_editor_style_dash: true, |
|
bdf851bb1c4f
add style to node and edge in java. implement data migration for schema version 2
ymh <ymh.work@gmail.com>
parents:
444
diff
changeset
|
2082 |
show_node_editor_style_thickness: true, |
| 442 | 2083 |
show_node_editor_image: true, |
2084 |
show_node_editor_creator: true, |
|
2085 |
allow_image_upload: true, |
|
2086 |
uploaded_image_max_kb: 500, |
|
2087 |
||
| 488 | 2088 |
|
| 442 | 2089 |
/* NODE TOOLTIP OPTIONS */ |
2090 |
||
2091 |
show_node_tooltip_uri: true, |
|
2092 |
show_node_tooltip_description: true, |
|
2093 |
show_node_tooltip_color: true, |
|
2094 |
show_node_tooltip_image: true, |
|
2095 |
show_node_tooltip_creator: true, |
|
2096 |
||
2097 |
/* EDGE EDITOR OPTIONS */ |
|
2098 |
||
2099 |
show_edge_editor_uri: true, |
|
|
460
bdf851bb1c4f
add style to node and edge in java. implement data migration for schema version 2
ymh <ymh.work@gmail.com>
parents:
444
diff
changeset
|
2100 |
show_edge_editor_style: true, |
|
bdf851bb1c4f
add style to node and edge in java. implement data migration for schema version 2
ymh <ymh.work@gmail.com>
parents:
444
diff
changeset
|
2101 |
show_edge_editor_style_color: true, |
|
bdf851bb1c4f
add style to node and edge in java. implement data migration for schema version 2
ymh <ymh.work@gmail.com>
parents:
444
diff
changeset
|
2102 |
show_edge_editor_style_dash: true, |
|
bdf851bb1c4f
add style to node and edge in java. implement data migration for schema version 2
ymh <ymh.work@gmail.com>
parents:
444
diff
changeset
|
2103 |
show_edge_editor_style_thickness: true, |
|
bdf851bb1c4f
add style to node and edge in java. implement data migration for schema version 2
ymh <ymh.work@gmail.com>
parents:
444
diff
changeset
|
2104 |
show_edge_editor_style_arrow: true, |
| 442 | 2105 |
show_edge_editor_direction: true, |
2106 |
show_edge_editor_nodes: true, |
|
2107 |
show_edge_editor_creator: true, |
|
2108 |
||
2109 |
/* EDGE TOOLTIP OPTIONS */ |
|
2110 |
||
2111 |
show_edge_tooltip_uri: true, |
|
2112 |
show_edge_tooltip_color: true, |
|
2113 |
show_edge_tooltip_nodes: true, |
|
| 488 | 2114 |
show_edge_tooltip_creator: true, |
| 442 | 2115 |
|
2116 |
}; |
|
2117 |
||
2118 |
Rkns.i18n = {
|
|
2119 |
fr: {
|
|
2120 |
"Edit Node": "Édition d’un nœud", |
|
2121 |
"Edit Edge": "Édition d’un lien", |
|
2122 |
"Title:": "Titre :", |
|
2123 |
"URI:": "URI :", |
|
2124 |
"Description:": "Description :", |
|
2125 |
"From:": "De :", |
|
2126 |
"To:": "Vers :", |
|
2127 |
"Image": "Image", |
|
2128 |
"Image URL:": "URL d'Image", |
|
2129 |
"Choose Image File:": "Choisir un fichier image", |
|
2130 |
"Full Screen": "Mode plein écran", |
|
2131 |
"Add Node": "Ajouter un nœud", |
|
2132 |
"Add Edge": "Ajouter un lien", |
|
2133 |
"Save Project": "Enregistrer le projet", |
|
2134 |
"Open Project": "Ouvrir un projet", |
|
2135 |
"Auto-save enabled": "Enregistrement automatique activé", |
|
2136 |
"Connection lost": "Connexion perdue", |
|
2137 |
"Created by:": "Créé par :", |
|
2138 |
"Zoom In": "Agrandir l’échelle", |
|
2139 |
"Zoom Out": "Rapetisser l’échelle", |
|
2140 |
"Edit": "Éditer", |
|
2141 |
"Remove": "Supprimer", |
|
2142 |
"Cancel deletion": "Annuler la suppression", |
|
2143 |
"Link to another node": "Créer un lien", |
|
2144 |
"Enlarge": "Agrandir", |
|
2145 |
"Shrink": "Rétrécir", |
|
2146 |
"Click on the background canvas to add a node": "Cliquer sur le fond du graphe pour rajouter un nœud", |
|
2147 |
"Click on a first node to start the edge": "Cliquer sur un premier nœud pour commencer le lien", |
|
2148 |
"Click on a second node to complete the edge": "Cliquer sur un second nœud pour terminer le lien", |
|
2149 |
"Wikipedia": "Wikipédia", |
|
2150 |
"Wikipedia in ": "Wikipédia en ", |
|
2151 |
"French": "Français", |
|
2152 |
"English": "Anglais", |
|
2153 |
"Japanese": "Japonais", |
|
2154 |
"Untitled project": "Projet sans titre", |
|
2155 |
"Lignes de Temps": "Lignes de Temps", |
|
2156 |
"Loading, please wait": "Chargement en cours, merci de patienter", |
|
2157 |
"Edge color:": "Couleur :", |
|
|
460
bdf851bb1c4f
add style to node and edge in java. implement data migration for schema version 2
ymh <ymh.work@gmail.com>
parents:
444
diff
changeset
|
2158 |
"Dash:": "Point. :", |
|
bdf851bb1c4f
add style to node and edge in java. implement data migration for schema version 2
ymh <ymh.work@gmail.com>
parents:
444
diff
changeset
|
2159 |
"Thickness:": "Epaisseur :", |
|
bdf851bb1c4f
add style to node and edge in java. implement data migration for schema version 2
ymh <ymh.work@gmail.com>
parents:
444
diff
changeset
|
2160 |
"Arrow:": "Flèche :", |
| 442 | 2161 |
"Node color:": "Couleur :", |
2162 |
"Choose color": "Choisir une couleur", |
|
2163 |
"Change edge direction": "Changer le sens du lien", |
|
2164 |
"Do you really wish to remove node ": "Voulez-vous réellement supprimer le nœud ", |
|
2165 |
"Do you really wish to remove edge ": "Voulez-vous réellement supprimer le lien ", |
|
2166 |
"This file is not an image": "Ce fichier n'est pas une image", |
|
2167 |
"Image size must be under ": "L'image doit peser moins de ", |
|
2168 |
"Size:": "Taille :", |
|
2169 |
"KB": "ko", |
|
2170 |
"Choose from vocabulary:": "Choisir dans un vocabulaire :", |
|
2171 |
"SKOS Documentation properties": "SKOS: Propriétés documentaires", |
|
2172 |
"has note": "a pour note", |
|
2173 |
"has example": "a pour exemple", |
|
2174 |
"has definition": "a pour définition", |
|
2175 |
"SKOS Semantic relations": "SKOS: Relations sémantiques", |
|
2176 |
"has broader": "a pour concept plus large", |
|
2177 |
"has narrower": "a pour concept plus étroit", |
|
2178 |
"has related": "a pour concept apparenté", |
|
2179 |
"Dublin Core Metadata": "Métadonnées Dublin Core", |
|
2180 |
"has contributor": "a pour contributeur", |
|
2181 |
"covers": "couvre", |
|
2182 |
"created by": "créé par", |
|
2183 |
"has date": "a pour date", |
|
2184 |
"published by": "édité par", |
|
2185 |
"has source": "a pour source", |
|
2186 |
"has subject": "a pour sujet", |
|
2187 |
"Dragged resource": "Ressource glisée-déposée", |
|
2188 |
"Search the Web": "Rechercher en ligne", |
|
2189 |
"Search in Bins": "Rechercher dans les chutiers", |
|
2190 |
"Close bin": "Fermer le chutier", |
|
2191 |
"Refresh bin": "Rafraîchir le chutier", |
|
2192 |
"(untitled)": "(sans titre)", |
|
2193 |
"Select contents:": "Sélectionner des contenus :", |
|
2194 |
"Drag items from this website, drop them in Renkan": "Glissez des éléments de ce site web vers Renkan", |
|
2195 |
"Drag this button to your bookmark bar. When on a third-party website, click it to enable drag-and-drop from the website to Renkan.": "Glissez ce bouton vers votre barre de favoris. Ensuite, depuis un site tiers, cliquez dessus pour activer 'Drag-to-Add' puis glissez des éléments de ce site vers Renkan", |
|
2196 |
"Shapes available": "Formes disponibles", |
|
2197 |
"Circle": "Cercle", |
|
2198 |
"Square": "Carré", |
|
2199 |
"Diamond": "Losange", |
|
2200 |
"Hexagone": "Hexagone", |
|
2201 |
"Ellipse": "Ellipse", |
|
2202 |
"Star": "Étoile", |
|
2203 |
"Cloud": "Nuage", |
|
|
460
bdf851bb1c4f
add style to node and edge in java. implement data migration for schema version 2
ymh <ymh.work@gmail.com>
parents:
444
diff
changeset
|
2204 |
"Triangle": "Triangle", |
| 442 | 2205 |
"Zoom Fit": "Ajuster le Zoom", |
2206 |
"Download Project": "Télécharger le projet", |
|
| 488 | 2207 |
"Save view": "Sauver la vue", |
2208 |
"View saved view": "Restaurer la Vue", |
|
| 442 | 2209 |
"Renkan \'Drag-to-Add\' bookmarklet": "Renkan \'Deplacer-Pour-Ajouter\' Signet", |
2210 |
"(unknown user)":"(non authentifié)", |
|
2211 |
"<unknown user>":"<non authentifié>", |
|
2212 |
"Search in graph":"Rechercher dans carte", |
|
2213 |
"Search in " : "Chercher dans " |
|
2214 |
} |
|
2215 |
}; |
|
2216 |
||
2217 |
/* Saves the Full JSON at each modification */ |
|
2218 |
||
2219 |
Rkns.jsonIO = function(_renkan, _opts) {
|
|
2220 |
var _proj = _renkan.project; |
|
2221 |
if (typeof _opts.http_method === "undefined") {
|
|
2222 |
_opts.http_method = 'PUT'; |
|
2223 |
} |
|
2224 |
var _load = function() {
|
|
2225 |
_renkan.renderer.redrawActive = false; |
|
2226 |
_proj.set({
|
|
|
444
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
2227 |
loadingStatus : true |
| 442 | 2228 |
}); |
2229 |
Rkns.$.getJSON(_opts.url, function(_data) {
|
|
|
444
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
2230 |
_renkan.dataloader.load(_data); |
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
2231 |
_proj.set({
|
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
2232 |
loadingStatus : false |
| 442 | 2233 |
}); |
2234 |
_proj.set({
|
|
|
444
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
2235 |
saveStatus : 0 |
| 442 | 2236 |
}); |
2237 |
_renkan.renderer.redrawActive = true; |
|
2238 |
_renkan.renderer.fixSize(); |
|
2239 |
}); |
|
2240 |
}; |
|
2241 |
var _save = function() {
|
|
2242 |
_proj.set({
|
|
|
444
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
2243 |
saveStatus : 2 |
| 442 | 2244 |
}); |
2245 |
var _data = _proj.toJSON(); |
|
2246 |
if (!_renkan.read_only) {
|
|
2247 |
Rkns.$.ajax({
|
|
2248 |
type : _opts.http_method, |
|
2249 |
url : _opts.url, |
|
2250 |
contentType : "application/json", |
|
2251 |
data : JSON.stringify(_data), |
|
2252 |
success : function(data, textStatus, jqXHR) {
|
|
2253 |
_proj.set({
|
|
|
444
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
2254 |
saveStatus : 0 |
| 442 | 2255 |
}); |
2256 |
} |
|
2257 |
}); |
|
2258 |
} |
|
2259 |
||
2260 |
}; |
|
2261 |
var _thrSave = Rkns._.throttle(function() {
|
|
2262 |
setTimeout(_save, 100); |
|
2263 |
}, 1000); |
|
2264 |
_proj.on("add:nodes add:edges add:users add:views", function(_model) {
|
|
2265 |
_model.on("change remove", function(_model) {
|
|
2266 |
_thrSave(); |
|
2267 |
}); |
|
2268 |
_thrSave(); |
|
2269 |
}); |
|
2270 |
_proj.on("change", function() {
|
|
2271 |
if (!(_proj.changedAttributes.length === 1 && _proj |
|
|
444
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
2272 |
.hasChanged('saveStatus'))) {
|
| 442 | 2273 |
_thrSave(); |
2274 |
} |
|
2275 |
}); |
|
2276 |
||
2277 |
_load(); |
|
2278 |
}; |
|
2279 |
||
2280 |
/* Saves the Full JSON once */ |
|
2281 |
||
2282 |
Rkns.jsonIOSaveOnClick = function(_renkan, _opts) {
|
|
2283 |
var _proj = _renkan.project, |
|
2284 |
_saveWarn = false, |
|
2285 |
_onLeave = function() {
|
|
2286 |
return "Project not saved"; |
|
2287 |
}; |
|
2288 |
if (typeof _opts.http_method === "undefined") {
|
|
2289 |
_opts.http_method = 'POST'; |
|
2290 |
} |
|
2291 |
var _load = function() {
|
|
2292 |
var getdata = {},
|
|
2293 |
rx = /id=([^&#?=]+)/, |
|
2294 |
matches = document.location.hash.match(rx); |
|
2295 |
if (matches) {
|
|
2296 |
getdata.id = matches[1]; |
|
2297 |
} |
|
2298 |
Rkns.$.ajax({
|
|
2299 |
url: _opts.url, |
|
2300 |
data: getdata, |
|
2301 |
beforeSend: function(){
|
|
|
444
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
2302 |
_proj.set({loadingStatus:true});
|
| 442 | 2303 |
}, |
2304 |
success: function(_data) {
|
|
|
444
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
2305 |
_renkan.dataloader.load(_data); |
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
2306 |
_proj.set({loadingStatus:false});
|
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
2307 |
_proj.set({saveStatus:0});
|
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
2308 |
_renkan.renderer.autoScale(); |
| 442 | 2309 |
} |
2310 |
}); |
|
2311 |
}; |
|
2312 |
var _save = function() {
|
|
2313 |
_proj.set("saved_at", new Date());
|
|
2314 |
var _data = _proj.toJSON(); |
|
2315 |
Rkns.$.ajax({
|
|
2316 |
type: _opts.http_method, |
|
2317 |
url: _opts.url, |
|
2318 |
contentType: "application/json", |
|
2319 |
data: JSON.stringify(_data), |
|
2320 |
beforeSend: function(){
|
|
|
444
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
2321 |
_proj.set({saveStatus:2});
|
| 442 | 2322 |
}, |
2323 |
success: function(data, textStatus, jqXHR) {
|
|
2324 |
$(window).off("beforeunload", _onLeave);
|
|
2325 |
_saveWarn = false; |
|
|
444
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
2326 |
_proj.set({saveStatus:0});
|
| 442 | 2327 |
//document.location.hash = "#id=" + data.id; |
2328 |
//$(".Rk-Notifications").text("Saved as "+document.location.href).fadeIn().delay(2000).fadeOut();
|
|
2329 |
} |
|
2330 |
}); |
|
2331 |
}; |
|
2332 |
var _checkLeave = function() {
|
|
|
444
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
2333 |
_proj.set({saveStatus:1});
|
|
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
2334 |
|
| 442 | 2335 |
var title = _proj.get("title");
|
2336 |
if (title && _proj.get("nodes").length) {
|
|
2337 |
$(".Rk-Save-Button").removeClass("disabled");
|
|
2338 |
} else {
|
|
2339 |
$(".Rk-Save-Button").addClass("disabled");
|
|
2340 |
} |
|
2341 |
if (title) {
|
|
2342 |
$(".Rk-PadTitle").css("border-color","#333333");
|
|
2343 |
} |
|
2344 |
if (!_saveWarn) {
|
|
2345 |
_saveWarn = true; |
|
2346 |
$(window).on("beforeunload", _onLeave);
|
|
2347 |
} |
|
2348 |
}; |
|
2349 |
_load(); |
|
2350 |
_proj.on("add:nodes add:edges add:users change", function(_model) {
|
|
2351 |
_model.on("change remove", function(_model) {
|
|
|
444
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
2352 |
if(!(_model.changedAttributes.length === 1 && _model.hasChanged('saveStatus'))) {
|
| 442 | 2353 |
_checkLeave(); |
2354 |
} |
|
2355 |
}); |
|
|
444
19f0b7803aed
add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents:
442
diff
changeset
|
2356 |
if(!(_proj.changedAttributes.length === 1 && _proj.hasChanged('saveStatus'))) {
|
| 442 | 2357 |
_checkLeave(); |
2358 |
} |
|
2359 |
}); |
|
2360 |
_renkan.renderer.save = function() {
|
|
2361 |
if ($(".Rk-Save-Button").hasClass("disabled")) {
|
|
2362 |
if (!_proj.get("title")) {
|
|
2363 |
$(".Rk-PadTitle").css("border-color","#ff0000");
|
|
2364 |
} |
|
2365 |
} else {
|
|
2366 |
_save(); |
|
2367 |
} |
|
2368 |
}; |
|
2369 |
}; |
|
2370 |
||
2371 |
(function(Rkns) {
|
|
2372 |
"use strict"; |
|
2373 |
||
2374 |
var _ = Rkns._; |
|
2375 |
||
2376 |
var Ldt = Rkns.Ldt = {};
|
|
2377 |
||
2378 |
var Bin = Ldt.Bin = function(_renkan, _opts) {
|
|
2379 |
if (_opts.ldt_type) {
|
|
2380 |
var Resclass = Ldt[_opts.ldt_type+"Bin"]; |
|
2381 |
if (Resclass) {
|
|
2382 |
return new Resclass(_renkan, _opts); |
|
2383 |
} |
|
2384 |
} |
|
2385 |
console.error("No such LDT Bin Type");
|
|
2386 |
}; |
|
2387 |
||
2388 |
var ProjectBin = Ldt.ProjectBin = Rkns.Utils.inherit(Rkns._BaseBin); |
|
2389 |
||
2390 |
ProjectBin.prototype.tagTemplate = renkanJST['templates/ldtjson-bin/tagtemplate.html']; |
|
2391 |
||
2392 |
ProjectBin.prototype.annotationTemplate = renkanJST['templates/ldtjson-bin/annotationtemplate.html']; |
|
2393 |
||
2394 |
ProjectBin.prototype._init = function(_renkan, _opts) {
|
|
2395 |
this.renkan = _renkan; |
|
2396 |
this.proj_id = _opts.project_id; |
|
2397 |
this.ldt_platform = _opts.ldt_platform || "http://ldt.iri.centrepompidou.fr/"; |
|
2398 |
this.title_$.html(_opts.title); |
|
2399 |
this.title_icon_$.addClass('Rk-Ldt-Title-Icon');
|
|
2400 |
this.refresh(); |
|
2401 |
}; |
|
2402 |
||
2403 |
ProjectBin.prototype.render = function(searchbase) {
|
|
2404 |
var search = searchbase || Rkns.Utils.regexpFromTextOrArray(); |
|
2405 |
function highlight(_text) {
|
|
2406 |
var _e = _(_text).escape(); |
|
2407 |
return search.isempty ? _e : search.replace(_e, "<span class='searchmatch'>$1</span>"); |
|
2408 |
} |
|
2409 |
function convertTC(_ms) {
|
|
2410 |
function pad(_n) {
|
|
2411 |
var _res = _n.toString(); |
|
2412 |
while (_res.length < 2) {
|
|
2413 |
_res = '0' + _res; |
|
2414 |
} |
|
2415 |
return _res; |
|
2416 |
} |
|
2417 |
var _totalSeconds = Math.abs(Math.floor(_ms/1000)), |
|
2418 |
_hours = Math.floor(_totalSeconds / 3600), |
|
2419 |
_minutes = (Math.floor(_totalSeconds / 60) % 60), |
|
2420 |
_seconds = _totalSeconds % 60, |
|
2421 |
_res = ''; |
|
2422 |
if (_hours) {
|
|
2423 |
_res += pad(_hours) + ':'; |
|
2424 |
} |
|
2425 |
_res += pad(_minutes) + ':' + pad(_seconds); |
|
2426 |
return _res; |
|
2427 |
} |
|
2428 |
||
2429 |
var _html = '<li><h3>Tags</h3></li>', |
|
2430 |
_projtitle = this.data.meta["dc:title"], |
|
2431 |
_this = this, |
|
2432 |
count = 0; |
|
2433 |
_this.title_$.text('LDT Project: "' + _projtitle + '"');
|
|
2434 |
_.map(_this.data.tags,function(_tag) {
|
|
2435 |
var _title = _tag.meta["dc:title"]; |
|
2436 |
if (!search.isempty && !search.test(_title)) {
|
|
2437 |
return; |
|
2438 |
} |
|
2439 |
count++; |
|
2440 |
_html += _this.tagTemplate({
|
|
2441 |
ldt_platform: _this.ldt_platform, |
|
2442 |
title: _title, |
|
2443 |
htitle: highlight(_title), |
|
2444 |
encodedtitle : encodeURIComponent(_title), |
|
2445 |
static_url: _this.renkan.options.static_url |
|
2446 |
}); |
|
2447 |
}); |
|
2448 |
_html += '<li><h3>Annotations</h3></li>'; |
|
2449 |
_.map(_this.data.annotations,function(_annotation) {
|
|
2450 |
var _description = _annotation.content.description, |
|
2451 |
_title = _annotation.content.title.replace(_description,""); |
|
2452 |
if (!search.isempty && !search.test(_title) && !search.test(_description)) {
|
|
2453 |
return; |
|
2454 |
} |
|
2455 |
count++; |
|
2456 |
var _duration = _annotation.end - _annotation.begin, |
|
2457 |
_img = ( |
|
2458 |
(_annotation.content && _annotation.content.img && _annotation.content.img.src) ? |
|
2459 |
_annotation.content.img.src : |
|
2460 |
( _duration ? _this.renkan.options.static_url+"img/ldt-segment.png" : _this.renkan.options.static_url+"img/ldt-point.png" ) |
|
2461 |
); |
|
2462 |
_html += _this.annotationTemplate({
|
|
2463 |
ldt_platform: _this.ldt_platform, |
|
2464 |
title: _title, |
|
2465 |
htitle: highlight(_title), |
|
2466 |
description: _description, |
|
2467 |
hdescription: highlight(_description), |
|
2468 |
start: convertTC(_annotation.begin), |
|
2469 |
end: convertTC(_annotation.end), |
|
2470 |
duration: convertTC(_duration), |
|
2471 |
mediaid: _annotation.media, |
|
2472 |
annotationid: _annotation.id, |
|
2473 |
image: _img, |
|
2474 |
static_url: _this.renkan.options.static_url |
|
2475 |
}); |
|
2476 |
}); |
|
2477 |
||
2478 |
this.main_$.html(_html); |
|
2479 |
if (!search.isempty && count) {
|
|
2480 |
this.count_$.text(count).show(); |
|
2481 |
} else {
|
|
2482 |
this.count_$.hide(); |
|
2483 |
} |
|
2484 |
if (!search.isempty && !count) {
|
|
2485 |
this.$.hide(); |
|
2486 |
} else {
|
|
2487 |
this.$.show(); |
|
2488 |
} |
|
2489 |
this.renkan.resizeBins(); |
|
2490 |
}; |
|
2491 |
||
2492 |
ProjectBin.prototype.refresh = function() {
|
|
2493 |
var _this = this; |
|
2494 |
Rkns.$.ajax({
|
|
2495 |
url: this.ldt_platform + 'ldtplatform/ldt/cljson/id/' + this.proj_id, |
|
2496 |
dataType: "jsonp", |
|
2497 |
success: function(_data) {
|
|
2498 |
_this.data = _data; |
|
2499 |
_this.render(); |
|
2500 |
} |
|
2501 |
}); |
|
2502 |
}; |
|
2503 |
||
2504 |
var Search = Ldt.Search = function(_renkan, _opts) {
|
|
2505 |
this.renkan = _renkan; |
|
2506 |
this.lang = _opts.lang || "en"; |
|
2507 |
}; |
|
2508 |
||
2509 |
Search.prototype.getBgClass = function() {
|
|
2510 |
return "Rk-Ldt-Icon"; |
|
2511 |
}; |
|
2512 |
||
2513 |
Search.prototype.getSearchTitle = function() {
|
|
2514 |
return this.renkan.translate("Lignes de Temps");
|
|
2515 |
}; |
|
2516 |
||
2517 |
Search.prototype.search = function(_q) {
|
|
2518 |
this.renkan.tabs.push( |
|
2519 |
new ResultsBin(this.renkan, {
|
|
2520 |
search: _q |
|
2521 |
}) |
|
2522 |
); |
|
2523 |
}; |
|
2524 |
||
2525 |
var ResultsBin = Ldt.ResultsBin = Rkns.Utils.inherit(Rkns._BaseBin); |
|
2526 |
||
2527 |
ResultsBin.prototype.segmentTemplate = renkanJST['templates/ldtjson-bin/segmenttemplate.html']; |
|
2528 |
||
2529 |
ResultsBin.prototype._init = function(_renkan, _opts) {
|
|
2530 |
this.renkan = _renkan; |
|
2531 |
this.ldt_platform = _opts.ldt_platform || "http://ldt.iri.centrepompidou.fr/"; |
|
2532 |
this.max_results = _opts.max_results || 50; |
|
2533 |
this.search = _opts.search; |
|
2534 |
this.title_$.html('Lignes de Temps: "' + _opts.search + '"');
|
|
2535 |
this.title_icon_$.addClass('Rk-Ldt-Title-Icon');
|
|
2536 |
this.refresh(); |
|
2537 |
}; |
|
2538 |
||
2539 |
ResultsBin.prototype.render = function(searchbase) {
|
|
2540 |
if (!this.data) {
|
|
2541 |
return; |
|
2542 |
} |
|
2543 |
var search = searchbase || Rkns.Utils.regexpFromTextOrArray(); |
|
2544 |
var highlightrx = (search.isempty ? Rkns.Utils.regexpFromTextOrArray(this.search) : search); |
|
2545 |
function highlight(_text) {
|
|
2546 |
return highlightrx.replace(_(_text).escape(), "<span class='searchmatch'>$1</span>"); |
|
2547 |
} |
|
2548 |
function convertTC(_ms) {
|
|
2549 |
function pad(_n) {
|
|
2550 |
var _res = _n.toString(); |
|
2551 |
while (_res.length < 2) {
|
|
2552 |
_res = '0' + _res; |
|
2553 |
} |
|
2554 |
return _res; |
|
2555 |
} |
|
2556 |
var _totalSeconds = Math.abs(Math.floor(_ms/1000)), |
|
2557 |
_hours = Math.floor(_totalSeconds / 3600), |
|
2558 |
_minutes = (Math.floor(_totalSeconds / 60) % 60), |
|
2559 |
_seconds = _totalSeconds % 60, |
|
2560 |
_res = ''; |
|
2561 |
if (_hours) {
|
|
2562 |
_res += pad(_hours) + ':'; |
|
2563 |
} |
|
2564 |
_res += pad(_minutes) + ':' + pad(_seconds); |
|
2565 |
return _res; |
|
2566 |
} |
|
2567 |
||
2568 |
var _html = '', |
|
2569 |
_this = this, |
|
2570 |
count = 0; |
|
2571 |
_.each(this.data.objects,function(_segment) {
|
|
2572 |
var _description = _segment.abstract, |
|
2573 |
_title = _segment.title; |
|
2574 |
if (!search.isempty && !search.test(_title) && !search.test(_description)) {
|
|
2575 |
return; |
|
2576 |
} |
|
2577 |
count++; |
|
2578 |
var _duration = _segment.duration, |
|
2579 |
_begin = _segment.start_ts, |
|
2580 |
_end = + _segment.duration + _begin, |
|
2581 |
_img = ( |
|
2582 |
_duration ? |
|
2583 |
_this.renkan.options.static_url + "img/ldt-segment.png" : |
|
2584 |
_this.renkan.options.static_url + "img/ldt-point.png" |
|
2585 |
); |
|
2586 |
_html += _this.segmentTemplate({
|
|
2587 |
ldt_platform: _this.ldt_platform, |
|
2588 |
title: _title, |
|
2589 |
htitle: highlight(_title), |
|
2590 |
description: _description, |
|
2591 |
hdescription: highlight(_description), |
|
2592 |
start: convertTC(_begin), |
|
2593 |
end: convertTC(_end), |
|
2594 |
duration: convertTC(_duration), |
|
2595 |
mediaid: _segment.iri_id, |
|
2596 |
//projectid: _segment.project_id, |
|
2597 |
//cuttingid: _segment.cutting_id, |
|
2598 |
annotationid: _segment.element_id, |
|
2599 |
image: _img |
|
2600 |
}); |
|
2601 |
}); |
|
2602 |
||
2603 |
this.main_$.html(_html); |
|
2604 |
if (!search.isempty && count) {
|
|
2605 |
this.count_$.text(count).show(); |
|
2606 |
} else {
|
|
2607 |
this.count_$.hide(); |
|
2608 |
} |
|
2609 |
if (!search.isempty && !count) {
|
|
2610 |
this.$.hide(); |
|
2611 |
} else {
|
|
2612 |
this.$.show(); |
|
2613 |
} |
|
2614 |
this.renkan.resizeBins(); |
|
2615 |
}; |
|
2616 |
||
2617 |
ResultsBin.prototype.refresh = function() {
|
|
2618 |
var _this = this; |
|
2619 |
Rkns.$.ajax({
|
|
2620 |
url: this.ldt_platform + 'ldtplatform/api/ldt/1.0/segments/search/', |
|
2621 |
data: {
|
|
2622 |
format: "jsonp", |
|
2623 |
q: this.search, |
|
2624 |
limit: this.max_results |
|
2625 |
}, |
|
2626 |
dataType: "jsonp", |
|
2627 |
success: function(_data) {
|
|
2628 |
_this.data = _data; |
|
2629 |
_this.render(); |
|
2630 |
} |
|
2631 |
}); |
|
2632 |
}; |
|
2633 |
||
2634 |
})(window.Rkns); |
|
2635 |
||
2636 |
Rkns.ResourceList = {};
|
|
2637 |
||
2638 |
Rkns.ResourceList.Bin = Rkns.Utils.inherit(Rkns._BaseBin); |
|
2639 |
||
2640 |
Rkns.ResourceList.Bin.prototype.resultTemplate = renkanJST['templates/list-bin.html']; |
|
2641 |
||
2642 |
Rkns.ResourceList.Bin.prototype._init = function(_renkan, _opts) {
|
|
2643 |
this.renkan = _renkan; |
|
2644 |
this.title_$.html(_opts.title); |
|
2645 |
if (_opts.list) {
|
|
2646 |
this.data = _opts.list; |
|
2647 |
} |
|
2648 |
this.refresh(); |
|
2649 |
}; |
|
2650 |
||
2651 |
Rkns.ResourceList.Bin.prototype.render = function(searchbase) {
|
|
2652 |
var search = searchbase || Rkns.Utils.regexpFromTextOrArray(); |
|
2653 |
function highlight(_text) {
|
|
2654 |
var _e = _(_text).escape(); |
|
2655 |
return search.isempty ? _e : search.replace(_e, "<span class='searchmatch'>$1</span>"); |
|
2656 |
} |
|
2657 |
var _html = "", |
|
2658 |
_this = this, |
|
2659 |
count = 0; |
|
2660 |
Rkns._.each(this.data,function(_item) {
|
|
2661 |
var _element; |
|
2662 |
if (typeof _item === "string") {
|
|
2663 |
if (/^(https?:\/\/|www)/.test(_item)) {
|
|
2664 |
_element = { url: _item };
|
|
2665 |
} else {
|
|
2666 |
_element = { title: _item.replace(/[:,]?\s?(https?:\/\/|www)[\d\w\/.&?=#%-_]+\s?/,'').trim() };
|
|
2667 |
var _match = _item.match(/(https?:\/\/|www)[\d\w\/.&?=#%-_]+/); |
|
2668 |
if (_match) {
|
|
2669 |
_element.url = _match[0]; |
|
2670 |
} |
|
2671 |
if (_element.title.length > 80) {
|
|
2672 |
_element.description = _element.title; |
|
2673 |
_element.title = _element.title.replace(/^(.{30,60})\s.+$/,'$1…');
|
|
2674 |
} |
|
2675 |
} |
|
2676 |
} else {
|
|
2677 |
_element = _item; |
|
2678 |
} |
|
2679 |
var title = _element.title || (_element.url || "").replace(/^https?:\/\/(www\.)?/,'').replace(/^(.{40}).+$/,'$1…'),
|
|
2680 |
url = _element.url || "", |
|
2681 |
description = _element.description || "", |
|
2682 |
image = _element.image || ""; |
|
2683 |
if (url && !/^https?:\/\//.test(url)) {
|
|
2684 |
url = 'http://' + url; |
|
2685 |
} |
|
2686 |
if (!search.isempty && !search.test(title) && !search.test(description)) {
|
|
2687 |
return; |
|
2688 |
} |
|
2689 |
count++; |
|
2690 |
_html += _this.resultTemplate({
|
|
2691 |
url: url, |
|
2692 |
title: title, |
|
2693 |
htitle: highlight(title), |
|
2694 |
image: image, |
|
2695 |
description: description, |
|
2696 |
hdescription: highlight(description), |
|
2697 |
static_url: _this.renkan.options.static_url |
|
2698 |
}); |
|
2699 |
}); |
|
2700 |
_this.main_$.html(_html); |
|
2701 |
if (!search.isempty && count) {
|
|
2702 |
this.count_$.text(count).show(); |
|
2703 |
} else {
|
|
2704 |
this.count_$.hide(); |
|
2705 |
} |
|
2706 |
if (!search.isempty && !count) {
|
|
2707 |
this.$.hide(); |
|
2708 |
} else {
|
|
2709 |
this.$.show(); |
|
2710 |
} |
|
2711 |
this.renkan.resizeBins(); |
|
2712 |
}; |
|
2713 |
||
2714 |
Rkns.ResourceList.Bin.prototype.refresh = function() {
|
|
2715 |
if (this.data) {
|
|
2716 |
this.render(); |
|
2717 |
} |
|
2718 |
}; |
|
2719 |
||
2720 |
Rkns.Wikipedia = {
|
|
2721 |
}; |
|
2722 |
||
2723 |
Rkns.Wikipedia.Search = function(_renkan, _opts) {
|
|
2724 |
this.renkan = _renkan; |
|
2725 |
this.lang = _opts.lang || "en"; |
|
2726 |
}; |
|
2727 |
||
2728 |
Rkns.Wikipedia.Search.prototype.getBgClass = function() {
|
|
2729 |
return "Rk-Wikipedia-Search-Icon Rk-Wikipedia-Lang-" + this.lang; |
|
2730 |
}; |
|
2731 |
||
2732 |
Rkns.Wikipedia.Search.prototype.getSearchTitle = function() {
|
|
2733 |
var langs = {
|
|
2734 |
"fr": "French", |
|
2735 |
"en": "English", |
|
2736 |
"ja": "Japanese" |
|
2737 |
}; |
|
2738 |
if (langs[this.lang]) {
|
|
2739 |
return this.renkan.translate("Wikipedia in ") + this.renkan.translate(langs[this.lang]);
|
|
2740 |
} else {
|
|
2741 |
return this.renkan.translate("Wikipedia") + " [" + this.lang + "]";
|
|
2742 |
} |
|
2743 |
}; |
|
2744 |
||
2745 |
Rkns.Wikipedia.Search.prototype.search = function(_q) {
|
|
2746 |
this.renkan.tabs.push( |
|
2747 |
new Rkns.Wikipedia.Bin(this.renkan, {
|
|
2748 |
lang: this.lang, |
|
2749 |
search: _q |
|
2750 |
}) |
|
2751 |
); |
|
2752 |
}; |
|
2753 |
||
2754 |
Rkns.Wikipedia.Bin = Rkns.Utils.inherit(Rkns._BaseBin); |
|
2755 |
||
2756 |
Rkns.Wikipedia.Bin.prototype.resultTemplate = renkanJST['templates/wikipedia-bin/resulttemplate.html']; |
|
2757 |
||
2758 |
Rkns.Wikipedia.Bin.prototype._init = function(_renkan, _opts) {
|
|
2759 |
this.renkan = _renkan; |
|
2760 |
this.search = _opts.search; |
|
2761 |
this.lang = _opts.lang || "en"; |
|
2762 |
this.title_icon_$.addClass('Rk-Wikipedia-Title-Icon Rk-Wikipedia-Lang-' + this.lang);
|
|
2763 |
this.title_$.html(this.search).addClass("Rk-Wikipedia-Title");
|
|
2764 |
this.refresh(); |
|
2765 |
}; |
|
2766 |
||
2767 |
Rkns.Wikipedia.Bin.prototype.render = function(searchbase) {
|
|
2768 |
var search = searchbase || Rkns.Utils.regexpFromTextOrArray(); |
|
2769 |
var highlightrx = (search.isempty ? Rkns.Utils.regexpFromTextOrArray(this.search) : search); |
|
2770 |
function highlight(_text) {
|
|
2771 |
return highlightrx.replace(_(_text).escape(), "<span class='searchmatch'>$1</span>"); |
|
2772 |
} |
|
2773 |
var _html = "", |
|
2774 |
_this = this, |
|
2775 |
count = 0; |
|
2776 |
Rkns._.each(this.data.query.search, function(_result) {
|
|
2777 |
var title = _result.title, |
|
2778 |
url = "http://" + _this.lang + ".wikipedia.org/wiki/" + encodeURI(title.replace(/ /g,"_")), |
|
2779 |
description = Rkns.$('<div>').html(_result.snippet).text();
|
|
2780 |
if (!search.isempty && !search.test(title) && !search.test(description)) {
|
|
2781 |
return; |
|
2782 |
} |
|
2783 |
count++; |
|
2784 |
_html += _this.resultTemplate({
|
|
2785 |
url: url, |
|
2786 |
title: title, |
|
2787 |
htitle: highlight(title), |
|
2788 |
description: description, |
|
2789 |
hdescription: highlight(description), |
|
2790 |
static_url: _this.renkan.options.static_url |
|
2791 |
}); |
|
2792 |
}); |
|
2793 |
_this.main_$.html(_html); |
|
2794 |
if (!search.isempty && count) {
|
|
2795 |
this.count_$.text(count).show(); |
|
2796 |
} else {
|
|
2797 |
this.count_$.hide(); |
|
2798 |
} |
|
2799 |
if (!search.isempty && !count) {
|
|
2800 |
this.$.hide(); |
|
2801 |
} else {
|
|
2802 |
this.$.show(); |
|
2803 |
} |
|
2804 |
this.renkan.resizeBins(); |
|
2805 |
}; |
|
2806 |
||
2807 |
Rkns.Wikipedia.Bin.prototype.refresh = function() {
|
|
2808 |
var _this = this; |
|
2809 |
Rkns.$.ajax({
|
|
2810 |
url: "http://" + _this.lang + ".wikipedia.org/w/api.php?action=query&list=search&srsearch=" + encodeURIComponent(this.search) + "&format=json", |
|
2811 |
dataType: "jsonp", |
|
2812 |
success: function(_data) {
|
|
2813 |
_this.data = _data; |
|
2814 |
_this.render(); |
|
2815 |
} |
|
2816 |
}); |
|
2817 |
}; |