Skip to content
This repository has been archived by the owner on Sep 10, 2021. It is now read-only.

Commit

Permalink
Add REST API base URL to relevant config page
Browse files Browse the repository at this point in the history
Fixes #3.
  • Loading branch information
Jamie Snape committed Dec 15, 2014
1 parent e89d1c8 commit f823b23
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 33 deletions.
1 change: 1 addition & 0 deletions core/controllers/ApikeyController.php
Original file line number Diff line number Diff line change
Expand Up @@ -87,5 +87,6 @@ public function usertabAction()
$userapiDaos = $this->Userapi->getByUser($user);
$this->view->userapiDaos = $userapiDaos;
$this->view->user = $user;
$this->view->serverURL = $this->getServerURL();
}
}
50 changes: 19 additions & 31 deletions core/views/apikey/usertab.phtml
Original file line number Diff line number Diff line change
Expand Up @@ -20,72 +20,60 @@

echo '<script type="text/javascript" src="'.$this->coreWebroot.'/public/js/apikey/apikey.usertab.js"></script>';
?>
<h3>REST Web API</h3>
<p><b>Base URL:</b> <a href="<?php echo $this->serverURL.$this->webroot; ?>/rest"><?php echo $this->serverURL.$this->webroot; ?>/rest</a></p>

<h3><?php echo $this->t('Generated API keys') ?></h3>
<h3><?php echo $this->t('Generated API Keys') ?></h3>
<?php if (count($this->userapiDaos) == 0) {
echo "You do not have any API keys.<br/>";
} else {
?>
<table width="100%" border="0">
<tr bgcolor="#999999">
<td>
<center><b><?php echo $this->t('Application Name') ?></b>
</center>
</td>
<td>
<center><b>API Key</b></center>
</td>
<td>
<center><b><?php echo $this->t('Default Expiration') ?></b>
</center>
</td>
<td>
<center><b>Creation</b></center>
</td>
<td>
<center><b>Action</b></center>
</td>
<th><?php echo $this->t('Application Name') ?></th>
<th>API Key</th>
<th><?php echo $this->t('Default Expiration') ?></th>
<th>Creation</th>
<th>Action</th>
</tr>
<?php
foreach ($this->userapiDaos as $userapiDao) {
?>
<tr>
<td><?php echo $this->escape($userapiDao->getApplicationName()); ?></td>
<td><?php echo $this->escape($userapiDao->getApikey()); ?></td>
<td><?php echo $this->escape($userapiDao->getTokenExpirationTime()); ?> minutes
</td>
<td><?php echo $this->escape($userapiDao->getTokenExpirationTime()); ?> minutes</td>
<td><?php echo $this->dateago($userapiDao->getCreationDate()); ?></td>
<td>
<a style='text-decoration: underline;' class='deleteApiKeyLink'
element='<?php echo $this->escape($userapiDao->getKey()); ?>'><?php echo $this->t('delete') ?></a>
</td>
</tr>
<?php
} // end foreach keys
}
?>
</table>
<?php
} // end count
}
?>

<a href="<?php echo $this->webroot ?>/rest">Web API Information</a>
<br />

<div class="separator"></div>
<h3><?php echo $this->t('Generate New API Key') ?></h3>

<form class="genericForm" id="generateKeyForm" method="<?php echo $this->form['method'] ?>"
action="<?php echo $this->form['action'] ?>">
<form class="genericForm" id="generateKeyForm" method="<?php echo $this->form['method']; ?>"
action="<?php echo $this->form['action']; ?>">
<input type="hidden" id="apiUserId" name="userId" value="<?php echo $this->escape($this->user->getKey()); ?>"/>

<div>
<label for="appplication_name"><?php echo $this->t('Application Name') ?>:</label>
<?php echo $this->form['appplication_name'] ?>
<label for="appplication_name"><?php echo $this->t('Application Name'); ?>:</label>
<?php echo $this->form['appplication_name']; ?>
</div>
<div>
<label for="expiration"><?php echo $this->t('Default Expiration') ?> (minutes):</label>
<?php echo $this->form['expiration'] ?>
<label for="expiration"><?php echo $this->t('Default Expiration'); ?> (minutes):</label>
<?php echo $this->form['expiration']; ?>
</div>
<div>
<?php echo $this->form['createAPIKey'] ?>
<?php echo $this->form['createAPIKey']; ?>
</div>
</form>
1 change: 0 additions & 1 deletion modules/api/controllers/IndexController.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@ public function preDispatch()
/** Index function */
public function indexAction()
{
$this->view->header = 'Web API';
$this->_computeApiHelp($this->apiSetup['apiMethodPrefix']);

// Prepare the data used by the view
Expand Down
2 changes: 1 addition & 1 deletion modules/api/views/index/index.phtml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ $this->headScript()->appendFile($this->moduleWebroot.'/public/js/index/index.ind
<div class="viewMain">
<h2>Deprecated JSON RPC API</h2>
<div>
<img style="position: relative; top: 3px;" src="<?php echo $this->coreWebroot ?>/public/images/icons/warning.png"> This API is
<img style="position: relative; top: 3px;" src="<?php echo $this->coreWebroot ?>/public/images/icons/warning.png"> This JSON RPC API is
<b>deprecated</b>. Instead use the <a href="<?php echo $this->escape($this->serverURL.$this->webroot); ?>/rest">RESTful API</a>.
</div>
<br />
Expand Down

0 comments on commit f823b23

Please sign in to comment.