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

Commit f823b23

Browse files
author
Jamie Snape
committed
Add REST API base URL to relevant config page
Fixes #3.
1 parent e89d1c8 commit f823b23

File tree

4 files changed

+21
-33
lines changed

4 files changed

+21
-33
lines changed

core/controllers/ApikeyController.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,5 +87,6 @@ public function usertabAction()
8787
$userapiDaos = $this->Userapi->getByUser($user);
8888
$this->view->userapiDaos = $userapiDaos;
8989
$this->view->user = $user;
90+
$this->view->serverURL = $this->getServerURL();
9091
}
9192
}

core/views/apikey/usertab.phtml

Lines changed: 19 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -20,72 +20,60 @@
2020

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

24-
<h3><?php echo $this->t('Generated API keys') ?></h3>
26+
<h3><?php echo $this->t('Generated API Keys') ?></h3>
2527
<?php if (count($this->userapiDaos) == 0) {
2628
echo "You do not have any API keys.<br/>";
2729
} else {
2830
?>
2931
<table width="100%" border="0">
3032
<tr bgcolor="#999999">
31-
<td>
32-
<center><b><?php echo $this->t('Application Name') ?></b>
33-
</center>
34-
</td>
35-
<td>
36-
<center><b>API Key</b></center>
37-
</td>
38-
<td>
39-
<center><b><?php echo $this->t('Default Expiration') ?></b>
40-
</center>
41-
</td>
42-
<td>
43-
<center><b>Creation</b></center>
44-
</td>
45-
<td>
46-
<center><b>Action</b></center>
47-
</td>
33+
<th><?php echo $this->t('Application Name') ?></th>
34+
<th>API Key</th>
35+
<th><?php echo $this->t('Default Expiration') ?></th>
36+
<th>Creation</th>
37+
<th>Action</th>
4838
</tr>
4939
<?php
5040
foreach ($this->userapiDaos as $userapiDao) {
5141
?>
5242
<tr>
5343
<td><?php echo $this->escape($userapiDao->getApplicationName()); ?></td>
5444
<td><?php echo $this->escape($userapiDao->getApikey()); ?></td>
55-
<td><?php echo $this->escape($userapiDao->getTokenExpirationTime()); ?> minutes
56-
</td>
45+
<td><?php echo $this->escape($userapiDao->getTokenExpirationTime()); ?> minutes</td>
5746
<td><?php echo $this->dateago($userapiDao->getCreationDate()); ?></td>
5847
<td>
5948
<a style='text-decoration: underline;' class='deleteApiKeyLink'
6049
element='<?php echo $this->escape($userapiDao->getKey()); ?>'><?php echo $this->t('delete') ?></a>
6150
</td>
6251
</tr>
6352
<?php
64-
} // end foreach keys
53+
}
6554
?>
6655
</table>
6756
<?php
68-
} // end count
57+
}
6958
?>
7059

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

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

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

8068
<div>
81-
<label for="appplication_name"><?php echo $this->t('Application Name') ?>:</label>
82-
<?php echo $this->form['appplication_name'] ?>
69+
<label for="appplication_name"><?php echo $this->t('Application Name'); ?>:</label>
70+
<?php echo $this->form['appplication_name']; ?>
8371
</div>
8472
<div>
85-
<label for="expiration"><?php echo $this->t('Default Expiration') ?> (minutes):</label>
86-
<?php echo $this->form['expiration'] ?>
73+
<label for="expiration"><?php echo $this->t('Default Expiration'); ?> (minutes):</label>
74+
<?php echo $this->form['expiration']; ?>
8775
</div>
8876
<div>
89-
<?php echo $this->form['createAPIKey'] ?>
77+
<?php echo $this->form['createAPIKey']; ?>
9078
</div>
9179
</form>

modules/api/controllers/IndexController.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,6 @@ public function preDispatch()
6060
/** Index function */
6161
public function indexAction()
6262
{
63-
$this->view->header = 'Web API';
6463
$this->_computeApiHelp($this->apiSetup['apiMethodPrefix']);
6564

6665
// Prepare the data used by the view

modules/api/views/index/index.phtml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ $this->headScript()->appendFile($this->moduleWebroot.'/public/js/index/index.ind
2525
<div class="viewMain">
2626
<h2>Deprecated JSON RPC API</h2>
2727
<div>
28-
<img style="position: relative; top: 3px;" src="<?php echo $this->coreWebroot ?>/public/images/icons/warning.png"> This API is
28+
<img style="position: relative; top: 3px;" src="<?php echo $this->coreWebroot ?>/public/images/icons/warning.png"> This JSON RPC API is
2929
<b>deprecated</b>. Instead use the <a href="<?php echo $this->escape($this->serverURL.$this->webroot); ?>/rest">RESTful API</a>.
3030
</div>
3131
<br />

0 commit comments

Comments
 (0)