Skip to content

Commit

Permalink
Include external connection handling improvements and multisession ha…
Browse files Browse the repository at this point in the history
…ndling for mini maintain ajax calls
  • Loading branch information
reportico-web committed Jul 27, 2014
1 parent ef3f293 commit af92f96
Show file tree
Hide file tree
Showing 5 changed files with 108 additions and 2 deletions.
21 changes: 21 additions & 0 deletions diffs
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
vimdiff dyngraph_pchart3.php /var/www/laravel/workbench/reportico/reportico/src/Reportico/Reportico/dyngraph_pchart3.php
vimdiff dyngraph_pchart.php /var/www/laravel/workbench/reportico/reportico/src/Reportico/Reportico/dyngraph_pchart.php
vimdiff imageget.php /var/www/laravel/workbench/reportico/reportico/src/Reportico/Reportico/imageget.php
vimdiff ./pChart/pChart.class /var/www/laravel/workbench/reportico/reportico/src/Reportico/Reportico/pChart/pChart.class
vimdiff ./pChart/pData.class /var/www/laravel/workbench/reportico/reportico/src/Reportico/Reportico/pChart/pData.class
vimdiff ./reportico.php /var/www/laravel/workbench/reportico/reportico/src/Reportico/Reportico/reportico.php
vimdiff ./swdb.php /var/www/laravel/workbench/reportico/reportico/src/Reportico/Reportico/swdb.php
vimdiff ./swgraph_flot.php /var/www/laravel/workbench/reportico/reportico/src/Reportico/Reportico/swgraph_flot.php
vimdiff ./swgraph_nvd3.php /var/www/laravel/workbench/reportico/reportico/src/Reportico/Reportico/swgraph_nvd3.php
vimdiff ./swgraph_pchart3.php /var/www/laravel/workbench/reportico/reportico/src/Reportico/Reportico/swgraph_pchart3.php
vimdiff ./swgraph_pchart.php /var/www/laravel/workbench/reportico/reportico/src/Reportico/Reportico/swgraph_pchart.php
vimdiff ./swgraph.php /var/www/laravel/workbench/reportico/reportico/src/Reportico/Reportico/swgraph.php
vimdiff ./swmodify.php /var/www/laravel/workbench/reportico/reportico/src/Reportico/Reportico/swmodify.php
vimdiff ./swoutput.php /var/www/laravel/workbench/reportico/reportico/src/Reportico/Reportico/swoutput.php
vimdiff ./swpanel.php /var/www/laravel/workbench/reportico/reportico/src/Reportico/Reportico/swpanel.php
vimdiff ./swsql.php /var/www/laravel/workbench/reportico/reportico/src/Reportico/Reportico/swsql.php
vimdiff ./swutil.php /var/www/laravel/workbench/reportico/reportico/src/Reportico/Reportico/swutil.php
vimdiff ./templates/admin.tpl /var/www/laravel/workbench/reportico/reportico/src/Reportico/Reportico/templates/admin.tpl
vimdiff ./templates/maintain.tpl /var/www/laravel/workbench/reportico/reportico/src/Reportico/Reportico/templates/maintain.tpl
vimdiff ./templates/menu.tpl /var/www/laravel/workbench/reportico/reportico/src/Reportico/Reportico/templates/menu.tpl
vimdiff ./templates/prepare.tpl /var/www/laravel/workbench/reportico/reportico/src/Reportico/Reportico/templates/prepare.tpl
5 changes: 3 additions & 2 deletions js/reportico.js
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ reportico_jquery(document).on('click', '.swMiniMaintainSubmit', function(event)
var expandpanel = reportico_jquery('#swPrpExpandCell');
reportico_jquery(loadpanel).addClass("modal-loading");

forms = reportico_jquery(this).closest('.swMntForm,.swPrpForm,form');
forms = reportico_jquery(this).closest('#reportico_container').find(".swPrpForm");
if ( reportico_jquery.type(reportico_ajax_script) === 'undefined' )
{
var ajaxaction = reportico_jquery(forms).prop("action");
Expand Down Expand Up @@ -204,7 +204,8 @@ reportico_jquery(document).on('click', '.swMiniMaintain', function(event)
maintainButton = reportico_jquery(this).prop("name");
reportico_jquery(".reportico-modal-title").html(reportico_jquery(this).prop("title"));
bits = maintainButton.split("_");
params="execute_mode=MAINTAIN&partialMaintain=" + maintainButton + "&partial_template=mini&submit_" + bits[0] + "_SHOW=1";
params = forms.serialize();
params += "&execute_mode=MAINTAIN&partialMaintain=" + maintainButton + "&partial_template=mini&submit_" + bits[0] + "_SHOW=1";
params += "&reportico_ajax_called=1";

reportico_jquery.ajax({
Expand Down
23 changes: 23 additions & 0 deletions reportico_adodb/adodb.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -439,6 +439,29 @@ function Connect($argHostname = "", $argUsername = "", $argPassword = "", $argDa
return $ret;
}

/**
* Connect to existing database
*
* @param [argHostname] Host to connect to
* @param [argUsername] Userid to login
* @param [argPassword] Associated password
* @param [argDatabaseName] database
* @param [forceNew] force new connection
*
* @return true or false
*/
function ConnectExisting($pdo)
{
$ret = true;
if (!$rez=$this->_connectExisting($pdo))
{
$err = "Connection error to existing connection ";
$ret = false;
}

return $ret;
}

function _nconnect($argHostname, $argUsername, $argPassword, $argDatabaseName)
{
return $this->_connect($argHostname, $argUsername, $argPassword, $argDatabaseName);
Expand Down
38 changes: 38 additions & 0 deletions reportico_adodb/drivers/adodb-pdo.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,44 @@ function Time()
return false;
}

// returns true or false
function _connectExisting($pdo)
{
$this->_connectionID = $pdo;
if ($this->_connectionID) {
switch(ADODB_ASSOC_CASE){
case 0: $m = PDO::CASE_LOWER; break;
case 1: $m = PDO::CASE_UPPER; break;
default:
case 2: $m = PDO::CASE_NATURAL; break;
}

//$this->_connectionID->setAttribute(PDO::ATTR_ERRMODE,PDO::ERRMODE_SILENT );
$this->_connectionID->setAttribute(PDO::ATTR_CASE,$m);

$class = 'ADODB_pdo_'.$this->dsnType;
//$this->_connectionID->setAttribute(PDO::ATTR_AUTOCOMMIT,true);
switch($this->dsnType) {
case 'oci':
case 'mysql':
case 'pgsql':
case 'mssql':
include_once(ADODB_DIR.'/drivers/adodb-pdo_'.$this->dsnType.'.inc.php');
break;
}
if (class_exists($class,false))
$this->_driver = new $class();
else
$this->_driver = new ADODB_pdo_base();

$this->_driver->_connectionID = $this->_connectionID;
$this->_UpdatePDO();
return true;
}
$this->_driver = new ADODB_pdo_base();
return false;
}

// returns true or false
function _connect($argDSN, $argUsername, $argPassword, $argDatabasename, $persist=false)
{
Expand Down
23 changes: 23 additions & 0 deletions run.php
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,29 @@
if ( $q->access_mode == "REPORTOUTPUT" )
$q->initial_execute_mode = "EXECUTE";


// Provide an existing connection to Reportico, at the moment to use this there still needs to be project
// in existence, but the connection specified here will override the
// this allows you build create temporary tables and perform other actions prior to reporting
// $q->external_connection = false;
// try
// {
// $q->external_connection = new PDO("mysql:host=localhost; username=root; password=root; dbname=ico1nnex", "root", "root" );
// }
// catch ( PDOException $ex )
// {
// $q->external_connection = false;
// // Handle Error
// }

// For setting report criteria parameters.. use the criteria name as the key and the criteria value
// $q->initial_execution_parameters = array();
// $q->initial_execution_parameters["lookupcriteria"] = "value1,value2";
// $q->initial_execution_parameters["datecriteria"] = "2014-07-01";
// $q->initial_execution_parameters["datecriteria2"] = "TODAY";
// $q->initial_execution_parameters["daterangecriteria1"] = "2014-01-01-2014-02-01";
// $q->initial_execution_parameters["daterangecriteria2"] = "FIRSTOFMONTH-LASTOFMONTH";

// The session namespace to use. Only relevant when showing more than one report in a single page. Specify a name
// to store all session variables for this instance and then when running another report instance later in the script
// use another name
Expand Down

0 comments on commit af92f96

Please sign in to comment.