Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

first commit

  • Loading branch information...
commit 0364014d72cc781a5ead60a56872fd2b693fe41b 1 parent 3641c44
Christian Meier authored
Showing with 47,579 additions and 0 deletions.
  1. +2 −0  .gitignore
  2. +1 −0  pdftools/.gitignore
  3. +661 −0 pdftools/agpl-3.0.txt
  4. +53 −0 pdftools/pom.xml
  5. +296 −0 pdftools/src/main/java/org/pariyatti/tools/PdfAddPersonalFrontPage.java
  6. +52 −0 pdftools/src/main/java/org/pariyatti/tools/PdfServlet.java
  7. BIN  pdftools/src/main/resources/FreeSans.ttf
  8. +13 −0 pdftools/src/main/webapp/WEB-INF/web.xml
  9. +4 −0 pdftools/src/main/webapp/index.html
  10. +5 −0 rails/.gitignore
  11. +89 −0 rails/README.md
  12. +10 −0 rails/Rakefile
  13. +21 −0 rails/TODO
  14. +54 −0 rails/app/controllers/application_controller.rb
  15. +22 −0 rails/app/controllers/audits_controller.rb
  16. +22 −0 rails/app/controllers/authentications_controller.rb
  17. +22 −0 rails/app/controllers/configurations_controller.rb
  18. +216 −0 rails/app/controllers/containers_controller.rb
  19. +22 −0 rails/app/controllers/domains_controller.rb
  20. +161 −0 rails/app/controllers/download_controller.rb
  21. +60 −0 rails/app/controllers/dropboxes_controller.rb
  22. +22 −0 rails/app/controllers/groups_controller.rb
  23. +124 −0 rails/app/controllers/items_controller.rb
  24. +22 −0 rails/app/controllers/locales_controller.rb
  25. +156 −0 rails/app/controllers/orders_controller.rb
  26. +22 −0 rails/app/controllers/permissions_controller.rb
  27. +22 −0 rails/app/controllers/phrases_controller.rb
  28. +43 −0 rails/app/controllers/system_configs_controller.rb
  29. +22 −0 rails/app/controllers/users_controller.rb
  30. +22 −0 rails/app/controllers/word_bundles_controller.rb
  31. +22 −0 rails/app/guards/audits_guard.rb
  32. +23 −0 rails/app/guards/configurations_guard.rb
  33. +30 −0 rails/app/guards/containers_guard.rb
  34. +27 −0 rails/app/guards/domains_guard.rb
  35. +23 −0 rails/app/guards/dropboxes_guard.rb
  36. +27 −0 rails/app/guards/groups_guard.rb
  37. +26 −0 rails/app/guards/items_guard.rb
  38. +27 −0 rails/app/guards/locales_guard.rb
  39. +32 −0 rails/app/guards/orders_guard.rb
  40. +20 −0 rails/app/guards/permissions_guard.rb
  41. +29 −0 rails/app/guards/phrases_guard.rb
  42. +27 −0 rails/app/guards/users_guard.rb
  43. +22 −0 rails/app/helpers/application_helper.rb
  44. +21 −0 rails/app/helpers/configurations_helper.rb
  45. +21 −0 rails/app/helpers/domains_helper.rb
  46. +21 −0 rails/app/helpers/groups_helper.rb
  47. +21 −0 rails/app/helpers/locales_helper.rb
  48. +21 −0 rails/app/helpers/users_helper.rb
  49. +22 −0 rails/app/models/audit.rb
  50. +22 −0 rails/app/models/authentication.rb
  51. +52 −0 rails/app/models/configuration.rb
  52. +235 −0 rails/app/models/container.rb
  53. +33 −0 rails/app/models/container_order.rb
  54. +22 −0 rails/app/models/domain.rb
  55. +118 −0 rails/app/models/dropbox.rb
  56. +22 −0 rails/app/models/group.rb
  57. +22 −0 rails/app/models/i18n_text.rb
  58. +298 −0 rails/app/models/item.rb
  59. +33 −0 rails/app/models/item_order.rb
  60. +22 −0 rails/app/models/locale.rb
  61. +48 −0 rails/app/models/mailer.rb
  62. +180 −0 rails/app/models/order.rb
  63. +189 −0 rails/app/models/order_session.rb
  64. +22 −0 rails/app/models/user.rb
  65. +54 −0 rails/app/views/containers/container_widget.rb
  66. +157 −0 rails/app/views/containers/edit.rb
  67. +192 −0 rails/app/views/containers/list_widget.rb
  68. +223 −0 rails/app/views/containers/show.rb
  69. +64 −0 rails/app/views/containers/show.rb-
  70. +26 −0 rails/app/views/download/access_denied.rb
  71. +26 −0 rails/app/views/download/logged_out.rb
  72. +22 −0 rails/app/views/download/login.rb
  73. +50 −0 rails/app/views/download/login_widget.rb
  74. +27 −0 rails/app/views/download/login_with_error.rb
  75. +26 −0 rails/app/views/download/maintenance.rb
  76. +53 −0 rails/app/views/download/overview.rb
  77. +26 −0 rails/app/views/download/session_expired.rb
  78. +88 −0 rails/app/views/dropboxes/edit.rb
  79. +35 −0 rails/app/views/errors/error.rb
  80. +35 −0 rails/app/views/errors/error_with_session.rb
  81. +35 −0 rails/app/views/errors/logged_out_error.rb
  82. +2 −0  rails/app/views/errors/stale.html.erb
  83. +16 −0 rails/app/views/groups/edit.html.erb
  84. +20 −0 rails/app/views/groups/index.html.erb
  85. +15 −0 rails/app/views/groups/new.html.erb
  86. +8 −0 rails/app/views/groups/show.html.erb
  87. +123 −0 rails/app/views/items/edit.rb
  88. +85 −0 rails/app/views/layouts/admin.rb
  89. +69 −0 rails/app/views/layouts/base_widget.rb
  90. +17 −0 rails/app/views/layouts/configurations.html.erb
  91. +36 −0 rails/app/views/layouts/download.rb
  92. +17 −0 rails/app/views/layouts/groups.html.erb
  93. +17 −0 rails/app/views/layouts/locales.html.erb
  94. +119 −0 rails/app/views/layouts/page.rb
  95. +17 −0 rails/app/views/layouts/users.html.erb
  96. +16 −0 rails/app/views/locales/edit.html.erb
  97. +20 −0 rails/app/views/locales/index.html.erb
  98. +15 −0 rails/app/views/locales/new.html.erb
  99. +8 −0 rails/app/views/locales/show.html.erb
  100. +17 −0 rails/app/views/mailer/confirmation.erb
  101. +51 −0 rails/app/views/orders/edit.rb
  102. +80 −0 rails/app/views/orders/index.rb
  103. +63 −0 rails/app/views/orders/list_widget.rb
  104. +106 −0 rails/app/views/orders/modify_order_widget.rb
  105. +53 −0 rails/app/views/orders/new.rb
  106. +90 −0 rails/app/views/orders/order_details_widget.rb
  107. +122 −0 rails/app/views/orders/orders_widget.rb
  108. +56 −0 rails/app/views/orders/overview_widget.rb
  109. +74 −0 rails/app/views/orders/show.rb
  110. +1 −0  rails/app/views/password_mailer/password.erb
  111. +14 −0 rails/app/views/sessions/login.html.erb
  112. +28 −0 rails/app/views/users/edit.html.erb
  113. +26 −0 rails/app/views/users/index.html.erb
  114. +27 −0 rails/app/views/users/new.html.erb
  115. +23 −0 rails/app/views/users/show.html.erb
  116. +1 −0  rails/config/.gitignore
  117. +135 −0 rails/config/boot.rb
  118. +23 −0 rails/config/database.yml
  119. +89 −0 rails/config/environment.rb
  120. +36 −0 rails/config/environments/development.rb
  121. +59 −0 rails/config/environments/production.rb
  122. +47 −0 rails/config/environments/test.rb
  123. +17 −0 rails/config/global-example.yml
  124. +26 −0 rails/config/initializers/backtrace_silencers.rb
  125. +35 −0 rails/config/initializers/flavour.rb
  126. +29 −0 rails/config/initializers/inflections.rb
  127. +58 −0 rails/config/initializers/ixtlan.rb
  128. +38 −0 rails/config/initializers/java_throwable_monkey_patch.rb
  129. +24 −0 rails/config/initializers/mime_types.rb
  130. +40 −0 rails/config/initializers/new_rails_defaults.rb
  131. +369 −0 rails/config/initializers/pariyatti.yml
  132. +34 −0 rails/config/initializers/session_store.rb
  133. +29 −0 rails/config/initializers/taperoom.yml
  134. +20 −0 rails/config/initializers/time_formats.rb
  135. +5 −0 rails/config/locales/en.yml
  136. +52 −0 rails/config/preinitializer.rb
  137. +106 −0 rails/config/routes.rb
  138. +1 −0  rails/db/.gitignore
  139. +37 −0 rails/db/migrate/1_create_root_user.rb
  140. +10 −0 rails/db/migrate/2_create_configuration.rb
  141. +14 −0 rails/db/migrate/3_create_locale.rb
  142. +12 −0 rails/db/migrate/4_create_domain.rb
  143. +8 −0 rails/db/migrate/5_create_text.rb
  144. +13 −0 rails/db/migrate/6_create_container.rb
  145. +2 −0  rails/db/patch-1.sql
  146. +7 −0 rails/db/seeds.rb
  147. +12 −0 rails/doc/README_monitor_ip.txt
  148. +52 −0 rails/lib/pdf.rb
  149. +129 −0 rails/lib/scanner.rb
  150. +96 −0 rails/lib/smtp_tls.rb
  151. +125 −0 rails/lib/tasks/datamapper.rake
  152. +144 −0 rails/lib/tasks/rspec.rake
  153. +64 −0 rails/lib/zipper.rb
  154. +338 −0 rails/pom.xml
  155. +1 −0  rails/public/.gitignore
  156. BIN  rails/public/14A43CD7E24B0A0136C2B8B20D6DF3C0.cache.png
  157. +2,496 −0 rails/public/1ACC910B421227A928DBF189AC2217FB.cache.html
  158. +2,501 −0 rails/public/27E5862873419BB6D6BABA5EE6F519DC.cache.html
  159. +2,574 −0 rails/public/2C7632301CCB07A5047276139B8B5F4A.cache.html
  160. +2,510 −0 rails/public/3B7F9BB7D405558BD79DD7E4D7B956B5.cache.html
  161. +30 −0 rails/public/404.html
  162. +30 −0 rails/public/422.html
  163. +30 −0 rails/public/500.html
  164. BIN  rails/public/548CDF11D6FE9011F3447CA200D7FB7F.cache.png
  165. +2,582 −0 rails/public/7BE105C7D306DE3AA6AA7FC91C530817.cache.html
  166. BIN  rails/public/9DA92932034707C17CFF15F95086D53F.cache.png
  167. +2,510 −0 rails/public/A141A2AE6D9B7DFD59B9CB95E3D85723.cache.html
  168. BIN  rails/public/A7CD51F9E5A7DED5F85AD1D82BA67A8A.cache.png
  169. +2,515 −0 rails/public/B302FDBCEC1E4877986449E2341B361B.cache.html
  170. +2,574 −0 rails/public/B4DC45FC35F3B7408A39BDB0E3160D5D.cache.html
  171. BIN  rails/public/B8517E9C2E38AA39AB7C0051564224D3.cache.png
  172. +2,515 −0 rails/public/B88B373A1CBBEB05930BD58CFC229375.cache.html
  173. +2,510 −0 rails/public/CAEC9A03318A220F02AED7C59E99E70A.cache.html
  174. +2,496 −0 rails/public/D184A67F6A8934E40A43F6BBEFE068F1.cache.html
  175. +2,582 −0 rails/public/D874128115AE9196E6CCD4419AFC6E35.cache.html
  176. +2,574 −0 rails/public/F0F8EB9CEE34E6BFA0EFCBF45C7685D3.cache.html
  177. +2,501 −0 rails/public/F6FD046A311CC49833188A8DE34D70A8.cache.html
  178. +2,510 −0 rails/public/F798688DABCB6B38691C96397C5674D8.cache.html
  179. +5 −0 rails/public/John Richard/0.xml
  180. +5 −0 rails/public/John Richard/1.xml
  181. +5 −0 rails/public/John Richard/10.xml
  182. +6 −0 rails/public/John Richard/100.xml
  183. +6 −0 rails/public/John Richard/101.xml
  184. +5 −0 rails/public/John Richard/102.xml
  185. +5 −0 rails/public/John Richard/103.xml
  186. +5 −0 rails/public/John Richard/104.xml
  187. +5 −0 rails/public/John Richard/105.xml
  188. +4 −0 rails/public/John Richard/106.xml
  189. +5 −0 rails/public/John Richard/107.xml
  190. +5 −0 rails/public/John Richard/108.xml
  191. +5 −0 rails/public/John Richard/109.xml
  192. +5 −0 rails/public/John Richard/11.xml
  193. +4 −0 rails/public/John Richard/110.xml
  194. +4 −0 rails/public/John Richard/111.xml
  195. +4 −0 rails/public/John Richard/112.xml
  196. +5 −0 rails/public/John Richard/113.xml
  197. +5 −0 rails/public/John Richard/114.xml
  198. +5 −0 rails/public/John Richard/115.xml
  199. +5 −0 rails/public/John Richard/116.xml
  200. +5 −0 rails/public/John Richard/117.xml
  201. +4 −0 rails/public/John Richard/118.xml
  202. +5 −0 rails/public/John Richard/119.xml
  203. +4 −0 rails/public/John Richard/12.xml
  204. +5 −0 rails/public/John Richard/120.xml
  205. +5 −0 rails/public/John Richard/121.xml
  206. +5 −0 rails/public/John Richard/122.xml
  207. +4 −0 rails/public/John Richard/123.xml
  208. +4 −0 rails/public/John Richard/124.xml
  209. +4 −0 rails/public/John Richard/125.xml
  210. +4 −0 rails/public/John Richard/126.xml
  211. +5 −0 rails/public/John Richard/127.xml
  212. +4 −0 rails/public/John Richard/128.xml
  213. +4 −0 rails/public/John Richard/129.xml
  214. +5 −0 rails/public/John Richard/13.xml
  215. +4 −0 rails/public/John Richard/130.xml
  216. +8 −0 rails/public/John Richard/131.xml
  217. +5 −0 rails/public/John Richard/132.xml
  218. +6 −0 rails/public/John Richard/133.xml
  219. +4 −0 rails/public/John Richard/134.xml
  220. +7 −0 rails/public/John Richard/135.xml
  221. +4 −0 rails/public/John Richard/136.xml
  222. +5 −0 rails/public/John Richard/137.xml
  223. +5 −0 rails/public/John Richard/138.xml
  224. +4 −0 rails/public/John Richard/139.xml
  225. +4 −0 rails/public/John Richard/14.xml
  226. +4 −0 rails/public/John Richard/140.xml
  227. +4 −0 rails/public/John Richard/141.xml
  228. +5 −0 rails/public/John Richard/142.xml
  229. +4 −0 rails/public/John Richard/143.xml
  230. +7 −0 rails/public/John Richard/144.xml
  231. +4 −0 rails/public/John Richard/145.xml
  232. +4 −0 rails/public/John Richard/146.xml
  233. +5 −0 rails/public/John Richard/147.xml
  234. +4 −0 rails/public/John Richard/148.xml
  235. +5 −0 rails/public/John Richard/149.xml
  236. +4 −0 rails/public/John Richard/15.xml
  237. +4 −0 rails/public/John Richard/150.xml
  238. +4 −0 rails/public/John Richard/151.xml
  239. +4 −0 rails/public/John Richard/152.xml
  240. +5 −0 rails/public/John Richard/153.xml
  241. +6 −0 rails/public/John Richard/154.xml
  242. +5 −0 rails/public/John Richard/155.xml
  243. +5 −0 rails/public/John Richard/156.xml
  244. +5 −0 rails/public/John Richard/157.xml
  245. +4 −0 rails/public/John Richard/158.xml
  246. +4 −0 rails/public/John Richard/159.xml
  247. +5 −0 rails/public/John Richard/16.xml
  248. +4 −0 rails/public/John Richard/160.xml
  249. +4 −0 rails/public/John Richard/161.xml
  250. +4 −0 rails/public/John Richard/162.xml
  251. +4 −0 rails/public/John Richard/163.xml
  252. +4 −0 rails/public/John Richard/164.xml
  253. +5 −0 rails/public/John Richard/165.xml
  254. +4 −0 rails/public/John Richard/166.xml
  255. +5 −0 rails/public/John Richard/167.xml
  256. +5 −0 rails/public/John Richard/168.xml
  257. +5 −0 rails/public/John Richard/169.xml
  258. +5 −0 rails/public/John Richard/17.xml
  259. +5 −0 rails/public/John Richard/170.xml
  260. +5 −0 rails/public/John Richard/171.xml
  261. +5 −0 rails/public/John Richard/172.xml
  262. +4 −0 rails/public/John Richard/173.xml
  263. +6 −0 rails/public/John Richard/174.xml
  264. +6 −0 rails/public/John Richard/175.xml
  265. +7 −0 rails/public/John Richard/176.xml
  266. +11 −0 rails/public/John Richard/177.xml
  267. +4 −0 rails/public/John Richard/178.xml
  268. +5 −0 rails/public/John Richard/179.xml
  269. +5 −0 rails/public/John Richard/18.xml
  270. +7 −0 rails/public/John Richard/180.xml
  271. +4 −0 rails/public/John Richard/181.xml
  272. +4 −0 rails/public/John Richard/182.xml
  273. +4 −0 rails/public/John Richard/183.xml
  274. +4 −0 rails/public/John Richard/184.xml
  275. +5 −0 rails/public/John Richard/185.xml
  276. +5 −0 rails/public/John Richard/186.xml
  277. +5 −0 rails/public/John Richard/187.xml
  278. +5 −0 rails/public/John Richard/188.xml
  279. +5 −0 rails/public/John Richard/189.xml
  280. +7 −0 rails/public/John Richard/19.xml
  281. +4 −0 rails/public/John Richard/190.xml
  282. +5 −0 rails/public/John Richard/191.xml
  283. +6 −0 rails/public/John Richard/192.xml
  284. +6 −0 rails/public/John Richard/193.xml
  285. +4 −0 rails/public/John Richard/194.xml
  286. +5 −0 rails/public/John Richard/195.xml
  287. +4 −0 rails/public/John Richard/196.xml
  288. +4 −0 rails/public/John Richard/197.xml
  289. +4 −0 rails/public/John Richard/198.xml
  290. +4 −0 rails/public/John Richard/199.xml
  291. +5 −0 rails/public/John Richard/2.xml
  292. +5 −0 rails/public/John Richard/20.xml
  293. +4 −0 rails/public/John Richard/200.xml
  294. +5 −0 rails/public/John Richard/201.xml
  295. +5 −0 rails/public/John Richard/202.xml
  296. +7 −0 rails/public/John Richard/203.xml
  297. +5 −0 rails/public/John Richard/204.xml
  298. +5 −0 rails/public/John Richard/205.xml
  299. +5 −0 rails/public/John Richard/206.xml
  300. +5 −0 rails/public/John Richard/207.xml
