Mercurial > hg > NetworkVis
changeset 5:fa1b4fa5b4f8
ADDED: Table for person/codex/witness constraint boxes, reset button (currently leaves previous constraints in the text box)
FIXED: Text constraints are not applied if array left empty
author | alistair |
---|---|
date | Mon, 21 Sep 2015 15:32:32 -0400 |
parents | 72dc19d750ad |
children | aeef1fedd899 |
files | popoto/ismi.html popoto/js/app-ismi.js |
diffstat | 2 files changed, 97 insertions(+), 28 deletions(-) [+] |
line wrap: on
line diff
--- a/popoto/ismi.html Mon Sep 07 23:51:47 2015 -0400 +++ b/popoto/ismi.html Mon Sep 21 15:32:32 2015 -0400 @@ -13,18 +13,66 @@ </header> <section class="ppt-section-main"> - <div class="ppt-section-header" style="height: 150px; line-height: 45px;"> + <div class="ppt-section-header" style="height: auto; line-height: 35px;"> <span class="ppt-header-span">Graph</span> search <form> - <label> - <input id="constraint" type="text" style="width: 500px;" value='$identifier.label IN [""]'> - </label> - <input id="filter-button" type="button" value="Use this filter"> - <br> - <label> - <input id="constraint2" type="text" style="width: 500px;" value='$identifier.death_date_text IN [""]'> - </label> - <input id="filter-button2" type="button" value="Use this filter"> + <table width="100%"> + <tr> + <th>Person Constraints</th> + <th>Codex Constraints</th> + <th>Witness Constraints</th> + </tr> + <tr> + <td> + <label> + <input id="person-constraint" type="text" style="width: 90%;" value='$identifier.label IN [""]'> + </label> + </td> + <td> + <label> + <input id="codex-constraint" type="text" style="width: 90%;" value='$identifier.label IN [""]'> + </label> + </td> + <td> + <label> + <input id="witness-constraint" type="text" style="width: 90%;" value='$identifier.label IN [""]'> + </label> + </td> + </tr> + <tr> + <td> + <label> + <input id="person-constraint2" type="text" style="width: 90%;" value='$identifier.label IN [""]'> + </label> + </td> + <td> + <label> + <input id="codex-constraint2" type="text" style="width: 90%;" value='$identifier.label IN [""]'> + </label> + </td> + <td> + <label> + <input id="witness-constraint2" type="text" style="width: 90%;" value='$identifier.label IN [""]'> + </label> + </td> + </tr> + </table> + <!-- fill labels conditionally and have a single filter button with one id--> + <input id="filter-button" type="button" value="Use these filters"> + <input id="clear-button" type="button" value="Reset"> + <!-- + use: + clickedNode.data = popoto.graph.node.parseResultData(data); + to get data to use in drop down boxes + where: + popoto.graph.node.nodeClick = function () { + has var: + var clickedNode = d3.select(this).data()[0]; // Clicked node data + + note: could just do that for all [i] if not null + should test to see whether the .data returns the attribute type or the actual attribute + just console.log results array in popoto.graph.node.parseResultData + --> </form> </div>
--- a/popoto/js/app-ismi.js Mon Sep 07 23:51:47 2015 -0400 +++ b/popoto/js/app-ismi.js Mon Sep 21 15:32:32 2015 -0400 @@ -24,12 +24,34 @@ * * Uses the text box implementation currently */ - // TODO: finish textbox implementation as backup and add in dropdown menu implementation + // TODO: finish textbox implementation as backup + // have single filter button which on click sets constraints equal to d3.select("#constraintNUMBS)[0][0].value + // for a bunch of spots in the array + // will have to create only 1 d3.select + // the d3.select will need to know what constraints to pull from input boxes based on ids related to whether they + // are person/codex/witness/etc attributes and put them into the corresponding arrays + // personPredefinedConstraints codexPreDef var personPredefinedConstraints = []; +var codexPredefinedConstraints = []; +var witnessPredefinedConstraints = []; d3.select("#filter-button").on("click", function (d) { - var constraint = d3.select("#constraint")[0][0].value; + var person1 = d3.select("#person-constraint")[0][0].value; + var person2 = d3.select("#person-constraint2")[0][0].value; + + var codex1 = d3.select("#codex-constraint")[0][0].value; + var codex2 = d3.select("#codex-constraint2")[0][0].value; + + var witness1 = d3.select("#witness-constraint")[0][0].value; + var witness2 = d3.select("#witness-constraint2")[0][0].value; - personPredefinedConstraints = [constraint]; + if (person1.substring(person1.indexOf('"')+1,person1.lastIndexOf('"'))) personPredefinedConstraints.push(person1); + if (person2.substring(person2.indexOf('"')+1,person2.lastIndexOf('"'))) personPredefinedConstraints.push(person2); + + if (codex1.substring(codex1.indexOf('"')+1,codex1.lastIndexOf('"'))) codexPredefinedConstraints.push(codex1); + if (codex2.substring(codex2.indexOf('"')+1,codex2.lastIndexOf('"'))) codexPredefinedConstraints.push(codex2); + + if (witness1.substring(witness1.indexOf('"')+1,witness1.lastIndexOf('"'))) witnessPredefinedConstraints.push(witness1); + if (witness2.substring(witness2.indexOf('"')+1,witness2.lastIndexOf('"'))) witnessPredefinedConstraints.push(witness2); // Recreate taxonomies panel d3.select("#" + popoto.taxonomy.containerId).selectAll("ul").data([]).exit().remove(); @@ -38,10 +60,10 @@ popoto.tools.reset(); }); -d3.select("#filter-button2").on("click", function (d) { - var constraint = d3.select("#constraint2")[0][0].value; - - personPredefinedConstraints = [constraint]; +d3.select("#clear-button").on("click", function (d) { + personPredefinedConstraints = []; + codexPredefinedConstraints = []; + witnessPredefinedConstraints = []; // Recreate taxonomies panel d3.select("#" + popoto.taxonomy.containerId).selectAll("ul").data([]).exit().remove(); @@ -51,7 +73,6 @@ }); - /** * Define the Label provider you need for your application. * This configuration is mandatory and should contain at least all the labels you could find in your graph model. @@ -67,22 +88,22 @@ "CODEX": { "returnAttributes": ["label", "ismi_id", "identifier"], "displayAttribute": "label", - //"getPredefinedConstraints": function (node) { - // return personPredefinedConstraints; - //}, + "getPredefinedConstraints": function (node) { + return codexPredefinedConstraints; + }, }, "WITNESS": { "returnAttributes": ["label", "ismi_id", "folios"], "displayAttribute": "label", - //"getPredefinedConstraints": function (node) { - // return personPredefinedConstraints; - //}, + "getPredefinedConstraints": function (node) { + return witnessPredefinedConstraints; + }, }, "TEXT": { "returnAttributes": ["label", "full_title", "ismi_id"], "displayAttribute": "label", //"getPredefinedConstraints": function (node) { - // return personPredefinedConstraints; + // return textPredefinedConstraints; //}, }, "PERSON": { @@ -96,13 +117,13 @@ "returnAttributes": ["label", "ismi_id"], "displayAttribute": "label", //"getPredefinedConstraints": function (node) { - // return personPredefinedConstraints; + // return repositoryPredefinedConstraints; //}, }, "FLORUIT_DATE": { - "isSearchable": false + "isSearchable": false, //"getPredefinedConstraints": function (node) { - // return personPredefinedConstraints; + // return floruitPredefinedConstraints; //}, } };