Merge pull request #2 from Kloadut/master

[enh] Initialize a form
This commit is contained in:
Julien Vaubourg 2014-11-08 16:11:15 +01:00
commit 4b244633da
7 changed files with 60 additions and 13 deletions

BIN
sources/.controller.php.swp Normal file

Binary file not shown.

View File

@ -1,15 +1,21 @@
<?php
dispatch('/', 'hello_world');
function hello_world() {
flash('success', T_('This is a notification'));
set('title', T_('Hello World !'));
return render('homepage.html.php');
}
dispatch('/', function() {
set('title', T_('Configure your VPN client'));
return render('settings.html.php');
});
dispatch('/lang/:locale', 'changeLocale');
function changeLocale ($locale = 'en') {
dispatch_put('/settings', function() {
$success_message = "";
foreach ($_POST as $key => $value) {
$success_message = $success_message.T_("Parameter ").$key.": ".$value."<br>";
}
flash('success', $success_message);
redirect_to('/');
});
dispatch('/lang/:locale', function($locale = 'en') {
switch ($locale) {
case 'fr':
$_SESSION['locale'] = 'fr';
@ -22,5 +28,5 @@ function changeLocale ($locale = 'en') {
redirect_to($_GET['redirect_to']);
else
redirect_to('/');
}
});

Binary file not shown.

Binary file not shown.

View File

@ -1,3 +0,0 @@
<div class="hero">
<h1>Hello world !</h1>
</div>

View File

@ -6,7 +6,7 @@
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title>YunoHost <? echo (isset($title)) ? "| ".$title : "" ?></title>
<title>VPN Client <? echo (isset($title)) ? "| ".$title : "" ?></title>
<meta name="viewport" content="width=device-width">
<link media="all" type="text/css" href="<?= PUBLIC_DIR ?>/bootstrap/css/bootstrap.min.css" rel="stylesheet">
<link media="all" type="text/css" href="<?= PUBLIC_DIR ?>/bootstrap/css/bootstrap-theme.min.css" rel="stylesheet">

View File

@ -0,0 +1,44 @@
<h2><?= T_("Configure your VPN client") ?></h2>
<hr>
<div class="row">
<div class="col-sm-offset-2 col-sm-8">
<form method="post" action="settings" class="form-horizontal" role="form">
<input type="hidden" name="_method" value="put" />
<div class="form-group">
<label for="host" class="col-sm-3 control-label"><?= T_('Host') ?></label>
<div class="col-sm-9">
<input type="text" class="form-control" name="host" id="host" placeholder="vpn.neutrinet.be">
</div>
</div>
<div class="form-group">
<label for="password" class="col-sm-3 control-label"><?= T_('Password') ?></label>
<div class="col-sm-9">
<input type="password" class="form-control" name="password" id="password" placeholder="Password">
</div>
</div>
<div class="form-group">
<label for="privatekey" class="col-sm-3 control-label"><?= T_('Private key') ?></label>
<div class="col-sm-9">
<textarea rows="7" class="form-control" name="privatekey" id="privatekey">
-----BEGIN PRIVATE KEY-----
-----END PRIVATE KEY-----
</textarea>
</div>
</div>
<div class="form-group">
<div class="col-xs-offset-3 col-sm-10">
<div class="checkbox">
<label>
<input type="checkbox" name="usetcp" value="yes"> <?= T_('Use TCP') ?>
</label>
</div>
</div>
</div>
<div class="form-group">
<div class="col-xs-offset-3 col-sm-9">
<button type="submit" class="btn btn-default"><?= T_('Save settings') ?></button>
</div>
</div>
</form>
</div>
</div>