Browse files

Initial master of pastebin app

  • Loading branch information...
0 parents commit 56674da998f128da879f6936d9d18acf7a38f128 @weierophinney committed Aug 12, 2008
Showing with 26,688 additions and 0 deletions.
  1. +46 −0 .zfproject.xml
  2. +35 −0 application/configs/paste.ini
  3. +43 −0 application/controllers/ErrorController.php
  4. +44 −0 application/controllers/IndexController.php
  5. +225 −0 application/controllers/PasteController.php
  6. 0 application/data/cache-dev.db
  7. 0 application/data/cache-test.db
  8. 0 application/data/db-cache-dev.db
  9. 0 application/data/db-cache-test.db
  10. BIN application/data/paste-dev.db
  11. BIN application/data/paste-test.db
  12. BIN application/data/paste.db
  13. +29 −0 application/data/pasteSchema.php
  14. +118 −0 application/forms/PasteForm.php
  15. +4 −0 application/models/Exception.php
  16. +120 −0 application/models/Paste.php
  17. +95 −0 application/models/Paste/Table.php
  18. +25 −0 application/views/helpers/Geshi.php
  19. +15 −0 application/views/layouts/layout.phtml
  20. +18 −0 application/views/scripts/error/error.phtml
  21. +2 −0 application/views/scripts/index/test-complete.phtml
  22. +1 −0 application/views/scripts/index/test-editor.phtml
  23. +23 −0 application/views/scripts/paste/_about.phtml
  24. +32 −0 application/views/scripts/paste/_display.phtml
  25. +8 −0 application/views/scripts/paste/_followup-paste.phtml
  26. +7 −0 application/views/scripts/paste/_nav.phtml
  27. +8 −0 application/views/scripts/paste/_new-paste.phtml
  28. +1 −0 application/views/scripts/paste/active-data.ajax.phtml
  29. +1 −0 application/views/scripts/paste/active-data.phtml
  30. +26 −0 application/views/scripts/paste/active.ajax.phtml
  31. +9 −0 application/views/scripts/paste/active.phtml
  32. +3 −0 application/views/scripts/paste/display.ajax.phtml
  33. +13 −0 application/views/scripts/paste/display.phtml
  34. +3 −0 application/views/scripts/paste/followup.ajax.phtml
  35. +10 −0 application/views/scripts/paste/followup.phtml
  36. +6 −0 application/views/scripts/paste/index.phtml
  37. +3 −0 application/views/scripts/paste/new.ajax.phtml
  38. +7 −0 application/views/scripts/paste/new.phtml
  39. +7 −0 library/My/Form/Element/Editor.php
  40. +10 −0 library/My/Form/Element/SimpleTextarea.php
  41. +118 −0 library/My/Plugin/Initialize.php
  42. +66 −0 library/My/View/Helper/Editor.php
  43. +47 −0 library/My/View/Helper/SimpleTextarea.php
  44. +1 −0 library/Zend
  45. +1 −0 library/geshi
  46. +1 −0 library/geshi.php
  47. +11 −0 public/.htaccess
  48. +19 −0 public/index.php
  49. +1 −0 public/js
  50. +12 −0 public/js-build/dijit/ColorPalette.js
  51. +12 −0 public/js-build/dijit/Declaration.js
  52. +12 −0 public/js-build/dijit/Dialog.js
  53. +12 −0 public/js-build/dijit/Editor.js
  54. +12 −0 public/js-build/dijit/InlineEditBox.js
  55. +195 −0 public/js-build/dijit/LICENSE
  56. +12 −0 public/js-build/dijit/Menu.js
  57. +12 −0 public/js-build/dijit/ProgressBar.js
  58. +12 −0 public/js-build/dijit/TitlePane.js
  59. +12 −0 public/js-build/dijit/Toolbar.js
  60. +12 −0 public/js-build/dijit/Tooltip.js
  61. +12 −0 public/js-build/dijit/Tree.js
  62. +12 −0 public/js-build/dijit/_Calendar.js
  63. +12 −0 public/js-build/dijit/_Container.js
  64. +12 −0 public/js-build/dijit/_Templated.js
  65. +12 −0 public/js-build/dijit/_TimePicker.js
  66. +12 −0 public/js-build/dijit/_Widget.js
  67. +12 −0 public/js-build/dijit/_base.js
  68. +12 −0 public/js-build/dijit/_base/bidi.js
  69. +12 −0 public/js-build/dijit/_base/focus.js
  70. +12 −0 public/js-build/dijit/_base/manager.js
  71. +12 −0 public/js-build/dijit/_base/place.js
  72. +12 −0 public/js-build/dijit/_base/popup.js
  73. +12 −0 public/js-build/dijit/_base/scroll.js
  74. +12 −0 public/js-build/dijit/_base/sniff.js
  75. +12 −0 public/js-build/dijit/_base/typematic.js
  76. +12 −0 public/js-build/dijit/_base/wai.js
  77. +12 −0 public/js-build/dijit/_base/window.js
  78. +12 −0 public/js-build/dijit/_editor/RichText.js
  79. +12 −0 public/js-build/dijit/_editor/_Plugin.js
  80. +12 −0 public/js-build/dijit/_editor/html.js
  81. +1 −0 public/js-build/dijit/_editor/nls/FontChoice.js
  82. +1 −0 public/js-build/dijit/_editor/nls/LinkDialog.js
  83. +1 −0 public/js-build/dijit/_editor/nls/ar/FontChoice.js
  84. +1 −0 public/js-build/dijit/_editor/nls/ar/LinkDialog.js
  85. +1 −0 public/js-build/dijit/_editor/nls/ar/commands.js
  86. +1 −0 public/js-build/dijit/_editor/nls/commands.js
  87. +1 −0 public/js-build/dijit/_editor/nls/cs/FontChoice.js
  88. +1 −0 public/js-build/dijit/_editor/nls/cs/LinkDialog.js
  89. +1 −0 public/js-build/dijit/_editor/nls/cs/commands.js
  90. +1 −0 public/js-build/dijit/_editor/nls/da/FontChoice.js
  91. +1 −0 public/js-build/dijit/_editor/nls/da/LinkDialog.js
  92. +1 −0 public/js-build/dijit/_editor/nls/da/commands.js
  93. +1 −0 public/js-build/dijit/_editor/nls/de/FontChoice.js
  94. +1 −0 public/js-build/dijit/_editor/nls/de/LinkDialog.js
  95. +1 −0 public/js-build/dijit/_editor/nls/de/commands.js
  96. +1 −0 public/js-build/dijit/_editor/nls/el/FontChoice.js
  97. +1 −0 public/js-build/dijit/_editor/nls/el/LinkDialog.js
  98. +1 −0 public/js-build/dijit/_editor/nls/el/commands.js
  99. +1 −0 public/js-build/dijit/_editor/nls/es/FontChoice.js
  100. +1 −0 public/js-build/dijit/_editor/nls/es/LinkDialog.js
  101. +1 −0 public/js-build/dijit/_editor/nls/es/commands.js
  102. +1 −0 public/js-build/dijit/_editor/nls/fi/FontChoice.js
  103. +1 −0 public/js-build/dijit/_editor/nls/fi/LinkDialog.js
  104. +1 −0 public/js-build/dijit/_editor/nls/fi/commands.js
  105. +1 −0 public/js-build/dijit/_editor/nls/fr/FontChoice.js
  106. +1 −0 public/js-build/dijit/_editor/nls/fr/LinkDialog.js
  107. +1 −0 public/js-build/dijit/_editor/nls/fr/commands.js
  108. +1 −0 public/js-build/dijit/_editor/nls/he/FontChoice.js
  109. +1 −0 public/js-build/dijit/_editor/nls/he/LinkDialog.js
  110. +1 −0 public/js-build/dijit/_editor/nls/he/commands.js
  111. +1 −0 public/js-build/dijit/_editor/nls/hu/FontChoice.js
  112. +1 −0 public/js-build/dijit/_editor/nls/hu/LinkDialog.js
  113. +1 −0 public/js-build/dijit/_editor/nls/hu/commands.js
  114. +1 −0 public/js-build/dijit/_editor/nls/it/FontChoice.js
  115. +1 −0 public/js-build/dijit/_editor/nls/it/LinkDialog.js
  116. +1 −0 public/js-build/dijit/_editor/nls/it/commands.js
  117. +1 −0 public/js-build/dijit/_editor/nls/ja/FontChoice.js
  118. +1 −0 public/js-build/dijit/_editor/nls/ja/LinkDialog.js
  119. +1 −0 public/js-build/dijit/_editor/nls/ja/commands.js
  120. +1 −0 public/js-build/dijit/_editor/nls/ko/FontChoice.js
  121. +1 −0 public/js-build/dijit/_editor/nls/ko/LinkDialog.js
  122. +1 −0 public/js-build/dijit/_editor/nls/ko/commands.js
  123. +1 −0 public/js-build/dijit/_editor/nls/nb/FontChoice.js
  124. +1 −0 public/js-build/dijit/_editor/nls/nb/LinkDialog.js
  125. +1 −0 public/js-build/dijit/_editor/nls/nb/commands.js
  126. +1 −0 public/js-build/dijit/_editor/nls/nl/FontChoice.js
  127. +1 −0 public/js-build/dijit/_editor/nls/nl/LinkDialog.js
  128. +1 −0 public/js-build/dijit/_editor/nls/nl/commands.js
  129. +1 −0 public/js-build/dijit/_editor/nls/pl/FontChoice.js
  130. +1 −0 public/js-build/dijit/_editor/nls/pl/LinkDialog.js
  131. +1 −0 public/js-build/dijit/_editor/nls/pl/commands.js
  132. +1 −0 public/js-build/dijit/_editor/nls/pt-pt/FontChoice.js
  133. +1 −0 public/js-build/dijit/_editor/nls/pt-pt/LinkDialog.js
  134. +1 −0 public/js-build/dijit/_editor/nls/pt-pt/commands.js
  135. +1 −0 public/js-build/dijit/_editor/nls/pt/FontChoice.js
  136. +1 −0 public/js-build/dijit/_editor/nls/pt/LinkDialog.js
  137. +1 −0 public/js-build/dijit/_editor/nls/pt/commands.js
  138. +1 −0 public/js-build/dijit/_editor/nls/ru/FontChoice.js
  139. +1 −0 public/js-build/dijit/_editor/nls/ru/LinkDialog.js
  140. +1 −0 public/js-build/dijit/_editor/nls/ru/commands.js
  141. +1 −0 public/js-build/dijit/_editor/nls/sv/FontChoice.js
  142. +1 −0 public/js-build/dijit/_editor/nls/sv/LinkDialog.js
  143. +1 −0 public/js-build/dijit/_editor/nls/sv/commands.js
  144. +1 −0 public/js-build/dijit/_editor/nls/tr/FontChoice.js
  145. +1 −0 public/js-build/dijit/_editor/nls/tr/LinkDialog.js
  146. +1 −0 public/js-build/dijit/_editor/nls/tr/commands.js
  147. +1 −0 public/js-build/dijit/_editor/nls/zh-tw/FontChoice.js
  148. +1 −0 public/js-build/dijit/_editor/nls/zh-tw/LinkDialog.js
  149. +1 −0 public/js-build/dijit/_editor/nls/zh-tw/commands.js
  150. +1 −0 public/js-build/dijit/_editor/nls/zh/FontChoice.js
  151. +1 −0 public/js-build/dijit/_editor/nls/zh/LinkDialog.js
  152. +1 −0 public/js-build/dijit/_editor/nls/zh/commands.js
  153. +12 −0 public/js-build/dijit/_editor/plugins/AlwaysShowToolbar.js
  154. +12 −0 public/js-build/dijit/_editor/plugins/EnterKeyHandling.js
  155. +12 −0 public/js-build/dijit/_editor/plugins/FontChoice.js
  156. +12 −0 public/js-build/dijit/_editor/plugins/LinkDialog.js
  157. +12 −0 public/js-build/dijit/_editor/plugins/TextColor.js
  158. +12 −0 public/js-build/dijit/_editor/plugins/ToggleDir.js
  159. +12 −0 public/js-build/dijit/_editor/range.js
  160. +12 −0 public/js-build/dijit/_editor/selection.js
  161. +12 −0 public/js-build/dijit/_tree/Node.html
  162. +3 −0 public/js-build/dijit/_tree/Tree.html
  163. +12 −0 public/js-build/dijit/_tree/dndContainer.js
  164. +12 −0 public/js-build/dijit/_tree/dndSelector.js
  165. +12 −0 public/js-build/dijit/_tree/dndSource.js
  166. +12 −0 public/js-build/dijit/_tree/model.js
  167. +129 −0 public/js-build/dijit/bench/benchReceive.php
  168. +189 −0 public/js-build/dijit/bench/benchTool.html
  169. +73 −0 public/js-build/dijit/bench/create_widgets.html
  170. +75 −0 public/js-build/dijit/bench/test_Button-programmatic.html
  171. +66 −0 public/js-build/dijit/bench/test_button-results.html
  172. +186 −0 public/js-build/dijit/bench/widget_construction_test.php
  173. +93 −0 public/js-build/dijit/changes.txt
  174. +86 −0 public/js-build/dijit/demos/chat.html
  175. +46 −0 public/js-build/dijit/demos/chat/chat.css
  176. +65 −0 public/js-build/dijit/demos/chat/client.html
  177. +114 −0 public/js-build/dijit/demos/chat/community.html
  178. +83 −0 public/js-build/dijit/demos/chat/operator.html
  179. +12 −0 public/js-build/dijit/demos/chat/room.js
  180. +243 −0 public/js-build/dijit/demos/form.html
  181. +158 −0 public/js-build/dijit/demos/i18n.html
  182. +9 −0 public/js-build/dijit/demos/i18n/continents.json
  183. +8,646 −0 public/js-build/dijit/demos/i18n/data.json
  184. +1,224 −0 public/js-build/dijit/demos/i18n/flags.css
  185. BIN public/js-build/dijit/demos/i18n/flags.png
  186. +2,353 −0 public/js-build/dijit/demos/i18n/generate.html
  187. +215 −0 public/js-build/dijit/demos/i18n/langCountryMap.json
  188. +7,045 −0 public/js-build/dijit/demos/i18n/languages.json
  189. +18 −0 public/js-build/dijit/demos/i18n/languages.sh
  190. +2,319 −0 public/js-build/dijit/demos/i18n/sprite.html
  191. +426 −0 public/js-build/dijit/demos/mail.html
  192. BIN public/js-build/dijit/demos/mail/icons.gif
  193. BIN public/js-build/dijit/demos/mail/icons.png
  194. +157 −0 public/js-build/dijit/demos/mail/mail.css
  195. +75 −0 public/js-build/dijit/demos/mail/mail.json
  196. +8 −0 public/js-build/dijit/demos/mail/newMail.html
  197. +91 −0 public/js-build/dijit/demos/nihao.html
  198. +1 −0 public/js-build/dijit/demos/nihao/nls/en/helloworld.js
  199. +1 −0 public/js-build/dijit/demos/nihao/nls/fr/helloworld.js
  200. +1 −0 public/js-build/dijit/demos/nihao/nls/helloworld.js
  201. +1 −0 public/js-build/dijit/demos/nihao/nls/zh/helloworld.js
  202. +12 −0 public/js-build/dijit/dijit-all.js
  203. +12 −0 public/js-build/dijit/dijit.js
  204. +12 −0 public/js-build/dijit/form/Button.js
  205. +12 −0 public/js-build/dijit/form/CheckBox.js
  206. +12 −0 public/js-build/dijit/form/ComboBox.js
  207. +12 −0 public/js-build/dijit/form/CurrencyTextBox.js
  208. +12 −0 public/js-build/dijit/form/DateTextBox.js
  209. +12 −0 public/js-build/dijit/form/FilteringSelect.js
  210. +12 −0 public/js-build/dijit/form/Form.js
  211. +12 −0 public/js-build/dijit/form/MultiSelect.js
  212. +12 −0 public/js-build/dijit/form/NumberSpinner.js
  213. +12 −0 public/js-build/dijit/form/NumberTextBox.js
  214. +12 −0 public/js-build/dijit/form/SimpleTextarea.js
  215. +12 −0 public/js-build/dijit/form/Slider.js
  216. +12 −0 public/js-build/dijit/form/TextBox.js
  217. +12 −0 public/js-build/dijit/form/Textarea.js
  218. +12 −0 public/js-build/dijit/form/TimeTextBox.js
  219. +12 −0 public/js-build/dijit/form/ValidationTextBox.js
  220. +12 −0 public/js-build/dijit/form/_DateTimeTextBox.js
  221. +12 −0 public/js-build/dijit/form/_FormWidget.js
  222. +12 −0 public/js-build/dijit/form/_Spinner.js
  223. +1 −0 public/js-build/dijit/form/nls/ComboBox.js
  224. +1 −0 public/js-build/dijit/form/nls/Textarea.js
  225. +1 −0 public/js-build/dijit/form/nls/ar/ComboBox.js
  226. +1 −0 public/js-build/dijit/form/nls/ar/Textarea.js
  227. +1 −0 public/js-build/dijit/form/nls/ar/validate.js
  228. +1 −0 public/js-build/dijit/form/nls/cs/ComboBox.js
  229. +1 −0 public/js-build/dijit/form/nls/cs/Textarea.js
  230. +1 −0 public/js-build/dijit/form/nls/cs/validate.js
  231. +1 −0 public/js-build/dijit/form/nls/da/ComboBox.js
  232. +1 −0 public/js-build/dijit/form/nls/da/Textarea.js
  233. +1 −0 public/js-build/dijit/form/nls/da/validate.js
  234. +1 −0 public/js-build/dijit/form/nls/de/ComboBox.js
  235. +1 −0 public/js-build/dijit/form/nls/de/Textarea.js
  236. +1 −0 public/js-build/dijit/form/nls/de/validate.js
  237. +1 −0 public/js-build/dijit/form/nls/el/ComboBox.js
  238. +1 −0 public/js-build/dijit/form/nls/el/Textarea.js
  239. +1 −0 public/js-build/dijit/form/nls/el/validate.js
  240. +1 −0 public/js-build/dijit/form/nls/es/ComboBox.js
  241. +1 −0 public/js-build/dijit/form/nls/es/Textarea.js
  242. +1 −0 public/js-build/dijit/form/nls/es/validate.js
  243. +1 −0 public/js-build/dijit/form/nls/fi/ComboBox.js
  244. +1 −0 public/js-build/dijit/form/nls/fi/Textarea.js
  245. +1 −0 public/js-build/dijit/form/nls/fi/validate.js
  246. +1 −0 public/js-build/dijit/form/nls/fr/ComboBox.js
  247. +1 −0 public/js-build/dijit/form/nls/fr/Textarea.js
  248. +1 −0 public/js-build/dijit/form/nls/fr/validate.js
  249. +1 −0 public/js-build/dijit/form/nls/he/ComboBox.js
  250. +1 −0 public/js-build/dijit/form/nls/he/Textarea.js
  251. +1 −0 public/js-build/dijit/form/nls/he/validate.js
  252. +1 −0 public/js-build/dijit/form/nls/hu/ComboBox.js
  253. +1 −0 public/js-build/dijit/form/nls/hu/Textarea.js
  254. +1 −0 public/js-build/dijit/form/nls/hu/validate.js
  255. +1 −0 public/js-build/dijit/form/nls/it/ComboBox.js
  256. +1 −0 public/js-build/dijit/form/nls/it/Textarea.js
  257. +1 −0 public/js-build/dijit/form/nls/it/validate.js
  258. +1 −0 public/js-build/dijit/form/nls/ja/ComboBox.js
  259. +1 −0 public/js-build/dijit/form/nls/ja/Textarea.js
  260. +1 −0 public/js-build/dijit/form/nls/ja/validate.js
  261. +1 −0 public/js-build/dijit/form/nls/ko/ComboBox.js
  262. +1 −0 public/js-build/dijit/form/nls/ko/Textarea.js
  263. +1 −0 public/js-build/dijit/form/nls/ko/validate.js
  264. +1 −0 public/js-build/dijit/form/nls/nb/ComboBox.js
  265. +1 −0 public/js-build/dijit/form/nls/nb/Textarea.js
  266. +1 −0 public/js-build/dijit/form/nls/nb/validate.js
  267. +1 −0 public/js-build/dijit/form/nls/nl/ComboBox.js
  268. +1 −0 public/js-build/dijit/form/nls/nl/Textarea.js
  269. +1 −0 public/js-build/dijit/form/nls/nl/validate.js
  270. +1 −0 public/js-build/dijit/form/nls/pl/ComboBox.js
  271. +1 −0 public/js-build/dijit/form/nls/pl/Textarea.js
  272. +1 −0 public/js-build/dijit/form/nls/pl/validate.js
  273. +1 −0 public/js-build/dijit/form/nls/pt-pt/ComboBox.js
  274. +1 −0 public/js-build/dijit/form/nls/pt-pt/Textarea.js
  275. +1 −0 public/js-build/dijit/form/nls/pt-pt/validate.js
  276. +1 −0 public/js-build/dijit/form/nls/pt/ComboBox.js
  277. +1 −0 public/js-build/dijit/form/nls/pt/Textarea.js
  278. +1 −0 public/js-build/dijit/form/nls/pt/validate.js
  279. +1 −0 public/js-build/dijit/form/nls/ru/ComboBox.js
  280. +1 −0 public/js-build/dijit/form/nls/ru/Textarea.js
  281. +1 −0 public/js-build/dijit/form/nls/ru/validate.js
  282. +1 −0 public/js-build/dijit/form/nls/sv/ComboBox.js
  283. +1 −0 public/js-build/dijit/form/nls/sv/Textarea.js
  284. +1 −0 public/js-build/dijit/form/nls/sv/validate.js
  285. +1 −0 public/js-build/dijit/form/nls/tr/ComboBox.js
  286. +1 −0 public/js-build/dijit/form/nls/tr/Textarea.js
  287. +1 −0 public/js-build/dijit/form/nls/tr/validate.js
  288. +1 −0 public/js-build/dijit/form/nls/validate.js
  289. +1 −0 public/js-build/dijit/form/nls/zh-tw/ComboBox.js
  290. +1 −0 public/js-build/dijit/form/nls/zh-tw/Textarea.js
  291. +1 −0 public/js-build/dijit/form/nls/zh-tw/validate.js
  292. +1 −0 public/js-build/dijit/form/nls/zh/ComboBox.js
  293. +1 −0 public/js-build/dijit/form/nls/zh/Textarea.js
  294. +1 −0 public/js-build/dijit/form/nls/zh/validate.js
  295. +11 −0 public/js-build/dijit/form/templates/Button.html
  296. +7 −0 public/js-build/dijit/form/templates/CheckBox.html
  297. +19 −0 public/js-build/dijit/form/templates/ComboBox.html
  298. +21 −0 public/js-build/dijit/form/templates/ComboButton.html
  299. +13 −0 public/js-build/dijit/form/templates/DropDownButton.html
  300. +37 −0 public/js-build/dijit/form/templates/HorizontalSlider.html