Sorry, we could not display the entire diff because too many files (1,144) changed.
2  .gitignore
View
@@ -0,0 +1,2 @@
+*~
+target
1  pdftools/.gitignore
View
@@ -0,0 +1 @@
+target
661 pdftools/agpl-3.0.txt
View
@@ -0,0 +1,661 @@
+ GNU AFFERO GENERAL PUBLIC LICENSE
+ Version 3, 19 November 2007
+
+ Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+ Preamble
+
+ The GNU Affero General Public License is a free, copyleft license for
+software and other kinds of works, specifically designed to ensure
+cooperation with the community in the case of network server software.
+
+ The licenses for most software and other practical works are designed
+to take away your freedom to share and change the works. By contrast,
+our General Public Licenses are intended to guarantee your freedom to
+share and change all versions of a program--to make sure it remains free
+software for all its users.
+
+ When we speak of free software, we are referring to freedom, not
+price. Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+them if you wish), that you receive source code or can get it if you
+want it, that you can change the software or use pieces of it in new
+free programs, and that you know you can do these things.
+
+ Developers that use our General Public Licenses protect your rights
+with two steps: (1) assert copyright on the software, and (2) offer
+you this License which gives you legal permission to copy, distribute
+and/or modify the software.
+
+ A secondary benefit of defending all users' freedom is that
+improvements made in alternate versions of the program, if they
+receive widespread use, become available for other developers to
+incorporate. Many developers of free software are heartened and
+encouraged by the resulting cooperation. However, in the case of
+software used on network servers, this result may fail to come about.
+The GNU General Public License permits making a modified version and
+letting the public access it on a server without ever releasing its
+source code to the public.
+
+ The GNU Affero General Public License is designed specifically to
+ensure that, in such cases, the modified source code becomes available
+to the community. It requires the operator of a network server to
+provide the source code of the modified version running there to the
+users of that server. Therefore, public use of a modified version, on
+a publicly accessible server, gives the public access to the source
+code of the modified version.
+
+ An older license, called the Affero General Public License and
+published by Affero, was designed to accomplish similar goals. This is
+a different license, not a version of the Affero GPL, but Affero has
+released a new version of the Affero GPL which permits relicensing under
+this license.
+
+ The precise terms and conditions for copying, distribution and
+modification follow.
+
+ TERMS AND CONDITIONS
+
+ 0. Definitions.
+
+ "This License" refers to version 3 of the GNU Affero General Public License.
+
+ "Copyright" also means copyright-like laws that apply to other kinds of
+works, such as semiconductor masks.
+
+ "The Program" refers to any copyrightable work licensed under this
+License. Each licensee is addressed as "you". "Licensees" and
+"recipients" may be individuals or organizations.
+
+ To "modify" a work means to copy from or adapt all or part of the work
+in a fashion requiring copyright permission, other than the making of an
+exact copy. The resulting work is called a "modified version" of the
+earlier work or a work "based on" the earlier work.
+
+ A "covered work" means either the unmodified Program or a work based
+on the Program.
+
+ To "propagate" a work means to do anything with it that, without
+permission, would make you directly or secondarily liable for
+infringement under applicable copyright law, except executing it on a
+computer or modifying a private copy. Propagation includes copying,
+distribution (with or without modification), making available to the
+public, and in some countries other activities as well.
+
+ To "convey" a work means any kind of propagation that enables other
+parties to make or receive copies. Mere interaction with a user through
+a computer network, with no transfer of a copy, is not conveying.
+
+ An interactive user interface displays "Appropriate Legal Notices"
+to the extent that it includes a convenient and prominently visible
+feature that (1) displays an appropriate copyright notice, and (2)
+tells the user that there is no warranty for the work (except to the
+extent that warranties are provided), that licensees may convey the
+work under this License, and how to view a copy of this License. If
+the interface presents a list of user commands or options, such as a
+menu, a prominent item in the list meets this criterion.
+
+ 1. Source Code.
+
+ The "source code" for a work means the preferred form of the work
+for making modifications to it. "Object code" means any non-source
+form of a work.
+
+ A "Standard Interface" means an interface that either is an official
+standard defined by a recognized standards body, or, in the case of
+interfaces specified for a particular programming language, one that
+is widely used among developers working in that language.
+
+ The "System Libraries" of an executable work include anything, other
+than the work as a whole, that (a) is included in the normal form of
+packaging a Major Component, but which is not part of that Major
+Component, and (b) serves only to enable use of the work with that
+Major Component, or to implement a Standard Interface for which an
+implementation is available to the public in source code form. A
+"Major Component", in this context, means a major essential component
+(kernel, window system, and so on) of the specific operating system
+(if any) on which the executable work runs, or a compiler used to
+produce the work, or an object code interpreter used to run it.
+
+ The "Corresponding Source" for a work in object code form means all
+the source code needed to generate, install, and (for an executable
+work) run the object code and to modify the work, including scripts to
+control those activities. However, it does not include the work's
+System Libraries, or general-purpose tools or generally available free
+programs which are used unmodified in performing those activities but
+which are not part of the work. For example, Corresponding Source
+includes interface definition files associated with source files for
+the work, and the source code for shared libraries and dynamically
+linked subprograms that the work is specifically designed to require,
+such as by intimate data communication or control flow between those
+subprograms and other parts of the work.
+
+ The Corresponding Source need not include anything that users
+can regenerate automatically from other parts of the Corresponding
+Source.
+
+ The Corresponding Source for a work in source code form is that
+same work.
+
+ 2. Basic Permissions.
+
+ All rights granted under this License are granted for the term of
+copyright on the Program, and are irrevocable provided the stated
+conditions are met. This License explicitly affirms your unlimited
+permission to run the unmodified Program. The output from running a
+covered work is covered by this License only if the output, given its
+content, constitutes a covered work. This License acknowledges your
+rights of fair use or other equivalent, as provided by copyright law.
+
+ You may make, run and propagate covered works that you do not
+convey, without conditions so long as your license otherwise remains
+in force. You may convey covered works to others for the sole purpose
+of having them make modifications exclusively for you, or provide you
+with facilities for running those works, provided that you comply with
+the terms of this License in conveying all material for which you do
+not control copyright. Those thus making or running the covered works
+for you must do so exclusively on your behalf, under your direction
+and control, on terms that prohibit them from making any copies of
+your copyrighted material outside their relationship with you.
+
+ Conveying under any other circumstances is permitted solely under
+the conditions stated below. Sublicensing is not allowed; section 10
+makes it unnecessary.
+
+ 3. Protecting Users' Legal Rights From Anti-Circumvention Law.
+
+ No covered work shall be deemed part of an effective technological
+measure under any applicable law fulfilling obligations under article
+11 of the WIPO copyright treaty adopted on 20 December 1996, or
+similar laws prohibiting or restricting circumvention of such
+measures.
+
+ When you convey a covered work, you waive any legal power to forbid
+circumvention of technological measures to the extent such circumvention
+is effected by exercising rights under this License with respect to
+the covered work, and you disclaim any intention to limit operation or
+modification of the work as a means of enforcing, against the work's
+users, your or third parties' legal rights to forbid circumvention of
+technological measures.
+
+ 4. Conveying Verbatim Copies.
+
+ You may convey verbatim copies of the Program's source code as you
+receive it, in any medium, provided that you conspicuously and
+appropriately publish on each copy an appropriate copyright notice;
+keep intact all notices stating that this License and any
+non-permissive terms added in accord with section 7 apply to the code;
+keep intact all notices of the absence of any warranty; and give all
+recipients a copy of this License along with the Program.
+
+ You may charge any price or no price for each copy that you convey,
+and you may offer support or warranty protection for a fee.
+
+ 5. Conveying Modified Source Versions.
+
+ You may convey a work based on the Program, or the modifications to
+produce it from the Program, in the form of source code under the
+terms of section 4, provided that you also meet all of these conditions:
+
+ a) The work must carry prominent notices stating that you modified
+ it, and giving a relevant date.
+
+ b) The work must carry prominent notices stating that it is
+ released under this License and any conditions added under section
+ 7. This requirement modifies the requirement in section 4 to
+ "keep intact all notices".
+
+ c) You must license the entire work, as a whole, under this
+ License to anyone who comes into possession of a copy. This
+ License will therefore apply, along with any applicable section 7
+ additional terms, to the whole of the work, and all its parts,
+ regardless of how they are packaged. This License gives no
+ permission to license the work in any other way, but it does not
+ invalidate such permission if you have separately received it.
+
+ d) If the work has interactive user interfaces, each must display
+ Appropriate Legal Notices; however, if the Program has interactive
+ interfaces that do not display Appropriate Legal Notices, your
+ work need not make them do so.
+
+ A compilation of a covered work with other separate and independent
+works, which are not by their nature extensions of the covered work,
+and which are not combined with it such as to form a larger program,
+in or on a volume of a storage or distribution medium, is called an
+"aggregate" if the compilation and its resulting copyright are not
+used to limit the access or legal rights of the compilation's users
+beyond what the individual works permit. Inclusion of a covered work
+in an aggregate does not cause this License to apply to the other
+parts of the aggregate.
+
+ 6. Conveying Non-Source Forms.
+
+ You may convey a covered work in object code form under the terms
+of sections 4 and 5, provided that you also convey the
+machine-readable Corresponding Source under the terms of this License,
+in one of these ways:
+
+ a) Convey the object code in, or embodied in, a physical product
+ (including a physical distribution medium), accompanied by the
+ Corresponding Source fixed on a durable physical medium
+ customarily used for software interchange.
+
+ b) Convey the object code in, or embodied in, a physical product
+ (including a physical distribution medium), accompanied by a
+ written offer, valid for at least three years and valid for as
+ long as you offer spare parts or customer support for that product
+ model, to give anyone who possesses the object code either (1) a
+ copy of the Corresponding Source for all the software in the
+ product that is covered by this License, on a durable physical
+ medium customarily used for software interchange, for a price no
+ more than your reasonable cost of physically performing this
+ conveying of source, or (2) access to copy the
+ Corresponding Source from a network server at no charge.
+
+ c) Convey individual copies of the object code with a copy of the
+ written offer to provide the Corresponding Source. This
+ alternative is allowed only occasionally and noncommercially, and
+ only if you received the object code with such an offer, in accord
+ with subsection 6b.
+
+ d) Convey the object code by offering access from a designated
+ place (gratis or for a charge), and offer equivalent access to the
+ Corresponding Source in the same way through the same place at no
+ further charge. You need not require recipients to copy the
+ Corresponding Source along with the object code. If the place to
+ copy the object code is a network server, the Corresponding Source
+ may be on a different server (operated by you or a third party)
+ that supports equivalent copying facilities, provided you maintain
+ clear directions next to the object code saying where to find the
+ Corresponding Source. Regardless of what server hosts the
+ Corresponding Source, you remain obligated to ensure that it is
+ available for as long as needed to satisfy these requirements.
+
+ e) Convey the object code using peer-to-peer transmission, provided
+ you inform other peers where the object code and Corresponding
+ Source of the work are being offered to the general public at no
+ charge under subsection 6d.
+
+ A separable portion of the object code, whose source code is excluded
+from the Corresponding Source as a System Library, need not be
+included in conveying the object code work.
+
+ A "User Product" is either (1) a "consumer product", which means any
+tangible personal property which is normally used for personal, family,
+or household purposes, or (2) anything designed or sold for incorporation
+into a dwelling. In determining whether a product is a consumer product,
+doubtful cases shall be resolved in favor of coverage. For a particular
+product received by a particular user, "normally used" refers to a
+typical or common use of that class of product, regardless of the status
+of the particular user or of the way in which the particular user
+actually uses, or expects or is expected to use, the product. A product
+is a consumer product regardless of whether the product has substantial
+commercial, industrial or non-consumer uses, unless such uses represent
+the only significant mode of use of the product.
+
+ "Installation Information" for a User Product means any methods,
+procedures, authorization keys, or other information required to install
+and execute modified versions of a covered work in that User Product from
+a modified version of its Corresponding Source. The information must
+suffice to ensure that the continued functioning of the modified object
+code is in no case prevented or interfered with solely because
+modification has been made.
+
+ If you convey an object code work under this section in, or with, or
+specifically for use in, a User Product, and the conveying occurs as
+part of a transaction in which the right of possession and use of the
+User Product is transferred to the recipient in perpetuity or for a
+fixed term (regardless of how the transaction is characterized), the
+Corresponding Source conveyed under this section must be accompanied
+by the Installation Information. But this requirement does not apply
+if neither you nor any third party retains the ability to install
+modified object code on the User Product (for example, the work has
+been installed in ROM).
+
+ The requirement to provide Installation Information does not include a
+requirement to continue to provide support service, warranty, or updates
+for a work that has been modified or installed by the recipient, or for
+the User Product in which it has been modified or installed. Access to a
+network may be denied when the modification itself materially and
+adversely affects the operation of the network or violates the rules and
+protocols for communication across the network.
+
+ Corresponding Source conveyed, and Installation Information provided,
+in accord with this section must be in a format that is publicly
+documented (and with an implementation available to the public in
+source code form), and must require no special password or key for
+unpacking, reading or copying.
+
+ 7. Additional Terms.
+
+ "Additional permissions" are terms that supplement the terms of this
+License by making exceptions from one or more of its conditions.
+Additional permissions that are applicable to the entire Program shall
+be treated as though they were included in this License, to the extent
+that they are valid under applicable law. If additional permissions
+apply only to part of the Program, that part may be used separately
+under those permissions, but the entire Program remains governed by
+this License without regard to the additional permissions.
+
+ When you convey a copy of a covered work, you may at your option
+remove any additional permissions from that copy, or from any part of
+it. (Additional permissions may be written to require their own
+removal in certain cases when you modify the work.) You may place
+additional permissions on material, added by you to a covered work,
+for which you have or can give appropriate copyright permission.
+
+ Notwithstanding any other provision of this License, for material you
+add to a covered work, you may (if authorized by the copyright holders of
+that material) supplement the terms of this License with terms:
+
+ a) Disclaiming warranty or limiting liability differently from the
+ terms of sections 15 and 16 of this License; or
+
+ b) Requiring preservation of specified reasonable legal notices or
+ author attributions in that material or in the Appropriate Legal
+ Notices displayed by works containing it; or
+
+ c) Prohibiting misrepresentation of the origin of that material, or
+ requiring that modified versions of such material be marked in
+ reasonable ways as different from the original version; or
+
+ d) Limiting the use for publicity purposes of names of licensors or
+ authors of the material; or
+
+ e) Declining to grant rights under trademark law for use of some
+ trade names, trademarks, or service marks; or
+
+ f) Requiring indemnification of licensors and authors of that
+ material by anyone who conveys the material (or modified versions of
+ it) with contractual assumptions of liability to the recipient, for
+ any liability that these contractual assumptions directly impose on
+ those licensors and authors.
+
+ All other non-permissive additional terms are considered "further
+restrictions" within the meaning of section 10. If the Program as you
+received it, or any part of it, contains a notice stating that it is
+governed by this License along with a term that is a further
+restriction, you may remove that term. If a license document contains
+a further restriction but permits relicensing or conveying under this
+License, you may add to a covered work material governed by the terms
+of that license document, provided that the further restriction does
+not survive such relicensing or conveying.
+
+ If you add terms to a covered work in accord with this section, you
+must place, in the relevant source files, a statement of the
+additional terms that apply to those files, or a notice indicating
+where to find the applicable terms.
+
+ Additional terms, permissive or non-permissive, may be stated in the
+form of a separately written license, or stated as exceptions;
+the above requirements apply either way.
+
+ 8. Termination.
+
+ You may not propagate or modify a covered work except as expressly
+provided under this License. Any attempt otherwise to propagate or
+modify it is void, and will automatically terminate your rights under
+this License (including any patent licenses granted under the third
+paragraph of section 11).
+
+ However, if you cease all violation of this License, then your
+license from a particular copyright holder is reinstated (a)
+provisionally, unless and until the copyright holder explicitly and
+finally terminates your license, and (b) permanently, if the copyright
+holder fails to notify you of the violation by some reasonable means
+prior to 60 days after the cessation.
+
+ Moreover, your license from a particular copyright holder is
+reinstated permanently if the copyright holder notifies you of the
+violation by some reasonable means, this is the first time you have
+received notice of violation of this License (for any work) from that
+copyright holder, and you cure the violation prior to 30 days after
+your receipt of the notice.
+
+ Termination of your rights under this section does not terminate the
+licenses of parties who have received copies or rights from you under
+this License. If your rights have been terminated and not permanently
+reinstated, you do not qualify to receive new licenses for the same
+material under section 10.
+
+ 9. Acceptance Not Required for Having Copies.
+
+ You are not required to accept this License in order to receive or
+run a copy of the Program. Ancillary propagation of a covered work
+occurring solely as a consequence of using peer-to-peer transmission
+to receive a copy likewise does not require acceptance. However,
+nothing other than this License grants you permission to propagate or
+modify any covered work. These actions infringe copyright if you do
+not accept this License. Therefore, by modifying or propagating a
+covered work, you indicate your acceptance of this License to do so.
+
+ 10. Automatic Licensing of Downstream Recipients.
+
+ Each time you convey a covered work, the recipient automatically
+receives a license from the original licensors, to run, modify and
+propagate that work, subject to this License. You are not responsible
+for enforcing compliance by third parties with this License.
+
+ An "entity transaction" is a transaction transferring control of an
+organization, or substantially all assets of one, or subdividing an
+organization, or merging organizations. If propagation of a covered
+work results from an entity transaction, each party to that
+transaction who receives a copy of the work also receives whatever
+licenses to the work the party's predecessor in interest had or could
+give under the previous paragraph, plus a right to possession of the
+Corresponding Source of the work from the predecessor in interest, if
+the predecessor has it or can get it with reasonable efforts.
+
+ You may not impose any further restrictions on the exercise of the
+rights granted or affirmed under this License. For example, you may
+not impose a license fee, royalty, or other charge for exercise of
+rights granted under this License, and you may not initiate litigation
+(including a cross-claim or counterclaim in a lawsuit) alleging that
+any patent claim is infringed by making, using, selling, offering for
+sale, or importing the Program or any portion of it.
+
+ 11. Patents.
+
+ A "contributor" is a copyright holder who authorizes use under this
+License of the Program or a work on which the Program is based. The
+work thus licensed is called the contributor's "contributor version".
+
+ A contributor's "essential patent claims" are all patent claims
+owned or controlled by the contributor, whether already acquired or
+hereafter acquired, that would be infringed by some manner, permitted
+by this License, of making, using, or selling its contributor version,
+but do not include claims that would be infringed only as a
+consequence of further modification of the contributor version. For
+purposes of this definition, "control" includes the right to grant
+patent sublicenses in a manner consistent with the requirements of
+this License.
+
+ Each contributor grants you a non-exclusive, worldwide, royalty-free
+patent license under the contributor's essential patent claims, to
+make, use, sell, offer for sale, import and otherwise run, modify and
+propagate the contents of its contributor version.
+
+ In the following three paragraphs, a "patent license" is any express
+agreement or commitment, however denominated, not to enforce a patent
+(such as an express permission to practice a patent or covenant not to
+sue for patent infringement). To "grant" such a patent license to a
+party means to make such an agreement or commitment not to enforce a
+patent against the party.
+
+ If you convey a covered work, knowingly relying on a patent license,
+and the Corresponding Source of the work is not available for anyone
+to copy, free of charge and under the terms of this License, through a
+publicly available network server or other readily accessible means,
+then you must either (1) cause the Corresponding Source to be so
+available, or (2) arrange to deprive yourself of the benefit of the
+patent license for this particular work, or (3) arrange, in a manner
+consistent with the requirements of this License, to extend the patent
+license to downstream recipients. "Knowingly relying" means you have
+actual knowledge that, but for the patent license, your conveying the
+covered work in a country, or your recipient's use of the covered work
+in a country, would infringe one or more identifiable patents in that
+country that you have reason to believe are valid.
+
+ If, pursuant to or in connection with a single transaction or
+arrangement, you convey, or propagate by procuring conveyance of, a
+covered work, and grant a patent license to some of the parties
+receiving the covered work authorizing them to use, propagate, modify
+or convey a specific copy of the covered work, then the patent license
+you grant is automatically extended to all recipients of the covered
+work and works based on it.
+
+ A patent license is "discriminatory" if it does not include within
+the scope of its coverage, prohibits the exercise of, or is
+conditioned on the non-exercise of one or more of the rights that are
+specifically granted under this License. You may not convey a covered
+work if you are a party to an arrangement with a third party that is
+in the business of distributing software, under which you make payment
+to the third party based on the extent of your activity of conveying
+the work, and under which the third party grants, to any of the
+parties who would receive the covered work from you, a discriminatory
+patent license (a) in connection with copies of the covered work
+conveyed by you (or copies made from those copies), or (b) primarily
+for and in connection with specific products or compilations that
+contain the covered work, unless you entered into that arrangement,
+or that patent license was granted, prior to 28 March 2007.
+
+ Nothing in this License shall be construed as excluding or limiting
+any implied license or other defenses to infringement that may
+otherwise be available to you under applicable patent law.
+
+ 12. No Surrender of Others' Freedom.
+
+ If conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License. If you cannot convey a
+covered work so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you may
+not convey it at all. For example, if you agree to terms that obligate you
+to collect a royalty for further conveying from those to whom you convey
+the Program, the only way you could satisfy both those terms and this
+License would be to refrain entirely from conveying the Program.
+
+ 13. Remote Network Interaction; Use with the GNU General Public License.
+
+ Notwithstanding any other provision of this License, if you modify the
+Program, your modified version must prominently offer all users
+interacting with it remotely through a computer network (if your version
+supports such interaction) an opportunity to receive the Corresponding
+Source of your version by providing access to the Corresponding Source
+from a network server at no charge, through some standard or customary
+means of facilitating copying of software. This Corresponding Source
+shall include the Corresponding Source for any work covered by version 3
+of the GNU General Public License that is incorporated pursuant to the
+following paragraph.
+
+ Notwithstanding any other provision of this License, you have
+permission to link or combine any covered work with a work licensed
+under version 3 of the GNU General Public License into a single
+combined work, and to convey the resulting work. The terms of this
+License will continue to apply to the part which is the covered work,
+but the work with which it is combined will remain governed by version
+3 of the GNU General Public License.
+
+ 14. Revised Versions of this License.
+
+ The Free Software Foundation may publish revised and/or new versions of
+the GNU Affero General Public License from time to time. Such new versions
+will be similar in spirit to the present version, but may differ in detail to
+address new problems or concerns.
+
+ Each version is given a distinguishing version number. If the
+Program specifies that a certain numbered version of the GNU Affero General
+Public License "or any later version" applies to it, you have the
+option of following the terms and conditions either of that numbered
+version or of any later version published by the Free Software
+Foundation. If the Program does not specify a version number of the
+GNU Affero General Public License, you may choose any version ever published
+by the Free Software Foundation.
+
+ If the Program specifies that a proxy can decide which future
+versions of the GNU Affero General Public License can be used, that proxy's
+public statement of acceptance of a version permanently authorizes you
+to choose that version for the Program.
+
+ Later license versions may give you additional or different
+permissions. However, no additional obligations are imposed on any
+author or copyright holder as a result of your choosing to follow a
+later version.
+
+ 15. Disclaimer of Warranty.
+
+ THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
+APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
+HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
+OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
+THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
+IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
+ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
+
+ 16. Limitation of Liability.
+
+ IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
+THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
+GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
+USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
+DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
+PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
+EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
+SUCH DAMAGES.
+
+ 17. Interpretation of Sections 15 and 16.
+
+ If the disclaimer of warranty and limitation of liability provided
+above cannot be given local legal effect according to their terms,
+reviewing courts shall apply local law that most closely approximates
+an absolute waiver of all civil liability in connection with the
+Program, unless a warranty or assumption of liability accompanies a
+copy of the Program in return for a fee.
+
+ END OF TERMS AND CONDITIONS
+
+ How to Apply These Terms to Your New Programs
+
+ If you develop a new program, and you want it to be of the greatest
+possible use to the public, the best way to achieve this is to make it
+free software which everyone can redistribute and change under these terms.
+
+ To do so, attach the following notices to the program. It is safest
+to attach them to the start of each source file to most effectively
+state the exclusion of warranty; and each file should have at least
+the "copyright" line and a pointer to where the full notice is found.
+
+ <one line to give the program's name and a brief idea of what it does.>
+ Copyright (C) <year> <name of author>
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU Affero General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU Affero General Public License for more details.
+
+ You should have received a copy of the GNU Affero General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+Also add information on how to contact you by electronic and paper mail.
+
+ If your software can interact with users remotely through a computer
+network, you should also make sure that it provides a way for users to
+get its source. For example, if your program is a web application, its
+interface could display a "Source" link that leads users to an archive
+of the code. There are many ways you could offer source, and different
+solutions will be better for different programs; see section 13 for the
+specific requirements.
+
+ You should also get your employer (if you work as a programmer) or school,
+if any, to sign a "copyright disclaimer" for the program, if necessary.
+For more information on this, and how to apply and follow the GNU AGPL, see
+<http://www.gnu.org/licenses/>.
53 pdftools/pom.xml
View
@@ -0,0 +1,53 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
+ http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.pariyatti</groupId>
+ <artifactId>tools</artifactId>
+ <packaging>war</packaging>
+ <version>1.0</version>
+ <name>pariyatti tools</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>com.lowagie</groupId>
+ <artifactId>itext</artifactId>
+ <version>1.3.1</version>
+ </dependency>
+ <dependency>
+ <groupId>org.bouncycastle</groupId>
+ <artifactId>bcprov-jdk16</artifactId>
+ <version>1.43</version>
+ </dependency>
+ <dependency>
+ <groupId>javax.servlet</groupId>
+ <artifactId>servlet-api</artifactId>
+ <version>2.5</version>
+ </dependency>
+ </dependencies>
+ <build>
+ <finalName>pariyatti</finalName>
+ <plugins>
+ <plugin>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <configuration>
+ <source>1.6</source>
+ <target>1.6</target>
+ </configuration>
+ </plugin>
+ <plugin>
+ <artifactId>maven-war-plugin</artifactId>
+ </plugin>
+ <plugin>
+ <groupId>org.mortbay.jetty</groupId>
+ <artifactId>jetty-maven-plugin</artifactId>
+ <version>7.0.1.v20091125</version>
+ </plugin>
+ </plugins>
+ </build>
+
+ <properties>
+ <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+ </properties>
+</project>
296 pdftools/src/main/java/org/pariyatti/tools/PdfAddPersonalFrontPage.java
View
@@ -0,0 +1,296 @@
+/*
+ * $Id: concat_pdf.java,v 1.8 2004/02/07 10:29:03 blowagie Exp $
+ * $Name: $
+ *
+ * This code is free software. It may only be copied or modified
+ * if you include the following copyright notice:
+ *
+ * This class by Mark Thompson. Copyright (c) 2002 Mark Thompson.
+ *
+ * This code is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ * itext@lowagie.com
+ */
+
+/**
+ * This class demonstrates copying a PDF file using iText.
+ * @author Mark Thompson
+ * @author Kristian Meier
+ */
+/*
+ * added password and metadata stuff (Kristian)
+ */
+package org.pariyatti.tools;
+
+import java.awt.Color;
+import java.io.ByteArrayOutputStream;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import com.lowagie.text.Anchor;
+import com.lowagie.text.Document;
+import com.lowagie.text.DocumentException;
+import com.lowagie.text.Element;
+import com.lowagie.text.Font;
+import com.lowagie.text.FontFactory;
+import com.lowagie.text.Paragraph;
+import com.lowagie.text.Rectangle;
+import com.lowagie.text.pdf.BadPdfFormatException;
+import com.lowagie.text.pdf.BaseFont;
+import com.lowagie.text.pdf.PRAcroForm;
+import com.lowagie.text.pdf.PdfCopy;
+import com.lowagie.text.pdf.PdfDictionary;
+import com.lowagie.text.pdf.PdfImportedPage;
+import com.lowagie.text.pdf.PdfName;
+import com.lowagie.text.pdf.PdfReader;
+import com.lowagie.text.pdf.PdfString;
+import com.lowagie.text.pdf.PdfWriter;
+import com.lowagie.text.pdf.RandomAccessFileOrArray;
+import com.lowagie.text.pdf.SimpleBookmark;
+
+public class PdfAddPersonalFrontPage {
+
+ static class LocaleMap extends HashMap<String, Map<String, String>>{
+
+ private static final long serialVersionUID = 1L;
+
+ static final String PURCHASE_ONLY_AUTHORIZED = "purchase only authorized";
+ static final String SUPPORT_PARIYATTI = "support Pariyatti";
+ static final String SCANNING_UPLOADING = "scanning, uploading";
+ static final String BELONGS_TO = "belongs_to";
+
+ LocaleMap() {
+ Map<String, String> map = new HashMap<String, String>();
+ map.put(BELONGS_TO, "This e-book belongs to ");
+ map.put(SCANNING_UPLOADING, "The scanning, uploading, and distribution of this book via the Internet or by any other means without the permission of the publisher violates the copyright.");
+ map.put(SUPPORT_PARIYATTI, "You support Pariyatti in its mission by honoring the copyright and by not sharing this e-book broadly with others who might otherwise purchase it. By encouraging others to purchase e-books, you will be helping Pariyatti to continue to bring future books such as this one to a broader audience.");
+ map.put(PURCHASE_ONLY_AUTHORIZED, "Please purchase only authorized electronic editions and do not participate in or encourage electronic piracy of copyrighted materials. Thank you for your support.");
+ put("en", map);
+
+ map = new HashMap<String, String>();
+ map.put(BELONGS_TO, "Este libro pertenece a ");
+ map.put(SCANNING_UPLOADING, "El escaneo, el subir y distribución de este libro a través de Internet o por cualquier otro medio sin la autorización de la editorial viola los derechos de autor.");
+ map.put(SUPPORT_PARIYATTI, "Usted apoya a Pariyatti en su misión, mediante el cumplimiento de los derechos de autor y no por compartir este e-book con otras personas, que de otro modo podrían comprarlo. Al alentar a terceros para que compren los libros electrónicos, usted estará ayudando a Pariyatti que siga aportando futuros libros como este para un público más amplio.");
+ map.put(PURCHASE_ONLY_AUTHORIZED, "Por favor, compre sólo ediciones electrónicas autorizadas y no participe o aliente a la piratería electrónica de los materiales con derechos de autor. Gracias por su apoyo.");
+ put("es", map);
+
+ map = new HashMap<String, String>();
+ map.put(BELONGS_TO, "Tato elektronická kniha (E-book) je majetkem ");
+ map.put(SCANNING_UPLOADING, "Skenování, sdílení a distribuce této knihy prostřednictvím internetu nebo jakkoli jinak bez souhlasu vydavatele je porušením autorských práv.");
+ map.put(SUPPORT_PARIYATTI, "Podpořte nakladatelství Pariyatti v jeho misi tím, že budete respektovat autorská práva a nebudete knihu sdílet s ostatními, kteří by si ji jinak koupili. Když doporučíte druhým, aby si elektronickou knihu koupili, pomůžete nakladatelství Pariyatti, aby mohlo do budoucna nabízet knihy, jako je tato, širšímu okruhu čtenářů.");
+ map.put(PURCHASE_ONLY_AUTHORIZED, "Kupujte prosím pouze autorizovaná elektronická vydání a neúčastněte se ani nepodporujte elektronické piráctví s materiály chráněnými autorskými právy. Děkujeme za vaši podporu.");
+ put("cz", map);
+
+ map = new HashMap<String, String>();
+ map.put(BELONGS_TO, "Questo libro elettronico è di proprietà di ");
+ map.put(SCANNING_UPLOADING, "La scansione, il caricamento e la distribuzione di questo libro in rete o con qualsiasi altro mezzo senza l’autorizzazione dell’editore violano il diritto d’autore.");
+ map.put(SUPPORT_PARIYATTI, "Attraverso il rispetto del diritto d’autore e astenendosi dal distribuire diffusamente questo libro elettronico a terzi che potrebbero altrimenti acquistarlo si sostiene Pariyatti nella sua missione. Incoraggiando altri all’acquisto di un libro elettronico, si aiuta Pariyatti a continuare a far arrivare libri come questo a un più vasto pubblico.");
+ map.put(PURCHASE_ONLY_AUTHORIZED, "Vi preghiamo di acquistare esclusivamente edizioni elettroniche autorizzate e di non partecipare alla pirateria elettronica di materiale coperto da diritto d’autore né di incoraggiarla. Vi ringraziamo del vostro sostegno.");
+ put("it", map);
+ }
+
+ @Override
+ public Map<String, String> get(Object locale){
+ return super.get(containsKey(locale)? locale : "en");
+ }
+ }
+
+ /**
+ * This class can be used to concatenate existing PDF files. (This was an
+ * example known as PdfCopy.java)
+ *
+ * @param args
+ * the command line arguments
+ */
+ public static void main(final String args[]) {
+ if (args.length < 2) {
+ System.err.println("arguments: user email [pwd@]destfile [pwd@]file1");
+ System.err.println(" the metadata are taken from the last file");
+ }
+ else {
+ try {
+ String outFile = args[2];
+ String outPwd = null;
+ if (outFile.contains("@")) {
+ final int index = outFile.lastIndexOf("@");
+ outPwd = outFile.substring(0, index);
+ outFile = outFile.substring(index + 1);
+ }
+
+ String inFile = args[3];
+ String inPwd = null;
+ if (inFile.contains("@")) {
+ final int index = inFile.lastIndexOf("@");
+ inPwd = inFile.substring(0, index);
+ inFile = inFile.substring(index + 1);
+ }
+ new PdfAddPersonalFrontPage("FreeSans.ttf").process(args[0],
+ args[1],
+ "cz",
+ new FileInputStream(inFile),
+ new FileOutputStream(outFile),
+ inPwd,
+ outPwd);
+ }
+ catch (final Exception e) {
+ e.printStackTrace();
+ }
+ }
+ }
+
+ private final String fontFile;
+
+ PdfAddPersonalFrontPage(){
+ this(null);
+ }
+
+ PdfAddPersonalFrontPage(String fontFile){
+ this.fontFile= fontFile;
+ }
+
+ @SuppressWarnings("unchecked")
+ void process(final String name, final String email, final String locale, final InputStream in,
+ final OutputStream out, final String inPwd, final String outPwd)
+ throws DocumentException, IOException {
+
+ // step 1: creation of a document-object
+ final Document document = new Document();// reader.getPageSizeWithRotation(1));
+ // step 2: we create a writer that listens to the
+ // document
+ final PdfCopy writer = new PdfCopy(document, out);
+ // write out permissions when the password is given
+ writer.setEncryption(null,
+ outPwd == null ? null : outPwd.getBytes(),
+ PdfWriter.AllowScreenReaders,
+ true);
+ // step 3: we open the document
+ document.open();
+
+ // step 4: we add content
+ // copyPages(reader, writer, 1);
+
+ final PdfReader reader = inPwd == null
+ ? new PdfReader(in)
+ : new PdfReader(in, inPwd.getBytes());
+
+ reader.consolidateNamedDestinations();
+ final Map info = reader.getInfo();
+ // System.out.println(reader.getInfo());
+
+ // we retrieve the total number of pages
+ final int n = reader.getNumberOfPages();
+ final List<String> bookmarks = SimpleBookmark.getBookmark(reader);
+ if (bookmarks != null) {
+ SimpleBookmark.shiftPageNumbers(bookmarks, 1, null);
+ }
+ // System.out.println("There are " + n + " pages");
+
+ final PdfDictionary dict = writer.getInfo();
+ for (final Object key : info.keySet()) {
+ if (!"ProducerModDate".contains(key.toString())) {
+ dict.put(new PdfName(key.toString()),
+ new PdfString(info.get(key).toString(), PdfString.TEXT_UNICODE));
+ }
+ }
+ final PdfReader readerPersonal = new PdfReader(firstPage(name,
+ email,
+ locale,
+ reader.getPageSizeWithRotation(2)));
+
+ copyPages(reader, writer, 1, 0);
+ copyPages(readerPersonal, writer, 1, 0);
+ copyPages(reader, writer, n - 1, 1);
+
+ if (bookmarks != null && bookmarks.size() > 0) {
+ writer.setOutlines(bookmarks);
+ }
+ // step 5: we close the document
+ document.close();
+ }
+
+ private void copyPages(final PdfReader reader, final PdfCopy writer,
+ final int n, final int offset) throws IOException,
+ BadPdfFormatException {
+ PdfImportedPage page;
+ for (int i = offset; i < offset + n;) {
+ ++i;
+ page = writer.getImportedPage(reader, i);
+ writer.addPage(page);
+ // System.out.println("Processed page " + i);
+ }
+ final PRAcroForm form = reader.getAcroForm();
+ if (form != null) {
+ writer.copyAcroForm(reader);
+ }
+ }
+
+ private void add(Paragraph parent, Paragraph child){
+ parent.add(child);
+ parent.add(new Paragraph(" "));
+ }
+
+ private byte[] firstPage(final String name, final String email, final String locale,
+ final Rectangle pagesize) throws DocumentException, IOException {
+ final Map<String, String> translations = new LocaleMap().get(locale);
+ final Document document = new Document(pagesize);
+ final ByteArrayOutputStream bytes = new ByteArrayOutputStream();
+ PdfWriter.getInstance(document, bytes);
+ document.open();
+ final Paragraph page = new Paragraph();
+ BaseFont fnt = BaseFont.createFont(fontFile == null? BaseFont.HELVETICA : fontFile,
+ BaseFont.IDENTITY_H, BaseFont.EMBEDDED);
+
+ final Font fontLink = new Font(fnt, 10);
+ //fontLink.setStyle(Font.BOLD);
+ fontLink.setColor(Color.BLUE);
+ final Anchor anchor = new Anchor(name + " <" + email + ">", fontLink);
+ // no active link !!!
+ // anchor.setReference("mailto: " + email);
+ final Font font = new Font(fnt, 10);
+ //font.setStyle(Font.BOLD);
+ Paragraph paragraph = new Paragraph(200,
+ translations.get(LocaleMap.BELONGS_TO),
+ font);
+ paragraph.add(anchor);
+ paragraph.setAlignment(Element.ALIGN_LEFT);
+ add(page, paragraph);
+
+ paragraph = new Paragraph(200,
+ translations.get(LocaleMap.SCANNING_UPLOADING),
+ font);
+ paragraph.setAlignment(Element.ALIGN_LEFT);
+ add(page, paragraph);
+
+ paragraph = new Paragraph(200,
+ translations.get(LocaleMap.SUPPORT_PARIYATTI),
+ font);
+ paragraph.setAlignment(Element.ALIGN_LEFT);
+ add(page, paragraph);
+
+ paragraph = new Paragraph(200,
+ translations.get(LocaleMap.PURCHASE_ONLY_AUTHORIZED),
+ font);
+ paragraph.setAlignment(Element.ALIGN_LEFT);
+ add(page, paragraph);
+
+ document.add(page);
+
+ document.close();
+ try {
+ bytes.close();
+ }
+ catch (final IOException e) {
+ // ignore it
+ }
+ return bytes.toByteArray();
+ }
+}
52 pdftools/src/main/java/org/pariyatti/tools/PdfServlet.java
View
@@ -0,0 +1,52 @@
+package org.pariyatti.tools;
+
+import java.io.IOException;
+
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServlet;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import com.lowagie.text.DocumentException;
+
+public class PdfServlet extends HttpServlet {
+
+ private static final String X_PARIYATTI = "x-pariyatti-";
+ private static final String X_PARIYATTI_PASSWORD = X_PARIYATTI
+ + "password";
+ private static final String X_PARIYATTI_NAME = X_PARIYATTI
+ + "name";
+ private static final String X_PARIYATTI_EMAIL = X_PARIYATTI
+ + "email";
+ private static final String X_PARIYATTI_LOCALE = X_PARIYATTI
+ + "locale";
+
+ private static final long serialVersionUID = 1L;
+
+ private final PdfAddPersonalFrontPage pdf = new PdfAddPersonalFrontPage("FreeSans.ttf");
+
+ @Override
+ protected void doPost(final HttpServletRequest req,
+ final HttpServletResponse resp) throws ServletException,
+ IOException {
+ final String pwd = req.getHeader(X_PARIYATTI_PASSWORD);
+ final String name = req.getHeader(X_PARIYATTI_NAME);
+ final String email = req.getHeader(X_PARIYATTI_EMAIL);
+ final String locale = req.getHeader(X_PARIYATTI_LOCALE) == null ? "en" : req.getHeader(X_PARIYATTI_LOCALE);
+ log("process pdf (length:" + req.getContentLength() + ") for " + name
+ + " <" + email + ">" + " locale: " + locale);
+ try {
+ this.pdf.process(name,
+ email,
+ locale,
+ req.getInputStream(),
+ resp.getOutputStream(),
+ pwd,
+ pwd);
+ }
+ catch (final DocumentException e) {
+ throw new ServletException("error processing page for " + name
+ + " <" + email + ">", e);
+ }
+ }
+}
BIN  pdftools/src/main/resources/FreeSans.ttf
View
Binary file not shown
13 pdftools/src/main/webapp/WEB-INF/web.xml
View
@@ -0,0 +1,13 @@
+<!DOCTYPE web-app PUBLIC
+"-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
+"http://java.sun.com/dtd/web-app_2_3.dtd">
+<web-app>
+ <servlet>
+ <servlet-name>pdf</servlet-name>
+ <servlet-class>org.pariyatti.tools.PdfServlet</servlet-class>
+ </servlet>
+ <servlet-mapping>
+ <servlet-name>pdf</servlet-name>
+ <url-pattern>/pdf</url-pattern>
+ </servlet-mapping>
+</web-app>
4 pdftools/src/main/webapp/index.html
View
@@ -0,0 +1,4 @@
+<html xmlns="http://www.w3.org/1999/xhtml">
+ <head><title>pariyatti</title></head>
+ <body>nothing to see</body>
+</html>
5 rails/.gitignore
View
@@ -0,0 +1,5 @@
+classes
+target
+tomcat
+www-test
+root*
89 rails/README.md
View
@@ -0,0 +1,89 @@
+# setup
+
+reqirements are
+
+* java> 1.4.2
+
+* sqlite3
+
+* jruby from [http://jruby.org](jruby.org)
+
+almost the whole readme will use jruby. that is not strictly needed since after java-to-javascript compilation everything runs with MRI as well. but to keep things simple . . .
+
+## install ruby-maven gem
+
+`jruby -S gem install ruby-maven`
+
+now there is a `rmvn` command available.
+
+basically from rails point of view you just take the rails/rake commands and prefix them with 'rmvn'.
+
+any rmvn command will place the gems for the application in the directory __target/rubygems__ which is set as **GEM\_HOME** and **GEM\_PATH** by the `rmvn` command.
+
+# setup a fresh system
+
+the first run of maven takes a while and for the rubygems part that is true too.
+
+`rmvn rake db:config db:migrate db:sessions:create`
+
+after that you will find the root and admin password in the file **root**
+
+# starting the server
+
+for GWT development you need to use the development shell from GWT. you also can start the application with webrick (or with any other server gem) but here you need to compile first the GWT part into javascript. finally you can use MRI to run the application.
+
+## run gwt development shell (with 32bit java only !!!!)
+
+no need for compilation just start the server and developement shell with
+
+`rmvn gwt:run`
+
+now you can launch a browser directly from that shell.
+
+## run webrick
+
+first you need to compile the GWT application by
+
+`rmvn compile gwt:compile`
+
+then you can start the server
+
+`rmvn rails server`
+
+now use the url to start (html view):
+
+`http://localhost:3000/orders`
+
+# run the test (rspec)
+
+`rmvn spec`
+
+which can run single spec as well or the rake task
+
+`rmvn rake spec`
+
+# authorization
+
+each user belong to none, one or more groups. for each action on the controller you can declare the __allowed__ groups. see
+
+`app/guards/containers_guard.rb`
+
+`app/guards/orders_guard.rb`
+
+the current groups are
+
+* upload : can upload files in the upload section [http://localhost:3000/containers/0](http://localhost:3000/containers/0)
+
+* browse : can go through the files readonly [http://localhost:3000/containers/0](http://localhost:3000/containers/0)
+
+* users : user management
+
+* tickets : create download tickets [http://localhost:3000/orders](http://localhost:3000/orders)
+
+* taperoom: upload files and manage files and directory
+
+* root: master of the univers, i.e. is the all groups group
+
+# scaffold a new resource
+
+`rmvn rails2 generate ixtlan_datamapper_rspec_scaffold error name:string timestamp:datetime dump:string --skip -- -Djruby.fork=false`
10 rails/Rakefile
View
@@ -0,0 +1,10 @@
+# Add your own tasks in files placed in lib/tasks ending in .rake,
+# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
+
+require(File.join(File.dirname(__FILE__), 'config', 'boot'))
+
+require 'rake'
+require 'rake/testtask'
+require 'rake/rdoctask'
+
+require 'tasks/rails'
21 rails/TODO
View
@@ -0,0 +1,21 @@
+* when craeting a download ticket with an empty directory sends off
+ the email but the zip is empty and actually there will be no zip
+ file. maybe some warning or even disable to chackbox in such a case.
+
+* added password_length to GWT configuration
+
+* delete empty directory (with open orders)
+
+* get trashpath for container
+
+* clean up trash when cleaning obsolete orders
+
+* maybe cleanup trash as well
+
+* upload without javascript
+
+* upload from webkit
+
+* sorting in directories in files
+
+* Tikapaṭṭhāna (Day 5 - SNG).mp4 gives an error
54 rails/app/controllers/application_controller.rb
View
@@ -0,0 +1,54 @@
+#
+# taperoom - application to manage audio files and give out download tickets
+# Copyright (C) 2013 Christian Meier <m.kristian@web.de>
+#
+# This file is part of taperoom.
+#
+# taperoom is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as
+# published by the Free Software Foundation, either version 3 of the
+# License, or (at your option) any later version.
+#
+# taperoom is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with taperoom. If not, see <http://www.gnu.org/licenses/>.
+#
+# Filters added to this controller apply to all controllers in the application.
+# Likewise, all the methods added will be available for all controllers.
+
+class ApplicationController < ActionController::Base
+ filter_parameter_logging :password, :login
+ before_filter :check_session_expiry, :baseurl
+
+ protected
+
+ # baseurl for url handling !!
+ def baseurl
+ @baseurl ||= url_for(:controller => :download,
+ :action => :index).sub(/\/$/, "")
+ end
+
+ # override default to use value from configuration
+ def session_timeout
+ Configuration.instance.session_idle_timeout
+ end
+
+ # you can overwrite error pages
+ # def render_error_page_with_session(status)
+ # render :template => "errors/error_with_session", :status => status
+ # end
+
+ # def render_error_page(status)
+ # render :template => "errors/error", :status => status
+ # end
+
+ # you can overwrite a rescue directive here
+ # rescue_from ::Ixtlan::StaleResourceError, :with => :stale_resource
+ # rescue_from ::ActionView::MissingTemplate, :with => :internal_server_error
+
+ protect_from_forgery # See ActionController::RequestForgeryProtection for details
+end
22 rails/app/controllers/audits_controller.rb
View
@@ -0,0 +1,22 @@
+#
+# taperoom - application to manage audio files and give out download tickets
+# Copyright (C) 2013 Christian Meier <m.kristian@web.de>
+#
+# This file is part of taperoom.
+#
+# taperoom is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as
+# published by the Free Software Foundation, either version 3 of the
+# License, or (at your option) any later version.
+#
+# taperoom is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with taperoom. If not, see <http://www.gnu.org/licenses/>.
+#
+class AuditsController < ApplicationController
+ include Ixtlan::Controllers::AuditsController
+end
22 rails/app/controllers/authentications_controller.rb
View
@@ -0,0 +1,22 @@
+#
+# taperoom - application to manage audio files and give out download tickets
+# Copyright (C) 2013 Christian Meier <m.kristian@web.de>
+#
+# This file is part of taperoom.
+#
+# taperoom is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as
+# published by the Free Software Foundation, either version 3 of the
+# License, or (at your option) any later version.
+#
+# taperoom is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with taperoom. If not, see <http://www.gnu.org/licenses/>.
+#
+class AuthenticationsController < ApplicationController
+ include Ixtlan::Controllers::AuthenticationsController
+end
22 rails/app/controllers/configurations_controller.rb
View
@@ -0,0 +1,22 @@
+#
+# taperoom - application to manage audio files and give out download tickets
+# Copyright (C) 2013 Christian Meier <m.kristian@web.de>
+#
+# This file is part of taperoom.
+#
+# taperoom is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as
+# published by the Free Software Foundation, either version 3 of the
+# License, or (at your option) any later version.
+#
+# taperoom is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with taperoom. If not, see <http://www.gnu.org/licenses/>.
+#
+class ConfigurationsController < ApplicationController
+ include Ixtlan::Controllers::ConfigurationsController
+end
216 rails/app/controllers/containers_controller.rb
View
@@ -0,0 +1,216 @@
+#
+# taperoom - application to manage audio files and give out download tickets
+# Copyright (C) 2013 Christian Meier <m.kristian@web.de>
+#
+# This file is part of taperoom.
+#
+# taperoom is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as
+# published by the Free Software Foundation, either version 3 of the
+# License, or (at your option) any later version.
+#
+# taperoom is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with taperoom. If not, see <http://www.gnu.org/licenses/>.
+#
+require 'ftools'
+class ContainersController < ApplicationController
+
+ skip_before_filter :authentication, :guard, :only => :upload
+
+ protect_from_forgery :except => :upload
+
+ private
+
+ def session_timeout
+ if allowed(:upload)
+ Configuration.instance.upload_session_idle_timeout
+ else
+ super
+ end
+ end
+
+ def user_logger
+ @logger ||= ::Ixtlan::UserLogger.new(self)
+ end
+
+ public
+
+ def upload
+ @container = Container.get!(params[:id])
+ if(params[:uploadedfile].instance_of?(String) || params[:uploadedfile].nil?)
+ flash[:notice] = 'no file to upload'
+ redirect_to container_url(@container.id)
+ else
+ user_logger.log_action(self, ": " + params[:uploadedfile].original_filename)
+ config = Configuration.instance
+ FileUtils.mkdir_p( config.dropbox_directory + @container.path )
+ file = config.dropbox_directory + @container.path + "/" + params[:uploadedfile].original_filename
+ if(params[:uploadedfile].instance_of?(ActionController::UploadedTempfile) || params[:uploadedfile].instance_of?(Tempfile))
+ FileUtils.cp(params[:uploadedfile].path, file)
+ else
+ File.open(file, 'w') do |f|
+ f.puts params[:uploadedfile].string
+ end
+ end
+ File.chmod(0644, file)
+ redirect_to container_url(@container.id)
+ end
+ end
+
+ # PUT /containers/1/scan
+ def scan
+ container = Container.get!(params[:id])
+ errors = container.scan
+ if errors.nil? # container dir does not exists and not items/children
+ destroy
+ else
+ if errors.size > 0
+ flash[:notice] = errors.join("\n")
+ else
+ flash[:notice] = "all directories scanned"
+ end
+
+ redirect_to container_url(container.id)
+ end
+ end
+
+ # PUT /containers/1/import
+ def import
+ dropbox = Dropbox.get!(params[:id])
+ method = params[:commit] == 'replace' ? :replace : :import
+ files = params[:dropbox] || []
+ files = nil if files.delete("all")
+ errors = dropbox.send(method, files)
+
+ if (errors || []).size > 0
+ flash[:notice] = errors.join("\n")
+ else
+ flash[:notice] = "all directories scanned"
+ end
+
+ to_container =
+ if dropbox.root?
+ Container.root
+ else
+ Container.first(:name => dropbox.name,
+ :container_id => dropbox.parent.id) ||
+ Container.root
+ end
+ redirect_to(container_url(to_container.id))
+ end
+
+ def index
+ redirect_to(container_url(Container.root_id))
+ end
+
+ def create
+ raise "should never reach here, just allow login on create urls"
+ end
+
+ # GET /containers/1
+ # GET /containers/1.xml
+ def show
+ @container = Container.get!(params[:id])
+ @dropbox = Dropbox.new(@container)
+ @upload_url = upload_container_url(@container.id)
+ if Ixtlan::Guard.check(self, :containers, :edit, nil) || @container.public?
+ respond_to do |format|
+ format.html # show.html.erb
+ format.xml { render :xml => @container }
+ end
+ else
+ redirect_to container_url(Container.root.id)
+ end
+ end
+
+ # GET /containers/1/edit
+ def edit
+ @container = Container.get!(params[:id])
+ end
+
+ def zip
+ @container = Container.get!(params[:id])
+ result = @container.zip
+ if result.nil?
+ flash[:notice] = "can not zip root directory"
+ elsif result == true
+ flash[:notice] = "zipped directory and scanned"
+ elsif result == false
+ flash[:notice] = "zipped directory and scanned but error disabling container"
+ else
+ flash[:notice] = result.join("\n")
+ end
+ redirect_to container_url(@container.parent.id)
+ end
+
+ def subdir
+ @container = Container.get!(params[:id])
+ container = @container.create_child_container(params[:subdir])
+
+ respond_to do |format|
+ if container.saved?
+ flash[:notice] = 'Container was successfully updated.'
+ format.html { redirect_to(edit_container_url(container.id)) }
+ format.xml { head :ok }
+ else
+ format.html { render :action => "edit" }
+ format.xml { render :xml => container.errors, :status => :unprocessable_entity }
+ end
+ end
+ end
+
+ def enable
+ # TODO can be done with the update action
+ @container = Container.get!(params[:id])
+ if(@container.root?)
+ parent = @container
+ else
+ @container.enabled = !@container.enabled?
+ parent = @container.parent
+ end
+ respond_to do |format|
+ if @container.save
+ flash[:notice] = 'Container was successfully updated.'
+ format.html { redirect_to(container_url(parent.id)) }
+ format.xml { head :ok }
+ else
+ format.html { render :action => "edit" }
+ format.xml { render :xml => @container.errors, :status => :unprocessable_entity }
+ end
+ end
+ end
+
+ # PUT /containers/1
+ # PUT /containers/1.xml
+ def update
+ @container = Container.get!(params[:id])
+
+ respond_to do |format|
+ if @container.update(params[:container])
+ flash[:notice] = 'Container was successfully updated.'
+ format.html { redirect_to(edit_container_url(@container.id)) }
+ format.xml { head :ok }
+ else
+ format.html { render :action => "edit" }
+ format.xml { render :xml => @container.errors, :status => :unprocessable_entity }
+ end
+ end
+ end
+
+ # DELETE /containers/1
+ # DELETE /containers/1.xml
+ def destroy
+ @container = Container.get(params[:id])
+ @container.destroy if(@container && !@container.root?)
+
+ respond_to do |format|
+ format.html { redirect_to(container_url(@container.parent.id)) }
+ format.xml { head :ok }
+ end
+ end
+end
22 rails/app/controllers/domains_controller.rb
View
@@ -0,0 +1,22 @@
+#
+# taperoom - application to manage audio files and give out download tickets
+# Copyright (C) 2013 Christian Meier <m.kristian@web.de>
+#
+# This file is part of taperoom.
+#
+# taperoom is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as
+# published by the Free Software Foundation, either version 3 of the
+# License, or (at your option) any later version.
+#
+# taperoom is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with taperoom. If not, see <http://www.gnu.org/licenses/>.
+#
+class DomainsController < ApplicationController
+ include Ixtlan::Controllers::DomainsController
+end
161 rails/app/controllers/download_controller.rb
View
@@ -0,0 +1,161 @@
+#
+# taperoom - application to manage audio files and give out download tickets
+# Copyright (C) 2013 Christian Meier <m.kristian@web.de>
+#
+# This file is part of taperoom.
+#
+# taperoom is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as
+# published by the Free Software Foundation, either version 3 of the
+# License, or (at your option) any later version.
+#
+# taperoom is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with taperoom. If not, see <http://www.gnu.org/licenses/>.
+#
+class DownloadController < ApplicationController
+
+ # remove layout to get the erector widgets working
+ layout nil
+
+ skip_before_filter :guard, :authenticate
+
+ # do our own logging here
+ skip_after_filter Ixtlan::Rails::Audit
+
+ prepend_before_filter :baseurl, :load_order#, :check_session
+
+ skip_before_filter :verify_authenticity_token, :check_session, :only => [:index, :alive]
+
+ private
+
+ def session_timeout
+ config.download_session_idle_timeout
+ end
+
+ def config
+ @config ||= Configuration.instance
+ end
+
+ def load_order
+ if session[:order_id]
+ @order = Order.get!(session[:order_id])
+ end
+ end
+
+ def log_message(message)
+ @logger ||= Ixtlan::UserLogger.new(Ixtlan::Rails::Audit)
+ @logger.log_user(@order.nil? ? "???" : @order.name, "download " + message)
+ end
+
+ # from session_timeout mixin
+ def session_timeout
+ config.download_session_idle_timeout
+ end
+
+ # from session_timeout mixin
+ def render_session_timeout
+ render :template => "download/session_expired"
+ end
+
+#TODO ????
+ def render_error(message, status)
+ @message = message
+ if @order
+ render :template => "download/overview", :status => status
+ else
+ session.clear
+ render :template => "download/login_with_error", :status => status
+ end
+ end
+
+ def download_link(method)
+ if @order
+ link, size, item_or_container = @order.send(method, params[:id], RAILS_ROOT)
+ if(link.nil?)
+ redirect_to url_for(:controller => :download, :action => :overview)
+ if(item_or_container.nil?)
+ log_message "(unauthorized) of none existing item with id: #{params[:id]}"
+ else
+ log_message "(unauthorized) of #{item_or_container.inspect}"
+ end
+ else
+ log_message "#{item_or_container.name} <#{size}>"
+ redirect_to link, :status => :temporary_redirect
+ end
+ else
+ # from session_timeout mixin
+ expire_session
+ end
+ end
+
+ protected
+
+ def current_user
+ if @order
+ def @order.login
+ name
+ end
+ @order
+ end
+ end
+
+ public
+
+ def alive
+ render :text => "alive"
+ end
+
+ def index
+ case request.method
+ when :post
+ @order = Order.for_password(params[:password])
+ if config.maintenance_mode
+ session.clear
+ render :template => "download/maintenance"
+ log_message "maintenance mode: no access"
+ elsif @order
+ session[:order_id] = @order.id
+ redirect_to url_for(:controller => :download, :action => :overview)
+ log_message "overview"
+ else
+ session.clear
+ render :template => "download/access_denied"
+ log_message "access denied used password '#{params[:password]}' from IP #{request.headers['REMOTE_ADDR']}"
+ end
+ when :delete
+ session.clear
+ render :template => "download/logged_out"
+ log_message "logged out"
+ else
+ session.clear
+ if config.maintenance_mode
+ render :template => "download/maintenance"
+ else
+ render :template => "download/login"
+ end
+ log_message "login page"
+ end
+ end
+
+ def overview
+ if @order
+ render :template => "download/overview"
+ else
+ # from session_timeout mixin
+ expire_session
+ end
+ end
+
+ def file
+ download_link(:filelink_and_size_and_item)
+ end
+
+ def archive
+ download_link(:archivelink_and_size_and_container)
+ end
+end
60 rails/app/controllers/dropboxes_controller.rb
View
@@ -0,0 +1,60 @@
+#
+# taperoom - application to manage audio files and give out download tickets
+# Copyright (C) 2013 Christian Meier <m.kristian@web.de>
+#
+# This file is part of taperoom.
+#
+# taperoom is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as
+# published by the Free Software Foundation, either version 3 of the
+# License, or (at your option) any later version.
+#
+# taperoom is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with taperoom. If not, see <http://www.gnu.org/licenses/>.
+#
+class DropboxesController < ApplicationController
+
+ public
+
+ # GET /containers/1/edit
+ def edit
+ @dropbox = Dropbox.get!(params[:container_id])
+ end
+
+ # PUT /containers/1
+ # PUT /containers/1.xml
+ def update
+ @dropbox = Dropbox.get!(params[:container_id])
+
+ respond_to do |format|
+ if @dropbox.rename(params[:old], params[:name])
+ flash[:notice] =
+ @dropbox.directory?(name) ? 'Directory renamed.' : 'File renamed.'
+ format.html { redirect_to(edit_container_dropbox_url(@dropbox.id)) }
+ format.xml { head :ok }
+ else
+ flash[:notice] =
+ params[:old] == params[:name] ? "filename the same" : "new filename already exists"
+ format.html { render :action => "edit" }
+ format.xml { render :xml => @dropbox.errors, :status => :unprocessable_entity }
+ end
+ end
+ end
+
+ # DELETE /containers/1
+ # DELETE /containers/1.xml
+ def destroy
+ @dropbox = Dropbox.get!(params[:container_id])
+ @dropbox.delete(params[:name])
+
+ respond_to do |format|
+ format.html { redirect_to(edit_container_dropbox_url(@dropbox.id)) }
+ format.xml { head :ok }
+ end
+ end
+end
22 rails/app/controllers/groups_controller.rb
View
@@ -0,0 +1,22 @@
+#
+# taperoom - application to manage audio files and give out download tickets
+# Copyright (C) 2013 Christian Meier <m.kristian@web.de>
+#
+# This file is part of taperoom.
+#
+# taperoom is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as
+# published by the Free Software Foundation, either version 3 of the
+# License, or (at your option) any later version.
+#
+# taperoom is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with taperoom. If not, see <http://www.gnu.org/licenses/>.
+#
+class GroupsController < ApplicationController
+ include Ixtlan::Controllers::GroupsController
+end
124 rails/app/controllers/items_controller.rb
View
@@ -0,0 +1,124 @@
+#
+# taperoom - application to manage audio files and give out download tickets
+# Copyright (C) 2013 Christian Meier <m.kristian@web.de>
+#
+# This file is part of taperoom.
+#
+# taperoom is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as
+# published by the Free Software Foundation, either version 3 of the
+# License, or (at your option) any later version.
+#
+# taperoom is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with taperoom. If not, see <http://www.gnu.org/licenses/>.
+#
+class ItemsController < ApplicationController
+
+ public
+
+ # GET /items/1
+ # GET /items/1.xml
+ def show
+ @item = Item.get!(params[:id])
+ respond_to do |format|
+ format.html # index.html.erb
+ format.xml { render :xml => @items }
+ end
+ end
+
+ # GET /items/1/edit
+ def edit
+ @item = Item.get!(params[:id])
+ end
+
+ # PUT /items/1
+ # PUT /items/1.xml
+ def update
+ @item = Item.get!(params[:id])
+ if params[:item][:name]
+ # rename
+ @item.name = params[:item][:name]
+ else
+ # move
+ # TODO what is the difference to move_to ????
+ @item.position = params[:item][:position]
+ end
+ respond_to do |format|
+ if @item.save
+ flash[:notice] = 'item was successfully renamed.'
+ format.html { redirect_to(params[:item][:name] ?
+ edit_item_url(@item.id) :
+ container_url(@item.parent.id)) }
+ format.xml { head :ok }
+ else
+ format.html { render :action => "edit" }
+ format.xml { render :xml => @item.errors, :status => :unprocessable_entity }
+ end
+ end
+ end
+
+ # DELETE /items/1
+ # DELETE /items/1.xml
+ def destroy
+ @item = Item.get(params[:id])
+ if @item
+ container_id = @item.parent.id
+ @item.destroy
+ else
+ container_id = Container.root_id
+ end
+ respond_to do |format|
+ flash[:notice] = 'item was successfully deleted.'
+ format.html { redirect_to(container_url(container_id)) }
+ format.xml { head :ok }
+ end
+ end
+
+ # PUT /items/<id>/down
+ def down
+ @item = Item.get!(params[:id])
+ @item.move_down
+ redirect_to container_url(@item.parent.id)
+ end
+
+ # PUT /items/<id>/up
+ def up
+ @item = Item.get!(params[:id])
+ @item.move_up
+ redirect_to container_url(@item.parent.id)
+ end
+
+ # PUT /items/<id>/move_to
+ def move_to
+ @item = Item.get!(params[:id])
+ @item.position = params[:item][:position]
+ respond_to do |format|
+ if @item.save
+ flash[:notice] = 'item was successfully moved.'
+ format.html { redirect_to(container_url(@item.parent.id)) }
+ format.xml { head :ok }
+ else
+ raise "error #{item.errors.inspect}"
+ end
+ end
+ end
+
+ # PUT /items/<id>/separator
+ def separator
+ @item = Item.get!(params[:id]).new_separator
+ respond_to do |format|
+ if @item.save
+ flash[:notice] = 'separator added.'
+ format.html { redirect_to container_url(@item.parent.id) }
+ format.xml { head :ok }
+ else
+ raise "error #{item.errors.inspect}"
+ end
+ end
+ end
+end
22 rails/app/controllers/locales_controller.rb
View
@@ -0,0 +1,22 @@
+#
+# taperoom - application to manage audio files and give out download tickets
+# Copyright (C) 2013 Christian Meier <m.kristian@web.de>
+#
+# This file is part of taperoom.
+#
+# taperoom is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as
+# published by the Free Software Foundation, either version 3 of the
+# License, or (at your option) any later version.
+#
+# taperoom is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with taperoom. If not, see <http://www.gnu.org/licenses/>.
+#
+class LocalesController < ApplicationController
+ include Ixtlan::Controllers::LocalesController
+end
156 rails/app/controllers/orders_controller.rb
View
@@ -0,0 +1,156 @@
+#
+# taperoom - application to manage audio files and give out download tickets
+# Copyright (C) 2013 Christian Meier <m.kristian@web.de>
+#
+# This file is part of taperoom.
+#
+# taperoom is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as
+# published by the Free Software Foundation, either version 3 of the
+# License, or (at your option) any later version.
+#
+# taperoom is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with taperoom. If not, see <http://www.gnu.org/licenses/>.
+#
+class OrdersController < ApplicationController
+
+ # GET /orders
+ # GET /orders.xml
+ def all
+ @orders = Order.all.reverse
+ @action = params[:action]
+ respond_to do |format|
+ format.html { render :action => :index }
+ format.xml { render :xml => @orders }
+ end
+ end