Permalink
Browse files

Usage reporting management

  • Loading branch information...
ginatrapani committed Nov 8, 2011
1 parent ef067f3 commit 728867ff520ff9fd40e5dedbb6e3a46ea2feda21
View
@@ -0,0 +1,44 @@
+Core Development Team
+======================
+
+ThinkUp development is funded by Expert Labs, a non-profit startup that helps government be more effective by tapping
+in to the power of social networks.
+
+Expert Labs
+-----------
+
+**Gina Trapani** started building ThinkUp in the summer of 2009 as a personal weekend project. Today, she is a
+Project Director at Expert Labs, leading application development.
+
+* `ginatrapani on GitHub <https://github.com/ginatrapani>`_
+* `@ginatrapani on Twitter <https://twitter.com/ginatrapani>`_
+* `+Gina Trapani on Google+ <https://plus.google.com/113612142759476883204>`_
+
+**Mark Wilkie** joined Expert Labs in May of 2010 as a lead developer and application architect. `See Mark's ThinkUp
+contributions <https://github.com/ginatrapani/ThinkUp/commits/master?author=mwilkie>`_.
+
+* `mwilkie on GitHub <https://github.com/mwilkie>`_
+* `@mwilkie on Twitter <https://twitter.com/mwilkie>`_
+
+**Anil Dash** founded Expert Labs in January of 2010, and is responsible for ThinkUp's look and feel. `See Anil's ThinkUp
+contributions <https://github.com/ginatrapani/ThinkUp/commits/master?author=anildash>`_.
+
+* `anildash on GitHub <https://github.com/anildash>`_
+* `@anildash on Twitter <https://twitter.com/anildash>`_
+* `+Anil Dash on Google+ <https://plus.google.com/103012564142649561853/>`_
+* `Anil Dash on Facebook <https://www.facebook.com/anil.dash>`_
+
+**Andy Baio** joined Expert Labs in November of 2010, and is responsible for data analysis and visualization.
+`See Andy's ThinkUp contributions <https://github.com/ginatrapani/ThinkUp/commits/master?author=waxpancake>`_.
+
+* `waxpancake on GitHub <https://github.com/waxpancake>`_
+* `@waxpancake on Twitter <https://twitter.com/waxpancake>`_
+* `+Andy Baio on Google+ <https://plus.google.com/103765655241162838230/>`_
+
+Community
+---------
+
+The core development team works with a growing community of volunteer and third-party contributors, some of whom are
+paid by their employer or through open source programs.
+
+`See ThinkUp's full list of contributors <https://github.com/ginatrapani/ThinkUp/contributors>`_.
View
@@ -28,3 +28,4 @@ engine.
contact
contribute/index
changelog
+ core
@@ -36,13 +36,6 @@ Check this box if you don't want to allow users to
:doc:`embed ThinkUp threads on third-party web sites </userguide/listings/all/post_listings>` using a JavaScript
embed code. When this box is checked, the code will not be available for use.
-Developer Log
--------------
-
-Check this box if you want to see the :doc:`verbose, unformatted developer
-log </troubleshoot/common/advanced/crawlerlog>` on the "Update Now" screen, instead of the quieter, formatted user log.
-Once you change this setting, go back to the Dashboard and click on "Update Now" to see the change in action.
-
Default service user
--------------------
@@ -53,6 +46,33 @@ successfully.
If you set this to a public service user which becomes private, this setting will fall back to its default, the last
updated service user.
+Developer Log
+-------------
+
+Check this box if you want to see the :doc:`verbose, unformatted developer
+log </troubleshoot/common/advanced/crawlerlog>` on the "Update Now" screen, instead of the quieter, formatted user log.
+Once you change this setting, go back to the Dashboard and click on "Update Now" to see the change in action.
+
+
+Disable Usage Reporting
+-----------------------
+
+ThinkUp sends usage information to `thinkupapp.com <http://thinkupapp.com>`_ when it checks if there's
+a new version available. Collecting this usage information enables ThinkUp's :doc:`core development team </core>` to
+gain insight into what features are in use, and make data-informed decisions about how to improve the application.
+
+The information collected about individual ThinkUp installations is not public; it is only available to ThinkUp's
+:doc:`core development team </core>`. From time to time, the team may publish usage statistics in aggregate.
+
+The usage information includes:
+
+* The location and version of the ThinkUp installation
+* How many and which service users have been added to the installation
+* The last time an administrator logged into the ThinkUp installation
+
+Check this box to disable usage reporting on your ThinkUp installation.
+
+
Back Up and Export Data
------------------------
@@ -84,10 +84,13 @@ public function testLoadConfigViewData() {
'option_value' => 'abc123public');
$bvalue4 = array('namespace' => OptionDAO::APP_OPTIONS, 'option_name' => 'default_instance',
'option_value' => '123');
+ $bvalue5 = array('namespace' => OptionDAO::APP_OPTIONS, 'option_name' => 'is_opted_out_usage_stats',
+ 'option_value' => 'true');
$bdata = FixtureBuilder::build('options', $bvalue);
$bdata2 = FixtureBuilder::build('options', $bvalue2);
$bdata3 = FixtureBuilder::build('options', $bvalue3);
$bdata4 = FixtureBuilder::build('options', $bvalue4);
+ $bdata5 = FixtureBuilder::build('options', $bvalue5);
$results = $controller->control();
$json_obj = json_decode($results);
@@ -96,6 +99,7 @@ public function testLoadConfigViewData() {
$this->assertEqual($json_obj->values->recaptcha_private_key->option_value, 'abc123');
$this->assertEqual($json_obj->values->recaptcha_public_key->option_value, 'abc123public');
$this->assertEqual($json_obj->values->default_instance->option_value, '123');
+ $this->assertTrue($json_obj->values->is_opted_out_usage_stats->option_value);
}
public function testSaveConfigViewDataNoCSRFTokenPassed() {
@@ -128,6 +132,15 @@ public function testSaveConfigViewData() {
$this->assertEqual($json_obj->saved, 0);
$this->assertEqual($json_obj->deleted, 0);
+ // bad arg for is_registration_open
+ $_POST['is_opted_out_usage_stats'] = 'falsify';
+ $controller = new AppConfigController(true);
+ $results = $controller->control();
+ $json_obj = json_decode($results);
+ $this->assertEqual($json_obj->status, 'failed');
+ $this->assertNotNull($json_obj->required->is_opted_out_usage_stats);
+ $_POST['is_opted_out_usage_stats'] = 'false';
+
// bad arg for is_registration_open
$_POST['is_registration_open'] = 'falsey';
//$_POST['recaptcha_enable'] = 'false';
@@ -168,7 +181,7 @@ public function testSaveConfigViewData() {
$results = $controller->control();
$json_obj = json_decode($results);
$this->assertEqual($json_obj->status, 'success');
- $this->assertEqual($json_obj->saved, 4);
+ $this->assertEqual($json_obj->saved, 5);
// bad arg, not numeric
$_POST['default_instance'] = 'notanumber';
@@ -194,23 +207,23 @@ public function testSaveConfigViewData() {
$results = $controller->control();
$json_obj = json_decode($results);
$this->assertEqual($json_obj->status, 'success');
- $this->assertEqual($json_obj->saved, 5);
+ $this->assertEqual($json_obj->saved, 6);
// good double digit arg for default_instance
$_POST['default_instance'] = '57';
$controller = new AppConfigController(true);
$results = $controller->control();
$json_obj = json_decode($results);
$this->assertEqual($json_obj->status, 'success');
- $this->assertEqual($json_obj->saved, 5);
+ $this->assertEqual($json_obj->saved, 6);
// good triple digit arg for default_instance
$_POST['default_instance'] = '105';
$controller = new AppConfigController(true);
$results = $controller->control();
$json_obj = json_decode($results);
$this->assertEqual($json_obj->status, 'success');
- $this->assertEqual($json_obj->saved, 5);
+ $this->assertEqual($json_obj->saved, 6);
//assert Session info re: selected instance has been cleared
$session_instance_network = SessionCache::get('selected_instance_network');
@@ -227,7 +240,7 @@ public function testSaveConfigViewData() {
}
$stmt->closeCursor();
array_shift($data); //shift off database version record
- $this->assertEqual(count($data), 5);
+ $this->assertEqual(count($data), 6);
$this->assertEqual($data[0]['namespace'], OptionDAO::APP_OPTIONS);
$this->assertEqual($data[0]['option_name'], 'is_registration_open');
$this->assertEqual($data[0]['option_value'], 'false');
@@ -245,8 +258,10 @@ public function testSaveConfigViewData() {
$this->assertEqual($data[3]['option_name'], 'recaptcha_private_key');
$this->assertEqual($data[3]['option_value'], '1234abc');
$this->assertEqual($data[4]['namespace'], OptionDAO::APP_OPTIONS);
- $this->assertEqual($data[4]['option_name'], 'default_instance');
- $this->assertEqual($data[4]['option_value'], '105');
+ $this->assertEqual($data[4]['option_name'], 'is_opted_out_usage_stats');
+ $this->assertEqual($data[4]['option_value'], 'false');
+ $this->assertEqual($data[5]['option_name'], 'default_instance');
+ $this->assertEqual($data[5]['option_value'], '105');
// update records...
$_POST['is_registration_open'] = 'true';
@@ -262,7 +277,7 @@ public function testSaveConfigViewData() {
$results = $controller->control();
$json_obj = json_decode($results);
$this->assertEqual($json_obj->status, 'success');
- $this->assertEqual($json_obj->saved, 5);
+ $this->assertEqual($json_obj->saved, 6);
$this->assertEqual($json_obj->deleted, 0);
$sql = "select * from " . $this->table_prefix . 'options where namespace = \'' . OptionDAO::APP_OPTIONS
. '\' order by option_id';
@@ -273,7 +288,7 @@ public function testSaveConfigViewData() {
}
$stmt->closeCursor();
array_shift($data); //shift off database version record
- $this->assertEqual(count($data), 5);
+ $this->assertEqual(count($data), 6);
$this->assertEqual($data[0]['namespace'], OptionDAO::APP_OPTIONS);
$this->assertEqual($data[0]['option_name'], 'is_registration_open');
$this->assertEqual($data[0]['option_value'], 'true');
@@ -290,20 +305,22 @@ public function testSaveConfigViewData() {
$this->assertEqual($data[3]['namespace'], OptionDAO::APP_OPTIONS);
$this->assertEqual($data[3]['option_name'], 'recaptcha_private_key');
$this->assertEqual($data[3]['option_value'], '12345abc');
- $this->assertEqual($data[4]['option_value'], '12345');
+ $this->assertEqual($data[4]['option_value'], 'false');
+ $this->assertEqual($data[5]['option_value'], '12345');
// delete records...
$_POST['is_registration_open'] = 'true';
$_POST['recaptcha_enable'] = '';
$_POST['recaptcha_public_key'] = '';
$_POST['recaptcha_private_key'] = '';
$_POST['default_instance'] = '';
+ $_POST['is_opted_out_usage_stats'] = '';
$controller = new AppConfigController(true);
$results = $controller->control();
$json_obj = json_decode($results);
$this->assertEqual($json_obj->status, 'success');
$this->assertEqual($json_obj->saved, 1);
- $this->assertEqual($json_obj->deleted, 4);
+ $this->assertEqual($json_obj->deleted, 5);
$sql = "select * from " . $this->table_prefix . 'options where namespace = \'' . OptionDAO::APP_OPTIONS
. '\' order by option_id';
$stmt = PluginOptionMysqlDAO::$PDO->query($sql);
@@ -0,0 +1,86 @@
+<?php
+/**
+ *
+ * ThinkUp/tests/TestOfCheckVersionController.php
+ *
+ * Copyright (c) 2011 Gina Trapani
+ *
+ * LICENSE:
+ *
+ * This file is part of ThinkUp (http://thinkupapp.com).
+ *
+ * ThinkUp is free software: you can redistribute it and/or modify it under the terms of the GNU General Public
+ * License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any
+ * later version.
+ *
+ * ThinkUp 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 General Public License for more
+ * details.
+ *
+ * You should have received a copy of the GNU General Public License along with ThinkUp. If not, see
+ * <http://www.gnu.org/licenses/>.
+ *
+ * Test of CheckCrawlerController
+ *
+ * @license http://www.gnu.org/licenses/gpl.html
+ * @copyright 2011 Gina Trapani
+ * @author Gina Trapani <ginatrapani[at]gmail[dot]com>
+ */
+require_once dirname(__FILE__).'/init.tests.php';
+require_once THINKUP_ROOT_PATH.'webapp/_lib/extlib/simpletest/autorun.php';
+require_once THINKUP_ROOT_PATH.'webapp/config.inc.php';
+
+class TestOfCheckVersionController extends ThinkUpUnitTestCase {
+
+ public function setUp(){
+ parent::setUp();
+ }
+
+ public function tearDown(){
+ parent::tearDown();
+ }
+
+ public function testConstructor() {
+ $controller = new CheckVersionController(true);
+ $this->assertTrue(isset($controller));
+ }
+
+ public function testNotLoggedIn() {
+ $controller = new CheckVersionController(true);
+
+ $results = $controller->go();
+ $this->assertPattern('/You must <a href="\/session\/login.php">log in<\/a> to do this/', $results);
+ }
+
+ public function testLoggedin() {
+ $this->simulateLogin('me@example.com');
+ $controller = new CheckVersionController(true);
+
+ $results = $controller->go();
+ $this->assertNoPattern('/You must <a href="\/session\/login.php">log in<\/a> to do this/', $results);
+ $this->assertPattern('/var ROOT = \'thinkup_version\'/', $results);
+ }
+
+ public function testOptedOut() {
+ $bvalues = array('namespace' => OptionDAO::APP_OPTIONS, 'option_name' => 'is_opted_out_usage_stats',
+ 'option_value' => 'true');
+ $bdata = FixtureBuilder::build('options', $bvalues);
+
+ $this->simulateLogin('me@example.com');
+ $controller = new CheckVersionController(true);
+
+ $results = $controller->go();
+ $this->assertNoPattern('/You must <a href="\/session\/login.php">log in<\/a> to do this/', $results);
+ $this->assertPattern('/var ROOT = \'thinkup_version\'/', $results);
+ $this->assertPattern('/var CONTENT_URL = \'http:\/\/thinkupapp.com\/version.php\?v=0.16\&usage=n/', $results);
+ }
+
+ public function testNotOptedOut() {
+ $this->simulateLogin('me@example.com');
+ $controller = new CheckVersionController(true);
+
+ $results = $controller->go();
+ $this->assertPattern('/var CONTENT_URL = \'http:\/\/thinkupapp.com\/version.php\?v=0.16/', $results);
+ $this->assertNoPattern('/var CONTENT_URL = \'http:\/\/thinkupapp.com\/version.php?v=0.16q\&usage=n/', $results);
+ }
+}
@@ -37,6 +37,7 @@
$controller_test->add(new TestOfAppConfigController());
$controller_test->add(new TestOfBackupController());
$controller_test->add(new TestOfCheckCrawlerController());
+$controller_test->add(new TestOfCheckVersionController());
$controller_test->add(new TestOfCrawlerAuthController());
$controller_test->add(new TestOfDashboardController());
$controller_test->add(new TestOfThinkUpEmbedController());
@@ -31,7 +31,10 @@
*/
class CheckVersionController extends ThinkUpAuthController {
public function authControl() {
+ $this->setContentType('text/javascript');
$this->setViewTemplate('install.checkversion.tpl');
+ $config = Config::getInstance();
+ $this->addToView('is_opted_out_usage_stats', $config->getValue('is_opted_out_usage_stats'));
return $this->generateView();
}
}
@@ -69,7 +69,7 @@ class AppConfig {
'match_message' => '',
'default' => '',
),
-
+
/**
* Currently there's a bug with checkboxes which have a default value of true. When you uncheck the box,
* and save the form, no value gets submitted for the checkbox, so the false value doesn't get saved.
@@ -101,6 +101,14 @@ class AppConfig {
'match' => '/^(true|false)$/',
'match_message' => 'Must be true or false'
),
+ 'is_opted_out_usage_stats' => array(
+ 'type' => 'checkbox',
+ 'title' => 'Usage reporting helps us improve ThinkUp',
+ 'required' => false,
+ 'default' => 'false',
+ 'match' => '/^(true|false)$/',
+ 'match_message' => 'Must be true or false'
+ ),
'default_instance' => array(
'type' => 'text',
'title' => 'The service user to display by default',
Oops, something went wrong.

0 comments on commit 728867f

Please sign in to comment.