Marius Cramer
2015-01-05 307a78622c6a6b9b1a5a1dc51a8d54cf95e8a3c2
Merge branch 'feature/backup_stats' into 'master'

add Websites/BackupStats

Add overview page for backups

See merge request !143
5 files added
1 files modified
164 ■■■■■ changed files
interface/web/sites/backup_stats.php 39 ●●●●● patch | view | raw | blame | history
interface/web/sites/lib/lang/de_backup_stats_list.lng 9 ●●●●● patch | view | raw | blame | history
interface/web/sites/lib/lang/en_backup_stats_list.lng 9 ●●●●● patch | view | raw | blame | history
interface/web/sites/lib/module.conf.php 7 ●●●●● patch | view | raw | blame | history
interface/web/sites/list/backup_stats.list.php 52 ●●●●● patch | view | raw | blame | history
interface/web/sites/templates/backup_stats_list.htm 48 ●●●●● patch | view | raw | blame | history
interface/web/sites/backup_stats.php
New file
@@ -0,0 +1,39 @@
<?php
require_once '../../lib/config.inc.php';
require_once '../../lib/app.inc.php';
$list_def_file = 'list/backup_stats.list.php';
/******************************************
* End Form configuration
******************************************/
//* Check permissions for module
$app->auth->check_module_permissions('sites');
$app->load('listform_actions','functions');
class list_action extends listform_actions {
    public function prepareDataRow($rec)
    {
        global $app;
        $rec = parent::prepareDataRow($rec);
        $rec['active'] = "<div id=\"ir-Yes\" class=\"swap\"><span>Yes</span></div>";
        if ($rec['backup_interval'] === 'none') {
            $rec['active']        = "<div class=\"swap\" id=\"ir-No\"><span>No</span></div>";
            $rec['backup_copies'] = 0;
        }
        $recBackup = $app->db->queryOneRecord('SELECT COUNT(backup_id) AS backup_count FROM web_backup WHERE parent_domain_id = ?', $rec['domain_id']);
        $rec['backup_copies_exists'] = $recBackup['backup_count'];
        return $rec;
    }
}
$list = new list_action;
$list->SQLExtWhere = "";
$list->onLoad();
interface/web/sites/lib/lang/de_backup_stats_list.lng
New file
@@ -0,0 +1,9 @@
<?php
$wb["list_head_txt"]       = 'Backup Statistiken';
$wb["database_name_txt"]   = '';
$wb['active_txt']          = 'Aktiv';
$wb['domain_txt']          = 'Domain';
$wb['backup_count_txt']    = 'Anz. Backups';
$wb['backup_server_txt']   = 'Server';
$wb['backup_interval_txt'] = 'Intervall / Anz.';
?>
interface/web/sites/lib/lang/en_backup_stats_list.lng
New file
@@ -0,0 +1,9 @@
<?php
$wb["list_head_txt"]       = 'Backup Stats';
$wb["database_name_txt"]   = '';
$wb['active_txt']          = 'Active';
$wb['domain_txt']          = 'Domain';
$wb['backup_count_txt']    = 'Backup count';
$wb['backup_server_txt']   = 'Server';
$wb['backup_interval_txt'] = 'Interval / cnt.';
?>
interface/web/sites/lib/module.conf.php
@@ -189,6 +189,13 @@
    'link'    => 'sites/database_quota_stats.php',
    'html_id' => 'databse_quota_stats');
$items[] = array (
    'title'   => 'Backup Stats',
    'target'  => 'content',
    'link'    => 'sites/backup_stats.php',
    'html_id' => 'backup_stats'
);
$module['nav'][] = array(   'title' => 'Statistics',
    'open'  => 1,
    'items' => $items);
