Add a database page

This commit is contained in:
Frédéric Guillot 2014-11-18 19:16:14 -05:00
parent e9685cf6d5
commit fa5bda49db
16 changed files with 56 additions and 24 deletions

View File

@ -664,6 +664,7 @@ iframe {
#login form {
border: none;
margin-bottom: 45px;
}
/* desktop design */

View File

@ -22,7 +22,7 @@ Router\get_action('new-db', function() {
)));
}
Response\redirect('?action=about');
Response\redirect('?action=database');
});
// Create a new database
@ -43,7 +43,7 @@ Router\post_action('new-db', function() {
Session\flash_error(t('Unable to create the new database.'));
}
Response\redirect('?action=about');
Response\redirect('?action=database');
}
Response\html(Template\layout('new_db', array(
@ -54,7 +54,7 @@ Router\post_action('new-db', function() {
)));
}
Response\redirect('?action=about');
Response\redirect('?action=database');
});
// Comfirmation box before auto-update
@ -99,7 +99,7 @@ Router\get_action('optimize-db', function() {
Database::get('db')->getConnection()->exec('VACUUM');
}
Response\redirect('?action=about');
Response\redirect('?action=database');
});
// Download the compressed database
@ -181,12 +181,23 @@ Router\get_action('about', function() {
Response\html(Template\layout('about', array(
'csrf' => Model\Config\generate_csrf(),
'config' => Model\Config\get_all(),
'db_size' => filesize(\Model\Database\get_path()),
'menu' => 'config',
'title' => t('About')
)));
});
// Display database page
Router\get_action('database', function() {
Response\html(Template\layout('database', array(
'csrf' => Model\Config\generate_csrf(),
'config' => Model\Config\get_all(),
'db_size' => filesize(\Model\Database\get_path()),
'menu' => 'config',
'title' => t('Database')
)));
});
// Display API page
Router\get_action('api', function() {

View File

@ -7,11 +7,10 @@ Each user have his own Sqlite database and people can choose which database they
To create a new database:
1. Go to the page **preferences > about**
2. Scroll-down to the database section
3. Click on the link "Add a new database"
4. Fill the form (db name, the new username and password) and save
5. If you logout, on the login page you can choose the database you want to use
1. Go to the page **preferences > database**
2. Click on the link "Add a new database"
3. Fill the form (db name, the new username and password) and save
4. If you logout, on the login page you can choose the database you want to use
If you use the cronjob, to select the database, use the parameter `--database` like that:

View File

@ -234,4 +234,5 @@ return array(
// 'about' => '',
// 'Link:' => '',
// 'This action will update Miniflux with the last development version, are you sure?' => '',
// 'database' => '',
);

View File

@ -234,4 +234,5 @@ return array(
// 'about' => '',
// 'Link:' => '',
// 'This action will update Miniflux with the last development version, are you sure?' => '',
// 'database' => '',
);

View File

@ -234,4 +234,5 @@ return array(
// 'about' => '',
// 'Link:' => '',
// 'This action will update Miniflux with the last development version, are you sure?' => '',
// 'database' => '',
);

View File

@ -234,4 +234,5 @@ return array(
'about' => 'a propos',
'Link:' => 'Lien :',
'This action will update Miniflux with the last development version, are you sure?' => 'Cette action va mettre à jour Miniflux avec la dernière version en cours de développement, êtes-vous certain ?',
'database' => 'base de données',
);

View File

@ -234,4 +234,5 @@ return array(
// 'about' => '',
// 'Link:' => '',
// 'This action will update Miniflux with the last development version, are you sure?' => '',
// 'database' => '',
);

View File

@ -234,4 +234,5 @@ return array(
// 'about' => '',
// 'Link:' => '',
// 'This action will update Miniflux with the last development version, are you sure?' => '',
// 'database' => '',
);

View File

@ -234,4 +234,5 @@ return array(
// 'about' => '',
// 'Link:' => '',
// 'This action will update Miniflux with the last development version, are you sure?' => '',
// 'database' => '',
);

View File

@ -3,6 +3,7 @@
<ul>
<li><a href="?action=config"><?= t('settings') ?></a></li>
<li><a href="?action=help"><?= t('help') ?></a></li>
<li><a href="?action=database"><?= t('database') ?></a></li>
<li><a href="?action=api"><?= t('api') ?></a></li>
</ul>
</div>
@ -18,19 +19,6 @@
</li>
</ul>
</div>
<div class="alert alert-normal">
<h3><?= t('Database') ?></h3>
<ul>
<li><?= t('Database size:') ?> <strong><?= Helper\format_bytes($db_size) ?></strong></li>
<li><a href="?action=optimize-db&amp;csrf=<?= $csrf ?>"><?= t('Optimize the database') ?></a> <?= t('(VACUUM command)') ?></li>
<li><a href="?action=download-db&amp;csrf=<?= $csrf ?>"><?= t('Download the entire database') ?></a> <?= t('(Gzip compressed Sqlite file)') ?></li>
<?php if (ENABLE_MULTIPLE_DB): ?>
<li>
<a href="?action=new-db"><?= t('Add a new database (new user)') ?></a>
</li>
<?php endif ?>
</ul>
</div>
<div class="alert alert-normal">
<h3><?= t('About') ?></h3>
<ul>

View File

@ -4,6 +4,7 @@
<li><a href="?action=config"><?= t('settings') ?></a></li>
<li><a href="?action=about"><?= t('about') ?></a></li>
<li><a href="?action=help"><?= t('help') ?></a></li>
<li><a href="?action=database"><?= t('database') ?></a></li>
</ul>
</div>
<section>

View File

@ -3,6 +3,7 @@
<ul>
<li><a href="?action=about"><?= t('about') ?></a></li>
<li><a href="?action=help"><?= t('help') ?></a></li>
<li><a href="?action=database"><?= t('database') ?></a></li>
<li><a href="?action=api"><?= t('api') ?></a></li>
</ul>
</div>

23
templates/database.php Normal file
View File

@ -0,0 +1,23 @@
<div class="page-header">
<h2><?= t('Database') ?></h2>
<ul>
<li><a href="?action=about"><?= t('about') ?></a></li>
<li><a href="?action=config"><?= t('settings') ?></a></li>
<li><a href="?action=help"><?= t('help') ?></a></li>
<li><a href="?action=api"><?= t('api') ?></a></li>
</ul>
</div>
<section>
<div class="alert alert-normal">
<ul>
<li><?= t('Database size:') ?> <strong><?= Helper\format_bytes($db_size) ?></strong></li>
<li><a href="?action=optimize-db&amp;csrf=<?= $csrf ?>"><?= t('Optimize the database') ?></a> <?= t('(VACUUM command)') ?></li>
<li><a href="?action=download-db&amp;csrf=<?= $csrf ?>"><?= t('Download the entire database') ?></a> <?= t('(Gzip compressed Sqlite file)') ?></li>
<?php if (ENABLE_MULTIPLE_DB): ?>
<li>
<a href="?action=new-db"><?= t('Add a new database (new user)') ?></a>
</li>
<?php endif ?>
</ul>
</div>
</section>

View File

@ -3,6 +3,7 @@
<ul>
<li><a href="?action=config"><?= t('settings') ?></a></li>
<li><a href="?action=about"><?= t('about') ?></a></li>
<li><a href="?action=database"><?= t('database') ?></a></li>
<li><a href="?action=api"><?= t('api') ?></a></li>
</ul>
</div>

View File

@ -37,7 +37,7 @@
</form>
<?php if (ENABLE_MULTIPLE_DB && count($databases) > 1): ?>
<div class="alert alert-normal">
<div>
<h3><?= t('Select another database') ?></h3>
<ul>
<?php foreach ($databases as $filename => $dbname): ?>