Commit 46d07268 authored by bgm's avatar bgm Committed by Aegir user

Update civirules, sumfields, flexmailer, volunteer, angularprofiles, etc

parent 2cda87f4
<?php
return array (
0=>array (
'name'=>'dataviz_contact',
'entity'=> 'Dashboard',
'params'=> array (
'version'=>'3',
return array(
array(
'name'=>'dataviz_contact',
'label'=> 'Dataviz of contacts',
'url' => CRM_Utils_System::url('civicrm/dataviz/contacts', 'snippet=4'),
)
),
'entity'=> 'Dashboard',
'params'=> array(
'version'=>'3',
'name'=>'dataviz_contact',
'label'=> 'Dataviz of contacts',
'url' => 'civicrm/dataviz/contacts?snippet=4',
),
),
1=>array (
'name'=>'dataviz_events',
'entity'=> 'Dashboard',
'params'=> array (
'version'=>'3',
'name'=>'dataviz_event',
'label'=> 'Dataviz of events',
'url' => CRM_Utils_System::url('civicrm/dataviz/events', 'snippet=4'),
)
),
array(
'name'=>'dataviz_events',
'entity'=> 'Dashboard',
'params'=> array(
'version'=>'3',
'name'=>'dataviz_event',
'label'=> 'Dataviz of events',
'url' => 'civicrm/dataviz/events?snippet=4',
),
),
2=>array (
'name'=>'dataviz_contribute',
'entity'=> 'Dashboard',
'params'=> array (
'version'=>'3',
array(
'name'=>'dataviz_contribute',
'label'=> 'Dataviz of contributions',
'url' => CRM_Utils_System::url('civicrm/dataviz/contribute', 'snippet=4'),
)
)
'entity'=> 'Dashboard',
'params'=> array(
'version'=>'3',
'name'=>'dataviz_contribute',
'label'=> 'Dataviz of contributions',
'url' => 'civicrm/dataviz/contribute?snippet=4',
),
),
);
<?php
class CRM_Civisualize_Page_Doc extends CRM_Core_Page {
public function run() {
CRM_Core_Resources::singleton()
->addScriptFile('eu.tttp.civisualize', 'js/marked.min.js', 110, 'html-header', FALSE);
$request = CRM_Utils_System::currentPath();
if (false !== strpos($request, '..')) {
die ("SECURITY FATAL: the url can't contain '..'. Please report the issue on the forum at civicrm.org");
}
$request = explode('/',$request);
//print_r($request);
$tplfile = NULL;
$smarty= CRM_Core_Smarty::singleton( );
$smarty->assign("options",array());
$path = "doc/";
if (CRM_Utils_Array::value(2, $request)) {
$tplfile = _civicrm_api_get_camel_name($request[2]);
$tplfile = explode('?', $tplfile);
$file = $tplfile[0].'.md';
}
if (CRM_Utils_Array::value(3, $request)) {
$r3 = _civicrm_api_get_camel_name($request[3]);
if (!is_numeric($r3)) {
$file = $r3 .'.md';
$path = $path.$tplfile[0].'/';
}
$smarty->assign("id",$r3);
}
if (CIVISUALIZE_GITHUB_DOC) {
$smarty->assign("github",CIVISUALIZE_GITHUB_DOC);
} else {
$smarty->assign("github","TechToThePeople/civisualize");
}
// $github = civicrm_api3('setting', 'getvalue', array('group' => 'Civisualize Preferences', 'name' => 'civisualize_github_doc'));
$md = file_get_contents($path.$file, FILE_USE_INCLUDE_PATH);
if (!$md) {
$md= "$path$file not found";
$smarty->assign("error","missing_file");
}
$smarty->assign("mdfile",$file);
$smarty->assign("path",$path);
$smarty->assign("md",$md);
if (CRM_Utils_Array::value(4, $request)) {
$r3 = CRM_Utils_String::munge($request[4]);
$smarty->assign("id2",$r3);
}
if (!$tplfile) {
$tpl = "CRM/Civisualize/Page/Doc.tpl";
}
parent::run();
}
}
......@@ -10,7 +10,7 @@ class CRM_Civisualize_Page_Main extends CRM_Core_Page {
die ("SECURITY FATAL: the url can't contain '..'. Please report the issue on the forum at civicrm.org");
}
$request = split ('/',$request);
$request = explode('/',$request);
$tplfile = NULL;
$smarty= CRM_Core_Smarty::singleton( );
$smarty->assign("options",array());
......@@ -23,8 +23,12 @@ class CRM_Civisualize_Page_Main extends CRM_Core_Page {
$r3 = _civicrm_api_get_camel_name($request[3]);
$smarty->assign("id",$r3);
}
if (CRM_Utils_Array::value(4, $request)) {
$r3 = CRM_Utils_String::munge($request[4]);
$smarty->assign("id2",$r3);
}
if (!$tplfile) {
$tpl = "CRM/Civizualise/Page/Main.tpl";
$tpl = "CRM/Civisualize/Page/Main.tpl";
}
if( !$smarty->template_exists($tpl) ){
header("Status: 404 Not Found");
......@@ -54,8 +58,13 @@ class CRM_Civisualize_Page_Main extends CRM_Core_Page {
->addScriptFile('eu.tttp.civisualize', 'js/d3.v3.js', 110, 'html-header', FALSE)
->addScriptFile('eu.tttp.civisualize', 'js/dc/dc.js', 110, 'html-header', FALSE)
->addScriptFile('eu.tttp.civisualize', 'js/dc/crossfilter.js', 110, 'html-header', FALSE)
->addScriptFile('eu.tttp.civisualize', 'js/filesaver.js', 110, 'html-header', FALSE)
->addScriptFile('eu.tttp.civisualize', 'js/common.js', 110, 'html-header', FALSE)
->addStyleFile('eu.tttp.civisualize', 'js/dc/dc.css')
->addStyleFile('eu.tttp.civisualize', 'css/style.css');
->addStyleFile('eu.tttp.civisualize', 'css/style.css')
->addVars('civisualize', array(
'baseUrl' => CRM_Core_Resources::singleton()->getUrl('eu.tttp.civisualize'),
));
require_once 'CRM/Core/Smarty/plugins/function.crmSQL.php';
$smarty->register_function("crmSQL", "smarty_function_crmSQL");
......
......@@ -14,50 +14,68 @@ function smarty_function_crmSQL($params, &$smarty) {
$parameters = array();
if(array_key_exists('json', $params)){
$json=json_decode(file_get_contents('queries/'.$params["json"].".json", true));//file_get_contents('queries/'.$params["json"].".json", true)
$sql=$json->{"query"};
foreach ($json->{"params"} as $key => $value) {
$var=intval($key);
$name=$value->{"name"};
$type=$value->{"type"};
if(array_key_exists($name, $params)){
$parameters[$var] = array($params[$name],$type);
}
}
}
try{
if(array_key_exists('json', $params)){
else if(array_key_exists('sql', $params)){
$sql = $params["sql"];
}
$json=json_decode(str_replace(array("\r\n","\r","\n")," ",file_get_contents('queries/'.$params["json"].".json", true)));
$sql=$json->query;
if (!$sql){
$smarty->trigger_error("assign: missing 'query' in the json file");
$error = "crmAPI: missing 'query' in the json";
}
foreach ($json->params as $key => $value) {
$var=intval($key);
$name=$value->name;
$type=$value->type;
if(array_key_exists($name, $params)){
$parameters[$var] = array($params[$name],$type);
}
}
}
else if(array_key_exists('file', $params)){
$sql = file_get_contents('queries/'.$params["file"].".sql", true);
}
elseif(array_key_exists('sql', $params)){
$sql = $params["sql"];
}
$forbidden=array("delete ", "drop ","update ","grant ");
foreach ($forbidden as $check) {
if(strpos(strtolower($sql), $check)!==false){
$smarty->trigger_error($check."command not allowed");
$error = "crmAPI: you can not ".$check."using crmSQL";
$is_error = 1;
break;
}
}
elseif(array_key_exists('file', $params)){
$filename = 'queries/'.$params["file"].".sql";
$sql = file_get_contents($filename, true);
if (!$sql) throw new Exception ("missing filename or empty ".$filename);
if (array_key_exists('debug', $params)) {
$smarty->trigger_error("sql:". $params["sql"]);
}
}
$forbidden=array("delete ", "drop ","update ","grant ");
foreach ($forbidden as $check) {
if(strpos(strtolower($sql), $check)!==false){
$smarty->trigger_error($check."command not allowed");
$error = "crmAPI: you can not ".$check."using crmSQL";
$is_error = 1;
break;
}
}
if (array_key_exists('debug', $params)) {
$smarty->trigger_error("sql:". $params["sql"]);
}
try{
if($is_error==0){
$errorScope = CRM_Core_TemporaryErrorScope::useException();
CRM_Core_DAO::executeQuery("SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED ;");
$dao = CRM_Core_DAO::executeQuery($sql,$parameters);
$values = array();
while ($dao->fetch()) {
$keys= null;
if (array_key_exists('sequential', $params)) {
while ($dao->fetch()) {
if (!$keys) $keys= array_keys($dao->toArray());
$values[] = array_values($dao->toArray());
}
} else {
while ($dao->fetch()) {
$values[] = $dao->toArray();
}
$keys= array_keys($values[0]);
}
}
}
}
catch(Exception $e){
$is_error=1;
......@@ -72,5 +90,11 @@ function smarty_function_crmSQL($params, &$smarty) {
}
}
return json_encode(array("is_error"=>$is_error, "error"=>$error, "values" => $values), JSON_NUMERIC_CHECK);
if (array_key_exists('debug', $params)) {
return json_encode(array("is_error"=>$is_error, "keys"=> $keys, "error"=>$error, "values" => $values,"sql" => trim(preg_replace('/\s+/', ' ', $sql))), JSON_NUMERIC_CHECK);
}
if (!$smarty)
return array("is_error"=>$is_error, "keys"=> $keys, "error"=>$error, "values" => $values);
return json_encode(array("is_error"=>$is_error, "keys"=> $keys, "error"=>$error, "values" => $values), JSON_NUMERIC_CHECK);
}
......@@ -13,15 +13,15 @@ Civisualize will help you out with ready to use visualizations that we have crea
***
Installation
------------
You can install this extension directly from your civicrm site, like any other etension from Administer->System settings->Manage extensions
If you don't have a bootstrap based theme, you should install https://github.com/TechToThePeople/bootstrapvisualize
You can also live at the cutting edge and directly clone the master branch to your civiCRM extension directory using
You can directly clone to your civiCRM extension directory using
`git clone https://github.com/TechToThePeople/civisualize.git`
You can also download a zip file from
`https://codeload.github.com/TechToThePeople/civisualize/zip/master`
and extract in your extension directory. The next step is enabling the extension which can be done from `"Administer -> Customize -> Manage CiviCRM Extensions".`
Ready to Use Visualizations
---------------------------
......@@ -129,6 +129,9 @@ We have also used {crmTitle} function which let you set the title of the page, a
Checkour resources at [dc.js](http://dc-js.github.io/dc.js/) and create your first visualization.
## Documentation and help
If you want to add a document, add a markdown file that has the same name as the template into the doc folder
We love you
-------
xavier made this, sid helped him. You can find us on civicrm forum, [@eucampaign](http://twitter.com/eucampaign) and [@sid0_o](http://twitter.com/sid0_o) on twitter, or in the dc mailing group. Be warned, d3 is awesome, but the learning curve is steep. Worthwhile, the view at the top is beautiful.
......@@ -3,32 +3,39 @@
// AUTO-GENERATED FILE -- Civix may overwrite any changes made to this file
/**
* (Delegated) Implementation of hook_civicrm_config
* (Delegated) Implements hook_civicrm_config().
*
* @link http://wiki.civicrm.org/confluence/display/CRMDOC/hook_civicrm_config
*/
function _civisualize_civix_civicrm_config(&$config = NULL) {
static $configured = FALSE;
if ($configured) return;
if ($configured) {
return;
}
$configured = TRUE;
$template =& CRM_Core_Smarty::singleton();
$extRoot = dirname( __FILE__ ) . DIRECTORY_SEPARATOR;
$extRoot = dirname(__FILE__) . DIRECTORY_SEPARATOR;
$extDir = $extRoot . 'templates';
if ( is_array( $template->template_dir ) ) {
array_unshift( $template->template_dir, $extDir );
} else {
$template->template_dir = array( $extDir, $template->template_dir );
if (is_array($template->template_dir)) {
array_unshift($template->template_dir, $extDir);
}
else {
$template->template_dir = array($extDir, $template->template_dir);
}
$include_path = $extRoot . PATH_SEPARATOR . get_include_path( );
set_include_path( $include_path );
$include_path = $extRoot . PATH_SEPARATOR . get_include_path();
set_include_path($include_path);
}
/**
* (Delegated) Implementation of hook_civicrm_xmlMenu
* (Delegated) Implements hook_civicrm_xmlMenu().
*
* @param $files array(string)
*
* @link http://wiki.civicrm.org/confluence/display/CRMDOC/hook_civicrm_xmlMenu
*/
function _civisualize_civix_civicrm_xmlMenu(&$files) {
foreach (_civisualize_civix_glob(__DIR__ . '/xml/Menu/*.xml') as $file) {
......@@ -37,57 +44,82 @@ function _civisualize_civix_civicrm_xmlMenu(&$files) {
}
/**
* Implementation of hook_civicrm_install
* Implements hook_civicrm_install().
*
* @link http://wiki.civicrm.org/confluence/display/CRMDOC/hook_civicrm_install
*/
function _civisualize_civix_civicrm_install() {
_civisualize_civix_civicrm_config();
if ($upgrader = _civisualize_civix_upgrader()) {
return $upgrader->onInstall();
$upgrader->onInstall();
}
}
/**
* Implementation of hook_civicrm_uninstall
* Implements hook_civicrm_postInstall().
*
* @link http://wiki.civicrm.org/confluence/display/CRMDOC/hook_civicrm_postInstall
*/
function _civisualize_civix_civicrm_postInstall() {
_civisualize_civix_civicrm_config();
if ($upgrader = _civisualize_civix_upgrader()) {
if (is_callable(array($upgrader, 'onPostInstall'))) {
$upgrader->onPostInstall();
}
}
}
/**
* Implements hook_civicrm_uninstall().
*
* @link http://wiki.civicrm.org/confluence/display/CRMDOC/hook_civicrm_uninstall
*/
function _civisualize_civix_civicrm_uninstall() {
_civisualize_civix_civicrm_config();
if ($upgrader = _civisualize_civix_upgrader()) {
return $upgrader->onUninstall();
$upgrader->onUninstall();
}
}
/**
* (Delegated) Implementation of hook_civicrm_enable
* (Delegated) Implements hook_civicrm_enable().
*
* @link http://wiki.civicrm.org/confluence/display/CRMDOC/hook_civicrm_enable
*/
function _civisualize_civix_civicrm_enable() {
_civisualize_civix_civicrm_config();
if ($upgrader = _civisualize_civix_upgrader()) {
if (is_callable(array($upgrader, 'onEnable'))) {
return $upgrader->onEnable();
$upgrader->onEnable();
}
}
}
/**
* (Delegated) Implementation of hook_civicrm_disable
* (Delegated) Implements hook_civicrm_disable().
*
* @link http://wiki.civicrm.org/confluence/display/CRMDOC/hook_civicrm_disable
* @return mixed
*/
function _civisualize_civix_civicrm_disable() {
_civisualize_civix_civicrm_config();
if ($upgrader = _civisualize_civix_upgrader()) {
if (is_callable(array($upgrader, 'onDisable'))) {
return $upgrader->onDisable();
$upgrader->onDisable();
}
}