view.html.php 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  1. <?php
  2. /**
  3. * The create view file of repo module of ZenTaoPMS.
  4. *
  5. * @copyright Copyright 2009-2023 禅道软件(青岛)有限公司(ZenTao Software (Qingdao) Co., Ltd. www.cnezsoft.com)
  6. * @author Wang Yidong, Zhu Jinyong
  7. * @package repo
  8. * @version $Id: create.html.php $
  9. */
  10. ?>
  11. <?php
  12. include '../../common/view/header.html.php';
  13. include '../../common/view/form.html.php';
  14. include '../../common/view/kindeditor.html.php';
  15. css::import($jsRoot . 'misc/highlight/styles/code.css');
  16. js::import($jsRoot . 'misc/highlight/highlight.pack.js');
  17. $encodePath = $this->repo->encodePath($entry);
  18. $version = " <span class=\"label label-info\">$revisionName</span>";
  19. ?>
  20. <?php if(!isonlybody()):?>
  21. <div id='mainMenu' class='clearfix'>
  22. <div class='btn-toolbar pull-left'>
  23. <?php echo html::a($this->session->repoList, "<i class='icon icon-back icon-sm'></i> " . $lang->goback, '', "class='btn btn-secondary' data-app='{$app->tab}'");?>
  24. <div class="divider"></div>
  25. <div class="page-title">
  26. <strong>
  27. <?php
  28. $base64BranchID = helper::safe64Encode(base64_encode($branchID));
  29. echo html::a($this->repo->createLink('browse', "repoID=$repoID&branchID=$base64BranchID&objectID=$objectID"), $repo->name, '', "data-app='{$app->tab}'");
  30. $paths= explode('/', $entry);
  31. $fileName = array_pop($paths);
  32. $postPath = '';
  33. foreach($paths as $pathName)
  34. {
  35. $postPath .= $pathName . '/';
  36. echo '/' . ' ' . html::a($this->repo->createLink('browse', "repoID=$repoID&branchID=$base64BranchID&objectID=$objectID&path=" . $this->repo->encodePath($postPath)), trim($pathName, '/'), '', "data-app='{$app->tab}'");
  37. }
  38. echo '/' . ' ' . $fileName;
  39. echo $version;
  40. ?>
  41. </strong>
  42. </div>
  43. </div>
  44. <div class="btn-toolbar pull-right">
  45. <?php echo html::a($this->repo->createLink('revision', "repoID=$repoID&objectID=$objectID&revision=$revision"), $lang->repo->allChanges, '', "class='btn btn-primary' data-app='{$app->tab}'")?>
  46. </div>
  47. </div>
  48. <?php endif;?>
  49. <?php if(!isonlybody()):?>
  50. <div id="mainContent" class="main-row fade">
  51. <?php endif;?>
  52. <div class="main-col repoCode main">
  53. <div class="content panel">
  54. <div class='panel-heading'>
  55. <div class='btn-toolbar'>
  56. <div class='panel-title'>
  57. <?php echo $pathInfo['basename'];?>
  58. <div class='btn-group'>
  59. <div class='btn-group'>
  60. <?php echo html::commonButton(zget($lang->repo->encodingList, $encoding, $lang->repo->encoding) . "<span class='caret'></span>", "data-toggle='dropdown'", 'btn dropdown-toggle btn-sm')?>
  61. <ul class='dropdown-menu' role='menu'>
  62. <?php foreach($lang->repo->encodingList as $key => $val):?>
  63. <li><?php echo html::a($this->repo->createLink('view', "repoID=$repoID&objectID=$objectID&entry=$encodePath&revision=$revision&showBug=$showBug&encoding=$key", 'html', isonlybody()), $val, '', "data-app='{$app->tab}'")?></li>
  64. <?php endforeach;?>
  65. </ul>
  66. </div>
  67. </div>
  68. </div>
  69. </div>
  70. <div class='panel-actions'>
  71. <?php if($suffix != 'binary' and strpos($config->repo->images, "|$suffix|") === false):?>
  72. <?php
  73. if(common::hasPriv('repo', 'blame')) echo html::a($this->repo->createLink('blame', "repoID=$repoID&objectID=$objectID&entry=$encodePath&revision=$revision&encoding=$encoding"), html::icon('random') . $lang->repo->blame, '', "class='btn btn-sm btn-primary' data-app='{$app->tab}'");
  74. if(common::hasPriv('repo', 'download')) echo html::a($this->repo->createLink('download', "repoID=$repoID&path=$encodePath&fromRevision=$revision"), html::icon('download-alt') . $lang->repo->download, 'hiddenwin', "class='btn btn-sm btn-primary'");
  75. ?>
  76. <?php endif;?>
  77. </div>
  78. </div>
  79. <?php if(strpos($config->repo->images, "|$suffix|") !== false):?>
  80. <div class='image'><img src='data:image/<?php echo $suffix?>;base64,<?php echo $content?>' /></div>
  81. <?php elseif($suffix == 'binary'):?>
  82. <div class='binary'><?php echo html::a($this->repo->createLink('download', "repoID=$repoID&path=" . $this->repo->encodePath($entry) . "&fromRevision=$revision"), "<i class='icon-download'></i>", 'hiddenwin', "title='{$lang->repo->download}'"); ?></div>
  83. <?php else:?>
  84. <pre class="<?php echo $config->program->suffix[$suffix];?>"><?php echo trim(htmlSpecialString($content, defined('ENT_SUBSTITUTE') ? ENT_QUOTES | ENT_SUBSTITUTE : ENT_QUOTES));?></pre>
  85. <?php endif;?>
  86. </div>
  87. </div>
  88. <?php if(!isonlybody()):?>
  89. <div class="side-col" id="sidebar">
  90. <div class="sidebar-toggle"><i class="icon icon-angle-right"></i></div>
  91. <div class='side-body'><?php include 'ajaxsidecommits.html.php';?></div>
  92. </div>
  93. <?php endif;?>
  94. <?php if(!isonlybody()):?>
  95. </div>
  96. <?php endif;?>
  97. <?php if(!isonlybody()):?>
  98. <div id="mainActions" class='main-actions'>
  99. <nav class="container">
  100. <?php if(!empty($preAndNext->pre)) echo html::a($this->repo->createLink('view', "repoID=$repoID&objectID=$objectID&entry=$encodePath&revision={$preAndNext->pre}&showBug=$showBug", 'html', isonlybody()), "<i class='icon-pre icon-chevron-left'></i>", '', "id='prevPage' class='btn btn-info' data-app='{$app->tab}' title='{$preAndNext->pre}'")?>
  101. <?php if(!empty($preAndNext->next)) echo html::a($this->repo->createLink('view', "repoID=$repoID&objectID=$objectID&entry=$encodePath&revision={$preAndNext->next}&showBug=$showBug", 'html', isonlybody()), "<i class='icon-pre icon-chevron-right'></i>", '', "id='nextPage' class='btn btn-info' data-app='{$app->tab}' title='{$preAndNext->next}'")?>
  102. </nav>
  103. </div>
  104. <?php endif;?>
  105. <?php include '../../common/view/footer.html.php';?>