From fed9fe597da0b69cfcc564d6bcdebc1329ae8188 Mon Sep 17 00:00:00 2001 From: aurimasv Date: Mon, 12 Nov 2012 03:19:29 -0600 Subject: [PATCH] Allow translators to pre-select items in the "multiple" select item dialog. --- chrome/content/zotero/ingester/selectitems.js | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/chrome/content/zotero/ingester/selectitems.js b/chrome/content/zotero/ingester/selectitems.js index 4118b790b..32c01596c 100644 --- a/chrome/content/zotero/ingester/selectitems.js +++ b/chrome/content/zotero/ingester/selectitems.js @@ -47,11 +47,21 @@ Zotero_Ingester_Interface_SelectItems.init = function() { 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 + 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"); itemNode.setAttribute("type", "checkbox"); itemNode.setAttribute("value", i); - itemNode.setAttribute("label", this.io.dataIn[i]); - itemNode.setAttribute("checked", false); + itemNode.setAttribute("label", title); + itemNode.setAttribute("checked", checked); listbox.appendChild(itemNode); } }