edittemplate.html.php 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. <?php include $app->getModuleRoot() . 'common/view/header.html.php';?>
  2. <?php include $app->getModuleRoot() . 'common/view/kindeditor.html.php';?>
  3. <?php include $app->getModuleRoot() . 'common/view/markdown.html.php';?>
  4. <?php
  5. $content = $template->type == 'html' ? $template->content : '';
  6. $markdown = $template->type == 'markdown' ? $template->content : '';
  7. $url = $template->type == 'url' ? $template->content : '';
  8. ?>
  9. <div id="mainContent" class="main-content fade">
  10. <div class="center-block">
  11. <div class="main-header">
  12. <h2><?php echo $lang->baseline->editTemplate;?></h2>
  13. </div>
  14. <form class="load-indicator main-form form-ajax" method='post' enctype='multipart/form-data' id='dataform'>
  15. <table class="table table-form">
  16. <tbody>
  17. <tr>
  18. <th class='w-110px'><?php echo $lang->baseline->templateType;?></th>
  19. <td><?php echo html::select('templateType', $lang->baseline->objectList, $template->templateType, "class='form-control chosen'");?></td>
  20. </tr>
  21. <tr>
  22. <th class='w-110px'><?php echo $lang->baseline->templateTitle;?></th>
  23. <td><?php echo html::input('title', $template->title, "class='form-control'");?></td>
  24. <td></td>
  25. </tr>
  26. <tr>
  27. <th class='w-110px'><?php echo $lang->baseline->docType;?></th>
  28. <?php if($template->type == 'url') $lang->baseline->docTypeList['url'] = $lang->baseline->urlDoc;?>
  29. <td><?php echo html::radio('type', $lang->baseline->docTypeList, $template->type, "onchange=toggleEditor(this.value)");?></td>
  30. </tr>
  31. <tr id='contentBox'>
  32. <th class='w-110px'><?php echo $lang->baseline->docContent;?></th>
  33. <td colspan='2'>
  34. <div class='contenthtml'><?php echo html::textarea('content', $content, "style='width:100%;height:200px'");?></div>
  35. <div class='contentmarkdown hidden'><?php echo html::textarea('contentMarkdown', $markdown, "style='width:100%;height:200px'");?></div>
  36. <?php echo html::hidden('contentType', $template->type);?>
  37. </td>
  38. </tr>
  39. <tr id='urlBox' class='hidden'>
  40. <th><?php echo $lang->baseline->url;?></th>
  41. <td colspan='2'><?php echo html::input('url', $url, "class='form-control'");?></td>
  42. </tr>
  43. <tr>
  44. <td colspan='3' class='text-center form-actions'>
  45. <?php echo html::submitButton() . ' ' . html::backButton();?>
  46. </td>
  47. </tr>
  48. </tbody>
  49. </table>
  50. </form>
  51. </div>
  52. </div>
  53. <script>
  54. function toggleEditor(type)
  55. {
  56. if(type == 'html')
  57. {
  58. $('#contentBox').removeClass('hidden');
  59. $('#urlBox').addClass('hidden');
  60. $('.contenthtml').removeClass('hidden');
  61. $('.contentmarkdown').addClass('hidden');
  62. }
  63. else if(type == 'markdown')
  64. {
  65. $('#contentBox').removeClass('hidden');
  66. $('#urlBox').addClass('hidden');
  67. $('.contenthtml').addClass('hidden');
  68. $('.contentmarkdown').removeClass('hidden');
  69. }
  70. else if(type == 'url')
  71. {
  72. $('#contentBox').addClass('hidden');
  73. $('#urlBox').removeClass('hidden');
  74. }
  75. else if(type == 'book')
  76. {
  77. $('#contentBox').addClass('hidden');
  78. $('#urlBox').addClass('hidden');
  79. }
  80. $('#contentType').val(type);
  81. return false;
  82. }
  83. toggleEditor($('input[name="type"]:checked').val());
  84. </script>
  85. <?php include $app->getModuleRoot() . 'common/view/footer.html.php';?>