Permalink
Browse files

Changing default credentials to admin/admin.

git-svn-id: http://ovz-web-panel.googlecode.com/svn/trunk@356 5ed322ce-bccc-11de-a0e9-83d03c287164
  • Loading branch information...
1 parent 6423afa commit 65ad0174eca86dcc805c089406fe26580867b05a sibprogrammer committed Dec 8, 2009
Showing with 5,925 additions and 10,396 deletions.
  1. +256 −0 README
  2. +10 −0 Rakefile
  3. +33 −0 app/controllers/admin/dashboard_controller.rb
  4. +47 −0 app/controllers/admin/hardware_servers_controller.rb
  5. +13 −0 app/controllers/admin/os_templates_controller.rb
  6. +21 −0 app/controllers/admin/users_controller.rb
  7. +57 −0 app/controllers/admin/virtual_servers_controller.rb
  8. +4 −0 app/controllers/admin_controller.rb
  9. +31 −0 app/controllers/application.rb
  10. +30 −0 app/controllers/sessions_controller.rb
  11. +2 −0 app/helpers/admin/dashboard_helper.rb
  12. +2 −0 app/helpers/admin/hardware_servers_helper.rb
  13. +2 −0 app/helpers/admin/os_templates_helper.rb
  14. +2 −0 app/helpers/admin/users_helper.rb
  15. +2 −0 app/helpers/admin/virtual_servers_helper.rb
  16. +13 −0 app/helpers/application_helper.rb
  17. +2 −0 app/helpers/sessions_helper.rb
  18. +93 −0 app/helpers/users_helper.rb
  19. +54 −0 app/models/hardware_server.rb
  20. +3 −0 app/models/os_template.rb
  21. +36 −0 app/models/user.rb
  22. +51 −0 app/models/virtual_server.rb
  23. +57 −0 app/views/admin/dashboard/index.html.erb
  24. +169 −0 app/views/admin/hardware_servers/list.html.erb
  25. +294 −0 app/views/admin/hardware_servers/show.html.erb
  26. +2 −0 app/views/layouts/_footer.html.erb
  27. +15 −0 app/views/layouts/_header.html.erb
  28. +37 −0 app/views/layouts/_top_header.html.erb
  29. +227 −0 app/views/layouts/admin.html.erb
  30. +28 −0 app/views/layouts/application.html.erb
  31. +95 −0 app/views/sessions/new.html.erb
  32. +0 −292 application/LICENSE
  33. +0 −9 application/config.ini.sample
  34. +0 −17 application/externals/Zend.patch
  35. BIN application/externals/Zend.zip
  36. +0 −10 application/htdocs/ext/adapter/ext/ext-base.js
  37. +0 −162 application/htdocs/ext/ext-all.js
  38. +0 −42 application/htdocs/ext/license.txt
  39. +0 −3 application/htdocs/ext/resources/css/README.txt
  40. +0 −61 application/htdocs/ext/resources/css/borders.css
  41. +0 −111 application/htdocs/ext/resources/css/box.css
  42. +0 −161 application/htdocs/ext/resources/css/button.css
  43. +0 −55 application/htdocs/ext/resources/css/combo.css
  44. +0 −314 application/htdocs/ext/resources/css/core.css
  45. +0 −247 application/htdocs/ext/resources/css/date-picker.css
  46. +0 −75 application/htdocs/ext/resources/css/dd.css
  47. +0 −37 application/htdocs/ext/resources/css/debug.css
  48. +0 −69 application/htdocs/ext/resources/css/dialog.css
  49. +0 −66 application/htdocs/ext/resources/css/editor.css
  50. +0 −925 application/htdocs/ext/resources/css/ext-all.css
  51. +0 −552 application/htdocs/ext/resources/css/form.css
  52. +0 −554 application/htdocs/ext/resources/css/grid.css
  53. +0 −273 application/htdocs/ext/resources/css/layout.css
  54. +0 −142 application/htdocs/ext/resources/css/menu.css
  55. +0 −424 application/htdocs/ext/resources/css/panel.css
  56. +0 −43 application/htdocs/ext/resources/css/progress.css
  57. +0 −134 application/htdocs/ext/resources/css/qtips.css
  58. +0 −9 application/htdocs/ext/resources/css/reset-min.css
  59. +0 −9 application/htdocs/ext/resources/css/reset.css
  60. +0 −143 application/htdocs/ext/resources/css/resizable.css
  61. +0 −90 application/htdocs/ext/resources/css/slider.css
  62. +0 −358 application/htdocs/ext/resources/css/tabs.css
  63. +0 −183 application/htdocs/ext/resources/css/toolbar.css
  64. +0 −254 application/htdocs/ext/resources/css/tree.css
  65. +0 −208 application/htdocs/ext/resources/css/window.css
  66. +0 −415 application/htdocs/ext/resources/css/xtheme-gray.css
  67. BIN application/htdocs/ext/resources/images/default/button/btn-arrow.gif
  68. BIN application/htdocs/ext/resources/images/default/button/btn-sprite.gif
  69. BIN application/htdocs/ext/resources/images/default/form/clear-trigger.psd
  70. BIN application/htdocs/ext/resources/images/default/form/date-trigger.psd
  71. BIN application/htdocs/ext/resources/images/default/form/search-trigger.psd
  72. BIN application/htdocs/ext/resources/images/default/form/trigger.gif
  73. BIN application/htdocs/ext/resources/images/default/form/trigger.psd
  74. BIN application/htdocs/ext/resources/images/default/gradient-bg.gif
  75. BIN application/htdocs/ext/resources/images/default/grid/grid-split.gif
  76. BIN application/htdocs/ext/resources/images/default/grid/grid-vista-hd.gif
  77. BIN application/htdocs/ext/resources/images/default/layout/gradient-bg.gif
  78. BIN application/htdocs/ext/resources/images/default/panel/tool-sprites.gif
  79. BIN application/htdocs/ext/resources/images/default/panel/tools-sprites-trans.gif
  80. BIN application/htdocs/ext/resources/images/default/panel/top-bottom.png
  81. BIN application/htdocs/ext/resources/images/default/qtip/close.gif
  82. BIN application/htdocs/ext/resources/images/default/s.gif
  83. BIN application/htdocs/ext/resources/images/default/shadow-c.psd
  84. BIN application/htdocs/ext/resources/images/default/tabs/tab-strip-bg.png
  85. BIN application/htdocs/ext/resources/images/default/toolbar/btn-arrow-light.gif
  86. BIN application/htdocs/ext/resources/images/default/toolbar/btn-arrow.gif
  87. BIN application/htdocs/ext/resources/images/default/toolbar/btn-over-bg.gif
  88. BIN application/htdocs/ext/resources/images/default/toolbar/gray-bg.gif
  89. BIN application/htdocs/ext/resources/images/default/toolbar/tb-bg.gif
  90. BIN application/htdocs/ext/resources/images/default/tree/s.gif
  91. BIN application/htdocs/ext/resources/images/default/window/icon-error.gif
  92. BIN application/htdocs/ext/resources/images/default/window/icon-info.gif
  93. BIN application/htdocs/ext/resources/images/default/window/icon-question.gif
  94. BIN application/htdocs/ext/resources/images/default/window/icon-warning.gif
  95. BIN application/htdocs/ext/resources/images/default/window/left-corners.png
  96. BIN application/htdocs/ext/resources/images/default/window/left-corners.psd
  97. BIN application/htdocs/ext/resources/images/default/window/left-right.png
  98. BIN application/htdocs/ext/resources/images/default/window/left-right.psd
  99. BIN application/htdocs/ext/resources/images/default/window/right-corners.png
  100. BIN application/htdocs/ext/resources/images/default/window/right-corners.psd
  101. BIN application/htdocs/ext/resources/images/default/window/top-bottom.png
  102. BIN application/htdocs/ext/resources/images/default/window/top-bottom.psd
  103. BIN application/htdocs/ext/resources/images/gray/button/btn-arrow.gif
  104. BIN application/htdocs/ext/resources/images/gray/button/btn-sprite.gif
  105. BIN application/htdocs/ext/resources/images/gray/panel/corners-sprite.gif
  106. BIN application/htdocs/ext/resources/images/gray/panel/left-right.gif
  107. BIN application/htdocs/ext/resources/images/gray/panel/light-hd.gif
  108. BIN application/htdocs/ext/resources/images/gray/panel/tool-sprite-tpl.gif
  109. BIN application/htdocs/ext/resources/images/gray/panel/tool-sprites.gif
  110. BIN application/htdocs/ext/resources/images/gray/panel/tools-sprites-trans.gif
  111. BIN application/htdocs/ext/resources/images/gray/panel/top-bottom.gif
  112. BIN application/htdocs/ext/resources/images/gray/panel/white-corners-sprite.gif
  113. BIN application/htdocs/ext/resources/images/gray/panel/white-left-right.gif
  114. BIN application/htdocs/ext/resources/images/gray/panel/white-top-bottom.gif
  115. BIN application/htdocs/ext/resources/images/gray/qtip/bg.gif
  116. BIN application/htdocs/ext/resources/images/gray/qtip/tip-sprite.gif
  117. BIN application/htdocs/ext/resources/images/gray/tabs/scroll-left.gif
  118. BIN application/htdocs/ext/resources/images/gray/tabs/scroll-right.gif
  119. BIN application/htdocs/ext/resources/images/gray/tabs/scroller-bg.gif
  120. BIN application/htdocs/ext/resources/images/gray/tabs/tab-btm-inactive-left-bg.gif
  121. BIN application/htdocs/ext/resources/images/gray/tabs/tab-btm-inactive-right-bg.gif
  122. BIN application/htdocs/ext/resources/images/gray/tabs/tab-btm-left-bg.gif
  123. BIN application/htdocs/ext/resources/images/gray/tabs/tab-btm-right-bg.gif
  124. BIN application/htdocs/ext/resources/images/gray/tabs/tab-close.gif
  125. BIN application/htdocs/ext/resources/images/gray/tabs/tab-strip-bg.gif
  126. BIN application/htdocs/ext/resources/images/gray/tabs/tab-strip-btm-bg.gif
  127. BIN application/htdocs/ext/resources/images/gray/tabs/tabs-sprite.gif
  128. BIN application/htdocs/ext/resources/images/gray/toolbar/bg.gif
  129. BIN application/htdocs/ext/resources/images/gray/toolbar/tb-btn-sprite.gif
  130. BIN application/htdocs/ext/resources/images/gray/window/left-corners.png
  131. BIN application/htdocs/ext/resources/images/gray/window/left-corners.pspimage
  132. BIN application/htdocs/ext/resources/images/gray/window/left-right.png
  133. BIN application/htdocs/ext/resources/images/gray/window/right-corners.png
  134. BIN application/htdocs/ext/resources/images/gray/window/top-bottom.png
  135. BIN application/htdocs/ext/resources/images/vista/basic-dialog/bg-center.gif
  136. BIN application/htdocs/ext/resources/images/vista/basic-dialog/bg-left.gif
  137. BIN application/htdocs/ext/resources/images/vista/basic-dialog/bg-right.gif
  138. BIN application/htdocs/ext/resources/images/vista/basic-dialog/close.gif
  139. BIN application/htdocs/ext/resources/images/vista/basic-dialog/collapse.gif
  140. BIN application/htdocs/ext/resources/images/vista/basic-dialog/dlg-bg.gif
  141. BIN application/htdocs/ext/resources/images/vista/basic-dialog/e-handle.gif
  142. BIN application/htdocs/ext/resources/images/vista/basic-dialog/expand.gif
  143. BIN application/htdocs/ext/resources/images/vista/basic-dialog/hd-sprite.gif
  144. BIN application/htdocs/ext/resources/images/vista/basic-dialog/s-handle.gif
  145. BIN application/htdocs/ext/resources/images/vista/basic-dialog/se-handle.gif
  146. BIN application/htdocs/ext/resources/images/vista/basic-dialog/w-handle.gif
  147. BIN application/htdocs/ext/resources/images/vista/layout/collapse.gif
  148. BIN application/htdocs/ext/resources/images/vista/layout/expand.gif
  149. BIN application/htdocs/ext/resources/images/vista/layout/gradient-bg.gif
  150. BIN application/htdocs/ext/resources/images/vista/layout/ns-collapse.gif
  151. BIN application/htdocs/ext/resources/images/vista/layout/ns-expand.gif
  152. BIN application/htdocs/ext/resources/images/vista/layout/panel-close.gif
  153. BIN application/htdocs/ext/resources/images/vista/layout/panel-title-bg.gif
  154. BIN application/htdocs/ext/resources/images/vista/layout/panel-title-light-bg.gif
  155. BIN application/htdocs/ext/resources/images/vista/layout/stick.gif
  156. BIN application/htdocs/ext/resources/images/vista/layout/tab-close-on.gif
  157. BIN application/htdocs/ext/resources/images/vista/layout/tab-close.gif
  158. BIN application/htdocs/ext/resources/images/vista/qtip/bg.gif
  159. BIN application/htdocs/ext/resources/images/vista/qtip/tip-sprite.gif
  160. BIN application/htdocs/ext/resources/images/vista/sizer/e-handle-dark.gif
  161. BIN application/htdocs/ext/resources/images/vista/sizer/e-handle.gif
  162. BIN application/htdocs/ext/resources/images/vista/sizer/ne-handle-dark.gif
  163. BIN application/htdocs/ext/resources/images/vista/sizer/ne-handle.gif
  164. BIN application/htdocs/ext/resources/images/vista/sizer/nw-handle-dark.gif
  165. BIN application/htdocs/ext/resources/images/vista/sizer/nw-handle.gif
  166. BIN application/htdocs/ext/resources/images/vista/sizer/s-handle-dark.gif
  167. BIN application/htdocs/ext/resources/images/vista/sizer/s-handle.gif
  168. BIN application/htdocs/ext/resources/images/vista/sizer/se-handle-dark.gif
  169. BIN application/htdocs/ext/resources/images/vista/sizer/se-handle.gif
  170. BIN application/htdocs/ext/resources/images/vista/sizer/sw-handle-dark.gif
  171. BIN application/htdocs/ext/resources/images/vista/sizer/sw-handle.gif
  172. BIN application/htdocs/ext/resources/images/vista/tabs/tab-btm-inactive-left-bg.gif
  173. BIN application/htdocs/ext/resources/images/vista/tabs/tab-btm-inactive-right-bg.gif
  174. BIN application/htdocs/ext/resources/images/vista/tabs/tab-btm-left-bg.gif
  175. BIN application/htdocs/ext/resources/images/vista/tabs/tab-btm-right-bg.gif
  176. BIN application/htdocs/ext/resources/images/vista/tabs/tab-sprite.gif
  177. BIN application/htdocs/ext/resources/images/vista/toolbar/gray-bg.gif
  178. BIN application/htdocs/ext/resources/images/vista/toolbar/tb-btn-sprite.gif
  179. +0 −699 application/htdocs/ext/resources/resources.jsb
  180. +0 −6 application/htdocs/index.php
  181. +0 −18 application/htdocs/js/layouts/abstract.js
  182. +0 −236 application/htdocs/js/layouts/admin.js
  183. +0 −19 application/htdocs/js/layouts/simple.js
  184. +0 −16 application/htdocs/js/namespaces.js
  185. +0 −141 application/htdocs/js/views/admin/dashboard/index.js
  186. +0 −167 application/htdocs/js/views/admin/hardware-server/list.js
  187. +0 −264 application/htdocs/js/views/admin/hardware-server/show.js
  188. +0 −78 application/htdocs/js/views/default/auth/login.js
  189. +0 −57 application/htdocs/js/views/default/check/env.js
  190. +0 −15 application/htdocs/js/views/default/error/error.js
  191. +0 −8 application/htdocs/skins/common.css
  192. BIN application/htdocs/skins/win_xp/images/arrow_sort_down.gif
  193. BIN application/htdocs/skins/win_xp/images/arrow_sort_up.gif
  194. BIN application/htdocs/skins/win_xp/images/button_hide.gif
  195. BIN application/htdocs/skins/win_xp/images/menu_icon_dashboard.png
  196. BIN application/htdocs/skins/win_xp/images/menu_icon_default.gif
  197. BIN application/htdocs/skins/win_xp/images/menu_icon_docs.png
  198. BIN application/htdocs/skins/win_xp/images/menu_icon_help.png
  199. BIN application/htdocs/skins/win_xp/images/menu_icon_host.png
  200. BIN application/htdocs/skins/win_xp/images/menu_icon_info.png
  201. BIN application/htdocs/skins/win_xp/images/menu_icon_logout.png
  202. BIN application/htdocs/skins/win_xp/images/menu_icon_logs.png
  203. BIN application/htdocs/skins/win_xp/images/menu_icon_profile.png
  204. BIN application/htdocs/skins/win_xp/images/menu_icon_tool.png
  205. BIN application/htdocs/skins/win_xp/images/off.gif
  206. BIN application/htdocs/skins/win_xp/images/ok.png
  207. BIN application/htdocs/skins/win_xp/images/on.gif
  208. BIN application/htdocs/skins/win_xp/images/panel_corner.gif
  209. BIN application/htdocs/skins/win_xp/images/panel_header_bg.gif
  210. BIN application/htdocs/skins/win_xp/images/rss.png
  211. BIN application/htdocs/skins/win_xp/images/search.png
  212. BIN application/htdocs/skins/win_xp/images/star.png
  213. +0 −123 application/htdocs/skins/win_xp/styles.css
  214. +0 −13 application/init.php
  215. +0 −94 application/models/Owp/Application.php
  216. +0 −99 application/models/Owp/Config/Defaults.php
  217. +0 −56 application/models/Owp/Config/IniParser.php
  218. +0 −51 application/models/Owp/Controller/Action/Abstract.php
  219. +0 −63 application/models/Owp/Controller/Action/Admin.php
  220. +0 −21 application/models/Owp/Controller/Action/Simple.php
  221. +0 −10 application/models/Owp/Exception.php
  222. +0 −17 application/models/Owp/Table/HwServers.php
  223. +0 −22 application/models/Owp/Table/OsTemplates.php
  224. +0 −53 application/models/Owp/Table/Row/HwServer.php
  225. +0 −72 application/models/Owp/Table/Row/VirtualServer.php
  226. +0 −12 application/models/Owp/Table/Shortcuts.php
  227. +0 −14 application/models/Owp/Table/Users.php
  228. +0 −27 application/models/Owp/Table/VirtualServers.php
  229. +0 −24 application/models/Owp/View/Helper/CssFile.php
  230. +0 −24 application/models/Owp/View/Helper/JsFile.php
  231. +0 −19 application/modules/admin/controllers/DashboardController.php
  232. +0 −156 application/modules/admin/controllers/HardwareServerController.php
  233. +0 −19 application/modules/admin/controllers/IndexController.php
  234. +0 −42 application/modules/admin/controllers/MyProfileController.php
  235. +0 −35 application/modules/admin/controllers/OsTemplateController.php
  236. +0 −83 application/modules/admin/controllers/ShortcutController.php
  237. +0 −150 application/modules/admin/controllers/VirtualServerController.php
  238. +0 −32 application/modules/admin/views/scripts/_partials/menu.phtml
  239. +0 −23 application/modules/admin/views/scripts/dashboard/index.phtml
  240. +0 −3 application/modules/admin/views/scripts/hardware-server/list.phtml
  241. +0 −7 application/modules/admin/views/scripts/hardware-server/show.phtml
  242. +0 −61 application/modules/default/controllers/AuthController.php
  243. +0 −87 application/modules/default/controllers/CheckController.php
  244. +0 −29 application/modules/default/controllers/ErrorController.php
  245. +0 −15 application/modules/default/controllers/IndexController.php
  246. +0 −2 application/modules/default/views/layouts/_footer.phtml
  247. +0 −35 application/modules/default/views/layouts/_header.phtml
  248. +0 −21 application/modules/default/views/layouts/admin.phtml
  249. +0 −9 application/modules/default/views/layouts/simple.phtml
  250. +0 −5 application/modules/default/views/scripts/auth/login.phtml
  251. +0 −15 application/modules/default/views/scripts/check/env.phtml
  252. +0 −35 application/modules/default/views/scripts/error/error.phtml
  253. +0 −41 application/resources/sql/sqlite/structure.sql
  254. +0 −4 application/utils/hw-daemon/hw-daemon.ini.sample
  255. +0 −458 application/utils/hw-daemon/hw-daemon.php
  256. +0 −44 build/build.sh
  257. +109 −0 config/boot.rb
  258. +22 −0 config/database.yml
  259. +79 −0 config/environment.rb
  260. +17 −0 config/environments/development.rb
  261. +24 −0 config/environments/production.rb
  262. +22 −0 config/environments/test.rb
  263. +31 −0 config/initializers/i18n.rb
  264. +10 −0 config/initializers/inflections.rb
  265. +5 −0 config/initializers/mime_types.rb
  266. +17 −0 config/initializers/new_rails_defaults.rb
  267. +38 −0 config/initializers/site_keys.rb
  268. +145 −0 config/locales/en.yml
  269. +145 −0 config/locales/ru.yml
  270. +21 −0 config/routes.rb
  271. +19 −0 db/migrate/20091102155710_create_users.rb
  272. +14 −0 db/migrate/20091102162214_default_admin.rb
  273. +15 −0 db/migrate/20091125153737_create_hardware_servers.rb
  274. +12 −0 db/migrate/20091129111601_create_os_templates.rb
  275. +16 −0 db/migrate/20091129132932_create_virtual_servers.rb
  276. +48 −0 db/schema.rb
  277. +5 −0 doc/README_FOR_APP
  278. +189 −0 lib/authenticated_system.rb
  279. +11 −0 lib/authenticated_test_helper.rb
  280. +39 −0 lib/hw_daemon_client.rb
  281. +18 −0 lib/ini_parser.rb
  282. +30 −0 public/404.html
  283. +30 −0 public/422.html
  284. +33 −0 public/500.html
  285. +10 −0 public/dispatch.cgi
  286. +24 −0 public/dispatch.fcgi
  287. +10 −0 public/dispatch.rb
  288. +7 −0 public/ext/adapter/ext/ext-base.js
  289. +11 −0 public/ext/ext-all.js
  290. +42 −0 public/ext/license.txt
  291. +184 −0 public/ext/locale/ext-lang-af.js
  292. +278 −0 public/ext/locale/ext-lang-bg.js
  293. +315 −0 public/ext/locale/ext-lang-ca.js
  294. +293 −0 public/ext/locale/ext-lang-cs.js
  295. +296 −0 public/ext/locale/ext-lang-da.js
  296. +326 −0 public/ext/locale/ext-lang-de.js
  297. +309 −0 public/ext/locale/ext-lang-el_GR.js
  298. +335 −0 public/ext/locale/ext-lang-en.js
  299. +315 −0 public/ext/locale/ext-lang-en_GB.js
  300. +318 −0 public/ext/locale/ext-lang-es.js
