This commit is contained in:
Frédéric Guillot
2018-04-06 10:54:58 -07:00
parent ac11220a1a
commit 0b306fa60a
648 changed files with 15 additions and 38030 deletions

View File

@@ -12,126 +12,8 @@ use Parsedown;
*/
class DocumentationController extends BaseController
{
public function show()
{
$page = $this->request->getStringParam('file', 'index');
if (!preg_match('/^[a-z0-9\-]+/', $page)) {
$page = 'index';
}
$filename = $this->getPageFilename($page);
$this->response->html($this->helper->layout->app('doc/show', $this->render($filename)));
}
/**
* Display keyboard shortcut
*/
public function shortcuts()
{
$this->response->html($this->template->render('config/keyboard_shortcuts'));
}
/**
* Prepare Markdown file
*
* @access private
* @param string $filename
* @return array
*/
private function render($filename)
{
$data = file_get_contents($filename);
$content = preg_replace_callback('/\((.*.markdown)\)/', array($this, 'replaceMarkdownUrl'), $data);
$content = preg_replace_callback('/\((screenshots.*\.png)\)/', array($this, 'replaceImageUrl'), $content);
$content = preg_replace_callback('/\((\.\.\/screenshots.*\.png)\)/', array($this, 'replaceImageUrl'), $content);
list($title, ) = explode("\n", $data, 2);
return array(
'content' => Parsedown::instance()->text($content),
'title' => $title !== 'Documentation' ? t('Documentation: %s', $title) : $title,
);
}
/**
* Regex callback to replace Markdown links
*
* @access public
* @param array $matches
* @return string
*/
public function replaceMarkdownUrl(array $matches)
{
return '('.$this->helper->url->to('DocumentationController', 'show', array('file' => str_replace('.markdown', '', $matches[1]))).')';
}
/**
* Regex callback to replace image links
*
* @access public
* @param array $matches
* @return string
*/
public function replaceImageUrl(array $matches)
{
return '('.$this->getFileBaseUrl($matches[1]).')';
}
/**
* Get Markdown file according to the current language
*
* @access private
* @param string $page
* @return string
*/
private function getPageFilename($page)
{
return $this->getFileLocation($page . '.markdown') ?:
implode(DIRECTORY_SEPARATOR, array(ROOT_DIR, 'doc', 'en_US', 'index.markdown'));
}
/**
* Get base URL for Markdown links
*
* @access private
* @param string $filename
* @return string
*/
private function getFileBaseUrl($filename)
{
$language = $this->languageModel->getCurrentLanguage();
$path = $this->getFileLocation($filename);
if (strpos($path, $language) !== false) {
$url = implode('/', array('doc', $language, $filename));
} else {
$url = implode('/', array('doc', $filename));
}
return $this->helper->url->base().$url;
}
/**
* Get file location according to the current language
*
* @access private
* @param string $filename
* @return string
*/
private function getFileLocation($filename)
{
$files = array(
implode(DIRECTORY_SEPARATOR, array(ROOT_DIR, 'doc', $this->languageModel->getCurrentLanguage(), $filename)),
implode(DIRECTORY_SEPARATOR, array(ROOT_DIR, 'doc', 'en_US', $filename)),
);
foreach ($files as $filename) {
if (file_exists($filename)) {
return $filename;
}
}
return '';
}
}

View File

