summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJani Palsamäki2011-08-30 06:30:05 (GMT)
committer Jani Palsamäki2011-08-30 06:30:05 (GMT)
commit797514774494be8af0cd203f4d8f43c78b58cdde (patch)
treeaca42a8143cfca2aa03df531a55621d1a15fd1ed
parent5ce0cb2bb2f177c5382e94ae5d0c1b05fb6624ac (diff)
Added a configuration setting for email addressbook integration.
-rw-r--r--addthis.install1
-rw-r--r--addthis.test13
-rw-r--r--classes/AddThis.php6
-rw-r--r--includes/addthis.admin.inc14
4 files changed, 30 insertions, 4 deletions
diff --git a/addthis.install b/addthis.install
index 9fe65f5..7cd8b8e 100644
--- a/addthis.install
+++ b/addthis.install
@@ -31,6 +31,7 @@ function addthis_field_schema($field) {
* Implements hook_uninstall().
*/
function addthis_uninstall() {
+ variable_del(AddThis::ADDRESSBOOK_ENABLED_KEY);
variable_del(AddThis::BLOCK_WIDGET_TYPE_KEY);
variable_del(AddThis::BOOKMARK_URL_KEY);
variable_del(AddThis::CLICKBACK_TRACKING_ENABLED_KEY);
diff --git a/addthis.test b/addthis.test
index d84e0d6..9001d66 100644
--- a/addthis.test
+++ b/addthis.test
@@ -161,6 +161,8 @@ class AddThisFunctionalityTestCase extends DrupalWebTestCase {
$edit[AddThis::CLICKBACK_TRACKING_ENABLED_KEY] = TRUE;
+ $edit[AddThis::ADDRESSBOOK_ENABLED_KEY] = TRUE;
+
$numberOfPreferredServices = 5;
$edit[AddThis::NUMBER_OF_PREFERRED_SERVICES_KEY] = $numberOfPreferredServices;
@@ -194,7 +196,7 @@ class AddThisFunctionalityTestCase extends DrupalWebTestCase {
$this->addThis508CompliantSettingShouldBeAbleToBeSaved();
- $this->addThisClickbackTrackingSettingShouldBeAbleToBeSaved();
+ $this->addThisClickbackTrackingEnabledSettingShouldBeAbleToBeSaved();
$this->addThisNumberOfPreferredServicesShouldBeAbleToBeSaved($numberOfPreferredServices);
@@ -232,9 +234,14 @@ class AddThisFunctionalityTestCase extends DrupalWebTestCase {
'AddThis 508 compliant setting should be able to be saved.');
}
- private function addThisClickbackTrackingSettingShouldBeAbleToBeSaved() {
+ private function addThisClickbackTrackingEnabledSettingShouldBeAbleToBeSaved() {
$this->assertFieldChecked('edit-addthis-clickback-tracking-enabled',
- 'AddThis clickback tracking setting should be able to be saved.');
+ 'AddThis clickback tracking enabled setting should be able to be saved.');
+ }
+
+ private function addThisAddressbookEnabledSettingShouldBeAbleToBeSaved() {
+ $this->assertFieldChecked('edit-addthis-addressbook-enabled',
+ 'AddThis addressbook enabled setting should be able to be saved.');
}
private function addThisNumberOfPreferredServicesShouldBeAbleToBeSaved($numberOfPreferredServices) {
diff --git a/classes/AddThis.php b/classes/AddThis.php
index 2a73172..7bdd981 100644
--- a/classes/AddThis.php
+++ b/classes/AddThis.php
@@ -24,6 +24,7 @@ class AddThis {
const TITLE_ATTRIBUTE = 'addthis:title';
// Persistent variable keys
+ const ADDRESSBOOK_ENABLED_KEY = 'addthis_addressbook_enabled';
const BLOCK_WIDGET_TYPE_KEY = 'addthis_block_widget_type';
const BOOKMARK_URL_KEY = 'addthis_bookmark_url';
const CLICKBACK_TRACKING_ENABLED_KEY = 'addthis_clickback_tracking_enabled';
@@ -172,6 +173,7 @@ class AddThis {
. $this->addThisConfigurationGenerator->generate('ui_cobrand', $this->getCoBrand())
. $this->addThisConfigurationGenerator->generate('ui_508_compliant', $this->get508Compliant())
. $this->addThisConfigurationGenerator->generate('data_track_clickback', $this->isClickbackTrackingEnabled())
+ . $this->addThisConfigurationGenerator->generate('ui_use_addressbook', $this->isAddressbookEnabled())
. '}'
;
}
@@ -222,6 +224,10 @@ class AddThis {
return variable_get(self::CLICKBACK_TRACKING_ENABLED_KEY, FALSE);
}
+ public function isAddressbookEnabled() {
+ return variable_get(self::ADDRESSBOOK_ENABLED_KEY, FALSE);
+ }
+
private function getLargeButtonWidgetMarkup($entity) {
return '<a class="addthis_button" '
. $this->getAddThisAttributesMarkup($entity)
diff --git a/includes/addthis.admin.inc b/includes/addthis.admin.inc
index 01ef3bf..bfad353 100644
--- a/includes/addthis.admin.inc
+++ b/includes/addthis.admin.inc
@@ -70,7 +70,6 @@ function addthis_admin_settings_form($form_state) {
'#default_value' => AddThis::getInstance()->get508Compliant(),
'#required' => FALSE,
);
-
$form['data_tracking_fieldset'] = array(
'#type' => 'fieldset',
'#title' => t('Data tracking'),
@@ -84,6 +83,19 @@ function addthis_admin_settings_form($form_state) {
'#default_value' => AddThis::getInstance()->isClickbackTrackingEnabled(),
'#required' => FALSE,
);
+ $form['email_settings_fieldset'] = array(
+ '#type' => 'fieldset',
+ '#title' => t('Email settings'),
+ '#collapsible' => TRUE,
+ '#collapsed' => TRUE,
+ );
+ $form['email_settings_fieldset'][AddThis::ADDRESSBOOK_ENABLED_KEY] = array(
+ '#type' => 'checkbox',
+ '#title' => t('Use addressbook'),
+ '#description' => 'If checked, the user will be able import their contacts from popular webmail services when using AddThis\'s email sharing.',
+ '#default_value' => AddThis::getInstance()->isAddressbookEnabled(),
+ '#required' => FALSE,
+ );
$form['service_urls_fieldset'] = array(
'#type' => 'fieldset',
'#title' => t('Service URLs'),