Dotclear

Changeset 1497:7b8e2fa94f9a


Ignore:
Timestamp:
08/20/13 12:37:19 (10 years ago)
Author:
Dsls
Branch:
twig
Message:

added post.php notifications

Files:
2 edited

Legend:

Unmodified
Added
Removed
  • admin/post.php

    r1493 r1497  
    1919     public static function savePost($form) { 
    2020          global $_ctx, $core; 
     21          if (!$form->can_edit_post) { 
     22               return; 
     23          } 
    2124          try { 
    2225               $form->check($_ctx); 
    23                $_ctx->setAlert('save'); 
    2426               $form->cat_id = (integer) $form->cat_id; 
    2527      
     
    8587                    # --BEHAVIOR-- adminAfterPostUpdate 
    8688                    $core->callBehavior('adminAfterPostUpdate',$cur,$form->id); 
    87                      
    8889                    http::redirect('post.php?id='.$form->id.'&upd=1'); 
    8990               } 
     
    102103               } 
    103104 
    104      } catch (Exception $e) { 
    105           $ctx->setError($e->getMessage()); 
    106      } 
    107 } 
    108      function deletePost($form) { 
    109           echo $form->id->getValue(); exit; 
     105          } catch (Exception $e) { 
     106               $_ctx->addError($e->getMessage()); 
     107          } 
     108     } 
     109     public static function deletePost($form) { 
     110          global $core,$_ctx; 
     111          if ($form->can_delete) { 
     112               try { 
     113                    $post_id = $form->id; 
     114                    $core->callBehavior('adminBeforePostDelete',$post_id); 
     115                    $core->blog->delPost($post_id); 
     116                    http::redirect('posts.php'); 
     117                    exit; 
     118               } catch (Exception $e) { 
     119                    $_ctx->addError($e->getMessage()); 
     120               } 
     121          } 
    110122     } 
    111123} 
     
    190202     ->addField( 
    191203          new dcFieldSubmit('delete',__('Delete'),array( 
    192                'action' => 'deletePost'))) 
     204               'action' => array('PostActions','deletePost')))) 
    193205     ->addField( 
    194206          new dcFieldCombo('post_status',$core->auth->getInfo('user_post_status'),$status_combo,array( 
     
    363375     $_ctx->post_url = $post->getURL(); 
    364376} 
    365       
     377 
     378if (!empty($_GET['upd'])) { 
     379     $_ctx->setAlert(__('Entry has been successfully updated.')); 
     380} 
     381elseif (!empty($_GET['crea'])) { 
     382     $_ctx->setAlert(__('Entry has been successfully created.')); 
     383} 
     384elseif (!empty($_GET['attached'])) { 
     385     $_ctx->setAlert(__('File has been successfully attached.')); 
     386} 
     387elseif (!empty($_GET['rmattach'])) { 
     388     $_ctx->setAlert(__('Attachment has been successfully removed.')); 
     389} 
     390if (!empty($_GET['creaco'])) { 
     391     $_ctx->setAlert(__('Comment has been successfully created.')); 
     392}     
    366393      
    367394$core->tpl->display('post.html.twig'); 
  • inc/admin/class.dc.form.php

    r1491 r1497  
    777777          foreach ($submitted as $f) { 
    778778               $action = $f->getAction(); 
    779                if ($action != NULL) { 
     779               if ($action != NULL && is_callable($action)) { 
    780780                    $hasActions = true; 
    781781                    $ret = call_user_func($action,$this); 
Note: See TracChangeset for help on using the changeset viewer.

Sites map