# HG changeset patch # User rougeronj # Date 1433256122 -7200 # Node ID 18b9be54174d2d353251db6349ed6195d2434559 # Parent 03e8815a012d5b1c1f8c41adbf66638e41903f77# Parent 19f0b7803aed33a22feeb3e7c7da7a9dc7de81ce Merge with 19f0b7803aed33a22feeb3e7c7da7a9dc7de81ce diff -r 03e8815a012d -r 18b9be54174d .hgignore --- a/.hgignore Fri May 22 17:50:10 2015 +0200 +++ b/.hgignore Tue Jun 02 16:42:02 2015 +0200 @@ -26,3 +26,5 @@ ^client/bower_components ^client/lib ^server/python/django/MANIFEST\.in$ +^server/php/basic/resources/config.php$ +^server/php/basic/data diff -r 03e8815a012d -r 18b9be54174d client/data/example-cinema-src.json --- a/client/data/example-cinema-src.json Fri May 22 17:50:10 2015 +0200 +++ b/client/data/example-cinema-src.json Tue Jun 02 16:42:02 2015 +0200 @@ -4,7 +4,6 @@ "description": "(empty description)", "uri": null, "color": null, - "revCounter": 2495, "created": "2013-03-18T11:32:40.253+01:00", "updated": "2014-02-04T15:12:56.619+01:00", "nodes": [ @@ -627,13 +626,12 @@ "anonymous": true } ], - "space_id": "17f968e4-2640-4319-aa61-b5b8b527ebb4", "views": [ { - "_id": "view-2014-02-18-628af15b-12ad-457a-8ac0-a28c8998cc3b-0001", - "zoom_level": 0.8275032552816195, + "_id": "view-2014-02-18-628af15b-12ad-457a-8ac0-a28c8998cc3b-0001", + "zoom_level": 0.8275032552816195, "offset_x": 832.0104075533723, "offset_y": 402.8917139487223 } ] -} \ No newline at end of file +} diff -r 03e8815a012d -r 18b9be54174d client/gruntfile.js --- a/client/gruntfile.js Fri May 22 17:50:10 2015 +0200 +++ b/client/gruntfile.js Tue Jun 02 16:42:02 2015 +0200 @@ -7,6 +7,7 @@ var renkan_src = [ 'dist/js/templates.js', 'js/main.js', + 'js/dataloader.js', 'js/models.js', 'js/defaults.js', 'js/i18n.js', @@ -114,8 +115,10 @@ }, renkan_server: { files: [ - {expand: true, cwd: 'dist', src: ['**', '!data/*', '!lib/**'], dest: '../server/python/django/renkanmanager/static/renkanmanager/lib/renkan/', filter: 'isFile'}, - {expand: true, cwd: 'dist/lib', src: ['**'], dest: '../server/python/django/renkanmanager/static/renkanmanager/lib/', filter: 'isFile'} + {expand: true, cwd: 'dist', src: ['**', '!data/*', '!lib/**'], dest: '../server/python/django/renkanmanager/static/renkanmanager/lib/renkan/', filter: 'isFile'}, + {expand: true, cwd: 'dist/lib', src: ['**'], dest: '../server/python/django/renkanmanager/static/renkanmanager/lib/', filter: 'isFile'}, + {expand: true, cwd: 'dist', src: ['**', '!data/*', '!lib/**'], dest: '../server/php/basic/public_html/static/lib/renkan/', filter: 'isFile'}, + {expand: true, cwd: 'dist/lib', src: ['**'], dest: '../server/php/basic/public_html/static/lib/', filter: 'isFile'} ] } }, @@ -147,7 +150,7 @@ watch: { css:{ files: ['css/**/*.css'], - tasks: ['cssmin', 'copy:renkan_css'], + tasks: ['cssmin', 'copy:renkan_css'], }, js:{ files: ['js/**/*.js', 'templates/**/*.html'], diff -r 03e8815a012d -r 18b9be54174d client/js/dataloader.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/client/js/dataloader.js Tue Jun 02 16:42:02 2015 +0200 @@ -0,0 +1,43 @@ +(function(root) { + + "use strict"; + + var DataLoader = root.Rkns.DataLoader = { + converters: { + from1to2: function(data) { + + //TODO: implement + + return data; + } + } + }; + + + DataLoader.Loader = function(project, options) { + this.project = project; + this.dataConverters = _.defaults(options.converters || {}, DataLoader.converters); + }; + + + DataLoader.Loader.prototype.convert = function(data) { + var schemaVersionFrom = this.project.getSchemaVersion(data); + var schemaVersionTo = this.project.getSchemaVersion(); + + if (schemaVersionFrom !== schemaVersionTo) { + var converterName = "from" + schemaVersionFrom + "to" + schemaVersionTo; + if (typeof this.dataConverters[converterName] === 'function') { + data = this.dataConverters[converterName](data); + } + } + return data; + }; + + DataLoader.Loader.prototype.load = function(data) { + console.log(data); + this.project.set(this.convert(data), { + validate: true + }); + }; + +})(window); diff -r 03e8815a012d -r 18b9be54174d client/js/full-json.js --- a/client/js/full-json.js Fri May 22 17:50:10 2015 +0200 +++ b/client/js/full-json.js Tue Jun 02 16:42:02 2015 +0200 @@ -8,17 +8,15 @@ var _load = function() { _renkan.renderer.redrawActive = false; _proj.set({ - loading_status : true + loadingStatus : true }); Rkns.$.getJSON(_opts.url, function(_data) { - _proj.set(_data, { - validate : true + _renkan.dataloader.load(_data); + _proj.set({ + loadingStatus : false }); _proj.set({ - loading_status : false - }); - _proj.set({ - save_status : 0 + saveStatus : 0 }); _renkan.renderer.redrawActive = true; _renkan.renderer.fixSize(); @@ -26,7 +24,7 @@ }; var _save = function() { _proj.set({ - save_status : 2 + saveStatus : 2 }); var _data = _proj.toJSON(); if (!_renkan.read_only) { @@ -37,7 +35,7 @@ data : JSON.stringify(_data), success : function(data, textStatus, jqXHR) { _proj.set({ - save_status : 0 + saveStatus : 0 }); } }); @@ -55,7 +53,7 @@ }); _proj.on("change", function() { if (!(_proj.changedAttributes.length === 1 && _proj - .hasChanged('save_status'))) { + .hasChanged('saveStatus'))) { _thrSave(); } }); diff -r 03e8815a012d -r 18b9be54174d client/js/main-renderer.js --- a/client/js/main-renderer.js Fri May 22 17:50:10 2015 +0200 +++ b/client/js/main-renderer.js Tue Jun 02 16:42:02 2015 +0200 @@ -4,8 +4,6 @@ require.config({ paths: { 'jquery':'../lib/jquery/jquery', -// 'underscore':'../lib/underscore/underscore', -// 'underscore':'../lib/lodash-compat/lodash', 'underscore':'../lib/lodash/lodash', 'filesaver' :'../lib/FileSaver/FileSaver', 'requtils':'require-utils' diff -r 03e8815a012d -r 18b9be54174d client/js/main.js --- a/client/js/main.js Fri May 22 17:50:10 2015 +0200 +++ b/client/js/main.js Tue Jun 02 16:42:02 2015 +0200 @@ -1,555 +1,568 @@ - /* Declaring the Renkan Namespace Rkns and Default values */ (function(root) { -"use strict"; + "use strict"; + + if (typeof root.Rkns !== "object") { + root.Rkns = {}; + } + + var Rkns = root.Rkns; + var $ = Rkns.$ = root.jQuery; + var _ = Rkns._ = root._; -if (typeof root.Rkns !== "object") { - root.Rkns = {}; -} + Rkns.pickerColors = ["#8f1919", "#a80000", "#d82626", "#ff0000", "#e87c7c", "#ff6565", "#f7d3d3", "#fecccc", + "#8f5419", "#a85400", "#d87f26", "#ff7f00", "#e8b27c", "#ffb265", "#f7e5d3", "#fee5cc", + "#8f8f19", "#a8a800", "#d8d826", "#feff00", "#e8e87c", "#feff65", "#f7f7d3", "#fefecc", + "#198f19", "#00a800", "#26d826", "#00ff00", "#7ce87c", "#65ff65", "#d3f7d3", "#ccfecc", + "#198f8f", "#00a8a8", "#26d8d8", "#00feff", "#7ce8e8", "#65feff", "#d3f7f7", "#ccfefe", + "#19198f", "#0000a8", "#2626d8", "#0000ff", "#7c7ce8", "#6565ff", "#d3d3f7", "#ccccfe", + "#8f198f", "#a800a8", "#d826d8", "#ff00fe", "#e87ce8", "#ff65fe", "#f7d3f7", "#feccfe", + "#000000", "#242424", "#484848", "#6d6d6d", "#919191", "#b6b6b6", "#dadada", "#ffffff" + ]; + + Rkns.__renkans = []; -var Rkns = root.Rkns; -var $ = Rkns.$ = root.jQuery; -var _ = Rkns._ = root._; + var _BaseBin = Rkns._BaseBin = function(_renkan, _opts) { + if (typeof _renkan !== "undefined") { + this.renkan = _renkan; + this.renkan.$.find(".Rk-Bin-Main").hide(); + this.$ = Rkns.$('
  • ') + .addClass("Rk-Bin") + .appendTo(_renkan.$.find(".Rk-Bin-List")); + this.title_icon_$ = Rkns.$('') + .addClass("Rk-Bin-Title-Icon") + .appendTo(this.$); + + var _this = this; -Rkns.pickerColors = ["#8f1919", "#a80000", "#d82626", "#ff0000", "#e87c7c", "#ff6565", "#f7d3d3", "#fecccc", - "#8f5419", "#a85400", "#d87f26", "#ff7f00", "#e8b27c", "#ffb265", "#f7e5d3", "#fee5cc", - "#8f8f19", "#a8a800", "#d8d826", "#feff00", "#e8e87c", "#feff65", "#f7f7d3", "#fefecc", - "#198f19", "#00a800", "#26d826", "#00ff00", "#7ce87c", "#65ff65", "#d3f7d3", "#ccfecc", - "#198f8f", "#00a8a8", "#26d8d8", "#00feff", "#7ce8e8", "#65feff", "#d3f7f7", "#ccfefe", - "#19198f", "#0000a8", "#2626d8", "#0000ff", "#7c7ce8", "#6565ff", "#d3d3f7", "#ccccfe", - "#8f198f", "#a800a8", "#d826d8", "#ff00fe", "#e87ce8", "#ff65fe", "#f7d3f7", "#feccfe", - "#000000", "#242424", "#484848", "#6d6d6d", "#919191", "#b6b6b6", "#dadada", "#ffffff"]; - -Rkns.__renkans = []; + Rkns.$('') + .attr({ + href: "#", + title: _renkan.translate("Close bin") + }) + .addClass("Rk-Bin-Close") + .html('×') + .appendTo(this.$) + .click(function() { + _this.destroy(); + if (!_renkan.$.find(".Rk-Bin-Main:visible").length) { + _renkan.$.find(".Rk-Bin-Main:last").slideDown(); + } + _renkan.resizeBins(); + return false; + }); + Rkns.$('') + .attr({ + href: "#", + title: _renkan.translate("Refresh bin") + }) + .addClass("Rk-Bin-Refresh") + .appendTo(this.$) + .click(function() { + _this.refresh(); + return false; + }); + this.count_$ = Rkns.$('
    ') + .addClass("Rk-Bin-Count") + .appendTo(this.$); + this.title_$ = Rkns.$('

    ') + .addClass("Rk-Bin-Title") + .appendTo(this.$); + this.main_$ = Rkns.$('
    ') + .addClass("Rk-Bin-Main") + .appendTo(this.$) + .html('

    ' + _renkan.translate("Loading, please wait") + '

    '); + this.title_$.html(_opts.title || '(new bin)'); + this.renkan.resizeBins(); -var _BaseBin = Rkns._BaseBin = function(_renkan, _opts) { - if (typeof _renkan !== "undefined") { - this.renkan = _renkan; - this.renkan.$.find(".Rk-Bin-Main").hide(); - this.$ = Rkns.$('
  • ') - .addClass("Rk-Bin") - .appendTo(_renkan.$.find(".Rk-Bin-List")); - this.title_icon_$ = Rkns.$('') - .addClass("Rk-Bin-Title-Icon") - .appendTo(this.$); + if (_opts.auto_refresh) { + window.setInterval(function() { + _this.refresh(); + }, _opts.auto_refresh); + } + } + }; + _BaseBin.prototype.destroy = function() { + this.$.detach(); + this.renkan.resizeBins(); + }; + + /* Point of entry */ + + var Renkan = Rkns.Renkan = function(_opts) { var _this = this; - Rkns.$('') - .attr({ - href: "#", - title: _renkan.translate("Close bin") - }) - .addClass("Rk-Bin-Close") - .html('×') - .appendTo(this.$) - .click(function() { - _this.destroy(); - if (!_renkan.$.find(".Rk-Bin-Main:visible").length) { - _renkan.$.find(".Rk-Bin-Main:last").slideDown(); - } - _renkan.resizeBins(); - return false; - }); - Rkns.$('') - .attr({ - href: "#", - title: _renkan.translate("Refresh bin") - }) - .addClass("Rk-Bin-Refresh") - .appendTo(this.$) - .click(function() { - _this.refresh(); - return false; - }); - this.count_$ = Rkns.$('
    ') - .addClass("Rk-Bin-Count") - .appendTo(this.$); - this.title_$ = Rkns.$('

    ') - .addClass("Rk-Bin-Title") - .appendTo(this.$); - this.main_$ = Rkns.$('
    ') - .addClass("Rk-Bin-Main") - .appendTo(this.$) - .html('

    ' + _renkan.translate("Loading, please wait") + '

    '); - this.title_$.html(_opts.title || '(new bin)'); - this.renkan.resizeBins(); + Rkns.__renkans.push(this); + + this.options = _.defaults(_opts, Rkns.defaults, { + templates: renkanJST + }); + this.template = renkanJST['templates/main.html']; - if (_opts.auto_refresh) { - window.setInterval(function() { - _this.refresh(); - },_opts.auto_refresh); - } - } -}; - -_BaseBin.prototype.destroy = function() { - this.$.detach(); - this.renkan.resizeBins(); -}; - -/* Point of entry */ - -var Renkan = Rkns.Renkan = function(_opts) { - var _this = this; - - Rkns.__renkans.push(this); + _.each(this.options.property_files, function(f) { + Rkns.$.getJSON(f, function(data) { + _this.options.properties = _this.options.properties.concat(data); + }); + }); - this.options = _.defaults(_opts, Rkns.defaults, {templates: renkanJST}); - this.template = renkanJST['templates/main.html']; - - _.each(this.options.property_files,function(f) { - Rkns.$.getJSON(f, function(data) { - _this.options.properties = _this.options.properties.concat(data); - }); - }); - - this.read_only = this.options.read_only || !this.options.editor_mode; + this.read_only = this.options.read_only || !this.options.editor_mode; - this.project = new Rkns.Models.Project(); - - this.setCurrentUser = function (user_id, user_name) { - this.project.addUser({ - _id:user_id, - title: user_name - }); - this.current_user = user_id; - this.renderer.redrawUsers(); - }; + this.project = new Rkns.Models.Project(); + this.dataloader = new Rkns.DataLoader.Loader(this.project, this.options); - if (typeof this.options.user_id !== "undefined") { - this.current_user = this.options.user_id; - } - this.$ = Rkns.$("#" + this.options.container); - this.$ - .addClass("Rk-Main") - .html(this.template(this)); - - this.tabs = []; - this.search_engines = []; - - this.current_user_list = new Rkns.Models.UsersList(); - - this.current_user_list.on("add remove", function() { - if (this.renderer) { + this.setCurrentUser = function(user_id, user_name) { + this.project.addUser({ + _id: user_id, + title: user_name + }); + this.current_user = user_id; this.renderer.redrawUsers(); - } - }); - - this.colorPicker = (function() { - var _tmpl = renkanJST['templates/colorpicker.html']; - return '
      ' + Rkns.pickerColors.map(function(c) { return _tmpl({c:c});}).join("") + '
    '; - })(); - - if (this.options.show_editor) { - this.renderer = new Rkns.Renderer.Scene(this); - } + }; - if (!this.options.search.length) { - this.$.find(".Rk-Web-Search-Form").detach(); - } else { - var _tmpl = renkanJST['templates/search.html'], - _select = this.$.find(".Rk-Search-List"), - _input = this.$.find(".Rk-Web-Search-Input"), - _form = this.$.find(".Rk-Web-Search-Form"); - _.each(this.options.search, function(_search, _key) { - if (Rkns[_search.type] && Rkns[_search.type].Search) { - _this.search_engines.push(new Rkns[_search.type].Search(_this, _search)); - } - }); - _select.html( - _(this.search_engines).map(function(_search, _key) { - return _tmpl({ - key: _key, - title: _search.getSearchTitle(), - className: _search.getBgClass() - }); - }).join("") - ); - _select.find("li").click(function() { - var _el = Rkns.$(this); - _this.setSearchEngine(_el.attr("data-key")); - _form.submit(); - }); - _form.submit(function() { - if (_input.val()) { - var _search = _this.search_engine; - _search.search(_input.val()); - } - return false; - }); - this.$.find(".Rk-Search-Current").mouseenter( - function() { _select.slideDown(); } - ); - this.$.find(".Rk-Search-Select").mouseleave( - function() { _select.hide(); } - ); - this.setSearchEngine(0); - } - _.each(this.options.bins, function(_bin) { - if (Rkns[_bin.type] && Rkns[_bin.type].Bin) { - _this.tabs.push(new Rkns[_bin.type].Bin(_this, _bin)); + if (typeof this.options.user_id !== "undefined") { + this.current_user = this.options.user_id; } - }); - - var elementDropped = false; + this.$ = Rkns.$("#" + this.options.container); + this.$ + .addClass("Rk-Main") + .html(this.template(this)); - this.$.find(".Rk-Bins") - .on("click",".Rk-Bin-Title,.Rk-Bin-Title-Icon", function() { - var _mainDiv = Rkns.$(this).siblings(".Rk-Bin-Main"); - if (_mainDiv.is(":hidden")) { - _this.$.find(".Rk-Bin-Main").slideUp(); - _mainDiv.slideDown(); + this.tabs = []; + this.search_engines = []; + + this.current_user_list = new Rkns.Models.UsersList(); + + this.current_user_list.on("add remove", function() { + if (this.renderer) { + this.renderer.redrawUsers(); } }); - if (this.options.show_editor) { - - this.$.find(".Rk-Bins").on("mouseover", ".Rk-Bin-Item", function(_e) { - var _t = Rkns.$(this); - if (_t && $(_t).attr("data-uri")) { - var _models = _this.project.get("nodes").where({ - uri: $(_t).attr("data-uri") - }); - _.each(_models, function(_model) { - _this.renderer.highlightModel(_model); + this.colorPicker = (function() { + var _tmpl = renkanJST['templates/colorpicker.html']; + return '
      ' + Rkns.pickerColors.map(function(c) { + return _tmpl({ + c: c }); - } - }).mouseout(function() { - _this.renderer.unhighlightAll(); - }).on("mousemove", ".Rk-Bin-Item", function(e) { - try { - this.dragDrop(); - } - catch(err) {} - }).on("touchstart", ".Rk-Bin-Item", function(e) { - elementDropped = false; - }).on("touchmove", ".Rk-Bin-Item", function(e) { - e.preventDefault(); - var touch = e.originalEvent.changedTouches[0], - off = _this.renderer.canvas_$.offset(), - w = _this.renderer.canvas_$.width(), - h = _this.renderer.canvas_$.height(); - if (touch.pageX >= off.left && touch.pageX < (off.left + w) && touch.pageY >= off.top && touch.pageY < (off.top + h)) { - if (elementDropped) { - _this.renderer.onMouseMove(touch, true); - } else { - elementDropped = true; - var div = document.createElement('div'); - div.appendChild(this.cloneNode(true)); - _this.renderer.dropData({"text/html": div.innerHTML}, touch); - _this.renderer.onMouseDown(touch, true); + }).join("") + '
    '; + })(); + + if (this.options.show_editor) { + this.renderer = new Rkns.Renderer.Scene(this); + } + + if (!this.options.search.length) { + this.$.find(".Rk-Web-Search-Form").detach(); + } else { + var _tmpl = renkanJST['templates/search.html'], + _select = this.$.find(".Rk-Search-List"), + _input = this.$.find(".Rk-Web-Search-Input"), + _form = this.$.find(".Rk-Web-Search-Form"); + _.each(this.options.search, function(_search, _key) { + if (Rkns[_search.type] && Rkns[_search.type].Search) { + _this.search_engines.push(new Rkns[_search.type].Search(_this, _search)); } - } - }).on("touchend", ".Rk-Bin-Item", function(e) { - if (elementDropped) { - _this.renderer.onMouseUp(e.originalEvent.changedTouches[0], true); - } - elementDropped = false; - }).on("dragstart", ".Rk-Bin-Item", function(e) { - var div = document.createElement('div'); - div.appendChild(this.cloneNode(true)); - try { - e.originalEvent.dataTransfer.setData("text/html",div.innerHTML); - } - catch(err) { - e.originalEvent.dataTransfer.setData("text",div.innerHTML); + }); + _select.html( + _(this.search_engines).map(function(_search, _key) { + return _tmpl({ + key: _key, + title: _search.getSearchTitle(), + className: _search.getBgClass() + }); + }).join("") + ); + _select.find("li").click(function() { + var _el = Rkns.$(this); + _this.setSearchEngine(_el.attr("data-key")); + _form.submit(); + }); + _form.submit(function() { + if (_input.val()) { + var _search = _this.search_engine; + _search.search(_input.val()); + } + return false; + }); + this.$.find(".Rk-Search-Current").mouseenter( + function() { + _select.slideDown(); + } + ); + this.$.find(".Rk-Search-Select").mouseleave( + function() { + _select.hide(); + } + ); + this.setSearchEngine(0); + } + _.each(this.options.bins, function(_bin) { + if (Rkns[_bin.type] && Rkns[_bin.type].Bin) { + _this.tabs.push(new Rkns[_bin.type].Bin(_this, _bin)); } }); - } + var elementDropped = false; - Rkns.$(window).resize(function() { - _this.resizeBins(); - }); + this.$.find(".Rk-Bins") + .on("click", ".Rk-Bin-Title,.Rk-Bin-Title-Icon", function() { + var _mainDiv = Rkns.$(this).siblings(".Rk-Bin-Main"); + if (_mainDiv.is(":hidden")) { + _this.$.find(".Rk-Bin-Main").slideUp(); + _mainDiv.slideDown(); + } + }); - var lastsearch = false, lastval = ''; + if (this.options.show_editor) { - this.$.find(".Rk-Bins-Search-Input").on("change keyup paste input", function() { - var val = Rkns.$(this).val(); - if (val === lastval) { - return; + this.$.find(".Rk-Bins").on("mouseover", ".Rk-Bin-Item", function(_e) { + var _t = Rkns.$(this); + if (_t && $(_t).attr("data-uri")) { + var _models = _this.project.get("nodes").where({ + uri: $(_t).attr("data-uri") + }); + _.each(_models, function(_model) { + _this.renderer.highlightModel(_model); + }); + } + }).mouseout(function() { + _this.renderer.unhighlightAll(); + }).on("mousemove", ".Rk-Bin-Item", function(e) { + try { + this.dragDrop(); + } catch (err) {} + }).on("touchstart", ".Rk-Bin-Item", function(e) { + elementDropped = false; + }).on("touchmove", ".Rk-Bin-Item", function(e) { + e.preventDefault(); + var touch = e.originalEvent.changedTouches[0], + off = _this.renderer.canvas_$.offset(), + w = _this.renderer.canvas_$.width(), + h = _this.renderer.canvas_$.height(); + if (touch.pageX >= off.left && touch.pageX < (off.left + w) && touch.pageY >= off.top && touch.pageY < (off.top + h)) { + if (elementDropped) { + _this.renderer.onMouseMove(touch, true); + } else { + elementDropped = true; + var div = document.createElement('div'); + div.appendChild(this.cloneNode(true)); + _this.renderer.dropData({ + "text/html": div.innerHTML + }, touch); + _this.renderer.onMouseDown(touch, true); + } + } + }).on("touchend", ".Rk-Bin-Item", function(e) { + if (elementDropped) { + _this.renderer.onMouseUp(e.originalEvent.changedTouches[0], true); + } + elementDropped = false; + }).on("dragstart", ".Rk-Bin-Item", function(e) { + var div = document.createElement('div'); + div.appendChild(this.cloneNode(true)); + try { + e.originalEvent.dataTransfer.setData("text/html", div.innerHTML); + } catch (err) { + e.originalEvent.dataTransfer.setData("text", div.innerHTML); + } + }); + } - var search = Rkns.Utils.regexpFromTextOrArray(val.length > 1 ? val: null); - if (search.source === lastsearch) { - return; - } - lastsearch = search.source; - _.each(_this.tabs, function(tab) { - tab.render(search); + + Rkns.$(window).resize(function() { + _this.resizeBins(); }); - }); - this.$.find(".Rk-Bins-Search-Form").submit(function() { - return false; - }); - -}; - -Renkan.prototype.translate = function(_text) { - if (Rkns.i18n[this.options.language] && Rkns.i18n[this.options.language][_text]) { - return Rkns.i18n[this.options.language][_text]; - } - if (this.options.language.length > 2 && Rkns.i18n[this.options.language.substr(0,2)] && Rkns.i18n[this.options.language.substr(0,2)][_text]) { - return Rkns.i18n[this.options.language.substr(0,2)][_text]; - } - return _text; -}; - -Renkan.prototype.onStatusChange = function() { - this.renderer.onStatusChange(); -}; - -Renkan.prototype.setSearchEngine = function(_key) { - this.search_engine = this.search_engines[_key]; - this.$.find(".Rk-Search-Current").attr("class","Rk-Search-Current " + this.search_engine.getBgClass()); - var listClasses = this.search_engine.getBgClass().split(" "); - var classes = ""; - for (var i= 0; i < listClasses.length; i++) { - classes += "." + listClasses[i]; - } - this.$.find(".Rk-Web-Search-Input.Rk-Search-Input").attr("placeholder", this.translate("Search in ") + this.$.find(".Rk-Search-List "+ classes).html()); -}; - -Renkan.prototype.resizeBins = function() { - var _d = + this.$.find(".Rk-Bins-Head").outerHeight(); - this.$.find(".Rk-Bin-Title:visible").each(function() { - _d += Rkns.$(this).outerHeight(); - }); - this.$.find(".Rk-Bin-Main").css({ - height: this.$.find(".Rk-Bins").height() - _d - }); -}; - -/* Utility functions */ -var getUUID4 = function() { - return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function(c) { - var r = Math.random()*16|0, v = c === 'x' ? r : (r&0x3|0x8); - return v.toString(16); - }); -}; + var lastsearch = false, + lastval = ''; -Rkns.Utils = { - getUUID4 : getUUID4, - getUID : (function() { - function pad(n){ - return n<10 ? '0'+n : n; - } - var _d = new Date(), - ID_AUTO_INCREMENT = 0, - ID_BASE = _d.getUTCFullYear() + '-' + - pad(_d.getUTCMonth()+1) + '-' + - pad(_d.getUTCDate()) + '-' + - getUUID4(); - return function(_base) { - var _n = (++ID_AUTO_INCREMENT).toString(16), - _uidbase = (typeof _base === "undefined" ? "" : _base + "-" ); - while (_n.length < 4) { _n = '0' + _n; } - return _uidbase + ID_BASE + '-' + _n; - }; - })(), - getFullURL : function(url) { - - if(typeof(url) === 'undefined' || url == null ) { - return ""; - } - if(/https?:\/\//.test(url)) { - return url; - } - var img = new Image(); - img.src = url; - var res = img.src; - img.src = null; - return res; - - }, - inherit : function(_baseClass, _callbefore) { - - var _class = function(_arg) { - if (typeof _callbefore === "function") { - _callbefore.apply(this, Array.prototype.slice.call(arguments, 0)); + this.$.find(".Rk-Bins-Search-Input").on("change keyup paste input", function() { + var val = Rkns.$(this).val(); + if (val === lastval) { + return; } - _baseClass.apply(this, Array.prototype.slice.call(arguments, 0)); - if (typeof this._init === "function" && !this._initialized) { - this._init.apply(this, Array.prototype.slice.call(arguments, 0)); - this._initialized = true; + var search = Rkns.Utils.regexpFromTextOrArray(val.length > 1 ? val : null); + if (search.source === lastsearch) { + return; } - }; - _.extend(_class.prototype,_baseClass.prototype); - - return _class; - - }, - regexpFromTextOrArray: (function() { - var charsub = [ - '[aáàâä]', - '[cç]', - '[eéèêë]', - '[iíìîï]', - '[oóòôö]', - '[uùûü]' - ], - removeChars = [ - String.fromCharCode(768), String.fromCharCode(769), String.fromCharCode(770), String.fromCharCode(771), String.fromCharCode(807), - "{", "}", "(", ")", "[", "]", "【", "】", "、", "・", "‥", "。", "「", "」", "『", "』", "〜", ":", "!", "?", " ", - ",", " ", ";", "(", ")", ".", "*", "+", "\\", "?", "|", "{", "}", "[", "]", "^", "#", "/" - ], - remsrc = "[\\" + removeChars.join("\\") + "]", - remrx = new RegExp(remsrc, "gm"), - charsrx = _.map(charsub, function(c) { - return new RegExp(c); + lastsearch = search.source; + _.each(_this.tabs, function(tab) { + tab.render(search); }); - function replaceText(_text) { - var txt = _text.toLowerCase().replace(remrx,""), src = ""; - function makeReplaceFunc(l) { - return function(k,v) { - l = l.replace(charsrx[k], v); - }; - } - for (var j = 0; j < txt.length; j++) { - if (j) { - src += remsrc + "*"; - } - var l = txt[j]; - _.each(charsub, makeReplaceFunc(l)); - src += l; - } - return src; + }); + this.$.find(".Rk-Bins-Search-Form").submit(function() { + return false; + }); + + }; + + Renkan.prototype.translate = function(_text) { + if (Rkns.i18n[this.options.language] && Rkns.i18n[this.options.language][_text]) { + return Rkns.i18n[this.options.language][_text]; + } + if (this.options.language.length > 2 && Rkns.i18n[this.options.language.substr(0, 2)] && Rkns.i18n[this.options.language.substr(0, 2)][_text]) { + return Rkns.i18n[this.options.language.substr(0, 2)][_text]; } + return _text; + }; + + Renkan.prototype.onStatusChange = function() { + this.renderer.onStatusChange(); + }; + + Renkan.prototype.setSearchEngine = function(_key) { + this.search_engine = this.search_engines[_key]; + this.$.find(".Rk-Search-Current").attr("class", "Rk-Search-Current " + this.search_engine.getBgClass()); + var listClasses = this.search_engine.getBgClass().split(" "); + var classes = ""; + for (var i = 0; i < listClasses.length; i++) { + classes += "." + listClasses[i]; + } + this.$.find(".Rk-Web-Search-Input.Rk-Search-Input").attr("placeholder", this.translate("Search in ") + this.$.find(".Rk-Search-List " + classes).html()); + }; + + Renkan.prototype.resizeBins = function() { + var _d = +this.$.find(".Rk-Bins-Head").outerHeight(); + this.$.find(".Rk-Bin-Title:visible").each(function() { + _d += Rkns.$(this).outerHeight(); + }); + this.$.find(".Rk-Bin-Main").css({ + height: this.$.find(".Rk-Bins").height() - _d + }); + }; + + /* Utility functions */ + var getUUID4 = function() { + return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function(c) { + var r = Math.random() * 16 | 0, + v = c === 'x' ? r : (r & 0x3 | 0x8); + return v.toString(16); + }); + }; - function getSource(inp) { - switch (typeof inp) { - case "string": - return replaceText(inp); - case "object": - var src = ''; - _.each(inp, function(v) { - var res = getSource(v); - if (res) { - if (src) { - src += '|'; - } - src += res; - } - }); - return src; + Rkns.Utils = { + getUUID4: getUUID4, + getUID: (function() { + function pad(n) { + return n < 10 ? '0' + n : n; } - return ''; - } + var _d = new Date(), + ID_AUTO_INCREMENT = 0, + ID_BASE = _d.getUTCFullYear() + '-' + + pad(_d.getUTCMonth() + 1) + '-' + + pad(_d.getUTCDate()) + '-' + + getUUID4(); + return function(_base) { + var _n = (++ID_AUTO_INCREMENT).toString(16), + _uidbase = (typeof _base === "undefined" ? "" : _base + "-"); + while (_n.length < 4) { + _n = '0' + _n; + } + return _uidbase + ID_BASE + '-' + _n; + }; + })(), + getFullURL: function(url) { + + if (typeof(url) === 'undefined' || url == null) { + return ""; + } + if (/https?:\/\//.test(url)) { + return url; + } + var img = new Image(); + img.src = url; + var res = img.src; + img.src = null; + return res; + + }, + inherit: function(_baseClass, _callbefore) { - return function(_textOrArray) { - var source = getSource(_textOrArray); - if (source) { - var testrx = new RegExp( source, "im"), - replacerx = new RegExp( '(' + source + ')', "igm"); - return { - isempty: false, - source: source, - test: function(_t) { return testrx.test(_t); }, - replace: function(_text, _replace) { return _text.replace(replacerx, _replace); } - }; - } else { - return { - isempty: true, - source: '', - test: function() { return true; }, - replace: function(_text) { return text; } - }; - } - }; - })(), - /* The minimum distance (in pixels) the mouse has to move to consider an element was dragged */ - _MIN_DRAG_DISTANCE: 2, - /* Distance between the inner and outer radius of buttons that appear when hovering on a node */ - _NODE_BUTTON_WIDTH: 40, + var _class = function(_arg) { + if (typeof _callbefore === "function") { + _callbefore.apply(this, Array.prototype.slice.call(arguments, 0)); + } + _baseClass.apply(this, Array.prototype.slice.call(arguments, 0)); + if (typeof this._init === "function" && !this._initialized) { + this._init.apply(this, Array.prototype.slice.call(arguments, 0)); + this._initialized = true; + } + }; + _.extend(_class.prototype, _baseClass.prototype); + + return _class; + + }, + regexpFromTextOrArray: (function() { + var charsub = [ + '[aáàâä]', + '[cç]', + '[eéèêë]', + '[iíìîï]', + '[oóòôö]', + '[uùûü]' + ], + removeChars = [ + String.fromCharCode(768), String.fromCharCode(769), String.fromCharCode(770), String.fromCharCode(771), String.fromCharCode(807), + "{", "}", "(", ")", "[", "]", "【", "】", "、", "・", "‥", "。", "「", "」", "『", "』", "〜", ":", "!", "?", " ", + ",", " ", ";", "(", ")", ".", "*", "+", "\\", "?", "|", "{", "}", "[", "]", "^", "#", "/" + ], + remsrc = "[\\" + removeChars.join("\\") + "]", + remrx = new RegExp(remsrc, "gm"), + charsrx = _.map(charsub, function(c) { + return new RegExp(c); + }); + + function replaceText(_text) { + var txt = _text.toLowerCase().replace(remrx, ""), + src = ""; - _EDGE_BUTTON_INNER: 2, - _EDGE_BUTTON_OUTER: 40, - /* Constants used to know if a specific action is to be performed when clicking on the canvas */ - _CLICKMODE_ADDNODE: 1, - _CLICKMODE_STARTEDGE: 2, - _CLICKMODE_ENDEDGE: 3, - /* Node size step: Used to calculate the size change when clicking the +/- buttons */ - _NODE_SIZE_STEP: Math.LN2/4, - _MIN_SCALE: 1/20, - _MAX_SCALE: 20, - _MOUSEMOVE_RATE: 80, - _DOUBLETAP_DELAY: 800, - /* Maximum distance in pixels (squared, to reduce calculations) - * between two taps when double-tapping on a touch terminal */ - _DOUBLETAP_DISTANCE: 20*20, - /* A placeholder so a default colour is displayed when a node has a null value for its user property */ - _USER_PLACEHOLDER: function(_renkan) { - return { - color: _renkan.options.default_user_color, - title: _renkan.translate("(unknown user)"), - get: function(attr) { - return this[attr] || false; + function makeReplaceFunc(l) { + return function(k, v) { + l = l.replace(charsrx[k], v); + }; + } + for (var j = 0; j < txt.length; j++) { + if (j) { + src += remsrc + "*"; + } + var l = txt[j]; + _.each(charsub, makeReplaceFunc(l)); + src += l; + } + return src; + } + + function getSource(inp) { + switch (typeof inp) { + case "string": + return replaceText(inp); + case "object": + var src = ''; + _.each(inp, function(v) { + var res = getSource(v); + if (res) { + if (src) { + src += '|'; + } + src += res; + } + }); + return src; + } + return ''; } - }; - }, - /* The code for the "Drag and Add Bookmarklet", slightly minified and with whitespaces removed, though - * it doesn't seem that it's still a requirement in newer browsers (i.e. the ones compatibles with canvas drawing) - */ - _BOOKMARKLET_CODE: function(_renkan) { - 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='" + - _renkan.translate("Drag items from this website, drop them in Renkan").replace(/ /g,"_") + - "

    '.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);})();"; - }, - /* Shortens text to the required length then adds ellipsis */ - shortenText: function(_text, _maxlength) { - return (_text.length > _maxlength ? (_text.substr(0,_maxlength) + '…') : _text); - }, - /* Drawing an edit box with an arrow and positioning the edit box according to the position of the node/edge being edited - * Called by Rkns.Renderer.NodeEditor and Rkns.Renderer.EdgeEditor */ - drawEditBox: function(_options, _coords, _path, _xmargin, _selector) { - _selector.css({ - width: ( _options.tooltip_width - 2* _options.tooltip_padding ) - }); - var _height = _selector.outerHeight() + 2* _options.tooltip_padding, - _isLeft = (_coords.x < paper.view.center.x ? 1 : -1), - _left = _coords.x + _isLeft * ( _xmargin + _options.tooltip_arrow_length ), - _right = _coords.x + _isLeft * ( _xmargin + _options.tooltip_arrow_length + _options.tooltip_width ), - _top = _coords.y - _height / 2; - if (_top + _height > (paper.view.size.height - _options.tooltip_margin)) { - _top = Math.max( paper.view.size.height - _options.tooltip_margin, _coords.y + _options.tooltip_arrow_width / 2 ) - _height; - } - if (_top < _options.tooltip_margin) { - _top = Math.min( _options.tooltip_margin, _coords.y - _options.tooltip_arrow_width / 2 ); + + return function(_textOrArray) { + var source = getSource(_textOrArray); + if (source) { + var testrx = new RegExp(source, "im"), + replacerx = new RegExp('(' + source + ')', "igm"); + return { + isempty: false, + source: source, + test: function(_t) { + return testrx.test(_t); + }, + replace: function(_text, _replace) { + return _text.replace(replacerx, _replace); + } + }; + } else { + return { + isempty: true, + source: '', + test: function() { + return true; + }, + replace: function(_text) { + return text; + } + }; + } + }; + })(), + /* The minimum distance (in pixels) the mouse has to move to consider an element was dragged */ + _MIN_DRAG_DISTANCE: 2, + /* Distance between the inner and outer radius of buttons that appear when hovering on a node */ + _NODE_BUTTON_WIDTH: 40, + + _EDGE_BUTTON_INNER: 2, + _EDGE_BUTTON_OUTER: 40, + /* Constants used to know if a specific action is to be performed when clicking on the canvas */ + _CLICKMODE_ADDNODE: 1, + _CLICKMODE_STARTEDGE: 2, + _CLICKMODE_ENDEDGE: 3, + /* Node size step: Used to calculate the size change when clicking the +/- buttons */ + _NODE_SIZE_STEP: Math.LN2 / 4, + _MIN_SCALE: 1 / 20, + _MAX_SCALE: 20, + _MOUSEMOVE_RATE: 80, + _DOUBLETAP_DELAY: 800, + /* Maximum distance in pixels (squared, to reduce calculations) + * between two taps when double-tapping on a touch terminal */ + _DOUBLETAP_DISTANCE: 20 * 20, + /* A placeholder so a default colour is displayed when a node has a null value for its user property */ + _USER_PLACEHOLDER: function(_renkan) { + return { + color: _renkan.options.default_user_color, + title: _renkan.translate("(unknown user)"), + get: function(attr) { + return this[attr] || false; + } + }; + }, + /* The code for the "Drag and Add Bookmarklet", slightly minified and with whitespaces removed, though + * it doesn't seem that it's still a requirement in newer browsers (i.e. the ones compatibles with canvas drawing) + */ + _BOOKMARKLET_CODE: function(_renkan) { + 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='" + + _renkan.translate("Drag items from this website, drop them in Renkan").replace(/ /g, "_") + + "

    '.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);})();"; + }, + /* Shortens text to the required length then adds ellipsis */ + shortenText: function(_text, _maxlength) { + return (_text.length > _maxlength ? (_text.substr(0, _maxlength) + '…') : _text); + }, + /* Drawing an edit box with an arrow and positioning the edit box according to the position of the node/edge being edited + * Called by Rkns.Renderer.NodeEditor and Rkns.Renderer.EdgeEditor */ + drawEditBox: function(_options, _coords, _path, _xmargin, _selector) { + _selector.css({ + width: (_options.tooltip_width - 2 * _options.tooltip_padding) + }); + var _height = _selector.outerHeight() + 2 * _options.tooltip_padding, + _isLeft = (_coords.x < paper.view.center.x ? 1 : -1), + _left = _coords.x + _isLeft * (_xmargin + _options.tooltip_arrow_length), + _right = _coords.x + _isLeft * (_xmargin + _options.tooltip_arrow_length + _options.tooltip_width), + _top = _coords.y - _height / 2; + if (_top + _height > (paper.view.size.height - _options.tooltip_margin)) { + _top = Math.max(paper.view.size.height - _options.tooltip_margin, _coords.y + _options.tooltip_arrow_width / 2) - _height; + } + if (_top < _options.tooltip_margin) { + _top = Math.min(_options.tooltip_margin, _coords.y - _options.tooltip_arrow_width / 2); + } + var _bottom = _top + _height; + /* jshint laxbreak:true */ + _path.segments[0].point = _path.segments[7].point = _coords.add([_isLeft * _xmargin, 0]); + _path.segments[1].point.x = _path.segments[2].point.x = _path.segments[5].point.x = _path.segments[6].point.x = _left; + _path.segments[3].point.x = _path.segments[4].point.x = _right; + _path.segments[2].point.y = _path.segments[3].point.y = _top; + _path.segments[4].point.y = _path.segments[5].point.y = _bottom; + _path.segments[1].point.y = _coords.y - _options.tooltip_arrow_width / 2; + _path.segments[6].point.y = _coords.y + _options.tooltip_arrow_width / 2; + _path.closed = true; + _path.fillColor = new paper.GradientColor(new paper.Gradient([_options.tooltip_top_color, _options.tooltip_bottom_color]), [0, _top], [0, _bottom]); + _selector.css({ + left: (_options.tooltip_padding + Math.min(_left, _right)), + top: (_options.tooltip_padding + _top) + }); + return _path; } - var _bottom = _top + _height; - /* jshint laxbreak:true */ - _path.segments[0].point - = _path.segments[7].point - = _coords.add([_isLeft * _xmargin, 0]); - _path.segments[1].point.x - = _path.segments[2].point.x - = _path.segments[5].point.x - = _path.segments[6].point.x - = _left; - _path.segments[3].point.x - = _path.segments[4].point.x - = _right; - _path.segments[2].point.y - = _path.segments[3].point.y - = _top; - _path.segments[4].point.y - = _path.segments[5].point.y - = _bottom; - _path.segments[1].point.y = _coords.y - _options.tooltip_arrow_width / 2; - _path.segments[6].point.y = _coords.y + _options.tooltip_arrow_width / 2; - _path.closed = true; - _path.fillColor = new paper.GradientColor(new paper.Gradient([_options.tooltip_top_color, _options.tooltip_bottom_color]), [0,_top], [0, _bottom]); - _selector.css({ - left: (_options.tooltip_padding + Math.min(_left, _right)), - top: (_options.tooltip_padding + _top) - }); - return _path; - } -}; + }; })(window); /* END main.js */ diff -r 03e8815a012d -r 18b9be54174d client/js/models.js --- a/client/js/models.js Fri May 22 17:50:10 2015 +0200 +++ b/client/js/models.js Tue Jun 02 16:42:02 2015 +0200 @@ -1,6 +1,5 @@ -(function() { +(function(root) { "use strict"; - var root = this; var Backbone = root.Backbone; @@ -191,8 +190,9 @@ // PROJECT var Project = Models.Project = RenkanModel.extend({ + schemaVersion : "1", type : "project", - blacklist : [ 'save_status', ], + blacklist : [ 'saveStatus', 'loadingStatus',], relations : [ { type : Backbone.HasMany, key : "users", @@ -269,6 +269,19 @@ } ); }, + getSchemaVersion : function(data) { + var t = data; + if(typeof(t) === "undefined") { + t = this; + } + var version = t.schemaVersion; + if(!version) { + return 1; + } + else { + return version; + } + }, // Add event handler to remove edges when a node is removed initialize : function() { var _this = this; @@ -283,6 +296,7 @@ }, toJSON : function() { var json = _.clone(this.attributes); + json.schema_version = this.schemaVersion; for ( var attr in json) { if ((json[attr] instanceof Backbone.Model) || (json[attr] instanceof Backbone.Collection) || @@ -347,4 +361,4 @@ model : RosterUser }); -}).call(window); +})(window); diff -r 03e8815a012d -r 18b9be54174d client/js/renderer/scene.js --- a/client/js/renderer/scene.js Fri May 22 17:50:10 2015 +0200 +++ b/client/js/renderer/scene.js Tue Jun 02 16:42:02 2015 +0200 @@ -338,8 +338,8 @@ _thRedrawUsers(); // register model events - this.renkan.project.on("change:save_status", function(){ - switch (_this.renkan.project.get("save_status")) { + this.renkan.project.on("change:saveStatus", function(){ + switch (_this.renkan.project.get("saveStatus")) { case 0: //clean _this.$.find(".Rk-Save-Button").removeClass("to-save"); _this.$.find(".Rk-Save-Button").removeClass("saving"); @@ -358,8 +358,8 @@ } }); - this.renkan.project.on("change:loading_status", function(){ - if (_this.renkan.project.get("loading_status")){ + this.renkan.project.on("change:loadingStatus", function(){ + if (_this.renkan.project.get("loadingStatus")){ var animate = _this.$.find(".loader").addClass("run"); var timer = setTimeout(function(){ _this.$.find(".loader").hide(250); @@ -380,13 +380,13 @@ this.renkan.project.on("add:nodes", function(_node) { _this.addRepresentation("Node", _node); - if (!_this.renkan.project.get("loading_status")){ + if (!_this.renkan.project.get("loadingStatus")){ _thRedraw(); } }); this.renkan.project.on("add:edges", function(_edge) { _this.addRepresentation("Edge", _edge); - if (!_this.renkan.project.get("loading_status")){ + if (!_this.renkan.project.get("loadingStatus")){ _thRedraw(); } }); @@ -742,7 +742,7 @@ addRepresentations: function(_type, _collection) { var _this = this; _collection.forEach(function(_model) { - //_this.addRepresentation(_type, _model); + _this.addRepresentation(_type, _model); }); }, userTemplate: _.template( diff -r 03e8815a012d -r 18b9be54174d client/js/save-once.js --- a/client/js/save-once.js Fri May 22 17:50:10 2015 +0200 +++ b/client/js/save-once.js Tue Jun 02 16:42:02 2015 +0200 @@ -20,12 +20,12 @@ url: _opts.url, data: getdata, beforeSend: function(){ - _proj.set({loading_status:true}); + _proj.set({loadingStatus:true}); }, success: function(_data) { - _proj.set(_data, {validate: true}); - _proj.set({loading_status:false}); - _proj.set({save_status:0}); + _renkan.dataloader.load(_data); + _proj.set({loadingStatus:false}); + _proj.set({saveStatus:0}); _renkan.renderer.autoScale(); } }); @@ -39,20 +39,20 @@ contentType: "application/json", data: JSON.stringify(_data), beforeSend: function(){ - _proj.set({save_status:2}); + _proj.set({saveStatus:2}); }, success: function(data, textStatus, jqXHR) { $(window).off("beforeunload", _onLeave); _saveWarn = false; - _proj.set({save_status:0}); + _proj.set({saveStatus:0}); //document.location.hash = "#id=" + data.id; //$(".Rk-Notifications").text("Saved as "+document.location.href).fadeIn().delay(2000).fadeOut(); } }); }; var _checkLeave = function() { - _proj.set({save_status:1}); - + _proj.set({saveStatus:1}); + var title = _proj.get("title"); if (title && _proj.get("nodes").length) { $(".Rk-Save-Button").removeClass("disabled"); @@ -69,14 +69,14 @@ }; _load(); _proj.on("add:nodes add:edges add:users change", function(_model) { - _model.on("change remove", function(_model) { - if(!(_model.changedAttributes.length === 1 && _model.hasChanged('save_status'))) { - _checkLeave(); - } - }); - if(!(_proj.changedAttributes.length === 1 && _proj.hasChanged('save_status'))) { - _checkLeave(); - } + _model.on("change remove", function(_model) { + if(!(_model.changedAttributes.length === 1 && _model.hasChanged('saveStatus'))) { + _checkLeave(); + } + }); + if(!(_proj.changedAttributes.length === 1 && _proj.hasChanged('saveStatus'))) { + _checkLeave(); + } }); _renkan.renderer.save = function() { if ($(".Rk-Save-Button").hasClass("disabled")) { diff -r 03e8815a012d -r 18b9be54174d client/test/publish-test-min.html --- a/client/test/publish-test-min.html Fri May 22 17:50:10 2015 +0200 +++ b/client/test/publish-test-min.html Tue Jun 02 16:42:02 2015 +0200 @@ -13,6 +13,7 @@ + diff -r 03e8815a012d -r 18b9be54174d client/test/publish-test.html --- a/client/test/publish-test.html Fri May 22 17:50:10 2015 +0200 +++ b/client/test/publish-test.html Tue Jun 02 16:42:02 2015 +0200 @@ -13,6 +13,7 @@ + diff -r 03e8815a012d -r 18b9be54174d client/test/render-test.html --- a/client/test/render-test.html Fri May 22 17:50:10 2015 +0200 +++ b/client/test/render-test.html Tue Jun 02 16:42:02 2015 +0200 @@ -13,6 +13,7 @@ + diff -r 03e8815a012d -r 18b9be54174d client/test/space-editor.html --- a/client/test/space-editor.html Fri May 22 17:50:10 2015 +0200 +++ b/client/test/space-editor.html Tue Jun 02 16:42:02 2015 +0200 @@ -14,6 +14,7 @@ + diff -r 03e8815a012d -r 18b9be54174d client/test/test-readonly-body-no-zoom.html --- a/client/test/test-readonly-body-no-zoom.html Fri May 22 17:50:10 2015 +0200 +++ b/client/test/test-readonly-body-no-zoom.html Tue Jun 02 16:42:02 2015 +0200 @@ -13,6 +13,7 @@ + diff -r 03e8815a012d -r 18b9be54174d client/test/test-readonly-body-zoom-save.html --- a/client/test/test-readonly-body-zoom-save.html Fri May 22 17:50:10 2015 +0200 +++ b/client/test/test-readonly-body-zoom-save.html Tue Jun 02 16:42:02 2015 +0200 @@ -13,6 +13,7 @@ + diff -r 03e8815a012d -r 18b9be54174d client/test/test-readonly-body.html --- a/client/test/test-readonly-body.html Fri May 22 17:50:10 2015 +0200 +++ b/client/test/test-readonly-body.html Tue Jun 02 16:42:02 2015 +0200 @@ -13,6 +13,7 @@ + diff -r 03e8815a012d -r 18b9be54174d client/test/test-readonly-div-editor-panel.html --- a/client/test/test-readonly-div-editor-panel.html Fri May 22 17:50:10 2015 +0200 +++ b/client/test/test-readonly-div-editor-panel.html Tue Jun 02 16:42:02 2015 +0200 @@ -13,6 +13,7 @@ + diff -r 03e8815a012d -r 18b9be54174d client/test/test-readonly-div-resize.html --- a/client/test/test-readonly-div-resize.html Fri May 22 17:50:10 2015 +0200 +++ b/client/test/test-readonly-div-resize.html Tue Jun 02 16:42:02 2015 +0200 @@ -13,6 +13,7 @@ + diff -r 03e8815a012d -r 18b9be54174d client/test/test-readonly-div.html --- a/client/test/test-readonly-div.html Fri May 22 17:50:10 2015 +0200 +++ b/client/test/test-readonly-div.html Tue Jun 02 16:42:02 2015 +0200 @@ -13,6 +13,7 @@ + diff -r 03e8815a012d -r 18b9be54174d client/test/test-writable-bins-div-100.html --- a/client/test/test-writable-bins-div-100.html Fri May 22 17:50:10 2015 +0200 +++ b/client/test/test-writable-bins-div-100.html Tue Jun 02 16:42:02 2015 +0200 @@ -13,6 +13,7 @@ + diff -r 03e8815a012d -r 18b9be54174d client/test/test-writable-bins-div.html --- a/client/test/test-writable-bins-div.html Fri May 22 17:50:10 2015 +0200 +++ b/client/test/test-writable-bins-div.html Tue Jun 02 16:42:02 2015 +0200 @@ -13,6 +13,7 @@ + diff -r 03e8815a012d -r 18b9be54174d client/test/test-writable-bins-save-on-click.html --- a/client/test/test-writable-bins-save-on-click.html Fri May 22 17:50:10 2015 +0200 +++ b/client/test/test-writable-bins-save-on-click.html Tue Jun 02 16:42:02 2015 +0200 @@ -13,6 +13,7 @@ + diff -r 03e8815a012d -r 18b9be54174d client/test/test-writable-bins.html --- a/client/test/test-writable-bins.html Fri May 22 17:50:10 2015 +0200 +++ b/client/test/test-writable-bins.html Tue Jun 02 16:42:02 2015 +0200 @@ -13,6 +13,7 @@ + diff -r 03e8815a012d -r 18b9be54174d client/test/test-writable-simple-div-editor-panel.html --- a/client/test/test-writable-simple-div-editor-panel.html Fri May 22 17:50:10 2015 +0200 +++ b/client/test/test-writable-simple-div-editor-panel.html Tue Jun 02 16:42:02 2015 +0200 @@ -13,6 +13,7 @@ + diff -r 03e8815a012d -r 18b9be54174d client/test/test-writable-simple-div-user.html --- a/client/test/test-writable-simple-div-user.html Fri May 22 17:50:10 2015 +0200 +++ b/client/test/test-writable-simple-div-user.html Tue Jun 02 16:42:02 2015 +0200 @@ -13,6 +13,7 @@ + diff -r 03e8815a012d -r 18b9be54174d client/test/test-writable-simple-div.html --- a/client/test/test-writable-simple-div.html Fri May 22 17:50:10 2015 +0200 +++ b/client/test/test-writable-simple-div.html Tue Jun 02 16:42:02 2015 +0200 @@ -13,6 +13,7 @@ + diff -r 03e8815a012d -r 18b9be54174d client/test/test-writable-simple-empty.html --- a/client/test/test-writable-simple-empty.html Fri May 22 17:50:10 2015 +0200 +++ b/client/test/test-writable-simple-empty.html Tue Jun 02 16:42:02 2015 +0200 @@ -13,6 +13,7 @@ + diff -r 03e8815a012d -r 18b9be54174d client/test/test-writable-simple-no-img-upload.html --- a/client/test/test-writable-simple-no-img-upload.html Fri May 22 17:50:10 2015 +0200 +++ b/client/test/test-writable-simple-no-img-upload.html Tue Jun 02 16:42:02 2015 +0200 @@ -14,6 +14,7 @@ + diff -r 03e8815a012d -r 18b9be54174d client/test/test-writable-simple-zoom-save.html --- a/client/test/test-writable-simple-zoom-save.html Fri May 22 17:50:10 2015 +0200 +++ b/client/test/test-writable-simple-zoom-save.html Tue Jun 02 16:42:02 2015 +0200 @@ -13,6 +13,7 @@ + diff -r 03e8815a012d -r 18b9be54174d client/test/test-writable-simple.html --- a/client/test/test-writable-simple.html Fri May 22 17:50:10 2015 +0200 +++ b/client/test/test-writable-simple.html Tue Jun 02 16:42:02 2015 +0200 @@ -13,6 +13,7 @@ + diff -r 03e8815a012d -r 18b9be54174d server/java/renkan-core/src/main/java/org/iri_research/renkan/Constants.java --- a/server/java/renkan-core/src/main/java/org/iri_research/renkan/Constants.java Fri May 22 17:50:10 2015 +0200 +++ b/server/java/renkan-core/src/main/java/org/iri_research/renkan/Constants.java Tue Jun 02 16:42:02 2015 +0200 @@ -17,6 +17,9 @@ public final static String PROPERTIES_CLASSPATH_NAME = "renkan_run.properties"; public final static String ANONYMOUS_USER_BASE_NAME = "Anonymous"; + public final static String UNKNOWN_SCHEMA_VERSION = "1"; + public final static String SCHEMA_VERSION = "2"; + private final static EthernetAddress ETHERNET_ADRESS = EthernetAddress .fromInterface(); public final static NoArgGenerator UUID_GENERATOR = Generators @@ -45,7 +48,7 @@ public final static String ROLE_USER = "ROLE_USER"; - + public final static List USER_ROLES_SELECT = Collections .unmodifiableList(new ArrayList() { private static final long serialVersionUID = -3041530185134732199L; diff -r 03e8815a012d -r 18b9be54174d server/java/renkan-core/src/main/java/org/iri_research/renkan/models/Project.java --- a/server/java/renkan-core/src/main/java/org/iri_research/renkan/models/Project.java Fri May 22 17:50:10 2015 +0200 +++ b/server/java/renkan-core/src/main/java/org/iri_research/renkan/models/Project.java Tue Jun 02 16:42:02 2015 +0200 @@ -32,6 +32,10 @@ private static Logger logger = LoggerFactory.getLogger(Project.class); + @Field("schema_version") + @JsonProperty("schema_version") + private String schemaVersion = Constants.SCHEMA_VERSION; + @Field("rev_counter") private int revCounter = 1; @@ -52,7 +56,7 @@ // edges @DBRef private List edges = new ArrayList(); - + //views private List views = new ArrayList(); @@ -61,7 +65,7 @@ public Project(Project project) { this(project.spaceId, Constants.UUID_GENERATOR.generate().toString(), - project.title, project.description, project.uri, new DateTime()); + project.title, project.description, project.uri, new DateTime(), project.schemaVersion); Map nodeCloneMap = new HashMap( project.nodes.size()); @@ -81,7 +85,7 @@ } public Project(String spaceId, String id, String title, String description, - String uri, DateTime created, int revCounter) { + String uri, DateTime created, String schemaVersion, int revCounter) { super(id, title, description, uri, null); if(this.id == null) { @@ -94,12 +98,25 @@ this.created = new DateTime(); } this.setUpdated(new DateTime()); + + if(schemaVersion != null) { + this.schemaVersion = schemaVersion; + } + else { + this.schemaVersion = Constants.UNKNOWN_SCHEMA_VERSION; + } + } + + public Project(String spaceId, String id, String title, String description, + String uri, DateTime created, String schemaVersion) { + this(spaceId, id, title, description, uri, created, schemaVersion, 1); + logger.debug("partial constructor used"); } @Autowired(required = true) public Project(String spaceId, String id, String title, String description, String uri, DateTime created) { - this(spaceId, id, title, description, uri, created, 1); + this(spaceId, id, title, description, uri, created, Constants.SCHEMA_VERSION, 1); logger.debug("partial constructor used"); } @@ -122,7 +139,7 @@ public List getViews() { return this.views; } - + public List getUsers() { return this.users; } @@ -142,6 +159,11 @@ return spaceId; } + @JsonProperty("schema_version") + public String getSchemaVersion() { + return schemaVersion; + } + private String getRawKey(String prefix, Constants.EditMode editMode) { StringBuffer key = new StringBuffer(prefix != null ? prefix + "|" : ""); key.append(this.getId()); @@ -270,7 +292,7 @@ protected String getRawKeyPart() { return this.getId() + Long.toString(this.getCreated().getMillis()); } - + @Override protected String getDefaultId() { return UUID.randomUUID().toString(); diff -r 03e8815a012d -r 18b9be54174d server/java/renkan-web/src/main/webapp/WEB-INF/renkan.properties --- a/server/java/renkan-web/src/main/webapp/WEB-INF/renkan.properties Fri May 22 17:50:10 2015 +0200 +++ b/server/java/renkan-web/src/main/webapp/WEB-INF/renkan.properties Tue Jun 02 16:42:02 2015 +0200 @@ -1,6 +1,6 @@ mongodb.host.name = localhost mongodb.host.port = 27017 -mongodb.db.name = renkan +mongodb.db.name = renkan_05_20 user.admin.name = admin #user.admin.password = admin @@ -8,4 +8,4 @@ renkan.pagination.size = 2 renkan.coweb.debug = false -renkan.coweb.websocket = false \ No newline at end of file +renkan.coweb.websocket = false diff -r 03e8815a012d -r 18b9be54174d server/java/renkan-web/src/main/webapp/WEB-INF/web.xml --- a/server/java/renkan-web/src/main/webapp/WEB-INF/web.xml Fri May 22 17:50:10 2015 +0200 +++ b/server/java/renkan-web/src/main/webapp/WEB-INF/web.xml Tue Jun 02 16:42:02 2015 +0200 @@ -1,23 +1,24 @@ - - - org.springframework.web.context.ContextLoaderListener + + org.springframework.web.context.ContextLoaderListener - - org.springframework.web.context.request.RequestContextListener + + org.springframework.web.context.request.RequestContextListener - - contextConfigLocation - /WEB-INF/applicationContext.xml + + contextConfigLocation + /WEB-INF/applicationContext.xml cometd org.cometd.server.CometdServlet + false logLevel 1 @@ -29,7 +30,7 @@ jsonDebug false - + maxSessionsPerBrowser -1 @@ -51,6 +52,7 @@ admin org.coweb.servlet.AdminServlet + false ConfigURI /WEB-INF/cowebConfig.json @@ -64,6 +66,7 @@ restServlet org.glassfish.jersey.servlet.ServletContainer + false javax.ws.rs.Application org.iri_research.renkan.rest.RestApplication @@ -77,6 +80,7 @@ spring org.springframework.web.servlet.DispatcherServlet + false 1 diff -r 03e8815a012d -r 18b9be54174d server/java/renkan-web/src/main/webapp/static/js/corenkan.js --- a/server/java/renkan-web/src/main/webapp/static/js/corenkan.js Fri May 22 17:50:10 2015 +0200 +++ b/server/java/renkan-web/src/main/webapp/static/js/corenkan.js Tue Jun 02 16:42:02 2015 +0200 @@ -40,7 +40,7 @@ }); sess.onStatusChange = function(status) { - console.log(status); + console.log("STATUS : ", status); that.onInternalStatusChange(status); if(typeof that.onStatusChange === "function") { that.onStatusChange(status); @@ -119,7 +119,7 @@ var obj = json.parse(state); console.log("State response", obj); obj._id = obj.id; - this.project.set(obj, {validate: true}); + this.renkan.dataloader.load(obj); this.renkan.renderer.autoScale(); }; diff -r 03e8815a012d -r 18b9be54174d server/php/basic/README.md --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/server/php/basic/README.md Tue Jun 02 16:42:02 2015 +0200 @@ -0,0 +1,29 @@ +# Basic php server for Renkan + +This folder provides an example of a basic server for renkan. + +The data schema is very simple since there is only one table. +it has been tested on sqlite, postgresql and mysql. + +All path given in this README are relative to the directory containing this README.md file. + +## prerequisite + + - php 5.6 + - PDO extension with the driver of the database of your choice + - A database access allowint the table creation + +## Installation + +The root for the site is the `public_html` folder. +To serve the page you can either use a webserver or the simple webserver embedded in php. + +copy the `resource/config.php.tmpl` file to `resource/config.php` and complete the configuration. +If you choose to use the default sqlite database configuration, please make sure to create a `data` folder and make sure that you chosen webserver has write access to it. + +To serve the page you can for example use the php build-in webserver. For this, once you have created and configured the `resource/config.php` file just type the following commands: + +```shell: +$ cd public_html +$ php -S localhost:8000 +``` diff -r 03e8815a012d -r 18b9be54174d server/php/basic/public_html/index.php --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/server/php/basic/public_html/index.php Tue Jun 02 16:42:02 2015 +0200 @@ -0,0 +1,15 @@ + listProjects() + ); + + $css = ['static/lib/foundation/css/foundation-icons.css']; + + renderLayoutWithContentFile("home.php", $variables, $css); diff -r 03e8815a012d -r 18b9be54174d server/php/basic/public_html/renkan.php --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/server/php/basic/public_html/renkan.php Tue Jun 02 16:42:02 2015 +0200 @@ -0,0 +1,25 @@ + $resRenkan[0], 'self_url' => selfURL(), 'self_base_url' => selfBaseURL()]; + $css = []; + + renderLayoutWithContentFile("renkan_del.php", $variables, $css); diff -r 03e8815a012d -r 18b9be54174d server/php/basic/public_html/renkan_edit.php --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/server/php/basic/public_html/renkan_edit.php Tue Jun 02 16:42:02 2015 +0200 @@ -0,0 +1,32 @@ + $config, 'renkanId' => $_GET['renkanId']]; + $css = [ + 'static/lib/renkan/css/renkan.css' + ]; + + renderLayoutWithContentFile("renkan_edit.php", $variables, $css); diff -r 03e8815a012d -r 18b9be54174d server/php/basic/public_html/renkan_read.php --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/server/php/basic/public_html/renkan_read.php Tue Jun 02 16:42:02 2015 +0200 @@ -0,0 +1,12 @@ + $config, 'renkanId' => $_GET['renkanId']]; + $css = [ + 'static/lib/renkan/css/renkan.css' + ]; + + renderLayoutWithContentFile("renkan_read.php", $variables, $css); diff -r 03e8815a012d -r 18b9be54174d server/php/basic/public_html/static/css/renkanphp.css --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/server/php/basic/public_html/static/css/renkanphp.css Tue Jun 02 16:42:02 2015 +0200 @@ -0,0 +1,85 @@ +.Rk-PadTitle { + height: unset; +} + +.rnk-container { + min-height: 100%; + position: relative; + width: 100%; +} + +input[type="search"].Rk-GraphSearch-Field { + height: 2em; +} + +.Rk-Fold-Bins { + width: unset; +} + +.Rk-Bins-Title { + height: unset; + width: unset; +} + +input[type="search"].Rk-Bins-Search-Input { + width: 235px; + line-height: 25px; + height: 25px; + padding: 0; +} + + +#content { + position:absolute; + top:45px; + left: 0; + right: 0; + bottom: 45px; +} + +#renkanlist { + margin-top: 5em; +} + +#renkanlist-table { + width: 90%; +} + +#renkanlist-title-header { + width: 90%; +} + +#renkanlist-actions-header { + width: 10%; +} + + +.renkanlist-actions { + text-align: center; +} + +.renkanlist-actions .has-tip { + cursor: pointer; +} + +.renkanlist-actions span { + margin: 0 0.2em; +} + +.renkandel-buttons form { + display: inline-block; + margin: 0 0.5em; +} + +footer{ + height: 40px; + position: fixed; + bottom: 0px; + left: 0px; + line-height: 40px; + background: #333 none repeat scroll 0% 0%; + color: #FFF; + text-align: center; + width: 100%; + padding: 0px 10px; +} diff -r 03e8815a012d -r 18b9be54174d server/php/basic/public_html/static/img/.hgkeep --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/server/php/basic/public_html/static/img/.hgkeep Tue Jun 02 16:42:02 2015 +0200 @@ -0,0 +1,1 @@ + diff -r 03e8815a012d -r 18b9be54174d server/php/basic/public_html/static/img/renkan-white-30x30.png Binary file server/php/basic/public_html/static/img/renkan-white-30x30.png has changed diff -r 03e8815a012d -r 18b9be54174d server/php/basic/public_html/static/img/renkan.png Binary file server/php/basic/public_html/static/img/renkan.png has changed diff -r 03e8815a012d -r 18b9be54174d server/php/basic/public_html/static/js/vendor/fastclick.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/server/php/basic/public_html/static/js/vendor/fastclick.js Tue Jun 02 16:42:02 2015 +0200 @@ -0,0 +1,8 @@ +!function(){"use strict";/** + * @preserve FastClick: polyfill to remove click delays on browsers with touch UIs. + * + * @codingstandard ftlabs-jsv2 + * @copyright The Financial Times Limited [All Rights Reserved] + * @license MIT License (see LICENSE.txt) + */ +function a(b,d){function e(a,b){return function(){return a.apply(b,arguments)}}var f;if(d=d||{},this.trackingClick=!1,this.trackingClickStart=0,this.targetElement=null,this.touchStartX=0,this.touchStartY=0,this.lastTouchIdentifier=0,this.touchBoundary=d.touchBoundary||10,this.layer=b,this.tapDelay=d.tapDelay||200,this.tapTimeout=d.tapTimeout||700,!a.notNeeded(b)){for(var g=["onMouse","onClick","onTouchStart","onTouchMove","onTouchEnd","onTouchCancel"],h=this,i=0,j=g.length;j>i;i++)h[g[i]]=e(h[g[i]],h);c&&(b.addEventListener("mouseover",this.onMouse,!0),b.addEventListener("mousedown",this.onMouse,!0),b.addEventListener("mouseup",this.onMouse,!0)),b.addEventListener("click",this.onClick,!0),b.addEventListener("touchstart",this.onTouchStart,!1),b.addEventListener("touchmove",this.onTouchMove,!1),b.addEventListener("touchend",this.onTouchEnd,!1),b.addEventListener("touchcancel",this.onTouchCancel,!1),Event.prototype.stopImmediatePropagation||(b.removeEventListener=function(a,c,d){var e=Node.prototype.removeEventListener;"click"===a?e.call(b,a,c.hijacked||c,d):e.call(b,a,c,d)},b.addEventListener=function(a,c,d){var e=Node.prototype.addEventListener;"click"===a?e.call(b,a,c.hijacked||(c.hijacked=function(a){a.propagationStopped||c(a)}),d):e.call(b,a,c,d)}),"function"==typeof b.onclick&&(f=b.onclick,b.addEventListener("click",function(a){f(a)},!1),b.onclick=null)}}var b=navigator.userAgent.indexOf("Windows Phone")>=0,c=navigator.userAgent.indexOf("Android")>0&&!b,d=/iP(ad|hone|od)/.test(navigator.userAgent)&&!b,e=d&&/OS 4_\d(_\d)?/.test(navigator.userAgent),f=d&&/OS [6-7]_\d/.test(navigator.userAgent),g=navigator.userAgent.indexOf("BB10")>0;a.prototype.needsClick=function(a){switch(a.nodeName.toLowerCase()){case"button":case"select":case"textarea":if(a.disabled)return!0;break;case"input":if(d&&"file"===a.type||a.disabled)return!0;break;case"label":case"iframe":case"video":return!0}return/\bneedsclick\b/.test(a.className)},a.prototype.needsFocus=function(a){switch(a.nodeName.toLowerCase()){case"textarea":return!0;case"select":return!c;case"input":switch(a.type){case"button":case"checkbox":case"file":case"image":case"radio":case"submit":return!1}return!a.disabled&&!a.readOnly;default:return/\bneedsfocus\b/.test(a.className)}},a.prototype.sendClick=function(a,b){var c,d;document.activeElement&&document.activeElement!==a&&document.activeElement.blur(),d=b.changedTouches[0],c=document.createEvent("MouseEvents"),c.initMouseEvent(this.determineEventType(a),!0,!0,window,1,d.screenX,d.screenY,d.clientX,d.clientY,!1,!1,!1,!1,0,null),c.forwardedTouchEvent=!0,a.dispatchEvent(c)},a.prototype.determineEventType=function(a){return c&&"select"===a.tagName.toLowerCase()?"mousedown":"click"},a.prototype.focus=function(a){var b;d&&a.setSelectionRange&&0!==a.type.indexOf("date")&&"time"!==a.type&&"month"!==a.type?(b=a.value.length,a.setSelectionRange(b,b)):a.focus()},a.prototype.updateScrollParent=function(a){var b,c;if(b=a.fastClickScrollParent,!b||!b.contains(a)){c=a;do{if(c.scrollHeight>c.offsetHeight){b=c,a.fastClickScrollParent=c;break}c=c.parentElement}while(c)}b&&(b.fastClickLastScrollTop=b.scrollTop)},a.prototype.getTargetElementFromEventTarget=function(a){return a.nodeType===Node.TEXT_NODE?a.parentNode:a},a.prototype.onTouchStart=function(a){var b,c,f;if(a.targetTouches.length>1)return!0;if(b=this.getTargetElementFromEventTarget(a.target),c=a.targetTouches[0],d){if(f=window.getSelection(),f.rangeCount&&!f.isCollapsed)return!0;if(!e){if(c.identifier&&c.identifier===this.lastTouchIdentifier)return a.preventDefault(),!1;this.lastTouchIdentifier=c.identifier,this.updateScrollParent(b)}}return this.trackingClick=!0,this.trackingClickStart=a.timeStamp,this.targetElement=b,this.touchStartX=c.pageX,this.touchStartY=c.pageY,a.timeStamp-this.lastClickTimec||Math.abs(b.pageY-this.touchStartY)>c?!0:!1},a.prototype.onTouchMove=function(a){return this.trackingClick?((this.targetElement!==this.getTargetElementFromEventTarget(a.target)||this.touchHasMoved(a))&&(this.trackingClick=!1,this.targetElement=null),!0):!0},a.prototype.findControl=function(a){return void 0!==a.control?a.control:a.htmlFor?document.getElementById(a.htmlFor):a.querySelector("button, input:not([type=hidden]), keygen, meter, output, progress, select, textarea")},a.prototype.onTouchEnd=function(a){var b,g,h,i,j,k=this.targetElement;if(!this.trackingClick)return!0;if(a.timeStamp-this.lastClickTimethis.tapTimeout)return!0;if(this.cancelNextClick=!1,this.lastClickTime=a.timeStamp,g=this.trackingClickStart,this.trackingClick=!1,this.trackingClickStart=0,f&&(j=a.changedTouches[0],k=document.elementFromPoint(j.pageX-window.pageXOffset,j.pageY-window.pageYOffset)||k,k.fastClickScrollParent=this.targetElement.fastClickScrollParent),h=k.tagName.toLowerCase(),"label"===h){if(b=this.findControl(k)){if(this.focus(k),c)return!1;k=b}}else if(this.needsFocus(k))return a.timeStamp-g>100||d&&window.top!==window&&"input"===h?(this.targetElement=null,!1):(this.focus(k),this.sendClick(k,a),d&&"select"===h||(this.targetElement=null,a.preventDefault()),!1);return d&&!e&&(i=k.fastClickScrollParent,i&&i.fastClickLastScrollTop!==i.scrollTop)?!0:(this.needsClick(k)||(a.preventDefault(),this.sendClick(k,a)),!1)},a.prototype.onTouchCancel=function(){this.trackingClick=!1,this.targetElement=null},a.prototype.onMouse=function(a){return this.targetElement?a.forwardedTouchEvent?!0:a.cancelable&&(!this.needsClick(this.targetElement)||this.cancelNextClick)?(a.stopImmediatePropagation?a.stopImmediatePropagation():a.propagationStopped=!0,a.stopPropagation(),a.preventDefault(),!1):!0:!0},a.prototype.onClick=function(a){var b;return this.trackingClick?(this.targetElement=null,this.trackingClick=!1,!0):"submit"===a.target.type&&0===a.detail?!0:(b=this.onMouse(a),b||(this.targetElement=null),b)},a.prototype.destroy=function(){var a=this.layer;c&&(a.removeEventListener("mouseover",this.onMouse,!0),a.removeEventListener("mousedown",this.onMouse,!0),a.removeEventListener("mouseup",this.onMouse,!0)),a.removeEventListener("click",this.onClick,!0),a.removeEventListener("touchstart",this.onTouchStart,!1),a.removeEventListener("touchmove",this.onTouchMove,!1),a.removeEventListener("touchend",this.onTouchEnd,!1),a.removeEventListener("touchcancel",this.onTouchCancel,!1)},a.notNeeded=function(a){var b,d,e,f;if("undefined"==typeof window.ontouchstart)return!0;if(d=+(/Chrome\/([0-9]+)/.exec(navigator.userAgent)||[,0])[1]){if(!c)return!0;if(b=document.querySelector("meta[name=viewport]")){if(-1!==b.content.indexOf("user-scalable=no"))return!0;if(d>31&&document.documentElement.scrollWidth<=window.outerWidth)return!0}}if(g&&(e=navigator.userAgent.match(/Version\/([0-9]*)\.([0-9]*)/),e[1]>=10&&e[2]>=3&&(b=document.querySelector("meta[name=viewport]")))){if(-1!==b.content.indexOf("user-scalable=no"))return!0;if(document.documentElement.scrollWidth<=window.outerWidth)return!0}return"none"===a.style.msTouchAction||"manipulation"===a.style.touchAction?!0:(f=+(/Firefox\/([0-9]+)/.exec(navigator.userAgent)||[,0])[1],f>=27&&(b=document.querySelector("meta[name=viewport]"),b&&(-1!==b.content.indexOf("user-scalable=no")||document.documentElement.scrollWidth<=window.outerWidth))?!0:"none"===a.style.touchAction||"manipulation"===a.style.touchAction?!0:!1)},a.attach=function(b,c){return new a(b,c)},"function"==typeof define&&"object"==typeof define.amd&&define.amd?define(function(){return a}):"undefined"!=typeof module&&module.exports?(module.exports=a.attach,module.exports.FastClick=a):window.FastClick=a}(); diff -r 03e8815a012d -r 18b9be54174d server/php/basic/public_html/static/js/vendor/jquery.cookie.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/server/php/basic/public_html/static/js/vendor/jquery.cookie.js Tue Jun 02 16:42:02 2015 +0200 @@ -0,0 +1,8 @@ +/*! + * jQuery Cookie Plugin v1.4.1 + * https://github.com/carhartl/jquery-cookie + * + * Copyright 2013 Klaus Hartl + * Released under the MIT license + */ +!function(a){"function"==typeof define&&define.amd?define(["jquery"],a):a("object"==typeof exports?require("jquery"):jQuery)}(function(a){function b(a){return h.raw?a:encodeURIComponent(a)}function c(a){return h.raw?a:decodeURIComponent(a)}function d(a){return b(h.json?JSON.stringify(a):String(a))}function e(a){0===a.indexOf('"')&&(a=a.slice(1,-1).replace(/\\"/g,'"').replace(/\\\\/g,"\\"));try{return a=decodeURIComponent(a.replace(g," ")),h.json?JSON.parse(a):a}catch(b){}}function f(b,c){var d=h.raw?b:e(b);return a.isFunction(c)?c(d):d}var g=/\+/g,h=a.cookie=function(e,g,i){if(void 0!==g&&!a.isFunction(g)){if(i=a.extend({},h.defaults,i),"number"==typeof i.expires){var j=i.expires,k=i.expires=new Date;k.setTime(+k+864e5*j)}return document.cookie=[b(e),"=",d(g),i.expires?"; expires="+i.expires.toUTCString():"",i.path?"; path="+i.path:"",i.domain?"; domain="+i.domain:"",i.secure?"; secure":""].join("")}for(var l=e?void 0:{},m=document.cookie?document.cookie.split("; "):[],n=0,o=m.length;o>n;n++){var p=m[n].split("="),q=c(p.shift()),r=p.join("=");if(e&&e===q){l=f(r,g);break}e||void 0===(r=f(r))||(l[q]=r)}return l};h.defaults={},a.removeCookie=function(b,c){return void 0===a.cookie(b)?!1:(a.cookie(b,"",a.extend({},c,{expires:-1})),!a.cookie(b))}}); diff -r 03e8815a012d -r 18b9be54174d server/php/basic/public_html/static/js/vendor/jquery.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/server/php/basic/public_html/static/js/vendor/jquery.js Tue Jun 02 16:42:02 2015 +0200 @@ -0,0 +1,27 @@ +/*! + * jQuery JavaScript Library v2.1.4 + * http://jquery.com/ + * + * Includes Sizzle.js + * http://sizzlejs.com/ + * + * Copyright 2005, 2014 jQuery Foundation, Inc. and other contributors + * Released under the MIT license + * http://jquery.org/license + * + * Date: 2015-04-28T16:01Z + */ +!function(a,b){"object"==typeof module&&"object"==typeof module.exports?module.exports=a.document?b(a,!0):function(a){if(!a.document)throw new Error("jQuery requires a window with a document");return b(a)}:b(a)}("undefined"!=typeof window?window:this,function(a,b){function c(a){var b="length"in a&&a.length,c=_.type(a);return"function"===c||_.isWindow(a)?!1:1===a.nodeType&&b?!0:"array"===c||0===b||"number"==typeof b&&b>0&&b-1 in a}function d(a,b,c){if(_.isFunction(b))return _.grep(a,function(a,d){return!!b.call(a,d,a)!==c});if(b.nodeType)return _.grep(a,function(a){return a===b!==c});if("string"==typeof b){if(ha.test(b))return _.filter(b,a,c);b=_.filter(b,a)}return _.grep(a,function(a){return U.call(b,a)>=0!==c})}function e(a,b){for(;(a=a[b])&&1!==a.nodeType;);return a}function f(a){var b=oa[a]={};return _.each(a.match(na)||[],function(a,c){b[c]=!0}),b}function g(){Z.removeEventListener("DOMContentLoaded",g,!1),a.removeEventListener("load",g,!1),_.ready()}function h(){Object.defineProperty(this.cache={},0,{get:function(){return{}}}),this.expando=_.expando+h.uid++}function i(a,b,c){var d;if(void 0===c&&1===a.nodeType)if(d="data-"+b.replace(ua,"-$1").toLowerCase(),c=a.getAttribute(d),"string"==typeof c){try{c="true"===c?!0:"false"===c?!1:"null"===c?null:+c+""===c?+c:ta.test(c)?_.parseJSON(c):c}catch(e){}sa.set(a,b,c)}else c=void 0;return c}function j(){return!0}function k(){return!1}function l(){try{return Z.activeElement}catch(a){}}function m(a,b){return _.nodeName(a,"table")&&_.nodeName(11!==b.nodeType?b:b.firstChild,"tr")?a.getElementsByTagName("tbody")[0]||a.appendChild(a.ownerDocument.createElement("tbody")):a}function n(a){return a.type=(null!==a.getAttribute("type"))+"/"+a.type,a}function o(a){var b=Ka.exec(a.type);return b?a.type=b[1]:a.removeAttribute("type"),a}function p(a,b){for(var c=0,d=a.length;d>c;c++)ra.set(a[c],"globalEval",!b||ra.get(b[c],"globalEval"))}function q(a,b){var c,d,e,f,g,h,i,j;if(1===b.nodeType){if(ra.hasData(a)&&(f=ra.access(a),g=ra.set(b,f),j=f.events)){delete g.handle,g.events={};for(e in j)for(c=0,d=j[e].length;d>c;c++)_.event.add(b,e,j[e][c])}sa.hasData(a)&&(h=sa.access(a),i=_.extend({},h),sa.set(b,i))}}function r(a,b){var c=a.getElementsByTagName?a.getElementsByTagName(b||"*"):a.querySelectorAll?a.querySelectorAll(b||"*"):[];return void 0===b||b&&_.nodeName(a,b)?_.merge([a],c):c}function s(a,b){var c=b.nodeName.toLowerCase();"input"===c&&ya.test(a.type)?b.checked=a.checked:("input"===c||"textarea"===c)&&(b.defaultValue=a.defaultValue)}function t(b,c){var d,e=_(c.createElement(b)).appendTo(c.body),f=a.getDefaultComputedStyle&&(d=a.getDefaultComputedStyle(e[0]))?d.display:_.css(e[0],"display");return e.detach(),f}function u(a){var b=Z,c=Oa[a];return c||(c=t(a,b),"none"!==c&&c||(Na=(Na||_("