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

Use civi jquery & update libs #23

Merged
merged 3 commits into from
Jul 17, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 9 additions & 12 deletions activityreport.php
Original file line number Diff line number Diff line change
Expand Up @@ -128,18 +128,15 @@ function activityreport_civicrm_alterSettingsFolders(&$metaDataFolders = NULL) {
function activityreport_civicrm_pageRun($page) {
if ($page instanceof CRM_Activityreport_Page_ActivityReport) {
CRM_Core_Resources::singleton()
->addScriptFile('uk.co.compucorp.civicrm.activityreport', 'js/pivottable/jquery-migrate-1.4.1.min.js')
->addScriptFile('uk.co.compucorp.civicrm.activityreport', 'js/pivottable/jquery-ui.js')
->addScriptFile('uk.co.compucorp.civicrm.activityreport', 'js/pivottable/jquery-ui-1.9.2.custom.min.js')
->addScriptFile('uk.co.compucorp.civicrm.activityreport', 'js/pivottable/pivot.min.js', CRM_Core_Resources::DEFAULT_WEIGHT, 'page-header')
->addScriptFile('uk.co.compucorp.civicrm.activityreport', 'js/pivottable/d3.min.js')
->addScriptFile('uk.co.compucorp.civicrm.activityreport', 'js/pivottable/c3.min.js')
->addScriptFile('uk.co.compucorp.civicrm.activityreport', 'js/pivottable/c3_renderers.js')
->addScriptFile('uk.co.compucorp.civicrm.activityreport', 'js/pivottable/export_renderers.js');
->addScriptFile('uk.co.compucorp.civicrm.activityreport', 'packages/d3/d3.min.js', 1, 'html-header')
->addScriptFile('uk.co.compucorp.civicrm.activityreport', 'packages/c3/c3.min.js', 1, 'html-header')
->addScriptFile('uk.co.compucorp.civicrm.activityreport', 'packages/pivottable/pivot.min.js', 1, 'html-header')
->addScriptFile('uk.co.compucorp.civicrm.activityreport', 'packages/pivottable/c3_renderers.min.js', 2, 'html-header')
->addScriptFile('uk.co.compucorp.civicrm.activityreport', 'packages/pivottable-cc/export_renderers.js', 2, 'html-header');
CRM_Core_Resources::singleton()
->addStyleFile('uk.co.compucorp.civicrm.activityreport', 'css/pivottable/pivot.css')
->addStyleFile('uk.co.compucorp.civicrm.activityreport', 'css/pivottable/c3.min.css')
->addStyleFile('uk.co.compucorp.civicrm.activityreport', 'css/style.css');
->addStyleFile('uk.co.compucorp.civicrm.activityreport', 'packages/c3/c3.min.css', 1)
->addStyleFile('uk.co.compucorp.civicrm.activityreport', 'packages/pivottable/pivot.min.css', 2)
->addStyleFile('uk.co.compucorp.civicrm.activityreport', 'css/style.css', 3);
}
}

Expand All @@ -154,4 +151,4 @@ function activityreport_civicrm_permission(&$permissions) {
$permissions += array(
'access CiviCRM pivot table reports' => $prefix . ts('access CiviCRM pivot table reports'),
);
}
}
51 changes: 51 additions & 0 deletions bin/fetch_packages.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
#!/usr/bin/env php
<?php

# Fetch package files

$packages = array (
'd3' => array (
'd3.min.js',
),
'c3' => array (
'c3.min.js',
'c3.min.css',
),
'pivottable' => array (
'c3_renderers.min.js',
'd3_renderers.min.js',
'export_renderers.min.js',
'pivot.min.js',
'pivot.min.css',
),
);

$package_dir = "packages";
if (!is_dir($package_dir)) {
mkdir($package_dir, 0775);
}

foreach ($packages as $key => $files) {
$dir = "$package_dir/$key";
$version_file = "$dir/version";
if (!is_dir($dir)) {
mkdir($dir, 0775, true);
}
$json = file_get_contents("http://api.cdnjs.com/libraries/$key?fields=version,name,filename");
$info = json_decode($json, true);
$version = $info['version'];

if (is_file($version_file) AND is_readable($version_file)) {
$old_json = file_get_contents($version_file);
if ($old_json == $json) {
print "$key is already at latest version: $version\n";
continue;
}
}

file_put_contents($version_file, $json);
print "Downloading $key $version\n";
foreach ($files as $file) {
file_put_contents("$dir/$file", fopen("https://cdnjs.cloudflare.com/ajax/libs/$key/$version/$file", 'r'));
}
}
1 change: 0 additions & 1 deletion css/pivottable/c3.min.css

This file was deleted.

204 changes: 0 additions & 204 deletions css/pivottable/pivot.css

This file was deleted.

5 changes: 5 additions & 0 deletions css/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -45,3 +45,8 @@ th.pvtAxisLabel, th.pvtRowLabel, th.pvtColLabel {
select.pvtAggregator {
width: 100%;
}

.pvtHorizList li {
display: inline-block;
}

5 changes: 0 additions & 5 deletions js/pivottable/c3.min.js

This file was deleted.

Loading