hide map for Character groups Quest Stations when there are no stations
This commit is contained in:
commit
df14dfafc3
4371 changed files with 1220224 additions and 0 deletions
64
www/analytics/plugins/Widgetize/Controller.php
Normal file
64
www/analytics/plugins/Widgetize/Controller.php
Normal file
|
|
@ -0,0 +1,64 @@
|
|||
<?php
|
||||
/**
|
||||
* Piwik - Open source web analytics
|
||||
*
|
||||
* @link http://piwik.org
|
||||
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
|
||||
*
|
||||
*/
|
||||
namespace Piwik\Plugins\Widgetize;
|
||||
|
||||
use Piwik\API\Request;
|
||||
use Piwik\Common;
|
||||
use Piwik\FrontController;
|
||||
use Piwik\View;
|
||||
use Piwik\WidgetsList;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
class Controller extends \Piwik\Plugin\Controller
|
||||
{
|
||||
public function index()
|
||||
{
|
||||
$view = new View('@Widgetize/index');
|
||||
$view->availableWidgets = Common::json_encode(WidgetsList::get());
|
||||
$this->setGeneralVariablesView($view);
|
||||
return $view->render();
|
||||
}
|
||||
|
||||
public function testJsInclude1()
|
||||
{
|
||||
$view = new View('@Widgetize/testJsInclude1');
|
||||
$view->url1 = '?module=Widgetize&action=js&moduleToWidgetize=UserSettings&actionToWidgetize=getBrowser&idSite=1&period=day&date=yesterday';
|
||||
$view->url2 = '?module=Widgetize&action=js&moduleToWidgetize=API&actionToWidgetize=index&method=ExamplePlugin.getGoldenRatio&format=original';
|
||||
return $view->render();
|
||||
}
|
||||
|
||||
public function testJsInclude2()
|
||||
{
|
||||
$view = new View('@Widgetize/testJsInclude2');
|
||||
$view->url1 = '?module=Widgetize&action=js&moduleToWidgetize=UserSettings&actionToWidgetize=getBrowser&idSite=1&period=day&date=yesterday';
|
||||
$view->url2 = '?module=Widgetize&action=js&moduleToWidgetize=UserCountry&actionToWidgetize=getCountry&idSite=1&period=day&date=yesterday&viewDataTable=cloud&show_footer=0';
|
||||
$view->url3 = '?module=Widgetize&action=js&moduleToWidgetize=Referrers&actionToWidgetize=getKeywords&idSite=1&period=day&date=yesterday&viewDataTable=table&show_footer=0';
|
||||
return $view->render();
|
||||
}
|
||||
|
||||
public function iframe()
|
||||
{
|
||||
Request::reloadAuthUsingTokenAuth();
|
||||
$this->init();
|
||||
$controllerName = Common::getRequestVar('moduleToWidgetize');
|
||||
$actionName = Common::getRequestVar('actionToWidgetize');
|
||||
$outputDataTable = FrontController::getInstance()->fetchDispatch($controllerName, $actionName);
|
||||
if ($controllerName == 'Dashboard' && $actionName == 'index') {
|
||||
$view = new View('@Widgetize/iframe_empty');
|
||||
} else {
|
||||
$view = new View('@Widgetize/iframe');
|
||||
}
|
||||
$this->setGeneralVariablesView($view);
|
||||
$view->setXFrameOptions('allow');
|
||||
$view->content = $outputDataTable;
|
||||
return $view->render();
|
||||
}
|
||||
}
|
||||
65
www/analytics/plugins/Widgetize/Widgetize.php
Normal file
65
www/analytics/plugins/Widgetize/Widgetize.php
Normal file
|
|
@ -0,0 +1,65 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Piwik - Open source web analytics
|
||||
*
|
||||
* @link http://piwik.org
|
||||
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
|
||||
*
|
||||
*/
|
||||
|
||||
namespace Piwik\Plugins\Widgetize;
|
||||
use Piwik\Menu\MenuTop;
|
||||
use Piwik\Piwik;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
class Widgetize extends \Piwik\Plugin
|
||||
{
|
||||
/**
|
||||
* @see Piwik\Plugin::getListHooksRegistered
|
||||
*/
|
||||
public function getListHooksRegistered()
|
||||
{
|
||||
return array(
|
||||
'AssetManager.getJavaScriptFiles' => 'getJsFiles',
|
||||
'AssetManager.getStylesheetFiles' => 'getStylesheetFiles',
|
||||
'Menu.Top.addItems' => 'addTopMenu',
|
||||
'Translate.getClientSideTranslationKeys' => 'getClientSideTranslationKeys'
|
||||
);
|
||||
}
|
||||
|
||||
public function addTopMenu()
|
||||
{
|
||||
$tooltip = Piwik::translate('Widgetize_TopLinkTooltip');
|
||||
$urlParams = array('module' => 'Widgetize', 'action' => 'index', 'segment' => false);
|
||||
|
||||
MenuTop::addEntry('General_Widgets', $urlParams, true, 5, $isHTML = false, $tooltip);
|
||||
}
|
||||
|
||||
public function getJsFiles(&$jsFiles)
|
||||
{
|
||||
$jsFiles[] = "libs/jquery/jquery.truncate.js";
|
||||
$jsFiles[] = "libs/jquery/jquery.scrollTo.js";
|
||||
$jsFiles[] = "plugins/Zeitgeist/javascripts/piwikHelper.js";
|
||||
$jsFiles[] = "plugins/CoreHome/javascripts/dataTable.js";
|
||||
$jsFiles[] = "plugins/Dashboard/javascripts/widgetMenu.js";
|
||||
$jsFiles[] = "plugins/Widgetize/javascripts/widgetize.js";
|
||||
}
|
||||
|
||||
public function getStylesheetFiles(&$stylesheets)
|
||||
{
|
||||
$stylesheets[] = "plugins/Widgetize/stylesheets/widgetize.less";
|
||||
$stylesheets[] = "plugins/CoreHome/stylesheets/coreHome.less";
|
||||
$stylesheets[] = "plugins/CoreHome/stylesheets/dataTable.less";
|
||||
$stylesheets[] = "plugins/CoreHome/stylesheets/cloud.less";
|
||||
$stylesheets[] = "plugins/Dashboard/stylesheets/dashboard.less";
|
||||
}
|
||||
|
||||
public function getClientSideTranslationKeys(&$translations)
|
||||
{
|
||||
$translations[] = 'Widgetize_OpenInNewWindow';
|
||||
$translations[] = 'Dashboard_LoadingWidget';
|
||||
}
|
||||
}
|
||||
84
www/analytics/plugins/Widgetize/javascripts/widgetize.js
Normal file
84
www/analytics/plugins/Widgetize/javascripts/widgetize.js
Normal file
|
|
@ -0,0 +1,84 @@
|
|||
/*!
|
||||
* Piwik - Web Analytics
|
||||
*
|
||||
* @link http://piwik.org
|
||||
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
|
||||
*/
|
||||
|
||||
/**
|
||||
* @constructor
|
||||
*/
|
||||
function widgetize() {
|
||||
var self = this;
|
||||
|
||||
this.getInputFormWithHtml = function (inputId, htmlEmbed) {
|
||||
return '<input class="formEmbedCode" id="' + inputId + '" value="' + htmlEmbed.replace(/"/g, '"') + '" onclick="javascript:document.getElementById(\'' + inputId + '\').focus();document.getElementById(\'' + inputId + '\').select();" readonly="true" type="text" />';
|
||||
};
|
||||
|
||||
this.getEmbedUrl = function (parameters, exportFormat) {
|
||||
var copyParameters = {};
|
||||
for (var variableName in parameters) {
|
||||
copyParameters[variableName] = parameters[variableName];
|
||||
}
|
||||
copyParameters['moduleToWidgetize'] = parameters['module'];
|
||||
copyParameters['actionToWidgetize'] = parameters['action'];
|
||||
delete copyParameters['action'];
|
||||
delete copyParameters['module'];
|
||||
var sourceUrl;
|
||||
sourceUrl = document.location.protocol + '//' + document.location.hostname + (document.location.port == '' ? '' : (':' + document.location.port)) + document.location.pathname + '?';
|
||||
sourceUrl += "module=Widgetize" +
|
||||
"&action=" + exportFormat +
|
||||
"&" + piwikHelper.getQueryStringFromParameters(copyParameters) +
|
||||
"&idSite=" + piwik.idSite +
|
||||
"&period=" + piwik.period +
|
||||
"&date=" + broadcast.getValueFromUrl('date') +
|
||||
"&disableLink=1&widget=1";
|
||||
return sourceUrl;
|
||||
};
|
||||
|
||||
this.htmlentities = function (s) {
|
||||
return s.replace(/[<>&]/g, function (m) { return "&" + m.charCodeAt(0) + ";"; });
|
||||
};
|
||||
|
||||
this.callbackAddExportButtonsUnderWidget = function (widgetUniqueId, loadedWidgetElement) {
|
||||
var widget = widgetsHelper.getWidgetObjectFromUniqueId(widgetUniqueId);
|
||||
var widgetParameters = widget['parameters'];
|
||||
|
||||
var exportButtonsElement = $('<span id="exportButtons">');
|
||||
|
||||
var urlIframe = self.getEmbedUrl(widgetParameters, "iframe");
|
||||
// We first build the HTML code that will load the widget in an IFRAME
|
||||
var widgetIframeHtml = '<div id="widgetIframe">' +
|
||||
'<iframe width="100%" height="350" src="' +
|
||||
urlIframe +
|
||||
'" scrolling="no" frameborder="0" marginheight="0" marginwidth="0">' +
|
||||
'</iframe>' +
|
||||
'</div>';
|
||||
|
||||
// Add the input field containing the widget in an Iframe
|
||||
$(exportButtonsElement).append(
|
||||
'<div id="embedThisWidgetIframe">' +
|
||||
'<label for="embedThisWidgetIframeInput">› Embed Iframe</label>' +
|
||||
'<span id="embedThisWidgetIframeInput">' +
|
||||
self.getInputFormWithHtml('iframeEmbed', widgetIframeHtml) +
|
||||
'</span>' +
|
||||
'</div>' +
|
||||
'<div> <label for="embedThisWidgetDirectLink">› Direct Link</label>' +
|
||||
'<span id="embedThisWidgetDirectLink"> ' + self.getInputFormWithHtml('directLinkEmbed', urlIframe) + ' - <a href="' + urlIframe + '" target="_blank">' + _pk_translate('Widgetize_OpenInNewWindow') + '</a></span>'
|
||||
+ '</div>'
|
||||
);
|
||||
|
||||
// We then replace the div iframeDivToExport with the actual Iframe html
|
||||
$('#iframeDivToExport')
|
||||
.html(widgetIframeHtml);
|
||||
|
||||
// Finally we append the content to the parent widget DIV
|
||||
$(loadedWidgetElement)
|
||||
.parent()
|
||||
.append(exportButtonsElement);
|
||||
|
||||
// JS is buggy at least on IE
|
||||
//var widgetJS = '<script type="text/javascript" src="'+ getEmbedUrl(pluginId, actionId, "js") +'"></scr'+'ipt>';
|
||||
//divEmbedThisWidget.append('<br />Embed JS: '+ getInputFormWithHtml('javascriptEmbed', widgetJS));
|
||||
}
|
||||
}
|
||||
31
www/analytics/plugins/Widgetize/stylesheets/widgetize.less
Normal file
31
www/analytics/plugins/Widgetize/stylesheets/widgetize.less
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
.widgetize {
|
||||
width: 100%;
|
||||
padding: 15px 15px 0 15px;
|
||||
font-size: 13px;
|
||||
}
|
||||
|
||||
.widgetize p {
|
||||
padding: 0 0 20px 0;
|
||||
}
|
||||
|
||||
.widgetize .formEmbedCode {
|
||||
font-size: 11px;
|
||||
text-decoration: none;
|
||||
background-color: #FBFDFF;
|
||||
border: 1px solid #ECECEC;
|
||||
width: 220px;
|
||||
}
|
||||
|
||||
.widgetize label {
|
||||
color: #666666;
|
||||
line-height: 18px;
|
||||
margin-right: 5px;
|
||||
font-weight: bold;
|
||||
padding-bottom: 100px;
|
||||
}
|
||||
|
||||
#embedThisWidgetIframe,
|
||||
#embedThisWidgetFlash,
|
||||
#embedThisWidgetEverywhere {
|
||||
margin-top: 5px;
|
||||
}
|
||||
22
www/analytics/plugins/Widgetize/templates/iframe.twig
Normal file
22
www/analytics/plugins/Widgetize/templates/iframe.twig
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
<!DOCTYPE html>
|
||||
<!--[if lt IE 9 ]>
|
||||
<html class="old-ie" id="ng-app" ng-app="piwikApp"> <![endif]-->
|
||||
<!--[if (gte IE 9)|!(IE)]><!-->
|
||||
<html id="ng-app" ng-app="piwikApp"><!--<![endif]-->
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
{% include "_jsGlobalVariables.twig" %}
|
||||
<!--[if lt IE 9]>
|
||||
<script language="javascript" type="text/javascript" src="libs/jqplot/excanvas.min.js"></script>
|
||||
<![endif]-->
|
||||
{% include "_jsCssIncludes.twig" %}
|
||||
<!--[if IE]>
|
||||
<link rel="stylesheet" type="text/css" href="plugins/Zeitgeist/stylesheets/ieonly.css"/>
|
||||
<![endif]-->
|
||||
</head>
|
||||
<body ng-app="app">
|
||||
<div class="widget">
|
||||
{{ content|raw }}
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -0,0 +1 @@
|
|||
{{ content|raw }}
|
||||
69
www/analytics/plugins/Widgetize/templates/index.twig
Normal file
69
www/analytics/plugins/Widgetize/templates/index.twig
Normal file
|
|
@ -0,0 +1,69 @@
|
|||
{% extends 'dashboard.twig' %}
|
||||
|
||||
{% block content %}
|
||||
|
||||
|
||||
<div class="pageWrap">
|
||||
<div class="top_controls">
|
||||
{% include "@CoreHome/_siteSelectHeader.twig" %}
|
||||
{% include "@CoreHome/_periodSelect.twig" %}
|
||||
</div>
|
||||
|
||||
<script type="text/javascript">
|
||||
$(function () {
|
||||
var widgetized = new widgetize();
|
||||
var urlPath = document.location.protocol + '//' + document.location.hostname + (document.location.port == '' ? '' : (':' + document.location.port)) + document.location.pathname;
|
||||
var dashboardUrl = urlPath + '?module=Widgetize&action=iframe&moduleToWidgetize=Dashboard&actionToWidgetize=index&idSite=' + piwik.idSite + '&period=week&date=yesterday';
|
||||
$('#exportFullDashboard').html(
|
||||
widgetized.getInputFormWithHtml('dashboardEmbed', '<iframe src="' + dashboardUrl + '" frameborder="0" marginheight="0" marginwidth="0" width="100%" height="100%"></iframe>')
|
||||
);
|
||||
$('#linkDashboardUrl').attr('href', dashboardUrl);
|
||||
|
||||
var allWebsitesDashboardUrl = urlPath + '?module=Widgetize&action=iframe&moduleToWidgetize=MultiSites&actionToWidgetize=standalone&idSite=' + piwik.idSite + '&period=week&date=yesterday';
|
||||
$('#exportAllWebsitesDashboard').html(
|
||||
widgetized.getInputFormWithHtml('allWebsitesDashboardEmbed', '<iframe src="' + allWebsitesDashboardUrl + '" frameborder="0" marginheight="0" marginwidth="0" width="100%" height="100%"></iframe>')
|
||||
);
|
||||
$('#linkAllWebsitesDashboardUrl').attr('href', allWebsitesDashboardUrl);
|
||||
$('#widgetPreview').widgetPreview({
|
||||
onPreviewLoaded: widgetized.callbackAddExportButtonsUnderWidget
|
||||
});
|
||||
broadcast.init();
|
||||
});
|
||||
</script>
|
||||
|
||||
|
||||
<div class="widgetize">
|
||||
<p>With Piwik, you can export your Web Analytics reports on your blog, website, or intranet dashboard... in one click.
|
||||
|
||||
<p>
|
||||
<strong>› Widget authentication:</strong> If you want your widgets to be viewable by everybody, you first have to set the 'view' permissions
|
||||
to the anonymous user in the <a href='index.php?module=UsersManager' target='_blank'>Users Management section</a>.
|
||||
<br/>Alternatively, if you are publishing widgets on a password protected or private page,
|
||||
you don't necessarily have to allow 'anonymous' to view your reports. In this case, you can add the secret token_auth parameter (found in the
|
||||
<a href='{{ linkTo({'module':'API','action':'listAllAPI'}) }}' target='_blank'>API page</a>) in the widget URL.
|
||||
</p>
|
||||
|
||||
<p><strong>› Widgetize the full dashboard:</strong> You can also display the full Piwik dashboard in your application or website in an IFRAME
|
||||
(<a href='' target='_blank' id='linkDashboardUrl'>see example</a>).
|
||||
The date parameter can be set to a specific calendar date, "today", or "yesterday". The period parameter can be set to "day", "week", "month", or
|
||||
"year".
|
||||
The language parameter can be set to the language code of a translation, such as language=fr.
|
||||
For example, for idSite=1 and date=yesterday, you can write: <span id='exportFullDashboard'></span>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<strong>› Widgetize the all websites dashboard in an IFRAME</strong> (<a href='' target='_blank' id='linkAllWebsitesDashboardUrl'>see example</a>)
|
||||
<span id='exportAllWebsitesDashboard'></span>
|
||||
</p>
|
||||
|
||||
<p><strong>› Select a report, and copy paste in your page the embed code below the widget:</strong>
|
||||
|
||||
<div id="widgetPreview"></div>
|
||||
|
||||
<div id='iframeDivToExport' style='display:none;'></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{% include "@Dashboard/_widgetFactoryTemplate.twig" %}
|
||||
|
||||
{% endblock %}
|
||||
|
|
@ -0,0 +1,22 @@
|
|||
<html>
|
||||
<body>
|
||||
<p>This text is after the JS INCLUDE</p>
|
||||
|
||||
|
||||
<h2>Test tag cloud in a JS include</h2>
|
||||
|
||||
<div style="width:500px;">
|
||||
<script type="text/javascript" src="{{ url1 }}"></script>
|
||||
<noscript>Powered by <a href="http://piwik.org">Piwik</a></noscript>
|
||||
</div>
|
||||
|
||||
<p>This text is after the JS INCLUDE</p>
|
||||
|
||||
<h2>Test calling the API in Javascript</h2>
|
||||
|
||||
<p>using a javascript include. This is a dirty way (much better to ajax call the API!) but an interesting show case.</P>
|
||||
<script type="text/javascript" src="{{ url2 }}"></script>
|
||||
<noscript>Powered by <a href="http://piwik.org">Piwik</a></noscript>
|
||||
<p>This text is after the JS INCLUDE 2</p>
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -0,0 +1,27 @@
|
|||
<html>
|
||||
<body>
|
||||
<p>This text is after the JS INCLUDE</p>
|
||||
|
||||
<h2>Test table in a JS include</h2>
|
||||
|
||||
<script type="text/javascript" src="{{ url1 }}"></script>
|
||||
<noscript>Powered by <a href="http://piwik.org">Piwik</a></noscript>
|
||||
|
||||
<p>This text is after the JS INCLUDE</p>
|
||||
|
||||
<h2>Test another table in a JS include</h2>
|
||||
|
||||
<script type="text/javascript" src="{{ url3 }}"></script>
|
||||
<noscript>Powered by <a href="http://piwik.org">Piwik</a></noscript>
|
||||
|
||||
<p>This text is after the 2nd JS INCLUDE</p>
|
||||
|
||||
<h2>Test tag cloud in a JS include</h2>
|
||||
|
||||
<script type="text/javascript" src="{{ url2 }}"></script>
|
||||
<noscript>Powered by <a href="http://piwik.org">Piwik</a></noscript>
|
||||
|
||||
<p>This text is after the JS INCLUDE</p>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
Loading…
Add table
Add a link
Reference in a new issue