The page you are looking at now is at this URL: http://pastoid.com/bz6
This paste was last updated on February 14, 2010 at 7:18 pm.
@@ -467,17 +467,21 @@ */ public function post_publish() { + $this->get_publish(); + } + + public function form_publish_success( FormUI $form ) + { $post_id = 0; - if ( isset($this->handler_vars['id']) ) { - $post_id = intval($this->handler_vars['id']); + if ( isset( $this->handler_vars['id'] ) ) { + $post_id = intval( $this->handler_vars['id'] ); } - // If an id has been passed in, we're updating an existing post, otherwise we're creating one if ( 0 !== $post_id ) { $post = Post::get( array( 'id' => $post_id, 'status' => Post::status( 'any' ) ) ); $this->theme->admin_page = sprintf(_t('Publish %s'), Plugins::filter('post_type_display', Post::type_name($post->content_type), 'singular')); - $form = $post->get_form( 'admin' ); +// $form = $post->get_form( 'admin' ); // Verify that the post hasn't already been updated since the form was loaded if ( $post->modified != $form->modified->value ) { @@ -534,7 +538,7 @@ } else { $post = new Post(); - $form = $post->get_form( 'admin' ); +// $form = $post->get_form( 'admin' ); // check the user can create new posts of the set type. $user = User::identify(); $type = 'post_' . Post::type_name($form->content_type->value); @@ -543,7 +547,8 @@ $this->get_blank(); } - $form->set_option( 'form_action', URL::get('admin', 'page=publish' ) ); +// $form->set_option( 'form_action', URL::get('admin', 'page=publish' ) ); + $form->on_success( array( $this, 'form_publish_success' ) ); if ( HabariDateTime::date_create( $form->pubdate->value )->int > $post->pubdate->int ) { $post->pubdate = HabariDateTime::date_create( $form->pubdate->value ); @@ -599,7 +604,8 @@ $$key = $value; } - if ( isset( $id ) ) { + // 0 is what's assigned to new posts + if ( isset( $id ) && ( $id != 0 )) { $post = Post::get( array( 'id' => $id, 'status' => Post::status( 'any' ) ) ); if ( !$post ) { Session::error(_t('Access to that post id is denied')); @@ -628,13 +634,14 @@ $this->theme->statuses = $statuses; $form = $post->get_form( 'admin' ); - $form->set_option( 'form_action', URL::get('admin', 'page=publish' ) ); +// $form->set_option( 'form_action', URL::get('admin', 'page=publish' ) ); + $form->on_success( array( $this, 'form_publish_success' ) ); $this->theme->form = $form; $this->theme->wsse = Utils::WSSE(); + $this->display( $template ); - $this->display( $template ); } /**
| Referring Domain | Hits |
|---|---|
| Unknown Referer | 125 |
| pastoid.com | 3 |
| drunkenmonkey.org | 1 |
Tip: Use Pastoid to shorten URLs with this bookmarklet: Pastoid This