Dotclear

Changeset 2181:f30610fc3af1


Ignore:
Timestamp:
10/01/13 09:06:01 (10 years ago)
Author:
Dsls
Branch:
default
Message:

Non-repeatable notifications, step 1, see #1710.

Files:
3 edited

Legend:

Unmodified
Added
Removed
  • admin/post.php

    r2166 r2181  
    298298               # --BEHAVIOR-- adminAfterPostUpdate 
    299299               $core->callBehavior('adminAfterPostUpdate',$cur,$post_id); 
    300                 
    301                http::redirect('post.php?id='.$post_id.'&upd=1'); 
     300               dcPage::addSuccessNotice (sprintf('The post "%s" has been successfully updated',html::escapeHTML($cur->post_title))); 
     301               http::redirect('post.php?id='.$post_id); 
    302302          } 
    303303          catch (Exception $e) 
  • inc/admin/actions/class.dcactionposts.php

    r2178 r2181  
    159159          } 
    160160          $core->blog->updPostsStatus($posts_ids,$status); 
    161            
    162           $ap->redirect(true,array('upd' => 1)); 
     161          dcPage::addSuccessNotice(sprintf( 
     162               __( 
     163                    '%d entry has been successfully updated to status : "%s"', 
     164                    '%d entries have been successfully updated to status : "%s"', 
     165                    count($posts_ids) 
     166               ), 
     167               count($posts_ids), 
     168               $core->blog->getPostStatus($status)) 
     169          ); 
     170          $ap->redirect(true); 
    163171     } 
    164172      
     
    170178          $action = $ap->getAction(); 
    171179          $core->blog->updPostsSelected($posts_ids,$action == 'selected'); 
    172            
    173           $ap->redirect(true,array('upd' => 1)); 
     180          if ($action == 'selected') { 
     181               dcPage::addSuccessNotice(sprintf( 
     182                    __( 
     183                         '%d entry has been successfully marked as selected', 
     184                         '%d entries have been successfully marked as selected', 
     185                         count($posts_ids) 
     186                    ), 
     187                    count($posts_ids)) 
     188               ); 
     189          } else { 
     190               dcPage::addSuccessNotice(sprintf( 
     191                    __( 
     192                         '%d entry has been successfully marked as unselected', 
     193                         '%d entries have been successfully marked as unselected', 
     194                         count($posts_ids) 
     195                    ), 
     196                    count($posts_ids)) 
     197               ); 
     198          } 
     199          $ap->redirect(true); 
    174200     } 
    175201      
     
    191217           
    192218          $core->blog->delPosts($posts_ids); 
     219          dcPage::addSuccessNotice(sprintf( 
     220               __( 
     221                    '%d entry has been successfully deleted', 
     222                    '%d entries have been successfully deleted', 
     223                    count($posts_ids) 
     224               ), 
     225               count($posts_ids)) 
     226          ); 
    193227           
    194           $ap->redirect(false,array('del',1)); 
     228          $ap->redirect(false); 
    195229     } 
    196230 
     
    207241                    $cur_cat->cat_title = $post['new_cat_title']; 
    208242                    $cur_cat->cat_url = ''; 
     243                    $title = $cur_cat->cat_title; 
    209244                     
    210245                    $parent_cat = !empty($post['new_cat_parent']) ? $post['new_cat_parent'] : ''; 
     
    220255                
    221256               $core->blog->updPostsCategory($posts_ids, $new_cat_id); 
    222                 
    223                $ap->redirect(true,array('upd'=>1)); 
     257               $title = $core->blog->getCategory($new_cat_id); 
     258               dcPage::addSuccessNotice(sprintf( 
     259                    __( 
     260                         '%d entry has been successfully moved to category "%s"', 
     261                         '%d entries have been successfully moved to category "%s"', 
     262                         count($posts_ids) 
     263                    ), 
     264                    count($posts_ids), 
     265                    html::escapeHTML($title->cat_title)) 
     266               ); 
     267 
     268               $ap->redirect(true); 
    224269          } else { 
    225270 
     
    279324               $cur->user_id = $new_user_id; 
    280325               $cur->update('WHERE post_id '.$core->con->in($posts_ids)); 
    281                 
    282                $ap->redirect(true,array('upd' => 1)); 
     326               dcPage::addSuccessNotice(sprintf( 
     327                    __( 
     328                         '%d entry has been successfully set to user "%s"', 
     329                         '%d entries have been successfully set to user "%s"', 
     330                         count($posts_ids) 
     331                    ), 
     332                    count($posts_ids), 
     333                    html::escapeHTML($new_user_id)) 
     334               ); 
     335 
     336 
     337               $ap->redirect(true); 
    283338          } else { 
    284339               $usersList = ''; 
     
    332387               $cur->post_lang = $new_lang; 
    333388               $cur->update('WHERE post_id '.$core->con->in($posts_ids)); 
    334                 
    335                $ap->redirect(true,array('upd' => 1)); 
     389               dcPage::addSuccessNotice(sprintf( 
     390                    __( 
     391                         '%d entry has been successfully set to language "%s"', 
     392                         '%d entries have been successfully set to language "%s"', 
     393                         count($posts_ids) 
     394                    ), 
     395                    count($posts_ids), 
     396                    html::escapeHTML(l10n::getLanguageName($new_lang))) 
     397               ); 
     398               $ap->redirect(true); 
    336399          } else { 
    337400               $ap->beginPage( 
  • inc/admin/lib.dc.page.php

    r2167 r2181  
    175175               '</div>'; 
    176176          } 
    177      } 
    178  
     177           
     178          if (isset($_SESSION['notifications'])) { 
     179               $types = array("success" => "success", "warning" => "warning-msg"); 
     180               $notifications = $_SESSION['notifications']; 
     181               foreach ($types as $type => $class) { 
     182                    if (isset($notifications[$type])) { 
     183                         foreach ($notifications[$type] as $n) { 
     184                              echo self::getNotification($n,$class); 
     185                         } 
     186                    } 
     187               } 
     188               unset($_SESSION['notifications']); 
     189          } 
     190           
     191     } 
     192     public static function AddNotice($type,$message) { 
     193          $notification = isset($_SESSION['notifications']) ? $_SESSION['notifications']:array(); 
     194          $notification[$type][] = array('ts' => time(), 'text' => $message); 
     195          $_SESSION['notifications'] = $notification; 
     196     } 
     197     public static function addSuccessNotice($message) { 
     198          self::addNotice("success",$message); 
     199     } 
     200     public static function addWarningNotice($message) { 
     201          self::addNotice("warning",$message); 
     202     } 
     203      
     204     protected static function getNotification($msg,$class) { 
     205          global $core; 
     206          $res = '<p class="'.$class.'">'. 
     207          dt::str(__('[%H:%M:%S] '),$msg['ts'],$core->auth->getInfo('user_tz')).' '.$msg['text']. 
     208          '</p>'; 
     209          return $res;    
     210     } 
    179211     public static function close() 
    180212     { 
Note: See TracChangeset for help on using the changeset viewer.

Sites map