Move system info to about page

This commit is contained in:
Dmitriy Simushev 2014-12-23 12:51:40 +00:00
parent 9bfd6a29fb
commit 8552881f7d
9 changed files with 63 additions and 150 deletions

View File

@ -735,12 +735,6 @@ update_run:
_access_check: Mibew\AccessControl\Check\PermissionsCheck
_access_permissions: [CAN_ADMINISTRATE]
updates:
path: /operator/updates
defaults:
_controller: Mibew\Controller\UpdatesController::indexAction
_access_check: Mibew\AccessControl\Check\LoggedInCheck
## Users (visitors avaiting page)
users:
path: /operator/users

View File

@ -17,19 +17,6 @@
*/
(function ($) {
var loadNews = function () {
if (typeof (window.mibewNews) == "undefined" || typeof (window.mibewNews.length) == "undefined") {
return;
}
var str = "<div>";
for (var i = 0; i < window.mibewNews.length; i++) {
str += "<div class=\"news-title\"><a hre" + "f=\"" + window.mibewNews[i].link + "\">" + window.mibewNews[i].title + "</a>, <span class=\"small\">" + window.mibewNews[i].date + "</span></div>";
str += "<div class=\"news-text\">" + window.mibewNews[i].message + "</div>";
}
$("#news").html(str + "</div>");
}
var loadVersion = function () {
if (typeof (window.mibewLatest) == "undefined" || typeof (window.mibewLatest.version) == "undefined") {
return;
@ -49,7 +36,6 @@
}
$(function () {
loadNews();
loadVersion();
});
})(jQuery);

View File

@ -19,6 +19,7 @@
namespace Mibew\Controller;
use Mibew\Asset\AssetManagerInterface;
use Symfony\Component\HttpFoundation\Request;
/**
@ -36,12 +37,53 @@ class AboutController extends AbstractController
{
$page = array_merge(
array(
'localizations' => get_available_locales(),
'phpVersion' => phpversion(),
'extensions' => $this->getExtensionsInfo(),
'version' => MIBEW_VERSION,
'title' => getlocal('About'),
'menuid' => 'about',
),
prepare_menu($this->getOperator())
);
$this->getAssetManager()->attachJs(
'https://mibew.org/latestMibew.js',
AssetManagerInterface::ABSOLUTE_URL
);
$this->getAssetManager()->attachJs('js/compiled/about.js');
return $this->render('about', $page);
}
/**
* Builds info about required extensions.
*
* @return array Associative array of extensions info. Its keys are
* extensions names and the values are associative arrays with the following
* keys:
* - "loaded": boolean, indicates it the extension was loaded or not.
* - "version": string, extension version or boolean false if the version
* cannot be obtained.
*/
protected function getExtensionsInfo()
{
$required_extensions = array('PDO', 'pdo_mysql', 'gd', 'iconv');
$info = array();
foreach ($required_extensions as $ext) {
if (!extension_loaded($ext)) {
$info[$ext] = array(
'loaded' => false,
'version' => false,
);
} else {
$info[$ext] = array(
'loaded' => true,
'version' => phpversion($ext),
);
}
}
return $info;
}
}

View File

