From 1efb57fed8918b439c360af2f13aced286bbb6a1 Mon Sep 17 00:00:00 2001 From: hyung-hwan Date: Sun, 15 Jun 2014 17:16:06 +0000 Subject: [PATCH] added preview buttons to various edit pages --- codepot/src/codepot/views/file_edit.php | 127 ++++++++------- codepot/src/codepot/views/issue_edit.php | 94 +++++++---- codepot/src/codepot/views/project_edit.php | 173 +++++++++++---------- codepot/src/codepot/views/site_edit.php | 102 +++++++----- codepot/src/codepot/views/wiki_edit.php | 117 ++++++++------ codepot/src/css/common.css | 29 +++- codepot/src/css/file.css | 5 + codepot/src/css/project.css | 1 + codepot/src/js/creole.js | 30 ++++ 9 files changed, 417 insertions(+), 261 deletions(-) diff --git a/codepot/src/codepot/views/file_edit.php b/codepot/src/codepot/views/file_edit.php index 25d3c36b..aeb87935 100644 --- a/codepot/src/codepot/views/file_edit.php +++ b/codepot/src/codepot/views/file_edit.php @@ -6,6 +6,36 @@ + + + + + + + + + + <?=htmlspecialchars($file->name)?> @@ -38,78 +68,65 @@ $this->load->view ( -
+
-'.htmlspecialchars($message).'
'; ?> +'.htmlspecialchars($message).'
'; ?> id}/" . $this->converter->AsciiToHex($file->name))?> -
-
- lang->line('Name').': ', 'file_name')?> - -
-
- name), $extra); - else - print form_upload('file_name', set_value('file_name', $file->name), $extra); - ?> -
+
+ lang->line('Name').': ', 'file_name')?> + name), $extra); + else + print form_upload('file_name', set_value('file_name', $file->name), $extra); + ?> +
-
-
- lang->line('Tag').': ', 'file_tag')?> - -
-
- - tag), $extra)?> -
+
+ lang->line('Tag').': ', 'file_tag')?> + + tag), $extra)?> +
-
-
- lang->line('Summary').': ', 'file_summary')?> - -
-
- - summary), $extra)?> -
+
+ lang->line('Summary').': ', 'file_summary')?> + +
+
+ + summary), $extra)?>
-
-
- lang->line('Description').': ', 'file_description')?> - -
-
- description))?> -
+
+ lang->line('Description').': ', 'file_description')?> + Preview +
- -
- projectid))?> +
+ description), 'id=file_edit_mainarea_description')?>
+
-
- lang->line('Update'): $this->lang->line('Create'); ?> - -
+ + projectid))?> + + lang->line('Update'): $this->lang->line('Create'); ?> + -
+
diff --git a/codepot/src/codepot/views/issue_edit.php b/codepot/src/codepot/views/issue_edit.php index 1e2dd087..812fb2c7 100644 --- a/codepot/src/codepot/views/issue_edit.php +++ b/codepot/src/codepot/views/issue_edit.php @@ -6,6 +6,35 @@ + + + + + + + + + <?=htmlspecialchars($issue->id)?> @@ -59,7 +88,7 @@ $this->load->view ( owner))?>
-
+
load->view ( 'issue_type', $issue_type_array, set_value('issue_type', $issue->type), - 'id="project_issue_type"'); + 'id="issue_edit_mainarea_type"'); print form_error('issue_type'); } ?>
-
-
- lang->line('Summary').': ', 'issue_summary')?> - -
-
- summary), - 'size="80" id="project_issue_summary"') - ?> -
+
+ lang->line('Summary').': ', 'issue_summary')?> + +
+
+ summary), + 'size="80" id="issue_edit_mainarea_summary"') + ?>
-
-
- lang->line('Description').': ', 'issue_description')?> - -
-
- 'issue_description', - 'value' => set_value ('issue_description', $issue->description), - 'id' => 'project_issue_description', - 'rows' => 20, - 'cols' => 80 - ); - print form_textarea ($xdata); - ?> -
+
+ lang->line('Description').': ', 'issue_description')?> + Preview +
+
+ 'issue_description', + 'value' => set_value ('issue_description', $issue->description), + 'id' => 'issue_edit_mainarea_description', + 'rows' => 20, + 'cols' => 80 + ); + print form_textarea ($xdata); + ?> +
+
-
- lang->line('Update'): $this->lang->line('Create'); ?> - -
+ + lang->line('Update'): $this->lang->line('Create'); ?> + diff --git a/codepot/src/codepot/views/project_edit.php b/codepot/src/codepot/views/project_edit.php index a6f58718..8424a577 100644 --- a/codepot/src/codepot/views/project_edit.php +++ b/codepot/src/codepot/views/project_edit.php @@ -6,6 +6,32 @@ + + + + + + + + <?=$project->name?> @@ -48,97 +74,82 @@ $this->load->view ( -
-
- lang->line('ID').': ', 'project_id')?> - -
-
- - - id), $extra)?> -
+
+ lang->line('ID').': ', 'project_id')?> + + id), $extra)?> +
-
-
- lang->line('Name').': ', 'project_name')?> - -
-
- - name), $extra)?> -
+
+ lang->line('Name').': ', 'project_name')?> + +
+
+ + name), $extra)?>
-
-
- lang->line('Summary').': ', 'project_summary')?> - -
-
- - summary), $extra)?> -
+
+ lang->line('Summary').': ', 'project_summary')?> + +
+
+ + summary), $extra)?>
-
-
- lang->line('Description').': ', 'project_description')?> - -
-
- 'project_description', - 'value' => set_value ('project_description', $project->description), - 'id' => 'project_edit_mainarea_description', - 'rows' => 20, - 'cols' => 80 - ); - print form_textarea ($xdata); - ?> -
+
+ lang->line('Description').': ', 'project_description')?> + Preview + +
+
+ 'project_description', + 'value' => set_value ('project_description', $project->description), + 'id' => 'project_edit_mainarea_description', + 'rows' => 20, + 'cols' => 80 + ); + print form_textarea ($xdata); + ?> +
+
+ +
+ lang->line('Commitable').': ', 'project_commitable')?> + commitable, $project->commitable == 'Y'))?> + + + lang->line('Public').': ', 'project_public')?> + public, $project->public == 'Y'))?> +
-
-
- lang->line('Commitable').': ', 'project_commitable')?> - commitable, $project->commitable == 'Y'))?> - - - lang->line('Public').': ', 'project_public')?> - public, $project->public == 'Y'))?> - -
+
+ lang->line('Members').': ', 'project_members')?> + +
+
+ 'project_members', + 'value' => set_value ('project_members', $project->members), + 'id' => 'project_edit_mainarea_members', + 'rows' => 2, + 'cols' => 80 + ); + print form_textarea ($xdata); + ?>
-
-
- lang->line('Members').': ', 'project_members')?> - -
-
- 'project_members', - 'value' => set_value ('project_members', $project->members), - 'id' => 'project_edit_mainarea_members', - 'rows' => 2, - 'cols' => 80 - ); - print form_textarea ($xdata); - ?> -
-
- -
- lang->line('Update'): $this->lang->line('Create'); ?> - -
+ lang->line('Update'): $this->lang->line('Create'); ?> + diff --git a/codepot/src/codepot/views/site_edit.php b/codepot/src/codepot/views/site_edit.php index d45214b2..055164d6 100644 --- a/codepot/src/codepot/views/site_edit.php +++ b/codepot/src/codepot/views/site_edit.php @@ -6,6 +6,36 @@ + + + + + + + + + + + <?=htmlspecialchars($site->name)?> @@ -48,55 +78,45 @@ $this->load->view ( -
-
- lang->line('Language').': ', 'site_id')?> - -
-
- +
+ lang->line('Language').': ', 'site_id')?> + - id), - $extra) - ?> -
+ id), + $extra) + ?> +
-
-
- lang->line('Name').': ', 'site_name')?> - -
-
- name), - 'maxlength="80" size="40" class="name"'); - ?> -
+
+ lang->line('Name').': ', 'site_name')?> + name), + 'maxlength="80" size="40" class="name"'); + ?> +
-
-
- lang->line('Text').': ', 'site_text')?> - -
-
- text), - 'class="text"') - ?> -
+
+ lang->line('Text').': ', 'site_text')?> + Preview +
- -
- lang->line('Update'): $this->lang->line('Create'); ?> - +
+ text), + 'class="text" id="site_edit_mainarea_text"') + ?>
+
+ + lang->line('Update'): $this->lang->line('Create'); ?> + diff --git a/codepot/src/codepot/views/wiki_edit.php b/codepot/src/codepot/views/wiki_edit.php index 141fa2c7..3ddad54e 100644 --- a/codepot/src/codepot/views/wiki_edit.php +++ b/codepot/src/codepot/views/wiki_edit.php @@ -6,12 +6,28 @@ + + + + @@ -65,46 +87,44 @@ $this->load->view ( id}/".$this->converter->AsciiToHex($wiki->name))?> -
-
- lang->line('Name').': ', 'wiki_name')?> - -
-
- - name), $extra)?> -
+
+ lang->line('Name').': ', 'wiki_name')?> + +
+
+ + name), $extra)?>
-
-
- lang->line('Text').': ', 'wiki_text')?> - -
-
- 'wiki_text', - 'value' => set_value ('wiki_text', $wiki->text), - 'id' => 'wiki_edit_mainarea_text', - 'rows' => 20, - 'cols' => 80 - ); - print form_textarea ($xdata); - ?> -
+
+ lang->line('Text').': ', 'wiki_text')?> + Preview +
+
+ 'wiki_text', + 'value' => set_value ('wiki_text', $wiki->text), + 'id' => 'wiki_edit_mainarea_text', + 'rows' => 20, + 'cols' => 80 + ); + print form_textarea ($xdata); + ?> +
+
attachments)): ?> -
-
- lang->line('WIKI_ATTACHMENTS').': ', 'wiki_edit_attachment_list')?> - -
+
+ lang->line('WIKI_ATTACHMENTS').': ', 'wiki_edit_attachment_list')?> + +
+
    attachments as $att) @@ -122,25 +142,24 @@ $this->load->view ( } ?>
