From 158024caf99ecb3b0369486f95ec249ccf8aba72 Mon Sep 17 00:00:00 2001 From: mattab <matthieu.aubry@gmail.com> Date: Thu, 21 Feb 2013 17:42:20 +1300 Subject: [PATCH] * Adding legal notices * Removing unused minimal.css Refs #1652 --- LEGALNOTICE | 22 +++++- plugins/UserCountryMap/Controller.php | 83 ++++++++++++---------- plugins/UserCountryMap/UserCountryMap.php | 3 +- plugins/UserCountryMap/css/minimal.css | 63 ---------------- plugins/UserCountryMap/css/visitor-map.css | 2 +- plugins/UserCountryMap/js/realtime-map.js | 10 ++- plugins/UserCountryMap/js/visitor-map.js | 9 +++ 7 files changed, 83 insertions(+), 109 deletions(-) delete mode 100644 plugins/UserCountryMap/css/minimal.css diff --git a/LEGALNOTICE b/LEGALNOTICE index 3b8136117c..27fa9af115 100644 --- a/LEGALNOTICE +++ b/LEGALNOTICE @@ -166,9 +166,9 @@ THIRD-PARTY COMPONENTS AND LIBRARIES Link: http://www.phcomp.co.uk/tmp/Smarty.phps License: New BSD - Name: MaxMindGeoIP - Link: http://dev.maxmind.com/geoip/downloadable#PHP-7 - License: LGPL + Name: MaxMindGeoIP + Link: http://dev.maxmind.com/geoip/downloadable#PHP-7 + License: LGPL Name: PclZip Link: http://www.phpconcept.net/pclzip/ @@ -204,6 +204,22 @@ THIRD-PARTY COMPONENTS AND LIBRARIES Link: http://www.pchart.net License: GPL v3 + Name: Chroma.js + Link: https://github.com/gka/chroma.js + License: GPL v3 + + Name: qTip2 - Pretty powerful tooltips + Link: http://craigsworks.com/projects/qtip2/ + License: GPL + + Name: Kartograph.js + Link: http://kartograph.org/ + License: LGPL v3 or later + + Name: Raphaël - JavaScript Vector Library + Link: http://raphaeljs.com/ + License: MIT + THIRD-PARTY CONTENT Name: FamFamFam icons - Mark James diff --git a/plugins/UserCountryMap/Controller.php b/plugins/UserCountryMap/Controller.php index 8c91ff8431..c35239c9e7 100644 --- a/plugins/UserCountryMap/Controller.php +++ b/plugins/UserCountryMap/Controller.php @@ -16,40 +16,12 @@ class Piwik_UserCountryMap_Controller extends Piwik_Controller { - // By defaul plot up to the last 30 days of visitors on the map, for low traffic sites + // By default plot up to the last 30 days of visitors on the map, for low traffic sites const REAL_TIME_WINDOW = 'last30'; - private function _reqUrl($module, $action, $idSite, $period, $date, $token_auth, $filter_by_country = false) { - // use processed reports - $url = "?module=" . $module - . "&method=".$module.".".$action."&format=JSON" - . "&idSite=" . $idSite - . "&period=" . $period - . "&date=" . $date - . "&token_auth=" . $token_auth - . "&segment=" . Piwik_Common::unsanitizeInputValue(Piwik_Common::getRequestVar('segment', '')) - . "&enable_filter_excludelowpop=1" - . "&showRawMetrics=1"; - - if ($filter_by_country) { - $url .= "&filter_column=country" - . "&filter_sort_column=nb_visits" - . "&filter_limit=-1" - . "&filter_pattern="; - } else { - $url .= "&filter_limit=-1"; - } - return $url; - } - - private function _report($module, $action, $idSite, $period, $date, $token_auth, $filter_by_country = false) { - return $this->_reqUrl('API', 'getProcessedReport&apiModule='.$module.'&apiAction='.$action, $idSite, $period, $date, $token_auth, $filter_by_country); - } - - function visitorMap() + public function visitorMap() { $this->checkUserCountryPluginEnabled(); - $config = array(); $idSite = Piwik_Common::getRequestVar('idSite', 1, 'int'); Piwik::checkUserHasViewAccess($idSite); @@ -63,12 +35,13 @@ class Piwik_UserCountryMap_Controller extends Piwik_Controller // request visits summary $request = new Piwik_API_Request( 'method=VisitsSummary.get&format=PHP' - . '&idSite=' . $idSite - . '&period=' . $period - . '&date=' . $date - . '&token_auth=' . $token_auth - . '&filter_limit=-1' + . '&idSite=' . $idSite + . '&period=' . $period + . '&date=' . $date + . '&token_auth=' . $token_auth + . '&filter_limit=-1' ); + $config = array(); $config['visitsSummary'] = unserialize($request->process()); $config['countryDataUrl'] = $this->_report('UserCountry', 'getCountry', $idSite, $period, $date, $token_auth); @@ -76,9 +49,10 @@ class Piwik_UserCountryMap_Controller extends Piwik_Controller $idSite, $period, $date, $token_auth, true); $config['cityDataUrl'] = $this->_report('UserCountry', 'getCity', $idSite, $period, $date, $token_auth, true); - $config['countrySummaryUrl'] = $this->_reqUrl('VisitsSummary', 'get', + $config['countrySummaryUrl'] = $this->getApiRequestUrl('VisitsSummary', 'get', $idSite, $period, $date, $token_auth, true); $view->defaultMetric = 'nb_visits'; + // some translations $view->localeJSON = json_encode(array( 'nb_visits' => Piwik_Translate('VisitsSummary_NbVisits'), @@ -110,7 +84,7 @@ class Piwik_UserCountryMap_Controller extends Piwik_Controller echo $view->render(); } - function realtimeMap() + public function realtimeMap() { if(Piwik::isUserIsAnonymous()) { return "<h2>" . Piwik_Translate("UserCountryMap_LoginToViewRealTime") . "</h2>"; @@ -164,13 +138,15 @@ class Piwik_UserCountryMap_Controller extends Piwik_Controller echo $view->render(); } - private function checkUserCountryPluginEnabled() { + private function checkUserCountryPluginEnabled() + { if (!Piwik_PluginsManager::getInstance()->isPluginActivated('UserCountry')) { throw new Exception(Piwik_Translate('General_Required', 'Plugin UserCountry')); } } - private function getMetrics($idSite, $period, $date, $token_auth) { + private function getMetrics($idSite, $period, $date, $token_auth) + { $request = new Piwik_API_Request( 'method=API.getMetadata&format=PHP' . '&apiModule=UserCountry&apiAction=getCountry' @@ -196,4 +172,33 @@ class Piwik_UserCountryMap_Controller extends Piwik_Controller return $metrics; } + private function getApiRequestUrl($module, $action, $idSite, $period, $date, $token_auth, $filter_by_country = false) + { + // use processed reports + $url = "?module=" . $module + . "&method=".$module.".".$action."&format=JSON" + . "&idSite=" . $idSite + . "&period=" . $period + . "&date=" . $date + . "&token_auth=" . $token_auth + . "&segment=" . Piwik_Common::unsanitizeInputValue(Piwik_Common::getRequestVar('segment', '')) + . "&enable_filter_excludelowpop=1" + . "&showRawMetrics=1"; + + if ($filter_by_country) { + $url .= "&filter_column=country" + . "&filter_sort_column=nb_visits" + . "&filter_limit=-1" + . "&filter_pattern="; + } else { + $url .= "&filter_limit=-1"; + } + return $url; + } + + private function _report($module, $action, $idSite, $period, $date, $token_auth, $filter_by_country = false) + { + return $this->getApiRequestUrl('API', 'getProcessedReport&apiModule='.$module.'&apiAction='.$action, $idSite, $period, $date, $token_auth, $filter_by_country); + } + } diff --git a/plugins/UserCountryMap/UserCountryMap.php b/plugins/UserCountryMap/UserCountryMap.php index 6db24dc825..d7f6976e46 100644 --- a/plugins/UserCountryMap/UserCountryMap.php +++ b/plugins/UserCountryMap/UserCountryMap.php @@ -29,7 +29,6 @@ class Piwik_UserCountryMap extends Piwik_Plugin public function postLoad() { Piwik_AddWidget('General_Visitors', Piwik_Translate('UserCountryMap_VisitorMap'), 'UserCountryMap', 'visitorMap'); - Piwik_AddWidget('Live!', Piwik_Translate('UserCountryMap_RealTimeMap'), 'UserCountryMap', 'realtimeMap'); } @@ -50,7 +49,7 @@ class Piwik_UserCountryMap extends Piwik_Plugin $jsFiles = &$notification->getNotificationObject(); $jsFiles[] = "plugins/UserCountryMap/js/vendor/raphael-min.js"; $jsFiles[] = "plugins/UserCountryMap/js/vendor/jquery.qtip.min.js"; - $jsFiles[] = "plugins/UserCountryMap/js/vendor/kartograph.js"; + $jsFiles[] = "plugins/UserCountryMap/js/vendor/kartograph.min.js"; $jsFiles[] = "plugins/UserCountryMap/js/vendor/chroma.min.js"; $jsFiles[] = "plugins/UserCountryMap/js/visitor-map.js"; $jsFiles[] = "plugins/UserCountryMap/js/realtime-map.js"; diff --git a/plugins/UserCountryMap/css/minimal.css b/plugins/UserCountryMap/css/minimal.css deleted file mode 100644 index 56a09214c6..0000000000 --- a/plugins/UserCountryMap/css/minimal.css +++ /dev/null @@ -1,63 +0,0 @@ -.page { background: #fff; } - -#dashboardWidgetsArea { - margin: -10px; -} - -.nav_sep { border-color: #fff; } - -.widget { - border-color: #fff; -padding: 10px; -background: transparent; -} - -.widgetTop { - background: #fff; - margin-bottom: 10px; -} - -.widgetName { - color: #7E7363; - text-shadow: none; - font-family: Open Sans; - font-weight: 300; - font-size: 24px; -} - -.dataTableFooterIcons { - border-top: 1px solid #fff; -} - -table.dataTable th, -table.dataTable th.columnSorted, -table.dataTable td.labeleven, -table.dataTable td.columneven { - background: #fff; - border-color: #fff; -} - -.dataTable th + th { - text-align: right; -} - -.dataTable td + td { - text-align: right; -} -.dataTable th.first { - color: #fff; -} - -table.dataTable td, table.dataTable td.columnodd { - border-color: #fff; - background: #fff; -} - -.dataTable .dataTableFeatures - { - display: none!important; -} - -.dataTable:hover .dataTableFeatures { - display: block!important; -} \ No newline at end of file diff --git a/plugins/UserCountryMap/css/visitor-map.css b/plugins/UserCountryMap/css/visitor-map.css index 13ea08906a..83bc8dee75 100644 --- a/plugins/UserCountryMap/css/visitor-map.css +++ b/plugins/UserCountryMap/css/visitor-map.css @@ -39,7 +39,7 @@ .UserCountryMap-tooltip { display:block; position: absolute; - z-index:10; + z-index:20; } .UserCountryMap-overlay .content, diff --git a/plugins/UserCountryMap/js/realtime-map.js b/plugins/UserCountryMap/js/realtime-map.js index 9abe306905..9c8099b0be 100644 --- a/plugins/UserCountryMap/js/realtime-map.js +++ b/plugins/UserCountryMap/js/realtime-map.js @@ -1,4 +1,12 @@ -// # RealTimeMap +/*! + * Piwik - Web Analytics + * + * Real time vistors map + * Using Kartograph.js http://kartograph.org/ + * + * @link http://piwik.org + * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later + */ (function() { diff --git a/plugins/UserCountryMap/js/visitor-map.js b/plugins/UserCountryMap/js/visitor-map.js index 0b822c0504..e89361f546 100644 --- a/plugins/UserCountryMap/js/visitor-map.js +++ b/plugins/UserCountryMap/js/visitor-map.js @@ -1,3 +1,12 @@ +/*! + * Piwik - Web Analytics + * + * Visitors Map with zoom in continents / countries. Cities + Region view. + * Using Kartograph.js http://kartograph.org/ + * + * @link http://piwik.org + * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later + */ (function() { -- GitLab