Add API setting in the new theme during the installation

Also use the same variable name across template files
This commit is contained in:
ArthurHoaro 2017-03-22 19:58:22 +01:00
parent c4c655d9bf
commit 76be95e199
4 changed files with 23 additions and 5 deletions

View file

@ -1142,7 +1142,7 @@ function renderPage($conf, $pluginManager, $LINKSDB)
$conf->set('feed.rss_permalinks', !empty($_POST['enableRssPermalinks'])); $conf->set('feed.rss_permalinks', !empty($_POST['enableRssPermalinks']));
$conf->set('updates.check_updates', !empty($_POST['updateCheck'])); $conf->set('updates.check_updates', !empty($_POST['updateCheck']));
$conf->set('privacy.hide_public_links', !empty($_POST['hidePublicLinks'])); $conf->set('privacy.hide_public_links', !empty($_POST['hidePublicLinks']));
$conf->set('api.enabled', !empty($_POST['apiEnabled'])); $conf->set('api.enabled', !empty($_POST['enableApi']));
$conf->set('api.secret', escape($_POST['apiSecret'])); $conf->set('api.secret', escape($_POST['apiSecret']));
try { try {
$conf->write(isLoggedIn()); $conf->write(isLoggedIn());

View file

@ -186,7 +186,7 @@ <h2 class="window-title">{'Configure'|t}</h2>
<div class="pure-g"> <div class="pure-g">
<div class="pure-u-lg-{$ratioLabel} pure-u-{$ratioLabelMobile}"> <div class="pure-u-lg-{$ratioLabel} pure-u-{$ratioLabelMobile}">
<div class="form-label"> <div class="form-label">
<label for="apiEnabled"> <label for="enableApi">
<span class="label-name">{'Enable REST API'|t}</span><br> <span class="label-name">{'Enable REST API'|t}</span><br>
<span class="label-desc">{'Allow third party software to use Shaarli such as mobile application'|t}</span> <span class="label-desc">{'Allow third party software to use Shaarli such as mobile application'|t}</span>
</label> </label>
@ -194,7 +194,7 @@ <h2 class="window-title">{'Configure'|t}</h2>
</div> </div>
<div class="pure-u-lg-{$ratioInput} pure-u-{$ratioInputMobile}"> <div class="pure-u-lg-{$ratioInput} pure-u-{$ratioInputMobile}">
<div class="form-input"> <div class="form-input">
<input type="checkbox" name="apiEnabled" id="apiEnabled" <input type="checkbox" name="enableApi" id="enableApi"
{if="$api_enabled"}checked{/if}/> {if="$api_enabled"}checked{/if}/>
</div> </div>
</div> </div>

View file

@ -7,6 +7,8 @@
{$ratioLabel='1-4'} {$ratioLabel='1-4'}
{$ratioInput='3-4'} {$ratioInput='3-4'}
{$ratioLabelMobile='7-8'}
{$ratioInputMobile='1-8'}
<form method="POST" action="#" name="installform" id="installform"> <form method="POST" action="#" name="installform" id="installform">
<div class="pure-g"> <div class="pure-g">
@ -98,6 +100,22 @@ <h2 class="window-title">{'Install Shaarli'|t}</h2>
</div> </div>
</div> </div>
<div class="pure-g">
<div class="pure-u-lg-{$ratioLabel} pure-u-{$ratioLabelMobile}">
<div class="form-label">
<label for="enableApi">
<span class="label-name">{'Enable REST API'|t}</span><br>
<span class="label-desc">{'Allow third party software to use Shaarli such as mobile application'|t}</span>
</label>
</div>
</div>
<div class="pure-u-lg-{$ratioInput} pure-u-{$ratioInputMobile}">
<div class="form-input">
<input type="checkbox" name="enableApi" id="enableApi" checked />
</div>
</div>
</div>
<div class="center"> <div class="center">
<input type="submit" value="{'Install'|t}" name="Save"> <input type="submit" value="{'Install'|t}" name="Save">
</div> </div>

View file

@ -97,9 +97,9 @@
<tr> <tr>
<td valign="top"><b>Enable REST API</b></td> <td valign="top"><b>Enable REST API</b></td>
<td> <td>
<input type="checkbox" name="apiEnabled" id="apiEnabled" <input type="checkbox" name="enableApi" id="enableApi"
{if="$api_enabled"}checked{/if}/> {if="$api_enabled"}checked{/if}/>
<label for="apiEnabled">&nbsp;Allow third party software to use Shaarli such as mobile application.</label> <label for="enableApi">&nbsp;Allow third party software to use Shaarli such as mobile application.</label>
</td> </td>
</tr> </tr>
<tr> <tr>