diff --git a/src/main/webapp/project.html b/src/main/webapp/project.html index dc70dc8ad..df3c319da 100644 --- a/src/main/webapp/project.html +++ b/src/main/webapp/project.html @@ -1,2 +1,2 @@ -
').text("Reconcile cell values to Freebase topics of type:").appendTo(body); + var html = $( + '
Reconcile each cell to a Freebase topic of type: | ' + + 'Also use relevant details from other columns: | ' + + '||
' +
+ ' ' +
+ ' ' +
+ '
| ' +
+ '' + + '' + + ' | ' + + '
' + + ' Auto-match correctly-typed candidates scoring at least ' + + '' + + '
' + + '').appendTo(body);
- var autoMatchCheckbox = $('').appendTo(optionDiv);
- $('').text(" Auto-match correctly-typed candidates scoring at least ").appendTo(optionDiv);
- var minScoreInput = $('').width("3em").attr("value", "100").appendTo(optionDiv);
+ this._level = DialogSystem.showDialog(frame);
- $('').text("Start Reconciling").click(function() {
- var choices = $('input[name="recon-dialog-type-choice"]:checked');
- if (choices != null && choices.length > 0 && choices[0].value != "") {
- type = {
- id: choices[0].value,
- name: choices.attr("typeName")
- };
- }
-
- if (type == null) {
- alert("Please specify a type.");
- } else {
- DialogSystem.dismissUntil(level - 1);
-
- Gridworks.postProcess(
- "reconcile",
- {
- columnName: self._column.headerLabel,
- typeID: type.id,
- typeName: type.name,
- autoMatch: autoMatchCheckbox[0].checked,
- minScore: minScoreInput[0].value
- },
- null,
- { cellsChanged: true, columnStatsChanged: true }
- );
- }
- }).appendTo(footer);
-
- $('').text("Cancel").click(function() {
- DialogSystem.dismissUntil(level - 1);
- }).appendTo(footer);
-
- var level = DialogSystem.showDialog(frame);
-
- input.focus().data("suggest").textchange();
+ $("#recon-dialog-tabs").tabs();
+ $("#recon-dialog-tabs-strict").css("display", "");
};
+ReconDialog.prototype._populateDialog = function() {
+ var self = this;
+
+ /*
+ * Populate types in heuristic tab
+ */
+ var typeTable = $('').addClass("recon-dialog-inner-layout").appendTo(this._elmts.heuristicTypeContainer)[0];
+ var createTypeChoice = function(type, check) {
+ var tr = typeTable.insertRow(typeTable.rows.length);
+ var td0 = tr.insertCell(0);
+ var td1 = tr.insertCell(1);
+
+ td0.width = "1%";
+ var checkbox = $('')
+ .attr("value", type.id)
+ .attr("typeName", type.name)
+ .appendTo(td0);
+
+ if (check) {
+ checkbox.attr("checked", "true");
+ }
+
+ $(td1).html(type.name + '
' + type.id + '');
+ };
+ for (var i = 0; i < this._types.length; i++) {
+ createTypeChoice(this._types[i], i == 0);
+ }
+
+ this._elmts.heuristicTypeInput
+ .suggest({ type : '/type/type' })
+ .bind("fb-select", function(e, data) {
+ $('input[name="recon-dialog-type-choice"][value=""]').attr("checked", "true");
+ });
+
+ /*
+ * Populate properties in heuristic tab
+ */
+ var heuristicDetailTable = $(
+ '' +
+ '
'
+ ).addClass("recon-dialog-inner-layout").appendTo(this._elmts.heuristicDetailContainer)[0];
+
+ function renderDetailColumn(column) {
+ var tr = heuristicDetailTable.insertRow(heuristicDetailTable.rows.length);
+ var td0 = tr.insertCell(0);
+ var td1 = tr.insertCell(1);
+
+ $(td0).html(column.headerLabel);
+ $('')
+ .appendTo(td1)
+ .suggest({ type: '/type/property' });
+ }
+ var columns = theProject.columnModel.columns;
+ for (var i = 0; i < columns.length; i++) {
+ var column = columns[i];
+ if (column !== this._column) {
+ renderDetailColumn(column);
+ }
+ }
+
+ /*
+ * Populate strict tab
+ */
+
+ this._elmts.strictNamespaceInput
+ .suggest({ type: '/type/namespace' })
+ .bind("fb-select", function(e, data) {
+ $('input[name="recon-dialog-strict-choice"][value="key"]').attr("checked", "true");
+ $('input[name="recon-dialog-strict-namespace-choice"][value="other"]').attr("checked", "true");
+ });
+};
+
+ReconDialog.prototype._onOK = function() {
+ var tab = $("#recon-dialog-tabs").tabs('option', 'selected');
+ if (tab == 0) {
+ this._onDoHeuristic();
+ } else {
+ this._onDoStrict();
+ }
+};
+
+ReconDialog.prototype._dismiss = function() {
+ DialogSystem.dismissUntil(this._level - 1);
+};
+
+ReconDialog.prototype._onDoHeuristic = function() {
+ var type = this._elmts.heuristicTypeInput.data("data.suggest");
+
+ var choices = $('input[name="recon-dialog-type-choice"]:checked');
+ if (choices != null && choices.length > 0 && choices[0].value != "") {
+ type = {
+ id: choices[0].value,
+ name: choices.attr("typeName")
+ };
+ }
+
+ if (type == null) {
+ alert("Please specify a type.");
+ } else {
+ this._dismiss();
+
+ Gridworks.postProcess(
+ "reconcile",
+ {
+ columnName: this._column.headerLabel,
+ typeID: type.id,
+ typeName: type.name,
+ autoMatch: this._elmts.heuristicAutomatchCheck[0].checked,
+ minScore: this._elmts.heuristicAutomatchScoreInput[0].value
+ },
+ null,
+ { cellsChanged: true, columnStatsChanged: true }
+ );
+ }
+};
\ No newline at end of file
diff --git a/src/main/webapp/styles/recon-dialog.css b/src/main/webapp/styles/recon-dialog.css
new file mode 100644
index 000000000..3d074dd95
--- /dev/null
+++ b/src/main/webapp/styles/recon-dialog.css
@@ -0,0 +1,57 @@
+table.recon-dialog-main-layout {
+ border-collapse: collapse;
+}
+table.recon-dialog-main-layout > tbody > tr > td {
+ padding: 0px;
+ padding-right: 10px;
+ padding-bottom: 10px;
+}
+table.recon-dialog-main-layout > tbody > tr > td:last-child {
+ padding-right: 0px;
+}
+table.recon-dialog-main-layout > tbody > tr:last-child > td {
+ padding-bottom: 0px;
+}
+
+table.recon-dialog-inner-layout {
+ border-collapse: collapse;
+}
+table.recon-dialog-inner-layout > tbody > tr > td {
+ padding: 0px;
+ padding-right: 5px;
+ padding-bottom: 5px;
+}
+table.recon-dialog-inner-layout > tbody > tr > td:last-child {
+ padding-right: 0px;
+}
+table.recon-dialog-inner-layout > tbody > tr:last-child > td {
+ padding-bottom: 0px;
+}
+table.recon-dialog-inner-layout > tbody > tr > th {
+ text-align: left;
+ padding-bottom: 5px;
+ padding-right: 5px;
+}
+
+
+.recon-dialog-type-id {
+ color: #888;
+}
+
+.recon-dialog-heuristic-types-container {
+ border: 1px solid #ccc;
+ padding: 10px;
+ max-height: 200px;
+ overflow: auto;
+}
+.recon-dialog-heuristic-other-type-container {
+ margin: 10px;
+}
+
+.recon-dialog-heuristic-details-container {
+ border: 1px solid #ccc;
+ padding: 10px;
+ max-height: 300px;
+ overflow: auto;
+}
+
' +
+ 'Column Freebase property