diff --git a/dev/View/Popup/Plugin.js b/dev/View/Popup/Plugin.js index fcd9533ae..4b4ba4529 100644 --- a/dev/View/Popup/Plugin.js +++ b/dev/View/Popup/Plugin.js @@ -124,6 +124,7 @@ this.configures(_.map(aConfig, function (aItem) { return { 'value': ko.observable(aItem[0]), + 'placeholder': ko.observable(aItem[6]), 'Name': aItem[1], 'Type': aItem[2], 'Label': aItem[3], diff --git a/plugins/google-analytics/VERSION b/plugins/google-analytics/VERSION index 840ca8cbf..400122e60 100644 --- a/plugins/google-analytics/VERSION +++ b/plugins/google-analytics/VERSION @@ -1 +1 @@ -1.4 \ No newline at end of file +1.5 \ No newline at end of file diff --git a/plugins/google-analytics/index.php b/plugins/google-analytics/index.php index 831545e9a..3d714bbf9 100644 --- a/plugins/google-analytics/index.php +++ b/plugins/google-analytics/index.php @@ -18,11 +18,17 @@ class GoogleAnalyticsPlugin extends \RainLoop\Plugins\AbstractPlugin */ public function configMapping() { - return array( - \RainLoop\Plugins\Property::NewInstance('account')->SetLabel('Account') - ->SetAllowedInJs(true) - ->SetDescription('UA-XXXXXXXX-X') - ->SetDefaultValue(''), + $oAccount = \RainLoop\Plugins\Property::NewInstance('account')->SetLabel('Account') + ->SetAllowedInJs(true) + ->SetDefaultValue('') + ; + + if (\method_exists($oAccount, 'SetPlaceholder')) + { + $oAccount->SetPlaceholder('UA-XXXXXXXX-X'); + } + + return array($oAccount, \RainLoop\Plugins\Property::NewInstance('domain_name')->SetLabel('Domain Name') ->SetAllowedInJs(true) ->SetDefaultValue(''), diff --git a/plugins/piwik-analytics/LICENSE b/plugins/piwik-analytics/LICENSE new file mode 100644 index 000000000..271342337 --- /dev/null +++ b/plugins/piwik-analytics/LICENSE @@ -0,0 +1,20 @@ +The MIT License (MIT) + +Copyright (c) 2013 RainLoop Team + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software is furnished to do so, +subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS +FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR +COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER +IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/plugins/piwik-analytics/README b/plugins/piwik-analytics/README new file mode 100644 index 000000000..9b69b68ca --- /dev/null +++ b/plugins/piwik-analytics/README @@ -0,0 +1 @@ +Embed Piwik Analytics (Open source web analytics platform) code into your webmail installation pages. \ No newline at end of file diff --git a/plugins/piwik-analytics/VERSION b/plugins/piwik-analytics/VERSION new file mode 100644 index 000000000..9f8e9b69a --- /dev/null +++ b/plugins/piwik-analytics/VERSION @@ -0,0 +1 @@ +1.0 \ No newline at end of file diff --git a/plugins/piwik-analytics/index.php b/plugins/piwik-analytics/index.php new file mode 100644 index 000000000..11368a99a --- /dev/null +++ b/plugins/piwik-analytics/index.php @@ -0,0 +1,35 @@ +Config()->Get('plugin', 'account', '')) + { + $this->addJs('js/include.js'); + } + } + + /** + * @return array + */ + public function configMapping() + { + $oUrl = \RainLoop\Plugins\Property::NewInstance('piwik_url')->SetLabel('Piwik URL') + ->SetAllowedInJs(true); + + $oSiteID = \RainLoop\Plugins\Property::NewInstance('site_id')->SetLabel('Site ID') + ->SetAllowedInJs(true); + + if (\method_exists($oUrl, 'SetPlaceholder')) + { + $oUrl->SetPlaceholder('http://'); + $oSiteID->SetPlaceholder(''); + } + + return array($oUrl, $oSiteID); + } +} diff --git a/plugins/piwik-analytics/js/include.js b/plugins/piwik-analytics/js/include.js new file mode 100644 index 000000000..26afba6ff --- /dev/null +++ b/plugins/piwik-analytics/js/include.js @@ -0,0 +1,32 @@ + +$(function () { + + var + sPiwikURL = '' + window.rl.pluginSettingsGet('piwik-analytics', 'piwik_url'), + sSiteID = '' + window.rl.pluginSettingsGet('piwik-analytics', 'site_id') + ; + + if ('' !== sPiwikURL && '' !== sSiteID) + { + sPiwikURL = sPiwikURL.replace(/[\\\/\s]+$/, '') + '/'; + if (/^https?:/i.test(sPiwikURL)) + { + sPiwikURL = 'http://' + sPiwikURL; + } + + window._paq = window._paq || []; + (function(window){ + window._paq.push(['setSiteId', sSiteID]); + window._paq.push(['setTrackerUrl', sPiwikURL + 'piwik.php']); + window._paq.push(['trackPageView']); + window.setInterval(function () { + window._paq.push(['trackPageView']); + }, 1000 * 60 * 2); + var d = window.document, g = d.createElement('script'), s = d.getElementsByTagName('script')[0]; + g.type = 'text/javascript'; g.defer = true; g.async = true; g.src = sPiwikURL + 'piwik.js'; + if (s && s.parentNode) { + s.parentNode.insertBefore(g, s); + } + }(window)); + } +}); \ No newline at end of file diff --git a/rainloop/v/0.0.0/app/libraries/RainLoop/Plugins/Manager.php b/rainloop/v/0.0.0/app/libraries/RainLoop/Plugins/Manager.php index 00182d6cc..e4e0cee89 100644 --- a/rainloop/v/0.0.0/app/libraries/RainLoop/Plugins/Manager.php +++ b/rainloop/v/0.0.0/app/libraries/RainLoop/Plugins/Manager.php @@ -295,7 +295,7 @@ class Manager $aMap = $oPlugin->ConfigMap(); if (\is_array($aMap)) { - foreach ($aMap as /* @var $oPluginProperty \RainLoop\Plugins\Property */$oPluginProperty) + foreach ($aMap as /* @var $oPluginProperty \RainLoop\Plugins\Property */ $oPluginProperty) { if ($oPluginProperty && $oPluginProperty->AllowedInJs()) { diff --git a/rainloop/v/0.0.0/app/libraries/RainLoop/Plugins/Property.php b/rainloop/v/0.0.0/app/libraries/RainLoop/Plugins/Property.php index 7cb756150..7cc7591c9 100644 --- a/rainloop/v/0.0.0/app/libraries/RainLoop/Plugins/Property.php +++ b/rainloop/v/0.0.0/app/libraries/RainLoop/Plugins/Property.php @@ -33,6 +33,11 @@ class Property * @var mixed */ private $mDefaultValue; + + /** + * @var string + */ + private $sPlaceholder; private function __construct($sName) { @@ -42,6 +47,7 @@ class Property $this->sLabel = ''; $this->sDesc = ''; $this->bAllowedInJs = false; + $this->sPlaceholder = ''; } /** @@ -77,6 +83,18 @@ class Property return $this; } + + /** + * @param string $sPlaceholder + * + * @return \RainLoop\Plugins\Property + */ + public function SetPlaceholder($sPlaceholder) + { + $this->sPlaceholder = $sPlaceholder; + + return $this; + } /** * @param string $sLabel @@ -160,6 +178,14 @@ class Property { return $this->mDefaultValue; } + + /** + * @return string + */ + public function Placeholder() + { + return $this->sPlaceholder; + } /** * @return array @@ -172,7 +198,8 @@ class Property $this->iType, $this->sLabel, $this->mDefaultValue, - $this->sDesc + $this->sDesc, + $this->sPlaceholder ); } } diff --git a/rainloop/v/0.0.0/app/templates/Views/Admin/AdminSettingsPluginProperty.html b/rainloop/v/0.0.0/app/templates/Views/Admin/AdminSettingsPluginProperty.html index 70f69ad3d..c63ce404f 100644 --- a/rainloop/v/0.0.0/app/templates/Views/Admin/AdminSettingsPluginProperty.html +++ b/rainloop/v/0.0.0/app/templates/Views/Admin/AdminSettingsPluginProperty.html @@ -4,13 +4,16 @@
- + - + - +