-
-
-
- lang->line('WIKI_NEW_ATTACHMENTS').': ', 'wiki_edit_new_attachment_list')?> - - lang->line('WIKI_MORE_NEW_ATTACHMENTS')?> - - -
+
+ lang->line('WIKI_NEW_ATTACHMENTS').': ', 'wiki_edit_new_attachment_list')?> + + lang->line('WIKI_MORE_NEW_ATTACHMENTS')?> + + +
-
    -
  • - - -
  • -
+
+
    +
  • + + +
  • +
diff --git a/codepot/src/css/common.css b/codepot/src/css/common.css index ce03ea58..54e00860 100644 --- a/codepot/src/css/common.css +++ b/codepot/src/css/common.css @@ -217,12 +217,39 @@ body { font-size: inherit; } +.content .mainarea .form_input_label { + margin-bottom: 0.2em; +} + +.content .mainarea .form_input_label .ui-button { + font-size: 80%; + font-style: italic; +} + + +.content .mainarea .form_input_field { + margin-bottom: 0.5em; +} + +.content .mainarea .form_input_preview { + width: 100%; + /*border: 1px solid #DDDDDD;*/ + background-color: #FFFFF0; + font-size: 90%; +} + +.content .mainarea .form_input_preview pre { + background-color: inherit; + /*background-color: #FDF5D6;*/ + /*border: none;*/ +} + .content .mainarea .icon { border: 0; } .content .mainarea pre { - padding: .3em .3em .3em .3em; + /*padding: .3em .3em .3em .3em;*/ border: 1px dashed #BBCCDD; background-color: #F1F1FF; overflow: auto; diff --git a/codepot/src/css/file.css b/codepot/src/css/file.css index dc611b5e..a03541d9 100644 --- a/codepot/src/css/file.css +++ b/codepot/src/css/file.css @@ -11,3 +11,8 @@ } +#file_edit_mainarea_description { + width: 100%; +} + + diff --git a/codepot/src/css/project.css b/codepot/src/css/project.css index 7564362d..a23b0e8b 100644 --- a/codepot/src/css/project.css +++ b/codepot/src/css/project.css @@ -50,6 +50,7 @@ width: 100%; } + /*----------------------------------------------- * project catalog view *-----------------------------------------------*/ diff --git a/codepot/src/js/creole.js b/codepot/src/js/creole.js index cbec0bb4..9ed037ac 100644 --- a/codepot/src/js/creole.js +++ b/codepot/src/js/creole.js @@ -536,3 +536,33 @@ function creole_render_wiki (inputid, outputid, linkbase, imgbase) output.innerHTML = ''; creole.parse (output, xinput); } + +function creole_render_wiki_with_input_text (input_text, outputid, linkbase, imgbase) +{ + function $(id) { return document.getElementById(id); } + + function decodeEntities(str) + { + return str.replace(/&/g, '&'). + replace(/</g, '<'). + replace(/>/g, '>'). + replace(/"/g, '"'); + } + + //var input = $(inputid); + var output = $(outputid); + var creole = new Parse.Simple.Creole( + { + forIE: document.all, + /*interwiki: { + WikiCreole: 'http://www.wikicreole.org/wiki/', + Wikipedia: 'http://en.wikipedia.org/wiki/' + },*/ + linkFormat: linkbase, + imgFormat: imgbase + } ); + + var xinput = decodeEntities(input_text); + output.innerHTML = ''; + creole.parse (output, xinput); +}