commit
4c1ea97c92
@ -430,6 +430,11 @@ public class FileProjectManager extends ProjectManager {
|
|||||||
try {
|
try {
|
||||||
boolean found = false;
|
boolean found = false;
|
||||||
JSONObject placeHolderJsonObj = userMetadataPreference.getJSONObject(index);
|
JSONObject placeHolderJsonObj = userMetadataPreference.getJSONObject(index);
|
||||||
|
|
||||||
|
if (!isValidUserMetaDataDefinition(placeHolderJsonObj)) {
|
||||||
|
logger.warn("Skipped invalid user metadata definition" + placeHolderJsonObj.toString());
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
for (int i = 0; i < jsonObjArray.length(); i++) {
|
for (int i = 0; i < jsonObjArray.length(); i++) {
|
||||||
JSONObject jsonObj = jsonObjArray.getJSONObject(i);
|
JSONObject jsonObj = jsonObjArray.getJSONObject(i);
|
||||||
@ -452,6 +457,17 @@ public class FileProjectManager extends ProjectManager {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A valid user meta data definition should have name and display property
|
||||||
|
* @param placeHolderJsonObj
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
private boolean isValidUserMetaDataDefinition(JSONObject placeHolderJsonObj) {
|
||||||
|
return (placeHolderJsonObj != null &&
|
||||||
|
placeHolderJsonObj.has("name") &&
|
||||||
|
placeHolderJsonObj.has("display"));
|
||||||
|
}
|
||||||
|
|
||||||
protected void recover() {
|
protected void recover() {
|
||||||
boolean recovered = false;
|
boolean recovered = false;
|
||||||
|
@ -14,29 +14,31 @@ function EditMetadataDialog(metaData, targetRowElem) {
|
|||||||
|
|
||||||
var td2 = tr.insertCell(2);
|
var td2 = tr.insertCell(2);
|
||||||
|
|
||||||
$('<button class="button">').text($.i18n._('core-index')["edit"]).appendTo(td2).click(function() {
|
if (key !== "modified" && key !== "rowNumber" && key !== "importOptionMetaData" && key !== "id") {
|
||||||
var newValue = window.prompt($.i18n._('core-index')["change-metadata-value"]+" " + key, value);
|
$('<button class="button">').text($.i18n._('core-index')["edit"]).appendTo(td2).click(function() {
|
||||||
if (newValue !== null) {
|
var newValue = window.prompt($.i18n._('core-index')["change-metadata-value"]+" " + key, value);
|
||||||
$(td1).text(newValue);
|
if (newValue !== null) {
|
||||||
metaData[key] = newValue;
|
$(td1).text(newValue);
|
||||||
$.post(
|
metaData[key] = newValue;
|
||||||
"command/core/set-metaData",
|
$.post(
|
||||||
{
|
"command/core/set-metaData",
|
||||||
project : project,
|
{
|
||||||
name : key,
|
project : project,
|
||||||
value : newValue
|
name : key,
|
||||||
},
|
value : newValue
|
||||||
function(o) {
|
},
|
||||||
if (o.code === "error") {
|
function(o) {
|
||||||
alert(o.message);
|
if (o.code === "error") {
|
||||||
}
|
alert(o.message);
|
||||||
},
|
}
|
||||||
"json"
|
},
|
||||||
);
|
"json"
|
||||||
}
|
);
|
||||||
|
}
|
||||||
Refine.OpenProjectUI.refreshProject(targetRowElem, metaData);
|
|
||||||
});
|
Refine.OpenProjectUI.refreshProject(targetRowElem, metaData);
|
||||||
|
});
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
this._createDialog();
|
this._createDialog();
|
||||||
|
@ -264,11 +264,24 @@ Refine.OpenProjectUI.prototype._renderProjects = function(data) {
|
|||||||
renderProject(projects[i]);
|
renderProject(projects[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$.tablesorter.addParser({
|
||||||
|
id: "isoDateParser",
|
||||||
|
is: function(s) {
|
||||||
|
return (/^\d{4}[\/\-]\d{1,2}[\/\-]\d{1,2}T\d{2}:\d{2}:\d{2}[\+,\-\.]\d{3}/).test(s);
|
||||||
|
},
|
||||||
|
format: function(s, table) {
|
||||||
|
return $.tablesorter.formatFloat((s !== "") ? (new Date(s).getTime() || "") : "", table);
|
||||||
|
},
|
||||||
|
type: "numeric"
|
||||||
|
});
|
||||||
|
|
||||||
$(table).tablesorter({
|
$(table).tablesorter({
|
||||||
headers : {
|
headers : {
|
||||||
|
0: { sorter: false },
|
||||||
|
1: { sorter: false },
|
||||||
|
2: { sorter: false },
|
||||||
3 : {
|
3 : {
|
||||||
sorter : "time"
|
sorter : "isoDateParser"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -87,6 +87,14 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||||||
opacity: 0.2;
|
opacity: 0.2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#projects-container > table {
|
||||||
|
table-layout: fixed
|
||||||
|
}
|
||||||
|
|
||||||
|
#projects-container > table > tbody > tr > td {
|
||||||
|
word-wrap: break-word;
|
||||||
|
}
|
||||||
|
|
||||||
#metadata-body tr:nth-child(even) {background: #CCC}
|
#metadata-body tr:nth-child(even) {background: #CCC}
|
||||||
#metadata-body tr:nth-child(odd) {background: #FFF}
|
#metadata-body tr:nth-child(odd) {background: #FFF}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user