ajaxgetolddropmenu.html.php 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  1. <?php js::set('productID', $productID);?>
  2. <?php js::set('module', $module);?>
  3. <?php js::set('method', $method);?>
  4. <?php js::set('extra', $extra);?>
  5. <style>
  6. #tabContent {margin-top: 5px; z-index: 900; max-width: 220px}
  7. .productTree ul {list-style: none; margin: 0}
  8. .productTree .products>ul {padding-left: 7px;}
  9. .productTree .products>ul>li>div {display: flex; flex-flow: row nowrap; justify-content: flex-start; align-items: center;}
  10. .productTree .products>ul>li label {background: rgba(255,255,255,0.5); line-height: unset; color: #838a9d; border: 1px solid #d8d8d8; border-radius: 2px; padding: 1px 4px;}
  11. .productTree li a i.icon {font-size: 15px !important;}
  12. .productTree li a i.icon:before {min-width: 16px !important;}
  13. .productTree li .label {position: unset; margin-bottom: 0;}
  14. .productTree li>a, div.hide-in-search>a {display: block; padding: 2px 10px 2px 5px; overflow: hidden; line-height: 20px; text-overflow: ellipsis; white-space: nowrap; border-radius: 4px;}
  15. .productTree .tree li>.list-toggle {line-height: 24px;}
  16. .productTree .tree li.has-list.open:before {content: unset;}
  17. .productTree li>a, div.hide-in-search>a {display: block; padding: 2px 10px 2px 5px; overflow: hidden; line-height: 20px; text-overflow: ellipsis; white-space: nowrap; border-radius: 4px;}
  18. #swapper li>div.hide-in-search>a:focus, #swapper li>div.hide-in-search>a:hover {color: #838a9d; cursor: default;}
  19. #swapper li > a {margin-top: 4px; margin-bottom: 4px;}
  20. #swapper li>div.hide-in-search>a:focus, #swapper li>div.hide-in-search>a:hover {color: #838a9d; cursor: default;}
  21. #swapper li {padding-top: 0; padding-bottom: 0;}
  22. #swapper .tree li>.list-toggle {top: -1px;}
  23. #subHeader .tree ul {display: block;}
  24. div#closed {width: 90px; height: 25px; line-height: 25px; background-color: #ddd; color: #3c495c; text-align: center; margin-left: 15px; border-radius: 2px;}
  25. #gray-line {width: 230px; height: 1px; margin-left: 10px; margin-bottom:2px; background-color: #ddd;}
  26. #swapper li >.selected {color: #0c64eb!important;background: #e9f2fb!important;}
  27. #dropMenu .col-footer .selected{color: #2e7fff!important;background: #e6f0ff!important; padding: 1px 10px;border-radius: 4px;}
  28. #dropMenu .col-left {padding-bottom: 5px;}
  29. </style>
  30. <?php
  31. $productCounts = array();
  32. $productNames = array();
  33. $normalProductsHtml = array();
  34. foreach($products as $programID => $programProducts)
  35. {
  36. $productCounts[$programID]['normal'] = 0;
  37. foreach($programProducts as $product)
  38. {
  39. $productCounts[$programID]['normal'] ++;
  40. $productNames[] = $product->name;
  41. }
  42. }
  43. $productsPinYin = common::convert2Pinyin($productNames);
  44. $normalProductsHtml = $config->systemMode == 'ALM' ? '<ul class="tree tree-angles" data-ride="tree">' : '<ul class="noProgram">';
  45. $allProductlink = $module == 'ticket' ? helper::createLink('ticket', 'browse', 'browseType=byProduct&param=all') : helper::createLink('feedback', 'admin', 'browseType=byProduct&param=all');
  46. if($this->config->vision == 'lite' and $module != 'ticket') $allProductlink = helper::createLink('feedback', 'browse', 'browseType=byProduct&param=all');
  47. $selected = $productID == 'all' ? 'selected' : '';
  48. $normalProductsHtml .= '<li>' . html::a($allProductlink, $lang->product->allProduct, '', "class='$selected clickable' title='{$lang->product->allProduct}'") . '</li>';
  49. foreach($products as $programID => $programProducts)
  50. {
  51. /* Add the program name before project. */
  52. if($programID and $config->systemMode == 'ALM')
  53. {
  54. $programName = zget($programs, $programID);
  55. if($productCounts[$programID]['normal']) $normalProductsHtml .= '<li><div class="hide-in-search"><a class="text-muted not-list-item" title="' . $programName . '">' . $programName . '</a> <label class="label">' . $lang->program->common . '</label></div><ul>';
  56. }
  57. foreach($programProducts as $index => $product)
  58. {
  59. $selected = $product->id == $productID ? 'selected' : '';
  60. $productName = ($config->systemMode == 'ALM' and $product->line) ? zget($lines, $product->line, '') . ' / ' . $product->name : $product->name;
  61. $linkHtml = $this->product->setParamsForLink($module, $link, $projectID, $product->id);
  62. $locateTab = ($module == 'testtask' and $method == 'browseUnits' and $app->tab == 'project') ? '' : "data-app='$app->tab'";
  63. $normalProductsHtml .= '<li>' . html::a($linkHtml, $productName, '', "class='$selected clickable' title='{$productName}' data-key='" . zget($productsPinYin, $product->name, '') . "' data-app='$app->tab'") . '</li>';
  64. /* If the programID is greater than 0, the product is the last one in the program, print the closed label. */
  65. if($programID and !isset($programProducts[$index + 1]))
  66. {
  67. if($productCounts[$programID]['normal']) $normalProductsHtml .= '</ul></li>';
  68. }
  69. }
  70. }
  71. $normalProductsHtml .= '</ul>';
  72. ?>
  73. <div class="table-row">
  74. <div class="table-col col-left">
  75. <div class='list-group'>
  76. <div class="tab-content productTree" id="tabContent">
  77. <div class="tab-pane products active">
  78. <?php echo $normalProductsHtml;?>
  79. </div>
  80. </div>
  81. </div>
  82. </div>
  83. </div>
  84. <script>
  85. $(function()
  86. {
  87. scrollToSelected();
  88. $('#swapper [data-ride="tree"]').tree('expand');
  89. $('#swapper #dropMenu .search-box').on('onSearchChange', function(event, value)
  90. {
  91. if(value != '')
  92. {
  93. $('div.hide-in-search').siblings('i').addClass('hide-in-search');
  94. $('.nav-tabs li span').hide();
  95. }
  96. else
  97. {
  98. $('div.hide-in-search').siblings('i').removeClass('hide-in-search');
  99. $('li.has-list div.hide-in-search').removeClass('hidden');
  100. $('.nav-tabs li.active').find('span').show();
  101. }
  102. })
  103. })
  104. </script>