comparison api/Exporters/WarFoundryHtmlExporter.cs @ 132:e9c415839462

Re #68: Add "export" of army * Add total to title and points value to units
author IBBoard <dev@ibboard.co.uk>
date Tue, 01 Sep 2009 17:32:27 +0000
parents 5145b7c61ae0
children 57f7b80757ea
comparison
equal deleted inserted replaced
131:5145b7c61ae0 132:e9c415839462
5 using System; 5 using System;
6 using System.Collections.Generic; 6 using System.Collections.Generic;
7 using System.IO; 7 using System.IO;
8 using System.Xml; 8 using System.Xml;
9 using System.Xml.Schema; 9 using System.Xml.Schema;
10 using IBBoard.Lang;
10 using IBBoard.WarFoundry.API.Objects; 11 using IBBoard.WarFoundry.API.Objects;
11 12
12 namespace IBBoard.WarFoundry.API.Exporters 13 namespace IBBoard.WarFoundry.API.Exporters
13 { 14 {
14 /// <summary> 15 /// <summary>
45 head.AppendChild(title); 46 head.AppendChild(title);
46 title.InnerXml = army.Name; 47 title.InnerXml = army.Name;
47 XmlElement body = doc.CreateElement("body"); 48 XmlElement body = doc.CreateElement("body");
48 html.AppendChild(body); 49 html.AppendChild(body);
49 XmlElement header = doc.CreateElement("h1"); 50 XmlElement header = doc.CreateElement("h1");
50 header.InnerText = army.Name; 51 header.InnerText = Translation.GetTranslation("armyHtmlOutputBodyHeader", "{0} - {1}pts", army.Name, army.PointsTotal);
51 body.AppendChild(header); 52 body.AppendChild(header);
52 53
53 foreach (XmlElement table in CreateTables(army, doc)) 54 foreach (XmlElement table in CreateTables(army, doc))
54 { 55 {
55 body.AppendChild(table); 56 body.AppendChild(table);
101 } 102 }
102 103
103 XmlElement notes = doc.CreateElement("th"); 104 XmlElement notes = doc.CreateElement("th");
104 notes.InnerText = "Notes"; 105 notes.InnerText = "Notes";
105 headerRow.AppendChild(notes); 106 headerRow.AppendChild(notes);
107
108 XmlElement points = doc.CreateElement("th");
109 points.InnerText = "Points";
110 headerRow.AppendChild(points);
111
106 return table; 112 return table;
107 } 113 }
108 114
109 private XmlElement CreateUnitRow(Unit unit, XmlDocument doc) 115 private XmlElement CreateUnitRow(Unit unit, XmlDocument doc)
110 { 116 {
117 { 123 {
118 XmlElement statCell = doc.CreateElement("td"); 124 XmlElement statCell = doc.CreateElement("td");
119 statCell.InnerText = stat.SlotValueString; 125 statCell.InnerText = stat.SlotValueString;
120 row.AppendChild(statCell); 126 row.AppendChild(statCell);
121 } 127 }
128
129 XmlElement notes = doc.CreateElement("td");
130 notes.InnerText = "TODO: Notes here (equipment etc)";
131 row.AppendChild(notes);
132
133 XmlElement points = doc.CreateElement("td");
134 points.InnerText = unit.PointsValue.ToString();
135 row.AppendChild(points);
122 136
123 return row; 137 return row;
124 } 138 }
125 } 139 }
126 } 140 }