/halogy/application/modules/blog/views/admin/edit_post.php
PHP | 142 lines | 123 code | 19 blank | 0 comment | 9 complexity | c04b67d0af2caf8e7edac7a53dde520f MD5 | raw file
1<script type="text/javascript"> 2function 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 40<form method="post" action="<?php echo $this->uri->uri_string(); ?>" class="default"> 41 42<h1 class="headingleft">Edit Blog Post <small>(<a href="/admin/blog">Back to Blog Posts</a>)</small></h1> 43 44<div class="headingright"> 45 <input type="submit" name="view" value="View Post" class="button blue" /> 46 <input type="submit" value="Save Changes" class="button" /> 47</div> 48 49<div class="clear"></div> 50 51<?php if ($errors = validation_errors()): ?> 52 <div class="error"> 53 <?php echo $errors; ?> 54 </div> 55<?php endif; ?> 56<?php if (isset($message)): ?> 57 <div class="message"> 58 <?php echo $message; ?> 59 </div> 60<?php endif; ?> 61 62<h2 class="underline">Content and Classification</h2> 63 64<label for="postName">Title:</label> 65<?php echo @form_input('postTitle', set_value('postTitle', $data['postTitle']), 'id="postTitle" class="formelement"'); ?> 66<br class="clear" /> 67 68<label>Categories: <small>[<a href="/admin/blog/categories" onclick="return confirm('You will lose any unsaved changes.\n\nContinue anyway?')">update</a>]</small></label> 69<div class="categories"> 70 <?php if ($categories): ?> 71 <?php foreach($categories as $category): ?> 72 <div class="category<?php echo (isset($data['categories'][$category['catID']])) ? ' hover' : ''; ?>"> 73 <?php echo @form_checkbox('catsArray['.$category['catID'].']', $category['catName'], (isset($data['categories'][$category['catID']])) ? 1 : ''); ?><span><?php echo $category['catName']; ?></span> 74 </div> 75 <?php endforeach; ?> 76 <?php else: ?> 77 <div class="category"> 78 <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>. 79 </div> 80 <?php endif; ?> 81</div> 82<br class="clear" /> 83 84<div class="buttons"> 85 <a href="#" class="boldbutton"><img src="<?php echo $this->config->item('staticPath'); ?>/images/btn_bold.png" alt="Bold" title="Bold" /></a> 86 <a href="#" class="italicbutton"><img src="<?php echo $this->config->item('staticPath'); ?>/images/btn_italic.png" alt="Italic" title="Italic" /></a> 87 <a href="#" class="h1button"><img src="<?php echo $this->config->item('staticPath'); ?>/images/btn_h1.png" alt="Heading 1" title="Heading 1"/></a> 88 <a href="#" class="h2button"><img src="<?php echo $this->config->item('staticPath'); ?>/images/btn_h2.png" alt="Heading 2" title="Heading 2" /></a> 89 <a href="#" class="h3button"><img src="<?php echo $this->config->item('staticPath'); ?>/images/btn_h3.png" alt="Heading 3" title="Heading 3" /></a> 90 <a href="#" class="urlbutton"><img src="<?php echo $this->config->item('staticPath'); ?>/images/btn_url.png" alt="Insert Link" title="Insert Link" /></a> 91 <a href="#" class="halogycms_imagebutton"><img src="<?php echo $this->config->item('staticPath'); ?>/images/btn_image.png" alt="Insert Image" title="Insert Image" /></a> 92 <a href="#" class="halogycms_filebutton"><img src="<?php echo $this->config->item('staticPath'); ?>/images/btn_file.png" alt="Insert File" title="Insert File" /></a> 93 <a href="#" class="previewbutton"><img src="<?php echo $this->config->item('staticPath'); ?>/images/btn_save.png" alt="Preview" title="Preview" /></a> 94</div> 95 96<div class="autosave"> 97 <label for="body">Body:</label> 98 <?php echo @form_textarea('body', set_value('body', $data['body']), 'id="body" class="formelement code half"'); ?> 99 <div class="preview"></div> 100</div> 101<br class="clear" /><br /> 102 103<label for="excerpt">Excerpt:</label> 104<?php echo @form_textarea('excerpt', set_value('excerpt', $data['excerpt']), 'id="excerpt" class="formelement code short"'); ?> 105<br class="clear" /><br /> 106 107<h2 class="underline">Publishing and Options</h2> 108 109<label for="tags">Tags: <br /></label> 110<?php echo @form_input('tags', set_value('tags', $data['tags']), 'id="tags" class="formelement"'); ?> 111<span class="tip">Separate tags with a comma (e.g. “places, hobbies, favourite work”)</span> 112<br class="clear" /> 113 114<label for="published">Publish:</label> 115<?php 116 $values = array( 117 1 => 'Yes', 118 0 => 'No (save as draft)', 119 ); 120 echo @form_dropdown('published',$values,set_value('published', $data['published']), 'id="published"'); 121?> 122<br class="clear" /> 123 124<label for="allowComments">Allow Comments?</label> 125<?php 126 $values = array( 127 1 => 'Yes', 128 0 => 'No', 129 ); 130 echo @form_dropdown('allowComments',$values,set_value('allowComments', $data['allowComments']), 'id="allowComments"'); 131?> 132<br class="clear" /> 133 134<label for="publishDate">Publish Date:</label> 135<?php echo @form_input('publishDate', dateFmt($data['dateCreated'], 'd M Y'), 'id="publishDate" class="formelement datebox" readonly="readonly"'); ?> 136<br class="clear" /> 137 138<br /> 139 140<p class="clear" style="text-align: right;"><a href="#" class="button grey" id="totop">Back to top</a></p> 141 142</form>