Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions js/admin.js
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,9 @@
_.each(this._sites.models, function(site) {
var $el = $(self._renderSite(site.attributes));
self._attachEvents($el);
if (site.attributes.type === 'guest') {
$el.find('.site-redirect-box').hide();
}
self.$list.append($el);
});
},
Expand Down Expand Up @@ -232,6 +235,11 @@

$site.removeClass('failure saved').addClass('saving');
$site.find('.invalid-value').removeClass('invalid-value');
if (data.type === 'guest') {
$site.find('.site-redirect-box').hide();
} else {
$site.find('.site-redirect-box').show();
}

if (!_.isUndefined(site)) {
site.save(data, {
Expand Down
2 changes: 1 addition & 1 deletion lib/AppInfo/Application.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public function register() {
*/
public function registerNavigationEntries(IServerContainer $server, array $sites) {
foreach ($sites as $id => $site) {
if ($site['type'] !== SitesManager::TYPE_LINK && $site['type'] !== SitesManager::TYPE_SETTING) {
if ($site['type'] !== SitesManager::TYPE_LINK && $site['type'] !== SitesManager::TYPE_SETTING && $site['type'] !== SitesManager::TYPE_LOGIN ) {
continue;
}

Expand Down
2 changes: 2 additions & 0 deletions lib/Controller/APIController.php
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,8 @@ public function getAdmin() {
['type' => SitesManager::TYPE_LINK, 'name' => $this->l->t('Header')],
['type' => SitesManager::TYPE_SETTING, 'name' => $this->l->t('Setting menu')],
['type' => SitesManager::TYPE_QUOTA, 'name' => $this->l->t('User quota')],
['type' => SitesManager::TYPE_LOGIN, 'name' => $this->l->t('Public footer')],

Comment thread
juliusknorr marked this conversation as resolved.
Outdated
];

$devices = [
Expand Down
13 changes: 11 additions & 2 deletions lib/SitesManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
use OCP\Files\SimpleFS\ISimpleFile;
use OCP\IConfig;
use OCP\IGroupManager;
use OCP\INavigationManager;
use OCP\IRequest;
use OCP\IUser;
use OCP\IUserSession;
Expand Down Expand Up @@ -237,7 +238,7 @@ public function addSite($name, $url, $lang, $type, $device, $icon, array $groups
}
}

if (!in_array($type, [self::TYPE_LINK, self::TYPE_SETTING, self::TYPE_QUOTA], true)) {
if (!in_array($type, [self::TYPE_LINK, self::TYPE_SETTING, self::TYPE_QUOTA, INavigationManager::TYPE_GUEST], true)) {
throw new InvalidTypeException();
}

Expand All @@ -259,6 +260,10 @@ public function addSite($name, $url, $lang, $type, $device, $icon, array $groups
throw new IconNotFoundException();
}

if ($type === INavigationManager::TYPE_GUEST) {
$redirect = true;
}

$sites = $this->getSites();
$sites[$id] = [
'id' => $id,
Expand Down Expand Up @@ -326,7 +331,7 @@ public function updateSite($id, $name, $url, $lang, $type, $device, $icon, array
}
}

if (!in_array($type, [self::TYPE_LINK, self::TYPE_SETTING, self::TYPE_QUOTA], true)) {
if (!in_array($type, [self::TYPE_LINK, self::TYPE_SETTING, self::TYPE_QUOTA, INavigationManager::TYPE_GUEST], true)) {
throw new InvalidTypeException();
}

Expand All @@ -348,6 +353,10 @@ public function updateSite($id, $name, $url, $lang, $type, $device, $icon, array
throw new IconNotFoundException();
}

if ($type === INavigationManager::TYPE_GUEST) {
$redirect = true;
}

$sites[$id] = [
'id' => $id,
'name' => $name,
Expand Down