From 724ecc44bfac3874ccccda5178f73313db7abae9 Mon Sep 17 00:00:00 2001 From: Aleksander Machniak Date: Tue, 3 Mar 2015 03:37:06 -0500 Subject: [PATCH] Make ActiveSync devices configuration page configurable (#4770) and change default url to http://docs.kolab.org/client-configuration/ --- plugins/kolab_activesync/config.inc.php.dist | 4 +++ plugins/kolab_activesync/kolab_activesync.php | 2 +- .../kolab_activesync/kolab_activesync_ui.php | 29 +++++++++++++++++++ .../kolab_activesync/localization/en_US.inc | 2 +- .../skins/classic/templates/configempty.html | 2 +- .../skins/larry/templates/configempty.html | 2 +- 6 files changed, 37 insertions(+), 4 deletions(-) create mode 100644 plugins/kolab_activesync/config.inc.php.dist diff --git a/plugins/kolab_activesync/config.inc.php.dist b/plugins/kolab_activesync/config.inc.php.dist new file mode 100644 index 00000000..adcc3787 --- /dev/null +++ b/plugins/kolab_activesync/config.inc.php.dist @@ -0,0 +1,4 @@ +ui = new kolab_activesync_ui($this); if (!empty($_GET['_init'])) { - return $this->rc->output->send('kolab_activesync.configempty'); + return $this->ui->init_message(); } $this->register_handler('plugin.deviceconfigform', array($this->ui, 'device_config_form')); diff --git a/plugins/kolab_activesync/kolab_activesync_ui.php b/plugins/kolab_activesync/kolab_activesync_ui.php index 257ec2ab..edf64114 100644 --- a/plugins/kolab_activesync/kolab_activesync_ui.php +++ b/plugins/kolab_activesync/kolab_activesync_ui.php @@ -29,6 +29,9 @@ class kolab_activesync_ui private $plugin; public $device = array(); + const SETUP_URL = 'http://docs.kolab.org/client-configuration'; + + public function __construct($plugin) { $this->plugin = $plugin; @@ -245,4 +248,30 @@ class kolab_activesync_ui return $table->show(); } + + /** + * Displays initial page (when no devices are registered) + */ + function init_message() + { + $this->plugin->load_config(); + + $this->rc->output->add_handlers(array( + 'initmessage' => array($this, 'init_message_content') + )); + + $this->rc->output->send('kolab_activesync.configempty'); + } + + /** + * Handler for initmessage template object + */ + function init_message_content() + { + $url = $this->rc->config->get('activesync_setup_url', self::SETUP_URL); + $vars = array('url' => $url); + $msg = $this->plugin->gettext(array('name' => 'nodevices', 'vars' => $vars)); + + return $msg; + } } diff --git a/plugins/kolab_activesync/localization/en_US.inc b/plugins/kolab_activesync/localization/en_US.inc index 6d4e0bfa..683488f4 100644 --- a/plugins/kolab_activesync/localization/en_US.inc +++ b/plugins/kolab_activesync/localization/en_US.inc @@ -16,7 +16,7 @@ $labels['task'] = 'Tasks'; $labels['note'] = 'Notes'; $labels['configuration'] = 'Configuration'; $labels['deletedevice'] = 'Delete device'; -$labels['nodevices'] = 'There are currently no devices registered.

In order to register a device, please connect it to the server first, using the instructions in the Wiki. Afterwards the device should become available for configuration here.'; +$labels['nodevices'] = 'There are currently no devices registered.

In order to register a device, please connect it to the server first, using instructions from this page. Afterwards the device should become available for configuration here.'; $labels['savingdata'] = 'Saving data...'; $labels['savingerror'] = 'Failed to save configuration'; $labels['notsupported'] = 'Your server does not support metadata/annotations'; diff --git a/plugins/kolab_activesync/skins/classic/templates/configempty.html b/plugins/kolab_activesync/skins/classic/templates/configempty.html index 5afd3ce8..e36fc174 100644 --- a/plugins/kolab_activesync/skins/classic/templates/configempty.html +++ b/plugins/kolab_activesync/skins/classic/templates/configempty.html @@ -9,7 +9,7 @@
- +
diff --git a/plugins/kolab_activesync/skins/larry/templates/configempty.html b/plugins/kolab_activesync/skins/larry/templates/configempty.html index 5d1a0622..8d9aaff7 100644 --- a/plugins/kolab_activesync/skins/larry/templates/configempty.html +++ b/plugins/kolab_activesync/skins/larry/templates/configempty.html @@ -9,7 +9,7 @@
- +