| [ Index ] |
|
Code source de b2evolution 2.1.0-beta |
1 <?php 2 /** 3 * This file implements the UI controller for the dashboard. 4 * 5 * b2evolution - {@link http://b2evolution.net/} 6 * Released under GNU GPL License - {@link http://b2evolution.net/about/license.html} 7 * 8 * @copyright (c)2003-2007 by Francois PLANQUE - {@link http://fplanque.net/} 9 * 10 * {@internal Open Source relicensing agreement: 11 * }} 12 * 13 * @package admin 14 * 15 * {@internal Below is a list of authors who have contributed to design/coding of this file: }} 16 * @author fplanque: Francois PLANQUE. 17 * 18 * @todo add 5 plugin hooks. Will be widgetized later (same as SkinTag became Widgets) 19 * 20 * @version $Id: dashboard.ctrl.php,v 1.16 2007/11/04 21:22:25 fplanque Exp $ 21 */ 22 if( !defined('EVO_MAIN_INIT') ) die( 'Please, do not access this page directly.' ); 23 24 /** 25 * @var User 26 */ 27 global $current_User; 28 29 if( $blog ) 30 { 31 if( ! $current_User->check_perm( 'blog_ismember', '', false, $blog ) ) 32 { // We don't have permission for the requested blog (may happen if we come to admin from a link on a different blog) 33 set_working_blog( 0 ); 34 unset( $Blog ); 35 } 36 } 37 38 $blogListButtons = $AdminUI->get_html_collection_list( 'blog_ismember', 'view', 39 regenerate_url( array('blog'), 'blog=%d' ), 40 T_('Global'), regenerate_url( array('blog'), 'blog=0' ) ); 41 42 $AdminUI->set_path( 'dashboard' ); 43 44 // Display <html><head>...</head> section! (Note: should be done early if actions do not redirect) 45 $AdminUI->disp_html_head(); 46 47 // Display title, menu, messages, etc. (Note: messages MUST be displayed AFTER the actions) 48 $AdminUI->disp_body_top(); 49 50 51 // fp> Note: don't bother with T_() yet. This is going to change too often. 52 53 if( $blog ) 54 { // We want to look at a specific blog: 55 // Begin payload block: 56 $AdminUI->disp_payload_begin(); 57 58 echo '<h2>'.$Blog->dget( 'name' ).'</h2>'; 59 60 echo '<table class="browse" cellspacing="0" cellpadding="0" border="0"><tr><td>'; 61 62 load_class('items/model/_itemlist.class.php'); 63 64 $block_item_Widget = & new Widget( 'block_item' ); 65 66 $nb_blocks_displayed = 0; 67 68 /* 69 * COMMENTS: 70 */ 71 $CommentList = & new CommentList( $Blog, "'comment','trackback','pingback'", array( 'draft' ), '', '', 'DESC', '', 5 ); 72 73 if( $CommentList->result_num_rows ) 74 { // We have drafts 75 76 $nb_blocks_displayed++; 77 78 $block_item_Widget->title = T_('Comments awaiting moderation'); 79 $block_item_Widget->disp_template_replaced( 'block_start' ); 80 81 while( $Comment = & $CommentList->get_next() ) 82 { // Loop through comments: 83 84 echo '<div class="dashboard_post">'; 85 echo '<h3 class="dashboard_post_title">'; 86 87 switch( $Comment->get( 'type' ) ) 88 { 89 case 'comment': // Display a comment: 90 echo T_('Comment from'); 91 break; 92 93 case 'trackback': // Display a trackback: 94 echo T_('Trackback from'); 95 break; 96 97 case 'pingback': // Display a pingback: 98 echo T_('Pingback from'); 99 break; 100 } 101 echo ' <strong>'; 102 $Comment->author(); 103 echo '</strong>'; 104 105 $comment_Item = & $Comment->get_Item(); 106 echo ' '.T_('in response to') 107 .' <a href="?ctrl=items&blog='.$comment_Item->blog_ID.'&p='.$comment_Item->ID.'"><strong>'.$comment_Item->dget('title').'</strong></a>'; 108 109 echo '</h3>'; 110 111 echo '<div class="notes">'; 112 if( $Comment->author_url( '', 'Url: <span class="bUrl">', '</span>' ) ) 113 { 114 if( $current_User->check_perm( 'spamblacklist', 'edit' ) ) 115 { // There is an URL and we have permission to ban... 116 // TODO: really ban the base domain! - not by keyword 117 echo ' <a href="'.$dispatcher.'?ctrl=antispam&action=ban&keyword='.rawurlencode(get_ban_domain($Comment->author_url)) 118 .'">'.get_icon( 'ban' ).'</a> '; 119 } 120 echo ' • '; 121 } 122 $Comment->author_email( '', 'Email: <span class="bEmail">', '</span> • ' ); 123 $Comment->author_ip( 'IP: <span class="bIP">', '</span> • ' ); 124 $Comment->spam_karma( T_('Spam Karma').': %s%', T_('No Spam Karma') ); 125 echo '</div>'; 126 ?> 127 128 129 <div class="small"> 130 <?php $Comment->content() ?> 131 </div> 132 133 <div class="dashboard_action_area"> 134 <?php 135 // Display edit button if current user has the rights: 136 $Comment->edit_link( ' ', ' ', '#', '#', 'ActionButton'); 137 138 // Display publish NOW button if current user has the rights: 139 $Comment->publish_link( ' ', ' ', '#', '#', 'PublishButton', '&', true ); 140 141 // Display deprecate button if current user has the rights: 142 $Comment->deprecate_link( ' ', ' ', '#', '#', 'DeleteButton', '&', true ); 143 144 // Display delete button if current user has the rights: 145 $Comment->delete_link( ' ', ' ', '#', '#', 'DeleteButton'); 146 ?> 147 <div class="clear"></div> 148 </div> 149 150 151 <?php 152 echo '</div>'; 153 } 154 155 $block_item_Widget->disp_template_raw( 'block_end' ); 156 } 157 158 159 /* 160 * RECENT DRAFTS 161 */ 162 // Create empty List: 163 $ItemList = & new ItemList2( $Blog, NULL, NULL ); 164 165 // Filter list: 166 $ItemList->set_filters( array( 167 'visibility_array' => array( 'draft' ), 168 'orderby' => 'datemodified', 169 'order' => 'DESC', 170 'posts' => 5, 171 ) ); 172 173 // Get ready for display (runs the query): 174 $ItemList->display_init(); 175 176 if( $ItemList->result_num_rows ) 177 { // We have drafts 178 179 $nb_blocks_displayed++; 180 181 $block_item_Widget->title = T_('Recent drafts'); 182 $block_item_Widget->disp_template_replaced( 'block_start' ); 183 184 while( $Item = & $ItemList->get_item() ) 185 { 186 echo '<div class="dashboard_post" lang="'.$Item->get('locale').'">'; 187 // We don't switch locales in the backoffice, since we use the user pref anyway 188 // Load item's creator user: 189 $Item->get_creator_User(); 190 191 echo '<div class="dashboard_float_actions">'; 192 $Item->edit_link( array( // Link to backoffice for editing 193 'before' => ' ', 194 'after' => ' ', 195 'class' => 'ActionButton' 196 ) ); 197 $Item->publish_link( '', '', '#', '#', 'PublishButton' ); 198 echo '<img src="'.$rsc_url.'/img/blank.gif">'; 199 echo '</div>'; 200 201 echo '<h3 class="dashboard_post_title">'; 202 echo '<a href="?ctrl=items&blog='.$Blog->ID.'&p='.$Item->ID.'">'.$Item->dget( 'title' ).'</a>'; 203 echo '</h3>'; 204 205 echo '</div>'; 206 207 } 208 209 $block_item_Widget->disp_template_raw( 'block_end' ); 210 } 211 212 213 /* 214 * RECENTLY EDITED 215 */ 216 // Create empty List: 217 $ItemList = & new ItemList2( $Blog, NULL, NULL ); 218 219 // Filter list: 220 $ItemList->set_filters( array( 221 'visibility_array' => array( 'published', 'protected', 'private', 'deprecated', 'redirected' ), 222 'orderby' => 'datemodified', 223 'order' => 'DESC', 224 'posts' => 5, 225 ) ); 226 227 // Get ready for display (runs the query): 228 $ItemList->display_init(); 229 230 if( $ItemList->result_num_rows ) 231 { // We have recent edits 232 233 $nb_blocks_displayed++; 234 235 if( $current_User->check_perm( 'blog_post_statuses', 'edit', false, $Blog->ID ) ) 236 { // We have permission to add a post with at least one status: 237 $block_item_Widget->global_icon( T_('Write a new post...'), 'new', '?ctrl=items&action=new&blog='.$Blog->ID, T_('New post').' »', 3, 4 ); 238 } 239 240 $block_item_Widget->title = T_('Recently edited'); 241 $block_item_Widget->disp_template_replaced( 'block_start' ); 242 243 while( $Item = & $ItemList->get_item() ) 244 { 245 echo '<div class="dashboard_post" lang="'.$Item->get('locale').'">'; 246 // We don't switch locales in the backoffice, since we use the user pref anyway 247 // Load item's creator user: 248 $Item->get_creator_User(); 249 250 echo '<div class="dashboard_float_actions">'; 251 $Item->edit_link( array( // Link to backoffice for editing 252 'before' => ' ', 253 'after' => ' ', 254 'class' => 'ActionButton' 255 ) ); 256 echo '</div>'; 257 258 echo '<h3 class="dashboard_post_title">'; 259 echo '<a href="?ctrl=items&blog='.$Blog->ID.'&p='.$Item->ID.'">'.$Item->dget( 'title' ).'</a>'; 260 echo ' <span class="dashboard_post_details">'; 261 $Item->status( array( 262 'before' => '', 263 'after' => ' • ', 264 ) ); 265 $Item->views(); 266 echo '</span>'; 267 echo '</h3>'; 268 269 // Display images that are linked to this post: 270 $Item->images( array( 271 'before' => '<div class="dashboard_thumbnails">', 272 'before_image' => '', 273 'before_image_legend' => NULL, // No legend 274 'after_image_legend' => NULL, 275 'after_image' => '', 276 'after' => '</div>', 277 'image_size' => 'fit-80x80' 278 ) ); 279 280 echo '<div class="small">'.$Item->get_content_excerpt( 150 ).'</div>'; 281 282 echo '<div style="clear:left;">'.get_icon('pixel').'</div>'; // IE crap 283 echo '</div>'; 284 } 285 286 $block_item_Widget->disp_template_raw( 'block_end' ); 287 } 288 289 290 if( $nb_blocks_displayed == 0 ) 291 { // We haven't displayed anything yet! 292 293 $nb_blocks_displayed++; 294 295 $block_item_Widget->title = T_('Getting started'); 296 $block_item_Widget->disp_template_replaced( 'block_start' ); 297 298 echo '<p><strong>'.T_('Welcome to your new blog\'s dashboard!').'</strong></p>'; 299 300 echo '<p>'.T_('Use the links on the right to write a first post or to customize your blog.').'</p>'; 301 302 echo '<p>'.T_('You can see your blog page at any time by clicking "See" in the b2evolution toolbar at the top of this page.').'</p>'; 303 304 echo '<p>'.T_('You can come back here at any time by clicking "Manage" in that same evobar.').'</p>'; 305 306 $block_item_Widget->disp_template_raw( 'block_end' ); 307 } 308 309 310 /* 311 * DashboardBlogMain to be added here (anyone?) 312 */ 313 314 315 echo '</td><td>'; 316 317 /* 318 * RIGHT COL 319 */ 320 321 $side_item_Widget = & new Widget( 'side_item' ); 322 323 $side_item_Widget->title = T_('Manage your blog'); 324 $side_item_Widget->disp_template_replaced( 'block_start' ); 325 326 echo '<div class="dashboard_sidebar">'; 327 echo '<ul>'; 328 echo '<li><a href="admin.php?ctrl=items&action=new&blog='.$Blog->ID.'">'.T_('Write a new post').' »</a></li>'; 329 330 echo '<li>Browse:<ul>'; 331 echo '<li><a href="admin.php?ctrl=items&tab=full&filter=restore&blog='.$Blog->ID.'">'.T_('Posts (full)').' »</a></li>'; 332 echo '<li><a href="admin.php?ctrl=items&tab=list&filter=restore&blog='.$Blog->ID.'">'.T_('Posts (list)').' »</a></li>'; 333 echo '<li><a href="admin.php?ctrl=comments&blog='.$Blog->ID.'">'.T_('Comments').' »</a></li>'; 334 echo '</ul></li>'; 335 336 if( $current_User->check_perm( 'blog_cats', '', false, $Blog->ID ) ) 337 { 338 echo '<li><a href="admin.php?ctrl=chapters&blog='.$Blog->ID.'">'.T_('Edit categories').' »</a></li>'; 339 } 340 341 if( $current_User->check_perm( 'blog_genstatic', 'any', false, $Blog->ID ) ) 342 { 343 echo '<li><a href="admin.php?ctrl=collections&action=GenStatic&blog='.$Blog->ID.'&redir_after_genstatic='.rawurlencode(regenerate_url( '', '', '', '&' )).'">'.T_('Generate static page!').'</a></li>'; 344 } 345 346 echo '<li><a href="'.$Blog->get('url').'">'.T_('View this blog').'</a></li>'; 347 echo '</ul>'; 348 echo '</div>'; 349 350 $side_item_Widget->disp_template_raw( 'block_end' ); 351 352 if( $current_User->check_perm( 'blog_properties', 'edit', false, $Blog->ID ) ) 353 { 354 $side_item_Widget->title = T_('Customize your blog'); 355 $side_item_Widget->disp_template_replaced( 'block_start' ); 356 357 echo '<div class="dashboard_sidebar">'; 358 echo '<ul>'; 359 360 echo '<li><a href="admin.php?ctrl=coll_settings&tab=general&blog='.$Blog->ID.'">'.T_('Blog properties').' »</a></li>'; 361 echo '<li><a href="admin.php?ctrl=coll_settings&tab=features&blog='.$Blog->ID.'">'.T_('Blog features').' »</a></li>'; 362 echo '<li><a href="admin.php?ctrl=coll_settings&tab=skin&blog='.$Blog->ID.'">'.T_('Blog skin').' »</a></li>'; 363 echo '<li><a href="admin.php?ctrl=widgets&blog='.$Blog->ID.'">'.T_('Blog widgets').' »</a></li>'; 364 echo '<li><a href="admin.php?ctrl=coll_settings&tab=urls&blog='.$Blog->ID.'">'.T_('Blog URLs').' »</a></li>'; 365 366 echo '</ul>'; 367 echo '</div>'; 368 369 $side_item_Widget->disp_template_raw( 'block_end' ); 370 } 371 372 373 /* 374 * DashboardBlogSide to be added here (anyone?) 375 */ 376 377 378 echo '</td></tr></table>'; 379 380 381 // End payload block: 382 $AdminUI->disp_payload_end(); 383 } 384 else 385 { // We're on the GLOBAL tab... 386 387 $AdminUI->disp_payload_begin(); 388 echo '<h2>Select a blog</h2>'; 389 // Display blog list VIEW: 390 $AdminUI->disp_view( 'collections/views/_coll_list.view.php' ); 391 $AdminUI->disp_payload_end(); 392 393 394 /* 395 * DashboardGlobalMain to be added here (anyone?) 396 */ 397 } 398 399 400 /* 401 * Administrative tasks 402 */ 403 404 if( $current_User->check_perm( 'options', 'edit' ) ) 405 { // We have some serious admin privilege: 406 // Begin payload block: 407 $AdminUI->disp_payload_begin(); 408 409 echo '<table class="browse" cellspacing="0" cellpadding="0" border="0"><tr><td>'; 410 411 $block_item_Widget = & new Widget( 'block_item' ); 412 413 $block_item_Widget->title = T_('Info'); 414 $block_item_Widget->disp_template_replaced( 'block_start' ); 415 416 echo '<p>Please be advised that this is beta software. A few things may still change until the stable release.</p>'; 417 418 419 420 $block_item_Widget->disp_template_replaced( 'block_end' ); 421 422 /* 423 * DashboardAdminMain to be added here (anyone?) 424 */ 425 426 echo '</td><td>'; 427 428 /* 429 * RIGHT COL 430 */ 431 $side_item_Widget = & new Widget( 'side_item' ); 432 433 $side_item_Widget->title = T_('Administrative tasks'); 434 $side_item_Widget->disp_template_replaced( 'block_start' ); 435 436 echo '<div class="dashboard_sidebar">'; 437 echo '<ul>'; 438 if( $current_User->check_perm( 'users', 'edit' ) ) 439 { 440 echo '<li><a href="admin.php?ctrl=users&action=new_user">'.T_('Create new user').' »</a></li>'; 441 } 442 if( $current_User->check_perm( 'blogs', 'create' ) ) 443 { 444 echo '<li><a href="admin.php?ctrl=collections&action=new">'.T_('Create new blog').' »</a></li>'; 445 } 446 echo '<li><a href="admin.php?ctrl=skins">'.T_('Install a skin').' »</a></li>'; 447 echo '<li><a href="admin.php?ctrl=plugins">'.T_('Install a plugin').' »</a></li>'; 448 // TODO: remember system date check and only remind every 3 months 449 echo '<li><a href="admin.php?ctrl=system">'.T_('Check system & security').' »</a></li>'; 450 echo '</ul>'; 451 echo '</div>'; 452 453 $side_item_Widget->disp_template_raw( 'block_end' ); 454 455 /* 456 * DashboardAdminSide to be added here (anyone?) 457 */ 458 459 echo '</td></tr></table>'; 460 461 // End payload block: 462 $AdminUI->disp_payload_end(); 463 } 464 465 // Display body bottom, debug info and close </html>: 466 $AdminUI->disp_global_footer(); 467 468 /* 469 * $Log: dashboard.ctrl.php,v $ 470 * Revision 1.16 2007/11/04 21:22:25 fplanque 471 * version bump 472 * 473 * Revision 1.15 2007/11/03 23:54:39 fplanque 474 * skin cleanup continued 475 * 476 * Revision 1.14 2007/11/03 21:04:26 fplanque 477 * skin cleanup 478 * 479 * Revision 1.13 2007/11/02 02:47:06 fplanque 480 * refactored blog settings / UI 481 * 482 * Revision 1.12 2007/09/12 01:18:32 fplanque 483 * translation updates 484 * 485 * Revision 1.11 2007/09/10 14:53:35 fplanque 486 * doc 487 * 488 * Revision 1.10 2007/09/08 20:23:04 fplanque 489 * action icons / wording 490 * 491 * Revision 1.9 2007/09/07 21:11:11 fplanque 492 * superstylin' (not even close) 493 * 494 * Revision 1.8 2007/09/07 20:11:40 fplanque 495 * minor 496 * 497 * Revision 1.7 2007/09/04 22:16:33 fplanque 498 * in context editing of posts 499 * 500 * Revision 1.6 2007/09/04 19:50:04 fplanque 501 * dashboard cleanup 502 * 503 * Revision 1.5 2007/09/04 15:36:07 fplanque 504 * minor 505 * 506 * Revision 1.4 2007/09/03 18:32:50 fplanque 507 * enhanced dashboard / comment moderation 508 * 509 * Revision 1.3 2007/09/03 16:44:31 fplanque 510 * chicago admin skin 511 * 512 * Revision 1.2 2007/06/30 20:37:37 fplanque 513 * UI changes 514 * 515 * Revision 1.1 2007/06/25 10:59:50 fplanque 516 * MODULES (refactored MVC) 517 * 518 * Revision 1.21 2007/06/22 23:46:43 fplanque 519 * bug fixes 520 * 521 * Revision 1.20 2007/06/13 23:29:03 fplanque 522 * minor 523 * 524 * Revision 1.19 2007/06/13 20:56:02 fplanque 525 * minor 526 * 527 * Revision 1.18 2007/05/09 01:01:29 fplanque 528 * permissions cleanup 529 * 530 * Revision 1.17 2007/04/26 00:11:15 fplanque 531 * (c) 2007 532 * 533 * Revision 1.16 2007/03/11 23:57:07 fplanque 534 * item editing: allow setting to 'redirected' status 535 * 536 * Revision 1.15 2007/03/05 04:48:15 fplanque 537 * IE crap 538 * 539 * Revision 1.14 2007/03/05 02:13:25 fplanque 540 * improved dashboard 541 * 542 * Revision 1.13 2007/01/28 23:31:57 blueyed 543 * todo 544 * 545 * Revision 1.12 2007/01/19 08:20:57 fplanque 546 * bugfix 547 * 548 * Revision 1.11 2007/01/14 22:43:29 fplanque 549 * handled blog view perms. 550 * 551 * Revision 1.10 2006/12/17 02:42:22 fplanque 552 * streamlined access to blog settings 553 * 554 * Revision 1.9 2006/12/15 22:53:26 fplanque 555 * cleanup 556 * 557 * Revision 1.8 2006/12/12 21:19:31 fplanque 558 * UI fixes 559 * 560 * Revision 1.7 2006/12/12 02:53:56 fplanque 561 * Activated new item/comments controllers + new editing navigation 562 * Some things are unfinished yet. Other things may need more testing. 563 * 564 * Revision 1.6 2006/12/11 17:26:21 fplanque 565 * some cross-linking 566 * 567 * Revision 1.5 2006/12/09 02:01:48 fplanque 568 * temporary / minor 569 * 570 * Revision 1.4 2006/12/07 23:59:31 fplanque 571 * basic dashboard stuff 572 * 573 * Revision 1.3 2006/12/07 23:21:00 fplanque 574 * dashboard blog switching 575 * 576 * Revision 1.2 2006/12/07 23:13:10 fplanque 577 * @var needs to have only one argument: the variable type 578 * Otherwise, I can't code! 579 * 580 * Revision 1.1 2006/12/07 22:29:26 fplanque 581 * reorganized menus / basic dashboard 582 * 583 */ 584 ?>
titre
Description
Corps
titre
Description
Corps
titre
Description
Corps
titre
Corps
| Généré le : Thu Nov 29 23:58:50 2007 | par Balluche grâce à PHPXref 0.7 |
|