@ -1,69 +0,0 @@
<?php
/*
* This file is a part of Mibew Messenger.
*
* Copyright 2005-2014 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
namespace Mibew\Controller;
use Mibew\Asset\AssetManagerInterface;
use Symfony\Component\HttpFoundation\Request;
/**
* Build updates info page.
*/
class UpdatesController extends AbstractController
{
/**
* Generate a page with updates list.
*
* @param Request $request
* @return string Rendered page content
*/
public function indexAction(Request $request)
{
$operator = $this->getOperator();
$default_extensions = array('mysql', 'gd', 'iconv');
$page = array(
'localizations' => get_available_locales(),
'phpVersion' => phpversion(),
'version' => MIBEW_VERSION,
'title' => getlocal("Updates"),
'menuid' => "updates",
'errors' => array(),
);
foreach ($default_extensions as $ext) {
if (!extension_loaded($ext)) {
$page['phpVersion'] .= " $ext/absent";
} else {
$ver = phpversion($ext);
$page['phpVersion'] .= $ver ? " $ext/$ver" : " $ext";
}
}
$page = array_merge($page, prepare_menu($operator));
$this->getAssetManager()->attachJs(
'https://mibew.org/latestMibew.js',
AssetManagerInterface::ABSOLUTE_URL
);
$this->getAssetManager()->attachJs('js/compiled/update.js');
return $this->render('updates', $page);
}
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.6 KiB

View File

@ -36,7 +36,6 @@
<li{{#ifEqual menuid "styles"}} class="active"{{/ifEqual}}><a href="{{route "style_preview" type="page"}}">{{l10n "Styles"}}</a></li>
<li{{#ifEqual menuid "translation"}} class="active"{{/ifEqual}}><a href="{{route "translations"}}">{{l10n "Localize"}}</a></li>
<li{{#ifEqual menuid "mail_templates"}} class="active"{{/ifEqual}}><a href="{{route "mail_templates"}}">{{l10n "Mail templates"}}</a></li>
<li{{#ifEqual menuid "updates"}} class="active"{{/ifEqual}}><a href="{{route "updates"}}">{{l10n "Updates"}}</a></li>
<li{{#ifEqual menuid "about"}} class="active"{{/ifEqual}}><a href="{{route "about"}}">{{l10n "About"}}</a></li>
{{/if}}
{{#if currentopid}}

View File

@ -75,6 +75,27 @@
<li>Traditional Chinese Dawei; X Chen</li>
<li>Ukrainian azzepis</li>
</ul>
<h2>{{l10n "System information"}}</h2>
<h3>{{l10n "You are using:"}}</h3>
<div id="current-version">{{version}}</div>
<br/>
<h3>{{l10n "Latest version:"}}</h3>
<div id="latest-version">{{l10n "unknown"}}</div>
<br/>
<h3>{{l10n "Installed localizations:"}}</h3>
{{#each localizations}}
{{this}}
{{/each}}
<br/><br/>
<h3>{{l10n "Environment:"}}</h3>
PHP {{phpVersion}} {{#each extensions}}{{@key}}{{#if loaded}}{{#if version}}/{{version}}{{/if}}{{else}}/absent{{/if}} {{/each}}
</div>
<div class="form-footer">

View File

@ -140,18 +140,6 @@
</div>
{{/if}}
{{#if showadmin}}
<div class="dashboard-item">
<div class="dashboard-item-content">
<img src="{{asset "@CurrentStyle/images/dash/updates.png"}}" alt=""/>
<a href="{{route "updates"}}">
{{l10n "Updates"}}
</a>
{{l10n "Check for news and updates."}}
</div>
</div>
{{/if}}
<div class="dashboard-item">
<div class="dashboard-item-content">
<img src="{{asset "@CurrentStyle/images/dash/information.png"}}" alt=""/>

View File

@ -1,48 +0,0 @@
{{#extends "_layout"}}
{{#override "menu"}}{{> _menu}}{{/override}}
{{#override "content"}}
{{l10n "Messenger updates."}}
<br />
<br />
<div>
<div class="form-wrapper">
<div class="form-header">
<div class="form-header-inwards"></div>
</div>
<div class="form-inwards">
{{l10n "News:"}}<br/>
<div id="news"></div>
{{l10n "You are using:"}}<br/>
<div id="current-version">{{version}}</div>
<br/>
{{l10n "Latest version:"}}
<div id="latest-version"></div>
<br/>
{{l10n "Installed localizations:"}}<br/>
{{#each localizations}}
{{this}}
{{/each}}
<br/><br/>
{{l10n "Environment:"}}<br/>
PHP {{phpVersion}}
</div>
<div class="form-footer">
<div class="form-footer-inwards"></div>
</div>
</div>
</div>
{{/override}}
{{/extends}}