template.php 46 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236
  1. {* <?php *}
  2. {*//set the doctype *}
  3. {if $browser_name == 'Internet Explorer'}
  4. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  5. {else}
  6. <!DOCTYPE html>
  7. {/if}
  8. <html xmlns='http://www.w3.org/1999/xhtml' xml:lang='en' lang='en'>
  9. <head>
  10. <meta charset='utf-8'>
  11. <meta http-equiv='Content-Type' content='text/html; charset=UTF-8'>
  12. <meta http-equiv='X-UA-Compatible' content='IE=edge'>
  13. <meta name='viewport' content='width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no' />
  14. <meta name="robots" content="noindex, nofollow, noarchive" />
  15. {*//external css files *}
  16. <link rel='stylesheet' type='text/css' href='{$project_path}/resources/bootstrap/css/bootstrap.min.css.php'>
  17. <link rel='stylesheet' type='text/css' href='{$project_path}/resources/bootstrap/css/bootstrap-tempusdominus.min.css.php'>
  18. <link rel='stylesheet' type='text/css' href='{$project_path}/resources/bootstrap/css/bootstrap-colorpicker.min.css.php'>
  19. <link rel='stylesheet' type='text/css' href='{$project_path}/resources/fontawesome/css/all.min.css.php'>
  20. <link rel='stylesheet' type='text/css' href='{$project_path}/themes/default/css.php'>
  21. {*//link to custom css file *}
  22. {if !empty($settings.theme.custom_css)}
  23. <link rel='stylesheet' type='text/css' href='{$settings.theme.custom_css}'>
  24. {/if}
  25. {*//set favorite icon *}
  26. <link rel='icon' href='{$settings.theme.favicon}'>
  27. {*//document title *}
  28. <title>{$document_title}</title>
  29. {*//remote javascript *}
  30. <script language='JavaScript' type='text/javascript' src='{$project_path}/resources/jquery/jquery.min.js.php'></script>
  31. <script language='JavaScript' type='text/javascript' src='{$project_path}/resources/jquery/jquery.autosize.input.js.php'></script>
  32. <script language='JavaScript' type='text/javascript' src='{$project_path}/resources/momentjs/moment-with-locales.min.js.php'></script>
  33. <script language='JavaScript' type='text/javascript' src='{$project_path}/resources/bootstrap/js/bootstrap.min.js.php'></script>
  34. <script language='JavaScript' type='text/javascript' src='{$project_path}/resources/bootstrap/js/bootstrap-tempusdominus.min.js.php'></script>
  35. <script language='JavaScript' type='text/javascript' src='{$project_path}/resources/bootstrap/js/bootstrap-colorpicker.min.js.php'></script>
  36. <script language='JavaScript' type='text/javascript' src='{$project_path}/resources/bootstrap/js/bootstrap-pwstrength.min.js.php'></script>
  37. <script language='JavaScript' type='text/javascript'>{literal}window.FontAwesomeConfig = { autoReplaceSvg: false }{/literal}</script>
  38. <script language='JavaScript' type='text/javascript' src='{$project_path}/resources/fontawesome/js/all.min.js.php' defer></script>
  39. {*//web font loader *}
  40. {if isset($settings.theme.font_loader) && $settings.theme.font_loader == 'true'}
  41. {if $settings.theme.font_retrieval != 'asynchronous'}
  42. <script language='JavaScript' type='text/javascript' src='//ajax.googleapis.com/ajax/libs/webfont/{$settings.theme.font_loader_version}/webfont.js'></script>
  43. {/if}
  44. <script language='JavaScript' type='text/javascript' src='{$project_path}/resources/fonts/web_font_loader.php?v={$settings.theme.font_loader_version}'></script>
  45. {/if}
  46. {*//local javascript *}
  47. <script language='JavaScript' type='text/javascript'>
  48. //message bar display
  49. {literal}
  50. function display_message(msg, mood, delay) {
  51. mood = mood !== undefined ? mood : 'default';
  52. delay = delay !== undefined ? delay : {/literal}{$settings.theme.message_delay}{literal};
  53. if (msg !== '') {
  54. var message_text = $(document.createElement('div'));
  55. message_text.addClass('message_text message_mood_'+mood);
  56. message_text.html(msg);
  57. message_text.on('click', function() {
  58. var object = $(this);
  59. object.clearQueue().finish();
  60. $('#message_container div').remove();
  61. $('#message_container').css({opacity: 0, 'height': 0}).css({'height': 'auto'});
  62. } );
  63. $('#message_container').append(message_text);
  64. message_text.css({'height': 'auto'}).animate({opacity: 1}, 250, function(){
  65. $('#message_container').delay(delay).animate({opacity: 0, 'height': 0}, 500, function() {
  66. $('#message_container div').remove();
  67. $('#message_container').animate({opacity: 1}, 300).css({'height': 'auto'});
  68. });
  69. });
  70. }
  71. }
  72. {/literal}
  73. {if $settings.theme.menu_style == 'side'}
  74. //side menu visibility toggle
  75. var menu_side_expand_timer;
  76. var menu_side_contract_timer;
  77. var menu_side_state_current = '{if $menu_side_state == 'hidden'}expanded{else}{$menu_side_state}{/if}';
  78. {literal}
  79. function menu_side_contract_start() {
  80. menu_side_contract_timer = setTimeout(function() {
  81. menu_side_contract();
  82. }, {/literal}{$settings.theme.menu_side_toggle_hover_delay_contract}{literal});
  83. }
  84. function menu_side_contract() {
  85. if (menu_side_state_current == 'expanded') {
  86. {/literal}
  87. {if $menu_side_state == 'hidden'}
  88. {literal}
  89. $('#menu_side_container').hide();
  90. {/literal}
  91. {else}
  92. {literal}
  93. $('.menu_side_sub').slideUp(180);
  94. $('.menu_side_item_title').hide();
  95. {/literal}
  96. {if $settings.theme.menu_brand_type == 'image' || $settings.theme.menu_brand_type == 'image_text' || $settings.theme.menu_brand_type == ''}
  97. {literal}
  98. $('#menu_brand_image_expanded').fadeOut(180, function() {
  99. $('#menu_brand_image_contracted').fadeIn(180);
  100. });
  101. {/literal}
  102. {else if $settings.theme.menu_brand_type == 'text'}
  103. {literal}
  104. $('.menu_brand_text').hide();
  105. {/literal}
  106. {/if}
  107. {literal}
  108. $('.menu_side_control_state').hide();
  109. $('.menu_side_item_main_sub_icons').hide();
  110. $('.sub_arrows').removeClass('{/literal}{$settings.theme.menu_side_item_main_sub_icon_contract}{literal}').addClass('{/literal}{$settings.theme.menu_side_item_main_sub_icon_expand}{literal}');
  111. $('#menu_side_container').animate({ width: '{/literal}{$settings.theme.menu_side_width_contracted}{literal}px' }, 180, function() {
  112. menu_side_state_current = 'contracted';
  113. });
  114. {/literal}
  115. {if $settings.theme.menu_side_toggle_body_width == 'shrink' || ($settings.theme.menu_side_state == 'expanded' && $settings.theme.menu_side_toggle_body_width == 'fixed')}
  116. {literal}
  117. if ($(window).width() >= 576) {
  118. $('#content_container').animate({ width: $(window).width() - {/literal}{$settings.theme.menu_side_width_contracted}{literal} }, 250);
  119. }
  120. {/literal}
  121. {/if}
  122. {literal}
  123. $('.menu_side_contract').hide();
  124. $('.menu_side_expand').show();
  125. if ($(window).width() < 576) {
  126. $('#menu_side_container').hide();
  127. }
  128. {/literal}
  129. {/if}
  130. {literal}
  131. }
  132. }
  133. function menu_side_expand_start() {
  134. menu_side_expand_timer = setTimeout(function() {
  135. menu_side_expand();
  136. }, {/literal}{$settings.theme.menu_side_toggle_hover_delay_expand}{literal});
  137. }
  138. function menu_side_expand() {
  139. {/literal}
  140. {if $menu_side_state == 'hidden'}
  141. {literal}
  142. $('.menu_side_contract').show();
  143. {/literal}
  144. {if $settings.theme.menu_brand_type == 'image' || $settings.theme.menu_brand_type == 'image_text' || $settings.theme.menu_brand_type == ''}
  145. {literal}
  146. $('#menu_brand_image_contracted').hide();
  147. $('#menu_brand_image_expanded').show();
  148. {/literal}
  149. {/if}
  150. {literal}
  151. $('.menu_side_control_state').show();
  152. $('.menu_brand_text').show();
  153. $('.menu_side_item_main_sub_icons').show();
  154. $('.menu_side_item_title').show();
  155. if ($(window).width() < 576) {
  156. $('#menu_side_container').width($(window).width());
  157. }
  158. $('#menu_side_container').show();
  159. {/literal}
  160. {else}
  161. {if $settings.theme.menu_brand_type == 'image' || $settings.theme.menu_brand_type == 'image_text' ||$settings.theme.menu_brand_type == ''}
  162. {literal}
  163. $('#menu_brand_image_contracted').fadeOut(180);
  164. {/literal}
  165. {/if}
  166. {literal}
  167. $('.menu_side_expand').hide();
  168. $('.menu_side_contract').show();
  169. $('#menu_side_container').show();
  170. var menu_side_container_width = $(window).width() < 576 ? $(window).width() : '{/literal}{$settings.theme.menu_side_width_expanded}{literal}px';
  171. $('#menu_side_container').animate({ width: menu_side_container_width }, 180, function() {
  172. {/literal}
  173. {if $settings.theme.menu_brand_type == 'image' || $settings.theme.menu_brand_type == 'image_text' || $settings.theme.menu_brand_type == ''}
  174. {literal}
  175. $('#menu_brand_image_expanded').fadeIn(180);
  176. {/literal}
  177. {/if}
  178. {literal}
  179. $('.menu_side_control_state').fadeIn(180);
  180. $('.menu_brand_text').fadeIn(180);
  181. $('.menu_side_item_main_sub_icons').fadeIn(180);
  182. $('.menu_side_item_title').fadeIn(180, function() {
  183. menu_side_state_current = 'expanded';
  184. });
  185. });
  186. {/literal}
  187. {if $settings.theme.menu_side_toggle_body_width == 'shrink' || ($settings.theme.menu_side_state == 'expanded' && $settings.theme.menu_side_toggle_body_width == 'fixed')}
  188. {literal}
  189. if ($(window).width() >= 576) {
  190. $('#content_container').animate({ width: $(window).width() - {/literal}{$settings.theme.menu_side_width_expanded}{literal} }, 250);
  191. }
  192. {/literal}
  193. {/if}
  194. {/if}
  195. {literal}
  196. }
  197. function menu_side_item_toggle(item_id) {
  198. $('#sub_arrow_'+item_id).toggleClass(['{/literal}{$settings.theme.menu_side_item_main_sub_icon_contract}{literal}','{/literal}{$settings.theme.menu_side_item_main_sub_icon_expand}{literal}']);
  199. $('.sub_arrows').not('#sub_arrow_'+item_id).removeClass('{/literal}{$settings.theme.menu_side_item_main_sub_icon_contract}{literal}').addClass('{/literal}{$settings.theme.menu_side_item_main_sub_icon_expand}{literal}');
  200. $('#sub_'+item_id).slideToggle(180, function() {
  201. {/literal}
  202. {if $settings.theme.menu_side_item_main_sub_close != 'manual'}
  203. {literal}
  204. if (!$(this).is(':hidden')) {
  205. $('.menu_side_sub').not($(this)).slideUp(180);
  206. }
  207. {/literal}
  208. {/if}
  209. {literal}
  210. });
  211. }
  212. {/literal}
  213. {/if}
  214. {literal}
  215. $(document).ready(function() {
  216. {/literal}
  217. {$messages}
  218. //message bar hide on hover
  219. {literal}
  220. $('#message_container').on('mouseenter',function() {
  221. $('#message_container div').remove();
  222. $('#message_container').css({opacity: 0, 'height': 0}).css({'height': 'auto'});
  223. });
  224. {/literal}
  225. //domain selector controls
  226. {if $domain_selector_enabled}
  227. {literal}
  228. $('.header_domain_selector_domain').on('click', function() { event.preventDefault(); show_domains(); });
  229. $('#domains_hide').on('click', function() { hide_domains(); });
  230. function show_domains() {
  231. $('#body_header_user_menu').fadeOut(200);
  232. search_domains('domains_list');
  233. $('#domains_visible').val(1);
  234. var scrollbar_width = (window.innerWidth - $(window).width()); //gold: only solution that worked with body { overflow:auto } (add -ms-overflow-style: scrollbar; to <body> style for ie 10+)
  235. if (scrollbar_width > 0) {
  236. $('body').css({'margin-right':scrollbar_width, 'overflow':'hidden'}); //disable body scroll bars
  237. $('.navbar').css('margin-right',scrollbar_width); //adjust navbar margin to compensate
  238. $('#domains_container').css('right',-scrollbar_width); //domain container right position to compensate
  239. }
  240. $('#domains_container').show();
  241. $('#domains_block').animate({marginRight: '+=300'}, 400, function() {
  242. $('#domains_search').trigger('focus');
  243. });
  244. }
  245. function hide_domains() {
  246. $('#domains_visible').val(0);
  247. $(document).ready(function() {
  248. $('#domains_block').animate({marginRight: '-=300'}, 400, function() {
  249. $('#domains_search').val('');
  250. $('.navbar').css('margin-right','0'); //restore navbar margin
  251. $('#domains_container').css('right','0'); //domain container right position
  252. $('#domains_container').hide();
  253. $('body').css({'margin-right':'0','overflow':'auto'}); //enable body scroll bars
  254. document.activeElement.blur();
  255. });
  256. });
  257. }
  258. {/literal}
  259. {/if}
  260. //keyboard shortcut scripts
  261. //key: [enter] - retain default behavior to submit form, when present - note: safari does not honor the first submit element when hiding it using 'display: none;' in the setAttribute method
  262. {if $settings.theme.keyboard_shortcut_submit_enabled}
  263. {literal}
  264. var action_bar_actions, first_form, first_submit, modal_input_class, modal_continue_button;
  265. action_bar_actions = document.querySelector('div#action_bar.action_bar > div.actions');
  266. first_form = document.querySelector('form#frm');
  267. if (action_bar_actions !== null) {
  268. if (first_form !== null) {
  269. first_submit = document.createElement('input');
  270. first_submit.type = 'submit';
  271. first_submit.id = 'default_submit';
  272. first_submit.setAttribute('style','position: absolute; left: -10000px; top: auto; width: 1px; height: 1px; overflow: hidden;');
  273. first_form.prepend(first_submit);
  274. window.addEventListener('keydown',function(e){
  275. modal_input_class = e.target.className;
  276. if (e.which == 13 && (e.target.tagName == 'INPUT' || e.target.tagName == 'SELECT')) {
  277. if (modal_input_class.includes('modal-input')) {
  278. e.preventDefault();
  279. modal_continue_button = document.getElementById(e.target.dataset.continue);
  280. if (modal_continue_button) { modal_continue_button.click(); }
  281. }
  282. else {
  283. if (typeof window.submit_form === 'function') { submit_form(); }
  284. else { document.getElementById('frm').submit(); }
  285. }
  286. }
  287. });
  288. }
  289. }
  290. {/literal}
  291. {/if}
  292. //common (used by delete and toggle)
  293. {if !empty($settings.theme.keyboard_shortcut_delete_enabled) || !empty($settings.theme.keyboard_shortcut_toggle_enabled)}
  294. var list_checkboxes;
  295. list_checkboxes = document.querySelectorAll('table.list tr.list-row td.checkbox input[type=checkbox]');
  296. {/if}
  297. //keyup event listener
  298. {literal}
  299. window.addEventListener('keyup', function(e) {
  300. {/literal}
  301. //key: [escape] - close modal window, if open, or toggle domain selector
  302. {literal}
  303. if (e.which == 27) {
  304. e.preventDefault();
  305. var modals, modal_visible, modal;
  306. modal_visible = false;
  307. modals = document.querySelectorAll('div.modal-window');
  308. if (modals.length !== 0) {
  309. for (var x = 0, max = modals.length; x < max; x++) {
  310. modal = document.getElementById(modals[x].id);
  311. if (window.getComputedStyle(modal).getPropertyValue('opacity') == 1) {
  312. modal_visible = true;
  313. }
  314. }
  315. }
  316. if (modal_visible) {
  317. modal_close();
  318. }
  319. {/literal}
  320. {if $domain_selector_enabled}
  321. {literal}
  322. else {
  323. if (document.getElementById('domains_visible').value == 0) {
  324. show_domains();
  325. }
  326. else {
  327. hide_domains();
  328. }
  329. }
  330. {/literal}
  331. {/if}
  332. {literal}
  333. }
  334. {/literal}
  335. //key: [insert], list: to add
  336. {if $settings.theme.keyboard_shortcut_add_enabled}
  337. {literal}
  338. if (e.which == 45 && !(e.target.tagName == 'INPUT' && e.target.type == 'text') && e.target.tagName != 'TEXTAREA') {
  339. e.preventDefault();
  340. var add_button;
  341. add_button = document.getElementById('btn_add');
  342. if (add_button === null || add_button === undefined) {
  343. add_button = document.querySelector('button[name=btn_add]');
  344. }
  345. if (add_button !== null) { add_button.click(); }
  346. }
  347. {/literal}
  348. {/if}
  349. //key: [delete], list: to delete checked, edit: to delete
  350. {if !empty($settings.theme.keyboard_shortcut_delete_enabled)}
  351. {literal}
  352. if (e.which == 46 && !(e.target.tagName == 'INPUT' && e.target.type == 'text') && e.target.tagName != 'TEXTAREA') {
  353. e.preventDefault();
  354. var delete_button;
  355. delete_button = document.querySelector('button[name=btn_delete]');
  356. if (delete_button === null || delete_button === undefined) {
  357. delete_button = document.getElementById('btn_delete');
  358. }
  359. if (delete_button !== null) { delete_button.click(); }
  360. }
  361. {/literal}
  362. {/if}
  363. //key: [space], list,edit:prevent default space key behavior when opening toggle confirmation (which would automatically *click* the focused continue button on key-up)
  364. {if $settings.theme.keyboard_shortcut_toggle_enabled}
  365. {literal}
  366. if (e.which == 32 && e.target.id == 'btn_toggle') {
  367. e.preventDefault();
  368. }
  369. {/literal}
  370. {/if}
  371. //keyup end
  372. {literal}
  373. });
  374. {/literal}
  375. //keydown event listener
  376. {literal}
  377. window.addEventListener('keydown', function(e) {
  378. {/literal}
  379. //key: [space], list: to toggle checked - note: for default [space] checkbox behavior (ie. toggle focused checkbox) include in the if statement: && !(e.target.tagName == 'INPUT' && e.target.type == 'checkbox')
  380. {if $settings.theme.keyboard_shortcut_toggle_enabled}
  381. {literal}
  382. if (e.which == 32 && !(e.target.tagName == 'INPUT' && e.target.type == 'text') && e.target.tagName != 'BUTTON' && !(e.target.tagName == 'INPUT' && e.target.type == 'button') && !(e.target.tagName == 'INPUT' && e.target.type == 'submit') && e.target.tagName != 'TEXTAREA' && list_checkboxes.length !== 0) {
  383. e.preventDefault();
  384. var toggle_button;
  385. toggle_button = document.querySelector('button[name=btn_toggle]');
  386. if (toggle_button === null || toggle_button === undefined) {
  387. toggle_button = document.getElementById('btn_toggle');
  388. }
  389. if (toggle_button !== null) { toggle_button.click(); }
  390. }
  391. {/literal}
  392. {/if}
  393. //key: [ctrl]+[a], list,edit: to check all
  394. {if $settings.theme.keyboard_shortcut_check_all_enabled}
  395. {literal}
  396. if ((((e.which == 97 || e.which == 65) && (e.ctrlKey || e.metaKey) && !e.shiftKey) || e.which == 19) && !(e.target.tagName == 'INPUT' && e.target.type == 'text') && e.target.tagName != 'TEXTAREA') {
  397. var all_checkboxes;
  398. all_checkboxes = document.querySelectorAll('table.list tr.list-header th.checkbox input[name=checkbox_all]');
  399. if (typeof all_checkboxes != 'object' || all_checkboxes.length == 0) {
  400. all_checkboxes = document.querySelectorAll('td.edit_delete_checkbox_all > span > input[name=checkbox_all]');
  401. }
  402. if (typeof all_checkboxes == 'object' && all_checkboxes.length > 0) {
  403. e.preventDefault();
  404. for (var x = 0, max = all_checkboxes.length; x < max; x++) {
  405. all_checkboxes[x].click();
  406. }
  407. }
  408. }
  409. {/literal}
  410. {/if}
  411. //key: [ctrl]+[s], edit: to save
  412. {if $settings.theme.keyboard_shortcut_save_enabled}
  413. {literal}
  414. if (((e.which == 115 || e.which == 83) && (e.ctrlKey || e.metaKey) && !e.shiftKey) || (e.which == 19)) {
  415. e.preventDefault();
  416. var save_button;
  417. save_button = document.getElementById('btn_save');
  418. if (save_button === null || save_button === undefined) {
  419. save_button = document.querySelector('button[name=btn_save]');
  420. }
  421. if (save_button !== null) { save_button.click(); }
  422. }
  423. {/literal}
  424. {/if}
  425. //key: [ctrl]+[c], list,edit: to copy
  426. {if $settings.theme.keyboard_shortcut_copy_enabled}
  427. {if $browser_name_short == 'Safari'} //emulate with detecting [c] only, as [command] and [control] keys are ignored when captured
  428. {literal}
  429. if (
  430. (e.which == 99 || e.which == 67) &&
  431. !(e.target.tagName == 'INPUT' && e.target.type == 'text') &&
  432. !(e.target.tagName == 'INPUT' && e.target.type == 'password') &&
  433. e.target.tagName != 'TEXTAREA'
  434. ) {
  435. {/literal}
  436. {else}
  437. {literal}
  438. if (
  439. (
  440. (
  441. (e.which == 99 || e.which == 67) &&
  442. (e.ctrlKey || e.metaKey) &&
  443. !e.shiftKey
  444. ) ||
  445. e.which == 19
  446. ) &&
  447. !(e.target.tagName == 'INPUT' && e.target.type == 'text') &&
  448. e.target.tagName != 'TEXTAREA'
  449. ) {
  450. {/literal}
  451. {/if}
  452. {literal}
  453. var current_selection, copy_button;
  454. current_selection = window.getSelection();
  455. if (current_selection === null || current_selection === undefined || current_selection.toString() == '') {
  456. e.preventDefault();
  457. copy_button = document.querySelector('button[name=btn_copy]');
  458. if (copy_button === null || copy_button === undefined) {
  459. copy_button = document.getElementById('btn_copy');
  460. }
  461. if (copy_button !== null) { copy_button.click(); }
  462. }
  463. }
  464. {/literal}
  465. {/if}
  466. //key: [left] / [right], audio playback: rewind / fast-forward
  467. {literal}
  468. if (
  469. e.which == 39 &&
  470. !(e.target.tagName == 'INPUT' && e.target.type == 'text') &&
  471. e.target.tagName != 'TEXTAREA'
  472. ) {
  473. recording_fast_forward();
  474. }
  475. if (
  476. e.which == 37 &&
  477. !(e.target.tagName == 'INPUT' && e.target.type == 'text') &&
  478. e.target.tagName != 'TEXTAREA'
  479. ) {
  480. recording_rewind();
  481. }
  482. {/literal}
  483. //keydown end
  484. {literal}
  485. });
  486. {/literal}
  487. //link list rows
  488. {literal}
  489. $('.tr_hover tr,.list tr').each(function(i,e) {
  490. $(e).children('td:not(.list_control_icon,.list_control_icons,.tr_link_void,.list-row > .no-link,.list-row > .checkbox,.list-row > .button,.list-row > .action-button)').on('click', function() {
  491. var href = $(this).closest('tr').attr('href');
  492. var target = $(this).closest('tr').attr('target');
  493. if (href) {
  494. if (target) { window.open(href, target); }
  495. else { window.location = href; }
  496. }
  497. });
  498. });
  499. {/literal}
  500. //autosize jquery autosize plugin on applicable input fields
  501. {literal}
  502. $('input[type=text].txt.auto-size,input[type=number].txt.auto-size,input[type=password].txt.auto-size,input[type=text].formfld.auto-size,input[type=number].formfld.auto-size,input[type=password].formfld.auto-size').autosizeInput();
  503. {/literal}
  504. //initialize bootstrap tempusdominus (calendar/datetime picker) plugin
  505. {literal}
  506. $(function() {
  507. //set defaults
  508. $.fn.datetimepicker.Constructor.Default = $.extend({}, $.fn.datetimepicker.Constructor.Default, {
  509. buttons: {
  510. showToday: true,
  511. showClear: true,
  512. showClose: true,
  513. },
  514. icons: {
  515. time: 'fa-solid fa-clock',
  516. date: 'fa-solid fa-calendar-days',
  517. up: 'fa-solid fa-arrow-up',
  518. down: 'fa-solid fa-arrow-down',
  519. previous: 'fa-solid fa-chevron-left',
  520. next: 'fa-solid fa-chevron-right',
  521. today: 'fa-solid fa-calendar-check',
  522. clear: 'fa-solid fa-trash',
  523. close: 'fa-solid fa-xmark',
  524. }
  525. });
  526. //define formatting of individual classes
  527. $('.datepicker').datetimepicker({ format: 'YYYY-MM-DD', });
  528. $('.datetimepicker').datetimepicker({ format: 'YYYY-MM-DD HH:mm', });
  529. $('.datetimepicker-future').datetimepicker({ format: 'YYYY-MM-DD HH:mm', minDate: new Date(), });
  530. $('.datetimesecpicker').datetimepicker({ format: 'YYYY-MM-DD HH:mm:ss', });
  531. });
  532. {/literal}
  533. //apply bootstrap colorpicker plugin
  534. {literal}
  535. $(function(){
  536. $('.colorpicker').colorpicker({
  537. align: 'left',
  538. customClass: 'colorpicker-2x',
  539. sliders: {
  540. saturation: {
  541. maxLeft: 200,
  542. maxTop: 200
  543. },
  544. hue: {
  545. maxTop: 200
  546. },
  547. alpha: {
  548. maxTop: 200
  549. }
  550. }
  551. });
  552. });
  553. {/literal}
  554. //apply bootstrap password strength plugin
  555. {literal}
  556. $('#password').pwstrength({
  557. common: {
  558. minChar: 8,
  559. usernameField: '#username',
  560. },
  561. //rules: { },
  562. ui: {
  563. colorClasses: ['danger', 'warning', 'warning', 'warning', 'success', 'success'], //weak,poor,normal,medium,good,strong
  564. progressBarMinPercentage: 15,
  565. showVerdicts: false,
  566. viewports: {
  567. progress: '#pwstrength_progress'
  568. }
  569. }
  570. });
  571. {/literal}
  572. //crossfade menu brand images (if hover version set)
  573. {if !empty($settings.theme.menu_brand_image) && !empty($settings.theme.menu_brand_image_hover) && isset($settings.theme.menu_style) && $settings.theme.menu_style != 'side'}
  574. {literal}
  575. $(function(){
  576. $('#menu_brand_image').on('mouseover',function(){
  577. $(this).fadeOut('fast', function(){
  578. $('#menu_brand_image_hover').fadeIn('fast');
  579. });
  580. });
  581. $('#menu_brand_image_hover').on('mouseout',function(){
  582. $(this).fadeOut('fast', function(){
  583. $('#menu_brand_image').fadeIn('fast');
  584. });
  585. });
  586. });
  587. {/literal}
  588. {/if}
  589. //generate resizeEnd event after window resize event finishes (used when side menu and on messages app)
  590. {literal}
  591. $(window).on('resize', function() {
  592. if (this.resizeTO) { clearTimeout(this.resizeTO); }
  593. this.resizeTO = setTimeout(function() { $(this).trigger('resizeEnd'); }, 180);
  594. });
  595. {/literal}
  596. //side menu: adjust content container width after window resize
  597. {if $settings.theme.menu_style == 'side'}
  598. {literal}
  599. $(window).on('resizeEnd', function() {
  600. if ($(window).width() < 576) {
  601. if (menu_side_state_current == 'contracted') {
  602. $('#menu_side_container').hide();
  603. }
  604. if (menu_side_state_current == 'expanded') {
  605. {/literal}
  606. {if $menu_side_state != 'hidden'}
  607. {literal}
  608. $('#menu_side_container').show();
  609. {/literal}
  610. {/if}
  611. {literal}
  612. $('#menu_side_container').animate({ width: $(window).width() }, 180);
  613. }
  614. $('#content_container').animate({ width: $(window).width() }, 100);
  615. }
  616. else {
  617. {/literal}
  618. {if $menu_side_state == 'hidden'}
  619. {literal}
  620. $('#menu_side_container').animate({ width: '{/literal}{$settings.theme.menu_side_width_expanded}{literal}px' }, 180);
  621. $('#content_container').animate({ width: $(window).width() }, 100);
  622. {/literal}
  623. {else}
  624. {literal}
  625. $('#menu_side_container').show();
  626. if (menu_side_state_current == 'expanded') {
  627. $('#menu_side_container').animate({ width: '{/literal}{$settings.theme.menu_side_width_expanded}{literal}px' }, 180, function() {
  628. $('#content_container').animate({ width: $(window).width() - $('#menu_side_container').width() }, 100);
  629. });
  630. }
  631. else {
  632. $('#content_container').animate({ width: $(window).width() - $('#menu_side_container').width() }, 100);
  633. }
  634. {/literal}
  635. {/if}
  636. {literal}
  637. }
  638. });
  639. {/literal}
  640. {/if}
  641. //side/fixed menu: hide an open user menu in the body header or menu on scroll
  642. {if $settings.theme.menu_style == 'side' || $settings.theme.menu_style == 'fixed' }
  643. {literal}
  644. $(window).on('scroll', function() {
  645. $('#body_header_user_menu').fadeOut(200);
  646. });
  647. $('div#main_content').on('click', function() {
  648. $('#body_header_user_menu').fadeOut(200);
  649. });
  650. {/literal}
  651. {/if}
  652. //create function to mimic toggling fade and slide at the same time
  653. {literal}
  654. (function($){
  655. $.fn.toggleFadeSlide = function(speed = 200, easing, callback){
  656. return this.animate({opacity: 'toggle', height: 'toggle'}, speed, easing, callback);
  657. };
  658. })(jQuery);
  659. {/literal}
  660. {literal}
  661. }); //document ready end
  662. {/literal}
  663. //audio playback functions
  664. {literal}
  665. var recording_audio, audio_clock, recording_id_playing;
  666. function recording_play(player_id, data, audio_type) {
  667. if (document.getElementById('recording_progress_bar_' + player_id)) {
  668. document.getElementById('recording_progress_bar_' + player_id).style.display='';
  669. }
  670. recording_audio = document.getElementById('recording_audio_' + player_id);
  671. if (recording_audio.paused) {
  672. {/literal}
  673. //create and load waveform image
  674. {if $settings.theme.audio_player_waveform_enabled == 'true'}
  675. {literal}
  676. //list playback
  677. if (document.getElementById('playback_progress_bar_background_' + player_id)) {
  678. // alert("waveform.php?id=" + player_id + (data !== undefined ? '&data=' + data : '') + (audio_type !== undefined ? '&type=' + audio_type : ''));
  679. document.getElementById('playback_progress_bar_background_' + player_id).style.backgroundImage = "linear-gradient(to bottom, rgba(0,0,0,0.10) 0%, transparent 20%), url('waveform.php?id=" + player_id + (data !== undefined ? '&data=' + data : '') + (audio_type !== undefined ? '&type=' + audio_type : '') + "')";
  680. }
  681. //form playback
  682. else if (document.getElementById('recording_progress_bar_' + player_id)) {
  683. // alert("waveform.php?id=" + player_id + (data !== undefined ? '&data=' + data : '') + (audio_type !== undefined ? '&type=' + audio_type : ''));
  684. document.getElementById('recording_progress_bar_' + player_id).style.backgroundImage = "linear-gradient(to bottom, rgba(0,0,0,0.10) 0%, transparent 20%), url('waveform.php?id=" + player_id + (data !== undefined ? '&data=' + data : '') + (audio_type !== undefined ? '&type=' + audio_type : '') + "')";
  685. }
  686. {/literal}
  687. {/if}
  688. {literal}
  689. recording_audio.volume = 1;
  690. recording_audio.play();
  691. recording_id_playing = player_id;
  692. document.getElementById('recording_button_' + player_id).innerHTML = "<span class='{/literal}{$settings.theme.button_icon_pause}{literal} fa-fw'></span>";
  693. audio_clock = setInterval(function () { update_progress(player_id); }, 20);
  694. $('[id*=recording_button]').not('[id*=recording_button_' + player_id + ']').html("<span class='{/literal}{$settings.theme.button_icon_play}{literal} fa-fw'></span>");
  695. $('[id*=recording_button_intro]').not('[id*=recording_button_' + player_id + ']').html("<span class='{/literal}{$settings.theme.button_icon_comment}{literal} fa-fw'></span>");
  696. $('[id*=recording_progress_bar]').not('[id*=recording_progress_bar_' + player_id + ']').css('display', 'none');
  697. $('audio').each(function(){
  698. if ($(this).get(0) != recording_audio) {
  699. $(this).get(0).pause(); //stop playing
  700. $(this).get(0).currentTime = 0; //reset time
  701. }
  702. });
  703. }
  704. else {
  705. recording_audio.pause();
  706. recording_id_playing = '';
  707. if (player_id.substring(0,6) == 'intro_') {
  708. document.getElementById('recording_button_' + player_id).innerHTML = "<span class='{/literal}{$settings.theme.button_icon_comment}{literal} fa-fw'></span>";
  709. }
  710. else {
  711. document.getElementById('recording_button_' + player_id).innerHTML = "<span class='{/literal}{$settings.theme.button_icon_play}{literal} fa-fw'></span>";
  712. }
  713. clearInterval(audio_clock);
  714. }
  715. }
  716. function recording_stop(player_id) {
  717. recording_reset(player_id);
  718. clearInterval(audio_clock);
  719. }
  720. function recording_reset(player_id) {
  721. recording_audio = document.getElementById('recording_audio_' + player_id);
  722. recording_audio.pause();
  723. recording_audio.currentTime = 0;
  724. if (document.getElementById('recording_progress_bar_' + player_id)) {
  725. document.getElementById('recording_progress_bar_' + player_id).style.display='none';
  726. }
  727. if (player_id.substring(0,6) == 'intro_') {
  728. document.getElementById('recording_button_' + player_id).innerHTML = "<span class='{/literal}{$settings.theme.button_icon_comment}{literal} fa-fw'></span>";
  729. }
  730. else {
  731. document.getElementById('recording_button_' + player_id).innerHTML = "<span class='{/literal}{$settings.theme.button_icon_play}{literal} fa-fw'></span>";
  732. }
  733. clearInterval(audio_clock);
  734. }
  735. function update_progress(player_id) {
  736. recording_audio = document.getElementById('recording_audio_' + player_id);
  737. var recording_progress = document.getElementById('recording_progress_' + player_id);
  738. var value = 0;
  739. if (recording_audio != null && recording_audio.currentTime > 0) {
  740. value = Number(((100 / recording_audio.duration) * recording_audio.currentTime).toFixed(1));
  741. }
  742. if (recording_progress) {
  743. recording_progress.style.marginLeft = value + '%';
  744. }
  745. // if (recording_audio != null && parseInt(recording_audio.duration) > 30) { //seconds
  746. // clearInterval(audio_clock);
  747. // }
  748. }
  749. function recording_fast_forward() {
  750. if (recording_audio) {
  751. recording_audio.currentTime += {/literal}{if !empty($settings.theme.audio_player_scrub_seconds) }{$settings.theme.audio_player_scrub_seconds}{else}2{/if}{literal};
  752. update_progress(recording_id_playing);
  753. }
  754. }
  755. function recording_rewind() {
  756. if (recording_audio) {
  757. recording_audio.currentTime -= {/literal}{if !empty($settings.theme.audio_player_scrub_seconds) }{$settings.theme.audio_player_scrub_seconds}{else}2{/if}{literal};
  758. update_progress(recording_id_playing);
  759. }
  760. }
  761. function recording_seek(event, player_id) {
  762. if (recording_audio) {
  763. if (document.getElementById('playback_progress_bar_background_' + player_id)) {
  764. audio_player = document.getElementById('playback_progress_bar_background_' + player_id);
  765. }
  766. else if (document.getElementById('recording_progress_bar_' + player_id)) {
  767. audio_player = document.getElementById('recording_progress_bar_' + player_id);
  768. }
  769. recording_audio.currentTime = (event.offsetX / audio_player.offsetWidth) * recording_audio.duration;
  770. update_progress(recording_id_playing);
  771. document.getElementById('recording_button_' + player_id).focus();
  772. }
  773. }
  774. {/literal}
  775. //handle action bar style on scroll
  776. {literal}
  777. window.addEventListener('scroll', function(){
  778. action_bar_scroll('action_bar', {/literal}{if $settings.theme.menu_style == 'side'}60{else}20{/if}{literal});
  779. }, false);
  780. function action_bar_scroll(action_bar_id, scroll_position, function_sticky, function_inline) {
  781. if (document.getElementById(action_bar_id)) {
  782. //sticky
  783. if (this.scrollY > scroll_position) {
  784. document.getElementById(action_bar_id).classList.add('scroll');
  785. if (typeof function_sticky === 'function') { function_sticky(); }
  786. }
  787. //inline
  788. if (this.scrollY < scroll_position) {
  789. document.getElementById(action_bar_id).classList.remove('scroll');
  790. if (typeof function_inline === 'function') { function_inline(); }
  791. }
  792. }
  793. }
  794. {/literal}
  795. //enable button class button
  796. {literal}
  797. function button_enable(button_id) {
  798. button = document.getElementById(button_id);
  799. button.disabled = false;
  800. button.classList.remove('disabled');
  801. if (button.parentElement.nodeName == 'A') {
  802. anchor = button.parentElement;
  803. anchor.classList.remove('disabled');
  804. anchor.setAttribute('onclick','');
  805. }
  806. }
  807. {/literal}
  808. //disable button class button
  809. {literal}
  810. function button_disable(button_id) {
  811. button = document.getElementById(button_id);
  812. button.disabled = true;
  813. button.classList.add('disabled');
  814. if (button.parentElement.nodeName == 'A') {
  815. anchor = button.parentElement;
  816. anchor.classList.add('disabled');
  817. anchor.setAttribute('onclick','return false;');
  818. }
  819. }
  820. {/literal}
  821. //checkbox on change
  822. {literal}
  823. function checkbox_on_change(checkbox) {
  824. checked = false;
  825. var inputs = document.getElementsByTagName('input');
  826. for (var i = 0, max = inputs.length; i < max; i++) {
  827. if (inputs[i].type === 'checkbox' && inputs[i].checked == true) {
  828. checked = true;
  829. break;
  830. }
  831. }
  832. btn_copy = document.getElementById("btn_copy");
  833. btn_toggle = document.getElementById("btn_toggle");
  834. btn_delete = document.getElementById("btn_delete");
  835. btn_download = document.getElementById("btn_download");
  836. btn_transcribe = document.getElementById("btn_transcribe");
  837. btn_resend = document.getElementById("btn_resend");
  838. if (checked == true) {
  839. if (btn_copy) { btn_copy.style.display = "inline"; }
  840. if (btn_toggle) { btn_toggle.style.display = "inline"; }
  841. if (btn_delete) { btn_delete.style.display = "inline"; }
  842. if (btn_download) { btn_download.style.display = "inline"; }
  843. if (btn_transcribe) { btn_transcribe.style.display = "inline"; }
  844. if (btn_resend) { btn_resend.style.display = "inline"; }
  845. }
  846. else {
  847. if (btn_copy) { btn_copy.style.display = "none"; }
  848. if (btn_toggle) { btn_toggle.style.display = "none"; }
  849. if (btn_delete) { btn_delete.style.display = "none"; }
  850. if (btn_download) { btn_download.style.display = "none"; }
  851. if (btn_transcribe) { btn_transcribe.style.display = "none"; }
  852. if (btn_resend) { btn_resend.style.display = "none"; }
  853. }
  854. }
  855. {/literal}
  856. //list page functions
  857. {literal}
  858. function list_all_toggle(modifier) {
  859. var checkboxes = (modifier !== undefined) ? document.getElementsByClassName('checkbox_'+modifier) : document.querySelectorAll("input[type='checkbox']");
  860. var checkbox_checked = document.getElementById('checkbox_all' + (modifier !== undefined ? '_'+modifier : '')).checked;
  861. for (var i = 0, max = checkboxes.length; i < max; i++) {
  862. checkboxes[i].checked = checkbox_checked;
  863. }
  864. if (document.getElementById('btn_check_all') && document.getElementById('btn_check_none')) {
  865. if (checkbox_checked) {
  866. document.getElementById('btn_check_all').style.display = 'none';
  867. document.getElementById('btn_check_none').style.display = '';
  868. }
  869. else {
  870. document.getElementById('btn_check_all').style.display = '';
  871. document.getElementById('btn_check_none').style.display = 'none';
  872. }
  873. }
  874. }
  875. function list_all_check() {
  876. var inputs = document.getElementsByTagName('input');
  877. document.getElementById('checkbox_all').checked;
  878. for (var i = 0, max = inputs.length; i < max; i++) {
  879. if (inputs[i].type === 'checkbox') {
  880. inputs[i].checked = true;
  881. }
  882. }
  883. }
  884. function list_self_check(checkbox_id) {
  885. var inputs = document.getElementsByTagName('input');
  886. for (var i = 0, max = inputs.length; i < max; i++) {
  887. if (inputs[i].type === 'checkbox' && inputs[i].name.search['enabled'] == -1) {
  888. inputs[i].checked = false;
  889. }
  890. }
  891. document.getElementById(checkbox_id).checked = true;
  892. }
  893. function list_action_set(action) {
  894. document.getElementById('action').value = action;
  895. }
  896. function list_form_submit(form_id) {
  897. document.getElementById(form_id).submit();
  898. }
  899. function list_search_reset() {
  900. document.getElementById('btn_reset').style.display = 'none';
  901. document.getElementById('btn_search').style.display = '';
  902. }
  903. {/literal}
  904. //edit page functions
  905. {literal}
  906. function edit_all_toggle(modifier) {
  907. var checkboxes = document.getElementsByClassName('checkbox_'+modifier);
  908. var checkbox_checked = document.getElementById('checkbox_all_'+modifier).checked;
  909. if (checkboxes.length > 0) {
  910. for (var i = 0; i < checkboxes.length; ++i) {
  911. checkboxes[i].checked = checkbox_checked;
  912. }
  913. if (document.getElementById('btn_delete')) {
  914. document.getElementById('btn_delete').value = checkbox_checked ? '' : 'delete';
  915. }
  916. }
  917. }
  918. function edit_delete_action(modifier) {
  919. var checkboxes = document.getElementsByClassName('chk_delete');
  920. if (document.getElementById('btn_delete') && checkboxes.length > 0) {
  921. var checkbox_checked = false;
  922. for (var i = 0; i < checkboxes.length; ++i) {
  923. if (checkboxes[i].checked) {
  924. checkbox_checked = true;
  925. }
  926. else {
  927. if (document.getElementById('checkbox_all'+(modifier !== undefined ? '_'+modifier : ''))) {
  928. document.getElementById('checkbox_all'+(modifier !== undefined ? '_'+modifier : '')).checked = false;
  929. }
  930. }
  931. }
  932. document.getElementById('btn_delete').value = checkbox_checked ? '' : 'delete';
  933. }
  934. }
  935. {/literal}
  936. //modal functions
  937. {literal}
  938. function modal_open(modal_id, focus_id) {
  939. var modal = document.getElementById(modal_id);
  940. modal.style.opacity = '1';
  941. modal.style.pointerEvents = 'auto';
  942. if (focus_id !== undefined) {
  943. document.getElementById(focus_id).focus();
  944. }
  945. }
  946. function modal_close() {
  947. var modals = document.getElementsByClassName('modal-window');
  948. if (modals.length > 0) {
  949. for (var m = 0; m < modals.length; ++m) {
  950. modals[m].style.opacity = '0';
  951. modals[m].style.pointerEvents = 'none';
  952. }
  953. }
  954. document.activeElement.blur();
  955. }
  956. {/literal}
  957. //misc functions
  958. {literal}
  959. function swap_display(a_id, b_id, display_value) {
  960. display_value = display_value !== undefined ? display_value : 'inline-block';
  961. a = document.getElementById(a_id);
  962. b = document.getElementById(b_id);
  963. if (window.getComputedStyle(a).display === 'none') {
  964. a.style.display = display_value;
  965. b.style.display = 'none';
  966. }
  967. else {
  968. a.style.display = 'none';
  969. b.style.display = display_value;
  970. }
  971. }
  972. function hide_password_fields() {
  973. var password_fields = document.querySelectorAll("input[type='password']");
  974. for (var p = 0, max = password_fields.length; p < max; p++) {
  975. password_fields[p].style.visibility = 'hidden';
  976. password_fields[p].type = 'text';
  977. }
  978. }
  979. window.addEventListener('beforeunload', function(e){
  980. hide_password_fields();
  981. });
  982. {/literal}
  983. {*//session timer *}
  984. {if !empty($session_timer)}
  985. {$session_timer}
  986. {/if}
  987. {*//domain selector *}
  988. function search_domains(element_id) {
  989. var xhttp = new XMLHttpRequest();
  990. xhttp.onreadystatechange = function() {
  991. //if (this.readyState == 4 && this.status == 200) {
  992. // document.getElementById(element_id).innerHTML = this.responseText;
  993. //}
  994. //remove current options
  995. document.getElementById(element_id).innerHTML = '';
  996. if (this.readyState == 4 && this.status == 200) {
  997. //create the json object from the response
  998. obj = JSON.parse(this.responseText);
  999. //update the domain count
  1000. document.getElementById('domain_count').innerText = '('+ obj.length +')';
  1001. //add new options from the json results
  1002. for (var i=0; i < obj.length; i++) {
  1003. //get the variables
  1004. domain_uuid = obj[i].domain_uuid;
  1005. domain_name = obj[i].domain_name;
  1006. if (obj[i].domain_description != null) {
  1007. // domain_description = DOMPurify.sanitize(obj[i].domain_description);
  1008. }
  1009. //create a div element
  1010. var div = document.createElement('div');
  1011. //add a div title
  1012. div.title = obj[i].domain_name;
  1013. //add a css class
  1014. div.classList.add("domains_list_item");
  1015. //alternate the background color
  1016. if(i%2==0) {
  1017. div.style.background = '{$domain_selector_background_color_1}';
  1018. }
  1019. else {
  1020. div.style.background = '{$domain_selector_background_color_2}';
  1021. }
  1022. //set the active domain style
  1023. if ('{$domain_uuid}' == obj[i].domain_uuid) {
  1024. div.style.background = '{$domain_active_background_color}';
  1025. div.style.fontWeight = 'bold';
  1026. //div.classList.add("domains_list_item_active");
  1027. //var item_description_class = 'domain_active_list_item_description';
  1028. }
  1029. else {
  1030. //div.classList.add("domains_list_item_inactive");
  1031. //var item_description_class = 'domain_inactive_list_item_description';
  1032. }
  1033. //set link on domain div in list
  1034. div.setAttribute('onclick',"window.location.href='{$domains_app_path}?domain_uuid=" + obj[i].domain_uuid + "&domain_change=true';");
  1035. //define domain link text and description (if any)
  1036. link_label = obj[i].domain_name;
  1037. if (obj[i].domain_description != null) {
  1038. link_label += " <span class='domain_list_item_description' title=\"" + obj[i].domain_description + "\">" + obj[i].domain_description + "</span>";
  1039. }
  1040. var a_tag = document.createElement('a');
  1041. a_tag.setAttribute('href','manage:'+obj[i].domain_name);
  1042. a_tag.setAttribute('onclick','event.preventDefault();');
  1043. a_tag.innerHTML = link_label;
  1044. div.appendChild(a_tag);
  1045. document.getElementById(element_id).appendChild(div);
  1046. }
  1047. }
  1048. };
  1049. search = document.getElementById('domains_search');
  1050. if (search.value) {
  1051. //xhttp.open("GET", "/core/domains/domain_list.php?search="+search.value, true);
  1052. xhttp.open("GET", "/core/domains/domain_json.php?search="+search.value+"&{$domain_json_token_name}={$domain_json_token_hash}", true);
  1053. }
  1054. else {
  1055. //xhttp.open("GET", "/core/domains/domain_list.php", true);
  1056. xhttp.open("GET", "/core/domains/domain_json.php?{$domain_json_token_name}={$domain_json_token_hash}", true);
  1057. }
  1058. xhttp.send();
  1059. }
  1060. {*//domain selector *}
  1061. </script>
  1062. </head>
  1063. <body>
  1064. {*//video background *}
  1065. {if !empty({$background_video})}
  1066. <video id="background-video" autoplay muted poster="" disablePictureInPicture="true" onloadstart="this.playbackRate = 1; this.pause();">
  1067. <source src="{$background_video}" type="video/mp4">
  1068. </video>
  1069. {/if}
  1070. {*//image background *}
  1071. <div id='background-image'></div>
  1072. {*//color background *}
  1073. <div id='background-color'></div>
  1074. {*//message container *}
  1075. <div id='message_container'></div>
  1076. {*//domain selector *}
  1077. {if $authenticated && $domain_selector_enabled}
  1078. <div id='domains_container'>
  1079. <input type='hidden' id='domains_visible' value='0'>
  1080. <div id='domains_block'>
  1081. <div id='domains_header'>
  1082. <input id='domains_hide' type='button' class='btn' style='float: right' value="{$text.theme_button_close}">
  1083. <a id='domains_title' href='{$domains_app_path}'>{$text.theme_title_domains} <span id='domain_count' style='font-size: 80%;'></span></a>
  1084. <br><br>
  1085. <input type='text' id='domains_search' class='formfld' style='margin-left: 0; min-width: 100%; width: 100%;' placeholder="{$text.theme_label_search}" onkeyup="search_domains('domains_list');">
  1086. </div>
  1087. <div id='domains_list'></div>
  1088. </div>
  1089. </div>
  1090. {/if}
  1091. {*//qr code container for contacts *}
  1092. <div id='qr_code_container' style='display: none;' onclick='$(this).fadeOut(400);'>
  1093. <table cellpadding='0' cellspacing='0' border='0' width='100%' height='100%'><tr><td align='center' valign='middle'>
  1094. <span id='qr_code' onclick="$('#qr_code_container').fadeOut(400);"></span>
  1095. </td></tr></table>
  1096. </div>
  1097. {*//login page *}
  1098. {if !empty($login_page)}
  1099. <div id='default_login'>
  1100. <a href='{$project_path}/'><img id='login_logo' style='width: {$login_logo_width}; height: {$login_logo_height};' src='{$login_logo_source}'></a><br />
  1101. {$document_body}
  1102. </div>
  1103. <div id='footer_login'>
  1104. <span class='footer'>{$settings.theme.footer}</span>
  1105. </div>
  1106. {*//other pages *}
  1107. {else}
  1108. {if $settings.theme.menu_style == 'side' || $settings.theme.menu_style == 'inline' || $settings.theme.menu_style == 'static'}
  1109. {$container_open}
  1110. {if $settings.theme.menu_style == 'inline'}{$logo}{/if}
  1111. {$menu}
  1112. {if $settings.theme.menu_style == 'inline' || $settings.theme.menu_style == 'static'}<br />{/if}
  1113. {if $settings.theme.menu_style == 'side'}<input type='hidden' id='menu_side_state_current' value='{if $menu_side_state == 'hidden'}expanded{else}{$menu_side_state}{/if}'>{/if}
  1114. {else} {*//default: fixed *}
  1115. {$menu}
  1116. {$container_open}
  1117. {/if}
  1118. <div id='main_content'>
  1119. {$document_body}
  1120. </div>
  1121. <div id='footer'>
  1122. <span class='footer'>{$settings.theme.footer}</span>
  1123. </div>
  1124. {$container_close}
  1125. {/if}
  1126. </body>
  1127. </html>