html.js 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657
  1. App.HTML.setTplKeys = function(tpl, o, empty)
  2. {
  3. var empty = empty || '';
  4. fb.log(empty);
  5. tpl.set(':source', $.toJSON(o).replace(/'/gi, "\\'"))
  6. $(o).each(function(i, object)
  7. {
  8. $.each(o, function(key)
  9. {
  10. var val = o[key];
  11. if (empty == true) {
  12. tpl.set(':' + key, val || '');
  13. }
  14. else {
  15. tpl.set(':' + key, val || '');
  16. }
  17. });
  18. });
  19. return tpl;
  20. }
  21. App.HTML.makeDatabases = function(databases)
  22. {
  23. var acc = [];
  24. $(databases).each(function(i, o)
  25. {
  26. var tpl = App.Templates.get('database', 'database');
  27. tpl.set(':name', o.Database);
  28. tpl.set(':db_name', o.Database);
  29. acc[acc.length++] = tpl.finalize();
  30. });
  31. return acc.done();
  32. }
  33. App.HTML.makeDbTableList = function(data)
  34. {
  35. var acc = [];
  36. $(data).each(function(i, o)
  37. {
  38. var name = App.Helpers.getFirstValue(o);
  39. var tpl = App.Templates.get('database_table', 'database');
  40. tpl.set(':name', name);
  41. tpl.set(':table_name', name);
  42. acc[acc.length++] = tpl.finalize();
  43. });
  44. return acc.done();
  45. }
  46. App.HTML.makeDbFieldsList = function(data)
  47. {
  48. var acc = [];
  49. $(data).each(function(i, o)
  50. {
  51. var details = [o['Type'], o['Null'], o['Key'], o['Default'], o['Extra']].join(' ');
  52. var tpl = App.Templates.get('database_field', 'database');
  53. tpl.set(':name', o.Field);
  54. tpl.set(':details', details);
  55. acc[acc.length++] = tpl.finalize();
  56. });
  57. return acc.done();
  58. }
  59. App.HTML.Build.dns_form = function(options, id)
  60. {
  61. if('undefined' == typeof App.Env.initialParams) {
  62. return alert('PLease wait a bit. Some background processes are not yet executed. Thank you for patience.');
  63. }
  64. var tpl = App.Templates.get('FORM', 'dns');
  65. tpl.set(':source', options);
  66. options = App.Helpers.evalJSON(options) || {};
  67. if (App.Helpers.isEmpty(options)) {
  68. tpl.set(':title', 'New dns record');
  69. tpl.set(':save_button', 'ADD');
  70. }
  71. else {
  72. tpl.set(':title', 'Edit dns record');
  73. tpl.set(':save_button', 'SAVE');
  74. }
  75. tpl.set(':id', id || '');
  76. tpl.set(':DNS_DOMAIN', options.DNS_DOMAIN || '');
  77. tpl.set(':IP', options.IP || '');
  78. tpl.set(':TTL', options.TTL || '');
  79. tpl.set(':SOA', options.SOA || '');
  80. tpl.set(':DATE', options.DATE || '');
  81. tpl = App.HTML.Build.dns_selects(tpl, options);
  82. return tpl.finalize();
  83. }
  84. App.HTML.Build.ip_form = function(options, id)
  85. {try{
  86. if('undefined' == typeof App.Env.initialParams) {
  87. return alert('PLease wait a bit. Some background processes are not yet executed. Thank you for patience.');
  88. }
  89. var tpl = App.Templates.get('FORM', 'ip');
  90. tpl.set(':source', options);
  91. options = App.Helpers.evalJSON(options) || {};
  92. if (App.Helpers.isEmpty(options)) {
  93. tpl.set(':title', 'New ip address');
  94. tpl.set(':save_button', 'ADD');
  95. }
  96. else {
  97. tpl.set(':title', 'Edit ip address');
  98. tpl.set(':save_button', 'SAVE');
  99. }
  100. tpl.set(':id', id || '');
  101. tpl.set(':IP_ADDRESS', options.IP_ADDRESS || '');
  102. tpl.set(':NETMASK', options.NETMASK || '');
  103. tpl.set(':NAME', options.NAME || '');
  104. tpl = App.HTML.Build.ip_selects(tpl, options);
  105. }catch(e){fb.error(e);}
  106. return tpl.finalize();
  107. }
  108. App.HTML.Build.options = function(initial, default_value)
  109. {
  110. var opts = [];
  111. $.each(initial, function(key){
  112. var selected = key == default_value ? 'selected="selected"' : '';
  113. opts[opts.length++] = '<option value="'+key+'" '+selected+'>'+initial[key]+'</options>';
  114. });
  115. return opts.join('');
  116. }
  117. App.HTML.Build.ip_entry = function(o)
  118. {
  119. var tpl = App.Templates.get('ENTRY', 'ip');
  120. tpl = App.HTML.setTplKeys(tpl, o);
  121. /*if (App.Constants.SUSPENDED_YES == o.SUSPENDED) {
  122. var sub_tpl = App.Templates.get('SUSPENDED_TPL_ENABLED', 'ip');
  123. }
  124. else {
  125. var sub_tpl = App.Templates.get('SUSPENDED_TPL_DISABLED', 'ip');
  126. }*/
  127. tpl.set(':SUSPENDED_TPL', '');
  128. return tpl.finalize();
  129. }
  130. App.HTML.Build.dns_entry = function(o, is_new)
  131. {
  132. var tpl = App.Templates.get('ENTRY', 'dns');
  133. tpl = App.HTML.setTplKeys(tpl, o);
  134. var ip = o.IP.split('.');
  135. tpl.set(':IP', ip.join('<span class="dot">.</span>'));
  136. tpl.set(':CHECKED', '');
  137. if (is_new) {
  138. var now = new Date();
  139. tpl.set(':DATE', now.format("d.mm.yyyy"));
  140. }
  141. /*if (App.Constants.SUSPENDED_YES == o.SUSPEND) {
  142. var sub_tpl = App.Templates.get('SUSPENDED_TPL_NOT_SUSPENDED', 'general');
  143. }
  144. else {
  145. var sub_tpl = App.Templates.get('SUSPENDED_TPL_SUSPENDED', 'general');
  146. }*/
  147. tpl.set(':SUSPENDED_TPL', '');
  148. return tpl.finalize();
  149. }
  150. App.HTML.Build.user_entry = function(o, key)
  151. {
  152. var processed_data = {
  153. 'NICKNAME' : key,
  154. 'U_DISK_PERCENTAGE' : o.U_DISK > 0 ? o.U_DISK / o.DISK_QUOTA * 100 : 0.01,
  155. 'U_BANDWIDTH_PERCENTAGE': o.U_BANDWIDTH > 0 ? o.U_BANDWIDTH / o.BANDWIDTH * 100 : 0.01,
  156. 'DISK_QUOTA_MEASURE' : App.Helpers.getMbHumanMeasure(o.DISK_QUOTA),
  157. 'BANDWIDTH_MEASURE' : App.Helpers.getMbHumanMeasure(o.BANDWIDTH),
  158. 'BANDWIDTH' : App.Helpers.getMbHuman(o.BANDWIDTH),
  159. 'DISK_QUOTA' : App.Helpers.getMbHuman(o.DISK_QUOTA)
  160. };
  161. var o = $.extend(o, processed_data);
  162. var tpl = App.Templates.get('ENTRY', 'user');
  163. tpl = App.HTML.setTplKeys(tpl, o);
  164. tpl.set(':SUSPENDED_TPL', '');//sub_tpl.finalize());
  165. var ns = [];
  166. var ns_full = [];
  167. $([1,2,3,4,5,6,7,8]).each(function(i, index)
  168. {
  169. if (o['NS'+index].trim() != '') {
  170. var tpl_ns = App.Templates.get('NS_RECORD', 'user');
  171. tpl_ns.set(':NAME', o['NS'+index]);
  172. var tpl_finalized = tpl_ns.finalize();
  173. ns_full[ns_full.length++] = tpl_finalized;
  174. if (i < App.Settings.USER_VISIBLE_NS) {
  175. ns[ns.length++] = tpl_finalized;
  176. }
  177. }
  178. });
  179. if (ns_full.length <= App.Settings.USER_VISIBLE_NS) {
  180. tpl.set(':NS', ns.done());
  181. }
  182. else {
  183. var ns_custom = App.Templates.get('NS_MINIMIZED', 'user');
  184. ns_custom.set(':NS_MINI', ns.done());
  185. ns_custom.set(':NS_FULL', ns_full.done());
  186. ns_custom.set(':MORE_NUMBER', Math.abs(App.Settings.USER_VISIBLE_NS - ns_full.length));
  187. tpl.set(':NS', ns_custom.finalize());
  188. }
  189. tpl.set(':REPORTS_ENABLED', o.REPORTS_ENABLED == 'yes' ? 'enabled' : 'DISABLED');
  190. return tpl.finalize();
  191. }
  192. App.HTML.Build.user_form = function(options, id)
  193. {
  194. var in_edit = false;
  195. if (!App.Helpers.isEmpty(options)) {
  196. in_edit = true;
  197. }
  198. if('undefined' == typeof App.Env.initialParams) {
  199. return alert('Please wait a bit. Some background processes are not yet executed. Thank you for patience.');
  200. }
  201. var tpl = App.Templates.get('FORM', 'user');
  202. tpl.set(':source', options);
  203. tpl.set(':id', id || '');
  204. options = App.Helpers.evalJSON(options) || {};
  205. if (App.Helpers.isEmpty(options)) {
  206. tpl.set(':title', 'New user');
  207. tpl.set(':save_button', 'ADD');
  208. }
  209. else {
  210. tpl.set(':title', 'Edit user');
  211. tpl.set(':save_button', 'SAVE');
  212. }
  213. options = !App.Helpers.isEmpty(options) ? options : App.Empty.USER;
  214. // NS
  215. var ns = [];
  216. $([3,4,5,6,7,8]).each(function(i, index)
  217. {
  218. if (options['NS'+index].trim() != '') {
  219. var tpl_ns = App.Templates.get('NS_INPUT', 'user');
  220. tpl_ns.set(':NS_LABEL', 'NS #' + (index));
  221. tpl_ns.set(':NAME', options['NS'+index]);
  222. ns[ns.length++] = tpl_ns.finalize();
  223. }
  224. });
  225. ns[ns.length++] = App.Templates.get('PLUS_ONE_NS', 'user').finalize();
  226. tpl.set(':NS', ns.done());
  227. if (in_edit == true) {
  228. options.PASSWORD = App.Settings.PASSWORD_IMMUTE;
  229. }
  230. tpl = App.HTML.setTplKeys(tpl, options, true);
  231. tpl = App.HTML.Build.user_selects(tpl, options);
  232. if (options.REPORTS_ENABLED == 'yes') {
  233. tpl.set(':CHECKED', 'checked="checked"');
  234. }
  235. else {
  236. tpl.set(':CHECKED', '');
  237. }
  238. return tpl.finalize();
  239. }
  240. App.HTML.Build.web_domain_entry = function(o, key)
  241. {
  242. var processed_data = {
  243. DOMAIN: key
  244. };
  245. var o = $.extend(o, processed_data);
  246. var tpl = App.Templates.get('ENTRY', 'web_domain');
  247. tpl = App.HTML.setTplKeys(tpl, o);
  248. if (App.Constants.SUSPENDED_YES == o.SUSPEND) {
  249. var sub_tpl = App.Templates.get('SUSPENDED_TPL_SUSPENDED', 'general');
  250. }
  251. else {
  252. var sub_tpl = App.Templates.get('SUSPENDED_TPL_NOT_SUSPENDED', 'general');
  253. }
  254. tpl.set(':SUSPENDED_TPL', sub_tpl.finalize());
  255. if (o.STATS_LOGIN.trim() != '') {
  256. tpl.set(':STATS_AUTH', '+auth');
  257. }
  258. else {
  259. tpl.set(':STATS_AUTH', '');
  260. }
  261. return tpl.finalize();
  262. }
  263. App.HTML.Build.web_domain_form = function(options, id)
  264. {
  265. if('undefined' == typeof App.Env.initialParams) {
  266. return alert('PLease wait a bit. Some background processes are not yet executed. Thank you for patience.');
  267. }
  268. var in_edit = false;
  269. if (!App.Helpers.isEmpty(options)) {
  270. in_edit = true;
  271. }
  272. var tpl = App.Templates.get('FORM', 'web_domain');
  273. tpl.set(':source', options);
  274. tpl.set(':id', id || '');
  275. options = App.Helpers.evalJSON(options) || {};
  276. if (App.Helpers.isEmpty(options)) {
  277. tpl.set(':title', 'New WEB domain');
  278. tpl.set(':save_button', 'ADD');
  279. }
  280. else {
  281. tpl.set(':title', 'Edit WEB domain');
  282. tpl.set(':save_button', 'SAVE');
  283. }
  284. options = !App.Helpers.isEmpty(options) ? options : App.Empty.WEB_DOMAIN;
  285. if (in_edit == true) {
  286. options.STATS_PASSWORD = options.STATS_LOGIN.trim() != '' ? App.Settings.PASSWORD_IMMUTE : '';
  287. }
  288. tpl = App.HTML.setTplKeys(tpl, options, true);
  289. tpl = App.HTML.Build.web_domain_selects(tpl, options);
  290. if (options.CGI == 'yes') {
  291. tpl.set(':CHECKED_CGI', 'checked="checked"');
  292. }
  293. if (options.ELOG == 'yes') {
  294. tpl.set(':CHECKED_ELOG', 'checked="checked"');
  295. }
  296. if (options.STATS_LOGIN.trim() != '') {
  297. tpl.set(':STAT_AUTH', 'checked="checked"');
  298. tpl.set(':ACTIVE_LOGIN', '');
  299. tpl.set(':ACTIVE_PASSWORD', '');
  300. tpl.set(':stats_auth_checked', 'checked="checked"');
  301. }
  302. else {
  303. tpl.set(':ACTIVE_LOGIN', 'hidden');
  304. tpl.set(':ACTIVE_PASSWORD', 'hidden');
  305. tpl.set(':stats_auth_checked', '');
  306. }
  307. return tpl.finalize();
  308. }
  309. App.HTML.Build.mail_entry = function(o, key)
  310. {
  311. var processed_data = {
  312. DOMAIN: key
  313. };
  314. var o = $.extend(o, processed_data);
  315. var tpl = App.Templates.get('ENTRY', 'mail');
  316. tpl = App.HTML.setTplKeys(tpl, o);
  317. return tpl.finalize();
  318. }
  319. App.HTML.Build.db_entry = function(o, key)
  320. {
  321. var user_list_html = [];
  322. $(o['USERS']).each(function(i, o)
  323. {
  324. var tpl = App.Templates.get('USER_ITEM', 'db');
  325. tpl.set(':NAME', o);
  326. user_list_html.push(tpl.finalize());
  327. });
  328. var wrapper = App.Templates.get('USER_ITEMS_WRAPPER', 'db');
  329. wrapper.set(':CONTENT', user_list_html.done());
  330. var processed_data = {
  331. 'USER_LIST': wrapper.finalize(),
  332. 'USERS': o['USERS'].length || 0,
  333. 'U_DISK_PERCENTAGE' : o.U_DISK > 0 ? o.U_DISK / o.DISK * 100 : 0.01,
  334. 'DISK_MEASURE': App.Helpers.getMbHumanMeasure(o.DISK),
  335. 'DISK': App.Helpers.getMbHuman(o.DISK)
  336. };
  337. var o = $.extend(o, processed_data);
  338. var tpl = App.Templates.get('ENTRY', 'db');
  339. tpl = App.HTML.setTplKeys(tpl, o);
  340. return tpl.finalize();
  341. }
  342. App.HTML.Build.db_form = function(options, id)
  343. {
  344. var in_edit = false;
  345. if (!App.Helpers.isEmpty(options)) {
  346. in_edit = true;
  347. }
  348. if('undefined' == typeof App.Env.initialParams) {
  349. return alert('PLease wait a bit. Some background processes are not yet executed. Thank you for patience.');
  350. }
  351. var tpl = App.Templates.get('FORM', 'db');
  352. tpl.set(':source', options);
  353. tpl.set(':id', id || '');
  354. options = App.Helpers.evalJSON(options) || {};
  355. if (App.Helpers.isEmpty(options)) {
  356. tpl.set(':title', 'New database');
  357. tpl.set(':save_button', 'ADD');
  358. }
  359. else {
  360. tpl.set(':title', 'Edit database "'+options.DB+'"');
  361. tpl.set(':save_button', 'SAVE');
  362. }
  363. options = !App.Helpers.isEmpty(options) ? options : App.Empty.DB;
  364. if (in_edit == true) {
  365. options.PASSWORD = App.Settings.PASSWORD_IMMUTE;
  366. }
  367. tpl = App.HTML.setTplKeys(tpl, options, true);
  368. tpl = App.HTML.Build.db_selects(tpl, options);
  369. return tpl.finalize();
  370. }
  371. App.HTML.Build.cron_entry = function(o, key)
  372. {
  373. var processed_data = {
  374. DOMAIN: key
  375. };
  376. var o = $.extend(o, processed_data);
  377. var tpl = App.Templates.get('ENTRY', 'cron');
  378. tpl = App.HTML.setTplKeys(tpl, o);
  379. if (App.Constants.SUSPENDED_YES == o.SUSPENDED) {
  380. var sub_tpl = App.Templates.get('SUSPENDED_TPL_SUSPENDED', 'general');
  381. }
  382. else {
  383. var sub_tpl = App.Templates.get('SUSPENDED_TPL_NOT_SUSPENDED', 'general');
  384. }
  385. tpl.set(':SUSPENDED_TPL', sub_tpl.finalize());
  386. return tpl.finalize();
  387. }
  388. App.HTML.Build.cron_form = function(options, id)
  389. {try{
  390. if('undefined' == typeof App.Env.initialParams) {
  391. return alert('PLease wait a bit. Some background processes are not yet executed. Thank you for patience.');
  392. }
  393. var tpl = App.Templates.get('FORM', 'cron');
  394. tpl.set(':source', options);
  395. tpl.set(':id', id || '');
  396. options = App.Helpers.evalJSON(options) || {};
  397. if (App.Helpers.isEmpty(options)) {
  398. tpl.set(':title', 'New cron entry');
  399. tpl.set(':save_button', 'ADD');
  400. }
  401. else {
  402. tpl.set(':title', 'Edit cron entry');
  403. tpl.set(':save_button', 'SAVE');
  404. }
  405. options = !App.Helpers.isEmpty(options) ? options : {DAY:'', MONTH: '', WDAY:'',HOUR:'',CMD:'',MIN:''};
  406. tpl = App.HTML.setTplKeys(tpl, options);
  407. /*tpl.set(':id', id || '');
  408. tpl.set(':IP_ADDRESS', options.IP_ADDRESS || '');
  409. tpl.set(':NETMASK', options.NETMASK || '');
  410. tpl.set(':NAME', options.NAME || '');*/
  411. //tpl = App.HTML.Build.ip_selects(tpl, options);
  412. }catch(e){fb.error(e);}
  413. return tpl.finalize();
  414. }
  415. App.HTML.Build.dns_records = function(records)
  416. {
  417. var acc = [];
  418. $.each(records, function(i, record)
  419. {
  420. var record = records[i];
  421. var tpl = App.HTML.Build.dns_subrecord(record);
  422. acc[acc.length++] = tpl.finalize();
  423. });
  424. return acc.done();
  425. }
  426. App.HTML.Build.dns_subrecord = function(record)
  427. {
  428. var tpl = App.Templates.get('SUBENTRY', 'dns');
  429. tpl.set(':RECORD', record.RECORD || '');
  430. tpl.set(':RECORD_VALUE', record.RECORD_VALUE || '');
  431. tpl.set(':RECORD_ID', record.RECORD_ID || '');
  432. //tpl.set(':RECORD_TYPE_VALUE', '');
  433. tpl.set(':RECORD_TYPE', App.HTML.Build.options(App.Env.initialParams.DNS.record.RECORD_TYPE, (record.RECORD_TYPE || -1)));
  434. return tpl;
  435. }
  436. App.HTML.Build.ssl_key_file = function()
  437. {
  438. return '<iframe src="'+App.Helpers.getUploadUrl()+'?action=show&type=key" width="500px;" height="53px;" framevorder="0" scroll="no">..</iframe>';
  439. }
  440. App.HTML.Build.ssl_cert_file = function()
  441. {
  442. return '<iframe src="'+App.Helpers.getUploadUrl()+'?action=show&type=cert" width="500px;" height="53px;" framevorder="0" scroll="no">..</iframe>';
  443. }
  444. App.HTML.Build.user_selects = function(tpl, options)
  445. {
  446. var acc = [];
  447. // PACKAGE
  448. var pkg = App.Env.initialParams.USERS.PACKAGE;
  449. $.each(pkg, function(val)
  450. {
  451. var tpl = App.Templates.get('select_option', 'general');
  452. tpl.set(':VALUE', val);
  453. tpl.set(':TEXT', pkg[val]);
  454. tpl.set(':SELECTED', val == options.PACKAGE ? 'selected="selected"' : '');
  455. acc[acc.length++] = tpl.finalize();
  456. });
  457. tpl.set(':PACKAGE_OPTIONS', acc.done());
  458. // ROLE
  459. acc = [];
  460. var roles = App.Env.initialParams.USERS.ROLE;
  461. $.each(roles, function(val)
  462. {
  463. var tpl = App.Templates.get('select_option', 'general');
  464. tpl.set(':VALUE', val);
  465. tpl.set(':TEXT', roles[val]);
  466. tpl.set(':SELECTED', val == options.ROLE ? 'selected="selected"' : '');
  467. acc[acc.length++] = tpl.finalize();
  468. });
  469. tpl.set(':ROLE_OPTIONS', acc.done());
  470. // SHELL
  471. acc = [];
  472. var shell = App.Env.initialParams.USERS.SHELL;
  473. $.each(shell, function(val)
  474. {
  475. var tpl = App.Templates.get('select_option', 'general');
  476. tpl.set(':VALUE', val);
  477. tpl.set(':TEXT', shell[val]);
  478. tpl.set(':SELECTED', val == options.SHELL ? 'selected="selected"' : '');
  479. acc[acc.length++] = tpl.finalize();
  480. });
  481. tpl.set(':SHELL_OPTIONS', acc.done());
  482. return tpl;
  483. }
  484. App.HTML.Build.db_selects = function(tpl, options)
  485. {
  486. var acc = [];
  487. // PACKAGE
  488. var items = App.Env.initialParams.DB.TYPE;
  489. $.each(items, function(val)
  490. {
  491. var tpl = App.Templates.get('select_option', 'general');
  492. tpl.set(':VALUE', val);
  493. tpl.set(':TEXT', items[val]);
  494. tpl.set(':SELECTED', val == options.TYPE ? 'selected="selected"' : '');
  495. acc[acc.length++] = tpl.finalize();
  496. });
  497. tpl.set(':TYPE_OPTIONS', acc.done());
  498. // ROLE
  499. acc = [];
  500. var items = App.Env.initialParams.DB.HOST;
  501. $.each(items, function(val)
  502. {
  503. var tpl = App.Templates.get('select_option', 'general');
  504. tpl.set(':VALUE', val);
  505. tpl.set(':TEXT', items[val]);
  506. tpl.set(':SELECTED', val == options.HOST ? 'selected="selected"' : '');
  507. acc[acc.length++] = tpl.finalize();
  508. });
  509. tpl.set(':HOST_OPTIONS', acc.done());
  510. return tpl;
  511. }
  512. App.HTML.Build.ip_selects = function(tpl, options)
  513. {
  514. // OWNER
  515. var users = App.Env.initialParams.IP.OWNER;
  516. var opts = App.HTML.Build.options(users, options.OWNER);
  517. tpl.set(':owner_options', opts);
  518. // STATUS
  519. var opts = App.HTML.Build.options(App.Env.initialParams.IP.STATUSES, options.STATUS);
  520. tpl.set(':status_options', opts);
  521. // INTERFACE
  522. var opts = App.HTML.Build.options(App.Env.initialParams.IP.INTERFACES, options.INTERFACE);
  523. tpl.set(':interface_options', opts);
  524. return tpl;
  525. }
  526. App.HTML.Build.dns_selects = function(tpl, options)
  527. {
  528. try {
  529. // TPL
  530. var obj = App.Env.initialParams.DNS.TPL;
  531. var opts = App.HTML.Build.options(obj, options.TPL);
  532. tpl.set(':TPL', opts);
  533. tpl.set(':TPL_DEFAULT_VALUE', options.TPL || App.Helpers.getFirstKey(obj));
  534. }
  535. catch (e) {
  536. return tpl;
  537. }
  538. return tpl;
  539. }
  540. App.HTML.Build.web_domain_selects = function(tpl, options)
  541. {
  542. try {
  543. // IP
  544. var obj = App.Env.initialParams.WEB_DOMAIN.IP;
  545. var opts = App.HTML.Build.options(obj, options.IP);
  546. tpl.set(':IP_OPTIONS', opts);
  547. // TPL
  548. var obj = App.Env.initialParams.WEB_DOMAIN.TPL;
  549. var opts = App.HTML.Build.options(obj, options.TPL);
  550. tpl.set(':TPL_OPTIONS', opts);
  551. // TPL
  552. var obj = App.Env.initialParams.WEB_DOMAIN.STAT;
  553. var opts = App.HTML.Build.options(obj, options.STAT);
  554. tpl.set(':STAT_OPTIONS', opts);
  555. //<input type="checkbox" name="STATS" ~!:stats_checked~!="" value="~!:STATS~!" class="not-styled">\
  556. }
  557. catch (e) {
  558. return tpl;
  559. }
  560. return tpl;
  561. }