taskjuggler 0.0.3 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (495) hide show
  1. data/benchmarks/UTF-8-Strings.rb +58 -0
  2. data/data/css/tjmanual.css +52 -0
  3. data/data/css/tjreport.css +195 -0
  4. data/data/icons/details.png +0 -0
  5. data/data/icons/flag-green.png +0 -0
  6. data/data/icons/flag-red.png +0 -0
  7. data/data/icons/flag-yellow.png +0 -0
  8. data/data/icons/resource.png +0 -0
  9. data/data/icons/resourcegroup.png +0 -0
  10. data/data/icons/task.png +0 -0
  11. data/data/icons/taskgroup.png +0 -0
  12. data/data/icons/trend-down.png +0 -0
  13. data/data/icons/trend-flat.png +0 -0
  14. data/data/icons/trend-up.png +0 -0
  15. data/data/scripts/wz_tooltip.js +1301 -0
  16. data/doc/classes/AppConfig.html +298 -230
  17. data/doc/classes/Arguments.html +8 -8
  18. data/doc/classes/Object.html +7 -7
  19. data/doc/classes/String.html +89 -89
  20. data/doc/classes/TaskJuggler.html +396 -264
  21. data/doc/classes/TaskJuggler/Account.html +18 -18
  22. data/doc/classes/TaskJuggler/AccountAttribute.html +26 -26
  23. data/doc/classes/TaskJuggler/AccountScenario.html +12 -12
  24. data/doc/classes/TaskJuggler/Allocation.html +30 -30
  25. data/doc/classes/TaskJuggler/AllocationAttribute.html +26 -26
  26. data/doc/classes/TaskJuggler/AttributeBase.html +227 -115
  27. data/doc/classes/TaskJuggler/AttributeDefinition.html +6 -6
  28. data/doc/classes/TaskJuggler/BatchProcessor.html +117 -83
  29. data/doc/classes/TaskJuggler/Booking.html +18 -18
  30. data/doc/classes/TaskJuggler/BookingListAttribute.html +26 -26
  31. data/doc/classes/TaskJuggler/BooleanAttribute.html +26 -26
  32. data/doc/classes/TaskJuggler/CSVFile.html +24 -24
  33. data/doc/classes/TaskJuggler/CellSettingPattern.html +201 -0
  34. data/doc/classes/TaskJuggler/CellSettingPatternList.html +253 -0
  35. data/doc/classes/TaskJuggler/Charge.html +18 -18
  36. data/doc/classes/TaskJuggler/ChargeListAttribute.html +20 -20
  37. data/doc/classes/TaskJuggler/ChargeSet.html +37 -37
  38. data/doc/classes/TaskJuggler/ChargeSetListAttribute.html +26 -26
  39. data/doc/classes/TaskJuggler/ColumnListAttribute.html +20 -20
  40. data/doc/classes/TaskJuggler/ColumnTable.html +40 -40
  41. data/doc/classes/TaskJuggler/DateAttribute.html +54 -15
  42. data/doc/classes/TaskJuggler/DefinitionListAttribute.html +10 -10
  43. data/doc/classes/TaskJuggler/DependencyListAttribute.html +47 -47
  44. data/doc/classes/TaskJuggler/DurationAttribute.html +30 -30
  45. data/doc/classes/TaskJuggler/FixnumAttribute.html +20 -20
  46. data/doc/classes/TaskJuggler/FlagListAttribute.html +43 -43
  47. data/doc/classes/TaskJuggler/FloatAttribute.html +30 -30
  48. data/doc/classes/TaskJuggler/FormatListAttribute.html +21 -21
  49. data/doc/classes/TaskJuggler/GanttChart.html +48 -48
  50. data/doc/classes/TaskJuggler/GanttContainer.html +42 -42
  51. data/doc/classes/TaskJuggler/GanttHeader.html +12 -12
  52. data/doc/classes/TaskJuggler/GanttHeaderScaleItem.html +12 -12
  53. data/doc/classes/TaskJuggler/GanttLine.html +24 -24
  54. data/doc/classes/TaskJuggler/GanttLoadStack.html +18 -18
  55. data/doc/classes/TaskJuggler/GanttMilestone.html +42 -42
  56. data/doc/classes/TaskJuggler/GanttRouter.html +24 -24
  57. data/doc/classes/TaskJuggler/GanttTaskBar.html +42 -42
  58. data/doc/classes/TaskJuggler/HTMLDocument.html +13 -13
  59. data/doc/classes/TaskJuggler/HTMLGraphics.html +12 -12
  60. data/doc/classes/TaskJuggler/Interval.html +57 -57
  61. data/doc/classes/TaskJuggler/IntervalListAttribute.html +47 -47
  62. data/doc/classes/TaskJuggler/JobInfo.html +68 -12
  63. data/doc/classes/TaskJuggler/Journal.html +266 -20
  64. data/doc/classes/TaskJuggler/JournalEntry.html +79 -23
  65. data/doc/classes/TaskJuggler/JournalEntryList.html +454 -0
  66. data/doc/classes/TaskJuggler/KeywordArray.html +10 -10
  67. data/doc/classes/TaskJuggler/KeywordDocumentation.html +171 -170
  68. data/doc/classes/TaskJuggler/Limits.html +36 -36
  69. data/doc/classes/TaskJuggler/Limits/Limit.html +30 -30
  70. data/doc/classes/TaskJuggler/LimitsAttribute.html +40 -40
  71. data/doc/classes/TaskJuggler/ListAttributeBase.html +20 -20
  72. data/doc/classes/TaskJuggler/Log.html +145 -107
  73. data/doc/classes/TaskJuggler/LogicalAttribute.html +65 -36
  74. data/doc/classes/TaskJuggler/LogicalExpression.html +61 -24
  75. data/doc/classes/TaskJuggler/LogicalExpressionAttribute.html +20 -20
  76. data/doc/classes/TaskJuggler/LogicalFlag.html +31 -51
  77. data/doc/classes/TaskJuggler/LogicalFunction.html +64 -53
  78. data/doc/classes/TaskJuggler/LogicalOperation.html +103 -55
  79. data/doc/classes/TaskJuggler/Macro.html +6 -6
  80. data/doc/classes/TaskJuggler/MacroParser.html +36 -36
  81. data/doc/classes/TaskJuggler/MacroTable.html +37 -37
  82. data/doc/classes/TaskJuggler/Message.html +12 -12
  83. data/doc/classes/TaskJuggler/MessageHandler.html +32 -20
  84. data/doc/classes/TaskJuggler/Navigator.html +110 -46
  85. data/doc/classes/TaskJuggler/NavigatorElement.html +449 -0
  86. data/doc/classes/TaskJuggler/OnShiftCache.html +24 -24
  87. data/doc/classes/TaskJuggler/Project.html +1158 -893
  88. data/doc/classes/TaskJuggler/ProjectFileParser.html +94 -91
  89. data/doc/classes/TaskJuggler/PropertyAttribute.html +20 -20
  90. data/doc/classes/TaskJuggler/PropertyList.html +225 -155
  91. data/doc/classes/TaskJuggler/PropertySet.html +375 -332
  92. data/doc/classes/TaskJuggler/PropertyTreeNode.html +750 -510
  93. data/doc/classes/TaskJuggler/Query.html +404 -139
  94. data/doc/classes/TaskJuggler/{RTPNavigator.html → RTFNavigator.html} +57 -56
  95. data/doc/classes/TaskJuggler/RTFQuery.html +343 -0
  96. data/doc/classes/TaskJuggler/{RTPReport.html → RTFReport.html} +70 -67
  97. data/doc/classes/TaskJuggler/RealFormat.html +18 -18
  98. data/doc/classes/TaskJuggler/RealFormatAttribute.html +10 -10
  99. data/doc/classes/TaskJuggler/ReferenceAttribute.html +107 -40
  100. data/doc/classes/TaskJuggler/RemoteServiceManager.html +335 -0
  101. data/doc/classes/TaskJuggler/Report.html +66 -64
  102. data/doc/classes/TaskJuggler/ReportBase.html +112 -123
  103. data/doc/classes/TaskJuggler/ReportContext.html +43 -38
  104. data/doc/classes/TaskJuggler/ReportServer.html +320 -0
  105. data/doc/classes/TaskJuggler/ReportTable.html +42 -42
  106. data/doc/classes/TaskJuggler/ReportTableCell.html +221 -129
  107. data/doc/classes/TaskJuggler/ReportTableColumn.html +27 -27
  108. data/doc/classes/TaskJuggler/ReportTableLegend.html +24 -24
  109. data/doc/classes/TaskJuggler/ReportTableLine.html +126 -80
  110. data/doc/classes/TaskJuggler/Resource.html +12 -12
  111. data/doc/classes/TaskJuggler/ResourceListAttribute.html +82 -47
  112. data/doc/classes/TaskJuggler/ResourceListRE.html +43 -39
  113. data/doc/classes/TaskJuggler/ResourceScenario.html +413 -321
  114. data/doc/classes/TaskJuggler/RichText.html +64 -248
  115. data/doc/classes/TaskJuggler/RichTextAttribute.html +94 -30
  116. data/doc/classes/TaskJuggler/RichTextDocument.html +87 -85
  117. data/doc/classes/TaskJuggler/RichTextElement.html +456 -363
  118. data/doc/classes/TaskJuggler/RichTextException.html +13 -13
  119. data/doc/classes/TaskJuggler/{RichTextProtocolExample.html → RichTextFunctionExample.html} +64 -63
  120. data/doc/classes/TaskJuggler/{RichTextProtocolHandler.html → RichTextFunctionHandler.html} +42 -36
  121. data/doc/classes/TaskJuggler/RichTextIntermediate.html +563 -0
  122. data/doc/classes/TaskJuggler/RichTextParser.html +54 -51
  123. data/doc/classes/TaskJuggler/RichTextScanner.html +94 -92
  124. data/doc/classes/TaskJuggler/RichTextSnip.html +96 -60
  125. data/doc/classes/TaskJuggler/RichTextSyntaxRules.html +369 -227
  126. data/doc/classes/TaskJuggler/Scenario.html +6 -6
  127. data/doc/classes/TaskJuggler/ScenarioData.html +37 -37
  128. data/doc/classes/TaskJuggler/ScenarioListAttribute.html +31 -31
  129. data/doc/classes/TaskJuggler/Scoreboard.html +66 -66
  130. data/doc/classes/TaskJuggler/Shift.html +18 -18
  131. data/doc/classes/TaskJuggler/ShiftAssignment.html +54 -54
  132. data/doc/classes/TaskJuggler/ShiftAssignments.html +78 -78
  133. data/doc/classes/TaskJuggler/ShiftAssignmentsAttribute.html +40 -40
  134. data/doc/classes/TaskJuggler/ShiftScenario.html +24 -24
  135. data/doc/classes/TaskJuggler/SortListAttribute.html +22 -22
  136. data/doc/classes/TaskJuggler/SourceFileInfo.html +12 -12
  137. data/doc/classes/TaskJuggler/StringAttribute.html +30 -30
  138. data/doc/classes/TaskJuggler/SymbolAttribute.html +20 -20
  139. data/doc/classes/TaskJuggler/SyntaxReference.html +42 -42
  140. data/doc/classes/TaskJuggler/TOCEntry.html +12 -12
  141. data/doc/classes/TaskJuggler/TSResourceRecord.html +197 -0
  142. data/doc/classes/TaskJuggler/TSTaskRecord.html +215 -0
  143. data/doc/classes/TaskJuggler/TableColumnDefinition.html +64 -43
  144. data/doc/classes/TaskJuggler/TableOfContents.html +18 -18
  145. data/doc/classes/TaskJuggler/TableReport.html +447 -468
  146. data/doc/classes/TaskJuggler/Task.html +12 -12
  147. data/doc/classes/TaskJuggler/TaskDependency.html +12 -12
  148. data/doc/classes/TaskJuggler/TaskListAttribute.html +47 -47
  149. data/doc/classes/TaskJuggler/TaskListRE.html +43 -39
  150. data/doc/classes/TaskJuggler/TaskScenario.html +529 -282
  151. data/doc/classes/TaskJuggler/TextParser.html +215 -194
  152. data/doc/classes/TaskJuggler/TextParser/Pattern.html +97 -97
  153. data/doc/classes/TaskJuggler/TextParser/Rule.html +84 -84
  154. data/doc/classes/TaskJuggler/TextParser/StackElement.html +16 -15
  155. data/doc/classes/TaskJuggler/TextParser/TextParserResultArray.html +12 -12
  156. data/doc/classes/TaskJuggler/TextParser/TokenDoc.html +6 -6
  157. data/doc/classes/TaskJuggler/TextReport.html +77 -74
  158. data/doc/classes/TaskJuggler/TextScanner.html +294 -281
  159. data/doc/classes/TaskJuggler/TextScanner/BufferStreamHandle.html +70 -70
  160. data/doc/classes/TaskJuggler/TextScanner/FileStreamHandle.html +59 -60
  161. data/doc/classes/TaskJuggler/TextScanner/StreamHandle.html +12 -12
  162. data/doc/classes/TaskJuggler/TimeSheetReport.html +406 -0
  163. data/doc/classes/TaskJuggler/TjException.html +6 -6
  164. data/doc/classes/TaskJuggler/TjTime.html +522 -513
  165. data/doc/classes/TaskJuggler/TjpExample.html +25 -25
  166. data/doc/classes/TaskJuggler/TjpExportRE.html +21 -24
  167. data/doc/classes/TaskJuggler/TjpSyntaxRules.html +6177 -4318
  168. data/doc/classes/TaskJuggler/UserManual.html +212 -213
  169. data/doc/classes/TaskJuggler/WorkingHours.html +49 -49
  170. data/doc/classes/TaskJuggler/WorkingHoursAttribute.html +53 -53
  171. data/doc/classes/TaskJuggler/XMLBlob.html +21 -21
  172. data/doc/classes/TaskJuggler/XMLComment.html +21 -21
  173. data/doc/classes/TaskJuggler/XMLDocument.html +27 -26
  174. data/doc/classes/TaskJuggler/XMLElement.html +86 -50
  175. data/doc/classes/TaskJuggler/XMLNamedText.html +11 -11
  176. data/doc/classes/TaskJuggler/XMLText.html +36 -36
  177. data/doc/files/COPYING.html +1 -1
  178. data/doc/files/README.html +1 -1
  179. data/doc/files/lib/AccountScenario_rb.html +3 -2
  180. data/doc/files/lib/Account_rb.html +3 -2
  181. data/doc/files/lib/Allocation_rb.html +3 -2
  182. data/doc/files/lib/AppConfig_rb.html +5 -2
  183. data/doc/files/lib/AttributeBase_rb.html +3 -2
  184. data/doc/files/lib/AttributeDefinition_rb.html +3 -2
  185. data/doc/files/lib/Attributes_rb.html +3 -2
  186. data/doc/files/lib/BatchProcessor_rb.html +4 -3
  187. data/doc/files/lib/Booking_rb.html +3 -2
  188. data/doc/files/lib/ChargeSet_rb.html +3 -2
  189. data/doc/files/lib/Charge_rb.html +3 -2
  190. data/doc/files/lib/HTMLDocument_rb.html +3 -2
  191. data/doc/files/lib/Interval_rb.html +3 -2
  192. data/doc/files/lib/Journal_rb.html +4 -3
  193. data/doc/files/lib/KeywordArray_rb.html +3 -2
  194. data/doc/files/lib/KeywordDocumentation_rb.html +3 -2
  195. data/doc/files/lib/Limits_rb.html +3 -2
  196. data/doc/files/lib/Log_rb.html +3 -2
  197. data/doc/files/lib/LogicalExpression_rb.html +3 -2
  198. data/doc/files/lib/LogicalFunction_rb.html +3 -2
  199. data/doc/files/lib/LogicalOperation_rb.html +3 -2
  200. data/doc/files/lib/MacroParser_rb.html +3 -2
  201. data/doc/files/lib/MacroTable_rb.html +3 -2
  202. data/doc/files/lib/MessageHandler_rb.html +3 -2
  203. data/doc/files/lib/Message_rb.html +3 -2
  204. data/doc/files/lib/ProjectFileParser_rb.html +7 -4
  205. data/doc/files/lib/Project_rb.html +3 -2
  206. data/doc/files/lib/PropertyList_rb.html +3 -2
  207. data/doc/files/lib/PropertySet_rb.html +3 -2
  208. data/doc/files/lib/PropertyTreeNode_rb.html +3 -2
  209. data/doc/files/lib/Query_rb.html +3 -2
  210. data/doc/files/lib/{RTPNavigator_rb.html → RTFNavigator_rb.html} +8 -7
  211. data/doc/files/lib/RTFQuery_rb.html +121 -0
  212. data/doc/files/lib/{RTPReport_rb.html → RTFReport_rb.html} +8 -7
  213. data/doc/files/lib/RealFormat_rb.html +3 -2
  214. data/doc/files/lib/RemoteServiceManager_rb.html +117 -0
  215. data/doc/files/lib/ReportServer_rb.html +107 -0
  216. data/doc/files/lib/ResourceScenario_rb.html +3 -2
  217. data/doc/files/lib/Resource_rb.html +3 -2
  218. data/doc/files/lib/RichTextDocument_rb.html +4 -3
  219. data/doc/files/lib/RichTextElement_rb.html +3 -2
  220. data/doc/files/lib/{RichTextProtocolExample_rb.html → RichTextFunctionExample_rb.html} +8 -7
  221. data/doc/files/lib/{RichTextProtocolHandler_rb.html → RichTextFunctionHandler_rb.html} +7 -6
  222. data/doc/files/lib/RichTextParser_rb.html +3 -2
  223. data/doc/files/lib/RichTextScanner_rb.html +3 -2
  224. data/doc/files/lib/RichTextSnip_rb.html +3 -2
  225. data/doc/files/lib/RichTextSyntaxRules_rb.html +3 -2
  226. data/doc/files/lib/RichText_rb.html +3 -2
  227. data/doc/files/lib/ScenarioData_rb.html +3 -2
  228. data/doc/files/lib/Scenario_rb.html +3 -2
  229. data/doc/files/lib/Scoreboard_rb.html +3 -2
  230. data/doc/files/lib/ShiftAssignments_rb.html +3 -2
  231. data/doc/files/lib/ShiftScenario_rb.html +3 -2
  232. data/doc/files/lib/Shift_rb.html +3 -2
  233. data/doc/files/lib/SourceFileInfo_rb.html +3 -2
  234. data/doc/files/lib/SyntaxReference_rb.html +3 -2
  235. data/doc/files/lib/TOCEntry_rb.html +3 -2
  236. data/doc/files/lib/TableColumnDefinition_rb.html +3 -2
  237. data/doc/files/lib/TableOfContents_rb.html +3 -2
  238. data/doc/files/lib/TaskDependency_rb.html +3 -2
  239. data/doc/files/lib/TaskJuggler_rb.html +7 -2
  240. data/doc/files/lib/TaskScenario_rb.html +3 -2
  241. data/doc/files/lib/Task_rb.html +3 -2
  242. data/doc/files/lib/TextParser/Pattern_rb.html +4 -3
  243. data/doc/files/lib/TextParser/Rule_rb.html +4 -3
  244. data/doc/files/lib/TextParser/StackElement_rb.html +4 -3
  245. data/doc/files/lib/TextParser/TokenDoc_rb.html +4 -3
  246. data/doc/files/lib/TextParser_rb.html +3 -2
  247. data/doc/files/lib/TextScanner_rb.html +3 -2
  248. data/doc/files/lib/Tj3Config_rb.html +3 -2
  249. data/doc/files/lib/TjException_rb.html +3 -2
  250. data/doc/files/lib/TjTime_rb.html +3 -2
  251. data/doc/files/lib/TjpExample_rb.html +3 -2
  252. data/doc/files/lib/TjpSyntaxRules_rb.html +3 -2
  253. data/doc/files/lib/UTF8String_rb.html +14 -6
  254. data/doc/files/lib/UserManual_rb.html +6 -3
  255. data/doc/files/lib/WorkingHours_rb.html +3 -2
  256. data/doc/files/lib/XMLDocument_rb.html +3 -2
  257. data/doc/files/lib/XMLElement_rb.html +3 -2
  258. data/doc/files/lib/deep_copy_rb.html +3 -2
  259. data/doc/files/lib/reports/CSVFile_rb.html +3 -2
  260. data/doc/files/lib/reports/ColumnTable_rb.html +3 -2
  261. data/doc/files/lib/reports/GanttChart_rb.html +3 -2
  262. data/doc/files/lib/reports/GanttContainer_rb.html +3 -2
  263. data/doc/files/lib/reports/GanttHeaderScaleItem_rb.html +3 -2
  264. data/doc/files/lib/reports/GanttHeader_rb.html +3 -2
  265. data/doc/files/lib/reports/GanttLine_rb.html +3 -2
  266. data/doc/files/lib/reports/GanttLoadStack_rb.html +3 -2
  267. data/doc/files/lib/reports/GanttMilestone_rb.html +3 -2
  268. data/doc/files/lib/reports/GanttRouter_rb.html +3 -2
  269. data/doc/files/lib/reports/GanttTaskBar_rb.html +3 -2
  270. data/doc/files/lib/reports/HTMLGraphics_rb.html +3 -2
  271. data/doc/files/lib/reports/Navigator_rb.html +3 -2
  272. data/doc/files/lib/reports/ReportBase_rb.html +3 -2
  273. data/doc/files/lib/reports/ReportContext_rb.html +3 -2
  274. data/doc/files/lib/reports/ReportTableCell_rb.html +3 -2
  275. data/doc/files/lib/reports/ReportTableColumn_rb.html +3 -2
  276. data/doc/files/lib/reports/ReportTableLegend_rb.html +3 -2
  277. data/doc/files/lib/reports/ReportTableLine_rb.html +3 -2
  278. data/doc/files/lib/reports/ReportTable_rb.html +3 -2
  279. data/doc/files/lib/reports/Report_rb.html +7 -2
  280. data/doc/files/lib/reports/ResourceListRE_rb.html +3 -2
  281. data/doc/files/lib/reports/TableReport_rb.html +3 -2
  282. data/doc/files/lib/reports/TaskListRE_rb.html +3 -2
  283. data/doc/files/lib/reports/TextReport_rb.html +4 -3
  284. data/doc/files/lib/reports/TimeSheetReport_rb.html +117 -0
  285. data/doc/files/lib/reports/TjpExportRE_rb.html +3 -2
  286. data/doc/files/lib/taskjuggler3_rb.html +94 -77
  287. data/doc/files/lib/tj3client_rb.html +280 -0
  288. data/doc/files/lib/tj3man_rb.html +10 -9
  289. data/doc/fr_class_index.html +27 -5
  290. data/doc/fr_file_index.html +15 -7
  291. data/doc/fr_method_index.html +1312 -1020
  292. data/examples/tutorial.tjp +113 -14
  293. data/gem_spec.rb +2 -1
  294. data/lib/Account.rb +1 -1
  295. data/lib/AccountScenario.rb +1 -1
  296. data/lib/Allocation.rb +1 -1
  297. data/lib/AppConfig.rb +23 -10
  298. data/lib/AttributeBase.rb +34 -6
  299. data/lib/AttributeDefinition.rb +1 -1
  300. data/lib/Attributes.rb +51 -16
  301. data/lib/BatchProcessor.rb +204 -77
  302. data/lib/Booking.rb +1 -1
  303. data/lib/Charge.rb +1 -1
  304. data/lib/ChargeSet.rb +1 -1
  305. data/lib/HTMLDocument.rb +2 -2
  306. data/lib/Interval.rb +1 -1
  307. data/lib/Journal.rb +231 -9
  308. data/lib/KeywordArray.rb +1 -1
  309. data/lib/KeywordDocumentation.rb +6 -4
  310. data/lib/Limits.rb +1 -1
  311. data/lib/Log.rb +8 -1
  312. data/lib/LogicalExpression.rb +14 -13
  313. data/lib/LogicalFunction.rb +88 -14
  314. data/lib/LogicalOperation.rb +124 -53
  315. data/lib/MacroParser.rb +1 -1
  316. data/lib/MacroTable.rb +2 -2
  317. data/lib/Message.rb +1 -1
  318. data/lib/MessageHandler.rb +7 -3
  319. data/lib/Project.rb +93 -14
  320. data/lib/ProjectFileParser.rb +30 -15
  321. data/lib/PropertyList.rb +103 -36
  322. data/lib/PropertySet.rb +22 -10
  323. data/lib/PropertyTreeNode.rb +120 -15
  324. data/lib/Query.rb +119 -48
  325. data/lib/{RTPNavigator.rb → RTFNavigator.rb} +11 -10
  326. data/lib/RTFQuery.rb +166 -0
  327. data/lib/{RTPReport.rb → RTFReport.rb} +11 -8
  328. data/lib/RealFormat.rb +1 -1
  329. data/lib/RemoteServiceManager.rb +80 -0
  330. data/lib/ReportServer.rb +66 -0
  331. data/lib/Resource.rb +1 -1
  332. data/lib/ResourceScenario.rb +48 -19
  333. data/lib/RichText.rb +98 -41
  334. data/lib/RichTextDocument.rb +10 -8
  335. data/lib/RichTextElement.rb +72 -28
  336. data/lib/{RichTextProtocolExample.rb → RichTextFunctionExample.rb} +8 -7
  337. data/lib/{RichTextProtocolHandler.rb → RichTextFunctionHandler.rb} +12 -14
  338. data/lib/RichTextParser.rb +6 -3
  339. data/lib/RichTextScanner.rb +91 -19
  340. data/lib/RichTextSnip.rb +8 -3
  341. data/lib/RichTextSyntaxRules.rb +103 -45
  342. data/lib/Scenario.rb +1 -1
  343. data/lib/ScenarioData.rb +2 -2
  344. data/lib/Scoreboard.rb +1 -1
  345. data/lib/Shift.rb +1 -1
  346. data/lib/ShiftAssignments.rb +1 -1
  347. data/lib/ShiftScenario.rb +1 -1
  348. data/lib/SourceFileInfo.rb +1 -1
  349. data/lib/SyntaxReference.rb +2 -2
  350. data/lib/TOCEntry.rb +1 -1
  351. data/lib/TableColumnDefinition.rb +59 -16
  352. data/lib/TableOfContents.rb +1 -1
  353. data/lib/Task.rb +1 -1
  354. data/lib/TaskDependency.rb +1 -1
  355. data/lib/TaskJuggler.rb +31 -8
  356. data/lib/TaskScenario.rb +165 -16
  357. data/lib/TextParser.rb +36 -22
  358. data/lib/TextParser/Pattern.rb +3 -3
  359. data/lib/TextParser/Rule.rb +2 -2
  360. data/lib/TextParser/StackElement.rb +4 -3
  361. data/lib/TextParser/TokenDoc.rb +2 -2
  362. data/lib/TextScanner.rb +52 -37
  363. data/lib/Tj3Config.rb +6 -5
  364. data/lib/TjException.rb +1 -1
  365. data/lib/TjTime.rb +12 -3
  366. data/lib/TjpExample.rb +1 -1
  367. data/lib/TjpSyntaxRules.rb +1044 -150
  368. data/lib/UTF8String.rb +2 -1
  369. data/lib/UserManual.rb +18 -70
  370. data/lib/WorkingHours.rb +3 -3
  371. data/lib/XMLDocument.rb +3 -2
  372. data/lib/XMLElement.rb +6 -1
  373. data/lib/deep_copy.rb +1 -1
  374. data/lib/reports/CSVFile.rb +1 -1
  375. data/lib/reports/ColumnTable.rb +9 -9
  376. data/lib/reports/GanttChart.rb +1 -1
  377. data/lib/reports/GanttContainer.rb +1 -1
  378. data/lib/reports/GanttHeader.rb +1 -1
  379. data/lib/reports/GanttHeaderScaleItem.rb +1 -1
  380. data/lib/reports/GanttLine.rb +40 -40
  381. data/lib/reports/GanttLoadStack.rb +1 -1
  382. data/lib/reports/GanttMilestone.rb +1 -1
  383. data/lib/reports/GanttRouter.rb +1 -1
  384. data/lib/reports/GanttTaskBar.rb +1 -1
  385. data/lib/reports/HTMLGraphics.rb +1 -1
  386. data/lib/reports/Navigator.rb +149 -22
  387. data/lib/reports/Report.rb +115 -172
  388. data/lib/reports/ReportBase.rb +22 -27
  389. data/lib/reports/ReportContext.rb +29 -15
  390. data/lib/reports/ReportTable.rb +1 -1
  391. data/lib/reports/ReportTableCell.rb +120 -27
  392. data/lib/reports/ReportTableColumn.rb +3 -3
  393. data/lib/reports/ReportTableLegend.rb +1 -1
  394. data/lib/reports/ReportTableLine.rb +10 -2
  395. data/lib/reports/ResourceListRE.rb +5 -1
  396. data/lib/reports/TableReport.rb +237 -287
  397. data/lib/reports/TaskListRE.rb +5 -1
  398. data/lib/reports/TextReport.rb +7 -4
  399. data/lib/reports/TimeSheetReport.rb +233 -0
  400. data/lib/reports/TjpExportRE.rb +2 -2
  401. data/lib/taskjuggler3.rb +27 -11
  402. data/lib/tj3client.rb +110 -0
  403. data/lib/tj3man.rb +4 -4
  404. data/manual/Getting_Started +0 -50
  405. data/manual/How_To_Contribute +6 -13
  406. data/manual/Installation +102 -28
  407. data/manual/Intro +11 -1
  408. data/manual/Reporting_Bugs +23 -7
  409. data/manual/Rich_Text_Attributes +59 -6
  410. data/manual/TaskJuggler_2x_Migration +27 -0
  411. data/manual/The_TaskJuggler_Syntax +104 -0
  412. data/manual/Tutorial +10 -9
  413. data/prj_cfg.rb +8 -2
  414. data/tasks/csts.rake +1 -1
  415. data/tasks/manual.rake +5 -3
  416. data/test/MessageChecker.rb +1 -1
  417. data/test/TestSuite/HTML-Reports/Alerts.html +172 -0
  418. data/test/TestSuite/HTML-Reports/Alerts.tjp +77 -0
  419. data/test/TestSuite/HTML-Reports/CellText.html +758 -0
  420. data/test/TestSuite/HTML-Reports/CellText.tjp +75 -0
  421. data/test/TestSuite/HTML-Reports/ColumnPeriods.html +156 -0
  422. data/test/TestSuite/HTML-Reports/ColumnPeriods.tjp +44 -0
  423. data/test/TestSuite/HTML-Reports/IsOngoing.html +172 -0
  424. data/test/TestSuite/HTML-Reports/IsOngoing.tjp +34 -0
  425. data/test/TestSuite/HTML-Reports/LogicalFunctions.html +80 -0
  426. data/test/TestSuite/HTML-Reports/LogicalFunctions.tjp +20 -0
  427. data/test/TestSuite/HTML-Reports/Query.html +31 -0
  428. data/test/TestSuite/HTML-Reports/Query.tjp +28 -0
  429. data/test/TestSuite/HTML-Reports/Sorting.tjp +68 -0
  430. data/test/TestSuite/HTML-Reports/TimeSheet.tjp +69 -0
  431. data/test/TestSuite/HTML-Reports/UDAQuery.tjp +27 -0
  432. data/test/TestSuite/HTML-Reports/css/tjmanual.css +52 -0
  433. data/test/TestSuite/HTML-Reports/css/tjreport.css +195 -0
  434. data/test/TestSuite/HTML-Reports/depArrows.html +842 -0
  435. data/test/TestSuite/HTML-Reports/icons/details.png +0 -0
  436. data/test/TestSuite/HTML-Reports/icons/flag-green.png +0 -0
  437. data/test/TestSuite/HTML-Reports/icons/flag-red.png +0 -0
  438. data/test/TestSuite/HTML-Reports/icons/flag-yellow.png +0 -0
  439. data/test/TestSuite/HTML-Reports/icons/resource.png +0 -0
  440. data/test/TestSuite/HTML-Reports/icons/resourcegroup.png +0 -0
  441. data/test/TestSuite/HTML-Reports/icons/task.png +0 -0
  442. data/test/TestSuite/HTML-Reports/icons/taskgroup.png +0 -0
  443. data/test/TestSuite/HTML-Reports/reference.tjp +7 -8
  444. data/test/TestSuite/HTML-Reports/scripts/scripts/wz_tooltip.js +1301 -0
  445. data/test/TestSuite/HTML-Reports/scripts/wz_tooltip.js +1301 -0
  446. data/test/TestSuite/Scheduler/Correct/Mandatory.tjp +34 -0
  447. data/test/TestSuite/Syntax/Correct/Celltext.tjp +2 -1
  448. data/test/TestSuite/Syntax/Correct/Journal.tjp +2 -2
  449. data/test/TestSuite/Syntax/Correct/LogicalExpression.tjp +2 -1
  450. data/test/TestSuite/Syntax/Correct/LogicalFunction.tjp +20 -0
  451. data/test/TestSuite/Syntax/Correct/Query.tjp +18 -0
  452. data/test/TestSuite/Syntax/Correct/StatusSheet.tjp +45 -0
  453. data/test/TestSuite/Syntax/Correct/TimeSheet.tjp +49 -0
  454. data/test/TestSuite/Syntax/Correct/icons/details.png +0 -0
  455. data/test/TestSuite/Syntax/Correct/icons/flag-green.png +0 -0
  456. data/test/TestSuite/Syntax/Correct/icons/flag-red.png +0 -0
  457. data/test/TestSuite/Syntax/Correct/icons/flag-yellow.png +0 -0
  458. data/test/TestSuite/Syntax/Correct/icons/resource.png +0 -0
  459. data/test/TestSuite/Syntax/Correct/icons/resourcegroup.png +0 -0
  460. data/test/TestSuite/Syntax/Correct/icons/task.png +0 -0
  461. data/test/TestSuite/Syntax/Correct/icons/taskgroup.png +0 -0
  462. data/test/TestSuite/Syntax/Correct/scripts/wz_tooltip.js +1301 -0
  463. data/test/TestSuite/Syntax/Correct/tutorial.tjp +113 -14
  464. data/test/TestSuite/Syntax/Errors/macro_stack_overflow.tjp +28 -0
  465. data/test/TestSuite/Syntax/Errors/unsupported_token.tjp +12 -0
  466. data/test/all.rb +2 -2
  467. data/test/test_BatchProcessor.rb +42 -13
  468. data/test/test_CSV-Reports.rb +1 -1
  469. data/test/test_Journal.rb +176 -0
  470. data/test/test_Limits.rb +1 -1
  471. data/test/test_LogicalExpression.rb +14 -5
  472. data/test/test_MacroTable.rb +1 -1
  473. data/test/test_Project.rb +1 -1
  474. data/test/test_PropertySet.rb +1 -1
  475. data/test/test_Query.rb +1 -1
  476. data/test/test_RealFormat.rb +1 -1
  477. data/test/test_RichText.rb +30 -20
  478. data/test/test_Scheduler.rb +1 -1
  479. data/test/test_ShiftAssignments.rb +2 -2
  480. data/test/test_Syntax.rb +1 -1
  481. data/test/test_TextScanner.rb +1 -1
  482. data/test/test_TjTime.rb +1 -1
  483. data/test/test_TjpExample.rb +1 -1
  484. data/test/test_UTF8String.rb +1 -1
  485. data/test/test_WorkingHours.rb +1 -1
  486. data/test/test_deep_copy.rb +2 -2
  487. metadata +610 -532
  488. data/doc/files/lib/ms_test_rb.html +0 -90
  489. data/examples/ContactList.html +0 -1467
  490. data/examples/Deliveries.html +0 -485
  491. data/examples/Development.html +0 -2525
  492. data/examples/Overview.html +0 -747
  493. data/examples/Resource Graph.html +0 -616
  494. data/lib/ms_test.rb +0 -27
  495. data/test/TestSuite/HTML-Reports/reference-export.html +0 -187
