diff --git a/admin.php b/admin.php
index 05d5053a..aac0984b 100644
--- a/admin.php
+++ b/admin.php
@@ -40,7 +40,7 @@
}
$template = new Template('survey_client', 'admin');
-$template->assign('is_enabled', \OC::$server->getJobList()->has('OCA\Survey_Client\MonthlyReport', null));
+$template->assign('is_enabled', \OC::$server->getJobList()->has('OCA\Survey_Client\BackgroundJobs\MonthlyReport', null));
$template->assign('last_sent', $lastSentReportDate);
$template->assign('last_report', $lastReport);
$template->assign('categories', $collector->getCategories());
diff --git a/appinfo/info.xml b/appinfo/info.xml
index 2a3ee406..e7f55400 100644
--- a/appinfo/info.xml
+++ b/appinfo/info.xml
@@ -7,6 +7,7 @@
always have full control over he content send to Nextcloud and can disable
it again at any time.
+ Survey_ClientAGPLJoas Schilling, Björn Schiessle0.1.5
diff --git a/appinfo/install.php b/appinfo/install.php
index 0608a2bd..10205316 100644
--- a/appinfo/install.php
+++ b/appinfo/install.php
@@ -19,6 +19,6 @@
*
*/
-if (!\OC::$server->getJobList()->has('OCA\Survey_Client\MonthlyReport', null)) {
- \OC::$server->getJobList()->add('OCA\Survey_Client\AdminNotification');
+if (!\OC::$server->getJobList()->has('OCA\Survey_Client\BackgroundJobs\MonthlyReport', null)) {
+ \OC::$server->getJobList()->add('OCA\Survey_Client\BackgroundJobs\AdminNotification');
}
diff --git a/appinfo/update.php b/appinfo/update.php
index 0608a2bd..10205316 100644
--- a/appinfo/update.php
+++ b/appinfo/update.php
@@ -19,6 +19,6 @@
*
*/
-if (!\OC::$server->getJobList()->has('OCA\Survey_Client\MonthlyReport', null)) {
- \OC::$server->getJobList()->add('OCA\Survey_Client\AdminNotification');
+if (!\OC::$server->getJobList()->has('OCA\Survey_Client\BackgroundJobs\MonthlyReport', null)) {
+ \OC::$server->getJobList()->add('OCA\Survey_Client\BackgroundJobs\AdminNotification');
}
diff --git a/css/admin.css b/css/admin.css
index fac7de08..a54414fb 100644
--- a/css/admin.css
+++ b/css/admin.css
@@ -1,4 +1,8 @@
#survey_client textarea {
- height: 400px;
+ height: 150px;
width: 300px;
}
+
+#survey_client button {
+ margin: 20px 0;
+}
diff --git a/js/admin.js b/js/admin.js
index dbecd8c6..8f5da934 100644
--- a/js/admin.js
+++ b/js/admin.js
@@ -6,7 +6,7 @@ $(document).ready(function() {
OC.AppConfig.postCall('setValue', {
app: 'survey_client',
- key: $(this).attr('name').substring(24),
+ key: $(this).attr('name').substring(14),
value: $(this).attr('checked') ? 'yes' : 'no'
}, function() {
$button.attr('disabled', false);
diff --git a/appinfo/application.php b/lib/AppInfo/Application.php
similarity index 100%
rename from appinfo/application.php
rename to lib/AppInfo/Application.php
diff --git a/adminnotification.php b/lib/BackgroundJobs/AdminNotification.php
similarity index 96%
rename from adminnotification.php
rename to lib/BackgroundJobs/AdminNotification.php
index 4e225be5..5aeeb518 100644
--- a/adminnotification.php
+++ b/lib/BackgroundJobs/AdminNotification.php
@@ -19,7 +19,7 @@
*
*/
-namespace OCA\Survey_Client;
+namespace OCA\Survey_Client\BackgroundJobs;
use OC\BackgroundJob\QueuedJob;
@@ -33,7 +33,7 @@ protected function run($argument) {
->setDateTime(new \DateTime())
->setSubject('updated')
->setObject('dummy', 23)
- ->setLink($urlGenerator->getAbsoluteURL('index.php/settings/admin#goto-usage-report'));
+ ->setLink($urlGenerator->getAbsoluteURL('index.php/settings/admin#usage-report'));
$enableAction = $notification->createAction();
$enableAction->setLabel('enable')
diff --git a/monthlyreport.php b/lib/BackgroundJobs/MonthlyReport.php
similarity index 96%
rename from monthlyreport.php
rename to lib/BackgroundJobs/MonthlyReport.php
index d05f8658..ccb0cc1b 100644
--- a/monthlyreport.php
+++ b/lib/BackgroundJobs/MonthlyReport.php
@@ -19,7 +19,7 @@
*
*/
-namespace OCA\Survey_Client;
+namespace OCA\Survey_Client\BackgroundJobs;
use OC\BackgroundJob\TimedJob;
use OCA\Survey_Client\AppInfo\Application;
diff --git a/categories/apps.php b/lib/Categories/Apps.php
similarity index 97%
rename from categories/apps.php
rename to lib/Categories/Apps.php
index 5d527877..b5b33334 100644
--- a/categories/apps.php
+++ b/lib/Categories/Apps.php
@@ -58,7 +58,7 @@ public function getCategory() {
* @return string
*/
public function getDisplayName() {
- return (string) $this->l->t('App list (For each app: name, version, is enabled?)');
+ return (string) $this->l->t('App list (for each app: name, version, is enabled?)');
}
/**
diff --git a/categories/database.php b/lib/Categories/Database.php
similarity index 98%
rename from categories/database.php
rename to lib/Categories/Database.php
index 891f0e22..fe2d4c12 100644
--- a/categories/database.php
+++ b/lib/Categories/Database.php
@@ -63,7 +63,7 @@ public function getCategory() {
* @return string
*/
public function getDisplayName() {
- return (string) $this->l->t('Database Environment (type, version, database size)');
+ return (string) $this->l->t('Database environment (type, version, database size)');
}
/**
diff --git a/categories/encryption.php b/lib/Categories/Encryption.php
similarity index 100%
rename from categories/encryption.php
rename to lib/Categories/Encryption.php
diff --git a/categories/files_sharing.php b/lib/Categories/FilesSharing.php
similarity index 98%
rename from categories/files_sharing.php
rename to lib/Categories/FilesSharing.php
index 939b3734..16164d85 100644
--- a/categories/files_sharing.php
+++ b/lib/Categories/FilesSharing.php
@@ -26,11 +26,11 @@
use OCP\IL10N;
/**
- * Class Files_Sharing
+ * Class FilesSharing
*
* @package OCA\Survey_Client\Categories
*/
-class Files_Sharing implements ICategory {
+class FilesSharing implements ICategory {
/** @var IDBConnection */
protected $connection;
diff --git a/categories/icategory.php b/lib/Categories/ICategory.php
similarity index 100%
rename from categories/icategory.php
rename to lib/Categories/ICategory.php
diff --git a/categories/php.php b/lib/Categories/Php.php
similarity index 95%
rename from categories/php.php
rename to lib/Categories/Php.php
index f3e96362..cd30ab45 100644
--- a/categories/php.php
+++ b/lib/Categories/Php.php
@@ -30,7 +30,7 @@
*
* @package OCA\Survey_Client\Categories
*/
-class php implements ICategory {
+class Php implements ICategory {
/** @var IniGetWrapper */
protected $phpIni;
@@ -57,7 +57,7 @@ public function getCategory() {
* @return string
*/
public function getDisplayName() {
- return (string) $this->l->t('php Environment (version, memory limit, max. execution time, max. file size)');
+ return (string) $this->l->t('PHP environment (version, memory limit, max. execution time, max. file size)');
}
/**
diff --git a/categories/owncloud.php b/lib/Categories/Server.php
similarity index 89%
rename from categories/owncloud.php
rename to lib/Categories/Server.php
index 8c5d702a..c3307a19 100644
--- a/categories/owncloud.php
+++ b/lib/Categories/Server.php
@@ -26,11 +26,11 @@
use OCP\IL10N;
/**
- * Class OwnCloud
+ * Class Server
*
* @package OCA\Survey_Client\Categories
*/
-class OwnCloud implements ICategory {
+class Server implements ICategory {
/** @var \OCP\IConfig */
protected $config;
@@ -50,14 +50,14 @@ public function __construct(IConfig $config, IL10N $l) {
* @return string
*/
public function getCategory() {
- return 'owncloud';
+ return 'server';
}
/**
* @return string
*/
public function getDisplayName() {
- return (string) $this->l->t('ownCloud Instance Details (version, theme, memcache used, locking/previews/avatars enabled?)');
+ return (string) $this->l->t('Server instance details (version, memcache used, locking/previews/avatars enabled?)');
}
/**
@@ -66,7 +66,6 @@ public function getDisplayName() {
public function getData() {
return [
'version' => $this->config->getSystemValue('version'),
- 'theme' => $this->config->getSystemValue('theme', 'none'),
'code' => $this->codeLocation(),
'enable_avatars' => $this->config->getSystemValue('enable_avatars', true) ? 'yes' : 'no',
'enable_previews' => $this->config->getSystemValue('enable_previews', true) ? 'yes' : 'no',
diff --git a/categories/stats.php b/lib/Categories/Stats.php
similarity index 100%
rename from categories/stats.php
rename to lib/Categories/Stats.php
diff --git a/collector.php b/lib/Collector.php
similarity index 90%
rename from collector.php
rename to lib/Collector.php
index 9b2f33e2..89e4a4d6 100644
--- a/collector.php
+++ b/lib/Collector.php
@@ -25,10 +25,10 @@
use OCA\Survey_Client\Categories\Apps;
use OCA\Survey_Client\Categories\Database;
use OCA\Survey_Client\Categories\Encryption;
-use OCA\Survey_Client\Categories\Files_Sharing;
+use OCA\Survey_Client\Categories\FilesSharing;
use OCA\Survey_Client\Categories\ICategory;
-use OCA\Survey_Client\Categories\OwnCloud;
-use OCA\Survey_Client\Categories\php;
+use OCA\Survey_Client\Categories\Php;
+use OCA\Survey_Client\Categories\Server;
use OCA\Survey_Client\Categories\Stats;
use OCP\AppFramework\Http;
use OCP\Http\Client\IClientService;
@@ -38,7 +38,7 @@
class Collector {
- const SURVEY_SERVER_URL = 'http://localhost/ownCloud/master/core/';
+ const SURVEY_SERVER_URL = 'https://surveyserver.nextcloud.com/';
/** @var ICategory[] */
protected $categories;
@@ -76,7 +76,7 @@ public function __construct(IClientService $clientService, IConfig $config, IDBC
}
protected function registerCategories() {
- $this->categories[] = new OwnCloud(
+ $this->categories[] = new Server(
$this->config,
$this->l
);
@@ -97,7 +97,7 @@ protected function registerCategories() {
$this->connection,
$this->l
);
- $this->categories[] = new Files_Sharing(
+ $this->categories[] = new FilesSharing(
$this->connection,
$this->l
);
@@ -157,8 +157,6 @@ public function sendReport() {
$report = $this->getReport();
$client = $this->clientService->newClient();
- $this->config->setAppValue('survey_client', 'last_sent', time());
- $this->config->setAppValue('survey_client', 'last_report', json_encode($report));
try {
$response = $client->post(self::SURVEY_SERVER_URL . 'ocs/v2.php/apps/survey_server/api/v1/survey', [
@@ -175,6 +173,8 @@ public function sendReport() {
}
if ($response->getStatusCode() === Http::STATUS_OK) {
+ $this->config->setAppValue('survey_client', 'last_sent', time());
+ $this->config->setAppValue('survey_client', 'last_report', json_encode($report));
return new \OC_OCS_Result(
$report,
100// HTTP::STATUS_OK, TODO: failure200
diff --git a/controller/endpointcontroller.php b/lib/Controller/EndpointController.php
similarity index 93%
rename from controller/endpointcontroller.php
rename to lib/Controller/EndpointController.php
index 0e81f6d5..6b21ddfd 100644
--- a/controller/endpointcontroller.php
+++ b/lib/Controller/EndpointController.php
@@ -58,7 +58,7 @@ public function __construct($appName, IRequest $request, Collector $collector, I
* @return \OC_OCS_Result
*/
public function enableMonthly() {
- $this->jobList->add('OCA\Survey_Client\MonthlyReport');
+ $this->jobList->add('OCA\Survey_Client\BackgroundJobs\MonthlyReport');
$notification = $this->manager->createNotification();
$notification->setApp('survey_client');
@@ -71,7 +71,7 @@ public function enableMonthly() {
* @return \OC_OCS_Result
*/
public function disableMonthly() {
- $this->jobList->remove('OCA\Survey_Client\MonthlyReport');
+ $this->jobList->remove('OCA\Survey_Client\BackgroundJobs\MonthlyReport');
$notification = $this->manager->createNotification();
$notification->setApp('survey_client');
diff --git a/notifier.php b/lib/Notifier.php
similarity index 83%
rename from notifier.php
rename to lib/Notifier.php
index ad054d69..995551fc 100644
--- a/notifier.php
+++ b/lib/Notifier.php
@@ -54,13 +54,14 @@ public function prepare(INotification $notification, $languageCode) {
// Read the language from the notification
$l = $this->l10nFactory->get('survey_client', $languageCode);
- $notification->setParsedSubject((string) $l->t('Do you want to send monthly usage statistics to ownCloud?'));
+ $notification->setParsedSubject((string) $l->t(
+ 'Do you want to help us to improve Nextcloud by providing some anonymized data about your setup and usage? You can disable it at any time in the admin settings again.'));
foreach ($notification->getActions() as $action) {
- if ($action->getLabel() === 'enable') {
- $action->setParsedLabel((string) $l->t('Yes'));
- } else if ($action->getLabel() === 'disable') {
+ if ($action->getLabel() === 'disable') {
$action->setParsedLabel((string) $l->t('Not now'));
+ } else if ($action->getLabel() === 'enable') {
+ $action->setParsedLabel((string) $l->t('Send usage'));
}
$notification->addParsedAction($action);
}
diff --git a/templates/admin.php b/templates/admin.php
index 033d8284..9e909ad3 100644
--- a/templates/admin.php
+++ b/templates/admin.php
@@ -26,7 +26,11 @@
t('Usage report')); ?>
- t('When the server receives a new report of your instance, all entries from previous reports are removed. So in case you disable one of the settings below, you can send a new report, to delete the data, that is currently stored on the server.')); ?>
+ t('You can help us to improve Nextcloud be sending us some data about your current setup and usage.')); ?>
+
+
+
+ t('We take your privacy seriously. The data are anonymized and you can enable/disable it at any time, by default it is always disabled. Below you can also adjust what kind of data are send and always see the last report send to us. When the server receives a new report of your instance, all entries from previous reports are removed. In case you disable one of the settings below, you can send a new report, to delete the data, that is currently stored on the server.')); ?>