Started writing code for views

This commit is contained in:
Christian Wolf 2019-04-07 16:31:23 +02:00
parent 773eb1092d
commit 628514eb4e
14 changed files with 313 additions and 1 deletions

18
sql/init1.sql Normal file
View File

@ -0,0 +1,18 @@
DROP TABLE IF EXISTS `jtmxc_club_keys`;
CREATE TABLE `jtmxc_club_keys` (
`privkey` text NOT NULL,
`publickey` text NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
INSERT INTO `jtmxc_club_keys` VALUES ('-----BEGIN PRIVATE KEY-----\nMIIEwAIBADANBgkqhkiG9w0BAQEFAASCBKowggSmAgEAAoIBAQDvZHhLHHqmfnnP\noj5Y7AtS0UvEN8XLzNdHj/0nHBVHrXDMNul8phbCaevuaXcYTZvb9JBTAO019Bnu\nCoj6KFrk0Cw/zcVgVHryguNCr2DeLaxAXyArfkKNZPuG/kTw1mxE6ebeR886JVU0\nfQpIi3zDGAHpXxaKO7EttnvQK8NRd4h5O5EI6dCnmMn/8xY/d5G7AsZKuAxq01ZB\nmmUrkRKrQtBTwUeJWhtfT+XjOa1n1FVIwmqz4O2sqbfm0pa6PX0BNT0CUp0RI1wN\nGmF6bh/WkQ8h3jmTamzZ2cQUwDnL7ByAJqexJrrPacRbE6EotCGODjuBXDSy02PJ\nZk0fThZpAgMBAAECggEBANJaU0WU8cUo73pekzBpwY11MYFqjJiHF0ffo0/hYmWI\nZsxbGBGak/cjQdhNvgOR9nlxTfxRnR7CrqI3iaNfIHdc4PTzqBL8SMid8HohRxoT\nwf8SV19AY9SAvnAhL4z8rUhky6PYL6RlN5iWoxmZz/hSOSPKlTDEQOztI6CJQ+hp\nUFEiOLq/TSWB1DYEu6qAQRyI5wcC1QMo+zB/zBwIuM3DsB2f6Xtj86kXzU/bGeDj\nNLbsCuhRbFyMgvcJ3z6KQTvREZOGkeF22HA+ZVH7bWf00PqCEjq2I/XFHZGK61X4\nWLgNOUmVZSmGv2Kd9UJaC8VffkBnrV3XFN1n97gcP4ECgYEA/Joaw3VrbWpKsquf\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g3i2sQF8gK35CjWT7hv5E8NZsROnm3kfPOiVVNH0KSIt8\nwxgB6V8WijuxLbZ70CvDUXeIeTuRCOnQp5jJ//MWP3eRuwLGSrgMatNWQZplK5ES\nq0LQU8FHiVobX0/l4zmtZ9RVSMJqs+DtrKm35tKWuj19ATU9AlKdESNcDRphem4f\n1pEPId45k2ps2dnEFMA5y+wcgCansSa6z2nEWxOhKLQhjg47gVw0stNjyWZNH04W\naQIDAQAB\n-----END PUBLIC KEY-----\n');
DROP TABLE IF EXISTS `jtmxc_club_users`;
CREATE TABLE `jtmxc_club_users` (
`id` int(10) NOT NULL AUTO_INCREMENT,
`user` varchar(30) NOT NULL,
`password` varchar(150) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8;
INSERT INTO `jtmxc_club_users` VALUES (1,'chris','$2y$10$2/aeOfLlLwFx7JYXpaAOH.CG0ZtvkzTuK6nojvSIuOYlTbSd07CqC');

View File

@ -0,0 +1,19 @@
<?php
use Joomla\CMS\MVC\Controller\BaseController;
// No direct access.
defined('_JEXEC') or die;
class ClubsControllerUser extends BaseController
{
public function savepwd()
{
// FIXME
}
public function savedata()
{
// FIXME
}
}

14
src/site/css/clubs.css Normal file
View File

@ -0,0 +1,14 @@
.clubs_content_row
{
margin-left: 2em;
}
.clubs_title_row
{
font-weight: bold;
}
.clubs_row
{
margin: 10px 0px;
}

View File

@ -0,0 +1,34 @@
<?php
// No direct access.
defined('_JEXEC') or die;
?>
<h1><?php echo $this->clubname; ?></h1>
<div class='clubs_row'>
<div class='clubs_title_row'>Adresse</div>
<div class='clubs_content_row'><?php echo nl2br(htmlentities($this->address)); ?></div>
</div>
<div class='clubs_row'>
<div class='clubs_title_row'>Kontaktperson</div>
<div class='clubs_content_row'><?php echo htmlentities($this->contactperson); ?></div>
</div>
<div class='clubs_row'>
<div class='clubs_title_row'>Mail-Adresse</div>
<div class='clubs_content_row'><a href='mailto:<?php echo htmlentities($this->email); ?>'><?php echo htmlentities($this->email); ?></a></div>
</div>
<div class='clubs_row'>
<div class='clubs_title_row'>Telefon</div>
<div class='clubs_content_row'><?php echo htmlentities($this->phone); ?></div>
</div>
<div class='clubs_row'>
<div class='clubs_title_row'>Assoziierte Personen</div>
<!-- FIXME <div class='clubs_content_row'><?php echo htmlentities($this->phone); ?></div>-->
</div>

View File

@ -0,0 +1,26 @@
<?php
use Joomla\CMS\MVC\View\HtmlView;
use Joomla\CMS\Factory;
use Joomla\CMS\Uri\Uri;
// No direct access.
defined('_JEXEC') or die;
class ClubsViewClub extends HtmlView
{
public function display(string $tpl = null)
{
// FIXME Insert code from DB
$this->clubname = "Testclub";
$this->address = "Strasse 1\n66123 Ort";
$this->contactperson = "Max Mustermann";
$this->email = "me@club.de";
$this->phone = "012345";
Factory::getDocument()->addStyleSheet(Uri::base(true) . "components/com_clubs/css/clubs.css");
parent::display($tpl);
}
}

View File

@ -4,4 +4,7 @@
defined('_JEXEC') or die;
?>
asd
<pre>
Ort Verein Adresse Ansprechpartner Email
</pre>

View File

@ -0,0 +1,16 @@
<?php
// No direct access.
defined('_JEXEC') or die;
?>
<ul>
<?php
foreach ($this->clubs as $c) {
?>
<li><a href='?option=com_clubs&view=club&clubid=<?php echo $c['id']; ?>'><?php echo htmlentities($c['name']); ?></a></li>
<?php
}
?>
</ul>

View File

@ -0,0 +1,30 @@
<?php
use Joomla\CMS\MVC\View\HtmlView;
// No direct access.
defined('_JEXEC') or die;
class ClubsViewMyClubs extends HtmlView
{
public function display($tpl = null)
{
// FIXME
$this->clubs = array();
$c = array();
$c['name'] = "Ein Test-Club";
$c['city'] = "Saarbrücken";
$c['id'] = 2;
$this->clubs[] = $c;
$c = array();
$c['name'] = "Ein zweiter Test-Club";
$c['city'] = "Saarlouis";
$c['id'] = 4;
$this->clubs[] = $c;
parent::display($tpl);
}
}

View File

@ -0,0 +1,36 @@
<?php
// No direct access.
defined('_JEXEC') or die;
?>
<div class='clubs_row'>
<div class='clubs_title_row'>Name</div>
<div class='clubs_content_row'><?php echo htmlentities($this->username); ?></div>
</div>
<div class='clubs_row'>
<div class='clubs_title_row'>Addresse</div>
<div class='clubs_content_row'><?php echo nl2br(htmlentities($this->address)); ?></div>
</div>
<div class='clubs_row'>
<div class='clubs_title_row'>Haupt-Email</div>
<div class='clubs_content_row'><?php echo htmlentities($this->mail); ?></div>
</div>
<div class='clubs_row'>
<div class='clubs_title_row'>Telefon</div>
<div class='clubs_content_row'><?php echo htmlentities($this->phone); ?></div>
</div>
<div class='clubs_row'>
<div class='clubs_title_row'>Handy</div>
<div class='clubs_content_row'><?php echo htmlentities($this->mobile); ?></div>
</div>
<div class='clubs_row'>
<a href="?option=com_clubs&view=userdata&id=<?php echo $this->id; ?>">Daten anpassen</a><br />
<a href="?option=com_clubs&view=userpwd&id=<?php echo $this->id; ?>">Passwort &auml;ndern</a>
</div>

View File

@ -0,0 +1,25 @@
<?php
use Joomla\CMS\MVC\View\HtmlView;
use Joomla\CMS\Factory;
use Joomla\CMS\Uri\Uri;
// No direct access.
defined('_JEXEC') or die;
class ClubsViewUser extends HtmlView
{
public function display($tpl = null)
{
// FIXME
$this->id = 1;
$this->username = "Max Mustermann";
$this->address = "Strasse 3274\n66123 Saarland";
$this->mail = "mmuster@mail.de";
$this->phone = "0123456";
$this->mobile = "0178 8375";
Factory::getDocument()->addStyleSheet(Uri::base(true) . '/components/com_clubs/css/clubs.css');
parent::display($tpl);
}
}

View File

@ -0,0 +1,37 @@
<?php
// No direct access.
defined('_JEXEC') or die;
?>
<form action="?option=com_clubs&task=user.savedata" method="post">
<div class='clubs_row'>
<div class='clubs_title_row'>Name</div>
<div class='clubs_content_row'><input type="text" name='name' value='<?php echo $this->username; ?>' style='width:100%;'></div>
</div>
<div class='clubs_row'>
<div class='clubs_title_row'>Addresse</div>
<div class='clubs_content_row'><textarea rows="4" style='width:100%;'><?php echo $this->address; ?></textarea></div>
</div>
<div class='clubs_row'>
<div class='clubs_title_row'>Haupt-Email</div>
<div class='clubs_content_row'><input type="text" name='name' value='<?php echo $this->mail; ?>' style='width:100%;'></div>
</div>
<div class='clubs_row'>
<div class='clubs_title_row'>Telefon</div>
<div class='clubs_content_row'><input type="text" name='name' value='<?php echo $this->phone; ?>' style='width:100%;'></div>
</div>
<div class='clubs_row'>
<div class='clubs_title_row'>Handy</div>
<div class='clubs_content_row'><input type="text" name='name' value='<?php echo $this->mobile; ?>' style='width:100%;'></div>
</div>
<input type="submit" value='Speichern' name='submit'>
<input type="reset" value='Werte zur&uuml;cksetzen'>
</form>

View File

@ -0,0 +1,17 @@
<?php
use Joomla\CMS\MVC\View\HtmlView;
use Joomla\CMS\Factory;
use Joomla\CMS\Uri\Uri;
// No direct access.
defined('_JEXEC') or die;
class ClubsViewUSerdata extends HtmlView
{
public function display(string $tpl = null)
{
Factory::getDocument()->addStyleSheet(Uri::base(true) . 'components/com_clubs/css/clubs.css');
parent::display($tpl);
}
}

View File

@ -0,0 +1,26 @@
<?php
// No direct access.
defined('_JEXEC') or die;
?>
<form action="?option=com_clubs&task=user.savepwd" method="post">
<div class='clubs_row'>
<div class='clubs_title_row'>Altes Passwort</div>
<div class='clubs_content_row'><input type="password" name='old' style='width:100%;'></div>
</div>
<div class='clubs_row'>
<div class='clubs_title_row'>Neues Passwort</div>
<div class='clubs_content_row'><input type="password" name='new' style='width:100%;'></div>
</div>
<div class='clubs_row'>
<div class='clubs_title_row'>Neues Passwort wiederholen</div>
<div class='clubs_content_row'><input type="password" name='repeat' style='width:100%;'></div>
</div>
<input type="submit" value='Speichern' name='submit'>
</form>

View File

@ -0,0 +1,11 @@
<?php
use Joomla\CMS\MVC\View\HtmlView;
// No direct access.
defined('_JEXEC') or die;
class ClubsViewUserpwd extends HtmlView
{
// FIXME
}