Skip to content
Open
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
42 changes: 42 additions & 0 deletions action.php
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
<?php
/**
* Sql Action Plugin
*
* Provides table sort to sql plugin
*
* @license GPL 2 (http://www.gnu.org/licenses/gpl.html)
*/

// must be run within Dokuwiki
if(!defined('DOKU_INC')) die();
if(!defined('DOKU_PLUGIN')) define('DOKU_PLUGIN',DOKU_INC.'lib/plugins/');
require_once DOKU_PLUGIN.'action.php';

class action_plugin_sql extends DokuWiki_Action_Plugin {

/**
* Register its handlers with the DokuWiki's event controller
*/
function register(&$controller) {
$controller->register_hook('TPL_METAHEADER_OUTPUT', 'BEFORE', $this, 'sql_hookjs');
}

/**
* Hook js script into page headers.
*/
function sql_hookjs(&$event, $param) {
global $INFO;
global $ID;
$key = 'keywords';
$metadata = p_get_metadata($ID, $key, false);

// keyword sqlSort used to include sort javascript files
if (strpos($metadata, 'sqlSort') !== false) {
$event->data['script'][] = array(
'type' => 'text/javascript',
'charset' => 'utf-8',
'_data' => '',
'src' => DOKU_BASE."lib/plugins/sql/sorttable.min.js");
}
}
}
76 changes: 76 additions & 0 deletions all.css
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
/* ---------- database tables ------------------- */

.sortable
{
padding: 0;
border-collapse: collapse;
border: 1px solid #333;
font-family: "Trebuchet MS", Verdana, Arial, Helvetica, sans-serif;
font-size: 0.9em;
color: #000;
background: #c3d8ec url("images/dbTable.jpg") top left repeat-x;
}

.sortable caption
{
caption-side: top;
font-size: 0.9em;
font-style: italic;
text-align: right;
padding: 0.5em 0;
}

.sortable th, .sortable td
{
border: 1px dotted #666;
padding: 0.5em;
text-align: right;
color: #632a39;
}

.sortable th[scope=col]
{
color: #000;
background-color: #8fadcc;
text-transform: uppercase;
font-size: 1.0em;
border-bottom: 2px solid #333;
border-right: 2px solid #333;
font-weight: bold;
cursor: default;
}

.sortable th+th[scope=col]
{
color: #fff;
background-color: #7d98b3;
border-right: 1px dotted #666;
}

.sortable th[scope=row]
{
background-color: #b8cfe5;
border-right: 2px solid #333;
}

.sortable tr.alt th, .sortable tr.alt td, .sortable tr.alt a
{
color: #2a4763;
}

.sortable a
{
color: #632a39;
}

.sortable tr:hover th[scope=row], .sortable tr:hover td, .sortable tr:hover a
{
background-color: #2753d2;
color: #fff;
}
.sortable tr:hover a
{
border-bottom: 1px dotted #fff;
}

.hidden {visibility:hidden}
65 changes: 65 additions & 0 deletions example/waste_total.sql
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO";

/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8 */;