data/lib/PropertySet.rb CHANGED
@@ -3,7 +3,7 @@
3
3
  #
4
4
  # = PropertySet.rb -- The TaskJuggler III Project Management Software
5
5
  #
6
- # Copyright (c) 2006, 2007, 2008, 2009 by Chris Schlaeger <cs@kde.org>
6
+ # Copyright (c) 2006, 2007, 2008, 2009, 2010 by Chris Schlaeger <cs@kde.org>
7
7
  #
8
8
  # This program is free software; you can redistribute it and/or modify
9
9
  # it under the terms of version 2 of the GNU General Public License as
@@ -93,6 +93,24 @@ class TaskJuggler
93
93
  @attributeDefinitions.include?(attrId)
94
94
  end
95
95
 
96
+ # Check whether the PropertyTreeNode has a calculated attribute with the
97
+ # ID _attrId_. For scenarioSpecific attributes _scenarioIdx_ needs to be
98
+ # provided.
99
+ def hasQuery?(attrId, scenarioIdx = nil)
100
+ return false if @properties.empty?
101
+
102
+ property = @properties.first
103
+ methodName = 'query_' + attrId
104
+ # First we check for non-scenario-specific query functions.
105
+ if property.respond_to?(methodName)
106
+ return true
107
+ elsif scenarioIdx
108
+ # Then we check for scenario-specific ones via the @data member.
109
+ return property.data[scenarioIdx].respond_to?(methodName)
110
+ end
111
+ false
112
+ end
113
+
96
114
  # Return whether the attribute with _attrId_ is scenario specific or not.
