widget_list 1.2.5 → 1.2.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/lib/widget_list.rb +367 -299
- data/lib/widget_list/version.rb +1 -1
- metadata +1 -1
data/lib/widget_list.rb
CHANGED
@@ -63,11 +63,11 @@ module WidgetList
|
|
63
63
|
#
|
64
64
|
@fill['<!--POST_URL-->'] = $_SERVER['PATH_INFO']
|
65
65
|
@fill['<!--BUTTONS-->'] = WidgetList::Widgets::widget_button('Step One - Start ->', {'id' => 'start' , 'onclick' => "ShowStart();" , 'innerClass' => "primary" } ) +
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
66
|
+
WidgetList::Widgets::widget_button('Step Two - Fields ->', {'id' => 'fields' , 'onclick' => "ShowFields();" , 'innerClass' => "primary disabled" } ) +
|
67
|
+
WidgetList::Widgets::widget_button('Step Three - Rows ->', {'id' => 'rows' , 'onclick' => "ShowRows();" , 'innerClass' => "primary disabled" } ) +
|
68
|
+
WidgetList::Widgets::widget_button('Step Four - Search ->', {'id' => 'search' , 'onclick' => "ShowSearch();" , 'innerClass' => "primary disabled" } ) +
|
69
|
+
WidgetList::Widgets::widget_button('Step Four - Footer Actions ->', {'id' => 'footer' , 'onclick' => "ShowFooter();" , 'innerClass' => "primary disabled" } ) +
|
70
|
+
WidgetList::Widgets::widget_button('Step Five - Misc & Submit ->', {'id' => 'misc_submit', 'onclick' => "ShowSubmit();" , 'innerClass' => "success disabled" } )
|
71
71
|
|
72
72
|
|
73
73
|
#
|
@@ -299,19 +299,35 @@ module WidgetList
|
|
299
299
|
checkbox_code = ''
|
300
300
|
button_code = ''
|
301
301
|
grouping_code = ''
|
302
|
+
grouping_code2 = ''
|
303
|
+
search_out = ''
|
302
304
|
field_function_code = ''
|
303
|
-
|
305
|
+
database_type = WidgetList::List.get_db_type(page_config['primaryDatabase'] == '1' ? true : false)
|
306
|
+
using_grouping = (page_config['useGrouping'] == '1' && page_config['showSearch'] == '1' && !group_by.empty?)
|
304
307
|
#------------ DRILL DOWNS ------------
|
305
308
|
if page_config['drillDownsOn'] == "1" && !drill_downs.empty?
|
306
|
-
|
309
|
+
|
310
|
+
search_out += "
|
311
|
+
list_parms['searchFieldsOut'] = {}"
|
307
312
|
|
308
313
|
drill_downs.each { |field|
|
314
|
+
|
315
|
+
search_out += "
|
316
|
+
list_parms['searchFieldsOut']#{add_pointer(field[1]['column_to_show'],9)} true"
|
317
|
+
|
318
|
+
column_to_show = "'#{field[1]['column_to_show'].gsub(/_linked/,'')}'"
|
319
|
+
if using_grouping
|
320
|
+
if database_type == 'oracle'
|
321
|
+
column_to_show = "groupByFilter == 'none' ? '#{field[1]['column_to_show'].gsub(/_linked/,'')}' : 'MAX(#{field[1]['column_to_show'].gsub(/_linked/,'')})'"
|
322
|
+
end
|
323
|
+
end
|
324
|
+
|
309
325
|
field_function_code += "
|
310
326
|
list_parms['fieldFunction']#{add_pointer(field[1]['column_to_show'],7)} WidgetList::List::build_drill_down(
|
311
327
|
:list_id => list_parms['name'],
|
312
328
|
:drill_down_name => '#{field[0]}',
|
313
|
-
:data_to_pass_from_view =>
|
314
|
-
:column_to_show =>
|
329
|
+
:data_to_pass_from_view => #{column_to_show},
|
330
|
+
:column_to_show => #{column_to_show},
|
315
331
|
:column_alias => '#{field[1]['column_to_show']}',
|
316
332
|
:primary_database => #{page_config['primaryDatabase'] == '1' ? 'true' : 'false'}
|
317
333
|
)"
|
@@ -404,13 +420,18 @@ module WidgetList
|
|
404
420
|
checkbox_code += "
|
405
421
|
list_parms = WidgetList::List.checkbox_helper(list_parms,'#{page_config['checkboxField']}')
|
406
422
|
"
|
407
|
-
|
423
|
+
if using_grouping
|
424
|
+
visible_field_code += "
|
425
|
+
list_parms['fields']#{add_pointer('checkbox')} #{add_conditional('checkbox_header',"if groupByFilter == 'none'")}"
|
426
|
+
else
|
427
|
+
visible_field_code += "
|
408
428
|
list_parms['fields']#{add_pointer('checkbox')} 'checkbox_header'"
|
429
|
+
end
|
409
430
|
end
|
410
431
|
|
411
432
|
fields.each { |field,description|
|
412
433
|
conditional = ''
|
413
|
-
if
|
434
|
+
if using_grouping
|
414
435
|
conditional = ' if groupByFilter == \'none\''
|
415
436
|
if group_by.key?(field) || group_by.key?(field.gsub(/_linked/,''))
|
416
437
|
conditional = " if groupByFilter == 'none' || groupByFilter == 'group_#{group_by[field.gsub(/_linked/,'')].gsub(/ /,'_').downcase}'"
|
@@ -425,7 +446,7 @@ module WidgetList
|
|
425
446
|
|
426
447
|
#------------ GROUPING ------------
|
427
448
|
|
428
|
-
if
|
449
|
+
if using_grouping
|
429
450
|
variable_code += "
|
430
451
|
groupByDesc = '' # Initialize a variable you can use in listDescription to show what the current grouping selection is
|
431
452
|
groupByFilter = 'none' # This variable should be used to control business logic based on the grouping and is a short hand key rather than using what is returned from get_group_by_selection
|
@@ -434,7 +455,7 @@ module WidgetList
|
|
434
455
|
visible_field_code += "
|
435
456
|
list_parms['fields']#{add_pointer('cnt')} #{add_conditional('Count'," if groupByFilter != 'none'")}
|
436
457
|
"
|
437
|
-
if
|
458
|
+
if database_type == 'oracle'
|
438
459
|
count = 'TO_CHAR(COUNT(1))'
|
439
460
|
else
|
440
461
|
count = 'COUNT(1)'
|
@@ -476,7 +497,14 @@ module WidgetList
|
|
476
497
|
EOD
|
477
498
|
|
478
499
|
grouping_code += "
|
479
|
-
list_parms['groupByItems'] = " + '[' + descriptions.join(', ') + ']'
|
500
|
+
list_parms['groupByItems'] = " + '[' + descriptions.join(', ') + ']'
|
501
|
+
|
502
|
+
grouping_code2 = "
|
503
|
+
#
|
504
|
+
# Prevent Oracle grouping errors
|
505
|
+
#
|
506
|
+
list_parms = WidgetList::List.group_by_max_each_field(list_parms,groupByFilter)
|
507
|
+
" if database_type == 'oracle'
|
480
508
|
end
|
481
509
|
|
482
510
|
|
@@ -485,6 +513,9 @@ module WidgetList
|
|
485
513
|
if page_config['rowButtonsOn'] == '1'
|
486
514
|
visible_field_code += "
|
487
515
|
list_parms['fields'][button_column_name.downcase] = button_column_name.capitalize"
|
516
|
+
visible_field_code += " if groupByFilter == 'none'" if using_grouping
|
517
|
+
|
518
|
+
|
488
519
|
|
489
520
|
button_code += "
|
490
521
|
#
|
@@ -573,6 +604,8 @@ module WidgetList
|
|
573
604
|
#{visible_field_code}
|
574
605
|
#{hidden_field_code}
|
575
606
|
#{field_function_code}
|
607
|
+
#{search_out}
|
608
|
+
#{grouping_code2}
|
576
609
|
|
577
610
|
#
|
578
611
|
# Model
|
@@ -1021,23 +1054,23 @@ module WidgetList
|
|
1021
1054
|
|
1022
1055
|
|
1023
1056
|
@items.deep_merge!({ 'statement' =>
|
1024
|
-
|
1025
|
-
|
1026
|
-
|
1057
|
+
{'select'=>
|
1058
|
+
{'view' =>
|
1059
|
+
'
|
1027
1060
|
SELECT <!--FIELDS_PLAIN--> FROM <!--SOURCE--> <!--WHERE--> <!--GROUPBY--> <!--ORDERBY--> <!--LIMIT-->
|
1028
1061
|
'
|
1029
|
-
|
1030
|
-
|
1062
|
+
}
|
1063
|
+
}
|
1031
1064
|
})
|
1032
1065
|
|
1033
1066
|
@items.deep_merge!({ 'statement' =>
|
1034
|
-
|
1035
|
-
|
1036
|
-
|
1067
|
+
{'count'=>
|
1068
|
+
{'view' =>
|
1069
|
+
'
|
1037
1070
|
SELECT count(1) total FROM <!--VIEW--> <!--WHERE--> <!--GROUPBY-->
|
1038
1071
|
'
|
1039
|
-
|
1040
|
-
|
1072
|
+
}
|
1073
|
+
}
|
1041
1074
|
})
|
1042
1075
|
#inject site wide configs before list specific configs if a helper exists
|
1043
1076
|
|
@@ -1061,8 +1094,8 @@ module WidgetList
|
|
1061
1094
|
# if no one passed a listSearchForm inject a default one to show the ransack form
|
1062
1095
|
#
|
1063
1096
|
fill = {
|
1064
|
-
|
1065
|
-
|
1097
|
+
'<!--BUTTON_SEARCH-->' => WidgetList::Widgets::widget_button('Search', {'onclick' => WidgetList::List::build_search_button_click(@items), 'innerClass' => @items['defaultButtonClass'] }),
|
1098
|
+
'<!--BUTTON_CLOSE-->' => "HideAdvancedSearch(this)"
|
1066
1099
|
}
|
1067
1100
|
@items['listSearchForm'] = WidgetList::Utils::fill( fill , ac.render_to_string(:partial => 'widget_list/ransack_widget_list_advanced_search') )
|
1068
1101
|
|
@@ -1081,19 +1114,19 @@ module WidgetList
|
|
1081
1114
|
if get_database.db_type == 'oracle'
|
1082
1115
|
|
1083
1116
|
@items.deep_merge!({'statement' =>
|
1084
|
-
|
1085
|
-
|
1086
|
-
|
1117
|
+
{'count'=>
|
1118
|
+
{'view' =>
|
1119
|
+
'
|
1087
1120
|
SELECT count(1) total FROM <!--VIEW--> ' + ((@items['groupBy'].empty? && !@active_record_model) ? '<!--WHERE--> <!--GROUPBY-->' : '' )
|
1088
|
-
|
1089
|
-
|
1121
|
+
}
|
1122
|
+
}
|
1090
1123
|
})
|
1091
1124
|
@items.deep_merge!({'statement' =>
|
1092
|
-
|
1093
|
-
|
1094
|
-
|
1095
|
-
|
1096
|
-
|
1125
|
+
{'select'=>
|
1126
|
+
{'view' =>
|
1127
|
+
'SELECT <!--FIELDS_PLAIN--> FROM ( SELECT a.*, DENSE_RANK() over (<!--ORDERBY-->) rn FROM ( SELECT ' + ( (!get_view().include?('(')) ? '<!--SOURCE-->' : get_view().strip.split(" ").last ) + '.* FROM <!--SOURCE--> ) a ' + ((@items['groupBy'].empty?) ? '<!--WHERE-->' : '') + ' <!--ORDERBY--> ) <!--LIMIT--> ' + ((!@active_record_model) ? '<!--GROUPBY-->' : '')
|
1128
|
+
}
|
1129
|
+
}
|
1097
1130
|
})
|
1098
1131
|
|
1099
1132
|
end
|
@@ -1389,230 +1422,230 @@ module WidgetList
|
|
1389
1422
|
def get_grouping_functions()
|
1390
1423
|
#http://docs.oracle.com/cd/E11882_01/server.112/e10592/functions003.htm
|
1391
1424
|
[
|
1392
|
-
|
1393
|
-
|
1394
|
-
|
1395
|
-
|
1396
|
-
|
1397
|
-
|
1398
|
-
|
1399
|
-
|
1400
|
-
|
1401
|
-
|
1402
|
-
|
1403
|
-
|
1404
|
-
|
1405
|
-
|
1406
|
-
|
1407
|
-
|
1408
|
-
|
1409
|
-
|
1410
|
-
|
1411
|
-
|
1412
|
-
|
1413
|
-
|
1414
|
-
|
1415
|
-
|
1416
|
-
|
1417
|
-
|
1418
|
-
|
1419
|
-
|
1420
|
-
|
1421
|
-
|
1422
|
-
|
1423
|
-
|
1424
|
-
|
1425
|
-
|
1426
|
-
|
1427
|
-
|
1428
|
-
|
1429
|
-
|
1430
|
-
|
1431
|
-
|
1432
|
-
|
1433
|
-
|
1434
|
-
|
1435
|
-
|
1425
|
+
'AVG(',
|
1426
|
+
'COLLECT(',
|
1427
|
+
'CORR(',
|
1428
|
+
'COUNT(',
|
1429
|
+
'COVAR_POP(',
|
1430
|
+
'COVAR_SAMP(',
|
1431
|
+
'CUME_DIST(',
|
1432
|
+
'DENSE_RANK(',
|
1433
|
+
'FIRST(',
|
1434
|
+
'GROUP_ID(',
|
1435
|
+
'GROUPING_ID(',
|
1436
|
+
'LAST(',
|
1437
|
+
'LISTAGG(',
|
1438
|
+
'MAX(',
|
1439
|
+
'MEDIAN(',
|
1440
|
+
'MIN(',
|
1441
|
+
'PERCENT_RANK(',
|
1442
|
+
'PERCENTILE_CONT(',
|
1443
|
+
'PERCENTILE_DISC(',
|
1444
|
+
'RANK(',
|
1445
|
+
'REGR_SLOPE(',
|
1446
|
+
'REGR_INTERCEPT(',
|
1447
|
+
'REGR_COUNT(',
|
1448
|
+
'REGR_R2(',
|
1449
|
+
'REGR_AVGX(',
|
1450
|
+
'REGR_AVGY(',
|
1451
|
+
'REGR_SXX(',
|
1452
|
+
'REGR_SYY(',
|
1453
|
+
'REGR_SXY(',
|
1454
|
+
'STATS_MINOMIAL_TEST(',
|
1455
|
+
'STATS_CROSSTAB(',
|
1456
|
+
'STATS_F_TEST(',
|
1457
|
+
'STATS_KS_TEST(',
|
1458
|
+
'STATS_MODE(',
|
1459
|
+
'STATS_MW_TEST(',
|
1460
|
+
'STDDEV(',
|
1461
|
+
'STDDEV_POP(',
|
1462
|
+
'STDDEV_SAMP(',
|
1463
|
+
'SUM(',
|
1464
|
+
'SYS_XMLAGG(',
|
1465
|
+
'VAR_POP(',
|
1466
|
+
'VAR_SAMP(',
|
1467
|
+
'VARIANCE(',
|
1468
|
+
'XMLAGG(',
|
1436
1469
|
]
|
1437
1470
|
end
|
1438
1471
|
|
1439
1472
|
def self.get_defaults()
|
1440
1473
|
{
|
1441
|
-
|
1442
|
-
|
1443
|
-
|
1444
|
-
|
1445
|
-
|
1446
|
-
|
1447
|
-
|
1448
|
-
|
1449
|
-
|
1450
|
-
|
1451
|
-
|
1452
|
-
|
1453
|
-
|
1454
|
-
|
1455
|
-
|
1456
|
-
|
1457
|
-
|
1458
|
-
|
1459
|
-
|
1460
|
-
|
1461
|
-
|
1462
|
-
|
1463
|
-
|
1464
|
-
|
1465
|
-
|
1466
|
-
|
1467
|
-
|
1474
|
+
'errors' => [],
|
1475
|
+
'name' => ([*('A'..'Z'),*('0'..'9')]-%w(0 1 I O)).sample(16).join,
|
1476
|
+
'database' => 'primary', #
|
1477
|
+
'title' => '',
|
1478
|
+
'listDescription' => '',
|
1479
|
+
'pageId' => $_SERVER['PATH_INFO'],
|
1480
|
+
'view' => '',
|
1481
|
+
'data' => {},
|
1482
|
+
'collClass' => '',
|
1483
|
+
'collAlign' => '',
|
1484
|
+
'fields' => {},
|
1485
|
+
'fieldsHidden' => [],
|
1486
|
+
'bindVars' => [],
|
1487
|
+
'bindVarsLegacy' => {},
|
1488
|
+
'links' => {},
|
1489
|
+
'buttons' => {},
|
1490
|
+
'inputs' => {},
|
1491
|
+
'filter' => [],
|
1492
|
+
'groupBy' => '',
|
1493
|
+
'rowStart' => 0,
|
1494
|
+
'rowLimit' => 10,
|
1495
|
+
'orderBy' => '',
|
1496
|
+
'allowHTML' => true,
|
1497
|
+
'searchClear' => false,
|
1498
|
+
'searchClearAll' => false,
|
1499
|
+
'showPagination' => true,
|
1500
|
+
'searchSession' => true,
|
1468
1501
|
|
1469
|
-
|
1470
|
-
|
1471
|
-
|
1472
|
-
|
1502
|
+
#
|
1503
|
+
# carryOverRequests will allow you to post custom things from request to all sort/paging URLS for each ajax
|
1504
|
+
#
|
1505
|
+
'carryOverRequsts' => ['switch_grouping','group_row_id','q'],
|
1473
1506
|
|
1474
|
-
|
1475
|
-
|
1476
|
-
|
1507
|
+
#
|
1508
|
+
# Head/Foot
|
1509
|
+
#
|
1477
1510
|
|
1478
|
-
|
1479
|
-
|
1511
|
+
'customFooter' => '',
|
1512
|
+
'customHeader' => '',
|
1480
1513
|
|
1481
|
-
|
1482
|
-
|
1483
|
-
|
1484
|
-
|
1485
|
-
|
1514
|
+
#
|
1515
|
+
# Ajax
|
1516
|
+
#
|
1517
|
+
'ajaxFunctionAll' => '',
|
1518
|
+
'ajaxFunction' => 'ListJumpMin',
|
1486
1519
|
|
1487
|
-
|
1488
|
-
|
1489
|
-
|
1490
|
-
|
1491
|
-
|
1492
|
-
|
1493
|
-
|
1494
|
-
|
1495
|
-
|
1496
|
-
|
1520
|
+
#
|
1521
|
+
# Search
|
1522
|
+
#
|
1523
|
+
'showSearch' => true,
|
1524
|
+
'searchOnkeyup' => "SearchWidgetList('<!--URL-->', '<!--TARGET-->', this);",
|
1525
|
+
'searchIdCol' => 'id',
|
1526
|
+
'searchTitle' => 'Search by Id or CSV of Ids and more',
|
1527
|
+
'searchFieldsIn' => {},
|
1528
|
+
'searchFieldsOut' => {'id'=>true},
|
1529
|
+
'templateFilter' => '',
|
1497
1530
|
|
1498
|
-
|
1499
|
-
|
1500
|
-
|
1501
|
-
|
1502
|
-
|
1531
|
+
#
|
1532
|
+
# Export
|
1533
|
+
#
|
1534
|
+
'showExport' => true,
|
1535
|
+
'exportButtonTitle' => 'Export CSV',
|
1503
1536
|
|
1504
|
-
|
1505
|
-
|
1506
|
-
|
1507
|
-
|
1508
|
-
|
1509
|
-
|
1510
|
-
|
1511
|
-
|
1537
|
+
#
|
1538
|
+
# Group By Box
|
1539
|
+
#
|
1540
|
+
'groupByItems' => [],
|
1541
|
+
'groupBySelected' => false,
|
1542
|
+
'groupByLabel' => 'Group By',
|
1543
|
+
'groupByClick' => '',
|
1544
|
+
'groupByClickDefault' => "ListChangeGrouping('<!--NAME-->', this);",
|
1512
1545
|
|
1513
1546
|
|
1514
|
-
|
1515
|
-
|
1516
|
-
|
1517
|
-
|
1518
|
-
|
1547
|
+
#
|
1548
|
+
# Advanced searching
|
1549
|
+
#
|
1550
|
+
'listSearchForm' => '',
|
1551
|
+
'ransackSearch' => false,
|
1519
1552
|
|
1520
|
-
|
1521
|
-
|
1522
|
-
|
1523
|
-
|
1524
|
-
|
1525
|
-
|
1526
|
-
|
1527
|
-
|
1528
|
-
|
1553
|
+
#
|
1554
|
+
# Column Specific
|
1555
|
+
#
|
1556
|
+
'columnStyle' => {},
|
1557
|
+
'columnClass' => {},
|
1558
|
+
'columnPopupTitle' => {},
|
1559
|
+
'columnSort' => {},
|
1560
|
+
'columnWidth' => {},
|
1561
|
+
'columnNoSort' => {},
|
1529
1562
|
|
1530
|
-
|
1531
|
-
|
1532
|
-
|
1533
|
-
|
1534
|
-
|
1563
|
+
#
|
1564
|
+
# Column Border (on right of each column)
|
1565
|
+
#
|
1566
|
+
'borderedColumns' => false,
|
1567
|
+
'borderColumnStyle' => '1px solid #CCCCCC',
|
1535
1568
|
|
1536
|
-
|
1537
|
-
|
1538
|
-
|
1539
|
-
|
1540
|
-
|
1569
|
+
#
|
1570
|
+
# Row Border (on top of each row)
|
1571
|
+
#
|
1572
|
+
'borderedRows' => true,
|
1573
|
+
'borderRowStyle' => '1px solid #CCCCCC',
|
1541
1574
|
|
1542
|
-
|
1543
|
-
|
1544
|
-
|
1545
|
-
|
1546
|
-
|
1575
|
+
#
|
1576
|
+
# Head/Foot border
|
1577
|
+
#
|
1578
|
+
'borderHeadFoot' => false,
|
1579
|
+
'headFootBorderStyle' => '1px solid #CCCCCC',
|
1547
1580
|
|
1548
|
-
|
1549
|
-
|
1581
|
+
'bordersEverywhere?' => false,
|
1582
|
+
'borderEverywhere' => '1px solid #CCCCCC',
|
1550
1583
|
|
1551
|
-
|
1552
|
-
|
1553
|
-
|
1554
|
-
|
1584
|
+
#
|
1585
|
+
# Buttons
|
1586
|
+
#
|
1587
|
+
'defaultButtonClass' => 'info',
|
1555
1588
|
|
1556
|
-
|
1557
|
-
|
1558
|
-
|
1559
|
-
|
1560
|
-
|
1561
|
-
|
1562
|
-
|
1589
|
+
#
|
1590
|
+
# Font
|
1591
|
+
#
|
1592
|
+
'fontFamily' => '"Times New Roman", Times, serif',
|
1593
|
+
'headerFooterFontSize' => '14px',
|
1594
|
+
'dataFontSize' => '14px',
|
1595
|
+
'titleFontSize' => '24px',
|
1563
1596
|
|
1564
|
-
|
1565
|
-
|
1566
|
-
|
1567
|
-
|
1568
|
-
|
1569
|
-
|
1570
|
-
|
1571
|
-
|
1572
|
-
|
1573
|
-
|
1574
|
-
|
1575
|
-
|
1576
|
-
|
1577
|
-
|
1597
|
+
#
|
1598
|
+
# Table Colors
|
1599
|
+
#
|
1600
|
+
'footerBGColor' => '#ECECEC',
|
1601
|
+
'headerBGColor' => '#ECECEC',
|
1602
|
+
'footerFontColor' => '#494949',
|
1603
|
+
'headerFontColor' => '#494949',
|
1604
|
+
'tableBorder' => '1',
|
1605
|
+
'cornerRadius' => 15,
|
1606
|
+
|
1607
|
+
'useBoxShadow' => true,
|
1608
|
+
'shadowInset' => 10,
|
1609
|
+
'shadowSpread' => 20,
|
1610
|
+
'shadowColor' => '#888888',
|
1578
1611
|
|
1579
|
-
|
1580
|
-
|
1581
|
-
|
1582
|
-
|
1583
|
-
|
1584
|
-
|
1585
|
-
|
1586
|
-
|
1587
|
-
|
1588
|
-
|
1589
|
-
|
1590
|
-
|
1591
|
-
|
1592
|
-
|
1593
|
-
|
1594
|
-
|
1595
|
-
|
1596
|
-
|
1597
|
-
|
1598
|
-
|
1599
|
-
|
1600
|
-
|
1601
|
-
|
1602
|
-
|
1612
|
+
#
|
1613
|
+
# Row specifics
|
1614
|
+
#
|
1615
|
+
'rowClass' => '',
|
1616
|
+
'rowFontColor' => 'black',
|
1617
|
+
'rowColorByStatus' => {},
|
1618
|
+
'rowStylesByStatus' => {},
|
1619
|
+
'rowOffsets' => ['#FFFFFF','#FFFFFF'],
|
1620
|
+
|
1621
|
+
'class' => 'listContainerPassive',
|
1622
|
+
'tableclass' => 'tableBlowOutPreventer',
|
1623
|
+
'noDataMessage' => 'Currently no data.',
|
1624
|
+
'useSort' => true,
|
1625
|
+
'headerClass' => {},
|
1626
|
+
'fieldFunction' => {},
|
1627
|
+
'buttonVal' => 'templateListJump',
|
1628
|
+
'linkFunction' => 'ButtonLinkPost',
|
1629
|
+
'template' => '',
|
1630
|
+
'LIST_COL_SORT_ORDER' => 'ASC',
|
1631
|
+
'LIST_COL_SORT' => '',
|
1632
|
+
'LIST_FILTER_ALL' => '',
|
1633
|
+
'ROW_LIMIT' => '',
|
1634
|
+
'LIST_SEQUENCE' => 1,
|
1635
|
+
'NEW_SEARCH' => false,
|
1603
1636
|
|
1604
|
-
|
1605
|
-
|
1606
|
-
|
1607
|
-
|
1608
|
-
|
1609
|
-
|
1637
|
+
#
|
1638
|
+
# Checkbox
|
1639
|
+
#
|
1640
|
+
'checkedClass' => 'widgetlist-checkbox',
|
1641
|
+
'checkedFlag' => {},
|
1642
|
+
'storeSessionChecks' => false,
|
1610
1643
|
|
1611
|
-
|
1612
|
-
|
1613
|
-
|
1614
|
-
|
1615
|
-
|
1644
|
+
#
|
1645
|
+
# Hooks
|
1646
|
+
#
|
1647
|
+
'columnHooks' => {},
|
1648
|
+
'rowHooks' => {}
|
1616
1649
|
}
|
1617
1650
|
end
|
1618
1651
|
|
@@ -2031,11 +2064,11 @@ module WidgetList
|
|
2031
2064
|
list_search['name'] = 'list_search_name_' + @items['name']
|
2032
2065
|
list_search['class'] = 'inputOuter widget-search-outer ' + @items['name'].downcase + '-search'
|
2033
2066
|
list_search['search_ahead'] = {
|
2034
|
-
|
2035
|
-
|
2036
|
-
|
2037
|
-
|
2038
|
-
|
2067
|
+
'url' => searchUrl,
|
2068
|
+
'skip_queue' => false,
|
2069
|
+
'target' => @items['name'],
|
2070
|
+
'search_form' => @items['listSearchForm'],
|
2071
|
+
'onkeyup' => (! @items['searchOnkeyup'].empty?) ? WidgetList::Utils::fill({'<!--URL-->'=>searchUrl, '<!--TARGET-->' => @items['name'], '<!--FUNCTION_ALL-->' => @items['ajaxFunctionAll']}, @items['searchOnkeyup'] + '<!--FUNCTION_ALL-->') : ''
|
2039
2072
|
}
|
2040
2073
|
|
2041
2074
|
fillRansack = {}
|
@@ -2092,8 +2125,8 @@ module WidgetList
|
|
2092
2125
|
}
|
2093
2126
|
|
2094
2127
|
list_group['search_ahead'] = {
|
2095
|
-
|
2096
|
-
|
2128
|
+
'skip_queue' => false,
|
2129
|
+
'search_form'=> '
|
2097
2130
|
<div id="advanced-search-container" style="height:100% !important;">
|
2098
2131
|
' + groupRows.join("\n") + '
|
2099
2132
|
</div>'
|
@@ -2226,11 +2259,11 @@ module WidgetList
|
|
2226
2259
|
#Assemble navigation buttons
|
2227
2260
|
#
|
2228
2261
|
pieces = {
|
2229
|
-
|
2230
|
-
|
2231
|
-
|
2232
|
-
|
2233
|
-
|
2262
|
+
'<!--NEXT_URL-->' => nextUrl,
|
2263
|
+
'<!--LIST_NAME-->' => @items['name'],
|
2264
|
+
'<!--PREVIOUS_URL-->' => prevUrl,
|
2265
|
+
'<!--FUNCTION-->' => @items['ajaxFunction'],
|
2266
|
+
'<!--FUNCTION_ALL-->' => @items['ajaxFunctionAll'],
|
2234
2267
|
}
|
2235
2268
|
|
2236
2269
|
templates['btn_next'] = WidgetList::Utils::fill(pieces,templates['btn_next'])
|
@@ -2333,23 +2366,23 @@ module WidgetList
|
|
2333
2366
|
end
|
2334
2367
|
|
2335
2368
|
jumpSection << WidgetList::Utils::fill({
|
2336
|
-
|
2337
|
-
|
2338
|
-
|
2339
|
-
|
2340
|
-
|
2369
|
+
'<!--SEQUENCE-->' => page,
|
2370
|
+
'<!--JUMP_URL-->' => jumpUrl,
|
2371
|
+
'<!--LIST_NAME-->' => @items['name'],
|
2372
|
+
'<!--FUNCTION-->' => @items['ajaxFunction'],
|
2373
|
+
'<!--FUNCTION_ALL-->' => @items['ajaxFunctionAll'],
|
2341
2374
|
}, jumpTemplate)
|
2342
2375
|
end
|
2343
2376
|
|
2344
2377
|
pieces = {
|
2345
|
-
|
2346
|
-
|
2347
|
-
|
2348
|
-
|
2349
|
-
|
2350
|
-
|
2351
|
-
|
2352
|
-
|
2378
|
+
'<!--PREVIOUS_BUTTON-->' => templates['btn_previous'],
|
2379
|
+
'<!--SEQUENCE-->' => @sequence,
|
2380
|
+
'<!--NEXT_BUTTON-->' => templates['btn_next'],
|
2381
|
+
'<!--TOTAL_PAGES-->' => @totalPages,
|
2382
|
+
'<!--TOTAL_ROWS-->' => @totalRows,
|
2383
|
+
'<!--PAGE_SEQUENCE_JUMP_LIST-->' => pageSelect,
|
2384
|
+
'<!--JUMP-->' => jumpSection.join(''),
|
2385
|
+
'<!--LIST_NAME-->' => @items['name'],
|
2353
2386
|
}
|
2354
2387
|
|
2355
2388
|
paginationOutput = WidgetList::Utils::fill(pieces,@items['template_pagination_wrapper'])
|
@@ -2500,7 +2533,7 @@ module WidgetList
|
|
2500
2533
|
|
2501
2534
|
if (
|
2502
2535
|
( (@items.key?('LIST_COL_SORT') && !@items['LIST_COL_SORT'].empty?) && @items['LIST_COL_SORT'] == colSort['LIST_COL_SORT']) ||
|
2503
|
-
|
2536
|
+
( $_SESSION.key?('LIST_COL_SORT') && !$_SESSION['LIST_COL_SORT'].nil? && $_SESSION['LIST_COL_SORT'].key?(@sqlHash) && $_SESSION['LIST_COL_SORT'][@sqlHash].key?(field))
|
2504
2537
|
)
|
2505
2538
|
changedSession = false
|
2506
2539
|
if @items.key?('LIST_COL_SORT') && !@items['LIST_COL_SORT'].empty?
|
@@ -2759,65 +2792,100 @@ module WidgetList
|
|
2759
2792
|
def self.checkbox_helper(list_parms,primary_key)
|
2760
2793
|
|
2761
2794
|
list_parms.deep_merge!({'inputs' =>
|
2762
|
-
|
2763
|
-
|
2764
|
-
|
2765
|
-
|
2795
|
+
{'checkbox'=>
|
2796
|
+
{'type' => 'checkbox'
|
2797
|
+
}
|
2798
|
+
}
|
2766
2799
|
})
|
2767
2800
|
|
2768
2801
|
list_parms.deep_merge!({'inputs' =>
|
2769
|
-
|
2770
|
-
|
2771
|
-
|
2772
|
-
|
2773
|
-
|
2774
|
-
|
2775
|
-
|
2776
|
-
|
2777
|
-
|
2802
|
+
{'checkbox'=>
|
2803
|
+
{'items' =>
|
2804
|
+
{
|
2805
|
+
'name' => list_parms['name'] + '_visible_checks[]',
|
2806
|
+
'value' => primary_key, #the value should be a column name mapping
|
2807
|
+
'class_handle' => list_parms['name'] + '_info_tables',
|
2808
|
+
}
|
2809
|
+
}
|
2810
|
+
}
|
2778
2811
|
})
|
2779
2812
|
|
2780
2813
|
list_parms.deep_merge!({'inputs' =>
|
2781
|
-
|
2782
|
-
|
2783
|
-
|
2784
|
-
|
2814
|
+
{'checkbox_header'=>
|
2815
|
+
{'type' => 'checkbox'
|
2816
|
+
}
|
2817
|
+
}
|
2785
2818
|
})
|
2786
2819
|
|
2787
2820
|
list_parms.deep_merge!({'inputs' =>
|
2788
|
-
|
2789
|
-
|
2790
|
-
|
2791
|
-
|
2792
|
-
|
2793
|
-
|
2794
|
-
|
2795
|
-
|
2796
|
-
|
2821
|
+
{'checkbox_header'=>
|
2822
|
+
{'items' =>
|
2823
|
+
{
|
2824
|
+
'check_all' => true,
|
2825
|
+
'id' => list_parms['name'] + '_info_tables_check_all',
|
2826
|
+
'class_handle' => list_parms['name'] + '_info_tables',
|
2827
|
+
}
|
2828
|
+
}
|
2829
|
+
}
|
2797
2830
|
})
|
2798
2831
|
return list_parms
|
2799
2832
|
end
|
2800
2833
|
|
2834
|
+
|
2835
|
+
def self.group_by_max_each_field(list_parms,group_by_filter)
|
2836
|
+
|
2837
|
+
#
|
2838
|
+
# Oracle needs MAX on most fields when grouping in order to shy away from 'not a GROUP BY expression' errors
|
2839
|
+
#
|
2840
|
+
if group_by_filter != 'none'
|
2841
|
+
if list_parms.key?('fieldFunction') && !list_parms['fieldFunction'].empty?
|
2842
|
+
list_parms['fieldFunction'].each { |k, v|
|
2843
|
+
if !k.include?('_linked') && k != 'cnt'
|
2844
|
+
list_parms['fieldFunction'][k] = "MAX(#{v})"
|
2845
|
+
end
|
2846
|
+
}
|
2847
|
+
end
|
2848
|
+
|
2849
|
+
if list_parms.key?('fieldsHidden') && !list_parms['fieldsHidden'].empty?
|
2850
|
+
list_parms['fieldsHidden'].each { |k|
|
2851
|
+
if (list_parms.key?('fieldFunction') && !list_parms['fieldFunction'].empty? && !list_parms['fieldFunction'].key?(k)) || list_parms['fieldFunction'].empty?
|
2852
|
+
list_parms['fieldFunction'][k] = "MAX(#{k})"
|
2853
|
+
end
|
2854
|
+
}
|
2855
|
+
end
|
2856
|
+
|
2857
|
+
list_parms['fields'].each { |k|
|
2858
|
+
if !k.include?('_linked') && k != 'cnt'
|
2859
|
+
if (list_parms.key?('fieldFunction') && !list_parms['fieldFunction'].empty? && !list_parms['fieldFunction'].key?(k)) || list_parms['fieldFunction'].empty?
|
2860
|
+
list_parms['fieldFunction'][k] = "MAX(#{k})"
|
2861
|
+
end
|
2862
|
+
end
|
2863
|
+
}
|
2864
|
+
end
|
2865
|
+
|
2866
|
+
return list_parms
|
2867
|
+
end
|
2868
|
+
|
2801
2869
|
def self.drill_down_back(list_name='')
|
2802
2870
|
'<div class="goback" onclick="ListHome(\'' + list_name + '\');" title="Go Back"></div>'
|
2803
2871
|
end
|
2804
2872
|
|
2805
2873
|
def self.build_drill_down(*params)
|
2806
2874
|
required_params = {
|
2807
|
-
|
2808
|
-
|
2809
|
-
|
2810
|
-
|
2875
|
+
:list_id => true, # -- your widget_list name (used for JS)
|
2876
|
+
:drill_down_name => true, # -- an identifier that is pass for the "column" or "type of drill down" which is passed as $_REQUEST['drill_down'] when the user clicks and returned from get_filter_and_drilldown based on session or request
|
2877
|
+
:data_to_pass_from_view => true, # -- Any SQL function or column name/value in the resultset in which would be the value passed when the user clicks the drill down
|
2878
|
+
:column_to_show => true, # -- The visible column or SQL functions to display to user for the link
|
2811
2879
|
}
|
2812
2880
|
|
2813
2881
|
optional_params = {
|
2814
|
-
|
2815
|
-
|
2816
|
-
|
2817
|
-
|
2818
|
-
|
2819
|
-
|
2820
|
-
|
2882
|
+
:column_alias => '', # -- AS XXXX
|
2883
|
+
:extra_function => '', # -- Onclick of link, call another JS function after the drill down function is called
|
2884
|
+
:js_function_name => 'ListDrillDown', # -- name of JS Function
|
2885
|
+
:column_class => '', # -- custom class on the <a> tag
|
2886
|
+
:link_color => 'blue', # -- whatever color you want the link to be
|
2887
|
+
:extra_js_func_params => '', # -- Add extra params to ListDrillDown outside of the default
|
2888
|
+
:primary_database => true, # -- Since this function builds a column before widget_list is instantiated, tell which connection you are using
|
2821
2889
|
}
|
2822
2890
|
|
2823
2891
|
valid = WidgetList::Widgets::validate_items(params[0],required_params)
|
@@ -3429,7 +3497,7 @@ module WidgetList
|
|
3429
3497
|
when 'oracle'
|
3430
3498
|
|
3431
3499
|
pieces['<!--LIMIT-->'] =
|
3432
|
-
|
3500
|
+
'
|
3433
3501
|
WHERE
|
3434
3502
|
(
|
3435
3503
|
rn >' + (@sequence > 1 ? '' : '=') + ' :LOW
|
data/lib/widget_list/version.rb
CHANGED