93 _opts.container = "renkan"; |
93 _opts.container = "renkan"; |
94 } |
94 } |
95 if (typeof _opts.search !== "object" || !_opts.search) { |
95 if (typeof _opts.search !== "object" || !_opts.search) { |
96 _opts.search = []; |
96 _opts.search = []; |
97 } |
97 } |
|
98 if (typeof _opts.bins !== "object" || !_opts.bins) { |
|
99 _opts.bins = []; |
|
100 } |
98 if (typeof _opts.static_url !== "string") { |
101 if (typeof _opts.static_url !== "string") { |
99 _opts.static_url = ""; |
102 _opts.static_url = ""; |
|
103 } |
|
104 if (typeof _opts.show_bins !== "boolean") { |
|
105 _opts.show_bins = !!_opts.search.length || !!_opts.bins.length; |
|
106 } |
|
107 if (typeof _opts.read_only !== "boolean") { |
|
108 _opts.read_only = false; |
100 } |
109 } |
101 this.project = new Rkns.Models.Project(); |
110 this.project = new Rkns.Models.Project(); |
102 this.language = _opts.language; |
111 this.language = _opts.language; |
103 this.static_url = _opts.static_url; |
112 this.static_url = _opts.static_url; |
|
113 this.read_only = _opts.read_only; |
104 this.l10n = Rkns.i18n[_opts.language]; |
114 this.l10n = Rkns.i18n[_opts.language]; |
105 if (typeof _opts.user_id !== "undefined") { |
115 if (typeof _opts.user_id !== "undefined") { |
106 this.current_user = _opts.user_id; |
116 this.current_user = _opts.user_id; |
107 } |
117 } |
108 this.$ = Rkns.$("#" + _opts.container); |
118 this.$ = Rkns.$("#" + _opts.container); |
109 this.$ |
119 this.$ |
110 .addClass("Rk-Main") |
120 .addClass("Rk-Main") |
111 .html(this.template()); |
121 .html(this.template(_opts)); |
112 this.renderer = new Rkns.Renderer.Scene(this); |
122 this.renderer = new Rkns.Renderer.Scene(this); |
113 this.tabs = []; |
123 this.tabs = []; |
114 this.search_engines = []; |
124 this.search_engines = []; |
115 this.selected_bin_item = undefined; |
125 this.selected_bin_item = undefined; |
116 |
126 |
171 if (_mainDiv.is(":hidden")) { |
181 if (_mainDiv.is(":hidden")) { |
172 _this.$.find(".Rk-Bin-Main").slideUp(); |
182 _this.$.find(".Rk-Bin-Main").slideUp(); |
173 _mainDiv.slideDown(); |
183 _mainDiv.slideDown(); |
174 } |
184 } |
175 }).on("mousedown", ".Rk-Bin-Item", function() { |
185 }).on("mousedown", ".Rk-Bin-Item", function() { |
|
186 if (_this.read_only) { |
|
187 return false; |
|
188 } |
176 var _t = Rkns.$(this); |
189 var _t = Rkns.$(this); |
177 _t.addClass("dragging"); |
190 _t.addClass("dragging"); |
178 _this.selected_bin_item = { |
191 _this.selected_bin_item = { |
179 uri : $(_t).attr("data-uri"), |
192 uri : $(_t).attr("data-uri"), |
180 title : $(_t).attr("data-title"), |
193 title : $(_t).attr("data-title"), |
209 return false |
222 return false |
210 }); |
223 }); |
211 } |
224 } |
212 |
225 |
213 Rkns.Renkan.prototype.template = Rkns._.template( |
226 Rkns.Renkan.prototype.template = Rkns._.template( |
214 '<div class="Rk-Title"><h1>Hyper Plateau</h1></div><div class="Rk-Bins">' |
227 '<% if (show_bins) { %><div class="Rk-Title"><h1>Hyper Plateau</h1></div><div class="Rk-Bins">' |
215 + '<form class="Rk-Web-Search-Form Rk-Search-Form"><input class="Rk-Web-Search-Input Rk-Search-Input" type="search" placeholder="Search the Web" />' |
228 + '<form class="Rk-Web-Search-Form Rk-Search-Form"><input class="Rk-Web-Search-Input Rk-Search-Input" type="search" placeholder="Search the Web" />' |
216 + '<div class="Rk-Search-Select"><div class="Rk-Search-Current"></div><ul class="Rk-Search-List"></ul></div>' |
229 + '<div class="Rk-Search-Select"><div class="Rk-Search-Current"></div><ul class="Rk-Search-List"></ul></div>' |
217 + '<input type="submit" value="" class="Rk-Web-Search-Submit Rk-Search-Submit" /></form>' |
230 + '<input type="submit" value="" class="Rk-Web-Search-Submit Rk-Search-Submit" /></form>' |
218 + '<form class="Rk-Bins-Search-Form Rk-Search-Form"><input class="Rk-Bins-Search-Input Rk-Search-Input" type="search" placeholder="Search in Bins" />' |
231 + '<form class="Rk-Bins-Search-Form Rk-Search-Form"><input class="Rk-Bins-Search-Input Rk-Search-Input" type="search" placeholder="Search in Bins" />' |
219 + '<input type="submit" value="" class="Rk-Bins-Search-Submit Rk-Search-Submit" /></form>' |
232 + '<input type="submit" value="" class="Rk-Bins-Search-Submit Rk-Search-Submit" /></form>' |
220 + '<ul class="Rk-Bin-List"></ul></div><div class="Rk-Render Rk-Render-Panel"></div>' |
233 + '<ul class="Rk-Bin-List"></ul></div><% } %><div class="Rk-Render Rk-Render-<% if (show_bins) { %>Panel<% } else { %>Full<% } %>"></div>' |
221 ); |
234 ); |
222 |
235 |
223 |
236 |
224 Rkns.Renkan.prototype.setSearchEngine = function(_key) { |
237 Rkns.Renkan.prototype.setSearchEngine = function(_key) { |
225 this.search_engine = this.search_engines[_key]; |
238 this.search_engine = this.search_engines[_key]; |