Changes in [3080:4afa4b38a042:3081:2d7b794a32c3]
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
inc/admin/class.dc.favorites.php
r2725 r3075 315 315 true, 316 316 $v['id'], 317 $v['class'] 317 $v['class'], 318 true 318 319 ); 319 320 } -
inc/admin/class.dc.menu.php
r2566 r3075 22 22 $this->title = $title; 23 23 $this->itemSpace = $itemSpace; 24 $this->pinned = array(); 24 25 $this->items = array(); 25 26 } 26 27 27 public function addItem($title,$url,$img,$active,$show=true,$id=null,$class=null )28 public function addItem($title,$url,$img,$active,$show=true,$id=null,$class=null,$pinned=false) 28 29 { 29 30 if($show) { 30 $this->items[] = $this->itemDef($title,$url,$img,$active,$id,$class); 31 $item = $this->itemDef($title,$url,$img,$active,$id,$class); 32 if ($pinned) { 33 $this->pinned[] = $item; 34 } else { 35 $this->items[$title] = $item; 36 } 31 37 } 32 38 } 33 39 34 public function prependItem($title,$url,$img,$active,$show=true,$id=null,$class=null )40 public function prependItem($title,$url,$img,$active,$show=true,$id=null,$class=null,$pinned=false) 35 41 { 36 42 if ($show) { 37 array_unshift($this->items,$this->itemDef($title,$url,$img,$active,$id,$class)); 43 $item = $this->itemDef($title,$url,$img,$active,$id,$class); 44 if ($pinned) { 45 array_unshift($this->pinned,$item); 46 } else { 47 $this->items[$title] = $item; 48 } 38 49 } 39 50 } … … 41 52 public function draw() 42 53 { 43 if (count($this->items) == 0) {54 if (count($this->items) + count($this->pinned) == 0) { 44 55 return ''; 45 56 } … … 50 61 '<ul>'."\n"; 51 62 52 for ($i=0; $i<count($this->items); $i++) 63 // 1. Display pinned items (unsorted) 64 for ($i=0; $i<count($this->pinned); $i++) 65 { 66 if ($i+1 < count($this->pinned) && $this->itemSpace != '') { 67 $res .= preg_replace('|</li>$|',$this->itemSpace.'</li>',$this->pinned[$i]); 68 $res .= "\n"; 69 } else { 70 $res .= $this->pinned[$i]."\n"; 71 } 72 } 73 74 // 2. Display unpinned itmes (sorted) 75 $i = 0; 76 dcUtils::lexicalKeySort($this->items); 77 foreach ($this->items as $title => $item) 53 78 { 54 79 if ($i+1 < count($this->items) && $this->itemSpace != '') { 55 $res .= preg_replace('|</li>$|',$this->itemSpace.'</li>',$ this->items[$i]);80 $res .= preg_replace('|</li>$|',$this->itemSpace.'</li>',$item); 56 81 $res .= "\n"; 57 82 } else { 58 $res .= $ this->items[$i]."\n";83 $res .= $item."\n"; 59 84 } 85 $i++; 60 86 } 61 87 -
inc/admin/lib.dc.page.php
r3080 r3081 177 177 } 178 178 179 // Display breadcrumb (if given) before any error message 179 // Display breadcrumb (if given) before any error messages 180 180 echo $breadcrumb; 181 181 182 if ($core->error->flag()) { 183 echo 184 '<div class="error"><p><strong>'.(count($core->error->getErrors()) > 1 ? __('Errors:') : __('Error:')).'</strong></p>'. 182 // Display notices and errors 183 echo self::notices(); 184 } 185 186 public static function notices() 187 { 188 global $core; 189 static $error_displayed = false; 190 $res = ''; 191 192 // return error messages if any 193 if ($core->error->flag() && !$error_displayed) { 194 $res .= '<div class="error"><p><strong>'.(count($core->error->getErrors()) > 1 ? __('Errors:') : __('Error:')).'</strong></p>'. 185 195 $core->error->toHTML(). 186 196 '</div>'; 187 } 188 189 // Display notices 190 echo self::notices(); 191 } 192 193 public static function notices() 194 { 197 $error_displayed = true; 198 } 199 195 200 // return notices if any 196 $res = '';197 201 if (isset($_SESSION['notifications'])) { 198 $notifications = $_SESSION['notifications'];199 202 foreach ($_SESSION['notifications'] as $notification) { 200 203 $res .= self::getNotification($notification); … … 366 369 echo $breadcrumb; 367 370 368 if ($core->error->flag()) { 369 echo 370 '<div class="error" role="alert"><strong>'.__('Errors:').'</strong>'. 371 $core->error->toHTML(). 372 '</div>'; 373 } 371 // Display notices and errors 372 echo self::notices(); 374 373 } 375 374 -
inc/admin/prepend.php
r3059 r3075 69 69 70 70 $url = $core->adminurl->get($adminurl); 71 $_menu[$section]->prependItem($desc,$url,$icon,preg_match('/'.preg_quote($url).'(\?.*)?$/',$_SERVER['REQUEST_URI']),$perm); 71 $_menu[$section]->prependItem($desc,$url,$icon, 72 preg_match('/'.preg_quote($url).'(\?.*)?$/',$_SERVER['REQUEST_URI']),$perm,null,null,true); 72 73 } 73 74 -
inc/core/class.dc.error.php
r2566 r3074 30 30 /** @var string HTML error item pattern */ 31 31 protected $html_item = "<li>%s</li>\n"; 32 33 /**34 * Object constructor.35 */36 public function __construct()37 {38 $this->code = 0;39 $this->msg = '';40 }41 32 42 33 /** -
inc/prepend.php
r3079 r3081 140 140 # Constants 141 141 define('DC_ROOT',path::real(dirname(__FILE__).'/..')); 142 define('DC_VERSION','2. 8.1');142 define('DC_VERSION','2.9-dev'); 143 143 define('DC_DIGESTS',dirname(__FILE__).'/digests'); 144 144 define('DC_L10N_ROOT',dirname(__FILE__).'/../locales'); -
plugins/maintenance/index.php
r2849 r3073 158 158 html::escapeHTML($task->name())=> '' 159 159 ) 160 ) ;160 ).dcPage::notices(); 161 161 162 162 // content … … 193 193 __('Maintenance') => '' 194 194 ) 195 ) ;195 ).dcPage::notices(); 196 196 197 197 // Simple task (with only a button to start it)
Note: See TracChangeset
for help on using the changeset viewer.