97
115
  def scenarioSpecific?(attrId)
98
116
  # All hardwired attributes are not scenario specific.
@@ -224,19 +242,14 @@ class TaskJuggler
224
242
  @propertyMap[id]
225
243
  end
226
244
 
227
- # Update the WBS and tree indicies. This method needs to be called whenever
228
- # the set has been modified.
245
+ # Update the work-breakdown-structure (wbs) indicies. This method needs to
246
+ # be called whenever the set has been modified.
229
247
  def index
230
248
  each do |p|
231
249
  wbsIdcs = p.getWBSIndicies
232
- tree = ""
233
250
  wbs = ""
234
251
  first = true
235
252
  wbsIdcs.each do |idx|
236
- # Prefix the level index with zeros so that we always have a 5 digit
237
- # long String. 5 digits should be large enough for all real-world
238
- # projects.
239
- tree += idx.to_s.rjust(5, '0')
240
253
  if first
241
254
  first = false
242
255
  else
@@ -245,7 +258,6 @@ class TaskJuggler
245
258
  wbs += idx.to_s
246
259
  end
247
260
  p.set('wbs', wbs)
248
- p.set('tree', tree)
249
261
  end
250
262
  end
251
263
 
@@ -300,7 +312,7 @@ class TaskJuggler
300
312
 
