Skip to content

Commit

Permalink
Merge pull request #2 from nextcloud/edit-circles-files-panel
Browse files Browse the repository at this point in the history
moving files/methods around
  • Loading branch information
viniciuscb authored Oct 22, 2017
2 parents b39762f + d9a1994 commit 200422b
Show file tree
Hide file tree
Showing 14 changed files with 293 additions and 272 deletions.
3 changes: 2 additions & 1 deletion appinfo/app.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,9 @@

$app = new \OCA\Circles\AppInfo\Application();

$app->registerNavigation();
$app->registerSettingsAdmin();
$app->registerNavigation();
$app->registerFilesNavigation();
$app->registerFilesPlugin();


39 changes: 0 additions & 39 deletions css/circles.filelist.css

This file was deleted.

54 changes: 54 additions & 0 deletions css/files/circles.filelist.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
/*
* Circles - Bring cloud-users closer together.
*
* This file is licensed under the Affero General Public License version 3 or
* later. See the COPYING file.
*
* @author Maxence Lange <[email protected]>
* @copyright 2017
* @license GNU AGPL version 3 or any later version
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
#app-content-circlesfilter .select2-container {
width: 30%;
margin-left: 10px;
}

#app-content-circlesfilter .select2-choices {
white-space: nowrap;
text-overflow: ellipsis;
background: #fff;
color: #555;
box-sizing: content-box;
border-radius: 3px;
border: 1px solid #ddd;
padding: 0;
min-height: auto;
}

.nav-icon-circlesfilter {
background-image: url('../../img/black_circle.svg');
}

#app-sidebar .mainFileInfoView .tag-label {
cursor: pointer;
padding: 13px;
}

#app-sidebar .mainFileInfoView .icon-tag {
opacity: .5;
vertical-align: middle;
}
6 changes: 6 additions & 0 deletions files/list.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?php

OCP\User::checkLoggedIn();

$tmpl = new OCP\Template('circles', 'files/list', '');
$tmpl->printPage();
File renamed without changes.
30 changes: 21 additions & 9 deletions js/circles.files.list.js → js/files/circles.files.list.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,25 @@
/*
* Copyright (c) 2017 EITA Cooperative
* Circles - Bring cloud-users closer together.
*
* @author Vinicius Brand <[email protected]>
* @author Daniel Tygel <[email protected]>
* This file is licensed under the Affero General Public License version 3 or
* later. See the COPYING file.
*
* This file is licensed under the Affero General Public License version 3
* or later.
* @author Maxence Lange <[email protected]>
* @copyright 2017
* @license GNU AGPL version 3 or any later version
*
* See the COPYING-README file.
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
(function() {
Expand Down Expand Up @@ -146,7 +158,7 @@
return m;
},
formatNoMatches: function() {
return t('systemtags', 'No tags found');
return t('systemtags', 'No circles found');
}
});
this.$filterField.on('change', _.bind(this._onTagsChanged, this));
Expand Down Expand Up @@ -211,11 +223,11 @@
if (!this._circlesIds.length) {
// no tags selected
this.$el.find('#emptycontent').html('<div class="icon-systemtags"></div>' +
'<h2>' + t('systemtags', 'Please select tags to filter by') + '</h2>');
'<h2>' + t('systemtags', 'Please select circles to filter by') + '</h2>');
} else {
// tags selected but no results
this.$el.find('#emptycontent').html('<div class="icon-systemtags"></div>' +
'<h2>' + t('systemtags', 'No files found for the selected tags') + '</h2>');
'<h2>' + t('systemtags', 'No files found for the selected circles') + '</h2>');
}
this.$el.find('#emptycontent').toggleClass('hidden', !this.isEmpty);
this.$el.find('#filestable thead th').toggleClass('hidden', this.isEmpty);
Expand Down
18 changes: 5 additions & 13 deletions lib/Api/v1/Circles.php
Original file line number Diff line number Diff line change
Expand Up @@ -452,24 +452,16 @@ public static function generateCircleParameter(SharingFrame $frame) {
/**
* Get a list of objects which are shred with $circleUniqueId.
*
* @param string|array $tagIds Tag id or array of tag ids.
* @param string $objectType object type
* @param int $limit Count of object ids you want to get
* @param string $offset The last object id you already received
* @since 0.14.0
*
* @return string[] array of object ids or empty array if none found
*
* @throws \OCP\SystemTag\TagNotFoundException if at least one of the
* given tags does not exist
* @throws \InvalidArgumentException When a limit is specified together with
* multiple tag ids
* @param array $circleUniqueIds
*
* @since 9.0.0
* @return string[] array of object ids or empty array if none found
*/
public static function getObjectIdsForCircles($circleUniqueIds) {
public static function getFilesForCircles($circleUniqueIds) {
$c = self::getContainer();

return $c->query(CirclesService::class)
->getObjectIdsForCircles($circleUniqueIds);
->getFilesForCircles($circleUniqueIds);
}
}
138 changes: 55 additions & 83 deletions lib/AppInfo/Application.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,33 +29,13 @@

namespace OCA\Circles\AppInfo;

