mcramer
2012-10-30 a1c925f9c924f55f9dc39f840a9e23a62d4b1af1
Implemented:
- Show status messages to clients as long as the datalog is not processed (changes pending...)
- missing:
- template code in templates other than database list
- language entries other than web_database, web_domain, web_database_user

6 files modified
70 ■■■■■ changed files
interface/lib/app.inc.php 6 ●●●●● patch | view | raw | blame | history
interface/lib/classes/db_mysql.inc.php 22 ●●●●● patch | view | raw | blame | history
interface/lib/lang/de.lng 13 ●●●●● patch | view | raw | blame | history
interface/lib/lang/en.lng 12 ●●●●● patch | view | raw | blame | history
interface/web/sites/templates/database_list.htm 16 ●●●●● patch | view | raw | blame | history
interface/web/themes/default/css/styles.css 1 ●●●● patch | view | raw | blame | history
interface/lib/app.inc.php
@@ -213,6 +213,12 @@
        $this->tpl->setVar('app_title', $this->_conf['app_title']);
        if(isset($_SESSION['s']['user'])) {
            $this->tpl->setVar('app_version', $this->_conf['app_version']);
            // get pending datalog changes
            $datalog = $this->db->datalogStatus();
            $this->tpl->setVar('datalog_changes_txt', $this->lng('datalog_changes_txt'));
            $this->tpl->setVar('datalog_changes_end_txt', $this->lng('datalog_changes_end_txt'));
            $this->tpl->setVar('datalog_changes_count', $datalog['count']);
            $this->tpl->setLoop('datalog_changes', $datalog['entries']);
        } else {
            $this->tpl->setVar('app_version', '');
        }
interface/lib/classes/db_mysql.inc.php
@@ -317,6 +317,28 @@
      return true;
    }
    //* get the current datalog status for the specified login (or currently logged in user)
    public function datalogStatus($login = '') {
        global $app;
        $return = array('count' => 0, 'entries' => array());
        if($_SESSION['s']['user']['typ'] == 'admin') return $return; // these information should not be displayed to admin users
        if($login == '' && isset($_SESSION['s']['user'])) {
            $login = $_SESSION['s']['user']['username'];
        }
        $result = $this->queryAllRecords("SELECT COUNT( * ) AS cnt, sys_datalog.action, sys_datalog.dbtable FROM sys_datalog, server WHERE server.server_id = sys_datalog.server_id AND sys_datalog.user = '" . $this->quote($login) . "' AND sys_datalog.datalog_id > server.updated GROUP BY sys_datalog.dbtable, sys_datalog.action");
        foreach($result as $row) {
            if(!$row['dbtable']) continue;
            $return['entries'][] = array('table' => $row['dbtable'], 'action' => $row['action'], 'count' => $row['cnt'], 'text' => $app->lng('datalog_status_' . $row['action'] . '_' . $row['dbtable']));
            $return['count'] += 1;
        }
        unset($result);
        return $return;
    }
    public function freeResult($query) 
interface/lib/lang/de.lng
@@ -80,5 +80,18 @@
$wb['globalsearch_suggestions_text_txt'] = "Vorschläge";
$wb['global_tabchange_warning_txt'] = "Die Eingaben in diesem Tab werden gespeichert, wenn Sie OK klicken, bei Abbrechen werden die Änderungen verworfen.";
$wb['global_tabchange_discard_txt'] = "Achtung, Sie haben ungespeicherte Änderungen in diesem Tab. Wenn Sie fortfahren werden die Änderungen verworfen.";
$wb['datalog_changes_txt'] = 'Folgende Änderungen wurden noch nicht auf alle Server übernommen:';
$wb['datalog_changes_end_txt'] = 'Die Übernahme der Änderungen kann bis zu 1 Minute in Anspruch nehmen.';
$wb['datalog_status_i_web_database'] = 'Neue Datenbank anlegen';
$wb['datalog_status_u_web_database'] = 'Datenbank ändern';
$wb['datalog_status_d_web_database'] = 'Datenbank löschen';
$wb['datalog_status_i_web_database_user'] = 'Datenbank-Benutzer für Datenbank anlegen';
$wb['datalog_status_u_web_database_user'] = 'Datenbank-Benutzer ändern';
$wb['datalog_status_d_web_database_user'] = 'Datenbank-Benutzer löschen';
$wb['datalog_status_i_web_domain'] = 'Neue Webseite anlegen';
$wb['datalog_status_u_web_domain'] = 'Webseiten-Einstellungen ändern';
$wb['datalog_status_d_web_domain'] = 'Webseite löschen';
?>
interface/lib/lang/en.lng
@@ -80,4 +80,16 @@
$wb['globalsearch_suggestions_text_txt'] = "Suggestions";
$wb['global_tabchange_warning_txt'] = 'Changed data in this tab will be changed if you press OK. On cancel they will be discarded.';
$wb['global_tabchange_discard_txt'] = 'You have unsaved changes in this tab. Changes will be discarded if you continue.';
$wb['datalog_changes_txt'] = 'The following changes are not yet populated to all servers:';
$wb['datalog_changes_end_txt'] = 'Storing updates can take up to one minute. Please be patient.';
$wb['datalog_status_i_web_database'] = 'Create new database';
$wb['datalog_status_u_web_database'] = 'Update database';
$wb['datalog_status_d_web_database'] = 'Delete database';
$wb['datalog_status_i_web_database_user'] = 'Create database user for database';
$wb['datalog_status_u_web_database_user'] = 'Update database user';
$wb['datalog_status_d_web_database_user'] = 'Delete database user';
$wb['datalog_status_i_web_domain'] = 'Create new website';
$wb['datalog_status_u_web_domain'] = 'Update website settings';
$wb['datalog_status_d_web_domain'] = 'Delete website';
?>
interface/web/sites/templates/database_list.htm
@@ -4,6 +4,22 @@
<div class="panel panel_list_database">
    <div class="pnl_toolsarea">
        <tmpl_if name='datalog_changes_count' op='>' value='0'>
        <div>
            <div class="systemmonitor-state state-info">
                <div class="status"></div>
                <div class="statusMsg">
                    {tmpl_var name="datalog_changes_txt"}
                    <ul>
                    <tmpl_loop name="datalog_changes">
                        <li><strong>{tmpl_var name="text"}:</strong> {tmpl_var name="count"}</li>
                    </tmpl_loop>
                    </ul>
                    {tmpl_var name="datalog_changes_end_txt"}
                </div>
            </div><br />
        </div>
        </tmpl_if>
        <fieldset><legend>{tmpl_var name="toolsarea_head_txt"}</legend>
            <div class="buttons">
                <button class="button iconstxt icoAdd" type="button" onclick="loadContent('sites/database_edit.php');">
interface/web/themes/default/css/styles.css
@@ -1787,3 +1787,4 @@
.ui-combobox-toggle { position: absolute !important; top: 0; bottom: 0; margin-left: -1px; padding: 1px !important; background: none repeat scroll 0 0 #FFFFFF !important; border: 1px solid #DFDFDF !important;}
.ui-combobox-input { background: none repeat scroll 0 0 #FFFFFF !important; border: 1px solid #DFDFDF !important; padding: 1px; font-weight: normal !important; }
.panel_install_package .ui-combobox { float: left; }
.clear-float { clear: both; }