Commit bc06008eef742e3971fdbe3859c442acdbd4d1a4
- Diff rendering mode:
- inline
- side by side
TODO
(4 / 6)
|   | |||
| 1 | 1 | Backend | |
| 2 | 2 | ------- | |
| 3 | - Wikify links | ||
| 4 | - Auto-link plain-text links | ||
| 5 | - Auto-insert newline after h? | ||
| 3 | - Auto-insert newline after h*. section headers | ||
| 6 | 4 | - Add section edit links ? | |
| 7 | 5 | - Add diffs to history | |
| 8 | 6 | ||
| 9 | ExtJS theme | ||
| 10 | ----------- | ||
| 11 | - Create | ||
| 7 | Themes | ||
| 8 | ------ | ||
| 9 | Create an ExtJS theme |
index.php
(28 / 6)
|   | |||
| 23 | 23 | // Helpers | |
| 24 | 24 | // -------------------------------------------------------------------------- | |
| 25 | 25 | ||
| 26 | function getHistory($file = "") { | ||
| 26 | function getGitHistory($file = "") { | ||
| 27 | 27 | $output = array(); | |
| 28 | 28 | git("log --pretty=format:'%H>%T>%an>%ae>%aD>%s' -- $file", $output); | |
| 29 | 29 | $history = array(); | |
| … | … | ||
| 120 | 120 | print join("\n", $output) . "\n"; | |
| 121 | 121 | //print "Error code: " . $result . "\n"; | |
| 122 | 122 | print "</pre>"; | |
| 123 | return 0; | ||
| 123 | 124 | } | |
| 124 | 125 | return 1; | |
| 125 | 126 | } | |
| … | … | ||
| 157 | 157 | // -------------------------------------------------------------------------- | |
| 158 | 158 | ||
| 159 | 159 | function wikify($text) { | |
| 160 | // FIXME: Wikify | ||
| 160 | global $SCRIPT_URL; | ||
| 161 | 161 | ||
| 162 | // FIXME: Do not apply this in <pre> and <notextile> blocks. | ||
| 163 | |||
| 164 | // Linkify | ||
| 165 | $text = preg_replace('@[^:](https?://([-\w\.]+)+(:\d+)?(/([-\w/_\.]*(\?\S+)?)?)?)@', '<a href="$1">$1</a>', $text); | ||
| 166 | |||
| 167 | // WikiLinkify | ||
| 168 | $text = preg_replace('@\[([A-Z]\w+)\]@', '<a href="' . $SCRIPT_URL . '/$1">$1</a>', $text); | ||
| 169 | |||
| 162 | 170 | // Textilify | |
| 163 | 171 | $textile = new Textile(); | |
| 164 | 172 | return $textile->TextileThis($text); | |
| … | … | ||
| 239 | 239 | return "themes/$THEME"; | |
| 240 | 240 | } | |
| 241 | 241 | ||
| 242 | function getFile() { | ||
| 243 | global $wikiFile; | ||
| 244 | return $wikiFile; | ||
| 245 | } | ||
| 246 | |||
| 247 | function getContent() { | ||
| 248 | global $wikiContent; | ||
| 249 | return $wikiContent; | ||
| 250 | } | ||
| 251 | |||
| 252 | function getRawData() { | ||
| 253 | global $wikiData; | ||
| 254 | return $wikiData; | ||
| 255 | } | ||
| 256 | |||
| 242 | 257 | // -------------------------------------------------------------------------- | |
| 243 | 258 | // Initialize globals | |
| 244 | 259 | // -------------------------------------------------------------------------- | |
| … | … | ||
| 263 | 263 | $resource = parseResource($_GET['r']); | |
| 264 | 264 | $wikiPage = $resource["page"]; | |
| 265 | 265 | $wikiSubPage = $resource["type"]; | |
| 266 | |||
| 267 | 266 | $wikiFile = $DATA_DIR . "/" . $wikiPage; | |
| 268 | $wikiCSS = $CSS; | ||
| 269 | 267 | ||
| 270 | 268 | ||
| 271 | 269 | // -------------------------------------------------------------------------- | |
| … | … | ||
| 304 | 304 | else { | |
| 305 | 305 | // Global history | |
| 306 | 306 | if ($wikiPage == "history") { | |
| 307 | $wikiHistory = getHistory(); | ||
| 307 | $wikiHistory = getGitHistory(); | ||
| 308 | 308 | $wikiPage = ""; | |
| 309 | 309 | include(getThemeDir() . "/history.php"); | |
| 310 | 310 | } | |
| … | … | ||
| 337 | 337 | } | |
| 338 | 338 | // History | |
| 339 | 339 | else if ($wikiSubPage == "history") { | |
| 340 | $wikiHistory = getHistory($wikiPage); | ||
| 340 | $wikiHistory = getGitHistory($wikiPage); | ||
| 341 | 341 | include(getThemeDir() . "/history.php"); | |
| 342 | 342 | } | |
| 343 | 343 | // Specific version |
themes/default/edit.php
(1 / 1)
|   | |||
| 18 | 18 | ||
| 19 | 19 | <div id="form"> | |
| 20 | 20 | <form method="post" action="<?php print getPostURL(); ?>"> | |
| 21 | <p><textarea name="data" cols="80" rows="20" style="width: 100%"><?php print $wikiData; ?></textarea></p> | ||
| 21 | <p><textarea name="data" cols="80" rows="20" style="width: 100%"><?php print getRawData(); ?></textarea></p> | ||
| 22 | 22 | <p><input type="submit" value="publish" /></p> | |
| 23 | 23 | </form> | |
| 24 | 24 | </div> |
themes/default/history.php
(2 / 0)
|   | |||
| 20 | 20 | </div> | |
| 21 | 21 | ||
| 22 | 22 | <div id="history"> | |
| 23 | <p> | ||
| 23 | 24 | <table> | |
| 24 | 25 | <tr><th>Date</th><th>Author</th><th>Page</th><th>Message</th></tr> | |
| 25 | 26 | <?php | |
| … | … | ||
| 36 | 36 | } | |
| 37 | 37 | ?> | |
| 38 | 38 | </table> | |
| 39 | </p> | ||
| 39 | 40 | </div> | |
| 40 | 41 | </body> | |
| 41 | 42 | </html> |
themes/default/style.css
(2 / 0)
|   | |||
| 115 | 115 | ||
| 116 | 116 | #history table { | |
| 117 | 117 | border-collapse: collapse; | |
| 118 | margin-left: auto; | ||
| 119 | margin-right: auto; | ||
| 118 | 120 | } | |
| 119 | 121 | ||
| 120 | 122 | #history td { |
themes/default/view.php
(2 / 2)
|   | |||
| 19 | 19 | </div> | |
| 20 | 20 | ||
| 21 | 21 | <div id="content"> | |
| 22 | <?php print $wikiContent; ?> | ||
| 22 | <?php print getContent(); ?> | ||
| 23 | 23 | </div> | |
| 24 | 24 | ||
| 25 | 25 | <div id="footer"> | |
| 26 | <p>Last modified on <?php print date("F d Y H:i:s", filemtime($wikiFile)); ?> </p> | ||
| 26 | <p>Last modified on <?php print date("F d Y H:i:s", filemtime(getFile())); ?> </p> | ||
| 27 | 27 | </div> | |
| 28 | 28 | </body> | |
| 29 | 29 | </html> |

