Changeset 2824
- Timestamp:
- 03/28/2016 05:11:35 PM (10 years ago)
- Location:
- sites/branches/application-tracking/wordcamp.org/public_html/wp-content/plugins/wcpt
- Files:
-
- 3 edited
-
views/wordcamp/metabox-status.php (modified) (1 diff)
-
wcpt-wordcamp/wordcamp-admin.php (modified) (4 diffs)
-
wcpt-wordcamp/wordcamp-loader.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
sites/branches/application-tracking/wordcamp.org/public_html/wp-content/plugins/wcpt/views/wordcamp/metabox-status.php
r2823 r2824 12 12 <span id="post-status-display"> 13 13 <select name="post_status"> 14 <?php $transitions = WordCamp_Loader::get_valid_status_transitions( $post->post_status ); ?> 14 15 <?php foreach ( WordCamp_Loader::get_post_statuses() as $key => $label ) : ?> 15 16 <?php $status = get_post_status_object( $key ); ?> 16 <option value="<?php echo esc_attr( $status->name ); ?>" <?php selected( $post->post_status, $status->name ); ?> > 17 <option value="<?php echo esc_attr( $status->name ); ?>" <?php 18 if ( $post->post_status == $status->name ) { 19 selected( true ); 20 } elseif ( ! in_array( $status->name, $transitions ) ) { 21 echo ' disabled '; 22 } 23 ?>> 17 24 <?php echo esc_html( $status->label ); ?> 18 25 </option> -
sites/branches/application-tracking/wordcamp.org/public_html/wp-content/plugins/wcpt/wcpt-wordcamp/wordcamp-admin.php
r2823 r2824 45 45 add_action( 'wcpt_added_to_planning_schedule', array( $this, 'add_organizer_to_central' ), 10 ); 46 46 add_action( 'wcpt_added_to_planning_schedule', array( $this, 'mark_date_added_to_planning_schedule' ), 10 ); 47 add_filter( 'wp_insert_post_data', array( $this, 'enforce_post_status _progression' ), 10, 2 );47 add_filter( 'wp_insert_post_data', array( $this, 'enforce_post_status' ), 10, 2 ); 48 48 add_filter( 'wp_insert_post_data', array( $this, 'require_complete_meta_to_publish_wordcamp' ), 10, 2 ); 49 49 … … 695 695 696 696 /** 697 * Force WordCamp posts to go through the expected status progression.697 * Enforce a valid post status for WordCamps. 698 698 * 699 699 * @param array $post_data … … 701 701 * @return array 702 702 */ 703 public function enforce_post_status _progression( $post_data, $post_data_raw ) {703 public function enforce_post_status( $post_data, $post_data_raw ) { 704 704 if ( $post_data['post_type'] != WCPT_POST_TYPE_ID || empty( $_POST['post_ID'] ) ) { 705 705 return $post_data; … … 709 709 if ( ! $post ) { 710 710 return $post_data; 711 }712 713 // @todo: Rewrite all of this according to the new flow.714 if ( ! empty( $_POST ) ) {715 $previous_post_status = get_post( absint( $_POST['post_ID'] ) );716 $previous_post_status = $previous_post_status->post_status;717 718 if ( 'pending' == $post_data['post_status'] && ! in_array( $previous_post_status, array( 'draft', 'pending', 'publish' ) ) ) {719 $this->active_admin_notices[] = 2;720 $post_data['post_status'] = $previous_post_status;721 }722 723 if ( 'publish' == $post_data['post_status'] && ! in_array( $previous_post_status, array( 'pending', 'publish' ) ) ) {724 $this->active_admin_notices[] = 2;725 $post_data['post_status'] = $previous_post_status;726 }727 711 } 728 712 -
sites/branches/application-tracking/wordcamp.org/public_html/wp-content/plugins/wcpt/wcpt-wordcamp/wordcamp-loader.php
r2805 r2824 117 117 } 118 118 119 /** 120 * Get WordCamp post statuses. 121 * 122 * @return array 123 */ 119 124 public static function get_post_statuses() { 120 125 return array( … … 137 142 ); 138 143 } 144 145 /** 146 * Return valid transitions given a post status. 147 * 148 * @param string $status Current status. 149 * 150 * @return array Valid transitions. 151 */ 152 public static function get_valid_status_transitions( $status ) { 153 $transitions = array( 154 'wcpt-formal-review' => array( 'wcpt-inactive', 'wcpt-application-rev' ), 155 'wcpt-inactive' => array( 'wcpt-formal-review', 'wcpt-application-rev' ), 156 'wcpt-application-rev' => array( 'wcpt-inactive', 'wcpt-scheduling' ), 157 'wcpt-scheduling' => array( 'wcpt-inactive', 'wcpt-interview-sched', 'wcpt-application-rev' ), 158 'wcpt-interview-sched' => array( 'wcpt-inactive', 'wcpt-needs-site', 'wcpt-scheduling', 'wcpt-rejected' ), 159 'wcpt-needs-site' => array( 'wcpt-inactive', 'wcpt-agreement-sig', 'wcpt-interview-sched' ), 160 'wcpt-rejected' => array( 'wcpt-inactive' ), 161 'wcpt-agreement-sig' => array( 'wcpt-inactive', 'wcpt-site-created', 'wcpt-needs-site' ), 162 'wcpt-site-created' => array( 'wcpt-inactive', 'wcpt-listing-added', 'wcpt-agreement-sig' ), 163 'wcpt-listing-added' => array( 'wcpt-inactive', 'wcpt-needs-budget-re', 'wcpt-site-created' ), 164 'wcpt-needs-budget-re' => array( 'wcpt-inactive', 'wcpt-budget-approved', 'wcpt-listing-added' ), 165 'wcpt-budget-approved' => array( 'wcpt-inactive', 'wcpt-venue-signed', 'wcpt-needs-budget-re' ), 166 'wcpt-venue-signed' => array( 'wcpt-inactive', 'wcpt-scheduled', 'wcpt-budget-approved' ), 167 'wcpt-scheduled' => array( 'wcpt-inactive', 'wcpt-debrief', 'wcpt-venue-signed' ), 168 'wcpt-debrief' => array( 'wcpt-inactive', 'wcpt-budget-closed', 'wcpt-scheduled' ), 169 'wcpt-budget-closed' => array( 'wcpt-inactive', 'wcpt-debrief' ), 170 ); 171 172 if ( empty( $transitions[ $status ] ) ) 173 return array( 'wcpt-inactive', 'wcpt-formal-review' ); 174 175 return $transitions[ $status ]; 176 } 139 177 } 140 178
Note: See TracChangeset
for help on using the changeset viewer.