diff options
author | Vincent Petry <pvince81@owncloud.com> | 2016-07-08 16:56:13 +0200 |
---|---|---|
committer | Thomas Müller <DeepDiver1975@users.noreply.github.com> | 2016-07-08 16:56:13 +0200 |
commit | 0ddbf5c9812d869db7df4473637927edaa0da9b1 (patch) | |
tree | 11953abeeb8b14eac7b50a1219272e3fa56a3743 | |
parent | 830c1f2fbfe560f42912315dc423b30578125905 (diff) | |
download | nextcloud-server-0ddbf5c9812d869db7df4473637927edaa0da9b1.tar.gz nextcloud-server-0ddbf5c9812d869db7df4473637927edaa0da9b1.zip |
[stable9.1] Revert invalid commits from master->stable9.1 merge (#25420)
* Revert "Merge pull request #25240 from owncloud/remove-svg"
This reverts commit 8b8d2b679a12f703141de9da71340f1f02151f3d, reversing
changes made to a35747b6fa8f7704bf7333f16a2b867b76acb187.
* Revert "Merge pull request #25253 from owncloud/users-fixotherquotadropdown"
This reverts commit a35747b6fa8f7704bf7333f16a2b867b76acb187, reversing
changes made to a573b6863cbb4eb21feb7fe5a17a9b8fc60cf059.
* Revert "Merge pull request #25314 from owncloud/files_external-backends-config"
This reverts commit a573b6863cbb4eb21feb7fe5a17a9b8fc60cf059, reversing
changes made to 8147eefaeba3822c9331283e973006ad3aeac1f5.
* Revert "Add all properties while creating a subscription (#25318)"
This reverts commit aaf4c3073af2511ab895e982cadae8dc6a143e55.
* Revert "Merge pull request #25276 from owncloud/delete-own-session-token"
This reverts commit e42ce62ce2855c95861eeae669508e5c20f99be4, reversing
changes made to aaf4c3073af2511ab895e982cadae8dc6a143e55.
* Revert "Merge pull request #25262 from owncloud/fed-sharing-error"
This reverts commit 027715f9acba4dc314a7e4c63ac41a58d4e33f22, reversing
changes made to e42ce62ce2855c95861eeae669508e5c20f99be4.
133 files changed, 242 insertions, 274 deletions
diff --git a/apps/dav/lib/CalDAV/CalDavBackend.php b/apps/dav/lib/CalDAV/CalDavBackend.php index 565ad0ec663..ce494082976 100644 --- a/apps/dav/lib/CalDAV/CalDavBackend.php +++ b/apps/dav/lib/CalDAV/CalDavBackend.php @@ -1079,27 +1079,22 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription 'lastmodified' => time(), ]; - $propertiesBoolean = ['striptodos', 'stripalarms', 'stripattachments']; - foreach($this->subscriptionPropertyMap as $xmlName=>$dbName) { - if (array_key_exists($xmlName, $properties)) { - $values[$dbName] = $properties[$xmlName]; - if (in_array($dbName, $propertiesBoolean)) { - $values[$dbName] = true; - } + if (isset($properties[$xmlName])) { + + $values[$dbName] = $properties[$xmlName]; + $fieldNames[] = $dbName; } } - $valuesToInsert = array(); - $query = $this->db->getQueryBuilder(); - - foreach (array_keys($values) as $name) { - $valuesToInsert[$name] = $query->createNamedParameter($values[$name]); - } - $query->insert('calendarsubscriptions') - ->values($valuesToInsert) + ->values([ + 'principaluri' => $query->createNamedParameter($values['principaluri']), + 'uri' => $query->createNamedParameter($values['uri']), + 'source' => $query->createNamedParameter($values['source']), + 'lastmodified' => $query->createNamedParameter($values['lastmodified']), + ]) ->execute(); return $this->db->lastInsertId('*PREFIX*calendarsubscriptions'); diff --git a/apps/dav/tests/unit/CalDAV/CalDavBackendTest.php b/apps/dav/tests/unit/CalDAV/CalDavBackendTest.php index baa8540c43c..977bdf15c8e 100644 --- a/apps/dav/tests/unit/CalDAV/CalDavBackendTest.php +++ b/apps/dav/tests/unit/CalDAV/CalDavBackendTest.php @@ -333,20 +333,15 @@ EOD; public function testSubscriptions() { $id = $this->backend->createSubscription(self::UNIT_TEST_USER, 'Subscription', [ - '{http://calendarserver.org/ns/}source' => new Href('test-source'), - '{http://apple.com/ns/ical/}calendar-color' => '#1C4587', - '{http://calendarserver.org/ns/}subscribed-strip-todos' => '' + '{http://calendarserver.org/ns/}source' => new Href('test-source') ]); $subscriptions = $this->backend->getSubscriptionsForUser(self::UNIT_TEST_USER); $this->assertEquals(1, count($subscriptions)); - $this->assertEquals('#1C4587', $subscriptions[0]['{http://apple.com/ns/ical/}calendar-color']); - $this->assertEquals(true, $subscriptions[0]['{http://calendarserver.org/ns/}subscribed-strip-todos']); $this->assertEquals($id, $subscriptions[0]['id']); $patch = new PropPatch([ '{DAV:}displayname' => 'Unit test', - '{http://apple.com/ns/ical/}calendar-color' => '#ac0606', ]); $this->backend->updateSubscription($id, $patch); $patch->commit(); @@ -355,7 +350,6 @@ EOD; $this->assertEquals(1, count($subscriptions)); $this->assertEquals($id, $subscriptions[0]['id']); $this->assertEquals('Unit test', $subscriptions[0]['{DAV:}displayname']); - $this->assertEquals('#ac0606', $subscriptions[0]['{http://apple.com/ns/ical/}calendar-color']); $this->backend->deleteSubscription($id); $subscriptions = $this->backend->getSubscriptionsForUser(self::UNIT_TEST_USER); diff --git a/apps/federatedfilesharing/lib/FederatedShareProvider.php b/apps/federatedfilesharing/lib/FederatedShareProvider.php index 181351816b1..01737256769 100644 --- a/apps/federatedfilesharing/lib/FederatedShareProvider.php +++ b/apps/federatedfilesharing/lib/FederatedShareProvider.php @@ -217,32 +217,28 @@ class FederatedShareProvider implements IShareProvider { $share->getPermissions(), $token ); + $sharedByFederatedId = $share->getSharedBy(); + if ($this->userManager->userExists($sharedByFederatedId)) { + $sharedByFederatedId = $sharedByFederatedId . '@' . $this->addressHandler->generateRemoteURL(); + } + $send = $this->notifications->sendRemoteShare( + $token, + $share->getSharedWith(), + $share->getNode()->getName(), + $shareId, + $share->getShareOwner(), + $share->getShareOwner() . '@' . $this->addressHandler->generateRemoteURL(), + $share->getSharedBy(), + $sharedByFederatedId + ); - try { - $sharedByFederatedId = $share->getSharedBy(); - if ($this->userManager->userExists($sharedByFederatedId)) { - $sharedByFederatedId = $sharedByFederatedId . '@' . $this->addressHandler->generateRemoteURL(); - } - $send = $this->notifications->sendRemoteShare( - $token, - $share->getSharedWith(), - $share->getNode()->getName(), - $shareId, - $share->getShareOwner(), - $share->getShareOwner() . '@' . $this->addressHandler->generateRemoteURL(), - $share->getSharedBy(), - $sharedByFederatedId - ); - - if ($send === false) { - $message_t = $this->l->t('Sharing %s failed, could not find %s, maybe the server is currently unreachable.', - [$share->getNode()->getName(), $share->getSharedWith()]); - throw new \Exception($message_t); - } - } catch (\Exception $e) { - $this->logger->error('Failed to notify remote server of federated share, removing share (' . $e->getMessage() . ')'); - $this->removeShareFromTableById($shareId); - throw $e; + if ($send === false) { + $data = $this->getRawShare($shareId); + $share = $this->createShareObject($data); + $this->removeShareFromTable($share); + $message_t = $this->l->t('Sharing %s failed, could not find %s, maybe the server is currently unreachable.', + [$share->getNode()->getName(), $share->getSharedWith()]); + throw new \Exception($message_t); } return $shareId; @@ -530,22 +526,13 @@ class FederatedShareProvider implements IShareProvider { * @param IShare $share */ public function removeShareFromTable(IShare $share) { - $this->removeShareFromTableById($share->getId()); - } - - /** - * remove share from table - * - * @param string $shareId - */ - private function removeShareFromTableById($shareId) { $qb = $this->dbConnection->getQueryBuilder(); $qb->delete('share') - ->where($qb->expr()->eq('id', $qb->createNamedParameter($shareId))); + ->where($qb->expr()->eq('id', $qb->createNamedParameter($share->getId()))); $qb->execute(); $qb->delete('federated_reshares') - ->where($qb->expr()->eq('share_id', $qb->createNamedParameter($shareId))); + ->where($qb->expr()->eq('share_id', $qb->createNamedParameter($share->getId()))); $qb->execute(); } diff --git a/apps/federatedfilesharing/tests/FederatedShareProviderTest.php b/apps/federatedfilesharing/tests/FederatedShareProviderTest.php index 8c5efdab7b0..6792e534cc6 100644 --- a/apps/federatedfilesharing/tests/FederatedShareProviderTest.php +++ b/apps/federatedfilesharing/tests/FederatedShareProviderTest.php @@ -217,6 +217,10 @@ class FederatedShareProviderTest extends \Test\TestCase { 'sharedBy@http://localhost/' )->willReturn(false); + $this->rootFolder->expects($this->once()) + ->method('getUserFolder') + ->with('shareOwner') + ->will($this->returnSelf()); $this->rootFolder->method('getById') ->with('42') ->willReturn([$node]); @@ -240,62 +244,6 @@ class FederatedShareProviderTest extends \Test\TestCase { $this->assertFalse($data); } - public function testCreateException() { - $share = $this->shareManager->newShare(); - - $node = $this->getMock('\OCP\Files\File'); - $node->method('getId')->willReturn(42); - $node->method('getName')->willReturn('myFile'); - - $share->setSharedWith('user@server.com') - ->setSharedBy('sharedBy') - ->setShareOwner('shareOwner') - ->setPermissions(19) - ->setNode($node); - - $this->tokenHandler->method('generateToken')->willReturn('token'); - - $this->addressHandler->expects($this->any())->method('generateRemoteURL') - ->willReturn('http://localhost/'); - $this->addressHandler->expects($this->any())->method('splitUserRemote') - ->willReturn(['user', 'server.com']); - - $this->notifications->expects($this->once()) - ->method('sendRemoteShare') - ->with( - $this->equalTo('token'), - $this->equalTo('user@server.com'), - $this->equalTo('myFile'), - $this->anything(), - 'shareOwner', - 'shareOwner@http://localhost/', - 'sharedBy', - 'sharedBy@http://localhost/' - )->willThrowException(new \Exception('dummy')); - - $this->rootFolder->method('getById') - ->with('42') - ->willReturn([$node]); - - try { - $share = $this->provider->create($share); - $this->fail(); - } catch (\Exception $e) { - $this->assertEquals('dummy', $e->getMessage()); - } - - $qb = $this->connection->getQueryBuilder(); - $stmt = $qb->select('*') - ->from('share') - ->where($qb->expr()->eq('id', $qb->createNamedParameter($share->getId()))) - ->execute(); - - $data = $stmt->fetch(); - $stmt->closeCursor(); - - $this->assertFalse($data); - } - public function testCreateShareWithSelf() { $share = $this->shareManager->newShare(); diff --git a/apps/files_external/lib/Command/Backends.php b/apps/files_external/lib/Command/Backends.php index d1da6db3f6a..260ea210397 100644 --- a/apps/files_external/lib/Command/Backends.php +++ b/apps/files_external/lib/Command/Backends.php @@ -98,30 +98,15 @@ class Backends extends Base { $result = [ 'name' => $data['name'], 'identifier' => $data['identifier'], - 'configuration' => $this->formatConfiguration($data['configuration']) + 'configuration' => array_map(function (DefinitionParameter $parameter) { + return $parameter->getTypeName(); + }, $data['configuration']) ]; if ($backend instanceof Backend) { $result['storage_class'] = $backend->getStorageClass(); $authBackends = $this->backendService->getAuthMechanismsByScheme(array_keys($backend->getAuthSchemes())); $result['supported_authentication_backends'] = array_keys($authBackends); - $authConfig = array_map(function (AuthMechanism $auth) { - return $this->serializeAuthBackend($auth)['configuration']; - }, $authBackends); - $result['authentication_configuration'] = array_combine(array_keys($authBackends), $authConfig); } return $result; } - - /** - * @param DefinitionParameter[] $parameters - * @return string[] - */ - private function formatConfiguration(array $parameters) { - $configuration = array_filter($parameters, function (DefinitionParameter $parameter) { - return $parameter->getType() !== DefinitionParameter::VALUE_HIDDEN; - }); - return array_map(function (DefinitionParameter $parameter) { - return $parameter->getTypeName(); - }, $configuration); - } } diff --git a/core/img/actions/add.png b/core/img/actions/add.png Binary files differnew file mode 100644 index 00000000000..8ae17cfe11b --- /dev/null +++ b/core/img/actions/add.png diff --git a/core/img/actions/caret-dark.png b/core/img/actions/caret-dark.png Binary files differnew file mode 100644 index 00000000000..97c64c6a720 --- /dev/null +++ b/core/img/actions/caret-dark.png diff --git a/core/img/actions/caret.png b/core/img/actions/caret.png Binary files differnew file mode 100644 index 00000000000..3a8dd99176d --- /dev/null +++ b/core/img/actions/caret.png diff --git a/core/img/actions/checkbox-checked-disabled.png b/core/img/actions/checkbox-checked-disabled.png Binary files differnew file mode 100644 index 00000000000..55980ba730d --- /dev/null +++ b/core/img/actions/checkbox-checked-disabled.png diff --git a/core/img/actions/checkbox-checked-white.png b/core/img/actions/checkbox-checked-white.png Binary files differnew file mode 100644 index 00000000000..ed8e3d3d557 --- /dev/null +++ b/core/img/actions/checkbox-checked-white.png diff --git a/core/img/actions/checkbox-checked.png b/core/img/actions/checkbox-checked.png Binary files differnew file mode 100644 index 00000000000..a8a07193ab7 --- /dev/null +++ b/core/img/actions/checkbox-checked.png diff --git a/core/img/actions/checkbox-disabled-white.png b/core/img/actions/checkbox-disabled-white.png Binary files differnew file mode 100644 index 00000000000..e1f48439d27 --- /dev/null +++ b/core/img/actions/checkbox-disabled-white.png diff --git a/core/img/actions/checkbox-disabled.png b/core/img/actions/checkbox-disabled.png Binary files differnew file mode 100644 index 00000000000..a2ead209965 --- /dev/null +++ b/core/img/actions/checkbox-disabled.png diff --git a/core/img/actions/checkbox-mixed-white.png b/core/img/actions/checkbox-mixed-white.png Binary files differnew file mode 100644 index 00000000000..0b81f998fc5 --- /dev/null +++ b/core/img/actions/checkbox-mixed-white.png diff --git a/core/img/actions/checkbox-mixed.png b/core/img/actions/checkbox-mixed.png Binary files differnew file mode 100644 index 00000000000..cc27ec651ea --- /dev/null +++ b/core/img/actions/checkbox-mixed.png diff --git a/core/img/actions/checkbox-white.png b/core/img/actions/checkbox-white.png Binary files differnew file mode 100644 index 00000000000..f0f903c77c6 --- /dev/null +++ b/core/img/actions/checkbox-white.png diff --git a/core/img/actions/checkbox.png b/core/img/actions/checkbox.png Binary files differnew file mode 100644 index 00000000000..770b7ef8203 --- /dev/null +++ b/core/img/actions/checkbox.png diff --git a/core/img/actions/checkmark-color.png b/core/img/actions/checkmark-color.png Binary files differnew file mode 100644 index 00000000000..a8ab849cad7 --- /dev/null +++ b/core/img/actions/checkmark-color.png diff --git a/core/img/actions/checkmark-white.png b/core/img/actions/checkmark-white.png Binary files differnew file mode 100644 index 00000000000..27f17204b1d --- /dev/null +++ b/core/img/actions/checkmark-white.png diff --git a/core/img/actions/checkmark.png b/core/img/actions/checkmark.png Binary files differnew file mode 100644 index 00000000000..c1a8be786cd --- /dev/null +++ b/core/img/actions/checkmark.png diff --git a/core/img/actions/close.png b/core/img/actions/close.png Binary files differnew file mode 100644 index 00000000000..66e3c26cc65 --- /dev/null +++ b/core/img/actions/close.png diff --git a/core/img/actions/comment.png b/core/img/actions/comment.png Binary files differnew file mode 100644 index 00000000000..08867cf6361 --- /dev/null +++ b/core/img/actions/comment.png diff --git a/core/img/actions/confirm.png b/core/img/actions/confirm.png Binary files differnew file mode 100644 index 00000000000..3021d4c27d6 --- /dev/null +++ b/core/img/actions/confirm.png diff --git a/core/img/actions/delete-hover.png b/core/img/actions/delete-hover.png Binary files differnew file mode 100644 index 00000000000..ed12640df71 --- /dev/null +++ b/core/img/actions/delete-hover.png diff --git a/core/img/actions/delete-white.png b/core/img/actions/delete-white.png Binary files differnew file mode 100644 index 00000000000..07a5de34252 --- /dev/null +++ b/core/img/actions/delete-white.png diff --git a/core/img/actions/delete.png b/core/img/actions/delete.png Binary files differnew file mode 100644 index 00000000000..20e894c7f74 --- /dev/null +++ b/core/img/actions/delete.png diff --git a/core/img/actions/details.png b/core/img/actions/details.png Binary files differnew file mode 100644 index 00000000000..9145025be26 --- /dev/null +++ b/core/img/actions/details.png diff --git a/core/img/actions/download-white.png b/core/img/actions/download-white.png Binary files differnew file mode 100644 index 00000000000..815b551354f --- /dev/null +++ b/core/img/actions/download-white.png diff --git a/core/img/actions/download.png b/core/img/actions/download.png Binary files differnew file mode 100644 index 00000000000..1f8e1a4f7e1 --- /dev/null +++ b/core/img/actions/download.png diff --git a/core/img/actions/edit.png b/core/img/actions/edit.png Binary files differnew file mode 100644 index 00000000000..7ca20eba363 --- /dev/null +++ b/core/img/actions/edit.png diff --git a/core/img/actions/error-color.png b/core/img/actions/error-color.png Binary files differnew file mode 100644 index 00000000000..7d00282312a --- /dev/null +++ b/core/img/actions/error-color.png diff --git a/core/img/actions/error-white.png b/core/img/actions/error-white.png Binary files differnew file mode 100644 index 00000000000..6e15865401d --- /dev/null +++ b/core/img/actions/error-white.png diff --git a/core/img/actions/error.png b/core/img/actions/error.png Binary files differnew file mode 100644 index 00000000000..61df76b53ea --- /dev/null +++ b/core/img/actions/error.png diff --git a/core/img/actions/external.png b/core/img/actions/external.png Binary files differnew file mode 100644 index 00000000000..af03dbf3e05 --- /dev/null +++ b/core/img/actions/external.png diff --git a/core/img/actions/history.png b/core/img/actions/history.png Binary files differnew file mode 100644 index 00000000000..ec2bbd0587f --- /dev/null +++ b/core/img/actions/history.png diff --git a/core/img/actions/info-white.png b/core/img/actions/info-white.png Binary files differnew file mode 100644 index 00000000000..670d7309c4e --- /dev/null +++ b/core/img/actions/info-white.png diff --git a/core/img/actions/info.png b/core/img/actions/info.png Binary files differnew file mode 100644 index 00000000000..b280a019ab4 --- /dev/null +++ b/core/img/actions/info.png diff --git a/core/img/actions/logout.png b/core/img/actions/logout.png Binary files differnew file mode 100644 index 00000000000..ad230de98f4 --- /dev/null +++ b/core/img/actions/logout.png diff --git a/core/img/actions/mail.png b/core/img/actions/mail.png Binary files differnew file mode 100644 index 00000000000..6d06259cd08 --- /dev/null +++ b/core/img/actions/mail.png diff --git a/core/img/actions/menu.png b/core/img/actions/menu.png Binary files differnew file mode 100644 index 00000000000..583ce319175 --- /dev/null +++ b/core/img/actions/menu.png diff --git a/core/img/actions/more.png b/core/img/actions/more.png Binary files differnew file mode 100644 index 00000000000..880d5dccce3 --- /dev/null +++ b/core/img/actions/more.png diff --git a/core/img/actions/password.png b/core/img/actions/password.png Binary files differnew file mode 100644 index 00000000000..3619fabab9a --- /dev/null +++ b/core/img/actions/password.png diff --git a/core/img/actions/pause-big.png b/core/img/actions/pause-big.png Binary files differnew file mode 100644 index 00000000000..054281c6314 --- /dev/null +++ b/core/img/actions/pause-big.png diff --git a/core/img/actions/pause.png b/core/img/actions/pause.png Binary files differnew file mode 100644 index 00000000000..d4b865e3401 --- /dev/null +++ b/core/img/actions/pause.png diff --git a/core/img/actions/play-add.png b/core/img/actions/play-add.png Binary files differnew file mode 100644 index 00000000000..ccf77d2a062 --- /dev/null +++ b/core/img/actions/play-add.png diff --git a/core/img/actions/play-big.png b/core/img/actions/play-big.png Binary files differnew file mode 100644 index 00000000000..7d4916cb204 --- /dev/null +++ b/core/img/actions/play-big.png diff --git a/core/img/actions/play-next.png b/core/img/actions/play-next.png Binary files differnew file mode 100644 index 00000000000..50cd91d240e --- /dev/null +++ b/core/img/actions/play-next.png diff --git a/core/img/actions/play-previous.png b/core/img/actions/play-previous.png Binary files differnew file mode 100644 index 00000000000..c380e96bb58 --- /dev/null +++ b/core/img/actions/play-previous.png diff --git a/core/img/actions/play.png b/core/img/actions/play.png Binary files differnew file mode 100644 index 00000000000..7994424c65c --- /dev/null +++ b/core/img/actions/play.png diff --git a/core/img/actions/public.png b/core/img/actions/public.png Binary files differnew file mode 100644 index 00000000000..772838ad205 --- /dev/null +++ b/core/img/actions/public.png diff --git a/core/img/actions/radio-checked-disabled.png b/core/img/actions/radio-checked-disabled.png Binary files differnew file mode 100644 index 00000000000..09abc410f61 --- /dev/null +++ b/core/img/actions/radio-checked-disabled.png diff --git a/core/img/actions/radio-checked.png b/core/img/actions/radio-checked.png Binary files differnew file mode 100644 index 00000000000..94933b7b69c --- /dev/null +++ b/core/img/actions/radio-checked.png diff --git a/core/img/actions/radio-disabled.png b/core/img/actions/radio-disabled.png Binary files differnew file mode 100644 index 00000000000..ac7f49ed533 --- /dev/null +++ b/core/img/actions/radio-disabled.png diff --git a/core/img/actions/radio-white.png b/core/img/actions/radio-white.png Binary files differnew file mode 100644 index 00000000000..04beefdff01 --- /dev/null +++ b/core/img/actions/radio-white.png diff --git a/core/img/actions/radio.png b/core/img/actions/radio.png Binary files differnew file mode 100644 index 00000000000..70ac4741b97 --- /dev/null +++ b/core/img/actions/radio.png diff --git a/core/img/actions/rename.png b/core/img/actions/rename.png Binary files differnew file mode 100644 index 00000000000..975bd2d7031 --- /dev/null +++ b/core/img/actions/rename.png diff --git a/core/img/actions/search-white.png b/core/img/actions/search-white.png Binary files differnew file mode 100644 index 00000000000..9812c44a3d6 --- /dev/null +++ b/core/img/actions/search-white.png diff --git a/core/img/actions/search.png b/core/img/actions/search.png Binary files differnew file mode 100644 index 00000000000..5f4767a6f46 --- /dev/null +++ b/core/img/actions/search.png diff --git a/core/img/actions/settings.png b/core/img/actions/settings.png Binary files differnew file mode 100644 index 00000000000..3ab939ca37a --- /dev/null +++ b/core/img/actions/settings.png diff --git a/core/img/actions/share.png b/core/img/actions/share.png Binary files differnew file mode 100644 index 00000000000..fdacbbabebc --- /dev/null +++ b/core/img/actions/share.png diff --git a/core/img/actions/shared.png b/core/img/actions/shared.png Binary files differnew file mode 100644 index 00000000000..fdacbbabebc --- /dev/null +++ b/core/img/actions/shared.png diff --git a/core/img/actions/sound-off.png b/core/img/actions/sound-off.png Binary files differnew file mode 100644 index 00000000000..0457de8e4d1 --- /dev/null +++ b/core/img/actions/sound-off.png diff --git a/core/img/actions/sound.png b/core/img/actions/sound.png Binary files differnew file mode 100644 index 00000000000..e849b4d248b --- /dev/null +++ b/core/img/actions/sound.png diff --git a/core/img/actions/star.png b/core/img/actions/star.png Binary files differnew file mode 100644 index 00000000000..88e4ad54584 --- /dev/null +++ b/core/img/actions/star.png diff --git a/core/img/actions/starred.png b/core/img/actions/starred.png Binary files differnew file mode 100644 index 00000000000..22e68c757e7 --- /dev/null +++ b/core/img/actions/starred.png diff --git a/core/img/actions/toggle-filelist.png b/core/img/actions/toggle-filelist.png Binary files differnew file mode 100644 index 00000000000..0926a726d53 --- /dev/null +++ b/core/img/actions/toggle-filelist.png diff --git a/core/img/actions/toggle-pictures.png b/core/img/actions/toggle-pictures.png Binary files differnew file mode 100644 index 00000000000..7499d5b7809 --- /dev/null +++ b/core/img/actions/toggle-pictures.png diff --git a/core/img/actions/toggle.png b/core/img/actions/toggle.png Binary files differnew file mode 100644 index 00000000000..24a6a4d47de --- /dev/null +++ b/core/img/actions/toggle.png diff --git a/core/img/actions/triangle-e.png b/core/img/actions/triangle-e.png Binary files differnew file mode 100644 index 00000000000..4ce1086f61d --- /dev/null +++ b/core/img/actions/triangle-e.png diff --git a/core/img/actions/triangle-n.png b/core/img/actions/triangle-n.png Binary files differnew file mode 100644 index 00000000000..2042d66532c --- /dev/null +++ b/core/img/actions/triangle-n.png diff --git a/core/img/actions/triangle-s.png b/core/img/actions/triangle-s.png Binary files differnew file mode 100644 index 00000000000..97c64c6a720 --- /dev/null +++ b/core/img/actions/triangle-s.png diff --git a/core/img/actions/upload-white.png b/core/img/actions/upload-white.png Binary files differnew file mode 100644 index 00000000000..28693f855d3 --- /dev/null +++ b/core/img/actions/upload-white.png diff --git a/core/img/actions/upload.png b/core/img/actions/upload.png Binary files differnew file mode 100644 index 00000000000..8955ed96412 --- /dev/null +++ b/core/img/actions/upload.png diff --git a/core/img/actions/user.png b/core/img/actions/user.png Binary files differnew file mode 100644 index 00000000000..5f2fddc0ea3 --- /dev/null +++ b/core/img/actions/user.png diff --git a/core/img/actions/view-close.png b/core/img/actions/view-close.png Binary files differnew file mode 100644 index 00000000000..eae9acc7a43 --- /dev/null +++ b/core/img/actions/view-close.png diff --git a/core/img/actions/view-download.png b/core/img/actions/view-download.png Binary files differnew file mode 100644 index 00000000000..29e1b6fec70 --- /dev/null +++ b/core/img/actions/view-download.png diff --git a/core/img/actions/view-next.png b/core/img/actions/view-next.png Binary files differnew file mode 100644 index 00000000000..be8cc15cecd --- /dev/null +++ b/core/img/actions/view-next.png diff --git a/core/img/actions/view-pause.png b/core/img/actions/view-pause.png Binary files differnew file mode 100644 index 00000000000..94cd1a5dc6c --- /dev/null +++ b/core/img/actions/view-pause.png diff --git a/core/img/actions/view-play.png b/core/img/actions/view-play.png Binary files differnew file mode 100644 index 00000000000..a8398d5758f --- /dev/null +++ b/core/img/actions/view-play.png diff --git a/core/img/actions/view-previous.png b/core/img/actions/view-previous.png Binary files differnew file mode 100644 index 00000000000..86e2a809626 --- /dev/null +++ b/core/img/actions/view-previous.png diff --git a/core/img/breadcrumb.png b/core/img/breadcrumb.png Binary files differnew file mode 100644 index 00000000000..5556920aa73 --- /dev/null +++ b/core/img/breadcrumb.png diff --git a/core/img/desktopapp.png b/core/img/desktopapp.png Binary files differnew file mode 100644 index 00000000000..272397c949e --- /dev/null +++ b/core/img/desktopapp.png diff --git a/core/img/filetypes/application-pdf.png b/core/img/filetypes/application-pdf.png Binary files differnew file mode 100644 index 00000000000..c215094eaa7 --- /dev/null +++ b/core/img/filetypes/application-pdf.png diff --git a/core/img/filetypes/application.png b/core/img/filetypes/application.png Binary files differnew file mode 100644 index 00000000000..d9db3b9114c --- /dev/null +++ b/core/img/filetypes/application.png diff --git a/core/img/filetypes/audio.png b/core/img/filetypes/audio.png Binary files differnew file mode 100644 index 00000000000..3d52756341a --- /dev/null +++ b/core/img/filetypes/audio.png diff --git a/core/img/filetypes/file.png b/core/img/filetypes/file.png Binary files differnew file mode 100644 index 00000000000..74add13f276 --- /dev/null +++ b/core/img/filetypes/file.png diff --git a/core/img/filetypes/folder-drag-accept.png b/core/img/filetypes/folder-drag-accept.png Binary files differnew file mode 100644 index 00000000000..1124a02982f --- /dev/null +++ b/core/img/filetypes/folder-drag-accept.png diff --git a/core/img/filetypes/folder-external.png b/core/img/filetypes/folder-external.png Binary files differnew file mode 100644 index 00000000000..dd8343d245a --- /dev/null +++ b/core/img/filetypes/folder-external.png diff --git a/core/img/filetypes/folder-public.png b/core/img/filetypes/folder-public.png Binary files differnew file mode 100644 index 00000000000..3da67f85f79 --- /dev/null +++ b/core/img/filetypes/folder-public.png diff --git a/core/img/filetypes/folder-shared.png b/core/img/filetypes/folder-shared.png Binary files differnew file mode 100644 index 00000000000..d24e1d7af4e --- /dev/null +++ b/core/img/filetypes/folder-shared.png diff --git a/core/img/filetypes/folder-starred.png b/core/img/filetypes/folder-starred.png Binary files differnew file mode 100644 index 00000000000..4b847bf69ea --- /dev/null +++ b/core/img/filetypes/folder-starred.png diff --git a/core/img/filetypes/folder.png b/core/img/filetypes/folder.png Binary files differnew file mode 100644 index 00000000000..e811e9cdfdc --- /dev/null +++ b/core/img/filetypes/folder.png diff --git a/core/img/filetypes/image.png b/core/img/filetypes/image.png Binary files differnew file mode 100644 index 00000000000..8ff5e6c119f --- /dev/null +++ b/core/img/filetypes/image.png diff --git a/core/img/filetypes/package-x-generic.png b/core/img/filetypes/package-x-generic.png Binary files differnew file mode 100644 index 00000000000..68117e0d070 --- /dev/null +++ b/core/img/filetypes/package-x-generic.png diff --git a/core/img/filetypes/text-calendar.png b/core/img/filetypes/text-calendar.png Binary files differnew file mode 100644 index 00000000000..f21c3a9951d --- /dev/null +++ b/core/img/filetypes/text-calendar.png diff --git a/core/img/filetypes/text-code.png b/core/img/filetypes/text-code.png Binary files differnew file mode 100644 index 00000000000..69744e499e6 --- /dev/null +++ b/core/img/filetypes/text-code.png diff --git a/core/img/filetypes/text-vcard.png b/core/img/filetypes/text-vcard.png Binary files differnew file mode 100644 index 00000000000..087eadaabd1 --- /dev/null +++ b/core/img/filetypes/text-vcard.png diff --git a/core/img/filetypes/text.png b/core/img/filetypes/text.png Binary files differnew file mode 100644 index 00000000000..d6bec70cf43 --- /dev/null +++ b/core/img/filetypes/text.png diff --git a/core/img/filetypes/video.png b/core/img/filetypes/video.png Binary files differnew file mode 100644 index 00000000000..7cc1ecdc46a --- /dev/null +++ b/core/img/filetypes/video.png diff --git a/core/img/filetypes/x-office-document.png b/core/img/filetypes/x-office-document.png Binary files differnew file mode 100644 index 00000000000..3bc2f08d1f9 --- /dev/null +++ b/core/img/filetypes/x-office-document.png diff --git a/core/img/filetypes/x-office-presentation.png b/core/img/filetypes/x-office-presentation.png Binary files differnew file mode 100644 index 00000000000..644fb852009 --- /dev/null +++ b/core/img/filetypes/x-office-presentation.png diff --git a/core/img/filetypes/x-office-spreadsheet.png b/core/img/filetypes/x-office-spreadsheet.png Binary files differnew file mode 100644 index 00000000000..8f79c32fe01 --- /dev/null +++ b/core/img/filetypes/x-office-spreadsheet.png diff --git a/core/img/logo-icon.png b/core/img/logo-icon.png Binary files differnew file mode 100644 index 00000000000..6874c83673f --- /dev/null +++ b/core/img/logo-icon.png diff --git a/core/img/places/calendar-dark.png b/core/img/places/calendar-dark.png Binary files differnew file mode 100644 index 00000000000..9dc21d8a7b8 --- /dev/null +++ b/core/img/places/calendar-dark.png diff --git a/core/img/places/contacts-dark.png b/core/img/places/contacts-dark.png Binary files differnew file mode 100644 index 00000000000..fe03bbfe1a4 --- /dev/null +++ b/core/img/places/contacts-dark.png diff --git a/core/img/places/files.png b/core/img/places/files.png Binary files differnew file mode 100644 index 00000000000..e317fc3c722 --- /dev/null +++ b/core/img/places/files.png diff --git a/core/img/places/home.png b/core/img/places/home.png Binary files differnew file mode 100644 index 00000000000..2e0313d59a7 --- /dev/null +++ b/core/img/places/home.png diff --git a/core/img/places/link.png b/core/img/places/link.png Binary files differnew file mode 100644 index 00000000000..8ba9f6530fb --- /dev/null +++ b/core/img/places/link.png diff --git a/core/img/places/music.png b/core/img/places/music.png Binary files differnew file mode 100644 index 00000000000..0670544fedc --- /dev/null +++ b/core/img/places/music.png diff --git a/core/img/places/picture.png b/core/img/places/picture.png Binary files differnew file mode 100644 index 00000000000..171af526e9d --- /dev/null +++ b/core/img/places/picture.png diff --git a/core/js/jquery.ocdialog.js b/core/js/jquery.ocdialog.js index 15b58f9e086..ea034f0aff7 100644 --- a/core/js/jquery.ocdialog.js +++ b/core/js/jquery.ocdialog.js @@ -145,7 +145,7 @@ break; case 'closeButton': if(value) { - var $closeButton = $('<a class="oc-dialog-close"></a>'); + var $closeButton = $('<a class="oc-dialog-close svg"></a>'); this.$dialog.prepend($closeButton); $closeButton.on('click', function() { self.close(); diff --git a/core/js/js.js b/core/js/js.js index 07ed396bec9..7f98668dcb2 100644 --- a/core/js/js.js +++ b/core/js/js.js @@ -327,8 +327,8 @@ var OC={ * @return {string} */ imagePath:function(app,file){ - if(file.indexOf('.')==-1){//if no extension is given, use svg - file+='.svg'; + if(file.indexOf('.')==-1){//if no extension is given, use png or svg depending on browser support + file+=(OC.Util.hasSVGSupport())?'.svg':'.png'; } return OC.filePath(app,'img',file); }, @@ -592,7 +592,7 @@ var OC={ var arrowclass = settings.hasClass('topright') ? 'up' : 'left'; var jqxhr = $.get(OC.filePath(props.appid, '', props.scriptName), function(data) { popup.html(data).ready(function() { - popup.prepend('<span class="arrow '+arrowclass+'"></span><h2>'+t('core', 'Settings')+'</h2><a class="close"></a>').show(); + popup.prepend('<span class="arrow '+arrowclass+'"></span><h2>'+t('core', 'Settings')+'</h2><a class="close svg"></a>').show(); popup.find('.close').bind('click', function() { popup.remove(); }); @@ -613,6 +613,9 @@ var OC={ throw e; }); } + if(!OC.Util.hasSVGSupport()) { + OC.Util.replaceSVG(); + } }).show(); }, 'html'); } @@ -1355,6 +1358,49 @@ if(typeof localStorage !=='undefined' && localStorage !== null){ } /** + * check if the browser support svg images + * @return {boolean} + */ +function SVGSupport() { + return SVGSupport.checkMimeType.correct && !!document.createElementNS && !!document.createElementNS('http://www.w3.org/2000/svg', "svg").createSVGRect; +} +SVGSupport.checkMimeType=function(){ + $.ajax({ + url: OC.imagePath('core','breadcrumb.svg'), + success:function(data,text,xhr){ + var headerParts=xhr.getAllResponseHeaders().split("\n"); + var headers={}; + $.each(headerParts,function(i,text){ + if(text){ + var parts=text.split(':',2); + if(parts.length===2){ + var value=parts[1].trim(); + if(value[0]==='"'){ + value=value.substr(1,value.length-2); + } + headers[parts[0].toLowerCase()]=value; + } + } + }); + if(headers["content-type"]!=='image/svg+xml'){ + OC.Util.replaceSVG(); + SVGSupport.checkMimeType.correct=false; + } + } + }); +}; +SVGSupport.checkMimeType.correct=true; + +/** + * Replace all svg images with png for browser compatibility + * @param $el + * @deprecated use OC.Util.replaceSVG instead + */ +function replaceSVG($el){ + return OC.Util.replaceSVG($el); +} + +/** * prototypical inheritance functions * @todo Write documentation * usage: @@ -1471,6 +1517,12 @@ function initCore() { initSessionHeartBeat(); } + if(!OC.Util.hasSVGSupport()){ //replace all svg images with png images for browser that don't support svg + OC.Util.replaceSVG(); + }else{ + SVGSupport.checkMimeType(); + } + OC.registerMenu($('#expand'), $('#expanddiv')); // toggle for menus @@ -1739,21 +1791,24 @@ OC.Util = { }, /** * Returns whether the browser supports SVG - * @deprecated SVG is always supported (since 9.0) * @return {boolean} true if the browser supports SVG, false otherwise */ - hasSVGSupport: function(){ - return true - }, + // TODO: replace with original function + hasSVGSupport: SVGSupport, /** * If SVG is not supported, replaces the given icon's extension * from ".svg" to ".png". * If SVG is supported, return the image path as is. * @param {string} file image path with svg extension - * @deprecated SVG is always supported (since 9.0) * @return {string} fixed image path with png extension if SVG is not supported */ replaceSVGIcon: function(file) { + if (file && !OC.Util.hasSVGSupport()) { + var i = file.lastIndexOf('.svg'); + if (i >= 0) { + file = file.substr(0, i) + '.png' + file.substr(i+4); + } + } return file; }, /** @@ -1761,9 +1816,39 @@ OC.Util = { * with PNG images. * * @param $el root element from which to search, defaults to $('body') - * @deprecated SVG is always supported (since 9.0) */ - replaceSVG: function($el) {}, + replaceSVG: function($el) { + if (!$el) { + $el = $('body'); + } + $el.find('img.svg').each(function(index,element){ + element=$(element); + var src=element.attr('src'); + element.attr('src',src.substr(0, src.length-3) + 'png'); + }); + $el.find('.svg').each(function(index,element){ + element = $(element); + var background = element.css('background-image'); + if (background){ + var i = background.lastIndexOf('.svg'); + if (i >= 0){ + background = background.substr(0,i) + '.png' + background.substr(i + 4); + element.css('background-image', background); + } + } + element.find('*').each(function(index, element) { + element = $(element); + var background = element.css('background-image'); + if (background) { + var i = background.lastIndexOf('.svg'); + if(i >= 0){ + background = background.substr(0,i) + '.png' + background.substr(i + 4); + element.css('background-image', background); + } + } + }); + }); + }, /** * Fix image scaling for IE8, since background-size is not supported. diff --git a/core/js/mimetype.js b/core/js/mimetype.js index 0d30da26c26..3cc33ce2830 100644 --- a/core/js/mimetype.js +++ b/core/js/mimetype.js @@ -29,7 +29,7 @@ OC.MimeType = { * Cache that maps mimeTypes to icon urls */ _mimeTypeIcons: {}, - + /** * Return the file icon we want to use for the given mimeType. * The file needs to be present in the supplied file list @@ -60,7 +60,7 @@ OC.MimeType = { return null; }, - + /** * Return the url to icon of the given mimeType * @@ -91,14 +91,19 @@ OC.MimeType = { path += icon; } } - + // If we do not yet have an icon fall back to the default if (gotIcon === null) { path = OC.webroot + '/core/img/filetypes/'; path += OC.MimeType._getFile(mimeType, OC.MimeTypeList.files); } - path += '.svg'; + // Use svg if we can + if(OC.Util.hasSVGSupport()){ + path += '.svg'; + } else { + path += '.png'; + } // Cache the result OC.MimeType._mimeTypeIcons[mimeType] = path; @@ -106,3 +111,5 @@ OC.MimeType = { } }; + + diff --git a/core/js/sharedialogshareelistview.js b/core/js/sharedialogshareelistview.js index 85dee978987..83fde154615 100644 --- a/core/js/sharedialogshareelistview.js +++ b/core/js/sharedialogshareelistview.js @@ -38,7 +38,7 @@ '<span class="shareOption">' + '<input id="canEdit-{{cid}}-{{shareWith}}" type="checkbox" name="edit" class="permissions checkbox" {{#if hasEditPermission}}checked="checked"{{/if}} />' + '<label for="canEdit-{{cid}}-{{shareWith}}">{{canEditLabel}}</label>' + - '<a href="#" class="showCruds"><img alt="{{crudsLabel}}" src="{{triangleSImage}}"/></a>' + + '<a href="#" class="showCruds"><img class="svg" alt="{{crudsLabel}}" src="{{triangleSImage}}"/></a>' + '</span>' + '{{/if}}' + '<div class="cruds hidden">' + diff --git a/core/js/sharedialogview.js b/core/js/sharedialogview.js index c17da94bab3..a4bfde1777b 100644 --- a/core/js/sharedialogview.js +++ b/core/js/sharedialogview.js @@ -30,7 +30,7 @@ '<div class="loading hidden" style="height: 50px"></div>'; var TEMPLATE_REMOTE_SHARE_INFO = - '<a target="_blank" class="icon-info shareWithRemoteInfo hasTooltip" href="{{docLink}}" ' + + '<a target="_blank" class="icon-info svg shareWithRemoteInfo hasTooltip" href="{{docLink}}" ' + 'title="{{tooltip}}"></a>'; /** diff --git a/core/js/shareitemmodel.js b/core/js/shareitemmodel.js index 9f75ac42f21..3ced66a1a78 100644 --- a/core/js/shareitemmodel.js +++ b/core/js/shareitemmodel.js @@ -187,7 +187,7 @@ }).fail(function(xhr) { var msg = t('core', 'Error'); var result = xhr.responseJSON; - if (result && result.ocs && result.ocs.meta) { + if (result.ocs && result.ocs.meta) { msg = result.ocs.meta.message; } diff --git a/core/js/tests/specs/coreSpec.js b/core/js/tests/specs/coreSpec.js index 1ffe7b38a40..3d19a38c416 100644 --- a/core/js/tests/specs/coreSpec.js +++ b/core/js/tests/specs/coreSpec.js @@ -231,12 +231,22 @@ describe('Core base tests', function() { }); describe('Images', function() { it('Generates image path with given extension', function() { + var svgSupportStub = sinon.stub(OC.Util, 'hasSVGSupport', function() { return true; }); expect(OC.imagePath('core', 'somefile.jpg')).toEqual(OC.webroot + '/core/img/somefile.jpg'); expect(OC.imagePath(TESTAPP, 'somefile.jpg')).toEqual(TESTAPP_ROOT + '/img/somefile.jpg'); + svgSupportStub.restore(); }); - it('Generates image path with svg extension', function() { + it('Generates image path with svg extension when svg support exists', function() { + var svgSupportStub = sinon.stub(OC.Util, 'hasSVGSupport', function() { return true; }); expect(OC.imagePath('core', 'somefile')).toEqual(OC.webroot + '/core/img/somefile.svg'); expect(OC.imagePath(TESTAPP, 'somefile')).toEqual(TESTAPP_ROOT + '/img/somefile.svg'); + svgSupportStub.restore(); + }); + it('Generates image path with png ext when svg support is not available', function() { + var svgSupportStub = sinon.stub(OC.Util, 'hasSVGSupport', function() { return false; }); + expect(OC.imagePath('core', 'somefile')).toEqual(OC.webroot + '/core/img/somefile.png'); + expect(OC.imagePath(TESTAPP, 'somefile')).toEqual(TESTAPP_ROOT + '/img/somefile.png'); + svgSupportStub.restore(); }); }); }); @@ -494,6 +504,32 @@ describe('Core base tests', function() { expect($navigation.is(':visible')).toEqual(false); }); }); + describe('SVG extension replacement', function() { + var svgSupportStub; + + beforeEach(function() { + svgSupportStub = sinon.stub(OC.Util, 'hasSVGSupport'); + }); + afterEach(function() { + svgSupportStub.restore(); + }); + it('does not replace svg extension with png when SVG is supported', function() { + svgSupportStub.returns(true); + expect( + OC.Util.replaceSVGIcon('/path/to/myicon.svg?someargs=1') + ).toEqual( + '/path/to/myicon.svg?someargs=1' + ); + }); + it('replaces svg extension with png when SVG not supported', function() { + svgSupportStub.returns(false); + expect( + OC.Util.replaceSVGIcon('/path/to/myicon.svg?someargs=1') + ).toEqual( + '/path/to/myicon.png?someargs=1' + ); + }); + }); describe('Util', function() { describe('humanFileSize', function() { it('renders file sizes with the correct unit', function() { @@ -981,3 +1017,4 @@ describe('Core base tests', function() { }); }); }); + diff --git a/core/templates/installation.php b/core/templates/installation.php index 98d95541827..7f179bfa5d6 100644 --- a/core/templates/installation.php +++ b/core/templates/installation.php @@ -51,14 +51,14 @@ script('core', [ autocomplete="off" autocapitalize="off" autocorrect="off" required> <label for="adminpass" class="infield"><?php p($l->t( 'Password' )); ?></label> <input type="checkbox" id="show" name="show"> - <label for="show"></label> + <label for="show" class="svg"></label> <div class="strengthify-wrapper"></div> </p> </fieldset> <?php if(!$_['directoryIsSet'] OR !$_['dbIsSet'] OR count($_['errors']) > 0): ?> <fieldset id="advancedHeader"> - <legend><a id="showAdvanced"><?php p($l->t( 'Storage & database' )); ?> <img src="<?php print_unescaped(image_path('', 'actions/caret.svg')); ?>" /></a></legend> + <legend><a id="showAdvanced"><?php p($l->t( 'Storage & database' )); ?> <img class="svg" src="<?php print_unescaped(image_path('', 'actions/caret.svg')); ?>" /></a></legend> </fieldset> <?php endif; ?> @@ -162,7 +162,7 @@ script('core', [ <div class="buttons"><input type="submit" class="primary" value="<?php p($l->t( 'Finish setup' )); ?>" data-finishing="<?php p($l->t( 'Finishing …' )); ?>"></div> <p class="info"> - <span class="icon-info-white"></span> + <span class="icon-info-white svg"></span> <?php p($l->t('Need help?'));?> <a target="_blank" rel="noreferrer" href="<?php p(link_to_docs('admin-install')); ?>"><?php p($l->t('See the documentation'));?> ↗</a> </p> diff --git a/core/templates/layout.guest.php b/core/templates/layout.guest.php index 58506353158..985e95294ad 100644 --- a/core/templates/layout.guest.php +++ b/core/templates/layout.guest.php @@ -31,7 +31,7 @@ <?php if ($_['bodyid'] === 'body-login' ): ?> <header role="banner"> <div id="header"> - <div class="logo"> + <div class="logo svg"> <h1 class="hidden-visually"> <?php p($theme->getName()); ?> </h1> diff --git a/core/templates/layout.user.php b/core/templates/layout.user.php index 370a6e2bd60..b19095dee8e 100644 --- a/core/templates/layout.user.php +++ b/core/templates/layout.user.php @@ -39,7 +39,7 @@ <header role="banner"><div id="header"> <a href="<?php print_unescaped(link_to('', 'index.php')); ?>" id="owncloud" tabindex="1"> - <div class="logo-icon"> + <div class="logo-icon svg"> <h1 class="hidden-visually"> <?php p($theme->getName()); ?> </h1> @@ -56,11 +56,11 @@ } ?> </h1> - <div class="icon-caret"></div> + <div class="icon-caret svg"></div> </a> <div id="logo-claim" style="display:none;"><?php p($theme->getLogoClaim()); ?></div> - <div id="settings"> + <div id="settings" class="svg"> <div id="expand" tabindex="6" role="link" class="menutoggle"> <?php if ($_['enableAvatars']): ?> <div class="avatardiv<?php if ($_['userAvatarSet']) { print_unescaped(' avatardiv-shown'); } else { print_unescaped('" style="display: none'); } ?>"> @@ -73,7 +73,7 @@ </div> <?php endif; ?> <span id="expandDisplayName"><?php p(trim($_['user_displayname']) != '' ? $_['user_displayname'] : $_['user_uid']) ?></span> - <img alt="" src="<?php print_unescaped(image_path('', 'actions/caret.svg')); ?>"> + <img class="svg" alt="" src="<?php print_unescaped(image_path('', 'actions/caret.svg')); ?>"> </div> <div id="expanddiv"> <ul> @@ -81,14 +81,14 @@ <li> <a href="<?php print_unescaped($entry['href']); ?>" <?php if( $entry["active"] ): ?> class="active"<?php endif; ?>> - <img alt="" src="<?php print_unescaped($entry['icon']); ?>"> + <img class="svg" alt="" src="<?php print_unescaped($entry['icon']); ?>"> <?php p($entry['name']) ?> </a> </li> <?php endforeach; ?> <li> <a id="logout" <?php print_unescaped(OC_User::getLogoutAttribute()); ?>> - <img alt="" src="<?php print_unescaped(image_path('', 'actions/logout.svg')); ?>"> + <img class="svg" alt="" src="<?php print_unescaped(image_path('', 'actions/logout.svg')); ?>"> <?php p($l->t('Log out'));?> </a> </li> @@ -100,20 +100,20 @@ <label for="searchbox" class="hidden-visually"> <?php p($l->t('Search'));?> </label> - <input id="searchbox" type="search" name="query" + <input id="searchbox" class="svg" type="search" name="query" value="" required autocomplete="off" tabindex="5"> </form> </div></header> <nav role="navigation"><div id="navigation"> - <div id="apps"> + <div id="apps" class="svg"> <ul> <?php foreach($_['navigation'] as $entry): ?> <li data-id="<?php p($entry['id']); ?>"> <a href="<?php print_unescaped($entry['href']); ?>" tabindex="3" <?php if( $entry['active'] ): ?> class="active"<?php endif; ?>> - <img class="app-icon" alt="" src="<?php print_unescaped($entry['icon']); ?>"> + <img class="app-icon svg" alt="" src="<?php print_unescaped($entry['icon']); ?>"> <div class="icon-loading-dark" style="display:none;"></div> <span> <?php p($entry['name']); ?> @@ -128,7 +128,7 @@ <li id="apps-management"> <a href="<?php print_unescaped(\OC::$server->getURLGenerator()->linkToRoute('settings.AppSettings.viewApps')); ?>" tabindex="4" <?php if( $_['appsmanagement_active'] ): ?> class="active"<?php endif; ?>> - <img class="app-icon" alt="" src="<?php print_unescaped(image_path('settings', 'apps.svg')); ?>"> + <img class="app-icon svg" alt="" src="<?php print_unescaped(image_path('settings', 'apps.svg')); ?>"> <div class="icon-loading-dark" style="display:none;"></div> <span> <?php p($l->t('Apps')); ?> diff --git a/core/templates/login.php b/core/templates/login.php index 95c5a423c3d..5b0fd97cfd8 100644 --- a/core/templates/login.php +++ b/core/templates/login.php @@ -53,7 +53,7 @@ script('core', [ <?php p($_['user_autofocus'] ? '' : 'autofocus'); ?> autocomplete="on" autocapitalize="off" autocorrect="off" required> <label for="password" class="infield"><?php p($l->t('Password')); ?></label> - <input type="submit" id="submit" class="login primary icon-confirm" title="<?php p($l->t('Log in')); ?>" value="" disabled="disabled"/> + <input type="submit" id="submit" class="login primary icon-confirm svg" title="<?php p($l->t('Log in')); ?>" value="" disabled="disabled"/> </p> <?php if (!empty($_['invalidpassword']) && !empty($_['canResetPassword'])) { ?> diff --git a/core/templates/update.admin.php b/core/templates/update.admin.php index 87f93967d91..24b2beec6da 100644 --- a/core/templates/update.admin.php +++ b/core/templates/update.admin.php @@ -47,7 +47,7 @@ <p id="update-progress-message-error" class="warning hidden"></p> <ul id="update-progress-message-warnings" class="warning hidden"></ul> <p id="update-progress-message"></p> - <a class="update-show-detailed"><?php p($l->t( 'Detailed logs' )); ?> <img src="<?php print_unescaped(image_path('', 'actions/caret.svg')); ?>" /></a> + <a class="update-show-detailed"><?php p($l->t( 'Detailed logs' )); ?> <img class="svg" src="<?php print_unescaped(image_path('', 'actions/caret.svg')); ?>" /></a> <div id="update-progress-detailed" class="hidden warning"></div> </div> </div> diff --git a/lib/private/Files/Type/Detection.php b/lib/private/Files/Type/Detection.php index 2d68c92b14e..6191eae2754 100644 --- a/lib/private/Files/Type/Detection.php +++ b/lib/private/Files/Type/Detection.php @@ -283,21 +283,21 @@ class Detection implements IMimeTypeDetector { // Is it a dir? if ($mimetype === 'dir') { - $this->mimetypeIcons[$mimetype] = $this->urlGenerator->imagePath('core', 'filetypes/folder.svg'); + $this->mimetypeIcons[$mimetype] = $this->urlGenerator->imagePath('core', 'filetypes/folder.png'); return $this->mimetypeIcons[$mimetype]; } if ($mimetype === 'dir-shared') { - $this->mimetypeIcons[$mimetype] = $this->urlGenerator->imagePath('core', 'filetypes/folder-shared.svg'); + $this->mimetypeIcons[$mimetype] = $this->urlGenerator->imagePath('core', 'filetypes/folder-shared.png'); return $this->mimetypeIcons[$mimetype]; } if ($mimetype === 'dir-external') { - $this->mimetypeIcons[$mimetype] = $this->urlGenerator->imagePath('core', 'filetypes/folder-external.svg'); + $this->mimetypeIcons[$mimetype] = $this->urlGenerator->imagePath('core', 'filetypes/folder-external.png'); return $this->mimetypeIcons[$mimetype]; } // Icon exists? try { - $this->mimetypeIcons[$mimetype] = $this->urlGenerator->imagePath('core', 'filetypes/' . $icon . '.svg'); + $this->mimetypeIcons[$mimetype] = $this->urlGenerator->imagePath('core', 'filetypes/' . $icon . '.png'); return $this->mimetypeIcons[$mimetype]; } catch (\RuntimeException $e) { // Specified image not found @@ -306,13 +306,13 @@ class Detection implements IMimeTypeDetector { // Try only the first part of the filetype $mimePart = substr($icon, 0, strpos($icon, '-')); try { - $this->mimetypeIcons[$mimetype] = $this->urlGenerator->imagePath('core', 'filetypes/' . $mimePart . '.svg'); + $this->mimetypeIcons[$mimetype] = $this->urlGenerator->imagePath('core', 'filetypes/' . $mimePart . '.png'); return $this->mimetypeIcons[$mimetype]; } catch (\RuntimeException $e) { // Image for the first part of the mimetype not found } - $this->mimetypeIcons[$mimetype] = $this->urlGenerator->imagePath('core', 'filetypes/file.svg'); + $this->mimetypeIcons[$mimetype] = $this->urlGenerator->imagePath('core', 'filetypes/file.png'); return $this->mimetypeIcons[$mimetype]; } } diff --git a/lib/private/Preview/MP3.php b/lib/private/Preview/MP3.php index f96b422f57a..8b1a0500538 100644 --- a/lib/private/Preview/MP3.php +++ b/lib/private/Preview/MP3.php @@ -68,7 +68,7 @@ class MP3 extends Provider { * @return bool|\OCP\IImage false if the default image is missing or invalid */ private function getNoCoverThumbnail() { - $icon = \OC::$SERVERROOT . '/core/img/filetypes/audio.svg'; + $icon = \OC::$SERVERROOT . '/core/img/filetypes/audio.png'; if(!file_exists($icon)) { return false; diff --git a/settings/Controller/AuthSettingsController.php b/settings/Controller/AuthSettingsController.php index e7fc2d916bc..db2db6e5bfc 100644 --- a/settings/Controller/AuthSettingsController.php +++ b/settings/Controller/AuthSettingsController.php @@ -81,28 +81,7 @@ class AuthSettingsController extends Controller { if (is_null($user)) { return []; } - $tokens = $this->tokenProvider->getTokenByUser($user); - - try { - $sessionId = $this->session->getId(); - } catch (SessionNotAvailableException $ex) { - return $this->getServiceNotAvailableResponse(); - } - try { - $sessionToken = $this->tokenProvider->getToken($sessionId); - } catch (InvalidTokenException $ex) { - return $this->getServiceNotAvailableResponse(); - } - - return array_map(function(IToken $token) use ($sessionToken) { - $data = $token->jsonSerialize(); - if ($sessionToken->getId() === $token->getId()) { - $data['canDelete'] = false; - } else { - $data['canDelete'] = true; - } - return $data; - }, $tokens); + return $this->tokenProvider->getTokenByUser($user); } /** @@ -115,7 +94,9 @@ class AuthSettingsController extends Controller { try { $sessionId = $this->session->getId(); } catch (SessionNotAvailableException $ex) { - return $this->getServiceNotAvailableResponse(); + $resp = new JSONResponse(); + $resp->setStatus(Http::STATUS_SERVICE_UNAVAILABLE); + return $resp; } try { @@ -127,7 +108,9 @@ class AuthSettingsController extends Controller { $password = null; } } catch (InvalidTokenException $ex) { - return $this->getServiceNotAvailableResponse(); + $resp = new JSONResponse(); + $resp->setStatus(Http::STATUS_SERVICE_UNAVAILABLE); + return $resp; } $token = $this->generateRandomDeviceToken(); @@ -140,12 +123,6 @@ class AuthSettingsController extends Controller { ]; } - private function getServiceNotAvailableResponse() { - $resp = new JSONResponse(); - $resp->setStatus(Http::STATUS_SERVICE_UNAVAILABLE); - return $resp; - } - /** * Return a 20 digit device password * diff --git a/settings/js/authtoken_view.js b/settings/js/authtoken_view.js index 472b841c230..01fc1b2ea34 100644 --- a/settings/js/authtoken_view.js +++ b/settings/js/authtoken_view.js @@ -29,11 +29,7 @@ '<tr data-id="{{id}}">' + '<td class="has-tooltip" title="{{name}}"><span class="token-name">{{name}}</span></td>' + '<td><span class="last-activity has-tooltip" title="{{lastActivityTime}}">{{lastActivity}}</span></td>' - + '{{#if canDelete}}' + '<td><a class="icon-delete has-tooltip" title="' + t('core', 'Disconnect') + '"></a></td>' - + '{{else}}' - + '<td></td>' - + '{{/if}}' + '<tr>'; var SubView = OC.Backbone.View.extend({ diff --git a/settings/js/users/users.js b/settings/js/users/users.js index e0fdea64773..e0fccbd9539 100644 --- a/settings/js/users/users.js +++ b/settings/js/users/users.js @@ -117,7 +117,7 @@ var UserList = { * remove action */ if ($tr.find('td.remove img').length === 0 && OC.currentUser !== user.name) { - var deleteImage = $('<img class="action">').attr({ + var deleteImage = $('<img class="svg action">').attr({ src: OC.imagePath('core', 'actions/delete') }); var deleteLink = $('<a class="action delete">') @@ -138,13 +138,10 @@ var UserList = { .find('option').attr('selected', null) .first().attr('selected', 'selected'); } else { - var $options = $quotaSelect.find('option'); - var $foundOption = $options.filterAttr('value', user.quota); - if ($foundOption.length > 0) { - $foundOption.attr('selected', 'selected'); + if ($quotaSelect.find('option').filterAttr('value', user.quota).length > 0) { + $quotaSelect.find('option').filterAttr('value', user.quota).attr('selected', 'selected'); } else { - // append before "Other" entry - $options.last().before('<option value="' + escapeHTML(user.quota) + '" selected="selected">' + escapeHTML(user.quota) + '</option>'); + $quotaSelect.append('<option value="' + escapeHTML(user.quota) + '" selected="selected">' + escapeHTML(user.quota) + '</option>'); } } @@ -579,15 +576,6 @@ var UserList = { var $select = $(ev.target); var uid = UserList.getUID($select); var quota = $select.val(); - if (quota === 'other') { - return; - } - if (isNaN(parseInt(quota, 10)) || parseInt(quota, 10) < 0) { - // the select component has added the bogus value, delete it again - $select.find('option[selected]').remove(); - OC.Notification.showTemporary(t('core', 'Invalid quota value "{val}"', {val: quota})); - return; - } UserList._updateQuota(uid, quota, function(returnedQuota){ if (quota !== returnedQuota) { $select.find(':selected').text(returnedQuota); diff --git a/settings/templates/admin.php b/settings/templates/admin.php index 9195e03ff48..0cdefe10083 100644 --- a/settings/templates/admin.php +++ b/settings/templates/admin.php @@ -202,7 +202,7 @@ if ($_['cronErrors']) { <div class="section" id="shareAPI"> <h2><?php p($l->t('Sharing'));?></h2> - <a target="_blank" el="noreferrer" class="icon-info" + <a target="_blank" el="noreferrer" class="icon-info svg" title="<?php p($l->t('Open documentation'));?>" href="<?php p(link_to_docs('admin-sharing')); ?>"></a> <p id="enable"> @@ -314,7 +314,7 @@ if ($_['cronErrors']) { endif; ?> </p> <?php endif; ?> - <a target="_blank" rel="noreferrer" class="icon-info" + <a target="_blank" rel="noreferrer" class="icon-info svg" title="<?php p($l->t('Open documentation'));?>" href="<?php p(link_to_docs('admin-background-jobs')); ?>"></a> @@ -346,7 +346,7 @@ if ($_['cronErrors']) { <div class="section" id='encryptionAPI'> <h2><?php p($l->t('Server-side encryption')); ?></h2> - <a target="_blank" rel="noreferrer" class="icon-info" + <a target="_blank" rel="noreferrer" class="icon-info svg" title="<?php p($l->t('Open documentation'));?>" href="<?php p(link_to_docs('admin-encryption')); ?>"></a> @@ -412,7 +412,7 @@ if ($_['cronErrors']) { <div class="section" id="mail_general_settings"> <form id="mail_general_settings_form" class="mail_settings"> <h2><?php p($l->t('Email server'));?></h2> - <a target="_blank" rel="noreferrer" class="icon-info" + <a target="_blank" rel="noreferrer" class="icon-info svg" title="<?php p($l->t('Open documentation'));?>" href="<?php p(link_to_docs('admin-email')); ?>"></a> diff --git a/settings/templates/certificates.php b/settings/templates/certificates.php index 16f8dda31ad..c1ccdcaef95 100644 --- a/settings/templates/certificates.php +++ b/settings/templates/certificates.php @@ -26,7 +26,7 @@ <?php else: ?>style="visibility:hidden;" <?php endif; ?>><img alt="<?php p($l->t('Delete')); ?>" title="<?php p($l->t('Delete')); ?>" - class="action" + class="svg action" src="<?php print_unescaped(image_path('core', 'actions/delete.svg')); ?>"/> </td> </tr> diff --git a/settings/templates/personal.php b/settings/templates/personal.php index a31cf1ed7b2..5056aad4c10 100644 --- a/settings/templates/personal.php +++ b/settings/templates/personal.php @@ -39,9 +39,9 @@ <div class="avatardiv"></div> <div class="warning hidden"></div> <?php if ($_['avatarChangeSupported']): ?> - <label for="uploadavatar" class="inlineblock button icon-upload" id="uploadavatarbutton" title="<?php p($l->t('Upload new')); ?>"></label> - <div class="inlineblock button icon-folder" id="selectavatar" title="<?php p($l->t('Select from Files')); ?>"></div> - <div class="hidden button icon-delete" id="removeavatar" title="<?php p($l->t('Remove image')); ?>"></div> + <label for="uploadavatar" class="inlineblock button icon-upload svg" id="uploadavatarbutton" title="<?php p($l->t('Upload new')); ?>"></label> + <div class="inlineblock button icon-folder svg" id="selectavatar" title="<?php p($l->t('Select from Files')); ?>"></div> + <div class="hidden button icon-delete svg" id="removeavatar" title="<?php p($l->t('Remove image')); ?>"></div> <input type="file" name="files[]" id="uploadavatar" class="hiddenuploadfield"> <p><em><?php p($l->t('png or jpg, max. 20 MB')); ?></em></p> <?php else: ?> @@ -130,7 +130,7 @@ if($_['passwordChangeSupported']) { placeholder="<?php echo $l->t('New password');?>" data-typetoggle="#personal-show" autocomplete="off" autocapitalize="off" autocorrect="off" /> - <input type="checkbox" id="personal-show" name="show" /><label for="personal-show"></label> + <input type="checkbox" id="personal-show" name="show" /><label for="personal-show" class="svg"></label> <input id="passwordbutton" type="submit" value="<?php echo $l->t('Change password');?>" /> <br/> <div class="strengthify-wrapper"></div> diff --git a/settings/templates/users/part.grouplist.php b/settings/templates/users/part.grouplist.php index 64c602c364c..cd6ac4a1e89 100644 --- a/settings/templates/users/part.grouplist.php +++ b/settings/templates/users/part.grouplist.php @@ -8,7 +8,7 @@ <li id="newgroup-form" style="display: none"> <form> <input type="text" id="newgroupname" placeholder="<?php p($l->t('Group')); ?>..." /> - <input type="submit" class="button icon-add" value="" /> + <input type="submit" class="button icon-add svg" value="" /> </form> </li> <!-- Everyone --> @@ -45,7 +45,7 @@ <span class="usercount"><?php if($group['usercount'] > 0) { p($group['usercount']); } ?></span> <?php if($_['isAdmin']): ?> <a href="#" class="action delete" original-title="<?php p($l->t('Delete'))?>"> - <img src="<?php print_unescaped(image_path('core', 'actions/delete.svg')) ?>" /> + <img src="<?php print_unescaped(image_path('core', 'actions/delete.svg')) ?>" class="svg" /> </a> <?php endif; ?> </span> diff --git a/settings/templates/users/part.userlist.php b/settings/templates/users/part.userlist.php index c7b2ad58c15..697d0f3f142 100644 --- a/settings/templates/users/part.userlist.php +++ b/settings/templates/users/part.userlist.php @@ -26,15 +26,15 @@ <td class="avatar"><div class="avatardiv"></div></td> <?php endif; ?> <th class="name" scope="row"></th> - <td class="displayName"><span></span> <img class="action" + <td class="displayName"><span></span> <img class="svg action" src="<?php p(image_path('core', 'actions/rename.svg'))?>" alt="<?php p($l->t("change full name"))?>" title="<?php p($l->t("change full name"))?>"/> </td> - <td class="password"><span>●●●●●●●</span> <img class="action" + <td class="password"><span>●●●●●●●</span> <img class="svg action" src="<?php print_unescaped(image_path('core', 'actions/rename.svg'))?>" alt="<?php p($l->t("set new password"))?>" title="<?php p($l->t("set new password"))?>"/> </td> - <td class="mailAddress"><span></span><div class="loading-small hidden"></div> <img class="action" + <td class="mailAddress"><span></span><div class="loading-small hidden"></div> <img class="svg action" src="<?php p(image_path('core', 'actions/rename.svg'))?>" alt="<?php p($l->t('change email address'))?>" title="<?php p($l->t('change email address'))?>"/> </td> diff --git a/tests/Settings/Controller/AuthSettingsControllerTest.php b/tests/Settings/Controller/AuthSettingsControllerTest.php index 1705cb5ddf1..ee67b221022 100644 --- a/tests/Settings/Controller/AuthSettingsControllerTest.php +++ b/tests/Settings/Controller/AuthSettingsControllerTest.php @@ -24,7 +24,6 @@ namespace Test\Settings\Controller; use OC\AppFramework\Http; use OC\Authentication\Exceptions\InvalidTokenException; -use OC\Authentication\Token\DefaultToken; use OC\Authentication\Token\IToken; use OC\Settings\Controller\AuthSettingsController; use OCP\AppFramework\Http\JSONResponse; @@ -57,17 +56,10 @@ class AuthSettingsControllerTest extends TestCase { } public function testIndex() { - $token1 = new DefaultToken(); - $token1->setId(100); - $token2 = new DefaultToken(); - $token2->setId(200); - $tokens = [ - $token1, - $token2, + $result = [ + 'token1', + 'token2', ]; - $sessionToken = new DefaultToken(); - $sessionToken->setId(100); - $this->userManager->expects($this->once()) ->method('get') ->with($this->uid) @@ -75,31 +67,9 @@ class AuthSettingsControllerTest extends TestCase { $this->tokenProvider->expects($this->once()) ->method('getTokenByUser') ->with($this->user) - ->will($this->returnValue($tokens)); - $this->session->expects($this->once()) - ->method('getId') - ->will($this->returnValue('session123')); - $this->tokenProvider->expects($this->once()) - ->method('getToken') - ->with('session123') - ->will($this->returnValue($sessionToken)); + ->will($this->returnValue($result)); - $this->assertEquals([ - [ - 'id' => 100, - 'name' => null, - 'lastActivity' => null, - 'type' => null, - 'canDelete' => false, - ], - [ - 'id' => 200, - 'name' => null, - 'lastActivity' => null, - 'type' => null, - 'canDelete' => true, - ] - ], $this->controller->index()); + $this->assertEquals($result, $this->controller->index()); } public function testCreate() { @@ -137,7 +107,6 @@ class AuthSettingsControllerTest extends TestCase { $expected = [ 'token' => $newToken, 'deviceToken' => $deviceToken, - 'loginName' => 'User13', ]; $this->assertEquals($expected, $this->controller->create($name)); } |