Allow translators to pre-select items in the "multiple" select item dialog.
This commit is contained in:
parent
42215d0441
commit
fed9fe597d
1 changed files with 12 additions and 2 deletions
|
@ -47,11 +47,21 @@ Zotero_Ingester_Interface_SelectItems.init = function() {
|
||||||
var listbox = document.getElementById("zotero-selectitems-links");
|
var listbox = document.getElementById("zotero-selectitems-links");
|
||||||
|
|
||||||
for(var i in this.io.dataIn) { // we could use a tree for this if we wanted to
|
for(var i in this.io.dataIn) { // we could use a tree for this if we wanted to
|
||||||
|
var item = this.io.dataIn[i];
|
||||||
|
|
||||||
|
var title, checked = false;
|
||||||
|
if(typeof(item) != "string" && item.title != undefined) {
|
||||||
|
title = item.title;
|
||||||
|
checked = !!item.checked;
|
||||||
|
} else {
|
||||||
|
title = item;
|
||||||
|
}
|
||||||
|
|
||||||
var itemNode = document.createElement("listitem");
|
var itemNode = document.createElement("listitem");
|
||||||
itemNode.setAttribute("type", "checkbox");
|
itemNode.setAttribute("type", "checkbox");
|
||||||
itemNode.setAttribute("value", i);
|
itemNode.setAttribute("value", i);
|
||||||
itemNode.setAttribute("label", this.io.dataIn[i]);
|
itemNode.setAttribute("label", title);
|
||||||
itemNode.setAttribute("checked", false);
|
itemNode.setAttribute("checked", checked);
|
||||||
listbox.appendChild(itemNode);
|
listbox.appendChild(itemNode);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue