Skip to content

Commit

Permalink
Modernize api token pages
Browse files Browse the repository at this point in the history
  • Loading branch information
syncguru committed Dec 12, 2015
1 parent a7fb5df commit 6a98975
Show file tree
Hide file tree
Showing 4 changed files with 76 additions and 40 deletions.
25 changes: 12 additions & 13 deletions api_token_create.php
Expand Up @@ -46,21 +46,20 @@
$t_disclose_message = lang_get( 'api_token_disclose_message' );
$t_display_once_message = lang_get( 'api_token_displayed_once' );

html_page_top();

layout_page_header( lang_get( 'api_tokens_link' ) );

layout_page_begin();
?>

<div align="center">
<br /><br />
<?php echo $t_disclose_message ?>
<br />
<span class="important-msg"><?php echo $t_display_once_message ?></span>
<br /><br />
<span class="api-token"><?php echo string_display_line( $t_token ) ?></span>
<br /><br />
<?php print_bracket_link( 'api_tokens_page.php', lang_get( 'api_tokens_link' ) ) ?>
<br />
<div class="col-md-12 col-xs-12">
<h2><?php echo $t_disclose_message ?></h2>
<div class="lead red"><?php echo $t_display_once_message ?></div>
<div class="space-10"></div>
<div class="well"><?php echo string_display_line( $t_token ) ?></div>
<div class="space-10"></div>
<?php print_button( 'api_tokens_page.php', lang_get( 'api_tokens_link' ) ) ?>
</div>

<?php
html_page_bottom();
layout_page_end();

16 changes: 10 additions & 6 deletions api_token_revoke.php
Expand Up @@ -43,14 +43,18 @@

api_token_revoke( $f_token_id, $t_user_id );

html_page_top1();
layout_page_header_begin();
html_meta_redirect( 'api_tokens_page.php' );
html_page_top2();
layout_page_header_end();

echo '<div align="center">';
echo '<br /><br />' . sprintf( lang_get( 'api_token_revoked' ), string_display_line( $f_token_name ) ) . '<br /><br />';
print_bracket_link( 'api_tokens_page.php', lang_get( 'api_tokens_link' ) );
layout_page_begin( 'api_tokens_page.php' );

echo '<div class="col-md-12 col-xs-12">';
echo '<div class="space-10"></div>';
echo '<div class="lead">' . sprintf( lang_get( 'api_token_revoked' ), string_display_line( $f_token_name ) ) . '</div>';
echo '<div class="space-10"></div>';
print_button( 'api_tokens_page.php', lang_get( 'api_tokens_link' ) );
echo '</div>';

html_page_bottom();
layout_page_end();

70 changes: 54 additions & 16 deletions api_tokens_page.php
Expand Up @@ -40,24 +40,52 @@

current_user_ensure_unprotected();

html_page_top( lang_get( 'api_tokens_link' ) );
layout_page_header( lang_get( 'api_tokens_link' ) );
layout_page_begin();
print_account_menu( 'api_tokens_page.php' );
?>

<div class="col-md-12 col-xs-12">
<div class="space-10"></div>

<div id="api-token-create-div" class="form-container">
<form id="account-create-api-token-form" method="post" action="api_token_create.php">

<div class="widget-box widget-color-blue2">
<div class="widget-header widget-header-small">
<h4 class="widget-title lighter">
<i class="ace-icon fa fa-plus"></i>
<?php echo lang_get( 'api_token_create_form_title' ) ?>
</h4>
</div>
<div class="widget-body">
<div class="widget-main no-padding">
<div class="table-responsive">
<table class="table table-bordered table-condensed table-striped">
<fieldset>
<legend><span><?php echo lang_get( 'api_token_create_form_title' ); ?></span></legend>
<?php echo form_security_field( 'create_api_token_form' ); ?>

<div class="field-container">
<label for="token_name"><span><?php echo lang_get( 'api_token_name' ) ?></span></label>
<span class="input"><input id="token_name" type="text" name="token_name" size="64" maxlength="<?php echo DB_FIELD_SIZE_API_TOKEN_NAME; ?>" /></span>
<span class="label-style"></span>
</div>
<tr>
<td class="category">
<?php echo lang_get( 'api_token_name' ) ?>
</td>
<td>
<input class="input-sm" id="token_name" type="text" name="token_name" size="64" maxlength="<?php echo DB_FIELD_SIZE_API_TOKEN_NAME; ?>" />
</td>
</tr>


<span class="submit-button"><input type="submit" class="button" value="<?php echo lang_get( 'api_token_create_button' ) ?>" /></span>
</fieldset>
</form>
</table>
</div>
</div>
<div class="widget-toolbox padding-8 clearfix">
<input type="submit" class="btn btn-primary btn-white btn-round" value="<?php echo lang_get( 'api_token_create_button' ) ?>" />
</div>
</div>
</div>

</form>
</div>
<?php
$t_user_id = auth_get_current_user_id();
Expand All @@ -66,12 +94,20 @@

if ( count( $t_tokens ) > 0 ) {
?>
<div id="api-tokens-list-div" class="form-container">
<fieldset>
<legend><span><?php echo lang_get( 'api_tokens_title' ); ?></span></legend>
</fieldset>
<div class="space-10"></div>

<table>
<div id="api-token-list-div" class="form-container">
<div class="widget-box widget-color-blue2">
<div class="widget-header widget-header-small">
<h4 class="widget-title lighter">
<i class="ace-icon fa fa-ticket"></i>
<?php echo lang_get( 'api_tokens_title' ) ?>
</h4>
</div>
<div class="widget-body">
<div class="widget-main no-padding">
<div class="table-responsive">
<table class="table table-bordered table-condensed table-striped">
<thead>
<tr class="row-category">
<th><?php echo lang_get( 'api_token_name' ); ?></th>
Expand Down Expand Up @@ -102,7 +138,7 @@
<fieldset>
<input id="token_id" type="hidden" name="token_id" value="<?php echo $u_id ; ?>" />
<input id="token_name" type="hidden" name="token_name" value="<?php echo string_attribute( $u_name ); ?>" />
<input type="submit" class="button" value="<?php echo lang_get( 'api_token_revoke_button' ) ?>" />
<input type="submit" class="btn btn-sm btn-primary btn-white btn-round" value="<?php echo lang_get( 'api_token_revoke_button' ) ?>" />
</fieldset>
</form>
</td>
Expand All @@ -111,7 +147,9 @@
</tbody>
</table>
</div>
</div>
</div>
<?php
}

html_page_bottom();
layout_page_end();
5 changes: 0 additions & 5 deletions core/html_api.php
Expand Up @@ -667,11 +667,6 @@ function print_account_menu( $p_page = '' ) {

$t_pages['api_tokens_page.php'] = array( 'url' => 'api_tokens_page.php', 'label' => 'api_tokens_link' );

# Remove the link from the current page
if( isset( $t_pages[$p_page] ) ) {
$t_pages[$p_page]['url'] = '';
}

# Plugin / Event added options
$t_event_menu_options = event_signal( 'EVENT_MENU_ACCOUNT' );
$t_menu_options = array();
Expand Down

0 comments on commit 6a98975

Please sign in to comment.