widget_list 1.2.7 → 1.2.8

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.
data/checkin_gem.sh ADDED
@@ -0,0 +1,13 @@
1
+ svn delete vendor/cache/widget_list-$1.gem vendor/bundle/ruby/1.9.1/cache/widget_list-$1.gem vendor/bundle/ruby/1.9.1/specifications/widget_list-$1.gemspec vendor/bundle/ruby/1.9.1/gems/widget_list-$1
2
+
3
+ grep -rl '"widget_list", "'$1'"' Gemfile | xargs sed -i 's/"widget_list", "'$1'"/"widget_list", "'$2'"/g'
4
+
5
+ bundle install
6
+
7
+ svn add vendor/cache/widget_list-$2.gem vendor/bundle/ruby/1.9.1/cache/widget_list-$2.gem vendor/bundle/ruby/1.9.1/specifications/widget_list-$2.gemspec vendor/bundle/ruby/1.9.1/gems/widget_list-$2
8
+
9
+ echo -e -n "Please test your solution and press enter to checkin new gem"
10
+ read THEMENAME
11
+
12
+
13
+ svn commit vendor/cache/widget_list-$1.gem vendor/bundle/ruby/1.9.1/cache/widget_list-$1.gem vendor/bundle/ruby/1.9.1/specifications/widget_list-$1.gemspec vendor/bundle/ruby/1.9.1/gems/widget_list-$1 vendor/cache/widget_list-$2.gem vendor/bundle/ruby/1.9.1/cache/widget_list-$2.gem vendor/bundle/ruby/1.9.1/specifications/widget_list-$2.gemspec vendor/bundle/ruby/1.9.1/gems/widget_list-$2 Gemfile.lock Gemfile -m "$1 -> $2 gem update"
@@ -1,3 +1,3 @@
1
1
  module WidgetList
2
- VERSION = "1.2.7"
2
+ VERSION = "1.2.8"
3
3
  end
data/lib/widget_list.rb CHANGED
@@ -325,7 +325,11 @@ module WidgetList
325
325
 
326
326
  def add_conditional(key,conditional)
327
327
  whitespace = 19
328
- "'#{key}' " + "".ljust(whitespace - key.length) + " #{conditional}"
328
+ "'#{escape_code key}' " + "".ljust(whitespace - key.length) + " #{conditional}"
329
+ end
330
+
331
+ def escape_code(code)
332
+ code.gsub(/'/,"\\\\\\\\'")
329
333
  end
330
334
 
331
335
  def translate_config_to_code()
@@ -361,17 +365,17 @@ module WidgetList
361
365
  column_to_show = "'#{field[1]['column_to_show'].gsub(/_linked/,'')}'"
362
366
  if using_grouping
363
367
  if database_type == 'oracle'
364
- column_to_show = "groupByFilter == 'none' ? '#{field[1]['column_to_show'].gsub(/_linked/,'')}' : 'MAX(#{field[1]['column_to_show'].gsub(/_linked/,'')})'"
368
+ column_to_show = "groupByFilter == 'none' ? '#{escape_code field[1]['column_to_show'].gsub(/_linked/,'')}' : 'MAX(#{escape_code field[1]['column_to_show'].gsub(/_linked/,'')})'"
365
369
  end
366
370
  end
367
371
 
368
372
  field_function_code += "
369
373
  list_parms['fieldFunction']#{add_pointer(field[1]['column_to_show'],7)} WidgetList::List::build_drill_down(
370
374
  :list_id => list_parms['name'],
371
- :drill_down_name => '#{field[0]}',
375
+ :drill_down_name => '#{escape_code field[0]}',
372
376
  :data_to_pass_from_view => #{column_to_show},
373
377
  :column_to_show => #{column_to_show},
374
- :column_alias => '#{field[1]['column_to_show']}',
378
+ :column_alias => '#{escape_code field[1]['column_to_show']}',
375
379
  :primary_database => #{page_config['primaryDatabase'] == '1' ? 'true' : 'false'}
376
380
  )"
