Changeset 1497:7b8e2fa94f9a
- Timestamp:
- 08/20/13 12:37:19 (10 years ago)
- Branch:
- twig
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
admin/post.php
r1493 r1497 19 19 public static function savePost($form) { 20 20 global $_ctx, $core; 21 if (!$form->can_edit_post) { 22 return; 23 } 21 24 try { 22 25 $form->check($_ctx); 23 $_ctx->setAlert('save');24 26 $form->cat_id = (integer) $form->cat_id; 25 27 … … 85 87 # --BEHAVIOR-- adminAfterPostUpdate 86 88 $core->callBehavior('adminAfterPostUpdate',$cur,$form->id); 87 88 89 http::redirect('post.php?id='.$form->id.'&upd=1'); 89 90 } … … 102 103 } 103 104 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 } 110 122 } 111 123 } … … 190 202 ->addField( 191 203 new dcFieldSubmit('delete',__('Delete'),array( 192 'action' => 'deletePost')))204 'action' => array('PostActions','deletePost')))) 193 205 ->addField( 194 206 new dcFieldCombo('post_status',$core->auth->getInfo('user_post_status'),$status_combo,array( … … 363 375 $_ctx->post_url = $post->getURL(); 364 376 } 365 377 378 if (!empty($_GET['upd'])) { 379 $_ctx->setAlert(__('Entry has been successfully updated.')); 380 } 381 elseif (!empty($_GET['crea'])) { 382 $_ctx->setAlert(__('Entry has been successfully created.')); 383 } 384 elseif (!empty($_GET['attached'])) { 385 $_ctx->setAlert(__('File has been successfully attached.')); 386 } 387 elseif (!empty($_GET['rmattach'])) { 388 $_ctx->setAlert(__('Attachment has been successfully removed.')); 389 } 390 if (!empty($_GET['creaco'])) { 391 $_ctx->setAlert(__('Comment has been successfully created.')); 392 } 366 393 367 394 $core->tpl->display('post.html.twig'); -
inc/admin/class.dc.form.php
r1491 r1497 777 777 foreach ($submitted as $f) { 778 778 $action = $f->getAction(); 779 if ($action != NULL ) {779 if ($action != NULL && is_callable($action)) { 780 780 $hasActions = true; 781 781 $ret = call_user_func($action,$this);
Note: See TracChangeset
for help on using the changeset viewer.