Merge pull request #2850 from nextcloud/downstream-26603
Fixed size issues on main detail view and disappearing of share recipients (#26603)
This commit is contained in:
commit
fdf10e242d
|
@ -9,7 +9,20 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
(function(OC, OCA) {
|
(function(OC, OCA) {
|
||||||
var NS_OWNCLOUD = 'http://owncloud.org/ns';
|
|
||||||
|
_.extend(OC.Files.Client, {
|
||||||
|
PROPERTY_FILEID: '{' + OC.Files.Client.NS_OWNCLOUD + '}id',
|
||||||
|
PROPERTY_MESSAGE: '{' + OC.Files.Client.NS_OWNCLOUD + '}message',
|
||||||
|
PROPERTY_ACTORTYPE: '{' + OC.Files.Client.NS_OWNCLOUD + '}actorType',
|
||||||
|
PROPERTY_ACTORID: '{' + OC.Files.Client.NS_OWNCLOUD + '}actorId',
|
||||||
|
PROPERTY_ISUNREAD: '{' + OC.Files.Client.NS_OWNCLOUD + '}isUnread',
|
||||||
|
PROPERTY_OBJECTID: '{' + OC.Files.Client.NS_OWNCLOUD + '}objectId',
|
||||||
|
PROPERTY_OBJECTTYPE: '{' + OC.Files.Client.NS_OWNCLOUD + '}objectType',
|
||||||
|
PROPERTY_ACTORDISPLAYNAME: '{' + OC.Files.Client.NS_OWNCLOUD + '}actorDisplayName',
|
||||||
|
PROPERTY_CREATIONDATETIME: '{' + OC.Files.Client.NS_OWNCLOUD + '}creationDateTime',
|
||||||
|
PROPERTY_MENTIONS: '{' + OC.Files.Client.NS_OWNCLOUD + '}mentions'
|
||||||
|
});
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @class OCA.Comments.CommentModel
|
* @class OCA.Comments.CommentModel
|
||||||
* @classdesc
|
* @classdesc
|
||||||
|
@ -27,16 +40,16 @@
|
||||||
},
|
},
|
||||||
|
|
||||||
davProperties: {
|
davProperties: {
|
||||||
'id': '{' + NS_OWNCLOUD + '}id',
|
'id': OC.Files.Client.PROPERTY_FILEID,
|
||||||
'message': '{' + NS_OWNCLOUD + '}message',
|
'message': OC.Files.Client.PROPERTY_MESSAGE,
|
||||||
'actorType': '{' + NS_OWNCLOUD + '}actorType',
|
'actorType': OC.Files.Client.PROPERTY_ACTORTYPE,
|
||||||
'actorId': '{' + NS_OWNCLOUD + '}actorId',
|
'actorId': OC.Files.Client.PROPERTY_ACTORID,
|
||||||
'actorDisplayName': '{' + NS_OWNCLOUD + '}actorDisplayName',
|
'actorDisplayName': OC.Files.Client.PROPERTY_ACTORDISPLAYNAME,
|
||||||
'creationDateTime': '{' + NS_OWNCLOUD + '}creationDateTime',
|
'creationDateTime': OC.Files.Client.PROPERTY_CREATIONDATETIME,
|
||||||
'objectType': '{' + NS_OWNCLOUD + '}objectType',
|
'objectType': OC.Files.Client.PROPERTY_OBJECTTYPE,
|
||||||
'objectId': '{' + NS_OWNCLOUD + '}objectId',
|
'objectId': OC.Files.Client.PROPERTY_OBJECTID,
|
||||||
'isUnread': '{' + NS_OWNCLOUD + '}isUnread',
|
'isUnread': OC.Files.Client.PROPERTY_ISUNREAD,
|
||||||
'mentions': '{' + NS_OWNCLOUD + '}mentions'
|
'mentions': OC.Files.Client.PROPERTY_MENTIONS
|
||||||
},
|
},
|
||||||
|
|
||||||
parse: function(data) {
|
parse: function(data) {
|
||||||
|
@ -78,4 +91,3 @@
|
||||||
|
|
||||||
OCA.Comments.CommentModel = CommentModel;
|
OCA.Comments.CommentModel = CommentModel;
|
||||||
})(OC, OCA);
|
})(OC, OCA);
|
||||||
|
|
||||||
|
|
|
@ -9,7 +9,11 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
(function(OC, OCA) {
|
(function(OC, OCA) {
|
||||||
var NS_OWNCLOUD = 'http://owncloud.org/ns';
|
|
||||||
|
_.extend(OC.Files.Client, {
|
||||||
|
PROPERTY_READMARKER: '{' + OC.Files.Client.NS_OWNCLOUD + '}readMarker'
|
||||||
|
});
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @class OCA.Comments.CommentSummaryModel
|
* @class OCA.Comments.CommentSummaryModel
|
||||||
* @classdesc
|
* @classdesc
|
||||||
|
@ -37,7 +41,7 @@
|
||||||
_objectId: null,
|
_objectId: null,
|
||||||
|
|
||||||
davProperties: {
|
davProperties: {
|
||||||
'readMarker': '{' + NS_OWNCLOUD + '}readMarker'
|
'readMarker': OC.Files.Client.PROPERTY_READMARKER
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -62,4 +66,3 @@
|
||||||
|
|
||||||
OCA.Comments.CommentSummaryModel = CommentSummaryModel;
|
OCA.Comments.CommentSummaryModel = CommentSummaryModel;
|
||||||
})(OC, OCA);
|
})(OC, OCA);
|
||||||
|
|
||||||
|
|
|
@ -11,6 +11,11 @@
|
||||||
/* global Handlebars */
|
/* global Handlebars */
|
||||||
|
|
||||||
(function() {
|
(function() {
|
||||||
|
|
||||||
|
_.extend(OC.Files.Client, {
|
||||||
|
PROPERTY_COMMENTS_UNREAD: '{' + OC.Files.Client.NS_OWNCLOUD + '}comments-unread'
|
||||||
|
});
|
||||||
|
|
||||||
var TEMPLATE_COMMENTS_UNREAD =
|
var TEMPLATE_COMMENTS_UNREAD =
|
||||||
'<a class="action action-comment permanent" title="{{countMessage}}" href="#">' +
|
'<a class="action action-comment permanent" title="{{countMessage}}" href="#">' +
|
||||||
'<img class="svg" src="{{iconUrl}}"/>' +
|
'<img class="svg" src="{{iconUrl}}"/>' +
|
||||||
|
@ -52,19 +57,17 @@
|
||||||
|
|
||||||
fileList.registerTabView(new OCA.Comments.CommentsTabView('commentsTabView'));
|
fileList.registerTabView(new OCA.Comments.CommentsTabView('commentsTabView'));
|
||||||
|
|
||||||
var NS_OC = 'http://owncloud.org/ns';
|
|
||||||
|
|
||||||
var oldGetWebdavProperties = fileList._getWebdavProperties;
|
var oldGetWebdavProperties = fileList._getWebdavProperties;
|
||||||
fileList._getWebdavProperties = function() {
|
fileList._getWebdavProperties = function() {
|
||||||
var props = oldGetWebdavProperties.apply(this, arguments);
|
var props = oldGetWebdavProperties.apply(this, arguments);
|
||||||
props.push('{' + NS_OC + '}comments-unread');
|
props.push(OC.Files.Client.PROPERTY_COMMENTS_UNREAD);
|
||||||
return props;
|
return props;
|
||||||
};
|
};
|
||||||
|
|
||||||
fileList.filesClient.addFileInfoParser(function(response) {
|
fileList.filesClient.addFileInfoParser(function(response) {
|
||||||
var data = {};
|
var data = {};
|
||||||
var props = response.propStat[0].properties;
|
var props = response.propStat[0].properties;
|
||||||
var commentsUnread = props['{' + NS_OC + '}comments-unread'];
|
var commentsUnread = props[OC.Files.Client.PROPERTY_COMMENTS_UNREAD];
|
||||||
if (!_.isUndefined(commentsUnread) && commentsUnread !== '') {
|
if (!_.isUndefined(commentsUnread) && commentsUnread !== '') {
|
||||||
data.commentsUnread = parseInt(commentsUnread, 10);
|
data.commentsUnread = parseInt(commentsUnread, 10);
|
||||||
}
|
}
|
||||||
|
|
|
@ -328,6 +328,9 @@ class FilesPlugin extends ServerPlugin {
|
||||||
$propFind->handle(self::HAS_PREVIEW_PROPERTYNAME, function () use ($node) {
|
$propFind->handle(self::HAS_PREVIEW_PROPERTYNAME, function () use ($node) {
|
||||||
return json_encode($this->previewManager->isAvailable($node->getFileInfo()));
|
return json_encode($this->previewManager->isAvailable($node->getFileInfo()));
|
||||||
});
|
});
|
||||||
|
$propFind->handle(self::SIZE_PROPERTYNAME, function() use ($node) {
|
||||||
|
return $node->getSize();
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($node instanceof \OCA\DAV\Connector\Sabre\Node) {
|
if ($node instanceof \OCA\DAV\Connector\Sabre\Node) {
|
||||||
|
|
|
@ -188,8 +188,6 @@ class FilesPluginTest extends TestCase {
|
||||||
$node->expects($this->exactly(2))
|
$node->expects($this->exactly(2))
|
||||||
->method('getOwner')
|
->method('getOwner')
|
||||||
->will($this->returnValue($user));
|
->will($this->returnValue($user));
|
||||||
$node->expects($this->never())
|
|
||||||
->method('getSize');
|
|
||||||
|
|
||||||
$this->plugin->handleGetProperties(
|
$this->plugin->handleGetProperties(
|
||||||
$propFind,
|
$propFind,
|
||||||
|
|
|
@ -36,10 +36,18 @@
|
||||||
path: ''
|
path: ''
|
||||||
},
|
},
|
||||||
|
|
||||||
initialize: function(data) {
|
_filesClient: null,
|
||||||
|
|
||||||
|
initialize: function(data, options) {
|
||||||
if (!_.isUndefined(data.id)) {
|
if (!_.isUndefined(data.id)) {
|
||||||
data.id = parseInt(data.id, 10);
|
data.id = parseInt(data.id, 10);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if( options ){
|
||||||
|
if (options.filesClient) {
|
||||||
|
this._filesClient = options.filesClient;
|
||||||
|
}
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -73,6 +81,42 @@
|
||||||
*/
|
*/
|
||||||
getFullPath: function() {
|
getFullPath: function() {
|
||||||
return OC.joinPaths(this.get('path'), this.get('name'));
|
return OC.joinPaths(this.get('path'), this.get('name'));
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reloads missing properties from server and set them in the model.
|
||||||
|
* @param properties array of properties to be reloaded
|
||||||
|
* @return ajax call object
|
||||||
|
*/
|
||||||
|
reloadProperties: function(properties) {
|
||||||
|
if( !this._filesClient ){
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
var self = this;
|
||||||
|
var deferred = $.Deferred();
|
||||||
|
|
||||||
|
var targetPath = OC.joinPaths(this.get('path') + '/', this.get('name'));
|
||||||
|
|
||||||
|
this._filesClient.getFileInfo(targetPath, {
|
||||||
|
properties: properties
|
||||||
|
})
|
||||||
|
.then(function(status, data) {
|
||||||
|
// the following lines should be extracted to a mapper
|
||||||
|
|
||||||
|
if( properties.indexOf(OC.Files.Client.PROPERTY_GETCONTENTLENGTH) !== -1
|
||||||
|
|| properties.indexOf(OC.Files.Client.PROPERTY_SIZE) !== -1 ) {
|
||||||
|
self.set('size', data.size);
|
||||||
|
}
|
||||||
|
|
||||||
|
deferred.resolve(status, data);
|
||||||
|
})
|
||||||
|
.fail(function(status) {
|
||||||
|
OC.Notification.showTemporary(t('files', 'Could not load info for file "{file}"', {file: self.get('name')}));
|
||||||
|
deferred.reject(status);
|
||||||
|
});
|
||||||
|
|
||||||
|
return deferred.promise();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -82,4 +126,3 @@
|
||||||
OCA.Files.FileInfoModel = FileInfoModel;
|
OCA.Files.FileInfoModel = FileInfoModel;
|
||||||
|
|
||||||
})(OC, OCA);
|
})(OC, OCA);
|
||||||
|
|
||||||
|
|
|
@ -442,7 +442,9 @@
|
||||||
// In the future the FileList should work with Backbone.Collection
|
// In the future the FileList should work with Backbone.Collection
|
||||||
// and contain existing models that can be used.
|
// and contain existing models that can be used.
|
||||||
// This method would in the future simply retrieve the matching model from the collection.
|
// This method would in the future simply retrieve the matching model from the collection.
|
||||||
var model = new OCA.Files.FileInfoModel(this.elementToFile($tr));
|
var model = new OCA.Files.FileInfoModel(this.elementToFile($tr), {
|
||||||
|
filesClient: this.filesClient
|
||||||
|
});
|
||||||
if (!model.get('path')) {
|
if (!model.get('path')) {
|
||||||
model.set('path', this.getCurrentDirectory(), {silent: true});
|
model.set('path', this.getCurrentDirectory(), {silent: true});
|
||||||
}
|
}
|
||||||
|
@ -891,11 +893,14 @@
|
||||||
mimetype: $el.attr('data-mime'),
|
mimetype: $el.attr('data-mime'),
|
||||||
mtime: parseInt($el.attr('data-mtime'), 10),
|
mtime: parseInt($el.attr('data-mtime'), 10),
|
||||||
type: $el.attr('data-type'),
|
type: $el.attr('data-type'),
|
||||||
size: parseInt($el.attr('data-size'), 10),
|
|
||||||
etag: $el.attr('data-etag'),
|
etag: $el.attr('data-etag'),
|
||||||
permissions: parseInt($el.attr('data-permissions'), 10),
|
permissions: parseInt($el.attr('data-permissions'), 10),
|
||||||
hasPreview: $el.attr('data-has-preview') === 'true'
|
hasPreview: $el.attr('data-has-preview') === 'true'
|
||||||
};
|
};
|
||||||
|
var size = $el.attr('data-size');
|
||||||
|
if (size) {
|
||||||
|
data.size = parseInt(size, 10);
|
||||||
|
}
|
||||||
var icon = $el.attr('data-icon');
|
var icon = $el.attr('data-icon');
|
||||||
if (icon) {
|
if (icon) {
|
||||||
data.icon = icon;
|
data.icon = icon;
|
||||||
|
@ -2828,7 +2833,6 @@
|
||||||
});
|
});
|
||||||
uploader.on('fail', function(e, data) {
|
uploader.on('fail', function(e, data) {
|
||||||
self._uploader.log('filelist handle fileuploadfail', e, data);
|
self._uploader.log('filelist handle fileuploadfail', e, data);
|
||||||
|
|
||||||
self._uploads = [];
|
self._uploads = [];
|
||||||
|
|
||||||
//if user pressed cancel hide upload chrome
|
//if user pressed cancel hide upload chrome
|
||||||
|
|
|
@ -130,6 +130,19 @@
|
||||||
if (this.model) {
|
if (this.model) {
|
||||||
this.model.on('change', this._onModelChanged, this);
|
this.model.on('change', this._onModelChanged, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (this.model) {
|
||||||
|
var properties = [];
|
||||||
|
if( !this.model.has('size') ) {
|
||||||
|
properties.push(OC.Files.Client.PROPERTY_SIZE);
|
||||||
|
properties.push(OC.Files.Client.PROPERTY_GETCONTENTLENGTH);
|
||||||
|
}
|
||||||
|
|
||||||
|
if( properties.length > 0){
|
||||||
|
this.model.reloadProperties(properties);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
this.render();
|
this.render();
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
|
@ -12,6 +12,11 @@
|
||||||
|
|
||||||
(function(OCA) {
|
(function(OCA) {
|
||||||
|
|
||||||
|
_.extend(OC.Files.Client, {
|
||||||
|
PROPERTY_TAGS: '{' + OC.Files.Client.NS_OWNCLOUD + '}tags',
|
||||||
|
PROPERTY_FAVORITE: '{' + OC.Files.Client.NS_OWNCLOUD + '}favorite'
|
||||||
|
});
|
||||||
|
|
||||||
var TEMPLATE_FAVORITE_ACTION =
|
var TEMPLATE_FAVORITE_ACTION =
|
||||||
'<a href="#" ' +
|
'<a href="#" ' +
|
||||||
'class="action action-favorite {{#isFavorite}}permanent{{/isFavorite}}">' +
|
'class="action action-favorite {{#isFavorite}}permanent{{/isFavorite}}">' +
|
||||||
|
@ -162,24 +167,22 @@
|
||||||
return fileInfo;
|
return fileInfo;
|
||||||
};
|
};
|
||||||
|
|
||||||
var NS_OC = 'http://owncloud.org/ns';
|
|
||||||
|
|
||||||
var oldGetWebdavProperties = fileList._getWebdavProperties;
|
var oldGetWebdavProperties = fileList._getWebdavProperties;
|
||||||
fileList._getWebdavProperties = function() {
|
fileList._getWebdavProperties = function() {
|
||||||
var props = oldGetWebdavProperties.apply(this, arguments);
|
var props = oldGetWebdavProperties.apply(this, arguments);
|
||||||
props.push('{' + NS_OC + '}tags');
|
props.push(OC.Files.Client.PROPERTY_TAGS);
|
||||||
props.push('{' + NS_OC + '}favorite');
|
props.push(OC.Files.Client.PROPERTY_FAVORITE);
|
||||||
return props;
|
return props;
|
||||||
};
|
};
|
||||||
|
|
||||||
fileList.filesClient.addFileInfoParser(function(response) {
|
fileList.filesClient.addFileInfoParser(function(response) {
|
||||||
var data = {};
|
var data = {};
|
||||||
var props = response.propStat[0].properties;
|
var props = response.propStat[0].properties;
|
||||||
var tags = props['{' + NS_OC + '}tags'];
|
var tags = props[OC.Files.Client.PROPERTY_TAGS];
|
||||||
var favorite = props['{' + NS_OC + '}favorite'];
|
var favorite = props[OC.Files.Client.PROPERTY_FAVORITE];
|
||||||
if (tags && tags.length) {
|
if (tags && tags.length) {
|
||||||
tags = _.chain(tags).filter(function(xmlvalue) {
|
tags = _.chain(tags).filter(function(xmlvalue) {
|
||||||
return (xmlvalue.namespaceURI === NS_OC && xmlvalue.nodeName.split(':')[1] === 'tag');
|
return (xmlvalue.namespaceURI === OC.Files.Client.NS_OWNCLOUD && xmlvalue.nodeName.split(':')[1] === 'tag');
|
||||||
}).map(function(xmlvalue) {
|
}).map(function(xmlvalue) {
|
||||||
return xmlvalue.textContent || xmlvalue.text;
|
return xmlvalue.textContent || xmlvalue.text;
|
||||||
}).value();
|
}).value();
|
||||||
|
|
|
@ -9,6 +9,12 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
(function() {
|
(function() {
|
||||||
|
|
||||||
|
_.extend(OC.Files.Client, {
|
||||||
|
PROPERTY_SHARE_TYPES: '{' + OC.Files.Client.NS_OWNCLOUD + '}share-types',
|
||||||
|
PROPERTY_OWNER_DISPLAY_NAME: '{' + OC.Files.Client.NS_OWNCLOUD + '}owner-display-name'
|
||||||
|
});
|
||||||
|
|
||||||
if (!OCA.Sharing) {
|
if (!OCA.Sharing) {
|
||||||
OCA.Sharing = {};
|
OCA.Sharing = {};
|
||||||
}
|
}
|
||||||
|
@ -65,32 +71,38 @@
|
||||||
fileInfo.shareTypes = shareTypes;
|
fileInfo.shareTypes = shareTypes;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if( $el.attr('data-expiration')){
|
||||||
|
var expirationTimestamp = parseInt($el.attr('data-expiration'));
|
||||||
|
fileInfo.shares = [];
|
||||||
|
fileInfo.shares.push({expiration: expirationTimestamp});
|
||||||
|
}
|
||||||
|
|
||||||
|
fileInfo.recipientsDisplayName = $el.attr('data-share-recipients') || undefined;
|
||||||
|
|
||||||
return fileInfo;
|
return fileInfo;
|
||||||
};
|
};
|
||||||
|
|
||||||
var NS_OC = 'http://owncloud.org/ns';
|
|
||||||
|
|
||||||
var oldGetWebdavProperties = fileList._getWebdavProperties;
|
var oldGetWebdavProperties = fileList._getWebdavProperties;
|
||||||
fileList._getWebdavProperties = function() {
|
fileList._getWebdavProperties = function() {
|
||||||
var props = oldGetWebdavProperties.apply(this, arguments);
|
var props = oldGetWebdavProperties.apply(this, arguments);
|
||||||
props.push('{' + NS_OC + '}owner-display-name');
|
props.push(OC.Files.Client.PROPERTY_OWNER_DISPLAY_NAME);
|
||||||
props.push('{' + NS_OC + '}share-types');
|
props.push(OC.Files.Client.PROPERTY_SHARE_TYPES);
|
||||||
return props;
|
return props;
|
||||||
};
|
};
|
||||||
|
|
||||||
fileList.filesClient.addFileInfoParser(function(response) {
|
fileList.filesClient.addFileInfoParser(function(response) {
|
||||||
var data = {};
|
var data = {};
|
||||||
var props = response.propStat[0].properties;
|
var props = response.propStat[0].properties;
|
||||||
var permissionsProp = props['{' + NS_OC + '}permissions'];
|
var permissionsProp = props[OC.Files.Client.PROPERTY_PERMISSIONS];
|
||||||
|
|
||||||
if (permissionsProp && permissionsProp.indexOf('S') >= 0) {
|
if (permissionsProp && permissionsProp.indexOf('S') >= 0) {
|
||||||
data.shareOwner = props['{' + NS_OC + '}owner-display-name'];
|
data.shareOwner = props[OC.Files.Client.PROPERTY_OWNER_DISPLAY_NAME];
|
||||||
}
|
}
|
||||||
|
|
||||||
var shareTypesProp = props['{' + NS_OC + '}share-types'];
|
var shareTypesProp = props[OC.Files.Client.PROPERTY_SHARE_TYPES];
|
||||||
if (shareTypesProp) {
|
if (shareTypesProp) {
|
||||||
data.shareTypes = _.chain(shareTypesProp).filter(function(xmlvalue) {
|
data.shareTypes = _.chain(shareTypesProp).filter(function(xmlvalue) {
|
||||||
return (xmlvalue.namespaceURI === NS_OC && xmlvalue.nodeName.split(':')[1] === 'share-type');
|
return (xmlvalue.namespaceURI === OC.Files.Client.NS_OWNCLOUD && xmlvalue.nodeName.split(':')[1] === 'share-type');
|
||||||
}).map(function(xmlvalue) {
|
}).map(function(xmlvalue) {
|
||||||
return parseInt(xmlvalue.textContent || xmlvalue.text, 10);
|
return parseInt(xmlvalue.textContent || xmlvalue.text, 10);
|
||||||
}).value();
|
}).value();
|
||||||
|
|
|
@ -31,9 +31,9 @@
|
||||||
this._root = this._root.substr(0, this._root.length - 1);
|
this._root = this._root.substr(0, this._root.length - 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
var url = 'http://';
|
var url = Client.PROTOCOL_HTTP + '://';
|
||||||
if (options.useHTTPS) {
|
if (options.useHTTPS) {
|
||||||
url = 'https://';
|
url = Client.PROTOCOL_HTTPS + '://';
|
||||||
}
|
}
|
||||||
|
|
||||||
url += options.host + this._root;
|
url += options.host + this._root;
|
||||||
|
@ -64,6 +64,19 @@
|
||||||
Client.NS_OWNCLOUD = 'http://owncloud.org/ns';
|
Client.NS_OWNCLOUD = 'http://owncloud.org/ns';
|
||||||
Client.NS_NEXTCLOUD = 'http://nextcloud.org/ns';
|
Client.NS_NEXTCLOUD = 'http://nextcloud.org/ns';
|
||||||
Client.NS_DAV = 'DAV:';
|
Client.NS_DAV = 'DAV:';
|
||||||
|
|
||||||
|
Client.PROPERTY_GETLASTMODIFIED = '{' + Client.NS_DAV + '}getlastmodified';
|
||||||
|
Client.PROPERTY_GETETAG = '{' + Client.NS_DAV + '}getetag';
|
||||||
|
Client.PROPERTY_GETCONTENTTYPE = '{' + Client.NS_DAV + '}getcontenttype';
|
||||||
|
Client.PROPERTY_RESOURCETYPE = '{' + Client.NS_DAV + '}resourcetype';
|
||||||
|
Client.PROPERTY_INTERNAL_FILEID = '{' + Client.NS_OWNCLOUD + '}fileid';
|
||||||
|
Client.PROPERTY_PERMISSIONS = '{' + Client.NS_OWNCLOUD + '}permissions';
|
||||||
|
Client.PROPERTY_SIZE = '{' + Client.NS_OWNCLOUD + '}size';
|
||||||
|
Client.PROPERTY_GETCONTENTLENGTH = '{' + Client.NS_DAV + '}getcontentlength';
|
||||||
|
|
||||||
|
Client.PROTOCOL_HTTP = 'http';
|
||||||
|
Client.PROTOCOL_HTTPS = 'https';
|
||||||
|
|
||||||
Client._PROPFIND_PROPERTIES = [
|
Client._PROPFIND_PROPERTIES = [
|
||||||
/**
|
/**
|
||||||
* Modified time
|
* Modified time
|
||||||
|
@ -259,23 +272,23 @@
|
||||||
var props = response.propStat[0].properties;
|
var props = response.propStat[0].properties;
|
||||||
|
|
||||||
var data = {
|
var data = {
|
||||||
id: props['{' + Client.NS_OWNCLOUD + '}fileid'],
|
id: props[Client.PROPERTY_INTERNAL_FILEID],
|
||||||
path: OC.dirname(path) || '/',
|
path: OC.dirname(path) || '/',
|
||||||
name: OC.basename(path),
|
name: OC.basename(path),
|
||||||
mtime: (new Date(props['{' + Client.NS_DAV + '}getlastmodified'])).getTime()
|
mtime: (new Date(props[Client.PROPERTY_GETLASTMODIFIED])).getTime()
|
||||||
};
|
};
|
||||||
|
|
||||||
var etagProp = props['{' + Client.NS_DAV + '}getetag'];
|
var etagProp = props[Client.PROPERTY_GETETAG];
|
||||||
if (!_.isUndefined(etagProp)) {
|
if (!_.isUndefined(etagProp)) {
|
||||||
data.etag = this._parseEtag(etagProp);
|
data.etag = this._parseEtag(etagProp);
|
||||||
}
|
}
|
||||||
|
|
||||||
var sizeProp = props['{' + Client.NS_DAV + '}getcontentlength'];
|
var sizeProp = props[Client.PROPERTY_GETCONTENTLENGTH];
|
||||||
if (!_.isUndefined(sizeProp)) {
|
if (!_.isUndefined(sizeProp)) {
|
||||||
data.size = parseInt(sizeProp, 10);
|
data.size = parseInt(sizeProp, 10);
|
||||||
}
|
}
|
||||||
|
|
||||||
sizeProp = props['{' + Client.NS_OWNCLOUD + '}size'];
|
sizeProp = props[Client.PROPERTY_SIZE];
|
||||||
if (!_.isUndefined(sizeProp)) {
|
if (!_.isUndefined(sizeProp)) {
|
||||||
data.size = parseInt(sizeProp, 10);
|
data.size = parseInt(sizeProp, 10);
|
||||||
}
|
}
|
||||||
|
@ -294,12 +307,12 @@
|
||||||
data.isFavorite = false;
|
data.isFavorite = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
var contentType = props['{' + Client.NS_DAV + '}getcontenttype'];
|
var contentType = props[Client.PROPERTY_GETCONTENTTYPE];
|
||||||
if (!_.isUndefined(contentType)) {
|
if (!_.isUndefined(contentType)) {
|
||||||
data.mimetype = contentType;
|
data.mimetype = contentType;
|
||||||
}
|
}
|
||||||
|
|
||||||
var resType = props['{' + Client.NS_DAV + '}resourcetype'];
|
var resType = props[Client.PROPERTY_RESOURCETYPE];
|
||||||
var isFile = true;
|
var isFile = true;
|
||||||
if (!data.mimetype && resType) {
|
if (!data.mimetype && resType) {
|
||||||
var xmlvalue = resType[0];
|
var xmlvalue = resType[0];
|
||||||
|
@ -310,7 +323,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
data.permissions = OC.PERMISSION_READ;
|
data.permissions = OC.PERMISSION_READ;
|
||||||
var permissionProp = props['{' + Client.NS_OWNCLOUD + '}permissions'];
|
var permissionProp = props[Client.PROPERTY_PERMISSIONS];
|
||||||
if (!_.isUndefined(permissionProp)) {
|
if (!_.isUndefined(permissionProp)) {
|
||||||
var permString = permissionProp || '';
|
var permString = permissionProp || '';
|
||||||
data.mountType = null;
|
data.mountType = null;
|
||||||
|
@ -816,4 +829,3 @@
|
||||||
|
|
||||||
OC.Files.Client = Client;
|
OC.Files.Client = Client;
|
||||||
})(OC, OC.Files.FileInfo);
|
})(OC, OC.Files.FileInfo);
|
||||||
|
|
||||||
|
|
|
@ -9,7 +9,15 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
(function(OC) {
|
(function(OC) {
|
||||||
var NS_OWNCLOUD = 'http://owncloud.org/ns';
|
|
||||||
|
_.extend(OC.Files.Client, {
|
||||||
|
PROPERTY_FILEID: '{' + OC.Files.Client.NS_OWNCLOUD + '}id',
|
||||||
|
PROPERTY_CAN_ASSIGN:'{' + OC.Files.Client.NS_OWNCLOUD + '}can-assign',
|
||||||
|
PROPERTY_DISPLAYNAME: '{' + OC.Files.Client.NS_OWNCLOUD + '}display-name',
|
||||||
|
PROPERTY_USERVISIBLE: '{' + OC.Files.Client.NS_OWNCLOUD + '}user-visible',
|
||||||
|
PROPERTY_USERASSIGNABLE:'{' + OC.Files.Client.NS_OWNCLOUD + '}user-assignable',
|
||||||
|
});
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @class OCA.SystemTags.SystemTagsCollection
|
* @class OCA.SystemTags.SystemTagsCollection
|
||||||
* @classdesc
|
* @classdesc
|
||||||
|
@ -28,12 +36,12 @@
|
||||||
},
|
},
|
||||||
|
|
||||||
davProperties: {
|
davProperties: {
|
||||||
'id': '{' + NS_OWNCLOUD + '}id',
|
'id': OC.Files.Client.PROPERTY_FILEID,
|
||||||
'name': '{' + NS_OWNCLOUD + '}display-name',
|
'name': OC.Files.Client.PROPERTY_DISPLAYNAME,
|
||||||
'userVisible': '{' + NS_OWNCLOUD + '}user-visible',
|
'userVisible': OC.Files.Client.PROPERTY_USERVISIBLE,
|
||||||
'userAssignable': '{' + NS_OWNCLOUD + '}user-assignable',
|
'userAssignable': OC.Files.Client.PROPERTY_USERASSIGNABLE,
|
||||||
// read-only, effective permissions computed by the server,
|
// read-only, effective permissions computed by the server,
|
||||||
'canAssign': '{' + NS_OWNCLOUD + '}can-assign'
|
'canAssign': OC.Files.Client.PROPERTY_CAN_ASSIGN
|
||||||
},
|
},
|
||||||
|
|
||||||
parse: function(data) {
|
parse: function(data) {
|
||||||
|
@ -50,4 +58,3 @@
|
||||||
OC.SystemTags = OC.SystemTags || {};
|
OC.SystemTags = OC.SystemTags || {};
|
||||||
OC.SystemTags.SystemTagModel = SystemTagModel;
|
OC.SystemTags.SystemTagModel = SystemTagModel;
|
||||||
})(OC);
|
})(OC);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue