twb 0.5.2 → 0.5.3

Sign up to get free protection for your applications and to get access to all the features.
data/lib/twb.rb CHANGED
@@ -33,5 +33,5 @@ require_relative 'twb/util/xraydashboards'
33
33
  # Represents Tableau Workbooks and their contents.
34
34
  #
35
35
  module Twb
36
- VERSION = '0.5.2'
36
+ VERSION = '0.5.3'
37
37
  end
@@ -1,13 +1,26 @@
1
- # X-Ray Dashboards.rb - this Ruby script Copyright 2013-2015 Christopher Gerrard
1
+ # Copyright (C) 2014, 2015 Chris Gerrard
2
+ #
3
+ # This program is free software: you can redistribute it and/or modify
4
+ # it under the terms of the GNU General Public License as published by
5
+ # the Free Software Foundation, either version 3 of the License, or
6
+ # (at your option) any later version.
7
+ #
8
+ # This program is distributed in the hope that it will be useful,
9
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
10
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11
+ # GNU General Public License for more details.
12
+ #
13
+ # You should have received a copy of the GNU General Public License
14
+ # along with this program. If not, see <http://www.gnu.org/licenses/>.
2
15
 
3
16
  require 'twb'
4
17
 
5
18
  system "cls"
6
19
 
7
20
  $doctwb = true
8
- $replacetwb = false
21
+ $replacetwb = false # true|false - replace/new name TWB
9
22
  $dashdoclbl = 'dashdoc'
10
- $localurl = 'file:///' + Dir.pwd + '/'
23
+ $localurl = 'file:///' + Dir.pwd + '/' # for Dashboard Web Page objects
11
24
 
12
25
  def xray twbname
13
26
  twb = Twb::Workbook.new(twbname)
@@ -24,7 +37,7 @@ $localurl = 'file:///' + Dir.pwd + '/'
24
37
  end
25
38
  puts "\t #{cnt} \t #{twbname}"
26
39
  end
27
-
40
+
28
41
  def saveHTML(htmlfilename, html)
29
42
  begin
30
43
  htmlfile = File.open(htmlfilename, 'w')
@@ -35,13 +48,13 @@ $localurl = 'file:///' + Dir.pwd + '/'
35
48
  # invalid file name Characters. or when the name is
36
49
  # an invalid file name.
37
50
  # Stripping the non-ASCII characters from the Dashboard
38
- # name fixes this, in the cases see so far.
51
+ # name fixes this, in the cases seen so far.
39
52
  # This rescue-recursion technique can potentially cause
40
53
  # an infite-loop condition. (not seen, but possible)
41
54
  saveHTML( sanitize(htmlfilename), html)
42
55
  end
43
56
  end
44
-
57
+
45
58
  def inject(twb, dashboard, htmlfilename)
46
59
  vDash = Twb::DocDashboardWebVert.new
47
60
  vDash.title=('Doc Dashboard: ' + sanitize(dashboard))
@@ -53,13 +66,15 @@ $localurl = 'file:///' + Dir.pwd + '/'
53
66
  twb.writeAppend($dashdoclbl)
54
67
  end
55
68
  end
56
-
69
+
57
70
  def sanitize(str)
58
71
  str.gsub(/[^a-z0-9\-]+/i, ' ')
59
72
  end
60
73
 
61
74
  system 'cls'
62
- puts "\n\n\t X-raying Dashboards\n\n\t # Dashboards Workbook\n\t ------------ ----------------------"
75
+ puts "\n\n\t X-raying Dashboards"
76
+ puts "\n\n\t # Dashboards Workbook"
77
+ puts "\n\t ------------ ----------------------"
63
78
 
64
79
  path = if ARGV.empty? then '*.twb' else ARGV[0] end
65
80
  Dir.glob(path) {|twb| xray twb }
@@ -40,12 +40,18 @@ module Twb
40
40
  'web' => 'Web Page'
41
41
  }
42
42
 
43
- @@zoneNamePadText = '&ndash;'
43
+ @@zoneNamePadText = '&nbsp;' # '&ndash;'
44
44
 
45
45
  @@shapeRadius = 1000
46
46
  @@shapeDiam = 2*@@shapeRadius
47
47
 
48
- @@htmlTableLead = '<p style="font: normal 12px Verdana, Calibri, Geneva, sans-serif; color: #000000;">The Dashboard\'s panels, one per row.<br />Mousing over the table highlights the Dashboard\'s panels in the diagram.</p>'
48
+ @@htmlTableLead = <<-TABLELEAD
49
+ <p style="font: normal 12px Verdana, Calibri, Geneva, sans-serif; color: #000000;">
50
+ The Dashboard\'s panels, one per row.<br />
51
+ Mousing over the table highlights the<br />
52
+ Dashboard\'s panels in the diagram.
53
+ </p>
54
+ TABLELEAD
49
55
  @@htmlTableFNote = <<-TABLEFNOTE
50
56
  <p><span style="font: normal 12px Verdana, Calibri, Geneva, sans-serif; color: #000000;">
51
57
  Note: the Dashboard\'s \'x\', \'y\', \'w\', and \'h\' values are shown as coded in the<br />Tableau Workbook.
@@ -63,6 +69,7 @@ module Twb
63
69
  @htmlHead = ''
64
70
 
65
71
  @@htmlTableHead = "<table>\n<tr><th align='left'>Zone Name</th><th align='left'>Type</th><th>x</th><th>y</th><th>w</th><th>h</th><th>ID</th></tr>"
