mirror of
https://github.com/Frumph/comic-easel.git
synced 2026-07-01 13:55:01 -04:00
Decided on a different method of implementing comics onto posts, that is managed by a 'library' system.
Signed-off-by: Philip M. Hofer (Frumph) <frumph_dragon@yahoo.com>
This commit is contained in:
+5
-18
@@ -13,20 +13,18 @@ function ceo_add_menu_pages() {
|
||||
|
||||
$menu_location = 'edit.php?post_type=comic';
|
||||
$plugin_title = __('Comic Easel', 'comiceasel');
|
||||
// $chapter_title = __('Chapter Manager', 'comiceasel');
|
||||
$library_title = __('Library', 'comiceasel');
|
||||
$config_title = __('Config', 'comiceasel');
|
||||
$debug_title = __('Debug', 'comiceasel');
|
||||
// $upload_title = __('Upload', 'comiceasel');
|
||||
|
||||
// the ceo_pluginfo used here actually initiates it.
|
||||
// $chapter_manager_hook = add_submenu_page($menu_location, $plugin_title . ' - ' . $chapter_title, $chapter_title, 'edit_theme_options', 'comiceasel-chapter-manager', 'ceo_chapter_manager');
|
||||
$library_hook = add_submenu_page($menu_location, $plugin_title . ' - ' . $library_title, $library_title, 'edit_theme_options', 'comiceasel-library', 'ceo_library');
|
||||
$config_hook = add_submenu_page($menu_location, $plugin_title . ' - ' . $config_title, $config_title, 'edit_theme_options', 'comiceasel-config', 'ceo_manager_config');
|
||||
$debug_hook = add_submenu_page($menu_location, $plugin_title . ' - ' . $debug_title, $debug_title, 'edit_theme_options', 'comiceasel-debug', 'ceo_debug');
|
||||
// $upload_hook = add_submenu_page($menu_location, $plugin_title . ' - ' . $upload_title, $upload_title, 'edit_theme_options', 'comiceasel-upload', 'ceo_upload');
|
||||
|
||||
// post_type is only found on the post-new.php with $_GET, so when the $pagenow is post.php it will not be able to strictly determine the post type so it will be executed on all already made post/page edits
|
||||
if ( (isset($_GET['post_type']) && $_GET['post_type'] == 'comic') || $post_type == 'comic') {
|
||||
// Z? why does the function comic_admin_css() not use wp_enqueue style/script and not here?
|
||||
|
||||
}
|
||||
// Notice how its checking the _GET['page'], do this for the other areas
|
||||
// if you need to execute scripts on the particular areas
|
||||
@@ -59,8 +57,8 @@ function ceo_debug() {
|
||||
require_once('ceo-debug.php');
|
||||
}
|
||||
|
||||
function ceo_upload() {
|
||||
require_once('ceo-upload.php');
|
||||
function ceo_library() {
|
||||
require_once('ceo-library.php');
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -76,15 +74,4 @@ function ceo_add_dashboard_widgets() {
|
||||
}
|
||||
|
||||
|
||||
// function to add comic uploader sectipts only to the comic post add/edit pager.
|
||||
// not sure why Z isn't using wp_enqueue here - phil
|
||||
add_action('admin_head', 'comic_admin_css');
|
||||
function comic_admin_css() {
|
||||
global $post_type;
|
||||
if ( (isset($_GET['post_type']) && $_GET['post_type'] == 'comic') || $post_type == 'comic') :
|
||||
echo "<link type='text/css' rel='stylesheet' href='" . plugins_url('/css/ceo-admin.css', __FILE__) . "' />";
|
||||
echo "<script type='text/javascript' src='". plugins_url('/js/fileuploader.js', __FILE__) . "'></script>";
|
||||
endif;
|
||||
}
|
||||
|
||||
?>
|
||||
@@ -1,5 +0,0 @@
|
||||
The Upload Page
|
||||
<?php
|
||||
|
||||
|
||||
?>
|
||||
+4
-107
@@ -65,90 +65,11 @@ function ceo_manage_comic_columns($column_name, $id) {
|
||||
function ceo_edit_comic_in_post($post) {
|
||||
?>
|
||||
<div class="inside" style="overflow: hidden; width: 100%;">
|
||||
<table>
|
||||
<td valign="top" style="width:50%;">
|
||||
<! -- comic uploader button -->
|
||||
<div id="file-uploader-demo1">
|
||||
<noscript>
|
||||
<p>Please enable JavaScript to use file uploader.</p>
|
||||
<!-- or put a simple form for upload here -->
|
||||
</noscript>
|
||||
</div>
|
||||
<!-- end comic uploader button -->
|
||||
<hr>
|
||||
<br />
|
||||
<!-- selectbox for file attaching from DIR -->
|
||||
<?php
|
||||
// open the current directory
|
||||
$comic_path = ceo_pluginfo('comic_path');
|
||||
// define an array to hold the files
|
||||
$dirhandle = opendir($comic_path);
|
||||
if ($dirhandle) {
|
||||
// loop through all of the files
|
||||
while (false !== ($fname = readdir($dirhandle))) {
|
||||
// if the file is not this file, and does not start with a '.' or '..',
|
||||
// then store it for later display
|
||||
if (($fname != '.') && ($fname != '..') && ($fname != basename($_SERVER['PHP_SELF']))) {
|
||||
// store the filename
|
||||
$files[] = (is_dir( "./$fname" )) ? "(Dir) {$fname}" : $fname;
|
||||
}
|
||||
}
|
||||
// close the directory
|
||||
closedir($dirhandle);
|
||||
}
|
||||
?>
|
||||
<div id="comicfileattacharea">
|
||||
<select id="comicfile" name="comicfile" size="6" multiple>
|
||||
<?php
|
||||
if (empty($files)) {
|
||||
echo '<option value="There are no files available">No Files';
|
||||
} else {
|
||||
// Now loop through the files, echoing out a new select option for each one
|
||||
foreach( $files as $fname ) {
|
||||
echo "<option value=\"{$fname}\">{$fname}\r\n";
|
||||
}
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
</div>
|
||||
<br />
|
||||
<div class="comicfileattach">
|
||||
<?php if (!empty($files)) { ?>
|
||||
<INPUT type="button" value="Attach" name="button2" onClick="comicfileadd(<?php echo $post->ID; ?>)">
|
||||
<?php } ?>
|
||||
</div>
|
||||
<br />
|
||||
<!-- end selectbox attacher -->
|
||||
</td>
|
||||
<td valign="top" style="width: 240px;">
|
||||
<div id="comicthumbs">
|
||||
<center>
|
||||
<!-- DIV added to enable auto update function -->
|
||||
<div id="comicthumbs">
|
||||
<?php echo ceo_display_comic_thumbnail_editor('small', $post, false, 198); ?><br />
|
||||
</div>
|
||||
<?php echo ceo_display_comic_thumbnail('medium', $post, false, 200); ?><br />
|
||||
</center>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<script>
|
||||
function createUploader(){
|
||||
var uploader = new qq.FileUploader({
|
||||
element: document.getElementById('file-uploader-demo1'),
|
||||
action: '<?php echo admin_url( 'admin-ajax.php' ); ?>',
|
||||
params: {
|
||||
action: 'ceo_uploader',
|
||||
post_id: '<?php echo $post->ID ?>'
|
||||
},
|
||||
onComplete: function(id, fileName, responseJSON){
|
||||
//refreash thumbnail DIV
|
||||
getdata(ajaxurl + '?action=ceo_thumb_update&post_id=<?php echo $post->ID ?>','comicthumbs');
|
||||
}
|
||||
});
|
||||
}
|
||||
// in your app create uploader as soon as the DOM is readyi
|
||||
// don't wait for the window to load
|
||||
window.onload = createUploader;
|
||||
</script>
|
||||
</div>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
@@ -169,7 +90,7 @@ function ceo_edit_hovertext_in_post($post) {
|
||||
add_action('add_meta_boxes', 'ceo_add_comic_in_post');
|
||||
|
||||
function ceo_add_comic_in_post() {
|
||||
add_meta_box('ceo_comic_in_post', __('Comic', 'comiceasel'), 'ceo_edit_comic_in_post', 'comic', 'normal', 'high');
|
||||
add_meta_box('ceo_comic_in_post', __('Comic', 'comiceasel'), 'ceo_edit_comic_in_post', 'comic', 'side', 'high');
|
||||
add_meta_box('ceo_hovertext_in_post', __('Alt (Hover) Text', 'comiceasel'), 'ceo_edit_hovertext_in_post', 'comic', 'normal', 'high');
|
||||
}
|
||||
|
||||
@@ -184,29 +105,5 @@ function ceo_handle_edit_save_comic($post_id) {
|
||||
} */
|
||||
}
|
||||
|
||||
// Do the thumbnail display functions here.
|
||||
function ceo_display_comic_thumbnail_editor($type = 'small', $override_post = null, $use_post_image = false, $setwidth = 0) {
|
||||
global $post;
|
||||
$thumbnail = $extra_text = '';
|
||||
$post_to_use = !empty($override_post) ? $override_post : $post;
|
||||
$thumburl = ceo_pluginfo('thumbnail_small_url');
|
||||
// need to add fallback
|
||||
|
||||
$thumbnail = get_post_meta($post_to_use->ID, 'comic');
|
||||
foreach ($thumbnail as $thumb) {
|
||||
if (!file_exists(ceo_pluginfo('thumbnail_small_path').'/'.$thumb)) {
|
||||
$thumb_url = ceo_pluginfo('comic_url').'/'.$thumb;
|
||||
$extra_text = 'No Thumbnail Found<br />';
|
||||
} else {
|
||||
$thumb_url = ceo_pluginfo('thumbnail_small_url').'/'.$thumb;
|
||||
}
|
||||
if ($setwidth) {
|
||||
echo '<div id='.$thumb.'><img src="'.$thumb_url.'" alt="'.get_the_title($post_to_use).'" style="max-width:'.$setwidth.'px" class="comicthumbnail" title="'.get_the_title($post_to_use->ID).'" />
|
||||
<br />'.$extra_text.'<INPUT type="button" value="Remove" name="'.$thumb.'" onClick="comicfileremove('.$post->ID.',\''.$thumb.'\')"></div>'."\r\n";
|
||||
} else {
|
||||
echo '<img src="'.$thumb_url.'" alt="'.get_the_title($post_to_use).'" class="comicthumbnail" title="'.get_the_title($post_to_use).'" />'.$extra_text.'<INPUT type="button" value="Remove" name="button2" onClick="comicfileremove('.$post->ID.','.$thumb.')">'."\r\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
Reference in New Issue
Block a user