issue #117: Replacing Template service with Twig and implementing Twig in all modules/utils

This commit is contained in:
Pepijn Over 2014-08-01 16:40:20 +02:00
parent 475bad8cec
commit 945a09cfc3
75 changed files with 1538 additions and 2069 deletions

View File

@ -12,6 +12,7 @@
"php": ">=5.3.7",
"phpmailer/phpmailer": "5.2.6",
"symfony/http-foundation": "2.4.*",
"php-pushover/php-pushover": "dev-master"
"php-pushover/php-pushover": "dev-master",
"twig/twig": "1.*"
}
}

59
composer.lock generated
View File

@ -3,7 +3,7 @@
"This file locks the dependencies of your project to a known state",
"Read more about it at http://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file"
],
"hash": "6a941e5369d421e16d869151569bc5c7",
"hash": "1d763e23381a086e18f83644bd89f16c",
"packages": [
{
"name": "php-pushover/php-pushover",
@ -138,6 +138,63 @@
"description": "Symfony HttpFoundation Component",
"homepage": "http://symfony.com",
"time": "2014-07-15 14:07:10"
},
{
"name": "twig/twig",
"version": "v1.16.0",
"source": {
"type": "git",
"url": "https://github.com/fabpot/Twig.git",
"reference": "8ce37115802e257a984a82d38254884085060024"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/fabpot/Twig/zipball/8ce37115802e257a984a82d38254884085060024",
"reference": "8ce37115802e257a984a82d38254884085060024",
"shasum": ""
},
"require": {
"php": ">=5.2.4"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.16-dev"
}
},
"autoload": {
"psr-0": {
"Twig_": "lib/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"BSD-3-Clause"
],
"authors": [
{
"name": "Fabien Potencier",
"email": "fabien@symfony.com",
"homepage": "http://fabien.potencier.org",
"role": "Lead Developer"
},
{
"name": "Armin Ronacher",
"email": "armin.ronacher@active-4.com",
"role": "Project Founder"
},
{
"name": "Twig Team",
"homepage": "https://github.com/fabpot/Twig/graphs/contributors",
"role": "Contributors"
}
],
"description": "Twig, the flexible, fast, and secure template language for PHP",
"homepage": "http://twig.sensiolabs.org",
"keywords": [
"templating"
],
"time": "2014-07-05 12:19:05"
}
],
"packages-dev": [

View File

@ -9,32 +9,32 @@ Credits
The following people have contributed to the development of PHP Server Monitor:
* Pepijn Over <https://github.com/dopeh/>
* Pepijn Over - https://github.com/dopeh
* Creator and project maintainer
* Jérôme Cabanis <https://github.com/Abawell>
* Jérôme Cabanis - https://github.com/Abawell
* History graphs
* Date localization
* Mobile compatibility
* Various fixes and improvements
* Perri Vardy-Mason <https://github.com/VeoPVM>
* Perri Vardy-Mason - https://github.com/VeoPVM
* Textmarketer SMS gateway
* Various fixes and improvements
* Luiz Alberto S. Ribeiro <https://github.com/madeinnordeste>
* Luiz Alberto S. Ribeiro - https://github.com/madeinnordeste
* Bootstrap implementation
* Portuguese Brazilian translation
* Michael Greenhill <https://github.com/doctorjbeam>
* Michael Greenhill - https://github.com/doctorjbeam
* Status page
* Andreas Ek <https://github.com/EkAndreas>
* Andreas Ek - https://github.com/EkAndreas
* Mosms SMS gateway
@ -42,23 +42,23 @@ The following people have contributed to the development of PHP Server Monitor:
* Website pattern / regular expression search
* nerdalertdk <https://github.com/nerdalertdk>
* nerdalertdk - https://github.com/nerdalertdk
* Smsit SMS gateway
* Victor Macko <https://github.com/victormacko>
* Victor Macko - https://github.com/victormacko
* SMSGlobal SMS gateway
* Julien Lebouteiller <https://github.com/Halvra>
* Julien Lebouteiller - https://github.com/Halvra
* Custom time-out per server
* Mathias Lange <https://github.com/remmedia>
* Mathias Lange - https://github.com/remmedia
* Pushover.net support
* Alexander Moore <http://www.famfamfam.com/>
* Alexander Moore - http://www.famfamfam.com
* Icon
@ -69,11 +69,11 @@ The following people have contributed to the translation of PHP Server Monitor:
* Chinese
* manhere <https://github.com/manhere>
* manhere - https://github.com/manhere
* Bulgarian
* Plamen Vasilev <https://github.com/PVasileff>
* Plamen Vasilev - https://github.com/PVasileff
* Danish
@ -102,11 +102,11 @@ The following people have contributed to the translation of PHP Server Monitor:
* Spanish
* Klemens Häckel <http://clickdimension.wordpress.com/>
* Klemens Häckel - http://clickdimension.wordpress.com
* Russian
* Roman Beylin <https://github.com/roman-beylin>
* Roman Beylin - https://github.com/roman-beylin
Vendors
@ -118,4 +118,5 @@ The following libraries are being used by PHP Server Monitor:
* Twitter Bootstrap - http://getbootstrap.com
* Bootstrap Multiselect - https://github.com/davidstutz/bootstrap-multiselect
* PHP Mailer - https://github.com/PHPMailer/PHPMailer
* php-pushover - https://github.com/kryap/php-pushover
* php-pushover - https://github.com/kryap/php-pushover
* Twig - http://twig.sensiolabs.org

View File

@ -47,7 +47,10 @@ if(file_exists($path_conf)) {
include_once $path_conf;
}
// check for a debug var
if(defined('PSM_DEBUG') && PSM_DEBUG) {
if(!defined('PSM_DEBUG')) {
define('PSM_DEBUG', false);
}
if(PSM_DEBUG) {
error_reporting(E_ALL);
ini_set('display_erors', 1);
} else {

View File

@ -101,3 +101,9 @@ define('PSM_CRON_TIMEOUT', 600);
* Default timeout in seconds for curl requests (can be overwritten per-server).
*/
define('PSM_CURL_TIMEOUT', 10);
/**
* Name of the default theme.
*/
define('PSM_THEME', 'default');

View File

@ -200,7 +200,7 @@ $sm_lang = array(
'pushover_description' => 'Pushover is a service that makes it easy to get real-time notifications. See <a href="https://pushover.net/">their website</a> for more info.',
'pushover_api_token' => 'Pushover App API Token',
'pushover_api_token_description' => 'Before you can use Pushover, you need to register an App at their website and enter the App API Token here.',
'alert_type' => 'Изберете кога желаете да получавате известия<br/>',
'alert_type' => 'Изберете кога желаете да получавате известия',
'alert_type_description' => '<b>Промяна на сатуса:</b><br>'.
'Ще получавате известие когато има промяна със връзката на даден някой от описаните сървър или сайт. От Онлайн -> Офлайн и от Офлайн -> Онлайн.<br/>'.
'<br/><b>Офлайн</b><br>'.

View File

@ -200,7 +200,7 @@ $sm_lang = array(
'pushover_description' => 'Pushover is a service that makes it easy to get real-time notifications. See <a href="https://pushover.net/">their website</a> for more info.',
'pushover_api_token' => 'Pushover App API Token',
'pushover_api_token_description' => 'Before you can use Pushover, you need to register an App at their website and enter the App API Token here.',
'alert_type' => 'Vælg hvornår du vil modtage besked.<br/>',
'alert_type' => 'Vælg hvornår du vil modtage besked',
'alert_type_description' => '<b>Status ændring:</b> '.
'Du vil modtage en notifcation når en server har en ændring i status. Fra online -> offline eller offline -> online.<br/>'.
'<br /><b>Offline:</b> '.

View File

@ -200,7 +200,7 @@ $sm_lang = array(
'pushover_description' => 'Pushover is a service that makes it easy to get real-time notifications. See <a href="https://pushover.net/">their website</a> for more info.',
'pushover_api_token' => 'Pushover App API Token',
'pushover_api_token_description' => 'Before you can use Pushover, you need to register an App at their website and enter the App API Token here.',
'alert_type' => 'Wann m&ouml;chten Sie benachrichtig werden?<br/>',
'alert_type' => 'Wann m&ouml;chten Sie benachrichtig werden?',
'alert_type_description' => '<b>Status ge&auml;ndert:</b> '.
'... wenn sich der Status &auml;ndert<br/>'.
'z.B. online -> offline oder offline -> online.<br/>'.

View File

@ -200,7 +200,7 @@ $sm_lang = array(
'pushover_description' => 'Pushover is a service that makes it easy to get real-time notifications. See <a href="https://pushover.net/">their website</a> for more info.',
'pushover_api_token' => 'Pushover App API Token',
'pushover_api_token_description' => 'Before you can use Pushover, you need to register an App at their website and enter the App API Token here.',
'alert_type' => 'Select when you\'d like to be notified.<br/>',
'alert_type' => 'Select when you\'d like to be notified.',
'alert_type_description' => '<b>Status change:</b> '.
'You will receive a notifcation when a server has a change in status. So from online -> offline or offline -> online.<br/>'.
'<br /><b>Offline:</b> '.

View File

@ -200,7 +200,7 @@ $sm_lang = array(
'pushover_description' => 'Pushover is a service that makes it easy to get real-time notifications. See <a href="https://pushover.net/">their website</a> for more info.',
'pushover_api_token' => 'Pushover App API Token',
'pushover_api_token_description' => 'Before you can use Pushover, you need to register an App at their website and enter the App API Token here.',
'alert_type' => 'Cuando desea recibir notificaciones ?<br/>',
'alert_type' => 'Cuando desea recibir notificaciones ?',
'alert_type_description' => '<b>... Al cambiar el estado:</b> '.
'p.ej. online -> offline o offline -> online.<br/>'.
'<br /><b>Offline:</b> '.

View File

@ -200,7 +200,7 @@ $sm_lang = array(
'pushover_description' => 'Pushover is a service that makes it easy to get real-time notifications. See <a href="https://pushover.net/">their website</a> for more info.',
'pushover_api_token' => 'Pushover App API Token',
'pushover_api_token_description' => 'Before you can use Pushover, you need to register an App at their website and enter the App API Token here.',
'alert_type' => 'Choisissez quand vous souhaitez être notifié.<br/>',
'alert_type' => 'Choisissez quand vous souhaitez être notifié',
'alert_type_description' => '<b>Changement d\'état : </b>'.
'Vous recevez une notification chaque fois que le serveur change d\'état. C\'est-à-dire passe de l\'état OK à HORS SERVICE ou de HORS SERVICE à OK.<br/>'.
'<br/><b>Hors service : </b>'.

View File

@ -200,7 +200,7 @@ $sm_lang = array(
'pushover_description' => 'Pushover is a service that makes it easy to get real-time notifications. See <a href="https://pushover.net/">their website</a> for more info.',
'pushover_api_token' => 'Pushover App API Token',
'pushover_api_token_description' => 'Before you can use Pushover, you need to register an App at their website and enter the App API Token here.',
'alert_type' => 'Seleziona quando vuoi essere notificato.<br/>',
'alert_type' => 'Seleziona quando vuoi essere notificato',
'alert_type_description' => '<b>Cambio di Stato:</b> '.
'Riceverai una notifica solo quando un server cambierà stato. Quindi da online -> offline oppure da offline -> online.<br/>'.
'<br /><b>Offline:</b> '.

View File

@ -200,7 +200,7 @@ $sm_lang = array(
'pushover_description' => 'Pushover is a service that makes it easy to get real-time notifications. See <a href="https://pushover.net/">their website</a> for more info.',
'pushover_api_token' => 'Pushover App API Token',
'pushover_api_token_description' => 'Before you can use Pushover, you need to register an App at their website and enter the App API Token here.',
'alert_type' => '알림을 원하면 다음과 같이 변경하십시오..<br/>',
'alert_type' => '알림을 원하면 다음과 같이 변경하십시오.',
'alert_type_description' => '<b>상태 변경: </b><br/>'.
'서버 상태가 변경이되면 알림을 받습니다. online -> offline -> online.<br/>'.
'<br/><b>오프라인: </b><br/>'.

View File

@ -200,7 +200,7 @@ $sm_lang = array(
'pushover_description' => 'Pushover is een dienst die het gemakkelijk maakt om real-time notificaties te ontvangen. Zie <a href="https://pushover.net/">hun website</a> voor meer informatie.',
'pushover_api_token' => 'Pushover App API Token',
'pushover_api_token_description' => 'Voordat je Pushover kunt gebruiken moet je een App registreren via hun website, en daarvan de App API Token hier invullen.',
'alert_type' => 'Selecteer wanneer je een notificatie wilt.<br/>',
'alert_type' => 'Selecteer wanneer je een notificatie wilt',
'alert_type_description' => '<b>Status change:</b> '.
'Je ontvangt alleen bericht wanneer een server van status verandert. Dus van online -> offline of offline -> online.<br/>'.
'<br /><b>Offline:</b> '.

View File

@ -200,7 +200,7 @@ $sm_lang = array(
'pushover_description' => 'Pushover is a service that makes it easy to get real-time notifications. See <a href="https://pushover.net/">their website</a> for more info.',
'pushover_api_token' => 'Pushover App API Token',
'pushover_api_token_description' => 'Before you can use Pushover, you need to register an App at their website and enter the App API Token here.',
'alert_type' => 'Selecione como você gostaria de ser notificado.<br/>',
'alert_type' => 'Selecione como você gostaria de ser notificado.',
'alert_type_description' => '<b>Mudança de Status:</b> '.
'Você receberá uma notificação quando o seridor tive uma mudança de status. De online -> offline ou offline -> online.<br/>'.
'<br /><b>Offline:</b> '.

View File

@ -200,7 +200,7 @@ $sm_lang = array(
'pushover_description' => 'Pushover - это сервис, который позволяет легко получать уведомления в режиме реального времени. Больше информации на <a href="https://pushover.net/">их веб-сайте</a>.',
'pushover_api_token' => 'Pushover App API Token',
'pushover_api_token_description' => 'Прежде чем вы сможете начать пользоваться Pushover, вам необходимо зарегестрировать "App" на их веб-сайте и ввести "App API Token" сюда.',
'alert_type' => 'Выбeрите, какие вы хотите получать уведомления<br/>',
'alert_type' => 'Выбeрите, какие вы хотите получать уведомления',
'alert_type_description' => '<b>Изменение статуса :</b> '.
'Вы получите уведомление об изменение статуса. Для онлайн -> оффлайн или офлайн -> онлайн.<br/>'.
'<br /><b>Оффлайн:</b> '.

View File

@ -200,7 +200,7 @@ $sm_lang = array(
'pushover_description' => 'Pushover is a service that makes it easy to get real-time notifications. See <a href="https://pushover.net/">their website</a> for more info.',
'pushover_api_token' => 'Pushover App API Token',
'pushover_api_token_description' => 'Before you can use Pushover, you need to register an App at their website and enter the App API Token here.',
'alert_type' => '如果想要收到提醒请选中此项.<br/>',
'alert_type' => '如果想要收到提醒请选中此项.',
'alert_type_description' => '<b>状态变化:</b> '.
'服务器 online -> offline 或 offline -> online 的状态变化将会收到提醒.<br/>'.
'<br /><b>离线状态:</b> '.

View File

@ -27,7 +27,6 @@
namespace psm\Module;
use psm\Service\Database;
use psm\Service\Template;
use Symfony\Component\HttpFoundation\Response;
abstract class AbstractController implements ControllerInterface {
@ -99,17 +98,10 @@ abstract class AbstractController implements ControllerInterface {
protected $db;
/**
* Template object
* @var \psm\Service\Template $tpl
* Twig object
* @var \Twig_Environment $twig
*/
protected $tpl;
/**
* Template Id that should be added to the main template
* @var string
* @see setTemplateId() getTemplateId()
*/
protected $tpl_id;
protected $twig;
/**
* User service
@ -144,9 +136,9 @@ abstract class AbstractController implements ControllerInterface {
*/
protected $xhr = false;
function __construct(Database $db, Template $tpl) {
function __construct(Database $db, \Twig_Environment $twig) {
$this->db = $db;
$this->tpl = $tpl;
$this->twig = $twig;
}
/**
@ -170,7 +162,7 @@ abstract class AbstractController implements ControllerInterface {
}
// no response returned from execute, create regular HTML
return $this->createHTML();
return $this->createHTML($result);
}
/**
@ -202,29 +194,23 @@ abstract class AbstractController implements ControllerInterface {
/**
* Create the HTML code for the module.
*
* First the createHTMLLabels() will be called to add all labels to the template,
* Then the tpl_id set in $this->getTemplateId() will be added to the main template automatically.
* If XHR is on, no main template will be added.
*
* @param string $html HTML code to add to the main body
* @return \Symfony\Component\HttpFoundation\Response
*/
protected function createHTML() {
$tpl_id_content = $this->getTemplateId();
$html = '';
if($this->xhr) {
protected function createHTML($html = null) {
if(!$this->xhr) {
// in XHR mode, we will not add the main template
if($tpl_id_content) {
$this->createHTMLLabels();
$html = $this->tpl->display($tpl_id_content);
}
} else {
// regular request, add main frame
$tpl_data = array();
$tpl_data = array(
'title' => strtoupper(psm_get_lang('system', 'title')),
'label_back_to_top' => psm_get_lang('system', 'back_to_top'),
'add_footer' => $this->add_footer,
'version' => 'v' . PSM_VERSION,
'messages' => $this->getMessages(),
'html_content' => $html,
);
if(!empty($this->messages)) {
$this->tpl->addTemplateDataRepeat('main', 'messages', $this->messages);
}
// add menu to page?
if($this->add_menu) {
$tpl_data['html_menu'] = $this->createHTMLMenu();
@ -245,16 +231,6 @@ abstract class AbstractController implements ControllerInterface {
if($this->sidebar !== null) {
$tpl_data['html_sidebar'] = $this->sidebar->createHTML();
}
// add footer to page?
if($this->add_footer) {
$this->tpl->newTemplate('main_footer', 'main.tpl.html');
$tpl_data['html_footer'] = $this->tpl->getTemplate('main_footer');
$tpl_data['version'] = 'v' . PSM_VERSION;
}
if($tpl_id_content) {
$tpl_data['content'] = $this->tpl->getTemplate($tpl_id_content);
}
if(psm_update_available()) {
$tpl_data['update_available'] = str_replace('{version}', 'v'.psm_get_conf('version_update_check'), psm_get_lang('system', 'update_available'));
@ -263,12 +239,7 @@ abstract class AbstractController implements ControllerInterface {
if($this->black_background) {
$tpl_data['body_class'] = 'black_background';
}
// add the module's custom template to the main template to get some content
$this->setTemplateId('main');
$this->tpl->addTemplatedata($this->getTemplateId(), $tpl_data);
$this->createHTMLLabels();
$html = $this->tpl->display($this->getTemplateId());
$html = $this->twig->render('main/body.tpl.html', $tpl_data);
}
$response = new Response($html);
@ -283,9 +254,6 @@ abstract class AbstractController implements ControllerInterface {
protected function createHTMLMenu() {
$ulvl = ($this->user) ? $this->user->getUserLevel() : PSM_USER_ANONYMOUS;
$tpl_id = 'main_menu';
$this->tpl->newTemplate($tpl_id, 'main.tpl.html');
$tpl_data = array(
'label_help' => psm_get_lang('menu', 'help'),
'label_profile' => psm_get_lang('users', 'profile'),
@ -305,17 +273,14 @@ abstract class AbstractController implements ControllerInterface {
$items = array();
break;
}
$menu = array();
$tpl_data['menu'] = array();
foreach($items as $key) {
$menu[] = array(
$tpl_data['menu'][] = array(
'active' => ($key == psm_GET('mod')) ? 'active' : '',
'url' => psm_build_url(array('mod' => $key)),
'label' => psm_get_lang('menu', $key),
);
}
if(!empty($menu)) {
$this->tpl->addTemplateDataRepeat($tpl_id, 'menu', $menu);
}
if($ulvl != PSM_USER_ANONYMOUS) {
$user = $this->user->getUser();
@ -325,51 +290,7 @@ abstract class AbstractController implements ControllerInterface {
psm_get_lang('login', 'welcome_usermenu')
);
}
$this->tpl->addTemplateData($tpl_id, $tpl_data);
return $this->tpl->getTemplate($tpl_id);
}
/**
* Use this to add language specific labels to template
*
* @see createHTML()
*/
protected function createHTMLLabels() {
$this->tpl->addTemplateData(
'main',
array(
'title' => strtoupper(psm_get_lang('system', 'title')),
'label_back_to_top' => psm_get_lang('system', 'back_to_top'),
)
);
}
/**
* Set a template id that will be added to the main template automatically
* once you call the parent::createHTML()
*
* @param string $tpl_id
* @param string $tpl_file if given, the tpl_id will be created automatically from this file
* @see getTemplateId() createHTML()
*/
public function setTemplateId($tpl_id, $tpl_file = null) {
$this->tpl_id = $tpl_id;
if($tpl_file != null) {
// tpl_file given, try to load the template..
$this->tpl->newTemplate($tpl_id, $tpl_file);
}
}
/**
* Get the mpalte id that will be added to the main template
*
* @return string
* @see setTemplateId()
*/
public function getTemplateId() {
return $this->tpl_id;
return $this->twig->render('main/menu.tpl.html', $tpl_data);
}
/**
@ -424,7 +345,8 @@ abstract class AbstractController implements ControllerInterface {
* Add one or multiple message to the stack to be displayed to the user
* @param string|array $msg
* @param string $shortcode info/success/warning/error
* @return \psm\Module\AbstractModule
* @return \psm\Module\ControllerInterface
* @see getMessages()
*/
public function addMessage($msg, $shortcode = 'info') {
if(!is_array($msg)) {
@ -455,6 +377,20 @@ abstract class AbstractController implements ControllerInterface {
return $this;
}
/**
* Get all messages (and optionally clear them)
* @param boolean $clear
* @return array
* @see addMessage()
*/
public function getMessages($clear = true) {
$msgs = $this->messages;
if($clear) {
$this->messages = array();
}
return $msgs;
}
/**
* Set user service
* @param \psm\Service\User $user

View File

@ -28,7 +28,6 @@
namespace psm\Module\Config\Controller;
use psm\Module\AbstractController;
use psm\Service\Database;
use psm\Service\Template;
class ConfigController extends AbstractController {
@ -67,8 +66,8 @@ class ConfigController extends AbstractController {
private $default_tab = 'general';
function __construct(Database $db, Template $tpl) {
parent::__construct($db, $tpl);
function __construct(Database $db, \Twig_Environment $twig) {
parent::__construct($db, $twig);
$this->setMinUserLevelRequired(PSM_USER_ADMIN);
@ -79,9 +78,12 @@ class ConfigController extends AbstractController {
/**
* Populate all the config fields with values from the database
*
* @return string
*/
protected function executeIndex() {
$this->setTemplateId('config', 'config/config.tpl.html');
$this->twig->addGlobal('subtitle', psm_get_lang('menu', 'config'));
$tpl_data = $this->getLabels();
$config_db = $this->db->select(
PSM_DB_PREFIX . 'config',
@ -96,21 +98,20 @@ class ConfigController extends AbstractController {
// generate language array
$lang_keys = psm_get_langs();
$languages = array();
$tpl_data['language_current'] = (isset($config['language']))
? $config['language']
: 'en_US';
$tpl_data['languages'] = array();
foreach($lang_keys as $key => $label) {
$languages[] = array(
$tpl_data['languages'][] = array(
'value' => $key,
'label' => $label,
'selected' => ($key == $config['language']) ? 'selected="selected"' : '',
);
}
$this->tpl->addTemplateDataRepeat($this->getTemplateId(), 'languages', $languages);
$tpl_data = array(
'sms_selected_' . $config['sms_gateway'] => 'selected="selected"',
'alert_type_selected_' . $config['alert_type'] => 'selected="selected"',
'auto_refresh_servers' => (isset($config['auto_refresh_servers'])) ? $config['auto_refresh_servers'] : '0',
);
$tpl_data['sms_selected_' . $config['sms_gateway']] = 'selected="selected"';
$tpl_data['alert_type_selected_' . $config['alert_type']] = 'selected="selected"';
$tpl_data['auto_refresh_servers'] = (isset($config['auto_refresh_servers'])) ? $config['auto_refresh_servers'] : '0';
foreach($this->checkboxes as $input_key) {
$tpl_data[$input_key . '_checked'] =
@ -126,14 +127,14 @@ class ConfigController extends AbstractController {
$testmodals = array('email', 'sms', 'pushover');
foreach($testmodals as $modal_id) {
$modal = new \psm\Util\Module\Modal($this->tpl, 'test' . ucfirst($modal_id), \psm\Util\Module\Modal::MODAL_TYPE_OKCANCEL);
$modal = new \psm\Util\Module\Modal($this->twig, 'test' . ucfirst($modal_id), \psm\Util\Module\Modal::MODAL_TYPE_OKCANCEL);
$this->addModal($modal);
$modal->setTitle(psm_get_lang('servers', 'send_' . $modal_id));
$modal->setMessage(psm_get_lang('config', 'test_' . $modal_id));
$modal->setOKButtonLabel(psm_get_lang('config', 'send'));
}
$this->tpl->addTemplateData($this->getTemplateId(), $tpl_data);
return $this->twig->render('module/config/config.tpl.html', $tpl_data);
}
/**
@ -186,7 +187,7 @@ class ConfigController extends AbstractController {
$this->default_tab = 'pushover';
}
}
$this->initializeAction('index');
return $this->initializeAction('index');
}
/**
@ -270,67 +271,60 @@ class ConfigController extends AbstractController {
}
}
// override parent::createHTMLLabels()
protected function createHTMLLabels() {
$this->tpl->addTemplateData(
$this->getTemplateId(),
array(
'subtitle' => psm_get_lang('menu', 'config'),
'label_tab_email' => psm_get_lang('config', 'tab_email'),
'label_tab_sms' => psm_get_lang('config', 'tab_sms'),
'label_tab_pushover' => psm_get_lang('config', 'tab_pushover'),
'label_settings_email' => psm_get_lang('config', 'settings_email'),
'label_settings_sms' => psm_get_lang('config', 'settings_sms'),
'label_settings_pushover' => psm_get_lang('config', 'settings_pushover'),
'label_settings_notification' => psm_get_lang('config', 'settings_notification'),
'label_settings_log' => psm_get_lang('config', 'settings_log'),
'label_general' => psm_get_lang('config', 'general'),
'label_language' => psm_get_lang('config', 'language'),
'label_show_update' => psm_get_lang('config', 'show_update'),
'label_email_status' => psm_get_lang('config', 'email_status'),
'label_email_from_email' => psm_get_lang('config', 'email_from_email'),
'label_email_from_name' => psm_get_lang('config', 'email_from_name'),
'label_email_smtp' => psm_get_lang('config', 'email_smtp'),
'label_email_smtp_host' => psm_get_lang('config', 'email_smtp_host'),
'label_email_smtp_port' => psm_get_lang('config', 'email_smtp_port'),
'label_email_smtp_username' => psm_get_lang('config', 'email_smtp_username'),
'label_email_smtp_password' => psm_get_lang('config', 'email_smtp_password'),
'label_email_smtp_noauth' => psm_get_lang('config', 'email_smtp_noauth'),
'label_sms_status' => psm_get_lang('config', 'sms_status'),
'label_sms_gateway' => psm_get_lang('config', 'sms_gateway'),
'label_sms_gateway_mosms' => psm_get_lang('config', 'sms_gateway_mosms'),
'label_sms_gateway_mollie' => psm_get_lang('config', 'sms_gateway_mollie'),
'label_sms_gateway_spryng' => psm_get_lang('config', 'sms_gateway_spryng'),
'label_sms_gateway_inetworx' => psm_get_lang('config', 'sms_gateway_inetworx'),
'label_sms_gateway_clickatell' => psm_get_lang('config', 'sms_gateway_clickatell'),
'label_sms_gateway_textmarketer' => psm_get_lang('config', 'sms_gateway_textmarketer'),
'label_sms_gateway_smsit' => psm_get_lang('config', 'sms_gateway_smsit'),
'label_sms_gateway_smsglobal' => psm_get_lang('config', 'sms_gateway_smsglobal'),
'label_sms_gateway_username' => psm_get_lang('config', 'sms_gateway_username'),
'label_sms_gateway_password' => psm_get_lang('config', 'sms_gateway_password'),
'label_sms_from' => psm_get_lang('config', 'sms_from'),
'label_pushover_description' => psm_get_lang('config', 'pushover_description'),
'label_pushover_status' => psm_get_lang('config', 'pushover_status'),
'label_pushover_api_token' => psm_get_lang('config', 'pushover_api_token'),
'label_pushover_api_token_description' => psm_get_lang('config', 'pushover_api_token_description'),
'label_alert_type' => psm_get_lang('config', 'alert_type'),
'label_alert_type_description' => psm_get_lang('config', 'alert_type_description'),
'label_alert_type_status' => psm_get_lang('config', 'alert_type_status'),
'label_alert_type_offline' => psm_get_lang('config', 'alert_type_offline'),
'label_alert_type_always' => psm_get_lang('config', 'alert_type_always'),
'label_log_status' => psm_get_lang('config', 'log_status'),
'label_log_status_description' => psm_get_lang('config', 'log_status_description'),
'label_log_email' => psm_get_lang('config', 'log_email'),
'label_log_sms' => psm_get_lang('config', 'log_sms'),
'label_log_pushover' => psm_get_lang('config', 'log_pushover'),
'label_auto_refresh' => psm_get_lang('config', 'auto_refresh'),
'label_auto_refresh_servers' => psm_get_lang('config', 'auto_refresh_servers'),
'label_seconds' => psm_get_lang('config', 'seconds'),
'label_save' => psm_get_lang('system', 'save'),
'label_test' => psm_get_lang('config', 'test'),
)
protected function getLabels() {
return array(
'label_tab_email' => psm_get_lang('config', 'tab_email'),
'label_tab_sms' => psm_get_lang('config', 'tab_sms'),
'label_tab_pushover' => psm_get_lang('config', 'tab_pushover'),
'label_settings_email' => psm_get_lang('config', 'settings_email'),
'label_settings_sms' => psm_get_lang('config', 'settings_sms'),
'label_settings_pushover' => psm_get_lang('config', 'settings_pushover'),
'label_settings_notification' => psm_get_lang('config', 'settings_notification'),
'label_settings_log' => psm_get_lang('config', 'settings_log'),
'label_general' => psm_get_lang('config', 'general'),
'label_language' => psm_get_lang('config', 'language'),
'label_show_update' => psm_get_lang('config', 'show_update'),
'label_email_status' => psm_get_lang('config', 'email_status'),
'label_email_from_email' => psm_get_lang('config', 'email_from_email'),
'label_email_from_name' => psm_get_lang('config', 'email_from_name'),
'label_email_smtp' => psm_get_lang('config', 'email_smtp'),
'label_email_smtp_host' => psm_get_lang('config', 'email_smtp_host'),
'label_email_smtp_port' => psm_get_lang('config', 'email_smtp_port'),
'label_email_smtp_username' => psm_get_lang('config', 'email_smtp_username'),
'label_email_smtp_password' => psm_get_lang('config', 'email_smtp_password'),
'label_email_smtp_noauth' => psm_get_lang('config', 'email_smtp_noauth'),
'label_sms_status' => psm_get_lang('config', 'sms_status'),
'label_sms_gateway' => psm_get_lang('config', 'sms_gateway'),
'label_sms_gateway_mosms' => psm_get_lang('config', 'sms_gateway_mosms'),
'label_sms_gateway_mollie' => psm_get_lang('config', 'sms_gateway_mollie'),
'label_sms_gateway_spryng' => psm_get_lang('config', 'sms_gateway_spryng'),
'label_sms_gateway_inetworx' => psm_get_lang('config', 'sms_gateway_inetworx'),
'label_sms_gateway_clickatell' => psm_get_lang('config', 'sms_gateway_clickatell'),
'label_sms_gateway_textmarketer' => psm_get_lang('config', 'sms_gateway_textmarketer'),
'label_sms_gateway_smsit' => psm_get_lang('config', 'sms_gateway_smsit'),
'label_sms_gateway_smsglobal' => psm_get_lang('config', 'sms_gateway_smsglobal'),
'label_sms_gateway_username' => psm_get_lang('config', 'sms_gateway_username'),
'label_sms_gateway_password' => psm_get_lang('config', 'sms_gateway_password'),
'label_sms_from' => psm_get_lang('config', 'sms_from'),
'label_pushover_description' => psm_get_lang('config', 'pushover_description'),
'label_pushover_status' => psm_get_lang('config', 'pushover_status'),
'label_pushover_api_token' => psm_get_lang('config', 'pushover_api_token'),
'label_pushover_api_token_description' => psm_get_lang('config', 'pushover_api_token_description'),
'label_alert_type' => psm_get_lang('config', 'alert_type'),
'label_alert_type_description' => psm_get_lang('config', 'alert_type_description'),
'label_alert_type_status' => psm_get_lang('config', 'alert_type_status'),
'label_alert_type_offline' => psm_get_lang('config', 'alert_type_offline'),
'label_alert_type_always' => psm_get_lang('config', 'alert_type_always'),
'label_log_status' => psm_get_lang('config', 'log_status'),
'label_log_status_description' => psm_get_lang('config', 'log_status_description'),
'label_log_email' => psm_get_lang('config', 'log_email'),
'label_log_sms' => psm_get_lang('config', 'log_sms'),
'label_log_pushover' => psm_get_lang('config', 'log_pushover'),
'label_auto_refresh' => psm_get_lang('config', 'auto_refresh'),
'label_auto_refresh_servers' => psm_get_lang('config', 'auto_refresh_servers'),
'label_seconds' => psm_get_lang('config', 'seconds'),
'label_save' => psm_get_lang('system', 'save'),
'label_test' => psm_get_lang('config', 'test'),
);
return parent::createHTMLLabels();
}
}

View File

@ -28,11 +28,10 @@
namespace psm\Module;
use psm\Service\Database;
use psm\Service\Template;
interface ControllerInterface {
public function __construct(Database $db, Template $tpl);
public function __construct(Database $db, \Twig_Environment $twig);
/**
* Initialize the module

View File

@ -29,12 +29,11 @@
namespace psm\Module\Error\Controller;
use psm\Module\AbstractController;
use psm\Service\Database;
use psm\Service\Template;
class ErrorController extends AbstractController {
function __construct(Database $db, Template $tpl) {
parent::__construct($db, $tpl);
function __construct(Database $db, \Twig_Environment $twig) {
parent::__construct($db, $twig);
$this->setMinUserLevelRequired(PSM_USER_ANONYMOUS);
@ -45,10 +44,11 @@ class ErrorController extends AbstractController {
/**
* 401 error page
*
* @return string
*/
protected function execute401() {
$this->setTemplateId('error', 'error/error.tpl.html');
$this->tpl->addTemplateData('error', array(
return $this->twig->render('module/error/401.tpl.html', array(
'label_title' => psm_get_lang('error', '401_unauthorized'),
'label_description' => psm_get_lang('error', '401_unauthorized_description'),
));

View File

@ -29,7 +29,6 @@
namespace psm\Module\Install\Controller;
use psm\Module\AbstractController;
use psm\Service\Database;
use psm\Service\Template;
class InstallController extends AbstractController {
@ -45,8 +44,8 @@ class InstallController extends AbstractController {
*/
protected $path_config_old;
function __construct(Database $db, Template $tpl) {
parent::__construct($db, $tpl);
function __construct(Database $db, \Twig_Environment $twig) {
parent::__construct($db, $twig);
$this->setMinUserLevelRequired(PSM_USER_ANONYMOUS);
$this->addMenu(false);
@ -57,33 +56,14 @@ class InstallController extends AbstractController {
$this->setActions(array(
'index', 'config', 'install'
), 'index');
}
protected function createHTML() {
$html_results = '';
if(!empty($this->messages)) {
$this->tpl->newTemplate('install_results', 'install/install.tpl.html');
$this->tpl->addTemplateDataRepeat('install_results', 'resultmsgs', $this->messages);
$html_results = $this->tpl->getTemplate('install_results');
$this->messages = array();
}
$tpl_id = $this->getTemplateId();
$this->setTemplateId('install', 'install/install.tpl.html');
$this->tpl->addTemplateData($this->getTemplateId(), array(
'html_install' => $this->tpl->getTemplate($tpl_id),
'html_results' => $html_results,
));
return parent::createHTML();
$this->twig->addGlobal('subtitle', psm_get_lang('system,', 'install'));
}
/**
* Say hi to our new user
*/
protected function executeIndex() {
$this->setTemplateId('install_index', 'install/install.tpl.html');
// build prerequisites
$errors = 0;
@ -110,13 +90,17 @@ class InstallController extends AbstractController {
if($errors > 0) {
$this->addMessage($errors . ' error(s) have been encountered. Please fix them and refresh this page.', 'error');
}
return $this->twig->render('module/install/index.tpl.html', array(
'messages' => $this->getMessages()
));
}
/**
* Help the user create a new config file
*/
protected function executeConfig() {
$this->setTemplateId('install_config_new', 'install/install.tpl.html');
$tpl_name = 'module/install/config_new.tpl.html';
$tpl_data = array();
if(!defined('PSM_DB_PREFIX')) {
@ -168,8 +152,7 @@ class InstallController extends AbstractController {
$this->addMessage('Configuration file written successfully.', 'success');
} else {
$this->addMessage('Config file is not writable, we cannot save it for you.', 'error');
$this->tpl->newTemplate('install_config_new_copy', 'install/install.tpl.html');
$tpl_data['html_config_copy'] = $this->tpl->getTemplate('install_config_new_copy');
$tpl_data['include_config_new_copy'] = true;
$tpl_data['php_config'] = $config_php;
}
} else {
@ -185,14 +168,14 @@ class InstallController extends AbstractController {
if(version_compare($this->getPreviousVersion(), '3.0.0', '<')) {
// upgrade from before 3.0, does not have passwords yet.. create new user first
$this->addMessage('Your current version does not have an authentication system, but since v3.0 access to the monitor is restricted by user accounts. Please set up a new account to be able to login after the upgrade, and which you can use to change the passwords for your other accounts.', 'info');
$this->setTemplateId('install_config_new_user', 'install/install.tpl.html');
$tpl_name = 'module/install/config_new_user.tpl.html';
} else {
$this->setTemplateId('install_config_upgrade', 'install/install.tpl.html');
$tpl_name = 'module/install/config_upgrade.tpl.html';
$tpl_data['version'] = PSM_VERSION;
}
} else {
// fresh install ahead
$this->setTemplateId('install_config_new_user', 'install/install.tpl.html');
$tpl_name = 'module/install/config_new_user.tpl.html';
$tpl_data['username'] = (isset($_POST['username'])) ? $_POST['username'] : '';
$tpl_data['email'] = (isset($_POST['email'])) ? $_POST['email'] : '';
@ -201,7 +184,8 @@ class InstallController extends AbstractController {
$this->addMessage('Configuration file found, but unable to connect to MySQL. Please check your information.', 'error');
}
}
$this->tpl->addTemplateData($this->getTemplateId(), $tpl_data);
$tpl_data['messages'] = $this->getMessages();
return $this->twig->render($tpl_name, $tpl_data);
}
/**
@ -280,7 +264,9 @@ class InstallController extends AbstractController {
}
}
$this->setTemplateId('install_success', 'install/install.tpl.html');
return $this->twig->render('module/install/success.tpl.html', array(
'messages' => $this->getMessages()
));
}
/**
@ -363,15 +349,4 @@ class InstallController extends AbstractController {
return $version_from;
}
}
protected function createHTMLLabels() {
$this->tpl->addTemplateData(
$this->getTemplateId(),
array(
'subtitle' => psm_get_lang('system', 'install'),
)
);
return parent::createHTMLLabels();
}
}

View File

@ -29,12 +29,11 @@
namespace psm\Module\Server\Controller;
use psm\Module\AbstractController;
use psm\Service\Database;
use psm\Service\Template;
abstract class AbstractServerController extends AbstractController {
function __construct(Database $db, Template $tpl) {
parent::__construct($db, $tpl);
function __construct(Database $db, \Twig_Environment $twig) {
parent::__construct($db, $twig);
}
/**

View File

@ -27,15 +27,14 @@
namespace psm\Module\Server\Controller;
use psm\Service\Database;
use psm\Service\Template;
/**
* Log module. Create the page to view previous log messages
*/
class LogController extends AbstractServerController {
function __construct(Database $db, Template $tpl) {
parent::__construct($db, $tpl);
function __construct(Database $db, \Twig_Environment $twig) {
parent::__construct($db, $twig);
$this->setActions('index', 'index');
}
@ -44,7 +43,21 @@ class LogController extends AbstractServerController {
* Prepare the template with a list of all log entries
*/
protected function executeIndex() {
$this->setTemplateId('server_log_list', 'server/log.tpl.html');
$this->twig->addGlobal('subtitle', psm_get_lang('menu', 'server_log'));
$tpl_data = array(
'label_status' => psm_get_lang('log', 'status'),
'label_email' => psm_get_lang('log', 'email'),
'label_sms' => psm_get_lang('log', 'sms'),
'label_pushover' => psm_get_lang('log', 'pushover'),
'label_title' => psm_get_lang('log', 'title'),
'label_server' => psm_get_lang('servers', 'server'),
'label_type' => psm_get_lang('log', 'type'),
'label_message' => psm_get_lang('system', 'message'),
'label_date' => psm_get_lang('system', 'date'),
'label_users' => ucfirst(psm_get_lang('menu', 'user')),
'label_no_logs' => psm_get_lang('log', 'no_logs'),
'tabs' => array(),
);
$log_types = array('status', 'email', 'sms', 'pushover');
// get users
@ -59,6 +72,13 @@ class LogController extends AbstractServerController {
$records = $this->getEntries($key);
$log_count = count($records);
$tab_data = array(
'id' => $key,
'has_users' => ($key == 'status') ? false : true,
'no_logs' => ($log_count == 0) ? true : false,
'tab_active' => ($key == 'status') ? 'active' : '',
);
for ($x = 0; $x < $log_count; $x++) {
$record = &$records[$x];
$record['class'] = ($x & 1) ? 'odd' : 'even';
@ -88,25 +108,10 @@ class LogController extends AbstractServerController {
$record['user_list'] = implode('&nbsp;&bull; ', $names);
}
}
// add entries to template
$this->tpl->newTemplate('server_log_entries', 'server/log.tpl.html');
$this->tpl->addTemplateDataRepeat('server_log_entries', 'entries', $records);
$this->tpl->addTemplateData(
'server_log_entries',
array(
'logtitle' => $key,
'?has_users' => ($key == 'status') ? false : true,
'?no_logs' => ($log_count == 0) ? true : false,
)
);
$this->tpl->addTemplateData(
$this->getTemplateId(),
array(
'content_' . $key => $this->tpl->getTemplate('server_log_entries'),
)
);
$tab_data['entries'] = $records;
$tpl_data['tabs'][] = $tab_data;
}
return $this->twig->render('module/server/log.tpl.html', $tpl_data);
}
/**
@ -143,27 +148,4 @@ class LogController extends AbstractServerController {
);
return $entries;
}
// override parent::createHTMLLabels()
protected function createHTMLLabels() {
$this->tpl->addTemplateData(
$this->getTemplateId(),
array(
'subtitle' => psm_get_lang('menu', 'server_log'),
'label_status' => psm_get_lang('log', 'status'),
'label_email' => psm_get_lang('log', 'email'),
'label_sms' => psm_get_lang('log', 'sms'),
'label_pushover' => psm_get_lang('log', 'pushover'),
'label_title' => psm_get_lang('log', 'title'),
'label_server' => psm_get_lang('servers', 'server'),
'label_type' => psm_get_lang('log', 'type'),
'label_message' => psm_get_lang('system', 'message'),
'label_date' => psm_get_lang('system', 'date'),
'label_users' => ucfirst(psm_get_lang('menu', 'user')),
'label_no_logs' => psm_get_lang('log', 'no_logs'),
)
);
return parent::createHTMLLabels();
}
}

View File

@ -27,7 +27,6 @@
namespace psm\Module\Server\Controller;
use psm\Service\Database;
use psm\Service\Template;
/**
* Server module. Add/edit/delete servers, show a list of all servers etc.
@ -40,8 +39,8 @@ class ServerController extends AbstractServerController {
*/
protected $server_id;
function __construct(Database $db, Template $tpl) {
parent::__construct($db, $tpl);
function __construct(Database $db, \Twig_Environment $twig) {
parent::__construct($db, $twig);
$this->server_id = isset($_GET['id']) ? intval($_GET['id']) : 0;
@ -53,19 +52,21 @@ class ServerController extends AbstractServerController {
$this->setMinUserLevelRequiredForAction(PSM_USER_ADMIN, array(
'delete', 'edit', 'save'
));
$this->twig->addGlobal('subtitle', psm_get_lang('menu', 'server'));
}
/**
* Prepare the template to show a list of all servers
*/
protected function executeIndex() {
$this->setTemplateId('server_list', 'server/server.tpl.html');
$sidebar = new \psm\Util\Module\Sidebar($this->tpl);
$tpl_data = $this->getLabels();
$tpl_data['user_level'] = $this->user->getUserLevel();
$sidebar = new \psm\Util\Module\Sidebar($this->twig);
$this->setSidebar($sidebar);
// check if user is admin, in that case we add the buttons
if($this->user->getUserLevel() == PSM_USER_ADMIN) {
$modal = new \psm\Util\Module\Modal($this->tpl, 'delete', \psm\Util\Module\Modal::MODAL_TYPE_DANGER);
$modal = new \psm\Util\Module\Modal($this->twig, 'delete', \psm\Util\Module\Modal::MODAL_TYPE_DANGER);
$this->addModal($modal);
$modal->setTitle(psm_get_lang('servers', 'delete_title'));
$modal->setMessage(psm_get_lang('servers', 'delete_message'));
@ -77,11 +78,6 @@ class ServerController extends AbstractServerController {
psm_build_url(array('mod' => 'server', 'action' => 'edit')),
'plus icon-white', 'success'
);
// get the action buttons per server
$this->tpl->newTemplate('server_list_admin_actions', 'server/server.tpl.html');
$html_actions = $this->tpl->getTemplate('server_list_admin_actions');
} else {
$html_actions = '';
}
$sidebar->addButton(
@ -91,8 +87,6 @@ class ServerController extends AbstractServerController {
'refresh'
);
// we need an array for our template magic (see below):
$html_actions = array('html_actions' => $html_actions);
$icons = array(
'email' => 'icon-envelope',
'sms' => 'icon-mobile',
@ -103,10 +97,6 @@ class ServerController extends AbstractServerController {
$server_count = count($servers);
for ($x = 0; $x < $server_count; $x++) {
// template magic: push the actions html to the front of the server array
// so the template handler will add it first. that way the other server vars
// will also be replaced in the html_actions template itself
$servers[$x] = $html_actions + $servers[$x];
$servers[$x]['class'] = ($x & 1) ? 'odd' : 'even';
if($servers[$x]['type'] == 'website') {
@ -138,27 +128,24 @@ class ServerController extends AbstractServerController {
$servers[$x] = $this->formatServer($servers[$x]);
}
// add servers to template
$this->tpl->addTemplateDataRepeat($this->getTemplateId(), 'servers', $servers);
$tpl_data['servers'] = $servers;
return $this->twig->render('module/server/server/list.tpl.html', $tpl_data);
}
/**
* Prepare the template to show the update screen for a single server
*/
protected function executeEdit() {
$this->setTemplateId('server_update', 'server/server.tpl.html');
$back_to = isset($_GET['back_to']) ? $_GET['back_to'] : '';
$tpl_data = array(
'edit_server_id' => $this->server_id,
// form url:
'url_save' => psm_build_url(array(
'mod' => 'server',
'action' => 'save',
'id' => $this->server_id,
'back_to' => $back_to,
)),
);
$tpl_data = $this->getLabels();
$tpl_data['edit_server_id'] = $this->server_id;
$tpl_data['url_save'] = psm_build_url(array(
'mod' => 'server',
'action' => 'save',
'id' => $this->server_id,
'back_to' => $back_to,
));
// depending on where the user came from, add the go back url:
if($back_to == 'view' && $this->server_id > 0) {
@ -167,7 +154,7 @@ class ServerController extends AbstractServerController {
$tpl_data['url_go_back'] = psm_build_url(array('mod' => 'server'));
}
$users = $this->db->select(PSM_DB_PREFIX.'users', null, array('user_id', 'name'), '', 'name');
$tpl_data['users'] = $this->db->select(PSM_DB_PREFIX.'users', null, array('user_id', 'name'), '', 'name');
switch($this->server_id) {
case 0:
@ -188,7 +175,7 @@ class ServerController extends AbstractServerController {
$tpl_data['titlemode'] = psm_get_lang('system', 'edit') . ' ' . $edit_server['label'];
$user_idc_selected = $this->getServerUsers($this->server_id);
foreach($users as &$user) {
foreach($tpl_data['users'] as &$user) {
if(in_array($user['user_id'], $user_idc_selected)) {
$user['edit_selected'] = 'selected="selected"';
}
@ -196,7 +183,6 @@ class ServerController extends AbstractServerController {
break;
}
$this->tpl->addTemplateDataRepeat($this->getTemplateId(), 'users', $users);
if(!empty($edit_server)) {
// attempt to prefill previously posted fields
@ -221,19 +207,19 @@ class ServerController extends AbstractServerController {
}
$notifications = array('email', 'sms', 'pushover');
$this->tpl->newTemplate('server_update_warning', 'server/server.tpl.html');
foreach($notifications as $notification) {
if(psm_get_conf($notification . '_status') == 0) {
$tpl_data['warning_' . $notification] = true;
$tpl_data['control_class_' . $notification] = 'warning';
$tpl_data['warning_' . $notification] = $this->tpl->addTemplateData(
$this->tpl->getTemplate('server_update_warning'),
array('label_warning' => psm_get_lang('servers', 'warning_notifications_disabled_' . $notification)),
true
$tpl_data['label_warning_' . $notification] = psm_get_lang(
'servers', 'warning_notifications_disabled_' . $notification
);
} else {
$tpl_data['warning_' . $notification] = false;
}
}
$this->tpl->addTemplateData($this->getTemplateId(), $tpl_data);
return $this->twig->render('module/server/server/update.tpl.html', $tpl_data);
}
/**
@ -312,9 +298,9 @@ class ServerController extends AbstractServerController {
$back_to = isset($_GET['back_to']) ? $_GET['back_to'] : 'index';
if($back_to == 'view') {
$this->initializeAction('view');
return $this->initializeAction('view');
} else {
$this->initializeAction('index');
return $this->initializeAction('index');
}
}
@ -335,7 +321,7 @@ class ServerController extends AbstractServerController {
}
$this->addMessage(psm_get_lang('servers', 'deleted'), 'success');
}
$this->initializeAction('index');
return $this->initializeAction('index');
}
/**
@ -351,27 +337,19 @@ class ServerController extends AbstractServerController {
return $this->initializeAction('index');
}
$this->setTemplateId('server_view', 'server/view.tpl.html');
$tpl_data = $this->formatServer($server);
$tpl_data = $this->getLabels();
$tpl_data = array_merge($tpl_data, $this->formatServer($server));
// create history HTML
$history = new \psm\Util\Server\HistoryGraph($this->db, $this->tpl);
$history = new \psm\Util\Server\HistoryGraph($this->db, $this->twig);
$tpl_data['html_history'] = $history->createHTML($this->server_id);
// add edit/delete buttons for admins
if($this->user->getUserLevel() == PSM_USER_ADMIN) {
$tpl_id_actions = 'server_view_admin_actions';
$this->tpl->newTemplate($tpl_id_actions, 'server/view.tpl.html');
// template magic: push the actions html to the front of the server array
// so the template handler will add it first. that way the other server vars
// will also be replaced in the html_actions template itself
$tpl_data = array('html_actions' => $this->tpl->getTemplate($tpl_id_actions)) + $tpl_data;
$tpl_data['has_admin_actions'] = true;
$tpl_data['url_edit'] = psm_build_url(array('mod' => 'server', 'action' => 'edit', 'id' => $this->server_id, 'back_to' => 'view'));
$tpl_data['server_name'] = $server['label'];
$modal = new \psm\Util\Module\Modal($this->tpl, 'delete', \psm\Util\Module\Modal::MODAL_TYPE_DANGER);
$modal = new \psm\Util\Module\Modal($this->twig, 'delete', \psm\Util\Module\Modal::MODAL_TYPE_DANGER);
$this->addModal($modal);
$modal->setTitle(psm_get_lang('servers', 'delete_title'));
$modal->setMessage(psm_get_lang('servers', 'delete_message'));
@ -380,17 +358,16 @@ class ServerController extends AbstractServerController {
// add all available servers to the menu
$servers = $this->getServers();
$options = array();
$tpl_data['options'] = array();
foreach($servers as $i => $server_available) {
$options[] = array(
$tpl_data['options'][] = array(
'class_active' => ($server_available['server_id'] == $this->server_id) ? 'active' : '',
'url' => psm_build_url(array('mod' => 'server', 'action' => 'view', 'id' => $server_available['server_id'])),
'label' => $server_available['label'],
);
}
$this->tpl->addTemplateDataRepeat($this->getTemplateId(), 'options', $options);
$sidebar = new \psm\Util\Module\Sidebar($this->tpl);
$sidebar = new \psm\Util\Module\Sidebar($this->twig);
$this->setSidebar($sidebar);
// check which module the user came from, and add a link accordingly
@ -402,51 +379,44 @@ class ServerController extends AbstractServerController {
'th-list'
);
$this->tpl->addTemplateData($this->getTemplateId(), $tpl_data);
return $this->twig->render('module/server/server/view.tpl.html', $tpl_data);
}
// override parent::createHTMLLabels()
protected function createHTMLLabels() {
$this->tpl->addTemplateData(
$this->getTemplateId(),
array(
'subtitle' => psm_get_lang('menu', 'server'),
'label_label' => psm_get_lang('servers', 'label'),
'label_status' => psm_get_lang('servers', 'status'),
'label_domain' => psm_get_lang('servers', 'domain'),
'label_timeout' => psm_get_lang('servers', 'timeout'),
'label_timeout_description' => psm_get_lang('servers', 'timeout_description'),
'label_port' => psm_get_lang('servers', 'port'),
'label_type' => psm_get_lang('servers', 'type'),
'label_website' => psm_get_lang('servers', 'type_website'),
'label_service' => psm_get_lang('servers', 'type_service'),
'label_type' => psm_get_lang('servers', 'type'),
'label_pattern' => psm_get_lang('servers', 'pattern'),
'label_pattern_description' => psm_get_lang('servers', 'pattern_description'),
'label_last_check' => psm_get_lang('servers', 'last_check'),
'label_rtime' => psm_get_lang('servers', 'latency'),
'label_last_online' => psm_get_lang('servers', 'last_online'),
'label_monitoring' => psm_get_lang('servers', 'monitoring'),
'label_email' => psm_get_lang('servers', 'email'),
'label_send_email' => psm_get_lang('servers', 'send_email'),
'label_sms' => psm_get_lang('servers', 'sms'),
'label_send_sms' => psm_get_lang('servers', 'send_sms'),
'label_pushover' => psm_get_lang('servers', 'pushover'),
'label_users' => psm_get_lang('servers', 'users'),
'label_warning_threshold' => psm_get_lang('servers', 'warning_threshold'),
'label_warning_threshold_description' => psm_get_lang('servers', 'warning_threshold_description'),
'label_action' => psm_get_lang('system', 'action'),
'label_save' => psm_get_lang('system', 'save'),
'label_go_back' => psm_get_lang('system', 'go_back'),
'label_edit' => psm_get_lang('system', 'edit'),
'label_delete' => psm_get_lang('system', 'delete'),
'label_yes' => psm_get_lang('system', 'yes'),
'label_no' => psm_get_lang('system', 'no'),
'label_add_new' => psm_get_lang('system', 'add_new'),
)
protected function getLabels() {
return array(
'label_label' => psm_get_lang('servers', 'label'),
'label_status' => psm_get_lang('servers', 'status'),
'label_domain' => psm_get_lang('servers', 'domain'),
'label_timeout' => psm_get_lang('servers', 'timeout'),
'label_timeout_description' => psm_get_lang('servers', 'timeout_description'),
'label_port' => psm_get_lang('servers', 'port'),
'label_type' => psm_get_lang('servers', 'type'),
'label_website' => psm_get_lang('servers', 'type_website'),
'label_service' => psm_get_lang('servers', 'type_service'),
'label_type' => psm_get_lang('servers', 'type'),
'label_pattern' => psm_get_lang('servers', 'pattern'),
'label_pattern_description' => psm_get_lang('servers', 'pattern_description'),
'label_last_check' => psm_get_lang('servers', 'last_check'),
'label_rtime' => psm_get_lang('servers', 'latency'),
'label_last_online' => psm_get_lang('servers', 'last_online'),
'label_monitoring' => psm_get_lang('servers', 'monitoring'),
'label_email' => psm_get_lang('servers', 'email'),
'label_send_email' => psm_get_lang('servers', 'send_email'),
'label_sms' => psm_get_lang('servers', 'sms'),
'label_send_sms' => psm_get_lang('servers', 'send_sms'),
'label_pushover' => psm_get_lang('servers', 'pushover'),
'label_users' => psm_get_lang('servers', 'users'),
'label_warning_threshold' => psm_get_lang('servers', 'warning_threshold'),
'label_warning_threshold_description' => psm_get_lang('servers', 'warning_threshold_description'),
'label_action' => psm_get_lang('system', 'action'),
'label_save' => psm_get_lang('system', 'save'),
'label_go_back' => psm_get_lang('system', 'go_back'),
'label_edit' => psm_get_lang('system', 'edit'),
'label_delete' => psm_get_lang('system', 'delete'),
'label_yes' => psm_get_lang('system', 'yes'),
'label_no' => psm_get_lang('system', 'no'),
'label_add_new' => psm_get_lang('system', 'add_new'),
);
return parent::createHTMLLabels();
}
/**

View File

@ -28,15 +28,14 @@
namespace psm\Module\Server\Controller;
use psm\Service\Database;
use psm\Service\Template;
/**
* Status module
*/
class StatusController extends AbstractServerController {
function __construct(Database $db, Template $tpl) {
parent::__construct($db, $tpl);
function __construct(Database $db, \Twig_Environment $twig) {
parent::__construct($db, $twig);
$this->setActions(array('index', 'saveLayout'), 'index');
}
@ -48,28 +47,26 @@ class StatusController extends AbstractServerController {
protected function executeIndex() {
// set background color to black
$this->black_background = true;
$this->twig->addGlobal('subtitle', psm_get_lang('menu', 'server_status'));
// add header accessories
$layout = $this->user->getUserPref('status_layout', 0);
$layout_data = array(
'label_last_check' => psm_get_lang('servers', 'last_check'),
'label_last_online' => psm_get_lang('servers', 'last_online'),
'label_rtime' => psm_get_lang('servers', 'latency'),
'block_layout_active' => ($layout == 0) ? 'active' : '',
'list_layout_active' => ($layout != 0) ? 'active' : '',
);
$this->tpl->newTemplate('status_layout_selector', 'server/status.tpl.html');
$this->tpl->addTemplateData('status_layout_selector', $layout_data);
$html_accessories = $this->tpl->getTemplate('status_layout_selector');
$this->setHeaderAccessories($html_accessories);
$this->setTemplateId('server_status', 'server/status.tpl.html');
$this->setHeaderAccessories($this->twig->render('module/server/status/header.tpl.html', $layout_data));
$this->addFooter(false);
$this->tpl->addTemplateData($this->getTemplateId(), $layout_data);
// get the active servers from database
$servers = $this->getServers();
$offline = array();
$online = array();
$layout_data['servers_offline'] = array();
$layout_data['servers_online'] = array();
foreach ($servers as $server) {
if($server['active'] == 'no') {
@ -80,36 +77,28 @@ class StatusController extends AbstractServerController {
$server['url_view'] = psm_build_url(array('mod' => 'server', 'action' => 'view', 'id' => $server['server_id'], 'back_to' => 'server_status'));
if ($server['status'] == "off") {
$offline[$server['server_id']] = $server;
$layout_data['servers_offline'][] = $server;
} elseif($server['warning_threshold_counter'] > 0) {
$server['class_warning'] = 'warning';
$offline[$server['server_id']] = $server;
$layout_data['servers_offline'][] = $server;
} else {
$online[$server['server_id']] = $server;
$layout_data['servers_online'][] = $server;
}
}
// add servers to template
$this->tpl->addTemplateDataRepeat($this->getTemplateId(), 'servers_offline', $offline);
$this->tpl->addTemplateDataRepeat($this->getTemplateId(), 'servers_online', $online);
$this->tpl->addTemplateDataRepeat($this->getTemplateId(), 'servers_offline2', $offline);
$this->tpl->addTemplateDataRepeat($this->getTemplateId(), 'servers_online2', $online);
// check if we need to add the auto refresh
$auto_refresh = psm_get_conf('auto_refresh_servers');
if(intval($auto_refresh) > 0) {
// add it
$this->tpl->newTemplate('main_auto_refresh', 'main.tpl.html');
$this->tpl->addTemplateData('main_auto_refresh', array('seconds' => $auto_refresh));
$this->tpl->addTemplateData('main', array('auto_refresh' => $this->tpl->getTemplate('main_auto_refresh')));
$auto_refresh_seconds = psm_get_conf('auto_refresh_servers');
if(intval($auto_refresh_seconds) > 0) {
$this->twig->addGlobal('auto_refresh', true);
$this->twig->addGlobal('auto_refresh_seconds', $auto_refresh_seconds);
}
return $this->twig->render('module/server/status/index.tpl.html', $layout_data);
}
protected function executeSaveLayout() {
if($this->isXHR()) {
$layout = psm_POST('layout', 0);
$this->user->setUserPref('status_layout', $layout);
$response = new \Symfony\Component\HttpFoundation\JsonResponse();
$response->setData(array(
'layout' => $layout,
@ -117,18 +106,4 @@ class StatusController extends AbstractServerController {
return $response;
}
}
protected function createHTMLLabels() {
$this->tpl->addTemplateData(
$this->getTemplateId(),
array(
'subtitle' => psm_get_lang('menu', 'server_status'),
'label_last_check' => psm_get_lang('servers', 'last_check'),
'label_last_online' => psm_get_lang('servers', 'last_online'),
'label_rtime' => psm_get_lang('servers', 'latency'),
)
);
return parent::createHTMLLabels();
}
}

View File

@ -30,12 +30,11 @@
namespace psm\Module\Server\Controller;
use psm\Module\AbstractController;
use psm\Service\Database;
use psm\Service\Template;
class UpdateController extends AbstractController {
function __construct(Database $db, Template $tpl) {
parent::__construct($db, $tpl);
function __construct(Database $db, \Twig_Environment $twig) {
parent::__construct($db, $twig);
$this->setActions('index', 'index');
}

View File

@ -29,12 +29,11 @@
namespace psm\Module\User\Controller;
use psm\Module\AbstractController;
use psm\Service\Database;
use psm\Service\Template;
class LoginController extends AbstractController {
function __construct(Database $db, Template $tpl) {
parent::__construct($db, $tpl);
function __construct(Database $db, \Twig_Environment $twig) {
parent::__construct($db, $twig);
$this->setMinUserLevelRequired(PSM_USER_ANONYMOUS);
@ -46,8 +45,6 @@ class LoginController extends AbstractController {
}
protected function executeLogin() {
$this->setTemplateId('user_login', 'user/login.tpl.html');
if(isset($_POST['user_name']) && isset($_POST['user_password'])) {
$rememberme = (isset($_POST['user_rememberme'])) ? true : false;
$result = $this->user->loginWithPostData(
@ -76,15 +73,15 @@ class LoginController extends AbstractController {
'value_rememberme' => (isset($rememberme) && $rememberme) ? 'checked="checked"' : '',
);
$this->tpl->addTemplateData($this->getTemplateId(), $tpl_data);
return $this->twig->render('module/user/login/login.tpl.html', $tpl_data);
}
/**
* Show/process the password forgot form (before the mail)
*
* @return string
*/
protected function executeForgot() {
$this->setTemplateId('user_login_forgot', 'user/login.tpl.html');
if(isset($_POST['user_name'])) {
$user = $this->user->getUserByUsername($_POST['user_name']);
@ -110,16 +107,13 @@ class LoginController extends AbstractController {
'label_submit' => psm_get_lang('login', 'submit'),
'label_go_back' => psm_get_lang('system', 'go_back'),
);
$this->tpl->addTemplateData($this->getTemplateId(), $tpl_data);
return $this->twig->render('module/user/login/forgot.tpl.html', $tpl_data);
}
/**
* Show/process the password reset form (after the mail)
*/
protected function executeReset() {
$this->setTemplateId('user_login_reset', 'user/login.tpl.html');
$user_id = (isset($_GET['user_id'])) ? intval($_GET['user_id']) : 0;
$token = (isset($_GET['token'])) ? $_GET['token'] : '';
@ -153,8 +147,7 @@ class LoginController extends AbstractController {
'label_go_back' => psm_get_lang('system', 'go_back'),
'value_user_name' => $user->user_name,
);
$this->tpl->addTemplateData($this->getTemplateId(), $tpl_data);
return $this->twig->render('module/user/login/reset.tpl.html', $tpl_data);
}
/**

View File

@ -28,7 +28,6 @@
namespace psm\Module\User\Controller;
use psm\Module\AbstractController;
use psm\Service\Database;
use psm\Service\Template;
class ProfileController extends AbstractController {
@ -38,8 +37,8 @@ class ProfileController extends AbstractController {
*/
protected $profile_fields = array('name', 'user_name', 'mobile', 'pushover_key', 'pushover_device', 'email');
function __construct(Database $db, Template $tpl) {
parent::__construct($db, $tpl);
function __construct(Database $db, \Twig_Environment $twig) {
parent::__construct($db, $twig);
$this->setActions(array(
'index', 'save',
@ -48,13 +47,26 @@ class ProfileController extends AbstractController {
/**
* Show the profile page
* @return string
*/
protected function executeIndex() {
$this->setTemplateId('user_profile', 'user/profile.tpl.html');
$this->twig->addGlobal('subtitle', psm_get_lang('users', 'profile'));
$user = $this->user->getUser(null, true);
$tpl_data = array(
'label_name' => psm_get_lang('users', 'name'),
'label_user_name' => psm_get_lang('users', 'user_name'),
'label_password' => psm_get_lang('users', 'password'),
'label_password_repeat' => psm_get_lang('users', 'password_repeat'),
'label_level' => psm_get_lang('users', 'level'),
'label_mobile' => psm_get_lang('users', 'mobile'),
'label_pushover' => psm_get_lang('users', 'pushover'),
'label_pushover_description' => psm_get_lang('users', 'pushover_description'),
'label_pushover_key' => psm_get_lang('users', 'pushover_key'),
'label_pushover_device' => psm_get_lang('users', 'pushover_device'),
'label_pushover_device_description' => psm_get_lang('users', 'pushover_device_description'),
'label_email' => psm_get_lang('users', 'email'),
'label_save' => psm_get_lang('system', 'save'),
'form_action' => psm_build_url(array(
'mod' => 'user_profile',
'action' => 'save',
@ -65,7 +77,7 @@ class ProfileController extends AbstractController {
foreach($this->profile_fields as $field) {
$tpl_data[$field] = (isset($user->$field)) ? $user->$field : '';
}
$this->tpl->addTemplateData($this->getTemplateId(), $tpl_data);
return $this->twig->render('module/user/profile.tpl.html', $tpl_data);
}
/**
@ -119,29 +131,4 @@ class ProfileController extends AbstractController {
return $this->executeIndex();
}
// override parent::createHTMLLabels()
protected function createHTMLLabels() {
$this->tpl->addTemplateData(
$this->getTemplateId(),
array(
'subtitle' => psm_get_lang('users', 'profile'),
'label_name' => psm_get_lang('users', 'name'),
'label_user_name' => psm_get_lang('users', 'user_name'),
'label_password' => psm_get_lang('users', 'password'),
'label_password_repeat' => psm_get_lang('users', 'password_repeat'),
'label_level' => psm_get_lang('users', 'level'),
'label_mobile' => psm_get_lang('users', 'mobile'),
'label_pushover' => psm_get_lang('users', 'pushover'),
'label_pushover_description' => psm_get_lang('users', 'pushover_description'),
'label_pushover_key' => psm_get_lang('users', 'pushover_key'),
'label_pushover_device' => psm_get_lang('users', 'pushover_device'),
'label_pushover_device_description' => psm_get_lang('users', 'pushover_device_description'),
'label_email' => psm_get_lang('users', 'email'),
'label_save' => psm_get_lang('system', 'save'),
)
);
return parent::createHTMLLabels();
}
}

View File

@ -28,7 +28,6 @@
namespace psm\Module\User\Controller;
use psm\Module\AbstractController;
use psm\Service\Database;
use psm\Service\Template;
/**
* User module. Add, edit and delete users, or assign
@ -43,14 +42,15 @@ class UserController extends AbstractController {
*/
protected $user_validator;
function __construct(Database $db, Template $tpl) {
parent::__construct($db, $tpl);
function __construct(Database $db, \Twig_Environment $twig) {
parent::__construct($db, $twig);
$this->setMinUserLevelRequired(PSM_USER_ADMIN);
$this->setActions(array(
'index', 'edit', 'delete', 'save',
), 'index');
$this->twig->addGlobal('subtitle', psm_get_lang('menu', 'user'));
}
public function initialize() {
@ -65,11 +65,12 @@ class UserController extends AbstractController {
}
/**
* Prepare the template to show a list of all users
* Create HTML to show a list of all users
*
* @return string
*/
protected function executeIndex() {
$this->setTemplateId('user_list', 'user/user.tpl.html');
$sidebar = new \psm\Util\Module\Sidebar($this->tpl);
$sidebar = new \psm\Util\Module\Sidebar($this->twig);
$this->setSidebar($sidebar);
$sidebar->addButton(
@ -79,7 +80,7 @@ class UserController extends AbstractController {
'plus icon-white', 'success'
);
$modal = new \psm\Util\Module\Modal($this->tpl, 'delete', \psm\Util\Module\Modal::MODAL_TYPE_DANGER);
$modal = new \psm\Util\Module\Modal($this->twig, 'delete', \psm\Util\Module\Modal::MODAL_TYPE_DANGER);
$this->addModal($modal);
$modal->setTitle(psm_get_lang('users', 'delete_title'));
$modal->setMessage(psm_get_lang('users', 'delete_message'));
@ -102,15 +103,17 @@ class UserController extends AbstractController {
foreach($users as $x => &$user) {
$user_servers = $this->getUserServers($user['user_id']);
$user['class'] = ($x & 1) ? 'odd' : 'even';
$user['level_text'] = psm_get_lang('users', 'level_' . $user['level']);
$user['emp_servers'] = '';
$user['emp_servers'] = array();
// fix server list
foreach($user_servers as $server_id) {
if (!isset($servers_labels[$server_id])) continue;
$user['emp_servers'] .= $servers_labels[$server_id] . '<br/>';
$user['emp_servers'][] = array(
'label' => $servers_labels[$server_id]
);
}
$user['emp_servers'] = substr($user['emp_servers'], 0, -5);
$user['url_delete'] = psm_build_url(array(
'mod' => 'user',
@ -123,14 +126,18 @@ class UserController extends AbstractController {
'id' => $user['user_id'],
));
}
$this->tpl->addTemplateDataRepeat($this->getTemplateId(), 'users', $users);
$tpl_data = $this->getLabels();
$tpl_data['users'] = $users;
return $this->twig->render('module/user/user/list.tpl.html', $tpl_data);
}
/**
* Prepare the template to show the update screen for a user
* Crate HTML for the update screen for a user
*
* @return string
*/
protected function executeEdit() {
$this->setTemplateId('user_update', 'user/user.tpl.html');
$user_id = isset($_GET['id']) ? intval($_GET['id']) : 0;
$fields_prefill = array('name', 'user_name', 'mobile', 'pushover_key', 'pushover_device', 'email');
@ -182,6 +189,8 @@ class UserController extends AbstractController {
'action' => 'save',
'id' => $user_id,
)),
'servers' => $this->servers,
'user_level' => $lvl_selected,
);
foreach($fields_prefill as $field) {
if(isset($edit_user->$field)) {
@ -189,17 +198,17 @@ class UserController extends AbstractController {
}
}
$ulvls_tpl = array();
$tpl_data['levels'] = array();
foreach($this->user_validator->getUserLevels() as $lvl) {
$ulvls_tpl[] = array(
$tpl_data['levels'][] = array(
'value' => $lvl,
'label' => psm_get_lang('users', 'level_' . $lvl),
'selected' => ($lvl == $lvl_selected) ? 'selected="selected"' : '',
);
}
$this->tpl->addTemplateDataRepeat($this->getTemplateId(), 'levels', $ulvls_tpl);
$this->tpl->addTemplateDataRepeat($this->getTemplateId(), 'servers', $this->servers);
$this->tpl->addTemplateData($this->getTemplateId(), $tpl_data);
$tpl_data = array_merge($this->getLabels(), $tpl_data);
return $this->twig->render('module/user/user/update.tpl.html', $tpl_data);
}
/**
@ -299,42 +308,31 @@ class UserController extends AbstractController {
return $this->executeIndex();
}
// override parent::createHTMLLabels()
protected function createHTMLLabels() {
$this->tpl->addTemplateData(
$this->getTemplateId(),
array(
'subtitle' => psm_get_lang('menu', 'user'),
'label_users' => psm_get_lang('menu', 'users'),
'label_user' => psm_get_lang('users', 'user'),
'label_name' => psm_get_lang('users', 'name'),
'label_user_name' => psm_get_lang('users', 'user_name'),
'label_password' => psm_get_lang('users', 'password'),
'label_password_repeat' => psm_get_lang('users', 'password_repeat'),
'label_level' => psm_get_lang('users', 'level'),
'label_level_10' => psm_get_lang('users', 'level_10'),
'label_level_20' => psm_get_lang('users', 'level_20'),
'label_level_description' => psm_get_lang('users', 'level_description'),
'label_mobile' => psm_get_lang('users', 'mobile'),
'label_pushover' => psm_get_lang('users', 'pushover'),
'label_pushover_description' => psm_get_lang('users', 'pushover_description'),
'label_pushover_key' => psm_get_lang('users', 'pushover_key'),
'label_pushover_device' => psm_get_lang('users', 'pushover_device'),
'label_pushover_device_description' => psm_get_lang('users', 'pushover_device_description'),
'label_email' => psm_get_lang('users', 'email'),
'label_servers' => psm_get_lang('menu', 'server'),
'label_action' => psm_get_lang('system', 'action'),
'label_save' => psm_get_lang('system', 'save'),
'label_go_back' => psm_get_lang('system', 'go_back'),
'label_edit' => psm_get_lang('system', 'edit'),
'label_delete' => psm_get_lang('system', 'delete'),
'label_add_new' => psm_get_lang('system', 'add_new'),
'icon_level_10' => 'icon-admin',
'icon_level_20' => 'icon-user',
)
protected function getLabels() {
return array(
'label_users' => psm_get_lang('menu', 'users'),
'label_user' => psm_get_lang('users', 'user'),
'label_name' => psm_get_lang('users', 'name'),
'label_user_name' => psm_get_lang('users', 'user_name'),
'label_password' => psm_get_lang('users', 'password'),
'label_password_repeat' => psm_get_lang('users', 'password_repeat'),
'label_level' => psm_get_lang('users', 'level'),
'label_level_description' => psm_get_lang('users', 'level_description'),
'label_mobile' => psm_get_lang('users', 'mobile'),
'label_pushover' => psm_get_lang('users', 'pushover'),
'label_pushover_description' => psm_get_lang('users', 'pushover_description'),
'label_pushover_key' => psm_get_lang('users', 'pushover_key'),
'label_pushover_device' => psm_get_lang('users', 'pushover_device'),
'label_pushover_device_description' => psm_get_lang('users', 'pushover_device_description'),
'label_email' => psm_get_lang('users', 'email'),
'label_servers' => psm_get_lang('menu', 'server'),
'label_action' => psm_get_lang('system', 'action'),
'label_save' => psm_get_lang('system', 'save'),
'label_go_back' => psm_get_lang('system', 'go_back'),
'label_edit' => psm_get_lang('system', 'edit'),
'label_delete' => psm_get_lang('system', 'delete'),
'label_add_new' => psm_get_lang('system', 'add_new'),
);
return parent::createHTMLLabels();
}
/**

View File

@ -64,9 +64,14 @@ class Router {
public function __construct() {
global $db;
$this->services['db'] = $db;
$this->services['tpl'] = new \psm\Service\Template();
$this->services['user'] = new \psm\Service\User($db);
$loader = new \Twig_Loader_Filesystem(PSM_PATH_TPL . PSM_THEME);
$this->services['twig'] = new \Twig_Environment($loader);
if(PSM_DEBUG) {
$this->services['twig']->enableDebug();
}
$modules = $this->getModules();
foreach($modules as $id => $module) {
@ -156,7 +161,7 @@ class Router {
if($controller === false) {
throw new \InvalidArgumentException('Controller is not registered');
}
$controller = new $controller($this->services['db'], $this->services['tpl']);
$controller = new $controller($this->services['db'], $this->services['twig']);
if(!$controller instanceof \psm\Module\ControllerInterface) {
throw new \Exception('Controller does not use ControllerInterface');

View File

@ -1,307 +0,0 @@
<?php
/**
* PHP Server Monitor
* Monitor your servers and websites.
*
* This file is part of PHP Server Monitor.
* PHP Server Monitor is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* PHP Server Monitor is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with PHP Server Monitor. If not, see <http://www.gnu.org/licenses/>.
*
* @package phpservermon
* @author Pepijn Over <pep@neanderthal-technology.com>
* @copyright Copyright (c) 2008-2014 Pepijn Over <pep@neanderthal-technology.com>
* @license http://www.gnu.org/licenses/gpl.txt GNU GPL v3
* @version Release: @package_version@
* @link http://www.phpservermonitor.org/
**/
namespace psm\Service;
class Template {
/**
* Loaded templates
* @var array $templates
*/
protected $templates = array();
/**
* Cache of parsed files
* @var array $files_parsed
* @see parseFile()
*/
protected $files_parsed = array();
function __construct() {
// add the main template
$this->newTemplate('main', 'main.tpl.html');
}
/**
* Add template
*
* @param string $id template id used in the tpl file (<!--%tpl_ID-->html<!--%%tpl_ID-->)
* @param string $filename path to template file, or if file is located in the default template dir just the filename
* @return mixed false if template cannot be found, html code on success
*/
public function newTemplate($id, $filename) {
if (file_exists($filename)) {
$this->templates[$id] = $this->parseFile($filename);
} elseif (file_exists(PSM_PATH_TPL.$filename)) {
$this->templates[$id] = $this->parseFile(PSM_PATH_TPL.$filename);
} else {
// file does not exist
trigger_error('Template not found with id: '.$id.' and filename: '.$filename);
return false;
}
$use_tpl = null;
// only get data from the file that's between the tpl id tags with this id
// find "tpl_{$row_id}" in the current template
//preg_match_all('{<!--%(.+?)-->(.*?)<!--%%\\1-->}is', $this->templates[$id], $matches);
preg_match_all("{<!--%tpl_{$id}-->(.*?)<!--%%tpl_{$id}-->}is", $this->templates[$id], $matches);
// no repeat tpl found? skip to next one
if (empty($matches)) return false;
// check if the row_id is in one of the matches (aka whether the supplied row id actually has a template in this file)
if (isset($matches[1][0])) {
$use_tpl = $matches[1][0];
}
// no template with the given id found..
if ($use_tpl === null) return false;
// remove tpl code tags from original template so it won't be in the source
$this->templates[$id] = preg_replace("{<!--%tpl_".$id."-->(.*?)<!--%%tpl_".$id."-->}is", "", $use_tpl);
return $this->templates[$id];
}
/**
* Add data to the template
*
* @param string $tpl_id template_id used by add_template()
* @param array $data
* @param boolean $use_html if true, $tpl_id is considered to be HTML code and used rather than a template
* @return string new template
*/
public function addTemplateData($tpl_id, $data, $use_html = false) {
if($use_html) {
// no template
$source = $tpl_id;
} else {
// does the template exist?
if (!isset($this->templates[$tpl_id])) {
// file does not exist
trigger_error("Template '{$tpl_id}' could not be found", E_USER_WARNING);
return false;
}
$source =& $this->templates[$tpl_id];
}
foreach($data as $key => $value) {
if(is_array($value)) {
$subdata = array();
foreach($value as $k => $v) {
$subdata[$key.'_'.$k] = $v;
}
$source = $this->addTemplateData($source, $subdata, true);
} else {
if(substr($key, 0, 1) == '?') {
$key = substr($key, 1);
// replace if statements
$if_replacement = empty($value) ? '' : '$1';
$source = preg_replace('{<!--\?'.$key.'-->(.*?)<!--\?\?'.$key.'-->}is', $if_replacement, $source);
}
$source = str_replace('{'.$key.'}', $value, $source);
}
}
return $source;
}
/**
* Add repeat rows to template.
* It's possible to create a nested repeat tpl. All you need to do is to create a subarray
* For example:
* $data = array(
* 0 => array(
* 'name' => 'Test',
* 'subdata' => array(
* 0 => array(
* 'name' => 'Subtest 1',
* ),
* 1 => array(...)
* ),
* ),
* );
* In your template you would literally put the nested repeat inside the first repeat.
* If you have more than 1 nested array, the first subtemplate will be used for all others.
*
* @param string $id template id used by add_template() or html code in case of repeat-repeat tpl
* @param string $repeat_id ID used in template file for the repeat template: <!--%tpl_repeat_ID-->html<!--%%tpl_repeat_ID-->
* @param array $data
* @param boolean $use_html can only be used from within this function for recursive repeat templating. in this case the $id is the html code
* @param int $level starts off with 0. if level=2, current repeat template will be used again for subs, so you can go all the way
* @param int $level_reuse_prev from what level should we start repeating the current template for more subrecords, so we can go all the way?
* @return mixed false if repeat template cannot be found, html code on success
*/
public function addTemplateDataRepeat($tpl_id, $repeat_id, $data, $use_html = false, $level = 0, $level_reuse_prev = 2) {
if($use_html) {
$source = $tpl_id;
} else {
// does the template exist?
if (!isset($this->templates[$tpl_id])) {
// file does not exist
trigger_error("Template '{$tpl_id}' could not be found", E_USER_WARNING);
return false;
}
$source =& $this->templates[$tpl_id];
}
if($level < $level_reuse_prev) {
// find "tpl_repeat_{$repeat_id}_" in the current template
preg_match_all("{<!--%tpl_repeat_{$repeat_id}-->(.*?)<!--%%tpl_repeat_{$repeat_id}-->}is", $source, $matches);
// check if the repeat_id is in one of the matches
if (isset($matches[1][0])) {
$use_tpl = $matches[1][0];
} else {
// if we didn't find a repeat template for the repeat_id supplied, skip the rest..
return false;
}
// remove repeat tpl code from original template so it won't be in the source
$source = preg_replace("{<!--%tpl_repeat_".$repeat_id."-->(.*?)<!--%%tpl_repeat_".$repeat_id."-->}is", "", $source);
} else {
$use_tpl = $source;
}
// now lets go through all the records supplied and put them in the HTML repeat code we just found
$result = '';
foreach($data as $record) {
$tmp_string = $use_tpl;
if(!is_array($record)) {
$record = array(
'value' => $record,
);
}
// multi dim array
foreach($record as $k => $v) {
if(is_array($v)) {
// nested repeat
if(isset($v[0]) && is_array($v[0])) {
// repeat template in a repeat template
$repeat_html = $this->addTemplateDataRepeat($use_tpl, $k, $v, true, ($level + 1), $level_reuse_prev);
$tmp_string = str_replace('{'.$k.'}', $repeat_html, $tmp_string);
} else {
foreach($v as $vk => $vv) {
if(substr($vk, 0, 1) == '?') {
$vk = substr($vk, 1);
// replace if statements
$if_replacement = empty($vv) ? '' : '$1';
$tmp_string = preg_replace('{<!--\?'.$k.'_'.$vk.'-->(.*?)<!--\?\?'.$k.'_'.$vk.'-->}is', $if_replacement, $tmp_string);
}
$tmp_string = str_replace('{'.$k.'_'.$vk.'}', $vv, $tmp_string);
}
}
} else {
if(substr($k, 0, 1) == '?') {
$k = substr($k, 1);
// replace if statements
$if_replacement = empty($v) ? '' : '$1';
$tmp_string = preg_replace('{<!--\?'.$k.'-->(.*?)<!--\?\?'.$k.'-->}is', $if_replacement, $tmp_string);
}
$tmp_string = str_replace('{'.$k.'}', $v, $tmp_string);
}
}
$result .= $tmp_string.PHP_EOL;
}
if($use_html === false) {
// add to main template..
return $this->addTemplateData($tpl_id, array($repeat_id => $result));
} else {
return $result;
}
}
public function display($id) {
// check if there are any unused tpl_repeat templates, and if there are remove them
$result = preg_replace('{<!--%(.+?)-->(.*?)<!--%%\\1-->}is', '', $this->templates[$id]);
// check if there are any unused if, and if there are remove them
$result = preg_replace('{<!--\?(.+?)-->(.*?)<!--\?\?\\1-->}is', '', $result);
// check for tpl variables that have not been replaced. ie: {name}. ignore literal stuff, though. ie: {{name}} is {name} and should not be removed
preg_match_all('~{?{(\w+?)}}?~', $result, $matches);
foreach($matches[0] as $match) {
if (substr($match, 0, 2) == '{{') {
// literal! remove only first and last bracket!
$result = str_replace($match, substr($match, 1, -1), $result);
} else {
// unused variable, remove completely
$result = str_replace($match, '', $result);
}
}
return $result;
}
/**
* Get html code for a template, or if no template id given get all templates
*
* @param string $template_id
* @return mixed string when ID given, else array
*/
public function getTemplate($template_id = null) {
if ($template_id === null) {
return $this->templates;
} elseif (isset($this->templates[$template_id])) {
return $this->templates[$template_id];
} else {
return false;
}
}
/**
*
* Get file content
*
* @param string $filename filename
* @return string file contents
*/
protected function parseFile($filename) {
if (!file_exists($filename)) return false;
if(isset($this->files_parsed[$filename])) {
return $this->files_parsed[$filename];
}
ob_start();
include($filename);
$file_content = ob_get_contents();
ob_end_clean();
$this->files_parsed[$filename] = $file_content;
return $file_content;
}
}

View File

@ -27,52 +27,51 @@
**/
namespace psm\Util\Module;
use psm\Service\Template;
class Modal implements ModalInterface {
const MODAL_TYPE_OK = 0;
const MODAL_TYPE_OKCANCEL = 1;
const MODAL_TYPE_DANGER = 2;
/**
* Template service
* @var \psm\Service\Template $tpl
*/
protected $tpl;
/**
* prefix used for modal dialog box elements
* @var string $modal_id
* @var string $modal_id
*/
protected $modal_id;
/**
* @var int $type Type of modal dialog
* @var int $type Type of modal dialog
*/
protected $type;
/**
* Modal dialog title
* @var string $title
*/
protected $title;
/**
* Modal dialog message
* @var string $body
*/
protected $message;
/**
* label of the OK button
* @var string $ok_label
*/
protected $ok_label;
public function __construct(Template $tpl, $modal_id = 'main', $type = self::MODAL_TYPE_OK ) {
/**
* Twig environment
* @var \Twig_Environment $twig
*/
protected $twig;
public function __construct(\Twig_Environment $twig, $modal_id = 'main', $type = self::MODAL_TYPE_OK ) {
$this->modal_id = $modal_id;
$this->tpl = $tpl;
$this->twig = $twig;
$this->type = $type;
}
@ -83,7 +82,7 @@ class Modal implements ModalInterface {
public function getModalID() {
return $this->modal_id;
}
/**
* Set the modal dialog type
* @param int $type
@ -95,7 +94,7 @@ class Modal implements ModalInterface {
}
return $this;
}
/**
* Set the modal dialog title
* @param string $title
@ -105,7 +104,7 @@ class Modal implements ModalInterface {
$this->title = $title;
return $this;
}
/**
* Set the modal dialog message
* @param string $message
@ -115,41 +114,36 @@ class Modal implements ModalInterface {
$this->message = $message;
return $this;
}
public function setOKButtonLabel($label) {
$this->ok_label = $label;
return $this;
}
public function createHTML() {
$tpl_id = 'main_modal_container';
$this->tpl->newTemplate($tpl_id, 'main_modal.tpl.html');
public function createHTML() {
$has_cancel = ($this->type == self::MODAL_TYPE_OK) ? false : true;
$button_type = ($this->type == self::MODAL_TYPE_DANGER) ? 'danger' : 'primary';
$button_label = empty($this->ok_label) ? psm_get_lang('system', 'ok') : $this->ok_label;
$message = !empty($this->message) ? $this->message : '';
$matches = array();
if(preg_match_all('/%(\d)/', $message, $matches, PREG_SET_ORDER)) {
foreach($matches as $match) {
$message = str_replace($match[0], '<span class="modalP' . $match[1] . '"></span>', $message);
}
}
$this->tpl->addTemplateData($tpl_id, array(
'modal_id' => $this->modal_id,
'modal_title' => !empty($this->title) ? $this->title : psm_get_lang('system', 'title'),
'modal_body' => $message,
'?has_cancel' => $has_cancel,
'label_cancel' => psm_get_lang('system', 'cancel'),
$tpl = $this->twig->loadTemplate('util/module/modal.tpl.html');
$html = $tpl->render(array(
'modal_id' => $this->modal_id,
'modal_title' => !empty($this->title) ? $this->title : psm_get_lang('system', 'title'),
'modal_body' => $message,
'has_cancel' => $has_cancel,
'label_cancel' => psm_get_lang('system', 'cancel'),
'modal_button_type' => $button_type,
'modal_button_label'=> $button_label,
));
$html = $this->tpl->getTemplate($tpl_id);
return $html;
}
}
}

View File

@ -30,7 +30,7 @@ namespace psm\Util\Module;
interface ModalInterface {
public function __construct(\psm\Service\Template $tpl);
public function __construct(\Twig_Environment $twig);
public function getModalID();
public function createHTML();

View File

@ -26,7 +26,6 @@
**/
namespace psm\Util\Module;
use psm\Service\Template;
class Sidebar implements SidebarInterface {
@ -51,13 +50,13 @@ class Sidebar implements SidebarInterface {
protected $subtitle;
/**
* Template service
* @var \psm\Service\Template $tpl
* Twig environment
* @var \Twig_Environment $twig
*/
protected $tpl;
protected $twig;
public function __construct(Template $tpl) {
$this->tpl = $tpl;
public function __construct(\Twig_Environment $twig) {
$this->twig = $twig;
}
/**
@ -73,7 +72,7 @@ class Sidebar implements SidebarInterface {
/**
* Set a custom subtitle (default is module subitle)
* @param string $title
* @return \psm\Util\Moduke\Sidebar
* @return \psm\Util\Module\Sidebar
*/
public function setSubtitle($title) {
$this->subtitle = $title;
@ -154,11 +153,11 @@ class Sidebar implements SidebarInterface {
}
public function createHTML() {
$tpl_id = 'main_sidebar_container';
$this->tpl->newTemplate($tpl_id, 'main_sidebar.tpl.html');
$tpl_data = array(
'subtitle' => $this->subtitle,
);
$types = array('dropdown', 'button', 'link');
$items = array();
$tpl_data['items'] = array();
// loop through all types and build their html
foreach($types as $type) {
@ -166,37 +165,17 @@ class Sidebar implements SidebarInterface {
// no items for this type
continue;
}
// retrieve template for this type once so we can use it in the loop
$tpl_id_type = 'main_sidebar_types_' . $type;
$this->tpl->newTemplate($tpl_id_type, 'main_sidebar.tpl.html');
$html_type = $this->tpl->getTemplate($tpl_id_type);
// build html for each individual item
foreach($this->items[$type] as $id => $item) {
$html_item = $html_type;
if(isset($item['options'])) {
$item['options'] = $this->tpl->addTemplateDataRepeat($html_item, 'options', $item['options'], true);
}
$html_item = $this->tpl->addTemplateData($html_type, $item, true);
$items[] = array(
'html_item' => $html_item,
'class_active' => ($id === $this->active_id) ? 'active' : '',
);
$item['type'] = $type;
$item['class_active'] = ($id === $this->active_id) ? 'active' : '';
$tpl_data['items'][] = $item;
}
}
if(!empty($items)) {
$this->tpl->addTemplateDataRepeat($tpl_id, 'items', $items);
}
if($this->subtitle !== null) {
$this->tpl->addTemplateData($tpl_id, array(
'subtitle' => $this->subtitle,
));
}
$html = $this->tpl->getTemplate($tpl_id);
$tpl = $this->twig->loadTemplate('util/module/sidebar.tpl.html');
$html = $tpl->render($tpl_data);
return $html;
}

View File

@ -29,7 +29,7 @@ namespace psm\Util\Module;
interface SidebarInterface {
public function __construct(\psm\Service\Template $tpl);
public function __construct(\Twig_Environment $twig);
public function createHTML();

View File

@ -28,7 +28,6 @@
namespace psm\Util\Server;
use psm\Service\Database;
use psm\Service\Template;
/**
* History util, create HTML for server graphs
@ -42,14 +41,14 @@ class HistoryGraph {
protected $db;
/**
* Template service
* @var \psm\Service\Template $tpl
* Twig environment
* @var \Twig_Environment $twig
*/
protected $tpl;
protected $twig;
function __construct(Database $db, Template $tpl) {
function __construct(Database $db, \Twig_Environment $twig) {
$this->db = $db;
$this->tpl = $tpl;
$this->twig = $twig;
}
/**
@ -57,9 +56,6 @@ class HistoryGraph {
* @return string
*/
public function createHTML($server_id) {
$tpl_id = 'server_history';
$this->tpl->newTemplate($tpl_id, 'server/history.tpl.html');
$graphs = array(
0 => $this->generateGraphUptime($server_id),
1 => $this->generateGraphHistory($server_id),
@ -84,20 +80,16 @@ class HistoryGraph {
}
}
$this->tpl->addTemplateDataRepeat($tpl_id, 'graphs', $graphs);
$this->tpl->addTemplateData(
$tpl_id,
array(
'label_server' => psm_get_lang('servers', 'server'),
'day_format' => psm_get_lang('servers', 'chart_day_format'),
'long_date_format' => psm_get_lang('servers', 'chart_long_date_format'),
'short_date_format' => psm_get_lang('servers', 'chart_short_date_format'),
'short_time_format' => psm_get_lang('servers', 'chart_short_time_format'),
)
$tpl_data = array(
'graphs' => $graphs,
'label_server' => psm_get_lang('servers', 'server'),
'day_format' => psm_get_lang('servers', 'chart_day_format'),
'long_date_format' => psm_get_lang('servers', 'chart_long_date_format'),
'short_date_format' => psm_get_lang('servers', 'chart_short_date_format'),
'short_time_format' => psm_get_lang('servers', 'chart_short_time_format'),
);
return $this->tpl->getTemplate($tpl_id);
return $this->twig->render('module/server/history.tpl.html', $tpl_data);
}
/**

View File

@ -0,0 +1,79 @@
{% block header %}
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>{{ title }}</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1, minimum-scale=1">
<meta name="description" content="">
<meta name="author" content="">
<link rel="icon" type="image/x-icon" href="favicon.ico" />
<link rel="icon" type="image/png" href="favicon.png" />
{% if auto_refresh %}
<meta http-equiv="refresh" content="{{ auto_refresh_seconds }}" />
{% endif %}
<!-- Le styles -->
<link href="static/plugin/twitter-bootstrap/css/bootstrap.min.css" rel="stylesheet">
<link href="static/plugin/twitter-bootstrap/css/bootstrap-responsive.min.css" rel="stylesheet">
<link href="static/plugin/bootstrap-multiselect/bootstrap-multiselect.min.css" rel="stylesheet">
<link href="static/css/style.css" rel="stylesheet">
<!-- Le HTML5 shim, for IE6-8 support of HTML5 elements -->
<!--[if lt IE 9]>
<script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
<script type="text/javascript" src="static/plugin/jquery-1.7.1.min.js"></script>
<script type="text/javascript" src="static/plugin/twitter-bootstrap/js/bootstrap.min.js"></script>
<script type="text/javascript" src="static/plugin/bootstrap-multiselect/bootstrap-multiselect.min.js"></script>
<script type="text/javascript" src="static/js/scripts.js"></script>
</head>
{% endblock %}
<body data-spy="scroll" data-target=".subnav" data-offset="50" class="{{ body_class }}">
<!-- navbar -->
<div class="navbar navbar-fixed-top">
<div class="navbar-inner">
<div class="container-fluid">
<a class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</a>
<a class="brand" href="index.php">{{ title }}</a>
{{ html_menu|raw }}
</div>
</div>
</div>
<!-- /navbar -->
{{ html_modal|raw }}
<!-- container -->
<div id="main-container">
<div class="page-header">
<div class="header-label"><h1>{{ subtitle }}</h1></div>
<div class="header-accessories">{{ header_accessories|raw }}</div>
</div>
<div id="main-content">
{{ html_sidebar|raw }}
<div id="page-container">
<div id="flashmessage" class="hide">
{% for msg in messages %}
<div class="alert alert-{{ msg.shortcode }}">
<p class="pull-left span1"><i class="icon-{{ msg.icon }}"></i></p>
<p>{{ msg.message }}</p>
</div>
{% endfor %}
</div>
{{ html_content|raw }}
</div>
</div>
{% if add_footer %}
{% block footer %}
<footer class="footer">
<p class="pull-right"><a href="#">{{ label_back_to_top }}</a></p>
<p class="powered"><small>Powered by <a href="http://www.phpservermonitor.org/" target="_blank">PHP Server Monitor {{ version }}</a>.<br/>{{ update_available }}</small></p>
</footer>
{% endblock %}
{% endif %}
</div>
<!-- /container -->
</body>
</html>

View File

@ -0,0 +1,22 @@
<div class="nav-collapse">
<ul class="nav">
{% for item in menu %}
<li class="{{ item.active }}"><a href="{{ item.url|raw }}">{{ item.label }}</a></li>
{% endfor %}
<li id="nav_option_help">
<a href="http://www.phpservermonitor.org/support" target="_blank">{{ label_help }}</a>
</li>
</ul>
<ul class="nav pull-right">
<li class="dropdown visible-desktop">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">{{ label_usermenu }} <b class="caret"></b></a>
<ul class="dropdown-menu">
<li><a href="{{ url_profile|raw }}"><i class="icon-cog"></i>&nbsp;{{ label_profile }}</a></li>
<li><a href="{{ url_logout|raw }}"><i class="icon-off"></i>&nbsp;{{ label_logout }}</a></li>
</ul>
</li>
<li class="hidden-desktop divider"></li>
<li class="hidden-desktop"><a href="{{ url_profile|raw }}">{{ label_profile }}</a></li>
<li class="hidden-desktop"><a href="{{ url_logout|raw }}">{{ label_logout }}</a></li>
</ul>
</div>

View File

@ -1,215 +1,212 @@
<!--%tpl_config-->
<form class="form-horizontal" name="edit_config" action="index.php?mod=config&action=save" id="edit_config" method="post">
<form class="form-horizontal" name="edit_config" action="index.php?mod=config&amp;action=save" id="edit_config" method="post">
<ul class="nav nav-tabs">
<li class="{general_active}"><a href="#config-general" data-toggle="tab">{label_general}</a></li>
<li class="{email_active}"><a href="#config-email" data-toggle="tab">{label_tab_email}</a></li>
<li class="{sms_active}"><a href="#config-sms" data-toggle="tab">{label_tab_sms}</a></li>
<li class="{pushover_active}"><a href="#config-pushover" data-toggle="tab">{label_tab_pushover}</a></li>
<li class="{{ general_active }}"><a href="#config-general" data-toggle="tab">{{ label_general }}</a></li>
<li class="{{ email_active }}"><a href="#config-email" data-toggle="tab">{{ label_tab_email }}</a></li>
<li class="{{ sms_active }}"><a href="#config-sms" data-toggle="tab">{{ label_tab_sms }}</a></li>
<li class="{{ pushover_active }}"><a href="#config-pushover" data-toggle="tab">{{ label_tab_pushover }}</a></li>
</ul>
<div class="tab-content well">
<div id="config-general" class="tab-pane {general_active}">
<div id="config-general" class="tab-pane {{ general_active }}">
<fieldset>
<legend>{label_general}</legend>
<legend>{{ label_general }}</legend>
<div class="control-group">
<label class="control-label" for="language">{label_language}</label>
<label class="control-label" for="language">{{ label_language }}</label>
<div class="controls">
<select id="language" name="language">
<!--%tpl_repeat_languages-->
<option value="{value}" {selected}>{label}</option>
<!--%%tpl_repeat_languages-->
{languages}
{% for language in languages %}
<option value="{{ language.value }}" {% if language.value == language_current %} selected="selected" {% endif %}>{{ language.label }}</option>
{% endfor %}
</select>
</div>
</div>
<div class="control-group">
<div class="controls">
<label class="checkbox" for="show_update"><input type="checkbox" id="show_update" name="show_update[]" {show_update_checked} /> {label_show_update}</label>
<label class="checkbox" for="show_update"><input type="checkbox" id="show_update" name="show_update[]" {{ show_update_checked|raw }} /> {{ label_show_update }}</label>
</div>
</div>
<div class="control-group">
<label class="control-label" for="auto_refresh_servers">{label_auto_refresh}</label>
<label class="control-label" for="auto_refresh_servers">{{ label_auto_refresh }}</label>
<div class="controls">
<input type="text" class="input-mini" id="auto_refresh_servers" name="auto_refresh_servers" value="{auto_refresh_servers}" maxlength="10" />&nbsp;{label_seconds}
<p class="help-block">{label_auto_refresh_servers}</p>
<input type="text" class="input-mini" id="auto_refresh_servers" name="auto_refresh_servers" value="{{ auto_refresh_servers }}" maxlength="10" />&nbsp;{{ label_seconds }}
<p class="help-block">{{ label_auto_refresh_servers|raw }}</p>
</div>
</div>
</fieldset>
<fieldset>
<legend>{label_settings_notification}</legend>
<legend>{{ label_settings_notification }}</legend>
<div class="control-group">
<label class="control-label" for="alert_type">{label_alert_type}</label>
<label class="control-label" for="alert_type">{{ label_alert_type }}</label>
<div class="controls">
<select id="alert_type" name="alert_type">
<option value="status" {alert_type_selected_status}>{label_alert_type_status}</option>
<option value="offline" {alert_type_selected_offline}>{label_alert_type_offline}</option>
<option value="always" {alert_type_selected_always}>{label_alert_type_always}</option>
<option value="status" {{ alert_type_selected_status|raw }}>{{ label_alert_type_status }}</option>
<option value="offline" {{ alert_type_selected_offline|raw }}>{{ label_alert_type_offline }}</option>
<option value="always" {{ alert_type_selected_always|raw }}>{{ label_alert_type_always }}</option>
</select>
<p class="help-block">{label_alert_type_description}</p>
<p class="help-block">{{ label_alert_type_description|raw }}</p>
</div>
</div>
</fieldset>
<fieldset>
<legend>{label_settings_log}</legend>
<legend>{{ label_settings_log }}</legend>
<div class="control-group">
<div class="controls">
<label class="checkbox"><input type="checkbox" id="log_status" name="log_status[]" {log_status_checked} /> {label_log_status}</label>
<p class="help-block">{label_log_status_description}</p>
<label class="checkbox"><input type="checkbox" id="log_status" name="log_status[]" {{ log_status_checked|raw }} /> {{ label_log_status }}</label>
<p class="help-block">{{ label_log_status_description|raw }}</p>
</div>
</div>
<div class="form-actions">
<button class="btn btn-success" type="submit" name="general_submit">{label_save}</button>
<button class="btn btn-success" type="submit" name="general_submit">{{ label_save }}</button>
</div>
</fieldset>
</div>
<div id="config-email" class="tab-pane {email_active}">
<div id="config-email" class="tab-pane {{ email_active }}">
<fieldset>
<legend>{label_settings_email}</legend>
<legend>{{ label_settings_email }}</legend>
<div class="control-group">
<div class="controls">
<label class="checkbox" for="email_status"><input type="checkbox" id="email_status" name="email_status[]" {email_status_checked} /> {label_email_status}</label>
<label class="checkbox" for="email_status"><input type="checkbox" id="email_status" name="email_status[]" {{ email_status_checked|raw }} /> {{ label_email_status }}</label>
</div>
</div>
<div class="control-group">
<div class="controls">
<label class="checkbox"><input type="checkbox" id="log_email" name="log_email[]" {log_email_checked} /> {label_log_email}</label>
<label class="checkbox"><input type="checkbox" id="log_email" name="log_email[]" {{ log_email_checked|raw }} /> {{ label_log_email }}</label>
</div>
</div>
<div class="control-group">
<label class="control-label" for="email_from_name">{label_email_from_name}</label>
<label class="control-label" for="email_from_name">{{ label_email_from_name }}</label>
<div class="controls">
<input type="text" id="email_from_name" name="email_from_name" value="{email_from_name}" maxlength="255" />
<input type="text" id="email_from_name" name="email_from_name" value="{{ email_from_name }}" maxlength="255" />
</div>
</div>
<div class="control-group">
<label class="control-label" for="email_from_email">{label_email_from_email}</label>
<label class="control-label" for="email_from_email">{{ label_email_from_email }}</label>
<div class="controls">
<input type="text" id="email_from_email" name="email_from_email" value="{email_from_email}" maxlength="255" />
<input type="text" id="email_from_email" name="email_from_email" value="{{ email_from_email }}" maxlength="255" />
</div>
</div>
<div class="control-group">
<div class="controls">
<label class="checkbox" for="email_smtp"><input type="checkbox" id="email_smtp" name="email_smtp[]" {email_smtp_checked} />{label_email_smtp}</label>
<label class="checkbox" for="email_smtp"><input type="checkbox" id="email_smtp" name="email_smtp[]" {{ email_smtp_checked|raw }} />{{ label_email_smtp }}</label>
</div>
</div>
<div class="control-group">
<label class="control-label" for="email_smtp_host">{label_email_smtp_host}</label>
<label class="control-label" for="email_smtp_host">{{ label_email_smtp_host }}</label>
<div class="controls">
<input type="text" id="email_smtp_host" name="email_smtp_host" value="{email_smtp_host}" maxlength="100" placeholder="{label_email_smtp_host}" />
<input type="text" class="input-small" id="email_smtp_port" name="email_smtp_port" value="{email_smtp_port}" maxlength="10" placeholder="{label_email_smtp_port}" />
<input type="text" id="email_smtp_host" name="email_smtp_host" value="{{ email_smtp_host }}" maxlength="100" placeholder="{{ label_email_smtp_host }}" />
<input type="text" class="input-small" id="email_smtp_port" name="email_smtp_port" value="{{ email_smtp_port }}" maxlength="10" placeholder="{{ label_email_smtp_port }}" />
</div>
</div>
<div class="control-group">
<label class="control-label" for="email_smtp_username">{label_email_smtp_username}</label>
<label class="control-label" for="email_smtp_username">{{ label_email_smtp_username }}</label>
<div class="controls">
<input type="text" id="email_smtp_username" name="email_smtp_username" value="{email_smtp_username}" maxlength="100" placeholder="{label_email_smtp_noauth}" />
<input type="text" id="email_smtp_username" name="email_smtp_username" value="{{ email_smtp_username }}" maxlength="100" placeholder="{{ label_email_smtp_noauth }}" />
</div>
</div>
<div class="control-group">
<label class="control-label" for="email_smtp_password">{label_email_smtp_password}</label>
<label class="control-label" for="email_smtp_password">{{ label_email_smtp_password }}</label>
<div class="controls">
<input type="password" id="email_smtp_password" name="email_smtp_password" value="{email_smtp_password}" maxlength="100" placeholder="{label_email_smtp_noauth}" />
<input type="password" id="email_smtp_password" name="email_smtp_password" value="{{ email_smtp_password }}" maxlength="100" placeholder="{{ label_email_smtp_noauth }}" />
</div>
</div>
<div class="control-group">
<div class="controls">
<button class="btn btn-primary show-modal" data-modal-id="testEmail">{label_test}</button>
<button class="btn btn-primary show-modal" data-modal-id="testEmail">{{ label_test }}</button>
<input type="hidden" name="test_email" value="0" />
</div>
</div>
<div class="form-actions">
<button class="btn btn-success" type="submit" name="email_submit" >{label_save}</button>
<button class="btn btn-success" type="submit" name="email_submit" >{{ label_save }}</button>
</div>
</fieldset>
</div>
<div id="config-sms" class="tab-pane {sms_active}">
<div id="config-sms" class="tab-pane {{ sms_active }}">
<fieldset>
<legend>{label_settings_sms}</legend>
<legend>{{ label_settings_sms }}</legend>
<div class="control-group">
<div class="controls">
<label class="checkbox" for="sms_status"><input type="checkbox" id="sms_status" name="sms_status[]" {sms_status_checked} /> {label_sms_status}</label>
<label class="checkbox" for="sms_status"><input type="checkbox" id="sms_status" name="sms_status[]" {{ sms_status_checked|raw }} /> {{ label_sms_status }}</label>
</div>
</div>
<div class="control-group">
<div class="controls">
<label class="checkbox"><input type="checkbox" id="log_sms" name="log_sms[]" {log_sms_checked} /> {label_log_sms}</label>
<label class="checkbox"><input type="checkbox" id="log_sms" name="log_sms[]" {{ log_sms_checked|raw }} /> {{ label_log_sms }}</label>
</div>
</div>
<div class="control-group">
<label class="control-label" for="sms_gateway">{label_sms_gateway}</label>
<label class="control-label" for="sms_gateway">{{ label_sms_gateway }}</label>
<div class="controls">
<select id="sms_gateway" name="sms_gateway">
<option value="mosms" {sms_selected_mosms}>{label_sms_gateway_mosms}</option>
<option value="mollie" {sms_selected_mollie}>{label_sms_gateway_mollie}</option>
<option value="spryng" {sms_selected_spryng}>{label_sms_gateway_spryng}</option>
<option value="inetworx" {sms_selected_inetworx}>{label_sms_gateway_inetworx}</option>
<option value="clickatell" {sms_selected_clickatell}>{label_sms_gateway_clickatell}</option>
<option value="textmarketer" {sms_selected_textmarketer}>{label_sms_gateway_textmarketer}</option>
<option value="smsglobal" {sms_selected_smsglobal}>{label_sms_gateway_smsglobal}</option>
<option value="smsit" {sms_selected_smsit}>{label_sms_gateway_smsit}</option>
<option value="mosms" {{ sms_selected_mosms|raw }}>{{ label_sms_gateway_mosms }}</option>
<option value="mollie" {{ sms_selected_mollie|raw }}>{{ label_sms_gateway_mollie }}</option>
<option value="spryng" {{ sms_selected_spryng|raw }}>{{ label_sms_gateway_spryng }}</option>
<option value="inetworx" {{ sms_selected_inetworx|raw }}>{{ label_sms_gateway_inetworx }}</option>
<option value="clickatell" {{ sms_selected_clickatell|raw }}>{{ label_sms_gateway_clickatell }}</option>
<option value="textmarketer" {{ sms_selected_textmarketer|raw }}>{{ label_sms_gateway_textmarketer }}</option>
<option value="smsglobal" {{ sms_selected_smsglobal|raw }}>{{ label_sms_gateway_smsglobal }}</option>
<option value="smsit" {{ sms_selected_smsit|raw }}>{{ label_sms_gateway_smsit }}</option>
</select>
</div>
</div>
<div class="control-group">
<label class="control-label" for="sms_gateway_username">{label_sms_gateway_username}</label>
<label class="control-label" for="sms_gateway_username">{{ label_sms_gateway_username }}</label>
<div class="controls">
<input type="text" id="sms_gateway_username" name="sms_gateway_username" value="{sms_gateway_username}" maxlength="255" />
<input type="text" id="sms_gateway_username" name="sms_gateway_username" value="{{ sms_gateway_username }}" maxlength="255" />
</div>
</div>
<div class="control-group">
<label class="control-label" for="sms_gateway_password">{label_sms_gateway_password}</label>
<label class="control-label" for="sms_gateway_password">{{ label_sms_gateway_password }}</label>
<div class="controls">
<input type="password" id="sms_gateway_password" name="sms_gateway_password" value="{sms_gateway_password}" maxlength="255" />
<input type="password" id="sms_gateway_password" name="sms_gateway_password" value="{{ sms_gateway_password }}" maxlength="255" />
</div>
</div>
<div class="control-group">
<label class="control-label" for="sms_from">{label_sms_from}</label>
<label class="control-label" for="sms_from">{{ label_sms_from }}</label>
<div class="controls">
<input type="text" id="sms_from" name="sms_from" value="{sms_from}" maxlength="255" />
<input type="text" id="sms_from" name="sms_from" value="{{ sms_from }}" maxlength="255" />
</div>
</div>
<div class="control-group">
<div class="controls">
<button class="btn btn-primary show-modal" data-modal-id="testSms">{label_test}</button>
<button class="btn btn-primary show-modal" data-modal-id="testSms">{{ label_test }}</button>
<input type="hidden" name="test_sms" value="0" />
</div>
</div>
<div class="form-actions">
<button class="btn btn-success" type="submit" name="sms_submit">{label_save}</button>
<button class="btn btn-success" type="submit" name="sms_submit">{{ label_save }}</button>
</div>
</fieldset>
</div>
<div id="config-pushover" class="tab-pane {pushover_active}">
<div id="config-pushover" class="tab-pane {{ pushover_active }}">
<fieldset>
<legend>{label_settings_pushover}</legend>
<legend>{{ label_settings_pushover }}</legend>
<div class="control-group">
<div class="controls">
<label class="checkbox" for="pushover_status"><input type="checkbox" id="pushover_status" name="pushover_status[]" {pushover_status_checked} /> {label_pushover_status}</label>
<p class="help-block">{label_pushover_description}</p>
<label class="checkbox" for="pushover_status"><input type="checkbox" id="pushover_status" name="pushover_status[]" {{ pushover_status_checked|raw }} /> {{ label_pushover_status }}</label>
<p class="help-block">{{ label_pushover_description|raw }}</p>
</div>
</div>
<div class="control-group">
<div class="controls">
<label class="checkbox"><input type="checkbox" id="log_pushover" name="log_pushover[]" {log_pushover_checked} /> {label_log_pushover}</label>
<label class="checkbox"><input type="checkbox" id="log_pushover" name="log_pushover[]" {{ log_pushover_checked|raw }} /> {{ label_log_pushover }}</label>
</div>
</div>
<div class="control-group">
<label class="control-label" for="pushover_api">{label_pushover_api_token}</label>
<label class="control-label" for="pushover_api_token">{{ label_pushover_api_token }}</label>
<div class="controls">
<input type="text" id="pushover_api_token" name="pushover_api_token" value="{pushover_api_token}" maxlength="255" />
<p class="help-block">{label_pushover_api_token_description}</p>
<input type="text" id="pushover_api_token" name="pushover_api_token" value="{{ pushover_api_token }}" maxlength="255" />
<p class="help-block">{{ label_pushover_api_token_description|raw }}</p>
</div>
</div>
<div class="control-group">
<div class="controls">
<button class="btn btn-primary show-modal" data-modal-id="testPushover">{label_test}</button>
<button class="btn btn-primary show-modal" data-modal-id="testPushover">{{ label_test }}</button>
<input type="hidden" name="test_pushover" value="0" />
</div>
</div>
<div class="form-actions">
<button class="btn btn-success" type="submit" name="pushover_submit">{label_save}</button>
<button class="btn btn-success" type="submit" name="pushover_submit">{{ label_save }}</button>
</div>
</fieldset>
</div>
</div>
</form>
<!--%%tpl_config-->
</form>

View File

@ -0,0 +1,2 @@
<h2>{{ label_title }}</h2>
<p>{{ label_description }}</p>

View File

@ -0,0 +1,61 @@
{% extends "module/install/main.tpl.html" %}
{% use "module/install/results.tpl.html" %}
{% block install %}
<div class="row-fluid">
<div class="span12">{{ block('results') }}</div>
</div>
<div class="row-fluid">
<div class="span6">
<form id="psm_config" class="form-horizontal" action="install.php?action=config" method="post">
<p>Please enter your database info:</p>
<div class="control-group">
<label class="control-label" for="host">Database host</label>
<div class="controls">
<input type="text" id="host" name="host" value="{{ host }}" />
</div>
</div>
<div class="control-group">
<label class="control-label" for="name">Database name</label>
<div class="controls">
<input type="text" id="name" name="name" value="{{ name }}" placeholder="db name" />
</div>
</div>
<div class="control-group">
<label class="control-label" for="user">Database user</label>
<div class="controls">
<input type="text" id="user" name="user" value="{{ user }}" placeholder="db user" />
</div>
</div>
<div class="control-group">
<label class="control-label" for="pass">Database password</label>
<div class="controls">
<input type="password" id="pass" name="pass" value="{{ pass }}" placeholder="db password" />
</div>
</div>
<div class="control-group">
<label class="control-label" for="prefix">Table prefix</label>
<div class="controls">
<input type="text" id="prefix" name="prefix" value="{{ prefix }}" />
</div>
</div>
<div class="control-group">
<div class="controls">
<button type="submit" class="btn">Save configuration</button>
</div>
</div>
</form>
</div>
{% if include_config_new_copy %}
<div class="span6">
<h3>Your config file:</h3>
<div class="alert alert-error">Unable to save your configuration.</div>
<p>Your database information is valid, however we are unable to create the configuration file automatically.
Please create a new file in the project directory called "config.php" and copy the information below.</p>
<p>After you have copied the configuration, press the button to continue.</p>
<p class="pull-left"><textarea rows="10">{{ php_config }}</textarea></p>
<p class="offset2"><input type="submit" class="btn btn-primary" value="I have saved the configuration" onclick="location.reload(true);" /></p>
</div>
{% endif %}
</div>
{% endblock %}

View File

@ -0,0 +1,44 @@
{% extends "module/install/main.tpl.html" %}
{% use "module/install/results.tpl.html" %}
{% block install %}
<p>Sweet, your database connection is up and running!</p>
<p>Next, please set up a new account to access your monitor:</p>
{{ block('results') }}
<p>&nbsp;</p>
<div class="row-fluid">
<div class="span6">
<form id="psm_config" class="form-horizontal" action="install.php?action=install" method="post">
<div class="control-group">
<label class="control-label" for="username">Username</label>
<div class="controls">
<input type="text" id="username" name="username" value="{{ username }}">
</div>
</div>
<div class="control-group">
<label class="control-label" for="password">Password</label>
<div class="controls">
<input type="password" id="password" name="password" value="">
</div>
</div>
<div class="control-group">
<label class="control-label" for="password_repeat">Password repeat</label>
<div class="controls">
<input type="password" id="password_repeat" name="password_repeat" value="">
</div>
</div>
<div class="control-group">
<label class="control-label" for="email">Email</label>
<div class="controls">
<input type="text" id="email" name="email" value="{{ email }}" />
</div>
</div>
<div class="control-group">
<div class="controls">
<button type="submit" class="btn btn-primary btn-large">Install</button>
</div>
</div>
</form>
</div>
</div>
{% endblock %}

View File

@ -0,0 +1,9 @@
{% extends "module/install/main.tpl.html" %}
{% block install %}
<p>We have discovered a previous version.</p>
<p>In the next step we will upgrade your database to the latest version.</p>
{{ block('results') }}
<p>&nbsp;</p>
<p><a class="btn btn-primary btn-large" href="install.php?action=install">Upgrade to {{ version }}</a></p>
{% endblock %}

View File

@ -0,0 +1,15 @@
{% extends "module/install/main.tpl.html" %}
{% use "module/install/results.tpl.html" %}
{% block install %}
<p>Welcome to the installation of PHP Server Monitor. This page will guide you through the steps to install or upgrade your monitor.</p>
<p>Before we start, we need to verify your system meets the requirements.
If you see any errors in the list below, you may still continue, but PHP Server Monitor may not work correctly.
It is recommended you fix any errors before continuing.
</p>
{{ block('results') }}
<p>&nbsp;</p>
<p>
<a class="btn btn-primary btn-large" href="install.php?action=config">Let's go</a>
</p>
{% endblock %}

View File

@ -0,0 +1,5 @@
<div class="hero-unit">
<h2><a href="http://www.phpservermonitor.org/"><img class="pull-right" src="static/opensource.png" width="100" alt="" /></a> &nbsp;PHP Server Monitor</h2>
<p>&nbsp;</p>
{% block install %} {% endblock %}
</div>

View File

@ -0,0 +1,10 @@
{% block results %}
{% if messages %}
{% for msg in messages %}
<div>
<p class="pull-left"><span class="label label-{{ msg.shortcode }}">{{ msg.shortcode }}</span></p>
<p class="offset1">{{ msg.message }}</p>
</div>
{% endfor %}
{% endif %}
{% endblock %}

View File

@ -0,0 +1,20 @@
{% extends "module/install/main.tpl.html" %}
{% use "module/install/results.tpl.html" %}
{% block install %}
<div class="row-fluid">
<div class="span12">{{ block('results') }}</div>
</div>
<div class="row-fluid">
<div class="span12">
<p>&nbsp;</p>
<p>The installation is complete. Please check above if errors have occurred.<br>
If no errors have occurred, you are good to go.<br><br></p>
<p>
<a class="btn btn-primary btn-large" href="index.php">Go to your monitor</a>
<a class="btn btn-large" target="_blank" href="http://www.phpservermonitor.org/">PHP Server Monitor</a>
<a class="btn btn-large" target="_blank" href="http://docs.phpservermonitor.org/">Documentation</a>
</p>
</div>
</div>
{% endblock %}

View File

@ -1,4 +1,3 @@
<!--%tpl_server_history-->
<link href="static/plugin/jqplot/jquery.jqplot.min.css" rel="stylesheet" >
<!--[if lt IE 9]><script type="text/javascript" src="static/plugin/excanvas.js"></script><![endif]-->
<script type="text/javascript" src="static/plugin/jqplot/jquery.jqplot.min.js"></script>
@ -9,46 +8,48 @@
<link href="static/css/history.css" rel="stylesheet" >
<script type="text/javascript">
var day_format = '{day_format}';
var long_date_format = '{long_date_format}';
var short_date_format = '{short_date_format}';
var short_time_format = '{short_time_format}';
var day_format = '{{ day_format }}';
var long_date_format = '{{ long_date_format }}';
var short_date_format = '{{ short_date_format }}';
var short_time_format = '{{ short_time_format }}';
</script>
<script type="text/javascript" src="static/js/history.js"></script>
<div id="history-panel">
<!--%tpl_repeat_graphs-->
{% for graph in graphs %}
<div class="chart-row">
<div class="chart-container">
<div class="chart-content">
<div id="chart{chart_id}" class="chart" data-title="{title}" data-plotMode="{plotmode}" data-endTime="{end_timestamp}" data-series="{series}" data-lines="{server_lines}" data-down="{server_down}"></div>
<div id="chart{{ graph.chart_id }}" class="chart" data-title="{{ graph.title }}" data-plotMode="{{ graph.plotmode }}" data-endTime="{{ graph.end_timestamp }}" data-series="{{ graph.series|raw }}" data-lines="{{ graph.server_lines }}" data-down="{{ graph.server_down }}"></div>
</div>
</div>
<div class="info-container">
<div class="info-content">
<div class="info-dropdown btn-group">
<button class="btn dropdown-toggle" data-toggle="dropdown"><i class="icon-info-sign"></i></button>
<!--%tpl_repeat_info-->
<li><span>{label}: {value}</span></li>
<!--%%tpl_repeat_info-->
<ul class="dropdown-menu">{info}</ul>
<ul class="dropdown-menu">
{% for record in graph.info %}
<li><span>{{ record.label }}: {{ record.value }}</span></li>
{% endfor %}
</ul>
</div>
<div class="server-info">
<ul>{info}</ul>
<ul>
{% for record in graph.info %}
<li><span>{{ record.label }}: {{ record.value }}</span></li>
{% endfor %}
</ul>
</div>
</div>
<div class="chart-selector">
<div class="btn-group">
<!--%tpl_repeat_buttons-->
<button class="btn {class_active}" data-chartId="{chart_id}" data-chartMode="{mode}" >{label}</button>
<!--%%tpl_repeat_buttons-->
{buttons}
{% for button in graph.buttons %}
<button class="btn {{ button.class_active }}" data-chartId="{{ graph.chart_id }}" data-chartMode="{{ button.mode }}" >{{ button.label }}</button>
{% endfor %}
</div>
</div>
</div>
</div>
<div style="clear: both;">&nbsp;</div>
<!--%%tpl_repeat_graphs-->
{graphs}
</div>
<!--%%tpl_server_history-->
{% endfor %}
</div>

View File

@ -0,0 +1,60 @@
<div class="tabbable">
<ul class="nav nav-tabs">
<li class="active"><a href="#log_status_content" data-toggle="tab">{{ label_status }}</a></li>
<li><a href="#log_email_content" data-toggle="tab">{{ label_email }}</a></li>
<li><a href="#log_sms_content" data-toggle="tab">{{ label_sms }}</a></li>
<li><a href="#log_pushover_content" data-toggle="tab">{{ label_pushover }}</a></li>
</ul>
<div class="tab-content well">
{% for tab in tabs %}
<div class="tab-pane {{ tab.tab_active }}" id="log_{{ tab.id }}_content">
<table class="table table-bordered table-striped">
<thead>
<tr>
<th class="hidden-phone">{{ label_server }}</th>
<th class="hidden-phone">{{ label_message }}</th>
<th class="hidden-phone">{{ label_date }}</th>
{% if tab.has_users %} <th class="hidden-phone">{{ label_users }}</th> {% endif %}
</tr>
</thead>
<tbody>
{% for entry in tab.entries %}
<tr class="{{ entry.class }}">
<td>
<div class="table-body">
<div class="table-cell">
<div class="visible-phone pull-right">
&nbsp;{{ entry.datetime_format }}
</div>
<i class="{{ entry.type_icon }}" title="{{ entry.type_title }}"></i> <span class="title">{{ entry.server }}</span> {{ entry.ip }}
</div>
</div>
<div class="visible-phone">
<div class="table-separator"/></div>
<div class="table-body">
<div class="table-cell-details">{{ entry.message|raw }}</div>
</div>
</div>
{% if tab.has_users %}<div class="visible-phone">
<div class="table-separator"/></div>
<div class="table-body">
<div class="table-cell-details">{{ label_users }}: {{ entry.user_list|raw }}</div>
</div>
</div>{% endif %}
</td>
<td class="hidden-phone">{{ entry.message|raw }}</td>
<td class="hidden-phone tight">{{ entry.datetime_format }}</td>
{% if tab.has_users %}<td class="hidden-phone tight">{{ entry.users|raw }}</td>{% endif %}
</tr>
{% endfor %}
{% if tab.no_logs %}
<tr class="{{ class }}">
<td colspan="4" class="cell-center">{{ label_no_logs }}</td>
</tr>
{% endif %}
</tbody>
</table>
</div>
{% endfor %}
</div>
</div>

View File

@ -0,0 +1,66 @@
<table class="table table-bordered table-striped">
<thead>
<tr>
<th class="hidden-phone">&nbsp;</th>
<th class="hidden-phone">{{ label_label }}</th>
<th class="hidden-phone">{{ label_domain }}</th>
<th class="visible-desktop">{{ label_port }}</th>
<th class="visible-desktop">{{ label_type }}</th>
<th class="hidden-phone">{{ label_rtime }}</th>
<th class="hidden-phone">{{ label_last_online }}</th>
<th class="hidden-phone">{{ label_monitoring }}</th>
<th class="hidden-phone">{{ label_action }}</th>
</tr>
</thead>
<tbody>
{% for server in servers %}
<tr>
<td class="hidden-phone"><div class="table-cell-title"><span class="label label-status-{{ server.status }}"><a href="{{ server.url_view|raw }}" title="{{ server.error }}">{{ server.status }}</a></span></div></td>
<td class="hidden-phone"><div class="table-cell-title"><a href="{{ server.url_view|raw }}">{{ server.label }}</a></div></td>
<td class="nowrap visible-tablet"><div class="table-cell-title"><i class="{{ server.type_icon }}" title="{{ server.type }}"></i> {{ server.ip_short|raw }}</div></td>
<td class="nowrap visible-desktop"><div class="table-cell-title">{{ server.ip|raw }}</div></td>
<td class="nowrap visible-desktop"><div class="table-cell-title">{{ server.port }}</div></td>
<td class="nowrap visible-desktop"><div class="table-cell-title">{{ server.type }}</div></td>
<td class="nowrap hidden-phone"><div class="table-cell-title">{{ server.rtime }} s</div></td>
<td class="nowrap hidden-phone"><div class="table-cell-title">{{ server.last_online }}</div></td>
<td class="tight hidden-phone"><div class="table-cell-title"><i class="{{ server.active_icon }}" title="{{ server.active_title }}"></i> <i class="{{ server.email_icon }}" title="{{ label_email }}"></i> <i class="{{ server.sms_icon }}" title="{{ label_sms }}"></i> <i class="{{ server.pushover_icon }}" title="Pushover"></i></div></td>
<td class="tight hidden-phone">
<div class="table-cell-title">
<a class="btn btn-small" href="{{ server.url_view|raw }}"><i class="icon-chart"></i></a>
{% if user_level == 10 %}
<a class="btn btn-small" href="{{ server.url_edit|raw }}" title="{{ label_edit }}"><i class="icon-pencil"></i></a>
<a class="btn btn-small btn-danger show-modal" href="{{ server.url_delete|raw }}" title="{{ label_delete }}" data-modal-id="delete" data-modal-param="{{ server.label }}"><i class="icon-remove icon-white"></i></a>
{% endif %}
</div>
</td>
<td class="visible-phone">
<div class="table-body">
<div class="table-cell-title">
<span class="label label-status-{{ server.status }}"><a href="{{ server.url_view|raw }}" title="{{ server.error }}">{{ server.status }}</a></span>
<a class="title" href="{{ server.url_view|raw }}">{{ server.label }}</a>
</div>
<div class="table-cell tight">
&nbsp;<a class="btn btn-small" href="{{ server.url_view|raw }}"><i class="icon-chart"></i></a>
{% if user_level == 10 %}
<a class="btn btn-small" href="{{ server.url_edit|raw }}" title="{{ label_edit }}"><i class="icon-pencil"></i></a>
<a class="btn btn-small btn-danger show-modal" href="{{ server.url_delete|raw }}" title="{{ label_delete }}" data-modal-id="delete" data-modal-param="{{ server.label }}"><i class="icon-remove icon-white"></i></a>
{% endif %}
</div>
</div>
<div class="table-body">
<div class="table-row">
<div class="table-cell"><i class="{{ server.type_icon }}" title="{{ server.type }}"></i> {{ server.ip_short|raw }}</div>
<div class="table-cell tight">
<i class="{{ server.active_icon }}" title="{{ server.active_title }}"></i> <i class="{{ server.email_icon }}" title="{{ label_email }}"></i> <i class="{{ server.sms_icon }}" title="{{ label_sms }}"></i> <i class="{{ server.pushover_icon }}" title="Pushover"></i>
</div>
</div>
</div>
<div class="table-body">
<div class="table-row"><div class="table-cell-details tight">{{ label_rtime }}: &nbsp;</div><div class="table-cell-details">{{ server.rtime }} s</div></div>
<div class="table-row"><div class="table-cell-details tight">{{ label_last_online }}: &nbsp;</div><div class="table-cell-details">{{ server.last_online }}</div></div>
</div>
</td>
</tr>
{% endfor %}
</tbody>
</table>

View File

@ -0,0 +1,106 @@
<form class="form-horizontal well" action="{{ url_save|raw }}" method="post">
<fieldset>
<legend>{{ titlemode }}</legend>
<div class="control-group">
<label class="control-label" for="label">{{ label_label }}</label>
<div class="controls">
<input type="text" id="label" name="label" value="{{ edit_value_label }}" maxlength="255" />
</div>
</div>
<div class="control-group">
<label class="control-label" for="ip">{{ label_domain }}</label>
<div class="controls">
<input type="text" id="ip" name="ip" value="{{ edit_value_ip }}" maxlength="100" />
</div>
</div>
<div class="control-group">
<label class="control-label" for="type">{{ label_type }}</label>
<div class="controls">
<select id="type" name="type">
<option value="service" {{ edit_type_selected_service|raw }}>{{ label_service }}</option>
<option value="website" {{ edit_type_selected_website|raw }}>{{ label_website }}</option>
</select>
</div>
</div>
<div class="control-group">
<label class="control-label" for="port">{{ label_port }}</label>
<div class="controls">
<input class="input-mini" type="text" id="port" name="port" value="{{ edit_value_port }}" maxlength="5" />
</div>
</div>
<div class="control-group">
<label class="control-label" for="pattern">{{ label_pattern }}</label>
<div class="controls">
<input type="text" id="pattern" name="pattern" value="{{ edit_value_pattern }}" maxlength="255" data-toggle="tooltip" title="{{ label_pattern_description }}" />
</div>
</div>
<div class="control-group">
<label class="control-label" for="warning_threshold">{{ label_warning_threshold }}</label>
<div class="controls">
<input class="input-mini" type="text" id="warning_threshold" name="warning_threshold" value="{{ edit_value_warning_threshold }}" maxlength="5" data-toggle="tooltip" title="{{ label_warning_threshold_description }}" />
</div>
</div>
<div class="control-group">
<label class="control-label" for="timeout">{{ label_timeout }}</label>
<div class="controls">
<input class="input-mini" type="text" id="timeout" name="timeout" value="{{ edit_value_timeout }}" placeholder="{{ default_value_timeout }}" maxlength="10" data-toggle="tooltip" title="{{ label_timeout_description }}" /> s
</div>
</div>
<div class="control-group">
<label class="control-label" for="active">{{ label_monitoring }}</label>
<div class="controls">
<select id="active" name="active">
<option value="yes" {{ edit_active_selected_yes|raw }}>{{ label_yes }}</option>
<option value="no" {{ edit_active_selected_no|raw }}>{{ label_no }}</option>
</select>
</div>
</div>
<div class="control-group {{ control_class_email }}">
<label class="control-label" for="email">{{ label_send_email }}
{% if warning_email %} <p class="help-inline"><i class="icon-warning-sign" data-toggle="tooltip" title="{{ label_warning_email }}"></i></p> {% endif %}
</label>
<div class="controls">
<select id="email" name="email">
<option value="yes" {{ edit_email_selected_yes|raw }}>{{ label_yes }}</option>
<option value="no" {{ edit_email_selected_no|raw }}>{{ label_no }}</option>
</select>
</div>
</div>
<div class="control-group {{ control_class_sms }}">
<label class="control-label" for="sms">{{ label_send_sms }}
{% if warning_sms %} <p class="help-inline"><i class="icon-warning-sign" data-toggle="tooltip" title="{{ label_warning_sms }}"></i></p> {% endif %}
</label>
<div class="controls">
<select id="sms" name="sms">
<option value="yes" {{ edit_sms_selected_yes|raw }}>{{ label_yes }}</option>
<option value="no" {{ edit_sms_selected_no|raw }}>{{ label_no }}</option>
</select>
</div>
</div>
<div class="control-group {{ control_class_pushover }}">
<label class="control-label" for="pushover">{{ label_pushover }}
{% if warning_pushover %} <p class="help-inline"><i class="icon-warning-sign" data-toggle="tooltip" title="{{ label_warning_pushover }}"></i></p> {% endif %}
</label>
<div class="controls">
<select id="pushover" name="pushover">
<option value="yes" {{ edit_pushover_selected_yes|raw }}>{{ label_yes }}</option>
<option value="no" {{ edit_pushover_selected_no|raw }}>{{ label_no }}</option>
</select>
</div>
</div>
<div class="control-group">
<label class="control-label" for="user_id">{{ label_users }}</label>
<div class="controls">
<select class="multiselect" multiple="multiple" id="user_id" name="user_id[]">
{% for user in users %}
<option value="{{ user.user_id }}" {{ user.edit_selected|raw }}> {{ user.name }}</option>
{% endfor %}
</select>
</div>
</div>
<div class="form-actions">
<button class="btn btn-success" type="submit">{{ label_save }}</button>
<a class="btn" href="{{ url_go_back|raw }}" >{{ label_go_back }}</a>
</div>
</fieldset>
</form>

View File

@ -0,0 +1,91 @@
<table class="table table-bordered">
<colgroup>
<col class="oce-first" />
<col />
</colgroup>
<thead>
<tr class="head">
<th colspan="2">
<div class="btn-group">
<button class="btn btn-success dropdown-toggle" data-toggle="dropdown">
<i class="icon-th icon-white"></i>&nbsp;{{ label }}
<span class="caret"></span>
</button>
<ul class="dropdown-menu">
{% for option in options %}
<li class="{{ option.class_active }}"><a href="{{ option.url|raw }}">{{ option.label }}</a>
{% endfor %}
</ul>
</div>
</th>
</tr>
</thead>
<tbody>
<tr>
<td>{{ label_status }}:</td>
<td>
<span class="label label-status-{{ status }}">
<a href="#" title="{{ error }}">{{ status }}</a>
</span>&nbsp;{{ error }}
</td>
</tr>
<tr>
<td>{{ label_type }}:</td>
<td>{{ type }}</td>
</tr>
<tr>
<td>{{ label_domain }}:</td>
<td>{{ ip|raw }}</td>
</tr>
<tr>
<td>{{ label_port }}:</td>
<td>{{ port }}</td>
</tr>
<tr>
<td>{{ label_last_check }}:</td>
<td>{{ last_check }}</td>
</tr>
<tr>
<td>{{ label_last_online }}:</td>
<td>{{ last_online }}</td>
</tr>
<tr>
<td>{{ label_rtime }}:</td>
<td>{{ rtime }} s</td>
</tr>
<tr>
<td>{{ label_monitoring }}:</td>
<td>{{ active }}</td>
</tr>
<tr>
<td>{{ label_email }}:</td>
<td>{{ email }}</td>
</tr>
<tr>
<td>{{ label_sms }}:</td>
<td>{{ sms }}</td>
</tr>
<tr>
<td>{{ label_pushover }}:</td>
<td>{{ pushover }}</td>
</tr>
<tr>
<td>{{ label_timeout }}:</td>
<td>{{ timeout }} s</td>
</tr>
{% if has_admin_actions %}
<tr>
<td class="hidden-small">&nbsp;</td>
<td class="action-small" colspan="2">
<a class="btn btn-success" href="{{ url_edit|raw }}">
<i class="icon-edit icon-white"></i>&nbsp;{{ label_edit }}
</a>
<a class="btn btn-danger show-modal" href="{{ url_delete|raw }}" data-modal-id="delete" data-modal-param="{{ label }}">
<i class="icon-remove icon-white"></i>&nbsp;{{ label_delete }}
</a>
</td>
</tr>
{% endif %}
</tbody>
</table>
{{ html_history|raw }}

View File

@ -0,0 +1,4 @@
<div class="btn-group" data-toggle="buttons-radio">
<button class="btn {{ block_layout_active }}" data-toggle="tab" data-target="#flow-layout" onclick="psm_saveLayout(0)"><i class="icon-th-large"></i></button>
<button class="btn {{ list_layout_active }}" data-toggle="tab" data-target="#list-layout" onclick="psm_saveLayout(1)"><i class="icon-th-list"></i></button>
</div>

View File

@ -0,0 +1,60 @@
<div class="tab-content">
<div id="flow-layout" class="tab-pane {{ block_layout_active }}">
<div class="entity-container">
{% for server in servers_offline %}
<div class="offline">
<div class="entity {{ server.class_warning }}" onclick="window.location.href='{{ server.url_view|raw }}'">
<h2>{{ server.label }}</h2>
<p>{{ label_last_online }}: {{ server.last_online_nice }}</p>
<p>{{ label_last_check }}: {{ server.last_checked_nice }}</p>
</div>
</div>
{% endfor %}
{% for server in servers_online %}
<div class="online">
<div class="entity" onclick="window.location.href='{{ server.url_view|raw }}'">
<h2>{{ server.label }}</h2>
<p>{{ label_last_online }}: {{ server.last_online_nice }}</p>
<p>{{ label_rtime }}: {{ server.rtime }}s</p>
</div>
</div>
{% endfor %}
</div>
</div>
<div id="list-layout" class="tab-pane {{ list_layout_active }}">
<div class="entity-container">
<table class="table table-bordered">
<tbody>
{% for server in servers_offline %}
<tr class="row-offline" onclick="window.location.href='{{ server.url_view|raw }}'">
<td class="{{ server.class_warning }}"><div class="server-name">{{ server.label }}</div>
<div class="visible-phone">
<div class="table-body">
<div class="table-row"><div class="table-cell-details tight">{{ label_last_online }}: &nbsp;</div><div class="table-cell-details">{{ server.last_online_nice }}</div></div>
<div class="table-row"><div class="table-cell-details tight">{{ label_last_check }}: &nbsp;</div><div class="table-cell-details">{{ server.last_checked_nice }}</div></div>
</div>
</div>
</td>
<td class="{{ server.class_warning }} hidden-phone">{{ label_last_online }}: {{ server.last_online_nice }}</td>
<td class="{{ server.class_warning }} hidden-phone">{{ label_last_check }}: {{ server.last_checked_nice }}</td>
</tr>
{% endfor %}
{% for server in servers_online %}
<tr class="row-online" onclick="window.location.href='{{ server.url_view|raw }}'">
<td><div class="server-name">{{ server.label }}</div>
<div class="visible-phone">
<div class="table-body">
<div class="table-row"><div class="table-cell-details tight">{{ label_last_online }}: &nbsp;</div><div class="table-cell-details">{{ server.last_online_nice }}</div></div>
<div class="table-row"><div class="table-cell-details tight">{{ label_rtime }}: &nbsp;</div><div class="table-cell-details">{{ server.rtime }}</div></div>
</div>
</div>
</td>
<td class="hidden-phone">{{ label_last_online }}: {{ server.last_online_nice }}</td>
<td class="hidden-phone">{{ label_rtime }}: {{ server.rtime }}s</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
</div>
</div>

View File

@ -0,0 +1,8 @@
<div class="container">
<form class="form-signin" method="post">
<h3 class="form-signin-heading">{{ title_forgot }}</h3>
<input type="text" name="user_name" class="input-block-level" placeholder="{{ label_username }}" value="{{ value_user_name }}" required>
<button class="btn btn-primary" type="submit">{{ label_submit }}</button>
<a class="btn" href="?">{{ label_go_back }}</a>
</form>
</div>

View File

@ -0,0 +1,13 @@
<div class="container">
<form class="form-signin" method="post">
<h3 class="form-signin-heading">{{ title_sign_in }}</h3>
<input type="text" name="user_name" class="input-block-level" placeholder="{{ label_username }}" value="{{ value_user_name }}" required>
<input type="password" name="user_password" class="input-block-level" placeholder="{{ label_password }}" required>
<input type="hidden" name="action" value="login">
<label class="checkbox">
<input type="checkbox" name="user_rememberme" value="1" {{ value_rememberme }}> {{ label_remember_me }}
</label>
<button class="btn btn-primary" type="submit">{{ label_login }}</button>
<a class="btn" href="?action=forgot">{{ label_password_forgot }}</a>
</form>
</div>

View File

@ -0,0 +1,10 @@
<div class="container">
<form class="form-signin" method="post">
<h3 class="form-signin-heading">{{ title_reset }}</h3>
<input type="text" name="user_name" class="input-block-level" placeholder="{{ label_username }}" value="{{ value_user_name }}" required disabled="disabled">
<input type="password" name="user_password_new" class="input-block-level" placeholder="{{ label_password }}" required autocomplete="off">
<input type="password" name="user_password_repeat" class="input-block-level" placeholder="{{ label_password_repeat }}" required autocomplete="off">
<button class="btn btn-primary" type="submit">{{ label_reset }}</button>
<a class="btn" href="?">{{ label_go_back }}</a>
</form>
</div>

View File

@ -0,0 +1,72 @@
<form class="form-horizontal well" action="{{ form_action|raw }}" method="post">
<fieldset>
<div class="row-fluid">
<div class="span6">
<div class="control-group">
<label class="control-label" for="user_name">{{ label_user_name }}</label>
<div class="controls">
<input type="text" id="user_name" name="user_name" value="{{ user_name }}" maxlength="64" required autofocus=>
</div>
</div>
<div class="control-group">
<label class="control-label" for="name">{{ label_name }}</label>
<div class="controls">
<input type="text" id="name" name="name" value="{{ name }}" maxlength="255" required>
</div>
</div>
<div class="control-group">
<label class="control-label" for="level">{{ label_level }}</label>
<div class="controls"><input type="text" value="{{ level }}" disabled="disabled" /></div>
</div>
<div class="control-group">
<label class="control-label" for="password">{{ label_password }}</label>
<div class="controls">
<input type="password" id="password" name="password" maxlength="255" placeholder="{{ placeholder_password }}" />
</div>
</div>
<div class="control-group">
<label class="control-label" for="password_repeat">{{ label_password_repeat }}</label>
<div class="controls">
<input type="password" id="password_repeat" name="password_repeat" maxlength="255" placeholder="{{ placeholder_password }}" />
</div>
</div>
<div class="control-group">
<label class="control-label" for="email">{{ label_email }}</label>
<div class="controls">
<input type="text" id="email" name="email" value="{{ email }}" maxlength="255" required>
</div>
</div>
<div class="control-group">
<label class="control-label" for="email">{{ label_mobile }}</label>
<div class="controls">
<input type="text" id="mobile" name="mobile" value="{{ mobile }}" maxlength="15" />
</div>
</div>
</div>
<div class="span6">
<div class="control-group">
<label class="control-label">{{ label_pushover }}</label>
<div class="controls">{{ label_pushover_description|raw }} </div>
</div>
<div class="control-group">
<label class="control-label" for="mobile">{{ label_pushover_key }}</label>
<div class="controls">
<input type="text" id="pushover_key" name="pushover_key" value="{{ pushover_key }}" maxlength="255" />
</div>
</div>
<div class="control-group">
<label class="control-label" for="mobile">{{ label_pushover_device }}</label>
<div class="controls">
<input type="text" id="pushover_device" name="pushover_device" value="{{ pushover_device }}" maxlength="255" />
<p class="help-block">{{ label_pushover_device_description }}</p>
</div>
</div>
</div>
</div>
<div class="row-fluid">
<div class="form-actions">
<button class="btn btn-success" type="submit">{{ label_save }}</button>
</div>
</div>
</fieldset>
</form>

View File

@ -0,0 +1,66 @@
<table class="table table-bordered table-striped">
<thead>
<tr>
<th class="hidden-phone">{{ label_user }}</th>
<th class="visible-desktop">{{ label_name }}</th>
<th class="visible-desktop">{{ label_level }}</th>
<th class="hidden-phone">{{ label_email }}</th>
<th class="hidden-phone">{{ label_mobile }}</th>
<th class="hidden-phone">{{ label_servers }}</th>
<th class="hidden-phone tight">{{ label_action }}</th>
</tr>
</thead>
<tbody>
{% for user in users %}
<tr>
<td>
<div class="table-body">
<div class="table-cell-title">
<span class="nowrap">
<span class="hidden-desktop">
{% if user.level == '10' %}
<i class="icon-admin" title="{{ user.level_text }}"></i>&nbsp;
{% elseif user.level == '20' %}
<i class="icon-user" title="{{ user.level_text }}"></i>&nbsp;
{% endif %}
</span>
<span class="title">{{ user.user_name }}</span>
</span>
<span class="hidden-desktop">({{ user.name }})</span>
</div>
<div class="table-cell tight">
<div class="visible-phone">
<a class="btn btn-small" href="{{ user.url_edit|raw }}" title="{{ user.label_edit }}">
<i class="icon-pencil"></i>
</a>
<a class="btn btn-small btn-danger show-modal" href="{{ user.url_delete|raw }}" title="{{ label_delete }}" data-modal-id="delete" data-modal-param="{{ user.user_name }}">
<i class="icon-remove icon-white"></i>
</a>
</div>
</div>
</div>
<div class="visible-phone">
<div class="table-body">
<div class="table-row"><div class="table-cell-details tight">{{ label_email }}:&nbsp;</div><div class="table-cell-details">{{ user.email }}</div></div>
<div class="table-row"><div class="table-cell-details tight">{{ label_mobile }}:&nbsp;</div><div class="table-cell-details">{{ user.mobile }}</div></div>
<div class="table-row"><div class="table-cell-details tight">{{ label_servers }}:&nbsp;</div><div class="table-cell-details">{% for server in user.emp_servers %} {{ server.label }}<br/> {% endfor %}</div></div>
</div>
</div>
</td>
<td class="visible-desktop nowrap"><div class="table-cell-title">{{ user.name }}</div></td>
<td class="visible-desktop tight"><div class="table-cell-title">{{ user.level_text }}</div></td>
<td class="hidden-phone tight"><div class="table-cell-title">{{ user.email }}</div></td>
<td class="hidden-phone tight"><div class="table-cell-title">{{ user.mobile }}</div></td>
<td class="hidden-phone"><div class="table-cell-title">{% for server in user.emp_servers %} {{ server.label }}<br/> {% endfor %}</div></td>
<td class="hidden-phone tight">
<a class="btn btn-small" href="{{ user.url_edit|raw }}" title="{{ label_edit }}">
<i class="icon-pencil"></i>
</a>
<a class="btn btn-small btn-danger show-modal" href="{{ user.url_delete|raw }}" title="{{ label_delete }}" data-modal-id="delete" data-modal-param="{{ user.user_name }}">
<i class="icon-remove icon-white"></i>
</a>
</td>
</tr>
{% endfor %}
</tbody>
</table>

View File

@ -0,0 +1,83 @@
<form class="form-horizontal well" action="{{ url_save|raw }}" method="post">
<fieldset>
<legend>{{ titlemode }}</legend>
<div class="control-group">
<label class="control-label" for="user_name">{{ label_user_name }}</label>
<div class="controls">
<input type="text" id="user_name" name="user_name" value="{{ edit_value_user_name }}" maxlength="64" required>
</div>
</div>
<div class="control-group">
<label class="control-label" for="name">{{ label_name }}</label>
<div class="controls">
<input type="text" id="name" name="name" value="{{ edit_value_name }}" maxlength="255" required>
</div>
</div>
<div class="control-group">
<label class="control-label" for="level">{{ label_level }}</label>
<div class="controls">
<select id="level" name="level">
{% for level in levels %}
<option value="{{ level.value }}" {% if level.value == user_level %} selected="selected" {% endif %}>{{ level.label }}</option>
{% endfor %}
</select>
<p class="help-block">{{ label_level_description|raw }}</p>
</div>
</div>
<div class="control-group">
<label class="control-label" for="password">{{ label_password }}</label>
<div class="controls">
<input type="password" id="password" name="password" maxlength="255" placeholder="{{ placeholder_password }}" />
</div>
</div>
<div class="control-group">
<label class="control-label" for="password_repeat">{{ label_password_repeat }}</label>
<div class="controls">
<input type="password" id="password_repeat" name="password_repeat" maxlength="255" placeholder="{{ placeholder_password }}" />
</div>
</div>
<div class="control-group">
<label class="control-label" for="email">{{ label_email }}</label>
<div class="controls">
<input type="text" id="email" name="email" value="{{ edit_value_email }}" maxlength="255" required>
</div>
</div>
<div class="control-group">
<label class="control-label" for="mobile">{{ label_mobile }}</label>
<div class="controls">
<input type="text" id="mobile" name="mobile" value="{{ edit_value_mobile }}" maxlength="15" />
</div>
</div>
<div class="control-group">
<label class="control-label">{{ label_pushover }}</label>
<div class="controls">{{ label_pushover_description|raw }} </div>
</div>
<div class="control-group">
<label class="control-label" for="mobile">{{ label_pushover_key }}</label>
<div class="controls">
<input type="text" id="pushover_key" name="pushover_key" value="{{ edit_value_pushover_key }}" maxlength="255" />
</div>
</div>
<div class="control-group">
<label class="control-label" for="mobile">{{ label_pushover_device }}</label>
<div class="controls">
<input type="text" id="pushover_device" name="pushover_device" value="{{ edit_value_pushover_device }}" maxlength="255" />
<p class="help-block">{{ label_pushover_device_description }}</p>
</div>
</div>
<div class="control-group">
<label class="control-label" for="server_id">{{ label_servers }}</label>
<div class="controls">
<select class="multiselect" multiple="multiple" id="server_id" name="server_id[]">
{% for server in servers %}
<option value="{{ server.server_id }}" {{ server.edit_selected }}> {{ server.label }}</option>
{% endfor %}
</select>
</div>
</div>
<div class="form-actions">
<button class="btn btn-success" type="submit">{{ label_save }}</button>
<button class="btn" onclick="history.back();return false;" >{{ label_go_back }}</button>
</div>
</fieldset>
</form>

View File

@ -0,0 +1,14 @@
<div id="{{ modal_id }}Modal" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="{{ modal_id }}ModalLabel" aria-hidden="true">
<div class="modal-header">
<h3 id="{{ modal_id }}ModalLabel">{{ modal_title }}</h3>
</div>
<div class="modal-body">
<p>{{ modal_body|raw }}</p>
</div>
<div class="modal-footer">
{% if has_cancel %}
<button class="btn btn-default" data-dismiss="modal" aria-hidden="true">{{ label_cancel }}</button>
{% endif %}
<button class="btn btn-{{ modal_button_type }} modalOKButton" >{{ modal_button_label }}</button>
</div>
</div>

View File

@ -0,0 +1,26 @@
<div id="sidebar-container">
<div class="sidebar-nav">
<ul class="nav nav-list">
<li class="nav-header">{{ subtitle }}</li>
{% for item in items %}
<li class="{{ item.class_active }}">
{% if item.type == 'link' %}
<a href="{{ item.url|raw }}"><i class="icon-{{ item.icon }}"></i>&nbsp;{{ item.label }}</a>
{% elseif item.type == 'button' %}
<button class="btn btn-{{ item.btn_class }}" onclick="{{ item.onclick|raw }}"><i class="icon-{{ item.icon }}"></i>&nbsp;{{ item.label }}</button>
{% elseif item.type == 'dropdown' %}
<div class="btn-group">
<button class="btn btn-{{ item.btn_class }} dropdown-toggle" data-toggle="dropdown"><i class="icon-{{ item.icon }}"></i>&nbsp;{{ item.label }} <span class="caret"></span></button>
<ul class="dropdown-menu">
{% for option in item.options %}
<li class="{{ option.class_active }}"><a href="{{ option.url|raw }}">{{ option.label }}</a></li>
{% endfor %}
</ul>
</div>
{% endif %}
</li>
{% endfor %}
</ul>
<div class="clearfix"></div>
</div>
</div>

View File

@ -1,4 +0,0 @@
<!--%tpl_error-->
<h2>{label_title}</h2>
<p>{label_description}</p>
<!--%%tpl_error-->

View File

@ -1,160 +0,0 @@
<!--%tpl_install-->
<div class="hero-unit">
<h2><a href="http://www.phpservermonitor.org/"><img class="pull-right" src="static/opensource.png" width="100" alt="" /></a> &nbsp;PHP Server Monitor</h2>
<p>&nbsp;</p>
{html_install}
</div>
<!--%%tpl_install-->
<!--%tpl_install_index-->
<p>Welcome to the installation of PHP Server Monitor. This page will guide you through the steps to install or upgrade your monitor.</p>
<p>Before we start, we need to verify your system meets the requirements.
If you see any errors in the list below, you may still continue, but PHP Server Monitor may not work correctly.
It is recommended you fix any errors before continuing.
</p>
{html_results}
<p>&nbsp;</p>
<p>
<a class="btn btn-primary btn-large" href="install.php?action=config">Let's go</a>
</p>
<!--%%tpl_install_index-->
<!--%tpl_install_config_upgrade-->
<p>We have discovered a previous version.</p>
<p>In the next step we will upgrade your database to the latest version.</p>
{html_results}
<p>&nbsp;</p>
<p><a class="btn btn-primary btn-large" href="install.php?action=install">Upgrade to {version}</a></p>
<!--%%tpl_install_config_upgrade-->
<!--%tpl_install_config_new_user-->
<p>Sweet, your database connection is up and running!</p>
<p>Next, please set up a new account to access your monitor:</p>
{html_results}
<p>&nbsp;</p>
<div class="row-fluid">
<div class="span6">
<form id="psm_config" class="form-horizontal" action="install.php?action=install" method="post">
<div class="control-group">
<label class="control-label" for="username">Username</label>
<div class="controls">
<input type="text" id="username" name="username" value="{username}">
</div>
</div>
<div class="control-group">
<label class="control-label" for="password">Password</label>
<div class="controls">
<input type="password" id="password" name="password" value="">
</div>
</div>
<div class="control-group">
<label class="control-label" for="password_repeat">Password repeat</label>
<div class="controls">
<input type="password" id="password_repeat" name="password_repeat" value="">
</div>
</div>
<div class="control-group">
<label class="control-label" for="email">Email</label>
<div class="controls">
<input type="text" id="email" name="email" value="{email}" />
</div>
</div>
<div class="control-group">
<div class="controls">
<button type="submit" class="btn btn-primary btn-large">Install</button>
</div>
</div>
</form>
</div>
{html_config_copy}
</div>
<!--%%tpl_install_config_new_user-->
<!--%tpl_install_config_new-->
<div class="row-fluid">
<div class="span12">{html_results}</div>
</div>
<div class="row-fluid">
<div class="span6">
<form id="psm_config" class="form-horizontal" action="install.php?action=config" method="post">
<p>Please enter your database info:</p>
<div class="control-group">
<label class="control-label" for="host">Database host</label>
<div class="controls">
<input type="text" id="host" name="host" value="{host}" />
</div>
</div>
<div class="control-group">
<label class="control-label" for="name">Database name</label>
<div class="controls">
<input type="text" id="name" name="name" value="{name}" placeholder="db name" />
</div>
</div>
<div class="control-group">
<label class="control-label" for="user">Database user</label>
<div class="controls">
<input type="text" id="user" name="user" value="{user}" placeholder="db user" />
</div>
</div>
<div class="control-group">
<label class="control-label" for="pass">Database password</label>
<div class="controls">
<input type="password" id="pass" name="pass" value="{pass}" placeholder="db password" />
</div>
</div>
<div class="control-group">
<label class="control-label" for="prefix">Table prefix</label>
<div class="controls">
<input type="text" id="prefix" name="prefix" value="{prefix}" />
</div>
</div>
<div class="control-group">
<div class="controls">
<button type="submit" class="btn">Save configuration</button>
</div>
</div>
</form>
</div>
{html_config_copy}
</div>
<!--%%tpl_install_config_new-->
<!--%tpl_install_config_new_copy-->
<div class="span6">
<h3>Your config file:</h3>
<div class="alert alert-error">Unable to save your configuration.</div>
<p>Your database information is valid, however we are unable to create the configuration file automatically.
Please create a new file in the project directory called "config.php" and copy the information below.</p>
<p>After you have copied the configuration, press the button to continue.</p>
<p class="pull-left"><textarea rows="10">{php_config}</textarea></p>
<p class="offset2"><input type="submit" class="btn btn-primary" value="I have saved the configuration" onclick="location.reload(true);" /></p>
</div>
<!--%%tpl_install_config_new_copy-->
<!--%tpl_install_success-->
<div class="row-fluid">
<div class="span12">{html_results}</div>
</div>
<div class="row-fluid">
<div class="span12">
<p>&nbsp;</p>
<p>The installation is complete. Please check above if errors have occurred.<br>
If no errors have occurred, you are good to go.<br><br></p>
<p>
<a class="btn btn-primary btn-large" href="index.php">Go to your monitor</a>
<a class="btn btn-large" target="_blank" href="http://www.phpservermonitor.org/">PHP Server Monitor</a>
<a class="btn btn-large" target="_blank" href="http://twitter.github.com/bootstrap/">Twitter Bootstrap</a>
</p>
</div>
</div>
<!--%%tpl_install_success-->
<!--%tpl_install_results-->
<!--%tpl_repeat_resultmsgs-->
<div>
<p class="pull-left"><span class="label label-{shortcode}">{shortcode}</span></p>
<p class="offset1">{message}</p>
</div>
<!--%%tpl_repeat_resultmsgs-->
{resultmsgs}
<!--%%tpl_install_results-->

View File

@ -1,110 +0,0 @@
<!--%tpl_main-->
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>{title}</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1, minimum-scale=1">
<meta name="description" content="">
<meta name="author" content="">
<link rel="icon" type="image/x-icon" href="favicon.ico" />
<link rel="icon" type="image/png" href="favicon.png" />
{auto_refresh}
<!-- Le styles -->
<link href="static/plugin/twitter-bootstrap/css/bootstrap.min.css" rel="stylesheet">
<link href="static/plugin/twitter-bootstrap/css/bootstrap-responsive.min.css" rel="stylesheet">
<link href="static/plugin/bootstrap-multiselect/bootstrap-multiselect.min.css" rel="stylesheet">
<link href="static/css/style.css" rel="stylesheet">
<!-- Le HTML5 shim, for IE6-8 support of HTML5 elements -->
<!--[if lt IE 9]>
<script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
<script type="text/javascript" src="static/plugin/jquery-1.7.1.min.js"></script>
<script type="text/javascript" src="static/plugin/twitter-bootstrap/js/bootstrap.min.js"></script>
<script type="text/javascript" src="static/plugin/bootstrap-multiselect/bootstrap-multiselect.min.js"></script>
<script type="text/javascript" src="static/js/scripts.js"></script>
</head>
<body data-spy="scroll" data-target=".subnav" data-offset="50" class="{body_class}">
<!-- navbar -->
<div class="navbar navbar-fixed-top">
<div class="navbar-inner">
<div class="container-fluid">
<a class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</a>
<a class="brand" href="index.php">{title}</a>
{html_menu}
</div>
</div>
</div>
<!-- /navbar -->
{html_modal}
<!-- container -->
<div id="main-container">
<div class="page-header">
<div class="header-label"><h1>{subtitle}</h1></div>
<div class="header-accessories">{header_accessories}</div>
</div>
<div id="main-content">
{html_sidebar}
<div id="page-container">
<div id="flashmessage" class="hide">
<!--%tpl_repeat_messages-->
<div class="alert alert-{shortcode}">
<p class="pull-left span1"><i class="icon-{icon}"></i></p>
<p>{message}</p>
</div>
<!--%%tpl_repeat_messages-->
{messages}
</div>
{content}
</div>
</div>
{html_footer}
</div>
<!-- /container -->
</body>
</html>
<!--%%tpl_main-->
<!--%tpl_main_menu-->
<div class="nav-collapse">
<ul class="nav">
<!--%tpl_repeat_menu-->
<li class="{active}">
<a href="{url}">{label}</a>
</li>
<!--%%tpl_repeat_menu-->
{menu}
<li id="nav_option_help">
<a href="http://www.phpservermonitor.org/support" target="_blank">{label_help}</a>
</li>
</ul>
<ul class="nav pull-right">
<li class="dropdown visible-desktop">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">{label_usermenu} <b class="caret"></b></a>
<ul class="dropdown-menu">
<li><a href="{url_profile}"><i class="icon-cog"></i>&nbsp;{label_profile}</a></li>
<li><a href="{url_logout}"><i class="icon-off"></i>&nbsp;{label_logout}</a></li>
</ul>
</li>
<li class="hidden-desktop divider"></li>
<li class="hidden-desktop"><a href="{url_profile}">{label_profile}</a></li>
<li class="hidden-desktop"><a href="{url_logout}">{label_logout}</a></li>
</ul>
</div>
<!--%%tpl_main_menu-->
<!--%tpl_main_auto_refresh-->
<meta http-equiv="refresh" content="{seconds}" />
<!--%%tpl_main_auto_refresh-->
<!--%tpl_main_footer-->
<footer class="footer">
<p class="pull-right"><a href="#">{label_back_to_top}</a></p>
<p class="powered"><small>Powered by <a href="http://www.phpservermonitor.org/" target="_blank">PHP Server Monitor {version}</a>.<br/>{update_available}</small></p>
</footer>
<!--%%tpl_main_footer-->

View File

@ -1,14 +0,0 @@
<!--%tpl_main_modal_container-->
<div id="{modal_id}Modal" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="{modal_id}ModalLabel" aria-hidden="true">
<div class="modal-header">
<h3 id="{modal_id}ModalLabel">{modal_title}</h3>
</div>
<div class="modal-body">
<p>{modal_body}</p>
</div>
<div class="modal-footer">
<!--?has_cancel--><button class="btn btn-default" data-dismiss="modal" aria-hidden="true">{label_cancel}</button><!--??has_cancel-->
<button class="btn btn-{modal_button_type} modalOKButton" >{modal_button_label}</button>
</div>
</div>
<!--%%tpl_main_modal_container-->

View File

@ -1,37 +0,0 @@
<!--%tpl_main_sidebar_container-->
<div id="sidebar-container">
<div class="sidebar-nav">
<ul class="nav nav-list">
<li class="nav-header">{subtitle}</li>
<!--%tpl_repeat_items-->
<li class="{class_active}">{html_item}</li>
<!--%%tpl_repeat_items-->
{items}
</ul>
<div class="clearfix"></div>
</div>
</div>
<!--%%tpl_main_sidebar_container-->
<!--%tpl_main_sidebar_types_link--><a href="{url}"><i class="icon-{icon}"></i>&nbsp;{label}</a><!--%%tpl_main_sidebar_types_link-->
<!--%tpl_main_sidebar_types_button-->
<button class="btn btn-{btn_class}" onclick="{onclick}">
<i class="icon-{icon}"></i>&nbsp;{label}
</button>
<!--%%tpl_main_sidebar_types_button-->
<!--%tpl_main_sidebar_types_dropdown-->
<div class="btn-group">
<button class="btn btn-{btn_class} dropdown-toggle" data-toggle="dropdown">
<i class="icon-{icon}"></i>&nbsp;{label}
<span class="caret"></span>
</button>
<ul class="dropdown-menu">
<!--%tpl_repeat_options-->
<li class="{class_active}"><a href="{url}">{label}</a>
<!--%%tpl_repeat_options-->
{options}
</ul>
</div>
<!--%%tpl_main_sidebar_types_dropdown-->

View File

@ -1,75 +0,0 @@
<!--%tpl_server_log_list-->
<div class="tabbable">
<ul class="nav nav-tabs">
<li class="active"><a href="#log_status_content" data-toggle="tab">{label_status}</a></li>
<li><a href="#log_email_content" data-toggle="tab">{label_email}</a></li>
<li><a href="#log_sms_content" data-toggle="tab">{label_sms}</a></li>
<li><a href="#log_pushover_content" data-toggle="tab">{label_pushover}</a></li>
</ul>
<div class="tab-content well">
<div class="tab-pane active" id="log_status_content">
{content_status}
</div>
<div class="tab-pane" id="log_email_content">
{content_email}
</div>
<div class="tab-pane" id="log_sms_content">
{content_sms}
</div>
<div class="tab-pane" id="log_pushover_content">
{content_pushover}
</div>
</div>
</div>
<!--%%tpl_server_log_list-->
<!--%tpl_server_log_entries-->
<!-- {logtitle} -->
<table class="table table-bordered table-striped">
<thead>
<tr>
<th class="hidden-phone">{label_server}</th>
<th class="hidden-phone">{label_message}</th>
<th class="hidden-phone">{label_date}</th>
<!--?has_users--><th class="hidden-phone">{label_users}</th><!--??has_users-->
</tr>
</thead>
<tbody>
<!--%tpl_repeat_entries-->
<tr class="{class}">
<td>
<div class="table-body">
<div class="table-cell">
<div class="visible-phone pull-right">
&nbsp;{datetime_format}
</div>
<i class="{type_icon}" title="{type_title}"></i> <span class="title">{server}</span> {ip}
</div>
</div>
<div class="visible-phone">
<div class="table-separator"/></div>
<div class="table-body">
<div class="table-cell-details">{message}</div>
</div>
</div>
<!--?has_users--><div class="visible-phone">
<div class="table-separator"/></div>
<div class="table-body">
<div class="table-cell-details">{label_users}: {user_list}</div>
</div>
</div><!--??has_users-->
</td>
<td class="hidden-phone">{message}</td>
<td class="hidden-phone tight">{datetime_format}</td>
<!--?has_users--><td class="hidden-phone tight">{users}</td><!--??has_users-->
</tr>
<!--%%tpl_repeat_entries-->
{entries}
<!--?no_logs-->
<tr class="{class}">
<td colspan="4" class="cell-center">{label_no_logs}</td>
</tr>
<!--??no_logs-->
</tbody>
</table>
<!--%%tpl_server_log_entries-->

View File

@ -1,180 +0,0 @@
<!--%tpl_server_list-->
<table class="table table-bordered table-striped">
<thead>
<tr>
<th class="hidden-phone">&nbsp;</th>
<th class="hidden-phone">{label_label}</th>
<th class="hidden-phone">{label_domain}</th>
<th class="visible-desktop">{label_port}</th>
<th class="visible-desktop">{label_type}</th>
<th class="hidden-phone">{label_rtime}</th>
<th class="hidden-phone">{label_last_online}</th>
<th class="hidden-phone">{label_monitoring}</th>
<th class="hidden-phone">{label_action}</th>
</tr>
</thead>
<tbody>
<!--%tpl_repeat_servers-->
<tr>
<td class="hidden-phone"><div class="table-cell-title"><span class="label label-status-{status}"><a href="{url_view}" title="{error}">{status}</a></span></div></td>
<td class="hidden-phone"><div class="table-cell-title"><a href="{url_view}">{label}</a></div></td>
<td class="nowrap visible-tablet"><div class="table-cell-title"><i class="{type_icon}" title="{type}"></i> {ip_short}</div></td>
<td class="nowrap visible-desktop"><div class="table-cell-title">{ip}</div></td>
<td class="nowrap visible-desktop"><div class="table-cell-title">{port}</div></td>
<td class="nowrap visible-desktop"><div class="table-cell-title">{type}</div></td>
<td class="nowrap hidden-phone"><div class="table-cell-title">{rtime} s</div></td>
<td class="nowrap hidden-phone"><div class="table-cell-title">{last_online}</div></td>
<td class="tight hidden-phone"><div class="table-cell-title"><i class="{active_icon}" title="{active_title}"></i> <i class="{email_icon}" title="{label_email}"></i> <i class="{sms_icon}" title="{label_sms}"></i> <i class="{pushover_icon}" title="Pushover"></i></div></td>
<td class="tight hidden-phone">
<div class="table-cell-title">
<a class="btn btn-small" href="{url_view}"><i class="icon-chart"></i></a>
{html_actions}
</div>
</td>
<td class="visible-phone">
<div class="table-body">
<div class="table-cell-title">
<span class="label label-status-{status}"><a href="{url_view}" title="{error}">{status}</a></span>
<a class="title" href="{url_view}">{label}</a>
</div>
<div class="table-cell tight">
&nbsp;<a class="btn btn-small" href="{url_view}"><i class="icon-chart"></i></a>
{html_actions}
</div>
</div>
<div class="table-body">
<div class="table-row">
<div class="table-cell"><i class="{type_icon}" title="{type}"></i> {ip_short}</div>
<div class="table-cell tight">
<i class="{active_icon}" title="{active_title}"></i> <i class="{email_icon}" title="{label_email}"></i> <i class="{sms_icon}" title="{label_sms}"></i> <i class="{pushover_icon}" title="Pushover"></i>
</div>
</div>
</div>
<div class="table-body">
<div class="table-row"><div class="table-cell-details tight">{label_rtime}: &nbsp;</div><div class="table-cell-details">{rtime} s</div></div>
<div class="table-row"><div class="table-cell-details tight">{label_last_online}: &nbsp;</div><div class="table-cell-details">{last_online}</div></div>
</div>
</td>
</tr>
<!--%%tpl_repeat_servers-->
{servers}
</tbody>
</table>
<!--%%tpl_server_list-->
<!--%tpl_server_list_admin_actions-->
<a class="btn btn-small" href="{url_edit}" title="{label_edit}">
<i class="icon-pencil"></i>
</a>
<a class="btn btn-small btn-danger show-modal" href="{url_delete}" title="{label_delete}" data-modal-id="delete" data-modal-param="{label}">
<i class="icon-remove icon-white"></i>
</a>
<!--%%tpl_server_list_admin_actions-->
<!--%tpl_server_update-->
<form class="form-horizontal well" action="{url_save}" method="post">
<fieldset>
<legend>{titlemode}</legend>
<div class="control-group">
<label class="control-label" for="label">{label_label}</label>
<div class="controls">
<input type="text" id="label" name="label" value="{edit_value_label}" maxlength="255" />
</div>
</div>
<div class="control-group">
<label class="control-label" for="ip">{label_domain}</label>
<div class="controls">
<input type="text" id="ip" name="ip" value="{edit_value_ip}" maxlength="100" />
</div>
</div>
<div class="control-group">
<label class="control-label" for="type">{label_type}</label>
<div class="controls">
<select id="type" name="type">
<option value="service" {edit_type_selected_service}>{label_service}</option>
<option value="website" {edit_type_selected_website}>{label_website}</option>
</select>
</div>
</div>
<div class="control-group">
<label class="control-label" for="port">{label_port}</label>
<div class="controls">
<input class="input-mini" type="text" id="port" name="port" value="{edit_value_port}" maxlength="5" />
</div>
</div>
<div class="control-group">
<label class="control-label" for="pattern">{label_pattern}</label>
<div class="controls">
<input type="text" id="pattern" name="pattern" value="{edit_value_pattern}" maxlength="255" data-toggle="tooltip" title="{label_pattern_description}" />
</div>
</div>
<div class="control-group">
<label class="control-label" for="warning_threshold">{label_warning_threshold}</label>
<div class="controls">
<input class="input-mini" type="text" id="warning_threshold" name="warning_threshold" value="{edit_value_warning_threshold}" maxlength="5" data-toggle="tooltip" title="{label_warning_threshold_description}" />
</div>
</div>
<div class="control-group">
<label class="control-label" for="timeout">{label_timeout}</label>
<div class="controls">
<input class="input-mini" type="text" id="timeout" name="timeout" value="{edit_value_timeout}" placeholder="{default_value_timeout}" maxlength="10" data-toggle="tooltip" title="{label_timeout_description}" /> s
</div>
</div>
<div class="control-group">
<label class="control-label" for="active">{label_monitoring}</label>
<div class="controls">
<select id="active" name="active">
<option value="yes" {edit_active_selected_yes}>{label_yes}</option>
<option value="no" {edit_active_selected_no}>{label_no}</option>
</select>
</div>
</div>
<div class="control-group {control_class_email}">
<label class="control-label" for="email">{label_send_email} {warning_email}</label>
<div class="controls">
<select id="email" name="email">
<option value="yes" {edit_email_selected_yes}>{label_yes}</option>
<option value="no" {edit_email_selected_no}>{label_no}</option>
</select>
</div>
</div>
<div class="control-group {control_class_sms}">
<label class="control-label" for="sms">{label_send_sms} {warning_sms}</label>
<div class="controls">
<select id="sms" name="sms">
<option value="yes" {edit_sms_selected_yes}>{label_yes}</option>
<option value="no" {edit_sms_selected_no}>{label_no}</option>
</select>
</div>
</div>
<div class="control-group {control_class_pushover}">
<label class="control-label" for="pushover">{label_pushover} {warning_pushover}</label>
<div class="controls">
<select id="pushover" name="pushover">
<option value="yes" {edit_pushover_selected_yes}>{label_yes}</option>
<option value="no" {edit_pushover_selected_no}>{label_no}</option>
</select>
</div>
</div>
<div class="control-group">
<label class="control-label" for="user_id">{label_users}</label>
<div class="controls">
<select class="multiselect" multiple="multiple" id="user_id" name="user_id[]">
<!--%tpl_repeat_users-->
<option value="{user_id}" {edit_selected}> {name}</option>
<!--%%tpl_repeat_users-->
{users}
</select>
</div>
</div>
<div class="form-actions">
<button class="btn btn-success" type="submit">{label_save}</button>
<a class="btn" href="{url_go_back}" >{label_go_back}</a>
</div>
</fieldset>
</form>
<!--%%tpl_server_update-->
<!--%tpl_server_update_warning-->
<p class="help-inline"><i class="icon-warning-sign" data-toggle="tooltip" title="{label_warning}"></i></p>
<!--%%tpl_server_update_warning-->

View File

@ -1,73 +0,0 @@
<!--%tpl_server_status-->
<div class="tab-content">
<div id="flow-layout" class="tab-pane {block_layout_active}">
<div class="entity-container">
<!--%tpl_repeat_servers_offline-->
<div class="offline">
<div class="entity {class_warning}" onclick="window.location.href='{url_view}'">
<h2>{label}</h2>
<p>{label_last_online}: {last_online_nice}</p>
<p>{label_last_check}: {last_checked_nice}</p>
</div>
</div>
<!--%%tpl_repeat_servers_offline-->
{servers_offline}
<!--%tpl_repeat_servers_online-->
<div class="online">
<div class="entity" onclick="window.location.href='{url_view}'">
<h2>{label}</h2>
<p>{label_last_online}: {last_online_nice}</p>
<p>{label_rtime}: {rtime}s</p>
</div>
</div>
<!--%%tpl_repeat_servers_online-->
{servers_online}
</div>
</div>
<div id="list-layout" class="tab-pane {list_layout_active}">
<div class="entity-container">
<table class="table table-bordered">
<tbody>
<!--%tpl_repeat_servers_offline2-->
<tr class="row-offline" onclick="window.location.href='{url_view}'">
<td class="{class_warning}"><div class="server-name">{label}</div>
<div class="visible-phone">
<div class="table-body">
<div class="table-row"><div class="table-cell-details tight">{label_last_online}: &nbsp;</div><div class="table-cell-details">{last_online_nice}</div></div>
<div class="table-row"><div class="table-cell-details tight">{label_last_check}: &nbsp;</div><div class="table-cell-details">{last_checked_nice}</div></div>
</div>
</div>
</td>
<td class="{class_warning} hidden-phone">{label_last_online}: {last_online_nice}</td>
<td class="{class_warning} hidden-phone">{label_last_check}: {last_checked_nice}</td>
</tr>
<!--%%tpl_repeat_servers_offline2-->
{servers_offline2}
<!--%tpl_repeat_servers_online2-->
<tr class="row-online" onclick="window.location.href='{url_view}'">
<td><div class="server-name">{label}</div>
<div class="visible-phone">
<div class="table-body">
<div class="table-row"><div class="table-cell-details tight">{label_last_online}: &nbsp;</div><div class="table-cell-details">{last_online_nice}</div></div>
<div class="table-row"><div class="table-cell-details tight">{label_rtime}: &nbsp;</div><div class="table-cell-details">{rtime}</div></div>
</div>
</div>
</td>
<td class="hidden-phone">{label_last_online}: {last_online_nice}</td>
<td class="hidden-phone">{label_rtime}: {rtime}s</td>
</tr>
<!--%%tpl_repeat_servers_online2-->
{servers_online2}
</tbody>
</table>
</div>
</div>
</div>
<!--%%tpl_server_status-->
<!--%tpl_status_layout_selector-->
<div class="btn-group" data-toggle="buttons-radio">
<button class="btn {block_layout_active}" data-toggle="tab" data-target="#flow-layout" onclick="psm_saveLayout(0)"><i class="icon-th-large"></i></button>
<button class="btn {list_layout_active}" data-toggle="tab" data-target="#list-layout" onclick="psm_saveLayout(1)"><i class="icon-th-list"></i></button>
</div>
<!--%%tpl_status_layout_selector-->

View File

@ -1,96 +0,0 @@
<!--%tpl_server_view-->
<table class="table table-bordered">
<colgroup>
<col class="oce-first" />
<col />
</colgroup>
<thead>
<tr class="head">
<th colspan="2">
<div class="btn-group">
<button class="btn btn-success dropdown-toggle" data-toggle="dropdown">
<i class="icon-th icon-white"></i>&nbsp;{label}
<span class="caret"></span>
</button>
<ul class="dropdown-menu">
<!--%tpl_repeat_options-->
<li class="{class_active}"><a href="{url}">{label}</a>
<!--%%tpl_repeat_options-->
{options}
</ul>
</div>
</th>
</tr>
</thead>
<tbody>
<tr>
<td>{label_status}:</td>
<td>
<span class="label label-status-{status}">
<a href="#" title="{error}">{status}</a>
</span>&nbsp;{error}
</td>
</tr>
<tr>
<td>{label_type}:</td>
<td>{type}</td>
</tr>
<tr>
<td>{label_domain}:</td>
<td>{ip}</td>
</tr>
<tr>
<td>{label_port}:</td>
<td>{port}</td>
</tr>
<tr>
<td>{label_last_check}:</td>
<td>{last_check}</td>
</tr>
<tr>
<td>{label_last_online}:</td>
<td>{last_online}</td>
</tr>
<tr>
<td>{label_rtime}:</td>
<td>{rtime} s</td>
</tr>
<tr>
<td>{label_monitoring}:</td>
<td>{active}</td>
</tr>
<tr>
<td>{label_email}:</td>
<td>{email}</td>
</tr>
<tr>
<td>{label_sms}:</td>
<td>{sms}</td>
</tr>
<tr>
<td>{label_pushover}:</td>
<td>{pushover}</td>
</tr>
<tr>
<td>{label_timeout}:</td>
<td>{timeout} s</td>
</tr>
{html_actions}
</tbody>
</table>
{html_history}
<!--%%tpl_server_view-->
<!--%tpl_server_view_admin_actions-->
<tr>
<td class="hidden-small">&nbsp;</td>
<td class="action-small" colspan="2">
<a class="btn btn-success" href="{url_edit}">
<i class="icon-edit icon-white"></i>&nbsp;{label_edit}
</a>
<a class="btn btn-danger show-modal" href="{url_delete}" data-modal-id="delete" data-modal-param="{server_name}">
<i class="icon-remove icon-white"></i>&nbsp;{label_delete}
</a>
</td>
</tr>
<!--%%tpl_server_view_admin_actions-->

View File

@ -1,39 +0,0 @@
<!--%tpl_user_login-->
<div class="container">
<form class="form-signin" method="post">
<h3 class="form-signin-heading">{title_sign_in}</h3>
<input type="text" name="user_name" class="input-block-level" placeholder="{label_username}" value="{value_user_name}" required>
<input type="password" name="user_password" class="input-block-level" placeholder="{label_password}" required>
<input type="hidden" name="action" value="login">
<label class="checkbox">
<input type="checkbox" name="user_rememberme" value="1" {value_rememberme}> {label_remember_me}
</label>
<button class="btn btn-primary" type="submit">{label_login}</button>
<a class="btn" href="?action=forgot">{label_password_forgot}</a>
</form>
</div>
<!--%%tpl_user_login-->
<!--%tpl_user_login_forgot-->
<div class="container">
<form class="form-signin" method="post">
<h3 class="form-signin-heading">{title_forgot}</h3>
<input type="text" name="user_name" class="input-block-level" placeholder="{label_username}" value="{value_user_name}" required>
<button class="btn btn-primary" type="submit">{label_submit}</button>
<a class="btn" href="?">{label_go_back}</a>
</form>
</div>
<!--%%tpl_user_login_forgot-->
<!--%tpl_user_login_reset-->
<div class="container">
<form class="form-signin" method="post">
<h3 class="form-signin-heading">{title_reset}</h3>
<input type="text" name="user_name" class="input-block-level" placeholder="{label_username}" value="{value_user_name}" required disabled="disabled">
<input type="password" name="user_password_new" class="input-block-level" placeholder="{label_password}" required autocomplete="off">
<input type="password" name="user_password_repeat" class="input-block-level" placeholder="{label_password_repeat}" required autocomplete="off">
<button class="btn btn-primary" type="submit">{label_reset}</button>
<a class="btn" href="?">{label_go_back}</a>
</form>
</div>
<!--%%tpl_user_login_reset-->

View File

@ -1,74 +0,0 @@
<!--%tpl_user_profile-->
<form class="form-horizontal well" action="{form_action}" method="post">
<fieldset>
<div class="row-fluid">
<div class="span6">
<div class="control-group">
<label class="control-label" for="user_name">{label_user_name}</label>
<div class="controls">
<input type="text" id="user_name" name="user_name" value="{user_name}" maxlength="64" required autofocus=>
</div>
</div>
<div class="control-group">
<label class="control-label" for="name">{label_name}</label>
<div class="controls">
<input type="text" id="name" name="name" value="{name}" maxlength="255" required>
</div>
</div>
<div class="control-group">
<label class="control-label" for="level">{label_level}</label>
<div class="controls"><input type="text" value="{level}" disabled="disabled" /></div>
</div>
<div class="control-group">
<label class="control-label" for="password">{label_password}</label>
<div class="controls">
<input type="password" id="password" name="password" maxlength="255" placeholder="{placeholder_password}" />
</div>
</div>
<div class="control-group">
<label class="control-label" for="password_repeat">{label_password_repeat}</label>
<div class="controls">
<input type="password" id="password_repeat" name="password_repeat" maxlength="255" placeholder="{placeholder_password}" />
</div>
</div>
<div class="control-group">
<label class="control-label" for="email">{label_email}</label>
<div class="controls">
<input type="text" id="email" name="email" value="{email}" maxlength="255" required>
</div>
</div>
<div class="control-group">
<label class="control-label" for="email">{label_mobile}</label>
<div class="controls">
<input type="text" id="mobile" name="mobile" value="{mobile}" maxlength="15" />
</div>
</div>
</div>
<div class="span6">
<div class="control-group">
<label class="control-label">{label_pushover}</label>
<div class="controls">{label_pushover_description} </div>
</div>
<div class="control-group">
<label class="control-label" for="mobile">{label_pushover_key}</label>
<div class="controls">
<input type="text" id="pushover_key" name="pushover_key" value="{pushover_key}" maxlength="255" />
</div>
</div>
<div class="control-group">
<label class="control-label" for="mobile">{label_pushover_device}</label>
<div class="controls">
<input type="text" id="pushover_device" name="pushover_device" value="{pushover_device}" maxlength="255" />
<p class="help-block">{label_pushover_device_description}</p>
</div>
</div>
</div>
</div>
<div class="row-fluid">
<div class="form-actions">
<button class="btn btn-success" type="submit">{label_save}</button>
</div>
</div>
</fieldset>
</form>
<!--%%tpl_user_profile-->

View File

@ -1,151 +0,0 @@
<!--%tpl_user_list-->
<table class="table table-bordered table-striped">
<thead>
<tr>
<th class="hidden-phone">{label_user}</th>
<th class="visible-desktop">{label_name}</th>
<th class="visible-desktop">{label_level}</th>
<th class="hidden-phone">{label_email}</th>
<th class="hidden-phone">{label_mobile}</th>
<th class="hidden-phone">{label_servers}</th>
<th class="hidden-phone tight">{label_action}</th>
</tr>
</thead>
<tbody>
<!--%tpl_repeat_users-->
<tr>
<td>
<div class="table-body">
<div class="table-cell-title">
<span class="nowrap">
<span class="hidden-desktop"><i class="{icon_level_{level}}" title="{label_level_{level}}"></i>&nbsp;</span>
<span class="title">{user_name}</span>
</span>
<span class="hidden-desktop">({name})</span>
</div>
<div class="table-cell tight">
<div class="visible-phone">
<a class="btn btn-small" href="{url_edit}" title="{label_edit}">
<i class="icon-pencil"></i>
</a>
<a class="btn btn-small btn-danger show-modal" href="{url_delete}" title="{label_delete}" data-modal-id="delete" data-modal-param="{user_name}">
<i class="icon-remove icon-white"></i>
</a>
</div>
</div>
</div>
<div class="visible-phone">
<div class="table-body">
<div class="table-row"><div class="table-cell-details tight">{label_email}:&nbsp;</div><div class="table-cell-details">{email}</div></div>
<div class="table-row"><div class="table-cell-details tight">{label_mobile}:&nbsp;</div><div class="table-cell-details">{mobile}</div></div>
<div class="table-row"><div class="table-cell-details tight">{label_servers}:&nbsp;</div><div class="table-cell-details">{emp_servers}</div></div>
</div>
</div>
</td>
<td class="visible-desktop nowrap"><div class="table-cell-title">{name}</div></td>
<td class="visible-desktop tight"><div class="table-cell-title">{label_level_{level}}</div></td>
<td class="hidden-phone tight"><div class="table-cell-title">{email}</div></td>
<td class="hidden-phone tight"><div class="table-cell-title">{mobile}</div></td>
<td class="hidden-phone"><div class="table-cell-title">{emp_servers}</div></td>
<td class="hidden-phone tight">
<a class="btn btn-small" href="{url_edit}" title="{label_edit}">
<i class="icon-pencil"></i>
</a>
<a class="btn btn-small btn-danger show-modal" href="{url_delete}" title="{label_delete}" data-modal-id="delete" data-modal-param="{user_name}">
<i class="icon-remove icon-white"></i>
</a>
</td>
</tr>
<!--%%tpl_repeat_users-->
{users}
</tbody>
</table>
<!--%%tpl_user_list-->
<!--%tpl_user_update-->
<form class="form-horizontal well" action="{url_save}" method="post">
<fieldset>
<legend>{titlemode}</legend>
<div class="control-group">
<label class="control-label" for="user_name">{label_user_name}</label>
<div class="controls">
<input type="text" id="user_name" name="user_name" value="{edit_value_user_name}" maxlength="64" required>
</div>
</div>
<div class="control-group">
<label class="control-label" for="name">{label_name}</label>
<div class="controls">
<input type="text" id="name" name="name" value="{edit_value_name}" maxlength="255" required>
</div>
</div>
<div class="control-group">
<label class="control-label" for="level">{label_level}</label>
<div class="controls">
<select id="level" name="level">
<!--%tpl_repeat_levels-->
<option value="{value}" {selected}>{label}</option>
<!--%%tpl_repeat_levels-->
{levels}
</select>
<p class="help-block">{label_level_description}</p>
</div>
</div>
<div class="control-group">
<label class="control-label" for="password">{label_password}</label>
<div class="controls">
<input type="password" id="password" name="password" maxlength="255" placeholder="{placeholder_password}" />
</div>
</div>
<div class="control-group">
<label class="control-label" for="password_repeat">{label_password_repeat}</label>
<div class="controls">
<input type="password" id="password_repeat" name="password_repeat" maxlength="255" placeholder="{placeholder_password}" />
</div>
</div>
<div class="control-group">
<label class="control-label" for="email">{label_email}</label>
<div class="controls">
<input type="text" id="email" name="email" value="{edit_value_email}" maxlength="255" required>
</div>
</div>
<div class="control-group">
<label class="control-label" for="mobile">{label_mobile}</label>
<div class="controls">
<input type="text" id="mobile" name="mobile" value="{edit_value_mobile}" maxlength="15" />
</div>
</div>
<div class="control-group">
<label class="control-label">{label_pushover}</label>
<div class="controls">{label_pushover_description} </div>
</div>
<div class="control-group">
<label class="control-label" for="mobile">{label_pushover_key}</label>
<div class="controls">
<input type="text" id="pushover_key" name="pushover_key" value="{edit_value_pushover_key}" maxlength="255" />
</div>
</div>
<div class="control-group">
<label class="control-label" for="mobile">{label_pushover_device}</label>
<div class="controls">
<input type="text" id="pushover_device" name="pushover_device" value="{edit_value_pushover_device}" maxlength="255" />
<p class="help-block">{label_pushover_device_description}</p>
</div>
</div>
<div class="control-group">
<label class="control-label" for="server_id">{label_servers}</label>
<div class="controls">
<select class="multiselect" multiple="multiple" id="server_id" name="server_id[]">
<!--%tpl_repeat_servers-->
<option value="{server_id}" {edit_selected}> {label}</option>
<!--%%tpl_repeat_servers-->
{servers}
</select>
</div>
</div>
<div class="form-actions">
<button class="btn btn-success" type="submit">{label_save}</button>
<button class="btn" onclick="history.back();return false;" >{label_go_back}</button>
</div>
</fieldset>
</form>
<!--%%tpl_user_update-->