|
432 | 432 | this.setupUploadEvents(this._uploader); |
433 | 433 | } |
434 | 434 | } |
435 | | - |
| 435 | + this.triedActionOnce = false; |
436 | 436 |
|
437 | 437 | OC.Plugins.attach('OCA.Files.FileList', this); |
438 | 438 |
|
|
874 | 874 | if ($tr.hasClass('dragging')) { |
875 | 875 | return; |
876 | 876 | } |
877 | | - if (this._allowSelection && (event.ctrlKey || event.shiftKey)) { |
| 877 | + if (this._allowSelection && (event.shiftKey)) { |
878 | 878 | event.preventDefault(); |
879 | 879 | if (event.shiftKey) { |
880 | 880 | this._selectRange($tr); |
|
883 | 883 | } |
884 | 884 | this._lastChecked = $tr; |
885 | 885 | this.updateSelectionSummary(); |
| 886 | + } else if (this._allowSelection && (event.ctrlKey)) { |
886 | 887 | } else { |
887 | 888 | // clicked directly on the name |
888 | 889 | if (!this._detailsView || $(event.target).is('.nametext, .name, .thumbnail') || $(event.target).closest('.nametext').length) { |
|
892 | 893 | event.preventDefault(); |
893 | 894 | } else if (!renaming) { |
894 | 895 | this.fileActions.currentFile = $tr.find('td'); |
895 | | - var mime = this.fileActions.getCurrentMimeType(); |
896 | | - var type = this.fileActions.getCurrentType(); |
897 | | - var permissions = this.fileActions.getCurrentPermissions(); |
898 | | - var action = this.fileActions.getDefault(mime,type, permissions); |
899 | | - if (action) { |
| 896 | + var item = this.$fileList.children().filterAttr('data-id', '' + $tr.attr('data-id')); |
| 897 | + |
| 898 | + if(this.openAction($tr.attr('data-id'))) { |
900 | 899 | event.preventDefault(); |
901 | | - action(filename, { |
902 | | - $file: $tr, |
903 | | - fileList: this, |
904 | | - fileActions: this.fileActions, |
905 | | - dir: $tr.attr('data-path') || this.getCurrentDirectory() |
906 | | - }); |
907 | 900 | } |
908 | 901 | // deselect row |
909 | 902 | $(event.target).closest('a').blur(); |
|
933 | 926 | } |
934 | 927 | }, |
935 | 928 |
|
| 929 | + openAction: function(id) { |
| 930 | + var item = this.$fileList.children().filterAttr('data-id', '' + id); |
| 931 | + var filename = item.attr('data-file'); |
| 932 | + // also set on global object for legacy apps |
| 933 | + window.FileActions.currentFile = item.find('td'); |
| 934 | + this.fileActions.currentFile = item.find('td'); |
| 935 | + var mime = this.fileActions.getCurrentMimeType(); |
| 936 | + var type = this.fileActions.getCurrentType(); |
| 937 | + var permissions = this.fileActions.getCurrentPermissions(); |
| 938 | + var action = this.fileActions.getDefault(mime,type, permissions); |
| 939 | + if (action) { |
| 940 | + action(filename, { |
| 941 | + $file: item, |
| 942 | + fileList: this, |
| 943 | + fileActions: this.fileActions, |
| 944 | + dir: item.attr('data-path') || this.getCurrentDirectory() |
| 945 | + }); |
| 946 | + return true; |
| 947 | + } |
| 948 | + return false; |
| 949 | + }, |
| 950 | + |
936 | 951 | /** |
937 | 952 | * Event handler for when clicking on a file's checkbox |
938 | 953 | */ |
|
1322 | 1337 | } |
1323 | 1338 | }, 0); |
1324 | 1339 | } |
1325 | | - |
| 1340 | + if(!this.triedActionOnce) { |
| 1341 | + var urlParams = OC.Util.History.parseUrlQuery(); |
| 1342 | + this.openAction(urlParams.editfile); |
| 1343 | + this.triedActionOnce = true; |
| 1344 | + } |
1326 | 1345 | return newTrs; |
1327 | 1346 | }, |
1328 | 1347 |
|
|
1532 | 1551 | linkUrl = this.linkTo(path + '/' + name); |
1533 | 1552 | } |
1534 | 1553 | else { |
1535 | | - linkUrl = this.getDownloadUrl(name, path, type === 'dir'); |
| 1554 | + linkUrl = this.linkTo(path) + "&editfile="+fileData.id; |
1536 | 1555 | } |
1537 | 1556 | var linkElem = $('<a></a>').attr({ |
1538 | 1557 | "class": "name", |
|
0 commit comments