301
313
  # Return the set of PropertyTreeNode objects as flat Array.
302
314
  def to_ary
303
- @properties
315
+ @properties.dup
304
316
  end
305
317
 
306
318
  def to_s
@@ -3,7 +3,7 @@
3
3
  #
4
4
  # = PropertyTreeNode.rb -- The TaskJuggler III Project Management Software
5
5
  #
6
- # Copyright (c) 2006, 2007, 2008, 2009 by Chris Schlaeger <cs@kde.org>
6
+ # Copyright (c) 2006, 2007, 2008, 2009, 2010 by Chris Schlaeger <cs@kde.org>
7
7
  #
8
8
  # This program is free software; you can redistribute it and/or modify
9
9
  # it under the terms of version 2 of the GNU General Public License as
@@ -29,6 +29,7 @@ class TaskJuggler
29
29
  attr_reader :propertySet, :id, :name, :parent, :project, :sequenceNo,
30
30
  :children
31
31
  attr_accessor :sourceFileInfo
32
+ attr_reader :data
32
33
 
33
34
  # Create a new PropertyTreeNode object. _propertySet_ is the PropertySet
34
35
  # that this PropertyTreeNode object belongs to. The PropertySet determines
@@ -44,7 +45,7 @@ class TaskJuggler
44
45
  unless id
