common.js 2.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. function setAutoHeight()
  2. {
  3. var height = $(window).height() - 105;
  4. $('.auto-height').each(function()
  5. {
  6. var $this = $(this);
  7. var offset = $this.data('offset') || 0;
  8. $this.height(height - offset);
  9. if($this.hasClass('main-row'))
  10. {
  11. $this.find('.side-col>.cell,.main-col>.cell').height(height - 20 - offset);
  12. }
  13. });
  14. };
  15. function toggleBelong(belong)
  16. {
  17. if($('.belongBox').length == 0) return;
  18. let app = $('#app').val();
  19. $('.belongBox').addClass('hidden');
  20. if(!belongList[app]) return;
  21. $('#belong').val(belongList[app]['value']).attr('title', belongList[app]['text']);
  22. $('label[for=belong]').html(belongList[app]['text']);
  23. $('.belongBox').removeClass('hidden');
  24. if(typeof belong === 'undefined' || belong == belongList[app]['value'])
  25. {
  26. $('#belong').attr('checked', 'checked');
  27. }
  28. else
  29. {
  30. $('#belong').removeAttr('checked');
  31. }
  32. }
  33. $(function()
  34. {
  35. $('#navigator').change(function()
  36. {
  37. if(typeof positionModule === 'undefined') positionModule = '';
  38. if(typeof position === 'undefined') position = '';
  39. if(typeof flowApp === 'undefined') flowApp = '';
  40. if(typeof currentModule === 'undefined') currentModule = '';
  41. if($(this).val() == 'primary')
  42. {
  43. $('#app').closest('.appTR').addClass('hidden');
  44. $('select#positionModule').load(createLink('workflow', 'ajaxGetApps'), function()
  45. {
  46. let $positionModule = $('#positionModule');
  47. $positionModule.val(positionModule);
  48. if(flowApp) $positionModule.find('option[value=' + flowApp + ']').remove();
  49. $positionModule.trigger('chosen:updated');
  50. $('#position').val(position);
  51. });
  52. }
  53. if($(this).val() == 'secondary')
  54. {
  55. $('#app').closest('.appTR').removeClass('hidden');
  56. $('select#positionModule').load(createLink('workflow', 'ajaxGetAppMenus', 'app=' + $('#app').val() + '&exclude=' + currentModule), function()
  57. {
  58. $('#app').val(flowApp).trigger('chosen:updated');
  59. $('#positionModule').val(positionModule).trigger('chosen:updated');
  60. $('#position').val(position);
  61. });
  62. }
  63. $('.belongBox').addClass('hidden');
  64. });
  65. $('#app').change(function()
  66. {
  67. let $this = $(this);
  68. let app = $this.val();
  69. if($this.closest('.appTR').hasClass('hidden')) return;
  70. let positionModule = $('#positionModule').val();
  71. $('#positionModule').load(createLink('workflow', 'ajaxGetAppMenus', 'app=' + app + '&exclude=' + window.currentModule), function()
  72. {
  73. $('#positionModule').val(positionModule).trigger('chosen:updated');
  74. });
  75. if(typeof flowApp !== 'undefined' && flowApp == app) return toggleBelong(flowBelong);
  76. toggleBelong();
  77. });
  78. });