action.html.php 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  1. <?php if($extView = $this->getExtViewFile(__FILE__)){include $extView; return helper::cd();}?>
  2. <?php if(!empty($blockHistory)):?>
  3. <div class="panel block-histories histories no-margin" data-textDiff="<?php echo $lang->action->textDiff;?>" data-original="<?php echo $lang->action->original;?>">
  4. <?php else:?>
  5. <div class="detail histories" id='actionbox' data-textDiff="<?php echo $lang->action->textDiff;?>" data-original="<?php echo $lang->action->original;?>">
  6. <?php endif;?>
  7. <style>
  8. .histories-list > li {word-break: break-word; word-wrap: break-word;}
  9. .history-changes del {padding-left: 3px;}
  10. </style>
  11. <script>
  12. $(function()
  13. {
  14. var diffButton = '<button type="button" class="btn btn-mini btn-icon btn-strip"><i class="icon icon-code icon-sm"></i></button>';
  15. var newBoxID = '';
  16. var oldBoxID = '';
  17. $('blockquote.textdiff').each(function()
  18. {
  19. newBoxID = $(this).parent().attr('id');
  20. if(newBoxID != oldBoxID)
  21. {
  22. oldBoxID = newBoxID;
  23. if($(this).html() != $(this).next().html()) $(this).closest('.history-changes').before(diffButton);
  24. }
  25. });
  26. });
  27. </script>
  28. <?php if(!empty($blockHistory)):?>
  29. <div class="panel-heading"><div class="panel-title">
  30. <?php else:?>
  31. <div class="detail-title">
  32. <?php endif;?>
  33. <?php echo $lang->history?> &nbsp;
  34. <button type="button" class="btn btn-mini btn-icon btn-reverse" title='<?php echo $lang->reverse;?>'>
  35. <i class="icon icon-arrow-up icon-sm"></i>
  36. </button>
  37. <button type="button" class="btn btn-mini btn-icon btn-expand-all" title='<?php echo $lang->switchDisplay;?>'>
  38. <i class="icon icon-plus icon-sm"></i>
  39. </button>
  40. <?php if(isset($actionFormLink)) echo common::printCommentIcon($actionFormLink);?>
  41. </div>
  42. <?php if(!empty($blockHistory)):?>
  43. </div>
  44. <?php endif;?>
  45. <?php if(!empty($blockHistory)):?>
  46. <div class="panel-body">
  47. <?php else:?>
  48. <div class="detail-content">
  49. <?php endif;?>
  50. <ol class='histories-list'>
  51. <?php $i = 1; ?>
  52. <?php foreach($actions as $action):?>
  53. <?php $canEditComment = ((!isset($canBeChanged) or !empty($canBeChanged)) and end($actions) == $action and trim($action->comment) != '' and strpos(',view,objectlibs,viewcard,', ",$this->methodName,") !== false and $action->actor == $this->app->user->account and common::hasPriv('action', 'editComment'));?>
  54. <li value='<?php echo $i ++;?>'>
  55. <?php
  56. $action->actor = zget($users, $action->actor);
  57. if($action->action == 'assigned' or $action->action == 'toaudit') $action->extra = zget($users, $action->extra);
  58. if(strpos($action->actor, ':') !== false) { $action->actor = substr($action->actor, strpos($action->actor, ':') + 1); }
  59. $this->loadModel('action')->printAction($action);
  60. ?>
  61. <?php if(!empty($action->history)):?>
  62. <button type='button' class='btn btn-mini switch-btn btn-icon btn-expand' title='<?php echo $lang->switchDisplay;?>'><i class='change-show icon icon-plus icon-sm'></i></button>
  63. <div class='history-changes' id='changeBox<?php echo $i;?>'>
  64. <?php echo $this->action->printChanges($action->objectType, $action->objectID, $action->history);?>
  65. </div>
  66. <?php endif;?>
  67. <?php if(strlen(trim(($action->comment))) != 0):?>
  68. <?php if($canEditComment):?>
  69. <?php echo html::commonButton('<i class="icon icon-pencil"></i>', "title='{$lang->action->editComment}'", 'btn btn-link btn-icon btn-sm btn-edit-comment');?>
  70. <style>.comment .comment-content{width: 98%}</style>
  71. <?php endif;?>
  72. <div class='article-content comment'>
  73. <div class='comment-content'>
  74. <?php
  75. if(strpos($action->comment, '<pre class="prettyprint lang-html">') !== false)
  76. {
  77. $before = explode('<pre class="prettyprint lang-html">', $action->comment);
  78. $after = explode('</pre>', $before[1]);
  79. $htmlCode = $after[0];
  80. $text = $before[0] . htmlspecialchars($htmlCode) . $after[1];
  81. echo $text;
  82. }
  83. else
  84. {
  85. echo strip_tags($action->comment) == $action->comment ? nl2br($action->comment) : $action->comment;
  86. }
  87. ?>
  88. </div>
  89. </div>
  90. <?php if($canEditComment):?>
  91. <form method='post' class='comment-edit-form' action='<?php echo $this->createLink('action', 'editComment', "actionID=$action->id")?>'>
  92. <div class="form-group">
  93. <?php echo html::textarea('lastComment', htmlSpecialString($action->comment), "rows='8' autofocus='autofocus'");?>
  94. </div>
  95. <div class="form-group form-actions">
  96. <?php echo html::submitButton($lang->save);?>
  97. <?php echo html::commonButton($lang->close, '', 'btn btn-wide btn-hide-form');?>
  98. </div>
  99. </form>
  100. <?php endif;?>
  101. <?php endif;?>
  102. </li>
  103. <?php endforeach;?>
  104. </ol>
  105. </div>
  106. </div>