72
+ @@htmlTableHead = "<table>\n<tr><th align='left'>Zone Name</th><th align='left'>Type</th></tr>"
66
73
  @htmlTable = ''
67
74
  @svgHead = ''
68
75
  @svg = ''
@@ -226,7 +233,7 @@ end
226
233
  # <zones>
227
234
  # <zone
228
235
  zoneHead = @@zoneNamePadText * zoneRelDepth
229
- name = zoneHead + '|' + name
236
+ name = zoneHead + '|' + '&nbsp;' + name + '&nbsp;'
230
237
  return name
231
238
  end
232
239
 
@@ -294,10 +301,10 @@ end
294
301
  @htmlHead << "\n#LeftColumn {font: Verdana, Calibri, Geneva, sans-serif; font-size:1em; float:left; margin: 0 5px 0 0; vertical-align:top; text-align:left;}"
295
302
  @htmlHead << "\n#RightColumn {font: Verdana, Calibri, Geneva, sans-serif; font-size:1em; float:left; margin: 0 0 0 10px; vertical-align:top;}"
296
303
 
297
- @htmlHead << "\ntable { font-family: Verdana, Calibri, Geneva, sans-serif; font-size:.9em; border-collapse:collapse;padding:5 15 5 10; text-align:right;}"
298
- @htmlHead << "\ntable td, table th { font-family: Verdana, Calibri, Geneva, sans-serif; font-size:.9em; border:3px solid #B0C4DE; padding:0 0 0 0; }"
299
- @htmlHead << "\ntable th { font-family: Verdana, Calibri, Geneva, sans-serif; font-size:.9em; font-size:.8em; background-color:lightgrey; color:black; }"
300
- @htmlHead << "\ntable tr.alt td { font-family: Verdana, Calibri, Geneva, sans-serif; font-size:.9em; border:1px solid #B0C4DE; color:#000; background-color:#EAF2D3; }"
304
+ @htmlHead << "\ntable { font-family: Verdana, Calibri, Geneva, sans-serif; font-size:.9em; border-collapse:collapse; padding: 0px 10px 0px 10px; text-align:left;}"
305
+ @htmlHead << "\ntable td, table th { font-family: Verdana, Calibri, Geneva, sans-serif; font-size:.9em; border:3px solid #B0C4DE; padding: 0px 10px 0px 10px; text-align: left; }"
306
+ @htmlHead << "\ntable th { font-family: Verdana, Calibri, Geneva, sans-serif; font-size:.9em; font-size:.8em; padding: 0px 10px 0px 10px; background-color:lightgrey; color:black; }"
307
+ @htmlHead << "\ntable tr.alt td { font-family: Verdana, Calibri, Geneva, sans-serif; font-size:.9em; border:1px solid #B0C4DE; padding: 0px 10px 0px 10px; background-color:#EAF2D3; color:#000; text-align: left;}"
301
308
 
302
309
  @htmlHead << "\n</style>"
303
310
  @htmlHead << "\n<script>\n"
@@ -363,7 +370,7 @@ end
363
370
  dhtml << @@htmlTableHead
364
371
  dhtml << @htmlTable
365
372
  dhtml << ('</table>')
366
- dhtml << @@htmlTableFNote
373
+ # dhtml << @@htmlTableFNote
367
374
  dhtml << '</div>'
368
375
  end
369
376
  dhtml << ('</BODY>')
@@ -462,13 +469,13 @@ end
462
469
  end
463
470
  @svg += "\n</g>\n"
464
471
  @htmlTable += "\n<tr style=\"cursor: pointer;\" onMouseOver=\"highlightDashComponent('#{id}-:-#{thcnt}')\" onMouseOut=\"resetDashComponent('#{id}-:-#{thcnt}')\">"
465
- @htmlTable += " <td style='text-align: left;'>#{zoneName}</td>"
466
- @htmlTable += " <td style='text-align: left;'>#{type}</td>"
467
- @htmlTable += " <td>#{x.to_s.reverse.gsub(/...(?=.)/,'\&,').reverse}</td>"
468
- @htmlTable += " <td>#{y.to_s.reverse.gsub(/...(?=.)/,'\&,').reverse}</td>"
469
- @htmlTable += " <td>#{w.to_s.reverse.gsub(/...(?=.)/,'\&,').reverse}</td>"
470
- @htmlTable += " <td>#{h.to_s.reverse.gsub(/...(?=.)/,'\&,').reverse}</td>"
471
- @htmlTable += " <td>#{id.gsub('-:-','.')}.#{thcnt}</td>"
472
+ @htmlTable += " <td>#{zoneName}</td>"
473
+ @htmlTable += " <td>#{type}</td>"
474
+ # @htmlTable += " <td>#{x.to_s.reverse.gsub(/...(?=.)/,'\&,').reverse}</td>"
475
+ # @htmlTable += " <td>#{y.to_s.reverse.gsub(/...(?=.)/,'\&,').reverse}</td>"
476
+ # @htmlTable += " <td>#{w.to_s.reverse.gsub(/...(?=.)/,'\&,').reverse}</td>"
477
+ # @htmlTable += " <td>#{h.to_s.reverse.gsub(/...(?=.)/,'\&,').reverse}</td>"
478
+ # @htmlTable += " <td>#{id.gsub('-:-','.')}.#{thcnt}</td>"
472
479
  @htmlTable += "</tr>"
473
480
  return @htmlTable
474
481
  end # def recordZone
@@ -565,5 +572,5 @@ end
565
572
  end
566
573
 
567
574
  end
568
-
569
- end
575
+
576
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: twb
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.2
4
+ version: 0.5.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: