Skip to content

Commit

Permalink
Erste Version
Browse files Browse the repository at this point in the history
  • Loading branch information
polarpixel committed Apr 13, 2018
1 parent 1fa6a8b commit d2041f5
Show file tree
Hide file tree
Showing 17 changed files with 966 additions and 0 deletions.
0 LICENSE → LICENCE
100644 → 100755
File renamed without changes.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Onepage-Demo für REDAXO 5

Die Demo ist eher für Fortgeschrittene gedacht und zeigt einige Wege, wie man eine Onepage-Website aufbauen kann.
1 change: 1 addition & 0 deletions assets/css/onepage-min.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

53 changes: 53 additions & 0 deletions assets/css/onepage.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
fieldset.distance {
padding-bottom: 50px;
}

.switcher {
background: #324050;
color: #fff;
padding: 20px 10px 40px;
margin: 20px 0;
}
.switcher label {
line-height: 36px;
}
.section-textpic-1 img,
.section-we-made-3 img,
.section-header img,
.project-content img,
.projects img {
width: 100%;
}
.project-content .col-md-10 {
margin-left: 0;
width: 100%;
}

/*=============================================
= TEXT IN SPALTEN
=============================================*/
.column {
height: 0;
overflow: hidden;
margin-bottom: 0;
}
.column-visible {
height: auto;
margin-bottom: 15px;
}
.column .form-horizontal {
transform: translate3d(-30px, 0, 0);
opacity: 0;
}
.column-visible .form-horizontal {
transform: translate3d(0, 0, 0);
opacity: 1;
transition: all 400ms ease-out;
}

/*=============================================
= TEXT
=============================================*/
.hide-border .panel {
border: none;
}
639 changes: 639 additions & 0 deletions backups/demo_onepage.sql

Large diffs are not rendered by default.

Binary file added backups/demo_onepage.tar.gz
Binary file not shown.
4 changes: 4 additions & 0 deletions boot.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<?php
if (rex::isBackend()) {
rex_view::addCssFile($this->getAssetsUrl('css/onepage.css'));
}
18 changes: 18 additions & 0 deletions fragments/introblock.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<div class="form-group">
<label class="col-sm-2 control-label" for="small-headline">Intro</label>
<div class="col-sm-10">
<input class="form-control" id="small-headline" type="text" name="REX_INPUT_VALUE[1]" value="<?= $this->intro ?>" />
</div>
</div>
<div class="form-group">
<label class="col-sm-2 control-label" for="headline">Überschrift</label>
<div class="col-sm-10">
<input class="form-control" id="headline" type="text" name="REX_INPUT_VALUE[2]" value="<?= $this->headline ?>" />
</div>
</div>
<div class="form-group">
<label class="col-sm-2 control-label" for="markitup_1">Text</label>
<div class="col-sm-10">
<textarea cols="1" rows="6" class="form-control markitupEditor-textile_full" id="markitup_1" name="REX_INPUT_VALUE[3]"><?= htmlspecialchars_decode($this->text) ?></textarea>
</div>
</div>
3 changes: 3 additions & 0 deletions help.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<h3>ONEPAGE-DEMO</h3>

<p>Die Demo sollte sich selbst erklären: Alle Module und Templates sind im Quellcode kommentiert, bzw. in den Inhalten der Demo-Website beschrieben.</p>
18 changes: 18 additions & 0 deletions install.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?php
/** @var rex_addon $this */
// copy backup files
rex_dir::copy(
$this->getPath('backups'),
rex_addon::get('backup')->getDataPath()
);
// update config
// merge current config with additional config
// Background information:
// We need the demo to be installed first of all to fetch required packages and import data.
// To make this happen, we need to keep the config free of external dependencies and use an
// additional config which will be merged into the config when the demo is installed.
$config = array_replace_recursive(
rex_file::getConfig($this->getPath('package.yml')),
rex_file::getConfig($this->getPath('package.setup.yml'))
);
rex_file::putConfig($this->getPath('package.yml'), $config);
20 changes: 20 additions & 0 deletions lang/de_de.lang
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
demo_onepage_title = Onepage-Demo

demo_onepage_install = Installation
demo_onepage_install_heading = Installation
demo_onepage_install_description = Bitte beachten, dass bei der Installation alle Inhalte der Datenbank gelöscht werden!<br>Die Installation kann etwas dauern, da auch alle benötigten AddOns geladen werden.
demo_onepage_install_button = Onepage-Demo installieren

demo_onepage_confirm_setup = Bestehende Daten gehen verloren. Fortfahren?

