Changes in [3087:b739d0de9983:3088:5e6b3da2b372]
- Files:
-
- 1 added
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
.hgtags
r2959 r3083 25 25 c45489df2bde825c7ed9c756e00444b54caf8e10 2.7.3 26 26 27e258e592e45b56a803038279adb6faa5865265 2.7.4 27 5e377b0f479e0f45cf199b24c3f997449a6f5a8a 2.8.0 -
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.admincombos.php
r3011 r3082 37 37 while ($categories->fetch()) { 38 38 $categories_combo[] = new formSelectOption ( 39 str_repeat(' ',$categories->level-1).($categories->level-1 == 0 ? '' : '• ').html::escapeHTML($categories->cat_title).' ('.$categories->nb_post.')',39 html::escapeHTML($categories->cat_title).' ('.$categories->nb_post.')', 40 40 ($use_url ? $categories->cat_url : $categories->cat_id), 41 41 ($categories->level-1 ? 'sub-option'.($categories->level-1) : '') … … 152 152 $editors_combo[$v] = $v; 153 153 } 154 154 155 155 return $editors_combo; 156 156 } -
inc/admin/lib.dc.page.php
r3080 r3086 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 … … 545 544 } 546 545 547 public static function cssLoad($src, $media='screen')546 public static function cssLoad($src,$media='screen',$v='') 548 547 { 549 548 $escaped_src = html::escapeHTML($src); 550 549 if (!isset(self::$loaded_css[$escaped_src])) { 551 550 self::$loaded_css[$escaped_src] = true; 552 $escaped_src = self::appendVersion($escaped_src );551 $escaped_src = self::appendVersion($escaped_src,$v); 553 552 554 553 return '<link rel="stylesheet" href="'.$escaped_src.'" type="text/css" media="'.$media.'" />'."\n"; … … 556 555 } 557 556 558 public static function jsLoad($src )557 public static function jsLoad($src,$v='') 559 558 { 560 559 $escaped_src = html::escapeHTML($src); 561 560 if (!isset(self::$loaded_js[$escaped_src])) { 562 561 self::$loaded_js[$escaped_src] = true; 563 $escaped_src = self::appendVersion($escaped_src );562 $escaped_src = self::appendVersion($escaped_src,$v); 564 563 return '<script type="text/javascript" src="'.$escaped_src.'"></script>'."\n"; 565 564 } 566 565 } 567 566 568 private static function appendVersion($src) 569 { 570 if (strpos($src,'?')===false) { 571 $src .= '?v='; 572 } else { 573 $src .= '&v='; 574 } 575 567 private static function appendVersion($src,$v='') 568 { 569 $src .= (strpos($src,'?') === false ? '?' : '&').'v='; 576 570 if (defined('DC_DEV') && DC_DEV === true) { 577 571 $src .= md5(uniqid()); 578 572 } else { 579 $src .= DC_VERSION; 580 } 581 573 $src .= ($v === '' ? DC_VERSION : $v); 574 } 582 575 return $src; 583 576 } -
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.