function render()
    {
        global $post, $comicpress_manager, $comicpress_manager_admin;
        $category = get_category($this->category_to_use);
        $comicpress_manager_admin->write_global_styles_scripts();
        ?>
    <div class="wrap">
      <?php 
        $comicpress_manager_admin->handle_warnings();
        ?>
      <?php 
        if ($this->show_widget) {
            ?>
        <?php 
            if ($this->show_new_setup_warning) {
                ?>
          <div style="border: solid #daa 1px; background-color: #ffe7e7; padding: 5px">
            <strong>It looks like this is a new ComicPress install.</strong> You should test to make
            sure uploading works correctly by visiting <a href="admin.php?page=<?php 
                echo plugin_basename(realpath(dirname(__FILE__) . '/../../comicpress_manager_admin.php'));
                ?>
">ComicPress -> Upload</a>.
          </div>
        <?php 
            }
            ?>

        <p>
          <?php 
            printf(__("<strong>Upload a single comic file</strong> and immediately start editing the associated published post. Your post will be going live %s on the provided date and will be posted in the <strong>%s</strong> category.", 'comicpress-manager'), $go_live_time_string, $category->cat_name);
            ?>

          <?php 
            if ($comicpress_manager->get_subcomic_directory() !== false) {
                printf(__("Comic files will be uploaded to the <strong>%s</strong> comic subdirectory.", 'comicpress-manager'), get_cat_name(get_option('comicpress-manager-manage-subcomic')));
            }
            ?>

          <?php 
            if (!empty($this->thumbnails_to_generate)) {
                $thumbnail_strings = array();
                foreach ($this->thumbnails_to_generate as $type) {
                    $thumbnail_strings[] = sprintf(__("<strong>%s</strong> thumbnails that are <strong>%spx</strong> wide", 'comicpress-manager'), $type, $comicpress_manager->properties["{$type}_comic_width"]);
                }
                ?>
            <?php 
                printf(__("You'll be generating: %s.", 'comicpress-manager'), implode(", ", $thumbnail_strings));
                ?>
          <?php 
            }
            ?>
        </p>

        <form action="?page=<?php 
            echo plugin_basename(realpath(dirname(__FILE__) . '/../../comicpress-manager.php'));
            ?>
" method="post" enctype="multipart/form-data">
          <input type="hidden" name="MAX_FILE_SIZE" value="<?php 
            echo $comicpress_manager->convert_short_size_string_to_bytes(ini_get('upload_max_filesize'));
            ?>
" />
          <input type="hidden" name="action" value="write-comic-post" />
          <input type="hidden" name="upload-destination" value="comic" />
          <input type="hidden" name="thumbnails" value="yes" />
          <input type="hidden" name="new_post" value="yes" />
          <?php 
            echo generate_comic_categories_options('in-comic-category[]', false);
            ?>
          <input type="hidden" name="time" value="<?php 
            echo $comicpress_manager->get_cpm_option('cpm-default-post-time');
            ?>
" />

          <table class="form-table">
            <tr>
              <th scope="row"><?php 
            _e('File:', 'comicpress-manager');
            ?>
</th>
              <td><input type="file" name="upload" /></td>
            </tr>
            <?php 
            if (count($category_checkboxes = $this->_generate_additional_categories_checkboxes()) > 0) {
                ?>
              <tr>
                <th scope="row"><?php 
                _e("Additional Categories:", 'comicpress-manager');
                ?>
</th>
                <td><?php 
                echo implode("\n", $category_checkboxes);
                ?>
</td>
              </tr>
            <?php 
            }
            ?>
            <tr>
              <th scope="row"><?php 
            _e("Post date (leave blank if already in filename):", 'comicpress-manager');
            ?>
</th>
              <td>
                <div class="curtime"><input type="text" id="override-date" name="override-date" /></div>
              </td>
            </tr>
            <tr>
              <td colspan="2"><input type="submit" class="button" value="Upload Comic File and Edit Post" /></td>
            </tr>
          </table>
        </form>
        <script type="text/javascript">
          Calendar.setup({
            inputField: "override-date",
            ifFormat: "%Y-%m-%d",
            button: "override-date"
          });
        </script>
      <?php 
        }
        ?>
    </div>
  <?php 
    }
/**
 * Add pages to the admin interface and load necessary JavaScript libraries.
 * Also read in the configuration and handle any POST actions.
 */