use OCA\Circles\Controller\FederatedController;
use OCA\Circles\Controller\GroupsController;
use OCA\Circles\Controller\NavigationController;
use OCA\Circles\Controller\CirclesController;
use OCA\Circles\Controller\MembersController;


use OCA\Circles\Controller\SettingsController;
use OCA\Circles\Controller\SharesController;
use OCA\Circles\Db\CirclesRequest;
use OCA\Circles\Db\FederatedLinksRequest;
use OCA\Circles\Db\MembersRequest;
use OCA\Circles\Events\UserEvents;
use OCA\Circles\Service\BroadcastService;
use OCA\Circles\Service\CirclesService;
use OCA\Circles\Service\EventsService;
use OCA\Circles\Service\FederatedLinkService;
use OCA\Circles\Service\GroupsService;
use OCA\Circles\Service\MembersService;
use OCA\Circles\Service\ConfigService;
use OCA\Circles\Service\MiscService;
use OCA\Circles\Service\SearchService;
use OCA\Circles\Service\SharingFrameService;
use OCA\Circles\Api\v1\Circles;
use OCA\Files\App as FilesApp;
use OCP\AppFramework\App;
use OCP\AppFramework\IAppContainer;
use OCP\Util;


class Application extends App {

const APP_NAME = 'circles';
Expand All @@ -65,17 +45,18 @@ class Application extends App {

const CLIENT_TIMEOUT = 3;

/** @var IAppContainer */
private $container;

/**
* @param array $params
*/
public function __construct(array $params = array()) {
parent::__construct(self::APP_NAME, $params);

$container = $this->getContainer();
$this->container = $this->getContainer();

// TODO: POURQUOI SELF:: ??!??
self::registerEvents($container);
self::registerHooks();
$this->registerHooks();
}


Expand All @@ -92,59 +73,32 @@ public function registerHooks() {
}


/**
* Register Events
*
* @param IAppContainer $container
*/
public function registerEvents(IAppContainer $container) {
// $container->registerService(
// 'UserEvents', function(IAppContainer $c) {
// return new UserEvents(
// $c->query('MembersService'), $c->query('GroupsService'), $c->query('MiscService')
// );
// }
// );
}


/**
* Register Navigation elements
*/
public function registerNavigation() {
// Register Navigation Tab
$this->getContainer()
->getServer()
->getNavigationManager()
->add(
function() {
$urlGen = \OC::$server->getURLGenerator();
$navName = \OC::$server->getL10N(self::APP_NAME)
->t('Circles');

return [
'id' => self::APP_NAME,
'order' => 5,
'href' => $urlGen->linkToRoute('circles.Navigation.navigate'),
'icon' => $urlGen->imagePath(self::APP_NAME, 'circles.svg'),
'name' => $navName
];
}
);

// Register Navigation in FileList
\OCA\Files\App::getNavigationManager()->add(function () {
$l = \OC::$server->getL10N('circles');
return [
'id' => 'circlesfilter',
'appname' => 'circles',
'script' => 'list.php',
'order' => 25,
'name' => $l->t('Circles'),
];
});

$appManager = $this->container->getServer()
->getNavigationManager();
$appManager->add(
function() {
$urlGen = \OC::$server->getURLGenerator();
$navName = \OC::$server->getL10N(self::APP_NAME)
->t('Circles');

return [
'id' => self::APP_NAME,
'order' => 5,
'href' => $urlGen->linkToRoute('circles.Navigation.navigate'),
'icon' => $urlGen->imagePath(self::APP_NAME, 'circles.svg'),
'name' => $navName
];
}
);

}


public function registerSettingsAdmin() {
\OCP\App::registerAdmin(self::APP_NAME, 'lib/admin');
}
Expand All @@ -154,19 +108,37 @@ public function registerFilesPlugin() {
$eventDispatcher->addListener(
'OCA\Files::loadAdditionalScripts',
function() {
// FIXME: no public API for these ?
\OCP\Util::addScript('circles', 'circles.v1.circles');
\OCP\Util::addScript('circles', 'circles.v1.links');
\OCP\Util::addScript('circles', 'circles.v1.members');
\OCP\Util::addScript('circles', 'circles.v1');
Circles::addJavascriptAPI();

Util::addScript('circles', 'files/circles.files.app');
Util::addScript('circles', 'files/circles.files.list');

Util::addStyle('circles', 'files/circles.filelist');
}
);
}

\OCP\Util::addScript('circles', 'circles.files.app');
\OCP\Util::addScript('circles', 'circles.files.list');

\OCP\Util::addStyle('circles');
\OCP\Util::addStyle('circles', 'circles.filelist');
/**
*
*/
public function registerFilesNavigation() {

$appManager = FilesApp::getNavigationManager();
$appManager->add(
function() {
$l = \OC::$server->getL10N('circles');

return [
'id' => 'circlesfilter',
'appname' => 'circles',
'script' => 'files/list.php',
'order' => 25,
'name' => $l->t('Shared to Circles'),
];
}
);
}

}

Loading

0 comments on commit 200422b

Please sign in to comment.