Subversion Repositories oidplus

Rev

Rev 1036 | View as "text/javascript" | Blame | Compare with Previous | Last modification | View Log | RSS feed

  1. /*
  2. * MIT License
  3. *
  4. * Copyright (c) 2022 Simon Tushev
  5. *
  6. * Permission is hereby granted, free of charge, to any person obtaining a copy
  7. * of this software and associated documentation files (the "Software"), to deal
  8. * in the Software without restriction, including without limitation the rights
  9. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  10. * copies of the Software, and to permit persons to whom the Software is
  11. * furnished to do so, subject to the following conditions:
  12. *
  13. * The above copyright notice and this permission notice shall be included in all
  14. * copies or substantial portions of the Software.
  15. *
  16. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  17. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  18. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  19. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  20. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  21. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  22. * SOFTWARE.
  23. */
  24.  
  25. oidplus_menu_width_uservalue = isNull(localStorage.getItem('menu_width'), oidplus_menu_width);
  26.  
  27. // This function will fire upon any page reload (both document.ready and AJAX page change)
  28. pageLoadedCallbacks.anyPageLoad.push(function() {
  29.         if (typeof uitweaks == "undefined") return; // is undefined for Setup
  30.         if (uitweaks.prefer_admin_login_tab) {
  31.                 $('#loginTab #myTab a[href="#admin"]').tab('show'); // Select tab by link
  32.         }
  33. });
  34.  
  35. // This function will fire upon document.ready event only, after the OIDplus base code
  36. pageLoadedCallbacks.documentReadyAfter.push(function () {
  37.         if (typeof uitweaks == "undefined") return; // is undefined for Setup
  38.  
  39.         var tree = $('#oidtree');
  40.         tree.on('ready.jstree', function (e, data) {
  41.                 var o  = isNull(uitweaks.expand_objects_tree , false);
  42.                 var l  = isNull(uitweaks.collapse_login_tree , false);
  43.                 var r  = isNull(uitweaks.collapse_res_tree   , false);
  44.  
  45.                 if (o) tree.jstree('open_all',  data.instance.get_node('oidplus:system'));
  46.                 if (l) tree.jstree('close_all', data.instance.get_node('oidplus:login'));
  47.                 if (r) tree.jstree('close_all', data.instance.get_node('oidplus:resources'));          
  48.         });
  49.  
  50.         var menu_remember_width = isNull(uitweaks.menu_remember_width, false);
  51.         if (menu_remember_width) {
  52.                 handle_glayout_onresize_start = function () {
  53.                         var new_width = parseInt($("#oidtree")[0].style.width, 10);
  54.                         localStorage.setItem('menu_width', new_width);
  55.                 }
  56.                 handle_glayout_onresize_start(); // to make sure that current value will be saved even if the user will not drag the bar
  57.         } else {
  58.                 localStorage.removeItem('menu_width');
  59.                 oidplus_menu_width_uservalue = oidplus_menu_width;
  60.         }
  61.  
  62. });
  63.