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 (
return array(
array(
'name'=>'dataviz_contact',
'entity'=> 'Dashboard',
'params'=> array (
'params'=> array(
'version'=>'3',
'name'=>'dataviz_contact',
'label'=> 'Dataviz of contacts',
'url' => CRM_Utils_System::url('civicrm/dataviz/contacts', 'snippet=4'),
)
),
'url' => 'civicrm/dataviz/contacts?snippet=4',
),
),
1=>array (
array(
'name'=>'dataviz_events',
'entity'=> 'Dashboard',
'params'=> array (
'params'=> array(
'version'=>'3',
'name'=>'dataviz_event',
'label'=> 'Dataviz of events',
'url' => CRM_Utils_System::url('civicrm/dataviz/events', 'snippet=4'),
)
),
'url' => 'civicrm/dataviz/events?snippet=4',
),
),
2=>array (
array(
'name'=>'dataviz_contribute',
'entity'=> 'Dashboard',
'params'=> array (
'params'=> array(
'version'=>'3',
'name'=>'dataviz_contribute',
'label'=> 'Dataviz of contributions',
'url' => CRM_Utils_System::url('civicrm/dataviz/contribute', 'snippet=4'),
)
)
'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,25 +14,34 @@ function smarty_function_crmSQL($params, &$smarty) {
$parameters = array();
try{
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) {
$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"};
$name=$value->name;
$type=$value->type;
if(array_key_exists($name, $params)){
$parameters[$var] = array($params[$name],$type);
}
}
}
else if(array_key_exists('sql', $params)){
elseif(array_key_exists('sql', $params)){
$sql = $params["sql"];
}
else if(array_key_exists('file', $params)){
$sql = file_get_contents('queries/'.$params["file"].".sql", true);
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);
}
$forbidden=array("delete ", "drop ","update ","grant ");
......@@ -49,14 +58,23 @@ function smarty_function_crmSQL($params, &$smarty) {
$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();
$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){
......@@ -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.
......@@ -16,7 +16,7 @@ function _civicrm_api3_basic_getsql ($params,$sql) {
require_once 'civisualize.civix.php';
function civicrm_civicrm_dashboard( $contactID, &$contentPlacement ) {
function civisualize_civicrm_dashboard( $contactID, &$contentPlacement ) {
CRM_Core_Resources::singleton()
->addScriptFile('eu.tttp.civisualize', 'js/d3.v3.js', 110, 'html-header', FALSE)
->addScriptFile('eu.tttp.civisualize', 'js/dc/dc.js', 110, 'html-header', FALSE)
......@@ -93,32 +93,22 @@ function civisualize_civicrm_managed(&$entities) {
return _civisualize_civix_civicrm_managed($entities);
}
/**
*
*Adds a navigation menu item under report.
*
*/
* Adds a navigation menu item under report.
*
* @param array $params
*/
function civisualize_civicrm_navigationMenu( &$params ) {
// get the id of Administer Menu
$reportMenuId = CRM_Core_DAO::getFieldValue('CRM_Core_BAO_Navigation', 'Reports', 'id', 'name');
// skip adding menu if there is no administer menu
if ($reportMenuId) {
// get the maximum key under adminster menu
$maxKey = max( array_keys($params[$reportMenuId]['child']));
$params[$reportMenuId]['child'][$maxKey+1] = array (
'attributes' => array (
$path = "Reports";
$item = array(
'label' => 'Civisualize',
'name' => 'Civisualize',
'url' => 'civicrm/dataviz',
'permission' => 'access CiviReport',
'operator' => NULL,
'operator' => '',
'separator' => TRUE,
'parentID' => $reportMenuId,
'navID' => $maxKey+1,
'active' => 1
)
'active' => 1,
);
}
_civisualize_civix_insert_navigation_menu($params, $path, $item);
}
table .header-fixed {
position: fixed;
top: 40px;
z-index: 1020; /* 10 less than .navbar-fixed to prevent any overlap */
border-bottom: 1px solid #d5d5d5;
-webkit-border-radius: 0;
-moz-border-radius: 0;
border-radius: 0;
-webkit-box-shadow: inset 0 1px 0 #fff, 0 1px 5px rgba(0,0,0,.1);
-moz-box-shadow: inset 0 1px 0 #fff, 0 1px 5px rgba(0,0,0,.1);
box-shadow: inset 0 1px 0 #fff, 0 1px 5px rgba(0,0,0,.1);
filter: progid:DXImageTransform.Microsoft.gradient(enabled=false); /* IE6-9 */
}
.eventsoverview #type svg {
width:400px;
}
......
......@@ -8,8 +8,8 @@
<author>Xavier</author>
<email>xavier@tttp.eu</email>
</maintainer>
<releaseDate>2016-02-24</releaseDate>
<version>1.42</version>
<releaseDate>2017-04-09</releaseDate>
<version>4.3</version>
<develStage>stable</develStage>
<compatibility>
<ver>4.3</ver>
......@@ -17,15 +17,21 @@
<ver>4.5</ver>
<ver>4.6</ver>
<ver>4.7</ver>
<ver>4.8</ver>
<ver>4.9</ver>
<ver>5.0</ver>
<ver>5.1</ver>
<ver>5.2</ver>
<ver>5.3</ver>
</compatibility>
<civix>
<namespace>CRM/Civisualize</namespace>
</civix>
<urls>
<url desc="Main Extension Page">http://github.com/TechToThePeople/civisualize</url>
<url desc="Documentation">http://github.com/TechToThePeople/civisualize</url>
<url desc="Support">http://forum.civicrm.org</url>
<url desc="Licensing">http://civicrm.org/licensing</url>
<url desc="Main Extension Page">https://github.com/TechToThePeople/civisualize</url>
<url desc="Documentation">https://github.com/TechToThePeople/civisualize</url>
<url desc="Support">https://chat.civicrm.org</url>
<url desc="Licensing">https://civicrm.org/licensing</url>
</urls>
......
jQuery(function($){
var url=window.location.href.replace("dataviz","datadoc");
$(".menu.secondary").append('<li class="civisualize-help"><a href="'+url+'" title="Help" class="glyphicon glyphicon-question-sign" aria-hidden="true">Help</a></li>');
$(".civisualize-help").click(function(event){
event.preventDefault();
if (typeof marqued == "function")
CRM.loadPage(url);
else
$.getScript(CRM.vars.civisualize.baseUrl + "js/marked.min.js", function(){
CRM.loadPage(url);
});
});
$('.table thead').addClass("header");
$('table.table').fixedHeader();
});
(function($) {
$.fn.fixedHeader = function (options) {
var config = {
topOffset: 40,
bgColor: '#EEEEEE'
};
if (options){ $.extend(config, options); }
return this.each( function() {
var o = $(this);
var $win = $(window)
, $head = $('thead.header', o)
, isFixed = 0;
var headTop = $head.length && $head.offset().top - config.topOffset;
function processScroll() {
if (!o.is(':visible')) return;
var i, scrollTop = $win.scrollTop();
var t = $head.length && $head.offset().top - config.topOffset;
if (!isFixed && headTop != t) { headTop = t; }
if (scrollTop >= headTop && !isFixed) { isFixed = 1; }
else if (scrollTop <= headTop && isFixed) { isFixed = 0; }
isFixed ? $('thead.header-copy', o).removeClass('hide')
: $('thead.header-copy', o).addClass('hide');
}
$win.on('scroll', processScroll);
// hack sad times - holdover until rewrite for 2.1
$head.on('click', function () {
if (!isFixed) setTimeout(function () { $win.scrollTop($win.scrollTop() - 47) }, 10);
})
$head.clone().removeClass('header').addClass('header-copy header-fixed').appendTo(o);
var ww = [];
o.find('thead.header > tr:first > th').each(function (i, h){
ww.push($(h).width());
});
$.each(ww, function (i, w){
o.find('thead.header > tr > th:eq('+i+'), thead.header-copy > tr > th:eq('+i+')').css({width: w});
});
o.find('thead.header-copy').css({