Class: Risu::Templates::MSUpdateSummary

Inherits:
Base::TemplateBase show all
Defined in:
lib/risu/templates/ms_update_summary.rb

Instance Attribute Summary

Attributes inherited from Base::TemplateBase

#output, #template_info

Instance Method Summary collapse

Methods inherited from Base::TemplateBase

inherited

Constructor Details

#initializeMSUpdateSummary

Returns a new instance of MSUpdateSummary.



28
29
30
31
32
33
34
35
36
37
# File 'lib/risu/templates/ms_update_summary.rb', line 28

def initialize
	@template_info =
	{
		:name => "ms_update_summary",
		:author => "hammackj",
		:version => "0.0.2",
		:renderer => "PDF",
		:description => "Generates a Microsoft Update Summary Report"
	}
end

Instance Method Details

#render(output) ⇒ Object



41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
# File 'lib/risu/templates/ms_update_summary.rb', line 41

def render output
	output.text Report.classification.upcase, :align => :center
	output.text "\n"

	output.font_size(22) { output.text Report.title, :align => :center }
	output.font_size(18) {
		output.text "Microsoft Update Summary", :align => :center
		output.text "\n"
		output.text "This report was prepared by\n#{Report.author}", :align => :center
	}

	output.text "\n\n\n"

	output.font_size(12)

	results = Array.new

	headers = ["Hostname","Operating System", "Windows Update Status"]
	header_widths = {0 => 108, 1 => 264, 2 => 140}

	Item.ms_update.each do |item|
		host = Host.find_by_id(item.host_id)

		if host == nil
			next
		end

		row = Array.new
		row.push(host.name)
		row.push(host.os)

		if item.plugin_output =~ /'Automatic Updates' are disabled/
			row.push("Disabled")
		else
			row.push("Enabled")
		end

		results.push(row)
	end

	output.table([headers] + results, :header => true, :column_widths => header_widths, :row_colors => ['FFFFFF', '336699']) do
		row(0).style(:font_style => :bold, :background_color => 'CCCCCC')
		cells.borders = [:top, :bottom, :left, :right]
	end

end