Browse Source

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>
tags/v14.0.0beta1
fnuesse 6 years ago
parent
commit
72ace9697c
No account linked to committer's email address

+ 10
- 0
apps/files/appinfo/routes.php View File

@@ -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',
],
]
]
);

+ 39
- 1
apps/files/js/app.js View File

@@ -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
*/

+ 28
- 0
apps/files/lib/Controller/ApiController.php View File

@@ -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();
}



}

+ 50
- 8
apps/files/lib/Controller/ViewController.php View File

@@ -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;
}


+ 18
- 10
apps/files/templates/appnavigation.php View File

@@ -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>

+ 36
- 0
core/css/apps.scss View File

@@ -584,6 +584,41 @@ kbd {
.app-navigation-entry-menu ul {
list-style-type: none;
}

.app-navigation-caption {
font-weight: bold;
line-height: 44px;
white-space: nowrap;
text-overflow: ellipsis;
float: left;
margin-left:10px;
margin-top:10px;
margin-bottom:10px;
//Make the Link in the spacer not selectable and prevent mouseevents
-moz-user-select: -moz-none;
-khtml-user-select: none;
-webkit-user-select: none;
-o-user-select: none;
user-select: none;
pointer-events:none;
}

.app-navigation-subelement {
line-height: 24px;
white-space: nowrap;
text-overflow: ellipsis;
float: left;
padding-left: 14px;
& a {
//Overrides normal size for smaller subelements
line-height: 24px;
min-height: 24px;
//Removes the double border on the a element
&:visited { box-shadow:none;}
&:hover { box-shadow:none;}
&:active {box-shadow:none; }
}
}
}

/* APP-CONTENT ---------------------------------------------------------------*/
@@ -691,6 +726,7 @@ kbd {
background-color: var(--color-main-background);
}


.settings-button {
display: block;
height: 44px;

Loading…
Cancel
Save