A corporation manager and dashboard for EVE Online
Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.

renderers.mako 5.8 KiB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135
  1. <%!
  2. from calefaction.format import (
  3. format_quantity, format_isk_compact, format_utctime_compact,
  4. format_security, get_security_class)
  5. %>
  6. <%def name="_killboard_kill(kill, detail, any_alliances, any_factions)">
  7. <%
  8. victim = kill["victim"]
  9. system = g.eve.universe.system(kill["system"])
  10. killed = g.eve.universe.killable(victim["ship_id"])
  11. %>
  12. <tr>
  13. <td class="fluid">
  14. <abbr title="${kill["date"].strftime("%Y-%m-%d %H:%M")}">${format_utctime_compact(kill["date"]) | h}</abbr><br/>
  15. <a href="https://zkillboard.com/kill/${kill['id']}/">
  16. <abbr title="${"{:,.2f}".format(kill["value"])} ISK">${format_isk_compact(kill["value"]) | h}</abbr>
  17. </a>
  18. </td>
  19. <td class="fluid extra">
  20. <a href="https://zkillboard.com/system/${system.id}/">${system.name | h}</a> <abbr title="${system.security}" class="${get_security_class(system.security)}">${format_security(system.security)}</abbr><br/>
  21. <a href="https://zkillboard.com/region/${system.region.id}/">${system.region.name | h}</a>
  22. </td>
  23. <td class="icon">
  24. <a href="https://zkillboard.com/kill/${kill['id']}/">
  25. <img title="Kill ${kill['id']}: ${killed.name | h}" alt="Kill ${kill['id']}: ${killed.name | h}" src="${g.eve.image.inventory(victim["ship_id"], 64)}"/>
  26. </a>
  27. </td>
  28. <td class="icon extra">
  29. <a href="https://zkillboard.com/character/${victim['char_id']}/">
  30. <img title="${victim['char_name'] | h}" alt="${victim['char_name'] | h}" src="${g.eve.image.character(victim["char_id"], 128)}"/>
  31. </a>
  32. </td>
  33. % if detail:
  34. <td class="detail-item">
  35. <a href="https://zkillboard.com/character/${victim['char_id']}/">${victim['char_name'] | h}</a>
  36. (${killed.name | h})
  37. </td>
  38. % endif
  39. <td class="icon${' extra' if victim["alliance_id"] and victim["faction_id"] else ''}">
  40. <a href="https://zkillboard.com/corporation/${victim['corp_id']}/">
  41. <img title="${victim['corp_name'] | h}" alt="${victim['corp_name'] | h}" src="${g.eve.image.corp(victim["corp_id"], 128)}"/>
  42. </a>
  43. </td>
  44. % if any_alliances:
  45. <td class="icon${'' if victim["alliance_id"] else ' extra'}">
  46. % if victim["alliance_id"]:
  47. <a href="https://zkillboard.com/alliance/${victim['alliance_id']}/">
  48. <img title="${victim['alliance_name'] | h}" alt="${victim['alliance_name'] | h}" src="${g.eve.image.alliance(victim["alliance_id"], 128)}"/>
  49. </a>
  50. % endif
  51. </td>
  52. % endif
  53. % if any_factions:
  54. <td class="icon${'' if victim["faction_id"] else ' extra'}">
  55. % if victim["faction_id"]:
  56. <a href="https://zkillboard.com/faction/${victim['faction_id']}/">
  57. <img title="${victim['faction_name'] | h}" alt="${victim['faction_name'] | h}" src="${g.eve.image.faction(victim["faction_id"], 128)}"/>
  58. </a>
  59. % endif
  60. </td>
  61. % endif
  62. % if not detail and (any_alliances or any_factions) and not victim["alliance_id"] and not victim["faction_id"]:
  63. <td class="icon spacer"></td>
  64. % endif
  65. % if detail:
  66. <td class="detail-item detail-list">
  67. <a href="https://zkillboard.com/corporation/${victim['corp_id']}/">${victim['corp_name'] | h}</a>
  68. % if victim['alliance_name']:
  69. <a href="https://zkillboard.com/alliance/${victim['alliance_id']}/">${victim['alliance_name'] | h}</a>
  70. % endif
  71. % if victim['faction_name']:
  72. <a href="https://zkillboard.com/faction/${victim['faction_id']}/">${victim['faction_name'] | h}</a>
  73. % endif
  74. </td>
  75. % endif
  76. </tr>
  77. </%def>
  78. <%def name="_itemboard_item(item)">
  79. <%
  80. type_id, count, value = item
  81. type = g.eve.universe.type(type_id)
  82. %>
  83. <tr>
  84. <td class="icon">
  85. <img title="${type.name | h}" alt="" src="${g.eve.image.inventory(type_id, 64)}"/>
  86. </td>
  87. <td>
  88. <a href="https://eve-central.com/home/quicklook.html?typeid=${type_id | u}">${type.name | h}</a>
  89. </td>
  90. <td>
  91. <span class="count">${format_quantity(count) | h}</span><br/>
  92. <abbr class="price" title="${"{:,.2f}".format(value)} ISK">${format_isk_compact(value) | h}</abbr>
  93. </td>
  94. </tr>
  95. </%def>
  96. <%def name="_killboard_recent(summary, detail)">
  97. % if detail:
  98. <h3 class="head">Kills:</h3>
  99. % else:
  100. <div class="head">Most recent kills:</div>
  101. % endif
  102. <%
  103. any_alliances = any(kill["victim"]["alliance_id"] for kill in summary)
  104. any_factions = any(kill["victim"]["faction_id"] for kill in summary)
  105. %>
  106. <div class="contents">
  107. <table class="board killboard">
  108. % for kill in summary:
  109. ${_killboard_kill(kill, detail, any_alliances, any_factions)}
  110. % endfor
  111. </table>
  112. </div>
  113. </%def>
  114. <%def name="_collection_items(summary, detail)">
  115. % if detail:
  116. <h3 class="head">Items:</h3>
  117. % else:
  118. <div class="head">Top items:</div>
  119. % endif
  120. <div class="contents">
  121. <table class="board itemboard">
  122. % for item in summary:
  123. ${_itemboard_item(item)}
  124. % endfor
  125. </table>
  126. </div>
  127. </%def>
  128. <%def name="render_summary(renderer, summary, detail=False)"><%
  129. if renderer == "killboard_recent":
  130. return _killboard_recent(summary, detail)
  131. if renderer == "collection_items":
  132. return _collection_items(summary, detail)
  133. raise RuntimeError("Unknown renderer: %s" % renderer)
  134. %></%def>