Merge pull request #62 from nextcloud/enh/allow_reloading_results

Enh/allow reloading results
This commit is contained in:
Roeland Jago Douma 2019-08-30 20:42:05 +02:00 committed by GitHub
commit 9645462348
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 19 additions and 11 deletions

View file

@ -29,6 +29,7 @@ return [
['name' => 'page#create_form', 'url' => '/new', 'verb' => 'GET'],
['name' => 'page#edit_form', 'url' => '/edit/{hash}', 'verb' => 'GET'],
['name' => 'page#clone_form', 'url' => '/clone/{hash}', 'verb' => 'GET'],
['name' => 'page#getResult', 'url' => '/results/{id}', 'verb' => 'GET'],
['name' => 'page#delete_form', 'url' => '/delete', 'verb' => 'POST'],
['name' => 'page#insert_vote', 'url' => '/insert/vote', 'verb' => 'POST'],

View file

@ -1,4 +1,5 @@
<?php
declare(strict_types=1);
/**
* @copyright Copyright (c) 2017 Vinzenz Rosenkranz <vinzenz.rosenkranz@gmail.com>
*
@ -23,14 +24,10 @@
namespace OCA\Forms\AppInfo;
use OCA\Forms\Controller\PageController;
use OCA\Forms\Controller\ApiController;
use OCA\Forms\Db\OptionMapper;
use OCA\Forms\Db\EventMapper;
use OCA\Forms\Db\NotificationMapper;
use OCA\Forms\Db\VoteMapper;
use OCP\AppFramework\App;
use OCP\IContainer;
use OCP\IL10N;
use OCP\INavigationManager;
use OCP\IURLGenerator;
class Application extends App {
@ -45,11 +42,11 @@ class Application extends App {
/**
* Register navigation entry for main navigation.
*/
public function registerNavigationEntry() {
public function registerNavigationEntry(): void {
$container = $this->getContainer();
$container->query('OCP\INavigationManager')->add(function() use ($container) {
$urlGenerator = $container->query('OCP\IURLGenerator');
$l10n = $container->query('OCP\IL10N');
$container->query(INavigationManager::class)->add(function() use ($container) {
$urlGenerator = $container->query(IURLGenerator::class);
$l10n = $container->query(IL10N::class);
return [
'id' => 'forms',
'order' => 77,

View file

@ -570,4 +570,14 @@ class PageController extends Controller {
Util::writeLog('forms', $this->userId, Util::ERROR);
return false;
}
/**
* @NoAdminRequired
* @NoCSRFRequired
* @param int $id
* @return TemplateResponse
*/
public function getResult(int $id): TemplateResponse {
return new TemplateResponse('forms', 'forms.tmpl');
}
}