Permalink
Browse files

Merge branch 'develop'

  • Loading branch information...
danielbachhuber committed Jan 9, 2012
2 parents 4d1680e + 8e4099a commit 2c5fc46c5031886282feb55aa699967a1205f26c
View
@@ -4,9 +4,4 @@ jQuery(document).ready(function() {
dateFormat: 'M dd yy',
firstDay: ef_week_first_day,
});
-
- jQuery('span.description .clear-date').click(function() {
- $(this).closest('div').find('input.date-pick').val('');
- return false;
- })
});
View
31 common/php/class-module.php 100644 → 100755
@@ -488,6 +488,7 @@ function users_select_form( $selected = null, $args = null ) {
'display_name',
'user_email'
),
+ 'orderby' => 'display_name',
);
$users = get_users( $args );
@@ -501,8 +502,8 @@ function users_select_form( $selected = null, $args = null ) {
<li>
<label for="<?php echo esc_attr( $input_id .'-'. $user->ID ) ?>">
<input type="checkbox" id="<?php echo esc_attr( $input_id .'-'. $user->ID ) ?>" name="<?php echo esc_attr( $input_id ) ?>[]" value="<?php echo esc_attr( $user->ID ); ?>" <?php echo $checked; ?> />
- <span class="ef-user-displayname"><?php echo esc_html( $user->display_name ); ?></span>
- <span class="ef-user-useremail"><?php echo esc_html( $user->user_email ); ?></span>
+ <span class="ef-user_displayname"><?php echo esc_html( $user->display_name ); ?></span>
+ <span class="ef-user_useremail"><?php echo esc_html( $user->user_email ); ?></span>
</label>
</li>
<?php endforeach; ?>
@@ -533,6 +534,32 @@ function add_caps_to_role( $role, $caps ) {
$role->add_cap( $cap );
}
}
+
+ /**
+ * Add settings help menus to our module screens if the values exist
+ * Auto-registered in Edit_Flow::register_module()
+ *
+ * @since 0.7
+ */
+ function action_settings_help_menu() {
+
+ $screen = get_current_screen();
+
+ if ( !method_exists( $screen, 'add_help_tab' ) )
+ return;
+
+ if ( $screen->id != 'edit-flow_page_' . $this->module->settings_slug )
+ return;
+
+ // Make sure we have all of the required values for our tab
+ if ( isset( $this->module->settings_help_tab['id'], $this->module->settings_help_tab['title'], $this->module->settings_help_tab['content'] ) ) {
+ $screen->add_help_tab( $this->module->settings_help_tab );
+
+ if ( isset( $this->module->settings_help_sidebar ) ) {
+ $screen->set_help_sidebar( $this->module->settings_help_sidebar );
+ }
+ }
+ }
}
}
View
@@ -4,10 +4,10 @@
Plugin URI: http://editflow.org/
Description: Remixing the WordPress admin for better editorial workflow options.
Author: Daniel Bachhuber, Scott Bressler, Mohammad Jangda, Automattic, and others
-Version: 0.7-beta4
+Version: 0.7-beta5
Author URI: http://editflow.org/
-Copyright 2009-2011 Mohammad Jangda, Daniel Bachhuber, et al.
+Copyright 2009-2012 Mohammad Jangda, Daniel Bachhuber, et al.
GNU General Public License, Free Software Foundation <http://creativecommons.org/licenses/GPL/2.0/>
@@ -28,7 +28,7 @@
*/
// Define contants
-define( 'EDIT_FLOW_VERSION' , '0.7-beta4' );
+define( 'EDIT_FLOW_VERSION' , '0.7-beta5' );
define( 'EDIT_FLOW_ROOT' , dirname(__FILE__) );
define( 'EDIT_FLOW_FILE_PATH' , EDIT_FLOW_ROOT . '/' . basename(__FILE__) );
define( 'EDIT_FLOW_URL' , plugins_url( '/', __FILE__ ) );
@@ -202,6 +202,11 @@ public function register_module( $name, $args = array() ) {
$args['settings_slug'] = 'ef-' . $args['slug'] . '-settings';
if ( empty( $args['post_type_support'] ) )
$args['post_type_support'] = 'ef_' . $name;
+ // If there's a Help Screen registered for the module, make sure we
+ // auto-load it
+ if ( !empty( $args['settings_help_tab'] ) )
+ add_action( 'load-edit-flow_page_' . $args['settings_slug'], array( &$this->$name, 'action_settings_help_menu' ) );
+
$this->modules->$name = (object) $args;
do_action( 'ef_module_registered', $name );
return $this->modules->$name;
View
35 modules/calendar/calendar.php 100644 → 100755
@@ -44,10 +44,16 @@ function __construct() {
'messages' => array(
'post-date-updated' => __( "Post date updated.", 'edit-flow' ),
'update-error' => __( 'There was an error updating the post. Please try again.', 'edit-flow' ),
- 'published-post-ajax' => __( "AJAX doesn't work for published content.", 'edit-flow' ),
+ 'published-post-ajax' => __( "Updating the post date dynamically doesn't work for published content. Please <a href='%s'>edit the post</a>.", 'edit-flow' ),
),
'configure_page_cb' => 'print_configure_view',
- 'configure_link_text' => __( 'Calendar Options', 'edit-flow' ),
+ 'configure_link_text' => __( 'Calendar Options', 'edit-flow' ),
+ 'settings_help_tab' => array(
+ 'id' => 'ef-calendar-overview',
+ 'title' => __('Overview', 'edit-flow'),
+ 'content' => __('<p>The calendar is a convenient week-by-week or month-by-month view into your content. Quickly see which stories are on track to being published on time, and which will need extra effort.</p>', 'edit-flow'),
+ ),
+ 'settings_help_sidebar' => __( '<p><strong>For more information:</strong></p><p><a href="http://editflow.org/features/calendar/">Calendar Documentation</a></p><p><a href="http://wordpress.org/tags/edit-flow?forum_id=10">Edit Flow Forum</a></p><p><a href="https://github.com/danielbachhuber/Edit-Flow">Edit Flow on Github</a></p>', 'edit-flow' ),
);
$this->module = $edit_flow->register_module( 'calendar', $args );
@@ -255,7 +261,7 @@ function handle_ajax_drag_and_drop() {
'private',
);
if ( in_array( $post->post_status, $published_statuses ) )
- $this->print_ajax_response( 'error', $this->module->messages['published-post-ajax'] );
+ $this->print_ajax_response( 'error', sprintf( $this->module->messages['published-post-ajax'], get_edit_post_link( $post_id ) ) );
// Check that the new date passed is a valid one
$next_date_full = strtotime( $_POST['next_date'] );
@@ -630,6 +636,12 @@ function view_calendar() {
<div class="item-inner">
<table class="item-information">
<?php foreach( $ef_calendar_item_information_fields as $field => $values ): ?>
+ <?php
+ // Allow filters to hide empty fields or to hide any given individual field. Hide empty fields by default.
+ if ( ( apply_filters( 'ef_calendar_hide_empty_item_information_fields', true, $post->ID ) && empty( $values['value'] ) )
+ || apply_filters( "ef_calendar_hide_{$field}_item_information_field", false, $post->ID ) )
+ continue;
+ ?>
<tr class="item-field item-information-<?php echo esc_attr( $field ); ?>">
<th class="label"><?php echo esc_html( $values['label'] ); ?>:</th>
<?php if ( $values['value'] ): ?>
@@ -778,16 +790,16 @@ function print_top_navigation( $filters, $dates ) {
</li>
<?php /** Previous and next navigation items (translatable so they can be increased if needed )**/ ?>
- <li class="next-week">
+ <li class="date-change next-week">
<a title="<?php printf( __( 'Forward 1 week', 'edit-flow' ) ); ?>" href="<?php echo esc_url( $this->get_pagination_link( 'next', $filters, 1 ) ); ?>"><?php _e( '&rsaquo;', 'edit-flow' ); ?></a>
<?php if ( $this->total_weeks > 1): ?>
<a title="<?php printf( __( 'Forward %d weeks', 'edit-flow' ), $this->total_weeks ); ?>" href="<?php echo esc_url( $this->get_pagination_link( 'next', $filters ) ); ?>"><?php _e( '&raquo;', 'edit-flow' ); ?></a>
<?php endif; ?>
</li>
- <li class="today">
+ <li class="date-change today">
<a title="<?php printf( __( 'Today is %s', 'edit-flow' ), date( get_option( 'date_format' ) ) ); ?>" href="<?php echo esc_url( $this->get_pagination_link( 'next', $filters, 0 ) ); ?>"><?php _e( 'Today', 'edit-flow' ); ?></a>
</li>
- <li class="previous-week">
+ <li class="date-change previous-week">
<?php if ( $this->total_weeks > 1): ?>
<a title="<?php printf( __( 'Back %d weeks', 'edit-flow' ), $this->total_weeks ); ?>" href="<?php echo esc_url( $this->get_pagination_link( 'previous', $filters ) ); ?>"><?php _e( '&laquo;', 'edit-flow' ); ?></a>
<?php endif; ?>
@@ -1032,6 +1044,7 @@ function register_settings() {
add_settings_section( $this->module->options_group_name . '_general', false, '__return_false', $this->module->options_group_name );
add_settings_field( 'post_types', 'Post types to show', array( &$this, 'settings_post_types_option' ), $this->module->options_group_name, $this->module->options_group_name . '_general' );
+ add_settings_field( 'number_of_weeks', 'Number of weeks to show', array( &$this, 'settings_number_weeks_option' ), $this->module->options_group_name, $this->module->options_group_name . '_general' );
}
@@ -1044,6 +1057,16 @@ function settings_post_types_option() {
global $edit_flow;
$edit_flow->settings->helper_option_custom_post_type( $this->module );
}
+
+ /**
+ * Give a bit of helper text to indicate the user can change
+ * number of weeks in the screen options
+ *
+ * @since 0.7
+ */
+ function settings_number_weeks_option() {
+ echo '<span class="description">' . __( 'The number of weeks shown on the calendar can be changed on a user-by-user basis using the calendar\'s screen options.', 'edit-flow' ) . '</span>';
+ }
/**
* Validate the data submitted by the user in calendar settings
@@ -316,7 +316,7 @@ table#ef-calendar-view .day-unit ul li .item-overlay .item-actions a {
margin-right: 0;
}
-.ef-calendar-navigation a {
+.ef-calendar-navigation li.date-change a {
text-decoration:none;
-moz-border-radius:5px 5px 5px 5px;
-webkit-border-radius:5px 5px 5px 5px;
@@ -362,9 +362,7 @@ table#ef-calendar-view .day-unit ul li .item-overlay .item-actions a {
}
.ef-calendar-navigation li.ajax-actions,
-.ef-calendar-navigation li.previous-week,
-.ef-calendar-navigation li.next-week,
-.ef-calendar-navigation li.today {
+.ef-calendar-navigation li.date-change {
float:right;
}
View
@@ -53,6 +53,13 @@ function __construct() {
'status-position-updated' => __( "Status order updated.", 'edit-flow' ),
),
'autoload' => false,
+ 'load_frontend' => true, // Load on the frontend so that previewing posts with custom statuses works
+ 'settings_help_tab' => array(
+ 'id' => 'ef-custom-status-overview',
+ 'title' => __('Overview', 'edit-flow'),
+ 'content' => __('<p>Edit Flow’s custom statuses allow you to define the most important stages of your editorial workflow. Out of the box, WordPress only offers “Draft” and “Pending Review” as post states. With custom statuses, you can create your own post states like “In Progress”, “Pitch”, or “Waiting for Edit” and keep or delete the originals. You can also drag and drop statuses to set the best order for your workflow.</p><p>Custom statuses are fully integrated into the rest of Edit Flow and the WordPress admin. On the calendar and story budget, you can filter your view to see only posts of a specific post state. Furthermore, email notifications can be sent to a specific group of users when a post changes state.</p>', 'edit-flow'),
+ ),
+ 'settings_help_sidebar' => __( '<p><strong>For more information:</strong></p><p><a href="http://editflow.org/features/custom-statuses/">Custom Status Documentation</a></p><p><a href="http://wordpress.org/tags/edit-flow?forum_id=10">Edit Flow Forum</a></p><p><a href="https://github.com/danielbachhuber/Edit-Flow">Edit Flow on Github</a></p>', 'edit-flow' ),
);
$this->module = $edit_flow->register_module( 'custom_status', $args );
@@ -88,6 +95,10 @@ function init() {
add_filter( 'manage_posts_columns', array( &$this, '_filter_manage_posts_columns') );
add_action( 'manage_posts_custom_column', array( &$this, '_filter_manage_posts_custom_column') );
+ // We need these for pages (http://core.trac.wordpress.org/browser/tags/3.3.1/wp-admin/includes/class-wp-posts-list-table.php#L283)
+ add_filter( 'manage_pages_columns', array( &$this, '_filter_manage_posts_columns' ) );
+ add_action( 'manage_pages_custom_column', array( &$this, '_filter_manage_posts_custom_column' ) );
+
// These two methods are hacks for fixing bugs in WordPress core
add_action( 'admin_init', array( &$this, 'check_timestamp_on_publish' ) );
add_filter( 'wp_insert_post_data', array( &$this, 'fix_custom_status_timestamp' ) );
@@ -225,17 +236,17 @@ function register_custom_statuses() {
* - We have other custom code for Quick Edit and JS niceties
*/
function action_admin_enqueue_scripts() {
-
// Load Javascript we need to use on the configuration views (jQuery Sortable and Quick Edit)
if ( $this->is_whitelisted_settings_view( $this->module->name ) ) {
wp_enqueue_script( 'jquery-ui-sortable' );
wp_enqueue_script( 'edit-flow-custom-status-configure', EDIT_FLOW_URL . 'modules/custom-status/lib/custom-status-configure.js', array( 'jquery', 'jquery-ui-sortable', 'edit-flow-settings-js' ), EDIT_FLOW_VERSION, true );
}
// Custom javascript to modify the post status dropdown where it shows up
- if ( $this->is_whitelisted_page() )
- wp_enqueue_script( 'edit_flow-custom_status', EDIT_FLOW_URL.'modules/custom-status/lib/custom-status.js', array( 'jquery','post' ), EDIT_FLOW_VERSION, true );
-
+ if ( $this->is_whitelisted_page() ) {
+ wp_enqueue_script( 'edit_flow-custom_status', EDIT_FLOW_URL . 'modules/custom-status/lib/custom-status.js', array( 'jquery','post' ), EDIT_FLOW_VERSION, true );
+ wp_enqueue_style( 'edit_flow-custom_status', EDIT_FLOW_URL . 'modules/custom-status/lib/custom-status.css', false, EDIT_FLOW_VERSION, 'all' );
+ }
}
/**
@@ -0,0 +1,4 @@
+/* Hide the post-state (status) span since we display a custom column with post status */
+span.post-state {
+ display: none;
+}
@@ -34,8 +34,6 @@ jQuery(document).ready(function() {
jQuery('#the-list a.editinline').bind( 'click', function() {
ef_append_to_dropdown('#the-list select[name="_status"]');
} );
- // Apply the post state to post titles. Only works on initial load but not after inline edit
- ef_apply_post_state_to_titles();
// Clean up the bulk edit selector because it's non-standard
jQuery( '#bulk-edit' ).find( 'select[name="_status"]' ).prepend( '<option value="">' + ef_text_no_change + '</option>' );
jQuery( '#bulk-edit' ).find( 'select[name="_status"] option' ).removeAttr('selected');
@@ -101,19 +99,6 @@ jQuery(document).ready(function() {
}
- /**
- * Add the post state to post titles on edit.php, mimicking the 'draft' and private that are already added
- */
- function ef_apply_post_state_to_titles() {
- var status_blacklist = new Array( 'Published', 'Scheduled' );
- jQuery('#the-list tr').each( function() {
- var status = jQuery(this).find('td.status').html();
- if ( jQuery.inArray( status, status_blacklist ) == -1 && jQuery(this).find('.post-title strong .post-state').length == 0 )
- jQuery(this).find('.post-title strong').append( ' - <span class="post-state">' + status + '</span>' );
-
- });
- }
-
// Update "Save" button text
function ef_update_save_button( text ) {
if(!text) text = 'Save as ' + jQuery('select[name="post_status"] :selected').text();
@@ -127,7 +112,20 @@ jQuery(document).ready(function() {
if(this.slug==slug) name = this.name;
});
return name;
-
+ }
+
+ // If we're on the Manage Posts screen, remove the trailing dashes left behind once we hide the post-state span (the status).
+ // We do this since we already add a custom column for post status on the screen since custom statuses are a core part of EF.
+ if ( jQuery('.post-state').length > 0 ) {
+ ef_remove_post_title_trailing_dashes();
+ }
+
+ // Remove the " - " in between a post title and the post-state span (separately hidden via CSS).
+ // This will not affect the dash before post-state-format spans.
+ function ef_remove_post_title_trailing_dashes() {
+ jQuery('.post-title.column-title strong').each(function() {
+ jQuery(this).html(jQuery(this).html().replace(/(.*) - (<span class="post-state".*<\/span>)$/g, "$1$2"));
+ });
}
});
@@ -128,7 +128,7 @@ function post_status_widget () {
$statuses = $this->get_post_statuses();
// If custom statuses are enabled, we'll output a link to edit the terms just below the post counts
if ( $this->module_enabled( 'custom_status' ) )
- $edit_custom_status_url = add_query_arg( 'configure', 'custom-status', EDIT_FLOW_SETTINGS_PAGE );
+ $edit_custom_status_url = add_query_arg( 'page', 'ef-custom-status-settings', get_admin_url( null, 'admin.php' ) );
?>
<p class="sub"><?php _e('Posts at a Glance', 'edit-flow') ?></p>
@@ -265,10 +265,10 @@ function settings_my_posts_widget_option() {
function settings_validate( $new_options ) {
// Follow whitelist validation for modules
- if ( $new_options['post_status_widget'] != 'on' )
+ if ( array_key_exists( 'post_status_widget', $new_options ) && $new_options['post_status_widget'] != 'on' )
$new_options['post_status_widget'] = 'off';
- if ( $new_options['my_posts_widget'] != 'on' )
+ if ( array_key_exists( 'my_posts_widget', $new_options ) && $new_options['my_posts_widget'] != 'on' )
$new_options['my_posts_widget'] = 'off';
return $new_options;
Oops, something went wrong.

0 comments on commit 2c5fc46

Please sign in to comment.