45
46
  tag = self.class.to_s.gsub(/TaskJuggler::/, '')
46
47
  id = '_' + tag + '_' + (propertySet.items + 1).to_s
47
- id = parent.id + '.' + id if !@propertySet.flatNamespace && parent
48
+ id = parent.fullId + '.' + id if !@propertySet.flatNamespace && parent
48
49
  end
49
50
  if !@propertySet.flatNamespace && id.include?('.')
50
51
  parentId = id[0..(id.rindex('.') - 1)]
@@ -251,6 +252,19 @@ class TaskJuggler
251
252
  idcs
252
253
  end
253
254
 
255
+ # Return the 'index' attributes of this property, prefixed by the 'index'
256
+ # attributes of all its parents. The result is an Array of Fixnums.
257
+ def getIndicies
258
+ idcs = []
259
+ p = self
260
+ begin
261
+ parent = p.parent
262
+ idcs.insert(0, p.get('index'))
263
+ p = parent
264
+ end while p
265
+ idcs
266
+ end
267
+
254
268
  # Add _child_ node as child to this node.
255
269
  def addChild(child)
256
270
  if $DEBUG && child.propertySet != @propertySet
@@ -319,7 +333,9 @@ class TaskJuggler
319
333
  @sequenceNo
320
334
  else
