widget_list 1.0.11 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
data/lib/widget_list/tpl.rb
CHANGED
@@ -146,7 +146,7 @@ $G_TEMPLATE.deep_merge!({'widget' =>
|
|
146
146
|
{'default' =>
|
147
147
|
'
|
148
148
|
<!--FRM_SUBMIT-->
|
149
|
-
<a class="<!--BUTTON_CLASS-->" style="<!--BUTTON_STYLE-->" onclick="<!--BUTTON_ONCLICK-->" name="<!--NAME-->" id="<!--ID-->">
|
149
|
+
<a class="<!--BUTTON_CLASS-->" style="<!--BUTTON_STYLE-->" onclick="<!--BUTTON_ONCLICK-->" onmouseover="<!--MOUSEOVER-->" onmouseout="<!--MOUSEOUT-->" name="<!--NAME-->" id="<!--ID-->">
|
150
150
|
<!--BUTTON_LABEL-->
|
151
151
|
</a>'
|
152
152
|
}
|
data/lib/widget_list/version.rb
CHANGED
data/lib/widget_list/widgets.rb
CHANGED
@@ -629,6 +629,8 @@ module WidgetList
|
|
629
629
|
'passive' => false,
|
630
630
|
'function' => 'ButtonLinkPost',
|
631
631
|
'onclick' => '',
|
632
|
+
'onmouseover'=> '',
|
633
|
+
'onmouseout' => '',
|
632
634
|
'template' => ''
|
633
635
|
}
|
634
636
|
|
@@ -691,6 +693,8 @@ module WidgetList
|
|
691
693
|
'<!--ID-->' => items['id'],
|
692
694
|
'<!--BUTTON_STYLE-->' => items['style'],
|
693
695
|
'<!--BUTTON_CLASS_INNER-->' => items['innerClass'],
|
696
|
+
'<!--MOUSEOVER-->' => items['onmouseover'],
|
697
|
+
'<!--MOUSEOUT-->' => items['onmouseout'],
|
694
698
|
'<!--FRM_SUBMIT-->' => items['frmSubmit'],
|
695
699
|
},
|
696
700
|
items['template']
|
data/lib/widget_list.rb
CHANGED
@@ -46,6 +46,7 @@ module WidgetList
|
|
46
46
|
@fieldList = []
|
47
47
|
@templateFill = {}
|
48
48
|
@results = {}
|
49
|
+
@headerPieces = {}
|
49
50
|
|
50
51
|
#the main template and outer shell
|
51
52
|
@items.deep_merge!({'template' =>
|
@@ -54,13 +55,13 @@ module WidgetList
|
|
54
55
|
<!--HEADER-->
|
55
56
|
<!--CUSTOM_CONTENT_TOP-->
|
56
57
|
<div class="<!--CLASS-->" id="<!--NAME-->">
|
57
|
-
<table class="widget_list <!--TABLE_CLASS-->" style="<!--INLINE_STYLE
|
58
|
+
<table class="widget_list <!--TABLE_CLASS-->" style="<!--INLINE_STYLE-->;border:<!--TABLE_BORDER-->;" width="100%" cellpadding="0" cellspacing="0">
|
58
59
|
<!--LIST_TITLE-->
|
59
|
-
<tr class="widget_list_header"><!--HEADERS--></tr>
|
60
|
+
<tr class="widget_list_header" style="background-color:<!--HEADER_COLOR-->;color:<!--HEADER_TXT_COLOR-->;"><!--HEADERS--></tr>
|
60
61
|
<!--DATA-->
|
61
62
|
<tr>
|
62
63
|
<td colspan="<!--COLSPAN_FULL-->" align="left" style="padding:0px;margin:0px;text-align:left">
|
63
|
-
<div style="background-color
|
64
|
+
<div style="background-color:<!--FOOTER_COLOR-->;hieght:50px;color:<!--FOOTER_TXT_COLOR-->;"><div style="padding:10px"><!--CUSTOM_CONTENT_BOTTOM--></div>
|
64
65
|
</td>
|
65
66
|
</tr>
|
66
67
|
</table>
|
@@ -182,6 +183,13 @@ module WidgetList
|
|
182
183
|
'
|
183
184
|
})
|
184
185
|
|
186
|
+
|
187
|
+
#inject site wide configs before list specific configs if a helper exists
|
188
|
+
|
189
|
+
if defined?(WidgetListHelper) == 'constant' && WidgetListHelper::SiteDefaults.class == Class && WidgetListHelper::SiteDefaults.respond_to?('get_site_widget_list_defaults')
|
190
|
+
@items = WidgetList::Widgets::populate_items(WidgetListHelper::SiteDefaults::get_site_widget_list_defaults() ,@items)
|
191
|
+
end
|
192
|
+
|
185
193
|
@items = WidgetList::Widgets::populate_items(list,@items)
|
186
194
|
|
187
195
|
# current_db is a flag of the last known primary or secondary YML used or defaulted when running a list
|
@@ -300,7 +308,7 @@ module WidgetList
|
|
300
308
|
fieldsToSearch[columnPivot[0]] = strip_aliases(columnPivot[0])
|
301
309
|
}
|
302
310
|
end
|
303
|
-
|
311
|
+
fieldsToSearch.delete('cnt') if fieldsToSearch.key?('cnt')
|
304
312
|
searchCriteria = searchFilter.strip_or_self()
|
305
313
|
searchSQL = []
|
306
314
|
numericSearch = false
|
@@ -495,6 +503,56 @@ module WidgetList
|
|
495
503
|
end
|
496
504
|
end
|
497
505
|
|
506
|
+
def get_grouping_functions()
|
507
|
+
#http://docs.oracle.com/cd/E11882_01/server.112/e10592/functions003.htm
|
508
|
+
[
|
509
|
+
'AVG(',
|
510
|
+
'COLLECT(',
|
511
|
+
'CORR(',
|
512
|
+
'COUNT(',
|
513
|
+
'COVAR_POP(',
|
514
|
+
'COVAR_SAMP(',
|
515
|
+
'CUME_DIST(',
|
516
|
+
'DENSE_RANK(',
|
517
|
+
'FIRST(',
|
518
|
+
'GROUP_ID(',
|
519
|
+
'GROUPING_ID(',
|
520
|
+
'LAST(',
|
521
|
+
'LISTAGG(',
|
522
|
+
'MAX(',
|
523
|
+
'MEDIAN(',
|
524
|
+
'MIN(',
|
525
|
+
'PERCENT_RANK(',
|
526
|
+
'PERCENTILE_CONT(',
|
527
|
+
'PERCENTILE_DISC(',
|
528
|
+
'RANK(',
|
529
|
+
'REGR_SLOPE(',
|
530
|
+
'REGR_INTERCEPT(',
|
531
|
+
'REGR_COUNT(',
|
532
|
+
'REGR_R2(',
|
533
|
+
'REGR_AVGX(',
|
534
|
+
'REGR_AVGY(',
|
535
|
+
'REGR_SXX(',
|
536
|
+
'REGR_SYY(',
|
537
|
+
'REGR_SXY(',
|
538
|
+
'STATS_MINOMIAL_TEST(',
|
539
|
+
'STATS_CROSSTAB(',
|
540
|
+
'STATS_F_TEST(',
|
541
|
+
'STATS_KS_TEST(',
|
542
|
+
'STATS_MODE(',
|
543
|
+
'STATS_MW_TEST(',
|
544
|
+
'STDDEV(',
|
545
|
+
'STDDEV_POP(',
|
546
|
+
'STDDEV_SAMP(',
|
547
|
+
'SUM(',
|
548
|
+
'SYS_XMLAGG(',
|
549
|
+
'VAR_POP(',
|
550
|
+
'VAR_SAMP(',
|
551
|
+
'VARIANCE(',
|
552
|
+
'XMLAGG(',
|
553
|
+
]
|
554
|
+
end
|
555
|
+
|
498
556
|
def self.get_defaults()
|
499
557
|
{
|
500
558
|
'errors' => [],
|
@@ -528,7 +586,7 @@ module WidgetList
|
|
528
586
|
#
|
529
587
|
# carryOverRequests will allow you to post custom things from request to all sort/paging URLS for each ajax
|
530
588
|
#
|
531
|
-
'carryOverRequsts' => ['switch_grouping'],
|
589
|
+
'carryOverRequsts' => ['switch_grouping','group_row_id'],
|
532
590
|
|
533
591
|
#
|
534
592
|
# Head/Foot
|
@@ -547,8 +605,7 @@ module WidgetList
|
|
547
605
|
# Search
|
548
606
|
#
|
549
607
|
'showSearch' => true,
|
550
|
-
'searchOnkeyup' => '',
|
551
|
-
'searchOnclick' => '',
|
608
|
+
'searchOnkeyup' => "SearchWidgetList('<!--URL-->', '<!--TARGET-->', this);",
|
552
609
|
'searchIdCol' => 'id',
|
553
610
|
'searchTitle' => 'Search by Id or a list of Ids and more',
|
554
611
|
'searchFieldsIn' => {},
|
@@ -592,13 +649,22 @@ module WidgetList
|
|
592
649
|
'borderedColumns' => false,
|
593
650
|
'borderColumnStyle' => '1px solid #CCCCCC',
|
594
651
|
|
652
|
+
#
|
653
|
+
# Table Colors
|
654
|
+
#
|
655
|
+
'footerBGColor' => '#ECECEC',
|
656
|
+
'headerBGColor' => '#ECECEC',
|
657
|
+
'footerFontColor' => '#494949',
|
658
|
+
'headerFontColor' => '#494949',
|
659
|
+
'tableBorder' => '1',
|
660
|
+
|
595
661
|
#
|
596
662
|
# Row specifics
|
597
663
|
#
|
598
664
|
'rowClass' => '',
|
599
665
|
'rowColorByStatus' => {},
|
600
666
|
'rowStylesByStatus' => {},
|
601
|
-
'rowOffsets' => ['FFFFFF','FFFFFF'],
|
667
|
+
'rowOffsets' => ['#FFFFFF','#FFFFFF'],
|
602
668
|
|
603
669
|
'class' => 'listContainerPassive',
|
604
670
|
'tableclass' => 'tableBlowOutPreventer',
|
@@ -934,6 +1000,11 @@ module WidgetList
|
|
934
1000
|
end
|
935
1001
|
|
936
1002
|
@templateFill['<!--HEADER-->'] = @items['templateHeader']
|
1003
|
+
@templateFill['<!--TABLE_BORDER-->'] = @items['tableBorder']
|
1004
|
+
@templateFill['<!--HEADER_COLOR-->'] = @items['headerBGColor']
|
1005
|
+
@templateFill['<!--FOOTER_COLOR-->'] = @items['footerBGColor']
|
1006
|
+
@templateFill['<!--HEADER_TXT_COLOR-->'] = @items['headerFontColor']
|
1007
|
+
@templateFill['<!--FOOTER_TXT_COLOR-->'] = @items['footerFontColor']
|
937
1008
|
@templateFill['<!--TITLE-->'] = @items['title']
|
938
1009
|
@templateFill['<!--NAME-->'] = @items['name']
|
939
1010
|
@templateFill['<!--JUMP_URL-->'] = WidgetList::Utils::build_url(@items['pageId'],listJumpUrl,(!$_REQUEST.key?('BUTTON_VALUE')))
|
@@ -1010,11 +1081,11 @@ module WidgetList
|
|
1010
1081
|
'skip_queue' => false,
|
1011
1082
|
'target' => @items['name'],
|
1012
1083
|
'search_form' => @items['listSearchForm'],
|
1013
|
-
'
|
1014
|
-
'onkeyup' => (! @items['searchOnkeyup'].empty?) ? @items['searchOnkeyup'] : ''
|
1084
|
+
'onkeyup' => (! @items['searchOnkeyup'].empty?) ? WidgetList::Utils::fill({'<!--URL-->'=>searchUrl, '<!--TARGET-->' => @items['name'], '<!--FUNCTION_ALL-->' => @items['ajaxFunctionAll']}, @items['searchOnkeyup'] + '<!--FUNCTION_ALL-->') : ''
|
1015
1085
|
}
|
1016
1086
|
|
1017
|
-
@
|
1087
|
+
@headerPieces['searchBar'] = WidgetList::Widgets::widget_input(list_search)
|
1088
|
+
@templateFill['<!--FILTER_HEADER-->'] = @headerPieces['searchBar']
|
1018
1089
|
|
1019
1090
|
end
|
1020
1091
|
|
@@ -1027,6 +1098,11 @@ module WidgetList
|
|
1027
1098
|
list_group['readonly'] = true
|
1028
1099
|
if @items['groupBySelected']
|
1029
1100
|
list_group['value'] = @items['groupBySelected']
|
1101
|
+
elsif $_REQUEST.key?('group_row_id')
|
1102
|
+
tmp = $_REQUEST['group_row_id'].gsub(@items['name'] + '_row_','')
|
1103
|
+
if Float(tmp.to_i) != nil
|
1104
|
+
list_group['value'] = @items['groupByItems'][tmp.to_i - 1]
|
1105
|
+
end
|
1030
1106
|
else
|
1031
1107
|
list_group['value'] = @items['groupByItems'][0]
|
1032
1108
|
end
|
@@ -1061,18 +1137,19 @@ module WidgetList
|
|
1061
1137
|
'search_form'=> '
|
1062
1138
|
<div id="advanced-search-container" style="height:100% !important;">
|
1063
1139
|
' + groupRows.join("\n") + '
|
1064
|
-
</div>'
|
1065
|
-
'onclick' => @items['searchOnclick']
|
1140
|
+
</div>'
|
1066
1141
|
}
|
1067
1142
|
if !@templateFill.key?('<!--FILTER_HEADER-->')
|
1068
1143
|
@templateFill['<!--FILTER_HEADER-->'] = ''
|
1069
1144
|
end
|
1070
|
-
@
|
1145
|
+
@headerPieces['groupByItems'] = '<div class="fake-select ' + @items['name'] + '-group-by"><div class="label">' + @items['groupByLabel'] + ':</div> ' + WidgetList::Widgets::widget_input(list_group) + '</div>'
|
1146
|
+
@templateFill['<!--FILTER_HEADER-->'] += @headerPieces['groupByItems']
|
1071
1147
|
|
1072
1148
|
end
|
1073
1149
|
|
1074
1150
|
if @items['showExport']
|
1075
|
-
@
|
1151
|
+
@headerPieces['exportButton'] = '<span class="' + @items['name'] + '-export">' + WidgetList::Widgets::widget_button(@items['exportButtonTitle'], {'onclick' => 'ListExport(\'' + @items['name'] + '\');'}, true) + '</span>'
|
1152
|
+
@templateFill['<!--FILTER_HEADER-->'] += @headerPieces['exportButton']
|
1076
1153
|
end
|
1077
1154
|
|
1078
1155
|
end
|
@@ -1098,6 +1175,10 @@ module WidgetList
|
|
1098
1175
|
end
|
1099
1176
|
end
|
1100
1177
|
|
1178
|
+
def get_header_pieces()
|
1179
|
+
@headerPieces
|
1180
|
+
end
|
1181
|
+
|
1101
1182
|
def build_pagination()
|
1102
1183
|
pageRange = 3
|
1103
1184
|
pageNext = 1
|
@@ -1302,6 +1383,27 @@ module WidgetList
|
|
1302
1383
|
|
1303
1384
|
end
|
1304
1385
|
|
1386
|
+
def self.build_search_button_click(list_parms)
|
1387
|
+
|
1388
|
+
extra_get_vars = ''
|
1389
|
+
extra_func = ''
|
1390
|
+
filterParameters = {}
|
1391
|
+
if list_parms.key?('ajaxFunctionAll')
|
1392
|
+
extra_func = list_parms['ajaxFunctionAll']
|
1393
|
+
end
|
1394
|
+
|
1395
|
+
if list_parms.key?('carryOverRequsts')
|
1396
|
+
list_parms['carryOverRequsts'].each { |value|
|
1397
|
+
if $_REQUEST.key?(value)
|
1398
|
+
filterParameters[value] = $_REQUEST[value]
|
1399
|
+
end
|
1400
|
+
}
|
1401
|
+
extra_get_vars = WidgetList::Utils::build_query_string(filterParameters)
|
1402
|
+
end
|
1403
|
+
|
1404
|
+
"ListJumpMin(jQuery('##{list_parms['name']}_jump_url').val() + '&advanced_search=1&' + jQuery('#list_search_id_#{list_parms['name']}_results *').serialize() + '&#{extra_get_vars}', '#{list_parms['name']}');HideAdvancedSearch(this);" + extra_func
|
1405
|
+
end
|
1406
|
+
|
1305
1407
|
def build_headers()
|
1306
1408
|
headers = []
|
1307
1409
|
@items['fields'].each { |field, fieldTitle|
|
@@ -1636,9 +1738,12 @@ module WidgetList
|
|
1636
1738
|
ret = {}
|
1637
1739
|
|
1638
1740
|
if $_REQUEST['list_action'] != 'ajax_widgetlist_checks'
|
1639
|
-
ret['list']
|
1640
|
-
ret['
|
1641
|
-
ret['
|
1741
|
+
ret['list'] = list.render()
|
1742
|
+
ret['search_bar'] = list.get_header_pieces['searchBar']
|
1743
|
+
ret['group_by_items'] = list.get_header_pieces['groupByItems']
|
1744
|
+
ret['export_button'] = list.get_header_pieces['exportButton']
|
1745
|
+
ret['list_id'] = list_parms['name']
|
1746
|
+
ret['callback'] = 'ListSearchAheadResponse'
|
1642
1747
|
end
|
1643
1748
|
|
1644
1749
|
return ['json',WidgetList::Utils::json_encode(ret)]
|
@@ -1821,29 +1926,37 @@ module WidgetList
|
|
1821
1926
|
nameId = ''
|
1822
1927
|
|
1823
1928
|
buttons.each { |buttonId,buttonAttribs|
|
1824
|
-
#url = array('PAGE_ID')
|
1825
1929
|
function = @items['linkFunction']
|
1826
1930
|
parameters = ''
|
1827
1931
|
renderButton = true
|
1828
1932
|
|
1933
|
+
page = buttonAttribs['page'].dup
|
1829
1934
|
if buttonAttribs.key?('tags')
|
1830
1935
|
buttonAttribs['tags'].each { | tagName , tag |
|
1831
|
-
#only uppercase will be replaced
|
1832
|
-
#
|
1833
|
-
|
1834
1936
|
if @results.key?(tag.upcase) && @results[tag.upcase][j]
|
1937
|
+
#
|
1938
|
+
# Data exists, lets check to see if page has any lowercase tags for restful URLs
|
1939
|
+
#
|
1835
1940
|
|
1836
|
-
buttonAttribs.
|
1837
|
-
|
1838
|
-
|
1839
|
-
|
1840
|
-
|
1941
|
+
if buttonAttribs.key?('page') && buttonAttribs['page'].include?(tag.downcase)
|
1942
|
+
page.gsub!(tag.downcase,@results[tag.upcase][j])
|
1943
|
+
else
|
1944
|
+
#
|
1945
|
+
# Will build ?tagname=XXXX based on your hash passed to your page
|
1946
|
+
#
|
1947
|
+
buttonAttribs.deep_merge!({ 'args' => { tagName => @results[tag.upcase][j] } })
|
1948
|
+
end
|
1841
1949
|
else
|
1842
|
-
|
1843
|
-
|
1844
|
-
|
1845
|
-
|
1846
|
-
|
1950
|
+
|
1951
|
+
#
|
1952
|
+
# User is passing hard coded tags such as 'tags' => {'my_static_var' => '1234'}
|
1953
|
+
# Just fill in normally wherever anything is matched
|
1954
|
+
#
|
1955
|
+
if buttonAttribs.key?('page') && buttonAttribs['page'].include?(tag.downcase)
|
1956
|
+
page.gsub!(tagName,tag)
|
1957
|
+
else
|
1958
|
+
buttonAttribs.deep_merge!({ 'args' => { tagName => tag } })
|
1959
|
+
end
|
1847
1960
|
end
|
1848
1961
|
}
|
1849
1962
|
end
|
@@ -1852,19 +1965,19 @@ module WidgetList
|
|
1852
1965
|
buttonAttribs['name'] = nameId
|
1853
1966
|
buttonAttribs['id'] = nameId
|
1854
1967
|
|
1855
|
-
|
1856
|
-
|
1857
|
-
|
1858
|
-
|
1859
|
-
|
1860
|
-
|
1861
|
-
|
1862
|
-
|
1863
|
-
|
1968
|
+
if buttonAttribs.key?('hide_if') && input['hide_if'].class.name == 'Proc'
|
1969
|
+
row_tmp = {}
|
1970
|
+
@results.map { |column| column }.each { |col|
|
1971
|
+
row_tmp[ col[0] ] = col[1][row]
|
1972
|
+
}
|
1973
|
+
if buttonAttribs['hide_if'].call(row_tmp)
|
1974
|
+
renderButton = false
|
1975
|
+
end
|
1976
|
+
end
|
1864
1977
|
|
1865
1978
|
if (renderButton)
|
1866
1979
|
strCnt += (buttonAttribs['text'].length * 15)
|
1867
|
-
btnOut << WidgetList::Widgets::widget_button(buttonAttribs['text'], buttonAttribs, true)
|
1980
|
+
btnOut << WidgetList::Widgets::widget_button(buttonAttribs['text'], buttonAttribs.deep_merge!({'page' => page}) , true)
|
1868
1981
|
end
|
1869
1982
|
}
|
1870
1983
|
|
@@ -230,6 +230,22 @@ function ListJumpResponse(response)
|
|
230
230
|
{
|
231
231
|
eval(response['callback'] + '()');
|
232
232
|
}
|
233
|
+
|
234
|
+
if(typeof response['search_bar'] === 'string')
|
235
|
+
{
|
236
|
+
jQuery('.' + response['list_id'] + '-search').replaceWith(response['search_bar']);
|
237
|
+
InitInfoFields(jQuery('#list_search_id_' + response['list_id']));
|
238
|
+
}
|
239
|
+
|
240
|
+
if(typeof response['export_button'] === 'string')
|
241
|
+
{
|
242
|
+
jQuery('.' + response['list_id'] + '-export').replaceWith(response['export_button']);
|
243
|
+
}
|
244
|
+
|
245
|
+
if(typeof response['group_by_items'] === 'string')
|
246
|
+
{
|
247
|
+
jQuery('.' + response['list_id'] + '-group-by').replaceWith(response['group_by_items']);
|
248
|
+
}
|
233
249
|
}
|
234
250
|
|
235
251
|
/**
|
@@ -627,7 +627,7 @@ div.inputOuter .inputInner input.search-ahead {width:97%}
|
|
627
627
|
* Advanced Search Down Arrow
|
628
628
|
*/
|
629
629
|
.widget-search-arrow {background: url('../assets/images/gobblecons/mid-gray/arrow-16.png') no-repeat scroll 0px 0px transparent;float:right;margin:8px;position: relative;right:-23px;top:-30px;cursor:pointer;border:0px solid red;height:20px;width:20px;display:none}
|
630
|
-
.widget-search-arrow:hover {background: url('../assets/images/gobblecons/
|
630
|
+
.widget-search-arrow:hover {background: url('../assets/images/gobblecons/mid-gray/arrow-16.png') no-repeat scroll 0px 0px transparent;}
|
631
631
|
|
632
632
|
/**
|
633
633
|
* Search Ahead Magifier Glass
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: widget_list
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0
|
4
|
+
version: 1.1.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-02-
|
12
|
+
date: 2013-02-28 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: sequel
|