lipsiadmin 2.9

Sign up to get free protection for your applications and to get access to all the features.
Files changed (467) hide show
  1. data/CHANGELOG +90 -0
  2. data/MIT-LICENSE +20 -0
  3. data/README +60 -0
  4. data/Rakefile +90 -0
  5. data/init.rb +1 -0
  6. data/lib/access_control/authentication.rb +105 -0
  7. data/lib/access_control/base.rb +227 -0
  8. data/lib/controller/ext.rb +168 -0
  9. data/lib/controller/lipsiadmin_controller.rb +18 -0
  10. data/lib/controller/pdf_builder.rb +67 -0
  11. data/lib/controller/rescue.rb +72 -0
  12. data/lib/controller/responds_to_parent.rb +56 -0
  13. data/lib/data_base/attachment.rb +351 -0
  14. data/lib/data_base/attachment/attach.rb +515 -0
  15. data/lib/data_base/attachment/geometry.rb +117 -0
  16. data/lib/data_base/attachment/iostream.rb +62 -0
  17. data/lib/data_base/attachment/processor.rb +49 -0
  18. data/lib/data_base/attachment/storage.rb +223 -0
  19. data/lib/data_base/attachment/thumbnail.rb +72 -0
  20. data/lib/data_base/attachment/upfile.rb +45 -0
  21. data/lib/data_base/attachment_table.rb +142 -0
  22. data/lib/data_base/translate_attributes.rb +30 -0
  23. data/lib/data_base/utility_scopes.rb +40 -0
  24. data/lib/data_base/without_table.rb +62 -0
  25. data/lib/generator.rb +114 -0
  26. data/lib/lipsiadmin.rb +77 -0
  27. data/lib/lipsiadmin_tasks.rb +3 -0
  28. data/lib/locale/en.yml +16 -0
  29. data/lib/locale/it.yml +16 -0
  30. data/lib/mailer/exception/exception.html.erb +11 -0
  31. data/lib/mailer/exception_notifier.rb +46 -0
  32. data/lib/mailer/pdf_builder.rb +66 -0
  33. data/lib/utils/html_entities.rb +63 -0
  34. data/lib/utils/literal.rb +20 -0
  35. data/lib/version.rb +9 -0
  36. data/lib/view/helpers/active_record_helper.rb +11 -0
  37. data/lib/view/helpers/backend_helper.rb +132 -0
  38. data/lib/view/helpers/ext/column_model.rb +73 -0
  39. data/lib/view/helpers/ext/component.rb +163 -0
  40. data/lib/view/helpers/ext/configuration.rb +36 -0
  41. data/lib/view/helpers/ext/grid.rb +281 -0
  42. data/lib/view/helpers/ext/store.rb +103 -0
  43. data/lib/view/helpers/ext/templates/grid_functions.js.erb +51 -0
  44. data/lib/view/helpers/ext/tool_bar.rb +40 -0
  45. data/lib/view/helpers/ext_helper.rb +150 -0
  46. data/lib/view/helpers/view_helper.rb +222 -0
  47. data/lipsiadmin_generators/attachment/REMEMBER +21 -0
  48. data/lipsiadmin_generators/attachment/attachment_generator.rb +27 -0
  49. data/lipsiadmin_generators/attachment/templates/migration.rb +14 -0
  50. data/lipsiadmin_generators/attachment/templates/model.rb +4 -0
  51. data/lipsiadmin_generators/backend/REMEMBER +18 -0
  52. data/lipsiadmin_generators/backend/backend_generator.rb +58 -0
  53. data/lipsiadmin_generators/backend/templates/config/config.yml +14 -0
  54. data/lipsiadmin_generators/backend/templates/config/initializers/config.rb +7 -0
  55. data/lipsiadmin_generators/backend/templates/config/initializers/emails.rb +2 -0
  56. data/lipsiadmin_generators/backend/templates/config/initializers/exception_notifier.rb +7 -0
  57. data/lipsiadmin_generators/backend/templates/config/locales/backend/en.yml +204 -0
  58. data/lipsiadmin_generators/backend/templates/config/locales/backend/it.yml +203 -0
  59. data/lipsiadmin_generators/backend/templates/config/locales/frontend/en.yml +5 -0
  60. data/lipsiadmin_generators/backend/templates/config/locales/frontend/it.yml +5 -0
  61. data/lipsiadmin_generators/backend/templates/config/locales/models/en.yml +31 -0
  62. data/lipsiadmin_generators/backend/templates/config/locales/models/it.yml +23 -0
  63. data/lipsiadmin_generators/backend/templates/config/locales/rails/en.yml +148 -0
  64. data/lipsiadmin_generators/backend/templates/config/locales/rails/it.yml +109 -0
  65. data/lipsiadmin_generators/backend/templates/controllers/backend/accounts_controller.rb +53 -0
  66. data/lipsiadmin_generators/backend/templates/controllers/backend/base_controller.rb +8 -0
  67. data/lipsiadmin_generators/backend/templates/controllers/backend/sessions_controller.rb +21 -0
  68. data/lipsiadmin_generators/backend/templates/controllers/backend_controller.rb +2 -0
  69. data/lipsiadmin_generators/backend/templates/controllers/frontend_controller.rb +4 -0
  70. data/lipsiadmin_generators/backend/templates/controllers/javascripts_controller.rb +17 -0
  71. data/lipsiadmin_generators/backend/templates/exceptions/template.html.haml +5 -0
  72. data/lipsiadmin_generators/backend/templates/helpers/backend_helper.rb +2 -0
  73. data/lipsiadmin_generators/backend/templates/helpers/frontend_helper.rb +2 -0
  74. data/lipsiadmin_generators/backend/templates/images/backend/back.gif +0 -0
  75. data/lipsiadmin_generators/backend/templates/images/backend/background.png +0 -0
  76. data/lipsiadmin_generators/backend/templates/images/backend/bg-content.png +0 -0
  77. data/lipsiadmin_generators/backend/templates/images/backend/bg-hd-slate.png +0 -0
  78. data/lipsiadmin_generators/backend/templates/images/backend/bg-hd.png +0 -0
  79. data/lipsiadmin_generators/backend/templates/images/backend/bg-intro.png +0 -0
  80. data/lipsiadmin_generators/backend/templates/images/backend/bg-login.png +0 -0
  81. data/lipsiadmin_generators/backend/templates/images/backend/bg-menu-slate.png +0 -0
  82. data/lipsiadmin_generators/backend/templates/images/backend/bg-menu.png +0 -0
  83. data/lipsiadmin_generators/backend/templates/images/backend/bg.png +0 -0
  84. data/lipsiadmin_generators/backend/templates/images/backend/btn-login.png +0 -0
  85. data/lipsiadmin_generators/backend/templates/images/backend/delete.gif +0 -0
  86. data/lipsiadmin_generators/backend/templates/images/backend/download.gif +0 -0
  87. data/lipsiadmin_generators/backend/templates/images/backend/duplicate.gif +0 -0
  88. data/lipsiadmin_generators/backend/templates/images/backend/edit.gif +0 -0
  89. data/lipsiadmin_generators/backend/templates/images/backend/hd-bg-slate.gif +0 -0
  90. data/lipsiadmin_generators/backend/templates/images/backend/hd-bg.gif +0 -0
  91. data/lipsiadmin_generators/backend/templates/images/backend/it.gif +0 -0
  92. data/lipsiadmin_generators/backend/templates/images/backend/loader.gif +0 -0
  93. data/lipsiadmin_generators/backend/templates/images/backend/logo-loader.png +0 -0
  94. data/lipsiadmin_generators/backend/templates/images/backend/logo-small.png +0 -0
  95. data/lipsiadmin_generators/backend/templates/images/backend/new.gif +0 -0
  96. data/lipsiadmin_generators/backend/templates/images/backend/no-image.png +0 -0
  97. data/lipsiadmin_generators/backend/templates/images/backend/preview.gif +0 -0
  98. data/lipsiadmin_generators/backend/templates/images/backend/print.gif +0 -0
  99. data/lipsiadmin_generators/backend/templates/images/backend/save.gif +0 -0
  100. data/lipsiadmin_generators/backend/templates/images/backend/support.gif +0 -0
  101. data/lipsiadmin_generators/backend/templates/images/backend/us.gif +0 -0
  102. data/lipsiadmin_generators/backend/templates/images/ext/default/box/corners-blue.gif +0 -0
  103. data/lipsiadmin_generators/backend/templates/images/ext/default/box/corners.gif +0 -0
  104. data/lipsiadmin_generators/backend/templates/images/ext/default/box/l-blue.gif +0 -0
  105. data/lipsiadmin_generators/backend/templates/images/ext/default/box/l.gif +0 -0
  106. data/lipsiadmin_generators/backend/templates/images/ext/default/box/r-blue.gif +0 -0
  107. data/lipsiadmin_generators/backend/templates/images/ext/default/box/r.gif +0 -0
  108. data/lipsiadmin_generators/backend/templates/images/ext/default/box/tb-blue.gif +0 -0
  109. data/lipsiadmin_generators/backend/templates/images/ext/default/box/tb-slate.gif +0 -0
  110. data/lipsiadmin_generators/backend/templates/images/ext/default/box/tb.gif +0 -0
  111. data/lipsiadmin_generators/backend/templates/images/ext/default/button/btn-arrow.gif +0 -0
  112. data/lipsiadmin_generators/backend/templates/images/ext/default/button/btn-sprite.gif +0 -0
  113. data/lipsiadmin_generators/backend/templates/images/ext/default/dd/drop-add.gif +0 -0
  114. data/lipsiadmin_generators/backend/templates/images/ext/default/dd/drop-no.gif +0 -0
  115. data/lipsiadmin_generators/backend/templates/images/ext/default/dd/drop-yes.gif +0 -0
  116. data/lipsiadmin_generators/backend/templates/images/ext/default/editor/tb-sprite.gif +0 -0
  117. data/lipsiadmin_generators/backend/templates/images/ext/default/form/clear-trigger.gif +0 -0
  118. data/lipsiadmin_generators/backend/templates/images/ext/default/form/clear-trigger.psd +0 -0
  119. data/lipsiadmin_generators/backend/templates/images/ext/default/form/date-trigger.gif +0 -0
  120. data/lipsiadmin_generators/backend/templates/images/ext/default/form/date-trigger.psd +0 -0
  121. data/lipsiadmin_generators/backend/templates/images/ext/default/form/error-tip-corners.gif +0 -0
  122. data/lipsiadmin_generators/backend/templates/images/ext/default/form/exclamation.gif +0 -0
  123. data/lipsiadmin_generators/backend/templates/images/ext/default/form/search-trigger.gif +0 -0
  124. data/lipsiadmin_generators/backend/templates/images/ext/default/form/search-trigger.psd +0 -0
  125. data/lipsiadmin_generators/backend/templates/images/ext/default/form/text-bg.gif +0 -0
  126. data/lipsiadmin_generators/backend/templates/images/ext/default/form/trigger-tpl.gif +0 -0
  127. data/lipsiadmin_generators/backend/templates/images/ext/default/form/trigger.gif +0 -0
  128. data/lipsiadmin_generators/backend/templates/images/ext/default/form/trigger.psd +0 -0
  129. data/lipsiadmin_generators/backend/templates/images/ext/default/gradient-bg.gif +0 -0
  130. data/lipsiadmin_generators/backend/templates/images/ext/default/grid/Thumbs.db +0 -0
  131. data/lipsiadmin_generators/backend/templates/images/ext/default/grid/arrow-left-white.gif +0 -0
  132. data/lipsiadmin_generators/backend/templates/images/ext/default/grid/arrow-right-white.gif +0 -0
  133. data/lipsiadmin_generators/backend/templates/images/ext/default/grid/col-move-bottom.gif +0 -0
  134. data/lipsiadmin_generators/backend/templates/images/ext/default/grid/col-move-top.gif +0 -0
  135. data/lipsiadmin_generators/backend/templates/images/ext/default/grid/columns.gif +0 -0
  136. data/lipsiadmin_generators/backend/templates/images/ext/default/grid/dirty.gif +0 -0
  137. data/lipsiadmin_generators/backend/templates/images/ext/default/grid/done.gif +0 -0
  138. data/lipsiadmin_generators/backend/templates/images/ext/default/grid/drop-no.gif +0 -0
  139. data/lipsiadmin_generators/backend/templates/images/ext/default/grid/drop-yes.gif +0 -0
  140. data/lipsiadmin_generators/backend/templates/images/ext/default/grid/footer-bg.gif +0 -0
  141. data/lipsiadmin_generators/backend/templates/images/ext/default/grid/grid-blue-hd.gif +0 -0
  142. data/lipsiadmin_generators/backend/templates/images/ext/default/grid/grid-blue-split.gif +0 -0
  143. data/lipsiadmin_generators/backend/templates/images/ext/default/grid/grid-hrow.gif +0 -0
  144. data/lipsiadmin_generators/backend/templates/images/ext/default/grid/grid-loading.gif +0 -0
  145. data/lipsiadmin_generators/backend/templates/images/ext/default/grid/grid-split.gif +0 -0
  146. data/lipsiadmin_generators/backend/templates/images/ext/default/grid/grid-vista-hd.gif +0 -0
  147. data/lipsiadmin_generators/backend/templates/images/ext/default/grid/grid3-hd-btn.gif +0 -0
  148. data/lipsiadmin_generators/backend/templates/images/ext/default/grid/grid3-hrow-over.gif +0 -0
  149. data/lipsiadmin_generators/backend/templates/images/ext/default/grid/grid3-hrow.gif +0 -0
  150. data/lipsiadmin_generators/backend/templates/images/ext/default/grid/grid3-special-col-bg.gif +0 -0
  151. data/lipsiadmin_generators/backend/templates/images/ext/default/grid/grid3-special-col-sel-bg.gif +0 -0
  152. data/lipsiadmin_generators/backend/templates/images/ext/default/grid/group-by.gif +0 -0
  153. data/lipsiadmin_generators/backend/templates/images/ext/default/grid/group-expand-sprite.gif +0 -0
  154. data/lipsiadmin_generators/backend/templates/images/ext/default/grid/hd-pop.gif +0 -0
  155. data/lipsiadmin_generators/backend/templates/images/ext/default/grid/hmenu-asc.gif +0 -0
  156. data/lipsiadmin_generators/backend/templates/images/ext/default/grid/hmenu-desc.gif +0 -0
  157. data/lipsiadmin_generators/backend/templates/images/ext/default/grid/hmenu-lock.gif +0 -0
  158. data/lipsiadmin_generators/backend/templates/images/ext/default/grid/hmenu-lock.png +0 -0
  159. data/lipsiadmin_generators/backend/templates/images/ext/default/grid/hmenu-unlock.gif +0 -0
  160. data/lipsiadmin_generators/backend/templates/images/ext/default/grid/hmenu-unlock.png +0 -0
  161. data/lipsiadmin_generators/backend/templates/images/ext/default/grid/invalid_line.gif +0 -0
  162. data/lipsiadmin_generators/backend/templates/images/ext/default/grid/loading.gif +0 -0
  163. data/lipsiadmin_generators/backend/templates/images/ext/default/grid/mso-hd.gif +0 -0
  164. data/lipsiadmin_generators/backend/templates/images/ext/default/grid/nowait.gif +0 -0
  165. data/lipsiadmin_generators/backend/templates/images/ext/default/grid/page-first-disabled.gif +0 -0
  166. data/lipsiadmin_generators/backend/templates/images/ext/default/grid/page-first.gif +0 -0
  167. data/lipsiadmin_generators/backend/templates/images/ext/default/grid/page-last-disabled.gif +0 -0
  168. data/lipsiadmin_generators/backend/templates/images/ext/default/grid/page-last.gif +0 -0
  169. data/lipsiadmin_generators/backend/templates/images/ext/default/grid/page-next-disabled.gif +0 -0
  170. data/lipsiadmin_generators/backend/templates/images/ext/default/grid/page-next.gif +0 -0
  171. data/lipsiadmin_generators/backend/templates/images/ext/default/grid/page-prev-disabled.gif +0 -0
  172. data/lipsiadmin_generators/backend/templates/images/ext/default/grid/page-prev.gif +0 -0
  173. data/lipsiadmin_generators/backend/templates/images/ext/default/grid/pick-button.gif +0 -0
  174. data/lipsiadmin_generators/backend/templates/images/ext/default/grid/refresh.gif +0 -0
  175. data/lipsiadmin_generators/backend/templates/images/ext/default/grid/row-check-sprite.gif +0 -0
  176. data/lipsiadmin_generators/backend/templates/images/ext/default/grid/row-expand-sprite.gif +0 -0
  177. data/lipsiadmin_generators/backend/templates/images/ext/default/grid/row-over.gif +0 -0
  178. data/lipsiadmin_generators/backend/templates/images/ext/default/grid/row-sel.gif +0 -0
  179. data/lipsiadmin_generators/backend/templates/images/ext/default/grid/sort_asc.gif +0 -0
  180. data/lipsiadmin_generators/backend/templates/images/ext/default/grid/sort_desc.gif +0 -0
  181. data/lipsiadmin_generators/backend/templates/images/ext/default/grid/wait.gif +0 -0
  182. data/lipsiadmin_generators/backend/templates/images/ext/default/layout/collapse.gif +0 -0
  183. data/lipsiadmin_generators/backend/templates/images/ext/default/layout/expand.gif +0 -0
  184. data/lipsiadmin_generators/backend/templates/images/ext/default/layout/gradient-bg.gif +0 -0
  185. data/lipsiadmin_generators/backend/templates/images/ext/default/layout/mini-bottom.gif +0 -0
  186. data/lipsiadmin_generators/backend/templates/images/ext/default/layout/mini-left.gif +0 -0
  187. data/lipsiadmin_generators/backend/templates/images/ext/default/layout/mini-right.gif +0 -0
  188. data/lipsiadmin_generators/backend/templates/images/ext/default/layout/mini-top.gif +0 -0
  189. data/lipsiadmin_generators/backend/templates/images/ext/default/layout/ns-collapse.gif +0 -0
  190. data/lipsiadmin_generators/backend/templates/images/ext/default/layout/ns-expand.gif +0 -0
  191. data/lipsiadmin_generators/backend/templates/images/ext/default/layout/panel-close.gif +0 -0
  192. data/lipsiadmin_generators/backend/templates/images/ext/default/layout/panel-title-bg.gif +0 -0
  193. data/lipsiadmin_generators/backend/templates/images/ext/default/layout/panel-title-light-bg.gif +0 -0
  194. data/lipsiadmin_generators/backend/templates/images/ext/default/layout/stick.gif +0 -0
  195. data/lipsiadmin_generators/backend/templates/images/ext/default/layout/stuck.gif +0 -0
  196. data/lipsiadmin_generators/backend/templates/images/ext/default/layout/tab-close-on.gif +0 -0
  197. data/lipsiadmin_generators/backend/templates/images/ext/default/layout/tab-close.gif +0 -0
  198. data/lipsiadmin_generators/backend/templates/images/ext/default/menu/checked.gif +0 -0
  199. data/lipsiadmin_generators/backend/templates/images/ext/default/menu/group-checked.gif +0 -0
  200. data/lipsiadmin_generators/backend/templates/images/ext/default/menu/item-over.gif +0 -0
  201. data/lipsiadmin_generators/backend/templates/images/ext/default/menu/menu-parent.gif +0 -0
  202. data/lipsiadmin_generators/backend/templates/images/ext/default/menu/menu.gif +0 -0
  203. data/lipsiadmin_generators/backend/templates/images/ext/default/menu/unchecked.gif +0 -0
  204. data/lipsiadmin_generators/backend/templates/images/ext/default/panel/corners-sprite.gif +0 -0
  205. data/lipsiadmin_generators/backend/templates/images/ext/default/panel/left-right.gif +0 -0
  206. data/lipsiadmin_generators/backend/templates/images/ext/default/panel/light-hd.gif +0 -0
  207. data/lipsiadmin_generators/backend/templates/images/ext/default/panel/tool-sprite-tpl.gif +0 -0
  208. data/lipsiadmin_generators/backend/templates/images/ext/default/panel/tool-sprites.gif +0 -0
  209. data/lipsiadmin_generators/backend/templates/images/ext/default/panel/tools-sprites-trans.gif +0 -0
  210. data/lipsiadmin_generators/backend/templates/images/ext/default/panel/top-bottom.gif +0 -0
  211. data/lipsiadmin_generators/backend/templates/images/ext/default/panel/top-bottom.png +0 -0
  212. data/lipsiadmin_generators/backend/templates/images/ext/default/panel/white-corners-sprite.gif +0 -0
  213. data/lipsiadmin_generators/backend/templates/images/ext/default/panel/white-left-right.gif +0 -0
  214. data/lipsiadmin_generators/backend/templates/images/ext/default/panel/white-top-bottom.gif +0 -0
  215. data/lipsiadmin_generators/backend/templates/images/ext/default/progress/progress-bg.gif +0 -0
  216. data/lipsiadmin_generators/backend/templates/images/ext/default/qtip/bg.gif +0 -0
  217. data/lipsiadmin_generators/backend/templates/images/ext/default/qtip/close.gif +0 -0
  218. data/lipsiadmin_generators/backend/templates/images/ext/default/qtip/tip-sprite.gif +0 -0
  219. data/lipsiadmin_generators/backend/templates/images/ext/default/s.gif +0 -0
  220. data/lipsiadmin_generators/backend/templates/images/ext/default/shadow-c.png +0 -0
  221. data/lipsiadmin_generators/backend/templates/images/ext/default/shadow-lr.png +0 -0
  222. data/lipsiadmin_generators/backend/templates/images/ext/default/shadow.png +0 -0
  223. data/lipsiadmin_generators/backend/templates/images/ext/default/shared/blue-loading.gif +0 -0
  224. data/lipsiadmin_generators/backend/templates/images/ext/default/shared/calendar.gif +0 -0
  225. data/lipsiadmin_generators/backend/templates/images/ext/default/shared/glass-bg.gif +0 -0
  226. data/lipsiadmin_generators/backend/templates/images/ext/default/shared/hd-sprite.gif +0 -0
  227. data/lipsiadmin_generators/backend/templates/images/ext/default/shared/large-loading.gif +0 -0
  228. data/lipsiadmin_generators/backend/templates/images/ext/default/shared/left-btn.gif +0 -0
  229. data/lipsiadmin_generators/backend/templates/images/ext/default/shared/loading-balls.gif +0 -0
  230. data/lipsiadmin_generators/backend/templates/images/ext/default/shared/right-btn.gif +0 -0
  231. data/lipsiadmin_generators/backend/templates/images/ext/default/shared/warning.gif +0 -0
  232. data/lipsiadmin_generators/backend/templates/images/ext/default/sizer/e-handle-dark.gif +0 -0
  233. data/lipsiadmin_generators/backend/templates/images/ext/default/sizer/e-handle.gif +0 -0
  234. data/lipsiadmin_generators/backend/templates/images/ext/default/sizer/ne-handle-dark.gif +0 -0
  235. data/lipsiadmin_generators/backend/templates/images/ext/default/sizer/ne-handle.gif +0 -0
  236. data/lipsiadmin_generators/backend/templates/images/ext/default/sizer/nw-handle-dark.gif +0 -0
  237. data/lipsiadmin_generators/backend/templates/images/ext/default/sizer/nw-handle.gif +0 -0
  238. data/lipsiadmin_generators/backend/templates/images/ext/default/sizer/s-handle-dark.gif +0 -0
  239. data/lipsiadmin_generators/backend/templates/images/ext/default/sizer/s-handle.gif +0 -0
  240. data/lipsiadmin_generators/backend/templates/images/ext/default/sizer/se-handle-dark.gif +0 -0
  241. data/lipsiadmin_generators/backend/templates/images/ext/default/sizer/se-handle.gif +0 -0
  242. data/lipsiadmin_generators/backend/templates/images/ext/default/sizer/square.gif +0 -0
  243. data/lipsiadmin_generators/backend/templates/images/ext/default/sizer/sw-handle-dark.gif +0 -0
  244. data/lipsiadmin_generators/backend/templates/images/ext/default/sizer/sw-handle.gif +0 -0
  245. data/lipsiadmin_generators/backend/templates/images/ext/default/slider/slider-bg.png +0 -0
  246. data/lipsiadmin_generators/backend/templates/images/ext/default/slider/slider-thumb.png +0 -0
  247. data/lipsiadmin_generators/backend/templates/images/ext/default/slider/slider-v-bg.png +0 -0
  248. data/lipsiadmin_generators/backend/templates/images/ext/default/slider/slider-v-thumb.png +0 -0
  249. data/lipsiadmin_generators/backend/templates/images/ext/default/tabs/scroll-left.gif +0 -0
  250. data/lipsiadmin_generators/backend/templates/images/ext/default/tabs/scroll-right.gif +0 -0
  251. data/lipsiadmin_generators/backend/templates/images/ext/default/tabs/scroller-bg.gif +0 -0
  252. data/lipsiadmin_generators/backend/templates/images/ext/default/tabs/tab-btm-inactive-left-bg.gif +0 -0
  253. data/lipsiadmin_generators/backend/templates/images/ext/default/tabs/tab-btm-inactive-right-bg.gif +0 -0
  254. data/lipsiadmin_generators/backend/templates/images/ext/default/tabs/tab-btm-left-bg.gif +0 -0
  255. data/lipsiadmin_generators/backend/templates/images/ext/default/tabs/tab-btm-right-bg.gif +0 -0
  256. data/lipsiadmin_generators/backend/templates/images/ext/default/tabs/tab-close.gif +0 -0
  257. data/lipsiadmin_generators/backend/templates/images/ext/default/tabs/tab-strip-bg.gif +0 -0
  258. data/lipsiadmin_generators/backend/templates/images/ext/default/tabs/tab-strip-bg.png +0 -0
  259. data/lipsiadmin_generators/backend/templates/images/ext/default/tabs/tab-strip-btm-bg.gif +0 -0
  260. data/lipsiadmin_generators/backend/templates/images/ext/default/tabs/tabs-sprite.gif +0 -0
  261. data/lipsiadmin_generators/backend/templates/images/ext/default/toolbar/bg.gif +0 -0
  262. data/lipsiadmin_generators/backend/templates/images/ext/default/toolbar/btn-arrow-light.gif +0 -0
  263. data/lipsiadmin_generators/backend/templates/images/ext/default/toolbar/btn-arrow.gif +0 -0
  264. data/lipsiadmin_generators/backend/templates/images/ext/default/toolbar/btn-over-bg.gif +0 -0
  265. data/lipsiadmin_generators/backend/templates/images/ext/default/toolbar/gray-bg.gif +0 -0
  266. data/lipsiadmin_generators/backend/templates/images/ext/default/toolbar/tb-bg.gif +0 -0
  267. data/lipsiadmin_generators/backend/templates/images/ext/default/toolbar/tb-btn-sprite.gif +0 -0
  268. data/lipsiadmin_generators/backend/templates/images/ext/default/tree/arrows.gif +0 -0
  269. data/lipsiadmin_generators/backend/templates/images/ext/default/tree/drop-add.gif +0 -0
  270. data/lipsiadmin_generators/backend/templates/images/ext/default/tree/drop-between.gif +0 -0
  271. data/lipsiadmin_generators/backend/templates/images/ext/default/tree/drop-no.gif +0 -0
  272. data/lipsiadmin_generators/backend/templates/images/ext/default/tree/drop-over.gif +0 -0
  273. data/lipsiadmin_generators/backend/templates/images/ext/default/tree/drop-under.gif +0 -0
  274. data/lipsiadmin_generators/backend/templates/images/ext/default/tree/drop-yes.gif +0 -0
  275. data/lipsiadmin_generators/backend/templates/images/ext/default/tree/elbow-end-minus-nl.gif +0 -0
  276. data/lipsiadmin_generators/backend/templates/images/ext/default/tree/elbow-end-minus.gif +0 -0
  277. data/lipsiadmin_generators/backend/templates/images/ext/default/tree/elbow-end-plus-nl.gif +0 -0
  278. data/lipsiadmin_generators/backend/templates/images/ext/default/tree/elbow-end-plus.gif +0 -0
  279. data/lipsiadmin_generators/backend/templates/images/ext/default/tree/elbow-end.gif +0 -0
  280. data/lipsiadmin_generators/backend/templates/images/ext/default/tree/elbow-line.gif +0 -0
  281. data/lipsiadmin_generators/backend/templates/images/ext/default/tree/elbow-minus-nl.gif +0 -0
  282. data/lipsiadmin_generators/backend/templates/images/ext/default/tree/elbow-minus.gif +0 -0
  283. data/lipsiadmin_generators/backend/templates/images/ext/default/tree/elbow-plus-nl.gif +0 -0
  284. data/lipsiadmin_generators/backend/templates/images/ext/default/tree/elbow-plus.gif +0 -0
  285. data/lipsiadmin_generators/backend/templates/images/ext/default/tree/elbow.gif +0 -0
  286. data/lipsiadmin_generators/backend/templates/images/ext/default/tree/folder-open.gif +0 -0
  287. data/lipsiadmin_generators/backend/templates/images/ext/default/tree/folder.gif +0 -0
  288. data/lipsiadmin_generators/backend/templates/images/ext/default/tree/leaf.gif +0 -0
  289. data/lipsiadmin_generators/backend/templates/images/ext/default/tree/loading.gif +0 -0
  290. data/lipsiadmin_generators/backend/templates/images/ext/default/tree/s.gif +0 -0
  291. data/lipsiadmin_generators/backend/templates/images/ext/default/window/icon-error.gif +0 -0
  292. data/lipsiadmin_generators/backend/templates/images/ext/default/window/icon-info.gif +0 -0
  293. data/lipsiadmin_generators/backend/templates/images/ext/default/window/icon-question.gif +0 -0
  294. data/lipsiadmin_generators/backend/templates/images/ext/default/window/icon-warning.gif +0 -0
  295. data/lipsiadmin_generators/backend/templates/images/ext/default/window/left-corners.png +0 -0
  296. data/lipsiadmin_generators/backend/templates/images/ext/default/window/left-corners.psd +0 -0
  297. data/lipsiadmin_generators/backend/templates/images/ext/default/window/left-right.png +0 -0
  298. data/lipsiadmin_generators/backend/templates/images/ext/default/window/left-right.psd +0 -0
  299. data/lipsiadmin_generators/backend/templates/images/ext/default/window/right-corners.png +0 -0
  300. data/lipsiadmin_generators/backend/templates/images/ext/default/window/right-corners.psd +0 -0
  301. data/lipsiadmin_generators/backend/templates/images/ext/default/window/top-bottom.png +0 -0
  302. data/lipsiadmin_generators/backend/templates/images/ext/default/window/top-bottom.psd +0 -0
  303. data/lipsiadmin_generators/backend/templates/images/ext/slate/button/btn-arrow.gif +0 -0
  304. data/lipsiadmin_generators/backend/templates/images/ext/slate/button/btn-sprite.gif +0 -0
  305. data/lipsiadmin_generators/backend/templates/images/ext/slate/editor/tb-sprite.gif +0 -0
  306. data/lipsiadmin_generators/backend/templates/images/ext/slate/form/checkbox.gif +0 -0
  307. data/lipsiadmin_generators/backend/templates/images/ext/slate/form/clear-trigger.gif +0 -0
  308. data/lipsiadmin_generators/backend/templates/images/ext/slate/form/date-trigger.gif +0 -0
  309. data/lipsiadmin_generators/backend/templates/images/ext/slate/form/radio.gif +0 -0
  310. data/lipsiadmin_generators/backend/templates/images/ext/slate/form/search-trigger.gif +0 -0
  311. data/lipsiadmin_generators/backend/templates/images/ext/slate/form/trigger-tpl.gif +0 -0
  312. data/lipsiadmin_generators/backend/templates/images/ext/slate/form/trigger.gif +0 -0
  313. data/lipsiadmin_generators/backend/templates/images/ext/slate/gradient-bg.gif +0 -0
  314. data/lipsiadmin_generators/backend/templates/images/ext/slate/grid/arrow-left-white.gif +0 -0
  315. data/lipsiadmin_generators/backend/templates/images/ext/slate/grid/arrow-right-white.gif +0 -0
  316. data/lipsiadmin_generators/backend/templates/images/ext/slate/grid/col-move-bottom.gif +0 -0
  317. data/lipsiadmin_generators/backend/templates/images/ext/slate/grid/col-move-top.gif +0 -0
  318. data/lipsiadmin_generators/backend/templates/images/ext/slate/grid/footer-bg.gif +0 -0
  319. data/lipsiadmin_generators/backend/templates/images/ext/slate/grid/grid-blue-hd.gif +0 -0
  320. data/lipsiadmin_generators/backend/templates/images/ext/slate/grid/grid-blue-split.gif +0 -0
  321. data/lipsiadmin_generators/backend/templates/images/ext/slate/grid/grid-hrow.gif +0 -0
  322. data/lipsiadmin_generators/backend/templates/images/ext/slate/grid/grid-split.gif +0 -0
  323. data/lipsiadmin_generators/backend/templates/images/ext/slate/grid/grid-vista-hd.gif +0 -0
  324. data/lipsiadmin_generators/backend/templates/images/ext/slate/grid/grid3-hd-btn.gif +0 -0
  325. data/lipsiadmin_generators/backend/templates/images/ext/slate/grid/grid3-hrow-over.gif +0 -0
  326. data/lipsiadmin_generators/backend/templates/images/ext/slate/grid/grid3-hrow.gif +0 -0
  327. data/lipsiadmin_generators/backend/templates/images/ext/slate/grid/grid3-special-col-bg.gif +0 -0
  328. data/lipsiadmin_generators/backend/templates/images/ext/slate/grid/grid3-special-col-sel-bg.gif +0 -0
  329. data/lipsiadmin_generators/backend/templates/images/ext/slate/grid/group-expand-sprite.gif +0 -0
  330. data/lipsiadmin_generators/backend/templates/images/ext/slate/grid/mso-hd.gif +0 -0
  331. data/lipsiadmin_generators/backend/templates/images/ext/slate/grid/page-first-disabled.gif +0 -0
  332. data/lipsiadmin_generators/backend/templates/images/ext/slate/grid/page-first.gif +0 -0
  333. data/lipsiadmin_generators/backend/templates/images/ext/slate/grid/page-last-disabled.gif +0 -0
  334. data/lipsiadmin_generators/backend/templates/images/ext/slate/grid/page-last.gif +0 -0
  335. data/lipsiadmin_generators/backend/templates/images/ext/slate/grid/page-next-disabled.gif +0 -0
  336. data/lipsiadmin_generators/backend/templates/images/ext/slate/grid/page-next.gif +0 -0
  337. data/lipsiadmin_generators/backend/templates/images/ext/slate/grid/page-prev-disabled.gif +0 -0
  338. data/lipsiadmin_generators/backend/templates/images/ext/slate/grid/page-prev.gif +0 -0
  339. data/lipsiadmin_generators/backend/templates/images/ext/slate/grid/refresh.gif +0 -0
  340. data/lipsiadmin_generators/backend/templates/images/ext/slate/grid/row-over.gif +0 -0
  341. data/lipsiadmin_generators/backend/templates/images/ext/slate/grid/row-sel.gif +0 -0
  342. data/lipsiadmin_generators/backend/templates/images/ext/slate/grid/sort_asc.gif +0 -0
  343. data/lipsiadmin_generators/backend/templates/images/ext/slate/grid/sort_desc.gif +0 -0
  344. data/lipsiadmin_generators/backend/templates/images/ext/slate/menu/checked.gif +0 -0
  345. data/lipsiadmin_generators/backend/templates/images/ext/slate/menu/group-checked.gif +0 -0
  346. data/lipsiadmin_generators/backend/templates/images/ext/slate/menu/item-over - Copy.gif +0 -0
  347. data/lipsiadmin_generators/backend/templates/images/ext/slate/menu/item-over.gif +0 -0
  348. data/lipsiadmin_generators/backend/templates/images/ext/slate/menu/menu-parent.gif +0 -0
  349. data/lipsiadmin_generators/backend/templates/images/ext/slate/menu/menu.gif +0 -0
  350. data/lipsiadmin_generators/backend/templates/images/ext/slate/menu/unchecked.gif +0 -0
  351. data/lipsiadmin_generators/backend/templates/images/ext/slate/panel/corners-sprite.gif +0 -0
  352. data/lipsiadmin_generators/backend/templates/images/ext/slate/panel/left-right.gif +0 -0
  353. data/lipsiadmin_generators/backend/templates/images/ext/slate/panel/light-hd.gif +0 -0
  354. data/lipsiadmin_generators/backend/templates/images/ext/slate/panel/tool-sprite-tpl.gif +0 -0
  355. data/lipsiadmin_generators/backend/templates/images/ext/slate/panel/tool-sprites.gif +0 -0
  356. data/lipsiadmin_generators/backend/templates/images/ext/slate/panel/tools-sprites-trans.gif +0 -0
  357. data/lipsiadmin_generators/backend/templates/images/ext/slate/panel/top-bottom.gif +0 -0
  358. data/lipsiadmin_generators/backend/templates/images/ext/slate/panel/top-bottom.png +0 -0
  359. data/lipsiadmin_generators/backend/templates/images/ext/slate/panel/white-corners-sprite.gif +0 -0
  360. data/lipsiadmin_generators/backend/templates/images/ext/slate/panel/white-left-right.gif +0 -0
  361. data/lipsiadmin_generators/backend/templates/images/ext/slate/panel/white-top-bottom.gif +0 -0
  362. data/lipsiadmin_generators/backend/templates/images/ext/slate/progress/progress-bg.gif +0 -0
  363. data/lipsiadmin_generators/backend/templates/images/ext/slate/qtip/bg.gif +0 -0
  364. data/lipsiadmin_generators/backend/templates/images/ext/slate/qtip/close.gif +0 -0
  365. data/lipsiadmin_generators/backend/templates/images/ext/slate/qtip/tip-sprite.gif +0 -0
  366. data/lipsiadmin_generators/backend/templates/images/ext/slate/s.gif +0 -0
  367. data/lipsiadmin_generators/backend/templates/images/ext/slate/shared/glass-bg.gif +0 -0
  368. data/lipsiadmin_generators/backend/templates/images/ext/slate/shared/hd-sprite.gif +0 -0
  369. data/lipsiadmin_generators/backend/templates/images/ext/slate/shared/left-btn.gif +0 -0
  370. data/lipsiadmin_generators/backend/templates/images/ext/slate/shared/right-btn.gif +0 -0
  371. data/lipsiadmin_generators/backend/templates/images/ext/slate/sizer/e-handle-dark.gif +0 -0
  372. data/lipsiadmin_generators/backend/templates/images/ext/slate/sizer/e-handle.gif +0 -0
  373. data/lipsiadmin_generators/backend/templates/images/ext/slate/sizer/ne-handle-dark.gif +0 -0
  374. data/lipsiadmin_generators/backend/templates/images/ext/slate/sizer/ne-handle.gif +0 -0
  375. data/lipsiadmin_generators/backend/templates/images/ext/slate/sizer/nw-handle-dark.gif +0 -0
  376. data/lipsiadmin_generators/backend/templates/images/ext/slate/sizer/nw-handle.gif +0 -0
  377. data/lipsiadmin_generators/backend/templates/images/ext/slate/sizer/s-handle-dark.gif +0 -0
  378. data/lipsiadmin_generators/backend/templates/images/ext/slate/sizer/s-handle.gif +0 -0
  379. data/lipsiadmin_generators/backend/templates/images/ext/slate/sizer/se-handle-dark.gif +0 -0
  380. data/lipsiadmin_generators/backend/templates/images/ext/slate/sizer/se-handle.gif +0 -0
  381. data/lipsiadmin_generators/backend/templates/images/ext/slate/sizer/square.gif +0 -0
  382. data/lipsiadmin_generators/backend/templates/images/ext/slate/sizer/sw-handle-dark.gif +0 -0
  383. data/lipsiadmin_generators/backend/templates/images/ext/slate/sizer/sw-handle.gif +0 -0
  384. data/lipsiadmin_generators/backend/templates/images/ext/slate/slider/slider-bg.png +0 -0
  385. data/lipsiadmin_generators/backend/templates/images/ext/slate/slider/slider-thumb.png +0 -0
  386. data/lipsiadmin_generators/backend/templates/images/ext/slate/slider/slider-v-bg.png +0 -0
  387. data/lipsiadmin_generators/backend/templates/images/ext/slate/slider/slider-v-thumb.png +0 -0
  388. data/lipsiadmin_generators/backend/templates/images/ext/slate/tabs/scroll-left.gif +0 -0
  389. data/lipsiadmin_generators/backend/templates/images/ext/slate/tabs/scroll-right.gif +0 -0
  390. data/lipsiadmin_generators/backend/templates/images/ext/slate/tabs/scroller-bg.gif +0 -0
  391. data/lipsiadmin_generators/backend/templates/images/ext/slate/tabs/tab-btm-inactive-left-bg.gif +0 -0
  392. data/lipsiadmin_generators/backend/templates/images/ext/slate/tabs/tab-btm-inactive-right-bg.gif +0 -0
  393. data/lipsiadmin_generators/backend/templates/images/ext/slate/tabs/tab-btm-left-bg.gif +0 -0
  394. data/lipsiadmin_generators/backend/templates/images/ext/slate/tabs/tab-btm-right-bg.gif +0 -0
  395. data/lipsiadmin_generators/backend/templates/images/ext/slate/tabs/tab-close.gif +0 -0
  396. data/lipsiadmin_generators/backend/templates/images/ext/slate/tabs/tab-strip-bg.gif +0 -0
  397. data/lipsiadmin_generators/backend/templates/images/ext/slate/tabs/tab-strip-bg.png +0 -0
  398. data/lipsiadmin_generators/backend/templates/images/ext/slate/tabs/tab-strip-btm-bg.gif +0 -0
  399. data/lipsiadmin_generators/backend/templates/images/ext/slate/tabs/tabs-sprite.gif +0 -0
  400. data/lipsiadmin_generators/backend/templates/images/ext/slate/toolbar/bg-menu.png +0 -0
  401. data/lipsiadmin_generators/backend/templates/images/ext/slate/toolbar/bg.gif +0 -0
  402. data/lipsiadmin_generators/backend/templates/images/ext/slate/toolbar/btn-arrow-light.gif +0 -0
  403. data/lipsiadmin_generators/backend/templates/images/ext/slate/toolbar/btn-arrow.gif +0 -0
  404. data/lipsiadmin_generators/backend/templates/images/ext/slate/toolbar/btn-over-bg.gif +0 -0
  405. data/lipsiadmin_generators/backend/templates/images/ext/slate/toolbar/gray-bg.gif +0 -0
  406. data/lipsiadmin_generators/backend/templates/images/ext/slate/toolbar/tb-bg.gif +0 -0
  407. data/lipsiadmin_generators/backend/templates/images/ext/slate/toolbar/tb-btn-sprite.gif +0 -0
  408. data/lipsiadmin_generators/backend/templates/images/ext/slate/tree/arrows.gif +0 -0
  409. data/lipsiadmin_generators/backend/templates/images/ext/slate/window/icon-error.gif +0 -0
  410. data/lipsiadmin_generators/backend/templates/images/ext/slate/window/icon-info.gif +0 -0
  411. data/lipsiadmin_generators/backend/templates/images/ext/slate/window/icon-question.gif +0 -0
  412. data/lipsiadmin_generators/backend/templates/images/ext/slate/window/icon-warning.gif +0 -0
  413. data/lipsiadmin_generators/backend/templates/images/ext/slate/window/left-corners.png +0 -0
  414. data/lipsiadmin_generators/backend/templates/images/ext/slate/window/left-right.png +0 -0
  415. data/lipsiadmin_generators/backend/templates/images/ext/slate/window/right-corners.png +0 -0
  416. data/lipsiadmin_generators/backend/templates/images/ext/slate/window/top-bottom.png +0 -0
  417. data/lipsiadmin_generators/backend/templates/javascripts/controls.js +3 -0
  418. data/lipsiadmin_generators/backend/templates/javascripts/dragdrop.js +3 -0
  419. data/lipsiadmin_generators/backend/templates/javascripts/effects.js +4 -0
  420. data/lipsiadmin_generators/backend/templates/javascripts/ext.js +76 -0
  421. data/lipsiadmin_generators/backend/templates/javascripts/prototype.js +12 -0
  422. data/lipsiadmin_generators/backend/templates/layouts/backend.html.haml +12 -0
  423. data/lipsiadmin_generators/backend/templates/layouts/frontend.html.haml +7 -0
  424. data/lipsiadmin_generators/backend/templates/migrations/create_accounts.rb +20 -0
  425. data/lipsiadmin_generators/backend/templates/models/account.rb +116 -0
  426. data/lipsiadmin_generators/backend/templates/models/account_access.rb +17 -0
  427. data/lipsiadmin_generators/backend/templates/models/notifier.rb +15 -0
  428. data/lipsiadmin_generators/backend/templates/stylesheets/backend-slate.css +105 -0
  429. data/lipsiadmin_generators/backend/templates/stylesheets/backend.css +74 -0
  430. data/lipsiadmin_generators/backend/templates/stylesheets/ext-slate.css +241 -0
  431. data/lipsiadmin_generators/backend/templates/stylesheets/ext.css +904 -0
  432. data/lipsiadmin_generators/backend/templates/stylesheets/login.css +22 -0
  433. data/lipsiadmin_generators/backend/templates/stylesheets/print.css +11 -0
  434. data/lipsiadmin_generators/backend/templates/stylesheets/standard.css +62 -0
  435. data/lipsiadmin_generators/backend/templates/views/backend/accounts/_form.html.haml +21 -0
  436. data/lipsiadmin_generators/backend/templates/views/backend/accounts/edit.html.haml +3 -0
  437. data/lipsiadmin_generators/backend/templates/views/backend/accounts/index.rjs +16 -0
  438. data/lipsiadmin_generators/backend/templates/views/backend/accounts/new.html.haml +3 -0
  439. data/lipsiadmin_generators/backend/templates/views/backend/base/index.html.haml +17 -0
  440. data/lipsiadmin_generators/backend/templates/views/backend/base/welcome.html.haml +2 -0
  441. data/lipsiadmin_generators/backend/templates/views/backend/sessions/new.html.haml +12 -0
  442. data/lipsiadmin_generators/backend/templates/views/javascripts/backend.js.erb +346 -0
  443. data/lipsiadmin_generators/backend/templates/views/javascripts/locale.js.erb +135 -0
  444. data/lipsiadmin_generators/backend/templates/views/notifier/registration.html.erb +2 -0
  445. data/lipsiadmin_generators/backend/templates/views/notifier/support_request.html.erb +1 -0
  446. data/lipsiadmin_generators/backend_page/REMEMBER +7 -0
  447. data/lipsiadmin_generators/backend_page/backend_page_generator.rb +212 -0
  448. data/lipsiadmin_generators/backend_page/templates/controller.rb +61 -0
  449. data/lipsiadmin_generators/backend_page/templates/form.html.haml +5 -0
  450. data/lipsiadmin_generators/backend_page/templates/form_scaffolding.html.haml +1 -0
  451. data/lipsiadmin_generators/backend_page/templates/functional_test.rb +45 -0
  452. data/lipsiadmin_generators/backend_page/templates/helper.rb +2 -0
  453. data/lipsiadmin_generators/backend_page/templates/view_edit.html.haml +3 -0
  454. data/lipsiadmin_generators/backend_page/templates/view_index.rjs.erb +16 -0
  455. data/lipsiadmin_generators/backend_page/templates/view_new.html.haml +3 -0
  456. data/lipsiadmin_generators/pdf/pdf_generator.rb +50 -0
  457. data/lipsiadmin_generators/pdf/templates/layout.html.erb +18 -0
  458. data/lipsiadmin_generators/pdf/templates/stylesheets/print.css +11 -0
  459. data/lipsiadmin_generators/pdf/templates/view.html.haml +7 -0
  460. data/resources/Pd4Ruby.class +0 -0
  461. data/resources/Pd4Ruby.java +52 -0
  462. data/resources/javascripts/ux.js +1102 -0
  463. data/resources/pd4ml.jar +0 -0
  464. data/resources/rdoc/horo.rb +613 -0
  465. data/resources/ss_css2.jar +0 -0
  466. data/tasks/lipsiadmin_tasks.rake +14 -0
  467. metadata +604 -0
