b2evolution PHP Cross Reference Blogging Systems

Source: /inc/collections/views/_coll_group_perm.form.php - 298 lines - 13564 bytes - Text - Print

Description: This file implements the UI view (+more :/) for the blogs permission management. b2evolution - {@link http://b2evolution.net/} Released under GNU GPL License - {@link http://b2evolution.net/about/license.html}

   1  <?php
   2  /**
   3   * This file implements the UI view (+more :/) for the blogs permission management.
   4   *
   5   * b2evolution - {@link http://b2evolution.net/}
   6   * Released under GNU GPL License - {@link http://b2evolution.net/about/license.html}
   7   * @copyright (c)2003-2014 by Francois Planque - {@link http://fplanque.com/}
   8   *
   9   * @package admin
  10   *
  11   * @todo move user rights queries to object (fplanque)
  12   *
  13   * @version $Id: _coll_group_perm.form.php 6136 2014-03-08 07:59:48Z manuel $
  14   */
  15  if( !defined('EVO_MAIN_INIT') ) die( 'Please, do not access this page directly.' );
  16  
  17  /**
  18   * @var Blog
  19   */
  20  global $edited_Blog;
  21  /**
  22   * @var User
  23   */
  24  global $current_User;
  25  
  26  global $debug;
  27  global $UserSettings;
  28  global $rsc_url, $htsrv_url;
  29  
  30  global $Blog, $permission_to_change_admin;
  31  
  32  $permission_to_change_admin = $current_User->check_perm( 'blog_admin', 'edit', false, $Blog->ID );
  33  
  34  // Javascript:
  35  echo '
  36  <script type="text/javascript">var htsrv_url = "'.$htsrv_url.'";</script>
  37  <script type="text/javascript" src="'.$rsc_url.'js/collectionperms.js"></script>';
  38  
  39  $Form = new Form( NULL, 'blogperm_checkchanges', 'post', 'fieldset' );
  40  
  41  $Form->begin_form( 'fform' );
  42  
  43  $Form->add_crumb( 'collection' );
  44  $Form->hidden_ctrl();
  45  $Form->hidden( 'tab', 'permgroup' );
  46  $Form->hidden( 'blog', $edited_Blog->ID );
  47  
  48  $Form->begin_fieldset( T_('Group permissions').get_manual_link('group_permissions') );
  49  
  50  
  51  /*
  52   * Query user list:
  53   */
  54  if( get_param('action') == 'filter2' )
  55  {
  56      $keywords = param( 'keywords2', 'string', '', true );
  57      set_param( 'keywords1', $keywords );
  58  }
  59  else
  60  {
  61      $keywords = param( 'keywords1', 'string', '', true );
  62      set_param( 'keywords2', $keywords );
  63  }
  64  
  65  
  66  $SQL = new SQL();
  67  $SQL->SELECT( 'grp_ID, grp_name, bloggroup_perm_poststatuses + 0 as perm_poststatuses, bloggroup_perm_edit, bloggroup_ismember,'
  68      . 'bloggroup_perm_delcmts, bloggroup_perm_recycle_owncmts, bloggroup_perm_vote_spam_cmts, bloggroup_perm_cmtstatuses + 0 as perm_cmtstatuses, bloggroup_perm_edit_cmt,'
  69      . 'bloggroup_perm_delpost, bloggroup_perm_edit_ts, bloggroup_perm_cats,'
  70      . 'bloggroup_perm_properties, bloggroup_perm_admin, bloggroup_perm_media_upload,'
  71      . 'bloggroup_perm_media_browse, bloggroup_perm_media_change, bloggroup_perm_page,'
  72      . 'bloggroup_perm_intro, bloggroup_perm_podcast, bloggroup_perm_sidebar' );
  73  $SQL->FROM( 'T_groups LEFT JOIN T_coll_group_perms ON
  74              ( grp_ID = bloggroup_group_ID AND bloggroup_blog_ID = '.$edited_Blog->ID.' )' );
  75  $SQL->ORDER_BY( 'bloggroup_ismember DESC, *, grp_name, grp_ID' );
  76  
  77  if( !empty( $keywords ) )
  78  {
  79      $SQL->add_search_field( 'grp_name' );
  80      $SQL->WHERE_keywords( $keywords, 'AND' );
  81  }
  82  
  83  // Display wide layout:
  84  ?>
  85  
  86  <div id="userlist_wide" class="clear">
  87  
  88  <?php
  89  
  90  $Results = new Results( $SQL->get(), 'collgroup_' );
  91  
  92  // Tell the Results class that we already have a form for this page:
  93  $Results->Form = & $Form;
  94  
  95  $Results->title = T_('Group permissions');
  96  
  97  $Results->filter_area = array(
  98      'submit' => 'actionArray[filter1]',
  99      'callback' => 'filter_collobjectlist',
 100      'url_ignore' => 'results_collgroup_page,keywords1,keywords2',
 101      'presets' => array(
 102          'all' => array( T_('All users'), regenerate_url( 'action,results_collgroup_page,keywords1,keywords2', 'action=edit' ) ),
 103          )
 104      );
 105  
 106  /*
 107   * Grouping params:
 108   */
 109  $Results->group_by = 'bloggroup_ismember';
 110  $Results->ID_col = 'grp_ID';
 111  
 112  /*
 113   * Group columns:
 114   */
 115  $Results->grp_cols[] = array(
 116                          'td_colspan' => 0,  // nb_cols
 117                          'td' => '~conditional( #bloggroup_ismember#, \''.format_to_output( TS_('Members'), 'htmlattr' ).'\', \''.format_to_output( TS_('Non members'), 'htmlattr' ).'\' )~',
 118                      );
 119  
 120  /*
 121   * Colmun definitions:
 122   */
 123  $Results->cols[] = array(
 124                          'th' => T_('ID'),
 125                          'order' => 'grp_ID',
 126                          'td' => '$grp_ID$',
 127                          'th_class' => 'shrinkwrap',
 128                          'td_class' => 'right',
 129                      );
 130  
 131  $Results->cols[] = array(
 132                          'th' => T_('Group'),
 133                          'order' => 'grp_name',
 134                          'td' => '<a href="?ctrl=users&amp;filter=new&amp;group=$grp_ID$">$grp_name$</a>',
 135                      );
 136  
 137  $Results->cols[] = array(
 138                          'th' => /* TRANS: SHORT table header on TWO lines */ T_('Is<br />member'),
 139                          'th_class' => 'checkright',
 140                          'td' => '%coll_perm_checkbox( {row}, \'bloggroup_\', \'ismember\', \''.format_to_output( TS_('Permission to read members posts'), 'htmlattr' ).'\', \'checkallspan_state_$grp_ID$\' )%',
 141                          'td_class' => 'center',
 142                      );
 143  
 144  $Results->cols[] = array(
 145                          'th' => T_('Post statuses'),
 146                          'th_class' => 'checkright',
 147                          'td' => '%coll_perm_status_checkbox( {row}, \'bloggroup_\', \'published\', \''.format_to_output( TS_('Permission to post into this blog with published status'), 'htmlattr' ).'\', \'post\' )%'.
 148                                  '%coll_perm_status_checkbox( {row}, \'bloggroup_\', \'community\', \''.format_to_output( TS_('Permission to post into this blog with community status'), 'htmlattr' ).'\', \'post\' )%'.
 149                                  '%coll_perm_status_checkbox( {row}, \'bloggroup_\', \'protected\', \''.format_to_output( TS_('Permission to post into this blog with members status'), 'htmlattr' ).'\', \'post\' )%'.
 150                                  '%coll_perm_status_checkbox( {row}, \'bloggroup_\', \'private\', \''.format_to_output( TS_('Permission to post into this blog with private status'), 'htmlattr' ).'\', \'post\' )%'.
 151                                  '%coll_perm_status_checkbox( {row}, \'bloggroup_\', \'review\', \''.format_to_output( TS_('Permission to post into this blog with review status'), 'htmlattr' ).'\', \'post\' )%'.
 152                                  '%coll_perm_status_checkbox( {row}, \'bloggroup_\', \'draft\', \''.format_to_output( TS_('Permission to post into this blog with draft status'), 'htmlattr' ).'\', \'post\' )%'.
 153                                  '%coll_perm_status_checkbox( {row}, \'bloggroup_\', \'deprecated\', \''.format_to_output( TS_('Permission to post into this blog with deprecated status'), 'htmlattr' ).'\', \'post\' )%'.
 154                                  '%coll_perm_status_checkbox( {row}, \'bloggroup_\', \'redirected\', \''.format_to_output( TS_('Permission to post into this blog with redirected status'), 'htmlattr' ).'\', \'post\' )%',
 155                          'td_class' => 'center',
 156                      );
 157  
 158  $Results->cols[] = array(
 159                          'th' => T_('Post types'),
 160                          'th_class' => 'checkright',
 161                          'td' => '%coll_perm_checkbox( {row}, \'bloggroup_\', \'perm_page\', \''.format_to_output( TS_('Permission to create pages'), 'htmlattr' ).'\' )%'.
 162                                  '%coll_perm_checkbox( {row}, \'bloggroup_\', \'perm_intro\', \''.format_to_output( TS_('Permission to create intro posts (Intro-* post types)'), 'htmlattr' ).'\' )%'.
 163                                  '%coll_perm_checkbox( {row}, \'bloggroup_\', \'perm_podcast\', \''.format_to_output( TS_('Permission to create podcast episodes'), 'htmlattr' ).'\' )%'.
 164                                  '%coll_perm_checkbox( {row}, \'bloggroup_\', \'perm_sidebar\', \''.format_to_output( TS_('Permission to create sidebar links'), 'htmlattr' ).'\' )%',
 165                          'td_class' => 'center',
 166                      );
 167  
 168  $Results->cols[] = array(
 169                          'th' => /* TRANS: SHORT table header on TWO lines */ T_('Edit posts<br />/user level'),
 170                          'th_class' => 'checkright',
 171                          'default_dir' => 'D',
 172                          'td' => '%coll_perm_edit( {row}, \'bloggroup_\' )%',
 173                          'td_class' => 'center',
 174                      );
 175  
 176  $Results->cols[] = array(
 177                          'th' => /* TRANS: SHORT table header on TWO lines */ T_('Delete<br />posts'),
 178                          'th_class' => 'checkright',
 179                          'order' => 'bloggroup_perm_delpost',
 180                          'default_dir' => 'D',
 181                          'td' => '%coll_perm_checkbox( {row}, \'bloggroup_\', \'perm_delpost\', \''.format_to_output( TS_('Permission to delete posts in this blog'), 'htmlattr' ).'\' )%',
 182                          'td_class' => 'center',
 183                      );
 184  
 185  $Results->cols[] = array(
 186                          'th' => /* TRANS: SHORT table header on TWO lines */ T_('Edit<br />TS'),
 187                          'th_class' => 'checkright',
 188                          'order' => 'bloggroup_perm_edit_ts',
 189                          'default_dir' => 'D',
 190                          'td' => '%coll_perm_checkbox( {row}, \'bloggroup_\', \'perm_edit_ts\', \''.format_to_output( TS_('Permission to edit timestamp on posts and comments in this blog'), 'htmlattr' ).'\' )%',
 191                          'td_class' => 'center',
 192                      );
 193  
 194  $Results->cols[] = array(
 195                          'th' => /* TRANS: SHORT table header on TWO lines */ T_('Comment<br />statuses'),
 196                          'th_class' => 'checkright',
 197                          'td' => '%coll_perm_status_checkbox( {row}, \'bloggroup_\', \'published\', \''.format_to_output( TS_('Permission to comment into this blog with published status'), 'htmlattr' ).'\', \'comment\' )%'.
 198                                  '%coll_perm_status_checkbox( {row}, \'bloggroup_\', \'community\', \''.format_to_output( TS_('Permission to comment into this blog with community status'), 'htmlattr' ).'\', \'comment\' )%'.
 199                                  '%coll_perm_status_checkbox( {row}, \'bloggroup_\', \'protected\', \''.format_to_output( TS_('Permission to comment into this blog with members status'), 'htmlattr' ).'\', \'comment\' )%'.
 200                                  '%coll_perm_status_checkbox( {row}, \'bloggroup_\', \'private\', \''.format_to_output( TS_('Permission to comment into this blog with private status'), 'htmlattr' ).'\', \'comment\' )%'.
 201                                  '%coll_perm_status_checkbox( {row}, \'bloggroup_\', \'review\', \''.format_to_output( TS_('Permission to comment into this blog with review status'), 'htmlattr' ).'\', \'comment\' )%'.
 202                                  '%coll_perm_status_checkbox( {row}, \'bloggroup_\', \'draft\', \''.format_to_output( TS_('Permission to comment into this blog with draft status'), 'htmlattr' ).'\', \'comment\' )%'.
 203                                  '%coll_perm_status_checkbox( {row}, \'bloggroup_\', \'deprecated\', \''.format_to_output( TS_('Permission to comment into this blog with deprecated status'), 'htmlattr' ).'\', \'comment\' )%',
 204                          'td_class' => 'center',
 205                      );
 206  
 207  $Results->cols[] = array(
 208                          'th' => /* TRANS: SHORT table header on TWO lines */ T_('Edit cmts<br />/user level'),
 209                          'th_class' => 'checkright',
 210                          'default_dir' => 'D',
 211                          'td' => '%coll_perm_edit_cmt( {row}, \'bloggroup_\' )%',
 212                          'td_class' => 'center',
 213                      );
 214  
 215  $Results->cols[] = array(
 216                          'th' => /* TRANS: SHORT table header on TWO lines */ T_('Delete<br />cmts'),
 217                          'th_class' => 'checkright',
 218                          'order' => 'bloggroup_perm_delcmts',
 219                          'default_dir' => 'D',
 220                          'td' => '%coll_perm_checkbox( {row}, \'bloggroup_\', \'perm_delcmts\', \''.format_to_output( TS_('Permission to delete comments on this blog'), 'htmlattr' ).'\' )%&nbsp;'.
 221                                  '%coll_perm_checkbox( {row}, \'bloggroup_\', \'perm_recycle_owncmts\', \''.format_to_output( TS_('Permission to recycle comments on their own posts'), 'htmlattr' ).'\' )%&nbsp;'.
 222                                  '%coll_perm_checkbox( {row}, \'bloggroup_\', \'perm_vote_spam_cmts\', \''.format_to_output( TS_('Permission to give a spam vote on any comment'), 'htmlattr' ).'\' )%&nbsp;',
 223                          'td_class' => 'center',
 224                      );
 225  
 226  $Results->cols[] = array(
 227                          'th_group' => T_('Edit blog settings'),
 228                          'th' => T_('Cats'),
 229                          'th_title' => T_('Categories'),
 230                          'th_class' => 'checkright',
 231                          'order' => 'bloggroup_perm_cats',
 232                          'default_dir' => 'D',
 233                          'td' => '%coll_perm_checkbox( {row}, \'bloggroup_\', \'perm_cats\', \''.format_to_output( TS_('Permission to edit categories for this blog'), 'htmlattr' ).'\' )%',
 234                          'td_class' => 'center',
 235                      );
 236  
 237  $Results->cols[] = array(
 238                          'th_group' => T_('Edit blog settings'),
 239                          'th' => /* TRANS: Short for blog features */  T_('Feat.'),
 240                          'th_title' => T_('Features'),
 241                          'th_class' => 'checkright',
 242                          'order' => 'bloggroup_perm_properties',
 243                          'default_dir' => 'D',
 244                          'td' => '%coll_perm_checkbox( {row}, \'bloggroup_\', \'perm_properties\', \''.format_to_output( TS_('Permission to edit blog features'), 'htmlattr' ).'\' )%',
 245                          'td_class' => 'center',
 246                      );
 247  
 248  $Results->cols[] = array(
 249                          'th_group' => T_('Edit blog settings'),
 250                          'th' => /* TRANS: Short for advanced */  T_('Adv.'),
 251                          'th_title' => T_('Advanced/Administrative blog properties'),
 252                          'th_class' => 'checkright',
 253                          'order' => 'bloggroup_perm_admin',
 254                          'default_dir' => 'D',
 255                          'td' => '%coll_perm_checkbox( {row}, \'bloggroup_\', \'perm_admin\', \''.format_to_output( TS_('Permission to edit advanced/administrative blog properties'), 'htmlattr' ).'\' )%',
 256                          'td_class' => 'center',
 257                      );
 258  
 259  // Media Directory:
 260  $Results->cols[] = array(
 261                          'th' => /* TRANS: SHORT table header on TWO lines */ T_('Media<br />Dir'),
 262                          'th_class' => 'checkright',
 263                          'order' => 'bloggroup_perm_media_upload',
 264                          'default_dir' => 'D',
 265                          'td' => '%coll_perm_checkbox( {row}, \'bloggroup_\', \'perm_media_upload\', \''.format_to_output( TS_('Permission to upload into blog\'s media folder'), 'htmlattr' ).'\' )%'.
 266                                  '%coll_perm_checkbox( {row}, \'bloggroup_\', \'perm_media_browse\', \''.format_to_output( TS_('Permission to browse blog\'s media folder'), 'htmlattr' ).'\' )%'.
 267                                  '%coll_perm_checkbox( {row}, \'bloggroup_\', \'perm_media_change\', \''.format_to_output( TS_('Permission to change the blog\'s media folder content'), 'htmlattr' ).'\' )%',
 268                          'td_class' => 'center',
 269                      );
 270  
 271  $Results->cols[] = array(
 272                          'th' => '&nbsp;',
 273                          'td' => '%perm_check_all( {row}, \'bloggroup_\' )%',
 274                          'td_class' => 'center',
 275                      );
 276  
 277  $Results->display();
 278  
 279  echo '</div>';
 280  
 281  // Permission note:
 282  // fp> TODO: link
 283  echo '<p class="note center">'.T_('Note: General group permissions may further restrict or extend any media folder permissions defined here.').'</p>';
 284  
 285  $Form->end_fieldset();
 286  
 287  // Make a hidden list of all displayed users:
 288  $grp_IDs = array();
 289  foreach( $Results->rows as $row )
 290  {
 291      $grp_IDs[] = $row->grp_ID;
 292  }
 293  $Form->hidden( 'group_IDs', implode( ',', $grp_IDs) );
 294  
 295  $Form->end_form( array( array( 'submit', 'actionArray[update]', T_('Update'), 'SaveButton' ),
 296                                                  array( 'reset', '', T_('Reset'), 'ResetButton' ) ) );
 297  
 298  ?>

title

Description

title

Description

title

Description

title

title

Body