widget_list 1.0.10 → 1.0.11
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/widget_list.rb +49 -15
- data/lib/widget_list/version.rb +1 -1
- data/vendor/assets/javascripts/widget_list.js +15 -40
- metadata +2 -2
data/lib/widget_list.rb
CHANGED
@@ -188,18 +188,30 @@ module WidgetList
|
|
188
188
|
@current_db_selection = @items['database']
|
189
189
|
|
190
190
|
if get_database.db_type == 'oracle'
|
191
|
+
|
191
192
|
@items.deep_merge!({'statement' =>
|
192
|
-
{'
|
193
|
+
{'count'=>
|
193
194
|
{'view' =>
|
194
195
|
'
|
195
|
-
|
196
|
-
|
196
|
+
SELECT count(1) total FROM <!--VIEW--> ' + ((@items['groupBy'].empty? && !@active_record_model) ? '<!--WHERE--> <!--GROUPBY-->' : '' )
|
197
|
+
}
|
198
|
+
}
|
199
|
+
})
|
200
|
+
@items.deep_merge!({'statement' =>
|
201
|
+
{'select'=>
|
202
|
+
{'view' =>
|
203
|
+
'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-->' : '')
|
197
204
|
}
|
198
205
|
}
|
199
206
|
})
|
200
207
|
|
201
208
|
end
|
202
209
|
|
210
|
+
|
211
|
+
if $_REQUEST.key?('searchClear')
|
212
|
+
clear_search_session()
|
213
|
+
end
|
214
|
+
|
203
215
|
begin
|
204
216
|
@isJumpingList = false
|
205
217
|
|
@@ -246,10 +258,6 @@ module WidgetList
|
|
246
258
|
|
247
259
|
@items['groupByClick'] = WidgetList::Utils::fill({'<!--NAME-->' => @items['name']}, @items['groupByClickDefault'] + @items['groupByClick'])
|
248
260
|
|
249
|
-
if $_REQUEST.key?('searchClear')
|
250
|
-
clear_search_session()
|
251
|
-
end
|
252
|
-
|
253
261
|
if @items['searchClear'] || @items['searchClearAll']
|
254
262
|
clear_search_session(@items.key?('searchClearAll'))
|
255
263
|
end
|
@@ -649,8 +657,7 @@ module WidgetList
|
|
649
657
|
|
650
658
|
def tick_field()
|
651
659
|
case get_database.db_type
|
652
|
-
when 'postgres'
|
653
|
-
when 'oracle'
|
660
|
+
when 'postgres','oracle'
|
654
661
|
''
|
655
662
|
else
|
656
663
|
'`'
|
@@ -771,6 +778,22 @@ module WidgetList
|
|
771
778
|
$_SESSION.delete('ROW_LIMIT')
|
772
779
|
end
|
773
780
|
|
781
|
+
if $_REQUEST.key?('LIST_FILTER_ALL')
|
782
|
+
$_REQUEST.delete('LIST_FILTER_ALL')
|
783
|
+
end
|
784
|
+
|
785
|
+
if $_REQUEST.key?('LIST_COL_SORT')
|
786
|
+
$_REQUEST.delete('LIST_COL_SORT')
|
787
|
+
end
|
788
|
+
|
789
|
+
if $_REQUEST.key?('LIST_COL_SORT_ORDER')
|
790
|
+
$_REQUEST.delete('LIST_COL_SORT_ORDER')
|
791
|
+
end
|
792
|
+
|
793
|
+
if $_REQUEST.key?('LIST_SEQUENCE')
|
794
|
+
$_REQUEST.delete('LIST_SEQUENCE')
|
795
|
+
end
|
796
|
+
|
774
797
|
end
|
775
798
|
|
776
799
|
def clear_sql_session(all=false)
|
@@ -2234,21 +2257,28 @@ module WidgetList
|
|
2234
2257
|
end
|
2235
2258
|
|
2236
2259
|
if !@items['LIST_COL_SORT'].empty? || ($_SESSION.key?('LIST_COL_SORT') && $_SESSION['LIST_COL_SORT'].class.name == 'Hash' && $_SESSION['LIST_COL_SORT'].key?(@sqlHash))
|
2260
|
+
pieces['<!--ORDERBY-->'] += ' ORDER BY '
|
2261
|
+
foundColumn = false
|
2237
2262
|
if ! @items['LIST_COL_SORT'].empty?
|
2238
|
-
|
2263
|
+
foundColumn = true
|
2264
|
+
pieces['<!--ORDERBY-->'] += tick_field() + strip_aliases(@items['LIST_COL_SORT']) + tick_field() + " " + @items['LIST_COL_SORT_ORDER']
|
2239
2265
|
else
|
2240
2266
|
$_SESSION['LIST_COL_SORT'][@sqlHash].each_with_index { |order,void|
|
2241
|
-
|
2267
|
+
if @items['fields'].key?(order[0])
|
2268
|
+
foundColumn = true
|
2269
|
+
pieces['<!--ORDERBY-->'] += tick_field() + strip_aliases(order[0]) + tick_field() + " " + strip_aliases(order[1])
|
2270
|
+
end
|
2242
2271
|
} if $_SESSION.key?('LIST_COL_SORT') && $_SESSION['LIST_COL_SORT'].class.name == 'Hash' && $_SESSION['LIST_COL_SORT'].key?(@sqlHash)
|
2243
2272
|
end
|
2244
2273
|
|
2245
2274
|
# Add base order by
|
2246
2275
|
if ! @items['orderBy'].empty?
|
2247
|
-
pieces['<!--ORDERBY-->'] += ','
|
2276
|
+
pieces['<!--ORDERBY-->'] += ',' if foundColumn == true
|
2277
|
+
pieces['<!--ORDERBY-->'] += strip_aliases(@items['orderBy'])
|
2248
2278
|
end
|
2249
2279
|
|
2250
2280
|
elsif !@items['orderBy'].empty?
|
2251
|
-
pieces['<!--ORDERBY-->'] += ' ORDER BY ' + @items['orderBy']
|
2281
|
+
pieces['<!--ORDERBY-->'] += ' ORDER BY ' + strip_aliases(@items['orderBy'])
|
2252
2282
|
end
|
2253
2283
|
|
2254
2284
|
if get_database.db_type == 'oracle' && pieces['<!--ORDERBY-->'].empty?
|
@@ -2264,7 +2294,7 @@ module WidgetList
|
|
2264
2294
|
}
|
2265
2295
|
|
2266
2296
|
keys = tmp.keys
|
2267
|
-
pieces['<!--ORDERBY-->'] += ' ORDER BY ' + keys[0] + ' ASC'
|
2297
|
+
pieces['<!--ORDERBY-->'] += ' ORDER BY ' + strip_aliases(keys[0]) + ' ASC' unless keys[0].nil?
|
2268
2298
|
end
|
2269
2299
|
|
2270
2300
|
case get_database.db_type
|
@@ -2446,8 +2476,12 @@ module WidgetList
|
|
2446
2476
|
view = @items['view'].scoped.to_sql
|
2447
2477
|
sql_from = view[view.index(/FROM/),view.length]
|
2448
2478
|
view = "SELECT #{new_columns.join(',')} " + sql_from
|
2479
|
+
where = ''
|
2480
|
+
if !@items['groupBy'].empty?
|
2481
|
+
where = '<!--WHERE-->'
|
2482
|
+
end
|
2449
2483
|
|
2450
|
-
return "( #{view} <!--GROUPBY-->) a"
|
2484
|
+
return "( #{view} #{where} <!--GROUPBY--> ) a"
|
2451
2485
|
else
|
2452
2486
|
return ""
|
2453
2487
|
end
|
data/lib/widget_list/version.rb
CHANGED
@@ -536,30 +536,6 @@ function BuildUrl(getVars)
|
|
536
536
|
jQuery(document).ready(
|
537
537
|
function()
|
538
538
|
{
|
539
|
-
/**
|
540
|
-
* @todo if is visible slide up
|
541
|
-
*/
|
542
|
-
/* jQuery('.widget-search-drilldown').each(
|
543
|
-
function()
|
544
|
-
{
|
545
|
-
//widget-search-content
|
546
|
-
//
|
547
|
-
var masterBlaster = this;
|
548
|
-
|
549
|
-
jQuery('.widget-search-content', this).bind("mouseenter",
|
550
|
-
function()
|
551
|
-
{
|
552
|
-
jQuery(masterBlaster).stop();
|
553
|
-
jQuery(masterBlaster).slideDown();
|
554
|
-
}
|
555
|
-
).bind("mouseleave",
|
556
|
-
function()
|
557
|
-
{
|
558
|
-
//jQuery(masterBlaster).stop();
|
559
|
-
jQuery(masterBlaster).slideUp();
|
560
|
-
});
|
561
|
-
});*/
|
562
|
-
|
563
539
|
InitInfoFields();
|
564
540
|
});
|
565
541
|
})(jQuery);
|
@@ -684,29 +660,28 @@ function AjaxMaintainChecks(obj, checkbox_class, list_id, url, check_all_id)
|
|
684
660
|
|
685
661
|
//Check or uncheck check-all checkbox
|
686
662
|
//
|
687
|
-
jQuery('.' + checkbox_class).attr('checked', jQuery('#' + checkAllId).is(':checked'));
|
663
|
+
jQuery('.' + checkbox_class).not(':disabled').attr('checked', jQuery('#' + checkAllId).is(':checked'));
|
688
664
|
}
|
689
665
|
|
690
666
|
/**
|
691
667
|
* Serialize all checkboxes both checked and unchecked
|
692
668
|
*/
|
693
|
-
jQuery('.' + checkbox_class).each(
|
694
|
-
|
695
|
-
{
|
696
|
-
var checked = '0';
|
697
|
-
|
698
|
-
if(this.checked)
|
669
|
+
jQuery('.' + checkbox_class).not(':disabled').each(
|
670
|
+
function(key, value)
|
699
671
|
{
|
700
|
-
checked = '
|
701
|
-
|
702
|
-
|
703
|
-
|
704
|
-
|
705
|
-
|
672
|
+
var checked = '0';
|
673
|
+
if(this.checked)
|
674
|
+
{
|
675
|
+
checked = '1';
|
676
|
+
}
|
677
|
+
else
|
678
|
+
{
|
679
|
+
checkedAllBool = false;
|
680
|
+
checkedAllString = '0';
|
681
|
+
}
|
682
|
+
serializedChecks += escape(this.value) + '=' + checked + '&';
|
706
683
|
}
|
707
|
-
|
708
|
-
serializedChecks += escape(this.value) + '=' + checked + '&';
|
709
|
-
});
|
684
|
+
);
|
710
685
|
|
711
686
|
/**
|
712
687
|
* Check All Checkbox Status. On/Off
|
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.0.11
|
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-27 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: sequel
|