Add support for all Wikibase datatypes
This commit is contained in:
parent
03c7674858
commit
d6b229f25e
@ -30,6 +30,11 @@
|
|||||||
"item-or-reconciled-column": "item or reconciled column",
|
"item-or-reconciled-column": "item or reconciled column",
|
||||||
"amount": "amount",
|
"amount": "amount",
|
||||||
"unit": "unit",
|
"unit": "unit",
|
||||||
|
"full-url": "full URL including the protocol",
|
||||||
|
"tabular-data-with-prefix": "filename starting with \"Data:\"",
|
||||||
|
"commons-media": "filename",
|
||||||
|
"math-expression": "mathematical expression",
|
||||||
|
"geoshape-with-prefix": "filename starting with \"Data:\"",
|
||||||
"datatype-not-supported-yet": "This datatype is not supported yet, sorry.",
|
"datatype-not-supported-yet": "This datatype is not supported yet, sorry.",
|
||||||
"invalid-schema-warning-issues": "Your schema is incomplete, fix it to see the issues.",
|
"invalid-schema-warning-issues": "Your schema is incomplete, fix it to see the issues.",
|
||||||
"invalid-schema-warning-qs": "Your schema is incomplete, fix it to see the preview.",
|
"invalid-schema-warning-qs": "Your schema is incomplete, fix it to see the preview.",
|
||||||
|
@ -606,6 +606,24 @@ SchemaAlignmentDialog._initField = function(inputContainer, mode, initialValue,
|
|||||||
});
|
});
|
||||||
changedCallback();
|
changedCallback();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
} else if (this._reconService !== null && mode === "wikibase-property") {
|
||||||
|
var endpoint = null;
|
||||||
|
endpoint = this._reconService.suggest.property;
|
||||||
|
var suggestConfig = $.extend({}, endpoint);
|
||||||
|
suggestConfig.key = null;
|
||||||
|
suggestConfig.query_param_name = "prefix";
|
||||||
|
|
||||||
|
input.suggestP(suggestConfig).bind("fb-select", function(evt, data) {
|
||||||
|
inputContainer.data("jsonValue", {
|
||||||
|
type : "wbpropconstant",
|
||||||
|
pid : data.id,
|
||||||
|
label: data.name,
|
||||||
|
datatype: "not-important",
|
||||||
|
});
|
||||||
|
changedCallback();
|
||||||
|
});
|
||||||
|
|
||||||
} else if (mode === "time") {
|
} else if (mode === "time") {
|
||||||
input.attr("placeholder", "YYYY(-MM(-DD))...");
|
input.attr("placeholder", "YYYY(-MM(-DD))...");
|
||||||
var propagateValue = function(val) {
|
var propagateValue = function(val) {
|
||||||
@ -620,6 +638,7 @@ SchemaAlignmentDialog._initField = function(inputContainer, mode, initialValue,
|
|||||||
propagateValue($(this).val());
|
propagateValue($(this).val());
|
||||||
changedCallback();
|
changedCallback();
|
||||||
});
|
});
|
||||||
|
|
||||||
} else if (mode === "globe-coordinate") {
|
} else if (mode === "globe-coordinate") {
|
||||||
input.attr("placeholder", "lat/lon");
|
input.attr("placeholder", "lat/lon");
|
||||||
var propagateValue = function(val) {
|
var propagateValue = function(val) {
|
||||||
@ -634,6 +653,7 @@ SchemaAlignmentDialog._initField = function(inputContainer, mode, initialValue,
|
|||||||
propagateValue($(this).val());
|
propagateValue($(this).val());
|
||||||
changedCallback();
|
changedCallback();
|
||||||
});
|
});
|
||||||
|
|
||||||
} else if (mode === "language") {
|
} else if (mode === "language") {
|
||||||
input.attr("placeholder", "lang");
|
input.attr("placeholder", "lang");
|
||||||
input.addClass("wbs-language-input");
|
input.addClass("wbs-language-input");
|
||||||
@ -645,6 +665,7 @@ SchemaAlignmentDialog._initField = function(inputContainer, mode, initialValue,
|
|||||||
});
|
});
|
||||||
changedCallback();
|
changedCallback();
|
||||||
});
|
});
|
||||||
|
|
||||||
} else if (mode === "monolingualtext") {
|
} else if (mode === "monolingualtext") {
|
||||||
input.remove();
|
input.remove();
|
||||||
var inputContainerLanguage = $('<div></div>')
|
var inputContainerLanguage = $('<div></div>')
|
||||||
@ -674,6 +695,7 @@ SchemaAlignmentDialog._initField = function(inputContainer, mode, initialValue,
|
|||||||
|
|
||||||
SchemaAlignmentDialog._initField(inputContainerLanguage, "language", langValue, propagateValue);
|
SchemaAlignmentDialog._initField(inputContainerLanguage, "language", langValue, propagateValue);
|
||||||
SchemaAlignmentDialog._initField(inputContainerValue, "string", strValue, propagateValue);
|
SchemaAlignmentDialog._initField(inputContainerValue, "string", strValue, propagateValue);
|
||||||
|
|
||||||
} else if (mode === "quantity") {
|
} else if (mode === "quantity") {
|
||||||
input.remove();
|
input.remove();
|
||||||
var inputContainerAmount = $('<div></div>')
|
var inputContainerAmount = $('<div></div>')
|
||||||
@ -703,7 +725,8 @@ SchemaAlignmentDialog._initField = function(inputContainer, mode, initialValue,
|
|||||||
|
|
||||||
SchemaAlignmentDialog._initField(inputContainerAmount, "amount", amountValue, propagateValue);
|
SchemaAlignmentDialog._initField(inputContainerAmount, "amount", amountValue, propagateValue);
|
||||||
SchemaAlignmentDialog._initField(inputContainerUnit, "unit", unitValue, propagateValue);
|
SchemaAlignmentDialog._initField(inputContainerUnit, "unit", unitValue, propagateValue);
|
||||||
} else if (mode === "external-id" || mode === "string" || mode === "amount") {
|
|
||||||
|
} else {
|
||||||
var propagateValue = function(val) {
|
var propagateValue = function(val) {
|
||||||
inputContainer.data("jsonValue", {
|
inputContainer.data("jsonValue", {
|
||||||
type: "wbstringconstant",
|
type: "wbstringconstant",
|
||||||
@ -717,9 +740,27 @@ SchemaAlignmentDialog._initField = function(inputContainer, mode, initialValue,
|
|||||||
});
|
});
|
||||||
if (mode === "amount") {
|
if (mode === "amount") {
|
||||||
input.attr("placeholder", $.i18n._('wikidata-schema')["amount"]);
|
input.attr("placeholder", $.i18n._('wikidata-schema')["amount"]);
|
||||||
|
} else if (mode === "url") {
|
||||||
|
input.attr("placeholder", $.i18n._('wikidata-schema')["full-url"]);
|
||||||
|
} else if (mode === "tabular-data") {
|
||||||
|
input.attr("placeholder", $.i18n._('wikidata-schema')["tabular-data-with-prefix"]);
|
||||||
|
} else if (mode === "commonsMedia") {
|
||||||
|
input.attr("placeholder", $.i18n._('wikidata-schema')["commons-media"]);
|
||||||
|
} else if (mode === "math") {
|
||||||
|
input.attr("placeholder", $.i18n._('wikidata-schema')["math-expression"]);
|
||||||
|
} else if (mode === "geo-shape") {
|
||||||
|
input.attr("placeholder", $.i18n._('wikidata-schema')["geoshape-with-prefix"]);
|
||||||
|
}
|
||||||
|
if (mode !== "external-id" &&
|
||||||
|
mode !== "url" &&
|
||||||
|
mode !== "string" &&
|
||||||
|
mode !== "amount" &&
|
||||||
|
mode !== "tabular-data" &&
|
||||||
|
mode !== "commonsMedia" &&
|
||||||
|
mode !== "geo-shape" &&
|
||||||
|
mode !== "math") {
|
||||||
|
alert($.i18n._('wikidata-schema')["datatype-not-supported-yet"]);
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
alert($.i18n._('wikidata-schema')["datatype-not-supported-yet"]);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
var acceptDraggableColumn = function(column) {
|
var acceptDraggableColumn = function(column) {
|
||||||
|
Loading…
Reference in New Issue
Block a user