demo_onepage_package_not_available = Benötigte Version des Pakets <b>"{0}"</b> ist nicht verfügbar!
demo_onepage_package_not_exists = Paket <b>"{0}"</b> ist nicht vorhanden!
demo_onepage_package_failed_to_download = Fehler beim Download von <b>"{0}"</b>!
demo_onepage_package_failed_to_validate = Fehler bei der Validierung von <b>"{0}"</b>!
demo_onepage_package_failed_to_extract = Fehler beim Entpacken von <b>"{0}"</b>!
demo_onepage_package_failed_to_install = Fehler beim Installieren von <b>"{0}"</b>!
demo_onepage_package_failed_to_activate = Fehler beim Aktivieren von <b>"{0}"</b>!
demo_onepage_package_failed_to_import = Fehler beim Importieren von <b>"{0}"</b>!

demo_onepage_installation_error = Demo konnte nicht installiert werden:
demo_onepage_installation_success = Demo wurde erfolgreich installiert!
26 changes: 26 additions & 0 deletions package.setup.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# additional requires (non-system packages)
requires:
packages:
developer: '>=3.7.0'
markitup: '>=3.0.3'
mblock: '>=2.1.0'
be_style/customizer: '>=2.4.0'

# setup config
# hint: inspect link values inside of REDAXO installer to find out fileIds (numbers) for new packages!
setup:
packages:
developer: 2274 # 3.7.0
markitup: 2170 # 3.0.3
mblock: 2082 # 2.1.0
installSequence:
- backup
- structure/content
- developer
- markitup
- mblock
- be_style/customizer
dbimport:
- demo_onepage.sql
fileimport:
- demo_onepage.tar.gz
15 changes: 15 additions & 0 deletions package.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package: demo_onepage
version: '1.0'
author: 'Friends Of REDAXO'
supportpage: 'https://github.com/FriendsOfREDAXO/demo_onepage'
page:
title: Onepage-Demo
perm: 'demo_onepage[]'
pjax: true
subpages:
install: { title: 'translate:title' }
requires:
packages:
backup: ^2.2.0
structure/content: ^2.5.0
redaxo: ^5.5.1
3 changes: 3 additions & 0 deletions pages/index.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<?php
echo rex_view::title($this->i18n('title'));
include rex_be_controller::getCurrentPageObject()->getSubPath();
163 changes: 163 additions & 0 deletions pages/install.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,163 @@
<?php
/** @var rex_addon $this */
/* setup process */
if (rex_post('install', 'boolean')) {
$errors = array();
// step 1/5: select missing packages we need to download
$missingPackages = array();
$packages = array();
if (isset($this->getProperty('setup')['packages'])) {
$packages = $this->getProperty('setup')['packages'];
}
if (count($packages) > 0) {
// fetch list of available packages from to redaxo webservice
try {
$packagesFromInstaller = rex_install_packages::getAddPackages();
} catch (rex_functional_exception $e) {
$errors[] = $e->getMessage();
rex_logger::logException($e);
}
if (count($errors) == 0) {
foreach ($packages as $id => $fileId) {
$localPackage = rex_package::get($id);
if ($localPackage->isSystemPackage()) {
continue; // skip system packages, they don’t need to be downloaded
}
$installerPackage = isset($packagesFromInstaller[$id]['files'][$fileId]) ? $packagesFromInstaller[$id]['files'][$fileId] : false;
if (!$installerPackage) {
$errors[] = $this->i18n('package_not_available', $id);
}
if ($localPackage->getVersion() !== $installerPackage['version']) {
$missingPackages[$id] = $fileId; // add to download list if package is not yet installed
}
}
}
}
// step 2/5: download required packages
if (count($missingPackages) > 0 && count($errors) == 0) {
foreach ($missingPackages as $id => $fileId) {
$installerPackage = $packagesFromInstaller[$id]['files'][$fileId];
if ($installerPackage) {
// fetch package
try {
$archivefile = rex_install_webservice::getArchive($installerPackage['path']);
} catch (rex_functional_exception $e) {
rex_logger::logException($e);
$errors[] = $this->i18n('package_failed_to_download', $id);
break;
}
// validate checksum
if ($installerPackage['checksum'] != md5_file($archivefile)) {
$errors[] = $this->i18n('package_failed_to_validate', $id);
break;
}
// extract package (overrides local package if existent)
if (!rex_install_archive::extract($archivefile, rex_path::addon($id), $id)) {
rex_dir::delete(rex_path::addon($id));
$errors[] = $this->i18n('package_failed_to_extract', $id);
break;
}
rex_package_manager::synchronizeWithFileSystem();
}
}
}
// step 3/5: install and activate packages based on install sequence from config
if (count($this->getProperty('setup')['installSequence']) > 0 && count($errors) == 0) {
foreach ($this->getProperty('setup')['installSequence'] as $id) {
$package = rex_package::get($id);
if ($package instanceof rex_null_package) {
$errors[] = $this->i18n('package_not_exists', $id);
break;
}
$manager = rex_package_manager::factory($package);
try {
$manager->install();
} catch (rex_functional_exception $e) {
rex_logger::logException($e);
$errors[] = $this->i18n('package_failed_to_install', $id);
break;
}
try {
$manager->activate();
} catch (rex_functional_exception $e) {
rex_logger::logException($e);
$errors[] = $this->i18n('package_failed_to_activate', $id);
break;
}
}
}
// step 4/5: import database
if (count($this->getProperty('setup')['dbimport']) > 0 && count($errors) == 0) {
foreach ($this->getProperty('setup')['dbimport'] as $import) {
$file = rex_backup::getDir() . '/' . $import;
$success = rex_backup::importDb($file);
if (!$success['state']) {
$errors[] = $this->i18n('package_failed_to_import', $import);
}
}
}
// step 5/5: import files
if (count($this->getProperty('setup')['fileimport']) > 0 && count($errors) == 0) {
foreach ($this->getProperty('setup')['fileimport'] as $import) {
$file = rex_backup::getDir() . '/' . $import;
$success = rex_backup::importFiles($file);
if (!$success['state']) {
$errors[] = $this->i18n('package_failed_to_import', $import);
}
}
}
// show result messages
if (count($errors) > 0) {
echo rex_view::error("<p>" . $this->i18n('installation_error') . "</p><ul><li>" . implode("</li><li>", $errors) . "</li></ul>");
} else {
echo rex_view::success("<p>" . $this->i18n('installation_success') . "</p>");
}
}
/* setup info */
$content = '<p>' . $this->i18n('install_description') . '</p>';
$content .= '<p><button class="btn btn-send" type="submit" name="install" value="1"><i class="rex-icon fa-download"></i> ' . $this->i18n('install_button') . '</button></p>';
$fragment = new rex_fragment();
$fragment->setVar('title', $this->i18n('install_heading'), false);
$fragment->setVar('body', $content, false);
$content = $fragment->parse('core/page/section.php');
$content = '
<form action="' . rex_url::currentBackendPage() . '" method="post" data-confirm="' . $this->i18n('confirm_setup') . '">
' . $content . '
</form>';
echo $content;
/* package info from README.md */
$content = '';
$package = rex_package::get($this->getName());
$name = $package->getPackageId();
$version = $package->getVersion();
$author = $package->getAuthor();
$supportPage = $package->getSupportPage();
if (is_readable($package->getPath('README.md'))) {
$fragment = new rex_fragment();
$fragment->setVar('content', rex_markdown::factory()->parse(rex_file::get($package->getPath('README.md'))), false);
$content .= $fragment->parse('core/page/docs.php');
}
if (!empty($content)) {
$fragment = new rex_fragment();
$fragment->setVar('title', rex_i18n::msg('package_help') . ' ' . $name, false);
$fragment->setVar('body', $content, false);
echo $fragment->parse('core/page/section.php');
}
/* credits */
$credits = '';
$credits .= '<dl class="dl-horizontal">';
$credits .= '<dt>' . rex_i18n::msg('credits_name') . '</dt><dd>' . htmlspecialchars($name) . '</dd>';
if ($version) {
$credits .= '<dt>' . rex_i18n::msg('credits_version') . '</dt><dd>' . $version . '</dd>';
}
if ($author) {
$credits .= '<dt>' . rex_i18n::msg('credits_author') . '</dt><dd>' . htmlspecialchars($author) . '</dd>';
}
if ($supportPage) {
$credits .= '<dt>' . rex_i18n::msg('credits_supportpage') . '</dt><dd><a href="' . $supportPage . '" onclick="window.open(this.href); return false;">' . $supportPage . '</a></dd>';
}
$credits .= '</dl>';
$fragment = new rex_fragment();
$fragment->setVar('title', rex_i18n::msg('credits'), false);
$fragment->setVar('body', $credits, false);
echo $fragment->parse('core/page/section.php');
Empty file added uninstall.php
Empty file.
Empty file added update.php
Empty file.

0 comments on commit d2041f5

Please sign in to comment.