Alexander Afanasyev | 3c95c85 | 2013-03-01 18:58:50 -0800 | [diff] [blame] | 1 | $.Class ("ChronoShare", { }, |
| 2 | { |
| 3 | init: function (username, foldername) { |
| 4 | $("#folder-name").text (foldername); |
| 5 | $("#user-name").text (username); |
Alexander Afanasyev | 46bd806 | 2013-02-27 23:59:15 -0800 | [diff] [blame] | 6 | |
Alexander Afanasyev | 3c95c85 | 2013-03-01 18:58:50 -0800 | [diff] [blame] | 7 | 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 Afanasyev | 46bd806 | 2013-02-27 23:59:15 -0800 | [diff] [blame] | 9 | |
Alexander Afanasyev | 3c95c85 | 2013-03-01 18:58:50 -0800 | [diff] [blame] | 10 | this.actions = new Name ("/localhost").add (this.username).add ("chronoshare").add (foldername).add ("info").add ("actions"); |
Alexander Afanasyev | 46bd806 | 2013-02-27 23:59:15 -0800 | [diff] [blame] | 11 | |
Alexander Afanasyev | 3c95c85 | 2013-03-01 18:58:50 -0800 | [diff] [blame] | 12 | this.restore = new Name ("/localhost").add (this.username).add ("chronoshare").add (foldername).add ("cmd").add ("restore").add ("file"); |
Alexander Afanasyev | 46bd806 | 2013-02-27 23:59:15 -0800 | [diff] [blame] | 13 | |
Alexander Afanasyev | 3c95c85 | 2013-03-01 18:58:50 -0800 | [diff] [blame] | 14 | this.ndn = new NDN ({host:"127.0.0.1"}); |
| 15 | }, |
Alexander Afanasyev | 46bd806 | 2013-02-27 23:59:15 -0800 | [diff] [blame] | 16 | |
Alexander Afanasyev | 3c95c85 | 2013-03-01 18:58:50 -0800 | [diff] [blame] | 17 | run: function () { |
| 18 | console.log ("RUN page: " + PAGE); |
| 19 | $("#loader").fadeIn (500); |
| 20 | $("#error").addClass ("hidden"); |
Alexander Afanasyev | 46bd806 | 2013-02-27 23:59:15 -0800 | [diff] [blame] | 21 | |
Alexander Afanasyev | 3c95c85 | 2013-03-01 18:58:50 -0800 | [diff] [blame] | 22 | cmd = {}; |
| 23 | if (PAGE == "fileList") { |
| 24 | cmd = this.info_files (PARAMS.item); |
| 25 | } |
| 26 | else if (PAGE == "folderHistory") { |
| 27 | cmd = this.info_actions ("folder", PARAMS.item); |
| 28 | } |
| 29 | else if (PAGE == "fileHistory") { |
| 30 | cmd = this.info_actions ("file", PARAMS.item); |
| 31 | } |
Alexander Afanasyev | f63a514 | 2013-02-28 02:21:42 -0800 | [diff] [blame] | 32 | |
Alexander Afanasyev | 3c95c85 | 2013-03-01 18:58:50 -0800 | [diff] [blame] | 33 | if (cmd.request && cmd.callback) { |
| 34 | console.log (cmd.request.to_uri ()); |
| 35 | this.ndn.expressInterest (cmd.request, cmd.callback); |
| 36 | } |
| 37 | else { |
| 38 | $("#loader").fadeOut (500); // ("hidden"); |
| 39 | $("#content").empty (); |
| 40 | if (cmd.error) { |
| 41 | $("#error").html (cmd.error); |
| 42 | } |
| 43 | else { |
| 44 | $("#error").html ("Unknown error with " + PAGE); |
| 45 | } |
| 46 | $("#error").removeClass ("hidden"); |
| 47 | } |
| 48 | }, |
Alexander Afanasyev | f63a514 | 2013-02-28 02:21:42 -0800 | [diff] [blame] | 49 | |
Alexander Afanasyev | 3c95c85 | 2013-03-01 18:58:50 -0800 | [diff] [blame] | 50 | info_files: function(folder) { |
| 51 | request = new Name ().add (this.files)./*add (folder_in_question).*/addSegment (PARAMS.offset?PARAMS.offset:0); |
| 52 | return { request:request, callback: new FilesClosure (this) }; |
| 53 | }, |
Alexander Afanasyev | f63a514 | 2013-02-28 02:21:42 -0800 | [diff] [blame] | 54 | |
Alexander Afanasyev | 3c95c85 | 2013-03-01 18:58:50 -0800 | [diff] [blame] | 55 | info_actions: function (type/*"file" or "folder"*/, fileOrFolder /*file or folder name*/) { |
| 56 | if (type=="file" && !fileOrFolder) { |
| 57 | return { error: "info_actions: fileOrFolder parameter is missing" }; |
| 58 | } |
Alexander Afanasyev | f63a514 | 2013-02-28 02:21:42 -0800 | [diff] [blame] | 59 | |
Alexander Afanasyev | 3c95c85 | 2013-03-01 18:58:50 -0800 | [diff] [blame] | 60 | request = new Name ().add (this.actions).add (type); |
| 61 | if (fileOrFolder) { |
| 62 | request.add (fileOrFolder); |
| 63 | } |
| 64 | request.addSegment (PARAMS.offset?PARAMS.offset:0); |
| 65 | return { request: request, callback: new HistoryClosure (this) }; |
| 66 | }, |
Alexander Afanasyev | 46bd806 | 2013-02-27 23:59:15 -0800 | [diff] [blame] | 67 | |
Alexander Afanasyev | 3c95c85 | 2013-03-01 18:58:50 -0800 | [diff] [blame] | 68 | cmd_restore_file: function (filename, version, hash) { |
| 69 | request = new Name ().add (this.restore) |
| 70 | .add (filename) |
| 71 | .addSegment (version) |
| 72 | .add (hash); |
| 73 | console.log (request.to_uri ()); |
| 74 | } |
| 75 | }); |
Zhenkai Zhu | 5c2475b | 2013-02-26 22:57:31 -0800 | [diff] [blame] | 76 | |
Alexander Afanasyev | fd5e627 | 2013-02-27 20:25:20 -0800 | [diff] [blame] | 77 | $.Class ("FilesClosure", {}, { |
Alexander Afanasyev | 46bd806 | 2013-02-27 23:59:15 -0800 | [diff] [blame] | 78 | init: function (chronoshare) { |
| 79 | this.chronoshare = chronoshare; |
| 80 | }, |
| 81 | |
Alexander Afanasyev | fd5e627 | 2013-02-27 20:25:20 -0800 | [diff] [blame] | 82 | upcall: function(kind, upcallInfo) { |
| 83 | $("#loader").fadeOut (500); // ("hidden"); |
| 84 | if (kind == Closure.UPCALL_CONTENT) { |
| 85 | convertedData = DataUtils.toString (upcallInfo.contentObject.content); |
Alexander Afanasyev | c15e016 | 2013-02-28 23:38:52 -0800 | [diff] [blame] | 86 | if (PARAMS.debug) { |
| 87 | $("#json").text (convertedData); |
| 88 | $("#json").removeClass ("hidden"); |
| 89 | } |
Alexander Afanasyev | fd5e627 | 2013-02-27 20:25:20 -0800 | [diff] [blame] | 90 | data = JSON.parse (convertedData); |
Zhenkai Zhu | 5c2475b | 2013-02-26 22:57:31 -0800 | [diff] [blame] | 91 | |
Alexander Afanasyev | 3c95c85 | 2013-03-01 18:58:50 -0800 | [diff] [blame] | 92 | tbody = $("<tbody />", { "id": "file-list-files" }); |
| 93 | |
Alexander Afanasyev | fd5e627 | 2013-02-27 20:25:20 -0800 | [diff] [blame] | 94 | // error handling? |
Alexander Afanasyev | 3c95c85 | 2013-03-01 18:58:50 -0800 | [diff] [blame] | 95 | newcontent = $("<div />", { "id": "content" }).append ( |
Alexander Afanasyev | f7c7cde | 2013-03-02 00:01:32 -0800 | [diff] [blame^] | 96 | $("<h2 />").append ($(document.createTextNode("List of files ")), $("<green />").text (PARAMS.item)), |
Alexander Afanasyev | f63a514 | 2013-02-28 02:21:42 -0800 | [diff] [blame] | 97 | $("<table />", { "class": "item-list" }) |
| 98 | .append ($("<thead />") |
| 99 | .append ($("<tr />") |
| 100 | .append ($("<th />", { "class": "filename border-left", "scope": "col" }).text ("Filename")) |
| 101 | .append ($("<th />", { "class": "version", "scope": "col" }).text ("Version")) |
Alexander Afanasyev | 3c95c85 | 2013-03-01 18:58:50 -0800 | [diff] [blame] | 102 | .append ($("<th />", { "class": "size", "scope": "col" }).text ("Size")) |
Alexander Afanasyev | f63a514 | 2013-02-28 02:21:42 -0800 | [diff] [blame] | 103 | .append ($("<th />", { "class": "modified", "scope": "col" }).text ("Modified")) |
| 104 | .append ($("<th />", { "class": "modified-by border-right", "scope": "col" }).text ("Modified By")))) |
Alexander Afanasyev | 3c95c85 | 2013-03-01 18:58:50 -0800 | [diff] [blame] | 105 | .append (tbody) |
Alexander Afanasyev | f63a514 | 2013-02-28 02:21:42 -0800 | [diff] [blame] | 106 | .append ($("<tfoot />") |
| 107 | .append ($("<tr />") |
Alexander Afanasyev | 3c95c85 | 2013-03-01 18:58:50 -0800 | [diff] [blame] | 108 | .append ($("<td />", { "colspan": "5", "class": "border-right border-left" }))))); |
| 109 | newcontent.hide (); |
Zhenkai Zhu | 5c2475b | 2013-02-26 22:57:31 -0800 | [diff] [blame] | 110 | |
Alexander Afanasyev | fd5e627 | 2013-02-27 20:25:20 -0800 | [diff] [blame] | 111 | for (var i = 0; i < data.files.length; i++) { |
| 112 | file = data.files[i]; |
Alexander Afanasyev | 46bd806 | 2013-02-27 23:59:15 -0800 | [diff] [blame] | 113 | |
Alexander Afanasyev | f7c7cde | 2013-03-02 00:01:32 -0800 | [diff] [blame^] | 114 | row = $("<tr />", { "class": "with-context-menu" } ); |
Alexander Afanasyev | 46bd806 | 2013-02-27 23:59:15 -0800 | [diff] [blame] | 115 | if (i%2) { row.addClass ("odd"); } |
| 116 | |
| 117 | row.bind('mouseenter mouseleave', function() { |
| 118 | $(this).toggleClass('highlighted'); |
| 119 | }); |
| 120 | |
Alexander Afanasyev | 3c95c85 | 2013-03-01 18:58:50 -0800 | [diff] [blame] | 121 | row.attr ("filename", file.filename); //encodeURIComponent(encodeURIComponent(file.filename))); |
Alexander Afanasyev | f7c7cde | 2013-03-02 00:01:32 -0800 | [diff] [blame^] | 122 | row.bind('click', function (e) { openHistoryForItem ($(this).attr ("filename")) }); |
Alexander Afanasyev | 3c95c85 | 2013-03-01 18:58:50 -0800 | [diff] [blame] | 123 | |
Alexander Afanasyev | f7c7cde | 2013-03-02 00:01:32 -0800 | [diff] [blame^] | 124 | row.append ($("<td />", { "class": "filename border-left" }) |
| 125 | .text (file.filename) |
| 126 | .prepend ($("<img />", { "src": fileExtension(file.filename) }))); |
Alexander Afanasyev | 3c95c85 | 2013-03-01 18:58:50 -0800 | [diff] [blame] | 127 | row.append ($("<td />", { "class": "version" }).text (file.version)); |
| 128 | row.append ($("<td />", { "class": "size" }).text (SegNumToFileSize (file.segNum))); |
| 129 | row.append ($("<td />", { "class": "modified" }).text (new Date (file.timestamp))); |
| 130 | row.append ($("<td />", { "class": "modified-by border-right"}) |
Alexander Afanasyev | 46bd806 | 2013-02-27 23:59:15 -0800 | [diff] [blame] | 131 | .append ($("<userName />").text (file.owner.userName)) |
| 132 | .append ($("<seqNo> /").text (file.owner.seqNo))); |
| 133 | |
Alexander Afanasyev | 3c95c85 | 2013-03-01 18:58:50 -0800 | [diff] [blame] | 134 | tbody = tbody.append (row); |
Alexander Afanasyev | fd5e627 | 2013-02-27 20:25:20 -0800 | [diff] [blame] | 135 | } |
Alexander Afanasyev | 3c95c85 | 2013-03-01 18:58:50 -0800 | [diff] [blame] | 136 | |
| 137 | // if (!PARAMS.offset || PARAMS.offset==0) |
| 138 | // { |
| 139 | $("#content").fadeOut ("fast", function () { |
| 140 | $(this).replaceWith (newcontent); |
| 141 | $("#content").fadeIn ("fast"); |
| 142 | }); |
| 143 | |
| 144 | self = this; // small "cheat" |
| 145 | $("#content-nav").fadeOut ("fast", function () { |
| 146 | $("#content-nav a").hide (); |
| 147 | |
| 148 | if (PARAMS.offset !== undefined || data.more !== undefined) { |
| 149 | $("#content-nav").fadeIn ("fast"); |
| 150 | |
| 151 | if (data.more !== undefined) { |
| 152 | $("#get-more").show (); |
| 153 | |
| 154 | $("#get-more").unbind ('click').click (function () { |
| 155 | url = self.base_url (); |
| 156 | url += "&offset="+data.more; |
| 157 | |
| 158 | document.location = url; |
| 159 | }); |
| 160 | } |
| 161 | if (PARAMS.offset > 0) { |
| 162 | $("#get-less").show (); |
| 163 | |
| 164 | $("#get-less").unbind ('click').click (function () { |
| 165 | url = self.base_url (); |
| 166 | if (PARAMS.offset > 1) { |
| 167 | url += "&offset="+(PARAMS.offset - 1); |
| 168 | } |
| 169 | |
| 170 | document.location = url; |
| 171 | }); |
| 172 | } |
| 173 | } |
| 174 | }); |
| 175 | // } |
| 176 | // else { |
| 177 | // tbody.children ().each (function (index, row) { |
| 178 | // $("#history-list-actions").append (row); |
| 179 | // }); |
| 180 | // } |
Alexander Afanasyev | f7c7cde | 2013-03-02 00:01:32 -0800 | [diff] [blame^] | 181 | |
| 182 | $.contextMenu({ |
| 183 | selector: ".with-context-menu", |
| 184 | events: { |
| 185 | show: function (opt) { |
| 186 | console.log(opt.$trigger.attr ("filename")); |
| 187 | opt.items.info.name = opt.$trigger.attr ("filename"); |
| 188 | console.log (opt.items.info.name); |
| 189 | }, |
| 190 | }, |
| 191 | items: { |
| 192 | "info": {name: "x", type: "html", html: "<b>File operations</b>"}, |
| 193 | "sep1": "---------", |
| 194 | history: {name: "View file history", |
| 195 | icon: "quit", // need a better icon |
| 196 | callback: function(key, opt) { |
| 197 | openHistoryForItem (opt.$trigger.attr ("filename")); |
| 198 | }}, |
| 199 | // bar: {name: "Bar", callback: function(key, opt){ alert("Bar!") }} |
| 200 | } |
| 201 | // there's more, have a look at the demos and docs... |
| 202 | }); |
Alexander Afanasyev | fd5e627 | 2013-02-27 20:25:20 -0800 | [diff] [blame] | 203 | } |
| 204 | else if (kind == Closure.UPCALL_INTEREST_TIMED_OUT) { |
| 205 | $("#error").html ("Interest timed out"); |
| 206 | $("#error").removeClass ("hidden"); |
| 207 | } |
| 208 | else { |
| 209 | $("#error").html ("Unknown error happened"); |
| 210 | $("#error").removeClass ("hidden"); |
Alexander Afanasyev | fd5e627 | 2013-02-27 20:25:20 -0800 | [diff] [blame] | 211 | } |
Alexander Afanasyev | 3c95c85 | 2013-03-01 18:58:50 -0800 | [diff] [blame] | 212 | }, |
| 213 | |
| 214 | base_url: function () { |
| 215 | url = "#fileList"+ |
| 216 | "&user="+encodeURIComponent (encodeURIComponent (PARAMS.user)) + |
| 217 | "&folder="+encodeURIComponent (encodeURIComponent (PARAMS.folder)); |
| 218 | if (PARAMS.item !== undefined) { |
| 219 | url += "&item="+encodeURIComponent (encodeURIComponent (PARAMS.item)); |
| 220 | } |
| 221 | return url; |
Zhenkai Zhu | 5c2475b | 2013-02-26 22:57:31 -0800 | [diff] [blame] | 222 | } |
Alexander Afanasyev | fd5e627 | 2013-02-27 20:25:20 -0800 | [diff] [blame] | 223 | }); |
Zhenkai Zhu | 5c2475b | 2013-02-26 22:57:31 -0800 | [diff] [blame] | 224 | |
Alexander Afanasyev | fd5e627 | 2013-02-27 20:25:20 -0800 | [diff] [blame] | 225 | |
Alexander Afanasyev | f63a514 | 2013-02-28 02:21:42 -0800 | [diff] [blame] | 226 | $.Class ("HistoryClosure", {}, { |
| 227 | init: function (chronoshare) { |
| 228 | this.chronoshare = chronoshare; |
| 229 | }, |
| 230 | |
| 231 | upcall: function(kind, upcallInfo) { |
| 232 | $("#loader").fadeOut (500); // ("hidden"); |
| 233 | if (kind == Closure.UPCALL_CONTENT) { |
| 234 | convertedData = DataUtils.toString (upcallInfo.contentObject.content); |
Alexander Afanasyev | c15e016 | 2013-02-28 23:38:52 -0800 | [diff] [blame] | 235 | if (PARAMS.debug) { |
| 236 | $("#json").text (convertedData); |
| 237 | $("#json").removeClass ("hidden"); |
| 238 | } |
Alexander Afanasyev | f63a514 | 2013-02-28 02:21:42 -0800 | [diff] [blame] | 239 | data = JSON.parse (convertedData); |
| 240 | |
Alexander Afanasyev | 3c95c85 | 2013-03-01 18:58:50 -0800 | [diff] [blame] | 241 | tbody = $("<tbody />", { "id": "history-list-actions" }); |
| 242 | |
| 243 | newcontent = $("<div />", { "id": "content" }).append ( |
Alexander Afanasyev | f7c7cde | 2013-03-02 00:01:32 -0800 | [diff] [blame^] | 244 | $("<h2 />").append ($(document.createTextNode("Recent actions ")), $("<green />").text (PARAMS.item)), |
Alexander Afanasyev | f63a514 | 2013-02-28 02:21:42 -0800 | [diff] [blame] | 245 | $("<table />", { "class": "item-list" }) |
| 246 | .append ($("<thead />") |
| 247 | .append ($("<tr />") |
| 248 | .append ($("<th />", { "class": "filename border-left", "scope": "col" }).text ("Filename")) |
| 249 | .append ($("<th />", { "class": "version", "scope": "col" }).text ("Version")) |
| 250 | .append ($("<th />", { "class": "modified", "scope": "col" }).text ("Modified")) |
| 251 | .append ($("<th />", { "class": "modified-by border-right", "scope": "col" }).text ("Modified By")))) |
Alexander Afanasyev | 3c95c85 | 2013-03-01 18:58:50 -0800 | [diff] [blame] | 252 | .append (tbody) |
Alexander Afanasyev | f63a514 | 2013-02-28 02:21:42 -0800 | [diff] [blame] | 253 | .append ($("<tfoot />") |
| 254 | .append ($("<tr />") |
| 255 | .append ($("<td />", { "colspan": "4", "class": "border-right border-left" }))))); |
| 256 | |
Alexander Afanasyev | f63a514 | 2013-02-28 02:21:42 -0800 | [diff] [blame] | 257 | for (var i = 0; i < data.actions.length; i++) { |
| 258 | action = data.actions[i]; |
| 259 | |
| 260 | row = $("<tr />"); |
| 261 | if (i%2) { row.addClass ("odd"); } |
Alexander Afanasyev | 3c95c85 | 2013-03-01 18:58:50 -0800 | [diff] [blame] | 262 | if (action.action=="DELETE") { row.addClass ("delete"); } |
Alexander Afanasyev | f63a514 | 2013-02-28 02:21:42 -0800 | [diff] [blame] | 263 | |
| 264 | row.bind('mouseenter mouseleave', function() { |
| 265 | $(this).toggleClass('highlighted'); |
| 266 | }); |
| 267 | |
Alexander Afanasyev | f7c7cde | 2013-03-02 00:01:32 -0800 | [diff] [blame^] | 268 | row.attr ("filename", action.filename); |
| 269 | row.attr ("file_version", action.version); |
| 270 | row.attr ("file_hash", action.hash); |
Alexander Afanasyev | 39dbc4b | 2013-03-01 10:39:23 -0800 | [diff] [blame] | 271 | |
Alexander Afanasyev | 3c95c85 | 2013-03-01 18:58:50 -0800 | [diff] [blame] | 272 | // row.bind('click', function (e) { |
| 273 | // url = "#fileHistory"; |
| 274 | // url += "&item=" + $(this).attr ("filename"); |
| 275 | // pos = URIPARAMS.indexOf ("&"); |
| 276 | // if (pos >= 0) { |
| 277 | // url += URIPARAMS.substring (pos) |
| 278 | // } |
Alexander Afanasyev | 39dbc4b | 2013-03-01 10:39:23 -0800 | [diff] [blame] | 279 | |
Alexander Afanasyev | 3c95c85 | 2013-03-01 18:58:50 -0800 | [diff] [blame] | 280 | // document.location = url; |
| 281 | // }); |
Alexander Afanasyev | f63a514 | 2013-02-28 02:21:42 -0800 | [diff] [blame] | 282 | |
Alexander Afanasyev | f7c7cde | 2013-03-02 00:01:32 -0800 | [diff] [blame^] | 283 | row.append ($("<td />", { "class": "filename border-left" }) |
| 284 | .text (action.filename) |
| 285 | .prepend ($("<img />", { "src": fileExtension(action.filename) }))); |
Alexander Afanasyev | 3c95c85 | 2013-03-01 18:58:50 -0800 | [diff] [blame] | 286 | row.append ($("<td />", { "class": "version" }).text (action.version)); |
| 287 | row.append ($("<td />", { "class": "timestamp" }).text (new Date (action.timestamp))); |
| 288 | row.append ($("<td />", { "class": "modified-by border-right" }) |
Alexander Afanasyev | f63a514 | 2013-02-28 02:21:42 -0800 | [diff] [blame] | 289 | .append ($("<userName />").text (action.id.userName)) |
| 290 | .append ($("<seqNo> /").text (action.id.seqNo))); |
| 291 | |
Alexander Afanasyev | 3c95c85 | 2013-03-01 18:58:50 -0800 | [diff] [blame] | 292 | tbody = tbody.append (row); |
Alexander Afanasyev | f63a514 | 2013-02-28 02:21:42 -0800 | [diff] [blame] | 293 | } |
Alexander Afanasyev | 3c95c85 | 2013-03-01 18:58:50 -0800 | [diff] [blame] | 294 | |
| 295 | // if (!PARAMS.offset || PARAMS.offset==0) |
| 296 | // { |
| 297 | $("#content").fadeOut ("fast", function () { |
| 298 | $(this).replaceWith (newcontent); |
| 299 | $("#content").fadeIn ("fast"); |
| 300 | }); |
| 301 | |
| 302 | self = this; // small "cheat" |
| 303 | $("#content-nav").fadeOut ("fast", function () { |
| 304 | $("#content-nav a").hide (); |
| 305 | |
| 306 | if (PARAMS.offset !== undefined || data.more !== undefined) { |
| 307 | $("#content-nav").fadeIn ("fast"); |
| 308 | |
| 309 | if (data.more !== undefined) { |
| 310 | $("#get-more").show (); |
| 311 | |
| 312 | $("#get-more").unbind ('click').click (function () { |
| 313 | url = self.base_url (PAGE); |
| 314 | url += "&offset="+data.more; |
| 315 | |
| 316 | document.location = url; |
| 317 | }); |
| 318 | } |
| 319 | if (PARAMS.offset > 0) { |
| 320 | $("#get-less").show (); |
| 321 | |
| 322 | $("#get-less").unbind ('click').click (function () { |
| 323 | url = self.base_url (PAGE); |
| 324 | if (PARAMS.offset > 1) { |
| 325 | url += "&offset="+(PARAMS.offset - 1); |
| 326 | } |
| 327 | |
| 328 | document.location = url; |
| 329 | }); |
| 330 | } |
| 331 | } |
| 332 | }); |
| 333 | // } |
| 334 | // else { |
| 335 | // tbody.children ().each (function (index, row) { |
| 336 | // $("#history-list-actions").append (row); |
| 337 | // }); |
| 338 | // } |
Alexander Afanasyev | f63a514 | 2013-02-28 02:21:42 -0800 | [diff] [blame] | 339 | } |
| 340 | else if (kind == Closure.UPCALL_INTEREST_TIMED_OUT) { |
| 341 | $("#error").html ("Interest timed out"); |
| 342 | $("#error").removeClass ("hidden"); |
| 343 | } |
| 344 | else { |
| 345 | $("#error").html ("Unknown error happened"); |
| 346 | $("#error").removeClass ("hidden"); |
| 347 | } |
Alexander Afanasyev | 3c95c85 | 2013-03-01 18:58:50 -0800 | [diff] [blame] | 348 | }, |
| 349 | |
| 350 | base_url: function (page) { |
| 351 | url = "#"+page+ |
| 352 | "&user="+encodeURIComponent (encodeURIComponent (PARAMS.user)) + |
| 353 | "&folder="+encodeURIComponent (encodeURIComponent (PARAMS.folder)); |
| 354 | if (PARAMS.item !== undefined) { |
| 355 | url += "&item="+encodeURIComponent (encodeURIComponent (PARAMS.item)); |
| 356 | } |
| 357 | return url; |
Alexander Afanasyev | f63a514 | 2013-02-28 02:21:42 -0800 | [diff] [blame] | 358 | } |
| 359 | }); |
| 360 | |
| 361 | |
Alexander Afanasyev | fd5e627 | 2013-02-27 20:25:20 -0800 | [diff] [blame] | 362 | |
| 363 | |