2015-08-12 20:38:14 -04:00
|
|
|
/*
|
|
|
|
|
* Copyright (c) 2015
|
|
|
|
|
*
|
|
|
|
|
* This file is licensed under the Affero General Public License version 3
|
|
|
|
|
* or later.
|
|
|
|
|
*
|
|
|
|
|
* See the COPYING-README file.
|
|
|
|
|
*
|
|
|
|
|
*/
|
|
|
|
|
|
2016-01-28 06:28:30 -05:00
|
|
|
/* global moment */
|
|
|
|
|
|
2015-08-12 20:38:14 -04:00
|
|
|
(function() {
|
|
|
|
|
if (!OC.Share) {
|
|
|
|
|
OC.Share = {};
|
|
|
|
|
OC.Share.Types = {};
|
|
|
|
|
}
|
|
|
|
|
|
2015-09-15 04:27:33 -04:00
|
|
|
// FIXME: the config model should populate its own model attributes based on
|
|
|
|
|
// the old DOM-based config
|
2015-08-12 20:38:14 -04:00
|
|
|
var ShareConfigModel = OC.Backbone.Model.extend({
|
|
|
|
|
defaults: {
|
2015-09-03 09:53:17 -04:00
|
|
|
publicUploadEnabled: false,
|
2015-09-04 09:31:45 -04:00
|
|
|
enforcePasswordForPublicLink: oc_appconfig.core.enforcePasswordForPublicLink,
|
|
|
|
|
isDefaultExpireDateEnforced: oc_appconfig.core.defaultExpireDateEnforced === true,
|
2015-09-12 08:21:14 -04:00
|
|
|
isDefaultExpireDateEnabled: oc_appconfig.core.defaultExpireDateEnabled === true,
|
|
|
|
|
isRemoteShareAllowed: oc_appconfig.core.remoteShareAllowed,
|
2015-09-04 09:31:45 -04:00
|
|
|
defaultExpireDate: oc_appconfig.core.defaultExpireDate,
|
2015-09-04 20:02:55 -04:00
|
|
|
isResharingAllowed: oc_appconfig.core.resharingAllowed
|
2015-08-12 20:38:14 -04:00
|
|
|
},
|
|
|
|
|
|
2015-08-18 06:13:08 -04:00
|
|
|
/**
|
|
|
|
|
* @returns {boolean}
|
|
|
|
|
*/
|
|
|
|
|
areAvatarsEnabled: function() {
|
|
|
|
|
return oc_config.enable_avatars === true;
|
|
|
|
|
},
|
|
|
|
|
|
2015-08-12 20:38:14 -04:00
|
|
|
/**
|
|
|
|
|
* @returns {boolean}
|
|
|
|
|
*/
|
|
|
|
|
isPublicUploadEnabled: function() {
|
|
|
|
|
var publicUploadEnabled = $('#filestable').data('allow-public-upload');
|
2015-09-13 18:43:11 -04:00
|
|
|
return publicUploadEnabled === 'yes';
|
2015-08-12 20:38:14 -04:00
|
|
|
},
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @returns {boolean}
|
|
|
|
|
*/
|
|
|
|
|
isMailPublicNotificationEnabled: function() {
|
|
|
|
|
return $('input:hidden[name=mailPublicNotificationEnabled]').val() === 'yes';
|
|
|
|
|
},
|
|
|
|
|
|
2016-01-08 08:15:06 -05:00
|
|
|
/**
|
|
|
|
|
* @returns {boolean}
|
|
|
|
|
*/
|
|
|
|
|
isMailNotificationEnabled: function() {
|
|
|
|
|
return $('input:hidden[name=mailNotificationEnabled]').val() === 'yes';
|
|
|
|
|
},
|
|
|
|
|
|
2015-08-18 06:13:08 -04:00
|
|
|
/**
|
|
|
|
|
* @returns {boolean}
|
|
|
|
|
*/
|
|
|
|
|
isShareWithLinkAllowed: function() {
|
|
|
|
|
return $('#allowShareWithLink').val() === 'yes';
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @returns {string}
|
|
|
|
|
*/
|
|
|
|
|
getFederatedShareDocLink: function() {
|
|
|
|
|
return oc_appconfig.core.federatedCloudShareDoc;
|
2015-09-12 08:21:14 -04:00
|
|
|
},
|
|
|
|
|
|
|
|
|
|
getDefaultExpirationDateString: function () {
|
|
|
|
|
var expireDateString = '';
|
|
|
|
|
if (this.get('isDefaultExpireDateEnabled')) {
|
2016-01-28 06:28:30 -05:00
|
|
|
var date = moment.utc();
|
|
|
|
|
var expireAfterDays = this.get('defaultExpireDate');
|
|
|
|
|
date.add(expireAfterDays, 'days');
|
|
|
|
|
expireDateString = date.format('YYYY-MM-DD 00:00:00');
|
2015-09-12 08:21:14 -04:00
|
|
|
}
|
|
|
|
|
return expireDateString;
|
2015-08-12 20:38:14 -04:00
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
OC.Share.ShareConfigModel = ShareConfigModel;
|
|
|
|
|
})();
|