|
@@ -66,7 +66,12 @@ ARKIWI.Uploader.prototype.listMetadata = function (item64, callback) {
|
|
data: '',
|
|
data: '',
|
|
dataType: 'json',
|
|
dataType: 'json',
|
|
error: function (xhr, status, error) {
|
|
error: function (xhr, status, error) {
|
|
- throw 'Arkiwi.listMetadata(): status ' + status + ' error ' + error;
|
|
|
|
|
|
+ if (status != 'parsererror')
|
|
|
|
+ throw 'Arkiwi.listMetadata(): status ' + status + ' error ' + error;
|
|
|
|
+ else {
|
|
|
|
+ if (callback != undefined)
|
|
|
|
+ callback(JSON.parse("[]"));
|
|
|
|
+ }
|
|
},
|
|
},
|
|
success: function (result, status, xhr) {
|
|
success: function (result, status, xhr) {
|
|
if (callback != undefined)
|
|
if (callback != undefined)
|
|
@@ -88,7 +93,7 @@ ARKIWI.Uploader.prototype.modifyMetadata = function (item64, jsonKVString, callb
|
|
dataType: 'json',
|
|
dataType: 'json',
|
|
contentType: "application/json",
|
|
contentType: "application/json",
|
|
error: function (xhr, status, error) {
|
|
error: function (xhr, status, error) {
|
|
- throw 'Arkiwi.metadata(): status ' + status + ' error ' + error;
|
|
|
|
|
|
+ throw 'Arkiwi.modifyMetadata(): status ' + status + ' error ' + error;
|
|
},
|
|
},
|
|
success: function (result, status, xhr) {
|
|
success: function (result, status, xhr) {
|
|
if (callback != undefined)
|
|
if (callback != undefined)
|
|
@@ -98,39 +103,19 @@ ARKIWI.Uploader.prototype.modifyMetadata = function (item64, jsonKVString, callb
|
|
});
|
|
});
|
|
};
|
|
};
|
|
|
|
|
|
-/* Cancella un metadato da un file */
|
|
|
|
-ARKIWI.Uploader.prototype.removeMetadata = function (jsonKVString, callback) {
|
|
|
|
|
|
+/* Aggiunge o sovrascrive i metadati di un file. */
|
|
|
|
+ARKIWI.Uploader.prototype.createDirectory = function (item64, newDirectory, callback) {
|
|
$.ajax({
|
|
$.ajax({
|
|
- url: this.uploaderUrl + '/removemetadata/' + this.sessionId + '/?' + this.defaultParameters,
|
|
|
|
|
|
+ url: this.uploaderUrl + '/createdirectory/' + item64 + '/?' + this.defaultParameters,
|
|
type: 'POST',
|
|
type: 'POST',
|
|
async: true,
|
|
async: true,
|
|
cache: false,
|
|
cache: false,
|
|
context: this,
|
|
context: this,
|
|
- data: jsonKVString,
|
|
|
|
- dataType: 'json',
|
|
|
|
- error: function (xhr, status, error) {
|
|
|
|
- throw 'Arkiwi.removeMetadata(): status ' + status + ' error ' + error;
|
|
|
|
- },
|
|
|
|
- success: function (result, status, xhr) {
|
|
|
|
- if (callback != undefined)
|
|
|
|
- callback(result);
|
|
|
|
- },
|
|
|
|
- complete: function (xhr, status) {}
|
|
|
|
- });
|
|
|
|
-};
|
|
|
|
-
|
|
|
|
-/* Chiude la sessione con l'asset store */
|
|
|
|
-ARKIWI.Uploader.prototype.close = function (callback) {
|
|
|
|
- $.ajax({
|
|
|
|
- url: this.uploaderUrl + '/close/' + this.sessionId + '/?' + this.defaultParameters,
|
|
|
|
- type: 'GET',
|
|
|
|
- async: true,
|
|
|
|
- cache: false,
|
|
|
|
- context: this,
|
|
|
|
- data: '',
|
|
|
|
- dataType: 'json',
|
|
|
|
|
|
+ data: newDirectory,
|
|
|
|
+ dataType: 'text',
|
|
|
|
+ contentType: "text/plain ",
|
|
error: function (xhr, status, error) {
|
|
error: function (xhr, status, error) {
|
|
- throw 'Arkiwi.close(): status ' + status + ' error ' + error;
|
|
|
|
|
|
+ throw 'Arkiwi.createDirectory(): status ' + status + ' error ' + error;
|
|
},
|
|
},
|
|
success: function (result, status, xhr) {
|
|
success: function (result, status, xhr) {
|
|
if (callback != undefined)
|
|
if (callback != undefined)
|