@@ -0,0 +1,2 @@
1
+ module Lipsiadmin::<%= controller_class_name %>Helper
2
+ end
@@ -0,0 +1,3 @@
1
+ =title "Edit <%= model_instance.class.human_name %> n. #{@<%= singular_name %>.id}"
2
+ -form_tag({:action => :update, :id => @<%= singular_name %>}, :method => :put) do
3
+ =render :partial => "form"
@@ -0,0 +1,16 @@
1
+ page.grid do |grid|
2
+ grid.id "grid-<%= plural_name %>"
3
+ grid.title "List all <%= model_instance.class.human_name %>"
4
+ grid.base_path "/backend/<%= plural_name %>"
5
+ grid.forgery_protection_token request_forgery_protection_token
6
+ grid.authenticity_token form_authenticity_token
7
+ grid.tbar :default
8
+ grid.store do |store|
9
+ store.url "/backend/<%= plural_name %>.json"
10
+ store.fields @column_store.store_fields
11
+ end
12
+ grid.columns do |columns|
13
+ columns.fields @column_store.column_fields
14
+ end
15
+ grid.bbar :store => grid.get_store, :pageSize => params[:limit]
16
+ end
@@ -0,0 +1,3 @@
1
+ =title "New <%= model_instance.class.human_name %>"
2
+ -form_tag({:action => :create}, :method => :post) do
3
+ =render :partial => "form"
@@ -0,0 +1,50 @@
1
+ class PdfGenerator < Rails::Generator::NamedBase
2
+ def initialize(runtime_args, runtime_options = {})
3
+ runtime_args = ["pdf"].concat(runtime_args) # Skip usage
4
+ super
5
+ end
6
+
7
+ def manifest
8
+ record do |m|
9
+ # Copy Stylesheets
10
+ m.create_all("stylesheets", "public/stylesheets")
11
+
12
+ # Layout and Views
13
+ m.directory "app/views/pdf"
14
+ m.directory "app/views/layouts"
15
+
16
+ # Layout
17
+ m.template 'layout.html.erb', 'app/views/layouts/print.html.erb'
18
+
19
+ # View template for each action.
20
+ actions.each do |action|
21
+ m.template 'view.html.haml', "app/views/pdf/#{action}.html.haml",
22
+ :assigns => { :action => action }
23
+ end
24
+
25
+ m.puts remember
26
+ end
27
+ end
28
+
29
+
30
+ protected
31
+ def banner
32
+ "Usage: #{$0} pdf action"
33
+ end
34
+
35
+ def remember
36
+ <<-MESSAGE
37
+
38
+ ==============================================================================================
39
+
40
+ Please remember to add in your controller(s) some like:
41
+
42
+ #{actions.collect { |a|
43
+ " def generate_pdf_#{a}
44
+ render_pdf :#{a}, '#{a}_file.pdf'
45
+ end" }.join("\n\n")}
46
+
47
+ ==============================================================================================
48
+ MESSAGE
49
+ end
50
+ end
@@ -0,0 +1,18 @@
1
+ <html>
2
+ <head>
3
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
4
+ <%%= stylesheet_link_tag "standard", "print" %>
5
+ </head>
6
+ <body>
7
+ <pd4ml:page.header>
8
+ <div style="padding:0px 0px 100px 0px">
9
+ <%%= yield(:header) %>
10
+ </div>
11
+ </pd4ml:page.header>
12
+ <pd4ml:page.footer>
13
+ <%%= yield(:footer) %>
14
+ <div style="text-align:right;padding-top:10px"><%= I18n.t("backend.print.footer.page") %> $[page] <%= I18n.t("backend.print.footer.page_of") %> $[total]</div>
15
+ </pd4ml:page.footer>
16
+ <%%= yield %>
17
+ </body>
18
+ </html>
@@ -0,0 +1,11 @@
1
+ /*
2
+ * Lipsiasadmin
3
+ * Copyright(c) 2007-2008, LipsiaSoft s.r.l.
4
+ * info@lipsiasoft.com
5
+ *
6
+ * http://www.lipsiasoft.com
7
+ */
8
+ body { font-family:Arial;}
9
+ table { font-size:0.8em; font-family:Arial }
10
+ td { padding-right:10px; }
11
+ a { text-decoration:none; color:#12255F; }
@@ -0,0 +1,7 @@
1
+ -content_for(:header) do
2
+ Header Here!
3
+
4
+ Content Here!
5
+
6
+ -content_for(:footer) do
7
+ Footer Here!
Binary file
@@ -0,0 +1,52 @@
1
+ // For compile javac -cp pd4ml.jar Pd4Ruby.java
2
+ import java.awt.Dimension;
3
+ import java.awt.Insets;
4
+ import java.lang.reflect.Field;
5
+ import java.net.URL;
6
+
7
+ import org.zefer.pd4ml.PD4Constants;
8
+ import org.zefer.pd4ml.PD4ML;
9
+
10
+ public class Pd4Ruby {
11
+
12
+ public static void main(String[] args) throws Exception {
13
+
14
+ if ( args.length < 2 ) {
15
+ System.out.println( "Usage: java -Xmx512m Pd4Ruby <url> <htmlWidth> <pageFormat> <landescape> [TTFfontsDir]" );
16
+ }
17
+
18
+ Pd4Ruby converter = new Pd4Ruby();
19
+ converter.generatePDF( args[0], args[1], args[2], args[3], args.length > 4 ? args[4] : null );
20
+ }
21
+
22
+ private void generatePDF(String inputUrl, String htmlWidth, String pageFormat, String landescape, String fontsDir)
23
+ throws Exception {
24
+
25
+ PD4ML pd4ml = new PD4ML();
26
+ pd4ml.setPageInsets(new Insets(15, 20, 10, 20));
27
+
28
+ if (htmlWidth != null) {
29
+ pd4ml.setHtmlWidth(Integer.parseInt(htmlWidth));
30
+ }
31
+
32
+ Class c = PD4Constants.class;
33
+ Field f = c.getField( pageFormat );
34
+ Dimension d = (Dimension)f.get( pd4ml );
35
+
36
+ if (landescape.equals("true")){
37
+ d = pd4ml.changePageOrientation(d);
38
+ }
39
+
40
+ pd4ml.setPageSize(d);
41
+
42
+ pd4ml.setAuthorName("LipsiaSoft s.r.l.");
43
+
44
+ if ( fontsDir != null && fontsDir.length() > 0 ) {
45
+ pd4ml.useTTF( fontsDir, true );
46
+ }
47
+
48
+ java.io.StringReader reader = new java.io.StringReader(inputUrl);
49
+
50
+ pd4ml.render(reader, System.out);
51
+ }
52
+ }
@@ -0,0 +1,1102 @@
1
+ //
2
+ // Created by Davide D'Agostino on 2008-01-19.
3
+ // Copyright 2008 Lipsiasoft s.r.l. All rights reserved.
4
+ //
5
+ Ext.util.Format.eurMoney = function(v){
6
+ v = (Math.round((v-0)*100))/100;
7
+ v = (v == Math.floor(v)) ? v + ".00" : ((v*10 == Math.floor(v*10)) ? v + "0" : v);
8
+ return "€" + v ;
9
+ };
10
+
11
+ Ext.util.Format.boolRenderer = function(v, p, record){
12
+ p.css += ' x-grid3-check-col-td';
13
+ return '<div class="x-grid3-check-col'+(v?'-on':'')+' x-grid3-cc-'+this.id+'">&#160;</div>';
14
+ };
15
+
16
+ // Tree DropConfig to allow Drop on Leaf
17
+ var treeDropConfig = { getDropPoint : function(e, n, dd){ var tn = n.node; if(tn.isRoot){ return tn.allowChildren !== false ? "append" : false; } var dragEl = n.ddel; var t = Ext.lib.Dom.getY(dragEl), b = t + dragEl.offsetHeight; var y = Ext.lib.Event.getPageY(e); var noAppend = tn.allowChildren === false; if(this.appendOnly || tn.parentNode.allowChildren === false){ return noAppend ? false : "append"; } var noBelow = false; if(!this.allowParentInsert){ noBelow = tn.hasChildNodes() && tn.isExpanded(); } var q = (b - t) / (noAppend ? 2 : 3); if(y >= t && y < (t + q)){ return "above"; }else if(!noBelow && (noAppend || y >= b-q && y <= b)){ return "below"; }else{ return "append"; } }, completeDrop : function(de){ var ns = de.dropNode, p = de.point, t = de.target; if(!Ext.isArray(ns)){ ns = [ns]; } var n; for(var i = 0, len = ns.length; i < len; i++){ n = ns[i]; if(p == "above"){ t.parentNode.insertBefore(n, t); }else if(p == "below"){ t.parentNode.insertBefore(n, t.nextSibling); }else{ t.leaf = false; t.appendChild(n); } } n.ui.focus(); if(this.tree.hlDrop){ n.ui.highlight(); } t.ui.endDrop(); this.tree.fireEvent("nodedrop", de); } };
18
+
19
+ // Fix for Prototype Adapter
20
+ Ext.lib.Event.getTarget = function(e){
21
+ var ee = e.browserEvent || e;
22
+ return ee.target ? Event.element(ee) : null;
23
+ };
24
+
25
+ // CheckBox column
26
+ Ext.grid.CheckColumn = function(config){
27
+ Ext.apply(this, config);
28
+ if(!this.id){
29
+ this.id = Ext.id();
30
+ }
31
+ this.renderer = this.renderer.createDelegate(this);
32
+ };
33
+
34
+ Ext.grid.CheckColumn.prototype ={
35
+ init : function(grid){
36
+ this.grid = grid;
37
+ this.grid.on('render', function(){
38
+ var view = this.grid.getView();
39
+ view.mainBody.on('mousedown', this.onMouseDown, this);
40
+ }, this);
41
+ },
42
+
43
+ onMouseDown : function(e, t){
44
+ if(t.className && t.className.indexOf('x-grid3-cc-'+this.id) != -1){
45
+ e.stopEvent();
46
+ var index = this.grid.getView().findRowIndex(t);
47
+ var record = this.grid.store.getAt(index);
48
+ var editEvent = {
49
+ grid: this.grid,
50
+ record: this.grid.store.getAt(index),
51
+ field: this.dataIndex,
52
+ value: !record.data[this.dataIndex],
53
+ originalValue: record.data[this.dataIndex],
54
+ row: index,
55
+ column: this.grid.getColumnModel().findColumnIndex(this.dataIndex)
56
+ };
57
+ record.set(this.dataIndex, editEvent.value);
58
+ this.grid.getSelectionModel().selectRow(index);
59
+ this.grid.fireEvent('afteredit', editEvent);
60
+ }
61
+ },
62
+
63
+ renderer : function(v, p, record){
64
+ p.css += ' x-grid3-check-col-td';
65
+ return '<div class="x-grid3-check-col'+(v?'-on':'')+' x-grid3-cc-'+this.id+'">&#160;</div>';
66
+ }
67
+ };
68
+
69
+ // DateTime Field
70
+ Ext.form.DateTimeField = Ext.extend(Ext.form.Field, {
71
+ /**
72
+ * @cfg {String/Object} defaultAutoCreate DomHelper element spec
73
+ * Let superclass to create hidden field instead of textbox. Hidden will be submittend to server
74
+ */
75
+ defaultAutoCreate:{tag:'input', type:'hidden'}
76
+ /**
77
+ * @cfg {Number} timeWidth Width of time field in pixels (defaults to 100)
78
+ */
79
+ ,timeWidth:100
80
+ /**
81
+ * @cfg {Number} dateWidth Width of time field in pixels (defaults to 100)
82
+ */
83
+ ,dateWidth:100
84
+
85
+ /**
86
+ * @cfg {String} dtSeparator Date - Time separator. Used to split date and time (defaults to ' ' (space))
87
+ */
88
+ ,dtSeparator:' '
89
+ /**
90
+ * @cfg {String} hiddenFormat Format of datetime used to store value in hidden field
91
+ * and submitted to server (defaults to 'Y-m-d H:i:s' that is mysql format)
92
+ */
93
+ ,hiddenFormat:'Y-m-d H:i:s'
94
+ /**
95
+ * @cfg {Boolean} otherToNow Set other field to now() if not explicly filled in (defaults to true)
96
+ */
97
+ ,otherToNow:true
98
+ /**
99
+ * @cfg {Boolean} emptyToNow Set field value to now on attempt to set empty value.
100
+ * If it is true then setValue() sets value of field to current date and time (defaults to false)
101
+ */
102
+ /**
103
+ * @cfg {String} dateFormat Format of DateField. Can be localized. (defaults to 'm/y/d')
104
+ */
105
+ ,dateFormat:'d/m/y'
106
+ /**
107
+ * @cfg {String} timeFormat Format of TimeField. Can be localized. (defaults to 'g:i A')
108
+ */
109
+ ,timeFormat:'H:i'
110
+ /**
111
+ * @cfg {Object} dateConfig Config for DateField constructor.
112
+ */
113
+ ,allowBlank: false
114
+ /**
115
+ * @cfg {Object} true to hide the time, default false.
116
+ */
117
+ ,hideTime: false
118
+ // {{{
119
+ /**
120
+ * private
121
+ * creates DateField and TimeField and installs the necessary event handlers
122
+ */
123
+ ,initComponent:function() {
124
+ // call parent initComponent
125
+ Ext.form.DateTimeField.superclass.initComponent.call(this);
126
+
127
+ // create DateField
128
+ var dateConfig = Ext.apply({}, {
129
+ id:this.id + '-date'
130
+ ,format:this.dateFormat || Ext.form.DateField.prototype.format
131
+ ,width:this.dateWidth
132
+ ,allowBlank:this.allowBlank
133
+ ,selectOnFocus:this.selectOnFocus
134
+ ,listeners:{
135
+ blur:{scope:this, fn:this.onBlur}
136
+ ,focus:{scope:this, fn:this.onFocus}
137
+ }
138
+ }, this.dateConfig);
139
+ this.df = new Ext.form.DateField(dateConfig);
140
+ this.df.ownerCt = this;
141
+ delete(this.dateFormat);
142
+
143
+
144
+ // create TimeField
145
+ var timeConfig = Ext.apply({}, {
146
+ id:this.id + '-time'
147
+ ,format:this.timeFormat || Ext.form.TimeField.prototype.format
148
+ ,allowBlank:this.allowBlank
149
+ ,width:this.timeWidth
150
+ ,selectOnFocus:this.selectOnFocus
151
+ ,listeners:{
152
+ blur:{scope:this, fn:this.onBlur}
153
+ ,focus:{scope:this, fn:this.onFocus}
154
+ }
155
+ }, this.timeConfig);
156
+ this.tf = new Ext.form.TimeField(timeConfig);
157
+ this.tf.ownerCt = this;
158
+ delete(this.timeFormat);
159
+
160
+ // relay events
161
+ this.relayEvents(this.df, ['focus', 'specialkey', 'invalid', 'valid']);
162
+ this.relayEvents(this.tf, ['focus', 'specialkey', 'invalid', 'valid']);
163
+
164
+ } // eo function initComponent
165
+ // }}}
166
+ // {{{
167
+ /**
168
+ * private
169
+ * Renders underlying DateField and TimeField and provides a workaround for side error icon bug
170
+ */
171
+ ,onRender:function(ct, position) {
172
+ // don't run more than once
173
+ if(this.isRendered) {
174
+ return;
175
+ }
176
+ // render underlying hidden field
177
+ Ext.form.DateTimeField.superclass.onRender.call(this, ct, position);
178
+
179
+ // render DateField and TimeField
180
+ // create bounding table
181
+ var t;
182
+ var timeStyle = this.hideTime ? 'display:none' : '';
183
+ t = Ext.DomHelper.append(ct, {tag:'table',style:'border-collapse:collapse',children:[
184
+ {tag:'tr',children:[
185
+ {tag:'td',style:'padding-right:17px', cls:'datetime-date'},{tag:'td', cls:'datetime-time', style: timeStyle}
186
+ ]}
187
+ ]}, true);
188
+ this.tableEl = t;
189
+
190
+ this.wrap = t.wrap();
191
+ this.wrap.on("mousedown", this.onMouseDown, this, {delay:10});
192
+ // render DateField & TimeField
193
+ this.df.render(t.child('td.datetime-date'));
194
+ this.tf.render(t.child('td.datetime-time'));
195
+
196
+ this.df.wrap.setStyle({width: this.dateWidth});
197
+ this.tf.wrap.setStyle({width: this.timeWidth});
198
+
199
+ // workaround for IE trigger misalignment bug
200
+ if(Ext.isIE && Ext.isStrict) {
201
+ t.select('input').applyStyles({top:0});
202
+ }
203
+
204
+ this.on('specialkey', this.onSpecialKey, this);
205
+ this.df.el.swallowEvent(['keydown', 'keypress']);
206
+ this.tf.el.swallowEvent(['keydown', 'keypress']);
207
+
208
+ // create icon for side invalid errorIcon
209
+ if('side' === this.msgTarget) {
210
+ var elp = this.el.findParent('.x-form-element', 10, true);
211
+ this.errorIcon = elp.createChild({cls:'x-form-invalid-icon'});
212
+
213
+ this.df.errorIcon = this.errorIcon;
214
+ this.tf.errorIcon = this.errorIcon;
215
+ }
216
+
217
+ // setup name for submit
218
+ if (!this.el.dom.name){
219
+ this.el.dom.name = this.hiddenName || this.name || this.id;
220
+ }
221
+
222
+ // prevent helper fields from being submitted
223
+ this.df.el.dom.removeAttribute("name");
224
+ this.tf.el.dom.removeAttribute("name");
225
+
226
+ // we're rendered flag
227
+ this.isRendered = true;
228
+ if (this.el.dom.value){
229
+ this.setValue(this.el.dom.value);
230
+ } else {
231
+ this.setValue(new Date());
232
+ this.updateHidden();
233
+ }
234
+ } // eo function onRender
235
+ // }}}
236
+ // {{{
237
+ /**
238
+ * private
239
+ */
240
+ ,adjustSize:Ext.BoxComponent.prototype.adjustSize
241
+ // }}}
242
+ // {{{
243
+ /**
244
+ * private
245
+ */
246
+ ,alignErrorIcon:function() {
247
+ this.errorIcon.alignTo(this.tableEl, 'tl-tr', [2, 0]);
248
+ }
249
+ // }}}
250
+ // {{{
251
+ /**
252
+ * private initializes internal dateValue
253
+ */
254
+ ,initDateValue:function() {
255
+ this.dateValue = this.otherToNow ? new Date() : new Date(1970, 0, 1, 0, 0, 0);
256
+ }
257
+ // }}}
258
+ // {{{
259
+ /**
260
+ * Calls clearInvalid on the DateField and TimeField
261
+ */
262
+ ,clearInvalid:function(){
263
+ this.df.clearInvalid();
264
+ this.tf.clearInvalid();
265
+ } // eo function clearInvalid
266
+ // }}}
267
+
268
+ /**
269
+ * @private
270
+ * called from Component::destroy.
271
+ * Destroys all elements and removes all listeners we've created.
272
+ */
273
+ ,beforeDestroy:function() {
274
+ if(this.isRendered) {
275
+ // this.removeAllListeners();
276
+ this.wrap.removeAllListeners();
277
+ this.wrap.remove();
278
+ this.tableEl.remove();
279
+ this.df.destroy();
280
+ this.tf.destroy();
281
+ }
282
+ } // eo function beforeDestroy
283
+
284
+ // {{{
285
+ /**
286
+ * Disable this component.
287
+ * @return {Ext.Component} this
288
+ */
289
+ ,disable:function() {
290
+ if(this.isRendered) {
291
+ this.df.disabled = this.disabled;
292
+ this.df.onDisable();
293
+ this.tf.onDisable();
294
+ }
295
+ this.disabled = true;
296
+ this.df.disabled = true;
297
+ this.tf.disabled = true;
298
+ this.fireEvent("disable", this);
299
+ return this;
300
+ } // eo function disable
301
+ // }}}
302
+ // {{{
303
+ /**
304
+ * Enable this component.
305
+ * @return {Ext.Component} this
306
+ */
307
+ ,enable:function() {
308
+ if(this.rendered){
309
+ this.df.onEnable();
310
+ this.tf.onEnable();
311
+ }
312
+ this.disabled = false;
313
+ this.df.disabled = false;
314
+ this.tf.disabled = false;
315
+ this.fireEvent("enable", this);
316
+ return this;
317
+ } // eo function enable
318
+ // }}}
319
+ // {{{
320
+ /**
321
+ * private Focus date filed
322
+ */
323
+ ,focus:function() {
324
+ this.df.focus();
325
+ } // eo function focus
326
+ // }}}
327
+ // {{{
328
+ /**
329
+ * private
330
+ */
331
+ ,getPositionEl:function() {
332
+ return this.wrap;
333
+ }
334
+ // }}}
335
+ // {{{
336
+ /**
337
+ * private
338
+ */
339
+ ,getResizeEl:function() {
340
+ return this.wrap;
341
+ }
342
+ // }}}
343
+ // {{{
344
+ /**
345
+ * @return {Date/String} Returns value of this field
346
+ */
347
+ ,getValue:function() {
348
+ // create new instance of date
349
+ return this.dateValue ? new Date(this.dateValue) : '';
350
+ } // eo function getValue
351
+ // }}}
352
+ // {{{
353
+ /**
354
+ * @return {Boolean} true = valid, false = invalid
355
+ * private Calls isValid methods of underlying DateField and TimeField and returns the result
356
+ */
357
+ ,isValid:function() {
358
+ return this.df.isValid() && this.tf.isValid();
359
+ } // eo function isValid
360
+ // }}}
361
+ // {{{
362
+ /**
363
+ * Returns true if this component is visible
364
+ * @return {boolean}
365
+ */
366
+ ,isVisible : function(){
367
+ return this.df.rendered && this.df.getActionEl().isVisible();
368
+ } // eo function isVisible
369
+ // }}}
370
+ // {{{
371
+ /**
372
+ * private Handles blur event
373
+ */
374
+ ,onBlur:function(f) {
375
+ // called by both DateField and TimeField blur events
376
+
377
+ // revert focus to previous field if clicked in between
378
+ if(this.wrapClick) {
379
+ f.focus();
380
+ this.wrapClick = false;
381
+ }
382
+
383
+ // update underlying value
384
+ this.updateDate();
385
+ this.updateTime();
386
+ this.updateHidden();
387
+
388
+ // fire events later
389
+ (function() {
390
+ if(!this.df.hasFocus && !this.tf.hasFocus) {
391
+ var v = this.getValue();
392
+ if(String(v) !== String(this.startValue)) {
393
+ this.fireEvent("change", this, v, this.startValue);
394
+ }
395
+ this.hasFocus = false;
396
+ this.fireEvent('blur', this);
397
+ }
398
+ }).defer(100, this);
399
+
400
+ } // eo function onBlur
401
+ // }}}
402
+ // {{{
403
+ /**
404
+ * private Handles focus event
405
+ */
406
+ ,onFocus:function() {
407
+ if(!this.hasFocus){
408
+ this.hasFocus = true;
409
+ this.startValue = this.getValue();
410
+ this.fireEvent("focus", this);
411
+ }
412
+ }
413
+ // }}}
414
+ // {{{
415
+ /**
416
+ * private Just to prevent blur event when clicked in the middle of fields
417
+ */
418
+ ,onMouseDown:function(e) {
419
+ if(!this.disabled) {
420
+ this.wrapClick = 'td' === e.target.nodeName.toLowerCase();
421
+ }
422
+ }
423
+ // }}}
424
+ // {{{
425
+ /**
426
+ * private
427
+ * Handles Tab and Shift-Tab events
428
+ */
429
+ ,onSpecialKey:function(t, e) {
430
+ var key = e.getKey();
431
+ if(key === e.TAB) {
432
+ if(t === this.df && !e.shiftKey) {
433
+ e.stopEvent();
434
+ this.tf.focus();
435
+ }
436
+ if(t === this.tf && e.shiftKey) {
437
+ e.stopEvent();
438
+ this.df.focus();
439
+ }
440
+ }
441
+ // otherwise it misbehaves in editor grid
442
+ if(key === e.ENTER) {
443
+ this.updateValue();
444
+ }
445
+
446
+ } // eo function onSpecialKey
447
+ // }}}
448
+ // {{{
449
+ /**
450
+ * private Sets the value of DateField
451
+ */
452
+ ,setDate:function(date) {
453
+ this.df.setValue(date);
454
+ } // eo function setDate
455
+ // }}}
456
+ // {{{
457
+ /**
458
+ * private Sets the value of TimeField
459
+ */
460
+ ,setTime:function(date) {
461
+ this.tf.setValue(date);
462
+ } // eo function setTime
463
+ // }}}
464
+ // {{{
465
+ /**
466
+ * private
467
+ * Sets correct sizes of underlying DateField and TimeField
468
+ * With workarounds for IE bugs
469
+ */
470
+ ,setSize:function(w, h) {
471
+ if(!w) {
472
+ return;
473
+ }
474
+ if('below' === this.timePosition) {
475
+ this.df.setSize(w, h);
476
+ this.tf.setSize(w, h);
477
+ if(Ext.isIE) {
478
+ this.df.el.up('td').setWidth(w);
479
+ this.tf.el.up('td').setWidth(w);
480
+ }
481
+ }
482
+ else {
483
+ this.df.setSize(w - this.timeWidth - 4, h);
484
+ this.tf.setSize(this.timeWidth, h);
485
+
486
+ if(Ext.isIE) {
487
+ this.df.el.up('td').setWidth(w - this.timeWidth - 4);
488
+ this.tf.el.up('td').setWidth(this.timeWidth);
489
+ }
490
+ }
491
+ } // eo function setSize
492
+ // }}}
493
+ // {{{
494
+ /**
495
+ * @param {Mixed} val Value to set
496
+ * Sets the value of this field
497
+ */
498
+ ,setValue:function(val) {
499
+ if(!val && true === this.emptyToNow) {
500
+ this.setValue(new Date());
501
+ return;
502
+ }
503
+ else if(!val) {
504
+ this.setDate('');
505
+ this.setTime('');
506
+ this.updateValue();
507
+ return;
508
+ }
509
+ if ('number' === typeof val) {
510
+ val = new Date(val);
511
+ }
512
+ val = val ? val : new Date(1970, 0 ,1, 0, 0, 0);
513
+ var da, time;
514
+ if(val instanceof Date) {
515
+ this.setDate(val);
516
+ this.setTime(val);
517
+ this.dateValue = new Date(val);
518
+ }
519
+ else {
520
+ da = val.split(this.dtSeparator);
521
+ this.setDate(da[0]);
522
+ if(da[1]) {
523
+ if(da[2]) {
524
+ // add am/pm part back to time
525
+ da[1] += da[2];
526
+ }
527
+ var hh = da[1].split(":");
528
+ this.setTime(hh[0]+":"+hh[1]);
529
+ }
530
+ }
531
+ } // eo function setValue
532
+ // }}}
533
+ // {{{
534
+ /**
535
+ * Hide or show this component by boolean
536
+ * @return {Ext.Component} this
537
+ */
538
+ ,setVisible: function(visible){
539
+ if(visible) {
540
+ this.df.show();
541
+ this.tf.show();
542
+ }else{
543
+ this.df.hide();
544
+ this.tf.hide();
545
+ }
546
+ return this;
547
+ } // eo function setVisible
548
+ // }}}
549
+ //{{{
550
+ ,show:function() {
551
+ return this.setVisible(true);
552
+ } // eo function show
553
+ //}}}
554
+ //{{{
555
+ ,hide:function() {
556
+ return this.setVisible(false);
557
+ } // eo function hide
558
+ //}}}
559
+ // {{{
560
+ /**
561
+ * private Updates the date part
562
+ */
563
+ ,updateDate:function() {
564
+ var d = this.df.getValue();
565
+ if(d) {
566
+ if(!(this.dateValue instanceof Date)) {
567
+ this.initDateValue();
568
+ if(!this.tf.getValue()) {
569
+ this.setTime(this.dateValue);
570
+ }
571
+ }
572
+ this.dateValue.setMonth(0); // because of leap years
573
+ this.dateValue.setFullYear(d.getFullYear());
574
+ this.dateValue.setMonth(d.getMonth());
575
+ this.dateValue.setDate(d.getDate());
576
+ }
577
+ else {
578
+ this.dateValue = '';
579
+ this.setTime('');
580
+ }
581
+ } // eo function updateDate
582
+ // }}}
583
+ // {{{
584
+ /**
585
+ * private
586
+ * Updates the time part
587
+ */
588
+ ,updateTime:function() {
589
+ var t = this.tf.getValue();
590
+ if(t && !(t instanceof Date)) {
591
+ t = Date.parseDate(t, this.tf.format);
592
+ }
593
+ if(t && !this.df.getValue()) {
594
+ this.initDateValue();
595
+ this.setDate(this.dateValue);
596
+ }
597
+ if(this.dateValue instanceof Date) {
598
+ if(t) {
599
+ this.dateValue.setHours(t.getHours());
600
+ this.dateValue.setMinutes(t.getMinutes());
601
+ this.dateValue.setSeconds(t.getSeconds());
602
+ }
603
+ else {
604
+ this.dateValue.setHours(0);
605
+ this.dateValue.setMinutes(0);
606
+ this.dateValue.setSeconds(0);
607
+ }
608
+ }
609
+ } // eo function updateTime
610
+ // }}}
611
+ // {{{
612
+ /**
613
+ * private Updates the underlying hidden field value
614
+ */
615
+ ,updateHidden:function() {
616
+ if(this.isRendered) {
617
+ var value = this.dateValue instanceof Date ? this.dateValue.format(this.hiddenFormat) : '';
618
+ this.el.dom.value = value;
619
+ }
620
+ }
621
+ // }}}
622
+ // {{{
623
+ /**
624
+ * private Updates all of Date, Time and Hidden
625
+ */
626
+ ,updateValue:function() {
627
+
628
+ this.updateDate();
629
+ this.updateTime();
630
+ this.updateHidden();
631
+ return;
632
+ } // eo function updateValue
633
+ // }}}
634
+ // {{{
635
+ /**
636
+ * @return {Boolean} true = valid, false = invalid
637
+ * callse validate methods of DateField and TimeField
638
+ */
639
+ ,validate:function() {
640
+ return this.df.validate() && this.tf.validate();
641
+ } // eo function validate
642
+ // }}}
643
+ // {{{
644
+ /**
645
+ * Returns renderer suitable to render this field
646
+ * @param {Object} Column model config
647
+ */
648
+ ,renderer: function(field) {
649
+ var format = field.editor.dateFormat || Ext.form.DateTime.prototype.dateFormat;
650
+ format += ' ' + (field.editor.timeFormat || Ext.form.DateTime.prototype.timeFormat);
651
+ var renderer = function(val) {
652
+ var retval = Ext.util.Format.date(val, format);
653
+ return retval;
654
+ };
655
+ return renderer;
656
+ } // eo function renderer
657
+ // }}}
658
+
659
+ }); // eo extend
660
+
661
+ // register xtype
662
+ Ext.reg('datetimefield', Ext.form.DateTimeField);
663
+
664
+ /**
665
+ * @class Ext.grid.Search
666
+ * @extends Ext.util.Observable
667
+ * @param {Object} config configuration object
668
+ * @constructor
669
+ */
670
+ Ext.grid.Search = function(config) {
671
+ Ext.apply(this, config);
672
+ Ext.grid.Search.superclass.constructor.call(this);
673
+ }; // eo constructor
674
+
675
+ Ext.extend(Ext.grid.Search, Ext.util.Observable, {
676
+ /**
677
+ * cfg {Boolean} autoFocus true to try to focus the input field on each store load (defaults to undefined)
678
+ */
679
+ autoFocus:true
680
+ /**
681
+ * @cfg {String} searchText Text to display on menu button
682
+ */
683
+ ,searchText:'Search'
684
+
685
+ /**
686
+ * @cfg {String} searchTipText Text to display as input tooltip. Set to '' for no tooltip
687
+ */
688
+ ,searchTipText:'Insert a word or press Search'
689
+
690
+ /**
691
+ * @cfg {String} selectAllText Text to display on menu item that selects all fields
692
+ */
693
+ ,selectAllText:'Select All'
694
+
695
+ /**
696
+ * @cfg {String} position Where to display the search controls. Valid values are top and bottom (defaults to top)
697
+ * Corresponding toolbar has to exist at least with mimimum configuration tbar:[] for position:top or bbar:[]
698
+ * for position bottom. Plugin does NOT create any toolbar.
699
+ */
700
+ ,position:'top'
701
+
702
+ /**
703
+ * @cfg {String} iconCls Icon class for menu button (defaults to check)
704
+ */
705
+ ,iconCls:'check'
706
+
707
+ /**
708
+ * @cfg {String/Array} checkIndexes Which indexes to check by default. Can be either 'all' for all indexes
709
+ * or array of dataIndex names, e.g. ['persFirstName', 'persLastName']
710
+ */
711
+ ,checkIndexes:'all'
712
+
713
+ /**
714
+ * @cfg {Array} disableIndexes Array of index names to disable (not show in the menu), e.g. ['persTitle', 'persTitle2']
715
+ */
716
+ ,disableIndexes:[]
717
+
718
+ /**
719
+ * @cfg {String} dateFormat how to format date values. If undefined (the default)
720
+ * date is formatted as configured in colummn model
721
+ */
722
+ ,dateFormat:undefined
723
+
724
+ /**
725
+ * @cfg {Boolean} showSelectAll Select All item is shown in menu if true (defaults to true)
726
+ */
727
+ ,showSelectAll:true
728
+
729
+ /**
730
+ * @cfg {String} menuStyle Valid values are 'checkbox' and 'radio'. If menuStyle is radio
731
+ * then only one field can be searched at a time and selectAll is automatically switched off.
732
+ */
733
+ ,menuStyle:'checkbox'
734
+
735
+ /**
736
+ * @cfg {Number} minChars minimum characters to type before the request is made. If undefined (the default)
737
+ * the trigger field shows magnifier icon and you need to click it or press enter for search to start. If it
738
+ * is defined and greater than 0 then maginfier is not shown and search starts after minChars are typed.
739
+ */
740
+
741
+ /**
742
+ * @cfg {String} minCharsTipText Tooltip to display if minChars is > 0
743
+ */
744
+ ,minCharsTipText:'Insert at least {0} characters'
745
+
746
+ /**
747
+ * @cfg {String} mode Use 'remote' for remote stores or 'local' for local stores. If mode is local
748
+ * no data requests are sent to server the grid's store is filtered instead (defaults to 'remote')
749
+ */
750
+ ,mode:'remote'
751
+
752
+ /**
753
+ * @cfg {Array} readonlyIndexes Array of index names to disable (show in menu disabled), e.g. ['persTitle', 'persTitle2']
754
+ */
755
+
756
+ /**
757
+ * @cfg {Number} width Width of input field in pixels (defaults to 100)
758
+ */
759
+ ,width:200
760
+
761
+ /**
762
+ * @cfg {String} xtype xtype is usually not used to instantiate this plugin but you have a chance to identify it
763
+ */
764
+ ,xtype:'gridsearch'
765
+
766
+ /**
767
+ * @cfg {Object} paramNames Params name map (defaults to {fields:'fields', query:'query'}
768
+ */
769
+ ,paramNames: {
770
+ fields:'fields'
771
+ ,query:'query'
772
+ }
773
+
774
+ /**
775
+ * @cfg {String} shortcutKey Key to fucus the input field (defaults to r = Sea_r_ch). Empty string disables shortcut
776
+ */
777
+ ,shortcutKey:'r'
778
+
779
+ /**
780
+ * @cfg {String} shortcutModifier Modifier for shortcutKey. Valid values: alt, ctrl, shift (defaults to alt)
781
+ */
782
+ ,shortcutModifier:'alt'
783
+
784
+ /**
785
+ * @cfg {String} align 'left' or 'right' (defaults to 'right')
786
+ */
787
+ ,align:'right'
788
+
789
+ /**
790
+ * @cfg {Number} minLength force user to type this many character before he can make a search
791
+ */
792
+ ,minLength:3
793
+
794
+ /**
795
+ * @cfg {Ext.Panel/String} toolbarContainer Panel (or id of the panel) which contains toolbar we want to render
796
+ * search controls to (defaults to this.grid, the grid this plugin is plugged-in into)
797
+ */
798
+ // {{{
799
+ /**
800
+ * private
801
+ * @param {Ext.grid.GridPanel/Ext.grid.EditorGrid} grid reference to grid this plugin is used for
802
+ */
803
+ ,init:function(grid) {
804
+ this.grid = grid;
805
+
806
+ // setup toolbar container if id was given
807
+ if('string' === typeof this.toolbarContainer) {
808
+ this.toolbarContainer = Ext.getCmp(this.toolbarContainer);
809
+ }
810
+
811
+ // do our processing after grid render and reconfigure
812
+ grid.onRender = grid.onRender.createSequence(this.onRender, this);
813
+ grid.reconfigure = grid.reconfigure.createSequence(this.reconfigure, this);
814
+ } // eo function init
815
+ // }}}
816
+ // {{{
817
+ /**
818
+ * private add plugin controls to <b>existing</b> toolbar and calls reconfigure
819
+ */
820
+ ,onRender:function() {
821
+ var panel = this.toolbarContainer || this.grid;
822
+ var tb = 'bottom' === this.position ? panel.bottomToolbar : panel.topToolbar;
823
+
824
+ // add menu
825
+ this.menu = new Ext.menu.Menu();
826
+
827
+ // handle position
828
+ if('right' === this.align) {
829
+ tb.addFill();
830
+ }
831
+ else {
832
+ if(0 < tb.items.getCount()) {
833
+ tb.addSeparator();
834
+ }
835
+ }
836
+
837
+ // add menu button
838
+ tb.add({
839
+ text:this.searchText
840
+ ,menu:this.menu
841
+ //,iconCls:this.iconCls
842
+ });
843
+
844
+ // add input field (TwinTriggerField in fact)
845
+ this.field = new Ext.form.TwinTriggerField({
846
+ width:this.width
847
+ ,selectOnFocus:undefined === this.selectOnFocus ? true : this.selectOnFocus
848
+ ,trigger1Class:'x-form-clear-trigger'
849
+ ,trigger2Class:this.minChars ? 'x-hidden' : 'x-form-search-trigger'
850
+ ,onTrigger1Click:this.minChars ? Ext.emptyFn : this.onTriggerClear.createDelegate(this)
851
+ ,onTrigger2Click:this.onTriggerSearch.createDelegate(this)
852
+ ,minLength:this.minLength
853
+ });
854
+
855
+ // install event handlers on input field
856
+ this.field.on('render', function() {
857
+ this.field.el.dom.qtip = this.minChars ? String.format(this.minCharsTipText, this.minChars) : this.searchTipText;
858
+
859
+ if(this.minChars) {
860
+ this.field.el.on({scope:this, buffer:300, keyup:this.onKeyUp});
861
+ }
862
+
863
+ // install key map
864
+ var map = new Ext.KeyMap(this.field.el, [{
865
+ key:Ext.EventObject.ENTER
866
+ ,scope:this
867
+ ,fn:this.onTriggerSearch
868
+ },{
869
+ key:Ext.EventObject.ESC
870
+ ,scope:this
871
+ ,fn:this.onTriggerClear
872
+ }]);
873
+ map.stopEvent = true;
874
+ }, this, {single:true});
875
+
876
+ tb.add(this.field);
877
+
878
+ // reconfigure
879
+ this.reconfigure();
880
+
881
+ // keyMap
882
+ if(this.shortcutKey && this.shortcutModifier) {
883
+ var shortcutEl = this.grid.getEl();
884
+ var shortcutCfg = [{
885
+ key:this.shortcutKey
886
+ ,scope:this
887
+ ,stopEvent:true
888
+ ,fn:function() {
889
+ this.field.focus();
890
+ }
891
+ }];
892
+ shortcutCfg[0][this.shortcutModifier] = true;
893
+ this.keymap = new Ext.KeyMap(shortcutEl, shortcutCfg);
894
+ }
895
+
896
+ if(true === this.autoFocus) {
897
+ this.grid.store.on({scope:this, load:function(){this.field.focus();}});
898
+ }
899
+ } // eo function onRender
900
+ // }}}
901
+ // {{{
902
+ /**
903
+ * field el keypup event handler. Triggers the search
904
+ * @private
905
+ */
906
+ ,onKeyUp:function() {
907
+ var length = this.field.getValue().toString().length;
908
+ if(0 === length || this.minChars <= length) {
909
+ this.onTriggerSearch();
910
+ }
911
+ } // eo function onKeyUp
912
+ // }}}
913
+ // {{{
914
+ /**
915
+ * private Clear Trigger click handler
916
+ */
917
+ ,onTriggerClear:function() {
918
+ if(this.field.getValue()) {
919
+ this.field.setValue('');
920
+ this.field.focus();
921
+ this.onTriggerSearch();
922
+ }
923
+ } // eo function onTriggerClear
924
+ // }}}
925
+ // {{{
926
+ /**
927
+ * private Search Trigger click handler (executes the search, local or remote)
928
+ */
929
+ ,onTriggerSearch:function() {
930
+ if(!this.field.isValid()) {
931
+ return;
932
+ }
933
+ var val = this.field.getValue();
934
+ var store = this.grid.store;
935
+
936
+ // grid's store filter
937
+ if('local' === this.mode) {
938
+ store.clearFilter();
939
+ if(val) {
940
+ store.filterBy(function(r) {
941
+ var retval = false;
942
+ this.menu.items.each(function(item) {
943
+ if(!item.checked || retval) {
944
+ return;
945
+ }
946
+ var rv = r.get(item.dataIndex);
947
+ rv = rv instanceof Date ? rv.format(this.dateFormat || r.fields.get(item.dataIndex).dateFormat) : rv;
948
+ var re = new RegExp(val, 'gi');
949
+ retval = re.test(rv);
950
+ }, this);
951
+ if(retval) {
952
+ return true;
953
+ }
954
+ return retval;
955
+ }, this);
956
+ }
957
+ else {
958
+ }
959
+ }
960
+ // ask server to filter records
961
+ else {
962
+ // clear start (necessary if we have paging)
963
+ if(store.lastOptions && store.lastOptions.params) {
964
+ store.lastOptions.params[store.paramNames.start] = 0;
965
+ }
966
+
967
+ // get fields to search array
968
+ var fields = [];
969
+ this.menu.items.each(function(item) {
970
+ if(item.checked && item.dataIndex) {
971
+ fields.push(item.dataIndex);
972
+ }
973
+ });
974
+
975
+ // add fields and query to baseParams of store
976
+ delete(store.baseParams[this.paramNames.fields]);
977
+ delete(store.baseParams[this.paramNames.query]);
978
+ if (store.lastOptions && store.lastOptions.params) {
979
+ delete(store.lastOptions.params[this.paramNames.fields]);
980
+ delete(store.lastOptions.params[this.paramNames.query]);
981
+ }
982
+ if(fields.length) {
983
+ store.baseParams[this.paramNames.fields] = fields.compact().join();
984
+ store.baseParams[this.paramNames.query] = val;
985
+ }
986
+ // reload store
987
+ store.reload();
988
+ }
989
+
990
+ } // eo function onTriggerSearch
991
+ // }}}
992
+ // {{{
993
+ /**
994
+ * @param {Boolean} true to disable search (TwinTriggerField), false to enable
995
+ */
996
+ ,setDisabled:function() {
997
+ this.field.setDisabled.apply(this.field, arguments);
998
+ } // eo function setDisabled
999
+ // }}}
1000
+ // {{{
1001
+ /**
1002
+ * Enable search (TwinTriggerField)
1003
+ */
1004
+ ,enable:function() {
1005
+ this.setDisabled(false);
1006
+ } // eo function enable
1007
+ // }}}
1008
+ // {{{
1009
+ /**
1010
+ * Enable search (TwinTriggerField)
1011
+ */
1012
+ ,disable:function() {
1013
+ this.setDisabled(true);
1014
+ } // eo function disable
1015
+ // }}}
1016
+ // {{{
1017
+ /**
1018
+ * private (re)configures the plugin, creates menu items from column model
1019
+ */
1020
+ ,reconfigure:function() {
1021
+
1022
+ // {{{
1023
+ // remove old items
1024
+ var menu = this.menu;
1025
+ menu.removeAll();
1026
+
1027
+ // add Select All item plus separator
1028
+ if(this.showSelectAll && 'radio' !== this.menuStyle) {
1029
+ menu.add(new Ext.menu.CheckItem({
1030
+ text:this.selectAllText
1031
+ ,checked:!(this.checkIndexes instanceof Array)
1032
+ ,hideOnClick:false
1033
+ ,handler:function(item) {
1034
+ var checked = ! item.checked;
1035
+ item.parentMenu.items.each(function(i) {
1036
+ if(item !== i && i.setChecked && !i.disabled) {
1037
+ i.setChecked(checked);
1038
+ }
1039
+ });
1040
+ }
1041
+ }),'-');
1042
+ }
1043
+
1044
+ // }}}
1045
+ // {{{
1046
+ // add new items
1047
+ var cm = this.grid.colModel;
1048
+ var group = undefined;
1049
+ if('radio' === this.menuStyle) {
1050
+ group = 'g' + (new Date).getTime();
1051
+ }
1052
+ Ext.each(cm.config, function(config) {
1053
+ var disable = false;
1054
+ if(config.header && config.dataIndex && config.sortable) {
1055
+ Ext.each(this.disableIndexes, function(item) {
1056
+ disable = disable ? disable : item === config.dataIndex;
1057
+ });
1058
+ if(!disable) {
1059
+ menu.add(new Ext.menu.CheckItem({
1060
+ text:config.header
1061
+ ,hideOnClick:false
1062
+ ,group:group
1063
+ ,checked:'all' === this.checkIndexes
1064
+ ,dataIndex:config.dataIndex
1065
+ }));
1066
+ }
1067
+ }
1068
+ }, this);
1069
+ // }}}
1070
+ // {{{
1071
+ // check items
1072
+ if(this.checkIndexes instanceof Array) {
1073
+ Ext.each(this.checkIndexes, function(di) {
1074
+ var item = menu.items.find(function(itm) {
1075
+ return itm.dataIndex === di;
1076
+ });
1077
+ if(item) {
1078
+ item.setChecked(true, true);
1079
+ }
1080
+ }, this);
1081
+ }
1082
+ // }}}
1083
+ // {{{
1084
+ // disable items
1085
+ if(this.readonlyIndexes instanceof Array) {
1086
+ Ext.each(this.readonlyIndexes, function(di) {
1087
+ var item = menu.items.find(function(itm) {
1088
+ return itm.dataIndex === di;
1089
+ });
1090
+ if(item) {
1091
+ item.disable();
1092
+ }
1093
+ }, this);
1094
+ }
1095
+ // }}}
1096
+
1097
+ } // eo function reconfigure
1098
+ // }}}
1099
+
1100
+ }); // eo extend
1101
+
1102
+ // eof