377
381
  case_statements += <<-EOD
@@ -379,7 +383,7 @@ module WidgetList
379
383
  when '#{field[0]}'
380
384
  list_parms['filter'] << " #{field[1]['column_to_show'].gsub(/_linked/,'')} = ? "
381
385
  list_parms['bindVars'] << #{page_config['view']}.sanitize(filterValue)
382
- list_parms['listDescription'] = drillDownBackLink + ' Filtered by #{field[1]['column_to_show'].gsub(/_linked/,'').camelize} (' + filterValue + ')'
386
+ list_parms['listDescription'] = drillDownBackLink + ' Filtered by #{escape_code field[1]['column_to_show'].gsub(/_linked/,'').camelize} (' + filterValue + ')'
383
387
  EOD
384
388
  }
385
389
 
@@ -394,20 +398,20 @@ module WidgetList
394
398
  drillDownBackLink = WidgetList::List::drill_down_back(list_parms['name'])
395
399
  case drillDown#{case_statements}
396
400
  else
397
- list_parms['listDescription'] = '#{page_config['listDescription']}'
401
+ list_parms['listDescription'] = '#{escape_code page_config['listDescription']}'
398
402
  end
399
403
  EOD
400
404
 
401
405
  else
402
406
  drill_down_code = "
403
- list_parms['listDescription'] = '#{page_config['listDescription']}'
407
+ list_parms['listDescription'] = '#{escape_code page_config['listDescription']}'
404
408
  "
405
409
  end
406
410
 
407
411
 
408
412
  if page_config['rowButtonsOn'] == '1'
409
413
  variable_code += "
410
- button_column_name = '#{page_config['rowButtonsName']}'"
414
+ button_column_name = '#{escape_code page_config['rowButtonsName']}'"
411
415
  end
412
416
 
413
417
  #------------ VIEW ------------
@@ -449,12 +453,12 @@ module WidgetList
449
453
 
450
454
  if page_config['showExport'] == '1' && page_config['showSearch'] == '1'
451
455
  export_code += "list_parms['showExport'] = #{page_config['showExport'] == '1' ? 'true' : 'false'}
452
- list_parms['exportButtonTitle'] = '#{page_config['exportButtonTitle']}'"
456
+ list_parms['exportButtonTitle'] = '#{escape_code page_config['exportButtonTitle']}'"
453
457
  end
454
458
 
455
459
  if page_config['showSearch'] == '1'
456
460
  export_code += "
457
- list_parms['searchTitle'] = '#{page_config['searchTitle']}'"
461
+ list_parms['searchTitle'] = '#{escape_code page_config['searchTitle']}'"
458
462
  end
459
463
 
460
464
 
@@ -508,7 +512,7 @@ module WidgetList
508
512
  list_parms['fieldFunction']#{add_pointer('cnt',7)} #{add_conditional(count," if groupByFilter != 'none'")}"
509
513
  descriptions = []
510
514
  group_by.each { |field,description|
511
- descriptions << "'" + description + "'"
515
+ descriptions << "'" + escape_code(description) + "'"
512
516
  desc = ''
513
517
  filter = ''
514
518
  unless field.empty?
@@ -521,8 +525,8 @@ module WidgetList
521
525
 
522
526
  when '#{description}'
523
527
  list_parms['groupBy'] = '#{field}'
524
- groupByFilter = '#{filter}'
525
- groupByDesc = '#{desc}'
528
+ groupByFilter = '#{escape_code filter}'
529
+ groupByDesc = '#{escape_code desc}'
526
530
  EOD
527
531
  }
528
532
  grouping_code = <<-EOD
@@ -569,10 +573,10 @@ module WidgetList
569
573
 
