summaryrefslogtreecommitdiffstats
path: root/apps/files
diff options
context:
space:
mode:
authorfnuesse <fnuesse@techfak.uni-bielefeld.de>2018-06-01 20:29:43 +0200
committerJohn Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>2018-07-12 16:49:37 +0200
commit72ace9697c0951b3379a88c3cb639e1c9abe0170 (patch)
tree7d24e3efbc36020579d99f4556f2bbed1cffd218 /apps/files
parent09d5b61c9e468cdc0b92db27946140e68192e2e5 (diff)
downloadnextcloud-server-72ace9697c0951b3379a88c3cb639e1c9abe0170.tar.gz
nextcloud-server-72ace9697c0951b3379a88c3cb639e1c9abe0170.zip
Added FavoritesQuickaccess-Sidebar
Added FavoritesQuickaccess-Sidebar Added Files-FavoritesQuickaccess-Toggle Fixed CSS for SpacerElement Removed Unnessessary Alerts and added Translations Tried fixing initial Quick-Access Checkboxstate Signed-off-by: fnuesse <fnuesse@techfak.uni-bielefeld.de> Tried fixing initial Quick-Access Checkboxstate Changed double-Quotes to single-Quotes Revert webdavurl which was changed by mistake Revert quota-icon which was changed by mistake Changed the Folderhandling from custom-designed to nextcloud-NavigationManager-handling Signed-off-by: fnuesse <fnuesse@techfak.uni-bielefeld.de> Moved CSS-Spacerclass to apps.scss for global usage Signed-off-by: fnuesse <felix.nuesse@t-online.de> Renamed settings-caption in apps.scss to app-navigation-caption Signed-off-by: fnuesse <felix.nuesse@t-online.de> Removed old input-tag for showQuickAccess-state Signed-off-by: fnuesse <felix.nuesse@t-online.de> Removed old spacer element in files.scss Signed-off-by: fnuesse <felix.nuesse@t-online.de> Changed style of favorites-sublist and disabled the ability to disable files-quickaccess Signed-off-by: fnuesse <felix.nuesse@t-online.de>
Diffstat (limited to 'apps/files')
-rw-r--r--apps/files/appinfo/routes.php10
-rw-r--r--apps/files/js/app.js40
-rw-r--r--apps/files/lib/Controller/ApiController.php28
-rw-r--r--apps/files/lib/Controller/ViewController.php58
-rw-r--r--apps/files/templates/appnavigation.php28
5 files changed, 145 insertions, 19 deletions
diff --git a/apps/files/appinfo/routes.php b/apps/files/appinfo/routes.php
index 0d1449ff355..3273d6d97db 100644
--- a/apps/files/appinfo/routes.php
+++ b/apps/files/appinfo/routes.php
@@ -76,6 +76,16 @@ $application->registerRoutes(
'url' => '/ajax/getstoragestats.php',
'verb' => 'GET',
],
+ [
+ 'name' => 'API#showQuickAccess',
+ 'url' => '/api/v1/showquickaccess',
+ 'verb' => 'GET',
+ ],
+ [
+ 'name' => 'API#hideQuickAccess',
+ 'url' => '/api/v1/hidequickaccess',
+ 'verb' => 'GET',
+ ],
]
]
);
diff --git a/apps/files/js/app.js b/apps/files/js/app.js
index 6a21bce975b..97b8b630f72 100644
--- a/apps/files/js/app.js
+++ b/apps/files/js/app.js
@@ -53,12 +53,19 @@
this.$showHiddenFiles = $('input#showhiddenfilesToggle');
var showHidden = $('#showHiddenFiles').val() === "1";
this.$showHiddenFiles.prop('checked', showHidden);
+
+ this.$showQuickAccess = $('input#showfavoritequickaccessToggle');
+ var showQuickAccess = $('#showFavoriteQuickAccess').val() === "1";
+ this.$showQuickAccess.prop('checked', showQuickAccess);
+
+
if ($('#fileNotFound').val() === "1") {
OC.Notification.show(t('files', 'File could not be found'), {type: 'error'});
}
this._filesConfig = new OC.Backbone.Model({
- showhidden: showHidden
+ showhidden: showHidden,
+ showQuickAccess: showQuickAccess
});
var urlParams = OC.Util.History.parseUrlQuery();
@@ -131,6 +138,7 @@
});
this._debouncedPersistShowHiddenFilesState = _.debounce(this._persistShowHiddenFilesState, 1200);
+ this._debouncedPersistShowQuickAccessState = _.debounce(this._persistShowQuickAccessState, 1200);
},
/**
@@ -205,6 +213,7 @@
$('#app-navigation').on('itemChanged', _.bind(this._onNavigationChanged, this));
this.$showHiddenFiles.on('change', _.bind(this._onShowHiddenFilesChange, this));
+ this.$showQuickAccess.on('change', _.bind(this._onShowQuickAccessChange, this));
},
/**
@@ -230,6 +239,35 @@
});
},
+
+ /**
+ * Toggle showing hidden files according to the settings checkbox
+ *
+ * @returns {undefined}
+ */
+ _onShowQuickAccessChange: function() {
+ var qa = this.$showQuickAccess.is(':checked');
+ this._filesConfig.set('show_quick_access', qa);
+ this._debouncedPersistShowQuickAccessState();
+ },
+
+ /**
+ * Persist show hidden preference on ther server
+ *
+ * @returns {undefined}
+ */
+ _persistShowQuickAccessState: function() {
+ var qa = this._filesConfig.get('show_quick_access');
+ var url="/apps/files/api/v1/hidequickaccess";
+ if(qa){
+ url="/apps/files/api/v1/showquickaccess";
+ }
+
+ $.get(OC.generateUrl(url),function(data, status){
+ });
+ },
+
+
/**
* Event handler for when the current navigation item has changed
*/
diff --git a/apps/files/lib/Controller/ApiController.php b/apps/files/lib/Controller/ApiController.php
index a66b1b4d565..b1af121ed6e 100644
--- a/apps/files/lib/Controller/ApiController.php
+++ b/apps/files/lib/Controller/ApiController.php
@@ -265,4 +265,32 @@ class ApiController extends Controller {
return new Response();
}
+ /**
+ * Toggle default for showing/hiding QuickAccess folder
+ *
+ * @NoAdminRequired
+ *
+ * @param int $value
+ * @return Response
+ */
+ public function showQuickAccess() {
+ $this->config->setUserValue($this->userSession->getUser()->getUID(), 'files', 'show_Quick_Access', 1);
+ return new Response();
+ }
+
+ /**
+ * Toggle default for showing/hiding QuickAccess folder
+ *
+ * @NoAdminRequired
+ *
+ * @param int $value
+ * @return Response
+ */
+ public function hideQuickAccess() {
+ $this->config->setUserValue($this->userSession->getUser()->getUID(), 'files', 'show_Quick_Access', 0);
+ return new Response();
+ }
+
+
+
}
diff --git a/apps/files/lib/Controller/ViewController.php b/apps/files/lib/Controller/ViewController.php
index 7cb0f112f72..54602839eb0 100644
--- a/apps/files/lib/Controller/ViewController.php
+++ b/apps/files/lib/Controller/ViewController.php
@@ -159,6 +159,7 @@ class ViewController extends Controller {
// FIXME: Make non static
$storageInfo = $this->getStorageInfo();
+
\OCA\Files\App::getNavigationManager()->add(
[
'id' => 'favorites',
@@ -169,18 +170,59 @@ class ViewController extends Controller {
]
);
+
+
+ $user = $this->userSession->getUser()->getUID();
+
+ $tagger=\OC::$server->getTagManager();
+
+
+ $helper= new \OCA\Files\Activity\Helper($tagger);
+ $favElements = $helper->getFavoriteFilePaths($this->userSession->getUser()->getUID());
+ $favItems = $favElements['items'];
+
+ $key='show_Quick_Access';
+
+ if($this->config->getUserValue($user,$this->appName,$key,true) && sizeof($favElements['folders'])>0){
+ /*$nav->assign('showQuickAccess', 1);
+ \OCA\Files\App::getNavigationManager()->add(
+ [
+ 'id' => 'Spacer',
+ 'classes' => 'app-navigation-caption',
+ 'order' => 6,
+ 'name' => $this->l10n->t('Quick-Access')
+ ]
+ );*/
+
+ $i=0;
+ foreach($favElements['folders'] as $elem){
+
+ \OCA\Files\App::getNavigationManager()->add(
+ [
+ 'id' => substr( $elem, strrpos($elem,'/')+1, strlen($elem)),
+ 'href' => \OC::$WEBROOT.'/index.php/apps/files/?dir='.$elem,
+ 'order' => 7+$i,
+ 'classes' => 'app-navigation-subelement',
+ 'name' => substr( $elem, strrpos($elem,'/')+1, strlen($elem)),
+ 'icon' => 'files'
+ ]
+ );
+ $i++;
+ }
+ }
+
+
+
$navItems = \OCA\Files\App::getNavigationManager()->getAll();
usort($navItems, function($item1, $item2) {
return $item1['order'] - $item2['order'];
});
- $nav->assign('navigationItems', $navItems);
- $webdavurl = $this->urlGenerator->linkTo('', 'remote.php') .
- '/dav/files/' .
- $this->userSession->getUser()->getUID() .
- '/';
- $webdavurl = $this->urlGenerator->getAbsoluteURL($webdavurl);
- $nav->assign('webdavurl', $webdavurl);
+
+
+
+
+ $nav->assign('navigationItems', $navItems);
$nav->assign('usage', \OC_Helper::humanFileSize($storageInfo['used']));
if ($storageInfo['quota'] === \OCP\Files\FileInfo::SPACE_UNLIMITED) {
@@ -215,7 +257,6 @@ class ViewController extends Controller {
$params['ownerDisplayName'] = $storageInfo['ownerDisplayName'];
$params['isPublic'] = false;
$params['allowShareWithLink'] = $this->config->getAppValue('core', 'shareapi_allow_links', 'yes');
- $user = $this->userSession->getUser()->getUID();
$params['defaultFileSorting'] = $this->config->getUserValue($user, 'files', 'file_sorting', 'name');
$params['defaultFileSortingDirection'] = $this->config->getUserValue($user, 'files', 'file_sorting_direction', 'asc');
$showHidden = (bool) $this->config->getUserValue($this->userSession->getUser()->getUID(), 'files', 'show_hidden', false);
@@ -234,6 +275,7 @@ class ViewController extends Controller {
$policy->addAllowedFrameDomain('\'self\'');
$response->setContentSecurityPolicy($policy);
+
return $response;
}
diff --git a/apps/files/templates/appnavigation.php b/apps/files/templates/appnavigation.php
index c811ace8abe..749f36a44e8 100644
--- a/apps/files/templates/appnavigation.php
+++ b/apps/files/templates/appnavigation.php
@@ -1,19 +1,21 @@
<div id="app-navigation">
<ul class="with-icon">
- <?php $pinned = 0 ?>
+
+ <?php $pinned = 0 ?>
<?php foreach ($_['navigationItems'] as $item) {
strpos($item['classes'], 'pinned')!==false ? $pinned++ : '';
- ?>
- <li data-id="<?php p($item['id']) ?>" class="nav-<?php p($item['id']) ?> <?php p($item['classes']) ?> <?php p($pinned===1?'first-pinned':'') ?>">
- <a href="<?php p(isset($item['href']) ? $item['href'] : '#') ?>"
- class="nav-icon-<?php p($item['icon'] !== '' ? $item['icon'] : $item['id']) ?> svg">
- <?php p($item['name']);?>
- </a>
- </li>
+ ?>
+ <li data-id="<?php p(isset($item['href']) ? $item['href'] : $item['id']) ?>" class="nav-<?php p($item['id']) ?> <?php p($item['classes']) ?> <?php p($pinned===1?'first-pinned':'') ?>">
+ <a href="<?php p(isset($item['href']) ? $item['href'] : '#') ?>"
+ class="nav-icon-<?php p($item['icon'] !== '' ? $item['icon'] : $item['id']) ?> svg">
+ <?php p($item['name']);?>
+ </a>
+ </li>
<?php } ?>
+
<li id="quota" class="pinned <?php p($pinned===0?'first-pinned ':'') ?><?php
if ($_['quota'] !== \OCP\Files\FileInfo::SPACE_UNLIMITED) {
- ?>has-tooltip" title="<?php p($_['usage_relative'] . '%');
+ ?>has-tooltip" title="<?php p($_['usage_relative'] . '%');
} ?>">
<a href="#" class="icon-quota svg">
<p id="quotatext"><?php
@@ -40,9 +42,15 @@
<input class="checkbox" id="showhiddenfilesToggle" checked="checked" type="checkbox">
<label for="showhiddenfilesToggle"><?php p($l->t('Show hidden files')); ?></label>
</div>
+ <!--Removed to disable disabling, but kept to allow easy reenabling-->
+ <!--<div id="files-setting-showFavoriteQuickAccess">
+ <input class="checkbox" id="showfavoritequickaccessToggle" <?php /*if($_['showQuickAccess']){ */?>checked="checked"<?php /*} */?> type="checkbox">
+ <label for="showfavoritequickaccessToggle"><?php /*p($l->t('Enable Favorites Quick Access')); */?></label>
+ </div>-->
<label for="webdavurl"><?php p($l->t('WebDAV'));?></label>
- <input id="webdavurl" type="text" readonly="readonly" value="<?php p($_['webdavurl']); ?>" />
+ <input id="webdavurl" type="text" readonly="readonly" value="<?php p(\OCP\Util::linkToRemote('webdav')); ?>" />
<em><?php print_unescaped($l->t('Use this address to <a href="%s" target="_blank" rel="noreferrer noopener">access your Files via WebDAV</a>', array(link_to_docs('user-webdav'))));?></em>
</div>
</div>
+
</div>