widget_list 1.3.7 → 2.0.0
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.
- checksums.yaml +5 -13
- data/README.md +98 -711
- data/checkin_gem.sh +10 -10
- data/docs/legacy-readme.md +757 -0
- data/lib/extensions/action_controller_base.rb +21 -29
- data/lib/widget_list/engine.rb +1 -4
- data/lib/widget_list/railtie.rb +10 -33
- data/lib/widget_list/request_context.rb +5 -0
- data/lib/widget_list/sequel.rb +17 -41
- data/lib/widget_list/utils.rb +7 -7
- data/lib/widget_list/version.rb +1 -1
- data/lib/widget_list/widgets.rb +1 -2
- data/lib/widget_list.rb +217 -216
- data/publish_gem.sh +14 -35
- data/vendor/assets/stylesheets/{widget_list.css → widget_list.css.erb} +21 -21
- data/vendor/assets/stylesheets/{widgets.css → widgets.css.erb} +9 -9
- data/widget_list.gemspec +8 -10
- metadata +44 -32
data/lib/widget_list.rb
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
require 'ransack'
|
|
2
|
+
require 'widget_list/request_context'
|
|
2
3
|
require 'widget_list/version'
|
|
3
4
|
require 'widget_list/hash'
|
|
4
5
|
require 'widget_list/string'
|
|
@@ -17,7 +18,7 @@ module WidgetList
|
|
|
17
18
|
# WidgetList Administration/Setup
|
|
18
19
|
#
|
|
19
20
|
def self.go!()
|
|
20
|
-
if
|
|
21
|
+
if WidgetList::RequestContext.request.key?('iframe')
|
|
21
22
|
eval(WidgetList::Administration.new.translate_config_to_code())
|
|
22
23
|
return @output
|
|
23
24
|
else
|
|
@@ -30,7 +31,7 @@ module WidgetList
|
|
|
30
31
|
def show_interface()
|
|
31
32
|
config_file = Rails.root.join("config", "widget-list-administration.json")
|
|
32
33
|
config_file_all = Rails.root.join("config", "widget-list-administration-all.json")
|
|
33
|
-
if config_file.file? &&
|
|
34
|
+
if config_file.file? && !WidgetList::RequestContext.request.key?('ajax') && !WidgetList::RequestContext.request.key?('name')
|
|
34
35
|
File.delete(Rails.root.join("config", "widget-list-administration.json"))
|
|
35
36
|
end
|
|
36
37
|
|
|
@@ -65,7 +66,7 @@ module WidgetList
|
|
|
65
66
|
# INIT PROMPT
|
|
66
67
|
#
|
|
67
68
|
|
|
68
|
-
if config_file_all.file? &&
|
|
69
|
+
if config_file_all.file? && !WidgetList::RequestContext.request.key?('restore')
|
|
69
70
|
@fill['<!--BUTTON_CSS-->'] = 'style="display:none"'
|
|
70
71
|
@fill['<!--START_CSS-->'] = 'style="display:none"'
|
|
71
72
|
options = ''
|
|
@@ -99,7 +100,7 @@ module WidgetList
|
|
|
99
100
|
#
|
|
100
101
|
# BASE
|
|
101
102
|
#
|
|
102
|
-
@fill['<!--POST_URL-->'] =
|
|
103
|
+
@fill['<!--POST_URL-->'] = WidgetList::RequestContext.server['SCRIPT_NAME'] + WidgetList::RequestContext.server['PATH_INFO']
|
|
103
104
|
@fill['<!--BUTTONS-->'] = WidgetList::Widgets::widget_button('Step One - Start ->', {'id' => 'start' , 'onclick' => "ShowStart();" , 'innerClass' => "primary" } ) +
|
|
104
105
|
WidgetList::Widgets::widget_button('Step Two - Fields ->', {'id' => 'fields' , 'onclick' => "ShowFields();" , 'innerClass' => "primary disabled" } ) +
|
|
105
106
|
WidgetList::Widgets::widget_button('Step Three - Rows ->', {'id' => 'rows' , 'onclick' => "ShowRows();" , 'innerClass' => "primary disabled" } ) +
|
|
@@ -112,8 +113,8 @@ module WidgetList
|
|
|
112
113
|
# START
|
|
113
114
|
#
|
|
114
115
|
@fill['<!--TITLE-->'] = 'Stub Out A New WidgetList Implementation'
|
|
115
|
-
@fill['<!--CONTROLLER_VALUE-->'] = (!@isEditing) ?
|
|
116
|
-
@fill['<!--ACTION_VALUE-->'] = (!@isEditing) ?
|
|
116
|
+
@fill['<!--CONTROLLER_VALUE-->'] = (!@isEditing) ? WidgetList::RequestContext.request['controller'] : page_config['desiredController']
|
|
117
|
+
@fill['<!--ACTION_VALUE-->'] = (!@isEditing) ? WidgetList::RequestContext.request['action'] : page_config['desiredAction']
|
|
117
118
|
@fill['<!--NAME_VALUE-->'] = (!@isEditing) ? config_id : page_config['name']
|
|
118
119
|
@fill['<!--VIEW_OPTIONS-->'] = model_options
|
|
119
120
|
@fill['<!--TITLE_VALUE-->'] = (!@isEditing) ? '' : page_config['title']
|
|
@@ -370,7 +371,7 @@ module WidgetList
|
|
|
370
371
|
end
|
|
371
372
|
|
|
372
373
|
def escape_code(code)
|
|
373
|
-
if
|
|
374
|
+
if WidgetList::RequestContext.request.key?('iframe')
|
|
374
375
|
#It is so weird, during output return, you need an extra slash to populate the code properly, but during rendering this is needed
|
|
375
376
|
code.gsub(/'/,"\\\\'")
|
|
376
377
|
else
|
|
@@ -594,7 +595,7 @@ module WidgetList
|
|
|
594
595
|
|
|
595
596
|
if page_config['useRansack'] == '1' && page_config['showSearch'] == '1' && $is_mongo == false
|
|
596
597
|
view_code = "
|
|
597
|
-
list_parms#{add_pointer('ransackSearch',-10)} #{page_config['view']}.search(#{(
|
|
598
|
+
list_parms#{add_pointer('ransackSearch',-10)} #{page_config['view']}.search(#{(WidgetList::RequestContext.request.key?('iframe')) ? 'WidgetList::RequestContext.request' : 'params'}[:q])
|
|
598
599
|
list_parms#{add_pointer('view',-10)} list_parms['ransackSearch'].result
|
|
599
600
|
"
|
|
600
601
|
if page_config['ransackAdvancedForm'] == '1'
|
|
@@ -888,9 +889,9 @@ module WidgetList
|
|
|
888
889
|
config_file = Rails.root.join("config", "widget-list-administration.json")
|
|
889
890
|
config_file_all = Rails.root.join("config", "widget-list-administration-all.json")
|
|
890
891
|
|
|
891
|
-
if config_file.file? && (
|
|
892
|
+
if config_file.file? && (WidgetList::RequestContext.request.key?('iframe') || WidgetList::RequestContext.request.key?('name'))
|
|
892
893
|
configuration = JSON.parse(File.new(Rails.root.join("config", "widget-list-administration.json")).read)
|
|
893
|
-
elsif
|
|
894
|
+
elsif WidgetList::RequestContext.request.key?('restore')
|
|
894
895
|
configuration = JSON.parse(File.new(Rails.root.join("config", "widget-list-administration-all.json")).read)
|
|
895
896
|
else
|
|
896
897
|
configuration = {}
|
|
@@ -1039,9 +1040,9 @@ module WidgetList
|
|
|
1039
1040
|
|
|
1040
1041
|
fields,fields_hidden,fields_function,buttons,footer_buttons,group_by,drill_downs,flags,misc = normalize_configs(page_config)
|
|
1041
1042
|
else
|
|
1042
|
-
controller = (
|
|
1043
|
+
controller = (WidgetList::RequestContext.request.key?('desiredController') ? WidgetList::RequestContext.request['desiredController'] : WidgetList::RequestContext.request['controller'] )
|
|
1043
1044
|
|
|
1044
|
-
if
|
|
1045
|
+
if WidgetList::RequestContext.request.key?('ajax')
|
|
1045
1046
|
model = model_name.constantize
|
|
1046
1047
|
model.columns.each { |field|
|
|
1047
1048
|
fields[field.name] = field.name.gsub(/_/,' _').camelize
|
|
@@ -1059,7 +1060,7 @@ module WidgetList
|
|
|
1059
1060
|
buttons['Delete']['url'] = '/' + controller + '/delete/id/'
|
|
1060
1061
|
buttons['Edit']['url'] = '/' + controller + '/edit/id/'
|
|
1061
1062
|
buttons['Edit']['class'] = 'info'
|
|
1062
|
-
if
|
|
1063
|
+
if WidgetList::RequestContext.request.key?('ajax')
|
|
1063
1064
|
group_by[''] = 'All ' + model_name + 's'
|
|
1064
1065
|
group_by['field_name'] = 'This will group by field_name and show Count'
|
|
1065
1066
|
buttons['Delete']['url'] = '/' + controller + '/delete/' + fields.keys.first + '/'
|
|
@@ -1275,7 +1276,7 @@ module WidgetList
|
|
|
1275
1276
|
@response['footer_buttons'] += WidgetList::Utils::fill(@fieldFill , ac.render_to_string(:partial => 'widget_list/administration/button_row') )
|
|
1276
1277
|
}
|
|
1277
1278
|
|
|
1278
|
-
if
|
|
1279
|
+
if WidgetList::RequestContext.request.key?('ajax') || @isEditing
|
|
1279
1280
|
@response['all_fields'] = all_fields
|
|
1280
1281
|
@response['checked_fields'] = build_field_options(all_fields, page_config.key?('checkboxField') ? page_config['checkboxField'] : '')
|
|
1281
1282
|
end
|
|
@@ -1289,13 +1290,13 @@ module WidgetList
|
|
|
1289
1290
|
|
|
1290
1291
|
def config_id()
|
|
1291
1292
|
config_id = ''
|
|
1292
|
-
if
|
|
1293
|
-
config_id =
|
|
1293
|
+
if WidgetList::RequestContext.request.key?('restore')
|
|
1294
|
+
config_id = WidgetList::RequestContext.request['restore']
|
|
1294
1295
|
else
|
|
1295
|
-
config_id +=
|
|
1296
|
-
config_id +=
|
|
1297
|
-
config_id += '|' +
|
|
1298
|
-
config_id += '-' +
|
|
1296
|
+
config_id += WidgetList::RequestContext.request['controller'] if WidgetList::RequestContext.request.key?('controller')
|
|
1297
|
+
config_id += WidgetList::RequestContext.request['action'] if WidgetList::RequestContext.request.key?('action')
|
|
1298
|
+
config_id += '|' + WidgetList::RequestContext.request['desiredController'] if WidgetList::RequestContext.request.key?('desiredController')
|
|
1299
|
+
config_id += '-' + WidgetList::RequestContext.request['desiredAction'] if WidgetList::RequestContext.request.key?('desiredAction')
|
|
1299
1300
|
end
|
|
1300
1301
|
return config_id
|
|
1301
1302
|
end
|
|
@@ -1311,7 +1312,7 @@ module WidgetList
|
|
|
1311
1312
|
else
|
|
1312
1313
|
configuration = {}
|
|
1313
1314
|
end
|
|
1314
|
-
configuration[config_id] =
|
|
1315
|
+
configuration[config_id] = WidgetList::RequestContext.request
|
|
1315
1316
|
time = Time.new
|
|
1316
1317
|
configuration[config_id]['savedOn'] = time.year.to_s + '-' + time.month.to_s.rjust(2, "0") + '-' + time.day.to_s.rjust(2, "0")
|
|
1317
1318
|
|
|
@@ -1319,14 +1320,14 @@ module WidgetList
|
|
|
1319
1320
|
file.puts configuration.to_json
|
|
1320
1321
|
end
|
|
1321
1322
|
|
|
1322
|
-
if
|
|
1323
|
+
if !WidgetList::RequestContext.request.key?('iframe') && !WidgetList::RequestContext.request.key?('ajax')
|
|
1323
1324
|
config_file_all = Rails.root.join("config", "widget-list-administration-all.json")
|
|
1324
1325
|
if config_file_all.file?
|
|
1325
1326
|
configuration_all = JSON.parse(File.new(Rails.root.join("config", "widget-list-administration-all.json")).read)
|
|
1326
1327
|
else
|
|
1327
1328
|
configuration_all = {}
|
|
1328
1329
|
end
|
|
1329
|
-
configuration_all[config_id] =
|
|
1330
|
+
configuration_all[config_id] = WidgetList::RequestContext.request
|
|
1330
1331
|
configuration_all[config_id]['savedOn'] = time.year.to_s + '-' + time.month.to_s.rjust(2, "0") + '-' + time.day.to_s.rjust(2, "0")
|
|
1331
1332
|
|
|
1332
1333
|
File.open(Rails.root.join("config", "widget-list-administration-all.json"), "w") do |file|
|
|
@@ -1336,10 +1337,10 @@ module WidgetList
|
|
|
1336
1337
|
|
|
1337
1338
|
|
|
1338
1339
|
@fill = {}
|
|
1339
|
-
unless
|
|
1340
|
+
unless WidgetList::RequestContext.request.key?('ajax')
|
|
1340
1341
|
@fill['<!--CODE-->'] = translate_config_to_code()
|
|
1341
1342
|
end
|
|
1342
|
-
return WidgetList::Utils::fill(@fill ,ac.render_to_string(:partial => 'widget_list/administration/output_save') ) unless
|
|
1343
|
+
return WidgetList::Utils::fill(@fill ,ac.render_to_string(:partial => 'widget_list/administration/output_save') ) unless WidgetList::RequestContext.request.key?('ajax')
|
|
1343
1344
|
return @fill.to_json
|
|
1344
1345
|
end
|
|
1345
1346
|
end
|
|
@@ -1366,6 +1367,7 @@ module WidgetList
|
|
|
1366
1367
|
|
|
1367
1368
|
# @param [Hash] list
|
|
1368
1369
|
def initialize(list={})
|
|
1370
|
+
WidgetList::RequestContext.used = true
|
|
1369
1371
|
|
|
1370
1372
|
# Defaults for all configs
|
|
1371
1373
|
# See https://github.com/davidrenne/widget_list/blob/master/README.md#feature-configurations
|
|
@@ -1498,7 +1500,7 @@ module WidgetList
|
|
|
1498
1500
|
end
|
|
1499
1501
|
|
|
1500
1502
|
|
|
1501
|
-
if
|
|
1503
|
+
if WidgetList::RequestContext.request.key?('searchClear')
|
|
1502
1504
|
clear_search_session()
|
|
1503
1505
|
end
|
|
1504
1506
|
|
|
@@ -1506,41 +1508,41 @@ module WidgetList
|
|
|
1506
1508
|
@isJumpingList = false
|
|
1507
1509
|
|
|
1508
1510
|
#Ajax ListJump
|
|
1509
|
-
if !
|
|
1510
|
-
if
|
|
1511
|
-
@items['LIST_FILTER_ALL'] =
|
|
1511
|
+
if ! WidgetList::RequestContext.request.empty?
|
|
1512
|
+
if WidgetList::RequestContext.request.key?('LIST_FILTER_ALL') && !WidgetList::RequestContext.request['LIST_FILTER_ALL'].empty?
|
|
1513
|
+
@items['LIST_FILTER_ALL'] = WidgetList::RequestContext.request['LIST_FILTER_ALL']
|
|
1512
1514
|
@isJumpingList = true
|
|
1513
1515
|
end
|
|
1514
1516
|
|
|
1515
|
-
if
|
|
1516
|
-
@items['LIST_COL_SORT'] =
|
|
1517
|
+
if WidgetList::RequestContext.request.key?('LIST_COL_SORT') && !WidgetList::RequestContext.request['LIST_COL_SORT'].empty?
|
|
1518
|
+
@items['LIST_COL_SORT'] = WidgetList::RequestContext.request['LIST_COL_SORT']
|
|
1517
1519
|
@isJumpingList = true
|
|
1518
1520
|
end
|
|
1519
1521
|
|
|
1520
|
-
if
|
|
1521
|
-
@items['LIST_COL_SORT_ORDER'] =
|
|
1522
|
+
if WidgetList::RequestContext.request.key?('LIST_COL_SORT_ORDER') && !WidgetList::RequestContext.request['LIST_COL_SORT_ORDER'].empty?
|
|
1523
|
+
@items['LIST_COL_SORT_ORDER'] = WidgetList::RequestContext.request['LIST_COL_SORT_ORDER']
|
|
1522
1524
|
@isJumpingList = true
|
|
1523
1525
|
end
|
|
1524
1526
|
|
|
1525
|
-
if
|
|
1526
|
-
@items['LIST_SEQUENCE'] =
|
|
1527
|
+
if WidgetList::RequestContext.request.key?('LIST_SEQUENCE') && !WidgetList::RequestContext.request['LIST_SEQUENCE'].empty?
|
|
1528
|
+
@items['LIST_SEQUENCE'] = WidgetList::RequestContext.request['LIST_SEQUENCE'].to_i
|
|
1527
1529
|
@isJumpingList = true
|
|
1528
1530
|
end
|
|
1529
1531
|
|
|
1530
|
-
if
|
|
1531
|
-
@items['ROW_LIMIT'] =
|
|
1532
|
+
if WidgetList::RequestContext.request.key?('ROW_LIMIT') && !WidgetList::RequestContext.request['ROW_LIMIT'].empty?
|
|
1533
|
+
@items['ROW_LIMIT'] = WidgetList::RequestContext.request['ROW_LIMIT']
|
|
1532
1534
|
@isJumpingList = true
|
|
1533
1535
|
|
|
1534
1536
|
if @items['showPagination']
|
|
1535
|
-
|
|
1536
|
-
|
|
1537
|
+
WidgetList::RequestContext.session['pageDisplayLimit'] = WidgetList::RequestContext.request['ROW_LIMIT']
|
|
1538
|
+
WidgetList::RequestContext.session.deep_merge!({'ROW_LIMIT' => { @items['name'] => WidgetList::RequestContext.request['ROW_LIMIT']} })
|
|
1537
1539
|
end
|
|
1538
1540
|
|
|
1539
1541
|
end
|
|
1540
1542
|
|
|
1541
1543
|
clear_sort_get_vars()
|
|
1542
1544
|
|
|
1543
|
-
if
|
|
1545
|
+
if WidgetList::RequestContext.request.key?('list_action') && WidgetList::RequestContext.request['list_action'] == 'ajax_widgetlist_checks' && @items['storeSessionChecks']
|
|
1544
1546
|
ajax_maintain_checks()
|
|
1545
1547
|
end
|
|
1546
1548
|
|
|
@@ -1553,14 +1555,14 @@ module WidgetList
|
|
|
1553
1555
|
clear_search_session(@items.key?('searchClearAll'))
|
|
1554
1556
|
end
|
|
1555
1557
|
|
|
1556
|
-
matchesCurrentList =
|
|
1557
|
-
isSearchRequest =
|
|
1558
|
+
matchesCurrentList = WidgetList::RequestContext.request.key?('BUTTON_VALUE') && WidgetList::RequestContext.request['BUTTON_VALUE'] == @items['buttonVal']
|
|
1559
|
+
isSearchRequest = WidgetList::RequestContext.request.key?('search_filter') && WidgetList::RequestContext.request['search_filter'] != 'undefined'
|
|
1558
1560
|
templateCustomSearch = !@items['templateFilter'].empty? # if you define templateFilter WidgetList will not attempt to build a where clause with search
|
|
1559
1561
|
|
|
1560
1562
|
#
|
|
1561
1563
|
# Search restore
|
|
1562
1564
|
#
|
|
1563
|
-
if !isSearchRequest &&
|
|
1565
|
+
if !isSearchRequest && !WidgetList::RequestContext.session.empty? && WidgetList::RequestContext.session.key?('SEARCH_FILTER') && WidgetList::RequestContext.session['SEARCH_FILTER'].key?(@items['name']) && @items['searchSession']
|
|
1564
1566
|
isSearchRestore = true
|
|
1565
1567
|
end
|
|
1566
1568
|
|
|
@@ -1570,10 +1572,10 @@ module WidgetList
|
|
|
1570
1572
|
get_view() if $is_mongo # call function to fill in @active_record_model
|
|
1571
1573
|
|
|
1572
1574
|
if !isSearchRestore
|
|
1573
|
-
|
|
1574
|
-
searchFilter =
|
|
1575
|
+
WidgetList::RequestContext.session.deep_merge!({'SEARCH_FILTER' => { @items['name'] => WidgetList::RequestContext.request['search_filter']} })
|
|
1576
|
+
searchFilter = WidgetList::RequestContext.request['search_filter'].strip_or_self()
|
|
1575
1577
|
else
|
|
1576
|
-
searchFilter =
|
|
1578
|
+
searchFilter = WidgetList::RequestContext.session['SEARCH_FILTER'][@items['name']]
|
|
1577
1579
|
end
|
|
1578
1580
|
|
|
1579
1581
|
if ! searchFilter.empty?
|
|
@@ -1794,7 +1796,7 @@ module WidgetList
|
|
|
1794
1796
|
@templateFill['<!--DATA-->'] = '<tr><td colspan="50"><div id="noListResults">' + generate_error_output(e) + @items['noDataMessage'] + '</div></td></tr>'
|
|
1795
1797
|
end
|
|
1796
1798
|
|
|
1797
|
-
if
|
|
1799
|
+
if !WidgetList::RequestContext.request.key?('BUTTON_VALUE')
|
|
1798
1800
|
|
|
1799
1801
|
#Initialize page load/Session stuff whe list first loads
|
|
1800
1802
|
#
|
|
@@ -1809,12 +1811,12 @@ module WidgetList
|
|
|
1809
1811
|
#Set a list title if it exists
|
|
1810
1812
|
#
|
|
1811
1813
|
|
|
1812
|
-
if !
|
|
1814
|
+
if ! WidgetList::RequestContext.request.key?('BUTTON_VALUE') && !@items['title'].empty?
|
|
1813
1815
|
@items['templateHeader'] = '
|
|
1814
1816
|
<h1 style="font-size:' + get_header_px_value() + ';"><!--TITLE--></h1><div class="horizontal_rule"></div>
|
|
1815
1817
|
<!--FILTER_HEADER-->
|
|
1816
1818
|
'
|
|
1817
|
-
elsif
|
|
1819
|
+
elsif !WidgetList::RequestContext.request.key?('BUTTON_VALUE')
|
|
1818
1820
|
# Only if not in ajax would we want to output the filter header
|
|
1819
1821
|
#
|
|
1820
1822
|
@items['templateHeader'] = '<!--FILTER_HEADER-->'
|
|
@@ -1844,8 +1846,8 @@ module WidgetList
|
|
|
1844
1846
|
@items['rowLimit'] = @items['ROW_LIMIT'].to_i
|
|
1845
1847
|
end
|
|
1846
1848
|
|
|
1847
|
-
if
|
|
1848
|
-
@items['rowLimit'] =
|
|
1849
|
+
if WidgetList::RequestContext.session.key?('ROW_LIMIT') && !WidgetList::RequestContext.session['ROW_LIMIT'].nil? && WidgetList::RequestContext.session['ROW_LIMIT'].key?(@items['name']) && !WidgetList::RequestContext.session['ROW_LIMIT'][@items['name']].empty?
|
|
1850
|
+
@items['rowLimit'] = WidgetList::RequestContext.session['ROW_LIMIT'][@items['name']].to_i
|
|
1849
1851
|
end
|
|
1850
1852
|
|
|
1851
1853
|
if ! @items['LIST_COL_SORT'].empty?
|
|
@@ -1920,7 +1922,7 @@ module WidgetList
|
|
|
1920
1922
|
'database' => 'primary', #
|
|
1921
1923
|
'title' => '',
|
|
1922
1924
|
'listDescription' => '',
|
|
1923
|
-
'pageId' =>
|
|
1925
|
+
'pageId' => WidgetList::RequestContext.server['SCRIPT_NAME'] + WidgetList::RequestContext.server['PATH_INFO'],
|
|
1924
1926
|
'view' => '',
|
|
1925
1927
|
'data' => {},
|
|
1926
1928
|
'bindVars' => [],
|
|
@@ -2150,17 +2152,17 @@ module WidgetList
|
|
|
2150
2152
|
|
|
2151
2153
|
def ajax_maintain_checks()
|
|
2152
2154
|
|
|
2153
|
-
if
|
|
2154
|
-
|
|
2155
|
+
if !WidgetList::RequestContext.session.key?('list_checks')
|
|
2156
|
+
WidgetList::RequestContext.session['list_checks'] = {}
|
|
2155
2157
|
end
|
|
2156
2158
|
|
|
2157
2159
|
#
|
|
2158
2160
|
# A list must be provided
|
|
2159
2161
|
#
|
|
2160
|
-
if
|
|
2161
|
-
listName =
|
|
2162
|
-
sqlHash =
|
|
2163
|
-
sequence =
|
|
2162
|
+
if WidgetList::RequestContext.request.key?('LIST_NAME')
|
|
2163
|
+
listName = WidgetList::RequestContext.request['LIST_NAME']
|
|
2164
|
+
sqlHash = WidgetList::RequestContext.request['SQL_HASH']
|
|
2165
|
+
sequence = WidgetList::RequestContext.request['LIST_SEQUENCE'].to_s
|
|
2164
2166
|
|
|
2165
2167
|
#
|
|
2166
2168
|
# The placeholder is created when the list initially forms. This validates it and makes it so
|
|
@@ -2171,18 +2173,18 @@ module WidgetList
|
|
|
2171
2173
|
# For each posted check box
|
|
2172
2174
|
#
|
|
2173
2175
|
|
|
2174
|
-
|
|
2176
|
+
WidgetList::RequestContext.request.each { |value, checked|
|
|
2175
2177
|
if checked.to_s == '1'
|
|
2176
2178
|
#
|
|
2177
2179
|
# Set it as checked
|
|
2178
2180
|
#
|
|
2179
|
-
|
|
2181
|
+
WidgetList::RequestContext.session.deep_merge!({'list_checks' => { listName + sqlHash + value => true } })
|
|
2180
2182
|
else
|
|
2181
2183
|
#
|
|
2182
2184
|
# Unset if it exists and is unchecked
|
|
2183
2185
|
#
|
|
2184
|
-
if
|
|
2185
|
-
|
|
2186
|
+
if WidgetList::RequestContext.session['list_checks'].key?(listName + sqlHash + value)
|
|
2187
|
+
WidgetList::RequestContext.session['list_checks'].delete(listName + sqlHash + value)
|
|
2186
2188
|
end
|
|
2187
2189
|
end
|
|
2188
2190
|
}
|
|
@@ -2190,18 +2192,18 @@ module WidgetList
|
|
|
2190
2192
|
#
|
|
2191
2193
|
# Check All
|
|
2192
2194
|
#
|
|
2193
|
-
if
|
|
2194
|
-
if
|
|
2195
|
+
if WidgetList::RequestContext.request.key?('checked_all') && WidgetList::RequestContext.request['checked_all'] == '1'
|
|
2196
|
+
if WidgetList::RequestContext.session.key?('list_checks')
|
|
2195
2197
|
|
|
2196
|
-
if
|
|
2197
|
-
if
|
|
2198
|
-
|
|
2198
|
+
if WidgetList::RequestContext.session['list_checks'].key?('check_all_' + sqlHash + listName + sequence)
|
|
2199
|
+
if WidgetList::RequestContext.request['checked_all'].empty?
|
|
2200
|
+
WidgetList::RequestContext.session['list_checks'].delete('check_all_' + sqlHash + listName + sequence)
|
|
2199
2201
|
else
|
|
2200
|
-
|
|
2202
|
+
WidgetList::RequestContext.session.deep_merge!({'list_checks' => { 'check_all_' + sqlHash + listName + sequence => true } })
|
|
2201
2203
|
end
|
|
2202
2204
|
else
|
|
2203
|
-
if !
|
|
2204
|
-
|
|
2205
|
+
if ! WidgetList::RequestContext.request['checked_all'].empty?
|
|
2206
|
+
WidgetList::RequestContext.session.deep_merge!({'list_checks' => { 'check_all_' + sqlHash + listName + WidgetList::RequestContext.request['LIST_SEQUENCE'] => true } })
|
|
2205
2207
|
end
|
|
2206
2208
|
end
|
|
2207
2209
|
end
|
|
@@ -2211,82 +2213,82 @@ module WidgetList
|
|
|
2211
2213
|
|
|
2212
2214
|
def self.clear_check_box_session(name='')
|
|
2213
2215
|
|
|
2214
|
-
if
|
|
2215
|
-
|
|
2216
|
+
if WidgetList::RequestContext.session.key?('DRILL_DOWN_FILTERS')
|
|
2217
|
+
WidgetList::RequestContext.session.delete('DRILL_DOWN_FILTERS')
|
|
2216
2218
|
end
|
|
2217
2219
|
|
|
2218
|
-
if
|
|
2219
|
-
|
|
2220
|
+
if WidgetList::RequestContext.session.key?('DRILL_DOWNS')
|
|
2221
|
+
WidgetList::RequestContext.session.delete('DRILL_DOWNS')
|
|
2220
2222
|
end
|
|
2221
2223
|
|
|
2222
|
-
|
|
2224
|
+
WidgetList::RequestContext.session['list_checks'].keys.each { |key|
|
|
2223
2225
|
if key.include?(name)
|
|
2224
|
-
|
|
2226
|
+
WidgetList::RequestContext.session['list_checks'].delete(key)
|
|
2225
2227
|
end
|
|
2226
|
-
} if
|
|
2228
|
+
} if WidgetList::RequestContext.session.key?('list_checks') && !WidgetList::RequestContext.session['list_checks'].nil? && !WidgetList::RequestContext.session['list_checks'].empty?
|
|
2227
2229
|
|
|
2228
2230
|
end
|
|
2229
2231
|
|
|
2230
2232
|
def clear_search_session(all=false)
|
|
2231
2233
|
|
|
2232
|
-
if
|
|
2233
|
-
|
|
2234
|
+
if WidgetList::RequestContext.session.key?('SEARCH_FILTER') && WidgetList::RequestContext.session['SEARCH_FILTER'].key?(@items['name'])
|
|
2235
|
+
WidgetList::RequestContext.session['SEARCH_FILTER'].delete(@items['name'])
|
|
2234
2236
|
end
|
|
2235
2237
|
|
|
2236
|
-
if
|
|
2237
|
-
|
|
2238
|
+
if WidgetList::RequestContext.session.key?('ROW_LIMIT') && WidgetList::RequestContext.session['ROW_LIMIT'].key?(@items['name'])
|
|
2239
|
+
WidgetList::RequestContext.session['ROW_LIMIT'].delete(@items['name'])
|
|
2238
2240
|
end
|
|
2239
2241
|
|
|
2240
|
-
if
|
|
2241
|
-
|
|
2242
|
+
if WidgetList::RequestContext.session.key?('DRILL_DOWNS') && WidgetList::RequestContext.session['DRILL_DOWNS'].key?(@items['name'])
|
|
2243
|
+
WidgetList::RequestContext.session['DRILL_DOWNS'].delete(@items['name'])
|
|
2242
2244
|
end
|
|
2243
2245
|
|
|
2244
|
-
if
|
|
2245
|
-
|
|
2246
|
+
if WidgetList::RequestContext.session.key?('DRILL_DOWN_FILTERS') && WidgetList::RequestContext.session['DRILL_DOWN_FILTERS'].key?(@items['name'])
|
|
2247
|
+
WidgetList::RequestContext.session['DRILL_DOWN_FILTERS'].delete(@items['name'])
|
|
2246
2248
|
end
|
|
2247
2249
|
|
|
2248
|
-
if all &&
|
|
2249
|
-
|
|
2250
|
+
if all && WidgetList::RequestContext.session.key?('SEARCH_FILTER')
|
|
2251
|
+
WidgetList::RequestContext.session.delete('SEARCH_FILTER')
|
|
2250
2252
|
end
|
|
2251
2253
|
|
|
2252
|
-
if all &&
|
|
2253
|
-
|
|
2254
|
+
if all && WidgetList::RequestContext.session.key?('ROW_LIMIT')
|
|
2255
|
+
WidgetList::RequestContext.session.delete('ROW_LIMIT')
|
|
2254
2256
|
end
|
|
2255
2257
|
|
|
2256
|
-
if
|
|
2257
|
-
|
|
2258
|
+
if WidgetList::RequestContext.request.key?('LIST_FILTER_ALL')
|
|
2259
|
+
WidgetList::RequestContext.request.delete('LIST_FILTER_ALL')
|
|
2258
2260
|
end
|
|
2259
2261
|
|
|
2260
|
-
if
|
|
2261
|
-
|
|
2262
|
+
if WidgetList::RequestContext.request.key?('LIST_COL_SORT')
|
|
2263
|
+
WidgetList::RequestContext.request.delete('LIST_COL_SORT')
|
|
2262
2264
|
end
|
|
2263
2265
|
|
|
2264
|
-
if
|
|
2265
|
-
|
|
2266
|
+
if WidgetList::RequestContext.request.key?('LIST_COL_SORT_ORDER')
|
|
2267
|
+
WidgetList::RequestContext.request.delete('LIST_COL_SORT_ORDER')
|
|
2266
2268
|
end
|
|
2267
2269
|
|
|
2268
|
-
if
|
|
2269
|
-
|
|
2270
|
+
if WidgetList::RequestContext.request.key?('LIST_SEQUENCE')
|
|
2271
|
+
WidgetList::RequestContext.request.delete('LIST_SEQUENCE')
|
|
2270
2272
|
end
|
|
2271
2273
|
|
|
2272
2274
|
end
|
|
2273
2275
|
|
|
2274
2276
|
def clear_sql_session(all=false)
|
|
2275
2277
|
|
|
2276
|
-
if
|
|
2277
|
-
|
|
2278
|
+
if WidgetList::RequestContext.session.key?('LIST_SEQUENCE') && WidgetList::RequestContext.session['LIST_SEQUENCE'].key?(@sqlHash)
|
|
2279
|
+
WidgetList::RequestContext.session['LIST_SEQUENCE'].delete(@sqlHash)
|
|
2278
2280
|
end
|
|
2279
2281
|
|
|
2280
|
-
if
|
|
2281
|
-
|
|
2282
|
+
if WidgetList::RequestContext.session.key?('LIST_COL_SORT') && WidgetList::RequestContext.session['LIST_COL_SORT'].key?(@sqlHash)
|
|
2283
|
+
WidgetList::RequestContext.session['LIST_COL_SORT'].delete(@sqlHash)
|
|
2282
2284
|
end
|
|
2283
2285
|
|
|
2284
|
-
if all &&
|
|
2285
|
-
|
|
2286
|
+
if all && WidgetList::RequestContext.session.key?('LIST_COL_SORT')
|
|
2287
|
+
WidgetList::RequestContext.session.delete('LIST_COL_SORT')
|
|
2286
2288
|
end
|
|
2287
2289
|
|
|
2288
|
-
if all &&
|
|
2289
|
-
|
|
2290
|
+
if all && WidgetList::RequestContext.session.key?('LIST_SEQUENCE')
|
|
2291
|
+
WidgetList::RequestContext.session.delete('LIST_SEQUENCE')
|
|
2290
2292
|
end
|
|
2291
2293
|
|
|
2292
2294
|
end
|
|
@@ -2294,26 +2296,26 @@ module WidgetList
|
|
|
2294
2296
|
def self.get_filter_and_drilldown(listId)
|
|
2295
2297
|
filter = ''
|
|
2296
2298
|
drillDown = ''
|
|
2297
|
-
if
|
|
2299
|
+
if !WidgetList::RequestContext.request.key?('BUTTON_VALUE')
|
|
2298
2300
|
# Initialize page load/Session stuff whe list first loads
|
|
2299
2301
|
#
|
|
2300
2302
|
WidgetList::List::clear_check_box_session(listId)
|
|
2301
2303
|
end
|
|
2302
2304
|
|
|
2303
|
-
if
|
|
2304
|
-
drillDown =
|
|
2305
|
-
|
|
2306
|
-
elsif
|
|
2307
|
-
drillDown =
|
|
2305
|
+
if WidgetList::RequestContext.request.key?('drill_down') && !WidgetList::RequestContext.request.key?('searchClear')
|
|
2306
|
+
drillDown = WidgetList::RequestContext.request['drill_down']
|
|
2307
|
+
WidgetList::RequestContext.session.deep_merge!({'DRILL_DOWNS' => { listId => drillDown} })
|
|
2308
|
+
elsif WidgetList::RequestContext.session.key?('DRILL_DOWNS') && WidgetList::RequestContext.session['DRILL_DOWNS'].key?(listId) && !WidgetList::RequestContext.request.key?('searchClear')
|
|
2309
|
+
drillDown = WidgetList::RequestContext.session['DRILL_DOWNS'][listId]
|
|
2308
2310
|
else
|
|
2309
2311
|
drillDown = 'default'
|
|
2310
2312
|
end
|
|
2311
2313
|
|
|
2312
|
-
if
|
|
2313
|
-
filter =
|
|
2314
|
-
|
|
2315
|
-
elsif
|
|
2316
|
-
filter =
|
|
2314
|
+
if WidgetList::RequestContext.request.key?('filter') && !WidgetList::RequestContext.request.key?('searchClear')
|
|
2315
|
+
filter = WidgetList::RequestContext.request['filter']
|
|
2316
|
+
WidgetList::RequestContext.session.deep_merge!({'DRILL_DOWN_FILTERS' => { listId => filter} })
|
|
2317
|
+
elsif WidgetList::RequestContext.session.key?('DRILL_DOWN_FILTERS') && WidgetList::RequestContext.session['DRILL_DOWN_FILTERS'].key?(listId) && !WidgetList::RequestContext.request.key?('searchClear')
|
|
2318
|
+
filter = WidgetList::RequestContext.session['DRILL_DOWN_FILTERS'][listId]
|
|
2317
2319
|
end
|
|
2318
2320
|
return drillDown, filter
|
|
2319
2321
|
end
|
|
@@ -2321,11 +2323,11 @@ module WidgetList
|
|
|
2321
2323
|
def self.get_group_by_selection(list_parms)
|
|
2322
2324
|
groupBy = ''
|
|
2323
2325
|
|
|
2324
|
-
if
|
|
2325
|
-
groupBy =
|
|
2326
|
-
|
|
2327
|
-
elsif
|
|
2328
|
-
groupBy =
|
|
2326
|
+
if WidgetList::RequestContext.request.key?('switch_grouping')
|
|
2327
|
+
groupBy = WidgetList::RequestContext.request['switch_grouping']
|
|
2328
|
+
WidgetList::RequestContext.session.deep_merge!({'CURRENT_GROUPING' => { list_parms['name'] => groupBy} })
|
|
2329
|
+
elsif WidgetList::RequestContext.session.key?('CURRENT_GROUPING') && !WidgetList::RequestContext.session['CURRENT_GROUPING'].nil? && WidgetList::RequestContext.session['CURRENT_GROUPING'].key?(list_parms['name'])
|
|
2330
|
+
groupBy = WidgetList::RequestContext.session['CURRENT_GROUPING'][list_parms['name']]
|
|
2329
2331
|
list_parms['groupBySelected'] = groupBy
|
|
2330
2332
|
else
|
|
2331
2333
|
groupBy = ''
|
|
@@ -2335,12 +2337,12 @@ module WidgetList
|
|
|
2335
2337
|
end
|
|
2336
2338
|
|
|
2337
2339
|
def clear_sort_get_vars()
|
|
2338
|
-
|
|
2339
|
-
|
|
2340
|
-
|
|
2341
|
-
|
|
2342
|
-
|
|
2343
|
-
|
|
2340
|
+
WidgetList::RequestContext.request.delete('LIST_FILTER_ALL')
|
|
2341
|
+
WidgetList::RequestContext.request.delete('ROW_LIMIT')
|
|
2342
|
+
WidgetList::RequestContext.request.delete('LIST_SEQUENCE')
|
|
2343
|
+
WidgetList::RequestContext.request.delete('LIST_COL_SORT_ORDER')
|
|
2344
|
+
WidgetList::RequestContext.request.delete('LIST_COL_SORT')
|
|
2345
|
+
WidgetList::RequestContext.request.delete('LIST_FILTER_ALL')
|
|
2344
2346
|
end
|
|
2345
2347
|
|
|
2346
2348
|
def generate_limits()
|
|
@@ -2369,11 +2371,11 @@ module WidgetList
|
|
|
2369
2371
|
def render(results={})
|
|
2370
2372
|
|
|
2371
2373
|
if @isAdministrating
|
|
2372
|
-
if
|
|
2374
|
+
if WidgetList::RequestContext.request.key?('name')
|
|
2373
2375
|
return WidgetList::Administration.new.save_and_show_code()
|
|
2374
|
-
elsif
|
|
2375
|
-
return WidgetList::Administration.new.ajax_get_field_json(
|
|
2376
|
-
elsif
|
|
2376
|
+
elsif WidgetList::RequestContext.request.key?('ajax') && WidgetList::RequestContext.request.key?('model')
|
|
2377
|
+
return WidgetList::Administration.new.ajax_get_field_json(WidgetList::RequestContext.request['model'])
|
|
2378
|
+
elsif WidgetList::RequestContext.request.key?('ajax') && WidgetList::RequestContext.request.key?('save')
|
|
2377
2379
|
return WidgetList::Administration.new.save_and_show_code()
|
|
2378
2380
|
else
|
|
2379
2381
|
return WidgetList::Administration.new.show_interface()
|
|
@@ -2424,8 +2426,8 @@ module WidgetList
|
|
|
2424
2426
|
listJumpUrl['LIST_NAME'] = @items['name']
|
|
2425
2427
|
listJumpUrl['SQL_HASH'] = @sqlHash
|
|
2426
2428
|
|
|
2427
|
-
if
|
|
2428
|
-
listJumpUrl['switch_grouping'] =
|
|
2429
|
+
if WidgetList::RequestContext.request.key?('switch_grouping')
|
|
2430
|
+
listJumpUrl['switch_grouping'] = WidgetList::RequestContext.request['switch_grouping']
|
|
2429
2431
|
end
|
|
2430
2432
|
|
|
2431
2433
|
@templateFill['<!--CORNER_RADIUS-->'] = get_radius_value()
|
|
@@ -2444,7 +2446,7 @@ module WidgetList
|
|
|
2444
2446
|
@templateFill['<!--CUSTOM_CONTENT_TOP-->'] = @items['customHeader']
|
|
2445
2447
|
@templateFill['<!--WRAP_START-->'] = ''
|
|
2446
2448
|
@templateFill['<!--WRAP_END-->'] = ''
|
|
2447
|
-
if
|
|
2449
|
+
if !WidgetList::RequestContext.request.key?('BUTTON_VALUE')
|
|
2448
2450
|
@templateFill['<!--WRAP_START-->'] = '<div class="widget_list_outer">
|
|
2449
2451
|
<input type="hidden" id="<!--NAME-->_jump_url_original" value="<!--JUMP_URL-->"/>'
|
|
2450
2452
|
@templateFill['<!--WRAP_END-->'] = '</div>'
|
|
@@ -2475,7 +2477,7 @@ module WidgetList
|
|
|
2475
2477
|
|
|
2476
2478
|
@templateFill['<!--FILTER_HEADER-->'] = ''
|
|
2477
2479
|
|
|
2478
|
-
if
|
|
2480
|
+
if !WidgetList::RequestContext.request.key?('search_filter') && !@isJumpingList
|
|
2479
2481
|
|
|
2480
2482
|
#Search page url
|
|
2481
2483
|
#
|
|
@@ -2495,12 +2497,12 @@ module WidgetList
|
|
|
2495
2497
|
filterParameters['SQL_HASH'] = @sqlHash
|
|
2496
2498
|
|
|
2497
2499
|
@items['carryOverRequsts'].each { |value|
|
|
2498
|
-
if
|
|
2499
|
-
filterParameters[value] =
|
|
2500
|
+
if WidgetList::RequestContext.request.key?(value)
|
|
2501
|
+
filterParameters[value] = WidgetList::RequestContext.request[value]
|
|
2500
2502
|
end
|
|
2501
2503
|
}
|
|
2502
2504
|
|
|
2503
|
-
searchUrl = WidgetList::Utils::build_url(@items['pageId'], filterParameters, (
|
|
2505
|
+
searchUrl = WidgetList::Utils::build_url(@items['pageId'], filterParameters, (!WidgetList::RequestContext.request.key?('BUTTON_VALUE')))
|
|
2504
2506
|
|
|
2505
2507
|
list_search = {}
|
|
2506
2508
|
#
|
|
@@ -2509,8 +2511,8 @@ module WidgetList
|
|
|
2509
2511
|
list_search['value'] = ''
|
|
2510
2512
|
|
|
2511
2513
|
if @items['searchSession']
|
|
2512
|
-
if
|
|
2513
|
-
list_search['value'] =
|
|
2514
|
+
if WidgetList::RequestContext.session.key?('SEARCH_FILTER') && !WidgetList::RequestContext.session['SEARCH_FILTER'].nil? && WidgetList::RequestContext.session['SEARCH_FILTER'].key?(@items['name'])
|
|
2515
|
+
list_search['value'] = WidgetList::RequestContext.session['SEARCH_FILTER'][@items['name']]
|
|
2514
2516
|
end
|
|
2515
2517
|
end
|
|
2516
2518
|
|
|
@@ -2551,8 +2553,8 @@ module WidgetList
|
|
|
2551
2553
|
list_group['readonly'] = true
|
|
2552
2554
|
if @items['groupBySelected']
|
|
2553
2555
|
list_group['value'] = @items['groupBySelected']
|
|
2554
|
-
elsif
|
|
2555
|
-
tmp =
|
|
2556
|
+
elsif WidgetList::RequestContext.request.key?('group_row_id')
|
|
2557
|
+
tmp = WidgetList::RequestContext.request['group_row_id'].gsub(@items['name'] + '_row_','')
|
|
2556
2558
|
if Float(tmp.to_i) != nil
|
|
2557
2559
|
list_group['value'] = @items['groupByItems'][tmp.to_i - 1]
|
|
2558
2560
|
end
|
|
@@ -2609,7 +2611,7 @@ module WidgetList
|
|
|
2609
2611
|
end
|
|
2610
2612
|
|
|
2611
2613
|
@templateFill['<!--NAME-->'] = @items['name']
|
|
2612
|
-
@templateFill['<!--JUMP_URL-->'] = WidgetList::Utils::build_url(@items['pageId'],listJumpUrl,(
|
|
2614
|
+
@templateFill['<!--JUMP_URL-->'] = WidgetList::Utils::build_url(@items['pageId'],listJumpUrl,(!WidgetList::RequestContext.request.key?('BUTTON_VALUE')))
|
|
2613
2615
|
@templateFill['--JUMP_URL--'] = @templateFill['<!--JUMP_URL-->']
|
|
2614
2616
|
@templateFill['<!--JUMP_URL_NAME-->'] = @items['name'] + '_jump_url'
|
|
2615
2617
|
|
|
@@ -2622,7 +2624,7 @@ module WidgetList
|
|
|
2622
2624
|
end
|
|
2623
2625
|
end
|
|
2624
2626
|
|
|
2625
|
-
if
|
|
2627
|
+
if WidgetList::RequestContext.request.key?('export_widget_list')
|
|
2626
2628
|
csv = ''
|
|
2627
2629
|
@csv.each{ |v|
|
|
2628
2630
|
csv += v.to_csv
|
|
@@ -2674,8 +2676,8 @@ module WidgetList
|
|
|
2674
2676
|
templates['btn_previous'] = @items['template_pagination_previous_disabled']
|
|
2675
2677
|
templates['btn_next'] = @items['template_pagination_next_active']
|
|
2676
2678
|
|
|
2677
|
-
if
|
|
2678
|
-
urlTags['search_filter'] =
|
|
2679
|
+
if WidgetList::RequestContext.request.key?('search_filter') && ! WidgetList::RequestContext.request['search_filter'].empty?
|
|
2680
|
+
urlTags['search_filter'] = WidgetList::RequestContext.request['search_filter']
|
|
2679
2681
|
end
|
|
2680
2682
|
|
|
2681
2683
|
if @items['LIST_COL_SORT'].empty?
|
|
@@ -2691,21 +2693,21 @@ module WidgetList
|
|
|
2691
2693
|
end
|
|
2692
2694
|
|
|
2693
2695
|
@items['carryOverRequsts'].each { |value|
|
|
2694
|
-
if
|
|
2695
|
-
urlTags[value] =
|
|
2696
|
+
if WidgetList::RequestContext.request.key?(value)
|
|
2697
|
+
urlTags[value] = WidgetList::RequestContext.request[value]
|
|
2696
2698
|
end
|
|
2697
2699
|
}
|
|
2698
2700
|
if (@sequence == @totalPages || ! (@totalPages > 0))
|
|
2699
2701
|
showNext = false
|
|
2700
2702
|
else
|
|
2701
2703
|
urlTags['LIST_SEQUENCE'] = @sequence + 1
|
|
2702
|
-
nextUrl = WidgetList::Utils::build_url(@items['pageId'],urlTags,(
|
|
2704
|
+
nextUrl = WidgetList::Utils::build_url(@items['pageId'],urlTags,(!WidgetList::RequestContext.request.key?('BUTTON_VALUE')))
|
|
2703
2705
|
end
|
|
2704
2706
|
|
|
2705
2707
|
if @sequence > 1
|
|
2706
2708
|
pagePrev = @sequence - 1
|
|
2707
2709
|
urlTags['LIST_SEQUENCE'] = pagePrev
|
|
2708
|
-
prevUrl = WidgetList::Utils::build_url(@items['pageId'],urlTags,(
|
|
2710
|
+
prevUrl = WidgetList::Utils::build_url(@items['pageId'],urlTags,(!WidgetList::RequestContext.request.key?('BUTTON_VALUE')))
|
|
2709
2711
|
showPrev = true
|
|
2710
2712
|
end
|
|
2711
2713
|
|
|
@@ -2739,8 +2741,8 @@ module WidgetList
|
|
|
2739
2741
|
urlTags['ROW_LIMIT'] = 10
|
|
2740
2742
|
|
|
2741
2743
|
@items['carryOverRequsts'].each { |value|
|
|
2742
|
-
if
|
|
2743
|
-
urlTags[value] =
|
|
2744
|
+
if WidgetList::RequestContext.request.key?(value)
|
|
2745
|
+
urlTags[value] = WidgetList::RequestContext.request[value]
|
|
2744
2746
|
end
|
|
2745
2747
|
}
|
|
2746
2748
|
|
|
@@ -2758,7 +2760,7 @@ module WidgetList
|
|
|
2758
2760
|
if (@totalRows >= jumpCount || @totalRows > rowLimitSelect[key-1])
|
|
2759
2761
|
urlTags['ROW_LIMIT'] = jumpCount
|
|
2760
2762
|
|
|
2761
|
-
rowLimitUrl = WidgetList::Utils::build_url(@items['pageId'],urlTags,(
|
|
2763
|
+
rowLimitUrl = WidgetList::Utils::build_url(@items['pageId'],urlTags,(!WidgetList::RequestContext.request.key?('BUTTON_VALUE')))
|
|
2762
2764
|
selected = ''
|
|
2763
2765
|
if (@items['rowLimit'] == jumpCount)
|
|
2764
2766
|
selected = 'selected'
|
|
@@ -2818,7 +2820,7 @@ module WidgetList
|
|
|
2818
2820
|
urlTags['SQL_HASH'] = @sqlHash
|
|
2819
2821
|
jumpTemplate = ''
|
|
2820
2822
|
jumpUrl = ''
|
|
2821
|
-
jumpUrl = WidgetList::Utils::build_url(@items['pageId'], urlTags, (
|
|
2823
|
+
jumpUrl = WidgetList::Utils::build_url(@items['pageId'], urlTags, (!WidgetList::RequestContext.request.key?('BUTTON_VALUE')))
|
|
2822
2824
|
|
|
2823
2825
|
if page == @sequence
|
|
2824
2826
|
jumpTemplate = @items['template_pagination_jump_active']
|
|
@@ -2867,8 +2869,8 @@ module WidgetList
|
|
|
2867
2869
|
|
|
2868
2870
|
if list_parms.key?('carryOverRequsts')
|
|
2869
2871
|
list_parms['carryOverRequsts'].each { |value|
|
|
2870
|
-
if
|
|
2871
|
-
filterParameters[value] =
|
|
2872
|
+
if WidgetList::RequestContext.request.key?(value)
|
|
2873
|
+
filterParameters[value] = WidgetList::RequestContext.request[value]
|
|
2872
2874
|
end
|
|
2873
2875
|
}
|
|
2874
2876
|
extra_get_vars = WidgetList::Utils::build_query_string(filterParameters)
|
|
@@ -2909,7 +2911,7 @@ module WidgetList
|
|
|
2909
2911
|
|
|
2910
2912
|
colWidthStyle += @items['borderHeadFoot'] ? 'border-bottom:' + @items['headFootBorderStyle'] + ';' : ''
|
|
2911
2913
|
|
|
2912
|
-
|
|
2914
|
+
WidgetList::RequestContext.session.deep_merge!({'LIST_SEQUENCE' => { @sqlHash => @sequence} })
|
|
2913
2915
|
|
|
2914
2916
|
#Hover Title
|
|
2915
2917
|
#
|
|
@@ -2954,7 +2956,7 @@ module WidgetList
|
|
|
2954
2956
|
|
|
2955
2957
|
else
|
|
2956
2958
|
|
|
2957
|
-
if
|
|
2959
|
+
if WidgetList::RequestContext.request.key?('export_widget_list') && !skip_column(field)
|
|
2958
2960
|
@csv[0] << fieldTitle
|
|
2959
2961
|
end
|
|
2960
2962
|
|
|
@@ -2994,15 +2996,15 @@ module WidgetList
|
|
|
2994
2996
|
|
|
2995
2997
|
if (
|
|
2996
2998
|
( (@items.key?('LIST_COL_SORT') && !@items['LIST_COL_SORT'].empty?) && @items['LIST_COL_SORT'] == colSort['LIST_COL_SORT']) ||
|
|
2997
|
-
(
|
|
2999
|
+
( WidgetList::RequestContext.session.key?('LIST_COL_SORT') && !WidgetList::RequestContext.session['LIST_COL_SORT'].nil? && WidgetList::RequestContext.session['LIST_COL_SORT'].key?(@sqlHash) && WidgetList::RequestContext.session['LIST_COL_SORT'][@sqlHash].key?(field))
|
|
2998
3000
|
)
|
|
2999
3001
|
changedSession = false
|
|
3000
3002
|
if @items.key?('LIST_COL_SORT') && !@items['LIST_COL_SORT'].empty?
|
|
3001
|
-
changedSession = (
|
|
3002
|
-
if
|
|
3003
|
-
|
|
3003
|
+
changedSession = ( WidgetList::RequestContext.session.key?('LIST_COL_SORT') && WidgetList::RequestContext.session['LIST_COL_SORT'].key?(@sqlHash) && ! WidgetList::RequestContext.session['LIST_COL_SORT'][@sqlHash].key?(@items['LIST_COL_SORT']) )
|
|
3004
|
+
if WidgetList::RequestContext.session.key?('LIST_COL_SORT') && WidgetList::RequestContext.session['LIST_COL_SORT'].key?(@sqlHash)
|
|
3005
|
+
WidgetList::RequestContext.session['LIST_COL_SORT'].delete(@sqlHash)
|
|
3004
3006
|
end
|
|
3005
|
-
|
|
3007
|
+
WidgetList::RequestContext.session.deep_merge!({'LIST_COL_SORT' => { @sqlHash => {@items['LIST_COL_SORT']=> @items['LIST_COL_SORT_ORDER'] } } })
|
|
3006
3008
|
end
|
|
3007
3009
|
|
|
3008
3010
|
if !changedSession && @items.key?('LIST_COL_SORT') && ! @items['LIST_COL_SORT'].empty?
|
|
@@ -3011,9 +3013,9 @@ module WidgetList
|
|
|
3011
3013
|
else
|
|
3012
3014
|
icon = "↓"
|
|
3013
3015
|
end
|
|
3014
|
-
elsif !changedSession &&
|
|
3016
|
+
elsif !changedSession && WidgetList::RequestContext.session['LIST_COL_SORT'].class.name == 'Hash' && WidgetList::RequestContext.session['LIST_COL_SORT'].key?(@sqlHash)
|
|
3015
3017
|
#load sort from session
|
|
3016
|
-
|
|
3018
|
+
WidgetList::RequestContext.session['LIST_COL_SORT'][@sqlHash].each_with_index { |order,void|
|
|
3017
3019
|
if order[1] == 'DESC'
|
|
3018
3020
|
colSort['LIST_COL_SORT_ORDER'] = "ASC"
|
|
3019
3021
|
icon = "↑"
|
|
@@ -3027,21 +3029,21 @@ module WidgetList
|
|
|
3027
3029
|
|
|
3028
3030
|
#Carry over any search criteria on a sort to SORT URL
|
|
3029
3031
|
#
|
|
3030
|
-
if
|
|
3031
|
-
if
|
|
3032
|
-
colSort['search_filter'] =
|
|
3032
|
+
if WidgetList::RequestContext.request.key?('search_filter') && ! WidgetList::RequestContext.request['search_filter'].empty?
|
|
3033
|
+
if WidgetList::RequestContext.request['search_filter'].empty?
|
|
3034
|
+
colSort['search_filter'] = WidgetList::RequestContext.request['search_filter']
|
|
3033
3035
|
end
|
|
3034
3036
|
end
|
|
3035
3037
|
|
|
3036
3038
|
@items['carryOverRequsts'].each { |value|
|
|
3037
|
-
if
|
|
3038
|
-
colSort[value] =
|
|
3039
|
+
if WidgetList::RequestContext.request.key?(value)
|
|
3040
|
+
colSort[value] = WidgetList::RequestContext.request[value]
|
|
3039
3041
|
end
|
|
3040
3042
|
}
|
|
3041
3043
|
|
|
3042
3044
|
colSort['SQL_HASH'] = @sqlHash
|
|
3043
3045
|
|
|
3044
|
-
pieces = { '<!--COLSORTURL-->' => WidgetList::Utils::build_url(@items['pageId'],colSort,(
|
|
3046
|
+
pieces = { '<!--COLSORTURL-->' => WidgetList::Utils::build_url(@items['pageId'],colSort,(!WidgetList::RequestContext.request.key?('BUTTON_VALUE'))),
|
|
3045
3047
|
'<!--NAME-->' => @items['name'],
|
|
3046
3048
|
'<!--COLSORTICON->' => icon,
|
|
3047
3049
|
'<!--COL_HEADER_ID-->' => strip_tags(field).gsub(/\s/,'_'),
|
|
@@ -3139,7 +3141,7 @@ module WidgetList
|
|
|
3139
3141
|
|
|
3140
3142
|
if input['check_all']
|
|
3141
3143
|
checkAllId = input['id']
|
|
3142
|
-
if
|
|
3144
|
+
if WidgetList::RequestContext.session.key?('list_checks') && !WidgetList::RequestContext.session['list_checks'].nil? && WidgetList::RequestContext.session['list_checks'].key?('check_all_' + @sqlHash.to_s + @items['name'].to_s + @sequence.to_s)
|
|
3143
3145
|
input['checked'] = true
|
|
3144
3146
|
end
|
|
3145
3147
|
|
|
@@ -3147,7 +3149,7 @@ module WidgetList
|
|
|
3147
3149
|
# Set header class
|
|
3148
3150
|
#
|
|
3149
3151
|
if @items['headerClass'].class.name == 'Array' && @items['headerClass'].key?('checkbox')
|
|
3150
|
-
if
|
|
3152
|
+
if WidgetList::RequestContext.session['list_checks'].key?('check_all_' + @sqlHash.to_s + @items['name'].to_s + @sequence.to_s)
|
|
3151
3153
|
input['checked'] = true
|
|
3152
3154
|
end
|
|
3153
3155
|
end
|
|
@@ -3170,7 +3172,7 @@ module WidgetList
|
|
|
3170
3172
|
listJumpUrl['SQL_HASH'] = @sqlHash
|
|
3171
3173
|
listJumpUrl['list_action'] = 'ajax_widgetlist_checks'
|
|
3172
3174
|
|
|
3173
|
-
onClick << "AjaxMaintainChecks(this, '#{input['class_handle']}', '#{@items['name']}', '" + WidgetList::Utils::build_url(@items['pageId'],listJumpUrl,(
|
|
3175
|
+
onClick << "AjaxMaintainChecks(this, '#{input['class_handle']}', '#{@items['name']}', '" + WidgetList::Utils::build_url(@items['pageId'],listJumpUrl,(!WidgetList::RequestContext.request.key?('BUTTON_VALUE'))) + "', '#{checkAllId}');"
|
|
3174
3176
|
end
|
|
3175
3177
|
|
|
3176
3178
|
input['onclick'] = onClick.join(' ')
|
|
@@ -3187,7 +3189,7 @@ module WidgetList
|
|
|
3187
3189
|
#
|
|
3188
3190
|
# Checkbox is checked or not per session (overwrites query)
|
|
3189
3191
|
#
|
|
3190
|
-
if
|
|
3192
|
+
if WidgetList::RequestContext.session.key?('list_checks') && !WidgetList::RequestContext.session['list_checks'].nil? && WidgetList::RequestContext.session['list_checks'].key?(@items['name'] + @sqlHash + input['value'].to_s)
|
|
3191
3193
|
input['checked'] = true
|
|
3192
3194
|
end
|
|
3193
3195
|
|
|
@@ -3219,13 +3221,13 @@ module WidgetList
|
|
|
3219
3221
|
#
|
|
3220
3222
|
# If AJAX, send back JSON
|
|
3221
3223
|
#
|
|
3222
|
-
if
|
|
3224
|
+
if WidgetList::RequestContext.request.key?('BUTTON_VALUE') && WidgetList::RequestContext.request['LIST_NAME'] == list_parms['name']
|
|
3223
3225
|
|
|
3224
|
-
if
|
|
3226
|
+
if WidgetList::RequestContext.request.key?('export_widget_list')
|
|
3225
3227
|
return ['export',list.render()]
|
|
3226
3228
|
end
|
|
3227
3229
|
|
|
3228
|
-
if
|
|
3230
|
+
if WidgetList::RequestContext.request['list_action'] != 'ajax_widgetlist_checks'
|
|
3229
3231
|
ret['list'] = list.render()
|
|
3230
3232
|
ret['search_bar'] = list.get_header_pieces['searchBar']
|
|
3231
3233
|
ret['group_by_items'] = list.get_header_pieces['groupByItems']
|
|
@@ -3390,7 +3392,7 @@ module WidgetList
|
|
|
3390
3392
|
def self.build_drill_down(*params)
|
|
3391
3393
|
required_params = {
|
|
3392
3394
|
:list_id => true, # -- your widget_list name (used for JS)
|
|
3393
|
-
:drill_down_name => true, # -- an identifier that is pass for the "column" or "type of drill down" which is passed as
|
|
3395
|
+
:drill_down_name => true, # -- an identifier that is pass for the "column" or "type of drill down" which is passed as WidgetList::RequestContext.request['drill_down'] when the user clicks and returned from get_filter_and_drilldown based on session or request
|
|
3394
3396
|
: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
|
|
3395
3397
|
:column_to_show => true, # -- The visible column or SQL functions to display to user for the link
|
|
3396
3398
|
}
|
|
@@ -3426,7 +3428,7 @@ module WidgetList
|
|
|
3426
3428
|
end
|
|
3427
3429
|
end
|
|
3428
3430
|
|
|
3429
|
-
if
|
|
3431
|
+
if WidgetList::RequestContext.request.key?('export_widget_list')
|
|
3430
3432
|
link = "#{items[:column_to_show]} #{WidgetList::List::is_sequel(items[:primary_database]) ? " as #{items[:column_alias]} " : ""}"
|
|
3431
3433
|
end
|
|
3432
3434
|
|
|
@@ -3620,7 +3622,7 @@ module WidgetList
|
|
|
3620
3622
|
return "#{function}('#{linkUrl}')"
|
|
3621
3623
|
else
|
|
3622
3624
|
url['SQL_HASH'] = @sqlHash
|
|
3623
|
-
linkUrl = WidgetList::Utils::build_url(@items['pageId'], url, (
|
|
3625
|
+
linkUrl = WidgetList::Utils::build_url(@items['pageId'], url, (!WidgetList::RequestContext.request.key?('BUTTON_VALUE')))
|
|
3624
3626
|
if !parameters.empty?
|
|
3625
3627
|
return "#{function}(#{parameters.join(',')})"
|
|
3626
3628
|
else
|
|
@@ -3839,7 +3841,7 @@ module WidgetList
|
|
|
3839
3841
|
}
|
|
3840
3842
|
|
|
3841
3843
|
|
|
3842
|
-
if
|
|
3844
|
+
if WidgetList::RequestContext.request.key?('export_widget_list')
|
|
3843
3845
|
@csv << row_values
|
|
3844
3846
|
end
|
|
3845
3847
|
|
|
@@ -4053,7 +4055,7 @@ module WidgetList
|
|
|
4053
4055
|
}
|
|
4054
4056
|
|
|
4055
4057
|
|
|
4056
|
-
if
|
|
4058
|
+
if WidgetList::RequestContext.request.key?('export_widget_list')
|
|
4057
4059
|
@csv << row_values
|
|
4058
4060
|
end
|
|
4059
4061
|
|
|
@@ -4186,8 +4188,8 @@ module WidgetList
|
|
|
4186
4188
|
clear_sql_session(@items.key?('searchClearAll'))
|
|
4187
4189
|
end
|
|
4188
4190
|
|
|
4189
|
-
if
|
|
4190
|
-
@sequence =
|
|
4191
|
+
if !WidgetList::RequestContext.request.key?('BUTTON_VALUE') && !WidgetList::RequestContext.session['LIST_SEQUENCE'].nil? && WidgetList::RequestContext.session.key?('LIST_SEQUENCE') && WidgetList::RequestContext.session['LIST_SEQUENCE'].key?(@sqlHash) && WidgetList::RequestContext.session['LIST_SEQUENCE'][@sqlHash] > 0
|
|
4192
|
+
@sequence = WidgetList::RequestContext.session['LIST_SEQUENCE'][@sqlHash]
|
|
4191
4193
|
generate_limits
|
|
4192
4194
|
end
|
|
4193
4195
|
|
|
@@ -4201,7 +4203,7 @@ module WidgetList
|
|
|
4201
4203
|
pieces['<!--GROUPBY-->'] = ''
|
|
4202
4204
|
end
|
|
4203
4205
|
|
|
4204
|
-
if !@items['LIST_COL_SORT'].empty? || (
|
|
4206
|
+
if !@items['LIST_COL_SORT'].empty? || (WidgetList::RequestContext.session.key?('LIST_COL_SORT') && WidgetList::RequestContext.session['LIST_COL_SORT'].class.name == 'Hash' && WidgetList::RequestContext.session['LIST_COL_SORT'].key?(@sqlHash))
|
|
4205
4207
|
pieces['<!--ORDERBY-->'] += ' ORDER BY '
|
|
4206
4208
|
foundColumn = false
|
|
4207
4209
|
if ! @items['LIST_COL_SORT'].empty?
|
|
@@ -4209,13 +4211,13 @@ module WidgetList
|
|
|
4209
4211
|
@mongo_sort[(( @items['LIST_COL_SORT'] != 'cnt') ? '_id.' : '') + @items['LIST_COL_SORT']] = (@items['LIST_COL_SORT_ORDER'] == 'ASC') ? 1 : -1 if $is_mongo
|
|
4210
4212
|
pieces['<!--ORDERBY-->'] += tick_field() + strip_aliases(@items['LIST_COL_SORT']) + tick_field() + " " + @items['LIST_COL_SORT_ORDER']
|
|
4211
4213
|
else
|
|
4212
|
-
|
|
4214
|
+
WidgetList::RequestContext.session['LIST_COL_SORT'][@sqlHash].each_with_index { |order,void|
|
|
4213
4215
|
if @items['fields'].key?(order[0])
|
|
4214
4216
|
foundColumn = true
|
|
4215
4217
|
@mongo_sort[((order[0] != 'cnt') ? '_id.' : '') + order[0]] = (order[1] == 'ASC') ? 1 : -1 if $is_mongo
|
|
4216
4218
|
pieces['<!--ORDERBY-->'] += tick_field() + strip_aliases(order[0]) + tick_field() + " " + order[1]
|
|
4217
4219
|
end
|
|
4218
|
-
} if
|
|
4220
|
+
} if WidgetList::RequestContext.session.key?('LIST_COL_SORT') && WidgetList::RequestContext.session['LIST_COL_SORT'].class.name == 'Hash' && WidgetList::RequestContext.session['LIST_COL_SORT'].key?(@sqlHash)
|
|
4219
4221
|
end
|
|
4220
4222
|
|
|
4221
4223
|
# Add base order by
|
|
@@ -4468,17 +4470,20 @@ module WidgetList
|
|
|
4468
4470
|
return 'mongo'
|
|
4469
4471
|
else
|
|
4470
4472
|
if $widget_list_db_conf.key?(db_type)
|
|
4471
|
-
|
|
4473
|
+
database_config = $widget_list_db_conf[db_type]
|
|
4474
|
+
database_config = database_config['primary'] if database_config.key?('primary')
|
|
4475
|
+
adapter = database_config.fetch('adapter', '').to_s
|
|
4476
|
+
if adapter.include?('mysql')
|
|
4472
4477
|
return 'mysql'
|
|
4473
|
-
elsif
|
|
4478
|
+
elsif adapter.include?('postgres')
|
|
4474
4479
|
return 'postgres'
|
|
4475
|
-
elsif
|
|
4480
|
+
elsif adapter.include?('oracle')
|
|
4476
4481
|
return 'oracle'
|
|
4477
|
-
elsif
|
|
4482
|
+
elsif adapter.include?('sqlite')
|
|
4478
4483
|
return 'sqlite'
|
|
4479
|
-
elsif
|
|
4484
|
+
elsif adapter.include?('sqlserver')
|
|
4480
4485
|
return 'sqlserver'
|
|
4481
|
-
elsif
|
|
4486
|
+
elsif adapter.include?('ibm')
|
|
4482
4487
|
return 'db2'
|
|
4483
4488
|
end
|
|
4484
4489
|
end
|
|
@@ -4492,7 +4497,13 @@ module WidgetList
|
|
|
4492
4497
|
|
|
4493
4498
|
def self.load_widget_list_yml
|
|
4494
4499
|
if $widget_list_conf.nil?
|
|
4495
|
-
|
|
4500
|
+
config_file = Rails.root.join('config', 'widget-list.yml')
|
|
4501
|
+
$widget_list_conf = if config_file.file?
|
|
4502
|
+
YAML.safe_load(ERB.new(File.read(config_file)).result,
|
|
4503
|
+
permitted_classes: [Symbol], aliases: true).fetch(Rails.env).transform_keys(&:to_sym)
|
|
4504
|
+
else
|
|
4505
|
+
{ primary: Rails.env, secondary: false, api_mode: false }
|
|
4506
|
+
end
|
|
4496
4507
|
if Rails.root.join("app/helpers", "widget_list_helper.rb").file?
|
|
4497
4508
|
require Rails.root.join("app/helpers", "widget_list_helper.rb")
|
|
4498
4509
|
end
|
|
@@ -4503,10 +4514,11 @@ module WidgetList
|
|
|
4503
4514
|
if $widget_list_db_conf.nil?
|
|
4504
4515
|
if Rails.root.join("config", "mongoid.yml").file?
|
|
4505
4516
|
$is_mongo = true
|
|
4506
|
-
$widget_list_db_conf = YAML.
|
|
4517
|
+
$widget_list_db_conf = YAML.safe_load(ERB.new(File.read(Rails.root.join("config", "mongoid.yml"))).result,
|
|
4518
|
+
aliases: true)
|
|
4507
4519
|
else
|
|
4508
4520
|
$is_mongo = false
|
|
4509
|
-
$widget_list_db_conf =
|
|
4521
|
+
$widget_list_db_conf = Rails.application.config.database_configuration
|
|
4510
4522
|
end
|
|
4511
4523
|
end
|
|
4512
4524
|
end
|
|
@@ -4533,8 +4545,8 @@ module WidgetList
|
|
|
4533
4545
|
end
|
|
4534
4546
|
if (@is_primary_sequel && @items['database'] == 'primary') || (@is_secondary_sequel && @items['database'] == 'secondary')
|
|
4535
4547
|
return @items['view']
|
|
4536
|
-
elsif $is_mongo ||
|
|
4537
|
-
@active_record_model = @items['view'].
|
|
4548
|
+
elsif $is_mongo || @items['view'].respond_to?(:to_sql)
|
|
4549
|
+
@active_record_model = @items['view'].klass if initializing && @items['view'].respond_to?(:klass)
|
|
4538
4550
|
new_columns = []
|
|
4539
4551
|
|
|
4540
4552
|
@items['fields'].each { |column, fieldTitle|
|
|
@@ -4570,7 +4582,7 @@ module WidgetList
|
|
|
4570
4582
|
if $is_mongo
|
|
4571
4583
|
return ''
|
|
4572
4584
|
else
|
|
4573
|
-
view = @items['view'].
|
|
4585
|
+
view = @items['view'].to_sql
|
|
4574
4586
|
sql_from = view[view.index(/FROM/),view.length]
|
|
4575
4587
|
view = "SELECT #{new_columns.join(',')} " + sql_from
|
|
4576
4588
|
where = ''
|
|
@@ -4589,16 +4601,9 @@ module WidgetList
|
|
|
4589
4601
|
|
|
4590
4602
|
@has_connected = true
|
|
4591
4603
|
begin
|
|
4592
|
-
|
|
4593
|
-
|
|
4594
|
-
|
|
4595
|
-
throw 'Configuration file widget-list.yml has no data. Check that (' + Rails.env + ') Rails.env matches the pointers in the file'
|
|
4596
|
-
end
|
|
4597
|
-
@primary_conn = $widget_list_conf[:primary]
|
|
4598
|
-
@secondary_conn = $widget_list_conf[:secondary]
|
|
4599
|
-
else
|
|
4600
|
-
throw 'widget-list.yml not found'
|
|
4601
|
-
end
|
|
4604
|
+
WidgetList::List.load_widget_list_yml
|
|
4605
|
+
@primary_conn = $widget_list_conf[:primary]
|
|
4606
|
+
@secondary_conn = $widget_list_conf[:secondary]
|
|
4602
4607
|
|
|
4603
4608
|
@is_primary_sequel = true
|
|
4604
4609
|
@is_secondary_sequel = true
|
|
@@ -4644,11 +4649,7 @@ module WidgetList
|
|
|
4644
4649
|
else
|
|
4645
4650
|
database_conn = $widget_list_conf[:secondary]
|
|
4646
4651
|
end
|
|
4647
|
-
|
|
4648
|
-
if database_conn != false && ! database_conn.include?('://')
|
|
4649
|
-
is_sequel = false
|
|
4650
|
-
end
|
|
4651
|
-
return is_sequel
|
|
4652
|
+
database_conn.is_a?(String) && database_conn.include?('://')
|
|
4652
4653
|
end
|
|
4653
4654
|
|
|
4654
4655
|
def self.get_sequel(primary=true)
|
|
@@ -4687,4 +4688,4 @@ module WidgetList
|
|
|
4687
4688
|
|
|
4688
4689
|
end
|
|
4689
4690
|
|
|
4690
|
-
end
|
|
4691
|
+
end
|