blob: 1c91c84e0dc566ebf4dbf7807698ca53c52301c2 [file] [log] [blame]
Alexander Afanasyev3c95c852013-03-01 18:58:50 -08001$.Class ("ChronoShare", { },
2 {
3 init: function (username, foldername) {
4 $("#folder-name").text (foldername);
5 $("#user-name").text (username);
Alexander Afanasyev46bd8062013-02-27 23:59:15 -08006
Alexander Afanasyev3c95c852013-03-01 18:58:50 -08007 this.username = new Name (username);
8 this.files = new Name ("/localhost").add (this.username).add ("chronoshare").add (foldername).add ("info").add ("files").add ("folder");
Alexander Afanasyev46bd8062013-02-27 23:59:15 -08009
Alexander Afanasyev3c95c852013-03-01 18:58:50 -080010 this.actions = new Name ("/localhost").add (this.username).add ("chronoshare").add (foldername).add ("info").add ("actions");
Alexander Afanasyev46bd8062013-02-27 23:59:15 -080011
Alexander Afanasyev3c95c852013-03-01 18:58:50 -080012 this.restore = new Name ("/localhost").add (this.username).add ("chronoshare").add (foldername).add ("cmd").add ("restore").add ("file");
Alexander Afanasyev46bd8062013-02-27 23:59:15 -080013
Alexander Afanasyev3c95c852013-03-01 18:58:50 -080014 this.ndn = new NDN ({host:"127.0.0.1"});
Alexander Afanasyev1663a412013-03-02 13:52:00 -080015 this.ndn.verify = false; //disable content verification, works WAAAAY faster
Alexander Afanasyev3c95c852013-03-01 18:58:50 -080016 },
Alexander Afanasyev46bd8062013-02-27 23:59:15 -080017
Alexander Afanasyev3c95c852013-03-01 18:58:50 -080018 run: function () {
19 console.log ("RUN page: " + PAGE);
20 $("#loader").fadeIn (500);
21 $("#error").addClass ("hidden");
Alexander Afanasyev46bd8062013-02-27 23:59:15 -080022
Alexander Afanasyev3c95c852013-03-01 18:58:50 -080023 cmd = {};
24 if (PAGE == "fileList") {
25 cmd = this.info_files (PARAMS.item);
26 }
27 else if (PAGE == "folderHistory") {
28 cmd = this.info_actions ("folder", PARAMS.item);
29 }
30 else if (PAGE == "fileHistory") {
31 cmd = this.info_actions ("file", PARAMS.item);
32 }
Alexander Afanasyevf63a5142013-02-28 02:21:42 -080033
Alexander Afanasyev3c95c852013-03-01 18:58:50 -080034 if (cmd.request && cmd.callback) {
35 console.log (cmd.request.to_uri ());
36 this.ndn.expressInterest (cmd.request, cmd.callback);
37 }
38 else {
39 $("#loader").fadeOut (500); // ("hidden");
40 $("#content").empty ();
41 if (cmd.error) {
42 $("#error").html (cmd.error);
43 }
44 else {
45 $("#error").html ("Unknown error with " + PAGE);
46 }
47 $("#error").removeClass ("hidden");
48 }
49 },
Alexander Afanasyevf63a5142013-02-28 02:21:42 -080050
Alexander Afanasyev3c95c852013-03-01 18:58:50 -080051 info_files: function(folder) {
52 request = new Name ().add (this.files)./*add (folder_in_question).*/addSegment (PARAMS.offset?PARAMS.offset:0);
53 return { request:request, callback: new FilesClosure (this) };
54 },
Alexander Afanasyevf63a5142013-02-28 02:21:42 -080055
Alexander Afanasyev3c95c852013-03-01 18:58:50 -080056 info_actions: function (type/*"file" or "folder"*/, fileOrFolder /*file or folder name*/) {
57 if (type=="file" && !fileOrFolder) {
58 return { error: "info_actions: fileOrFolder parameter is missing" };
59 }
Alexander Afanasyevf63a5142013-02-28 02:21:42 -080060
Alexander Afanasyev3c95c852013-03-01 18:58:50 -080061 request = new Name ().add (this.actions).add (type);
62 if (fileOrFolder) {
63 request.add (fileOrFolder);
64 }
65 request.addSegment (PARAMS.offset?PARAMS.offset:0);
66 return { request: request, callback: new HistoryClosure (this) };
67 },
Alexander Afanasyev46bd8062013-02-27 23:59:15 -080068
Alexander Afanasyev4c17b482013-03-02 01:32:35 -080069 cmd_restore_file: function (filename, version, hash, callback/*function (bool <- data received, status <- returned status)*/) {
Alexander Afanasyev3c95c852013-03-01 18:58:50 -080070 request = new Name ().add (this.restore)
71 .add (filename)
72 .addSegment (version)
73 .add (hash);
74 console.log (request.to_uri ());
Alexander Afanasyev4c17b482013-03-02 01:32:35 -080075 this.ndn.expressInterest (request, new CmdRestoreFileClosure (this, callback));
Alexander Afanasyevc24db642013-03-09 16:41:02 -080076 },
77
78 get_file: function (modifiedBy, hash, segments, callback/*function (bool <- data received, data <- returned data)*/) {
79 baseName = new Name (modifiedBy)
80 .add ("chronoshare").add ("file")
81 .add (hash);
82
83 new FileGetter (this.ndn, baseName, segments, callback)
84 .start ();
Alexander Afanasyev3c95c852013-03-01 18:58:50 -080085 }
86 });
Zhenkai Zhu5c2475b2013-02-26 22:57:31 -080087
Alexander Afanasyev4c17b482013-03-02 01:32:35 -080088$.Class ("CmdRestoreFileClosure", {}, {
89 init: function (chronoshare, callback) {
90 this.chronoshare = chronoshare;
91 this.callback = callback;
92 },
93 upcall: function(kind, upcallInfo) {
Alexander Afanasyev1663a412013-03-02 13:52:00 -080094 if (kind == Closure.UPCALL_CONTENT || kind == Closure.UPCALL_CONTENT_UNVERIFIED) { //disable content verification
Alexander Afanasyev4c17b482013-03-02 01:32:35 -080095 convertedData = DataUtils.toString (upcallInfo.contentObject.content);
96 this.callback (true, convertedData);
97 }
98 else if (kind == Closure.UPCALL_INTEREST_TIMED_OUT) {
99 this.callback (false, "Interest timed out");
100 }
101 else {
102 this.callback (false, "Unknown error happened");
103 }
104 }
105});
106
Alexander Afanasyevc24db642013-03-09 16:41:02 -0800107$.Class ("FileGetter", {}, {
108 init: function (ndn, baseName, segments, callback) {
109 this.ndn = ndn;
110 this.callback = callback;
111 this.baseName = baseName;
112 this.segments = segments;
113 this.lastSegmentRequested = -1;
114
115 this.data = "";
116 },
117
118 start: function () {
119 this.lastSegmentRequested ++;
120
121 request = new Name ()
122 .add (this.baseName)
123 .addSegment (this.lastSegmentRequested);
124
125 console.log (request.to_uri ());
126 this.ndn.expressInterest (request, this);
127 },
128
129 upcall: function(kind, upcallInfo) {
130 if (kind == Closure.UPCALL_CONTENT || kind == Closure.UPCALL_CONTENT_UNVERIFIED) { //disable content verification
131 convertedData = DataUtils.toString (upcallInfo.contentObject.content);
132
133 this.data += convertedData;
134
135 if (this.lastSegmentRequested+1 == this.segments) {
136 this.callback (true, this.data);
137 }
138 else {
139 this.start ();
140 }
141 }
142 else {
143 this.callback (false, "Interest timed out");
144 }
145 }
146});
147
Alexander Afanasyev1663a412013-03-02 13:52:00 -0800148$.Class ("RestPipelineClosure", {}, {
149 init: function (collectionName, moreName) {
150 this.collectionName = collectionName;
151 this.moreName = moreName;
152 $("#json").empty ();
153
154 this.collection = [];
Alexander Afanasyev10babd22013-03-04 13:53:36 -0800155 this.counter = 0;
Alexander Afanasyev46bd8062013-02-27 23:59:15 -0800156 },
157
Alexander Afanasyevfd5e6272013-02-27 20:25:20 -0800158 upcall: function(kind, upcallInfo) {
Alexander Afanasyev1663a412013-03-02 13:52:00 -0800159 if (kind == Closure.UPCALL_CONTENT || kind == Closure.UPCALL_CONTENT_UNVERIFIED) { //disable content verification
160
Alexander Afanasyevfd5e6272013-02-27 20:25:20 -0800161 convertedData = DataUtils.toString (upcallInfo.contentObject.content);
Alexander Afanasyevc15e0162013-02-28 23:38:52 -0800162 if (PARAMS.debug) {
Alexander Afanasyev1663a412013-03-02 13:52:00 -0800163 $("#json").append ($(document.createTextNode(convertedData)));
Alexander Afanasyevc15e0162013-02-28 23:38:52 -0800164 $("#json").removeClass ("hidden");
165 }
Alexander Afanasyevfd5e6272013-02-27 20:25:20 -0800166 data = JSON.parse (convertedData);
Zhenkai Zhu5c2475b2013-02-26 22:57:31 -0800167
Alexander Afanasyev1663a412013-03-02 13:52:00 -0800168 this.collection = this.collection.concat (data[this.collectionName]);
169 if (data[this.moreName] !== undefined) {
170 nextSegment = upcallInfo.interest.name.cut (1).addSegment (data[this.moreName]);
Alexander Afanasyev10babd22013-03-04 13:53:36 -0800171 this.counter ++;
172
173 if (this.counter < 5) {
174 console.log ("MORE: " +nextSegment.to_uri ());
175 CHRONOSHARE.ndn.expressInterest (nextSegment, this);
176 }
177 else {
178 $("#loader").fadeOut (500); // ("hidden");
179 this.onData (this.collection, data[this.moreName]);
180 }
Alexander Afanasyev1663a412013-03-02 13:52:00 -0800181 }
182 else {
183 $("#loader").fadeOut (500); // ("hidden");
Alexander Afanasyev10babd22013-03-04 13:53:36 -0800184 this.onData (this.collection, undefined);
Alexander Afanasyev1663a412013-03-02 13:52:00 -0800185 }
186 }
Alexander Afanasyevfd5e6272013-02-27 20:25:20 -0800187 else if (kind == Closure.UPCALL_INTEREST_TIMED_OUT) {
Alexander Afanasyev1663a412013-03-02 13:52:00 -0800188 $("#loader").fadeOut (500); // ("hidden");
189 this.onTimeout (upcallInfo.interest);
Alexander Afanasyevfd5e6272013-02-27 20:25:20 -0800190 }
191 else {
Alexander Afanasyev1663a412013-03-02 13:52:00 -0800192 $("#loader").fadeOut (500); // ("hidden");
193 this.onUnknownError (upcallInfo.interest);
Alexander Afanasyevfd5e6272013-02-27 20:25:20 -0800194 }
Alexander Afanasyev1663a412013-03-02 13:52:00 -0800195
196 return Closure.RESULT_OK; // make sure we never re-express the interest
197 },
198
Alexander Afanasyev10babd22013-03-04 13:53:36 -0800199 onData: function(data, more) {
Alexander Afanasyev1663a412013-03-02 13:52:00 -0800200 },
201
202 onTimeout: function () {
203 $("#error").html ("Interest timed out");
204 $("#error").removeClass ("hidden");
205 },
206
207 onUnknownError: function () {
208 $("#error").html ("Unknown error happened");
209 $("#error").removeClass ("hidden");
210 }
211});
212
213// $.Class ("FilesClosure", {}, {
214RestPipelineClosure ("FilesClosure", {}, {
215 init: function (chronoshare) {
216 this._super("files", "more");
217 this.chronoshare = chronoshare;
218 },
219
Alexander Afanasyev10babd22013-03-04 13:53:36 -0800220 onData: function(data, more) {
Alexander Afanasyev1663a412013-03-02 13:52:00 -0800221 tbody = $("<tbody />", { "id": "file-list-files" });
222
223 /// @todo Eventually set title for other pages
224 $("title").text ("ChronoShare - List of files" + (PARAMS.item?" - "+PARAMS.item:""));
225
226 // error handling?
227 newcontent = $("<div />", { "id": "content" }).append (
228 $("<h2 />").append ($(document.createTextNode("List of files ")), $("<green />").text (PARAMS.item)),
229 $("<table />", { "class": "item-list" })
230 .append ($("<thead />")
231 .append ($("<tr />")
232 .append ($("<th />", { "class": "filename border-left", "scope": "col" }).text ("Filename"))
233 .append ($("<th />", { "class": "version", "scope": "col" }).text ("Version"))
234 .append ($("<th />", { "class": "size", "scope": "col" }).text ("Size"))
235 .append ($("<th />", { "class": "modified", "scope": "col" }).text ("Modified"))
236 .append ($("<th />", { "class": "modified-by border-right", "scope": "col" }).text ("Modified By"))))
237 .append (tbody)
238 .append ($("<tfoot />")
239 .append ($("<tr />")
240 .append ($("<td />", { "colspan": "5", "class": "border-right border-left" })))));
241 newcontent.hide ();
242
243 for (var i = 0; i < data.length; i++) {
244 file = data[i];
245
246 row = $("<tr />", { "class": "with-context-menu" } );
247 if (i%2) { row.addClass ("odd"); }
248
249 row.bind('mouseenter mouseleave', function() {
250 $(this).toggleClass('highlighted');
251 });
252
253 row.attr ("filename", file.filename); //encodeURIComponent(encodeURIComponent(file.filename)));
254 row.bind('click', function (e) { openHistoryForItem ($(this).attr ("filename")) });
255
256 row.append ($("<td />", { "class": "filename border-left" })
257 .text (file.filename)
Alexander Afanasyevc24db642013-03-09 16:41:02 -0800258 .prepend ($("<img />", { "src": imgFullPath(fileExtension(file.filename)) })));
Alexander Afanasyev1663a412013-03-02 13:52:00 -0800259 row.append ($("<td />", { "class": "version" }).text (file.version));
260 row.append ($("<td />", { "class": "size" }).text (SegNumToFileSize (file.segNum)));
261 row.append ($("<td />", { "class": "modified" }).text (new Date (file.timestamp+"+00:00"))); // convert from UTC
262 row.append ($("<td />", { "class": "modified-by border-right"})
263 .append ($("<userName />").text (file.owner.userName))
264 .append ($("<seqNo> /").text (file.owner.seqNo)));
265
266 tbody = tbody.append (row);
267 }
268
Alexander Afanasyev10babd22013-03-04 13:53:36 -0800269 displayContent (newcontent, more, this.base_url ());
Alexander Afanasyev1663a412013-03-02 13:52:00 -0800270
271 $.contextMenu( 'destroy', ".with-context-menu" ); // cleanup
272 $.contextMenu({
273 selector: ".with-context-menu",
274 items: {
275 "info": {name: "x", type: "html", html: "<b>File operations</b>"},
276 "sep1": "---------",
277 history: {name: "View file history",
278 icon: "quit", // need a better icon
279 callback: function(key, opt) {
280 openHistoryForItem (opt.$trigger.attr ("filename"));
281 }},
282 }
283 });
Alexander Afanasyev3c95c852013-03-01 18:58:50 -0800284 },
285
286 base_url: function () {
287 url = "#fileList"+
288 "&user="+encodeURIComponent (encodeURIComponent (PARAMS.user)) +
289 "&folder="+encodeURIComponent (encodeURIComponent (PARAMS.folder));
290 if (PARAMS.item !== undefined) {
291 url += "&item="+encodeURIComponent (encodeURIComponent (PARAMS.item));
292 }
293 return url;
Zhenkai Zhu5c2475b2013-02-26 22:57:31 -0800294 }
Alexander Afanasyevfd5e6272013-02-27 20:25:20 -0800295});
Zhenkai Zhu5c2475b2013-02-26 22:57:31 -0800296
Alexander Afanasyevfd5e6272013-02-27 20:25:20 -0800297
Alexander Afanasyev1663a412013-03-02 13:52:00 -0800298RestPipelineClosure ("HistoryClosure", {}, {
Alexander Afanasyevf63a5142013-02-28 02:21:42 -0800299 init: function (chronoshare) {
Alexander Afanasyev1663a412013-03-02 13:52:00 -0800300 this._super("actions", "more");
Alexander Afanasyevf63a5142013-02-28 02:21:42 -0800301 this.chronoshare = chronoshare;
302 },
303
Alexander Afanasyevc24db642013-03-09 16:41:02 -0800304 previewFile: function (file) {
305 if (fileExtension(file.attr ("filename")) == "txt") {
306 CHRONOSHARE.get_file (file.attr ("file_modified_by"),
307 DataUtils.toNumbers (file.attr ("file_hash")),
308 file.attr ("file_seg_num"),
309 function (status, data) {
310 $("<div />", { "title": "Preview of " + file.attr ("filename") + " version " + file.attr ("file_version") })
311 .append ($("<pre />").text (data))
312 .dialog ({
313 resizable: true,
314 width: $(window).width() * 0.8,
315 maxHeight: $(window).height() * 0.8,
316 show: "blind",
317 hide: "fold",
318 modal: true,
319 });
320 });
321 }
322 else {
323 custom_alert ("Preview is not support for this type of file");
324 }
325 },
326
Alexander Afanasyev10babd22013-03-04 13:53:36 -0800327 onData: function(data, more) {
Alexander Afanasyev1663a412013-03-02 13:52:00 -0800328 tbody = $("<tbody />", { "id": "history-list-actions" });
329
330 /// @todo Eventually set title for other pages
331 $("title").text ("ChronoShare - Recent actions" + (PARAMS.item?" - "+PARAMS.item:""));
332
333 newcontent = $("<div />", { "id": "content" }).append (
334 $("<h2 />").append ($(document.createTextNode("Recent actions ")), $("<green />").text (PARAMS.item)),
335 $("<table />", { "class": "item-list" })
336 .append ($("<thead />")
337 .append ($("<tr />")
338 .append ($("<th />", { "class": "filename border-left", "scope": "col" }).text ("Filename"))
339 .append ($("<th />", { "class": "version", "scope": "col" }).text ("Version"))
340 .append ($("<th />", { "class": "size", "scope": "col" }).text ("Size"))
341 .append ($("<th />", { "class": "modified", "scope": "col" }).text ("Modified"))
342 .append ($("<th />", { "class": "modified-by border-right", "scope": "col" }).text ("Modified By"))))
343 .append (tbody)
344 .append ($("<tfoot />")
345 .append ($("<tr />")
346 .append ($("<td />", { "colspan": "5", "class": "border-right border-left" })))));
347
348 for (var i = 0; i < data.length; i++) {
349 action = data[i];
350
351 row = $("<tr />");
352 if (i%2) { row.addClass ("odd"); }
353 if (action.action=="DELETE") {
354 row.addClass ("delete");
Alexander Afanasyevc15e0162013-02-28 23:38:52 -0800355 }
Alexander Afanasyev1663a412013-03-02 13:52:00 -0800356 else {
357 row.addClass ("with-context-menu");
358 row.attr ("file_version", action.version);
359 row.attr ("file_hash", action.update.hash);
Alexander Afanasyevc24db642013-03-09 16:41:02 -0800360 row.attr ("file_seg_num", action.update.segNum);
Alexander Afanasyev1663a412013-03-02 13:52:00 -0800361 row.attr ("file_modified_by", action.id.userName);
362 }
Alexander Afanasyevf63a5142013-02-28 02:21:42 -0800363
Alexander Afanasyev1663a412013-03-02 13:52:00 -0800364 row.attr ("filename", action.filename);
Alexander Afanasyevc24db642013-03-09 16:41:02 -0800365
366 self = this;
367 if (PARAMS.item != action.filename) {
368 row.bind('click', function (e) { openHistoryForItem ($(this).attr ("filename")) });
369 }
370 else {
371 row.bind('click', function (e) {
372 self.previewFile ($(this));
373 });
374 }
Alexander Afanasyev3c95c852013-03-01 18:58:50 -0800375
Alexander Afanasyev1663a412013-03-02 13:52:00 -0800376 row.bind('mouseenter mouseleave', function() {
377 $(this).toggleClass('highlighted');
378 });
Alexander Afanasyev4c17b482013-03-02 01:32:35 -0800379
Alexander Afanasyev1663a412013-03-02 13:52:00 -0800380 row.append ($("<td />", { "class": "filename border-left" })
381 .text (action.filename)
Alexander Afanasyevc24db642013-03-09 16:41:02 -0800382 .prepend ($("<img />", { "src": imgFullPath(fileExtension(action.filename)) })));
Alexander Afanasyev1663a412013-03-02 13:52:00 -0800383 row.append ($("<td />", { "class": "version" }).text (action.version));
384 row.append ($("<td />", { "class": "size" }).text (action.update?SegNumToFileSize (action.update.segNum):""));
385 row.append ($("<td />", { "class": "timestamp" }).text (new Date (action.timestamp+"+00:00"))); // conversion from UTC timezone (we store action time in UTC)
386 row.append ($("<td />", { "class": "modified-by border-right" })
387 .append ($("<userName />").text (action.id.userName))
388 .append ($("<seqNo> /").text (action.id.seqNo)));
Alexander Afanasyevf63a5142013-02-28 02:21:42 -0800389
Alexander Afanasyev1663a412013-03-02 13:52:00 -0800390 tbody = tbody.append (row);
391 }
Alexander Afanasyevf63a5142013-02-28 02:21:42 -0800392
Alexander Afanasyev10babd22013-03-04 13:53:36 -0800393 displayContent (newcontent, more, this.base_url (PAGE));
Alexander Afanasyev4c17b482013-03-02 01:32:35 -0800394
Alexander Afanasyevc24db642013-03-09 16:41:02 -0800395 self = this;
Alexander Afanasyev1663a412013-03-02 13:52:00 -0800396 $.contextMenu( 'destroy', ".with-context-menu" ); // cleanup
397 $.contextMenu({
398 selector: ".with-context-menu",
399 items: {
400 "sep1": "---------",
Alexander Afanasyevc24db642013-03-09 16:41:02 -0800401 preview: {name: "Preview revision",
402 icon: "edit", // ned a better icon
403 callback: function(key, opt) {
404 self.previewFile (opt.$trigger);
405 }},
406 "sep3": "---------",
Alexander Afanasyev1663a412013-03-02 13:52:00 -0800407 restore: {name: "Restore this revision",
408 icon: "cut", // need a better icon
409 callback: function(key, opt) {
410 filename = opt.$trigger.attr ("filename");
411 version = opt.$trigger.attr ("file_version");
412 hash = DataUtils.toNumbers (opt.$trigger.attr ("file_hash"));
413 console.log (hash);
414 modified_by = opt.$trigger.attr ("file_modified_by");
Alexander Afanasyevf63a5142013-02-28 02:21:42 -0800415
Alexander Afanasyev1663a412013-03-02 13:52:00 -0800416 $("<div />", { "title": "Restore version " + version + "?" })
417 .append ($("<p />")
418 .append ($("<span />", { "class": "ui-icon ui-icon-alert",
419 "style": "float: left; margin: 0 7px 50px 0;" }),
420 $(document.createTextNode ("Are you sure you want restore version ")),
421 $("<green/>").text (version),
422 $(document.createTextNode (" by ")),
423 $("<green/>").text (modified_by)))
424 .dialog ({
425 resizable: true,
426 height:200,
427 width:300,
428 modal: true,
Alexander Afanasyevc24db642013-03-09 16:41:02 -0800429 show: "blind",
430 hide: "fold",
Alexander Afanasyev1663a412013-03-02 13:52:00 -0800431 buttons: {
432 "Restore": function() {
433 self = $(this);
434 CHRONOSHARE.cmd_restore_file (filename, version, hash, function(didGetData, response) {
435 if (!didGetData || response != "OK") {
436 custom_alert (response);
437 }
438 console.log (response);
439 self.dialog ("close");
Alexander Afanasyevf63a5142013-02-28 02:21:42 -0800440
Alexander Afanasyev1663a412013-03-02 13:52:00 -0800441 $.timer (function() {CHRONOSHARE.run ();}).once (1000);
442 });
443 },
444 Cancel: function() {
445 $(this).dialog ("close");
Alexander Afanasyev4c17b482013-03-02 01:32:35 -0800446 }
Alexander Afanasyev1663a412013-03-02 13:52:00 -0800447 }
448 });
449 // openHistoryForItem (opt.$trigger.attr ("filename"));
450 }},
451 "sep2": "---------",
452 }
453 });
Alexander Afanasyev3c95c852013-03-01 18:58:50 -0800454 },
455
Alexander Afanasyevc24db642013-03-09 16:41:02 -0800456 base_no_item_url: function (page) {
457 url = "#"+page+
458 "&user="+encodeURIComponent (encodeURIComponent (PARAMS.user)) +
459 "&folder="+encodeURIComponent (encodeURIComponent (PARAMS.folder));
460 return url;
461 },
462
Alexander Afanasyev3c95c852013-03-01 18:58:50 -0800463 base_url: function (page) {
464 url = "#"+page+
465 "&user="+encodeURIComponent (encodeURIComponent (PARAMS.user)) +
466 "&folder="+encodeURIComponent (encodeURIComponent (PARAMS.folder));
467 if (PARAMS.item !== undefined) {
468 url += "&item="+encodeURIComponent (encodeURIComponent (PARAMS.item));
469 }
470 return url;
Alexander Afanasyevf63a5142013-02-28 02:21:42 -0800471 }
472});
473
474
Alexander Afanasyevfd5e6272013-02-27 20:25:20 -0800475
476