Skip to content
This repository has been archived by the owner on Jan 5, 2023. It is now read-only.

Commit

Permalink
improved the inline documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
patkon committed Dec 20, 2020
1 parent f2b8fb5 commit bc33b06
Show file tree
Hide file tree
Showing 24 changed files with 1,446 additions and 26 deletions.
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,6 @@ This branch will be merged into main branch, as soon as a new stable version is
+ jquery.dirtyforms - https://github.com/snikch/jquery.dirtyforms
+ matchHeight - http://brm.io/jquery-match-height/
+ bootstrap-tagsinput - https://github.com/bootstrap-tagsinput/bootstrap-tagsinput
+ image-picker - https://github.com/rvera/image-picker
+ image-picker - https://github.com/rvera/image-picker
+ Spyc - https://github.com/mustangostang/spyc/
+ Parsedown - https://parsedown.org
2 changes: 2 additions & 0 deletions acp/acp.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
require '../lib/Medoo.php';
use Medoo\Medoo;

require '../lib/Spyc/spyc.php';

require '../config.php';
if(is_file('../'.FC_CONTENT_DIR.'/config.php')) {
include '../'.FC_CONTENT_DIR.'/config.php';
Expand Down
93 changes: 70 additions & 23 deletions acp/core/docs.php
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
<?php

//error_reporting(E_ALL ^E_NOTICE);
require 'access.php';

$core_docs = fc_get_core_docs();
$modules_docs = fc_get_modules_docs();
$themes_docs = fc_get_themes_docs();

$Parsedown = new Parsedown();

$all_docs = $core_docs;
if(is_array($modules_docs)) {
$all_docs = array_merge($all_docs, $modules_docs);
Expand All @@ -18,10 +20,11 @@
$docs_file = '';

if(isset($_POST['docs_file'])) {
$docs_file_id = (int) $_POST['docs_file'];
if(is_file($all_docs[$docs_file_id])) {
$_SESSION['docs_file'] = $all_docs[$docs_file_id];
}
$_SESSION['docs_file'] = (int) $_POST['docs_file'];
}

foreach($all_docs as $k => $v) {
$parsed_docs[] = fc_parse_doc_md_file($v);
}


Expand All @@ -31,51 +34,70 @@
echo '<select name="docs_file" class="form-control custom-select" onchange="this.form.submit()">';

echo '<optgroup label="flatCore">';
foreach($all_docs as $k => $v) {
foreach($parsed_docs as $k => $v) {

if(substr($v, 0, 4) != 'docs') {
if(substr($parsed_docs[$k]['filepath'], 0, 4) != 'docs') {
continue;
}

$sel = '';
if($_SESSION['docs_file'] == $v) {
if($_SESSION['docs_file'] == $k) {
$sel = 'selected';
}
echo '<option value="'.$k.'" '.$sel.'>'.basename($v).'</option>';

if($parsed_docs[$k]['header']['navigation'] != '') {
$show_title = $parsed_docs[$k]['header']['navigation'];
} else {
$show_title = $parsed_docs[$k]['filename'];
}

echo '<option value="'.$k.'" '.$sel.'>'.$show_title.'</option>';
}
echo '</optgroup>';

echo '<optgroup label="Modules">';
foreach($all_docs as $k => $v) {
foreach($parsed_docs as $k => $v) {

if(substr($v, 0, 11) != '../modules/') {
if(substr($parsed_docs[$k]['filepath'], 0, 11) != '../modules/') {
continue;
}

$sel = '';
if($_SESSION['docs_file'] == $v) {
if($_SESSION['docs_file'] == $k) {
$sel = 'selected';
}

$path = explode('/', $v);
echo '<option value="'.$k.'" '.$sel.'>'.$path[2].' > '.basename($v).'</option>';
if($parsed_docs[$k]['header']['navigation'] != '') {
$show_title = $parsed_docs[$k]['header']['navigation'];
} else {
$show_title = $parsed_docs[$k]['filename'];
}

$path = explode('/', $parsed_docs[$k]['filepath']);
echo '<option value="'.$k.'" '.$sel.'>'.$path[2].' > '.$show_title.'</option>';
}
echo '</optgroup>';

echo '<optgroup label="Themes">';
foreach($all_docs as $k => $v) {
foreach($parsed_docs as $k => $v) {

if(substr($v, 0, 10) != '../styles/') {
if(substr($parsed_docs[$k]['filepath'], 0, 10) != '../styles/') {
continue;
}

$sel = '';
if($_SESSION['docs_file'] == $v) {
if($_SESSION['docs_file'] == $k) {
$sel = 'selected';
}

$path = explode('/', $v);
echo '<option value="'.$k.'" '.$sel.'>'.$path[2].' > '.basename($v).'</option>';
if($parsed_docs[$k]['header']['navigation'] != '') {
$show_title = $parsed_docs[$k]['header']['navigation'];
} else {
$show_title = $parsed_docs[$k]['filename'];
}

$path = explode('/', $parsed_docs[$k]['filepath']);
echo '<option value="'.$k.'" '.$sel.'>'.$path[2].' > '.$show_title.'</option>';
}
echo '</optgroup>';

Expand All @@ -92,10 +114,7 @@


if(isset($_SESSION['docs_file'])) {
$help_text = file_get_contents($_SESSION['docs_file']);
$Parsedown = new Parsedown();
$help_text_html = $Parsedown->text($help_text);
echo '<hr>'.$help_text_html;
echo '<hr>'.$parsed_docs[$_SESSION['docs_file']]['content'];
}


Expand All @@ -109,4 +128,32 @@

echo '<hr><a target="_blank" href="'.$helpURL.'" title="'.$helpURL.'" class="btn btn-fc btn-block">'.$icon['question'].' '.$lang['show_help'].'</a>';




function fc_parse_doc_md_file($path) {

global $Parsedown;

if(is_file($path)) {
$src = file_get_contents($path);
$src_content = explode('---',$src);
$header_length = strlen($src_content[1])+6;
$content = substr($src, $header_length);
$parsed_header = Spyc::YAMLLoadString($src_content[1]);
$parsed_content = $Parsedown->text($content);
$filemtime = filemtime($path);
} else {
$parsed = 'FILE NOT FOUND';
}

$doc['header'] = $parsed_header;
$doc['content'] = $parsed_content;
$doc['filename'] = basename($path);
$doc['filepath'] = $path;

return $doc;
}


?>
6 changes: 6 additions & 0 deletions acp/docs/de/addons.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
---
navigation: Addons
title: Module, Plugins und Themes
description:
---

### Addons ###

Hier werden alle installierten Module, Plugins und Themes aufgelistet.
Expand Down
6 changes: 6 additions & 0 deletions acp/docs/de/dashboard.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
---
navigation: Das Dashboard
title: Das Dashboard
description: Eine Übersicht des Dashboards.
---

### Dashboard ###

Hier findest Du alle wichtigen Informationen zu Deinem Projekt. Wie z.B. eine kurze Auswertung zu den registrierten Benutzern und gespeicherten Seiten.
Expand Down
13 changes: 13 additions & 0 deletions acp/docs/de/filebrowser.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,15 @@
---
navigation: Dateien/Uploads verwalten
title:
description:
---

### Dateien verwalten ###

Hie siehst Du alle Deine Uploads auf einen Blick und Du kannst den Uploads Daten (wie z.B. Titel, Text, Schlüsselwörter etc.) zuweisen.

Bilder findest Du im Order __/images/__ oder in einem Unterordner davon. Alle diese Bilder erscheinen automatisch im Editor in der Bilder-Auswahl. Zum Beispiel, wenn Du eine Seite anlegst oder bearbeitest.

Alle anderen Dateien solltest Du in den Ordner __/files/__ kopieren.

Eine Auswahl, der verfügbaren Ordner bekommst Du übrigens angezeigt, wenn du - rechts unten - auf den Upload-Buttons klickst.
6 changes: 6 additions & 0 deletions acp/docs/de/moduls-p.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
---
navigation: Plugins
title:
description:
---

### Plugins ###

Als Plugins werden kleine Scripte bezeichnet, welche per Shortcode in die Seiten geladen werden können.
6 changes: 6 additions & 0 deletions acp/docs/de/pages-list.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
---
navigation: Inhalte (Seiten)
title:
description:
---

### Liste filtern ###

Über das Eingabefeld kannst Du die Inhalte der gespeicherten Seiten durchsuchen. Außerdem kannst Du über den *Status*, die *Sprache* und die *Labels* Seiten ein- und ausblenden. Die Labels kannst Du übrigens in den [Einstellungen](acp.php?tn=system) selbst erweitern und ändern.
Expand Down
6 changes: 6 additions & 0 deletions acp/docs/de/pages-new.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
---
navigation: Neue Seiten anlegen
title:
description:
---

### Neue Seiten erstellen ###

Du kannst beliebig viele Seiten zu deiner Webseite hinzufügen.
Expand Down
6 changes: 6 additions & 0 deletions acp/docs/de/pages.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
---
navigation: Inhalte
title:
description:
---

### Seiten und Inhalte ###

Als geordnete Seiten werden die Seiten aufgeführt, welche eine Sortierungsnummer enthalten. Diese Seiten werden automatisch in der Navigation aufgeführt. Die ungeordneten Seiten sind nicht in die Navigation eingegliedert - werden aber dennoch in der Sitemap bzw. den Suchergebnissen berücksichtigt.
Expand Down
12 changes: 12 additions & 0 deletions acp/docs/de/system.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,14 @@
---
navigation: Einstallungen
title:
description:
---

### Einstellungen ###


#### Beschreibungen ####

Seitenname, Seitentitel, Untertitel, Beschreibung und Standard-Publisher sind lediglich Vorgaben. Wenn Du eine neue Seite anlegst oder eine Seite bearbeitest, kannst Du diese Eingaben natürlich ünerschreiben.


7 changes: 7 additions & 0 deletions acp/docs/de/user.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,9 @@
---
navigation: Benutzer
title:
description:
---

### Benutzer ###

Du kannst jederzeit neue Benutzer und Administratoren hinzufügen oder entfernen. Administratoren werden mit einem blauen Benutzersymbol gekennzeichnet.
6 changes: 6 additions & 0 deletions acp/docs/en/addons.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,8 @@
---
navigation: Addons
title: Modules, Plugins and Themes
description:
---

### Addons ###

6 changes: 6 additions & 0 deletions acp/docs/en/dashboard.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,8 @@
---
navigation: Dashboard
title: The Dashboard
description:
---

### Dashboard ###

6 changes: 6 additions & 0 deletions acp/docs/en/filebrowser.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
---
navigation: Filebrowser
title:
description:
---

### Files and Images ###

Here you can upload Images and Files and add Informations such as title or description.
6 changes: 6 additions & 0 deletions acp/docs/en/pages.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
---
navigation: Pages
title:
description:
---

### Manage your Contents ###

#### Pages overview
Expand Down
6 changes: 6 additions & 0 deletions acp/docs/en/system.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
---
navigation: Preferences
title:
description:
---

### Preferences ###

Here you can specify the settings for the entire page. Nearly all the entries are self-explanatory.
Expand Down
6 changes: 6 additions & 0 deletions acp/docs/en/user.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
---
navigation: User
title:
description:
---

### User ###

### Create new Accounts/User
Expand Down
25 changes: 25 additions & 0 deletions acp/theme/css/styles_dark.css

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

2 changes: 1 addition & 1 deletion acp/theme/css/styles_dark.css.map

Large diffs are not rendered by default.

Loading

0 comments on commit bc33b06

Please sign in to comment.