Merge pull request #172 from owncloud/issue/161

Issue/161 Make use of the scrollto= parameter in activities
This commit is contained in:
Joas Schilling 2014-11-05 15:24:54 +01:00
Родитель f825a6f820 6c666461ff
Коммит bc9f5d24de
3 изменённых файлов: 21 добавлений и 18 удалений

Просмотреть файл

@ -153,14 +153,17 @@ class ParameterHelper
$is_dir = $this->rootView->is_dir('/' . User::getUser() . '/files' . $param);
if ($is_dir) {
$parent_dir = $param;
$fileLink = Util::linkTo('files', 'index.php', array('dir' => $param));
} else {
$parent_dir = (substr_count($param, '/') == 1) ? '/' : dirname($param);
$parentDir = (substr_count($param, '/') == 1) ? '/' : dirname($param);
$fileName = basename($param);
$fileLink = Util::linkTo('files', 'index.php', array(
'dir' => $parentDir,
'scrollto' => $fileName,
));
}
$fileLink = Util::linkTo('files', 'index.php', array('dir' => $parent_dir));
$param = trim($param, '/');
list($path, $name) = $this->splitPathFromFilename($param);
if (!$stripPath || $path === '') {
if (!$highlightParams) {

Просмотреть файл

@ -48,11 +48,11 @@ class DataHelperTest extends \PHPUnit_Framework_TestCase {
),
array(
'created_self', array('/SubFolder/A.txt'), false, true,
'You created <a class="filename" href="/index.php/apps/files?dir=%2FSubFolder">SubFolder/A.txt</a>',
'You created <a class="filename" href="/index.php/apps/files?dir=%2FSubFolder&scrollto=A.txt">SubFolder/A.txt</a>',
),
array(
'created_self', array('/SubFolder/A.txt'), true, true,
'You created <a class="filename tooltip" href="/index.php/apps/files?dir=%2FSubFolder" title="in SubFolder">A.txt</a>',
'You created <a class="filename tooltip" href="/index.php/apps/files?dir=%2FSubFolder&scrollto=A.txt" title="in SubFolder">A.txt</a>',
),
array('created_by', array('/SubFolder/A.txt', 'UserB'), false, false, 'UserB created SubFolder/A.txt'),
@ -60,17 +60,17 @@ class DataHelperTest extends \PHPUnit_Framework_TestCase {
array(
'created_by', array('/SubFolder/A.txt', 'UserB'), false, true,
'<div class="avatar" data-user="UserB"></div><strong>UserB</strong> created '
. '<a class="filename" href="/index.php/apps/files?dir=%2FSubFolder">SubFolder/A.txt</a>',
. '<a class="filename" href="/index.php/apps/files?dir=%2FSubFolder&scrollto=A.txt">SubFolder/A.txt</a>',
),
array(
'created_by', array('/SubFolder/A.txt', 'UserB'), true, true,
'<div class="avatar" data-user="UserB"></div><strong>UserB</strong> created '
. '<a class="filename tooltip" href="/index.php/apps/files?dir=%2FSubFolder" title="in SubFolder">A.txt</a>',
. '<a class="filename tooltip" href="/index.php/apps/files?dir=%2FSubFolder&scrollto=A.txt" title="in SubFolder">A.txt</a>',
),
array(
'created_by', array('/A.txt', 'UserB'), true, true,
'<div class="avatar" data-user="UserB"></div><strong>UserB</strong> created '
. '<a class="filename" href="/index.php/apps/files?dir=%2F">A.txt</a>',
. '<a class="filename" href="/index.php/apps/files?dir=%2F&scrollto=A.txt">A.txt</a>',
),
array(
@ -113,9 +113,9 @@ class DataHelperTest extends \PHPUnit_Framework_TestCase {
array(array('/SubFolder/A.txt', '/SubFolder/B.txt', '/SubFolder/C.txt', '/SubFolder/D.txt', '/SubFolder/E.txt', '/SubFolder/F.txt')),
false,
true,
'You created <a class="filename" href="/index.php/apps/files?dir=%2FSubFolder">SubFolder/A.txt</a>,'
. ' <a class="filename" href="/index.php/apps/files?dir=%2FSubFolder">SubFolder/B.txt</a>,'
. ' <a class="filename" href="/index.php/apps/files?dir=%2FSubFolder">SubFolder/C.txt</a>'
'You created <a class="filename" href="/index.php/apps/files?dir=%2FSubFolder&scrollto=A.txt">SubFolder/A.txt</a>,'
. ' <a class="filename" href="/index.php/apps/files?dir=%2FSubFolder&scrollto=B.txt">SubFolder/B.txt</a>,'
. ' <a class="filename" href="/index.php/apps/files?dir=%2FSubFolder&scrollto=C.txt">SubFolder/C.txt</a>'
. ' and <strong class="tooltip" title="SubFolder/D.txt, SubFolder/E.txt, SubFolder/F.txt">3 more</strong>',
),
);

Просмотреть файл

@ -60,10 +60,10 @@ class ParameterHelperTest extends \PHPUnit_Framework_TestCase {
array(array('/foo/bar.file'), array(0 => 'file'), false, false, array('foo/bar.file')),
array(array('/folder/trailingslash/fromsharing/'), array(0 => 'file'), false, false, array('folder/trailingslash/fromsharing')),
array(array('/foo/bar.file'), array(0 => 'file'), true, true, array(
'<a class="filename tooltip" href="/index.php/apps/files?dir=%2Ffoo" title="in foo">bar.file</a>',
'<a class="filename tooltip" href="/index.php/apps/files?dir=%2Ffoo&scrollto=bar.file" title="in foo">bar.file</a>',
)),
array(array('/0/bar.file'), array(0 => 'file'), true, true, array(
'<a class="filename tooltip" href="/index.php/apps/files?dir=%2F0" title="in 0">bar.file</a>',
'<a class="filename tooltip" href="/index.php/apps/files?dir=%2F0&scrollto=bar.file" title="in 0">bar.file</a>',
)),
array(array('/foo/bar.file'), array(1 => 'file'), true, false, array('/foo/bar.file')),
array(array('/foo/bar.file'), array(1 => 'file'), true, true, array('<strong>/foo/bar.file</strong>')),
@ -71,18 +71,18 @@ class ParameterHelperTest extends \PHPUnit_Framework_TestCase {
// Legacy: stored without leading slash
array(array('foo/bar.file'), array(0 => 'file'), false, false, array('foo/bar.file')),
array(array('foo/bar.file'), array(0 => 'file'), false, true, array(
'<a class="filename" href="/index.php/apps/files?dir=%2Ffoo">foo/bar.file</a>',
'<a class="filename" href="/index.php/apps/files?dir=%2Ffoo&scrollto=bar.file">foo/bar.file</a>',
)),
array(array('foo/bar.file'), array(0 => 'file'), true, false, array('bar.file')),
array(array('foo/bar.file'), array(0 => 'file'), true, true, array(
'<a class="filename tooltip" href="/index.php/apps/files?dir=%2Ffoo" title="in foo">bar.file</a>',
'<a class="filename tooltip" href="/index.php/apps/files?dir=%2Ffoo&scrollto=bar.file" title="in foo">bar.file</a>',
)),
// Valid file position
array(array('UserA', '/foo/bar.file'), array(1 => 'file'), true, false, array('UserA', 'bar.file')),
array(array('UserA', '/foo/bar.file'), array(1 => 'file'), true, true, array(
'<strong>UserA</strong>',
'<a class="filename tooltip" href="/index.php/apps/files?dir=%2Ffoo" title="in foo">bar.file</a>',
'<a class="filename tooltip" href="/index.php/apps/files?dir=%2Ffoo&scrollto=bar.file" title="in foo">bar.file</a>',
)),
array(array('UserA', '/foo/bar.file'), array(2 => 'file'), true, false, array('UserA', '/foo/bar.file')),
array(array('UserA', '/foo/bar.file'), array(2 => 'file'), true, true, array(
@ -100,7 +100,7 @@ class ParameterHelperTest extends \PHPUnit_Framework_TestCase {
array(array('UserA', '/foo/bar.file'), array(0 => 'username', 1 => 'file'), true, true, array(
'<div class="avatar" data-user="UserA"></div><strong>UserA</strong>',
'<a class="filename tooltip" href="/index.php/apps/files?dir=%2Ffoo" title="in foo">bar.file</a>',
'<a class="filename tooltip" href="/index.php/apps/files?dir=%2Ffoo&scrollto=bar.file" title="in foo">bar.file</a>',
)),
array(array('UserA', '/tmp/test'), array(0 => 'username', 1 => 'file'), true, true, array(
'<div class="avatar" data-user="UserA"></div><strong>UserA</strong>',