Merge branch 'master' of github.com:johnbintz/comicpress-2.8

This commit is contained in:
Philip M. Hofer (Frumph) 2010-01-02 12:42:50 -08:00
commit f939071692
12 changed files with 239 additions and 238 deletions

View File

@ -1,21 +1,26 @@
<?php
function options() {
$pagehook = add_submenu_page('themes.php','comicpress', __('ComicPress Options','comicpress'), 10, 'comicpress-options', 'comicpress_admin');
function comicpress_options_setup() {
$pagehook = add_submenu_page('themes.php',__('ComicPress Options', 'comicpress'), __('ComicPress Options','comicpress'), 10, 'comicpress-options', 'comicpress_admin');
add_action('admin_head-' . $pagehook, 'comicpress_admin_page_head');
add_action('admin_print_scripts-' . $pagehook, 'comicpress_admin_print_scripts');
add_action('admin_print_styles-' . $pagehook, 'comicpress_admin_print_styles');
}
function comicpress_admin_page_head() {
function comicpress_admin_print_scripts() {
wp_enqueue_script('utils');
wp_enqueue_script('jquery');
}
function comicpress_admin_print_styles() {
wp_admin_css('css/global');
wp_admin_css();
wp_admin_css('css/colors');
wp_admin_css('css/ie');
wp_enqueue_script('utils');
?>
<link rel="stylesheet" href="<?php echo get_template_directory_uri(); ?>/options/options.css" type="text/css" media="screen" />
<script type="text/javascript" src="<?php echo get_template_directory_uri(); ?>/js/tabbed_pages.js"></script>
<!--[if lt ie 8]> <style> div.show { position: static; margin-top: 1px; } #cpadmin div.off { height: 22px; } </style> <![endif]-->
wp_enqueue_style('comicpress-options', get_template_directory_uri() . '/options/options.css');
}
function comicpress_admin_page_head() { ?>
<!--[if lt ie 8]> <style> div.show { position: static; margin-top: 1px; } #cpadmin div.off { height: 22px; } </style> <![endif]-->
<?php }
function comicpress_admin() {
@ -24,7 +29,6 @@ function comicpress_admin() {
?>
<div class="wrap">
<div id="cpadmin-headericon" style="background: url('<?php echo get_template_directory_uri(); ?>/images/options/comicpress_icon.png') no-repeat;"></div>
<h2 class="alignleft"><?php _e('ComicPress Options','comicpress'); ?></h2>
<div class="clear"></div>
@ -211,39 +215,64 @@ function comicpress_admin() {
$comicpress_options = comicpress_load_options();
?>
<div id="message" class="updated"><p><strong><?php _e('ComicPress Settings RESET!','comicpress'); ?></strong></p></div>
<script>function hidemessage() { document.getElementById('message').style.display = 'none'; }</script>
<?php
}
?>
<div id="poststuff" class="metabox-holder">
<div id="cpadmin" onclick="hidemessage();">
<div class="<?php if ($tab == 'themestyle' || empty($tab)) { ?>on<?php } else { ?>off<?php } ?>" title="themestyle"><span><?php _e('Layout','comicpress'); ?></span></div>
<div class="<?php if ($tab == 'general') { ?>on<?php } else { ?>off<?php } ?>" title="generaloptions"><span><?php _e('General','comicpress'); ?></span></div>
<div class="<?php if ($tab == 'index') { ?>on<?php } else { ?>off<?php } ?>" title="indexoptions"><span><?php _e('Home Page','comicpress'); ?></span></div>
<div class="<?php if ($tab == 'post') { ?>on<?php } else { ?>off<?php } ?>" title="postoptions"><span><?php _e('Posts &amp; Pages','comicpress'); ?></span></div>
<div class="<?php if ($tab == 'archivesearch') { ?>on<?php } else { ?>off<?php } ?>" title="archivesearch"><span><?php _e('Archive &amp; Search','comicpress'); ?></span></div>
<div class="<?php if ($tab == 'menubar') { ?>on<?php } else { ?>off<?php } ?>" title="menubaroptions"><span><?php _e('Menubar','comicpress'); ?></span></div>
<div class="<?php if ($tab == 'customheader') { ?>on<?php } else { ?>off<?php } ?>" title="customheader"><span><?php _e('Custom Header','comicpress'); ?></span></div>
<div class="<?php if ($tab == 'buyprint') { ?>on<?php } else { ?>off<?php } ?>" title="buyprintoptions"><span><?php _e('Buy Print','comicpress'); ?></span></div>
<div class="<?php if ($tab == 'config') { ?>on<?php } else { ?>off<?php } ?>" title="configoptions"><span><?php _e('Configuration','comicpress'); ?></span></div>
</div>
<div id="cpadmin">
<?php
foreach (glob(get_template_directory() . '/options/*.php') as $file) {
include($file);
}
$tab_info = array(
'themestyle' => __('Layout', 'comicpress'),
'general' => __('General', 'comicpress'),
'index' => __('Home Page', 'comicpress'),
'post' => __('Posts &amp; Pages', 'comicpress'),
'archivesearch' => __('Archive &amp; Search', 'comicpress'),
'menubar' => __('Menubar', 'comicpress'),
'customheader' => __('Custom Header', 'comicpress'),
'buyprint' => __('Buy Print', 'comicpress'),
'config' => __('Configuration', 'comicpress'),
);
if (empty($tab)) { $tab = array_shift(array_keys($tab_info)); }
foreach($tab_info as $tab_id => $label) { ?>
<div id="comicpress-tab-<?php echo $tab_id ?>" class="comicpress-tab <?php echo ($tab == $tab_id) ? 'on' : 'off'; ?>"><span><?php echo $label; ?></span></div>
<?php }
?>
</div>
<div id="comicpress-options-pages">
<?php foreach (glob(get_template_directory() . '/options/*.php') as $file) { include($file); } ?>
</div>
</div>
<script type="text/javascript">
(function($) {
var showPage = function(which) {
$('#comicpress-options-pages > div').each(function(i) {
$(this)[(this.id == 'comicpress-' + which) ? 'show' : 'hide']();
});
};
$('.comicpress-tab').click(function() {
$('#message').animate({height:"0", opacity:0, margin: 0}, 100, 'swing', function() { $(this).remove() });
showPage(this.id.replace('comicpress-tab-', ''));
var myThis = this;
$('.comicpress-tab').each(function() {
var isSame = (this == myThis);
$(this).toggleClass('on', isSame).toggleClass('off', !isSame);
});
return false;
});
showPage('<?php echo esc_js($tab) ?>');
}(jQuery));
</script>
</div>
<?php
}
add_action('admin_menu', 'options');
?>
add_action('admin_menu', 'comicpress_options_setup');

View File

@ -1,28 +0,0 @@
/* ================================================================
This copyright notice must be untouched at all times.
The original version of this script and the associated (x)html
is available at http://www.stunicholls.com/various/tabbed_pages.html
Copyright (c) 2005-2007 Stu Nicholls. All rights reserved.
This script and the associated (x)html may be modified in any
way to fit your requirements.
=================================================================== */
onload = function() {
var e, i = 0;
while (e = document.getElementById('cpadmin').getElementsByTagName ('DIV') [i++]) {
if (e.className == 'on' || e.className == 'off') {
e.onclick = function () {
var getEls = document.getElementsByTagName('DIV');
for (var z=0; z<getEls.length; z++) {
getEls[z].className=getEls[z].className.replace('show', 'hide');
getEls[z].className=getEls[z].className.replace('on', 'off');
}
this.className = 'on';
var max = this.getAttribute('title');
document.getElementById(max).className = "show";
}
}
}
}

View File

@ -1,4 +1,4 @@
<div id="archivesearch" class="<?php if ($tab == 'archivesearch') { ?>show<?php } else { ?>hide<?php } ?>">
<div id="comicpress-archivesearch">
<form method="post" id="myForm" name="template" enctype="multipart/form-data">
<?php wp_nonce_field('update-options') ?>

View File

@ -1,4 +1,4 @@
<div id="buyprintoptions" class="<?php if ($tab == 'buyprint') { ?>show<?php } else { ?>hide<?php } ?>">
<div id="comicpress-buyprint">
<form method="post" id="myForm" name="template" enctype="multipart/form-data">
<?php wp_nonce_field('update-options') ?>

View File

@ -1,4 +1,4 @@
<div id="configoptions" class="<?php if ($tab == 'config') { ?>show<?php } else { ?>hide<?php } ?>">
<div id="comicpress-config">
<form method="post" id="myForm" name="template" enctype="multipart/form-data">
<?php wp_nonce_field('update-options') ?>

View File

@ -1,4 +1,4 @@
<div id="customheader" class="<?php if ($tab == 'customheader') { ?>show<?php } else { ?>hide<?php } ?>">
<div id="comicpress-customheader">
<form method="post" id="myForm" name="template" enctype="multipart/form-data">
<?php wp_nonce_field('update-options') ?>

View File

@ -1,4 +1,4 @@
<div id="generaloptions" class="<?php if ($tab == 'general') { ?>show<?php } else { ?>hide<?php } ?>">
<div id="comicpress-general">
<form method="post" id="myForm" name="template" enctype="multipart/form-data">
<?php wp_nonce_field('update-options') ?>
@ -259,4 +259,3 @@
</form>
</div>

View File

@ -1,4 +1,4 @@
<div id="indexoptions" class="<?php if ($tab == 'index') { ?>show<?php } else { ?>hide<?php } ?>">
<div id="comicpress-index">
<form method="post" id="myForm" name="template" enctype="multipart/form-data">
<?php wp_nonce_field('update-options') ?>

View File

@ -1,4 +1,4 @@
<div id="menubaroptions" class="<?php if ($tab == 'menubar') { ?>show<?php } else { ?>hide<?php } ?>">
<div id="comicpress-menubar">
<form method="post" id="myForm" name="template" enctype="multipart/form-data">
<?php wp_nonce_field('update-options') ?>

View File

@ -11,6 +11,7 @@
padding: 5px 0 0 0;
line-height: 5px;
margin: 0 0 -1px 0;
overflow: hidden
}
#cpadmin div {

View File

@ -1,4 +1,4 @@
<div id="postoptions" class="<?php if ($tab == 'post') { ?>show<?php } else { ?>hide<?php } ?>">
<div id="comicpress-post">
<form method="post" id="myForm" name="template" enctype="multipart/form-data">
<?php wp_nonce_field('update-options') ?>

View File

@ -6,7 +6,7 @@
}
</script>
<div id="themestyle" class="<?php if ($tab == 'themestyle' || empty($tab)) { ?>show<?php } else { ?>hide<?php } ?>">
<div id="comicpress-themestyle">
<form method="post" id="myForm" name="template" enctype="multipart/form-data">