Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/matomo-org/matomo.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/themes
diff options
context:
space:
mode:
authorvipsoft <vipsoft@59fd770c-687e-43c8-a1e3-f5a4ff64c105>2009-10-28 00:16:00 +0300
committervipsoft <vipsoft@59fd770c-687e-43c8-a1e3-f5a4ff64c105>2009-10-28 00:16:00 +0300
commit192cd850ebdb424fd95f5eeb835eeab4659741aa (patch)
tree8b79e99ca03cad413701f6155afe061412d41f9e /themes
parentbe8c1717fd91ebcdac6d5c028f6b05ca1f7d900e (diff)
fixes #997 - change data fetch for OFC2 widgets to load widget+data in a single fetch; moved HTML to graph.tpl; move JavaScript to common.js; fixed browser portability bug in findSWFGraph
fixes #1020 - only the last chart added to the dashboard can be saved locally (using the right-click pop-up menu to "Save Image Locally"); the footer icon link worked properly fixes #947 - truncated translation string in Flash widget when "no data"; this is now styled consistently with "no data" for tables and tag clouds related changes: * data-file (Flash parameter) renamed to x-data-file; this is used by Widgetize to provide the code to embed Flash OBJECTs * add translation strings for Flash detection * move some translation strings to JavaScript and enhance getJavascriptTranslations() to always generate 'General' translation strings
Diffstat (limited to 'themes')
-rw-r--r--themes/default/common.js56
1 files changed, 51 insertions, 5 deletions
diff --git a/themes/default/common.js b/themes/default/common.js
index 4920a9d7ba..95a3cb82ff 100644
--- a/themes/default/common.js
+++ b/themes/default/common.js
@@ -1,6 +1,15 @@
+/**
+ * Piwik - Web Analytics
+ *
+ * @link http://piwik.org
+ * @license http://www.gnu.org/licenses/gpl-3.0.html Gpl v3 or later
+ * @version $Id$
+ */
+
function piwikHelper()
{
}
+
/*
* Returns query string for an object of key,values
* Note: we don't use $.param from jquery as it doesn't return array values the PHP way (returns a=v1&a=v2 instead of a[]=v1&a[]=v2)
@@ -29,11 +38,13 @@ piwikHelper.getQueryStringFromParameters = function(parameters)
}
piwikHelper.findSWFGraph = function(name) {
- if (navigator.appName.indexOf("Microsoft")!= -1) {
- return window[name];
- } else {
- return document[name];
- }
+ if(document.getElementById)
+ return document.getElementById(name);
+ if(document.layers)
+ return document[id];
+ if(document.all)
+ return document.all[id];
+ return null;
}
piwikHelper.redirectToUrl = function(url) {
@@ -101,6 +112,41 @@ piwikHelper.lazyScrollTo = function(elem, time)
}
}
+piwikHelper.OFC = (function () {
+ var _data = {};
+ return {
+ get: function (id) {
+ return typeof _data[id] == 'undefined' ? '' : _data[id]; },
+ set: function (id, data) { _data[id] = data; },
+ jquery: {
+ name: 'jQuery',
+ rasterize: function (src, dst) { $('#'+dst).replaceWith(piwikHelper.OFC.jquery.image(src)); },
+ image: function (src) { return '<img title="Piwik Graph" src="data:image/png;base64,' + $('#'+src)[0].get_img_binary() + '" />'; },
+ popup: function (src) {
+ var img_win = window.open('', 'ExportChartAsImage');
+ img_win.document.write('<!DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd" /><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8" /><title>' + _pk_translate('General_ExportAsImage_js') + '</title></head><body>' + piwikHelper.OFC.jquery.image(src) + '<br /><br /><p>' + _pk_translate('General_SaveImageOnYourComputer_js') + '</p></body></html>');
+ img_win.document.close();
+ },
+ load: function (dst, data) { $('#'+dst)[0].load(data || piwikHelper.OFC.get(dst)); }
+ }
+ };
+})();
+
+// Open Flash Charts 2 - callback when chart is being initialized
+function open_flash_chart_data(chartId) {
+ if (typeof chartId != 'undefined') {
+ return piwikHelper.OFC.get(chartId);
+ }
+ return '';
+}
+
+// Open Flash Charts 2 - callback when user selects "Save Image Locally" (right click on Flash chart for pop-up menu)
+function save_image(chartId) {
+ if (typeof chartId != 'undefined') {
+ piwikHelper.OFC.jquery.popup(chartId);
+ }
+}
+
String.prototype.trim = function() {
return this.replace(/^\s+|\s+$/g,"");
}