widget_list 1.0.3 → 1.0.4
Sign up to get free protection for your applications and to get access to all the features.
- data/.idea/workspace.xml +9 -58
- data/lib/extensions/action_controller_base.rb +1 -1
- data/lib/widget_list/version.rb +1 -1
- data/lib/widget_list.rb +92 -94
- metadata +2 -2
data/.idea/workspace.xml
CHANGED
@@ -4,6 +4,7 @@
|
|
4
4
|
<list default="true" id="0bede1c9-1aed-4d82-8d14-4184b67697c4" name="Default" comment="">
|
5
5
|
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/.idea/.rakeTasks" afterPath="$PROJECT_DIR$/.idea/.rakeTasks" />
|
6
6
|
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/vendor/assets/images/gobblecons/README.rtf" afterPath="$PROJECT_DIR$/vendor/assets/images/gobblecons/README.rtf" />
|
7
|
+
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/.idea/workspace.xml" afterPath="$PROJECT_DIR$/.idea/workspace.xml" />
|
7
8
|
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/README.md" afterPath="$PROJECT_DIR$/README.md" />
|
8
9
|
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/lib/widget_list.rb" afterPath="$PROJECT_DIR$/lib/widget_list.rb" />
|
9
10
|
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/lib/widget_list/sequel.rb" afterPath="$PROJECT_DIR$/lib/widget_list/sequel.rb" />
|
@@ -44,7 +45,7 @@
|
|
44
45
|
<file leaf-file-name="README.md" pinned="false" current="true" current-in-tab="true">
|
45
46
|
<entry file="file://$PROJECT_DIR$/README.md">
|
46
47
|
<provider selected="true" editor-type-id="text-editor">
|
47
|
-
<state line="
|
48
|
+
<state line="289" column="0" selection-start="10689" selection-end="11027" vertical-scroll-proportion="0.0">
|
48
49
|
<folding />
|
49
50
|
</state>
|
50
51
|
</provider>
|
@@ -116,7 +117,7 @@
|
|
116
117
|
<file leaf-file-name="widget_list.rb" pinned="false" current="false" current-in-tab="false">
|
117
118
|
<entry file="file://$PROJECT_DIR$/lib/widget_list.rb">
|
118
119
|
<provider selected="true" editor-type-id="text-editor">
|
119
|
-
<state line="2082" column="3" selection-start="75983" selection-end="75983" vertical-scroll-proportion="
|
120
|
+
<state line="2082" column="3" selection-start="75983" selection-end="75983" vertical-scroll-proportion="0.0">
|
120
121
|
<folding />
|
121
122
|
</state>
|
122
123
|
</provider>
|
@@ -158,7 +159,7 @@
|
|
158
159
|
<option name="x" value="-5" />
|
159
160
|
<option name="y" value="25" />
|
160
161
|
<option name="width" value="1690" />
|
161
|
-
<option name="height" value="
|
162
|
+
<option name="height" value="937" />
|
162
163
|
</component>
|
163
164
|
<component name="ProjectLevelVcsManager" settingsEditedManually="false">
|
164
165
|
<OptionsSetting value="true" id="Add" />
|
@@ -205,56 +206,6 @@
|
|
205
206
|
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
|
206
207
|
</PATH_ELEMENT>
|
207
208
|
</PATH>
|
208
|
-
<PATH>
|
209
|
-
<PATH_ELEMENT>
|
210
|
-
<option name="myItemId" value="widget_list" />
|
211
|
-
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
|
212
|
-
</PATH_ELEMENT>
|
213
|
-
<PATH_ELEMENT>
|
214
|
-
<option name="myItemId" value="widget_list" />
|
215
|
-
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
|
216
|
-
</PATH_ELEMENT>
|
217
|
-
<PATH_ELEMENT>
|
218
|
-
<option name="myItemId" value="lib" />
|
219
|
-
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
|
220
|
-
</PATH_ELEMENT>
|
221
|
-
</PATH>
|
222
|
-
<PATH>
|
223
|
-
<PATH_ELEMENT>
|
224
|
-
<option name="myItemId" value="widget_list" />
|
225
|
-
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
|
226
|
-
</PATH_ELEMENT>
|
227
|
-
<PATH_ELEMENT>
|
228
|
-
<option name="myItemId" value="widget_list" />
|
229
|
-
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
|
230
|
-
</PATH_ELEMENT>
|
231
|
-
<PATH_ELEMENT>
|
232
|
-
<option name="myItemId" value="lib" />
|
233
|
-
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
|
234
|
-
</PATH_ELEMENT>
|
235
|
-
<PATH_ELEMENT>
|
236
|
-
<option name="myItemId" value="widget_list" />
|
237
|
-
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
|
238
|
-
</PATH_ELEMENT>
|
239
|
-
</PATH>
|
240
|
-
<PATH>
|
241
|
-
<PATH_ELEMENT>
|
242
|
-
<option name="myItemId" value="widget_list" />
|
243
|
-
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
|
244
|
-
</PATH_ELEMENT>
|
245
|
-
<PATH_ELEMENT>
|
246
|
-
<option name="myItemId" value="widget_list" />
|
247
|
-
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
|
248
|
-
</PATH_ELEMENT>
|
249
|
-
<PATH_ELEMENT>
|
250
|
-
<option name="myItemId" value="lib" />
|
251
|
-
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
|
252
|
-
</PATH_ELEMENT>
|
253
|
-
<PATH_ELEMENT>
|
254
|
-
<option name="myItemId" value="extensions" />
|
255
|
-
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
|
256
|
-
</PATH_ELEMENT>
|
257
|
-
</PATH>
|
258
209
|
</subPane>
|
259
210
|
</pane>
|
260
211
|
</panes>
|
@@ -374,14 +325,14 @@
|
|
374
325
|
<servers />
|
375
326
|
</component>
|
376
327
|
<component name="ToolWindowManager">
|
377
|
-
<frame x="-5" y="25" width="1690" height="
|
378
|
-
<editor active="
|
328
|
+
<frame x="-5" y="25" width="1690" height="937" extended-state="6" />
|
329
|
+
<editor active="false" />
|
379
330
|
<layout>
|
380
331
|
<window_info id="Changes" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" />
|
381
332
|
<window_info id="TODO" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="6" side_tool="false" content_ui="tabs" />
|
382
333
|
<window_info id="Database" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
|
383
334
|
<window_info id="Structure" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.25" sideWeight="0.5" order="1" side_tool="true" content_ui="tabs" />
|
384
|
-
<window_info id="Project" active="
|
335
|
+
<window_info id="Project" active="true" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" weight="0.1988984" sideWeight="0.5763547" order="0" side_tool="false" content_ui="combo" />
|
385
336
|
<window_info id="Debug" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.56913185" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
|
386
337
|
<window_info id="Favorites" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="2" side_tool="true" content_ui="tabs" />
|
387
338
|
<window_info id="Event Log" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="7" side_tool="true" content_ui="tabs" />
|
@@ -530,7 +481,7 @@
|
|
530
481
|
</entry>
|
531
482
|
<entry file="file://$PROJECT_DIR$/lib/widget_list.rb">
|
532
483
|
<provider selected="true" editor-type-id="text-editor">
|
533
|
-
<state line="2082" column="3" selection-start="75983" selection-end="75983" vertical-scroll-proportion="
|
484
|
+
<state line="2082" column="3" selection-start="75983" selection-end="75983" vertical-scroll-proportion="0.0">
|
534
485
|
<folding />
|
535
486
|
</state>
|
536
487
|
</provider>
|
@@ -544,7 +495,7 @@
|
|
544
495
|
</entry>
|
545
496
|
<entry file="file://$PROJECT_DIR$/README.md">
|
546
497
|
<provider selected="true" editor-type-id="text-editor">
|
547
|
-
<state line="
|
498
|
+
<state line="289" column="0" selection-start="10689" selection-end="11027" vertical-scroll-proportion="0.0">
|
548
499
|
<folding />
|
549
500
|
</state>
|
550
501
|
</provider>
|
@@ -13,7 +13,7 @@ ActionController::Base.class_eval {
|
|
13
13
|
def store_session
|
14
14
|
# Store pre-defined widget_list session items to the actual session
|
15
15
|
|
16
|
-
%w(pageDisplayLimit DRILL_DOWNS
|
16
|
+
%w(pageDisplayLimit DRILL_DOWNS ROW_LIMIT list_checks SEARCH_FILTER LIST_SEQUENCE LIST_COL_SORT list_count DRILL_DOWN_FILTERS).each { |key|
|
17
17
|
self.session[key] = $_SESSION[key]
|
18
18
|
}
|
19
19
|
|
data/lib/widget_list/version.rb
CHANGED
data/lib/widget_list.rb
CHANGED
@@ -28,6 +28,9 @@ module WidgetList
|
|
28
28
|
|
29
29
|
def self.determine_db_type(db_type)
|
30
30
|
the_type, void = db_type.split("://")
|
31
|
+
if the_type == 'sqlite:/'
|
32
|
+
the_type = 'sqlite'
|
33
|
+
end
|
31
34
|
return the_type.downcase
|
32
35
|
end
|
33
36
|
|
@@ -416,46 +419,6 @@ module WidgetList
|
|
416
419
|
|
417
420
|
@items['groupByClick'] = "ListChangeGrouping('" + @items['name'] + "')"
|
418
421
|
|
419
|
-
=begin
|
420
|
-
#todo
|
421
|
-
@items['fieldNames'] = {};
|
422
|
-
if (empty(@items['fields']) && empty(@items['data']))
|
423
|
-
{
|
424
|
-
#Lazy mode where new columns added to view show up in list (unless you name the column "HIDE_xxxxx")
|
425
|
-
#
|
426
|
-
if (@items['sql'])
|
427
|
-
{
|
428
|
-
#tick_field()....
|
429
|
-
preg_match("/\s+from\s+`?([a-z\d_]+)`?/i", @items['sql'], $match);
|
430
|
-
$viewName = $match[1];
|
431
|
-
}
|
432
|
-
elseif (@items['view'])
|
433
|
-
{
|
434
|
-
$viewName = @items['view'];
|
435
|
-
}
|
436
|
-
|
437
|
-
if ($this->DATABASE->Select("SHOW FULL COLUMNS IN ".$viewName))
|
438
|
-
{
|
439
|
-
foreach($this->DATABASE->results['FIELD'] as $col)
|
440
|
-
{
|
441
|
-
@items['fieldNames'][] = $col;
|
442
|
-
$columnUpper = strtoupper($col);
|
443
|
-
$columnLower = strtolower($col);
|
444
|
-
if (substr($columnUpper,0,5) != 'HIDE_')
|
445
|
-
{
|
446
|
-
#any columns named HIDE_ will not show
|
447
|
-
#
|
448
|
-
@items['fields'][$columnLower] = $this->autoColumnName($columnUpper);
|
449
|
-
if ($columnLower != 'features')
|
450
|
-
{
|
451
|
-
@items['columnSort'][$columnLower] = $columnLower;
|
452
|
-
}
|
453
|
-
}
|
454
|
-
}
|
455
|
-
}
|
456
|
-
}
|
457
|
-
=end
|
458
|
-
|
459
422
|
if $_REQUEST.key?('searchClear')
|
460
423
|
clear_search_session()
|
461
424
|
end
|
@@ -629,7 +592,7 @@ module WidgetList
|
|
629
592
|
|
630
593
|
#Initialize page load/Session stuff whe list first loads
|
631
594
|
#
|
632
|
-
clear_check_box_session(@items['name'])
|
595
|
+
WidgetList::List::clear_check_box_session(@items['name'])
|
633
596
|
end
|
634
597
|
|
635
598
|
|
@@ -773,7 +736,7 @@ module WidgetList
|
|
773
736
|
end
|
774
737
|
end
|
775
738
|
|
776
|
-
def clear_check_box_session(name='')
|
739
|
+
def self.clear_check_box_session(name='')
|
777
740
|
|
778
741
|
if $_SESSION.key?('DRILL_DOWN_FILTERS')
|
779
742
|
$_SESSION.delete('DRILL_DOWN_FILTERS')
|
@@ -825,6 +788,33 @@ module WidgetList
|
|
825
788
|
|
826
789
|
end
|
827
790
|
|
791
|
+
def self.get_filter_and_drilldown(listId)
|
792
|
+
filter = ''
|
793
|
+
drillDown = ''
|
794
|
+
if !$_REQUEST.key?('BUTTON_VALUE')
|
795
|
+
# Initialize page load/Session stuff whe list first loads
|
796
|
+
#
|
797
|
+
WidgetList::List::clear_check_box_session(listId)
|
798
|
+
end
|
799
|
+
|
800
|
+
if $_REQUEST.key?('drill_down')
|
801
|
+
drillDown = $_REQUEST['drill_down']
|
802
|
+
$_SESSION.deep_merge!({'DRILL_DOWNS' => { listId => drillDown} })
|
803
|
+
elsif $_SESSION.key?('DRILL_DOWNS') && $_SESSION['DRILL_DOWNS'].key?(listId)
|
804
|
+
drillDown = $_SESSION['DRILL_DOWNS'][listId]
|
805
|
+
else
|
806
|
+
drillDown = 'default'
|
807
|
+
end
|
808
|
+
|
809
|
+
if $_REQUEST.key?('filter')
|
810
|
+
filter = $_REQUEST['filter']
|
811
|
+
$_SESSION.deep_merge!({'DRILL_DOWN_FILTERS' => { listId => filter} })
|
812
|
+
elsif $_SESSION.key?('DRILL_DOWN_FILTERS') && $_SESSION['DRILL_DOWN_FILTERS'].key?(listId)
|
813
|
+
filter = $_SESSION['DRILL_DOWN_FILTERS'][listId]
|
814
|
+
end
|
815
|
+
return drillDown, filter
|
816
|
+
end
|
817
|
+
|
828
818
|
def clear_sort_get_vars()
|
829
819
|
$_REQUEST.delete('LIST_FILTER_ALL')
|
830
820
|
$_REQUEST.delete('ROW_LIMIT')
|
@@ -1531,6 +1521,60 @@ module WidgetList
|
|
1531
1521
|
return content
|
1532
1522
|
end
|
1533
1523
|
|
1524
|
+
def self.build_drill_down_link(listId,drillDownName,dataToPassFromView,columnToShow,columnAlias='',functionName='ListDrillDown',columnClass='')
|
1525
|
+
if columnAlias.empty?
|
1526
|
+
columnAlias = columnToShow
|
1527
|
+
end
|
1528
|
+
|
1529
|
+
if !columnClass.empty?
|
1530
|
+
columnClass = ' "' + WidgetList::List::concat_string() + columnClass + WidgetList::List::concat_string() + '"'
|
1531
|
+
end
|
1532
|
+
|
1533
|
+
return %[#{WidgetList::List::concat_inner()}"<a style='cursor:pointer;color:blue;' class='#{columnAlias}_drill#{columnClass}' onclick='#{functionName}(#{WidgetList::List::double_quote()}#{drillDownName}#{WidgetList::List::double_quote()},#{WidgetList::List::double_quote()}"#{WidgetList::List::concat_string()} #{dataToPassFromView} #{WidgetList::List::concat_string()} "#{WidgetList::List::double_quote()},#{WidgetList::List::double_quote()}#{listId}#{WidgetList::List::double_quote()})'>"#{WidgetList::List::concat_string()}#{columnToShow}#{WidgetList::List::concat_string()}"</a>"#{WidgetList::List::concat_outer()} as #{columnAlias},]
|
1534
|
+
end
|
1535
|
+
|
1536
|
+
def self.concat_string
|
1537
|
+
case WidgetList::List.get_database.db_type
|
1538
|
+
when 'mysql'
|
1539
|
+
' , '
|
1540
|
+
when 'oracle'
|
1541
|
+
when 'sqlite'
|
1542
|
+
' || '
|
1543
|
+
else
|
1544
|
+
','
|
1545
|
+
end
|
1546
|
+
end
|
1547
|
+
|
1548
|
+
def self.double_quote
|
1549
|
+
case WidgetList::List.get_database.db_type
|
1550
|
+
when 'mysql'
|
1551
|
+
'\\"'
|
1552
|
+
when 'oracle'
|
1553
|
+
when 'sqlite'
|
1554
|
+
'""'
|
1555
|
+
else
|
1556
|
+
'"'
|
1557
|
+
end
|
1558
|
+
end
|
1559
|
+
|
1560
|
+
def self.concat_outer
|
1561
|
+
case WidgetList::List.get_database.db_type
|
1562
|
+
when 'mysql'
|
1563
|
+
')'
|
1564
|
+
else
|
1565
|
+
''
|
1566
|
+
end
|
1567
|
+
end
|
1568
|
+
|
1569
|
+
def self.concat_inner
|
1570
|
+
case WidgetList::List.get_database.db_type
|
1571
|
+
when 'mysql'
|
1572
|
+
'CONCAT('
|
1573
|
+
else
|
1574
|
+
''
|
1575
|
+
end
|
1576
|
+
end
|
1577
|
+
|
1534
1578
|
def build_column_button(column,j)
|
1535
1579
|
buttons = @items['buttons'][column]
|
1536
1580
|
columnValue = @results[column.upcase][j]
|
@@ -1720,64 +1764,18 @@ module WidgetList
|
|
1720
1764
|
else
|
1721
1765
|
cleanData = strip_tags(@results[column.upcase][j].to_s)
|
1722
1766
|
|
1723
|
-
|
1724
|
-
|
1725
|
-
|
1726
|
-
|
1727
|
-
$possibleMatches = array("/(.*)(\(<a.*?>.*?<\/a>\)\s)(.*)/i" => array(3), #<a>(id)</a> Text
|
1728
|
-
"/(.*)(<a.*?>)(.*)(<\/a>)(.*)/i" => array(3) #<a>Text</a> other text
|
1729
|
-
);
|
1730
|
-
|
1731
|
-
foreach($possibleMatches as $regex => $toFix)
|
1732
|
-
{
|
1733
|
-
$matched = preg_match_all($regex, @results[strtoupper($column)][$j], $matches, PREG_PATTERN_ORDER);
|
1734
|
-
|
1735
|
-
if(! empty($matched))
|
1736
|
-
{
|
1737
|
-
$pieces = {};
|
1738
|
-
|
1739
|
-
unset($matches[0]);
|
1740
|
-
|
1741
|
-
foreach($matches as $key => $theText)
|
1742
|
-
{
|
1743
|
-
$fixedText = '';
|
1744
|
-
|
1745
|
-
if(in_array($key, $toFix))
|
1746
|
-
{
|
1747
|
-
$fixedText = substr($theText[0], 0, @items['strlength']) . '...';
|
1748
|
-
}
|
1749
|
-
else
|
1750
|
-
{
|
1751
|
-
$fixedText = $theText[0];
|
1752
|
-
}
|
1753
|
-
|
1754
|
-
$pieces[] = $fixedText;
|
1755
|
-
}
|
1756
|
-
|
1757
|
-
$content = implode('', $pieces);
|
1758
|
-
|
1759
|
-
break;
|
1760
|
-
}
|
1761
|
-
}
|
1767
|
+
#
|
1768
|
+
# For now disable length parser
|
1769
|
+
#
|
1770
|
+
if false && cleanData.length > @items['strlength']
|
1762
1771
|
|
1763
|
-
if(empty($matched))
|
1764
|
-
{
|
1765
|
-
if ((strpos(@results[strtoupper($column)][$j],'&#') !== false && strpos(@results[strtoupper($column)][$j],';') !== false))
|
1766
|
-
{
|
1767
|
-
$content = @results[strtoupper($column)][$j];
|
1768
|
-
}
|
1769
|
-
else
|
1770
|
-
{
|
1771
|
-
$content = substr(@results[strtoupper($column)][$j], 0, @items['strlength']) . '...';
|
1772
|
-
}
|
1773
|
-
}
|
1774
|
-
=end
|
1775
1772
|
content = @results[column.upcase][j].to_s[ 0, @items['strlength'] ] + '...'
|
1776
1773
|
|
1777
1774
|
else
|
1778
1775
|
content = @results[column.upcase][j].to_s
|
1779
1776
|
end
|
1780
1777
|
|
1778
|
+
#
|
1781
1779
|
#Strip HTML
|
1782
1780
|
#
|
1783
1781
|
if !@items['allowHTML']
|
@@ -2080,4 +2078,4 @@ module WidgetList
|
|
2080
2078
|
|
2081
2079
|
end
|
2082
2080
|
|
2083
|
-
|
2081
|
+
endx
|
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.4
|
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:
|
12
|
+
date: 2013-01-04 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: sequel
|