/halogy/application/modules/blog/views/admin/edit_post.php

https://bitbucket.org/haloweb/halogy-1.0/ · PHP · 142 lines · 123 code · 19 blank · 0 comment · 9 complexity · c04b67d0af2caf8e7edac7a53dde520f MD5 · raw file

  1. <script type="text/javascript">
  2. function preview(el){
  3. $.post('/admin/blog/preview', { body: $(el).val() }, function(data){
  4. $('div.preview').html(data);
  5. });
  6. }
  7. $(function(){
  8. $('div.category>span, div.category>input').hover(
  9. function() {
  10. if (!$(this).prev('input').attr('checked') && !$(this).attr('checked')){
  11. $(this).parent().addClass('hover');
  12. }
  13. },
  14. function() {
  15. if (!$(this).prev('input').attr('checked') && !$(this).attr('checked')){
  16. $(this).parent().removeClass('hover');
  17. }
  18. }
  19. );
  20. $('div.category>span').click(function(){
  21. if ($(this).prev('input').attr('checked')){
  22. $(this).prev('input').attr('checked', false);
  23. $(this).parent().removeClass('hover');
  24. } else {
  25. $(this).prev('input').attr('checked', true);
  26. $(this).parent().addClass('hover');
  27. }
  28. });
  29. $('textarea#body').focus(function(){
  30. $('.previewbutton').show();
  31. });
  32. $('textarea#body').blur(function(){
  33. preview(this);
  34. });
  35. $('input.datebox').datebox();
  36. preview($('textarea#body'));
  37. });
  38. </script>
  39. <form method="post" action="<?php echo $this->uri->uri_string(); ?>" class="default">
  40. <h1 class="headingleft">Edit Blog Post <small>(<a href="/admin/blog">Back to Blog Posts</a>)</small></h1>
  41. <div class="headingright">
  42. <input type="submit" name="view" value="View Post" class="button blue" />
  43. <input type="submit" value="Save Changes" class="button" />
  44. </div>
  45. <div class="clear"></div>
  46. <?php if ($errors = validation_errors()): ?>
  47. <div class="error">
  48. <?php echo $errors; ?>
  49. </div>
  50. <?php endif; ?>
  51. <?php if (isset($message)): ?>
  52. <div class="message">
  53. <?php echo $message; ?>
  54. </div>
  55. <?php endif; ?>
  56. <h2 class="underline">Content and Classification</h2>
  57. <label for="postName">Title:</label>
  58. <?php echo @form_input('postTitle', set_value('postTitle', $data['postTitle']), 'id="postTitle" class="formelement"'); ?>
  59. <br class="clear" />
  60. <label>Categories: <small>[<a href="/admin/blog/categories" onclick="return confirm('You will lose any unsaved changes.\n\nContinue anyway?')">update</a>]</small></label>
  61. <div class="categories">
  62. <?php if ($categories): ?>
  63. <?php foreach($categories as $category): ?>
  64. <div class="category<?php echo (isset($data['categories'][$category['catID']])) ? ' hover' : ''; ?>">
  65. <?php echo @form_checkbox('catsArray['.$category['catID'].']', $category['catName'], (isset($data['categories'][$category['catID']])) ? 1 : ''); ?><span><?php echo $category['catName']; ?></span>
  66. </div>
  67. <?php endforeach; ?>
  68. <?php else: ?>
  69. <div class="category">
  70. <strong>Warning:</strong> It is strongly recommended that you use categories or this may not appear properly. <a href="/admin/blog/categories" onclick="return confirm('You will lose any unsaved changes.\n\nContinue anyway?')"><strong>Please update your categories here</strong></a>.
  71. </div>
  72. <?php endif; ?>
  73. </div>
  74. <br class="clear" />
  75. <div class="buttons">
  76. <a href="#" class="boldbutton"><img src="<?php echo $this->config->item('staticPath'); ?>/images/btn_bold.png" alt="Bold" title="Bold" /></a>
  77. <a href="#" class="italicbutton"><img src="<?php echo $this->config->item('staticPath'); ?>/images/btn_italic.png" alt="Italic" title="Italic" /></a>
  78. <a href="#" class="h1button"><img src="<?php echo $this->config->item('staticPath'); ?>/images/btn_h1.png" alt="Heading 1" title="Heading 1"/></a>
  79. <a href="#" class="h2button"><img src="<?php echo $this->config->item('staticPath'); ?>/images/btn_h2.png" alt="Heading 2" title="Heading 2" /></a>
  80. <a href="#" class="h3button"><img src="<?php echo $this->config->item('staticPath'); ?>/images/btn_h3.png" alt="Heading 3" title="Heading 3" /></a>
  81. <a href="#" class="urlbutton"><img src="<?php echo $this->config->item('staticPath'); ?>/images/btn_url.png" alt="Insert Link" title="Insert Link" /></a>
  82. <a href="#" class="halogycms_imagebutton"><img src="<?php echo $this->config->item('staticPath'); ?>/images/btn_image.png" alt="Insert Image" title="Insert Image" /></a>
  83. <a href="#" class="halogycms_filebutton"><img src="<?php echo $this->config->item('staticPath'); ?>/images/btn_file.png" alt="Insert File" title="Insert File" /></a>
  84. <a href="#" class="previewbutton"><img src="<?php echo $this->config->item('staticPath'); ?>/images/btn_save.png" alt="Preview" title="Preview" /></a>
  85. </div>
  86. <div class="autosave">
  87. <label for="body">Body:</label>
  88. <?php echo @form_textarea('body', set_value('body', $data['body']), 'id="body" class="formelement code half"'); ?>
  89. <div class="preview"></div>
  90. </div>
  91. <br class="clear" /><br />
  92. <label for="excerpt">Excerpt:</label>
  93. <?php echo @form_textarea('excerpt', set_value('excerpt', $data['excerpt']), 'id="excerpt" class="formelement code short"'); ?>
  94. <br class="clear" /><br />
  95. <h2 class="underline">Publishing and Options</h2>
  96. <label for="tags">Tags: <br /></label>
  97. <?php echo @form_input('tags', set_value('tags', $data['tags']), 'id="tags" class="formelement"'); ?>
  98. <span class="tip">Separate tags with a comma (e.g. &ldquo;places, hobbies, favourite work&rdquo;)</span>
  99. <br class="clear" />
  100. <label for="published">Publish:</label>
  101. <?php
  102. $values = array(
  103. 1 => 'Yes',
  104. 0 => 'No (save as draft)',
  105. );
  106. echo @form_dropdown('published',$values,set_value('published', $data['published']), 'id="published"');
  107. ?>
  108. <br class="clear" />
  109. <label for="allowComments">Allow Comments?</label>
  110. <?php
  111. $values = array(
  112. 1 => 'Yes',
  113. 0 => 'No',
  114. );
  115. echo @form_dropdown('allowComments',$values,set_value('allowComments', $data['allowComments']), 'id="allowComments"');
  116. ?>
  117. <br class="clear" />
  118. <label for="publishDate">Publish Date:</label>
  119. <?php echo @form_input('publishDate', dateFmt($data['dateCreated'], 'd M Y'), 'id="publishDate" class="formelement datebox" readonly="readonly"'); ?>
  120. <br class="clear" />
  121. <br />
  122. <p class="clear" style="text-align: right;"><a href="#" class="button grey" id="totop">Back to top</a></p>
  123. </form>