interface/web/sites/list/backup_stats.list.php
New file
@@ -0,0 +1,52 @@
<?php
// Name of the list
$liste["name"]     = "backup_stats";
// Database table
$liste["table"]    = "web_domain";
// Index index field of the database table
$liste["table_idx"]   = "domain_id";
// Search Field Prefix
$liste["search_prefix"]  = "search_";
// Records per page
$liste["records_per_page"]  = "15";
// Script File of the list
$liste["file"]    = "backup_stats.php";
// Script file of the edit form
$liste["edit_file"]   = "backup_stats_edit.php";
// Paging Template
$liste["paging_tpl"]  = "templates/paging.tpl.htm";
// Enable auth
$liste["auth"]    = "yes";
// mark columns for php sorting (no real mySQL columns)
$liste["phpsort"] = array('used_sort', 'files');
/*****************************************************
* Suchfelder
*****************************************************/
$liste['item'][] = array (
       'field'    => 'server_id',
    'datatype' => 'INTEGER',
    'formtype' => 'SELECT',
    'op'       => '=',
    'prefix'   => '',
    'width'    => '',
    'value'    => '',
    'suffix'   => '',
    'datasource' => array (
          'type'        => 'SQL',
        'querystring' => 'SELECT a.server_id, a.server_name FROM server a, web_domain b WHERE (a.server_id = b.server_id) ORDER BY a.server_name',
        'keyfield'    => 'server_id',
        'valuefield'  => 'server_name'
    )
);
interface/web/sites/templates/backup_stats_list.htm
New file
@@ -0,0 +1,48 @@
<h2><tmpl_var name="list_head_txt"></h2>
<p><tmpl_var name="list_desc_txt"></p>
<div class="panel panel_list_backup_stats">
    <div class="pnl_listarea">
        <fieldset><legend><tmpl_var name="list_head_txt"></legend>
            <table class="list">
                <thead>
                    <tr class="caption">
                        <th class="tbl_col_active" scope="col">
                            <tmpl_var name="active_txt">
                        </th>
                        <th class="tbl_col_domain" scope="col">
                            <tmpl_var name="domain_txt">
                        </th>
                        <th class="tbl_col_server" scope="col">
                            <tmpl_var name="backup_server_txt">
                        </th>
                        <th class="tbl_col_interval" scope="col">
                            <tmpl_var name="backup_interval_txt">
                        </th>
                        <th class="tbl_col_backup_count" scope="col">
                            <tmpl_var name="backup_count_txt">
                        </th>
                    </tr>
                </thead>
                <tbody>
                    <tmpl_loop name="records">
                    <tr class="tbl_row_{tmpl_if name='__EVEN__'}even{tmpl_else}uneven{/tmpl_if}">
                        <td class="tbl_col_active"> <a href="#" onclick="loadContent('sites/web_<tmpl_if name='type' op='==' value='vhostsubdomain'>vhost_sub</tmpl_if><tmpl_if name='type' op='==' value='vhostalias'>vhost_alias</tmpl_if>domain_edit.php?id={tmpl_var name='id'}');">{tmpl_var name="active"}</a> </td>
                        <td class="tbl_col_domain"> <a href="#" onclick="loadContent('sites/web_<tmpl_if name='type' op='==' value='vhostsubdomain'>vhost_sub</tmpl_if><tmpl_if name='type' op='==' value='vhostalias'>vhost_alias</tmpl_if>domain_edit.php?id={tmpl_var name='id'}');">{tmpl_var name="domain"}</a> </td>
                        <td class="tbl_col_server"> <a href="#" onclick="loadContent('sites/web_<tmpl_if name='type' op='==' value='vhostsubdomain'>vhost_sub</tmpl_if><tmpl_if name='type' op='==' value='vhostalias'>vhost_alias</tmpl_if>domain_edit.php?id={tmpl_var name='id'}');">{tmpl_var name="server_id"}</a> </td>
                        <td class="tbl_col_interval"> <a href="#" onclick="loadContent('sites/web_<tmpl_if name='type' op='==' value='vhostsubdomain'>vhost_sub</tmpl_if><tmpl_if name='type' op='==' value='vhostalias'>vhost_alias</tmpl_if>domain_edit.php?id={tmpl_var name='id'}');">{tmpl_var name="backup_interval"}</a> /  <a href="#" onclick="loadContent('sites/web_<tmpl_if name='type' op='==' value='vhostsubdomain'>vhost_sub</tmpl_if><tmpl_if name='type' op='==' value='vhostalias'>vhost_alias</tmpl_if>domain_edit.php?id={tmpl_var name='id'}');">{tmpl_var name="backup_copies"}</a> </td>
                        <td class="tbl_col_backup_count"> <a href="#" onclick="loadContent('sites/web_<tmpl_if name='type' op='==' value='vhostsubdomain'>vhost_sub</tmpl_if><tmpl_if name='type' op='==' value='vhostalias'>vhost_alias</tmpl_if>domain_edit.php?id={tmpl_var name='id'}');">{tmpl_var name="backup_copies_exists"}</a> </td>
                    </tr>
                    </tmpl_loop>
                </tbody>
                <tfoot>
                    <tr>
                        <td class="tbl_footer tbl_paging" colspan="5">
                            <tmpl_var name="paging">
                        </td>
                    </tr>
                </tfoot>
            </table>
        </fieldset>
    </div>
</div>