m.action.html.php 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129
  1. <?php
  2. /**
  3. * The mobile action view of common module of RanZhi.
  4. *
  5. * @copyright Copyright 2009-2016 禅道软件(青岛)有限公司(ZenTao Software (Qingdao) Co., Ltd. www.cnezsoft.com)
  6. * @license ZPL(http://zpl.pub/page/zplv12.html) or AGPL(https://www.gnu.org/licenses/agpl-3.0.en.html)
  7. * @author Hao Sun <sunhao@cnezsoft.com>
  8. * @package common
  9. * @version $Id: chosen.html.php 7417 2013-12-23 07:51:50Z wwccss $
  10. * @link http://www.ranzhico.com
  11. */
  12. ?>
  13. <?php $historyUID = 'histories-' . uniqid(); ?>
  14. <style>
  15. .change-show, .change-hide{font-family: ZenIcon;}
  16. .change-show:before {content: "\e661";}
  17. .change-hide:before {content: "\e662";}
  18. .list-history.list{padding:0.5rem 0rem !important;}
  19. .list-history.list>.item{padding:0.1rem 0.5rem !important;}
  20. .list-history.list>.item>.title{padding:0rem !important;}
  21. </style>
  22. <div class='heading gray'>
  23. <div class="title"><i class='icon-history muted'></i> <strong><?php echo $lang->history?></strong></div>
  24. <nav class='nav'>
  25. <a data-toggle='reverse' data-target='#<?php echo $historyUID ?> > .item'><i class='icon-sort-by-order-alt'></i></a>
  26. </nav>
  27. </div>
  28. <div class='content list list-history' id='<?php echo $historyUID ?>'>
  29. <?php $i = 0;?>
  30. <?php foreach($actions as $action):?>
  31. <?php
  32. $canEditComment = ($action->action != 'record' and end($actions) == $action and $action->comment and (strpos($this->server->request_uri, 'view') !== false) and $action->actor == $this->app->user->account);
  33. if(isset($users[$action->actor])) $action->actor = $users[$action->actor];
  34. if($action->action == 'assigned' and isset($users[$action->extra]) ) $action->extra = $users[$action->extra];
  35. if(strpos($action->actor, ':') !== false) $action->actor = substr($action->actor, strpos($action->actor, ':') + 1);
  36. $hasCommentOrHistory = !(empty($action->comment) and empty($action->history));
  37. ?>
  38. <div class='item with-avatar <?php echo $hasCommentOrHistory ? 'multi-lines' : 'single-line' ?>' data-id='<?php echo ++$i;?>'>
  39. <?php if($hasCommentOrHistory):?><div class="content"><?php endif; ?>
  40. <div class="title">
  41. <?php echo $i . '. ';?><?php $this->action->printAction($action);?>
  42. <?php if(!empty($action->history)): ?>
  43. <span id='switchButton<?php echo $i;?>' class='toggle outline change-show btn btn-sm'></span>
  44. <?php endif; ?>
  45. </div>
  46. <?php if(!empty($action->history)): ?>
  47. <div class='history article break-word' style='display:none;'><?php echo $this->action->printChanges($action->objectType, $action->history, $action->action);?></div>
  48. <?php endif; ?>
  49. <?php if(!empty($action->comment)): ?>
  50. <div class='comment article primary-pale'>
  51. <?php echo strip_tags($action->comment) == $action->comment ? nl2br($action->comment) : $action->comment; ?>
  52. <?php if($canEditComment):?>
  53. <a href='#lastCommentBox' class='btn' data-display data-backdrop='true'><i class='icon-pencil'></i></a>
  54. <?php endif; ?>
  55. </div>
  56. <?php endif; ?>
  57. <?php if($hasCommentOrHistory):?></div><?php endif; ?>
  58. </div>
  59. <?php if(!empty($action->files)): ?>
  60. <div class='files list gray compact'>
  61. <div class='heading'><div class='title'><?php echo $lang->action->record->uploadFile;?></div></div>
  62. <?php foreach ($action->files as $file):?>
  63. <a class='item item-file with-avatar multi-lines' href='<?php echo helper::createLink('file', 'download', "fileID=$file->id&mouse=left") ?>' target='_blank'>
  64. <?php if($file->isImage): ?>
  65. <div class='avatar avatar-no-fix outline' style='background-image: url("<?php echo $file->smallURL; ?>")'></div>
  66. <?php else: ?>
  67. <div class='avatar avatar-no-fix text-tint align-start justify-end' data-skin='@<?php echo $file->extension?>'><small>.<?php echo $file->extension?></small></div>
  68. <?php endif; ?>
  69. <div class='content'>
  70. <div class='title'>
  71. <span class='text-link'><?php echo $file->title ?></span>
  72. <?php if($file->downloads): ?>
  73. <span class='pull-right text-yellow'><i class='icon icon-download-alt'></i> <?php echo $file->downloads ?></span>
  74. <?php endif; ?>
  75. </div>
  76. <div class='subtitle'>
  77. <?php echo formatBytes($file->size)?> &nbsp;
  78. <?php echo $file->createdDate?>
  79. </div>
  80. </div>
  81. </a>
  82. <?php endforeach;?>
  83. </div>
  84. <?php endif; ?>
  85. <?php endforeach;?>
  86. </div>
  87. <?php if(isset($canEditComment) and $canEditComment):?>
  88. <div id='lastCommentBox' class='enter-from-bottom hidden affix layer'>
  89. <div class='heading'>
  90. <div class="title"><?php echo $lang->comment;?></div>
  91. <nav class='nav'><a data-dismiss='display' class='muted'><i class='icon-remove'></i></a></nav>
  92. </div>
  93. <form id='lastcommentForm' target='hiddenwin' class='has-padding' data-form-refresh='#history' method='post' action='<?php echo $this->createLink('action', 'editComment', "actionID=$action->id")?>'>
  94. <div class='control'><?php echo html::textarea('lastComment', htmlspecialchars($action->comment),"rows='5' class='textarea' data-default-val");?></div>
  95. <div class='control'><button type='submit' class='btn primary'><?php echo $lang->save ?></button></div>
  96. </form>
  97. </div>
  98. <?php endif; ?>
  99. <script>
  100. $(function()
  101. {
  102. var $history = $('#<?php echo $historyUID ?>');
  103. if($history.parent().hasClass('modal'))
  104. {
  105. $history.listenScroll({container: 'parent'}).prev('.heading').addClass('divider').find('.nav').append('<a data-dismiss="display"><i class="icon icon-remove muted"></i></a>');
  106. }
  107. $('.toggle').click(function()
  108. {
  109. $(this).toggleClass('change-show').toggleClass('change-hide');
  110. if($(this).parent().next().find('.history').length)
  111. {
  112. $(this).parent().next().find('.history').toggle();
  113. }
  114. else
  115. {
  116. $(this).parent().next().toggle().find('.history').show();
  117. }
  118. });
  119. });
  120. </script>