Dashboard for Nextcloud - based on Work from Florian Steffens
Go to the apps folder of your Nextcloud instance and run the following command:
git clone https://github.com/dehnhardt/nc_dashboard.git dashboard
Download the zip. Unzip to the apps folder an then rename the folder to 'dashboard'
currently we use the class Api_1_0.
The following things has to be done to contribute an widget to the dashboard from another app:
/ don't forget the use statements / use \OCA[YourApp]\Widget[YourApp]Controller; use \OCA[YourApp]\Widget[YourApp]Template; .... $container->registerService('widget[YourApp]Controller', function(IContainer $c){ return new OwnNoteController( $c->query('AppName'), $c->query('Request') ); });'
'$container->registerService('widget[YourApp]Template', function(IContainer $c){
return new OwnNoteTemplate(
$c->query('AppName'),
$c->query('Request')
);
});
- Modify your appinfo/app.php to specify your widget parameters and call the api function
```php
/* instantiate an array */
$widget = array();
/*
*required*
use the app-name if your app provides only one widget
use any other describing name if your app provides more than one widget*/
$widget['wId'] = '[yourapp]';
/*
*required*
again the app name
*/
$widget['appName'] = '[yourapp]';
/*
*required*
the registered name of the widget controller
*/
$widget['controllerServiceName'] = 'widget[YourApp]Controller';
/*
*required*
the registered name of the widget template
*/
$widget['templateServiceName'] = 'widget[YourApp]Template';
/*
*required*, default: 1
The version of YOUR widget, don't forget increment it if you change any of these parameters
In incremented version triggern an update of the stored values
*/
$widget['version'] = 1;
/*
*optional*, default: empty
this is the link which is behind the headline of your widget, you can either link to your app (use the full path: /index.php/apps/[yourapp]/) or to any other internal or external page
No link is created if this parameter is omitted
*/
$widget['link'] = '/index.php/apps/ownnote/';
/*
*optional*, default: false
In the admin settings you can toggle the availability for each widget and each group. If this parameter is set to true, the widget is available for all groups, otherwise the admin has to enable the widget for each group manually
*/
$widget['enableDefault'] = true;
/*
*optional* default: empty
provide the pathes to aditional cascading style sheets as an array.
Omit the path to your app directory, this will automativally be added.
*/
$widget['css'] = array('widget/one_file');
/*
*optional* default: empty
provide the pathes to your javascript files as an array. .
Omit the path to your app directory, this will automativally be added.
*/
$widget['js'] = array('widget/one_file', 'widget/another_file');
/*end of parameters*/
$app = new \OCA\Dashboard\AppInfo\Application();
$container = $app->getContainer();
$api = $container->query('Api_1_0');
$api->addWidget($widget);