function cpm_add_pages()
{
    global $plugin_page, $access_level, $pagenow, $cpm_config, $wp_version, $wpmu_version;
    load_plugin_textdomain('comicpress-manager', cpm_get_plugin_path());
    $widget_options = get_option('dashboard_widget_options');
    if (!$widget_options || !is_array($widget_options)) {
        $widget_options = array();
    }
    cpm_read_information_and_check_config();
    $do_enqueue_prototype = false;
    if ($pagenow == "post.php" && $_REQUEST['action'] == "edit") {
        $do_enqueue_prototype = true;
    }
    if (strpos($pagenow, "post") === 0) {
        add_meta_box('comic-for-this-post', __('Comic For This Post', 'comicpress-manager'), 'cpm_show_comic_caller', 'post', 'normal', 'low');
        require_once "pages/edit_post_show_comic.php";
    }
    $filename = plugin_basename(__FILE__);
    if (strpos($plugin_page, $filename) !== false) {
        $editor_load_pages = array($filename, $filename . '-import');
        if (in_array($plugin_page, $editor_load_pages)) {
            wp_enqueue_script('editor');
            if (!function_exists('wp_tiny_mce')) {
                wp_enqueue_script('wp_tiny_mce');
            }
        }
        $do_enqueue_prototype = true;
        cpm_handle_actions();
    }
    if (in_array($pagenow, array("edit.php", "post-new.php"))) {
        $do_enqueue_prototype = true;
    }
    if ($do_enqueue_prototype) {
        wp_enqueue_script('prototype');
        wp_enqueue_script('scriptaculous-effects');
        wp_enqueue_script('scriptaculous-builder');
    }
    if (!isset($access_level)) {
        $access_level = 10;
    }
    $plugin_title = __("ComicPress Manager", 'comicpress-manager');
    add_menu_page($plugin_title, __("ComicPress", 'comicpress-manager'), $access_level, $filename, "cpm_manager_index_caller", get_option('siteurl') . '/' . cpm_get_plugin_path() . '/comicpress-icon.png');
    add_submenu_page($filename, $plugin_title, __("Upload", 'comicpress-manager'), $access_level, $filename, 'cpm_manager_index_caller');
    //if (!$wpmu_version) {
    add_submenu_page($filename, $plugin_title, __("Import", 'comicpress-manager'), $access_level, $filename . '-import', 'cpm_manager_import_caller');
    //}
    add_submenu_page($filename, $plugin_title, __("Bulk Edit", 'comicpress-manager'), $access_level, $filename . '-status', 'cpm_manager_status_caller');
    add_submenu_page($filename, $plugin_title, __("Storyline Structure", 'comicpress-manager'), $access_level, $filename . '-storyline', 'cpm_manager_storyline_caller');
    add_submenu_page($filename, $plugin_title, __("Change Dates", 'comicpress-manager'), $access_level, $filename . '-dates', 'cpm_manager_dates_caller');
    add_submenu_page($filename, $plugin_title, __("ComicPress Config", 'comicpress-manager'), $access_level, $filename . '-config', 'cpm_manager_config_caller');
    add_submenu_page($filename, $plugin_title, __("Manager Config", 'comicpress-manager'), $access_level, $filename . '-cpm-config', 'cpm_manager_cpm_config_caller');
    if ($pagenow == "index.php") {
        if (cpm_option('cpm-enable-dashboard-rss-feed') == 1) {
            wp_register_sidebar_widget('dashboard_cpm', __("ComicPress News", "comicpress-manager"), 'cpm_dashboard_widget', array('all_link' => "http://mindfaucet.com/comicpress/", 'feed_link' => "http://feeds.feedburner.com/comicpress?format=xml", 'width' => 'half', 'class' => 'widget_rss'));
            add_filter('wp_dashboard_widgets', 'cpm_add_dashboard_widget');
        }
        if (($option = generate_comic_categories_options('category')) !== false) {
            if (cpm_option('cpm-enable-quomicpress') == 1) {
                if (count($cpm_config->errors) == 0) {
                    if (current_user_can('edit_post')) {
                        wp_register_sidebar_widget('dashboard_quomicpress', __("QuomicPress (Quick ComicPress)", "comicpress-manager"), 'cpm_quomicpress_widget', array('width' => 'half'));
                        add_filter('wp_dashboard_widgets', 'cpm_add_quomicpress_widget');
                    }
                }
            }
        }
    }
}
 /**
  * Add pages to the admin interface and load necessary JavaScript libraries.
  * Also read in the configuration and handle any POST actions.
  */
 function setup_admin_menu()
 {
     global $plugin_page, $access_level, $pagenow, $comicpress_manager, $wp_version;
     load_plugin_textdomain('comicpress-manager', $this->get_plugin_path());
     $comicpress_manager->read_information_and_check_config();
     $do_enqueue_prototype = false;
     if ($pagenow == "post.php" && $_REQUEST['action'] == "edit") {
         $do_enqueue_prototype = true;
     }
     $filename = plugin_basename(__FILE__);
     if (strpos($plugin_page, $filename) !== false) {
         $editor_load_pages = array($filename, $filename . '-import');
         if (in_array($plugin_page, $editor_load_pages)) {
             wp_enqueue_script('editor');
             if (!function_exists('wp_tiny_mce')) {
                 wp_enqueue_script('wp_tiny_mce');
             }
         }
         $do_enqueue_prototype = true;
         $this->handle_actions();
     }
     if (in_array($pagenow, array("edit.php", "post-new.php"))) {
         $do_enqueue_prototype = true;
     }
     if ($do_enqueue_prototype) {
         wp_enqueue_script('prototype');
         wp_enqueue_script('scriptaculous-effects');
         wp_enqueue_script('scriptaculous-builder');
     }
     if (!isset($access_level)) {
         $access_level = 10;
     }
     $plugin_title = __("ComicPress Manager", 'comicpress-manager');
     add_menu_page($plugin_title, __("ComicPress", 'comicpress-manager'), $access_level, $filename, array($this, "_index_caller"), get_option('siteurl') . '/' . $this->get_plugin_path() . '/comicpress-icon.png');
     add_submenu_page($filename, $plugin_title, __("Upload", 'comicpress-manager'), $access_level, $filename, array($this, '_index_caller'));
     if (!function_exists('get_site_option')) {
         add_submenu_page($filename, $plugin_title, __("Import", 'comicpress-manager'), $access_level, $filename . '-import', array($this, '_import_caller'));
     }
     add_submenu_page($filename, $plugin_title, __("Bulk Edit", 'comicpress-manager'), $access_level, $filename . '-status', array($this, '_bulk_edit_caller'));
     add_submenu_page($filename, $plugin_title, __("Storyline Structure", 'comicpress-manager'), $access_level, $filename . '-storyline', array($this, '_storyline_caller'));
     add_submenu_page($filename, $plugin_title, __("Change Dates", 'comicpress-manager'), $access_level, $filename . '-dates', array($this, '_dates_caller'));
     add_submenu_page($filename, $plugin_title, __("ComicPress Config", 'comicpress-manager'), $access_level, $filename . '-config', array($this, '_comicpress_config_caller'));
     add_submenu_page($filename, $plugin_title, __("Manager Config", 'comicpress-manager'), $access_level, $filename . '-cpm-config', array($this, '_manager_config_caller'));
     if ($pagenow == "index.php") {
         if ($comicpress_manager->get_cpm_option('cpm-enable-dashboard-rss-feed') == 1) {
             wp_register_sidebar_widget('dashboard_cpm', __("ComicPress News", "comicpress-manager"), array($this, 'dashboard_widget'), array('all_link' => "http://mindfaucet.com/comicpress/", 'feed_link' => "http://feeds.feedburner.com/comicpress?format=xml", 'width' => 'half', 'class' => 'widget_rss'));
             add_filter('wp_dashboard_widgets', array($this, 'add_dashboard_widget'));
         }
         if (($option = generate_comic_categories_options('category')) !== false) {
             if ($comicpress_manager->get_cpm_option('cpm-enable-quomicpress') == 1) {
                 if (count($comicpress_manager->errors) == 0) {
                     wp_register_sidebar_widget('dashboard_quomicpress', __("QuomicPress (Quick ComicPress)", "comicpress-manager"), array($this, 'quomicpress_widget'), array('width' => 'half'));
                     add_filter('wp_dashboard_widgets', array($this, 'add_quomicpress_widget'));
                 }
             }
         }
     }
 }