browse.excel.html.hook.php 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. <?php if(!empty($productID) && !($this->app->tab == 'project' && $storyType == 'requirement')):?>
  2. <?php
  3. $openModule = $this->app->rawModule == 'projectstory' ? 'project' : 'product';
  4. $linkHtml = "<div class='btn-group'><button type='button' class='btn btn-link' data-toggle='dropdown' id='importAction'><i class='icon icon-import muted'></i><span class='text'>{$lang->import}</span><span class='caret'></span></button><ul class='dropdown-menu pull-right' id='importActionMenu'>";
  5. if($this->app->tab == 'product')
  6. {
  7. $canImport = ((!empty($this->config->CRProduct) or $product->status != 'closed') and common::hasPriv('story', 'import'));
  8. $class = $canImport ? '' : "class='disabled'";
  9. $link = $canImport ? $this->createLink('story', 'import', "productID=$productID&branch=$branch&storyType=$storyType") : '#';
  10. $misc = $canImport ? "class='btn btn-link import' data-toggle='modal' data-type='iframe' data-app='$openModule'" : "class='disabled'";
  11. $linkHtml .= "<li $class>" . html::a($link, $lang->story->import, '', $misc) . "</li>";
  12. }
  13. if($this->app->tab == 'project')
  14. {
  15. $class = common::hasPriv('projectstory', 'importFromLib') ? '' : "class=disabled";
  16. $link = common::hasPriv('projectstory', 'importFromLib') ? $this->createLink('projectstory', 'importFromLib', "projectID=$projectID&productID=$productID&libID=0&storyType=$storyType") : '#';
  17. $misc = common::hasPriv('projectstory', 'importFromLib') ? "data-app='{$this->app->tab}'" : "class=disabled";
  18. $linkHtml .= "<li $class>" . html::a($link, $lang->projectstory->importFromLib, '', $misc) . "</li>";
  19. }
  20. $linkHtml .= "</ul></div>";
  21. $class = common::hasPriv('story', 'exportTemplate') ? '' : "class='disabled'";
  22. $link = common::hasPriv('story', 'exportTemplate') ? $this->createLink('story', 'exportTemplate', "productID=$productID&branch=$branch&storyType=$storyType") : '#';
  23. $misc = common::hasPriv('story', 'exportTemplate') ? "data-toggle='modal' data-type='iframe' class='exportTemplate' data-app='$openModule'" : "class='disabled'";
  24. $exportHtml = "<li $class>" . html::a($link, $lang->story->exportTemplate, '', $misc) . '</li>';
  25. ?>
  26. <script>
  27. $(function()
  28. {
  29. $('#exportActionMenu').closest('.btn-group').after(<?php echo json_encode($linkHtml)?>);
  30. $('#exportActionMenu').append(<?php echo json_encode($exportHtml)?>);
  31. $('.import').modalTrigger({width:650, type:'iframe'})
  32. $(".exportTemplate").modalTrigger({width:650, type:'iframe'});
  33. $('#exportActionMenu a.export').attr('href', createLink('story', 'export', "<?php echo "productID=$productID&orderBy=$orderBy&executionID=0&browseType=$browseType&storyType=$storyType";?>"));
  34. })
  35. </script>
  36. <?php endif;?>