321
335
  unless @attributes.has_key?(attributeId)
322
- raise TjException.new, "Unknown attribute #{attributeId}"
336
+ raise TjException.new,
337
+ "Unknown attribute '#{attributeId}' requested for " +
338
+ "#{self.class.to_s.sub(/TaskJuggler::/, '')} '#{fullId}'"
323
339
  end
324
340
  @attributes[attributeId].get
325
341
  end
@@ -345,6 +361,22 @@ class TaskJuggler
345
361
  end
346
362
  end
347
363
 
364
+ # This function is similar to getAttr() but it always returns a
365
+ # AttributeBase object.
366
+ def getAttribute(attributeId, scenarioIdx = nil)
367
+ case attributeId
368
+ when 'id'
369
+ StringAttribute.new(self, @id)
370
+ when 'name'
371
+ StringAttribute.new(self, @name)
372
+ when 'seqno'
373
+ FixnumAttribute.new(self, @sequenceNo)
374
+ else
375
+ @attributes[attributeId] ||
376
+ @scenarioAttributes[scenarioIdx][attributeId]
377
+ end
378
+ end
379
+
348
380
  # Set the non-scenario-specific attribute with ID _attributeId_ to _value_.
349
381
  # In case the attribute does not exist, an exception is raised.
350
382
  def set(attributeId, value)
@@ -379,18 +411,6 @@ class TaskJuggler
379
411
  end
380
412
  end
381
413
 