@@ -25,7 +25,16 @@ class UrlHelper extends Base
*/
public function doc($label, $file)
{
return $this->link($label, 'DocumentationController', 'show', array('file' => $file), false, '', '', true);
$version = 'latest';
if (substr(APP_VERSION, 0, 1) === 'v') {
$version = substr(APP_VERSION, 1);
} else if (ctype_digit(substr(APP_VERSION, 0, 1))) {
$version = APP_VERSION;
}
$url = sprintf(DOCUMENTATION_URL_PATTERN, $version, $file);
return sprintf('<a href="%s" target="_blank">%s</a>', $url, $label);
}
/**

View File

@@ -742,10 +742,8 @@ return array(
'Change task color when using a specific task link' => 'Promijeni boju zadatka kada se koristi određena veza na zadatku',
'Task link creation or modification' => 'Veza na zadatku je napravljena ili izmijenjena',
'Milestone' => 'Prekretnica',
'Documentation: %s' => 'Dokumentacija: %s',
'Reset the search/filter box' => 'Vrati na početno pretragu/filtere',
'Documentation' => 'Dokumentacija',
'Table of contents' => 'Sadržaj',
'Author' => 'Autor',
'Version' => 'Verzija',
'Plugins' => 'Dodaci',

View File

@@ -742,10 +742,8 @@ return array(
'Change task color when using a specific task link' => 'Canviar de color quan la tasca utilitzant un enllaç tasca específica',
'Task link creation or modification' => 'La creació o modificació de l\'enllaç de tasques',
'Milestone' => 'Fita',
'Documentation: %s' => 'Documentació: %s',
'Reset the search/filter box' => 'Restablir el quadre de cerca / filtre',
'Documentation' => 'Documentació',
'Table of contents' => 'Taula de continguts',
'Author' => 'Autor',
'Version' => 'Versió',
'Plugins' => 'Connectors',

View File

@@ -742,10 +742,8 @@ return array(
'Change task color when using a specific task link' => 'Změnit barvu úkolu při použití konkrétního odkazu na úkol',
'Task link creation or modification' => 'Vytvoření, nebo změna odkazu na úkol',
'Milestone' => 'Milník',
'Documentation: %s' => 'Dokumentace %s',
'Reset the search/filter box' => 'Vyresetovat pole pro vyhledávání/filtrování',
'Documentation' => 'Dokumentace',
'Table of contents' => 'Obsah',
// 'Author' => '',
// 'Version' => '',
// 'Plugins' => '',

View File

@@ -742,10 +742,8 @@ return array(
'Change task color when using a specific task link' => 'Ændre opgave farve når der bruges bestemt opgave henvisning',
'Task link creation or modification' => 'Opgave henvisning oprettelse eller ændring',
'Milestone' => 'Milepæl',
'Documentation: %s' => 'Dokumentation: %s',
'Reset the search/filter box' => 'Nulstille søge- / filter-boks',
'Documentation' => 'Dokumentation',
'Table of contents' => 'Indholdsfortegnelse',
'Author' => 'Forfatter',
'Version' => 'Version',
'Plugins' => 'Udvidelses-moduler',

View File

@@ -742,10 +742,8 @@ return array(
'Change task color when using a specific task link' => 'Aufgabefarbe ändern bei bestimmter Aufgabenverbindung',
'Task link creation or modification' => 'Aufgabenverbindung erstellen oder bearbeiten',
'Milestone' => 'Meilenstein',
'Documentation: %s' => 'Dokumentation: %s',
'Reset the search/filter box' => 'Suche/Filter-Box zurücksetzen',
'Documentation' => 'Dokumentation',
'Table of contents' => 'Inhaltsverzeichnis',
'Author' => 'Autor',
'Version' => 'Version',
'Plugins' => 'Plugins',

View File

@@ -742,10 +742,8 @@ return array(
'Change task color when using a specific task link' => 'Αλλαγή χρώματος εργασίας χρησιμοποιώντας συγκεκριμένο σύνδεσμο εργασίας',
'Task link creation or modification' => 'Σύνδεσμος δημιουργίας ή τροποποίησης εργασίας',
'Milestone' => 'Ορόσημο',
'Documentation: %s' => 'Τεκμηρίωση: %s',
'Reset the search/filter box' => 'Αρχικοποίηση του πεδίου αναζήτησης/φιλτραρίσματος',
'Documentation' => 'Τεκμηρίωση',
'Table of contents' => 'Πίνακας περιεχομένων',
'Author' => 'Δημιουργός',
'Version' => 'Έκδοση',
'Plugins' => 'Πρόσθετα',

View File

@@ -742,10 +742,8 @@ return array(
'Change task color when using a specific task link' => 'Cambiar el color de la tarea cuando se utiliza un enlace de tarea específico',
'Task link creation or modification' => 'Creación o modificación de enlaces de tareas',
'Milestone' => 'Hito',
'Documentation: %s' => 'Documentación: %s',
'Reset the search/filter box' => 'Restablecer la caja de búsqueda/filtro',
'Documentation' => 'Documentación',
'Table of contents' => 'Tabla de contenido',
'Author' => 'Autor',
'Version' => 'Versión',
'Plugins' => 'Plugins',

View File

@@ -742,10 +742,8 @@ return array(
// 'Change task color when using a specific task link' => '',
// 'Task link creation or modification' => '',
// 'Milestone' => '',
// 'Documentation: %s' => '',
// 'Reset the search/filter box' => '',
// 'Documentation' => '',
// 'Table of contents' => '',
// 'Author' => '',
// 'Version' => '',
// 'Plugins' => '',

View File

@@ -742,10 +742,8 @@ return array(
'Change task color when using a specific task link' => 'Changer la couleur de la tâche lorsqu\'un lien spécifique est utilisé',
'Task link creation or modification' => 'Création ou modification d\'un lien sur une tâche',
'Milestone' => 'Étape importante',
'Documentation: %s' => 'Documentation : %s',
'Reset the search/filter box' => 'Réinitialiser le champ de recherche',
'Documentation' => 'Documentation',
'Table of contents' => 'Table des matières',
'Author' => 'Auteur',
'Version' => 'Version',
'Plugins' => 'Extensions',

View File

@@ -742,10 +742,8 @@ return array(
// 'Change task color when using a specific task link' => '',
// 'Task link creation or modification' => '',
// 'Milestone' => '',
// 'Documentation: %s' => '',
// 'Reset the search/filter box' => '',
'Documentation' => 'Dokumentacija',
// 'Table of contents' => '',
// 'Author' => '',
// 'Version' => '',
// 'Plugins' => '',

View File

@@ -742,10 +742,8 @@ return array(
'Change task color when using a specific task link' => 'Feladatszín megváltoztatása, ha egy adott feladathivatkozást használnak',
'Task link creation or modification' => 'Feladathivatkozás létrehozása vagy módosítása',
'Milestone' => 'Mérföldkő',
'Documentation: %s' => 'Dokumentáció: %s',
'Reset the search/filter box' => 'A keresés/szűrés doboz visszaállítása',
'Documentation' => 'Dokumentáció',
'Table of contents' => 'Tartalomjegyzék',
'Author' => 'Szerző',
'Version' => 'Verzió',
'Plugins' => 'Bővítmények',

View File

@@ -742,10 +742,8 @@ return array(
'Change task color when using a specific task link' => 'Ganti warna tugas ketika menggunakan tautan tugas yang spesifik',
'Task link creation or modification' => 'Tautan pembuatan atau modifikasi tugas ',
'Milestone' => 'Milestone',
'Documentation: %s' => 'Dokumentasi: %s',
'Reset the search/filter box' => 'Reset kotak pencarian/saringan',
'Documentation' => 'Dokumentasi',
'Table of contents' => 'Daftar isi',
'Author' => 'Penulis',
'Version' => 'Versi',
'Plugins' => 'Plugin',

View File

@@ -742,10 +742,8 @@ return array(
'Change task color when using a specific task link' => 'Cambia colore del task quando si un utilizza una determinata relazione di task',
'Task link creation or modification' => 'Creazione o modifica di relazione di task',
// 'Milestone' => '',
'Documentation: %s' => 'Documentazione: %s',
'Reset the search/filter box' => 'Resetta la riceca/filtro',
'Documentation' => 'Documentazione',
'Table of contents' => 'Indice dei contenuti',
'Author' => 'Autore',
'Version' => 'Versione',
'Plugins' => 'Plugin',

View File

@@ -742,10 +742,8 @@ return array(
'Change task color when using a specific task link' => '特定のタスクリンクを使用するとタスクの色を変更',
'Task link creation or modification' => 'タスクリンクの作成または変更',
'Milestone' => 'マイルストーン',
'Documentation: %s' => 'ドキュメント:%s',
'Reset the search/filter box' => '検索/フィルタをリセット',
'Documentation' => 'ドキュメント',
'Table of contents' => '目次',
'Author' => '著者',
'Version' => 'バージョン',
'Plugins' => 'プラグイン',

View File

@@ -742,10 +742,8 @@ return array(
'Change task color when using a specific task link' => '특정 할일 링크를 사용할때 할일의 색깔 변경',
'Task link creation or modification' => '할일 링크 생성 혹은 수정',
'Milestone' => '마일스톤',
'Documentation: %s' => '문서: %s',
'Reset the search/filter box' => '찾기/필터 박스 초기화',
'Documentation' => '문서',
'Table of contents' => '목차',
'Author' => '글쓴이',
'Version' => '버전',
'Plugins' => '플러그인',

View File

@@ -742,10 +742,8 @@ return array(
'Change task color when using a specific task link' => 'Rubah warna tugas ketika menggunakan Pautan tugas yang spesifik',
'Task link creation or modification' => 'Pautan tugas pada penciptaan atau penyuntingan',
'Milestone' => 'Batu Tanda',
'Documentation: %s' => 'Dokumentasi : %s',
'Reset the search/filter box' => 'Tetap semula pencarian/saringan',
'Documentation' => 'Dokumentasi',
'Table of contents' => 'Isi kandungan',
// 'Author' => '',
// 'Version' => '',
// 'Plugins' => '',

View File

@@ -742,10 +742,8 @@ return array(
// 'Change task color when using a specific task link' => '',
// 'Task link creation or modification' => '',
'Milestone' => 'Milepæl',
'Documentation: %s' => 'Dokumentasjon: %s',
'Reset the search/filter box' => 'Nullstill søk/filter',
'Documentation' => 'Dokumentasjon',
'Table of contents' => 'Innholdsfortegnelse',
// 'Author' => '',
// 'Version' => '',
// 'Plugins' => '',

View File

@@ -742,10 +742,8 @@ return array(
// 'Change task color when using a specific task link' => '',
// 'Task link creation or modification' => '',
'Milestone' => 'Mijlpaal',
// 'Documentation: %s' => '',
// 'Reset the search/filter box' => '',
// 'Documentation' => '',
// 'Table of contents' => '',
// 'Author' => '',
// 'Version' => '',
// 'Plugins' => '',

View File

@@ -742,10 +742,8 @@ return array(
'Change task color when using a specific task link' => 'Zmień kolor zadania używając specjalnego adresu URL',
'Task link creation or modification' => 'Adres URL do utworzenia zadania lub modyfikacji',
'Milestone' => 'Kamień milowy',
'Documentation: %s' => 'Dokumentacja: %s',
'Reset the search/filter box' => 'Zresetuj pole wyszukiwania/filtrowania',
'Documentation' => 'Dokumentacja',
'Table of contents' => 'Tablica zawartości',
'Author' => 'Autor',
'Version' => 'Wersja',
'Plugins' => 'Wtyczki',

View File

@@ -742,10 +742,8 @@ return array(
'Change task color when using a specific task link' => 'Mudar a cor da tarefa quando um link específico é utilizado',
'Task link creation or modification' => 'Criação ou modificação de um link em uma tarefa',
'Milestone' => 'Marco',
'Documentation: %s' => 'Documentação: %s',
'Reset the search/filter box' => 'Reiniciar o campo de pesquisa',
'Documentation' => 'Documentação',
'Table of contents' => 'Índice',
'Author' => 'Autor',
'Version' => 'Versão',
'Plugins' => 'Plugins',

View File

@@ -742,10 +742,8 @@ return array(
'Change task color when using a specific task link' => 'Alterar cor da tarefa quando se usar um tipo especifico de ligação de tarefa',
'Task link creation or modification' => 'Criação ou modificação de ligação de tarefa',
'Milestone' => 'Objectivo',
'Documentation: %s' => 'Documentação: %s',
'Reset the search/filter box' => 'Repor caixa de procura/filtro',
'Documentation' => 'Documentação',
'Table of contents' => 'Tabela de conteúdos',
'Author' => 'Autor',
'Version' => 'Versão',
'Plugins' => 'Plugins',

View File

@@ -742,10 +742,8 @@ return array(
'Change task color when using a specific task link' => 'Schimbă culoarea sarcinii când se folosește o anumită legătură în sarcină',
'Task link creation or modification' => 'Creare sau modificare legături sarcină',
'Milestone' => 'Țel',
'Documentation: %s' => 'Documentație: %s',
'Reset the search/filter box' => 'Resetează dialogul de căutare/filtre',
'Documentation' => 'Documentație',
'Table of contents' => 'Cuprins',
'Author' => 'Autor',
'Version' => 'Versiuni',
'Plugins' => 'Extensii',

View File

@@ -742,10 +742,8 @@ return array(
'Change task color when using a specific task link' => 'Изменение цвета задач при использовании ссылки на определенные задачи',
'Task link creation or modification' => 'Ссылка на создание или модификацию задачи',
'Milestone' => 'Веха',
'Documentation: %s' => 'Документация: %s',
'Reset the search/filter box' => 'Сбросить поиск/фильтр',
'Documentation' => 'Документация',
'Table of contents' => 'Содержание',
'Author' => 'Автор',
'Version' => 'Версия',
'Plugins' => 'Плагины',

View File

@@ -742,10 +742,8 @@ return array(
// 'Change task color when using a specific task link' => '',
// 'Task link creation or modification' => '',
// 'Milestone' => '',
// 'Documentation: %s' => '',
// 'Reset the search/filter box' => '',
// 'Documentation' => '',
// 'Table of contents' => '',
// 'Author' => '',
// 'Version' => '',
// 'Plugins' => '',

View File

@@ -742,10 +742,8 @@ return array(
// 'Change task color when using a specific task link' => '',
// 'Task link creation or modification' => '',
// 'Milestone' => '',
// 'Documentation: %s' => '',
// 'Reset the search/filter box' => '',
// 'Documentation' => '',
// 'Table of contents' => '',
// 'Author' => '',
// 'Version' => '',
// 'Plugins' => '',

View File

@@ -742,10 +742,8 @@ return array(
'Change task color when using a specific task link' => 'เปลี่ยนสีงานเมื่อมีการใช้การเชื่อมโยงงาน',
'Task link creation or modification' => 'การสร้างการเชื่อมโยงงานหรือการปรับเปลี่ยน',
'Milestone' => 'ขั้น',
'Documentation: %s' => 'เอกสาร: %s',
'Reset the search/filter box' => 'รีเซตกล่องค้นหา/ตัวกรอง',
'Documentation' => 'เอกสาร',
'Table of contents' => 'สารบัญ',
'Author' => 'ผู้แต่ง',
'Version' => 'เวอร์ชัน',
'Plugins' => 'ปลั๊กอิน',

View File

@@ -742,10 +742,8 @@ return array(
'Change task color when using a specific task link' => 'Belirli bir görev bağlantısı kullanıldığında görevin rengini değiştir',
'Task link creation or modification' => 'Görev bağlantısı oluşturulması veya değiştirilmesi',
'Milestone' => 'Kilometre taşı',
'Documentation: %s' => 'Dokümantasyon: %s',
'Reset the search/filter box' => 'Arama/Filtre kutusunu sıfırla',
'Documentation' => 'Dokümantasyon',
'Table of contents' => 'İçindekiler',
'Author' => 'Yazar',
'Version' => 'Versiyon',
'Plugins' => 'Eklentiler',

View File

@@ -742,10 +742,8 @@ return array(
'Change task color when using a specific task link' => 'Thay đổi màu nhiệm vụ khi sử dụng liên kết nhiệm vụ cụ thể',
'Task link creation or modification' => 'Tạo hoặc sửa đổi liên kết nhiệm vụ',
'Milestone' => 'Milestone',
'Documentation: %s' => 'Tài liệu: %s',
'Reset the search/filter box' => 'Đặt lại hộp tìm kiếm / bộ lọc',
'Documentation' => 'Tài liệu hướng dẫn',
'Table of contents' => 'Mục lục',
'Author' => 'Tác giả',
'Version' => 'Phiên bản',
'Plugins' => 'Plugins',

View File

@@ -742,10 +742,8 @@ return array(
'Change task color when using a specific task link' => '当任务关联到指定任务时改变颜色',
'Task link creation or modification' => '任务链接创建或更新时间',
'Milestone' => '里程碑',
'Documentation: %s' => '文档:%s',
'Reset the search/filter box' => '重置搜索/过滤框',
'Documentation' => '帮助文档',
'Table of contents' => '表内容',
'Author' => '作者',
'Version' => '版本',
'Plugins' => '插件管理',

View File

@@ -742,10 +742,8 @@ return array(
'Change task color when using a specific task link' => '當任務關聯到指定任務時改變顏色',
'Task link creation or modification' => '任務連接建立或更新時間',
'Milestone' => '里程碑',
'Documentation: %s' => '文件:%s',
'Reset the search/filter box' => '重設搜尋/過濾框',
'Documentation' => '文件',
'Table of contents' => '表内容',
'Author' => '作者',
'Version' => '版本',
'Plugins' => '插件',

View File

@@ -1,12 +0,0 @@
<section id="main">
<div class="page-header">
<ul>
<li>
<?= $this->url->icon('life-ring', t('Table of contents'), 'DocumentationController', 'show', array('file' => 'index')) ?>
</li>
</ul>
</div>
<div class="markdown documentation">
<?= $content ?>
</div>
</section>

View File

@@ -29,7 +29,8 @@
<?= $this->hook->render('template:header:dropdown') ?>
<li>
<?= $this->url->icon('life-ring', t('Documentation'), 'DocumentationController', 'show') ?>
<i class="fa fa-fw fa-life-ring" aria-hidden="true"></i>
<?= $this->url->doc(t('Documentation'), 'index') ?>
</li>
<?php if (! DISABLE_LOGOUT): ?>
<li>

View File

@@ -152,3 +152,6 @@ defined('TOTP_ISSUER') or define('TOTP_ISSUER', 'Kanboard');
// Comma separated list of fields to not synchronize when using external authentication providers
defined('EXTERNAL_AUTH_EXCLUDE_FIELDS') or define('EXTERNAL_AUTH_EXCLUDE_FIELDS', 'username');
// Documentation URL
defined('DOCUMENTATION_URL_PATTERN') or define('DOCUMENTATION_URL_PATTERN', 'https://docs.kanboard.org/en/%s/user_guide/%s.html');