[ Index ]

PHP Cross Reference of GlotPress

title

Body

[close]

/gp-templates/ -> project-permissions.php (source)

   1  <?php
   2  gp_title(
   3      sprintf(
   4          /* translators: %s: Project name. */
   5          __( 'Permissions &lt; %s &lt; GlotPress', 'glotpress' ),
   6          $project->name
   7      )
   8  );
   9  gp_breadcrumb_project( $project );
  10  gp_tmpl_header();
  11  ?>
  12  <h2><?php _e( 'Permissions', 'glotpress' ); ?></h2>
  13  <h3 id="validators">
  14      <?php _e( 'Validators', 'glotpress' ); ?>
  15      <?php if ( count( $permissions ) + count( $parent_permissions ) > 1 ) : ?>
  16      <a href="#add" onclick="jQuery('#user_login').focus(); return false;"><?php _e( 'Add', 'glotpress' ); ?> &rarr;</a>
  17      <?php endif; ?>
  18  </h3>
  19      <?php if ( $permissions ) : ?>
  20      <?php if ( $parent_permissions ) : ?>
  21  <h4 id="validators"><?php _e( 'Validators for this project', 'glotpress' ); ?></h4>
  22      <?php endif; ?>
  23  
  24      <table class="gp-table permissions">
  25          <thead>
  26              <tr>
  27                  <th class="gp-column-user"><?php _e( 'User', 'glotpress' ); ?></th>
  28                  <th class="gp-column-permission"><?php _e( 'Permission', 'glotpress' ); ?></th>
  29                  <th class="gp-column-locale"><?php _e( 'Locale', 'glotpress' ); ?></th>
  30                  <th class="gp-column-slug"><?php _e( 'Slug', 'glotpress' ); ?></th>
  31                  <th class="gp-column-actions">&mdash;</th>
  32              </tr>
  33          </thead>
  34          <tbody>
  35              <?php foreach ( $permissions as $permission ) : ?>
  36                  <tr>
  37                      <td class="user"><?php printf( '<a href="%s">%s</a>', esc_url( gp_url_profile( $permission->user->user_nicename ) ), esc_html( $permission->user->user_login ) ); ?></td>
  38                      <td><?php echo esc_html( $permission->action ); ?></td>
  39                      <td><?php echo esc_html( $permission->locale_slug ); ?></td>
  40                      <td><?php echo esc_html( $permission->set_slug ); ?></td>
  41                      <td><a href="<?php echo esc_url( gp_route_nonce_url( gp_url_join( gp_url_current(), '-delete/' . $permission->id ), 'delete-project-permission_' . $permission->id ) ); ?>" class="action delete"><?php _e( 'Delete', 'glotpress' ); ?></a></td>
  42                  </tr>
  43              <?php endforeach; ?>
  44          </tbody>
  45      </table>
  46      <?php endif; ?>
  47      <?php if ( $parent_permissions ) : ?>
  48  <h4 id="validators"><?php _e( 'Validators for parent projects', 'glotpress' ); ?></h4>
  49      <table class="gp-table permissions">
  50          <thead>
  51              <tr>
  52                  <th class="gp-column-user"><?php _e( 'User', 'glotpress' ); ?></th>
  53                  <th class="gp-column-permission"><?php _e( 'Permission', 'glotpress' ); ?></th>
  54                  <th class="gp-column-locale"><?php _e( 'Locale', 'glotpress' ); ?></th>
  55                  <th class="gp-column-slug"><?php _e( 'Slug', 'glotpress' ); ?></th>
  56                  <th class="gp-column-parent"><?php _e( 'Parent', 'glotpress' ); ?></th>
  57              </tr>
  58          </thead>
  59          <tbody>
  60              <?php foreach ( $parent_permissions as $permission ) : ?>
  61                  <tr>
  62                      <td><?php printf( '<a href="%s">%s</a>', esc_url( gp_url_profile( $permission->user->user_nicename ) ), esc_html( $permission->user->user_login ) ); ?></td>
  63                      <td><?php echo esc_html( $permission->action ); ?></td>
  64                      <td><?php echo esc_html( $permission->locale_slug ); ?></td>
  65                      <td><?php echo esc_html( $permission->set_slug ); ?></td>
  66                      <td><?php gp_link_project( $permission->project, esc_html( $permission->project->name ) ); ?></td>
  67                  </tr>
  68              <?php endforeach; ?>
  69          </tbody>
  70      </table>
  71      <?php endif; ?>
  72      <?php if ( ! $permissions && ! $parent_permissions ) : ?>
  73          <strong><?php _e( 'No validators defined for this project.', 'glotpress' ); ?></strong>
  74      <?php endif; ?>
  75  <form action="" method="post">
  76      <h3 id="add"><?php _e( 'Add a validator for this project', 'glotpress' ); ?></h3>
  77      <dl>
  78          <dt><label for="user_login"><?php _e( 'Username:', 'glotpress' ); ?></label></dt>
  79          <dd><input type="text" name="user_login" value="" id="user_login" /></dd>
  80          <dt><label for="locale"><?php _e( 'Locale:', 'glotpress' ); ?></label></dt>
  81          <dd><?php echo gp_locales_by_project_dropdown( $project->id, 'locale' ); ?></dd>
  82          <dt><label for="set-slug"><?php _e( 'Translation set slug:', 'glotpress' ); ?></label></dt>
  83          <dd><input type="text" name="set-slug" value="default" id="set-slug" /></dd>
  84      </dl>
  85  
  86      <div class="button-group">
  87          <input class="button is-primary" type="submit" name="submit" value="<?php esc_attr_e( 'Add', 'glotpress' ); ?>" id="submit" />
  88          <a class="button is-link" href="<?php echo esc_url( gp_url_project( $project ) ); ?>"><?php _e( 'Cancel', 'glotpress' ); ?></a>
  89      </div>
  90  
  91      <input type="hidden" name="action" value="add-validator" />
  92      <?php gp_route_nonce_field( 'add-project-permissions_' . $project->id ); ?>
  93  </form>
  94  <?php
  95  gp_tmpl_footer();


Generated: Sat Nov 23 01:01:06 2024 Cross-referenced by PHPXref 0.7.1