[ Index ] |
|
Code source de b2evolution 2.1.0-beta |
1 <?php 2 /** 3 * This file implements the UI view for the blogs list on blog management screens. 4 * 5 * b2evolution - {@link http://b2evolution.net/} 6 * Released under GNU GPL License - {@link http://b2evolution.net/about/license.html} 7 * @copyright (c)2003-2007 by Francois PLANQUE - {@link http://fplanque.net/} 8 * 9 * {@internal Open Source relicensing agreement: 10 * Daniel HAHLER grants Francois PLANQUE the right to license 11 * Daniel HAHLER's contributions to this file and the b2evolution project 12 * under any OSI approved OSS license (http://www.opensource.org/licenses/). 13 * }} 14 * 15 * @package admin 16 * {@internal Below is a list of authors who have contributed to design/coding of this file: }} 17 * @author blueyed: Daniel HAHLER 18 * @author fplanque: Francois PLANQUE. 19 * 20 * @version $Id: _coll_list.view.php,v 1.2 2007/09/11 20:57:51 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 * @var GeneralSettings 30 */ 31 global $Settings; 32 33 global $dispatcher; 34 35 36 $sql = 'SELECT T_blogs.*, user_login 37 FROM T_blogs INNER JOIN T_users ON blog_owner_user_ID = user_ID'; 38 39 40 if( ! $current_User->check_perm( 'blogs', 'view' ) ) 41 { // We do not have perm to view all blogs... we need to restrict to those we're a member of: 42 43 $sql .= " LEFT JOIN T_coll_user_perms ON (blog_advanced_perms <> 0 44 AND blog_ID = bloguser_blog_ID 45 AND bloguser_user_ID = {$current_User->ID} ) 46 LEFT JOIN T_coll_group_perms ON (blog_advanced_perms <> 0 47 AND blog_ID = bloggroup_blog_ID 48 AND bloggroup_group_ID = {$current_User->group_ID} ) 49 WHERE blog_owner_user_ID = {$current_User->ID} 50 OR bloguser_ismember <> 0 51 OR bloggroup_ismember <> 0"; 52 53 $no_results = T_('Sorry, you have no permission to edit/view any blog\'s properties.'); 54 } 55 else 56 { 57 $no_results = T_('No blog has been created yet!'); 58 } 59 60 // Create result set: 61 $Results = & new Results( $sql, 'blog_' ); 62 $Results->Cache = & get_Cache( 'BlogCache' ); 63 $Results->title = T_('Blog list'); 64 $Results->no_results_text = $no_results; 65 66 if( $current_User->check_perm( 'blogs', 'create' ) ) 67 { 68 $Results->global_icon( T_('New blog...'), 'new', url_add_param( $dispatcher, 'ctrl=collections&action=new' ), T_('New blog...'), 3, 4 ); 69 } 70 71 $Results->cols[] = array( 72 'th' => T_('ID'), 73 'order' => 'blog_ID', 74 'th_class' => 'shrinkwrap', 75 'td_class' => 'shrinkwrap', 76 'td' => '$blog_ID$', 77 ); 78 79 function disp_coll_name( $coll_name, $coll_ID ) 80 { 81 global $current_User, $ctrl; 82 if( $ctrl == 'dashboard' ) 83 { // Dashboard 84 $edit_url = regenerate_url( 'ctrl', 'ctrl=dashboard&blog='.$coll_ID ); 85 $r = '<a href="'.$edit_url.'">'; 86 $r .= $coll_name; 87 $r .= '</a>'; 88 } 89 elseif( $current_User->check_perm( 'blog_properties', 'edit', false, $coll_ID ) ) 90 { // Blog setting & can edit 91 $edit_url = regenerate_url( 'ctrl', 'ctrl=coll_settings&blog='.$coll_ID ); 92 $r = '<a href="'.$edit_url.'" title="'.T_('Edit properties...').'">'; 93 $r .= $coll_name; 94 $r .= '</a>'; 95 } 96 else 97 { 98 $r = $coll_name; 99 } 100 return $r; 101 } 102 $Results->cols[] = array( 103 'th' => T_('Name'), 104 'order' => 'blog_shortname', 105 'td' => '<strong>%disp_coll_name( #blog_shortname#, #blog_ID# )%</strong>', 106 ); 107 108 $Results->cols[] = array( 109 'th' => T_('Full Name'), 110 'order' => 'blog_name', 111 'td' => '$blog_name$', 112 ); 113 114 $Results->cols[] = array( 115 'th' => T_('Owner'), 116 'order' => 'user_login', 117 'td' => '$user_login$', 118 ); 119 120 $Results->cols[] = array( 121 'th' => T_('Blog URL'), 122 'td' => '<a href="@get(\'url\')@">@get(\'url\')@</a>', 123 ); 124 125 function disp_static_filename( & $Blog ) 126 { 127 global $current_User; 128 if( $r = $Blog->get_setting('static_file') ) 129 { 130 if( $current_User->check_perm( 'blog_genstatic', 'any', false, $Blog->ID ) ) 131 { 132 $gen_url = '?ctrl=collections&action=GenStatic&blog='.$Blog->ID; 133 $r .= ' [<a href="'.$gen_url.'" title="'.T_('Generate static page now!').'">'; 134 $r .= /* TRANS: abbrev. for "generate !" */ T_('Gen!'); 135 $r .= '</a>]'; 136 } 137 } 138 else 139 { // for IE 140 $r = ' '; 141 } 142 return $r; 143 } 144 $Results->cols[] = array( 145 'th' => T_('Static File'), 146 'order' => 'blog_staticfilename', 147 'td' => '%disp_static_filename( {Obj} )%', 148 ); 149 150 $Results->cols[] = array( 151 'th' => T_('Locale'), 152 'order' => 'blog_locale', 153 'th_class' => 'shrinkwrap', 154 'td_class' => 'shrinkwrap', 155 'td' => '%locale_flag( #blog_locale# )%', 156 ); 157 158 159 function disp_actions( $curr_blog_ID ) 160 { 161 global $current_User; 162 $r = ''; 163 164 if( $current_User->check_perm( 'blog_properties', 'edit', false, $curr_blog_ID ) ) 165 { 166 $r .= action_icon( T_('Edit properties...'), 'properties', regenerate_url( 'ctrl', 'ctrl=coll_settings&blog='.$curr_blog_ID ) ); 167 } 168 169 if( $current_User->check_perm( 'blog_cats', '', false, $curr_blog_ID ) ) 170 { 171 $r .= action_icon( T_('Edit categories...'), 'edit', regenerate_url( 'ctrl', 'ctrl=chapters&blog='.$curr_blog_ID ) ); 172 } 173 174 if( $current_User->check_perm( 'blog_properties', 'edit', false, $curr_blog_ID ) ) 175 { 176 $r .= action_icon( T_('Delete this blog...'), 'delete', regenerate_url( 'ctrl', 'ctrl=collections&action=delete&blog='.$curr_blog_ID ) ); 177 } 178 179 if( empty($r) ) 180 { // for IE 181 $r = ' '; 182 } 183 184 return $r; 185 } 186 $Results->cols[] = array( 187 'th' => T_('Actions'), 188 'th_class' => 'shrinkwrap', 189 'td_class' => 'shrinkwrap', 190 'td' => '%disp_actions( #blog_ID# )%', 191 ); 192 193 194 $Results->display( NULL, 'session' ); 195 196 197 /* 198 * $Log: _coll_list.view.php,v $ 199 * Revision 1.2 2007/09/11 20:57:51 fplanque 200 * minor fixes 201 * 202 * Revision 1.1 2007/06/25 10:59:37 fplanque 203 * MODULES (refactored MVC) 204 * 205 * Revision 1.19 2007/06/13 19:06:17 fplanque 206 * debugging 207 * 208 * Revision 1.18 2007/05/28 01:35:23 fplanque 209 * fixed static page generation 210 * 211 * Revision 1.17 2007/04/26 00:11:05 fplanque 212 * (c) 2007 213 * 214 * Revision 1.16 2007/03/25 13:19:17 fplanque 215 * temporarily disabled dynamic and static urls. 216 * may become permanent in favor of a caching mechanism. 217 * 218 * Revision 1.15 2007/01/23 04:19:50 fplanque 219 * handling of blog owners 220 * 221 * Revision 1.14 2007/01/15 18:48:20 fplanque 222 * cleanup 223 * 224 * Revision 1.13 2007/01/15 00:38:06 fplanque 225 * pepped up "new blog" creation a little. To be continued. 226 * 227 * Revision 1.12 2007/01/14 22:42:55 fplanque 228 * removed old crap 229 * 230 * Revision 1.11 2007/01/14 22:09:52 fplanque 231 * attempt to display the list of blogs in a modern way. 232 * 233 */ 234 ?>
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 |
![]() |