widget_list 1.2.3 → 1.2.4
Sign up to get free protection for your applications and to get access to all the features.
- data/app/views/widget_list/administration/_output.html.erb +468 -465
- data/lib/widget_list.rb +334 -317
- data/lib/widget_list/version.rb +1 -1
- metadata +2 -2
data/lib/widget_list.rb
CHANGED
@@ -18,7 +18,7 @@ module WidgetList
|
|
18
18
|
#
|
19
19
|
def self.go!()
|
20
20
|
if $_REQUEST.key?('iframe')
|
21
|
-
eval(WidgetList::Administration.new.translate_config_to_code(
|
21
|
+
eval(WidgetList::Administration.new.translate_config_to_code())
|
22
22
|
return @output
|
23
23
|
else
|
24
24
|
list = WidgetList::List.new()
|
@@ -28,6 +28,10 @@ module WidgetList
|
|
28
28
|
|
29
29
|
class Administration
|
30
30
|
def show_interface()
|
31
|
+
config_file = Rails.root.join("config", "widget-list-administration.json")
|
32
|
+
if config_file.file? && !$_REQUEST.key?('ajax') && !$_REQUEST.key?('name')
|
33
|
+
File.delete(Rails.root.join("config", "widget-list-administration.json"))
|
34
|
+
end
|
31
35
|
ac = ActionController::Base.new()
|
32
36
|
default_config = WidgetList::List::get_defaults()
|
33
37
|
config_id, page_config = get_configuration()
|
@@ -59,11 +63,11 @@ module WidgetList
|
|
59
63
|
#
|
60
64
|
@fill['<!--POST_URL-->'] = $_SERVER['PATH_INFO']
|
61
65
|
@fill['<!--BUTTONS-->'] = WidgetList::Widgets::widget_button('Step One - Start ->', {'id' => 'start' , 'onclick' => "ShowStart();" , 'innerClass' => "primary" } ) +
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
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" } )
|
67
71
|
|
68
72
|
|
69
73
|
#
|
@@ -270,8 +274,8 @@ module WidgetList
|
|
270
274
|
return WidgetList::Utils::fill(@fill , ac.render_to_string(:partial => 'widget_list/administration/output') )
|
271
275
|
end
|
272
276
|
|
273
|
-
def translate_config_to_code(
|
274
|
-
config_id, page_config = get_configuration(
|
277
|
+
def translate_config_to_code()
|
278
|
+
config_id, page_config = get_configuration()
|
275
279
|
fields,fields_hidden,fields_function,buttons,footer_buttons,group_by,drill_downs = normalize_configs(page_config)
|
276
280
|
drill_down_code = ''
|
277
281
|
case_statements = ''
|
@@ -393,8 +397,15 @@ module WidgetList
|
|
393
397
|
end
|
394
398
|
|
395
399
|
fields.each { |field,description|
|
400
|
+
conditional = ''
|
401
|
+
if page_config['useGrouping'] == '1' && page_config['showSearch'] == '1' && !group_by.empty?
|
402
|
+
conditional = ' if groupByFilter == \'none\''
|
403
|
+
if group_by.key?(field)
|
404
|
+
conditional = " if groupByFilter == 'none' || groupByFilter == 'group_#{group_by[field].gsub(/ /,'_').downcase}'"
|
405
|
+
end
|
406
|
+
end
|
396
407
|
visible_field_code += "
|
397
|
-
list_parms['fields']['#{field}'] = '#{description}'"
|
408
|
+
list_parms['fields']['#{field}'] = '#{description}' #{conditional}"
|
398
409
|
}
|
399
410
|
|
400
411
|
#------------ BUTTONS ------------
|
@@ -402,14 +413,13 @@ module WidgetList
|
|
402
413
|
if page_config['rowButtonsOn'] == '1'
|
403
414
|
visible_field_code += "
|
404
415
|
list_parms['fields'][button_column_name.downcase] = button_column_name.capitalize"
|
405
|
-
end
|
406
416
|
|
407
|
-
|
417
|
+
button_code += "
|
408
418
|
mini_buttons = {}
|
409
419
|
"
|
410
420
|
|
411
|
-
|
412
|
-
|
421
|
+
buttons.each { |field|
|
422
|
+
button_code += "
|
413
423
|
mini_buttons['button_#{field[0].downcase}'] = {'page' => '#{field[1]['url']}',
|
414
424
|
'text' => '#{field[0]}',
|
415
425
|
'function' => 'Redirect',
|
@@ -417,11 +427,12 @@ module WidgetList
|
|
417
427
|
'tags' => {'all'=>'all'}
|
418
428
|
}
|
419
429
|
"
|
420
|
-
|
430
|
+
}
|
421
431
|
|
422
|
-
|
432
|
+
button_code += "
|
423
433
|
list_parms['buttons'] = {button_column_name.downcase => mini_buttons}
|
424
434
|
"
|
435
|
+
end
|
425
436
|
|
426
437
|
|
427
438
|
|
@@ -446,6 +457,10 @@ module WidgetList
|
|
446
457
|
groupByDesc = '' # Initialize a variable you can use in listDescription to show what the current grouping selection is
|
447
458
|
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
|
448
459
|
"
|
460
|
+
|
461
|
+
visible_field_code += "
|
462
|
+
list_parms['fields']['cnt'] = 'Count' if groupByFilter != 'none'
|
463
|
+
list_parms['fieldFunction']['cnt'] = 'TO_CHAR(COUNT(1))' if groupByFilter != 'none'"
|
449
464
|
descriptions = []
|
450
465
|
group_by.each { |field,description|
|
451
466
|
descriptions << "'" + description + "'"
|
@@ -574,17 +589,16 @@ module WidgetList
|
|
574
589
|
EOD
|
575
590
|
end
|
576
591
|
|
577
|
-
def get_configuration(
|
578
|
-
temp = (tmp) ? '-tmp': ''
|
592
|
+
def get_configuration()
|
579
593
|
|
580
594
|
request = $_REQUEST.dup
|
581
595
|
config_id = ''
|
582
596
|
config_id += request['controller'] if request.key?('controller')
|
583
597
|
config_id += request['action'] if request.key?('action')
|
584
|
-
config_file = Rails.root.join("config", "widget-list-administration
|
598
|
+
config_file = Rails.root.join("config", "widget-list-administration.json")
|
585
599
|
|
586
|
-
if config_file.file?
|
587
|
-
configuration = JSON.parse(File.new(Rails.root.join("config", "widget-list-administration
|
600
|
+
if config_file.file? && ($_REQUEST.key?('iframe') || $_REQUEST.key?('name'))
|
601
|
+
configuration = JSON.parse(File.new(Rails.root.join("config", "widget-list-administration.json")).read)
|
588
602
|
else
|
589
603
|
configuration = {}
|
590
604
|
end
|
@@ -762,6 +776,7 @@ module WidgetList
|
|
762
776
|
@fieldFill['<!--FIELD-->'] = 'Field'
|
763
777
|
@fieldFill['<!--DESC-->'] = 'Desc'
|
764
778
|
@fieldFill['<!--DISABLED-->'] = ''
|
779
|
+
@fieldFill['<!--ONBLUR1-->'] = 'InvalidField(this)'
|
765
780
|
@response['group_by'] += WidgetList::Utils::fill(@fieldFill , ac.render_to_string(:partial => 'widget_list/administration/field_row') )
|
766
781
|
}
|
767
782
|
|
@@ -870,17 +885,19 @@ module WidgetList
|
|
870
885
|
config_id += request['controller'] if request.key?('controller')
|
871
886
|
config_id += request['action'] if request.key?('action')
|
872
887
|
|
873
|
-
|
874
|
-
|
875
|
-
config_file = Rails.root.join("config", "widget-list-administration#{tmp}.json")
|
888
|
+
config_file = Rails.root.join("config", "widget-list-administration.json")
|
876
889
|
if config_file.file?
|
877
|
-
configuration = JSON.parse(File.new(Rails.root.join("config", "widget-list-administration
|
890
|
+
configuration = JSON.parse(File.new(Rails.root.join("config", "widget-list-administration.json")).read)
|
878
891
|
else
|
879
892
|
configuration = {}
|
880
893
|
end
|
881
894
|
configuration[config_id] = request
|
882
895
|
|
883
|
-
File.open(Rails.root.join("config", "widget-list-administration
|
896
|
+
File.open(Rails.root.join("config", "widget-list-administration.json"), "w") do |file|
|
897
|
+
file.puts configuration.to_json
|
898
|
+
end
|
899
|
+
|
900
|
+
File.open(Rails.root.join("config", "widget-list-administration-all.json"), "w") do |file|
|
884
901
|
file.puts configuration.to_json
|
885
902
|
end
|
886
903
|
|
@@ -970,23 +987,23 @@ module WidgetList
|
|
970
987
|
|
971
988
|
|
972
989
|
@items.deep_merge!({ 'statement' =>
|
973
|
-
|
974
|
-
|
975
|
-
|
990
|
+
{'select'=>
|
991
|
+
{'view' =>
|
992
|
+
'
|
976
993
|
SELECT <!--FIELDS--> FROM <!--SOURCE--> <!--WHERE--> <!--GROUPBY--> <!--ORDERBY--> <!--LIMIT-->
|
977
994
|
'
|
978
|
-
|
979
|
-
|
995
|
+
}
|
996
|
+
}
|
980
997
|
})
|
981
998
|
|
982
999
|
@items.deep_merge!({ 'statement' =>
|
983
|
-
|
984
|
-
|
985
|
-
|
1000
|
+
{'count'=>
|
1001
|
+
{'view' =>
|
1002
|
+
'
|
986
1003
|
SELECT count(1) total FROM <!--VIEW--> <!--WHERE--> <!--GROUPBY-->
|
987
1004
|
'
|
988
|
-
|
989
|
-
|
1005
|
+
}
|
1006
|
+
}
|
990
1007
|
})
|
991
1008
|
#inject site wide configs before list specific configs if a helper exists
|
992
1009
|
|
@@ -1010,8 +1027,8 @@ module WidgetList
|
|
1010
1027
|
# if no one passed a listSearchForm inject a default one to show the ransack form
|
1011
1028
|
#
|
1012
1029
|
fill = {
|
1013
|
-
|
1014
|
-
|
1030
|
+
'<!--BUTTON_SEARCH-->' => WidgetList::Widgets::widget_button('Search', {'onclick' => WidgetList::List::build_search_button_click(@items), 'innerClass' => @items['defaultButtonClass'] }),
|
1031
|
+
'<!--BUTTON_CLOSE-->' => "HideAdvancedSearch(this)"
|
1015
1032
|
}
|
1016
1033
|
@items['listSearchForm'] = WidgetList::Utils::fill( fill , ac.render_to_string(:partial => 'widget_list/ransack_widget_list_advanced_search') )
|
1017
1034
|
|
@@ -1030,19 +1047,19 @@ module WidgetList
|
|
1030
1047
|
if get_database.db_type == 'oracle'
|
1031
1048
|
|
1032
1049
|
@items.deep_merge!({'statement' =>
|
1033
|
-
|
1034
|
-
|
1035
|
-
|
1050
|
+
{'count'=>
|
1051
|
+
{'view' =>
|
1052
|
+
'
|
1036
1053
|
SELECT count(1) total FROM <!--VIEW--> ' + ((@items['groupBy'].empty? && !@active_record_model) ? '<!--WHERE--> <!--GROUPBY-->' : '' )
|
1037
|
-
|
1038
|
-
|
1054
|
+
}
|
1055
|
+
}
|
1039
1056
|
})
|
1040
1057
|
@items.deep_merge!({'statement' =>
|
1041
|
-
|
1042
|
-
|
1043
|
-
|
1044
|
-
|
1045
|
-
|
1058
|
+
{'select'=>
|
1059
|
+
{'view' =>
|
1060
|
+
'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-->' : '')
|
1061
|
+
}
|
1062
|
+
}
|
1046
1063
|
})
|
1047
1064
|
|
1048
1065
|
end
|
@@ -1109,7 +1126,7 @@ module WidgetList
|
|
1109
1126
|
#
|
1110
1127
|
# Search restore
|
1111
1128
|
#
|
1112
|
-
if !isSearchRequest && $_SESSION.key?('SEARCH_FILTER') && $_SESSION['SEARCH_FILTER'].key?(@items['name']) && @items['searchSession']
|
1129
|
+
if !isSearchRequest && $_SESSION.class.name == 'Hash' && !$_SESSION.empty? && $_SESSION.key?('SEARCH_FILTER') && $_SESSION['SEARCH_FILTER'].key?(@items['name']) && @items['searchSession']
|
1113
1130
|
isSearchRestore = true
|
1114
1131
|
end
|
1115
1132
|
|
@@ -1316,7 +1333,7 @@ module WidgetList
|
|
1316
1333
|
@items['rowLimit'] = @items['ROW_LIMIT'].to_i
|
1317
1334
|
end
|
1318
1335
|
|
1319
|
-
if $_SESSION.key?('ROW_LIMIT') && $_SESSION['ROW_LIMIT'].key?(@items['name']) && !$_SESSION['ROW_LIMIT'][@items['name']].empty?
|
1336
|
+
if $_SESSION.key?('ROW_LIMIT') && !$_SESSION['ROW_LIMIT'].nil? && $_SESSION['ROW_LIMIT'].key?(@items['name']) && !$_SESSION['ROW_LIMIT'][@items['name']].empty?
|
1320
1337
|
@items['rowLimit'] = $_SESSION['ROW_LIMIT'][@items['name']].to_i
|
1321
1338
|
end
|
1322
1339
|
|
@@ -1338,230 +1355,230 @@ module WidgetList
|
|
1338
1355
|
def get_grouping_functions()
|
1339
1356
|
#http://docs.oracle.com/cd/E11882_01/server.112/e10592/functions003.htm
|
1340
1357
|
[
|
1341
|
-
|
1342
|
-
|
1343
|
-
|
1344
|
-
|
1345
|
-
|
1346
|
-
|
1347
|
-
|
1348
|
-
|
1349
|
-
|
1350
|
-
|
1351
|
-
|
1352
|
-
|
1353
|
-
|
1354
|
-
|
1355
|
-
|
1356
|
-
|
1357
|
-
|
1358
|
-
|
1359
|
-
|
1360
|
-
|
1361
|
-
|
1362
|
-
|
1363
|
-
|
1364
|
-
|
1365
|
-
|
1366
|
-
|
1367
|
-
|
1368
|
-
|
1369
|
-
|
1370
|
-
|
1371
|
-
|
1372
|
-
|
1373
|
-
|
1374
|
-
|
1375
|
-
|
1376
|
-
|
1377
|
-
|
1378
|
-
|
1379
|
-
|
1380
|
-
|
1381
|
-
|
1382
|
-
|
1383
|
-
|
1384
|
-
|
1358
|
+
'AVG(',
|
1359
|
+
'COLLECT(',
|
1360
|
+
'CORR(',
|
1361
|
+
'COUNT(',
|
1362
|
+
'COVAR_POP(',
|
1363
|
+
'COVAR_SAMP(',
|
1364
|
+
'CUME_DIST(',
|
1365
|
+
'DENSE_RANK(',
|
1366
|
+
'FIRST(',
|
1367
|
+
'GROUP_ID(',
|
1368
|
+
'GROUPING_ID(',
|
1369
|
+
'LAST(',
|
1370
|
+
'LISTAGG(',
|
1371
|
+
'MAX(',
|
1372
|
+
'MEDIAN(',
|
1373
|
+
'MIN(',
|
1374
|
+
'PERCENT_RANK(',
|
1375
|
+
'PERCENTILE_CONT(',
|
1376
|
+
'PERCENTILE_DISC(',
|
1377
|
+
'RANK(',
|
1378
|
+
'REGR_SLOPE(',
|
1379
|
+
'REGR_INTERCEPT(',
|
1380
|
+
'REGR_COUNT(',
|
1381
|
+
'REGR_R2(',
|
1382
|
+
'REGR_AVGX(',
|
1383
|
+
'REGR_AVGY(',
|
1384
|
+
'REGR_SXX(',
|
1385
|
+
'REGR_SYY(',
|
1386
|
+
'REGR_SXY(',
|
1387
|
+
'STATS_MINOMIAL_TEST(',
|
1388
|
+
'STATS_CROSSTAB(',
|
1389
|
+
'STATS_F_TEST(',
|
1390
|
+
'STATS_KS_TEST(',
|
1391
|
+
'STATS_MODE(',
|
1392
|
+
'STATS_MW_TEST(',
|
1393
|
+
'STDDEV(',
|
1394
|
+
'STDDEV_POP(',
|
1395
|
+
'STDDEV_SAMP(',
|
1396
|
+
'SUM(',
|
1397
|
+
'SYS_XMLAGG(',
|
1398
|
+
'VAR_POP(',
|
1399
|
+
'VAR_SAMP(',
|
1400
|
+
'VARIANCE(',
|
1401
|
+
'XMLAGG(',
|
1385
1402
|
]
|
1386
1403
|
end
|
1387
1404
|
|
1388
1405
|
def self.get_defaults()
|
1389
1406
|
{
|
1390
|
-
|
1391
|
-
|
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
|
-
|
1407
|
+
'errors' => [],
|
1408
|
+
'name' => ([*('A'..'Z'),*('0'..'9')]-%w(0 1 I O)).sample(16).join,
|
1409
|
+
'database' => 'primary', #
|
1410
|
+
'title' => '',
|
1411
|
+
'listDescription' => '',
|
1412
|
+
'pageId' => $_SERVER['PATH_INFO'],
|
1413
|
+
'view' => '',
|
1414
|
+
'data' => {},
|
1415
|
+
'collClass' => '',
|
1416
|
+
'collAlign' => '',
|
1417
|
+
'fields' => {},
|
1418
|
+
'fieldsHidden' => [],
|
1419
|
+
'bindVars' => [],
|
1420
|
+
'bindVarsLegacy' => {},
|
1421
|
+
'links' => {},
|
1422
|
+
'buttons' => {},
|
1423
|
+
'inputs' => {},
|
1424
|
+
'filter' => [],
|
1425
|
+
'groupBy' => '',
|
1426
|
+
'rowStart' => 0,
|
1427
|
+
'rowLimit' => 10,
|
1428
|
+
'orderBy' => '',
|
1429
|
+
'allowHTML' => true,
|
1430
|
+
'searchClear' => false,
|
1431
|
+
'searchClearAll' => false,
|
1432
|
+
'showPagination' => true,
|
1433
|
+
'searchSession' => true,
|
1417
1434
|
|
1418
|
-
|
1419
|
-
|
1420
|
-
|
1421
|
-
|
1435
|
+
#
|
1436
|
+
# carryOverRequests will allow you to post custom things from request to all sort/paging URLS for each ajax
|
1437
|
+
#
|
1438
|
+
'carryOverRequsts' => ['switch_grouping','group_row_id','q'],
|
1422
1439
|
|
1423
|
-
|
1424
|
-
|
1425
|
-
|
1440
|
+
#
|
1441
|
+
# Head/Foot
|
1442
|
+
#
|
1426
1443
|
|
1427
|
-
|
1428
|
-
|
1444
|
+
'customFooter' => '',
|
1445
|
+
'customHeader' => '',
|
1429
1446
|
|
1430
|
-
|
1431
|
-
|
1432
|
-
|
1433
|
-
|
1434
|
-
|
1447
|
+
#
|
1448
|
+
# Ajax
|
1449
|
+
#
|
1450
|
+
'ajaxFunctionAll' => '',
|
1451
|
+
'ajaxFunction' => 'ListJumpMin',
|
1435
1452
|
|
1436
|
-
|
1437
|
-
|
1438
|
-
|
1439
|
-
|
1440
|
-
|
1441
|
-
|
1442
|
-
|
1443
|
-
|
1444
|
-
|
1445
|
-
|
1453
|
+
#
|
1454
|
+
# Search
|
1455
|
+
#
|
1456
|
+
'showSearch' => true,
|
1457
|
+
'searchOnkeyup' => "SearchWidgetList('<!--URL-->', '<!--TARGET-->', this);",
|
1458
|
+
'searchIdCol' => 'id',
|
1459
|
+
'searchTitle' => 'Search by Id or CSV of Ids and more',
|
1460
|
+
'searchFieldsIn' => {},
|
1461
|
+
'searchFieldsOut' => {'id'=>true},
|
1462
|
+
'templateFilter' => '',
|
1446
1463
|
|
1447
|
-
|
1448
|
-
|
1449
|
-
|
1450
|
-
|
1451
|
-
|
1464
|
+
#
|
1465
|
+
# Export
|
1466
|
+
#
|
1467
|
+
'showExport' => true,
|
1468
|
+
'exportButtonTitle' => 'Export CSV',
|
1452
1469
|
|
1453
|
-
|
1454
|
-
|
1455
|
-
|
1456
|
-
|
1457
|
-
|
1458
|
-
|
1459
|
-
|
1460
|
-
|
1470
|
+
#
|
1471
|
+
# Group By Box
|
1472
|
+
#
|
1473
|
+
'groupByItems' => [],
|
1474
|
+
'groupBySelected' => false,
|
1475
|
+
'groupByLabel' => 'Group By',
|
1476
|
+
'groupByClick' => '',
|
1477
|
+
'groupByClickDefault' => "ListChangeGrouping('<!--NAME-->', this);",
|
1461
1478
|
|
1462
1479
|
|
1463
|
-
|
1464
|
-
|
1465
|
-
|
1466
|
-
|
1467
|
-
|
1480
|
+
#
|
1481
|
+
# Advanced searching
|
1482
|
+
#
|
1483
|
+
'listSearchForm' => '',
|
1484
|
+
'ransackSearch' => false,
|
1468
1485
|
|
1469
|
-
|
1470
|
-
|
1471
|
-
|
1472
|
-
|
1473
|
-
|
1474
|
-
|
1475
|
-
|
1476
|
-
|
1477
|
-
|
1486
|
+
#
|
1487
|
+
# Column Specific
|
1488
|
+
#
|
1489
|
+
'columnStyle' => {},
|
1490
|
+
'columnClass' => {},
|
1491
|
+
'columnPopupTitle' => {},
|
1492
|
+
'columnSort' => {},
|
1493
|
+
'columnWidth' => {},
|
1494
|
+
'columnNoSort' => {},
|
1478
1495
|
|
1479
|
-
|
1480
|
-
|
1481
|
-
|
1482
|
-
|
1483
|
-
|
1496
|
+
#
|
1497
|
+
# Column Border (on right of each column)
|
1498
|
+
#
|
1499
|
+
'borderedColumns' => false,
|
1500
|
+
'borderColumnStyle' => '1px solid #CCCCCC',
|
1484
1501
|
|
1485
|
-
|
1486
|
-
|
1487
|
-
|
1488
|
-
|
1489
|
-
|
1502
|
+
#
|
1503
|
+
# Row Border (on top of each row)
|
1504
|
+
#
|
1505
|
+
'borderedRows' => true,
|
1506
|
+
'borderRowStyle' => '1px solid #CCCCCC',
|
1490
1507
|
|
1491
|
-
|
1492
|
-
|
1493
|
-
|
1494
|
-
|
1495
|
-
|
1508
|
+
#
|
1509
|
+
# Head/Foot border
|
1510
|
+
#
|
1511
|
+
'borderHeadFoot' => false,
|
1512
|
+
'headFootBorderStyle' => '1px solid #CCCCCC',
|
1496
1513
|
|
1497
|
-
|
1498
|
-
|
1514
|
+
'bordersEverywhere?' => false,
|
1515
|
+
'borderEverywhere' => '1px solid #CCCCCC',
|
1499
1516
|
|
1500
|
-
|
1501
|
-
|
1502
|
-
|
1503
|
-
|
1517
|
+
#
|
1518
|
+
# Buttons
|
1519
|
+
#
|
1520
|
+
'defaultButtonClass' => 'info',
|
1504
1521
|
|
1505
|
-
|
1506
|
-
|
1507
|
-
|
1508
|
-
|
1509
|
-
|
1510
|
-
|
1511
|
-
|
1522
|
+
#
|
1523
|
+
# Font
|
1524
|
+
#
|
1525
|
+
'fontFamily' => '"Times New Roman", Times, serif',
|
1526
|
+
'headerFooterFontSize' => '14px',
|
1527
|
+
'dataFontSize' => '14px',
|
1528
|
+
'titleFontSize' => '24px',
|
1512
1529
|
|
1513
|
-
|
1514
|
-
|
1515
|
-
|
1516
|
-
|
1517
|
-
|
1518
|
-
|
1519
|
-
|
1520
|
-
|
1521
|
-
|
1522
|
-
|
1523
|
-
|
1524
|
-
|
1525
|
-
|
1526
|
-
|
1530
|
+
#
|
1531
|
+
# Table Colors
|
1532
|
+
#
|
1533
|
+
'footerBGColor' => '#ECECEC',
|
1534
|
+
'headerBGColor' => '#ECECEC',
|
1535
|
+
'footerFontColor' => '#494949',
|
1536
|
+
'headerFontColor' => '#494949',
|
1537
|
+
'tableBorder' => '1',
|
1538
|
+
'cornerRadius' => 15,
|
1539
|
+
|
1540
|
+
'useBoxShadow' => true,
|
1541
|
+
'shadowInset' => 10,
|
1542
|
+
'shadowSpread' => 20,
|
1543
|
+
'shadowColor' => '#888888',
|
1527
1544
|
|
1528
|
-
|
1529
|
-
|
1530
|
-
|
1531
|
-
|
1532
|
-
|
1533
|
-
|
1534
|
-
|
1535
|
-
|
1536
|
-
|
1537
|
-
|
1538
|
-
|
1539
|
-
|
1540
|
-
|
1541
|
-
|
1542
|
-
|
1543
|
-
|
1544
|
-
|
1545
|
-
|
1546
|
-
|
1547
|
-
|
1548
|
-
|
1549
|
-
|
1550
|
-
|
1551
|
-
|
1545
|
+
#
|
1546
|
+
# Row specifics
|
1547
|
+
#
|
1548
|
+
'rowClass' => '',
|
1549
|
+
'rowFontColor' => 'black',
|
1550
|
+
'rowColorByStatus' => {},
|
1551
|
+
'rowStylesByStatus' => {},
|
1552
|
+
'rowOffsets' => ['#FFFFFF','#FFFFFF'],
|
1553
|
+
|
1554
|
+
'class' => 'listContainerPassive',
|
1555
|
+
'tableclass' => 'tableBlowOutPreventer',
|
1556
|
+
'noDataMessage' => 'Currently no data.',
|
1557
|
+
'useSort' => true,
|
1558
|
+
'headerClass' => {},
|
1559
|
+
'fieldFunction' => {},
|
1560
|
+
'buttonVal' => 'templateListJump',
|
1561
|
+
'linkFunction' => 'ButtonLinkPost',
|
1562
|
+
'template' => '',
|
1563
|
+
'LIST_COL_SORT_ORDER' => 'ASC',
|
1564
|
+
'LIST_COL_SORT' => '',
|
1565
|
+
'LIST_FILTER_ALL' => '',
|
1566
|
+
'ROW_LIMIT' => '',
|
1567
|
+
'LIST_SEQUENCE' => 1,
|
1568
|
+
'NEW_SEARCH' => false,
|
1552
1569
|
|
1553
|
-
|
1554
|
-
|
1555
|
-
|
1556
|
-
|
1557
|
-
|
1558
|
-
|
1570
|
+
#
|
1571
|
+
# Checkbox
|
1572
|
+
#
|
1573
|
+
'checkedClass' => 'widgetlist-checkbox',
|
1574
|
+
'checkedFlag' => {},
|
1575
|
+
'storeSessionChecks' => false,
|
1559
1576
|
|
1560
|
-
|
1561
|
-
|
1562
|
-
|
1563
|
-
|
1564
|
-
|
1577
|
+
#
|
1578
|
+
# Hooks
|
1579
|
+
#
|
1580
|
+
'columnHooks' => {},
|
1581
|
+
'rowHooks' => {}
|
1565
1582
|
}
|
1566
1583
|
end
|
1567
1584
|
|
@@ -1783,7 +1800,7 @@ module WidgetList
|
|
1783
1800
|
if $_REQUEST.key?('switch_grouping')
|
1784
1801
|
groupBy = $_REQUEST['switch_grouping']
|
1785
1802
|
$_SESSION.deep_merge!({'CURRENT_GROUPING' => { list_parms['name'] => groupBy} })
|
1786
|
-
elsif $_SESSION.key?('CURRENT_GROUPING') && $_SESSION['CURRENT_GROUPING'].key?(list_parms['name'])
|
1803
|
+
elsif $_SESSION.key?('CURRENT_GROUPING') && !$_SESSION['CURRENT_GROUPING'].nil? && $_SESSION['CURRENT_GROUPING'].key?(list_parms['name'])
|
1787
1804
|
groupBy = $_SESSION['CURRENT_GROUPING'][list_parms['name']]
|
1788
1805
|
list_parms['groupBySelected'] = groupBy
|
1789
1806
|
else
|
@@ -1964,7 +1981,7 @@ module WidgetList
|
|
1964
1981
|
list_search['value'] = ''
|
1965
1982
|
|
1966
1983
|
if @items['searchSession']
|
1967
|
-
if $_SESSION.key?('SEARCH_FILTER') && $_SESSION['SEARCH_FILTER'].key?(@items['name'])
|
1984
|
+
if $_SESSION.key?('SEARCH_FILTER') && !$_SESSION['SEARCH_FILTER'].nil? && $_SESSION['SEARCH_FILTER'].key?(@items['name'])
|
1968
1985
|
list_search['value'] = $_SESSION['SEARCH_FILTER'][@items['name']]
|
1969
1986
|
end
|
1970
1987
|
end
|
@@ -1980,11 +1997,11 @@ module WidgetList
|
|
1980
1997
|
list_search['name'] = 'list_search_name_' + @items['name']
|
1981
1998
|
list_search['class'] = 'inputOuter widget-search-outer ' + @items['name'].downcase + '-search'
|
1982
1999
|
list_search['search_ahead'] = {
|
1983
|
-
|
1984
|
-
|
1985
|
-
|
1986
|
-
|
1987
|
-
|
2000
|
+
'url' => searchUrl,
|
2001
|
+
'skip_queue' => false,
|
2002
|
+
'target' => @items['name'],
|
2003
|
+
'search_form' => @items['listSearchForm'],
|
2004
|
+
'onkeyup' => (! @items['searchOnkeyup'].empty?) ? WidgetList::Utils::fill({'<!--URL-->'=>searchUrl, '<!--TARGET-->' => @items['name'], '<!--FUNCTION_ALL-->' => @items['ajaxFunctionAll']}, @items['searchOnkeyup'] + '<!--FUNCTION_ALL-->') : ''
|
1988
2005
|
}
|
1989
2006
|
|
1990
2007
|
@headerPieces['searchBar'] = WidgetList::Widgets::widget_input(list_search)
|
@@ -2040,8 +2057,8 @@ module WidgetList
|
|
2040
2057
|
}
|
2041
2058
|
|
2042
2059
|
list_group['search_ahead'] = {
|
2043
|
-
|
2044
|
-
|
2060
|
+
'skip_queue' => false,
|
2061
|
+
'search_form'=> '
|
2045
2062
|
<div id="advanced-search-container" style="height:100% !important;">
|
2046
2063
|
' + groupRows.join("\n") + '
|
2047
2064
|
</div>'
|
@@ -2174,11 +2191,11 @@ module WidgetList
|
|
2174
2191
|
#Assemble navigation buttons
|
2175
2192
|
#
|
2176
2193
|
pieces = {
|
2177
|
-
|
2178
|
-
|
2179
|
-
|
2180
|
-
|
2181
|
-
|
2194
|
+
'<!--NEXT_URL-->' => nextUrl,
|
2195
|
+
'<!--LIST_NAME-->' => @items['name'],
|
2196
|
+
'<!--PREVIOUS_URL-->' => prevUrl,
|
2197
|
+
'<!--FUNCTION-->' => @items['ajaxFunction'],
|
2198
|
+
'<!--FUNCTION_ALL-->' => @items['ajaxFunctionAll'],
|
2182
2199
|
}
|
2183
2200
|
|
2184
2201
|
templates['btn_next'] = WidgetList::Utils::fill(pieces,templates['btn_next'])
|
@@ -2281,23 +2298,23 @@ module WidgetList
|
|
2281
2298
|
end
|
2282
2299
|
|
2283
2300
|
jumpSection << WidgetList::Utils::fill({
|
2284
|
-
|
2285
|
-
|
2286
|
-
|
2287
|
-
|
2288
|
-
|
2301
|
+
'<!--SEQUENCE-->' => page,
|
2302
|
+
'<!--JUMP_URL-->' => jumpUrl,
|
2303
|
+
'<!--LIST_NAME-->' => @items['name'],
|
2304
|
+
'<!--FUNCTION-->' => @items['ajaxFunction'],
|
2305
|
+
'<!--FUNCTION_ALL-->' => @items['ajaxFunctionAll'],
|
2289
2306
|
}, jumpTemplate)
|
2290
2307
|
end
|
2291
2308
|
|
2292
2309
|
pieces = {
|
2293
|
-
|
2294
|
-
|
2295
|
-
|
2296
|
-
|
2297
|
-
|
2298
|
-
|
2299
|
-
|
2300
|
-
|
2310
|
+
'<!--PREVIOUS_BUTTON-->' => templates['btn_previous'],
|
2311
|
+
'<!--SEQUENCE-->' => @sequence,
|
2312
|
+
'<!--NEXT_BUTTON-->' => templates['btn_next'],
|
2313
|
+
'<!--TOTAL_PAGES-->' => @totalPages,
|
2314
|
+
'<!--TOTAL_ROWS-->' => @totalRows,
|
2315
|
+
'<!--PAGE_SEQUENCE_JUMP_LIST-->' => pageSelect,
|
2316
|
+
'<!--JUMP-->' => jumpSection.join(''),
|
2317
|
+
'<!--LIST_NAME-->' => @items['name'],
|
2301
2318
|
}
|
2302
2319
|
|
2303
2320
|
paginationOutput = WidgetList::Utils::fill(pieces,@items['template_pagination_wrapper'])
|
@@ -2449,7 +2466,7 @@ module WidgetList
|
|
2449
2466
|
|
2450
2467
|
if (
|
2451
2468
|
( (@items.key?('LIST_COL_SORT') && !@items['LIST_COL_SORT'].empty?) && @items['LIST_COL_SORT'] == colSort['LIST_COL_SORT']) ||
|
2452
|
-
|
2469
|
+
( $_SESSION.key?('LIST_COL_SORT') && !$_SESSION['LIST_COL_SORT'].nil? && $_SESSION['LIST_COL_SORT'].key?(@sqlHash) && $_SESSION['LIST_COL_SORT'][@sqlHash].key?(field))
|
2453
2470
|
)
|
2454
2471
|
changedSession = false
|
2455
2472
|
if @items.key?('LIST_COL_SORT') && !@items['LIST_COL_SORT'].empty?
|
@@ -2592,7 +2609,7 @@ module WidgetList
|
|
2592
2609
|
|
2593
2610
|
if input['check_all']
|
2594
2611
|
checkAllId = input['id']
|
2595
|
-
if $_SESSION.key?('list_checks') &&
|
2612
|
+
if $_SESSION.key?('list_checks') && !$_SESSION['list_checks'].nil? && $_SESSION['list_checks'].key?('check_all_' + @sqlHash.to_s + @items['name'].to_s + @sequence.to_s)
|
2596
2613
|
input['checked'] = true
|
2597
2614
|
end
|
2598
2615
|
|
@@ -2640,7 +2657,7 @@ module WidgetList
|
|
2640
2657
|
#
|
2641
2658
|
# Checkbox is checked or not per session (overwrites query)
|
2642
2659
|
#
|
2643
|
-
if $_SESSION.key?('list_checks') && $_SESSION['list_checks'].key?(@items['name'] + @sqlHash + input['value'].to_s)
|
2660
|
+
if $_SESSION.key?('list_checks') && !$_SESSION['list_checks'].nil? && $_SESSION['list_checks'].key?(@items['name'] + @sqlHash + input['value'].to_s)
|
2644
2661
|
input['checked'] = true
|
2645
2662
|
end
|
2646
2663
|
|
@@ -2708,41 +2725,41 @@ module WidgetList
|
|
2708
2725
|
def self.checkbox_helper(list_parms,primary_key)
|
2709
2726
|
|
2710
2727
|
list_parms.deep_merge!({'inputs' =>
|
2711
|
-
|
2712
|
-
|
2713
|
-
|
2714
|
-
|
2728
|
+
{'checkbox'=>
|
2729
|
+
{'type' => 'checkbox'
|
2730
|
+
}
|
2731
|
+
}
|
2715
2732
|
})
|
2716
2733
|
|
2717
2734
|
list_parms.deep_merge!({'inputs' =>
|
2718
|
-
|
2719
|
-
|
2720
|
-
|
2721
|
-
|
2722
|
-
|
2723
|
-
|
2724
|
-
|
2725
|
-
|
2726
|
-
|
2735
|
+
{'checkbox'=>
|
2736
|
+
{'items' =>
|
2737
|
+
{
|
2738
|
+
'name' => list_parms['name'] + '_visible_checks[]',
|
2739
|
+
'value' => primary_key, #the value should be a column name mapping
|
2740
|
+
'class_handle' => list_parms['name'] + '_info_tables',
|
2741
|
+
}
|
2742
|
+
}
|
2743
|
+
}
|
2727
2744
|
})
|
2728
2745
|
|
2729
2746
|
list_parms.deep_merge!({'inputs' =>
|
2730
|
-
|
2731
|
-
|
2732
|
-
|
2733
|
-
|
2747
|
+
{'checkbox_header'=>
|
2748
|
+
{'type' => 'checkbox'
|
2749
|
+
}
|
2750
|
+
}
|
2734
2751
|
})
|
2735
2752
|
|
2736
2753
|
list_parms.deep_merge!({'inputs' =>
|
2737
|
-
|
2738
|
-
|
2739
|
-
|
2740
|
-
|
2741
|
-
|
2742
|
-
|
2743
|
-
|
2744
|
-
|
2745
|
-
|
2754
|
+
{'checkbox_header'=>
|
2755
|
+
{'items' =>
|
2756
|
+
{
|
2757
|
+
'check_all' => true,
|
2758
|
+
'id' => list_parms['name'] + '_info_tables_check_all',
|
2759
|
+
'class_handle' => list_parms['name'] + '_info_tables',
|
2760
|
+
}
|
2761
|
+
}
|
2762
|
+
}
|
2746
2763
|
})
|
2747
2764
|
return list_parms
|
2748
2765
|
end
|
@@ -2753,20 +2770,20 @@ module WidgetList
|
|
2753
2770
|
|
2754
2771
|
def self.build_drill_down(*params)
|
2755
2772
|
required_params = {
|
2756
|
-
|
2757
|
-
|
2758
|
-
|
2759
|
-
|
2773
|
+
:list_id => true, # -- your widget_list name (used for JS)
|
2774
|
+
: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
|
2775
|
+
: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
|
2776
|
+
:column_to_show => true, # -- The visible column or SQL functions to display to user for the link
|
2760
2777
|
}
|
2761
2778
|
|
2762
2779
|
optional_params = {
|
2763
|
-
|
2764
|
-
|
2765
|
-
|
2766
|
-
|
2767
|
-
|
2768
|
-
|
2769
|
-
|
2780
|
+
:column_alias => '', # -- AS XXXX
|
2781
|
+
:extra_function => '', # -- Onclick of link, call another JS function after the drill down function is called
|
2782
|
+
:js_function_name => 'ListDrillDown', # -- name of JS Function
|
2783
|
+
:column_class => '', # -- custom class on the <a> tag
|
2784
|
+
:link_color => 'blue', # -- whatever color you want the link to be
|
2785
|
+
:extra_js_func_params => '', # -- Add extra params to ListDrillDown outside of the default
|
2786
|
+
:primary_database => true, # -- Since this function builds a column before widget_list is instantiated, tell which connection you are using
|
2770
2787
|
}
|
2771
2788
|
|
2772
2789
|
valid = WidgetList::Widgets::validate_items(params[0],required_params)
|
@@ -3313,7 +3330,7 @@ module WidgetList
|
|
3313
3330
|
clear_sql_session(@items.key?('searchClearAll'))
|
3314
3331
|
end
|
3315
3332
|
|
3316
|
-
if !$_REQUEST.key?('BUTTON_VALUE') && $_SESSION.key?('LIST_SEQUENCE') && $_SESSION['LIST_SEQUENCE'].key?(@sqlHash) && $_SESSION['LIST_SEQUENCE'][@sqlHash] > 0
|
3333
|
+
if !$_REQUEST.key?('BUTTON_VALUE') && !$_SESSION['LIST_SEQUENCE'].nil? && $_SESSION.key?('LIST_SEQUENCE') && $_SESSION['LIST_SEQUENCE'].key?(@sqlHash) && $_SESSION['LIST_SEQUENCE'][@sqlHash] > 0
|
3317
3334
|
@sequence = $_SESSION['LIST_SEQUENCE'][@sqlHash]
|
3318
3335
|
generate_limits
|
3319
3336
|
end
|
@@ -3375,7 +3392,7 @@ module WidgetList
|
|
3375
3392
|
when 'oracle'
|
3376
3393
|
|
3377
3394
|
pieces['<!--LIMIT-->'] =
|
3378
|
-
|
3395
|
+
'
|
3379
3396
|
WHERE
|
3380
3397
|
(
|
3381
3398
|
rn >' + (@sequence > 1 ? '' : '=') + ' :LOW
|