Fixing translation in modtools
I don't understand this though #1201 . Deletes work fine here
Cette révision appartient à :
Parent
e56aa2a713
révision
e9b6f3c3c7
1 fichiers modifiés avec 60 ajouts et 60 suppressions
|
@ -32,21 +32,21 @@ var TorrentsMod = {
|
||||||
for (var i=0; i < btn_actions.length; i++) {
|
for (var i=0; i < btn_actions.length; i++) {
|
||||||
btn_actions[i].disabled = true;
|
btn_actions[i].disabled = true;
|
||||||
switch (btn_actions[i].id) {
|
switch (btn_actions[i].id) {
|
||||||
case this.delete_btn:
|
case this.delete_btn:
|
||||||
btn_actions[i].addEventListener("click", this.Delete)
|
btn_actions[i].addEventListener("click", this.Delete)
|
||||||
break;
|
break;
|
||||||
case this.lock_delete_btn:
|
case this.lock_delete_btn:
|
||||||
btn_actions[i].addEventListener("click", this.LockDelete)
|
btn_actions[i].addEventListener("click", this.LockDelete)
|
||||||
break;
|
break;
|
||||||
case this.edit_btn:
|
case this.edit_btn:
|
||||||
btn_actions[i].addEventListener("click", this.Edit)
|
btn_actions[i].addEventListener("click", this.Edit)
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (var i=0; i < this.checkboxes.length; i++) {
|
for (var i=0; i < this.checkboxes.length; i++) {
|
||||||
checkbox = this.checkboxes[i];
|
var checkbox = this.checkboxes[i];
|
||||||
checkbox.addEventListener("change", this.checkboxEventHandler)
|
checkbox.addEventListener("change", this.checkboxEventHandler)
|
||||||
}
|
}
|
||||||
sh_btn.addEventListener("click", function(e) {
|
sh_btn.addEventListener("click", function(e) {
|
||||||
|
@ -118,7 +118,7 @@ var TorrentsMod = {
|
||||||
parentDiv.removeChild(el);
|
parentDiv.removeChild(el);
|
||||||
},
|
},
|
||||||
generatingModal: function() {
|
generatingModal: function() {
|
||||||
listLength = this.queued.length;
|
var listLength = this.queued.length;
|
||||||
var div = {"edit": "", "delete": ""};
|
var div = {"edit": "", "delete": ""};
|
||||||
for (var i=0; i < listLength; i++) {
|
for (var i=0; i < listLength; i++) {
|
||||||
var listHTML = "";
|
var listHTML = "";
|
||||||
|
@ -171,7 +171,7 @@ var TorrentsMod = {
|
||||||
},
|
},
|
||||||
removeFromSelection: function(torrent) {
|
removeFromSelection: function(torrent) {
|
||||||
delete this.selected[torrent.id];
|
delete this.selected[torrent.id];
|
||||||
for (t in this.selected) {
|
for (var t in this.selected) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
this.selected = [];
|
this.selected = [];
|
||||||
|
@ -207,7 +207,7 @@ var TorrentsMod = {
|
||||||
},
|
},
|
||||||
formatSelectionToQuery: function(selection) {
|
formatSelectionToQuery: function(selection) {
|
||||||
var format = "";
|
var format = "";
|
||||||
for (s in selection) {
|
for (var s in selection) {
|
||||||
format += "&torrent_id="+selection[s].id
|
format += "&torrent_id="+selection[s].id
|
||||||
}
|
}
|
||||||
return (format != "") ? format.substr(1) : ""
|
return (format != "") ? format.substr(1) : ""
|
||||||
|
@ -306,63 +306,63 @@ var TorrentsMod = {
|
||||||
var withReport = confirm(T.r("delete_reports_with_torrents"))
|
var withReport = confirm(T.r("delete_reports_with_torrents"))
|
||||||
var selection = TorrentsMod.selected;
|
var selection = TorrentsMod.selected;
|
||||||
if (locked)
|
if (locked)
|
||||||
TorrentsMod.AddToQueue({ action: "delete",
|
TorrentsMod.AddToQueue({ action: "delete",
|
||||||
withReport: withReport,
|
withReport: withReport,
|
||||||
selection: selection,
|
selection: selection,
|
||||||
queryPost: "",
|
queryPost: "",
|
||||||
infos: T.r("with_lock")+ ((withReport) ? T.r("and_reports") : ""),
|
infos: T.r("with_st", T.r("lock")) + ((withReport) ? T.r("and_reports") : ""),
|
||||||
status: "5" });
|
status: "5" });
|
||||||
else TorrentsMod.AddToQueue({
|
else TorrentsMod.AddToQueue({
|
||||||
action: "delete",
|
action: "delete",
|
||||||
withReport: withReport,
|
withReport: withReport,
|
||||||
selection: selection,
|
selection: selection,
|
||||||
infos: (withReport) ? T.r("with_reports") : "",
|
infos: (withReport) ? T.r("with_st", T.r("reports")) : "",
|
||||||
queryPost: ""});
|
queryPost: ""});
|
||||||
for (i in selection) document.getElementById("torrent_"+i).style.display="none";
|
for (i in selection) document.getElementById("torrent_"+i).style.display="none";
|
||||||
TorrentsMod.selected = []
|
TorrentsMod.selected = []
|
||||||
TorrentsMod.disableBtnActions();
|
TorrentsMod.disableBtnActions();
|
||||||
},
|
},
|
||||||
Delete: function(e) {
|
Delete: function(e) {
|
||||||
TorrentsMod.DeleteHandler(false);
|
TorrentsMod.DeleteHandler(false);
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
},
|
},
|
||||||
LockDelete: function(e) {
|
LockDelete: function(e) {
|
||||||
TorrentsMod.DeleteHandler(true);
|
TorrentsMod.DeleteHandler(true);
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
},
|
},
|
||||||
Edit: function(e) {
|
Edit: function(e) {
|
||||||
var selection = TorrentsMod.selected;
|
var selection = TorrentsMod.selected;
|
||||||
var status = document.querySelector(".modtools *[name='"+TorrentsMod.status_input_name+"']").value;
|
var status = document.querySelector(".modtools *[name='"+TorrentsMod.status_input_name+"']").value;
|
||||||
var owner_id = document.querySelector(".modtools *[name='"+TorrentsMod.owner_input_name+"']").value;
|
var owner_id = document.querySelector(".modtools *[name='"+TorrentsMod.owner_input_name+"']").value;
|
||||||
var category = document.querySelector(".modtools *[name='"+TorrentsMod.category_input_name+"']").value;
|
var category = document.querySelector(".modtools *[name='"+TorrentsMod.category_input_name+"']").value;
|
||||||
var infos = "";
|
var infos = "";
|
||||||
infos += (status != "") ? T.r("status_js", status) : "";
|
infos += (status != "") ? T.r("status_js", status) : "";
|
||||||
infos += (owner_id != "") ? T.r("owner_id_js", owner_id) : "";
|
infos += (owner_id != "") ? T.r("owner_id_js", owner_id) : "";
|
||||||
infos += (category != "") ? T.r("category_js", category) : "";
|
infos += (category != "") ? T.r("category_js", category) : "";
|
||||||
TorrentsMod.AddToQueue({
|
TorrentsMod.AddToQueue({
|
||||||
action: "edit",
|
action: "edit",
|
||||||
selection: selection,
|
selection: selection,
|
||||||
queryPost: "", // We don't format now, we wait until the query is sent
|
queryPost: "", // We don't format now, we wait until the query is sent
|
||||||
infos: (infos != "" ) ? T.r("with_st", infos) : T.r("no_changes"),
|
infos: (infos != "" ) ? T.r("with_st", infos) : T.r("no_changes"),
|
||||||
status: status,
|
status: status,
|
||||||
category: category,
|
category: category,
|
||||||
owner: owner_id });
|
owner: owner_id });
|
||||||
if (status != "") {
|
if (status != "") {
|
||||||
for (i in selection) document.getElementById("torrent_"+i).className="torrent-info "+TorrentsMod.statusToClassName(status);
|
for (i in selection) document.getElementById("torrent_"+i).className="torrent-info "+TorrentsMod.statusToClassName(status);
|
||||||
}
|
}
|
||||||
TorrentsMod.selected = []
|
TorrentsMod.selected = []
|
||||||
TorrentsMod.disableBtnActions();
|
TorrentsMod.disableBtnActions();
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
},
|
},
|
||||||
ApplyChanges: function() {
|
ApplyChanges: function() {
|
||||||
this.pause = false;
|
this.pause = false;
|
||||||
this.QueryLoop();
|
this.QueryLoop();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
// Load torrentMods when DOM is ready
|
// Load torrentMods when DOM is ready
|
||||||
document.addEventListener("DOMContentLoaded", function() {
|
document.addEventListener("DOMContentLoaded", function() {
|
||||||
TorrentsMod.checkboxes = document.querySelectorAll("input[name='torrent_id']");
|
TorrentsMod.checkboxes = document.querySelectorAll("input[name='torrent_id']");
|
||||||
TorrentsMod.Create();
|
TorrentsMod.Create();
|
||||||
});
|
});
|
||||||
// @license-end
|
// @license-end
|
||||||
|
|
Référencer dans un nouveau ticket