382
- # This function returns true if the PropertyTreeNode has a query function
383
- # for the given ID _queryId_. In case a _scenarioIdx_ is specified, the
384
- # query function must be scenario specific.
385
- def hasQuery?(queryId, scenarioIdx = nil)
386
- methodName = 'query_' + queryId
387
- if scenarioIdx
388
- @data[scenarioIdx].respond_to?(methodName)
389
- else
390
- respond_to?(methodName)
391
- end
392
- end
393
-
394
414
  # Returns true if the value of the attribute _attributeId_ (in scenario
395
415
  # _scenarioIdx_) has been provided by the user.
396
416
  def provided(attributeId, scenarioIdx = nil)
@@ -415,6 +435,48 @@ class TaskJuggler
415
435
  end
416
436
  end
417
437
 
438
+ def modified?(attributeId, scenarioIdx = nil)
439
+ if scenarioIdx
440
+ return false if @scenarioAttributes[scenarioIdx][attributeId].nil?
441
+ @scenarioAttributes[scenarioIdx][attributeId].provided ||
442
+ @scenarioAttributes[scenarioIdx][attributeId].inherited
443
+ else
444
+ return false if @attributes[attributeId].nil?
445
+ @attributes[attributeId].provided || @attributes[attributeId].inherited
446
+ end
447
+ end
448
+
449
+ def query_alert(query)
450
+ journal = @project['journal']
451
+ query.sortable = query.numerical = alert =
452
+ journal.alertLevel(query.end, self)
453
+ query.string = @project.alertLevelName(alert)
454
+ end
455
+
456
+ def query_alertsummary(query)
457
+ alertMessages(query, false)
458
+ end
459
+
460
+ def query_alertmessage(query)
461
+ alertMessages(query, true)
462
+ end
463
+
464
+ def query_alerttrend(query)
465
+ journal = @project['journal']
466
+ startAlert = journal.alertLevel(query.start, self)
467
+ endAlert = journal.alertLevel(query.end, self)
468
+ if startAlert < endAlert
469
+ query.sortable = 0
470
+ query.string = 'Up'
471
+ elsif startAlert > endAlert
472
+ query.sortable = 2
473
+ query.string = 'Down'
474
+ else
475
+ query.sortable = 1
476
+ query.string = 'Flat'
477
+ end
478
+ end
479
+
418
480
  # Dump the class data in human readable form. Used for debugging only.
419
481
  def to_s # :nodoc:
420
482
  res = "#{self.class} #{fullId} \"#{@name}\"\n" +
@@ -460,6 +522,49 @@ class TaskJuggler
460
522
 
461
523
  private
462
524
 
525
+ # Create a blog-style list of all alert messages that match the Query.
526
+ def alertMessages(query, longVersion)
527
+ # The components of the message are either UTF-8 text or RichText. For
528
+ # the RichText components, we use the originally provided markup since
529
+ # we compose the result as RichText markup first.
530
+ rText = ''
531
+ @project['journal'].currentEntries(query.end, self, 0,
532
+ query.start).each do |entry|
533
+ rText += "== " + entry.headline + " ==\n"
534
+ rText += "''Reported on #{entry.date.to_s(query.timeFormat)}'' "
535
+ if entry.author
536
+ rText += "''by #{entry.author.name}''"
537
+ end
538
+ rText += "\n\n"
539
+ if entry.summary
540
+ rText += entry.summary.richText.inputText + "\n\n"
541
+ end
542
+ if longVersion && entry.details
543
+ rText += entry.details.richText.inputText + "\n\n"
544
+ end
545
+ end
546
+ # Now convert the RichText markup String into RichTextIntermediate
547
+ # format.
548
+ handlers = [
549
+ RTFNavigator.new(@project),
550
+ RTFQuery.new(@project),
551
+ RTFReport.new(@project)
552
+ ]
553
+ begin
554
+ rti = RichText.new(rText, handlers).generateIntermediateFormat
555
+ rescue RichTextException => msg
556
+ $stderr.puts "Error in RichText of rule #{@keyword}\n" +
557
+ "Line #{msg.lineNo}: #{msg.text}\n" +
558
+ "#{msg.line}"
559
+ return nil
560
+ end
561
+ # No section numbers, please!
562
+ rti.sectionNumbers = false
563
+ # We use a special class to allow CSS formating.
564
+ rti.cssClass = 'alertmessage'
565
+ query.rti = rti
566
+ end
567
+
463
568
  def newAttribute(attributeType)
464
569
  attribute = attributeType.objClass.new(self, attributeType)
465
570
  # If the attribute requires a pointer to the project, we'll hand it over.
data/lib/Query.rb CHANGED
@@ -3,7 +3,7 @@
3
3
  #
4
4
  # = Query.rb -- The TaskJuggler III Project Management Software
5
5
  #
6
- # Copyright (c) 2006, 2007, 2008, 2009 by Chris Schlaeger <cs@kde.org>
6
+ # Copyright (c) 2006, 2007, 2008, 2009, 2010 by Chris Schlaeger <cs@kde.org>
7
7
  #
8
8
  # This program is free software; you can redistribute it and/or modify
9
9
  # it under the terms of version 2 of the GNU General Public License as
@@ -19,7 +19,8 @@ class TaskJuggler
19
19
  # run has been completed, but it only produces good results for static
20
20
  # attributes. And for such queries, the PropertyTreeNode.get and [] functions
21
21
  # are a lot more efficient.
22
- # # When constructing a Query, a set of variables need to be set that is
22
+ #
23
+ # When constructing a Query, a set of variables need to be set that is
23
24
  # sufficient enough to identify a unique attribute. Some attribute are
24
25
  # computed dynamically and further variables such as a start and end time will
25
26
  # be incorporated into the result computation.
@@ -33,17 +34,22 @@ class TaskJuggler
33
34
 
34
35
  attr_accessor :project, :propertyType, :propertyId, :property,
35
36
  :scopePropertyType, :scopePropertyId, :scopeProperty,
36
- :attributeId, :scenarioIdx, :start, :end, :startIdx, :endIdx,
37
- :numberFormat, :currencyFormat, :costAccount, :revenueAccount,
37
+ :attributeId, :scenarioIdx, :startIdx, :endIdx,
38
+ :timeFormat, :numberFormat, :currencyFormat, :costAccount,
39
+ :revenueAccount,
38
40
  :loadUnit,
39
- :result, :numericalResult, :sortableResult, :ok, :errorMessage
41
+ :ok, :errorMessage
42
+ attr_reader :end, :start
43
+ attr_writer :sortable, :numerical, :string, :rti
40
44
 
41
45
  # Create a new Query object. The _parameters_ need to be sufficent to
42
46
  # uniquely identify an attribute.
43
47
  def initialize(parameters = { })
44
48
  ps = %w( project propertyType propertyId property scopePropertyId
45
- scopeProperty attributeId scenarioIdx start end startIdx endIdx
46
- loadUnit numberFormat currencyFormat costAccount revenueAccount)
49
+ scopeProperty attributeId scenario scenarioIdx
50
+ start end startIdx endIdx
51
+ loadUnit numberFormat currencyFormat timeFormat
52
+ costAccount revenueAccount)
47
53
  ps.each do |p|
48
54
  instance_variable_set('@' + p, parameters[p] ? parameters[p] : nil)
49
55
  end
@@ -51,26 +57,49 @@ class TaskJuggler
51
57
  reset
