diff --git a/controller/viewcontroller.php b/controller/viewcontroller.php index 39af972bf2..65fd7f2430 100644 --- a/controller/viewcontroller.php +++ b/controller/viewcontroller.php @@ -189,6 +189,7 @@ private function getTemplateParams() { $appVersion = $this->config->getAppValue($this->appName, 'installed_version'); $isIE = $this->request->isUserAgent([Request::USER_AGENT_IE]); $defaultColor = $this->config->getAppValue('theming', 'color', '#0082C9'); + $canSharePublicLink = $this->config->getAppValue('core', 'shareapi_allow_links', 'yes'); return [ 'appVersion' => $appVersion, @@ -196,6 +197,7 @@ private function getTemplateParams() { 'defaultColor' => $defaultColor, 'shareeCanEditShares' => $shareeCanEditShares ? 'yes' : 'no', 'shareeCanEditCalendarProperties' => $shareeCanEditCalendarProperties ? 'yes' : 'no', + 'canSharePublicLink' => $canSharePublicLink, ]; } diff --git a/js/app/controllers/calendarlistcontroller.js b/js/app/controllers/calendarlistcontroller.js index 887cf527f8..d38e2e5387 100644 --- a/js/app/controllers/calendarlistcontroller.js +++ b/js/app/controllers/calendarlistcontroller.js @@ -42,6 +42,7 @@ app.controller('CalendarListController', ['$scope', '$rootScope', '$window', 'Ha $scope.publicdavdesc = t('calendar', 'CalDAV address for clients'); $scope.isSharingAPI = isSharingAPI; + $scope.canSharePublicLink = constants.canSharePublicLink; $scope.$watchCollection('calendars', function(newCalendars, oldCalendars) { newCalendars = newCalendars || []; diff --git a/js/config/config.js b/js/config/config.js index a564c69ff4..6ef1f06306 100644 --- a/js/config/config.js +++ b/js/config/config.js @@ -71,6 +71,7 @@ app.config(['$provide', '$httpProvider', const publicSharingToken = angular.element('#fullcalendar').attr('data-publicSharingToken'); const shareeCanEditShares = angular.element('#fullcalendar').attr('data-shareeCanEditShares') === 'yes'; const shareeCanEditCalendarProperties = angular.element('#fullcalendar').attr('data-shareeCanEditCalendarProperties') === 'yes'; + const canSharePublicLink = angular.element('#fullcalendar').attr('data-canSharePublicLink') === 'yes'; $provide.constant('constants', { initialView, emailAddress, @@ -79,6 +80,7 @@ app.config(['$provide', '$httpProvider', publicSharingToken, shareeCanEditShares, shareeCanEditCalendarProperties, + canSharePublicLink, SHARE_TYPE_USER: 0, SHARE_TYPE_GROUP: 1 }); diff --git a/templates/part.calendarlist.item.php b/templates/part.calendarlist.item.php index f629ede56b..acaecc830c 100644 --- a/templates/part.calendarlist.item.php +++ b/templates/part.calendarlist.item.php @@ -213,7 +213,7 @@ class="checkbox" -
+
diff --git a/tests/php/controller/viewcontrollerTest.php b/tests/php/controller/viewcontrollerTest.php index baff3681b7..fb17e9faad 100755 --- a/tests/php/controller/viewcontrollerTest.php +++ b/tests/php/controller/viewcontrollerTest.php @@ -82,6 +82,11 @@ public function testIndex($serverVersion, $isIE, $shareeActions, $shareeCanEdit) ->with('theming', 'color', '#0082C9') ->will($this->returnValue('#ff00ff')); + $this->config->expects($this->at(3)) + ->method('getAppValue') + ->with('core', 'shareapi_allow_links', 'yes') + ->will($this->returnValue('yes')); + $this->userSession->expects($this->once()) ->method('getUser') ->will($this->returnValue($this->dummyUser)); @@ -94,22 +99,22 @@ public function testIndex($serverVersion, $isIE, $shareeActions, $shareeCanEdit) ->method('getEMailAddress') ->will($this->returnValue('test@bla.com')); - $this->config->expects($this->at(3)) + $this->config->expects($this->at(4)) ->method('getUserValue') ->with('user123', $this->appName, 'currentView', null) ->will($this->returnValue('someView')); - $this->config->expects($this->at(4)) + $this->config->expects($this->at(5)) ->method('getUserValue') ->with('user123', $this->appName, 'skipPopover', 'no') ->will($this->returnValue('someSkipPopoverValue')); - $this->config->expects($this->at(5)) + $this->config->expects($this->at(6)) ->method('getUserValue') ->with('user123', $this->appName, 'showWeekNr', 'no') ->will($this->returnValue('someShowWeekNrValue')); - $this->config->expects($this->at(6)) + $this->config->expects($this->at(7)) ->method('getUserValue') ->with('user123', $this->appName, 'firstRun', null) ->will($this->returnValue('someFirstRunValue')); @@ -124,6 +129,7 @@ public function testIndex($serverVersion, $isIE, $shareeActions, $shareeCanEdit) 'skipPopover' => 'someSkipPopoverValue', 'weekNumbers' => 'someShowWeekNrValue', 'firstRun' => 'someFirstRunValue', + 'canSharePublicLink' => 'yes', 'defaultColor' => '#ff00ff', 'isPublic' => false, 'isEmbedded' => false, @@ -178,21 +184,26 @@ public function testIndexNoMonthFallback() { ->will($this->returnValue('#ff00ff')); $this->config->expects($this->at(3)) + ->method('getAppValue') + ->with('core', 'shareapi_allow_links', 'yes') + ->will($this->returnValue('no')); + + $this->config->expects($this->at(4)) ->method('getUserValue') ->with('user123', $this->appName, 'currentView', null) ->will($this->returnValue(null)); - $this->config->expects($this->at(4)) + $this->config->expects($this->at(5)) ->method('getUserValue') ->with('user123', $this->appName, 'skipPopover', 'no') ->will($this->returnValue('someSkipPopoverValue')); - $this->config->expects($this->at(5)) + $this->config->expects($this->at(6)) ->method('getUserValue') ->with('user123', $this->appName, 'showWeekNr', 'no') ->will($this->returnValue('someShowWeekNrValue')); - $this->config->expects($this->at(6)) + $this->config->expects($this->at(7)) ->method('getUserValue') ->with('user123', $this->appName, 'firstRun', null) ->will($this->returnValue('someFirstRunValue')); @@ -214,6 +225,7 @@ public function testIndexNoMonthFallback() { 'token' => '', 'shareeCanEditShares' => 'no', 'shareeCanEditCalendarProperties' => 'yes', + 'canSharePublicLink' => 'no' ], $actual->getParams()); $this->assertEquals('main', $actual->getTemplateName()); } @@ -255,27 +267,32 @@ public function testIndexFirstRunDetection($initialView, $expectedFirstRun, $exp ->will($this->returnValue('#ff00ff')); $this->config->expects($this->at(3)) + ->method('getAppValue') + ->with('core', 'shareapi_allow_links', 'yes') + ->will($this->returnValue('no')); + + $this->config->expects($this->at(4)) ->method('getUserValue') ->with('user123', $this->appName, 'currentView', null) ->will($this->returnValue($initialView)); - $this->config->expects($this->at(4)) + $this->config->expects($this->at(5)) ->method('getUserValue') ->with('user123', $this->appName, 'skipPopover', 'no') ->will($this->returnValue('someSkipPopoverValue')); - $this->config->expects($this->at(5)) + $this->config->expects($this->at(6)) ->method('getUserValue') ->with('user123', $this->appName, 'showWeekNr', 'no') ->will($this->returnValue('someShowWeekNrValue')); - $this->config->expects($this->at(6)) + $this->config->expects($this->at(7)) ->method('getUserValue') ->with('user123', $this->appName, 'firstRun', null) ->will($this->returnValue(null)); if ($expectsSetRequest) { - $this->config->expects($this->at(7)) + $this->config->expects($this->at(8)) ->method('setUserValue') ->with('user123'); } @@ -297,6 +314,7 @@ public function testIndexFirstRunDetection($initialView, $expectedFirstRun, $exp 'token' => '', 'shareeCanEditShares' => 'yes', 'shareeCanEditCalendarProperties' => 'no', + 'canSharePublicLink' => 'no' ], $actual->getParams()); $this->assertEquals('main', $actual->getTemplateName()); } @@ -332,6 +350,11 @@ public function testPublicIndex($serverVersion, $isIE, $shareeActions, $shareeCa ->with('theming', 'color', '#0082C9') ->will($this->returnValue('#ff00ff')); + $this->config->expects($this->at(3)) + ->method('getAppValue') + ->with('core', 'shareapi_allow_links', 'yes') + ->will($this->returnValue('no')); + $this->request->expects($this->at(1)) ->method('getServerProtocol') ->will($this->returnValue('fancy_protocol')); @@ -389,6 +412,7 @@ public function testPublicIndex($serverVersion, $isIE, $shareeActions, $shareeCa 'token' => 'fancy_token_123', 'shareeCanEditShares' => $shareeActions, 'shareeCanEditCalendarProperties' => $shareeCanEdit, + 'canSharePublicLink' => 'no', ], $actual->getParams()); $this->assertEquals('main', $actual->getTemplateName()); } @@ -417,6 +441,11 @@ public function testPublicIndexWithBranding($serverVersion, $isIE, $shareeAction ->with('theming', 'color', '#0082C9') ->will($this->returnValue('#ff00ff')); + $this->config->expects($this->at(3)) + ->method('getAppValue') + ->with('core', 'shareapi_allow_links', 'yes') + ->will($this->returnValue('no')); + $this->request->expects($this->at(1)) ->method('getServerProtocol') ->will($this->returnValue('fancy_protocol')); @@ -474,6 +503,7 @@ public function testPublicIndexWithBranding($serverVersion, $isIE, $shareeAction 'token' => 'fancy_token_123', 'shareeCanEditShares' => $shareeActions, 'shareeCanEditCalendarProperties' => $shareeCanEdit, + 'canSharePublicLink' => 'no', ], $actual->getParams()); $this->assertEquals('public', $actual->getTemplateName()); }