570
574
  buttons.each { |field|
571
575
  button_code += "
572
- mini_buttons['button_#{field[0].downcase}'] = {'page' => '#{field[1]['url']}',
573
- 'text' => '#{field[0]}',
576
+ mini_buttons['button_#{field[0].downcase}'] = {'page' => '#{escape_code field[1]['url']}',
577
+ 'text' => '#{escape_code field[0]}',
574
578
  'function' => 'Redirect',
575
- 'innerClass' => '#{field[1]['class']}',
579
+ 'innerClass' => '#{escape_code field[1]['class']}',
576
580
  'tags' => {'all'=>'all'}
577
581
  }
578
582
  "
@@ -589,7 +593,7 @@ module WidgetList
589
593
  if page_config['footerOn'] == '1' && !footer_buttons.empty?
590
594
  btns = []
591
595
  footer_buttons.each {|field|
592
- btns << " WidgetList::Widgets::widget_button('#{field[0]}', {'page' => '#{field[1]['url']}','innerClass' => '#{field[1]['class']}'})"
596
+ btns << " WidgetList::Widgets::widget_button('#{escape_code field[0]}', {'page' => '#{escape_code field[1]['url']}','innerClass' => '#{escape_code field[1]['class']}'})"
593
597
  }
594
598
 
595
599
  button_code += "
@@ -603,14 +607,14 @@ module WidgetList
603
607
  if page_config['fieldFunctionOn'] == '1' && !fields_function.empty?
604
608
  fields_function.each { |field,command|
605
609
  field_function_code += "
606
- list_parms['fieldFunction']#{add_pointer(field,7)} '#{command}'"
610
+ list_parms['fieldFunction']#{add_pointer(field,7)} '#{escape_code command}'"
607
611
  }
608
612
  end
609
613
 
610
614
  if page_config['showHidden'] == '1'
611
615
  fields_hidden.each { |field|
612
616
  hidden_field_code += "
613
- list_parms['fieldsHidden'] << '#{field[1]}'"
617
+ list_parms['fieldsHidden'] << '#{escape_code field[1]}'"
614
618
  }
615
619
  end
616
620
 
@@ -630,10 +634,10 @@ module WidgetList
630
634
 
631
635
  #{variable_code}
632
636
  list_parms = WidgetList::List::init_config()
633
- list_parms['name'] = '#{page_config['name']}'
634
- list_parms['noDataMessage'] = '#{page_config['noDataMessage']}'
637
+ list_parms['name'] = '#{escape_code page_config['name']}'
638
+ list_parms['noDataMessage'] = '#{escape_code page_config['noDataMessage']}'
635
639
  list_parms['rowLimit'] = #{page_config['rowLimit']}
636
- list_parms['title'] = '#{page_config['title']}'
640
+ list_parms['title'] = '#{escape_code page_config['title']}'
637
641
  list_parms['useSort'] = #{page_config['useSort'] == '1' ? 'true' : 'false'}
638
642
  list_parms['database'] = '#{page_config['primaryDatabase'] == '1' ? 'primary' : 'secondary'}'
639
643
  #{export_code}
@@ -1039,7 +1043,7 @@ module WidgetList
1039
1043
  unless $_REQUEST.key?('ajax')
1040
1044
  @fill['<!--CODE-->'] = translate_config_to_code()
1041
1045
  end
1042
- return WidgetList::Utils::fill(@fill , ac.render_to_string(:partial => 'widget_list/administration/output_save') ) unless $_REQUEST.key?('ajax')
1046
+ return WidgetList::Utils::fill(@fill ,ac.render_to_string(:partial => 'widget_list/administration/output_save') ) unless $_REQUEST.key?('ajax')
1043
1047
  return @fill.to_json
1044
1048
  end
1045
1049
  end
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.2.7
4
+ version: 1.2.8
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -82,6 +82,7 @@ files:
82
82
  - app/views/widget_list/list_partials/_row.html.erb
83
83
  - app/views/widget_list/list_partials/_sequence.html.erb
84
84
  - app/views/widget_list/list_partials/_sort_column.html.erb
85
+ - checkin_gem.sh
85
86
  - lib/extensions/action_controller_base.rb
86
87
  - lib/widget_list.rb
87
88
  - lib/widget_list/engine.rb