From edd163a6113664921a2fda730037dcf68bfe08ae Mon Sep 17 00:00:00 2001 From: Arthur Schiwon Date: Fri, 31 Jul 2015 00:07:41 +0200 Subject: refactor share dialog for multi-purpose use (dropdown, sidebar) and better maintainability --- core/js/share.js | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) (limited to 'core/js/share.js') diff --git a/core/js/share.js b/core/js/share.js index cd4a614e9d1..5d3253e6d5c 100644 --- a/core/js/share.js +++ b/core/js/share.js @@ -3,7 +3,7 @@ /** * @namespace */ -OC.Share={ +OC.Share = _.extend(OC.Share, { SHARE_TYPE_USER:0, SHARE_TYPE_GROUP:1, SHARE_TYPE_LINK:3, @@ -289,6 +289,12 @@ OC.Share={ } img.attr('src', image); }, + /** + * + * @param itemType + * @param itemSource + * @returns {OC.Share.Types.ShareInfo} + */ loadItem:function(itemType, itemSource) { var data = ''; var checkReshare = true; @@ -371,6 +377,21 @@ OC.Share={ }); }, showDropDown:function(itemType, itemSource, appendTo, link, possiblePermissions, filename) { + var itemModel = new OC.Share.ShareItemModel(itemType, itemSource); + var dialogView = new OC.Share.ShareDialogView('dropdown'); + dialogView.setContainerClasses('drop shareDropDown'); + dialogView.setShowLink(link); + dialogView.setPossiblePermissions(possiblePermissions); + dialogView.setItemModel(itemModel); + var $dialog = dialogView.render(); + $dialog.appendTo(appendTo); + $dialog.attr('data-item-source-name', filename); + $dialog.slideDown(OC.menuSpeed, function() { + OC.Share.droppedDown = true; + }); + return; + + var data = OC.Share.loadItem(itemType, itemSource); var dropDownEl; var html = '' + ' ' + + ' {{#if publicUpload}}' + + ' ' + + ' {{/if}}' + + ' {{#if mailPublicNotificationEnabled}}' + + ' ' + + ' {{/if}}' + + '' ; + var TEMPLATE_NO_SHARING = + '' + ; + + var TEMPLATE_EXPIRATION = + '
' + + ' ' + + ' ' + + ' ' + + ' ' + + ' {{defaultExpireMessage}}' + + '
' + ; + /** * @class OCA.Share.ShareDialogView * @member {OC.Share.ShareItemModel} model @@ -73,7 +107,10 @@ /** @type {string} **/ tagName: 'div', - initialize: function() { + /** @type {OC.Share.ShareConfigModel} **/ + configModel: undefined, + + initialize: function(options) { var view = this; this.model.on('change', function() { view.render(); @@ -82,6 +119,12 @@ this.model.on('fetchError', function() { OC.Notification.showTemporary(t('core', 'Share details could not be loaded for this item.')); }); + + if(!_.isUndefined(options.configModel)) { + this.configModel = options.configModel; + } else { + console.warn('missing OC.Share.ShareConfigModel'); + } }, render: function() { @@ -92,7 +135,10 @@ resharerInfo: this._renderResharerInfo(), sharePlaceholder: this._renderSharePlaceholderPart(), remoteShareInfo: this._renderRemoteShareInfoPart(), - linkShare: this._renderLinkSharePart() + linkShare: this._renderLinkSharePart(), + shareAllowed: this.model.hasSharePermission(), + noSharing: this._renderNoSharing(), + expiration: this._renderExpirationPart() })); return this; @@ -155,14 +201,34 @@ _renderLinkSharePart: function() { var linkShare = ''; - if(this._showLink && $('#allowShareWithLink').val() === 'yes') { + if( this.model.hasSharePermission() + && this._showLink + && $('#allowShareWithLink').val() === 'yes') + { var linkShareTemplate = this._getLinkShareTemplate(); + + var publicUpload = + this.model.isFolder() + && this.model.hasCreatePermission() + && this.configModel.isPublicUploadEnabled(); + + var publicUploadChecked = ''; + if(this.model.isPublicUploadAllowed) { + publicUploadChecked = 'checked="checked"'; + } + linkShare = linkShareTemplate({ linkShareLabel: t('core', 'Share link'), urlLabel: t('core', 'Link'), enablePasswordLabel: t('core', 'Password protect'), passwordLabel: t('core', 'Password'), - passwordPlaceholder: t('core', 'Choose a password for the public link') + passwordPlaceholder: t('core', 'Choose a password for the public link'), + publicUpload: publicUpload, + publicUploadChecked: publicUploadChecked, + publicUploadLabel: t('core', 'Allow editing'), + mailPublicNotificationEnabled: this.configModel.isMailPublicNotificationEnabled(), + mailPrivatePlaceholder: t('core', 'Email link to person'), + mailButtonText: t('core', 'Send') }); } return linkShare; @@ -176,6 +242,40 @@ return sharePlaceholder; }, + _renderNoSharing: function () { + var noSharing = ''; + if(!this.model.hasSharePermission()) { + var noSharingTemplate = this._getTemplate('noSharing', TEMPLATE_NO_SHARING); + noSharing = noSharingTemplate({ + placeholder: t('core', 'Resharing is not allowed') + }); + } + return noSharing; + }, + + _renderExpirationPart: function() { + var expirationTemplate = this._getTemplate('expiration', TEMPLATE_EXPIRATION); + + var defaultExpireMessage = ''; + if(( this.model.isFolder() || this.model.isFile()) + && this.configModel.isDefaultExpireDateEnforced()) { + defaultExpireMessage = t( + 'core', + 'The public link will expire no later than {days} days after it is created', + {'days': this.configModel.getDefaultExpireDate()} + ); + } + + var expiration = expirationTemplate({ + setExpirationLabel: t('core', 'Set expiration date'), + expirationLabel: t('core', 'Expiration'), + expirationDatePlaceholder: t('core', 'Expiration date'), + defaultExpireMessage: defaultExpireMessage + }); + + return expiration; + }, + /** * * @param {string} key - an identifier for the template diff --git a/core/js/shareitemmodel.js b/core/js/shareitemmodel.js index efce69f0f3e..eb93b91ce92 100644 --- a/core/js/shareitemmodel.js +++ b/core/js/shareitemmodel.js @@ -53,7 +53,10 @@ * // FIXME: use OC Share API once #17143 is done */ var ShareItemModel = OC.Backbone.Model.extend({ - initialize: function() { + initialize: function(attributes, options) { + if(!_.isUndefined(options.configModel)) { + this.configModel = options.configModel; + } this.fetch(); }, @@ -62,15 +65,24 @@ }, /** - * @returns {boolean|jQuery} + * @returns {boolean} */ - isPublicUploadEnabled: function() { - // FIXME: this really needs a better place - var publicUploadEnabled = $('#filestable').data('allow-public-upload'); - if (_.isUndefined(publicUploadEnabled)) { - publicUploadEnabled = 'no'; - } - return publicUploadEnabled; + isPublicUploadAllowed: function() { + return this.get('allowPublicUploadStatus'); + }, + + /** + * @returns {boolean} + */ + isFolder: function() { + return this.get('itemType') === 'folder'; + }, + + /** + * @returns {boolean} + */ + isFile: function() { + return this.get('itemType') === 'file'; }, /** @@ -134,7 +146,14 @@ * @returns {boolean} */ hasSharePermission: function() { - return (this.getPermissions & OC.PERMISSION_SHARE) === OC.PERMISSION_SHARE; + return (this.getPermissions() & OC.PERMISSION_SHARE) === OC.PERMISSION_SHARE; + }, + + /** + * @returns {boolean} + */ + hasCreatePermission: function() { + return (this.getPermissions() & OC.PERMISSION_CREATE) === OC.PERMISSION_CREATE; }, fetch: function() { diff --git a/lib/private/share/share.php b/lib/private/share/share.php index 65968f581f5..cd3f0cbfb34 100644 --- a/lib/private/share/share.php +++ b/lib/private/share/share.php @@ -83,6 +83,7 @@ class Share extends Constants { 'supportedFileExtensions' => $supportedFileExtensions ); if(count(self::$backendTypes) === 1) { + \OC_Util::addScript('core', 'shareconfigmodel'); \OC_Util::addScript('core', 'shareitemmodel'); \OC_Util::addScript('core', 'sharedialogview'); \OC_Util::addScript('core', 'share'); -- cgit v1.2.3 From e3fd96fa8ef2aa5b5fd3881e75b95c7a869895fa Mon Sep 17 00:00:00 2001 From: Arthur Schiwon Date: Tue, 18 Aug 2015 13:04:02 +0200 Subject: improve doc --- core/js/share.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'core/js/share.js') diff --git a/core/js/share.js b/core/js/share.js index 8d25749a107..84da511497e 100644 --- a/core/js/share.js +++ b/core/js/share.js @@ -293,7 +293,9 @@ OC.Share = _.extend(OC.Share, { * * @param itemType * @param itemSource - * @param callback + * @param callback - optional. If a callback is given this method works + * asynchronous and the callback will be provided with data when the request + * is done. * @returns {OC.Share.Types.ShareInfo} */ loadItem:function(itemType, itemSource, callback) { -- cgit v1.2.3 From f2fb20ed1cfc88c5e37c2ecc84ec4ec77d98f371 Mon Sep 17 00:00:00 2001 From: Arthur Schiwon Date: Mon, 24 Aug 2015 23:27:43 +0200 Subject: no auto-fetch in model --- core/js/share.js | 1 + core/js/shareitemmodel.js | 1 - 2 files changed, 1 insertion(+), 1 deletion(-) (limited to 'core/js/share.js') diff --git a/core/js/share.js b/core/js/share.js index 84da511497e..1fc1ac9e20c 100644 --- a/core/js/share.js +++ b/core/js/share.js @@ -404,6 +404,7 @@ OC.Share = _.extend(OC.Share, { $dialog.slideDown(OC.menuSpeed, function() { OC.Share.droppedDown = true; }); + itemModel.fetch(); return; diff --git a/core/js/shareitemmodel.js b/core/js/shareitemmodel.js index 9c4a8141cda..0d823f05749 100644 --- a/core/js/shareitemmodel.js +++ b/core/js/shareitemmodel.js @@ -57,7 +57,6 @@ if(!_.isUndefined(options.configModel)) { this.configModel = options.configModel; } - this.fetch(); }, defaults: { -- cgit v1.2.3 From 60abfcdab16ed674015422a6300bd28f3baa5e91 Mon Sep 17 00:00:00 2001 From: Arthur Schiwon Date: Wed, 2 Sep 2015 16:47:25 +0200 Subject: old OC.Share.addShareWith now reimplemented --- core/js/share.js | 106 ----------------------------------- core/js/sharedialogshareelistview.js | 28 +-------- core/js/shareitemmodel.js | 26 ++++++++- 3 files changed, 27 insertions(+), 133 deletions(-) (limited to 'core/js/share.js') diff --git a/core/js/share.js b/core/js/share.js index 1fc1ac9e20c..bd87ab10d40 100644 --- a/core/js/share.js +++ b/core/js/share.js @@ -685,112 +685,6 @@ OC.Share = _.extend(OC.Share, { } }); }, - addShareWith:function(shareType, shareWith, shareWithDisplayName, permissions, possiblePermissions, mailSend, collection) { - var shareItem = { - share_type: shareType, - share_with: shareWith, - share_with_displayname: shareWithDisplayName, - permissions: permissions - }; - if (shareType === OC.Share.SHARE_TYPE_GROUP) { - shareWithDisplayName = shareWithDisplayName + " (" + t('core', 'group') + ')'; - } - if (shareType === OC.Share.SHARE_TYPE_REMOTE) { - shareWithDisplayName = shareWithDisplayName + " (" + t('core', 'remote') + ')'; - } - if (!OC.Share.itemShares[shareType]) { - OC.Share.itemShares[shareType] = []; - } - OC.Share.itemShares[shareType].push(shareWith); - if (collection) { - if (collection.item_type == 'file' || collection.item_type == 'folder') { - var item = collection.path; - } else { - var item = collection.item_source; - } - var collectionList = $('#shareWithList li').filterAttr('data-collection', item); - if (collectionList.length > 0) { - $(collectionList).append(', '+shareWithDisplayName); - } else { - var html = '
  • '+t('core', 'Shared in {item} with {user}', {'item': item, user: shareWithDisplayName})+'
  • '; - $('#shareWithList').prepend(html); - } - } else { - var editChecked = createChecked = updateChecked = deleteChecked = shareChecked = ''; - if (permissions & OC.PERMISSION_CREATE) { - createChecked = 'checked="checked"'; - editChecked = 'checked="checked"'; - } - if (permissions & OC.PERMISSION_UPDATE) { - updateChecked = 'checked="checked"'; - editChecked = 'checked="checked"'; - } - if (permissions & OC.PERMISSION_DELETE) { - deleteChecked = 'checked="checked"'; - editChecked = 'checked="checked"'; - } - if (permissions & OC.PERMISSION_SHARE) { - shareChecked = 'checked="checked"'; - } - var html = '
  • '; - var showCrudsButton; - html += ''+t('core', 'Unshare')+''; - if (oc_config.enable_avatars === true) { - html += '
    '; - } - html += '' + escapeHTML(shareWithDisplayName) + ''; - var mailNotificationEnabled = $('input:hidden[name=mailNotificationEnabled]').val(); - if (mailNotificationEnabled === 'yes' && shareType !== OC.Share.SHARE_TYPE_REMOTE) { - var checked = ''; - if (mailSend === '1') { - checked = 'checked'; - } - html += ' '; - } - if (oc_appconfig.core.resharingAllowed && (possiblePermissions & OC.PERMISSION_SHARE)) { - html += ''; - } - if (possiblePermissions & OC.PERMISSION_CREATE || possiblePermissions & OC.PERMISSION_UPDATE || possiblePermissions & OC.PERMISSION_DELETE) { - html += ''; - } - if (shareType !== OC.Share.SHARE_TYPE_REMOTE) { - showCrudsButton = ''+t('core', 'access control')+''; - } - html += ''; - html += '
  • '; - html = $(html).appendTo('#shareWithList'); - if (oc_config.enable_avatars === true) { - if (shareType === OC.Share.SHARE_TYPE_USER) { - html.find('.avatar').avatar(escapeHTML(shareWith), 32); - } else { - //Add sharetype to generate different seed if there is a group and use with the same name - html.find('.avatar').imageplaceholder(escapeHTML(shareWith) + ' ' + shareType); - } - } - // insert cruds button into last label element - var lastLabel = html.find('>label:last'); - if (lastLabel.exists()){ - lastLabel.append(showCrudsButton); - } - else{ - html.find('.cruds').before(showCrudsButton); - } - if (!OC.Share.currentShares[shareType]) { - OC.Share.currentShares[shareType] = []; - } - OC.Share.currentShares[shareType].push(shareItem); - } - }, showLink:function(token, password, itemSource) { OC.Share.itemShares[OC.Share.SHARE_TYPE_LINK] = true; $('#linkCheckbox').attr('checked', true); diff --git a/core/js/sharedialogshareelistview.js b/core/js/sharedialogshareelistview.js index 8e08e2b4f76..f9d725bf51e 100644 --- a/core/js/sharedialogshareelistview.js +++ b/core/js/sharedialogshareelistview.js @@ -111,18 +111,6 @@ } }, - getCollectionObject: function(shareIndex) { - var type = this.model.getCollectionType(shareIndex); - var id = this.model.getCollectionPath(shareIndex); - if(type !== 'file' && type !== 'folder') { - id = this.model.getCollectionSource(shareIndex); - } - return { - collectionID: id, - text: t('core', 'Shared in {item} with {user}', {'item': id, user: this.model.getShareWithDisplayName(shareIndex)}) - } - }, - /** * * @param {OC.Share.Types.ShareInfo} shareInfo @@ -149,7 +137,8 @@ shareWith: shareWith, shareWithDisplayName: shareWithDisplayName, shareType: shareType, - modSeed: shareType !== OC.Share.SHARE_TYPE_USER + modSeed: shareType !== OC.Share.SHARE_TYPE_USER, + isRemoteShare: shareType === OC.Share.SHARE_TYPE_REMOTE }; }, @@ -181,9 +170,6 @@ this._collections = {}; - // TODO: sharess must have following attributes - // isRemoteShare - if(!this.model.hasShares()) { return []; } @@ -191,16 +177,6 @@ var shares = this.model.get('shares'); var list = []; for(var index = 0; index < shares.length; index++) { - - // #### FIXME: LEGACY #### - // this does not belong to a view - var shareType = this.model.getShareType(index); - if (!OC.Share.currentShares[shareType]) { - OC.Share.currentShares[shareType] = []; - } - OC.Share.currentShares[shareType].push(this.model.getShareWith(index)); - // #### /FIXME: LEGACY #### - if(this.model.isCollection(index)) { this.processCollectionShare(index); } else { diff --git a/core/js/shareitemmodel.js b/core/js/shareitemmodel.js index d4fbc3543a7..8afc4954902 100644 --- a/core/js/shareitemmodel.js +++ b/core/js/shareitemmodel.js @@ -350,6 +350,27 @@ }); }, + legacyFillCurrentShares: function(shares) { + OC.Share.currentShares = {}; + OC.Share.itemShares = []; + _.each(shares, + /** + * @param {OC.Share.Types.ShareInfo} share + */ + function(share) { + if (!OC.Share.currentShares[share.share_type]) { + OC.Share.currentShares[share.share_type] = []; + } + OC.Share.currentShares[share.share_type].push(share); + + if (!OC.Share.itemShares[share.share_type]) { + OC.Share.itemShares[share.share_type] = []; + } + OC.Share.itemShares[share.share_type].push(share.share_with); + } + ); + }, + parse: function(data) { if(data === false) { console.warn('no data was returned'); @@ -372,9 +393,12 @@ }); } + var shares = _.toArray(data.shares); + this.legacyFillCurrentShares(shares); + return { reshare: data.reshare, - shares: _.toArray(data.shares), + shares: shares, permissions: permissions, allowPublicUploadStatus: allowPublicUploadStatus }; -- cgit v1.2.3 From f29b51682bc0be785e1a3e4e5901db3255e4a377 Mon Sep 17 00:00:00 2001 From: Arthur Schiwon Date: Sat, 12 Sep 2015 14:21:14 +0200 Subject: share and unshare via link (not yet password). also some internal changes to reduce unnecessary rendering --- core/js/share.js | 74 ---------------------------------- core/js/shareconfigmodel.js | 23 +++++++---- core/js/sharedialogexpirationview.js | 22 ++++++++-- core/js/sharedialoglinkshareview.js | 37 +++++++++++++++-- core/js/sharedialogresharerinfoview.js | 7 ++++ core/js/sharedialogshareelistview.js | 11 +++++ core/js/sharedialogview.js | 22 +++------- core/js/shareitemmodel.js | 33 ++++++++++++--- 8 files changed, 121 insertions(+), 108 deletions(-) (limited to 'core/js/share.js') diff --git a/core/js/share.js b/core/js/share.js index bd87ab10d40..6581c401281 100644 --- a/core/js/share.js +++ b/core/js/share.js @@ -956,80 +956,6 @@ $(document).ready(function() { permissions); }); - $(document).on('change', '#dropdown #linkCheckbox', function() { - var $dropDown = $('#dropdown'); - var itemType = $dropDown.data('item-type'); - var itemSource = $dropDown.data('item-source'); - var itemSourceName = $dropDown.data('item-source-name'); - var $loading = $dropDown.find('#link .icon-loading-small'); - var $button = $(this); - - if (!$loading.hasClass('hidden')) { - // already in progress - return false; - } - - if (this.checked) { - // Reset password placeholder - $('#linkPassText').attr('placeholder', t('core', 'Choose a password for the public link')); - // Reset link - $('#linkText').val(''); - $('#showPassword').prop('checked', false); - $('#linkPass').hide(); - $('#sharingDialogAllowPublicUpload').prop('checked', false); - $('#expirationCheckbox').prop('checked', false); - $('#expirationDate').hide(); - var expireDateString = ''; - // Create a link - if (oc_appconfig.core.enforcePasswordForPublicLink === false) { - expireDateString = OC.Share.getDefaultExpirationDate(); - $loading.removeClass('hidden'); - $button.addClass('hidden'); - $button.prop('disabled', true); - - OC.Share.share(itemType, itemSource, OC.Share.SHARE_TYPE_LINK, '', OC.PERMISSION_READ, itemSourceName, expireDateString, function(data) { - $loading.addClass('hidden'); - $button.removeClass('hidden'); - $button.prop('disabled', false); - OC.Share.showLink(data.token, null, itemSource); - $('#dropdown').trigger(new $.Event('sharesChanged', {shares: OC.Share.currentShares})); - OC.Share.updateIcon(itemType, itemSource); - }); - } else { - $('#linkPass').slideToggle(OC.menuSpeed); - // TODO drop with IE8 drop - if($('html').hasClass('ie8')) { - $('#linkPassText').attr('placeholder', null); - $('#linkPassText').val(''); - } - $('#linkPassText').focus(); - } - if (expireDateString !== '') { - OC.Share.showExpirationDate(expireDateString); - } - } else { - // Delete private link - OC.Share.hideLink(); - $('#expiration').slideUp(OC.menuSpeed); - if ($('#linkText').val() !== '') { - $loading.removeClass('hidden'); - $button.addClass('hidden'); - $button.prop('disabled', true); - OC.Share.unshare(itemType, itemSource, OC.Share.SHARE_TYPE_LINK, '', function() { - $loading.addClass('hidden'); - $button.removeClass('hidden'); - $button.prop('disabled', false); - OC.Share.itemShares[OC.Share.SHARE_TYPE_LINK] = false; - $('#dropdown').trigger(new $.Event('sharesChanged', {shares: OC.Share.currentShares})); - OC.Share.updateIcon(itemType, itemSource); - if (typeof OC.Share.statuses[itemSource] === 'undefined') { - $('#expiration').slideUp(OC.menuSpeed); - } - }); - } - } - }); - $(document).on('click', '#dropdown #linkText', function() { $(this).focus(); $(this).select(); diff --git a/core/js/shareconfigmodel.js b/core/js/shareconfigmodel.js index 98280e01eb6..c6891154c98 100644 --- a/core/js/shareconfigmodel.js +++ b/core/js/shareconfigmodel.js @@ -19,6 +19,8 @@ publicUploadEnabled: false, enforcePasswordForPublicLink: oc_appconfig.core.enforcePasswordForPublicLink, isDefaultExpireDateEnforced: oc_appconfig.core.defaultExpireDateEnforced === true, + isDefaultExpireDateEnabled: oc_appconfig.core.defaultExpireDateEnabled === true, + isRemoteShareAllowed: oc_appconfig.core.remoteShareAllowed, defaultExpireDate: oc_appconfig.core.defaultExpireDate, isResharingAllowed: oc_appconfig.core.resharingAllowed }, @@ -45,13 +47,6 @@ return $('input:hidden[name=mailPublicNotificationEnabled]').val() === 'yes'; }, - /** - * @returns {boolean} - */ - isRemoteShareAllowed: function() { - return oc_appconfig.core.remoteShareAllowed; - }, - /** * @returns {boolean} */ @@ -64,6 +59,20 @@ */ getFederatedShareDocLink: function() { return oc_appconfig.core.federatedCloudShareDoc; + }, + + getDefaultExpirationDateString: function () { + var expireDateString = ''; + if (this.get('isDefaultExpireDateEnabled')) { + var date = new Date().getTime(); + var expireAfterMs = this.get('defaultExpireDate') * 24 * 60 * 60 * 1000; + var expireDate = new Date(date + expireAfterMs); + var month = expireDate.getMonth() + 1; + var year = expireDate.getFullYear(); + var day = expireDate.getDate(); + expireDateString = year + "-" + month + '-' + day + ' 00:00:00'; + } + return expireDateString; } }); diff --git a/core/js/sharedialogexpirationview.js b/core/js/sharedialogexpirationview.js index 56473cdb1fa..f244fe56548 100644 --- a/core/js/sharedialogexpirationview.js +++ b/core/js/sharedialogexpirationview.js @@ -24,7 +24,7 @@ '' + ' {{#if isExpirationSet}}' + '' + - '' + + '' + ' {{/if}}' + ' {{#if isExpirationEnforced}}' + // originally the expire message was shown when a default date was set, however it never had text @@ -64,13 +64,28 @@ } else { throw 'missing OC.Share.ShareConfigModel'; } + + var view = this; + this.configModel.on('change:isDefaultExpireDateEnforced', function() { + view.render(); + }); + + this.model.on('change:itemType', function() { + view.render(); + }); + + this.model.on('change:linkShare', function() { + view.render(); + }); }, render: function() { var defaultExpireMessage = ''; var defaultExpireDays = this.configModel.get('defaultExpireDate'); + var isExpirationEnforced = this.configModel.get('isDefaultExpireDateEnforced'); + if( (this.model.isFolder() || this.model.isFile()) - && this.configModel.get('isDefaultExpireDateEnforced')) { + && isExpirationEnforced) { defaultExpireMessage = t( 'core', 'The public link will expire no later than {days} days after it is created', @@ -79,7 +94,6 @@ } var isExpirationSet = !!this.model.get('linkShare').expiration; - var isExpirationEnforced = this.configModel.get('isDefaultExpireDateEnforced'); var expirationTemplate = this.template(); this.$el.html(expirationTemplate({ @@ -120,6 +134,8 @@ }); } + this.$el.find('.datepicker').datepicker({dateFormat : 'dd-mm-yy'}); + return this; }, diff --git a/core/js/sharedialoglinkshareview.js b/core/js/sharedialoglinkshareview.js index 373d6d180bc..b94f1c3e70b 100644 --- a/core/js/sharedialoglinkshareview.js +++ b/core/js/sharedialoglinkshareview.js @@ -23,13 +23,11 @@ ' {{#if showPasswordCheckBox}}' + '' + ' {{/if}}' + - ' {{#if isPasswordSet}}' + - '
    ' + + '
    ' + ' ' + ' ' + ' ' + '
    ' + - ' {{/if}}' + ' {{#if publicUpload}}' + '