edit.cmmi.html.hook.php 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. <?php if($execution->type == 'stage'):?>
  2. <?php
  3. $html = '<tr>';
  4. $html .= '<th>';
  5. $html .= $lang->task->design;
  6. $html .= '</th>';
  7. $html .= '<td>';
  8. $html .= html::select('design', '', '', "class='form-control chosen'");
  9. $html .= '</td>';
  10. $html .= '<tr>';
  11. js::set('designID', $task->design);
  12. ?>
  13. <script>
  14. $(function()
  15. {
  16. $('#story').change(function(){setStoryDesign(designID);});
  17. $('#story').closest('tr').after(<?php echo json_encode($html);?>);
  18. $('#design').chosen();
  19. $('#story').change();
  20. })
  21. </script>
  22. <?php endif;?>
  23. <?php js::set('attribute', $execution->attribute);?>
  24. <script>
  25. $(function()
  26. {
  27. if(attribute == 'request' || attribute == 'review') $('#story').closest('tr').hide();
  28. $('#execution').change(function()
  29. {
  30. link = createLink('execution', 'ajaxGetAttribute', "executionID=" + $('#execution').val());
  31. $.get(link, function(attribute)
  32. {
  33. if(attribute == 'request' || attribute == 'review')
  34. {
  35. $('#story').closest('tr').hide();
  36. }
  37. else
  38. {
  39. $('#story').closest('tr').show();
  40. }
  41. });
  42. setStoryDesign(designID);
  43. })
  44. })
  45. </script>