52
58
  end
53
59
 
54
- # Queries object can be reused. Calling this function will clear the query
55
- # result data.
56
- def reset
57
- @result = nil
58
- @numericalResult = nil
59
- @sortableResult = nil
60
- @loadUnit = :days
61
- @ok = nil
62
- @errorMessage = nil
60
+ # Reset the @startIdx when a start date is set.
61
+ def start=(date)
62
+ @start = date
63
+ @startIdx = nil
64
+ end
65
+
66
+ # Reset the @endIdx when an end date is set.
67
+ def end=(date)
68
+ @end = date
69
+ @endIdx = nil
63
70
  end
64
71
 
65
72
  # This method tries to resolve the query and return a result. In case it
66
73
  # finds an attribute that matches the query, it returns true; false
67
- # otherwise. The actual result data is put into the Query object.
74
+ # otherwise. The actual result data is stored in the Query object. It can
75
+ # then be retrieved by the caller with the methods to_s(), to_num(),
76
+ # to_sort() and result().
68
77
  def process
78
+ reset
69
79
  begin
70
80
  # Resolve property reference from property ID.
71
- if !@property.nil? && !@propertyId.nil?
81
+ if @property.nil? && !@propertyId.nil?
72
82
  @property = resolvePropertyId(@propertyType, @propertyId)
73
83
  end
84
+
85
+ unless @property
86
+ # No property was provided. We are looking for a project attribute.
87
+ supportedAttrs = %w( copyright currency end name now projectid
88
+ start version )
89
+ unless supportedAttrs.include?(@attributeId)
90
+ raise TjException.new,
91
+ "Unsupported project attribute '#{@attributeId}'"
92
+ end
93
+ attr = @project[@attributeId]
94
+ if attr.is_a?(TjTime)
95
+ @sortable = @numerical = attr
96
+ @string = attr.to_s(@timeFormat)
97
+ else
98
+ @sortable = @string = attr
99
+ end
100
+ return @ok = true
101
+ end
102
+
74
103
  # Same for the scope property.
75
104
  if !@scopeProperty.nil? && !@scopePropertyId.nil?
76
105
  @scopeProperty = resolvePropertyId(@scopePropertyType,
@@ -79,45 +108,77 @@ class TaskJuggler
79
108
  # Make sure the have a reference to the project.
80
109
  @project = @property.project unless @project
81
110
 
111
+ if @scenario && !@scenarioIdx
112
+ @scenarioIdx = @project.scenarioIdx(@scenario)
113
+ unless @scenarioIdx
114
+ raise "Query cannot resolve scenario '#{@scenario}'"
115
+ end
116
+ end
82
117
  @startIdx = @project.dateToIdx(@start, true) if @startIdx.nil? && @start
83
118
  @endIdx = @project.dateToIdx(@end, true) - 1 if @endIdx.nil? && @end
84
119
 
85
- if @property.hasQuery?(@attributeId, @scenarioIdx)
86
- # Call the property query function to get the result.
87
- if @scenarioIdx
88
- @property.send('query_' + @attributeId, scenarioIdx, self)
89
- else
90
- @property.send('query_' + @attributeId, self)
91
- end
120
+ queryMethodName = 'query_' + @attributeId
121
+ # First we check for non-scenario-specific query functions.
122
+ if @property.respond_to?(queryMethodName)
123
+ @property.send(queryMethodName, self)
124
+ elsif @scenarioIdx &&
125
+ @property.data[@scenarioIdx].respond_to?(queryMethodName)
126
+ # Then we check for scenario-specific ones via the @data member.
127
+ @property.send(queryMethodName, @scenarioIdx, self)
92
128
  else
93
- # There is no query function. We simply use the property attribute
94
- # value.
95
- @sortableResult =
96
- if @scenarioIdx
97
- @property[@attributeId, @scenarioIdx]
98
- else
99
- @property.get(@attributeId)
100
- end
101
- if @sortableResult.is_a?(Array)
102
- # This ugly special case is needed for custom attributes of type
103
- # reference.
104
- @sortableResult = @sortableResult[0]
129
+ # The result is a BaseAttribute
130
+ unless (@attr = @property.getAttribute(@attributeId, @scenarioIdx))
131
+ errorMessage = "Unknown attribute #{@attributeId} queried"
132
+ return @ok = false
105
133
  end
106
- @result = @sortableResult.to_s
107
- @numericalResult = @result if @result.is_a?(Fixnum) or
108
- @result.is_a?(Float)
109
134
  end
110
135
  rescue TjException
111
- @errorMessage = $!
112
- @result = ''
136
+ @errorMessage = $!.message
113
137
  return @ok = false
114
138
  end
115
139
  @ok = true
116
140
  end
117
141
 
118
- # Convert a duration to the format specified by @loadUnit. _work_ is the
119
- # effort in man days. The return value is the converted value with optional
120
- # unit as a String.
142
+ # Return the result of the Query as String. The result may be nil.
143
+ def to_s
144
+ @attr ? @attr.to_s(self) : (@string || '')
145
+ end
146
+
147
+ # Return the result of the Query as Fixnum or Float. The result may be
148
+ # nil.
149
+ def to_num
150
+ @attr ? @attr.to_num : @numerical
151
+ end
152
+
153
+ # Return the result in the best suited type and format for sorting. The
154
+ # result may be nil.
155
+ def to_sort
156
+ @attr ? @attr.to_sort : @sortable
157
+ end
158
+
159
+ # Return the result as RichTextIntermediate object. The result may be nil.
160
+ def to_rti
161
+ @attr ? @attr.to_rti(self) : @rti
162
+ end
163
+
164
+ # Return the result in the orginal form. It may be nil.
165
+ def result
166
+ if @attr
167
+ if @attr.value && @attr.is_a?(ReferenceAttribute)
168
+ @attr.value[0]
169
+ else
170
+ @attr.value
171
+ end
172
+ elsif @numerical
173
+ @numerical
174
+ else
175
+ @string
176
+ end
177
+ end
178
+
179
+ # Convert a duration to the format specified by @loadUnit. _value_ is the
180
+ # duration effort in days. The return value is the converted value with
181
+ # optional unit as a String.
121
182
  def scaleDuration(value)
122
183
  scaleValue(value, [ 24 * 60, 24, 1, 1.0 / 7, 1.0 / 30.42, 1.0 / 365 ])
123
184
  end
@@ -142,11 +203,11 @@ class TaskJuggler
142
203
  end
143
204
  case pType
144
205
  when :Account
145
- @project.account[pId]
206
+ @project.account(pId)
146
207
  when :Task
147
- @project.task[pId]
208
+ @project.task(pId)
148
209
  when:Resource
149
- @project.resource[pId]
210
+ @project.resource(pId)
150
211
  else
151
212
  raise TjException.new, "Unknown property type #{pType}"
152
213
  end
@@ -222,6 +283,16 @@ class TaskJuggler
222
283
  str
223
284
  end
224
285
 
286
+ private
287
+
288
+ # Queries object can be reused. Calling this function will clear the query
289
+ # result data.
290
+ def reset
291
+ @attr = @numerical = @sortable = @string = @rti = nil
292
+ @ok = nil
293
+ @errorMessage = nil
294
+ end
295
+
225
296
  end
226
297
 
227
298
  end