|
Lines 22-28
Link Here
|
| 22 |
ApplyPatchDialog.prototype.TEMPLATE = |
22 |
ApplyPatchDialog.prototype.TEMPLATE = |
| 23 |
|
23 |
|
| 24 |
'<div style="padding:4px"><input type="radio" name="radio" value="urlRadio" id="urlRadio" checked/>' + |
24 |
'<div style="padding:4px"><input type="radio" name="radio" value="urlRadio" id="urlRadio" checked/>' + |
| 25 |
messages["URL:"] + '<input type="text" name="url" id="url"/></div>' + |
25 |
messages["URL:"] + '<input type="text" name="url" id="patchurl"/></div>' + |
| 26 |
'<div style="padding:4px"><input type="radio" name="radio" value="fileRadio" id="fileRadio"/>' + |
26 |
'<div style="padding:4px"><input type="radio" name="radio" value="fileRadio" id="fileRadio"/>' + |
| 27 |
messages["File:"] + '<input type="file" name="selectedFile" id="selectedFile" class="uploadChooser" />' + |
27 |
messages["File:"] + '<input type="file" name="selectedFile" id="selectedFile" class="uploadChooser" />' + |
| 28 |
'</div>'; |
28 |
'</div>'; |
|
Lines 34-39
Link Here
|
| 34 |
this.modal = true; |
34 |
this.modal = true; |
| 35 |
this.messages = messages; |
35 |
this.messages = messages; |
| 36 |
this.options = options; |
36 |
this.options = options; |
|
|
37 |
this.customFocus = true; |
| 37 |
|
38 |
|
| 38 |
this.buttons = []; |
39 |
this.buttons = []; |
| 39 |
|
40 |
|
|
Lines 49-68
Link Here
|
| 49 |
}; |
50 |
}; |
| 50 |
|
51 |
|
| 51 |
ApplyPatchDialog.prototype._bindToDom = function(parent) { |
52 |
ApplyPatchDialog.prototype._bindToDom = function(parent) { |
|
|
53 |
var urlField = this.$patchurl; |
| 52 |
this.$selectedFile.onchange = function(event){ |
54 |
this.$selectedFile.onchange = function(event){ |
| 53 |
this.$urlRadio.checked = false; |
55 |
this.$urlRadio.checked = false; |
| 54 |
this.$fileRadio.checked = "fileRadio"; |
56 |
this.$fileRadio.checked = "fileRadio"; |
| 55 |
}.bind(this); |
57 |
}.bind(this); |
| 56 |
this.$url.onchange = function(event){ |
58 |
this.$patchurl.onchange = function(event){ |
| 57 |
this.$urlRadio.checked = "urlRadio"; |
59 |
this.$urlRadio.checked = "urlRadio"; |
| 58 |
this.$fileRadio.checked = false; |
60 |
this.$fileRadio.checked = false; |
| 59 |
}.bind(this); |
61 |
}.bind(this); |
|
|
62 |
window.setTimeout(function () {urlField.focus();}, 0); |
| 60 |
}; |
63 |
}; |
| 61 |
|
64 |
|
| 62 |
ApplyPatchDialog.prototype._applyPatch = function(parent) { |
65 |
ApplyPatchDialog.prototype._applyPatch = function(parent) { |
| 63 |
var formData = new FormData(); |
66 |
var formData = new FormData(); |
| 64 |
formData.append("uploadedfile", this.$selectedFile.files[0]); |
67 |
formData.append("uploadedfile", this.$selectedFile.files[0]); |
| 65 |
formData.append("url", this.$url.value); |
68 |
formData.append("url", this.$patchurl.value); |
| 66 |
formData.append("radio", this.$fileRadio.checked ? "fileRadio" : "urlRadio"); |
69 |
formData.append("radio", this.$fileRadio.checked ? "fileRadio" : "urlRadio"); |
| 67 |
|
70 |
|
| 68 |
this.req = new XMLHttpRequest(); |
71 |
this.req = new XMLHttpRequest(); |