work on archive dropdown, currently broken

This commit is contained in:
John Bintz 2009-12-10 07:46:59 -05:00
parent 039763281b
commit 690aa46ba1
1 changed files with 23 additions and 5 deletions

View File

@ -3,8 +3,8 @@
Widget Name: comicpress archive dropdown Widget Name: comicpress archive dropdown
Widget URI: http://comicpress.org/ Widget URI: http://comicpress.org/
Description: Description:
Author: Philip M. Hofer (Frumph) Author: Philip M. Hofer (Frumph) & John Bintz
Version: 1.04 Version: 1.1
Author URI: http://frumph.net/ Author URI: http://frumph.net/
*/ */
@ -24,7 +24,7 @@ function comicpress_archive_dropdown() { ?>
<div class="archive-dropdown-wrap"> <div class="archive-dropdown-wrap">
<select name="archive-dropdown" class="archive-dropdown" onchange='document.location.href=this.options[this.selectedIndex].value;'> <select name="archive-dropdown" class="archive-dropdown" onchange='document.location.href=this.options[this.selectedIndex].value;'>
<option value=""><?php echo attribute_escape(__('Archives...','comicpress')); ?></option> <option value=""><?php echo attribute_escape(__('Archives...','comicpress')); ?></option>
<?php wp_get_archives('type=monthly&format=option&show_post_count=-1'); ?> <?php ; ?>
</select> </select>
</div> </div>
<?php } <?php }
@ -65,6 +65,7 @@ class ArchiveDropdownWidget extends WP_Widget {
function build_dropdown($entries) { function build_dropdown($entries) {
if (is_string($entries) || is_array($entries)) { if (is_string($entries) || is_array($entries)) {
$id = 'archive-dropdown-' . md5(rand()); $id = 'archive-dropdown-' . md5(rand());
$button_id = 'archive-dropdown-submit-' . md5(rand());
$nonce = wp_create_nonce('comicpress'); $nonce = wp_create_nonce('comicpress');
$action_nonce = wp_create_nonce('comicpress-follow-archive-dropdown'); $action_nonce = wp_create_nonce('comicpress-follow-archive-dropdown');
@ -88,17 +89,34 @@ class ArchiveDropdownWidget extends WP_Widget {
} }
?> ?>
</select> </select>
<input type="submit" value="<?php echo esc_attr(apply_filters('comicpress_archive_dropdown_submit_button', __('Go', 'comicpress'))) ?>" /> <input id="<?php echo esc_attr($button_id) ?>" type="submit" value="<?php echo esc_attr(apply_filters('comicpress_archive_dropdown_submit_button', __('Go', 'comicpress'))) ?>" />
</form> </form>
</div> </div>
<script type="text/javascript"> <script type="text/javascript">
document.getElementById('<?php echo esc_js($button_id) ?>').style.display = 'none';
document.getElementById('<?php echo esc_js($id) ?>').onchange = function(e) {
document.location.href = e.target.options[e.target.selectedIndex].value;
};
</script> </script>
<?php return ob_get_clean(); <?php return ob_get_clean();
} }
return ''; return '';
} }
function build_monthly_archive_dropdown() {
return $this->build_dropdown(wp_get_archives('type=monthly&format=option&show_post_count=-1&echo=0'));
}
function _new_comicpressstoryline() { return new ComicPressStoryline(); }
function _new_comicpressdbinterface() { return new ComicPressDBInterface(); }
function build_comic_archive_dropdown() {
$storyline = $this->_new_comicpressstoryline();
$storyline->read_from_options();
}
function widget($args, $instance) { function widget($args, $instance) {
extract($args, EXTR_SKIP); extract($args, EXTR_SKIP);