blog-editor.php 1.6 KB

1234567891011121314151617181920212223242526272829303132333435
  1. <form method="post" class="form-horizontal" id="form-<?= $editor->name ?>" enctype="multipart/form-data">
  2. <?= HTML::hiddenToken() ?>
  3. <div class="row">
  4. <div class="col-sm-6">
  5. <?= HTML::div_vinput("{$editor->name}_title", 'text', $editor->label_text['title'], html_entity_decode($editor->cur_data['title'])) ?>
  6. </div>
  7. <div class="col-sm-6">
  8. <?= HTML::div_vinput("{$editor->name}_tags", 'text', $editor->label_text['tags'], join(', ', $editor->cur_data['tags'])) ?>
  9. </div>
  10. </div>
  11. <?= HTML::div_vtextarea("{$editor->name}_content_md", $editor->label_text['content'], $editor->cur_data['content_md']) ?>
  12. <div class="row mt-2">
  13. <div class="col-sm-6">
  14. <?php if ($editor->blog_url): ?>
  15. <a id="a-<?= $editor->name ?>_view_blog" class="btn btn-info" href="<?= HTML::escape($editor->blog_url) ?>"><?= $editor->label_text['view blog'] ?></a>
  16. <?php else: ?>
  17. <a id="a-<?= $editor->name ?>_view_blog" class="btn btn-info" style="display: none;"><?= $editor->label_text['view blog'] ?></a>
  18. <?php endif ?>
  19. </div>
  20. <div class="col-sm-6 text-right">
  21. <?= HTML::checkbox("{$editor->name}_is_hidden", $editor->cur_data['is_hidden']) ?>
  22. </div>
  23. </div>
  24. </form>
  25. <script type="text/javascript">
  26. $('#<?= "input-{$editor->name}_is_hidden" ?>').bootstrapSwitch({
  27. onText: <?= json_encode($editor->label_text['private']) ?>,
  28. onColor: 'danger',
  29. offText: <?= json_encode($editor->label_text['public']) ?>,
  30. offColor: 'primary',
  31. labelText: <?= json_encode($editor->label_text['blog visibility']) ?>,
  32. handleWidth: 100
  33. });
  34. blog_editor_init("<?= $editor->name ?>", <?= json_encode(array('type' => $editor->type)) ?>);
  35. </script>