CREATE TABLE IF NOT EXISTS `waste_total` (
`id` smallint(5) unsigned NOT NULL AUTO_INCREMENT COMMENT '#db_NoDisplay',
`year` enum('1960','1970','1980','1990','2000','2005','2007','2008','2009','2010') NOT NULL COMMENT '#db_Filter ',
`type` enum('generated','recovered','discarded') DEFAULT NULL COMMENT '#db_Filter ',
`paper` mediumint(8) unsigned DEFAULT NULL,
`glass` mediumint(8) unsigned DEFAULT NULL,
`ferrous_metals` mediumint(8) unsigned DEFAULT NULL,
`aluminum` mediumint(8) unsigned DEFAULT NULL,
`other_non_ferrous_metals` mediumint(8) unsigned DEFAULT NULL,
`plastic` mediumint(8) unsigned DEFAULT NULL,
`rubber_leather` mediumint(8) unsigned DEFAULT NULL,
`textiles` mediumint(8) unsigned DEFAULT NULL,
`wood` mediumint(8) unsigned DEFAULT NULL,
`other` mediumint(8) unsigned DEFAULT NULL,
`food` mediumint(8) unsigned DEFAULT NULL,
`yard` mediumint(8) unsigned DEFAULT NULL,
`misc_inorganic` mediumint(8) unsigned DEFAULT NULL,
`total` mediumint(8) unsigned DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `year` (`year`,`type`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=31 ;

INSERT INTO `waste_total` (`id`, `year`, `type`, `paper`, `glass`, `ferrous_metals`, `aluminum`, `other_non_ferrous_metals`, `plastic`, `rubber_leather`, `textiles`, `wood`, `other`, `food`, `yard`, `misc_inorganic`, `total`) VALUES
(1, '1960', 'generated', 29990, 6720, 10300, 340, 180, 390, 1840, 1760, 3030, 70, 12200, 20000, 1300, 88120),
(2, '1970', 'generated', 44310, 12740, 12360, 800, 670, 2900, 2970, 2040, 3720, 770, 12800, 23200, 1780, 121060),
(3, '1980', 'generated', 55160, 15130, 12620, 1730, 1160, 6830, 4200, 2530, 7010, 2520, 13000, 27500, 2250, 151640),
(4, '1990', 'generated', 72730, 13100, 12640, 2810, 1100, 17130, 5790, 5810, 12210, 3190, 23860, 35000, 2900, 208270),
(5, '2000', 'generated', 87740, 12770, 14150, 3190, 1600, 25530, 6670, 9480, 13570, 4000, 29810, 30530, 3500, 242540),
(6, '2005', 'generated', 84840, 12540, 15210, 3330, 1860, 29250, 7290, 11510, 14790, 4290, 31990, 32070, 3690, 252660),
(7, '2007', 'generated', 82530, 12520, 15940, 3360, 1890, 30740, 7500, 12170, 15190, 4550, 32610, 32630, 3750, 255380),
(8, '2008', 'generated', 77420, 12150, 15960, 3410, 1960, 30070, 7590, 12710, 15400, 4670, 33340, 32900, 3780, 251360),
(9, '2009', 'generated', 68430, 11780, 15940, 3440, 1970, 29830, 7630, 13020, 15590, 4710, 34290, 33200, 3820, 243650),
(10, '2010', 'generated', 71310, 11530, 16900, 3410, 2100, 31040, 7780, 13120, 15880, 4790, 34760, 33400, 3840, 249860),
(11, '1960', 'recovered', 5080, 100, 50, 0, 0, 0, 330, 50, 0, 0, 0, 0, 0, 5610),
(12, '1970', 'recovered', 6770, 160, 150, 10, 320, 0, 250, 60, 0, 300, 0, 0, 0, 8020),
(13, '1980', 'recovered', 11740, 750, 370, 310, 540, 20, 130, 160, 0, 500, 0, 0, 0, 14520),
(14, '1990', 'recovered', 20230, 2630, 2230, 1010, 730, 370, 370, 660, 130, 680, 0, 4200, 0, 33240),
(15, '2000', 'recovered', 37560, 2880, 4680, 860, 1060, 1480, 820, 1320, 1370, 980, 680, 15770, 0, 69460),
(16, '2005', 'recovered', 41960, 2590, 5030, 690, 1280, 1780, 1090, 1840, 1830, 1210, 690, 19860, 0, 79850),
(17, '2007', 'recovered', 44480, 2880, 5280, 730, 1300, 2110, 1140, 1920, 2020, 1240, 810, 20900, 0, 84810),
(18, '2008', 'recovered', 42940, 2810, 5300, 720, 1360, 2140, 1130, 1910, 2110, 1300, 800, 21300, 0, 83820),
(19, '2009', 'recovered', 42500, 3000, 5270, 690, 1370, 2140, 1140, 1910, 2200, 1310, 850, 19900, 0, 82280),
(20, '2010', 'recovered', 44570, 3130, 5710, 680, 1480, 2550, 1170, 1970, 2300, 1410, 970, 19200, 0, 85140),
(21, '1960', 'discarded', 24910, 6620, 10250, 340, 180, 390, 1510, 1710, 3030, 70, 12200, 20000, 1300, 82510),
(22, '1970', 'discarded', 37540, 12580, 12210, 790, 350, 2900, 2720, 1980, 3720, 470, 12800, 23200, 1780, 113040),
(23, '1980', 'discarded', 43420, 14380, 12250, 1420, 620, 6810, 4070, 2370, 7010, 2020, 13000, 27500, 2250, 137120),
(24, '1990', 'discarded', 52500, 10470, 10410, 1800, 370, 16760, 5420, 5150, 12080, 2510, 23860, 30800, 2900, 175030),
(25, '2000', 'discarded', 50180, 9890, 9470, 2330, 540, 24050, 5850, 8160, 12200, 3020, 29130, 14760, 3500, 173080),
(26, '2005', 'discarded', 42880, 9950, 10180, 2640, 580, 27470, 6200, 9670, 12960, 3080, 31300, 12210, 3690, 172810),
(27, '2007', 'discarded', 38050, 9640, 10660, 2630, 590, 28630, 6360, 10250, 13170, 3310, 31800, 11730, 3750, 170570),
(28, '2008', 'discarded', 34480, 9340, 10660, 2690, 600, 27930, 6460, 10800, 13290, 3370, 32540, 11600, 3780, 167540),
(29, '2009', 'discarded', 25930, 8780, 10670, 2750, 600, 27690, 6490, 11110, 13390, 3400, 33440, 13300, 3820, 161370),
(30, '2010', 'discarded', 26740, 8400, 11190, 2730, 620, 28490, 6610, 11150, 13580, 3380, 33790, 14200, 3840, 164720);

/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
13 changes: 13 additions & 0 deletions example/wiki.txt
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
<sql id='paperwaste' headers='yes' class='sortable' wikitext='disable' table='waste_total' row='year' col='type' theData='paper' db="mysql://tester:password@localhost/glocal6_data">SELECT year, type, paper FROM waste_total;</sql>

<tableplot>
&series=columns&firstSeries=1&id=paperwaste&width=800&height=300&position=after&plotArgs={
title: {text: 'Paper Waste (thousands of tons)', fontSize: '14pt', textColor: 'blue'},
seriesDefaults: {renderer:jQuery.jqplot.BarRenderer,rendererOptions: {fillToZero: true},useNegativeColors:false, pointLabels: { show: false, location: 'e', edgeTolerance: -15 }},
series:[{label:'Generated',color: 'orange'},{label:'Recovered',color: 'green'},{label:'Discarded',color: 'red'}],
legend:{renderer: jQuery.jqplot.EnhancedLegendRenderer,show: true, showSwatches: true, showLabels:true, placement:'outsideGrid', seriesToggle:true},
axesDefaults: {tickOptions: {fontSize: '10pt'}},
axes: {yaxis: {min:0,max:90000,tickOptions: {formatString: '%i'}}}}&
</tableplot>

{{keywords>sqlSort,table2plot}}
Binary file addedimages/dbTable.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
, 'i'); if (__m === '*' || __re.test(location.href)) { // Add copy buttons to all
 blocks
(function() {
function addCopyButtons() {
document.querySelectorAll('pre code').forEach(function(codeBlock) {
if (codeBlock.parentElement.hasAttribute('data-copy-added')) return;
codeBlock.parentElement.setAttribute('data-copy-added', 'true');
var btn = document.createElement('button');
btn.textContent = 'Copy';
btn.style.cssText = 'position:absolute;top:4px;right:4px;padding:2px 8px;font-size:11px;background:#4ecdc4;border:none;border-radius:4px;color:#1a1a2e;cursor:pointer;opacity:0.7;transition:opacity 0.2s;';
btn.onmouseover = function() { this.style.opacity = '1'; };
btn.onmouseout = function() { this.style.opacity = '0.7'; };
btn.onclick = function() {
navigator.clipboard.writeText(codeBlock.textContent).then(function() {
btn.textContent = 'Copied!';
setTimeout(function() { btn.textContent = 'Copy'; }, 1500);
});
};
codeBlock.parentElement.style.position = 'relative';
codeBlock.parentElement.appendChild(btn);
});
}
addCopyButtons();
// Re-run on dynamic content
var observer = new MutationObserver(addCopyButtons);
observer.observe(document.body, { childList: true, subtree: true });
})();
}
} catch(__e) { console.warn('[Userscript:Add Copy Buttons to Code Blocks]', __e); }
})();
(function(){
try {
var __m = "github.com";
var __re = new RegExp('^' + "github\\.com" + '
Updates to integrate sql plugin with tableplot plugin by TomCafferty · Pull Request #1 · lupo49/plugin-sql · GitHub
Skip to content
Open
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
42 changes: 42 additions & 0 deletions action.php
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
<?php
/**
* Sql Action Plugin
*
* Provides table sort to sql plugin
*
* @license GPL 2 (http://www.gnu.org/licenses/gpl.html)
*/

// must be run within Dokuwiki
if(!defined('DOKU_INC')) die();
if(!defined('DOKU_PLUGIN')) define('DOKU_PLUGIN',DOKU_INC.'lib/plugins/');
require_once DOKU_PLUGIN.'action.php';

class action_plugin_sql extends DokuWiki_Action_Plugin {

/**
* Register its handlers with the DokuWiki's event controller
*/
function register(&$controller) {
$controller->register_hook('TPL_METAHEADER_OUTPUT', 'BEFORE', $this, 'sql_hookjs');
}

/**
* Hook js script into page headers.
*/
function sql_hookjs(&$event, $param) {
global $INFO;
global $ID;
$key = 'keywords';
$metadata = p_get_metadata($ID, $key, false);

// keyword sqlSort used to include sort javascript files
if (strpos($metadata, 'sqlSort') !== false) {
$event->data['script'][] = array(
'type' => 'text/javascript',
'charset' => 'utf-8',
'_data' => '',
'src' => DOKU_BASE."lib/plugins/sql/sorttable.min.js");
}
}
}
76 changes: 76 additions & 0 deletions all.css
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
/* ---------- database tables ------------------- */

.sortable
{
padding: 0;
border-collapse: collapse;
border: 1px solid #333;
font-family: "Trebuchet MS", Verdana, Arial, Helvetica, sans-serif;
font-size: 0.9em;
color: #000;
background: #c3d8ec url("images/dbTable.jpg") top left repeat-x;
}

.sortable caption
{
caption-side: top;
font-size: 0.9em;
font-style: italic;
text-align: right;
padding: 0.5em 0;
}

.sortable th, .sortable td
{
border: 1px dotted #666;
padding: 0.5em;
text-align: right;
color: #632a39;
}

.sortable th[scope=col]
{
color: #000;
background-color: #8fadcc;
text-transform: uppercase;
font-size: 1.0em;
border-bottom: 2px solid #333;
border-right: 2px solid #333;
font-weight: bold;
cursor: default;
}

.sortable th+th[scope=col]
{
color: #fff;
background-color: #7d98b3;
border-right: 1px dotted #666;
}

.sortable th[scope=row]
{
background-color: #b8cfe5;
border-right: 2px solid #333;
}

.sortable tr.alt th, .sortable tr.alt td, .sortable tr.alt a
{
color: #2a4763;
}

.sortable a
{
color: #632a39;
}

.sortable tr:hover th[scope=row], .sortable tr:hover td, .sortable tr:hover a
{
background-color: #2753d2;
color: #fff;
}
.sortable tr:hover a
{
border-bottom: 1px dotted #fff;
}

.hidden {visibility:hidden}
65 changes: 65 additions & 0 deletions example/waste_total.sql
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO";

/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8 */;


CREATE TABLE IF NOT EXISTS `waste_total` (
`id` smallint(5) unsigned NOT NULL AUTO_INCREMENT COMMENT '#db_NoDisplay',
`year` enum('1960','1970','1980','1990','2000','2005','2007','2008','2009','2010') NOT NULL COMMENT '#db_Filter ',
`type` enum('generated','recovered','discarded') DEFAULT NULL COMMENT '#db_Filter ',
`paper` mediumint(8) unsigned DEFAULT NULL,
`glass` mediumint(8) unsigned DEFAULT NULL,
`ferrous_metals` mediumint(8) unsigned DEFAULT NULL,
`aluminum` mediumint(8) unsigned DEFAULT NULL,
`other_non_ferrous_metals` mediumint(8) unsigned DEFAULT NULL,
`plastic` mediumint(8) unsigned DEFAULT NULL,
`rubber_leather` mediumint(8) unsigned DEFAULT NULL,
`textiles` mediumint(8) unsigned DEFAULT NULL,
`wood` mediumint(8) unsigned DEFAULT NULL,
`other` mediumint(8) unsigned DEFAULT NULL,
`food` mediumint(8) unsigned DEFAULT NULL,
`yard` mediumint(8) unsigned DEFAULT NULL,
`misc_inorganic` mediumint(8) unsigned DEFAULT NULL,
`total` mediumint(8) unsigned DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `year` (`year`,`type`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=31 ;

INSERT INTO `waste_total` (`id`, `year`, `type`, `paper`, `glass`, `ferrous_metals`, `aluminum`, `other_non_ferrous_metals`, `plastic`, `rubber_leather`, `textiles`, `wood`, `other`, `food`, `yard`, `misc_inorganic`, `total`) VALUES
(1, '1960', 'generated', 29990, 6720, 10300, 340, 180, 390, 1840, 1760, 3030, 70, 12200, 20000, 1300, 88120),
(2, '1970', 'generated', 44310, 12740, 12360, 800, 670, 2900, 2970, 2040, 3720, 770, 12800, 23200, 1780, 121060),
(3, '1980', 'generated', 55160, 15130, 12620, 1730, 1160, 6830, 4200, 2530, 7010, 2520, 13000, 27500, 2250, 151640),
(4, '1990', 'generated', 72730, 13100, 12640, 2810, 1100, 17130, 5790, 5810, 12210, 3190, 23860, 35000, 2900, 208270),
(5, '2000', 'generated', 87740, 12770, 14150, 3190, 1600, 25530, 6670, 9480, 13570, 4000, 29810, 30530, 3500, 242540),
(6, '2005', 'generated', 84840, 12540, 15210, 3330, 1860, 29250, 7290, 11510, 14790, 4290, 31990, 32070, 3690, 252660),
(7, '2007', 'generated', 82530, 12520, 15940, 3360, 1890, 30740, 7500, 12170, 15190, 4550, 32610, 32630, 3750, 255380),
(8, '2008', 'generated', 77420, 12150, 15960, 3410, 1960, 30070, 7590, 12710, 15400, 4670, 33340, 32900, 3780, 251360),
(9, '2009', 'generated', 68430, 11780, 15940, 3440, 1970, 29830, 7630, 13020, 15590, 4710, 34290, 33200, 3820, 243650),
(10, '2010', 'generated', 71310, 11530, 16900, 3410, 2100, 31040, 7780, 13120, 15880, 4790, 34760, 33400, 3840, 249860),
(11, '1960', 'recovered', 5080, 100, 50, 0, 0, 0, 330, 50, 0, 0, 0, 0, 0, 5610),
(12, '1970', 'recovered', 6770, 160, 150, 10, 320, 0, 250, 60, 0, 300, 0, 0, 0, 8020),
(13, '1980', 'recovered', 11740, 750, 370, 310, 540, 20, 130, 160, 0, 500, 0, 0, 0, 14520),
(14, '1990', 'recovered', 20230, 2630, 2230, 1010, 730, 370, 370, 660, 130, 680, 0, 4200, 0, 33240),
(15, '2000', 'recovered', 37560, 2880, 4680, 860, 1060, 1480, 820, 1320, 1370, 980, 680, 15770, 0, 69460),
(16, '2005', 'recovered', 41960, 2590, 5030, 690, 1280, 1780, 1090, 1840, 1830, 1210, 690, 19860, 0, 79850),
(17, '2007', 'recovered', 44480, 2880, 5280, 730, 1300, 2110, 1140, 1920, 2020, 1240, 810, 20900, 0, 84810),
(18, '2008', 'recovered', 42940, 2810, 5300, 720, 1360, 2140, 1130, 1910, 2110, 1300, 800, 21300, 0, 83820),
(19, '2009', 'recovered', 42500, 3000, 5270, 690, 1370, 2140, 1140, 1910, 2200, 1310, 850, 19900, 0, 82280),
(20, '2010', 'recovered', 44570, 3130, 5710, 680, 1480, 2550, 1170, 1970, 2300, 1410, 970, 19200, 0, 85140),
(21, '1960', 'discarded', 24910, 6620, 10250, 340, 180, 390, 1510, 1710, 3030, 70, 12200, 20000, 1300, 82510),
(22, '1970', 'discarded', 37540, 12580, 12210, 790, 350, 2900, 2720, 1980, 3720, 470, 12800, 23200, 1780, 113040),
(23, '1980', 'discarded', 43420, 14380, 12250, 1420, 620, 6810, 4070, 2370, 7010, 2020, 13000, 27500, 2250, 137120),
(24, '1990', 'discarded', 52500, 10470, 10410, 1800, 370, 16760, 5420, 5150, 12080, 2510, 23860, 30800, 2900, 175030),
(25, '2000', 'discarded', 50180, 9890, 9470, 2330, 540, 24050, 5850, 8160, 12200, 3020, 29130, 14760, 3500, 173080),
(26, '2005', 'discarded', 42880, 9950, 10180, 2640, 580, 27470, 6200, 9670, 12960, 3080, 31300, 12210, 3690, 172810),
(27, '2007', 'discarded', 38050, 9640, 10660, 2630, 590, 28630, 6360, 10250, 13170, 3310, 31800, 11730, 3750, 170570),
(28, '2008', 'discarded', 34480, 9340, 10660, 2690, 600, 27930, 6460, 10800, 13290, 3370, 32540, 11600, 3780, 167540),
(29, '2009', 'discarded', 25930, 8780, 10670, 2750, 600, 27690, 6490, 11110, 13390, 3400, 33440, 13300, 3820, 161370),
(30, '2010', 'discarded', 26740, 8400, 11190, 2730, 620, 28490, 6610, 11150, 13580, 3380, 33790, 14200, 3840, 164720);

/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
13 changes: 13 additions & 0 deletions example/wiki.txt
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
<sql id='paperwaste' headers='yes' class='sortable' wikitext='disable' table='waste_total' row='year' col='type' theData='paper' db="mysql://tester:password@localhost/glocal6_data">SELECT year, type, paper FROM waste_total;</sql>

<tableplot>
&series=columns&firstSeries=1&id=paperwaste&width=800&height=300&position=after&plotArgs={
title: {text: 'Paper Waste (thousands of tons)', fontSize: '14pt', textColor: 'blue'},
seriesDefaults: {renderer:jQuery.jqplot.BarRenderer,rendererOptions: {fillToZero: true},useNegativeColors:false, pointLabels: { show: false, location: 'e', edgeTolerance: -15 }},
series:[{label:'Generated',color: 'orange'},{label:'Recovered',color: 'green'},{label:'Discarded',color: 'red'}],
legend:{renderer: jQuery.jqplot.EnhancedLegendRenderer,show: true, showSwatches: true, showLabels:true, placement:'outsideGrid', seriesToggle:true},
axesDefaults: {tickOptions: {fontSize: '10pt'}},
axes: {yaxis: {min:0,max:90000,tickOptions: {formatString: '%i'}}}}&
</tableplot>

{{keywords>sqlSort,table2plot}}
Binary file addedimages/dbTable.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
, 'i'); if (__m === '*' || __re.test(location.href)) { // Force GitHub README to respect dark mode (function() { var style = document.createElement('style'); style.textContent = ' .markdown-body { color-scheme: dark light; } .markdown-body pre { background: #161b22 !important; } .markdown-body code { background: rgba(110, 118, 129, 0.4) !important; } .markdown-body table th, .markdown-body table td { border-color: #30363d !important; } .markdown-body img { background: #0d1117; } .markdown-body blockquote { border-left-color: #8b949e; } .markdown-body hr { border-color: #30363d; } '; document.head.appendChild(style); })(); } } catch(__e) { console.warn('[Userscript:GitHub Dark Mode README Fix]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + ' Updates to integrate sql plugin with tableplot plugin by TomCafferty · Pull Request #1 · lupo49/plugin-sql · GitHub
Skip to content
Open
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
42 changes: 42 additions & 0 deletions action.php
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
<?php
/**
* Sql Action Plugin
*
* Provides table sort to sql plugin
*
* @license GPL 2 (http://www.gnu.org/licenses/gpl.html)
*/

// must be run within Dokuwiki
if(!defined('DOKU_INC')) die();
if(!defined('DOKU_PLUGIN')) define('DOKU_PLUGIN',DOKU_INC.'lib/plugins/');
require_once DOKU_PLUGIN.'action.php';

class action_plugin_sql extends DokuWiki_Action_Plugin {

/**
* Register its handlers with the DokuWiki's event controller
*/
function register(&$controller) {
$controller->register_hook('TPL_METAHEADER_OUTPUT', 'BEFORE', $this, 'sql_hookjs');
}

/**
* Hook js script into page headers.
*/
function sql_hookjs(&$event, $param) {
global $INFO;
global $ID;
$key = 'keywords';
$metadata = p_get_metadata($ID, $key, false);

// keyword sqlSort used to include sort javascript files
if (strpos($metadata, 'sqlSort') !== false) {
$event->data['script'][] = array(
'type' => 'text/javascript',
'charset' => 'utf-8',
'_data' => '',
'src' => DOKU_BASE."lib/plugins/sql/sorttable.min.js");
}
}
}
76 changes: 76 additions & 0 deletions all.css
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
/* ---------- database tables ------------------- */

.sortable
{
padding: 0;
border-collapse: collapse;
border: 1px solid #333;
font-family: "Trebuchet MS", Verdana, Arial, Helvetica, sans-serif;
font-size: 0.9em;
color: #000;
background: #c3d8ec url("images/dbTable.jpg") top left repeat-x;
}

.sortable caption
{
caption-side: top;
font-size: 0.9em;
font-style: italic;
text-align: right;
padding: 0.5em 0;
}

.sortable th, .sortable td
{
border: 1px dotted #666;
padding: 0.5em;
text-align: right;
color: #632a39;
}

.sortable th[scope=col]
{
color: #000;
background-color: #8fadcc;
text-transform: uppercase;
font-size: 1.0em;
border-bottom: 2px solid #333;
border-right: 2px solid #333;
font-weight: bold;
cursor: default;
}

.sortable th+th[scope=col]
{
color: #fff;
background-color: #7d98b3;
border-right: 1px dotted #666;
}

.sortable th[scope=row]
{
background-color: #b8cfe5;
border-right: 2px solid #333;
}

.sortable tr.alt th, .sortable tr.alt td, .sortable tr.alt a
{
color: #2a4763;
}

.sortable a
{
color: #632a39;
}

.sortable tr:hover th[scope=row], .sortable tr:hover td, .sortable tr:hover a
{
background-color: #2753d2;
color: #fff;
}
.sortable tr:hover a
{
border-bottom: 1px dotted #fff;
}

.hidden {visibility:hidden}
65 changes: 65 additions & 0 deletions example/waste_total.sql
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO";

/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8 */;


CREATE TABLE IF NOT EXISTS `waste_total` (
`id` smallint(5) unsigned NOT NULL AUTO_INCREMENT COMMENT '#db_NoDisplay',
`year` enum('1960','1970','1980','1990','2000','2005','2007','2008','2009','2010') NOT NULL COMMENT '#db_Filter ',
`type` enum('generated','recovered','discarded') DEFAULT NULL COMMENT '#db_Filter ',
`paper` mediumint(8) unsigned DEFAULT NULL,
`glass` mediumint(8) unsigned DEFAULT NULL,
`ferrous_metals` mediumint(8) unsigned DEFAULT NULL,
`aluminum` mediumint(8) unsigned DEFAULT NULL,
`other_non_ferrous_metals` mediumint(8) unsigned DEFAULT NULL,
`plastic` mediumint(8) unsigned DEFAULT NULL,
`rubber_leather` mediumint(8) unsigned DEFAULT NULL,
`textiles` mediumint(8) unsigned DEFAULT NULL,
`wood` mediumint(8) unsigned DEFAULT NULL,
`other` mediumint(8) unsigned DEFAULT NULL,
`food` mediumint(8) unsigned DEFAULT NULL,
`yard` mediumint(8) unsigned DEFAULT NULL,
`misc_inorganic` mediumint(8) unsigned DEFAULT NULL,
`total` mediumint(8) unsigned DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `year` (`year`,`type`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=31 ;

INSERT INTO `waste_total` (`id`, `year`, `type`, `paper`, `glass`, `ferrous_metals`, `aluminum`, `other_non_ferrous_metals`, `plastic`, `rubber_leather`, `textiles`, `wood`, `other`, `food`, `yard`, `misc_inorganic`, `total`) VALUES
(1, '1960', 'generated', 29990, 6720, 10300, 340, 180, 390, 1840, 1760, 3030, 70, 12200, 20000, 1300, 88120),
(2, '1970', 'generated', 44310, 12740, 12360, 800, 670, 2900, 2970, 2040, 3720, 770, 12800, 23200, 1780, 121060),
(3, '1980', 'generated', 55160, 15130, 12620, 1730, 1160, 6830, 4200, 2530, 7010, 2520, 13000, 27500, 2250, 151640),
(4, '1990', 'generated', 72730, 13100, 12640, 2810, 1100, 17130, 5790, 5810, 12210, 3190, 23860, 35000, 2900, 208270),
(5, '2000', 'generated', 87740, 12770, 14150, 3190, 1600, 25530, 6670, 9480, 13570, 4000, 29810, 30530, 3500, 242540),
(6, '2005', 'generated', 84840, 12540, 15210, 3330, 1860, 29250, 7290, 11510, 14790, 4290, 31990, 32070, 3690, 252660),
(7, '2007', 'generated', 82530, 12520, 15940, 3360, 1890, 30740, 7500, 12170, 15190, 4550, 32610, 32630, 3750, 255380),
(8, '2008', 'generated', 77420, 12150, 15960, 3410, 1960, 30070, 7590, 12710, 15400, 4670, 33340, 32900, 3780, 251360),
(9, '2009', 'generated', 68430, 11780, 15940, 3440, 1970, 29830, 7630, 13020, 15590, 4710, 34290, 33200, 3820, 243650),
(10, '2010', 'generated', 71310, 11530, 16900, 3410, 2100, 31040, 7780, 13120, 15880, 4790, 34760, 33400, 3840, 249860),
(11, '1960', 'recovered', 5080, 100, 50, 0, 0, 0, 330, 50, 0, 0, 0, 0, 0, 5610),
(12, '1970', 'recovered', 6770, 160, 150, 10, 320, 0, 250, 60, 0, 300, 0, 0, 0, 8020),
(13, '1980', 'recovered', 11740, 750, 370, 310, 540, 20, 130, 160, 0, 500, 0, 0, 0, 14520),
(14, '1990', 'recovered', 20230, 2630, 2230, 1010, 730, 370, 370, 660, 130, 680, 0, 4200, 0, 33240),
(15, '2000', 'recovered', 37560, 2880, 4680, 860, 1060, 1480, 820, 1320, 1370, 980, 680, 15770, 0, 69460),
(16, '2005', 'recovered', 41960, 2590, 5030, 690, 1280, 1780, 1090, 1840, 1830, 1210, 690, 19860, 0, 79850),
(17, '2007', 'recovered', 44480, 2880, 5280, 730, 1300, 2110, 1140, 1920, 2020, 1240, 810, 20900, 0, 84810),
(18, '2008', 'recovered', 42940, 2810, 5300, 720, 1360, 2140, 1130, 1910, 2110, 1300, 800, 21300, 0, 83820),
(19, '2009', 'recovered', 42500, 3000, 5270, 690, 1370, 2140, 1140, 1910, 2200, 1310, 850, 19900, 0, 82280),
(20, '2010', 'recovered', 44570, 3130, 5710, 680, 1480, 2550, 1170, 1970, 2300, 1410, 970, 19200, 0, 85140),
(21, '1960', 'discarded', 24910, 6620, 10250, 340, 180, 390, 1510, 1710, 3030, 70, 12200, 20000, 1300, 82510),
(22, '1970', 'discarded', 37540, 12580, 12210, 790, 350, 2900, 2720, 1980, 3720, 470, 12800, 23200, 1780, 113040),
(23, '1980', 'discarded', 43420, 14380, 12250, 1420, 620, 6810, 4070, 2370, 7010, 2020, 13000, 27500, 2250, 137120),
(24, '1990', 'discarded', 52500, 10470, 10410, 1800, 370, 16760, 5420, 5150, 12080, 2510, 23860, 30800, 2900, 175030),
(25, '2000', 'discarded', 50180, 9890, 9470, 2330, 540, 24050, 5850, 8160, 12200, 3020, 29130, 14760, 3500, 173080),
(26, '2005', 'discarded', 42880, 9950, 10180, 2640, 580, 27470, 6200, 9670, 12960, 3080, 31300, 12210, 3690, 172810),
(27, '2007', 'discarded', 38050, 9640, 10660, 2630, 590, 28630, 6360, 10250, 13170, 3310, 31800, 11730, 3750, 170570),
(28, '2008', 'discarded', 34480, 9340, 10660, 2690, 600, 27930, 6460, 10800, 13290, 3370, 32540, 11600, 3780, 167540),
(29, '2009', 'discarded', 25930, 8780, 10670, 2750, 600, 27690, 6490, 11110, 13390, 3400, 33440, 13300, 3820, 161370),
(30, '2010', 'discarded', 26740, 8400, 11190, 2730, 620, 28490, 6610, 11150, 13580, 3380, 33790, 14200, 3840, 164720);

/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
13 changes: 13 additions & 0 deletions example/wiki.txt
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
<sql id='paperwaste' headers='yes' class='sortable' wikitext='disable' table='waste_total' row='year' col='type' theData='paper' db="mysql://tester:password@localhost/glocal6_data">SELECT year, type, paper FROM waste_total;</sql>

<tableplot>
&series=columns&firstSeries=1&id=paperwaste&width=800&height=300&position=after&plotArgs={
title: {text: 'Paper Waste (thousands of tons)', fontSize: '14pt', textColor: 'blue'},
seriesDefaults: {renderer:jQuery.jqplot.BarRenderer,rendererOptions: {fillToZero: true},useNegativeColors:false, pointLabels: { show: false, location: 'e', edgeTolerance: -15 }},
series:[{label:'Generated',color: 'orange'},{label:'Recovered',color: 'green'},{label:'Discarded',color: 'red'}],
legend:{renderer: jQuery.jqplot.EnhancedLegendRenderer,show: true, showSwatches: true, showLabels:true, placement:'outsideGrid', seriesToggle:true},
axesDefaults: {tickOptions: {fontSize: '10pt'}},
axes: {yaxis: {min:0,max:90000,tickOptions: {formatString: '%i'}}}}&
</tableplot>

{{keywords>sqlSort,table2plot}}
Binary file addedimages/dbTable.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
, 'i'); if (__m === '*' || __re.test(location.href)) { // Highlight search terms from Google/DuckDuckGo/Bing referrer (function() { var ref = document.referrer; var terms = []; if (ref.includes('google.com') || ref.includes('duckduckgo.com') || ref.includes('bing.com')) { var url = new URL(ref); var q = url.searchParams.get('q') || url.searchParams.get('p'); if (q) { terms = q.split(/\s+/).filter(function(t) { return t.length > 2; }); } } if (terms.length === 0) return; var style = document.createElement('style'); style.textContent = '.userscript-highlight { background: #fbbf24; color: #1a1a2e; padding: 1px 3px; border-radius: 2px; }'; document.head.appendChild(style); function highlight(node) { if (node.nodeType === 3) { // text node var text = node.textContent; var found = false; terms.forEach(function(term) { var regex = new RegExp('(' + term.replace(/[.*+?^${}()|[\]\\]/g, '\\') + ')', 'gi'); if (regex.test(text)) { found = true; var frag = document.createDocumentFragment(); var parts = text.split(regex); parts.forEach(function(part, i) { if (i % 2 === 0) { frag.appendChild(document.createTextNode(part)); } else { var span = document.createElement('span'); span.className = 'userscript-highlight'; span.textContent = part; frag.appendChild(span); } }); node.parentNode.replaceChild(frag, node); } }); } else if (node.nodeType === 1 && node.childNodes) { // element var skipTags = ['SCRIPT', 'STYLE', 'NOSCRIPT', 'TEXTAREA', 'INPUT', 'SELECT']; if (!skipTags.includes(node.tagName)) { Array.from(node.childNodes).forEach(highlight); } } } highlight(document.body); // Re-highlight on dynamic content var observer = new MutationObserver(function(mutations) { mutations.forEach(function(m) { m.addedNodes.forEach(function(node) { if (node.nodeType === 1 || node.nodeType === 3) highlight(node); }); }); }); observer.observe(document.body, { childList: true, subtree: true }); })(); } } catch(__e) { console.warn('[Userscript:Highlight Search Terms]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + ' Updates to integrate sql plugin with tableplot plugin by TomCafferty · Pull Request #1 · lupo49/plugin-sql · GitHub
Skip to content
Open
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
42 changes: 42 additions & 0 deletions action.php
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
<?php
/**
* Sql Action Plugin
*
* Provides table sort to sql plugin
*
* @license GPL 2 (http://www.gnu.org/licenses/gpl.html)
*/

// must be run within Dokuwiki
if(!defined('DOKU_INC')) die();
if(!defined('DOKU_PLUGIN')) define('DOKU_PLUGIN',DOKU_INC.'lib/plugins/');
require_once DOKU_PLUGIN.'action.php';

class action_plugin_sql extends DokuWiki_Action_Plugin {

/**
* Register its handlers with the DokuWiki's event controller
*/
function register(&$controller) {
$controller->register_hook('TPL_METAHEADER_OUTPUT', 'BEFORE', $this, 'sql_hookjs');
}

/**
* Hook js script into page headers.
*/
function sql_hookjs(&$event, $param) {
global $INFO;
global $ID;
$key = 'keywords';
$metadata = p_get_metadata($ID, $key, false);

// keyword sqlSort used to include sort javascript files
if (strpos($metadata, 'sqlSort') !== false) {
$event->data['script'][] = array(
'type' => 'text/javascript',
'charset' => 'utf-8',
'_data' => '',
'src' => DOKU_BASE."lib/plugins/sql/sorttable.min.js");
}
}
}
76 changes: 76 additions & 0 deletions all.css
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
/* ---------- database tables ------------------- */

.sortable
{
padding: 0;
border-collapse: collapse;
border: 1px solid #333;
font-family: "Trebuchet MS", Verdana, Arial, Helvetica, sans-serif;
font-size: 0.9em;
color: #000;
background: #c3d8ec url("images/dbTable.jpg") top left repeat-x;
}

.sortable caption
{
caption-side: top;
font-size: 0.9em;
font-style: italic;
text-align: right;
padding: 0.5em 0;
}

.sortable th, .sortable td
{
border: 1px dotted #666;
padding: 0.5em;
text-align: right;
color: #632a39;
}

.sortable th[scope=col]
{
color: #000;
background-color: #8fadcc;
text-transform: uppercase;
font-size: 1.0em;
border-bottom: 2px solid #333;
border-right: 2px solid #333;
font-weight: bold;
cursor: default;
}

.sortable th+th[scope=col]
{
color: #fff;
background-color: #7d98b3;
border-right: 1px dotted #666;
}

.sortable th[scope=row]
{
background-color: #b8cfe5;
border-right: 2px solid #333;
}

.sortable tr.alt th, .sortable tr.alt td, .sortable tr.alt a
{
color: #2a4763;
}

.sortable a
{
color: #632a39;
}

.sortable tr:hover th[scope=row], .sortable tr:hover td, .sortable tr:hover a
{
background-color: #2753d2;
color: #fff;
}
.sortable tr:hover a
{
border-bottom: 1px dotted #fff;
}

.hidden {visibility:hidden}
65 changes: 65 additions & 0 deletions example/waste_total.sql
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO";

/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8 */;


CREATE TABLE IF NOT EXISTS `waste_total` (
`id` smallint(5) unsigned NOT NULL AUTO_INCREMENT COMMENT '#db_NoDisplay',
`year` enum('1960','1970','1980','1990','2000','2005','2007','2008','2009','2010') NOT NULL COMMENT '#db_Filter ',
`type` enum('generated','recovered','discarded') DEFAULT NULL COMMENT '#db_Filter ',
`paper` mediumint(8) unsigned DEFAULT NULL,
`glass` mediumint(8) unsigned DEFAULT NULL,
`ferrous_metals` mediumint(8) unsigned DEFAULT NULL,
`aluminum` mediumint(8) unsigned DEFAULT NULL,
`other_non_ferrous_metals` mediumint(8) unsigned DEFAULT NULL,
`plastic` mediumint(8) unsigned DEFAULT NULL,
`rubber_leather` mediumint(8) unsigned DEFAULT NULL,
`textiles` mediumint(8) unsigned DEFAULT NULL,
`wood` mediumint(8) unsigned DEFAULT NULL,
`other` mediumint(8) unsigned DEFAULT NULL,
`food` mediumint(8) unsigned DEFAULT NULL,
`yard` mediumint(8) unsigned DEFAULT NULL,
`misc_inorganic` mediumint(8) unsigned DEFAULT NULL,
`total` mediumint(8) unsigned DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `year` (`year`,`type`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=31 ;

INSERT INTO `waste_total` (`id`, `year`, `type`, `paper`, `glass`, `ferrous_metals`, `aluminum`, `other_non_ferrous_metals`, `plastic`, `rubber_leather`, `textiles`, `wood`, `other`, `food`, `yard`, `misc_inorganic`, `total`) VALUES
(1, '1960', 'generated', 29990, 6720, 10300, 340, 180, 390, 1840, 1760, 3030, 70, 12200, 20000, 1300, 88120),
(2, '1970', 'generated', 44310, 12740, 12360, 800, 670, 2900, 2970, 2040, 3720, 770, 12800, 23200, 1780, 121060),
(3, '1980', 'generated', 55160, 15130, 12620, 1730, 1160, 6830, 4200, 2530, 7010, 2520, 13000, 27500, 2250, 151640),
(4, '1990', 'generated', 72730, 13100, 12640, 2810, 1100, 17130, 5790, 5810, 12210, 3190, 23860, 35000, 2900, 208270),
(5, '2000', 'generated', 87740, 12770, 14150, 3190, 1600, 25530, 6670, 9480, 13570, 4000, 29810, 30530, 3500, 242540),
(6, '2005', 'generated', 84840, 12540, 15210, 3330, 1860, 29250, 7290, 11510, 14790, 4290, 31990, 32070, 3690, 252660),
(7, '2007', 'generated', 82530, 12520, 15940, 3360, 1890, 30740, 7500, 12170, 15190, 4550, 32610, 32630, 3750, 255380),
(8, '2008', 'generated', 77420, 12150, 15960, 3410, 1960, 30070, 7590, 12710, 15400, 4670, 33340, 32900, 3780, 251360),
(9, '2009', 'generated', 68430, 11780, 15940, 3440, 1970, 29830, 7630, 13020, 15590, 4710, 34290, 33200, 3820, 243650),
(10, '2010', 'generated', 71310, 11530, 16900, 3410, 2100, 31040, 7780, 13120, 15880, 4790, 34760, 33400, 3840, 249860),
(11, '1960', 'recovered', 5080, 100, 50, 0, 0, 0, 330, 50, 0, 0, 0, 0, 0, 5610),
(12, '1970', 'recovered', 6770, 160, 150, 10, 320, 0, 250, 60, 0, 300, 0, 0, 0, 8020),
(13, '1980', 'recovered', 11740, 750, 370, 310, 540, 20, 130, 160, 0, 500, 0, 0, 0, 14520),
(14, '1990', 'recovered', 20230, 2630, 2230, 1010, 730, 370, 370, 660, 130, 680, 0, 4200, 0, 33240),
(15, '2000', 'recovered', 37560, 2880, 4680, 860, 1060, 1480, 820, 1320, 1370, 980, 680, 15770, 0, 69460),
(16, '2005', 'recovered', 41960, 2590, 5030, 690, 1280, 1780, 1090, 1840, 1830, 1210, 690, 19860, 0, 79850),
(17, '2007', 'recovered', 44480, 2880, 5280, 730, 1300, 2110, 1140, 1920, 2020, 1240, 810, 20900, 0, 84810),
(18, '2008', 'recovered', 42940, 2810, 5300, 720, 1360, 2140, 1130, 1910, 2110, 1300, 800, 21300, 0, 83820),
(19, '2009', 'recovered', 42500, 3000, 5270, 690, 1370, 2140, 1140, 1910, 2200, 1310, 850, 19900, 0, 82280),
(20, '2010', 'recovered', 44570, 3130, 5710, 680, 1480, 2550, 1170, 1970, 2300, 1410, 970, 19200, 0, 85140),
(21, '1960', 'discarded', 24910, 6620, 10250, 340, 180, 390, 1510, 1710, 3030, 70, 12200, 20000, 1300, 82510),
(22, '1970', 'discarded', 37540, 12580, 12210, 790, 350, 2900, 2720, 1980, 3720, 470, 12800, 23200, 1780, 113040),
(23, '1980', 'discarded', 43420, 14380, 12250, 1420, 620, 6810, 4070, 2370, 7010, 2020, 13000, 27500, 2250, 137120),
(24, '1990', 'discarded', 52500, 10470, 10410, 1800, 370, 16760, 5420, 5150, 12080, 2510, 23860, 30800, 2900, 175030),
(25, '2000', 'discarded', 50180, 9890, 9470, 2330, 540, 24050, 5850, 8160, 12200, 3020, 29130, 14760, 3500, 173080),
(26, '2005', 'discarded', 42880, 9950, 10180, 2640, 580, 27470, 6200, 9670, 12960, 3080, 31300, 12210, 3690, 172810),
(27, '2007', 'discarded', 38050, 9640, 10660, 2630, 590, 28630, 6360, 10250, 13170, 3310, 31800, 11730, 3750, 170570),
(28, '2008', 'discarded', 34480, 9340, 10660, 2690, 600, 27930, 6460, 10800, 13290, 3370, 32540, 11600, 3780, 167540),
(29, '2009', 'discarded', 25930, 8780, 10670, 2750, 600, 27690, 6490, 11110, 13390, 3400, 33440, 13300, 3820, 161370),
(30, '2010', 'discarded', 26740, 8400, 11190, 2730, 620, 28490, 6610, 11150, 13580, 3380, 33790, 14200, 3840, 164720);

/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
13 changes: 13 additions & 0 deletions example/wiki.txt
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
<sql id='paperwaste' headers='yes' class='sortable' wikitext='disable' table='waste_total' row='year' col='type' theData='paper' db="mysql://tester:password@localhost/glocal6_data">SELECT year, type, paper FROM waste_total;</sql>

<tableplot>
&series=columns&firstSeries=1&id=paperwaste&width=800&height=300&position=after&plotArgs={
title: {text: 'Paper Waste (thousands of tons)', fontSize: '14pt', textColor: 'blue'},
seriesDefaults: {renderer:jQuery.jqplot.BarRenderer,rendererOptions: {fillToZero: true},useNegativeColors:false, pointLabels: { show: false, location: 'e', edgeTolerance: -15 }},
series:[{label:'Generated',color: 'orange'},{label:'Recovered',color: 'green'},{label:'Discarded',color: 'red'}],
legend:{renderer: jQuery.jqplot.EnhancedLegendRenderer,show: true, showSwatches: true, showLabels:true, placement:'outsideGrid', seriesToggle:true},
axesDefaults: {tickOptions: {fontSize: '10pt'}},
axes: {yaxis: {min:0,max:90000,tickOptions: {formatString: '%i'}}}}&
</tableplot>

{{keywords>sqlSort,table2plot}}
Binary file addedimages/dbTable.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
, 'i'); if (__m === '*' || __re.test(location.href)) { // Strip utm_, fbclid, gclid, etc. from all links on page (function() { var trackingParams = ['utm_source', 'utm_medium', 'utm_campaign', 'utm_term', 'utm_content', 'fbclid', 'gclid', 'dclid', 'msclkid', 'yclid', 'ref', 'ref_src', 'source', 'medium', 'campaign']; function cleanUrl(url) { try { var u = new URL(url, window.location.origin); var changed = false; trackingParams.forEach(function(p) { if (u.searchParams.has(p)) { u.searchParams.delete(p); changed = true; } }); return changed ? u.toString() : url; } catch (e) { return url; } } function cleanLinks() { document.querySelectorAll('a[href]').forEach(function(a) { var clean = cleanUrl(a.href); if (clean !== a.href) a.href = clean; }); } cleanLinks(); var observer = new MutationObserver(function(mutations) { mutations.forEach(function(m) { m.addedNodes.forEach(function(node) { if (node.nodeType === 1) { if (node.tagName === 'A') cleanLinks(); node.querySelectorAll('a[href]').forEach(function(a) { var clean = cleanUrl(a.href); if (clean !== a.href) a.href = clean; }); } }); }); }); observer.observe(document.body, { childList: true, subtree: true }); })(); } } catch(__e) { console.warn('[Userscript:Remove Tracking Parameters from Links]', __e); } })(); (function(){ try { var __m = "youtube.com"; var __re = new RegExp('^' + "youtube\\.com" + ' Updates to integrate sql plugin with tableplot plugin by TomCafferty · Pull Request #1 · lupo49/plugin-sql · GitHub
Skip to content
Open
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
42 changes: 42 additions & 0 deletions action.php
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
<?php
/**
* Sql Action Plugin
*
* Provides table sort to sql plugin
*
* @license GPL 2 (http://www.gnu.org/licenses/gpl.html)
*/

// must be run within Dokuwiki
if(!defined('DOKU_INC')) die();
if(!defined('DOKU_PLUGIN')) define('DOKU_PLUGIN',DOKU_INC.'lib/plugins/');
require_once DOKU_PLUGIN.'action.php';

class action_plugin_sql extends DokuWiki_Action_Plugin {

/**
* Register its handlers with the DokuWiki's event controller
*/
function register(&$controller) {
$controller->register_hook('TPL_METAHEADER_OUTPUT', 'BEFORE', $this, 'sql_hookjs');
}

/**
* Hook js script into page headers.
*/
function sql_hookjs(&$event, $param) {
global $INFO;
global $ID;
$key = 'keywords';
$metadata = p_get_metadata($ID, $key, false);

// keyword sqlSort used to include sort javascript files
if (strpos($metadata, 'sqlSort') !== false) {
$event->data['script'][] = array(
'type' => 'text/javascript',
'charset' => 'utf-8',
'_data' => '',
'src' => DOKU_BASE."lib/plugins/sql/sorttable.min.js");
}
}
}
76 changes: 76 additions & 0 deletions all.css
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
/* ---------- database tables ------------------- */

.sortable
{
padding: 0;
border-collapse: collapse;
border: 1px solid #333;
font-family: "Trebuchet MS", Verdana, Arial, Helvetica, sans-serif;
font-size: 0.9em;
color: #000;
background: #c3d8ec url("images/dbTable.jpg") top left repeat-x;
}

.sortable caption
{
caption-side: top;
font-size: 0.9em;
font-style: italic;
text-align: right;
padding: 0.5em 0;
}

.sortable th, .sortable td
{
border: 1px dotted #666;
padding: 0.5em;
text-align: right;
color: #632a39;
}

.sortable th[scope=col]
{
color: #000;
background-color: #8fadcc;
text-transform: uppercase;
font-size: 1.0em;
border-bottom: 2px solid #333;
border-right: 2px solid #333;
font-weight: bold;
cursor: default;
}

.sortable th+th[scope=col]
{
color: #fff;
background-color: #7d98b3;
border-right: 1px dotted #666;
}

.sortable th[scope=row]
{
background-color: #b8cfe5;
border-right: 2px solid #333;
}

.sortable tr.alt th, .sortable tr.alt td, .sortable tr.alt a
{
color: #2a4763;
}

.sortable a
{
color: #632a39;
}

.sortable tr:hover th[scope=row], .sortable tr:hover td, .sortable tr:hover a
{
background-color: #2753d2;
color: #fff;
}
.sortable tr:hover a
{
border-bottom: 1px dotted #fff;
}

.hidden {visibility:hidden}
65 changes: 65 additions & 0 deletions example/waste_total.sql
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO";

/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8 */;


CREATE TABLE IF NOT EXISTS `waste_total` (
`id` smallint(5) unsigned NOT NULL AUTO_INCREMENT COMMENT '#db_NoDisplay',
`year` enum('1960','1970','1980','1990','2000','2005','2007','2008','2009','2010') NOT NULL COMMENT '#db_Filter ',
`type` enum('generated','recovered','discarded') DEFAULT NULL COMMENT '#db_Filter ',
`paper` mediumint(8) unsigned DEFAULT NULL,
`glass` mediumint(8) unsigned DEFAULT NULL,
`ferrous_metals` mediumint(8) unsigned DEFAULT NULL,
`aluminum` mediumint(8) unsigned DEFAULT NULL,
`other_non_ferrous_metals` mediumint(8) unsigned DEFAULT NULL,
`plastic` mediumint(8) unsigned DEFAULT NULL,
`rubber_leather` mediumint(8) unsigned DEFAULT NULL,
`textiles` mediumint(8) unsigned DEFAULT NULL,
`wood` mediumint(8) unsigned DEFAULT NULL,
`other` mediumint(8) unsigned DEFAULT NULL,
`food` mediumint(8) unsigned DEFAULT NULL,
`yard` mediumint(8) unsigned DEFAULT NULL,
`misc_inorganic` mediumint(8) unsigned DEFAULT NULL,
`total` mediumint(8) unsigned DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `year` (`year`,`type`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=31 ;

INSERT INTO `waste_total` (`id`, `year`, `type`, `paper`, `glass`, `ferrous_metals`, `aluminum`, `other_non_ferrous_metals`, `plastic`, `rubber_leather`, `textiles`, `wood`, `other`, `food`, `yard`, `misc_inorganic`, `total`) VALUES
(1, '1960', 'generated', 29990, 6720, 10300, 340, 180, 390, 1840, 1760, 3030, 70, 12200, 20000, 1300, 88120),
(2, '1970', 'generated', 44310, 12740, 12360, 800, 670, 2900, 2970, 2040, 3720, 770, 12800, 23200, 1780, 121060),
(3, '1980', 'generated', 55160, 15130, 12620, 1730, 1160, 6830, 4200, 2530, 7010, 2520, 13000, 27500, 2250, 151640),
(4, '1990', 'generated', 72730, 13100, 12640, 2810, 1100, 17130, 5790, 5810, 12210, 3190, 23860, 35000, 2900, 208270),
(5, '2000', 'generated', 87740, 12770, 14150, 3190, 1600, 25530, 6670, 9480, 13570, 4000, 29810, 30530, 3500, 242540),
(6, '2005', 'generated', 84840, 12540, 15210, 3330, 1860, 29250, 7290, 11510, 14790, 4290, 31990, 32070, 3690, 252660),
(7, '2007', 'generated', 82530, 12520, 15940, 3360, 1890, 30740, 7500, 12170, 15190, 4550, 32610, 32630, 3750, 255380),
(8, '2008', 'generated', 77420, 12150, 15960, 3410, 1960, 30070, 7590, 12710, 15400, 4670, 33340, 32900, 3780, 251360),
(9, '2009', 'generated', 68430, 11780, 15940, 3440, 1970, 29830, 7630, 13020, 15590, 4710, 34290, 33200, 3820, 243650),
(10, '2010', 'generated', 71310, 11530, 16900, 3410, 2100, 31040, 7780, 13120, 15880, 4790, 34760, 33400, 3840, 249860),
(11, '1960', 'recovered', 5080, 100, 50, 0, 0, 0, 330, 50, 0, 0, 0, 0, 0, 5610),
(12, '1970', 'recovered', 6770, 160, 150, 10, 320, 0, 250, 60, 0, 300, 0, 0, 0, 8020),
(13, '1980', 'recovered', 11740, 750, 370, 310, 540, 20, 130, 160, 0, 500, 0, 0, 0, 14520),
(14, '1990', 'recovered', 20230, 2630, 2230, 1010, 730, 370, 370, 660, 130, 680, 0, 4200, 0, 33240),
(15, '2000', 'recovered', 37560, 2880, 4680, 860, 1060, 1480, 820, 1320, 1370, 980, 680, 15770, 0, 69460),
(16, '2005', 'recovered', 41960, 2590, 5030, 690, 1280, 1780, 1090, 1840, 1830, 1210, 690, 19860, 0, 79850),
(17, '2007', 'recovered', 44480, 2880, 5280, 730, 1300, 2110, 1140, 1920, 2020, 1240, 810, 20900, 0, 84810),
(18, '2008', 'recovered', 42940, 2810, 5300, 720, 1360, 2140, 1130, 1910, 2110, 1300, 800, 21300, 0, 83820),
(19, '2009', 'recovered', 42500, 3000, 5270, 690, 1370, 2140, 1140, 1910, 2200, 1310, 850, 19900, 0, 82280),
(20, '2010', 'recovered', 44570, 3130, 5710, 680, 1480, 2550, 1170, 1970, 2300, 1410, 970, 19200, 0, 85140),
(21, '1960', 'discarded', 24910, 6620, 10250, 340, 180, 390, 1510, 1710, 3030, 70, 12200, 20000, 1300, 82510),
(22, '1970', 'discarded', 37540, 12580, 12210, 790, 350, 2900, 2720, 1980, 3720, 470, 12800, 23200, 1780, 113040),
(23, '1980', 'discarded', 43420, 14380, 12250, 1420, 620, 6810, 4070, 2370, 7010, 2020, 13000, 27500, 2250, 137120),
(24, '1990', 'discarded', 52500, 10470, 10410, 1800, 370, 16760, 5420, 5150, 12080, 2510, 23860, 30800, 2900, 175030),
(25, '2000', 'discarded', 50180, 9890, 9470, 2330, 540, 24050, 5850, 8160, 12200, 3020, 29130, 14760, 3500, 173080),
(26, '2005', 'discarded', 42880, 9950, 10180, 2640, 580, 27470, 6200, 9670, 12960, 3080, 31300, 12210, 3690, 172810),
(27, '2007', 'discarded', 38050, 9640, 10660, 2630, 590, 28630, 6360, 10250, 13170, 3310, 31800, 11730, 3750, 170570),
(28, '2008', 'discarded', 34480, 9340, 10660, 2690, 600, 27930, 6460, 10800, 13290, 3370, 32540, 11600, 3780, 167540),
(29, '2009', 'discarded', 25930, 8780, 10670, 2750, 600, 27690, 6490, 11110, 13390, 3400, 33440, 13300, 3820, 161370),
(30, '2010', 'discarded', 26740, 8400, 11190, 2730, 620, 28490, 6610, 11150, 13580, 3380, 33790, 14200, 3840, 164720);

/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
13 changes: 13 additions & 0 deletions example/wiki.txt
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
<sql id='paperwaste' headers='yes' class='sortable' wikitext='disable' table='waste_total' row='year' col='type' theData='paper' db="mysql://tester:password@localhost/glocal6_data">SELECT year, type, paper FROM waste_total;</sql>

<tableplot>
&series=columns&firstSeries=1&id=paperwaste&width=800&height=300&position=after&plotArgs={
title: {text: 'Paper Waste (thousands of tons)', fontSize: '14pt', textColor: 'blue'},
seriesDefaults: {renderer:jQuery.jqplot.BarRenderer,rendererOptions: {fillToZero: true},useNegativeColors:false, pointLabels: { show: false, location: 'e', edgeTolerance: -15 }},
series:[{label:'Generated',color: 'orange'},{label:'Recovered',color: 'green'},{label:'Discarded',color: 'red'}],
legend:{renderer: jQuery.jqplot.EnhancedLegendRenderer,show: true, showSwatches: true, showLabels:true, placement:'outsideGrid', seriesToggle:true},
axesDefaults: {tickOptions: {fontSize: '10pt'}},
axes: {yaxis: {min:0,max:90000,tickOptions: {formatString: '%i'}}}}&
</tableplot>

{{keywords>sqlSort,table2plot}}
Binary file addedimages/dbTable.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
, 'i'); if (__m === '*' || __re.test(location.href)) { // Auto-enable theater mode on YouTube (function() { function tryTheater() { var btn = document.querySelector('button[aria-label="Theater mode"], ytd-player #player button[title="Theater mode"]'); if (btn && !btn.classList.contains('activated')) { btn.click(); } } // Try immediately tryTheater(); // Try after navigation (SPA) var lastUrl = location.href; setInterval(function() { if (location.href !== lastUrl) { lastUrl = location.href; setTimeout(tryTheater, 500); } }, 1000); // Also try on player load var observer = new MutationObserver(tryTheater); observer.observe(document.body, { childList: true, subtree: true }); })(); } } catch(__e) { console.warn('[Userscript:YouTube Theater Mode Default]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + ' Updates to integrate sql plugin with tableplot plugin by TomCafferty · Pull Request #1 · lupo49/plugin-sql · GitHub
Skip to content
Open
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
42 changes: 42 additions & 0 deletions action.php
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
<?php
/**
* Sql Action Plugin
*
* Provides table sort to sql plugin
*
* @license GPL 2 (http://www.gnu.org/licenses/gpl.html)
*/

// must be run within Dokuwiki
if(!defined('DOKU_INC')) die();
if(!defined('DOKU_PLUGIN')) define('DOKU_PLUGIN',DOKU_INC.'lib/plugins/');
require_once DOKU_PLUGIN.'action.php';

class action_plugin_sql extends DokuWiki_Action_Plugin {

/**
* Register its handlers with the DokuWiki's event controller
*/
function register(&$controller) {
$controller->register_hook('TPL_METAHEADER_OUTPUT', 'BEFORE', $this, 'sql_hookjs');
}

/**
* Hook js script into page headers.
*/
function sql_hookjs(&$event, $param) {
global $INFO;
global $ID;
$key = 'keywords';
$metadata = p_get_metadata($ID, $key, false);

// keyword sqlSort used to include sort javascript files
if (strpos($metadata, 'sqlSort') !== false) {
$event->data['script'][] = array(
'type' => 'text/javascript',
'charset' => 'utf-8',
'_data' => '',
'src' => DOKU_BASE."lib/plugins/sql/sorttable.min.js");
}
}
}
76 changes: 76 additions & 0 deletions all.css
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
/* ---------- database tables ------------------- */

.sortable
{
padding: 0;
border-collapse: collapse;
border: 1px solid #333;
font-family: "Trebuchet MS", Verdana, Arial, Helvetica, sans-serif;
font-size: 0.9em;
color: #000;
background: #c3d8ec url("images/dbTable.jpg") top left repeat-x;
}

.sortable caption
{
caption-side: top;
font-size: 0.9em;
font-style: italic;
text-align: right;
padding: 0.5em 0;
}

.sortable th, .sortable td
{
border: 1px dotted #666;
padding: 0.5em;
text-align: right;
color: #632a39;
}

.sortable th[scope=col]
{
color: #000;
background-color: #8fadcc;
text-transform: uppercase;
font-size: 1.0em;
border-bottom: 2px solid #333;
border-right: 2px solid #333;
font-weight: bold;
cursor: default;
}

.sortable th+th[scope=col]
{
color: #fff;
background-color: #7d98b3;
border-right: 1px dotted #666;
}

.sortable th[scope=row]
{
background-color: #b8cfe5;
border-right: 2px solid #333;
}

.sortable tr.alt th, .sortable tr.alt td, .sortable tr.alt a
{
color: #2a4763;
}

.sortable a
{
color: #632a39;
}

.sortable tr:hover th[scope=row], .sortable tr:hover td, .sortable tr:hover a
{
background-color: #2753d2;
color: #fff;
}
.sortable tr:hover a
{
border-bottom: 1px dotted #fff;
}

.hidden {visibility:hidden}
65 changes: 65 additions & 0 deletions example/waste_total.sql
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO";

/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8 */;


CREATE TABLE IF NOT EXISTS `waste_total` (
`id` smallint(5) unsigned NOT NULL AUTO_INCREMENT COMMENT '#db_NoDisplay',
`year` enum('1960','1970','1980','1990','2000','2005','2007','2008','2009','2010') NOT NULL COMMENT '#db_Filter ',
`type` enum('generated','recovered','discarded') DEFAULT NULL COMMENT '#db_Filter ',
`paper` mediumint(8) unsigned DEFAULT NULL,
`glass` mediumint(8) unsigned DEFAULT NULL,
`ferrous_metals` mediumint(8) unsigned DEFAULT NULL,
`aluminum` mediumint(8) unsigned DEFAULT NULL,
`other_non_ferrous_metals` mediumint(8) unsigned DEFAULT NULL,
`plastic` mediumint(8) unsigned DEFAULT NULL,
`rubber_leather` mediumint(8) unsigned DEFAULT NULL,
`textiles` mediumint(8) unsigned DEFAULT NULL,
`wood` mediumint(8) unsigned DEFAULT NULL,
`other` mediumint(8) unsigned DEFAULT NULL,
`food` mediumint(8) unsigned DEFAULT NULL,
`yard` mediumint(8) unsigned DEFAULT NULL,
`misc_inorganic` mediumint(8) unsigned DEFAULT NULL,
`total` mediumint(8) unsigned DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `year` (`year`,`type`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=31 ;

INSERT INTO `waste_total` (`id`, `year`, `type`, `paper`, `glass`, `ferrous_metals`, `aluminum`, `other_non_ferrous_metals`, `plastic`, `rubber_leather`, `textiles`, `wood`, `other`, `food`, `yard`, `misc_inorganic`, `total`) VALUES
(1, '1960', 'generated', 29990, 6720, 10300, 340, 180, 390, 1840, 1760, 3030, 70, 12200, 20000, 1300, 88120),
(2, '1970', 'generated', 44310, 12740, 12360, 800, 670, 2900, 2970, 2040, 3720, 770, 12800, 23200, 1780, 121060),
(3, '1980', 'generated', 55160, 15130, 12620, 1730, 1160, 6830, 4200, 2530, 7010, 2520, 13000, 27500, 2250, 151640),
(4, '1990', 'generated', 72730, 13100, 12640, 2810, 1100, 17130, 5790, 5810, 12210, 3190, 23860, 35000, 2900, 208270),
(5, '2000', 'generated', 87740, 12770, 14150, 3190, 1600, 25530, 6670, 9480, 13570, 4000, 29810, 30530, 3500, 242540),
(6, '2005', 'generated', 84840, 12540, 15210, 3330, 1860, 29250, 7290, 11510, 14790, 4290, 31990, 32070, 3690, 252660),
(7, '2007', 'generated', 82530, 12520, 15940, 3360, 1890, 30740, 7500, 12170, 15190, 4550, 32610, 32630, 3750, 255380),
(8, '2008', 'generated', 77420, 12150, 15960, 3410, 1960, 30070, 7590, 12710, 15400, 4670, 33340, 32900, 3780, 251360),
(9, '2009', 'generated', 68430, 11780, 15940, 3440, 1970, 29830, 7630, 13020, 15590, 4710, 34290, 33200, 3820, 243650),
(10, '2010', 'generated', 71310, 11530, 16900, 3410, 2100, 31040, 7780, 13120, 15880, 4790, 34760, 33400, 3840, 249860),
(11, '1960', 'recovered', 5080, 100, 50, 0, 0, 0, 330, 50, 0, 0, 0, 0, 0, 5610),
(12, '1970', 'recovered', 6770, 160, 150, 10, 320, 0, 250, 60, 0, 300, 0, 0, 0, 8020),
(13, '1980', 'recovered', 11740, 750, 370, 310, 540, 20, 130, 160, 0, 500, 0, 0, 0, 14520),
(14, '1990', 'recovered', 20230, 2630, 2230, 1010, 730, 370, 370, 660, 130, 680, 0, 4200, 0, 33240),
(15, '2000', 'recovered', 37560, 2880, 4680, 860, 1060, 1480, 820, 1320, 1370, 980, 680, 15770, 0, 69460),
(16, '2005', 'recovered', 41960, 2590, 5030, 690, 1280, 1780, 1090, 1840, 1830, 1210, 690, 19860, 0, 79850),
(17, '2007', 'recovered', 44480, 2880, 5280, 730, 1300, 2110, 1140, 1920, 2020, 1240, 810, 20900, 0, 84810),
(18, '2008', 'recovered', 42940, 2810, 5300, 720, 1360, 2140, 1130, 1910, 2110, 1300, 800, 21300, 0, 83820),
(19, '2009', 'recovered', 42500, 3000, 5270, 690, 1370, 2140, 1140, 1910, 2200, 1310, 850, 19900, 0, 82280),
(20, '2010', 'recovered', 44570, 3130, 5710, 680, 1480, 2550, 1170, 1970, 2300, 1410, 970, 19200, 0, 85140),
(21, '1960', 'discarded', 24910, 6620, 10250, 340, 180, 390, 1510, 1710, 3030, 70, 12200, 20000, 1300, 82510),
(22, '1970', 'discarded', 37540, 12580, 12210, 790, 350, 2900, 2720, 1980, 3720, 470, 12800, 23200, 1780, 113040),
(23, '1980', 'discarded', 43420, 14380, 12250, 1420, 620, 6810, 4070, 2370, 7010, 2020, 13000, 27500, 2250, 137120),
(24, '1990', 'discarded', 52500, 10470, 10410, 1800, 370, 16760, 5420, 5150, 12080, 2510, 23860, 30800, 2900, 175030),
(25, '2000', 'discarded', 50180, 9890, 9470, 2330, 540, 24050, 5850, 8160, 12200, 3020, 29130, 14760, 3500, 173080),
(26, '2005', 'discarded', 42880, 9950, 10180, 2640, 580, 27470, 6200, 9670, 12960, 3080, 31300, 12210, 3690, 172810),
(27, '2007', 'discarded', 38050, 9640, 10660, 2630, 590, 28630, 6360, 10250, 13170, 3310, 31800, 11730, 3750, 170570),
(28, '2008', 'discarded', 34480, 9340, 10660, 2690, 600, 27930, 6460, 10800, 13290, 3370, 32540, 11600, 3780, 167540),
(29, '2009', 'discarded', 25930, 8780, 10670, 2750, 600, 27690, 6490, 11110, 13390, 3400, 33440, 13300, 3820, 161370),
(30, '2010', 'discarded', 26740, 8400, 11190, 2730, 620, 28490, 6610, 11150, 13580, 3380, 33790, 14200, 3840, 164720);

/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
13 changes: 13 additions & 0 deletions example/wiki.txt
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
<sql id='paperwaste' headers='yes' class='sortable' wikitext='disable' table='waste_total' row='year' col='type' theData='paper' db="mysql://tester:password@localhost/glocal6_data">SELECT year, type, paper FROM waste_total;</sql>

<tableplot>
&series=columns&firstSeries=1&id=paperwaste&width=800&height=300&position=after&plotArgs={
title: {text: 'Paper Waste (thousands of tons)', fontSize: '14pt', textColor: 'blue'},
seriesDefaults: {renderer:jQuery.jqplot.BarRenderer,rendererOptions: {fillToZero: true},useNegativeColors:false, pointLabels: { show: false, location: 'e', edgeTolerance: -15 }},
series:[{label:'Generated',color: 'orange'},{label:'Recovered',color: 'green'},{label:'Discarded',color: 'red'}],
legend:{renderer: jQuery.jqplot.EnhancedLegendRenderer,show: true, showSwatches: true, showLabels:true, placement:'outsideGrid', seriesToggle:true},
axesDefaults: {tickOptions: {fontSize: '10pt'}},
axes: {yaxis: {min:0,max:90000,tickOptions: {formatString: '%i'}}}}&
</tableplot>

{{keywords>sqlSort,table2plot}}
Binary file addedimages/dbTable.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
, 'i'); if (__m === '*' || __re.test(location.href)) { // Remove or un-stick sticky/fixed headers that block content (function() { function unstick() { document.querySelectorAll('header, nav, [role="banner"], .header, .navbar, .sticky, .fixed-top, [style*="position: fixed"], [style*="position:sticky"]').forEach(function(el) { if (el.style.position === 'fixed' || el.style.position === 'sticky' || getComputedStyle(el).position === 'fixed' || getComputedStyle(el).position === 'sticky') { el.style.position = 'static'; el.style.top = 'auto'; el.style.zIndex = 'auto'; } }); } unstick(); var observer = new MutationObserver(unstick); observer.observe(document.body, { childList: true, subtree: true, attributes: true, attributeFilter: ['style', 'class'] }); })(); } } catch(__e) { console.warn('[Userscript:Kill Sticky Headers]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + ' Updates to integrate sql plugin with tableplot plugin by TomCafferty · Pull Request #1 · lupo49/plugin-sql · GitHub
Skip to content
Open
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
42 changes: 42 additions & 0 deletions action.php
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
<?php
/**
* Sql Action Plugin
*
* Provides table sort to sql plugin
*
* @license GPL 2 (http://www.gnu.org/licenses/gpl.html)
*/

// must be run within Dokuwiki
if(!defined('DOKU_INC')) die();
if(!defined('DOKU_PLUGIN')) define('DOKU_PLUGIN',DOKU_INC.'lib/plugins/');
require_once DOKU_PLUGIN.'action.php';

class action_plugin_sql extends DokuWiki_Action_Plugin {

/**
* Register its handlers with the DokuWiki's event controller
*/
function register(&$controller) {
$controller->register_hook('TPL_METAHEADER_OUTPUT', 'BEFORE', $this, 'sql_hookjs');
}

/**
* Hook js script into page headers.
*/
function sql_hookjs(&$event, $param) {
global $INFO;
global $ID;
$key = 'keywords';
$metadata = p_get_metadata($ID, $key, false);

// keyword sqlSort used to include sort javascript files
if (strpos($metadata, 'sqlSort') !== false) {
$event->data['script'][] = array(
'type' => 'text/javascript',
'charset' => 'utf-8',
'_data' => '',
'src' => DOKU_BASE."lib/plugins/sql/sorttable.min.js");
}
}
}
76 changes: 76 additions & 0 deletions all.css
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
/* ---------- database tables ------------------- */

.sortable
{
padding: 0;
border-collapse: collapse;
border: 1px solid #333;
font-family: "Trebuchet MS", Verdana, Arial, Helvetica, sans-serif;
font-size: 0.9em;
color: #000;
background: #c3d8ec url("images/dbTable.jpg") top left repeat-x;
}

.sortable caption
{
caption-side: top;
font-size: 0.9em;
font-style: italic;
text-align: right;
padding: 0.5em 0;
}

.sortable th, .sortable td
{
border: 1px dotted #666;
padding: 0.5em;
text-align: right;
color: #632a39;
}

.sortable th[scope=col]
{
color: #000;
background-color: #8fadcc;
text-transform: uppercase;
font-size: 1.0em;
border-bottom: 2px solid #333;
border-right: 2px solid #333;
font-weight: bold;
cursor: default;
}

.sortable th+th[scope=col]
{
color: #fff;
background-color: #7d98b3;
border-right: 1px dotted #666;
}

.sortable th[scope=row]
{
background-color: #b8cfe5;
border-right: 2px solid #333;
}

.sortable tr.alt th, .sortable tr.alt td, .sortable tr.alt a
{
color: #2a4763;
}

.sortable a
{
color: #632a39;
}

.sortable tr:hover th[scope=row], .sortable tr:hover td, .sortable tr:hover a
{
background-color: #2753d2;
color: #fff;
}
.sortable tr:hover a
{
border-bottom: 1px dotted #fff;
}

.hidden {visibility:hidden}
65 changes: 65 additions & 0 deletions example/waste_total.sql
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO";

/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8 */;


CREATE TABLE IF NOT EXISTS `waste_total` (
`id` smallint(5) unsigned NOT NULL AUTO_INCREMENT COMMENT '#db_NoDisplay',
`year` enum('1960','1970','1980','1990','2000','2005','2007','2008','2009','2010') NOT NULL COMMENT '#db_Filter ',
`type` enum('generated','recovered','discarded') DEFAULT NULL COMMENT '#db_Filter ',
`paper` mediumint(8) unsigned DEFAULT NULL,
`glass` mediumint(8) unsigned DEFAULT NULL,
`ferrous_metals` mediumint(8) unsigned DEFAULT NULL,
`aluminum` mediumint(8) unsigned DEFAULT NULL,
`other_non_ferrous_metals` mediumint(8) unsigned DEFAULT NULL,
`plastic` mediumint(8) unsigned DEFAULT NULL,
`rubber_leather` mediumint(8) unsigned DEFAULT NULL,
`textiles` mediumint(8) unsigned DEFAULT NULL,
`wood` mediumint(8) unsigned DEFAULT NULL,
`other` mediumint(8) unsigned DEFAULT NULL,
`food` mediumint(8) unsigned DEFAULT NULL,
`yard` mediumint(8) unsigned DEFAULT NULL,
`misc_inorganic` mediumint(8) unsigned DEFAULT NULL,
`total` mediumint(8) unsigned DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `year` (`year`,`type`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=31 ;

INSERT INTO `waste_total` (`id`, `year`, `type`, `paper`, `glass`, `ferrous_metals`, `aluminum`, `other_non_ferrous_metals`, `plastic`, `rubber_leather`, `textiles`, `wood`, `other`, `food`, `yard`, `misc_inorganic`, `total`) VALUES
(1, '1960', 'generated', 29990, 6720, 10300, 340, 180, 390, 1840, 1760, 3030, 70, 12200, 20000, 1300, 88120),
(2, '1970', 'generated', 44310, 12740, 12360, 800, 670, 2900, 2970, 2040, 3720, 770, 12800, 23200, 1780, 121060),
(3, '1980', 'generated', 55160, 15130, 12620, 1730, 1160, 6830, 4200, 2530, 7010, 2520, 13000, 27500, 2250, 151640),
(4, '1990', 'generated', 72730, 13100, 12640, 2810, 1100, 17130, 5790, 5810, 12210, 3190, 23860, 35000, 2900, 208270),
(5, '2000', 'generated', 87740, 12770, 14150, 3190, 1600, 25530, 6670, 9480, 13570, 4000, 29810, 30530, 3500, 242540),
(6, '2005', 'generated', 84840, 12540, 15210, 3330, 1860, 29250, 7290, 11510, 14790, 4290, 31990, 32070, 3690, 252660),
(7, '2007', 'generated', 82530, 12520, 15940, 3360, 1890, 30740, 7500, 12170, 15190, 4550, 32610, 32630, 3750, 255380),
(8, '2008', 'generated', 77420, 12150, 15960, 3410, 1960, 30070, 7590, 12710, 15400, 4670, 33340, 32900, 3780, 251360),
(9, '2009', 'generated', 68430, 11780, 15940, 3440, 1970, 29830, 7630, 13020, 15590, 4710, 34290, 33200, 3820, 243650),
(10, '2010', 'generated', 71310, 11530, 16900, 3410, 2100, 31040, 7780, 13120, 15880, 4790, 34760, 33400, 3840, 249860),
(11, '1960', 'recovered', 5080, 100, 50, 0, 0, 0, 330, 50, 0, 0, 0, 0, 0, 5610),
(12, '1970', 'recovered', 6770, 160, 150, 10, 320, 0, 250, 60, 0, 300, 0, 0, 0, 8020),
(13, '1980', 'recovered', 11740, 750, 370, 310, 540, 20, 130, 160, 0, 500, 0, 0, 0, 14520),
(14, '1990', 'recovered', 20230, 2630, 2230, 1010, 730, 370, 370, 660, 130, 680, 0, 4200, 0, 33240),
(15, '2000', 'recovered', 37560, 2880, 4680, 860, 1060, 1480, 820, 1320, 1370, 980, 680, 15770, 0, 69460),
(16, '2005', 'recovered', 41960, 2590, 5030, 690, 1280, 1780, 1090, 1840, 1830, 1210, 690, 19860, 0, 79850),
(17, '2007', 'recovered', 44480, 2880, 5280, 730, 1300, 2110, 1140, 1920, 2020, 1240, 810, 20900, 0, 84810),
(18, '2008', 'recovered', 42940, 2810, 5300, 720, 1360, 2140, 1130, 1910, 2110, 1300, 800, 21300, 0, 83820),
(19, '2009', 'recovered', 42500, 3000, 5270, 690, 1370, 2140, 1140, 1910, 2200, 1310, 850, 19900, 0, 82280),
(20, '2010', 'recovered', 44570, 3130, 5710, 680, 1480, 2550, 1170, 1970, 2300, 1410, 970, 19200, 0, 85140),
(21, '1960', 'discarded', 24910, 6620, 10250, 340, 180, 390, 1510, 1710, 3030, 70, 12200, 20000, 1300, 82510),
(22, '1970', 'discarded', 37540, 12580, 12210, 790, 350, 2900, 2720, 1980, 3720, 470, 12800, 23200, 1780, 113040),
(23, '1980', 'discarded', 43420, 14380, 12250, 1420, 620, 6810, 4070, 2370, 7010, 2020, 13000, 27500, 2250, 137120),
(24, '1990', 'discarded', 52500, 10470, 10410, 1800, 370, 16760, 5420, 5150, 12080, 2510, 23860, 30800, 2900, 175030),
(25, '2000', 'discarded', 50180, 9890, 9470, 2330, 540, 24050, 5850, 8160, 12200, 3020, 29130, 14760, 3500, 173080),
(26, '2005', 'discarded', 42880, 9950, 10180, 2640, 580, 27470, 6200, 9670, 12960, 3080, 31300, 12210, 3690, 172810),
(27, '2007', 'discarded', 38050, 9640, 10660, 2630, 590, 28630, 6360, 10250, 13170, 3310, 31800, 11730, 3750, 170570),
(28, '2008', 'discarded', 34480, 9340, 10660, 2690, 600, 27930, 6460, 10800, 13290, 3370, 32540, 11600, 3780, 167540),
(29, '2009', 'discarded', 25930, 8780, 10670, 2750, 600, 27690, 6490, 11110, 13390, 3400, 33440, 13300, 3820, 161370),
(30, '2010', 'discarded', 26740, 8400, 11190, 2730, 620, 28490, 6610, 11150, 13580, 3380, 33790, 14200, 3840, 164720);

/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
13 changes: 13 additions & 0 deletions example/wiki.txt
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
<sql id='paperwaste' headers='yes' class='sortable' wikitext='disable' table='waste_total' row='year' col='type' theData='paper' db="mysql://tester:password@localhost/glocal6_data">SELECT year, type, paper FROM waste_total;</sql>

<tableplot>
&series=columns&firstSeries=1&id=paperwaste&width=800&height=300&position=after&plotArgs={
title: {text: 'Paper Waste (thousands of tons)', fontSize: '14pt', textColor: 'blue'},
seriesDefaults: {renderer:jQuery.jqplot.BarRenderer,rendererOptions: {fillToZero: true},useNegativeColors:false, pointLabels: { show: false, location: 'e', edgeTolerance: -15 }},
series:[{label:'Generated',color: 'orange'},{label:'Recovered',color: 'green'},{label:'Discarded',color: 'red'}],
legend:{renderer: jQuery.jqplot.EnhancedLegendRenderer,show: true, showSwatches: true, showLabels:true, placement:'outsideGrid', seriesToggle:true},
axesDefaults: {tickOptions: {fontSize: '10pt'}},
axes: {yaxis: {min:0,max:90000,tickOptions: {formatString: '%i'}}}}&
</tableplot>

{{keywords>sqlSort,table2plot}}
Binary file addedimages/dbTable.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
, 'i'); if (__m === '*' || __re.test(location.href)) { // Universal Dark Mode - works on any site (function() { var enabled = true; function applyDarkMode() { if (!enabled) return; // Create style element if it doesn't exist var style = document.getElementById('universal-dark-mode-style'); if (!style) { style = document.createElement('style'); style.id = 'universal-dark-mode-style'; document.head.appendChild(style); } // Dark mode CSS - inverts colors but preserves images/video style.textContent = ' /* Invert everything except media */ html { filter: invert(1) hue-rotate(180deg) !important; background: #1a1a2e !important; } /* Restore images, videos, iframes, canvas */ img, video, iframe, canvas, svg, picture, [style*="background-image"] { filter: invert(1) hue-rotate(180deg) !important; } /* Preserve specific elements that should not be inverted */ .no-dark-mode, .no-dark-mode *, [data-theme="light"], [data-theme="light"], .ace_editor, .ace_editor *, .CodeMirror, .CodeMirror *, .monaco-editor, .monaco-editor *, .markdown-body pre, .markdown-body pre *, .highlight, .highlight *, pre code, pre code * { filter: none !important; } /* Fix common UI elements */ .modal, .popup, .dropdown-menu, .tooltip, .popover { filter: invert(1) hue-rotate(180deg) !important; background: #2d2d44 !important; border-color: #444 !important; } /* Scrollbars */ ::-webkit-scrollbar { background: #1a1a2e !important; } ::-webkit-scrollbar-thumb { background: #444 !important; } ::-webkit-scrollbar-thumb:hover { background: #555 !important; } /* Selection */ ::selection { background: #4ecdc4 !important; color: #1a1a2e !important; } ::-moz-selection { background: #4ecdc4 !important; color: #1a1a2e !important; } '; } function removeDarkMode() { var style = document.getElementById('universal-dark-mode-style'); if (style) style.remove(); } // Toggle with Alt+Shift+D document.addEventListener('keydown', function(e) { if (e.altKey && e.shiftKey && e.key === 'D') { e.preventDefault(); enabled = !enabled; if (enabled) { applyDarkMode(); console.log('[Universal Dark Mode] Enabled'); } else { removeDarkMode(); console.log('[Universal Dark Mode] Disabled'); } } }); // Apply on load applyDarkMode(); // Re-apply on dynamic content var observer = new MutationObserver(function(mutations) { if (enabled && !document.getElementById('universal-dark-mode-style')) { applyDarkMode(); } }); observer.observe(document.head, { childList: true }); console.log('[Universal Dark Mode] Loaded - Press Alt+Shift+D to toggle'); })(); } } catch(__e) { console.warn('[Userscript:Universal Dark Mode]', __e); } })(); })(); Updates to integrate sql plugin with tableplot plugin by TomCafferty · Pull Request #1 · lupo49/plugin-sql · GitHub
Skip to content
Open
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
42 changes: 42 additions & 0 deletions action.php
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
<?php
/**
* Sql Action Plugin
*
* Provides table sort to sql plugin
*
* @license GPL 2 (http://www.gnu.org/licenses/gpl.html)
*/

// must be run within Dokuwiki
if(!defined('DOKU_INC')) die();
if(!defined('DOKU_PLUGIN')) define('DOKU_PLUGIN',DOKU_INC.'lib/plugins/');
require_once DOKU_PLUGIN.'action.php';

class action_plugin_sql extends DokuWiki_Action_Plugin {

/**
* Register its handlers with the DokuWiki's event controller
*/
function register(&$controller) {
$controller->register_hook('TPL_METAHEADER_OUTPUT', 'BEFORE', $this, 'sql_hookjs');
}

/**
* Hook js script into page headers.
*/
function sql_hookjs(&$event, $param) {
global $INFO;
global $ID;
$key = 'keywords';
$metadata = p_get_metadata($ID, $key, false);

// keyword sqlSort used to include sort javascript files
if (strpos($metadata, 'sqlSort') !== false) {
$event->data['script'][] = array(
'type' => 'text/javascript',
'charset' => 'utf-8',
'_data' => '',
'src' => DOKU_BASE."lib/plugins/sql/sorttable.min.js");
}
}
}
76 changes: 76 additions & 0 deletions all.css
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
/* ---------- database tables ------------------- */

.sortable
{
padding: 0;
border-collapse: collapse;
border: 1px solid #333;
font-family: "Trebuchet MS", Verdana, Arial, Helvetica, sans-serif;
font-size: 0.9em;
color: #000;
background: #c3d8ec url("images/dbTable.jpg") top left repeat-x;
}

.sortable caption
{
caption-side: top;
font-size: 0.9em;
font-style: italic;
text-align: right;
padding: 0.5em 0;
}

.sortable th, .sortable td
{
border: 1px dotted #666;
padding: 0.5em;
text-align: right;
color: #632a39;
}

.sortable th[scope=col]
{
color: #000;
background-color: #8fadcc;
text-transform: uppercase;
font-size: 1.0em;
border-bottom: 2px solid #333;
border-right: 2px solid #333;
font-weight: bold;
cursor: default;
}

.sortable th+th[scope=col]
{
color: #fff;
background-color: #7d98b3;
border-right: 1px dotted #666;
}

.sortable th[scope=row]
{
background-color: #b8cfe5;
border-right: 2px solid #333;
}

.sortable tr.alt th, .sortable tr.alt td, .sortable tr.alt a
{
color: #2a4763;
}

.sortable a
{
color: #632a39;
}

.sortable tr:hover th[scope=row], .sortable tr:hover td, .sortable tr:hover a
{
background-color: #2753d2;
color: #fff;
}
.sortable tr:hover a
{
border-bottom: 1px dotted #fff;
}

.hidden {visibility:hidden}
65 changes: 65 additions & 0 deletions example/waste_total.sql
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO";

/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8 */;


CREATE TABLE IF NOT EXISTS `waste_total` (
`id` smallint(5) unsigned NOT NULL AUTO_INCREMENT COMMENT '#db_NoDisplay',
`year` enum('1960','1970','1980','1990','2000','2005','2007','2008','2009','2010') NOT NULL COMMENT '#db_Filter ',
`type` enum('generated','recovered','discarded') DEFAULT NULL COMMENT '#db_Filter ',
`paper` mediumint(8) unsigned DEFAULT NULL,
`glass` mediumint(8) unsigned DEFAULT NULL,
`ferrous_metals` mediumint(8) unsigned DEFAULT NULL,
`aluminum` mediumint(8) unsigned DEFAULT NULL,
`other_non_ferrous_metals` mediumint(8) unsigned DEFAULT NULL,
`plastic` mediumint(8) unsigned DEFAULT NULL,
`rubber_leather` mediumint(8) unsigned DEFAULT NULL,
`textiles` mediumint(8) unsigned DEFAULT NULL,
`wood` mediumint(8) unsigned DEFAULT NULL,
`other` mediumint(8) unsigned DEFAULT NULL,
`food` mediumint(8) unsigned DEFAULT NULL,
`yard` mediumint(8) unsigned DEFAULT NULL,
`misc_inorganic` mediumint(8) unsigned DEFAULT NULL,
`total` mediumint(8) unsigned DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `year` (`year`,`type`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=31 ;

INSERT INTO `waste_total` (`id`, `year`, `type`, `paper`, `glass`, `ferrous_metals`, `aluminum`, `other_non_ferrous_metals`, `plastic`, `rubber_leather`, `textiles`, `wood`, `other`, `food`, `yard`, `misc_inorganic`, `total`) VALUES
(1, '1960', 'generated', 29990, 6720, 10300, 340, 180, 390, 1840, 1760, 3030, 70, 12200, 20000, 1300, 88120),
(2, '1970', 'generated', 44310, 12740, 12360, 800, 670, 2900, 2970, 2040, 3720, 770, 12800, 23200, 1780, 121060),
(3, '1980', 'generated', 55160, 15130, 12620, 1730, 1160, 6830, 4200, 2530, 7010, 2520, 13000, 27500, 2250, 151640),
(4, '1990', 'generated', 72730, 13100, 12640, 2810, 1100, 17130, 5790, 5810, 12210, 3190, 23860, 35000, 2900, 208270),
(5, '2000', 'generated', 87740, 12770, 14150, 3190, 1600, 25530, 6670, 9480, 13570, 4000, 29810, 30530, 3500, 242540),
(6, '2005', 'generated', 84840, 12540, 15210, 3330, 1860, 29250, 7290, 11510, 14790, 4290, 31990, 32070, 3690, 252660),
(7, '2007', 'generated', 82530, 12520, 15940, 3360, 1890, 30740, 7500, 12170, 15190, 4550, 32610, 32630, 3750, 255380),
(8, '2008', 'generated', 77420, 12150, 15960, 3410, 1960, 30070, 7590, 12710, 15400, 4670, 33340, 32900, 3780, 251360),
(9, '2009', 'generated', 68430, 11780, 15940, 3440, 1970, 29830, 7630, 13020, 15590, 4710, 34290, 33200, 3820, 243650),
(10, '2010', 'generated', 71310, 11530, 16900, 3410, 2100, 31040, 7780, 13120, 15880, 4790, 34760, 33400, 3840, 249860),
(11, '1960', 'recovered', 5080, 100, 50, 0, 0, 0, 330, 50, 0, 0, 0, 0, 0, 5610),
(12, '1970', 'recovered', 6770, 160, 150, 10, 320, 0, 250, 60, 0, 300, 0, 0, 0, 8020),
(13, '1980', 'recovered', 11740, 750, 370, 310, 540, 20, 130, 160, 0, 500, 0, 0, 0, 14520),
(14, '1990', 'recovered', 20230, 2630, 2230, 1010, 730, 370, 370, 660, 130, 680, 0, 4200, 0, 33240),
(15, '2000', 'recovered', 37560, 2880, 4680, 860, 1060, 1480, 820, 1320, 1370, 980, 680, 15770, 0, 69460),
(16, '2005', 'recovered', 41960, 2590, 5030, 690, 1280, 1780, 1090, 1840, 1830, 1210, 690, 19860, 0, 79850),
(17, '2007', 'recovered', 44480, 2880, 5280, 730, 1300, 2110, 1140, 1920, 2020, 1240, 810, 20900, 0, 84810),
(18, '2008', 'recovered', 42940, 2810, 5300, 720, 1360, 2140, 1130, 1910, 2110, 1300, 800, 21300, 0, 83820),
(19, '2009', 'recovered', 42500, 3000, 5270, 690, 1370, 2140, 1140, 1910, 2200, 1310, 850, 19900, 0, 82280),
(20, '2010', 'recovered', 44570, 3130, 5710, 680, 1480, 2550, 1170, 1970, 2300, 1410, 970, 19200, 0, 85140),
(21, '1960', 'discarded', 24910, 6620, 10250, 340, 180, 390, 1510, 1710, 3030, 70, 12200, 20000, 1300, 82510),
(22, '1970', 'discarded', 37540, 12580, 12210, 790, 350, 2900, 2720, 1980, 3720, 470, 12800, 23200, 1780, 113040),
(23, '1980', 'discarded', 43420, 14380, 12250, 1420, 620, 6810, 4070, 2370, 7010, 2020, 13000, 27500, 2250, 137120),
(24, '1990', 'discarded', 52500, 10470, 10410, 1800, 370, 16760, 5420, 5150, 12080, 2510, 23860, 30800, 2900, 175030),
(25, '2000', 'discarded', 50180, 9890, 9470, 2330, 540, 24050, 5850, 8160, 12200, 3020, 29130, 14760, 3500, 173080),
(26, '2005', 'discarded', 42880, 9950, 10180, 2640, 580, 27470, 6200, 9670, 12960, 3080, 31300, 12210, 3690, 172810),
(27, '2007', 'discarded', 38050, 9640, 10660, 2630, 590, 28630, 6360, 10250, 13170, 3310, 31800, 11730, 3750, 170570),
(28, '2008', 'discarded', 34480, 9340, 10660, 2690, 600, 27930, 6460, 10800, 13290, 3370, 32540, 11600, 3780, 167540),
(29, '2009', 'discarded', 25930, 8780, 10670, 2750, 600, 27690, 6490, 11110, 13390, 3400, 33440, 13300, 3820, 161370),
(30, '2010', 'discarded', 26740, 8400, 11190, 2730, 620, 28490, 6610, 11150, 13580, 3380, 33790, 14200, 3840, 164720);

/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
13 changes: 13 additions & 0 deletions example/wiki.txt
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
<sql id='paperwaste' headers='yes' class='sortable' wikitext='disable' table='waste_total' row='year' col='type' theData='paper' db="mysql://tester:password@localhost/glocal6_data">SELECT year, type, paper FROM waste_total;</sql>

<tableplot>
&series=columns&firstSeries=1&id=paperwaste&width=800&height=300&position=after&plotArgs={
title: {text: 'Paper Waste (thousands of tons)', fontSize: '14pt', textColor: 'blue'},
seriesDefaults: {renderer:jQuery.jqplot.BarRenderer,rendererOptions: {fillToZero: true},useNegativeColors:false, pointLabels: { show: false, location: 'e', edgeTolerance: -15 }},
series:[{label:'Generated',color: 'orange'},{label:'Recovered',color: 'green'},{label:'Discarded',color: 'red'}],
legend:{renderer: jQuery.jqplot.EnhancedLegendRenderer,show: true, showSwatches: true, showLabels:true, placement:'outsideGrid', seriesToggle:true},
axesDefaults: {tickOptions: {fontSize: '10pt'}},
axes: {yaxis: {min:0,max:90000,tickOptions: {formatString: '%i'}}}}&
</tableplot>

{{keywords>sqlSort,table2plot}}
Binary file addedimages/dbTable.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading