You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

369 lines
21 KiB

  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta http-equiv="content-type" content="text/html; charset=utf-8">
  5. <title>{{ system_name }}</title>
  6. <link rel="shortcut icon" href="{{ system_favicon }}" type="image/x-icon">
  7. <link rel="stylesheet" href="/web/static/lib/fontawesome/css/font-awesome.css">
  8. <link rel="stylesheet" href="/web/static/lib/bootstrap/css/bootstrap.css">
  9. <script src="/web/static/lib/jquery/jquery.js" type="text/javascript"></script>
  10. <script type="text/javascript" src="/web/static/lib/popper/popper.js"></script>
  11. <script type="text/javascript" src="/web/static/lib/bootstrap/js/index.js"></script>
  12. <script type="text/javascript" src="/web/static/lib/bootstrap/js/util.js"></script>
  13. <script type="text/javascript" src="/web/static/lib/bootstrap/js/alert.js"></script>
  14. <script type="text/javascript" src="/web/static/lib/bootstrap/js/button.js"></script>
  15. <script type="text/javascript" src="/web/static/lib/bootstrap/js/carousel.js"></script>
  16. <script type="text/javascript" src="/web/static/lib/bootstrap/js/collapse.js"></script>
  17. <script type="text/javascript" src="/web/static/lib/bootstrap/js/dropdown.js"></script>
  18. <script type="text/javascript" src="/web/static/lib/bootstrap/js/modal.js"></script>
  19. <script type="text/javascript" src="/web/static/lib/bootstrap/js/tooltip.js"></script>
  20. <script type="text/javascript" src="/web/static/lib/bootstrap/js/popover.js"></script>
  21. <script type="text/javascript" src="/web/static/lib/bootstrap/js/scrollspy.js"></script>
  22. <script type="text/javascript" src="/web/static/lib/bootstrap/js/tab.js"></script>
  23. <script type="text/javascript">
  24. $(function() {
  25. // Little eye
  26. $('body').on('mousedown mouseup', '.o_little_eye', function (ev) {
  27. $(ev.target).closest('.input-group').find('.form-control').prop('type', ev.type === 'mousedown' ? 'text' : 'password');
  28. });
  29. // db modal
  30. $('body').on('click', '.o_database_action', function (ev) {
  31. ev.preventDefault();
  32. var db = $(ev.currentTarget).data('db');
  33. var target = $(ev.currentTarget).data('target');
  34. $(target).find('input[name=name]').val(db);
  35. $(target).modal();
  36. });
  37. // close modal on submit
  38. $('.modal').on('submit', 'form', function (ev) {
  39. var modal = $(this).parentsUntil('body', '.modal');
  40. if (modal.hasClass('o_database_backup')) {
  41. $(modal).modal('hide');
  42. if (!$('.alert-backup-long').length) {
  43. $('.list-group').before("<div class='alert alert-info alert-backup-long'>The backup may take some time before being ready</div>");
  44. }
  45. }
  46. });
  47. });
  48. </script>
  49. </head>
  50. {% macro master_input() -%}
  51. <div class="form-group">
  52. {% if insecure %}
  53. <input type="hidden" name="master_pwd" class="form-control" value="admin"/>
  54. {% else %}
  55. <label for="master_pwd" class="col-form-label">Master Password</label>
  56. <input id="master_pwd" type="password" name="master_pwd" class="form-control" required="required" autofocus="autofocus"/>
  57. {% endif %}
  58. </div>
  59. {%- endmacro %}
  60. {% macro create_form() -%}
  61. {{ master_input() }}
  62. <div class="form-group row">
  63. <label for="name" class="col-md-4 col-form-label">Database Name</label>
  64. <div class="col-md-8">
  65. <input id="name" type="text" name="name" class="form-control" required="required" autocomplete="off" pattern="{{ pattern }}" title="Only alphanumerical characters, underscore, hyphen and dot are allowed"/>
  66. </div>
  67. </div>
  68. <div class="form-group row">
  69. <label for="login" class="col-md-4 col-form-label">Email</label>
  70. <div class="col-md-8">
  71. <input id="login" type="text" name="login" class="form-control" required="required" autocomplete="off"/>
  72. </div>
  73. </div>
  74. <div class="form-group row">
  75. <label for="password" class="col-md-4 col-form-label">Password</label>
  76. <div class="col-md-8 input-group">
  77. <input id="password" type="password" name="password" class="form-control" required="required" autocomplete="off"/>
  78. <div class="input-group-append">
  79. <span class="fa fa-eye o_little_eye input-group-text" aria-hidden="true" style="cursor: pointer;"></span>
  80. </div>
  81. </div>
  82. </div>
  83. <div class="form-group row">
  84. <label for="phone" class="col-md-4 col-form-label">Phone number</label>
  85. <div class="col-md-8 input-group">
  86. <input id="phone" type="tel" name="phone" class="form-control" autocomplete="off"/>
  87. </div>
  88. </div>
  89. <div class="form-group row">
  90. <label for="lang" class="col-md-4 col-form-label">Language</label>
  91. <div class="col-md-8">
  92. <select id="lang" name="lang" class="form-control" required="required" autocomplete="off">
  93. {% for lang in langs %}
  94. <option {% if lang[0] == "en_US" %}selected="selected" {% endif %}value="{{ lang[0] }}">{{ lang[1] }}</option>
  95. {% endfor %}
  96. </select>
  97. </div>
  98. </div>
  99. <div class="form-group row">
  100. <label for="country" class="col-md-4 col-form-label ">Country</label>
  101. <div class="col-md-8">
  102. <select id="country" name="country_code" class="form-control" autocomplete="off">
  103. <option value=""></option>
  104. {% for country in countries %}
  105. <option value="{{ country[0] }}">{{ country[1] }}</option>
  106. {% endfor %}
  107. </select>
  108. </div>
  109. </div>
  110. <div class="form-group row">
  111. <label for="demo" class="col-md-4 col-form-label">Demo data</label>
  112. <div class="col-md-8">
  113. <input type="checkbox" id="load_demo_checkbox" class="form-control-sm" name="demo" value="1">
  114. </div>
  115. </div>
  116. {%- endmacro %}
  117. <body>
  118. <div class="container">
  119. <!-- Database List -->
  120. <div class="row">
  121. <div class="col-lg-6 offset-lg-3 o_database_list">
  122. <img src="{{ system_logo }}" class="img-fluid d-block mx-auto"/>
  123. {% if not list_db %}
  124. <div class="alert alert-danger text-center">The database manager has been disabled by the administrator</div>
  125. {% elif insecure and databases %}
  126. <div class="alert alert-warning">
  127. Warning, your {{ system_name }} database manager is not protected.<br/>
  128. Please <a href="#" data-toggle="modal" data-target=".o_database_master">set a master password</a> to secure it.
  129. </div>
  130. {% endif %}
  131. {% if error %}
  132. <div class="alert alert-danger">{{ error }}</div>
  133. {% endif %}
  134. {% if list_db and databases %}
  135. <div class="list-group">
  136. {% for db in databases %}
  137. <div class="list-group-item d-flex align-items-center">
  138. <a href="/web?db={{ db }}" class="d-block flex-grow-1">
  139. {% if db in incompatible_databases %}
  140. <i class="icon fa fa-warning float-right text-warning" title="This database may not be compatible"></i>
  141. {% endif %}
  142. {{ db }}
  143. </a>
  144. {% if manage %}
  145. <div class="btn-group btn-group-sm float-right">
  146. <button type="button" data-db="{{ db }}" data-target=".o_database_backup" class="o_database_action btn btn-primary">
  147. <i class="fa fa-floppy-o fa-fw"></i> Backup
  148. </button>
  149. <button type="button" data-db="{{ db }}" data-target=".o_database_duplicate" class="o_database_action btn btn-secondary">
  150. <i class="fa fa-files-o fa-fw"></i> Duplicate
  151. </button>
  152. <button type="button" data-db="{{ db }}" data-target=".o_database_delete" class="o_database_action btn btn-danger">
  153. <i class="fa fa-trash-o fa-fw"></i> Delete
  154. </button>
  155. </div>
  156. {% endif %}
  157. </div>
  158. {% endfor %}
  159. </div>
  160. {% if manage %}
  161. <div class="d-flex mt-2">
  162. <button type="button" data-toggle="modal" data-target=".o_database_create" class="btn btn-primary flex-grow-1">Create Database</button>
  163. <button type="button" data-toggle="modal" data-target=".o_database_restore" class="btn btn-primary flex-grow-1 ml-2">Restore Database</button>
  164. <button type="button" data-toggle="modal" data-target=".o_database_master" class="btn btn-primary flex-grow-1 ml-2">Set Master Password</button>
  165. </div>
  166. {% else %}
  167. <div class="text-center mt-2">
  168. <a href="/web/database/manager">Manage databases</a>
  169. </div>
  170. {% endif %}
  171. {% elif list_db %}
  172. <form role="form" action="/web/database/create" method="post">
  173. {{ create_form() }}
  174. <input type="submit" value="Create database" class="btn btn-primary float-left"/>
  175. </form>
  176. <a role="button" data-toggle="modal" data-target=".o_database_restore" class="btn btn-link">or restore a database</a>
  177. {% endif %}
  178. </div>
  179. </div>
  180. </div>
  181. <!-- Create -->
  182. <div class="modal fade o_database_create" role="dialog">
  183. <div class="modal-dialog">
  184. <div class="modal-content">
  185. <form role="form" action="/web/database/create" method="post">
  186. <div class="modal-header">
  187. <h4 class="modal-title">Create Database</h4>
  188. <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
  189. </div>
  190. <div class="modal-body">
  191. {{ create_form() }}
  192. <small class="text-muted">
  193. To enhance your experience, some data may be sent to {{ system_name }} online services. See our <a href="{{ system_name }}">Privacy Policy</a>.
  194. </small>
  195. </div>
  196. <div class="modal-footer">
  197. <input type="submit" value="Continue" class="btn btn-primary float-right"/>
  198. </div>
  199. </form>
  200. </div>
  201. </div>
  202. </div>
  203. <!-- Restore -->
  204. <div class="modal fade o_database_restore" role="dialog">
  205. <div class="modal-dialog">
  206. <div class="modal-content">
  207. <div class="modal-header">
  208. <h4 class="modal-title">Restore Database</h4>
  209. <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
  210. </div>
  211. <form id="form_restore_db" role="form" action="/web/database/restore" method="post" enctype="multipart/form-data">
  212. <div class="modal-body">
  213. {{ master_input() }}
  214. <div class="form-group">
  215. <label for="backup_file" class="col-form-label">File</label>
  216. <input id="backup_file" type="file" name="backup_file" class="required"/>
  217. </div>
  218. <div class="form-group">
  219. <label for="name" class="col-form-label">Database Name</label>
  220. <input id="name" type="text" name="name" class="form-control" required="required" pattern="{{ pattern }}" title="Only alphanumerical characters, underscore, hyphen and dot are allowed"/>
  221. </div>
  222. <div class="form-group">
  223. <label for="copy">This database might have been moved or copied.</label>
  224. <p class="form-text">
  225. In order to avoid conflicts between databases, {{ system_name }} needs to know if this database was moved or copied.<br/>
  226. If you don't know, answer "This database is a copy".
  227. </p>
  228. <div class="custom-control custom-radio">
  229. <input id="radio_copy_true" name="copy" type="radio" class="custom-control-input" value="true" checked="1">
  230. <label for="radio_copy_true" class="custom-control-label">This database is a copy</label>
  231. </div>
  232. <div class="custom-control custom-radio">
  233. <input id="radio_copy_false" name="copy" type="radio" class="custom-control-input" value="false">
  234. <label for="radio_copy_false" class="custom-control-label">This database was moved</label>
  235. </div>
  236. </div>
  237. </div>
  238. <div class="modal-footer">
  239. <input type="submit" value="Continue" class="btn btn-primary float-right"/>
  240. </div>
  241. </form>
  242. </div>
  243. </div>
  244. </div>
  245. <!-- Master password -->
  246. <div class="modal fade o_database_master" role="dialog">
  247. <div class="modal-dialog">
  248. <div class="modal-content">
  249. <div class="modal-header">
  250. <h4 class="modal-title">Set Master Password</h4>
  251. <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
  252. </div>
  253. <form id="form_change_pwd" role="form" action="/web/database/change_password" method="post">
  254. <div class="modal-body">
  255. <p>The master password is required to create, delete, dump or restore databases.</p>
  256. {{ master_input() }}
  257. <div class="form-group">
  258. <label for="master_pwd_new" class="col-form-label">New Master Password</label>
  259. <div class="input-group">
  260. <input id="master_pwd_new" type="password" name="master_pwd_new" class="form-control" required="required" autocomplete="off"/>
  261. <div class="input-group-append">
  262. <span class="fa fa-eye o_little_eye input-group-text" aria-hidden="true" style="cursor: pointer;"></span>
  263. </div>
  264. </div>
  265. </div>
  266. </div>
  267. <div class="modal-footer">
  268. <input type="submit" value="Continue" class="btn btn-primary float-right"/>
  269. </div>
  270. </form>
  271. </div>
  272. </div>
  273. </div>
  274. <!-- Duplicate DB -->
  275. <div class="modal fade o_database_duplicate" role="dialog">
  276. <div class="modal-dialog">
  277. <div class="modal-content">
  278. <div class="modal-header">
  279. <h4 class="modal-title">Duplicate Database</h4>
  280. <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
  281. </div>
  282. <form id="form-duplicate-db" role="form" action="/web/database/duplicate" method="post">
  283. <div class="modal-body">
  284. {{ master_input() }}
  285. <div class="form-group">
  286. <label for="name" class="col-form-label">Database Name</label>
  287. <input id="name" type="text" name="name" class="form-control" required="required" readonly="readonly"/>
  288. </div>
  289. <div class="form-group">
  290. <label for="new_name" class="col-form-label">New Name</label>
  291. <input id="new_name" type="text" name="new_name" class="form-control" required="required" pattern="{{ pattern }}" title="Only alphanumerical characters, underscore, hyphen and dot are allowed"/>
  292. </div>
  293. </div>
  294. <div class="modal-footer">
  295. <input type="submit" value="Continue" class="btn btn-primary float-right"/>
  296. </div>
  297. </form>
  298. </div>
  299. </div>
  300. </div>
  301. <!-- Drop DB -->
  302. <div class="modal fade o_database_delete" role="dialog">
  303. <div class="modal-dialog">
  304. <div class="modal-content">
  305. <div class="modal-header">
  306. <h4 class="modal-title">Delete Database</h4>
  307. <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
  308. </div>
  309. <form id="form_drop_db" role="form" action="/web/database/drop" method="post">
  310. <div class="modal-body">
  311. {{ master_input() }}
  312. <div class="form-group">
  313. <label for="name" class="col-form-label">Database</label>
  314. <input id="name" type="text" name="name" class="form-control" required="required" readonly="readonly"/>
  315. </div>
  316. </div>
  317. <div class="modal-footer">
  318. <input type="submit" value="Delete" class="btn btn-primary float-right"/>
  319. </div>
  320. </form>
  321. </div>
  322. </div>
  323. </div>
  324. <!-- Backup DB -->
  325. <div class="modal fade o_database_backup" role="dialog">
  326. <div class="modal-dialog">
  327. <div class="modal-content">
  328. <div class="modal-header">
  329. <h4 class="modal-title">Backup Database</h4>
  330. <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
  331. </div>
  332. <form id="form_backup_db" role="form" action="/web/database/backup" method="post">
  333. <div class="modal-body">
  334. {{ master_input() }}
  335. <div class="form-group">
  336. <label for="name" class="col-form-label">Database Name</label>
  337. <input id="name" type="text" name="name" class="form-control" required="required" readonly="readonly"/>
  338. </div>
  339. <div class="form-group">
  340. <label for="backup_format" class="col-form-label">Backup Format</label>
  341. <select id="backup_format" name="backup_format" class="form-control" required="required">
  342. <option value="zip">zip (includes filestore)</option>
  343. <option value="dump">pg_dump custom format (without filestore)</option>
  344. </select>
  345. </div>
  346. </div>
  347. <div class="modal-footer">
  348. <input type="submit" value="Backup" class="btn btn-primary float-right"/>
  349. </div>
  350. </form>
  351. </div>
  352. </div>
  353. </div>
  354. </body>
  355. </html>