template.php 46 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232
  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/solid.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('fa-{/literal}{$settings.theme.menu_side_item_main_sub_icon_contract}{literal}').addClass('fa-{/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(['fa-{/literal}{$settings.theme.menu_side_item_main_sub_icon_contract}{literal}','fa-{/literal}{$settings.theme.menu_side_item_main_sub_icon_expand}{literal}']);
  199. $('.sub_arrows').not('#sub_arrow_'+item_id).removeClass('fa-{/literal}{$settings.theme.menu_side_item_main_sub_icon_contract}{literal}').addClass('fa-{/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. function menu_side_state_set(state) {
  213. var user_setting_set_path = '{/literal}{$project_path}{literal}/core/user_settings/user_setting_set.php?category=theme&subcategory=menu_side_state&name=text&value='+state;
  214. var xhr = new XMLHttpRequest();
  215. xhr.open('GET', user_setting_set_path);
  216. xhr.send(null);
  217. xhr.onreadystatechange = function () {
  218. var setting_modified;
  219. if (xhr.readyState === 4) {
  220. if (xhr.status === 200) {
  221. setting_modified = xhr.responseText;
  222. if (setting_modified == 'true') {
  223. document.getElementById('menu_side_state_set_expanded').style.display = state == 'expanded' ? 'none' : 'block';
  224. document.getElementById('menu_side_state_set_contracted').style.display = state == 'contracted' ? 'none' : 'block';
  225. {/literal}
  226. {if $menu_side_state == 'hidden'}
  227. {literal}
  228. document.getElementById('menu_side_state_hidden_button').style.display='none';
  229. {/literal}
  230. {/if}
  231. {literal}
  232. if (state == 'expanded') {
  233. if ($(window).width() >= 576) {
  234. $('#content_container').animate({ width: $(window).width() - {/literal}{$settings.theme.menu_side_width_expanded}{literal} }, 250);
  235. }
  236. else {
  237. $('#menu_side_container').animate({ width: $(window).width() }, 180);
  238. }
  239. document.getElementById('menu_side_state_current').value = 'expanded';
  240. display_message("{/literal}{$text.theme_message_menu_expanded}{literal}", 'positive', 1000);
  241. }
  242. else {
  243. menu_side_contract();
  244. if ($(window).width() >= 576) {
  245. $('#content_container').animate({ width: $(window).width() - {/literal}{$settings.theme.menu_side_width_contracted}{literal} }, 250);
  246. }
  247. menu_side_state_current = 'contracted';
  248. document.getElementById('menu_side_state_current').value = 'contracted';
  249. display_message("{/literal}{$text.theme_message_menu_contracted}{literal}", 'positive', 1000);
  250. }
  251. }
  252. else if (setting_modified == 'deleted') {
  253. display_message("{/literal}{$text.theme_message_menu_reset}{literal}", 'positive', 1000);
  254. document.location.reload();
  255. }
  256. }
  257. }
  258. }
  259. }
  260. {/literal}
  261. {/if}
  262. {literal}
  263. $(document).ready(function() {
  264. {/literal}
  265. {$messages}
  266. //message bar hide on hover
  267. {literal}
  268. $('#message_container').on('mouseenter',function() {
  269. $('#message_container div').remove();
  270. $('#message_container').css({opacity: 0, 'height': 0}).css({'height': 'auto'});
  271. });
  272. {/literal}
  273. //domain selector controls
  274. {if $domain_selector_enabled}
  275. {literal}
  276. $('.domain_selector_domain').on('click', function() { show_domains(); });
  277. $('#header_domain_selector_domain').on('click', function() { show_domains(); });
  278. $('#domains_hide').on('click', function() { hide_domains(); });
  279. function show_domains() {
  280. search_domains('domains_list');
  281. $('#domains_visible').val(1);
  282. 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+)
  283. if (scrollbar_width > 0) {
  284. $('body').css({'margin-right':scrollbar_width, 'overflow':'hidden'}); //disable body scroll bars
  285. $('.navbar').css('margin-right',scrollbar_width); //adjust navbar margin to compensate
  286. $('#domains_container').css('right',-scrollbar_width); //domain container right position to compensate
  287. }
  288. $(document).scrollTop(0);
  289. $('#domains_container').show();
  290. $('#domains_block').animate({marginRight: '+=300'}, 400, function() {
  291. $('#domains_search').trigger('focus');
  292. });
  293. }
  294. function hide_domains() {
  295. $('#domains_visible').val(0);
  296. $(document).ready(function() {
  297. $('#domains_block').animate({marginRight: '-=300'}, 400, function() {
  298. $('#domains_search').val('');
  299. $('.navbar').css('margin-right','0'); //restore navbar margin
  300. $('#domains_container').css('right','0'); //domain container right position
  301. $('#domains_container').hide();
  302. $('body').css({'margin-right':'0','overflow':'auto'}); //enable body scroll bars
  303. document.activeElement.blur();
  304. });
  305. });
  306. }
  307. {/literal}
  308. {/if}
  309. //keyboard shortcut scripts
  310. //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
  311. {if $settings.theme.keyboard_shortcut_submit_enabled}
  312. {literal}
  313. var action_bar_actions, first_form, first_submit, modal_input_class, modal_continue_button;
  314. action_bar_actions = document.querySelector('div#action_bar.action_bar > div.actions');
  315. first_form = document.querySelector('form#frm');
  316. if (action_bar_actions !== null) {
  317. if (first_form !== null) {
  318. first_submit = document.createElement('input');
  319. first_submit.type = 'submit';
  320. first_submit.id = 'default_submit';
  321. first_submit.setAttribute('style','position: absolute; left: -10000px; top: auto; width: 1px; height: 1px; overflow: hidden;');
  322. first_form.prepend(first_submit);
  323. window.addEventListener('keydown',function(e){
  324. modal_input_class = e.target.className;
  325. if (e.which == 13 && (e.target.tagName == 'INPUT' || e.target.tagName == 'SELECT')) {
  326. if (modal_input_class.includes('modal-input')) {
  327. e.preventDefault();
  328. modal_continue_button = document.getElementById(e.target.dataset.continue);
  329. if (modal_continue_button) { modal_continue_button.click(); }
  330. }
  331. else {
  332. if (typeof window.submit_form === 'function') { submit_form(); }
  333. else { document.getElementById('frm').submit(); }
  334. }
  335. }
  336. });
  337. }
  338. }
  339. {/literal}
  340. {/if}
  341. //common (used by delete and toggle)
  342. {if !empty($settings.theme.keyboard_shortcut_delete_enabled) || !empty($settings.theme.keyboard_shortcut_toggle_enabled)}
  343. var list_checkboxes;
  344. list_checkboxes = document.querySelectorAll('table.list tr.list-row td.checkbox input[type=checkbox]');
  345. {/if}
  346. //keyup event listener
  347. {literal}
  348. window.addEventListener('keyup', function(e) {
  349. {/literal}
  350. //key: [escape] - close modal window, if open, or toggle domain selector
  351. {literal}
  352. if (e.which == 27) {
  353. e.preventDefault();
  354. var modals, modal_visible, modal;
  355. modal_visible = false;
  356. modals = document.querySelectorAll('div.modal-window');
  357. if (modals.length !== 0) {
  358. for (var x = 0, max = modals.length; x < max; x++) {
  359. modal = document.getElementById(modals[x].id);
  360. if (window.getComputedStyle(modal).getPropertyValue('opacity') == 1) {
  361. modal_visible = true;
  362. }
  363. }
  364. }
  365. if (modal_visible) {
  366. modal_close();
  367. }
  368. {/literal}
  369. {if $domain_selector_enabled}
  370. {literal}
  371. else {
  372. if (document.getElementById('domains_visible').value == 0) {
  373. show_domains();
  374. }
  375. else {
  376. hide_domains();
  377. }
  378. }
  379. {/literal}
  380. {/if}
  381. {literal}
  382. }
  383. {/literal}
  384. //key: [insert], list: to add
  385. {if $settings.theme.keyboard_shortcut_add_enabled}
  386. {literal}
  387. if (e.which == 45 && !(e.target.tagName == 'INPUT' && e.target.type == 'text') && e.target.tagName != 'TEXTAREA') {
  388. e.preventDefault();
  389. var add_button;
  390. add_button = document.getElementById('btn_add');
  391. if (add_button === null || add_button === undefined) {
  392. add_button = document.querySelector('button[name=btn_add]');
  393. }
  394. if (add_button !== null) { add_button.click(); }
  395. }
  396. {/literal}
  397. {/if}
  398. //key: [delete], list: to delete checked, edit: to delete
  399. {if !empty($settings.theme.keyboard_shortcut_delete_enabled)}
  400. {literal}
  401. if (e.which == 46 && !(e.target.tagName == 'INPUT' && e.target.type == 'text') && e.target.tagName != 'TEXTAREA') {
  402. e.preventDefault();
  403. var delete_button;
  404. delete_button = document.querySelector('button[name=btn_delete]');
  405. if (delete_button === null || delete_button === undefined) {
  406. delete_button = document.getElementById('btn_delete');
  407. }
  408. if (delete_button !== null) { delete_button.click(); }
  409. }
  410. {/literal}
  411. {/if}
  412. //key: [space], list,edit:prevent default space key behavior when opening toggle confirmation (which would automatically *click* the focused continue button on key-up)
  413. {if $settings.theme.keyboard_shortcut_toggle_enabled}
  414. {literal}
  415. if (e.which == 32 && e.target.id == 'btn_toggle') {
  416. e.preventDefault();
  417. }
  418. {/literal}
  419. {/if}
  420. //keyup end
  421. {literal}
  422. });
  423. {/literal}
  424. //keydown event listener
  425. {literal}
  426. window.addEventListener('keydown', function(e) {
  427. {/literal}
  428. //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')
  429. {if $settings.theme.keyboard_shortcut_toggle_enabled}
  430. {literal}
  431. 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) {
  432. e.preventDefault();
  433. var toggle_button;
  434. toggle_button = document.querySelector('button[name=btn_toggle]');
  435. if (toggle_button === null || toggle_button === undefined) {
  436. toggle_button = document.getElementById('btn_toggle');
  437. }
  438. if (toggle_button !== null) { toggle_button.click(); }
  439. }
  440. {/literal}
  441. {/if}
  442. //key: [ctrl]+[a], list,edit: to check all
  443. {if $settings.theme.keyboard_shortcut_check_all_enabled}
  444. {literal}
  445. 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') {
  446. var all_checkboxes;
  447. all_checkboxes = document.querySelectorAll('table.list tr.list-header th.checkbox input[name=checkbox_all]');
  448. if (typeof all_checkboxes != 'object' || all_checkboxes.length == 0) {
  449. all_checkboxes = document.querySelectorAll('td.edit_delete_checkbox_all > span > input[name=checkbox_all]');
  450. }
  451. if (typeof all_checkboxes == 'object' && all_checkboxes.length > 0) {
  452. e.preventDefault();
  453. for (var x = 0, max = all_checkboxes.length; x < max; x++) {
  454. all_checkboxes[x].click();
  455. }
  456. }
  457. }
  458. {/literal}
  459. {/if}
  460. //key: [ctrl]+[s], edit: to save
  461. {if $settings.theme.keyboard_shortcut_save_enabled}
  462. {literal}
  463. if (((e.which == 115 || e.which == 83) && (e.ctrlKey || e.metaKey) && !e.shiftKey) || (e.which == 19)) {
  464. e.preventDefault();
  465. var save_button;
  466. save_button = document.getElementById('btn_save');
  467. if (save_button === null || save_button === undefined) {
  468. save_button = document.querySelector('button[name=btn_save]');
  469. }
  470. if (save_button !== null) { save_button.click(); }
  471. }
  472. {/literal}
  473. {/if}
  474. //key: [ctrl]+[c], list,edit: to copy
  475. {if $settings.theme.keyboard_shortcut_copy_enabled}
  476. {if $browser_name_short == 'Safari'} //emulate with detecting [c] only, as [command] and [control] keys are ignored when captured
  477. {literal}
  478. if (
  479. (e.which == 99 || e.which == 67) &&
  480. !(e.target.tagName == 'INPUT' && e.target.type == 'text') &&
  481. !(e.target.tagName == 'INPUT' && e.target.type == 'password') &&
  482. e.target.tagName != 'TEXTAREA'
  483. ) {
  484. {/literal}
  485. {else}
  486. {literal}
  487. if (
  488. (
  489. (
  490. (e.which == 99 || e.which == 67) &&
  491. (e.ctrlKey || e.metaKey) &&
  492. !e.shiftKey
  493. ) ||
  494. e.which == 19
  495. ) &&
  496. !(e.target.tagName == 'INPUT' && e.target.type == 'text') &&
  497. e.target.tagName != 'TEXTAREA'
  498. ) {
  499. {/literal}
  500. {/if}
  501. {literal}
  502. var current_selection, copy_button;
  503. current_selection = window.getSelection();
  504. if (current_selection === null || current_selection === undefined || current_selection.toString() == '') {
  505. e.preventDefault();
  506. copy_button = document.querySelector('button[name=btn_copy]');
  507. if (copy_button === null || copy_button === undefined) {
  508. copy_button = document.getElementById('btn_copy');
  509. }
  510. if (copy_button !== null) { copy_button.click(); }
  511. }
  512. }
  513. {/literal}
  514. {/if}
  515. //key: [left] / [right], audio playback: rewind / fast-forward
  516. {literal}
  517. if (
  518. e.which == 39 &&
  519. !(e.target.tagName == 'INPUT' && e.target.type == 'text') &&
  520. e.target.tagName != 'TEXTAREA'
  521. ) {
  522. recording_fast_forward();
  523. }
  524. if (
  525. e.which == 37 &&
  526. !(e.target.tagName == 'INPUT' && e.target.type == 'text') &&
  527. e.target.tagName != 'TEXTAREA'
  528. ) {
  529. recording_rewind();
  530. }
  531. {/literal}
  532. //keydown end
  533. {literal}
  534. });
  535. {/literal}
  536. //link list rows
  537. {literal}
  538. $('.tr_hover tr,.list tr').each(function(i,e) {
  539. $(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() {
  540. var href = $(this).closest('tr').attr('href');
  541. var target = $(this).closest('tr').attr('target');
  542. if (href) {
  543. if (target) { window.open(href, target); }
  544. else { window.location = href; }
  545. }
  546. });
  547. });
  548. {/literal}
  549. //autosize jquery autosize plugin on applicable input fields
  550. {literal}
  551. $('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();
  552. {/literal}
  553. //initialize bootstrap tempusdominus (calendar/datetime picker) plugin
  554. {literal}
  555. $(function() {
  556. //set defaults
  557. $.fn.datetimepicker.Constructor.Default = $.extend({}, $.fn.datetimepicker.Constructor.Default, {
  558. buttons: {
  559. showToday: true,
  560. showClear: true,
  561. showClose: true,
  562. },
  563. icons: {
  564. time: 'fas fa-clock',
  565. date: 'fas fa-calendar-alt',
  566. up: 'fas fa-arrow-up',
  567. down: 'fas fa-arrow-down',
  568. previous: 'fas fa-chevron-left',
  569. next: 'fas fa-chevron-right',
  570. today: 'fas fa-calendar-check',
  571. clear: 'fas fa-trash',
  572. close: 'fas fa-times',
  573. }
  574. });
  575. //define formatting of individual classes
  576. $('.datepicker').datetimepicker({ format: 'YYYY-MM-DD', });
  577. $('.datetimepicker').datetimepicker({ format: 'YYYY-MM-DD HH:mm', });
  578. $('.datetimepicker-future').datetimepicker({ format: 'YYYY-MM-DD HH:mm', minDate: new Date(), });
  579. $('.datetimesecpicker').datetimepicker({ format: 'YYYY-MM-DD HH:mm:ss', });
  580. });
  581. {/literal}
  582. //apply bootstrap colorpicker plugin
  583. {literal}
  584. $(function(){
  585. $('.colorpicker').colorpicker({
  586. align: 'left',
  587. customClass: 'colorpicker-2x',
  588. sliders: {
  589. saturation: {
  590. maxLeft: 200,
  591. maxTop: 200
  592. },
  593. hue: {
  594. maxTop: 200
  595. },
  596. alpha: {
  597. maxTop: 200
  598. }
  599. }
  600. });
  601. });
  602. {/literal}
  603. //apply bootstrap password strength plugin
  604. {literal}
  605. $('#password').pwstrength({
  606. common: {
  607. minChar: 8,
  608. usernameField: '#username',
  609. },
  610. //rules: { },
  611. ui: {
  612. colorClasses: ['danger', 'warning', 'warning', 'warning', 'success', 'success'], //weak,poor,normal,medium,good,strong
  613. progressBarMinPercentage: 15,
  614. showVerdicts: false,
  615. viewports: {
  616. progress: '#pwstrength_progress'
  617. }
  618. }
  619. });
  620. {/literal}
  621. //crossfade menu brand images (if hover version set)
  622. {if !empty($settings.theme.menu_brand_image) && !empty($settings.theme.menu_brand_image_hover) && isset($settings.theme.menu_style) && $settings.theme.menu_style != 'side'}
  623. {literal}
  624. $(function(){
  625. $('#menu_brand_image').on('mouseover',function(){
  626. $(this).fadeOut('fast', function(){
  627. $('#menu_brand_image_hover').fadeIn('fast');
  628. });
  629. });
  630. $('#menu_brand_image_hover').on('mouseout',function(){
  631. $(this).fadeOut('fast', function(){
  632. $('#menu_brand_image').fadeIn('fast');
  633. });
  634. });
  635. });
  636. {/literal}
  637. {/if}
  638. //generate resizeEnd event after window resize event finishes (used when side menu and on messages app)
  639. {literal}
  640. $(window).on('resize', function() {
  641. if (this.resizeTO) { clearTimeout(this.resizeTO); }
  642. this.resizeTO = setTimeout(function() { $(this).trigger('resizeEnd'); }, 180);
  643. });
  644. {/literal}
  645. //side menu: adjust content container width after window resize
  646. {if $settings.theme.menu_style == 'side'}
  647. {literal}
  648. $(window).on('resizeEnd', function() {
  649. if ($(window).width() < 576) {
  650. if (menu_side_state_current == 'contracted') {
  651. $('#menu_side_container').hide();
  652. }
  653. if (menu_side_state_current == 'expanded') {
  654. {/literal}
  655. {if $menu_side_state != 'hidden'}
  656. {literal}
  657. $('#menu_side_container').show();
  658. {/literal}
  659. {/if}
  660. {literal}
  661. $('#menu_side_container').animate({ width: $(window).width() }, 180);
  662. }
  663. $('#content_container').animate({ width: $(window).width() }, 100);
  664. }
  665. else {
  666. {/literal}
  667. {if $menu_side_state == 'hidden'}
  668. {literal}
  669. $('#menu_side_container').animate({ width: '{/literal}{$settings.theme.menu_side_width_expanded}{literal}px' }, 180);
  670. $('#content_container').animate({ width: $(window).width() }, 100);
  671. {/literal}
  672. {else}
  673. {literal}
  674. $('#menu_side_container').show();
  675. if (menu_side_state_current == 'expanded') {
  676. $('#menu_side_container').animate({ width: '{/literal}{$settings.theme.menu_side_width_expanded}{literal}px' }, 180, function() {
  677. $('#content_container').animate({ width: $(window).width() - $('#menu_side_container').width() }, 100);
  678. });
  679. }
  680. else {
  681. $('#content_container').animate({ width: $(window).width() - $('#menu_side_container').width() }, 100);
  682. }
  683. {/literal}
  684. {/if}
  685. {literal}
  686. }
  687. });
  688. {/literal}
  689. {/if}
  690. {literal}
  691. }); //document ready end
  692. {/literal}
  693. //audio playback functions
  694. {literal}
  695. var recording_audio, audio_clock, recording_id_playing;
  696. function recording_play(player_id, data, audio_type) {
  697. if (document.getElementById('recording_progress_bar_' + player_id)) {
  698. document.getElementById('recording_progress_bar_' + player_id).style.display='';
  699. }
  700. recording_audio = document.getElementById('recording_audio_' + player_id);
  701. if (recording_audio.paused) {
  702. {/literal}
  703. //create and load waveform image
  704. {if $settings.theme.audio_player_waveform_enabled == 'true'}
  705. {literal}
  706. //list playback
  707. if (document.getElementById('playback_progress_bar_background_' + player_id)) {
  708. // alert("waveform.php?id=" + player_id + (data !== undefined ? '&data=' + data : '') + (audio_type !== undefined ? '&type=' + audio_type : ''));
  709. 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 : '') + "')";
  710. }
  711. //form playback
  712. else if (document.getElementById('recording_progress_bar_' + player_id)) {
  713. // alert("waveform.php?id=" + player_id + (data !== undefined ? '&data=' + data : '') + (audio_type !== undefined ? '&type=' + audio_type : ''));
  714. 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 : '') + "')";
  715. }
  716. {/literal}
  717. {/if}
  718. {literal}
  719. recording_audio.volume = 1;
  720. recording_audio.play();
  721. recording_id_playing = player_id;
  722. document.getElementById('recording_button_' + player_id).innerHTML = "<span class='{/literal}{$settings.theme.button_icon_pause}{literal} fa-fw'></span>";
  723. audio_clock = setInterval(function () { update_progress(player_id); }, 20);
  724. $('[id*=recording_button]').not('[id*=recording_button_' + player_id + ']').html("<span class='{/literal}{$settings.theme.button_icon_play}{literal} fa-fw'></span>");
  725. $('[id*=recording_progress_bar]').not('[id*=recording_progress_bar_' + player_id + ']').css('display', 'none');
  726. $('audio').each(function(){
  727. if ($(this).get(0) != recording_audio) {
  728. $(this).get(0).pause(); //stop playing
  729. $(this).get(0).currentTime = 0; //reset time
  730. }
  731. });
  732. }
  733. else {
  734. recording_audio.pause();
  735. recording_id_playing = '';
  736. document.getElementById('recording_button_' + player_id).innerHTML = "<span class='{/literal}{$settings.theme.button_icon_play}{literal} fa-fw'></span>";
  737. clearInterval(audio_clock);
  738. }
  739. }
  740. function recording_stop(player_id) {
  741. recording_reset(player_id);
  742. clearInterval(audio_clock);
  743. }
  744. function recording_reset(player_id) {
  745. recording_audio = document.getElementById('recording_audio_' + player_id);
  746. recording_audio.pause();
  747. recording_audio.currentTime = 0;
  748. if (document.getElementById('recording_progress_bar_' + player_id)) {
  749. document.getElementById('recording_progress_bar_' + player_id).style.display='none';
  750. }
  751. document.getElementById('recording_button_' + player_id).innerHTML = "<span class='{/literal}{$settings.theme.button_icon_play}{literal} fa-fw'></span>";
  752. clearInterval(audio_clock);
  753. }
  754. function update_progress(player_id) {
  755. recording_audio = document.getElementById('recording_audio_' + player_id);
  756. var recording_progress = document.getElementById('recording_progress_' + player_id);
  757. var value = 0;
  758. if (recording_audio != null && recording_audio.currentTime > 0) {
  759. value = Number(((100 / recording_audio.duration) * recording_audio.currentTime).toFixed(1));
  760. }
  761. if (recording_progress) {
  762. recording_progress.style.marginLeft = value + '%';
  763. }
  764. if (recording_audio != null && parseInt(recording_audio.duration) > 30) { //seconds
  765. clearInterval(audio_clock);
  766. }
  767. }
  768. function recording_fast_forward() {
  769. if (recording_audio) {
  770. recording_audio.currentTime += {/literal}{if !empty($settings.theme.audio_player_scrub_seconds) }{$settings.theme.audio_player_scrub_seconds}{else}2{/if}{literal};
  771. update_progress(recording_id_playing);
  772. }
  773. }
  774. function recording_rewind() {
  775. if (recording_audio) {
  776. recording_audio.currentTime -= {/literal}{if !empty($settings.theme.audio_player_scrub_seconds) }{$settings.theme.audio_player_scrub_seconds}{else}2{/if}{literal};
  777. update_progress(recording_id_playing);
  778. }
  779. }
  780. {/literal}
  781. //handle action bar style on scroll
  782. {literal}
  783. window.addEventListener('scroll', function(){
  784. action_bar_scroll('action_bar', 20);
  785. }, false);
  786. function action_bar_scroll(action_bar_id, scroll_position, function_sticky, function_inline) {
  787. if (document.getElementById(action_bar_id)) {
  788. //sticky
  789. if (this.scrollY > scroll_position) {
  790. document.getElementById(action_bar_id).classList.add('scroll');
  791. if (typeof function_sticky === 'function') { function_sticky(); }
  792. }
  793. //inline
  794. if (this.scrollY < scroll_position) {
  795. document.getElementById(action_bar_id).classList.remove('scroll');
  796. if (typeof function_inline === 'function') { function_inline(); }
  797. }
  798. }
  799. }
  800. {/literal}
  801. //enable button class button
  802. {literal}
  803. function button_enable(button_id) {
  804. button = document.getElementById(button_id);
  805. button.disabled = false;
  806. button.classList.remove('disabled');
  807. if (button.parentElement.nodeName == 'A') {
  808. anchor = button.parentElement;
  809. anchor.classList.remove('disabled');
  810. anchor.setAttribute('onclick','');
  811. }
  812. }
  813. {/literal}
  814. //disable button class button
  815. {literal}
  816. function button_disable(button_id) {
  817. button = document.getElementById(button_id);
  818. button.disabled = true;
  819. button.classList.add('disabled');
  820. if (button.parentElement.nodeName == 'A') {
  821. anchor = button.parentElement;
  822. anchor.classList.add('disabled');
  823. anchor.setAttribute('onclick','return false;');
  824. }
  825. }
  826. {/literal}
  827. //checkbox on change
  828. {literal}
  829. function checkbox_on_change(checkbox) {
  830. checked = false;
  831. var inputs = document.getElementsByTagName('input');
  832. for (var i = 0, max = inputs.length; i < max; i++) {
  833. if (inputs[i].type === 'checkbox' && inputs[i].checked == true) {
  834. checked = true;
  835. break;
  836. }
  837. }
  838. btn_copy = document.getElementById("btn_copy");
  839. btn_toggle = document.getElementById("btn_toggle");
  840. btn_delete = document.getElementById("btn_delete");
  841. btn_download = document.getElementById("btn_download");
  842. btn_transcribe = document.getElementById("btn_transcribe");
  843. if (checked == true) {
  844. if (btn_copy) { btn_copy.style.display = "inline"; }
  845. if (btn_toggle) { btn_toggle.style.display = "inline"; }
  846. if (btn_delete) { btn_delete.style.display = "inline"; }
  847. if (btn_download) { btn_download.style.display = "inline"; }
  848. if (btn_transcribe) { btn_transcribe.style.display = "inline"; }
  849. }
  850. else {
  851. if (btn_copy) { btn_copy.style.display = "none"; }
  852. if (btn_toggle) { btn_toggle.style.display = "none"; }
  853. if (btn_delete) { btn_delete.style.display = "none"; }
  854. if (btn_download) { btn_download.style.display = "none"; }
  855. if (btn_transcribe) { btn_transcribe.style.display = "none"; }
  856. }
  857. }
  858. {/literal}
  859. //list page functions
  860. {literal}
  861. function list_all_toggle(modifier) {
  862. var checkboxes = (modifier !== undefined) ? document.getElementsByClassName('checkbox_'+modifier) : document.querySelectorAll("input[type='checkbox']");
  863. var checkbox_checked = document.getElementById('checkbox_all' + (modifier !== undefined ? '_'+modifier : '')).checked;
  864. for (var i = 0, max = checkboxes.length; i < max; i++) {
  865. checkboxes[i].checked = checkbox_checked;
  866. }
  867. if (document.getElementById('btn_check_all') && document.getElementById('btn_check_none')) {
  868. if (checkbox_checked) {
  869. document.getElementById('btn_check_all').style.display = 'none';
  870. document.getElementById('btn_check_none').style.display = '';
  871. }
  872. else {
  873. document.getElementById('btn_check_all').style.display = '';
  874. document.getElementById('btn_check_none').style.display = 'none';
  875. }
  876. }
  877. }
  878. function list_all_check() {
  879. var inputs = document.getElementsByTagName('input');
  880. document.getElementById('checkbox_all').checked;
  881. for (var i = 0, max = inputs.length; i < max; i++) {
  882. if (inputs[i].type === 'checkbox') {
  883. inputs[i].checked = true;
  884. }
  885. }
  886. }
  887. function list_self_check(checkbox_id) {
  888. var inputs = document.getElementsByTagName('input');
  889. for (var i = 0, max = inputs.length; i < max; i++) {
  890. if (inputs[i].type === 'checkbox' && inputs[i].name.search['enabled'] == -1) {
  891. inputs[i].checked = false;
  892. }
  893. }
  894. document.getElementById(checkbox_id).checked = true;
  895. }
  896. function list_action_set(action) {
  897. document.getElementById('action').value = action;
  898. }
  899. function list_form_submit(form_id) {
  900. document.getElementById(form_id).submit();
  901. }
  902. function list_search_reset() {
  903. document.getElementById('btn_reset').style.display = 'none';
  904. document.getElementById('btn_search').style.display = '';
  905. }
  906. {/literal}
  907. //edit page functions
  908. {literal}
  909. function edit_all_toggle(modifier) {
  910. var checkboxes = document.getElementsByClassName('checkbox_'+modifier);
  911. var checkbox_checked = document.getElementById('checkbox_all_'+modifier).checked;
  912. if (checkboxes.length > 0) {
  913. for (var i = 0; i < checkboxes.length; ++i) {
  914. checkboxes[i].checked = checkbox_checked;
  915. }
  916. if (document.getElementById('btn_delete')) {
  917. document.getElementById('btn_delete').value = checkbox_checked ? '' : 'delete';
  918. }
  919. }
  920. }
  921. function edit_delete_action(modifier) {
  922. var checkboxes = document.getElementsByClassName('chk_delete');
  923. if (document.getElementById('btn_delete') && checkboxes.length > 0) {
  924. var checkbox_checked = false;
  925. for (var i = 0; i < checkboxes.length; ++i) {
  926. if (checkboxes[i].checked) {
  927. checkbox_checked = true;
  928. }
  929. else {
  930. if (document.getElementById('checkbox_all'+(modifier !== undefined ? '_'+modifier : ''))) {
  931. document.getElementById('checkbox_all'+(modifier !== undefined ? '_'+modifier : '')).checked = false;
  932. }
  933. }
  934. }
  935. document.getElementById('btn_delete').value = checkbox_checked ? '' : 'delete';
  936. }
  937. }
  938. {/literal}
  939. //modal functions
  940. {literal}
  941. function modal_open(modal_id, focus_id) {
  942. var modal = document.getElementById(modal_id);
  943. modal.style.opacity = '1';
  944. modal.style.pointerEvents = 'auto';
  945. if (focus_id !== undefined) {
  946. document.getElementById(focus_id).focus();
  947. }
  948. }
  949. function modal_close() {
  950. var modals = document.getElementsByClassName('modal-window');
  951. if (modals.length > 0) {
  952. for (var m = 0; m < modals.length; ++m) {
  953. modals[m].style.opacity = '0';
  954. modals[m].style.pointerEvents = 'none';
  955. }
  956. }
  957. document.activeElement.blur();
  958. }
  959. {/literal}
  960. //misc functions
  961. {literal}
  962. function swap_display(a_id, b_id, display_value) {
  963. display_value = display_value !== undefined ? display_value : 'inline-block';
  964. a = document.getElementById(a_id);
  965. b = document.getElementById(b_id);
  966. if (window.getComputedStyle(a).display === 'none') {
  967. a.style.display = display_value;
  968. b.style.display = 'none';
  969. }
  970. else {
  971. a.style.display = 'none';
  972. b.style.display = display_value;
  973. }
  974. }
  975. function hide_password_fields() {
  976. var password_fields = document.querySelectorAll("input[type='password']");
  977. for (var p = 0, max = password_fields.length; p < max; p++) {
  978. password_fields[p].style.visibility = 'hidden';
  979. password_fields[p].type = 'text';
  980. }
  981. }
  982. window.addEventListener('beforeunload', function(e){
  983. hide_password_fields();
  984. });
  985. {/literal}
  986. {*//session timer *}
  987. {if !empty($session_timer)}
  988. {$session_timer}
  989. {/if}
  990. {*//domain selector *}
  991. function search_domains(element_id) {
  992. var xhttp = new XMLHttpRequest();
  993. xhttp.onreadystatechange = function() {
  994. //if (this.readyState == 4 && this.status == 200) {
  995. // document.getElementById(element_id).innerHTML = this.responseText;
  996. //}
  997. //remove current options
  998. document.getElementById(element_id).innerHTML = '';
  999. if (this.readyState == 4 && this.status == 200) {
  1000. //create the json object from the response
  1001. obj = JSON.parse(this.responseText);
  1002. //update the domain count
  1003. document.getElementById('domain_count').innerText = '('+ obj.length +')';
  1004. //add new options from the json results
  1005. for (var i=0; i < obj.length; i++) {
  1006. //get the variables
  1007. domain_uuid = obj[i].domain_uuid;
  1008. domain_name = obj[i].domain_name;
  1009. if (obj[i].domain_description != null) {
  1010. // domain_description = DOMPurify.sanitize(obj[i].domain_description);
  1011. }
  1012. //create a div element
  1013. var div = document.createElement('div');
  1014. //add a div title
  1015. div.title = obj[i].domain_name;
  1016. //add a css class
  1017. div.classList.add("domains_list_item");
  1018. //alternate the background color
  1019. if(i%2==0) {
  1020. div.style.background = '{$domain_selector_background_color_1}';
  1021. }
  1022. else {
  1023. div.style.background = '{$domain_selector_background_color_2}';
  1024. }
  1025. //set the active domain style
  1026. if ('{$domain_uuid}' == obj[i].domain_uuid) {
  1027. div.style.background = '{$domain_active_background_color}';
  1028. div.style.fontWeight = 'bold';
  1029. //div.classList.add("domains_list_item_active");
  1030. //var item_description_class = 'domain_active_list_item_description';
  1031. }
  1032. else {
  1033. //div.classList.add("domains_list_item_inactive");
  1034. //var item_description_class = 'domain_inactive_list_item_description';
  1035. }
  1036. //set link on domain div in list
  1037. div.setAttribute('onclick',"window.location.href='{$domains_app_path}?domain_uuid=" + obj[i].domain_uuid + "&domain_change=true';");
  1038. //define domain link text and description (if any)
  1039. link_label = obj[i].domain_name;
  1040. if (obj[i].domain_description != null) {
  1041. link_label += " <span class='domain_list_item_description' title=\"" + obj[i].domain_description + "\">" + obj[i].domain_description + "</span>";
  1042. }
  1043. var a_tag = document.createElement('a');
  1044. a_tag.setAttribute('href','manage:'+obj[i].domain_name);
  1045. a_tag.setAttribute('onclick','event.preventDefault();');
  1046. a_tag.innerHTML = link_label;
  1047. div.appendChild(a_tag);
  1048. document.getElementById(element_id).appendChild(div);
  1049. }
  1050. }
  1051. };
  1052. search = document.getElementById('domains_search');
  1053. if (search.value) {
  1054. //xhttp.open("GET", "/core/domains/domain_list.php?search="+search.value, true);
  1055. xhttp.open("GET", "/core/domains/domain_json.php?search="+search.value+"&{$domain_json_token_name}={$domain_json_token_hash}", true);
  1056. }
  1057. else {
  1058. //xhttp.open("GET", "/core/domains/domain_list.php", true);
  1059. xhttp.open("GET", "/core/domains/domain_json.php?{$domain_json_token_name}={$domain_json_token_hash}", true);
  1060. }
  1061. xhttp.send();
  1062. }
  1063. {*//domain selector *}
  1064. </script>
  1065. </head>
  1066. <body>
  1067. {*//video background *}
  1068. {if !empty($settings.theme.background_video)}
  1069. <video id="background-video" autoplay muted poster=" onloadstart="this.playbackRate = 1;">
  1070. <source src="{$settings.theme.background_video}" type="video/mp4">
  1071. </video>
  1072. {/if}
  1073. {*//message container *}
  1074. <div id='message_container'></div>
  1075. {*//domain selector *}
  1076. {if $authenticated && $domain_selector_enabled}
  1077. <div id='domains_container'>
  1078. <input type='hidden' id='domains_visible' value='0'>
  1079. <div id='domains_block'>
  1080. <div id='domains_header'>
  1081. <input id='domains_hide' type='button' class='btn' style='float: right' value="{$text.theme_button_close}">
  1082. <a id='domains_title' href='{$domains_app_path}'>{$text.theme_title_domains} <span id='domain_count' style='font-size: 80%;'></span></a>
  1083. <br><br>
  1084. <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');">
  1085. </div>
  1086. <div id='domains_list'></div>
  1087. </div>
  1088. </div>
  1089. {/if}
  1090. {*//qr code container for contacts *}
  1091. <div id='qr_code_container' style='display: none;' onclick='$(this).fadeOut(400);'>
  1092. <table cellpadding='0' cellspacing='0' border='0' width='100%' height='100%'><tr><td align='center' valign='middle'>
  1093. <span id='qr_code' onclick="$('#qr_code_container').fadeOut(400);"></span>
  1094. </td></tr></table>
  1095. </div>
  1096. {*//login page *}
  1097. {if !empty($login_page)}
  1098. <div id='default_login'>
  1099. <a href='{$project_path}/'><img id='login_logo' style='width: {$login_logo_width}; height: {$login_logo_height};' src='{$login_logo_source}'></a><br />
  1100. {$document_body}
  1101. </div>
  1102. <div id='footer_login'>
  1103. <span class='footer'>{$settings.theme.footer}</span>
  1104. </div>
  1105. {*//other pages *}
  1106. {else}
  1107. {if $settings.theme.menu_style == 'side' || $settings.theme.menu_style == 'inline' || $settings.theme.menu_style == 'static'}
  1108. {$container_open}
  1109. {if $settings.theme.menu_style == 'inline'}{$logo}{/if}
  1110. {$menu}
  1111. {if $settings.theme.menu_style == 'inline' || $settings.theme.menu_style == 'static'}<br />{/if}
  1112. {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}
  1113. {else} {*//default: fixed *}
  1114. {$menu}
  1115. {$container_open}
  1116. {/if}
  1117. <div id='main_content'>
  1118. {$document_body}
  1119. </div>
  1120. <div id='footer'>
  1121. <span class='footer'>{$settings.theme.footer}</span>
  1122. </div>
  1123. {$container_close}
  1124. {/if}
  1125. </body>
  1126. </html>