Commit 06b2234f authored by Michael Herold's avatar Michael Herold
Browse files

Updates to new hemio\html version

parent 1feb20b9
v0.5.0
- Fixes missing generation of global gettext .mo-files.
This fixes missing l10n in top bar also.
- Removes static css files and adds generation to Makefile
- Updates to new version of hemio\html and hemio\form
v0.4.3
- Fixes crash on missing 'Accept-Language' HTTP header.
v0.4.2
......
......@@ -55,7 +55,7 @@ class ContentNav
$nav
->addChild(new html\Header())
->addChild(new html\H1())
->addChild(new html\String(_('Services')));
->addChild(new html\Str(_('Services')));
$contentEvents = new ContentEvents($nav);
......
<?php
/*
* Copyright (C) 2015 Michael Herold <quabla@hemio.de>
*
* This program 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.
*
* This program 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 this program. If not, see <http://www.gnu.org/licenses/>.
*/
namespace hemio\edentata;
/**
* Description of System
*
* @author Michael Herold <quabla@hemio.de>
*/
class System
{
static public $requestTime;
static public $startTime;
static public $endTime;
static public function init()
{
self::$startTime = microtime(true);
self::$requestTime = filter_input(
INPUT_SERVER, 'REQUEST_TIME_FLOAT', FILTER_VALIDATE_FLOAT,
[ 'options' => ['default' => self::$startTime]]
);
}
static public function reportString()
{
return sprintf("body_time: %s\nbody_time_request: %s"
, round(microtime(true) - self::$startTime, 4)
, round(microtime(true) - self::$requestTime, 4)
);
}
}
......@@ -110,7 +110,7 @@ abstract class Window
$msg = new html\P();
$msg->addCssClass('text');
$msg->addChild(new html\String($message));
$msg->addChild(new html\Str($message));
if ($protectedDelete) {
$switch = new gui\FieldSwitch('enable_delete', _('Permit Deletion'));
......@@ -121,7 +121,7 @@ abstract class Window
$hint = new html\P;
$hint->addCssClass('hint');
$hint->addChild(new html\String(_('You must activate the switch before you can submit')));
$hint->addChild(new html\Str(_('You must activate the switch before you can submit')));
}
$cancelButton = new gui\LinkButton(
......
......@@ -39,9 +39,9 @@ class Explanation extends \hemio\form\Container
}
$this['div']['h2'] = new html\H2();
$this['div']['h2'][] = new html\String($event::title());
$this['div']['h2'][] = new html\Str($event::title());
$this['div']['p'] = new html\P();
$this['div']['p'][] = new html\String($event->getMessage());
$this['div']['p'][] = new html\Str($event->getMessage());
}
}
......@@ -69,7 +69,7 @@ class FieldEmailWithSelect extends \hemio\form\Container
$p['at'] = new html\Span();
$p['at']->addCssClass('between');
$p['at']->addChild(new html\String('@'));
$p['at']->addChild(new html\Str('@'));
$p['select'] = new html\Span();
$p['select']->addCssClass('select');
......
<?php
/*
* Copyright (C) 2015 Michael Herold <quabla@hemio.de>
*
......@@ -26,13 +25,14 @@ use hemio\html;
*
* @author Michael Herold <quabla@hemio.de>
*/
class Fieldset extends html\Fieldset {
class Fieldset extends html\Fieldset
{
public function __construct($legend = null) {
public function __construct($legend = null)
{
if ($legend) {
$this['legend'] = new html\Legend();
$this['legend']->addChild(new html\String($legend));
$this['legend']->addChild(new html\Str($legend));
}
}
}
<?php
/*
* Copyright (C) 2015 Michael Herold <quabla@hemio.de>
*
......@@ -27,12 +26,13 @@ use hemio\html;
*
* @author Michael Herold <quabla@hemio.de>
*/
class Hint extends form\Container {
class Hint extends form\Container
{
public function __construct($text) {
$this['p'] = new html\P();
public function __construct($text)
{
$this['p'] = new html\P();
$this['p']->addCssClass('hint');
$this['p'][] = new html\String($text);
$this['p'][] = new html\Str($text);
}
}
......@@ -31,6 +31,6 @@ class Link extends \hemio\html\A
$this->setAttribute('href', $request->getUrl());
if ($text !== null)
$this['text'] = new \hemio\html\String($text);
$this['text'] = new \hemio\html\Str($text);
}
}
......@@ -44,7 +44,7 @@ class LinkButton extends form\Container
}
$this['form']['button'] = new html\Button();
$this['form']['button']['text'] = new html\String($text);
$this['form']['button']['text'] = new html\Str($text);
}
public function getButtonString()
......
......@@ -42,10 +42,10 @@ class Message extends form\Container
$this['article']->addCssClass('warning');
$this['article']['h2'] = new html\H2();
$this['article']['h2'][] = new html\String($event::title());
$this['article']['h2'][] = new html\Str($event::title());
$this['article']['p'] = new html\P();
$this['article']['p'][] = new html\String($event->getMessage());
$this['article']['p'][] = new html\Str($event->getMessage());
if ($event->backTo !== null)
$backUrl = $event->backTo;
......@@ -62,7 +62,7 @@ class Message extends form\Container
/**
*
* @return html\String
* @return html\Str
*/
public function getButtonString()
{
......
......@@ -35,9 +35,9 @@ class Output extends form\Container
$this['p']->addCssClass('output');
$this['p']['label'] = new html\Label();
$this['p']['label']->addChild(new html\String($title));
$this['p']['label']->addChild(new html\Str($title));
$this['p']['output'] = new html\Output();
$this['p']['output']->addChild(new html\String($value));
$this['p']['output']->addChild(new html\Str($value));
}
}
......@@ -31,7 +31,7 @@ class OutputStatus extends form\Container
$this['p']->addCssClass('output');
$this['p']['label'] = new html\Label();
$this['p']['label']->addChild(new html\String(_('Status')));
$this['p']['label']->addChild(new html\Str(_('Status')));
$this['p']['output'] = new html\Output();
$this['p']['output'][] = new Progress($data['backend_status']);
......
......@@ -49,10 +49,10 @@ class OutputUnit extends form\Container
$this['p']->addCssClass('output');
$this['p']['label'] = new html\Label();
$this['p']['label']->addChild(new html\String($title));
$this['p']['label']->addChild(new html\Str($title));
$this['p']['output'] = new html\Output();
$this['p']['output']->addChild(new html\String($str));
$this['p']['output']->addChild(new html\Str($str));
$this['p']['output']->setAttribute('title', $spell);
}
}
......@@ -30,14 +30,14 @@ class OutputUrl extends form\Container
$this['p']->addCssClass('output');
$this['p']['label'] = new html\Label();
$this['p']['label']->addChild(new html\String($title));
$this['p']['label']->addChild(new html\Str($title));
$this['p']['output'] = new html\Output();
$this['p']['output']->setCssProperty('font-family', 'monospace');
$a = new html\A();
$a->setAttribute('href', $url);
$a->addChild(new html\String($url));
$a->addChild(new html\Str($url));
$this['p']['output'][] = $a;
}
......
......@@ -31,6 +31,6 @@ class Pre extends \hemio\html\Pre
$this->addCssClass('pre');
if ($str !== null)
$this->addChild(new \hemio\html\String($str));
$this->addChild(new \hemio\html\Str($str));
}
}
......@@ -101,7 +101,7 @@ class Progress extends form\Container implements ProgressInterface
$this->status = '?';
}
$this['span']->addChild(new html\String($this->msg));
$this['span']->addChild(new html\Str($this->msg));
}
}
......
<?php
/*
* Copyright (C) 2015 Michael Herold <quabla@hemio.de>
*
......@@ -27,8 +26,8 @@ use hemio\form;
*
* @author Michael Herold <quabla@hemio.de>
*/
class Selectbox extends html\Div {
class Selectbox extends html\Div
{
/**
*
* @var html\Div
......@@ -41,57 +40,62 @@ class Selectbox extends html\Div {
*/
protected $items;
public function __construct() {
$this->main = new html\Div;
public function __construct()
{
$this->main = new html\Div;
$this['scroll'] = $this->main;
$this->items = new form\Container();
$this->items = new form\Container();
$this->main['items'] = $this->items;
$this->addCssClass('selectbox');
$this->main->addCssClass('scroll');
$this->addInheritableAppendage(
form\FormPost::FORM_FIELD_TEMPLATE, new form\template\FormPlainControl()
form\FormPost::FORM_FIELD_TEMPLATE,
new form\template\FormPlainControl()
);
}
/**
*
*
* @param string $name
* @param string $title
*/
public function addItem($name, $title, $backendStatus = null) {
public function addItem($name, $title, $backendStatus = null)
{
$item = new form\Container;
$this->items->addChild($item);
$item['checkbox'] = new form\FieldCheckbox($name, $title);
$item['checkbox']->setDefaultValue($name);
$item['p'] = new html\P();
$item['p']['label'] = new html\Label();
$item['p']['label']['span'] = new html\Span();
$item['p'] = new html\P();
$item['p']['label'] = new html\Label();
$item['p']['label']['span'] = new html\Span();
$item['p']['label']['span']->addCssClass('checkbox');
$item['p']['label']['span'][] = new html\String($title);
$item['p']['label']['span'][] = new html\Str($title);
$item['p']['label']->setAttribute(
'for', $item['checkbox']->getHtmlName()
'for', $item['checkbox']->getHtmlName()
);
$item['p']['label'][] = new Progress($backendStatus);
}
public function setOptions(html\Interface_\HtmlCode $options) {
public function setOptions(html\Interface_\HtmlCode $options)
{
$this->main['options'] = new html\P();
$this->main['options']->addCssClass('options');
$this->main['options']->addChild($options);
}
/**
*
*
* @return array
*/
public function getItemCheckboxFields() {
public function getItemCheckboxFields()
{
$fields = [];
foreach ($this->items as $item) {
$fields[] = $item['checkbox'];
......@@ -99,5 +103,4 @@ class Selectbox extends html\Div {
return $fields;
}
}
......@@ -49,7 +49,7 @@ class StatusList extends html\Ul
$li = $this->addLine();
$li->addChild(new html\String('['.$prefix[$status].'] '.$text));
$li->addChild(new html\Str('['.$prefix[$status].'] '.$text));
$li->addCssClass($status);
......
......@@ -36,7 +36,7 @@ class Window extends html\Article
$this['header']['button_right'] = new html\Div();
$this['header']['button_left'] = new html\Div();
$this['header']['title'] = new html\H1();
$this['header']['title'][] = new html\String($title);
$this['header']['title'][] = new html\Str($title);
$this['header']->addInheritableAppendage(
form\FormPost::FORM_FIELD_TEMPLATE,
new form\template\FormPlainControl
......@@ -45,7 +45,7 @@ class Window extends html\Article
if ($title && $subtitle) {
$this['header']['title']['br'] = new html\Br();
$this['header']['title']['subtitle'] = new html\Span();
$this['header']['title']['subtitle'][] = new html\String($subtitle);
$this['header']['title']['subtitle'][] = new html\Str($subtitle);
}
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment