From 093500d58de27c0f42cb20dee628338e14799f2f Mon Sep 17 00:00:00 2001 From: hyung-hwan Date: Fri, 15 Jan 2016 18:36:21 +0000 Subject: [PATCH] enhanced the standard wiki edit view --- codepot/src/codepot/views/wiki_edit.php | 501 +++++++++++++++++------- codepot/src/codepot/views/wiki_home.php | 2 +- codepot/src/codepot/views/wiki_show.php | 36 ++ codepot/src/css/common.css | 1 + codepot/src/css/wiki.css | 4 - 5 files changed, 404 insertions(+), 140 deletions(-) diff --git a/codepot/src/codepot/views/wiki_edit.php b/codepot/src/codepot/views/wiki_edit.php index 4b07cbde..9447e9c0 100644 --- a/codepot/src/codepot/views/wiki_edit.php +++ b/codepot/src/codepot/views/wiki_edit.php @@ -24,57 +24,335 @@ converter->AsciiToHex ($wiki->name); +$file_count = count($wiki->attachments); ?> @@ -112,115 +390,69 @@ $this->load->view (
-'.htmlspecialchars($message).'
'; ?> - -
-id}/".$this->converter->AsciiToHex($wiki->name))?> - -
- lang->line('Name').': ', 'wiki_name')?> - -
-
- - name), $extra)?> - name)): ''?> +
+
+ +
-
- lang->line('Text').': ', 'wiki_text')?> - lang->line('Preview')?> - - 'wiki_columns', - 'id' => 'wiki_edit_text_column_count', - 'value' => set_value('wiki_columns', $wiki->columns), - 'size' => '2', - 'min' => '1', - 'max' => '9', - 'type' => 'number'); - print form_input ($attrs); - ?> - - lang->line('Columns')?>(1-9) - - -
-
- 'wiki_text', - 'value' => set_value ('wiki_text', $wiki->text), - 'id' => 'wiki_edit_text_area', - 'rows' => 20, - 'cols' => 80 - ); - print form_textarea ($xdata); - ?> -
-
- - attachments)): ?> -
- lang->line('WIKI_ATTACHMENTS').': ', 'wiki_edit_attachment_list')?> - + -
-
    - attachments as $att) +
    +
+ +
+
+ lang->line('WIKI_ATTACHMENTS')?> + lang->line('New')?> +
+
+ + +
    + attachments)): ?> + converter->AsciiToHex($att->name) . - '@' . - $this->converter->AsciiToHex($att->encname); - $escattname = htmlspecialchars($att->name); - + $att = $wiki->attachments[$i];; print '
  • '; - print ""; - print $escattname; + printf ('', $i); + + //printf (' %s', $i, htmlspecialchars($att->name)); + $hexattname = $this->converter->AsciiToHex ($att->name); + printf (' %s', $i, + anchor ( + "wiki/attachment/{$project->id}/{$hex_wikiname}/{$hexattname}", + htmlspecialchars($att->name) + ) + ); print '
  • '; } - ?> + ?> + +
+ +
- +
-
- lang->line('WIKI_NEW_ATTACHMENTS').': ', 'wiki_edit_new_attachment_list')?> - - lang->line('WIKI_MORE_NEW_ATTACHMENTS')?> - - -
+
+
-
-
    -
  • - - -
  • -
+
+ +
-
- -
- projectid))?> -
- -
- lang->line('Update'): $this->lang->line('Create'); ?> - -
- - -
+
@@ -234,7 +466,6 @@ $this->load->view ( - diff --git a/codepot/src/codepot/views/wiki_home.php b/codepot/src/codepot/views/wiki_home.php index 1a8fb13a..15d03d3a 100644 --- a/codepot/src/codepot/views/wiki_home.php +++ b/codepot/src/codepot/views/wiki_home.php @@ -96,7 +96,7 @@ $this->load->view ( diff --git a/codepot/src/codepot/views/wiki_show.php b/codepot/src/codepot/views/wiki_show.php index c46e4569..10291dbf 100644 --- a/codepot/src/codepot/views/wiki_show.php +++ b/codepot/src/codepot/views/wiki_show.php @@ -9,6 +9,7 @@ + @@ -58,6 +59,37 @@ function show_alert (outputMsg, titleMsg) }); } +function showdown_render_wiki (inputid, outputid) +{ + var sd = new showdown.Converter ({ + omitExtraWLInCodeBlocks: false, + noHeaderId: true, + prefixHeaderId: false, + parseImgDimensions: true, + headerLevelStart: 1, + simplifiedAutoLink: false, + literalMidWordUnderscores: false, + strikethrough: true, + tables: true, + tablesHeaderId: false, + ghCodeBlocks: true, + tasklists: true + }); + + function decodeEntities(str) + { + return str.replace(/&/g, '&'). + replace(/</g, '<'). + replace(/>/g, '>'). + replace(/"/g, '"'); + } + + var input = document.getElementById(inputid); + var output = document.getElementById(outputid); + + output.innerHTML = sd.makeHtml(decodeEntities(input.innerHTML)); +} + function render_wiki() { var column_count = 'columns ?>'; @@ -75,12 +107,16 @@ function render_wiki() }); } +doctype == 'M'): ?> + showdown_render_wiki ("wiki_show_wiki_text", "wiki_show_wiki"); + creole_render_wiki ( "wiki_show_wiki_text", "wiki_show_wiki", "/wiki/show/id?>/", "/wiki/attachment/id?>//" ); + prettyPrint (); } diff --git a/codepot/src/css/common.css b/codepot/src/css/common.css index 49e89279..c965d705 100644 --- a/codepot/src/css/common.css +++ b/codepot/src/css/common.css @@ -13,6 +13,7 @@ body { } textarea { + font-size: inherit; font-family: "DejaVu Sans Mono", consolas, monaco, "Andale Mono", monospace; tab-size: 5; diff --git a/codepot/src/css/wiki.css b/codepot/src/css/wiki.css index b0919a89..7a081aa2 100644 --- a/codepot/src/css/wiki.css +++ b/codepot/src/css/wiki.css @@ -140,7 +140,3 @@ box-sizing: border-box !important; } -#wiki_edit_text_editor pre { - white-space: pre-wrap !important; -} -