Skip to content

Commit

Permalink
Nonmatch text saves to court field. Bump version
Browse files Browse the repository at this point in the history
  • Loading branch information
fbennett committed Sep 10, 2017
1 parent c0c9dc9 commit 6a4ef46
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 10 deletions.
17 changes: 8 additions & 9 deletions chrome/content/zotero/bindings/itembox.xml
Expand Up @@ -1961,7 +1961,6 @@
} else {
this.item.setField('court', oldCourtName);
courtNode.setAttribute('value', oldCourtName);
//valueElement.setAttribute("style", "background: yellow;");
courtNode.classList.add('yellow');
}
}
Expand All @@ -1981,21 +1980,20 @@
<method name="hideCourtEditor">
<parameter name="node"/>
<parameter name="result"/>
<parameter name="nonMatchHighlight"/>
<body>
<![CDATA[
return Zotero.spawn(function* () {
var valueElement = document.createElement("menulist");
if (!result || "string" !== typeof result.val) {
Zotero.debug("XXX OK 1 hideCourtEditor " + typeof result.val);
if (!result) {
// Used when saving hand-typed content of the field (triggred on blur)
Zotero.debug("XXX OK 2 hideCourtEditor " + node.value);
// XXX Actually I think this never happens now
var newValue = node.value;
var jurisdictionID = this.item.getField('jurisdiction', true);
var newComment = Zotero.CachedJurisdictionData.courtIdFromName(jurisdictionID, newValue, true);
result = {val:newValue,comment:newComment};
if ("undefined" == typeof result.comment) {
result.comment = result.val;
//valueElement.setAttribute("style", "background: yellow;");
valueElement.classList.add('yellow');
}
} else {
Expand Down Expand Up @@ -2041,6 +2039,9 @@
valueElement.setAttribute("value",result.comment);
valueElement.setAttribute("label",result.val);
valueElement.setAttribute("tooltiptext",result.val);
if (nonMatchHighlight) {
valueElement.classList.add('yellow');
}
node.parentNode.replaceChild(valueElement,node);
this.item.setField("court",result.comment);
this.item.saveTx();
Expand Down Expand Up @@ -2079,11 +2080,11 @@
<parameter name="textbox"/>
<body>
<![CDATA[
// Enables save of non-match text
var result = false;
var nonMatchHighlight = false;
var controller = textbox.controller;
var searchString = controller.searchString;
Zotero.debug("XXX searchString: " + searchString);
if (!controller.matchCount) {
result = {val:searchString, comment:searchString};
nonMatchHighlight = true;
Expand All @@ -2100,7 +2101,7 @@
nonMatchHighlight = true;
}
textbox.mController.input = null;
this.hideCourtEditor(textbox, result);
this.hideCourtEditor(textbox, result, nonMatchHighlight);
]]>
</body>
</method>
Expand Down Expand Up @@ -2136,7 +2137,6 @@
var label = Zotero.CachedJurisdictionData.jurisdictionNameFromId(value);
if (!label) {
label = value;
//valueElement.setAttribute("style", "background: yellow;");
valueElement.classList.add('yellow');
} else {
label = label.split("|");
Expand All @@ -2163,7 +2163,6 @@
// Double-check for validity - may contain a correct court name string
// on upgrade or immediately after data import
if (!Zotero.CachedJurisdictionData.courtIdFromName(jurisdictionValue, value, true)) {
//valueElement.setAttribute("style", "background: yellow;");
valueElement.classList.add('yellow');
}
}
Expand Down
2 changes: 1 addition & 1 deletion install.rdf
Expand Up @@ -6,7 +6,7 @@

<em:id>juris-m@juris-m.github.io</em:id>
<em:name>Juris-M</em:name>
<em:version>5.0.17.2.SOURCE</em:version>
<em:version>5.0.17.3.SOURCE</em:version>
<em:creator>Center for History and New Media<br/>George Mason University</em:creator>
<em:contributor>Dan Cohen</em:contributor>
<em:contributor>Sean Takats</em:contributor>
Expand Down

0 comments on commit 6a4ef46

Please sign in to comment.