Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BUG: Heatmap & domstream fixes #567

Merged
merged 11 commits into from Apr 29, 2020
8 changes: 8 additions & 0 deletions .htaccess
@@ -1 +1,9 @@
AddHandler application/x-httpd-php .tpl

Maaiins marked this conversation as resolved.
Show resolved Hide resolved
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule api/(.*)$ api/index.php?owa_rest_params=$1 [QSA,NC,L]
</IfModule>

51 changes: 0 additions & 51 deletions api.php

This file was deleted.

7 changes: 1 addition & 6 deletions modules/base/classes/resultSetManager.php
Expand Up @@ -1604,12 +1604,7 @@ function makeResultSetUrls() {
$query_params['do'] = 'reports';
$query_params['module'] = 'base';
$query_params['version'] = 'v1';
$query_params['apiKey'] = owa_coreAPI::getCurrentUser()->getUserData('api_key');
Maaiins marked this conversation as resolved.
Show resolved Hide resolved
} else {
$api_url = owa_coreAPI::getSetting('base', 'api_url');
// add api command
$query_params['do'] = 'getResultSet';
}
}


//add format
Expand Down
1 change: 0 additions & 1 deletion modules/base/classes/settings.php
Expand Up @@ -770,7 +770,6 @@ private function setupPaths() {
$this->set('base','images_url', $modules_url);
$this->set('base','images_absolute_url',$modules_url);
$this->set('base','log_url',$public_url.'log.php');
$this->set('base','api_url',$public_url.'api.php');
$this->set('base','rest_api_url',$public_url.'api/index.php');

$this->set('base', 'error_log_file', OWA_DATA_DIR . 'logs/errors_'. owa_coreAPI::generateInstanceSpecificHash() .'.txt');
Expand Down
6 changes: 6 additions & 0 deletions modules/base/controllers/reportsRestController.php
Expand Up @@ -21,6 +21,12 @@
*/
class owa_reportsRestController extends owa_reportController {

function __construct($params) {

parent::__construct($params);
$this->setRequiredCapability('view_reports');
}

function validate() {

// if no report name is specified do these validations necesary for generic resultSet.
Expand Down
2 changes: 1 addition & 1 deletion modules/base/js/owa.js
Expand Up @@ -137,7 +137,7 @@
},

getApiEndpoint : function() {
return this.config['api_endpoint'] || this.getSetting('baseUrl') + 'api.php';
return this.config['rest_api_endpoint'] || this.getSetting('baseUrl') + 'api/';
},

loadHeatmap: function(p) {
Expand Down
19 changes: 13 additions & 6 deletions modules/base/js/owa.player.js
Expand Up @@ -59,8 +59,8 @@ OWA.player.prototype = {
},

load : function(data) {

this.stream = data;
this.stream = data.data;
// count the events in the queue
this.queue_count = this.stream.events.length;
},
Expand All @@ -72,7 +72,10 @@ OWA.player.prototype = {

var p = unescape(OWA.state.getStateFromCookie('overlay'));
var params = JSON.parse(p);
params.action = 'getDomstream';
params.action = 'domstreams';
params.module = 'domstream';
params.version = 'v1';

//alert(params.action);
//alert(unescape(JSON.stringify(params)));
//closure
Expand Down Expand Up @@ -160,9 +163,13 @@ OWA.player.prototype = {

// change control static color
jQuery('#owa_overlay_start').removeClass('active');
if (!this.timer) return false;
clearInterval(this.timer);
this.setStatus('Ready.');
if (!this.timer) {
return false;
}

clearInterval(this.timer);

this.setStatus('Ready.');

},

Expand Down
7 changes: 3 additions & 4 deletions modules/base/js/owa.tracker-combined-min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 5 additions & 4 deletions modules/base/js/owa.tracker.js
Expand Up @@ -763,10 +763,11 @@ OWA.tracker.prototype = {
logEvent : function (properties, block, callback) {

if (this.active) {

var url = this._assembleRequestUrl(properties);
var limit = this.getOption('getRequestCharacterLimit');
if ( url.length > limit ) {

//this.cdPost( this.prepareRequestData( properties ) );
var data = this.prepareRequestData( properties );
this.cdPost( data );
Expand Down Expand Up @@ -1423,9 +1424,9 @@ OWA.tracker.prototype = {

if (event != undefined) {
this.event_queue.push(event.getProperties());
//console.debug("Now logging %s for: %d", event.get('event_type'), now);
console.debug("Now logging %s for: %d", event.get('event_type'), now);
} else {
//console.debug("No event properties to log");
console.debug("No event properties to log");
}

}
Expand Down Expand Up @@ -2289,7 +2290,7 @@ OWA.tracker.prototype = {
logDomStream : function() {

var domstream = new OWA.event;

if ( this.event_queue.length > this.options.domstreamEventThreshold ) {

// make an domstream_id if one does not exist. needed for upstream processing
Expand Down
2 changes: 1 addition & 1 deletion modules/base/module.php
Expand Up @@ -570,7 +570,7 @@ function registerApiMethods() {
$this->registerRestApiRoute( 'v1', 'users', 'POST', 'owa_addUserRestController', 'controllers/addUserRestController.php' );
$this->registerRestApiRoute( 'v1', 'users', 'DELETE', 'owa_deleteUserRestController', 'controllers/deleteUserRestController.php' );
$this->registerRestApiRoute( 'v1', 'siteUsers', 'POST', 'owa_siteAddAllowedUserRestController', 'controllers/siteAddAllowedUserRestController.php' );
$this->registerRestApiRoute( 'v1', 'reports', 'GET', 'owa_reportsRestController', 'controllers/reportsRestController.php' );
$this->registerRestApiRoute( 'v1', 'reports', 'GET', 'owa_reportsRestController', 'controllers/reportsRestController.php', [ 'params_order' => ['report_name'] ] );
Maaiins marked this conversation as resolved.
Show resolved Hide resolved
}

/**
Expand Down