Sorry, we could not display the entire diff because too many files (3,989) changed.
46 .zfproject.xml
@@ -0,0 +1,46 @@
+<?xml version="1.0"?>
+<projectProfile>
+ <projectDirectory>
+ <projectProfileFile/>
+ <applicationDirectory>
+ <apisDirectory enabled="false"/>
+ <configsDirectory/>
+ <controllersDirectory>
+ <controllerFile controllerName="index"/>
+ <controllerFile controllerName="error"/>
+ </controllersDirectory>
+ <layoutsDirectory enabled="false"/>
+ <modelsDirectory/>
+ <modulesDirectory enabled="false"/>
+ <viewsDirectory>
+ <viewScriptsDirectory>
+ <viewControllerScriptsDirectory forControllerName="index">
+ <viewScriptFile scriptName="index"/>
+ </viewControllerScriptsDirectory>
+ </viewScriptsDirectory>
+ <viewHelpersDirectory/>
+ <viewFiltersDirectory enabled="false"/>
+ </viewsDirectory>
+ <bootstrapFile/>
+ </applicationDirectory>
+ <dataDirectory enabled="false">
+ <cacheDirectory enabled="false"/>
+ <searchIndexesDirectory enabled="false"/>
+ <localesDirectory enabled="false"/>
+ <logsDirectory enabled="false"/>
+ <sessionsDirectory enabled="false"/>
+ <uploadsDirectory enabled="false"/>
+ </dataDirectory>
+ <libraryDirectory>
+ <zfStandardLibraryDirectory/>
+ </libraryDirectory>
+ <publicDirectory>
+ <publicStylesheetsDirectory enabled="false"/>
+ <publicScriptsDirectory enabled="false"/>
+ <publicImagesDirectory enabled="false"/>
+ <publicIndexFile/>
+ <htaccessFile/>
+ </publicDirectory>
+ <providersDirectory enabled="false"/>
+ </projectDirectory>
+</projectProfile>
35 application/configs/paste.ini
@@ -0,0 +1,35 @@
+[development]
+paths.init = 0
+
+db.cxn.adapter = "pdo_sqlite"
+db.cxn.params.dbname = "paste-dev.db"
+db.cache.backendName = "Sqlite"
+db.cache.frontendName = "Core"
+db.cache.frontendOptions.caching = false
+db.cache.frontendOptions.lifetime = 900
+db.cache.frontendOptions.automatic_serialization = true
+db.cache.frontendOptions.automatic_cleaning_factor = 20
+db.cache.backendOptions.cache_db_complete_path = "db-cache-dev.db"
+db.cache.backendOptions.automatic_vacuum_factor = 20
+
+cache.backendName = "Sqlite"
+cache.frontendName = "Core"
+cache.frontendOptions.caching = false
+cache.frontendOptions.lifetime = 900
+cache.frontendOptions.automatic_serialization = true
+cache.frontendOptions.automatic_cleaning_factor = 20
+cache.backendOptions.cache_db_complete_path = "cache-dev.db"
+cache.backendOptions.automatic_vacuum_factor = 20
+
+[testing : development]
+db.cxn.params.dbname = "paste-test.db"
+db.cache.backendOptions.cache_db_complete_path = "db-cache-test.db"
+
+cache.backendOptions.cache_db_complete_path = "cache-test.db"
+
+[production : development]
+db.cxn.params.dbname = "paste-prod.db"
+db.cache.backendOptions.cache_db_complete_path = "db-cache-prod.db"
+
+cache.frontendOptions.caching = true
+cache.backendOptions.cache_db_complete_path = "cache-prod.db"
43 application/controllers/ErrorController.php
@@ -0,0 +1,43 @@
+<?php
+require_once 'Zend/Controller/Action.php';
+
+class ErrorController extends Zend_Controller_Action
+{
+ public function errorAction()
+ {
+ $errors = $this->_getParam('error_handler');
+
+ switch ($errors->type) {
+ case Zend_Controller_Plugin_ErrorHandler::EXCEPTION_NO_CONTROLLER:
+ case Zend_Controller_Plugin_ErrorHandler::EXCEPTION_NO_ACTION:
+ // 404 error -- controller or action not found
+ $this->getResponse()->setHttpResponseCode(404);
+ $this->view->message = 'Page not found';
+ $this->view->code = 404;
+ if ($errors->type == Zend_Controller_Plugin_ErrorHandler::EXCEPTION_NO_CONTROLLER) {
+ $this->view->info = sprintf(
+ 'Unable to find controller "%s" in module "%s"',
+ $errors->request->getControllerName(),
+ $errors->request->getModuleName()
+ );
+ }
+ if ($errors->type == Zend_Controller_Plugin_ErrorHandler::EXCEPTION_NO_ACTION) {
+ $this->view->info = sprintf(
+ 'Unable to find action "%s" in controller "%s" in module "%s"',
+ $errors->request->getActionName(),
+ $errors->request->getControllerName(),
+ $errors->request->getModuleName()
+ );
+ }
+ break;
+ case Zend_Controller_Plugin_ErrorHandler::EXCEPTION_NO_ACTION:
+ default:
+ // application error
+ $this->getResponse()->setHttpResponseCode(500);
+ $this->view->message = 'Application error';
+ $this->view->code = 500;
+ $this->view->info = $errors->exception;
+ break;
+ }
+ }
+}
44 application/controllers/IndexController.php
@@ -0,0 +1,44 @@
+<?php
+
+class IndexController extends Zend_Controller_Action
+{
+ public function indexAction()
+ {
+ $this->_helper->redirector('index', 'paste');
+ }
+
+ public function testEditorAction()
+ {
+ Zend_Dojo_View_Helper_Dojo::setUseDeclarative();
+ $this->view->dojo()->registerModulePath('paste', '../paste')
+ ->requireModule('paste.main')
+ ->addOnLoad('paste.main.init')
+ ->enable();
+
+ $request = $this->getRequest();
+
+ if ($request->isPost()) {
+ $this->view->data = $request->getPost();
+ return $this->render('test-complete');
+ }
+
+ $form = new Zend_Dojo_Form(array(
+ 'action' => '/index/test-editor',
+ 'method' => 'post',
+ 'elementsBelongTo' => 'fooForm',
+ ));
+ $form->addPrefixPath('My_Form_Element', 'My/Form/Element', 'element');
+
+ $form->addElement('Editor', 'content', array(
+ 'width' => '200px',
+ 'value' => "It was a dark and stormy night. Your story belongs here!",
+ ));
+
+ $form->addElement('SubmitButton', 'save', array(
+ 'label' => 'Save',
+ ));
+
+ $this->view->form = $form;
+ return $this->render();
+ }
+}
225 application/controllers/PasteController.php
@@ -0,0 +1,225 @@
+<?php
+/**
+ * Pastebin application
+ *
+ * @uses Zend_Controller_Action
+ * @package Paste
+ * @author Matthew Weier O'Phinney <matthew@weierophinney.net>
+ * @copyright Copyright (C) 2008 - Present, Matthew Weier O'Phinney
+ * @license New BSD {@link http://framework.zend.com/license/new-bsd}
+ * @version $Id: $
+ */
+class PasteController extends Zend_Controller_Action
+{
+ protected $_model;
+
+ /**
+ * Pre-Dispatch: set up dojo and context switching
+ *
+ * @return void
+ */
+ public function preDispatch()
+ {
+ Zend_Dojo_View_Helper_Dojo::setUseDeclarative();
+ $contextSwitch = $this->_helper->contextSwitch;
+ $contextSwitch->addContext('ajax', array('suffix' => 'ajax'))
+ ->addActionContext('new', 'ajax')
+ ->addActionContext('followup', 'ajax')
+ ->addActionContext('display', 'ajax')
+ ->addActionContext('active', 'ajax')
+ ->addActionContext('active-data', 'ajax')
+ ->initContext();
+
+ $this->view->dojo()->registerModulePath('paste', '../paste')
+ ->requireModule('paste.main')
+ ->addOnLoad('paste.main.init');
+ }
+
+ /**
+ * Landing page
+ *
+ * @return void
+ */
+ public function indexAction()
+ {
+ }
+
+ /**
+ * New Paste page
+ *
+ * @return void
+ */
+ public function newAction()
+ {
+ $form = $this->getForm();
+ $this->view->form = $form;
+ }
+
+ /**
+ * Save paste
+ *
+ * @return void
+ */
+ public function saveAction()
+ {
+ $request = $this->getRequest();
+ if (!$request->isPost()) {
+ return $this->_helper->redirector('new');
+ }
+
+ $form = $this->getForm();
+ if (!$form->isValid($request->getPost($form->getElementsBelongTo()))) {
+ $this->view->form = $form;
+ return $this->render('new');
+ }
+
+ $data = $form->getValues();
+ $data = $data['pasteform'];
+ $model = $this->getModel();
+ $id = $model->add($data);
+ $this->_helper->redirector('display', null, null, array('id' => $id));
+ }
+
+ /**
+ * Display paste
+ *
+ * @return void
+ */
+ public function displayAction()
+ {
+ if (!$id = $this->_getParam('id', false)) {
+ return $this->_helper->redirector('index');
+ }
+
+ $model = $this->getModel();
+ if (!$paste = $model->get($id)) {$view = Zend_Layout::getMvcInstance()->getView();
+ $this->view->title = 'Not Found';
+ $this->view->message = "Paste not found";
+ return;
+ }
+
+ $this->view->id = $id;
+ $this->view->title = $id;
+ $this->view->paste = $paste;
+ }
+
+ /**
+ * Follow-up paste form
+ *
+ * @return void
+ */
+ public function followupAction()
+ {
+ if (!$id = $this->_getParam('id', false)) {
+ return $this->_helper->redirector('index');
+ }
+
+ $model = $this->getModel();
+ if (!$paste = $model->get($id)) {$view = Zend_Layout::getMvcInstance()->getView();
+ $this->view->title = 'Not Found';
+ $this->view->message = "Paste not found";
+ return;
+ }
+ $this->view->id = $id;
+
+ $followupKeys = array(
+ 'code' => null,
+ 'type' => null,
+ 'summary' => null,
+ );
+ $followup = array_intersect_key($paste, $followupKeys);
+ $followup['parent'] = $id;
+
+ $form = $this->getFollowupForm($id);
+ $form->setDefaults($followup);
+
+ $this->view->title = 'Followup: ' . $id;
+ $this->view->form = $form;
+ }
+
+ /**
+ * Process followup
+ *
+ * @return void
+ */
+ public function saveFollowupAction()
+ {
+ $request = $this->getRequest();
+ if (!$request->isPost()) {
+ return $this->_helper->redirector('new');
+ }
+
+ if (!$parentId = $this->_getParam('id', false)) {
+ return $this->_helper->redirector('index');
+ }
+
+ $form = $this->getFollowupForm($parentId);
+ if (!$form->isValid($request->getPost($form->getElementsBelongTo()))) {
+ $this->view->form = $form;
+ return $this->render('followup');
+ }
+
+ $data = $form->getValues();
+ $data = $data[$form->getElementsBelongTo()];
+ $model = $this->getModel();
+ $id = $model->add($data);
+ $this->_helper->redirector('display', null, null, array('id' => $id));
+ }
+
+ public function activeAction()
+ {
+ }
+
+ public function activeDataAction()
+ {
+ $model = $this->getModel();
+ $dojoData = new Zend_Dojo_Data('id', $model->fetchActive(), 'id');
+ $this->view->data = $dojoData;
+ }
+
+ /**
+ * Helper method: get paste model
+ *
+ * @return Paste
+ */
+ public function getModel()
+ {
+ if (null === $this->_model) {
+ $this->_model = new Paste();
+ }
+ return $this->_model;
+ }
+
+ /**
+ * Helper method: get new paste form
+ *
+ * @return PasteForm
+ */
+ public function getForm()
+ {
+ require_once dirname(__FILE__) . '/../forms/PasteForm.php';
+ return new PasteForm(array('action' => '/paste/save', 'method' => 'post'));
+ }
+
+ /**
+ * Helper method: get followup paste form
+ *
+ * @param string $id
+ * @return PasteForm
+ */
+ public function getFollowupForm($id)
+ {
+ $form = $this->getForm();
+ $form->addElement('hidden', 'parent', array(
+ 'required' => true,
+ 'validators' => array(
+ new Zend_Validate_Identical($id),
+ ),
+ ))
+ ->setName('followupform')
+ ->setElementsBelongTo('followupform')
+ ->setAction('/paste/save-followup/id/' . $id);
+ $form->save->setDijitParam('onClick', 'paste.main.followupPasteButton');
+ return $form;
+ }
+}
0 application/data/cache-dev.db
No changes.
0 application/data/cache-test.db
No changes.
0 application/data/db-cache-dev.db
No changes.
0 application/data/db-cache-test.db
No changes.
BIN application/data/paste-dev.db
Binary file not shown.
BIN application/data/paste-test.db
Binary file not shown.
BIN application/data/paste.db
Binary file not shown.
29 application/data/pasteSchema.php
@@ -0,0 +1,29 @@
+<?php
+$statements = array();
+
+$statements[] =<<<EOQ
+CREATE TABLE paste (
+ id CHAR(13) NOT NULL PRIMARY KEY,
+ code TEXT NOT NULL,
+ type VARCHAR(32) NOT NULL DEFAULT 'php',
+ summary TEXT NULL,
+ user VARCHAR(32) NULL,
+ parent CHAR(13) NULL,
+ created DATETIME NOT NULL,
+ expires DATETIME NULL
+);
+EOQ;
+
+$statements[] =<<<EOQ
+CREATE INDEX "id" ON "paste" ("id");
+EOQ;
+
+$statements[] =<<<EOQ
+CREATE INDEX "parent" ON "paste" ("parent");
+EOQ;
+
+$statements[] =<<<EOQ
+CREATE INDEX "idExpires" ON "paste" ("id", "expires");
+EOQ;
+
+return $statements;
118 application/forms/PasteForm.php
@@ -0,0 +1,118 @@
+<?php
+/**
+ * New pastebin form
+ *
+ * @uses Zend_Dojo_Form
+ * @package Paste
+ * @license New BSD {@link http://framework.zend.com/license/new-bsd}
+ * @version $Id: $
+ */
+class PasteForm extends Zend_Dojo_Form
+{
+ /**
+ * @var array Programming languages with syntax highlighting
+ */
+ protected $_languages;
+
+ /**
+ * Initialize form
+ *
+ * @return void
+ */
+ public function init()
+ {
+ $this->addPrefixPath('My_Form_Element', 'My/Form/Element/', 'element');
+
+ $expiries = array(
+ '' => 'No expiration',
+ 60 * 15 => '15 minutes',
+ 60 * 60 => '1 hour',
+ 60 * 60 * 3 => '3 hours',
+ 60 * 60 * 6 => '6 hours',
+ 60 * 60 * 12 => '12 hours',
+ 60 * 60 * 24 => '1 day',
+ 60 * 60 * 24 * 3 => '3 days',
+ 60 * 60 * 24 * 7 => '1 week',
+ 60 * 60 * 24 * 30 => '1 month',
+ );
+
+ $languages = $this->_getLanguages();
+
+ $this->setName('pasteform')
+ ->setElementsBelongTo('paste-form');
+
+ $this->addElement('FilteringSelect', 'type', array(
+ 'label' => 'Language:',
+ 'multiOptions' => $languages,
+ 'required' => true,
+ 'validators' => array(
+ array('InArray', true, array(array_keys($languages))),
+ ),
+ ));
+
+ $this->addElement('ValidationTextBox', 'user', array(
+ 'label' => 'Your name:',
+ 'regExp' => '^[a-z][a-z0-9_-]+$',
+ 'validators' => array(
+ array('Regex', true, array('/^[a-z][a-z0-9_-]+$/i')),
+ ),
+ ));
+
+ $this->addElement('SimpleTextarea', 'summary', array(
+ 'label' => 'Summary:',
+ 'class' => 'summaryTextarea',
+ ));
+
+ $this->addElement('FilteringSelect', 'expires', array(
+ 'label' => 'Expiration:',
+ 'multiOptions' => $expiries,
+ 'validators' => array(
+ array('InArray', true, array(array_keys($expiries))),
+ ),
+ ));
+
+ $this->addElement('SimpleTextarea', 'code', array(
+ 'label' => 'Code:',
+ 'required' => true,
+ 'class' => 'codeTextarea',
+ ));
+
+ $this->addElement('submitButton', 'save', array(
+ 'required' => false,
+ 'ignore' => true,
+ 'label' => 'Save',
+ ));
+
+ $this->setDecorators(array(
+ 'FormElements',
+ array('HtmlTag', array('tag' => 'dl')),
+ 'Form',
+ ));
+ }
+
+ /**
+ * Retrieve languages
+ *
+ * @return array
+ */
+ protected function _getLanguages()
+ {
+ if (null === $this->_languages) {
+ $cache = Zend_Registry::get('cache');
+ if (!$languages = $cache->load('PasteForm_Languages')) {
+ $config = Zend_Registry::get('config');
+ $di = new DirectoryIterator($config->paths->libPath . '/geshi');
+ $ri = new RegexIterator($di, '/\.php$/');
+ $languages = array();
+ foreach ($ri as $match) {
+ $file = $match->getFilename();
+ $lang = substr($file, 0, strlen($file) - 4);
+ $languages[$lang] = $lang;
+ }
+ $cache->save($languages, 'PasteForm_Languages', array('form', 'data'));
+ }
+ $this->_languages = $languages;
+ }
+ return $this->_languages;
+ }
+}
4 application/models/Exception.php
@@ -0,0 +1,4 @@
+<?php
+class Model_Exception extends Exception
+{
+}
120 application/models/Paste.php
@@ -0,0 +1,120 @@
+<?php
+/**
+ * Pastebin model
+ *
+ * @package Paste
+ * @license New BSD {@link http://framework.zend.com/license/new-bsd}
+ * @version $Id: $
+ */
+class Paste
+{
+ /**
+ * Table fields
+ * @var array
+ */
+ protected $_fields;
+
+ /**
+ * @var Zend_Db_Table_Abstract
+ */
+ protected $_table;
+
+ /**
+ * Add a paste
+ *
+ * @param array $data
+ * @return string
+ */
+ public function add(array $data)
+ {
+ $fields = $this->_getFields();
+ foreach ($data as $key => $value) {
+ if (!in_array($key, $fields)) {
+ unset($data[$key]);
+ }
+ }
+ return $this->_getTable()->insert($data);
+ }
+
+ /**
+ * Fetch a paste by id
+ *
+ * Returns boolean false on failure to find the paste; otherwise, a struct
+ * is returned.
+ *
+ * @param string $id
+ * @return struct|false
+ */
+ public function get($id)
+ {
+ $table = $this->_getTable();
+ $select = $table->select();
+ $select->where('id = ?', $id)
+ ->where('expires IS NULL OR expires = "" OR expires > ?', date('Y-m-d H:i:s'));
+ $row = $table->fetchRow($select);
+ if (null == $row) {
+ return false;
+ }
+ $data = $row->toArray();
+ $data['children'] = $this->_getChildren($id);
+ return $data;
+ }
+
+ /**
+ * Get list of active pastes, ordered by creation date (desc)
+ *
+ * @return array
+ */
+ public function fetchActive()
+ {
+ $table = $this->_getTable();
+ $adapter = $table->getAdapter();
+ $select = $adapter->select();
+ $select->from('paste', array('id', 'type', 'summary', 'user', 'created', 'expires'))
+ ->where('expires IS NULL OR expires = "" OR expires > ?', date('Y-m-d H:i:s'))
+ ->order('created DESC');
+
+ return $adapter->fetchAll($select);
+ }
+
+ /**
+ * Retrieve data provider
+ *
+ * @return Paste_Table
+ */
+ protected function _getTable()
+ {
+ if (null === $this->_table) {
+ $this->_table = new Paste_Table();
+ }
+ return $this->_table;
+ }
+
+ /**
+ * Retrieve table fields
+ *
+ * @return array
+ */
+ protected function _getFields()
+ {
+ if (null === $this->_fields) {
+ $this->_fields = $this->_getTable()->info('cols');
+ }
+ return $this->_fields;
+ }
+
+ /**
+ * Retrieve paste children
+ *
+ * @param string $id
+ * @return false|array
+ */
+ protected function _getChildren($id)
+ {
+ $adapter = $this->_getTable()->getAdapter();
+ $select = $adapter->select();
+ $select->from('paste', array('id'))
+ ->where('parent = ?', $id);
+ return $adapter->fetchCol($select);
+ }
+}
95 application/models/Paste/Table.php
@@ -0,0 +1,95 @@
+<?php
+/**
+ * Table data gateway for paste table
+ *
+ * @uses Zend_Db_Table_Abstract
+ * @package Paste
+ * @license New BSD {@link http://framework.zend.com/license/new-bsd}
+ * @version $Id: $
+ */
+class Paste_Table extends Zend_Db_Table_Abstract
+{
+ /**
+ * @var string Table name
+ */
+ protected $_name = 'paste';
+
+ /**
+ * @var string Primary key
+ */
+ protected $_primary = 'id';
+
+ /**
+ * Insert
+ *
+ * Calculates a unique ID and commits the new data
+ *
+ * @param array $data
+ * @return string
+ */
+ public function insert(array $data)
+ {
+ $adapter = $this->getAdapter();
+ $adapter->beginTransaction();
+ do {
+ $uniqId = uniqid();
+ $select = $adapter->select()->from($this->_name, 'COUNT(*)')
+ ->where('id = ?', $uniqId);
+ $found = $adapter->fetchOne($select);
+ } while ($found > 0);
+
+ $data['id'] = $uniqId;
+ $data['created'] = date('Y-m-d H:i:s');
+
+ $created = strtotime($data['created']);
+
+ if (array_key_exists('expires', $data)
+ && (is_int($data['expires']) || ($data['expires'] == intval($data['expires'])))
+ ) {
+ $expires = $data['expires'];
+ if ((0 < $expires) && ($expires < $created)) {
+ $data['expires'] = date('Y-m-d H:i:s', $created + $expires);
+ }
+ } elseif (array_key_exists('expires', $data) && is_string($data['expires'])) {
+ $expires = strtotime($data['expires']);
+ if ((0 < $expires) && ($expires < $created)) {
+ unset($data['expires']);
+ }
+ } elseif (array_key_exists('expires', $data)) {
+ unset($data['expires']);
+ }
+
+ parent::insert($data);
+
+ $adapter->commit();
+
+ return $uniqId;
+ }
+
+ /**
+ * Do not allow updates
+ *
+ * @param array $data
+ * @param mixed $where
+ * @return void
+ * @throws Model_Exception
+ */
+ public function update(array $data, $where)
+ {
+ require_once dirname(__FILE__) . '/../Exception.php';
+ throw new Model_Exception('Pastebin does not allow updates');
+ }
+
+ /**
+ * Do not allow deletions
+ *
+ * @param mixed $where
+ * @return void
+ * @throws Model_Exception
+ */
+ public function delete($where)
+ {
+ require_once dirname(__FILE__) . '/../Exception.php';
+ throw new Model_Exception('Pastebin does not allow deletes');
+ }
+}
25 application/views/helpers/Geshi.php
@@ -0,0 +1,25 @@
+<?php
+require_once 'geshi.php';
+
+class Zend_View_Helper_Geshi extends Zend_View_Helper_Abstract
+{
+ public function geshi($code, $language)
+ {
+ $lines = preg_split('/(\r[\n]?|\n)/', $code);
+ foreach ($lines as $key => $line) {
+ if (preg_match('/^(([ ]{4})+)/', $line, $matches)) {
+ $numTabs = strlen($matches[1]) / 4;
+ $tabs = str_repeat("\t", $numTabs);
+ $lines[$key] = str_replace($matches[1], $tabs, $line);
+ }
+ }
+ $code = implode("\n", $lines);
+
+ $geshi = new GeSHi($code, $language);
+ $geshi->set_header_type(GESHI_HEADER_PRE);
+ $geshi->enable_line_numbers(GESHI_NORMAL_LINE_NUMBERS);
+ $geshi->set_overall_class('formatted');
+
+ return $geshi->parse_code();
+ }
+}
15 application/views/layouts/layout.phtml
@@ -0,0 +1,15 @@
+<?= $this->doctype() ?>
+<html>
+<head>
+ <?= $this->headTitle() ?>
+ <?= $this->headMeta() ?>
+ <?= $this->headLink() ?>
+ <?= $this->headStyle() ?>
+ <?= $this->dojo() ?>
+ <?= $this->headScript() ?>
+
+</head>
+<body class="tundra">
+ <?= $this->layout()->content ?>
+</body>
+</html>
18 application/views/scripts/error/error.phtml
@@ -0,0 +1,18 @@
+<h1>Error!</h1>
+<p><?= $this->message ?></p>
+<? if (isset($this->info)): ?>
+<? if (404 == $this->code): ?>
+ <p>
+ <b>Reason:</b> <?= $this->info ?>
+ </p>
+<? elseif (500 == $this->code): ?>
+ <h2>Exception information:</h2>
+ <p>
+ <b>Message:</b> <?= $this->info->getMessage() ?>
+ </p>
+ <h4>Stack trace:</h4>
+ <pre>
+ <?= $this->info->getTraceAsString() ?>
+ </pre>
+<? endif ?>
+<? endif ?>
2 application/views/scripts/index/test-complete.phtml
@@ -0,0 +1,2 @@
+<h2>Final Values</h2>
+<pre><?= var_export($this->data, 1) ?></pre>
1 application/views/scripts/index/test-editor.phtml
@@ -0,0 +1 @@
+<?= $this->form ?>
23 application/views/scripts/paste/_about.phtml
@@ -0,0 +1,23 @@
+<? $this->contentPane()->captureStart('about', array('title' => 'About', 'class' => 'tab')) ?>
+<h3>Welcome</h3>
+
+<p>
+ This is a public pastebin. To quote <a href="http://pastebin.ca/">Pastebin</a>,
+ a pastebin "is a public place to paste things (primarily configurations and
+ source code), but it is really open to pretty much any text format. The idea is
+ to paste large items here when talking online to someone, or even when holding
+ a phone conversation to paste the little things that are hard to explain."
+</p>
+
+<p>
+ All pastes are public, so you are encouraged not to post anything of a
+ sensitive nature. However, this particular implementation does not aggregate or
+ list posts, and all posts receive a random unique identifier, which should help
+ to preserve a certain amount of anonymity. By default, pastes expire in 1 hour,
+ though you may configure the interval and/or disable expiration as desired.
+</p>
+
+<p class="new-paste">
+ <a href="/paste/new">Create a new paste.</a>
+</p>
+<?= $this->contentPane()->captureEnd('about') ?>
32 application/views/scripts/paste/_display.phtml
@@ -0,0 +1,32 @@
+ <? if (isset($this->message)): ?>
+ <p class="error"><?= $this->escape($this->message) ?></p>
+ <? else: ?>
+ <h3>Code (<a id="format-toggle" href="#" onClick="paste.main.unformattedShow();">unformatted</a>)</h3>
+ <div class="code">
+ <?= $this->geshi($this->paste['code'], $this->paste['type']) ?>
+ <pre class="unformatted"><?= $this->escape($this->paste['code']) ?></pre>
+ </div>
+ <? if (!empty($this->paste['summary'])): ?>
+ <h3>Summary</h3>
+ <p class="summary"><?= $this->escape($this->paste['summary']) ?></p>
+ <? endif ?>
+ <p class="metadata">
+ <?= $this->paste['type'] ?> code pasted <?= $this->paste['created'] ?>
+ <?= (empty($this->paste['user'])) ? '' : ' by ' . $this->escape($this->paste['user']) ?>
+ <?= (empty($this->paste['expires'])) ? '' : '; expires ' . $this->paste['expires'] ?>
+ </p>
+ <? if (!empty($this->paste['parent'])): ?>
+ <p class="parent">
+ <a href="/paste/display/id/<?= $this->paste['parent'] ?>">Parent paste (<?= $this->paste['parent'] ?>)</a>
+ </p>
+ <? endif ?>
+ <? if (!empty($this->paste['children'])): ?>
+ <p class="children">Child pastes:</p>
+ <ul class="children">
+ <? foreach ($this->paste['children'] as $child): ?>
+ <li><a href="/paste/display/id/<?= $child ?>"><?= $child ?></a></li>
+ <? endforeach ?>
+ </ul>
+ <? endif ?>
+ <? endif ?>
+
8 application/views/scripts/paste/_followup-paste.phtml
@@ -0,0 +1,8 @@
+<? $this->contentPane()->captureStart('followup', array('title' => 'Followup', 'class' => 'tab', 'href' => '/paste/followup/id/' . $this->id . '/format/ajax', 'parseOnLoad' => true)) ?>
+<script type="dojo/connect" event="onLoad">
+ dojo.connect(dojo.byId('followupform'), 'onsubmit', function () {
+ dojo.byId('followupform-code').value = dijit.byId('followupform-codeEditor').getValue(false);
+ });
+</script>
+<?= $this->contentPane()->captureEnd('followup') ?>
+
7 application/views/scripts/paste/_nav.phtml
@@ -0,0 +1,7 @@
+<ul id="paste-nav">
+ <? if (!isset($this->message)): ?>
+ <li><a href="/paste/followup/id/<?= $this->id ?>">Followup</a></li>
+ <? endif ?>
+ <li><a href="/paste/new">New Paste</a></li>
+ <li><a href="/paste">About</a></li>
+</ul>
8 application/views/scripts/paste/_new-paste.phtml
@@ -0,0 +1,8 @@
+<? $this->contentPane()->captureStart('new-paste', array('title' => 'New Paste', 'class' => 'tab', 'href' => '/paste/new/format/ajax', 'parseOnLoad' => true)) ?>
+<script type="dojo/connect" event="onLoad">
+ dojo.connect(dojo.byId('pasteform'), 'onsubmit', function () {
+ dojo.byId('pasteform-code').value = dijit.byId('pasteform-codeEditor').getValue(false);
+ });
+</script>
+<?= $this->contentPane()->captureEnd('new-paste') ?>
+
1 application/views/scripts/paste/active-data.ajax.phtml
@@ -0,0 +1 @@
+<?= $this->data->toJson() ?>
1 application/views/scripts/paste/active-data.phtml
@@ -0,0 +1 @@
+<?= $this->render('paste/active-data.ajax.phtml') ?>
26 application/views/scripts/paste/active.ajax.phtml
@@ -0,0 +1,26 @@
+<?
+Zend_Dojo_View_Helper_Dojo::setUseDeclarative();
+$this->dojo()->addStylesheet('/js/dojox/grid/_grid/tundraGrid.css')
+ ->requireModule('dojo.data.ItemFileReadStore')
+ ->requireModule('dojox.grid.Grid');
+?>
+<span dojoType="dojo.data.ItemFileReadStore" jsId="activeStore"
+ url="/paste/active-data/format/ajax"></span>
+<h2>Active Pastes</h2>
+<table id="activePastes" dojoType="dojox.grid.Grid" store="activeStore"
+ clientSort="true" query="{ id: '*' }">
+ <script type="dojo/method" event="onSelected" args="inRowIndex">
+var row = dijit.byId("activePastes").model.getRow(inRowIndex);
+location.href = "/paste/display/id/" + row.id;
+ </script>
+ <thead>
+ <tr>
+ <th field="id" width="16em">ID</th>
+ <th field="type">Type</th>
+ <th field="user">User</th>
+ <th field="summary">Summary</th>
+ <th field="expires">Expires</th>
+ </tr>
+ </thead>
+</table>
+
9 application/views/scripts/paste/active.phtml
@@ -0,0 +1,9 @@
+<? Zend_Dojo_View_Helper_Dojo::setUseDeclarative();
+ $this->dojo()->enable(); ?>
+<? $this->tabContainer()->captureStart('pastebin', array('class' => 'paste-tab')) ?>
+<?= $this->render('paste/_about.phtml') ?>
+<?= $this->render('paste/_new-paste.phtml') ?>
+<? $this->contentPane()->captureStart('active', array('title' => 'Active Pastes', 'selected' => true), array('class' => 'tab')) ?>
+ <?= $this->render('paste/active.ajax.phtml') ?>
+<?= $this->contentPane()->captureEnd('active') ?>
+<?= $this->tabContainer()->captureEnd('pastebin') ?>
3 application/views/scripts/paste/display.ajax.phtml
@@ -0,0 +1,3 @@
+<?php
+Zend_Dojo_View_Helper_Dojo::setUseDeclarative();
+echo $this->render('paste/_display.phtml');
13 application/views/scripts/paste/display.phtml
@@ -0,0 +1,13 @@
+<? $this->dojo()->enable() ?>
+<? $this->tabContainer()->captureStart('pastebin', array('class' => 'paste-tab')) ?>
+<?= $this->render('paste/_about.phtml') ?>
+<?= $this->render('paste/_new-paste.phtml') ?>
+<?= $this->contentPane('active', '', array('title' => 'Active Pastes', 'class' => 'tab', 'href' => '/paste/active/format/ajax', 'parseOnLoad' => true)) ?>
+<? $this->contentPane()->captureStart('paste', array('title' => $this->title, 'class' => 'tab', 'selected' => true)) ?>
+ <?= $this->render('paste/_nav.phtml') ?>
+ <?= $this->render('paste/_display.phtml') ?>
+<?= $this->contentPane()->captureEnd('paste') ?>
+<? if (!isset($this->message)): ?>
+<?= $this->render('paste/_followup-paste.phtml') ?>
+<? endif ?>
+<?= $this->tabContainer()->captureEnd('pastebin') ?>
3 application/views/scripts/paste/followup.ajax.phtml
@@ -0,0 +1,3 @@
+<?
+Zend_Dojo_View_Helper_Dojo::setUseDeclarative();
+echo $this->form ?>
10 application/views/scripts/paste/followup.phtml
@@ -0,0 +1,10 @@
+<? $this->dojo()->enable() ?>
+<? $this->tabContainer()->captureStart('pastebin', array('class' => 'paste-tab')) ?>
+<?= $this->render('paste/_about.phtml') ?>
+<?= $this->render('paste/_new-paste.phtml') ?>
+<?= $this->contentPane('active', '', array('title' => 'Active Pastes', 'class' => 'tab', 'href' => '/paste/active/format/ajax', 'parseOnLoad' => true)) ?>
+<?= $this->contentPane('paste', '', array('title' => $this->title, 'class' => 'tab', 'href' => '/paste/display/id/' . $this->id . '/format/ajax', 'parseOnLoad' => true)) ?>
+<? $this->contentPane()->captureStart('followup', array('title' => 'Followup', 'class' => 'tab', 'selected' => true)) ?>
+ <?= $this->form ?>
+<?= $this->contentPane()->captureEnd('followup') ?>
+<?= $this->tabContainer()->captureEnd('pastebin') ?>
6 application/views/scripts/paste/index.phtml
@@ -0,0 +1,6 @@
+<? $this->dojo()->enable() ?>
+<? $this->tabContainer()->captureStart('pastebin', array('class' => 'paste-tab')) ?>
+<?= $this->render('paste/_about.phtml') ?>
+<?= $this->render('paste/_new-paste.phtml') ?>
+<?= $this->contentPane('active', '', array('title' => 'Active Pastes', 'class' => 'tab', 'href' => '/paste/active/format/ajax', 'parseOnLoad' => true)) ?>
+<?= $this->tabContainer()->captureEnd('pastebin') ?>
3 application/views/scripts/paste/new.ajax.phtml
@@ -0,0 +1,3 @@
+<?
+Zend_Dojo_View_Helper_Dojo::setUseDeclarative();
+echo $this->form ?>
7 application/views/scripts/paste/new.phtml
@@ -0,0 +1,7 @@
+<? $this->dojo()->enable() ?>
+<? $this->tabContainer()->captureStart('pastebin', array('class' => 'paste-tab')) ?>
+<?= $this->render('paste/_about.phtml') ?>
+<? $this->contentPane()->captureStart('new-paste', array('title' => 'New Paste', 'class' => 'tab', 'href' => '/paste/new/format/ajax', 'parseOnLoad' => true, 'selected' => true)) ?>
+<?= $this->form ?>
+<?= $this->contentPane()->captureEnd('new-paste') ?>
+<?= $this->tabContainer()->captureEnd('pastebin') ?>
7 library/My/Form/Element/Editor.php
@@ -0,0 +1,7 @@
+<?php
+require_once 'Zend/Dojo/Form/Element/Dijit.php';
+
+class My_Form_Element_Editor extends Zend_Dojo_Form_Element_Dijit
+{
+ public $helper = 'Editor';
+}
10 library/My/Form/Element/SimpleTextarea.php
@@ -0,0 +1,10 @@
+<?php
+class My_Form_Element_SimpleTextarea extends Zend_Dojo_Form_Element_Dijit
+{
+ /**
+ * Use SimpleTextarea dijit view helper
+ * @var string
+ */
+ public $helper = 'SimpleTextarea';
+}
+
118 library/My/Plugin/Initialize.php
@@ -0,0 +1,118 @@
+<?php
+/**
+ * Plugin to initialize application state
+ *
+ * @uses Zend_Controller_Plugin_Abstract
+ * @package My
+ * @subpackage Plugin
+ * @version $Id: $
+ */
+class My_Plugin_Initialize extends Zend_Controller_Plugin_Abstract
+{
+ public function __construct($basePath, $env = 'production')
+ {
+ $this->env = $env;
+
+ $this->basePath = $basePath;
+ $this->appPath = $this->basePath . '/application';
+ $this->libPath = $this->basePath . '/library';
+ $this->pubPath = $this->basePath . '/public';
+ $this->front = Zend_Controller_Front::getInstance();
+ }
+
+ public function routeStartup(Zend_Controller_Request_Abstract $request)
+ {
+ $this->initConfig()
+ ->initControllers()
+ ->initCache()
+ ->initDb()
+ ->initView();
+ }
+
+ public function initConfig()
+ {
+ $config = new Zend_Config_Ini($this->appPath . '/configs/paste.ini', $this->env, true);
+
+ $config->paths->basePath = $this->basePath;
+ $config->paths->appPath = $this->appPath;
+ $config->paths->libPath = $this->libPath;
+ $config->paths->pubPath = $this->pubPath;
+
+ $config->db->cxn->params->dbname = $config->paths->appPath . '/data/' . $config->db->cxn->params->dbname;
+ $config->db->cache->backendOptions->cache_db_complete_path = $config->paths->appPath . '/data/' . $config->db->cache->backendOptions->cache_db_complete_path;
+
+ $config->cache->backendOptions->cache_db_complete_path = $config->paths->appPath . '/data/' . $config->cache->backendOptions->cache_db_complete_path;
+
+ $this->config = $config;
+ Zend_Registry::set('config', $config);
+ return $this;
+ }
+
+ public function initControllers()
+ {
+ $this->front->setControllerDirectory($this->appPath . '/controllers', 'default');
+ return $this;
+ }
+
+ public function initCache()
+ {
+ $config = $this->config->cache;
+ $this->cache = $this->_getCache($config);
+ Zend_Registry::set('cache', $this->cache);
+ return $this;
+ }
+
+ public function initDb()
+ {
+ $config = $this->config->db;
+ $cache = $this->_getCache($config->cache);
+ $profiler = new Zend_Db_Profiler_Firebug('All DB Queries');
+ $db = Zend_Db::factory($config->cxn);
+
+ $db->setProfiler($profiler);
+ Zend_Db_Table_Abstract::setDefaultAdapter($db);
+ Zend_Db_Table_Abstract::setDefaultMetadataCache($cache);
+
+ return $this;
+ }
+
+ public function initView()
+ {
+ $layout = Zend_Layout::startMvc(array(
+ 'layoutPath' => $this->appPath . '/views/layouts'
+ ));
+
+ $view = $layout->getView();
+ $view->addHelperPath('My/View/Helper/', 'My_View_Helper');
+
+ $view->headLink()->appendStylesheet('/style/paste.css');
+
+ Zend_Dojo::enableView($view);
+ $view->doctype('XHTML1_TRANSITIONAL');
+ $view->headTitle('Pastebin');
+ $view->headMeta()->appendHttpEquiv('Content-Type', 'text/html; charset=utf-8');
+ $view->dojo()->setDjConfigOption('usePlainJson', true)
+ ->setDjConfigOption('isDebug', true)
+ ->addStylesheetModule('dijit.themes.tundra')
+ ->addStylesheet('/js/dojox/grid/_grid/tundraGrid.css')
+ ->addStylesheet('/js/dojo/resources/dojo.css')
+ ->setLocalPath('/js/dojo/dojo.js')
+ // ->addLayer('/js/paste/main.js')
+ ->addLayer('/js/paste/paste.js')
+ ->addJavascript('paste.main.init();')
+ ->disable();
+
+ return $this;
+ }
+
+ protected function _getCache(Zend_Config $config)
+ {
+ $cache = Zend_Cache::factory(
+ $config->frontendName,
+ $config->backendName,
+ $config->frontendOptions->toArray(),
+ $config->backendOptions->toArray()
+ );
+ return $cache;
+ }
+}
66 library/My/View/Helper/Editor.php
@@ -0,0 +1,66 @@
+<?php
+class My_View_Helper_Editor extends Zend_Dojo_View_Helper_Textarea
+{
+ protected $_dijit = 'dijit.Editor';
+
+ public function editor($id, $value = null, $params = array(), $attribs = array())
+ {
+ $hiddenName = $textareaName = $id;
+
+ $hiddenAttribs = array(
+ 'id' => $hiddenName,
+ 'name' => $hiddenName,
+ 'value' => $value,
+ 'type' => 'hidden',
+ );
+
+ if (array_key_exists('id', $attribs)) {
+ $hiddenAttribs['id'] = $attribs['id'];
+ $attribs['id'] .= 'Editor';
+ $id = $attribs['id'];
+ }
+
+ if (']' == $textareaName[strlen($textareaName) - 1]) {
+ $textareaName = rtrim($textareaName, ']');
+ $textareaName .= 'Editor]';
+ }
+
+ $this->_createGetParentFormFunction();
+ $this->_createEditorOnSubmit($hiddenAttribs['id'], $id);
+
+ $html = '<input' . $this->_htmlAttribs($hiddenAttribs) . $this->getClosingBracket()
+ . $this->textarea($textareaName, $value, $params, $attribs);
+ return $html;
+ }
+
+ protected function _createGetParentFormFunction()
+ {
+ $function =<<<EOJ
+if (zend == undefined) {
+ var zend = {};
+}
+zend.findParentForm = function(elementNode) {
+ while (elementNode.nodeName.toLowerCase() != 'form') {
+ elementNode = elementNode.parentNode;
+ }
+ return elementNode;
+};
+EOJ;
+
+ $this->dojo->addJavascript($function);
+ }
+
+ protected function _createEditorOnSubmit($hiddenId, $editorId)
+ {
+ $this->dojo->onLoadCaptureStart();
+ echo <<<EOJ
+function() {
+ var form = zend.findParentForm(dojo.byId('$hiddenId'));
+ dojo.connect(form, 'onsubmit', function () {
+ dojo.byId('$hiddenId').value = dijit.byId('$editorId').getValue(false);
+ });
+}
+EOJ;
+ $this->dojo->onLoadCaptureEnd();
+ }
+}
47 library/My/View/Helper/SimpleTextarea.php
@@ -0,0 +1,47 @@
+<?php
+class My_View_Helper_SimpleTextarea extends Zend_Dojo_View_Helper_Dijit
+{
+ /**
+ * Dijit being used
+ * @var string
+ */
+ protected $_dijit = 'dijit.form.SimpleTextarea';
+
+ /**
+ * HTML element type
+ * @var string
+ */
+ protected $_elementType = 'textarea';
+
+ /**
+ * Dojo module to use
+ * @var string
+ */
+ protected $_module = 'dijit.form.SimpleTextarea';
+
+ /**
+ * dijit.form.SimpleTextarea
+ *
+ * @param string $id
+ * @param string $value
+ * @param array $params Parameters to use for dijit creation
+ * @param array $attribs HTML attributes
+ * @return string
+ */
+ public function simpleTextarea($id, $value = null, array $params = array(), array $attribs = array())
+ {
+ if (!array_key_exists('id', $attribs)) {
+ $attribs['id'] = $id;
+ }
+ $attribs['name'] = $id;
+ $attribs['type'] = $this->_elementType;
+
+ $attribs = $this->_prepareDijit($attribs, $params, 'textarea');
+
+ $html = '<textarea' . $this->_htmlAttribs($attribs) . '>'
+ . $this->view->escape($value)
+ . "</textarea>\n";
+
+ return $html;
+ }
+}
1 library/Zend
1 library/geshi
1 library/geshi.php
11 public/.htaccess
@@ -0,0 +1,11 @@
+php_value date.timezone "America/New_York"
+RewriteEngine On
+
+RewriteCond %{REQUEST_FILENAME} -s [OR]
+RewriteCond %{REQUEST_FILENAME} -l [OR]
+RewriteCond %{REQUEST_FILENAME} -d
+
+RewriteRule ^.*$ - [NC,L]
+RewriteRule ^.*$ /index.php [NC,L]
+
+
19 public/index.php
@@ -0,0 +1,19 @@
+<?php
+$base = realpath(dirname(__FILE__) . '/../');
+$paths = array(
+ '.',
+ $base . '/application/models',
+ $base . '/library',
+);
+ini_set('include_path', implode(PATH_SEPARATOR, $paths));
+ini_set('display_errors', false);
+error_reporting(E_ALL | E_STRICT);
+require_once 'Zend/Loader.php';
+Zend_Loader::registerAutoload();
+
+$front = Zend_Controller_Front::getInstance();
+$front->registerPlugin(new My_Plugin_Initialize($base, 'development'))
+ ->addControllerDirectory($base . '/application/controllers');
+
+// $front->throwExceptions(true);
+$front->dispatch();
1 public/js
12 public/js-build/dijit/ColorPalette.js
@@ -0,0 +1,12 @@
+/*
+ Copyright (c) 2004-2008, The Dojo Foundation
+ All Rights Reserved.
+
+ Licensed under the Academic Free License version 2.1 or above OR the
+ modified BSD license. For more information on Dojo licensing, see:
+
+ http://dojotoolkit.org/book/dojo-book-0-9/introduction/licensing
+*/
+
+
+if(!dojo._hasResource["dijit.ColorPalette"]){dojo._hasResource["dijit.ColorPalette"]=true;dojo.provide("dijit.ColorPalette");dojo.require("dijit._Widget");dojo.require("dijit._Templated");dojo.require("dojo.colors");dojo.require("dojo.i18n");dojo.requireLocalization("dojo","colors",null,"he,es,nb,ROOT,ar,nl,ko,fr,da,zh-tw,cs,ru,pt-pt,fi,pl,it,tr,de,ja,zh,pt,hu,el,sv");dojo.declare("dijit.ColorPalette",[dijit._Widget,dijit._Templated],{defaultTimeout:500,timeoutChangeRate:0.9,palette:"7x10",value:null,_currentFocus:0,_xDim:null,_yDim:null,_palettes:{"7x10":[["white","seashell","cornsilk","lemonchiffon","lightyellow","palegreen","paleturquoise","lightcyan","lavender","plum"],["lightgray","pink","bisque","moccasin","khaki","lightgreen","lightseagreen","lightskyblue","cornflowerblue","violet"],["silver","lightcoral","sandybrown","orange","palegoldenrod","chartreuse","mediumturquoise","skyblue","mediumslateblue","orchid"],["gray","red","orangered","darkorange","yellow","limegreen","darkseagreen","royalblue","slateblue","mediumorchid"],["dimgray","crimson","chocolate","coral","gold","forestgreen","seagreen","blue","blueviolet","darkorchid"],["darkslategray","firebrick","saddlebrown","sienna","olive","green","darkcyan","mediumblue","darkslateblue","darkmagenta"],["black","darkred","maroon","brown","darkolivegreen","darkgreen","midnightblue","navy","indigo","purple"]],"3x4":[["white","lime","green","blue"],["silver","yellow","fuchsia","navy"],["gray","red","purple","black"]]},_imagePaths:{"7x10":dojo.moduleUrl("dijit","templates/colors7x10.png"),"3x4":dojo.moduleUrl("dijit","templates/colors3x4.png")},_paletteCoords:{"leftOffset":3,"topOffset":3,"cWidth":20,"cHeight":20},templateString:"<div class=\"dijitInline dijitColorPalette\">\n\t<div class=\"dijitColorPaletteInner\" dojoAttachPoint=\"divNode\" waiRole=\"grid\" tabIndex=\"${tabIndex}\">\n\t\t<img class=\"dijitColorPaletteUnder\" dojoAttachPoint=\"imageNode\" waiRole=\"presentation\">\n\t</div>\t\n</div>\n",_paletteDims:{"7x10":{"width":"206px","height":"145px"},"3x4":{"width":"86px","height":"64px"}},tabIndex:"0",postCreate:function(){dojo.mixin(this.divNode.style,this._paletteDims[this.palette]);this.imageNode.setAttribute("src",this._imagePaths[this.palette]);var _1=this._palettes[this.palette];this.domNode.style.position="relative";this._cellNodes=[];this.colorNames=dojo.i18n.getLocalization("dojo","colors",this.lang);var _2=dojo.moduleUrl("dojo","resources/blank.gif"),_3=new dojo.Color(),_4=this._paletteCoords;for(var _5=0;_5<_1.length;_5++){for(var _6=0;_6<_1[_5].length;_6++){var _7=dojo.doc.createElement("img");_7.src=_2;dojo.addClass(_7,"dijitPaletteImg");var _8=_1[_5][_6],_9=_3.setColor(dojo.Color.named[_8]);_7.alt=this.colorNames[_8];_7.color=_9.toHex();var _a=_7.style;_a.color=_a.backgroundColor=_7.color;var _b=dojo.doc.createElement("span");_b.appendChild(_7);dojo.forEach(["Dijitclick","MouseEnter","Focus","Blur"],function(_c){this.connect(_b,"on"+_c.toLowerCase(),"_onCell"+_c);},this);this.divNode.appendChild(_b);var _d=_b.style;_d.top=_4.topOffset+(_5*_4.cHeight)+"px";_d.left=_4.leftOffset+(_6*_4.cWidth)+"px";dojo.attr(_b,"tabindex","-1");_b.title=this.colorNames[_8];dojo.addClass(_b,"dijitPaletteCell");dijit.setWaiRole(_b,"gridcell");_b.index=this._cellNodes.length;this._cellNodes.push(_b);}}this._xDim=_1[0].length;this._yDim=_1.length;this.connect(this.divNode,"onfocus","_onDivNodeFocus");var _e={UP_ARROW:-this._xDim,DOWN_ARROW:this._xDim,RIGHT_ARROW:1,LEFT_ARROW:-1};for(var _f in _e){this._connects.push(dijit.typematic.addKeyListener(this.domNode,{keyCode:dojo.keys[_f],ctrlKey:false,altKey:false,shiftKey:false},this,function(){var _10=_e[_f];return function(_11){this._navigateByKey(_10,_11);};}(),this.timeoutChangeRate,this.defaultTimeout));}},focus:function(){this._focusFirst();},onChange:function(_12){},_focusFirst:function(){this._currentFocus=0;var _13=this._cellNodes[this._currentFocus];window.setTimeout(function(){dijit.focus(_13);},0);},_onDivNodeFocus:function(evt){if(evt.target===this.divNode){this._focusFirst();}},_onFocus:function(){dojo.attr(this.divNode,"tabindex","-1");},_onBlur:function(){this._removeCellHighlight(this._currentFocus);dojo.attr(this.divNode,"tabindex",this.tabIndex);},_onCellDijitclick:function(evt){var _16=evt.currentTarget;if(this._currentFocus!=_16.index){this._currentFocus=_16.index;window.setTimeout(function(){dijit.focus(_16);},0);}this._selectColor(_16);dojo.stopEvent(evt);},_onCellMouseEnter:function(evt){var _18=evt.currentTarget;window.setTimeout(function(){dijit.focus(_18);},0);},_onCellFocus:function(evt){this._removeCellHighlight(this._currentFocus);this._currentFocus=evt.currentTarget.index;dojo.addClass(evt.currentTarget,"dijitPaletteCellHighlight");},_onCellBlur:function(evt){this._removeCellHighlight(this._currentFocus);},_removeCellHighlight:function(_1b){dojo.removeClass(this._cellNodes[_1b],"dijitPaletteCellHighlight");},_selectColor:function(_1c){var img=_1c.getElementsByTagName("img")[0];this.onChange(this.value=img.color);},_navigateByKey:function(_1e,_1f){if(_1f==-1){return;}var _20=this._currentFocus+_1e;if(_20<this._cellNodes.length&&_20>-1){var _21=this._cellNodes[_20];_21.focus();}}});}
12 public/js-build/dijit/Declaration.js
@@ -0,0 +1,12 @@
+/*
+ Copyright (c) 2004-2008, The Dojo Foundation
+ All Rights Reserved.
+
+ Licensed under the Academic Free License version 2.1 or above OR the
+ modified BSD license. For more information on Dojo licensing, see:
+
+ http://dojotoolkit.org/book/dojo-book-0-9/introduction/licensing
+*/
+
+
+if(!dojo._hasResource["dijit.Declaration"]){dojo._hasResource["dijit.Declaration"]=true;dojo.provide("dijit.Declaration");dojo.require("dijit._Widget");dojo.require("dijit._Templated");dojo.declare("dijit.Declaration",dijit._Widget,{_noScript:true,widgetClass:"",replaceVars:true,defaults:null,mixins:[],buildRendering:function(){var _1=this.srcNodeRef.parentNode.removeChild(this.srcNodeRef);var _2=dojo.query("> script[type='dojo/method'][event='preamble']",_1).orphan();var _3=dojo.query("> script[type^='dojo/']",_1).orphan();var _4=_1.nodeName;var _5=this.defaults||{};this.mixins=this.mixins.length?dojo.map(this.mixins,function(_6){return dojo.getObject(_6);}):[dijit._Widget,dijit._Templated];if(_2.length){_5.preamble=dojo.parser._functionFromScript(_2[0]);}var _7=dojo.map(_3,function(s){var _9=s.getAttribute("event")||"postscript";return {event:_9,func:dojo.parser._functionFromScript(s)};});this.mixins.push(function(){dojo.forEach(_7,function(s){dojo.connect(this,s.event,this,s.func);},this);});_5.widgetsInTemplate=true;_5._skipNodeCache=true;_5.templateString="<"+_4+" class='"+_1.className+"' dojoAttachPoint='"+(_1.getAttribute("dojoAttachPoint")||"")+"' dojoAttachEvent='"+(_1.getAttribute("dojoAttachEvent")||"")+"' >"+_1.innerHTML.replace(/\%7B/g,"{").replace(/\%7D/g,"}")+"</"+_4+">";dojo.query("[dojoType]",_1).forEach(function(_b){_b.removeAttribute("dojoType");});dojo.declare(this.widgetClass,this.mixins,_5);}});}
12 public/js-build/dijit/Dialog.js
@@ -0,0 +1,12 @@
+/*
+ Copyright (c) 2004-2008, The Dojo Foundation
+ All Rights Reserved.
+
+ Licensed under the Academic Free License version 2.1 or above OR the
+ modified BSD license. For more information on Dojo licensing, see:
+
+ http://dojotoolkit.org/book/dojo-book-0-9/introduction/licensing
+*/
+
+
+if(!dojo._hasResource["dijit.Dialog"]){dojo._hasResource["dijit.Dialog"]=true;dojo.provide("dijit.Dialog");dojo.require("dojo.dnd.TimedMoveable");dojo.require("dojo.fx");dojo.require("dijit._Widget");dojo.require("dijit._Templated");dojo.require("dijit.layout.ContentPane");dojo.require("dijit.form.Form");dojo.requireLocalization("dijit","common",null,"he,es,nb,ar,nl,ko,fr,da,zh-tw,cs,ru,pt-pt,fi,pl,it,tr,de,ROOT,ja,zh,pt,hu,el,sv");dojo.declare("dijit.DialogUnderlay",[dijit._Widget,dijit._Templated],{templateString:"<div class='dijitDialogUnderlayWrapper' id='${id}_wrapper'><div class='dijitDialogUnderlay ${class}' id='${id}' dojoAttachPoint='node'></div></div>",attributeMap:{},postCreate:function(){dojo.body().appendChild(this.domNode);this.bgIframe=new dijit.BackgroundIframe(this.domNode);},layout:function(){var _1=dijit.getViewport();var is=this.node.style,os=this.domNode.style;os.top=_1.t+"px";os.left=_1.l+"px";is.width=_1.w+"px";is.height=_1.h+"px";var _4=dijit.getViewport();if(_1.w!=_4.w){is.width=_4.w+"px";}if(_1.h!=_4.h){is.height=_4.h+"px";}},show:function(){this.domNode.style.display="block";this.layout();if(this.bgIframe.iframe){this.bgIframe.iframe.style.display="block";}this._resizeHandler=this.connect(window,"onresize","layout");},hide:function(){this.domNode.style.display="none";if(this.bgIframe.iframe){this.bgIframe.iframe.style.display="none";}this.disconnect(this._resizeHandler);},uninitialize:function(){if(this.bgIframe){this.bgIframe.destroy();}}});dojo.declare("dijit._DialogMixin",null,{attributeMap:dijit._Widget.prototype.attributeMap,execute:function(_5){},onCancel:function(){},onExecute:function(){},_onSubmit:function(){this.onExecute();this.execute(this.getValues());},_getFocusItems:function(_6){var _7=dijit.getFirstInTabbingOrder(_6);this._firstFocusItem=_7?_7:_6;_7=dijit.getLastInTabbingOrder(_6);this._lastFocusItem=_7?_7:this._firstFocusItem;if(dojo.isMoz&&this._firstFocusItem.tagName.toLowerCase()=="input"&&dojo.attr(this._firstFocusItem,"type").toLowerCase()=="file"){dojo.attr(_6,"tabindex","0");this._firstFocusItem=_6;}}});dojo.declare("dijit.Dialog",[dijit.layout.ContentPane,dijit._Templated,dijit.form._FormMixin,dijit._DialogMixin],{templateString:null,templateString:"<div class=\"dijitDialog\" tabindex=\"-1\" waiRole=\"dialog\" waiState=\"labelledby-${id}_title\">\n\t<div dojoAttachPoint=\"titleBar\" class=\"dijitDialogTitleBar\">\n\t<span dojoAttachPoint=\"titleNode\" class=\"dijitDialogTitle\" id=\"${id}_title\">${title}</span>\n\t<span dojoAttachPoint=\"closeButtonNode\" class=\"dijitDialogCloseIcon\" dojoAttachEvent=\"onclick: onCancel\">\n\t\t<span dojoAttachPoint=\"closeText\" class=\"closeText\">x</span>\n\t</span>\n\t</div>\n\t\t<div dojoAttachPoint=\"containerNode\" class=\"dijitDialogPaneContent\"></div>\n</div>\n",open:false,duration:400,refocus:true,_firstFocusItem:null,_lastFocusItem:null,doLayout:false,attributeMap:dojo.mixin(dojo.clone(dijit._Widget.prototype.attributeMap),{title:"titleBar"}),postCreate:function(){dojo.body().appendChild(this.domNode);this.inherited(arguments);var _8=dojo.i18n.getLocalization("dijit","common");if(this.closeButtonNode){this.closeButtonNode.setAttribute("title",_8.buttonCancel);}if(this.closeText){this.closeText.setAttribute("title",_8.buttonCancel);}var s=this.domNode.style;s.visibility="hidden";s.position="absolute";s.display="";s.top="-9999px";this.connect(this,"onExecute","hide");this.connect(this,"onCancel","hide");this._modalconnects=[];},onLoad:function(){this._position();this.inherited(arguments);},_setup:function(){if(this.titleBar){this._moveable=new dojo.dnd.TimedMoveable(this.domNode,{handle:this.titleBar,timeout:0});}this._underlay=new dijit.DialogUnderlay({id:this.id+"_underlay","class":dojo.map(this["class"].split(/\s/),function(s){return s+"_underlay";}).join(" ")});var _b=this.domNode;this._fadeIn=dojo.fx.combine([dojo.fadeIn({node:_b,duration:this.duration}),dojo.fadeIn({node:this._underlay.domNode,duration:this.duration,onBegin:dojo.hitch(this._underlay,"show")})]);this._fadeOut=dojo.fx.combine([dojo.fadeOut({node:_b,duration:this.duration,onEnd:function(){_b.style.visibility="hidden";_b.style.top="-9999px";}}),dojo.fadeOut({node:this._underlay.domNode,duration:this.duration,onEnd:dojo.hitch(this._underlay,"hide")})]);},uninitialize:function(){if(this._fadeIn&&this._fadeIn.status()=="playing"){this._fadeIn.stop();}if(this._fadeOut&&this._fadeOut.status()=="playing"){this._fadeOut.stop();}if(this._underlay){this._underlay.destroy();}},_position:function(){if(dojo.hasClass(dojo.body(),"dojoMove")){return;}var _c=dijit.getViewport();var mb=dojo.marginBox(this.domNode);var _e=this.domNode.style;_e.left=Math.floor((_c.l+(_c.w-mb.w)/2))+"px";_e.top=Math.floor((_c.t+(_c.h-mb.h)/2))+"px";},_onKey:function(_f){if(_f.keyCode){var _10=_f.target;if(_f.keyCode==dojo.keys.TAB){this._getFocusItems(this.domNode);}var _11=(this._firstFocusItem==this._lastFocusItem);if(_10==this._firstFocusItem&&_f.shiftKey&&_f.keyCode==dojo.keys.TAB){if(!_11){dijit.focus(this._lastFocusItem);}dojo.stopEvent(_f);}else{if(_10==this._lastFocusItem&&_f.keyCode==dojo.keys.TAB&&!_f.shiftKey){if(!_11){dijit.focus(this._firstFocusItem);}dojo.stopEvent(_f);}else{while(_10){if(_10==this.domNode){if(_f.keyCode==dojo.keys.ESCAPE){this.hide();}else{return;}}_10=_10.parentNode;}if(_f.keyCode!=dojo.keys.TAB){dojo.stopEvent(_f);}else{if(!dojo.isOpera){try{this._firstFocusItem.focus();}catch(e){}}}}}}},show:function(){if(this.open){return;}if(!this._alreadyInitialized){this._setup();this._alreadyInitialized=true;}if(this._fadeOut.status()=="playing"){this._fadeOut.stop();}this._modalconnects.push(dojo.connect(window,"onscroll",this,"layout"));this._modalconnects.push(dojo.connect(dojo.doc.documentElement,"onkeypress",this,"_onKey"));dojo.style(this.domNode,"opacity",0);this.domNode.style.visibility="";this.open=true;this._loadCheck();this._position();this._fadeIn.play();this._savedFocus=dijit.getFocus(this);this._getFocusItems(this.domNode);setTimeout(dojo.hitch(this,function(){dijit.focus(this._firstFocusItem);}),50);},hide:function(){if(!this._alreadyInitialized){return;}if(this._fadeIn.status()=="playing"){this._fadeIn.stop();}this._fadeOut.play();if(this._scrollConnected){this._scrollConnected=false;}dojo.forEach(this._modalconnects,dojo.disconnect);this._modalconnects=[];if(this.refocus){this.connect(this._fadeOut,"onEnd",dojo.hitch(dijit,"focus",this._savedFocus));}this.open=false;},layout:function(){if(this.domNode.style.visibility!="hidden"){this._underlay.layout();this._position();}},destroy:function(){dojo.forEach(this._modalconnects,dojo.disconnect);if(this.refocus&&this.open){var fo=this._savedFocus;setTimeout(dojo.hitch(dijit,"focus",fo),25);}this.inherited(arguments);}});dojo.declare("dijit.TooltipDialog",[dijit.layout.ContentPane,dijit._Templated,dijit.form._FormMixin,dijit._DialogMixin],{title:"",doLayout:false,_firstFocusItem:null,_lastFocusItem:null,templateString:null,templateString:"<div class=\"dijitTooltipDialog\" waiRole=\"presentation\">\n\t<div class=\"dijitTooltipContainer\" waiRole=\"presentation\">\n\t\t<div class =\"dijitTooltipContents dijitTooltipFocusNode\" dojoAttachPoint=\"containerNode\" tabindex=\"-1\" waiRole=\"dialog\"></div>\n\t</div>\n\t<div class=\"dijitTooltipConnector\" waiRole=\"presenation\"></div>\n</div>\n",postCreate:function(){this.inherited(arguments);this.connect(this.containerNode,"onkeypress","_onKey");this.containerNode.title=this.title;},orient:function(_13,_14,_15){this.domNode.className="dijitTooltipDialog "+" dijitTooltipAB"+(_15.charAt(1)=="L"?"Left":"Right")+" dijitTooltip"+(_15.charAt(0)=="T"?"Below":"Above");},onOpen:function(pos){this._getFocusItems(this.containerNode);this.orient(this.domNode,pos.aroundCorner,pos.corner);this._loadCheck();dijit.focus(this._firstFocusItem);},_onKey:function(evt){var _18=evt.target;if(evt.keyCode==dojo.keys.TAB){this._getFocusItems(this.containerNode);}var _19=(this._firstFocusItem==this._lastFocusItem);if(evt.keyCode==dojo.keys.ESCAPE){this.onCancel();}else{if(_18==this._firstFocusItem&&evt.shiftKey&&evt.keyCode==dojo.keys.TAB){if(!_19){dijit.focus(this._lastFocusItem);}dojo.stopEvent(evt);}else{if(_18==this._lastFocusItem&&evt.keyCode==dojo.keys.TAB&&!evt.shiftKey){if(!_19){dijit.focus(this._firstFocusItem);}dojo.stopEvent(evt);}else{if(evt.keyCode==dojo.keys.TAB){evt.stopPropagation();}}}}}});}
12 public/js-build/dijit/Editor.js