Sorry, we could not display the entire diff because too many files (2,336) changed.
View
256 README
@@ -0,0 +1,256 @@
+== Welcome to Rails
+
+Rails is a web-application framework that includes everything needed to create
+database-backed web applications according to the Model-View-Control pattern.
+
+This pattern splits the view (also called the presentation) into "dumb" templates
+that are primarily responsible for inserting pre-built data in between HTML tags.
+The model contains the "smart" domain objects (such as Account, Product, Person,
+Post) that holds all the business logic and knows how to persist themselves to
+a database. The controller handles the incoming requests (such as Save New Account,
+Update Product, Show Post) by manipulating the model and directing data to the view.
+
+In Rails, the model is handled by what's called an object-relational mapping
+layer entitled Active Record. This layer allows you to present the data from
+database rows as objects and embellish these data objects with business logic
+methods. You can read more about Active Record in
+link:files/vendor/rails/activerecord/README.html.
+
+The controller and view are handled by the Action Pack, which handles both
+layers by its two parts: Action View and Action Controller. These two layers
+are bundled in a single package due to their heavy interdependence. This is
+unlike the relationship between the Active Record and Action Pack that is much
+more separate. Each of these packages can be used independently outside of
+Rails. You can read more about Action Pack in
+link:files/vendor/rails/actionpack/README.html.
+
+
+== Getting Started
+
+1. At the command prompt, start a new Rails application using the <tt>rails</tt> command
+ and your application name. Ex: rails myapp
+2. Change directory into myapp and start the web server: <tt>script/server</tt> (run with --help for options)
+3. Go to http://localhost:3000/ and get "Welcome aboard: You're riding the Rails!"
+4. Follow the guidelines to start developing your application
+
+
+== Web Servers
+
+By default, Rails will try to use Mongrel and lighttpd if they are installed, otherwise
+Rails will use WEBrick, the webserver that ships with Ruby. When you run script/server,
+Rails will check if Mongrel exists, then lighttpd and finally fall back to WEBrick. This ensures
+that you can always get up and running quickly.
+
+Mongrel is a Ruby-based webserver with a C component (which requires compilation) that is
+suitable for development and deployment of Rails applications. If you have Ruby Gems installed,
+getting up and running with mongrel is as easy as: <tt>gem install mongrel</tt>.
+More info at: http://mongrel.rubyforge.org
+
+If Mongrel is not installed, Rails will look for lighttpd. It's considerably faster than
+Mongrel and WEBrick and also suited for production use, but requires additional
+installation and currently only works well on OS X/Unix (Windows users are encouraged
+to start with Mongrel). We recommend version 1.4.11 and higher. You can download it from
+http://www.lighttpd.net.
+
+And finally, if neither Mongrel or lighttpd are installed, Rails will use the built-in Ruby
+web server, WEBrick. WEBrick is a small Ruby web server suitable for development, but not
+for production.
+
+But of course its also possible to run Rails on any platform that supports FCGI.
+Apache, LiteSpeed, IIS are just a few. For more information on FCGI,
+please visit: http://wiki.rubyonrails.com/rails/pages/FastCGI
+
+
+== Apache .htaccess example
+
+# General Apache options
+AddHandler fastcgi-script .fcgi
+AddHandler cgi-script .cgi
+Options +FollowSymLinks +ExecCGI
+
+# If you don't want Rails to look in certain directories,
+# use the following rewrite rules so that Apache won't rewrite certain requests
+#
+# Example:
+# RewriteCond %{REQUEST_URI} ^/notrails.*
+# RewriteRule .* - [L]
+
+# Redirect all requests not available on the filesystem to Rails
+# By default the cgi dispatcher is used which is very slow
+#
+# For better performance replace the dispatcher with the fastcgi one
+#
+# Example:
+# RewriteRule ^(.*)$ dispatch.fcgi [QSA,L]
+RewriteEngine On
+
+# If your Rails application is accessed via an Alias directive,
+# then you MUST also set the RewriteBase in this htaccess file.
+#
+# Example:
+# Alias /myrailsapp /path/to/myrailsapp/public
+# RewriteBase /myrailsapp
+
+RewriteRule ^$ index.html [QSA]
+RewriteRule ^([^.]+)$ $1.html [QSA]
+RewriteCond %{REQUEST_FILENAME} !-f
+RewriteRule ^(.*)$ dispatch.cgi [QSA,L]
+
+# In case Rails experiences terminal errors
+# Instead of displaying this message you can supply a file here which will be rendered instead
+#
+# Example:
+# ErrorDocument 500 /500.html
+
+ErrorDocument 500 "<h2>Application error</h2>Rails application failed to start properly"
+
+
+== Debugging Rails
+
+Sometimes your application goes wrong. Fortunately there are a lot of tools that
+will help you debug it and get it back on the rails.
+
+First area to check is the application log files. Have "tail -f" commands running
+on the server.log and development.log. Rails will automatically display debugging
+and runtime information to these files. Debugging info will also be shown in the
+browser on requests from 127.0.0.1.
+
+You can also log your own messages directly into the log file from your code using
+the Ruby logger class from inside your controllers. Example:
+
+ class WeblogController < ActionController::Base
+ def destroy
+ @weblog = Weblog.find(params[:id])
+ @weblog.destroy
+ logger.info("#{Time.now} Destroyed Weblog ID ##{@weblog.id}!")
+ end
+ end
+
+The result will be a message in your log file along the lines of:
+
+ Mon Oct 08 14:22:29 +1000 2007 Destroyed Weblog ID #1
+
+More information on how to use the logger is at http://www.ruby-doc.org/core/
+
+Also, Ruby documentation can be found at http://www.ruby-lang.org/ including:
+
+* The Learning Ruby (Pickaxe) Book: http://www.ruby-doc.org/docs/ProgrammingRuby/
+* Learn to Program: http://pine.fm/LearnToProgram/ (a beginners guide)
+
+These two online (and free) books will bring you up to speed on the Ruby language
+and also on programming in general.
+
+
+== Debugger
+
+Debugger support is available through the debugger command when you start your Mongrel or
+Webrick server with --debugger. This means that you can break out of execution at any point
+in the code, investigate and change the model, AND then resume execution!
+You need to install ruby-debug to run the server in debugging mode. With gems, use 'gem install ruby-debug'
+Example:
+
+ class WeblogController < ActionController::Base
+ def index
+ @posts = Post.find(:all)
+ debugger
+ end
+ end
+
+So the controller will accept the action, run the first line, then present you
+with a IRB prompt in the server window. Here you can do things like:
+
+ >> @posts.inspect
+ => "[#<Post:0x14a6be8 @attributes={\"title\"=>nil, \"body\"=>nil, \"id\"=>\"1\"}>,
+ #<Post:0x14a6620 @attributes={\"title\"=>\"Rails you know!\", \"body\"=>\"Only ten..\", \"id\"=>\"2\"}>]"
+ >> @posts.first.title = "hello from a debugger"
+ => "hello from a debugger"
+
+...and even better is that you can examine how your runtime objects actually work:
+
+ >> f = @posts.first
+ => #<Post:0x13630c4 @attributes={"title"=>nil, "body"=>nil, "id"=>"1"}>
+ >> f.
+ Display all 152 possibilities? (y or n)
+
+Finally, when you're ready to resume execution, you enter "cont"
+
+
+== Console
+
+You can interact with the domain model by starting the console through <tt>script/console</tt>.
+Here you'll have all parts of the application configured, just like it is when the
+application is running. You can inspect domain models, change values, and save to the
+database. Starting the script without arguments will launch it in the development environment.
+Passing an argument will specify a different environment, like <tt>script/console production</tt>.
+
+To reload your controllers and models after launching the console run <tt>reload!</tt>
+
+== dbconsole
+
+You can go to the command line of your database directly through <tt>script/dbconsole</tt>.
+You would be connected to the database with the credentials defined in database.yml.
+Starting the script without arguments will connect you to the development database. Passing an
+argument will connect you to a different database, like <tt>script/dbconsole production</tt>.
+Currently works for mysql, postgresql and sqlite.
+
+== Description of Contents
+
+app
+ Holds all the code that's specific to this particular application.
+
+app/controllers
+ Holds controllers that should be named like weblogs_controller.rb for
+ automated URL mapping. All controllers should descend from ApplicationController
+ which itself descends from ActionController::Base.
+
+app/models
+ Holds models that should be named like post.rb.
+ Most models will descend from ActiveRecord::Base.
+
+app/views
+ Holds the template files for the view that should be named like
+ weblogs/index.html.erb for the WeblogsController#index action. All views use eRuby
+ syntax.
+
+app/views/layouts
+ Holds the template files for layouts to be used with views. This models the common
+ header/footer method of wrapping views. In your views, define a layout using the
+ <tt>layout :default</tt> and create a file named default.html.erb. Inside default.html.erb,
+ call <% yield %> to render the view using this layout.
+
+app/helpers
+ Holds view helpers that should be named like weblogs_helper.rb. These are generated
+ for you automatically when using script/generate for controllers. Helpers can be used to
+ wrap functionality for your views into methods.
+
+config
+ Configuration files for the Rails environment, the routing map, the database, and other dependencies.
+
+db
+ Contains the database schema in schema.rb. db/migrate contains all
+ the sequence of Migrations for your schema.
+
+doc
+ This directory is where your application documentation will be stored when generated
+ using <tt>rake doc:app</tt>
+
+lib
+ Application specific libraries. Basically, any kind of custom code that doesn't
+ belong under controllers, models, or helpers. This directory is in the load path.
+
+public
+ The directory available for the web server. Contains subdirectories for images, stylesheets,
+ and javascripts. Also contains the dispatchers and the default HTML files. This should be
+ set as the DOCUMENT_ROOT of your web server.
+
+script
+ Helper scripts for automation and generation.
+
+test
+ Unit and functional tests along with fixtures. When using the script/generate scripts, template
+ test files will be generated for you and placed in this directory.
+
+vendor
+ External libraries that the application depends on. Also includes the plugins subdirectory.
+ If the app has frozen rails, those gems also go here, under vendor/rails/.
+ This directory is in the load path.
View
10 Rakefile
@@ -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'
View
33 app/controllers/admin/dashboard_controller.rb
@@ -0,0 +1,33 @@
+class Admin::DashboardController < AdminController
+
+ def index
+ @stats_data = get_stats
+ end
+
+ private
+
+ def get_stats
+ [
+ [
+ t('admin.dashboard.stats_grid.parameter.panel_users'),
+ User.count
+ ], [
+ t('admin.dashboard.stats_grid.parameter.hardware_servers'),
+ HardwareServer.count
+ ], [
+ t('admin.dashboard.stats_grid.parameter.virtual_servers'),
+ VirtualServer.count
+ ], [
+ t('admin.dashboard.stats_grid.parameter.virtual_servers_running'),
+ VirtualServer.count(:conditions => "state = 'running'")
+ ], [
+ t('admin.dashboard.stats_grid.parameter.virtual_servers_stopped'),
+ VirtualServer.count(:conditions => "state = 'stopped'")
+ ], [
+ t('admin.dashboard.stats_grid.parameter.os_templates'),
+ OsTemplate.count
+ ]
+ ]
+ end
+
+end
View
47 app/controllers/admin/hardware_servers_controller.rb
@@ -0,0 +1,47 @@
+class Admin::HardwareServersController < AdminController
+
+ def list
+ @up_level = '/admin/dashboard'
+ end
+
+ def list_data
+ @hardware_servers = HardwareServer.all
+ @hardware_servers.map! { |item| {
+ :id => item.id,
+ :host => item.host,
+ :description => item.description
+ }}
+ render :json => { :data => @hardware_servers }
+ end
+
+ def connect
+ @hardware_server = HardwareServer.new(params)
+
+ if @hardware_server.connect
+ render :json => { :success => true }
+ else
+ render :json => { :success => false, :errors => @hardware_server.errors }
+ end
+ end
+
+ def disconnect
+ params[:ids].split(',').each { |id|
+ hardware_server = HardwareServer.find(id)
+ logger.info "Disconnecting hardware server with id: #{id}"
+
+ if !hardware_server.disconnect
+ render :json => { :success => false }
+ return
+ end
+ }
+
+ render :json => { :success => true }
+ end
+
+ def show
+ @hardware_server = HardwareServer.find_by_id(params[:id])
+ redirect_to :action => 'list' if !@hardware_server
+ @up_level = '/admin/hardware-servers/list'
+ end
+
+end
View
13 app/controllers/admin/os_templates_controller.rb
@@ -0,0 +1,13 @@
+class Admin::OsTemplatesController < AdminController
+
+ def list_data
+ hardware_server = HardwareServer.find_by_id(params[:hardware_server_id])
+ os_templates = hardware_server.os_templates
+ os_templates.map! { |item| {
+ :id => item.id,
+ :name => item.name,
+ }}
+ render :json => { :data => os_templates }
+ end
+
+end
View
21 app/controllers/admin/users_controller.rb
@@ -0,0 +1,21 @@
+class Admin::UsersController < AdminController
+
+ def save_profile
+ user = User.authenticate(@current_user.login, params[:current_password])
+
+ if !user
+ render :json => { :success => false, :errors => [['current_password', t('admin.my_profile.bad_current_password')]] }
+ return
+ end
+
+ user.password = params[:password]
+ user.password_confirmation = params[:confirm_password]
+
+ if user.save
+ render :json => { :success => true }
+ else
+ render :json => { :success => false, :errors => user.errors }
+ end
+ end
+
+end
View
57 app/controllers/admin/virtual_servers_controller.rb
@@ -0,0 +1,57 @@
+class Admin::VirtualServersController < AdminController
+
+ def list_data
+ hardware_server = HardwareServer.find_by_id(params[:hardware_server_id])
+ virtual_servers = hardware_server.virtual_servers
+ virtual_servers.map! { |item| {
+ :id => item.id,
+ :identity => item.identity,
+ :ip_address => item.ip_address,
+ :host_name => item.host_name,
+ :state => item.state,
+ :os_template_name => item.os_template.name
+ }}
+ render :json => { :data => virtual_servers }
+ end
+
+ def change_state
+ params[:ids].split(',').each { |id|
+ virtual_server = VirtualServer.find_by_id(id)
+
+ case params[:command]
+ when 'start' then virtual_server.start
+ when 'stop' then virtual_server.stop
+ when 'restart' then virtual_server.restart
+ end
+ }
+
+ render :json => { :success => true }
+ end
+
+ def delete
+ params[:ids].split(',').each { |id|
+ virtual_server = VirtualServer.find(id)
+
+ if !virtual_server.delete_physically
+ render :json => { :success => false }
+ return
+ end
+ }
+
+ render :json => { :success => true }
+ end
+
+ def create
+ hardware_server = HardwareServer.find_by_id(params[:hardware_server_id])
+ redirect_to :controller => 'hardware_servers', :action => 'list' if !hardware_server
+
+ virtual_server = VirtualServer.new(params)
+
+ if virtual_server.create_physically
+ render :json => { :success => true }
+ else
+ render :json => { :success => false, :errors => virtual_server.errors }
+ end
+ end
+
+end
View
4 app/controllers/admin_controller.rb
@@ -0,0 +1,4 @@
+class AdminController < ApplicationController
+ layout 'admin'
+ before_filter :login_required
+end
View
31 app/controllers/application.rb
@@ -0,0 +1,31 @@
+# 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
+ helper :all # include all helpers, all the time
+
+ include AuthenticatedSystem
+
+ # See ActionController::RequestForgeryProtection for details
+ # Uncomment the :secret if you're not using the cookie session store
+ #protect_from_forgery # :secret => 'ca592873eb4aeaa58effb6b48920e979'
+
+ # See ActionController::Base for details
+ # Uncomment this to filter the contents of submitted sensitive data parameters
+ # from your application log (in this case, all fields with names like "password").
+ # filter_parameter_logging :password
+
+ before_filter :set_locale
+
+ protected
+
+ def set_locale
+ if params[:locale] && I18n.available_locales.include?(params[:locale].to_sym)
+ cookies['locale'] = { :value => params[:locale], :expires => 1.year.from_now }
+ I18n.locale = params[:locale].to_sym
+ elsif cookies['locale'] && I18n.available_locales.include?(cookies['locale'].to_sym)
+ I18n.locale = cookies['locale'].to_sym
+ end
+ end
+
+end
View
30 app/controllers/sessions_controller.rb
@@ -0,0 +1,30 @@
+class SessionsController < ApplicationController
+
+ def new
+ redirect_to :controller => 'admin/dashboard' if logged_in?
+
+ @available_locales = I18n.available_locales.map {
+ |locale| [locale.to_s, I18n.t('language.title', :locale => locale) + " (#{locale})"]
+ }.sort
+ end
+
+ def create
+ logout_keeping_session!
+ user = User.authenticate(params[:login], params[:password])
+ if user
+ self.current_user = user
+ new_cookie_flag = (params[:remember_me] == "on")
+ handle_remember_cookie! new_cookie_flag
+ render :json => { :success => true }
+ else
+ logger.warn "Failed login for '#{params[:login]}' from #{request.remote_ip} at #{Time.now.utc}"
+ render :json => { :success => false, :message => t('login.bad_login') }
+ end
+ end
+
+ def destroy
+ logout_killing_session!
+ redirect_back_or_default('/')
+ end
+
+end
View
2 app/helpers/admin/dashboard_helper.rb
@@ -0,0 +1,2 @@
+module Admin::DashboardHelper
+end
View
2 app/helpers/admin/hardware_servers_helper.rb
@@ -0,0 +1,2 @@
+module Admin::HardwareServersHelper
+end
View
2 app/helpers/admin/os_templates_helper.rb
@@ -0,0 +1,2 @@
+module Admin::OsTemplatesHelper
+end
View
2 app/helpers/admin/users_helper.rb
@@ -0,0 +1,2 @@
+module Admin::UsersHelper
+end
View
2 app/helpers/admin/virtual_servers_helper.rb
@@ -0,0 +1,2 @@
+module Admin::VirtualServersHelper
+end
View
13 app/helpers/application_helper.rb
@@ -0,0 +1,13 @@
+# Methods added to this helper will be available to all templates in the application.
+module ApplicationHelper
+
+ def translate(key, options = {})
+ I18n.translate(key, options)
+ end
+ alias :t :translate
+
+ def tjs(key, options = {})
+ escape_javascript t(key, options)
+ end
+
+end
View
2 app/helpers/sessions_helper.rb
@@ -0,0 +1,2 @@
+module SessionsHelper
+end
View
93 app/helpers/users_helper.rb
@@ -0,0 +1,93 @@
+module UsersHelper
+
+ #
+ # Use this to wrap view elements that the user can't access.
+ # !! Note: this is an *interface*, not *security* feature !!
+ # You need to do all access control at the controller level.
+ #
+ # Example:
+ # <%= if_authorized?(:index, User) do link_to('List all users', users_path) end %> |
+ # <%= if_authorized?(:edit, @user) do link_to('Edit this user', edit_user_path) end %> |
+ # <%= if_authorized?(:destroy, @user) do link_to 'Destroy', @user, :confirm => 'Are you sure?', :method => :delete end %>
+ #
+ #
+ def if_authorized?(action, resource, &block)
+ if authorized?(action, resource)
+ yield action, resource
+ end
+ end
+
+ #
+ # Link to user's page ('users/1')
+ #
+ # By default, their login is used as link text and link title (tooltip)
+ #
+ # Takes options
+ # * :content_text => 'Content text in place of user.login', escaped with
+ # the standard h() function.
+ # * :content_method => :user_instance_method_to_call_for_content_text
+ # * :title_method => :user_instance_method_to_call_for_title_attribute
+ # * as well as link_to()'s standard options
+ #
+ # Examples:
+ # link_to_user @user
+ # # => <a href="/users/3" title="barmy">barmy</a>
+ #
+ # # if you've added a .name attribute:
+ # content_tag :span, :class => :vcard do
+ # (link_to_user user, :class => 'fn n', :title_method => :login, :content_method => :name) +
+ # ': ' + (content_tag :span, user.email, :class => 'email')
+ # end
+ # # => <span class="vcard"><a href="/users/3" title="barmy" class="fn n">Cyril Fotheringay-Phipps</a>: <span class="email">barmy@blandings.com</span></span>
+ #
+ # link_to_user @user, :content_text => 'Your user page'
+ # # => <a href="/users/3" title="barmy" class="nickname">Your user page</a>
+ #
+ def link_to_user(user, options={})
+ raise "Invalid user" unless user
+ options.reverse_merge! :content_method => :login, :title_method => :login, :class => :nickname
+ content_text = options.delete(:content_text)
+ content_text ||= user.send(options.delete(:content_method))
+ options[:title] ||= user.send(options.delete(:title_method))
+ link_to h(content_text), user_path(user), options
+ end
+
+ #
+ # Link to login page using remote ip address as link content
+ #
+ # The :title (and thus, tooltip) is set to the IP address
+ #
+ # Examples:
+ # link_to_login_with_IP
+ # # => <a href="/login" title="169.69.69.69">169.69.69.69</a>
+ #
+ # link_to_login_with_IP :content_text => 'not signed in'
+ # # => <a href="/login" title="169.69.69.69">not signed in</a>
+ #
+ def link_to_login_with_IP content_text=nil, options={}
+ ip_addr = request.remote_ip
+ content_text ||= ip_addr
+ options.reverse_merge! :title => ip_addr
+ if tag = options.delete(:tag)
+ content_tag tag, h(content_text), options
+ else
+ link_to h(content_text), login_path, options
+ end
+ end
+
+ #
+ # Link to the current user's page (using link_to_user) or to the login page
+ # (using link_to_login_with_IP).
+ #
+ def link_to_current_user(options={})
+ if current_user
+ link_to_user current_user, options
+ else
+ content_text = options.delete(:content_text) || 'not signed in'
+ # kill ignored options from link_to_user
+ [:content_method, :title_method].each{|opt| options.delete(opt)}
+ link_to_login_with_IP content_text, options
+ end
+ end
+
+end
View
54 app/models/hardware_server.rb
@@ -0,0 +1,54 @@
+class HardwareServer < ActiveRecord::Base
+ attr_accessible :host, :auth_key, :description
+ validates_uniqueness_of :host
+ has_many :os_templates, :dependent => :destroy
+ has_many :virtual_servers, :dependent => :destroy
+
+ def connect
+ save
+
+ rpc_client = HwDaemonClient.new(self.host, self.auth_key)
+ add_os_templates(rpc_client)
+ add_virtual_servers(rpc_client)
+ end
+
+ def disconnect
+ destroy
+ end
+
+ def exec_command(command, args = '')
+ rpc_client = HwDaemonClient.new(self.host, self.auth_key)
+ rpc_client.exec(command, args)
+ end
+
+ private
+
+ def add_os_templates(rpc_client)
+ rpc_client.exec('ls', '/vz/template/cache')['output'].split.each { |template_name|
+ os_template = OsTemplate.new(:name => template_name.sub(/\.tar.\gz/, ''))
+ os_template.hardware_server = self
+ os_template.save
+ }
+ end
+
+ def add_virtual_servers(rpc_client)
+ rpc_client.exec('vzlist', '-a -H -o veid,hostname,ip,status')['output'].split("\n").each { |vzlist_entry|
+ ve_id, host_name, ip_address, ve_state = vzlist_entry.split
+ virtual_server = VirtualServer.new(
+ :identity => ve_id,
+ :host_name => host_name,
+ :ip_address => ip_address,
+ :state => ve_state
+ )
+
+ parser = IniParser.new(rpc_client.exec('cat', "/etc/vz/conf/#{ve_id}.conf")['output'])
+ os_template = OsTemplate.find_by_name(parser.get('OSTEMPLATE'))
+ virtual_server.os_template = os_template
+
+ virtual_server.hardware_server = self
+
+ virtual_server.save
+ }
+ end
+
+end
View
3 app/models/os_template.rb
@@ -0,0 +1,3 @@
+class OsTemplate < ActiveRecord::Base
+ belongs_to :hardware_server
+end
View
36 app/models/user.rb
@@ -0,0 +1,36 @@
+require 'digest/sha1'
+
+class User < ActiveRecord::Base
+ include Authentication
+ include Authentication::ByPassword
+ include Authentication::ByCookieToken
+
+ validates_presence_of :login
+ validates_length_of :login, :within => 3..40
+ validates_uniqueness_of :login
+ validates_format_of :login, :with => Authentication.login_regex, :message => Authentication.bad_login_message
+
+ # HACK HACK HACK -- how to do attr_accessible from here?
+ # prevents a user from submitting a crafted form that bypasses activation
+ # anything else you want your user to change should be added here.
+ attr_accessible :login, :password, :password_confirmation
+
+ # Authenticates a user by their login name and unencrypted password. Returns the user or nil.
+ #
+ # uff. this is really an authorization, not authentication routine.
+ # We really need a Dispatch Chain here or something.
+ # This will also let us return a human error message.
+ #
+ def self.authenticate(login, password)
+ return nil if login.blank? || password.blank?
+ u = find_by_login(login.downcase) # need to get the salt
+ u && u.authenticated?(password) ? u : nil
+ end
+
+ def login=(value)
+ write_attribute :login, (value ? value.downcase : nil)
+ end
+
+ protected
+
+end
View
51 app/models/virtual_server.rb
@@ -0,0 +1,51 @@
+class VirtualServer < ActiveRecord::Base
+ attr_accessible :identity, :ip_address, :host_name, :hardware_server_id, :os_template_id, :password, :start_on_boot, :start_after_creation
+ attr_accessor :password, :start_on_boot, :start_after_creation
+ belongs_to :hardware_server
+ belongs_to :os_template
+
+ def start
+ self.hardware_server.exec_command('vzctl', 'start ' + self.identity.to_s)
+ self.state = 'running'
+ save
+ end
+
+ def stop
+ self.hardware_server.exec_command('vzctl', 'stop ' + self.identity.to_s)
+ self.state = 'stopped'
+ save
+ end
+
+ def restart
+ self.hardware_server.exec_command('vzctl', 'restart ' + self.identity.to_s)
+ self.state = 'running'
+ save
+ end
+
+ def delete_physically
+ stop
+ self.hardware_server.exec_command('vzctl', 'destroy ' + self.identity.to_s)
+ destroy
+ end
+
+ def create_physically
+ self.hardware_server.exec_command('vzctl', "create #{self.identity.to_s}" +
+ " --ostemplate #{self.os_template.name}" +
+ " --ipadd #{self.ip_address}" +
+ " --hostname #{self.host_name}"
+ )
+ self.state = 'stopped'
+ result = save
+ tune_server_settings
+ result
+ end
+
+ private
+
+ def tune_server_settings
+ self.hardware_server.exec_command('vzctl', "set #{self.identity.to_s} --userpasswd root:#{password}") if password
+ self.hardware_server.exec_command('vzctl', "set #{self.identity.to_s} --onboot yes --save") if start_on_boot
+ self.start if start_after_creation
+ end
+
+end
View
57 app/views/admin/dashboard/index.html.erb
@@ -0,0 +1,57 @@
+<% @page_title = t('admin.dashboard.title') %>
+
+<% javascript_tag do -%>
+Ext.onReady(function() {
+
+ new Ext.Panel({
+ title: '<%= tjs('admin.dashboard.intro.title') %>',
+ collapsible: true,
+ renderTo: 'panel-dashboard-intro',
+ html: '<p>' + '<%= tjs('admin.dashboard.intro.text') %>' + '</p>'
+ });
+
+ var storeData = <%= @stats_data.to_json %> ;
+
+ var store = new Ext.data.ArrayStore({
+ fields: [{
+ name: 'parameter'
+ }, {
+ name: 'value'
+ }]
+ });
+
+ store.loadData(storeData);
+
+ var statsGrid = new Ext.grid.GridPanel({
+ id: 'statsGrid',
+ title: '<%= tjs('admin.dashboard.stats_grid.title') %>',
+ iconCls: 'icon-items-list',
+ store: store,
+ collapsible: true,
+ autoHeight: true,
+ autoWidth: true,
+ stripeRows: true,
+ autoExpandColumn: 'value',
+ cm: new Ext.grid.ColumnModel([{
+ id: 'parameter',
+ header: '<%= tjs('admin.dashboard.stats_grid.column.parameter') %>',
+ width: 250,
+ sortable: true,
+ dataIndex: 'parameter'
+ }, {
+ id: 'value',
+ header: '<%= tjs('admin.dashboard.stats_grid.column.value') %>',
+ sortable: true,
+ dataIndex: 'value'
+ }])
+ });
+
+ statsGrid.render('panel-dashboard-stats');
+
+});
+<% end -%>
+
+<div id="panel-dashboard-intro"></div>
+
+<div id="panel-dashboard-stats"></div>
+
View
169 app/views/admin/hardware_servers/list.html.erb
@@ -0,0 +1,169 @@
+<% @page_title = t('admin.hardware_servers.title') %>
+
+<% javascript_tag do -%>
+Ext.onReady(function() {
+
+ var windowAddServer;
+
+ function addHwServer() {
+ if (!windowAddServer) {
+ var formAddServer = new Ext.form.FormPanel({
+ baseCls: 'x-plain',
+ labelWidth: 150,
+ url: '/admin/hardware-servers/connect',
+ defaultType: 'textfield',
+ waitMsgTarget: true,
+ defaults: { width: 200 },
+
+ items: [{
+ fieldLabel: '<%= tjs('admin.hardware_servers.form.connect_server.field.host_name') %>',
+ name: 'host',
+ allowBlank: false
+ }, {
+ fieldLabel: '<%= tjs('admin.hardware_servers.form.connect_server.field.auth_key') %>',
+ name: 'auth_key',
+ allowBlank: false
+ }, {
+ fieldLabel: '<%= tjs('admin.hardware_servers.form.connect_server.field.description') %>',
+ name: 'description'
+ }]
+ });
+
+ windowAddServer = new Ext.Window({
+ title: '<%= tjs('admin.hardware_servers.form.connect_server.title') %>',
+ iconCls: 'icon-window-add',
+ width: 400,
+ height: 160,
+ modal: true,
+ layout: 'fit',
+ plain: true,
+ bodyStyle: 'padding:5px;',
+ resizable: false,
+ items: formAddServer,
+ closeAction: 'hide',
+
+ buttons: [{
+ text: '<%= tjs('admin.hardware_servers.form.connect_server.button_connect') %>',
+ iconCls: 'icon-button-add',
+ handler: function() {
+ formAddServer.form.submit({
+ waitMsg: '<%= tjs('form.loading') %>',
+ success: function() {
+ hwServersGrid.store.reload();
+ windowAddServer.hide();
+ },
+ failure: function(form, action) {
+ Owp.form.errorHandler(form, action);
+ }
+ });
+ }
+ }, {
+ text: '<%= tjs('form.button.cancel') %>',
+ iconCls: 'icon-button-cancel',
+ handler: function() {
+ windowAddServer.hide();
+ }
+ }]
+ });
+
+ windowAddServer.on('show', function() {
+ formAddServer.getForm().reset();
+ });
+ }
+
+ windowAddServer.show();
+ }
+
+ function removeHwServer() {
+ Ext.MessageBox.confirm(
+ '<%= tjs('form.confirmation') %>',
+ '<%= tjs('admin.hardware_servers.form.disconnect_server.sure_to_disconnect') %>',
+ function(button, text) {
+ if ('yes' == button) {
+ Owp.list.groupAction({
+ gridName: 'hwServersGrid',
+ url: '/admin/hardware-servers/disconnect',
+ waitMsg: '<%= tjs('form.performing_task') %>',
+ failure: {
+ title: '<%= tjs('form.error.title') %>',
+ msg: '<%= tjs('admin.hardware_servers.form.disconnect_server.deletion_failed') %>'
+ }
+ });
+ }
+ }
+ );
+ }
+
+ var store = new Ext.data.JsonStore({
+ url: '/admin/hardware-servers/list_data',
+ root: 'data',
+ autoLoad: true,
+ fields: [
+ { name: 'id' },
+ { name: 'host' },
+ { name: 'description' }
+ ]
+ });
+
+ var selectionModel = new Ext.grid.CheckboxSelectionModel({
+ listeners: {
+ selectionchange: function(selectionModel) {
+ if (selectionModel.getCount()) {
+ hwServersGrid.removeButton.enable();
+ } else {
+ hwServersGrid.removeButton.disable();
+ }
+ }
+ }
+ });
+
+ var hwServersGrid = new Ext.grid.GridPanel({
+ id: 'hwServersGrid',
+ store: store,
+ title: '<%= tjs('admin.hardware_servers.grid.title') %>',
+ cm: new Ext.grid.ColumnModel([
+ selectionModel,
+ {
+ id: 'host',
+ header: '<%= tjs('admin.hardware_servers.grid.column.host_name') %>',
+ renderer: function(host, metadata, record) {
+ return "<a href='/admin/hardware-servers/show?id=" + record.data.id + "'>" + host + "</a>";
+ },
+ sortable: true,
+ dataIndex: 'host'
+ }, {
+ id: 'description',
+ header: '<%= tjs('admin.hardware_servers.grid.column.description') %>',
+ sortable: true,
+ dataIndex: 'description'
+ }
+ ]),
+ sm: selectionModel,
+ stripeRows: true,
+ autoExpandColumn: 'description',
+ autoHeight: true,
+ autoWidth: true,
+ stripeRows: true,
+ frame: true,
+ iconCls: 'icon-items-list',
+ tbar: [{
+ text: '<%= tjs('admin.hardware_servers.grid.button.connect') %>',
+ handler: addHwServer,
+ cls: 'x-btn-text-icon',
+ icon: '/images/add.png'
+ }, {
+ text: '<%= tjs('admin.hardware_servers.grid.button.disconnect') %>',
+ handler: removeHwServer,
+ cls: 'x-btn-text-icon',
+ icon: '/images/delete.png',
+ ref: '../removeButton',
+ disabled: true
+ }]
+ });
+
+ hwServersGrid.render('hw-servers-list');
+});
+<% end -%>
+
+<div id="hw-servers-list"></div>
+
View
294 app/views/admin/hardware_servers/show.html.erb
@@ -0,0 +1,294 @@
+<% @page_title = t('admin.hardware_servers.show.title', :name => @hardware_server.host) %>
+
+<% javascript_tag do -%>
+Ext.onReady(function() {
+
+ var changeStateAction = function(action) {
+ Owp.list.groupAction({
+ gridName: 'virtualServersGrid',
+ url: '/admin/virtual-servers/change_state',
+ command: action,
+ waitMsg: '<%= tjs('form.performing_task') %>',
+ failure: {
+ title: '<%= tjs('form.error.title') %>',
+ msg: '<%= tjs('admin.virtual_servers.form.change_state.failed') %>'
+ }
+ });
+ }
+
+ var windowAddVirtualServer;
+
+ function addVirtualServer() {
+ if (!windowAddVirtualServer) {
+ var osTemapltesStore = new Ext.data.JsonStore({
+ url: '/admin/os-templates/list_data?hardware_server_id=<%= @hardware_server.id %>',
+ root: 'data',
+ autoLoad: true,
+ fields: [
+ { name: 'id' },
+ { name: 'name' }
+ ]
+ });
+
+ var formAddVirtualServer = new Ext.form.FormPanel({
+ baseCls: 'x-plain',
+ labelWidth: 180,
+ url: '/admin/virtual-servers/create?hardware_server_id=<%= @hardware_server.id %>',
+ waitMsgTarget: true,
+
+ items: [{
+ xtype: 'fieldset',
+ title: '<%= tjs('admin.virtual_servers.form.create_server.fieldset.general') %>',
+ autoHeight: true,
+ defaults: { width: 170 },
+ defaultType: 'textfield',
+ items: [{
+ fieldLabel: '<%= tjs('admin.virtual_servers.form.create_server.field.identity') %>',
+ name: 'identity',
+ allowBlank: false
+ }, {
+ fieldLabel: '<%= tjs('admin.virtual_servers.form.create_server.field.os_template') %>',
+ xtype: 'combo',
+ hiddenName: 'os_template_id',
+ valueField: 'id',
+ displayField: 'name',
+ name: 'os_template_id',
+ forceSelection: true,
+ triggerAction: 'all',
+ emptyText: '<%= tjs('admin.virtual_servers.form.create_server.field.select_os_template') %>',
+ mode: 'local',
+ allowBlank: false,
+ editable: false,
+ store: osTemapltesStore
+ }]
+ }, {
+ xtype: 'fieldset',
+ title: '<%= tjs('admin.virtual_servers.form.create_server.fieldset.network') %>',
+ autoHeight: true,
+ defaults: { width: 170 },
+ defaultType: 'textfield',
+ items: [{
+ fieldLabel: '<%= tjs('admin.virtual_servers.form.create_server.field.ip_address') %>',
+ name: 'ip_address',
+ allowBlank: false
+ }, {
+ fieldLabel: '<%= tjs('admin.virtual_servers.form.create_server.field.host_name') %>',
+ name: 'host_name',
+ allowBlank: false
+ }]
+ }, {
+ xtype: 'fieldset',
+ title: '<%= tjs('admin.virtual_servers.form.create_server.fieldset.system_access') %>',
+ autoHeight: true,
+ defaults: { width: 170 },
+ defaultType: 'textfield',
+ items: [{
+ fieldLabel: '<%= tjs('admin.virtual_servers.form.create_server.field.password') %>',
+ name: 'password',
+ inputType: 'password',
+ allowBlank: false
+ }, {
+ fieldLabel: '<%= tjs('admin.virtual_servers.form.create_server.field.confirm_password') %>',
+ name: 'confirm_password',
+ inputType: 'password',
+ allowBlank: false
+ }]
+ }, {
+ xtype: 'fieldset',
+ title: '<%= tjs('admin.virtual_servers.form.create_server.fieldset.start_options') %>',
+ autoHeight: true,
+ defaultType: 'checkbox',
+ labelWidth: 180,
+ items: [{
+ fieldLabel: '<%= tjs('admin.virtual_servers.form.create_server.field.start_on_boot') %>',
+ checked: true,
+ name: 'start_on_boot'
+ }, {
+ fieldLabel: '<%= tjs('admin.virtual_servers.form.create_server.field.start_after_creation') %>',
+ checked: true,
+ name: 'start_after_creation'
+ }]
+ }]
+ });
+
+ windowAddVirtualServer = new Ext.Window({
+ title: '<%= tjs('admin.virtual_servers.form.create_server.title') %>',
+ iconCls: 'icon-window-add',
+ width: 420,
+ height: 465,
+ modal: true,
+ layout: 'fit',
+ plain: true,
+ border: false,
+ bodyStyle: 'padding: 5px;',
+ resizable: false,
+ items: formAddVirtualServer,
+ closeAction: 'hide',
+
+ buttons: [{
+ text: '<%= tjs('admin.virtual_servers.form.create_server.button_create') %>',
+ iconCls: 'icon-button-add',
+ handler: function() {
+ formAddVirtualServer.form.submit({
+ waitMsg: '<%= tjs('form.loading') %>',
+ success: function() {
+ virtualServersGrid.store.reload();
+ windowAddVirtualServer.hide();
+ },
+ failure: function(form, action) {
+ Owp.form.errorHandler(form, action);
+ }
+ });
+ }
+ }, {
+ text: '<%= tjs('form.button.cancel') %>',
+ iconCls: 'icon-button-cancel',
+ handler: function() {
+ windowAddVirtualServer.hide();
+ }
+ }]
+ });
+
+ windowAddVirtualServer.on('show', function() {
+ formAddVirtualServer.getForm().reset();
+ });
+ }
+
+ windowAddVirtualServer.show();
+ }
+
+ function removeVirtaulServer() {
+ Ext.MessageBox.confirm(
+ '<%= tjs('form.confirmation') %>',
+ '<%= tjs('admin.virtual_servers.form.remove_server.sure_to_remove') %>',
+ function(button, text) {
+ if ('yes' == button) {
+ Owp.list.groupAction({
+ gridName: 'virtualServersGrid',
+ url: '/admin/virtual-servers/delete',
+ waitMsg: '<%= tjs('form.performing_task') %>',
+ failure: {
+ title: '<%= tjs('form.error.title') %>',
+ msg: '<%= tjs('admin.virtual_servers.form.remove_server.deletion_failed') %>'
+ }
+ });
+ }
+ }
+ );
+ }
+
+ var store = new Ext.data.JsonStore({
+ url: '/admin/virtual-servers/list_data?hardware_server_id=<%= @hardware_server.id %>',
+ root: 'data',
+ autoLoad: true,
+ fields: [
+ { name: 'id' },
+ { name: 'identity' },
+ { name: 'ip_address' },
+ { name: 'host_name' },
+ { name: 'state' },
+ { name: 'os_template_name' }
+ ]
+ });
+
+ var selectionModel = new Ext.grid.CheckboxSelectionModel({
+ listeners: {
+ selectionchange: function(selectionModel) {
+ if (selectionModel.getCount()) {
+ virtualServersGrid.removeButton.enable();
+ virtualServersGrid.changeStateButton.enable();
+ } else {
+ virtualServersGrid.removeButton.disable();
+ virtualServersGrid.changeStateButton.disable();
+ }
+ }
+ }
+ });
+
+ var virtualServersGrid = new Ext.grid.GridPanel({
+ id: 'virtualServersGrid',
+ title: '<%= tjs('admin.virtual_servers.grid.title') %>',
+ iconCls: 'icon-items-list',
+ store: store,
+ cm: new Ext.grid.ColumnModel([
+ selectionModel,
+ {
+ id: 'state',
+ header: '<%= tjs('admin.virtual_servers.grid.column.state') %>',
+ renderer: function(value) {
+ var image = ('running' == value) ? 'control_play_blue.png' : 'control_stop_blue.png';
+ return '<img src="/images/' + image + '"/>';
+ },
+ width: 60,
+ align: 'center',
+ sortable: true,
+ dataIndex: 'state'
+ }, {
+ id: 'identity',
+ header: '<%= tjs('admin.virtual_servers.grid.column.identity') %>',
+ width: 60,
+ sortable: true,
+ dataIndex: 'identity'
+ }, {
+ id: 'ip_address',
+ header: '<%= tjs('admin.virtual_servers.grid.column.ip_address') %>',
+ sortable: true,
+ dataIndex: 'ip_address'
+ }, {
+ id: 'host_name',
+ header: '<%= tjs('admin.virtual_servers.grid.column.host_name') %>',
+ sortable: true,
+ dataIndex: 'host_name'
+ }, {
+ id: 'os_template_name',
+ header: '<%= tjs('admin.virtual_servers.grid.column.os_template') %>',
+ sortable: true,
+ dataIndex: 'os_template_name'
+ }
+ ]),
+ sm: selectionModel,
+ stripeRows: true,
+ autoExpandColumn: 'os_template_name',
+ autoHeight: true,
+ autoWidth: true,
+ stripeRows: true,
+ frame: true,
+ tbar: [{
+ text: '<%= tjs('admin.virtual_servers.grid.button.create') %>',
+ cls: 'x-btn-text-icon',
+ icon: '/images/add.png',
+ handler: addVirtualServer
+ }, {
+ text: '<%= tjs('admin.virtual_servers.grid.button.destroy') %>',
+ cls: 'x-btn-text-icon',
+ icon: '/images/delete.png',
+ handler: removeVirtaulServer,
+ ref: '../removeButton',
+ disabled: true
+ }, '-', {
+ text: '<%= tjs('admin.virtual_servers.grid.button.change_state') %>',
+ iconCls: 'icon-button-change-state',
+ ref: '../changeStateButton',
+ disabled: true,
+ menu: [{
+ text: '<%= tjs('admin.virtual_servers.grid.button.start') %>',
+ iconCls: 'icon-button-start-server',
+ handler: changeStateAction.createCallback('start')
+ }, {
+ text: '<%= tjs('admin.virtual_servers.grid.button.stop') %>',
+ iconCls: 'icon-button-stop-server',
+ handler: changeStateAction.createCallback('stop')
+ }, {
+ text: '<%= tjs('admin.virtual_servers.grid.button.restart') %>',
+ iconCls: 'icon-button-restart-server',
+ handler: changeStateAction.createCallback('restart')
+ }]
+ }]
+ });
+
+ virtualServersGrid.render('virtaul-servers-list');
+});
+<% end -%>
+
+<div id="virtaul-servers-list"></div>
+
View
2 app/views/layouts/_footer.html.erb
@@ -0,0 +1,2 @@
+</body>
+</html>
View
15 app/views/layouts/_header.html.erb
@@ -0,0 +1,15 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html>
+ <head>
+ <meta http-equiv="X-UA-Compatible" content="IE=7"/>
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
+ <title><%= @page_title + ' - ' + PRODUCT_NAME + ' ' + PRODUCT_VERSION %></title>
+ <link rel="shortcut icon" href="/favicon.ico"/>
+ <%= stylesheet_link_tag '/ext/resources/css/ext-all.css' %>
+ <%= stylesheet_link_tag 'application' %>
+ <%= javascript_include_tag '/ext/adapter/ext/ext-base.js' %>
+ <%= javascript_include_tag '/ext/ext-all.js' %>
+ <%= javascript_include_tag 'application' %>
+ <%= javascript_include_tag '/ext/locale/ext-lang-' + I18n.locale.to_s + '.js' %>
+ </head>
+<body>
View
37 app/views/layouts/_top_header.html.erb
@@ -0,0 +1,37 @@
+<div id="top-header">
+ <div class="logo">
+ <div>
+ <img src="/images/logo.gif"/>
+ <%= PRODUCT_NAME + ' ' + PRODUCT_VERSION %>
+ </div>
+ </div>
+
+ <div class="copyright">
+ <div>
+ <a id="copyright-link" href="#">
+ &copy; <%= t('about.copyright') %><br/>
+ <%= t('about.right_reserved') %>
+ </a>
+ </div>
+ <% javascript_tag do -%>
+ Ext.onReady(function() {
+ Ext.get('copyright-link').on('click', function(event) {
+ Ext.MessageBox.show({
+ title: '<%= escape_javascript t('about.about_program') %>',
+ icon: Ext.MessageBox.INFO,
+ buttons: Ext.Msg.OK,
+ animEl: 'copyright-link',
+ minWidth: 400,
+ msg: '<%= escape_javascript t('about.author') %>' +
+ ': <a href="mailto:sibprogrammer@gmail.com">Alexei Yuzhakov</a><br/>' +
+ '<%= escape_javascript t('about.web_site') %>' +
+ ': <a href="http://code.google.com/p/ovz-web-panel/" target="_blank">' +
+ 'http://code.google.com/p/ovz-web-panel/</a><br/><br/>' +
+ '&copy; ' + '<%= escape_javascript t('about.copyright') %>' + '<br/>' +
+ '<%= escape_javascript t('about.right_reserved') %>'
+ });
+ });
+ });
+ <% end -%>
+ </div>
+</div>
View
227 app/views/layouts/admin.html.erb
@@ -0,0 +1,227 @@
+<%= render :partial => 'layouts/header' %>
+
+ <% javascript_tag do -%>
+ Ext.onReady(function() {
+ var formMyProfile = new Ext.form.FormPanel({
+ baseCls: 'x-plain',
+ labelWidth: 150,
+ url: '/admin/users/save_profile',
+ defaultType: 'textfield',
+ defaults: { width: 200 },
+ waitMsgTarget: true,
+
+ items: [{
+ fieldLabel: '<%= tjs('admin.my_profile.user_name') %>',
+ value: '<%= escape_javascript @current_user.login %>',
+ xtype: 'displayfield'
+ }, {
+ fieldLabel: '<%= tjs('admin.my_profile.current_password') %>',
+ name: 'current_password',
+ inputType: 'password',
+ allowBlank: false
+ }, {
+ fieldLabel: '<%= tjs('admin.my_profile.new_password') %>',
+ name: 'password',
+ inputType: 'password',
+ allowBlank: false
+ }, {
+ fieldLabel: '<%= tjs('admin.my_profile.confirm_password') %>',
+ name: 'confirm_password',
+ inputType: 'password',
+ allowBlank: false
+ }]
+ });
+
+ var windowMyProfile = new Owp.form.BasicFormWindow({
+ title: '<%= tjs('admin.my_profile.title') %>',
+ iconCls: 'icon-window-my-profile',
+ width: 410,
+ height: 185,
+ modal: true,
+ layout: 'fit',
+ plain: true,
+ bodyStyle: 'padding: 5px;',
+ resizable: false,
+ items: formMyProfile,
+ closeAction: 'hide',
+
+ buttons: [{
+ text: '<%= tjs('form.button.save') %>',
+ iconCls: 'icon-button-save',
+ handler: function() {
+ formMyProfile.form.submit({
+ waitMsg: '<%= tjs('form.loading') %>',
+ success: function() {
+ windowMyProfile.hide();
+ },
+ failure: function(form, action) {
+ Owp.form.errorHandler(form, action);
+ }
+ });
+ }
+ }, {
+ text: '<%= tjs('form.button.cancel') %>',
+ iconCls: 'icon-button-cancel',
+ handler: function() {
+ windowMyProfile.hide();
+ }
+ }]
+ });
+
+ windowMyProfile.on('show', function() {
+ formMyProfile.getForm().reset();
+ });
+
+ var mainMenu = new Ext.tree.AsyncTreeNode({
+ expandable: false,
+ expanded: true,
+ children: [{
+ expanded: true,
+ expandable: false,
+ cls: 'menu-title',
+ text: '<%= tjs('admin.menu.general.title') %>',
+ children: [{
+ cls: 'menu-item',
+ text: '<%= tjs('admin.menu.general.dashboard') %>',
+ href: '/admin/dashboard',
+ icon: '/images/application.png',
+ leaf: true
+ }, {
+ cls: 'menu-item',
+ text: '<%= tjs('admin.menu.general.hardware_servers') %>',
+ href: '/admin/hardware-servers/list',
+ icon: '/images/server.png',
+ leaf: true
+ }, {
+ cls: 'menu-item',
+ text: '<%= tjs('admin.menu.general.my_profile') %>',
+ icon: '/images/vcard.png',
+ leaf: true,
+ listeners: {
+ click: function() {
+ windowMyProfile.show();
+ }
+ }
+ }, {
+ cls: 'menu-item',
+ text: '<%= tjs('admin.menu.general.logout') %>',
+ icon: '/images/key_go.png',
+ leaf: true,
+ listeners: {
+ click: function() {
+ Ext.MessageBox.confirm('<%= tjs('form.confirmation') %>', '<%= tjs('admin.logout') %>', function(button, text) {
+ if ('yes' == button) {
+ window.location.href = '/logout';
+ }
+ });
+ }
+ }
+ }]
+ }, {
+ expanded: true,
+ expandable: false,
+ cls: 'menu-title',
+ text: '<%= tjs('admin.menu.help.title') %>',
+ children: [{
+ cls: 'menu-item',
+ text: '<%= tjs('admin.menu.help.documentation') %>',
+ href: 'http://code.google.com/p/ovz-web-panel/w/list',
+ icon: '/images/help.png',
+ leaf: true
+ }, {
+ cls: 'menu-item',
+ text: '<%= tjs('admin.menu.help.support') %>',
+ href: 'http://code.google.com/p/ovz-web-panel/issues/list',
+ icon: '/images/bug.png',
+ leaf: true
+ }]
+ }]
+ });
+
+ function getTopBar() {
+ var upLevelLink = '<%= @up_level %>';
+
+ var topBar = [{
+ xtype: 'tbfill'
+ }, {
+ text: '<%= tjs('admin.operations.up_level') %>',
+ handler: function() {
+ document.location.href = upLevelLink;
+ },
+ disabled: ('' == upLevelLink),
+ cls: 'x-btn-text-icon',
+ icon: '/images/arrow_up.png'
+ }];
+
+ return topBar;
+ }
+
+ var viewport = new Ext.Viewport({
+ layout: 'border',
+ items: [
+ new Ext.BoxComponent({
+ region: 'north',
+ el: 'top-header',
+ cls: 'x-panel-header',
+ height: 50
+ }), {
+ region: 'west',
+ stateId: 'adminWestPanel',
+ title: '<%= tjs('admin.menu.title') %>',
+ contentEl: 'main-menu',
+ split: true,
+ width: 250,
+ minSize: 200,
+ maxSize: 400,
+ collapsible: true,
+ margins: '5 0 5 5',
+ layout: 'accordion',
+ layoutConfig: { animate: true },
+ xtype: 'treepanel',
+ loader: new Ext.tree.TreeLoader(),
+ rootVisible: false,
+ lines: false,
+ root: mainMenu,
+ listeners: {
+ click: function(node) {
+ var href = node.attributes.href;
+ if ('undefined' != typeof href) {
+ if (href.indexOf('http') === 0) {
+ window.open(href);
+ return false;
+ } else {
+ window.location.href = href;
+ }
+ }
+ }
+ }
+ }, {
+ region: 'center',
+ margins: '5 5 5 0',
+ contentEl: 'main-content',
+ xtype: 'panel',
+ autoScroll: true,
+ title: '<%= escape_javascript(@page_title) %>',
+ id: 'main-content-wrapper',
+ bodyStyle: 'background: #FFFFFF url(/images/openvz-big-logo.gif) no-repeat scroll right bottom',
+ tbar: getTopBar(),
+ bbar: [{
+ xtype: 'box',
+ height: 22,
+ id: 'statusbar'
+ }]
+ }
+ ]
+ });
+ });
+ <% end -%>
+
+ <%= render :partial => 'layouts/top_header' %>
+
+ <div id='main-menu'></div>
+
+ <div id='main-content'>
+ <%= yield %>
+ </div>
+
+<%= render :partial => 'layouts/footer' %>
View
28 app/views/layouts/application.html.erb
@@ -0,0 +1,28 @@
+<%= render :partial => 'layouts/header' %>
+
+ <% javascript_tag do -%>
+ Ext.onReady(function() {
+ var viewport = new Ext.Viewport({
+ layout: 'border',
+ items: [
+ new Ext.BoxComponent({
+ region: 'north',
+ el: 'top-header',
+ cls: 'x-panel-header',
+ height: 50
+ }), {
+ region: 'center',
+ contentEl: 'main-content',
+ bodyStyle: 'background: #3D71B8 url(/images/desktop.jpg) no-repeat scroll left top'
+ }]
+ });
+ });
+ <% end -%>
+
+ <%= render :partial => 'layouts/top_header' %>
+
+ <div id='main-content'>
+ <%= yield %>
+ </div>
+
+<%= render :partial => 'layouts/footer' %>
View
95 app/views/sessions/new.html.erb
@@ -0,0 +1,95 @@
+<% @page_title = t('login.page_title') %>
+
+<% javascript_tag do -%>
+Ext.onReady(function() {
+
+ var loginFormSubmitAction = function() {
+ loginForm.getForm().submit({
+ waitMsg: '<%= tjs('form.loading') %>',
+ success: function() {
+ document.location.href = '/admin/dashboard';
+ },
+ failure: function(form, action) {
+ Owp.form.errorHandler(form, action, {
+ fn: function() {
+ Ext.get('login').focus();
+ }
+ });
+ }
+ });
+ }
+
+ var loginForm = new Ext.FormPanel({
+ baseCls: 'x-plain',
+ labelWidth: 100,
+ url: '/session',
+ bodyStyle: 'padding: 15px 15px 0',
+ defaultType: 'textfield',
+ waitMsgTarget: true,
+
+ keys: [{
+ key: Ext.EventObject.ENTER,
+ fn: loginFormSubmitAction
+ }],
+
+ items: [{
+ fieldLabel: '<%= tjs('login.username') %>',
+ name: 'login',
+ id: 'login',
+ width: 210,
+ allowBlank: false
+ }, {
+ fieldLabel: '<%= tjs('login.password') %>',
+ name: 'password',
+ width: 210,
+ inputType: 'password',
+ allowBlank: false
+ }, {
+ fieldLabel: '<%= tjs('login.locale') %>',
+ name: 'locale',
+ xtype: 'combo',
+ mode: 'local',
+ hiddenName: 'locale',
+ valueField: 'locale',
+ value: '<%= I18n.locale %>',
+ displayField: 'languageTitle',
+ editable: false,
+ triggerAction: 'all',
+ store: new Ext.data.ArrayStore({
+ id: 0,
+ fields: ['locale', 'languageTitle'],
+ data: <%= @available_locales.to_json %>
+ })
+ }, {
+ fieldLabel: '<%= tjs('login.remember_me') %>',
+ name: 'remember_me',
+ xtype: 'checkbox',
+ checked: true
+ }]
+ });
+
+ var loginWindow = new Owp.form.BasicFormWindow({
+ applyTo: 'login-window',
+ title: '<%= tjs('login.window_title', :product => PRODUCT_NAME + ' ' + PRODUCT_VERSION) %>',
+ iconCls: 'icon-window-login',
+ width: 380,
+ height: 190,
+ y: 150,
+ closable: false,
+ resizable: false,
+ draggable: false,
+ plain: true,
+ items: loginForm,
+ buttons: [{
+ text: '<%= tjs('login.button_login') %>',
+ iconCls: 'icon-button-login',
+ handler: loginFormSubmitAction
+ }]
+ });
+
+ loginWindow.show();
+
+});
+<% end -%>
+
+<div id='login-window'></div>
View
292 application/LICENSE
@@ -1,292 +0,0 @@
-Copyright (c) 2008-2009 SoftUnity, Alexei Yuzhakov <alex@softunity.com.ru>
-
-This software is licensed under the terms of the GPL 2.0 license.
-
-If you have any questions regarding this license, please send an email to
-<alex@softunity.com.ru>.
-
-Some libraries found in this software project have own licenses. For further
-questions regarding the licenses of the related vendor code, please refer to
-the license informations as supplied within the specific directories in this
-software project.
-
- GNU GENERAL PUBLIC LICENSE
- Version 2, June 1991
-
- Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
- 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- Everyone is permitted to copy and distribute verbatim copies
- of this license document, but changing it is not allowed.
-
- Preamble
-
- The licenses for most software are designed to take away your
-freedom to share and change it. By contrast, the GNU General Public
-License is intended to guarantee your freedom to share and change free
-software--to make sure the software is free for all its users. This
-General Public License applies to most of the Free Software
-Foundation's software and to any other program whose authors commit to
-using it. (Some other Free Software Foundation software is covered by
-the GNU Lesser General Public License instead.) You can apply it to
-your programs, too.
-
- 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
-this service 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.
-
- To protect your rights, we need to make restrictions that forbid
-anyone to deny you these rights or to ask you to surrender the rights.
-These restrictions translate to certain responsibilities for you if you
-distribute copies of the software, or if you modify it.
-
- For example, if you distribute copies of such a program, whether
-gratis or for a fee, you must give the recipients all the rights that
-you have. You must make sure that they, too, receive or can get the
-source code. And you must show them these terms so they know their
-rights.
-
- We protect your rights with two steps: (1) copyright the software, and
-(2) offer you this license which gives you legal permission to copy,
-distribute and/or modify the software.
-
- Also, for each author's protection and ours, we want to make certain