diff --git a/codepot/etc/codepot.mysql b/codepot/etc/codepot.mysql index df49d05e..f8c249ad 100644 --- a/codepot/etc/codepot.mysql +++ b/codepot/etc/codepot.mysql @@ -40,6 +40,7 @@ CREATE TABLE wiki ( projectid VARCHAR(32) NOT NULL, name VARCHAR(255) NOT NULL, text TEXT NOT NULL, + columns INT NOT NULL DEFAULT 1, createdon DATETIME NOT NULL, updatedon DATETIME NOT NULL, diff --git a/codepot/src/codepot/controllers/wiki.php b/codepot/src/codepot/controllers/wiki.php index 1545e7db..6a72909a 100644 --- a/codepot/src/codepot/controllers/wiki.php +++ b/codepot/src/codepot/controllers/wiki.php @@ -353,6 +353,8 @@ class Wiki extends Controller 'wiki_name', 'name', 'required|max_length[255]'); $this->form_validation->set_rules ( 'wiki_text', 'text', 'required'); + $this->form_validation->set_rules ( + 'wiki_columns', 'columns', 'required|integer|min_length[1]|max_length[1]|greater_than[0]|less_than[10]'); $this->form_validation->set_error_delimiters ( '',''); @@ -374,6 +376,7 @@ class Wiki extends Controller $new_wiki_name = NULL; } $wiki->text = $this->input->post('wiki_text'); + $wiki->columns = $this->input->post('wiki_columns'); $wiki->attachments = array(); $wiki->delete_attachments = array(); @@ -529,6 +532,7 @@ class Wiki extends Controller $wiki->projectid = $projectid; $wiki->name = $name; $wiki->text = ''; + $wiki->columns = '1'; $data['wiki'] = $wiki; $this->load->view ($this->VIEW_EDIT, $data); diff --git a/codepot/src/codepot/language/english/common_lang.php b/codepot/src/codepot/language/english/common_lang.php index 37fd38f8..15359248 100644 --- a/codepot/src/codepot/language/english/common_lang.php +++ b/codepot/src/codepot/language/english/common_lang.php @@ -9,6 +9,8 @@ $lang['Change'] = 'Change'; $lang['Change log'] = 'Change log'; $lang['Code'] = 'Code'; $lang['Code changes'] = 'Code changes'; +$lang['Column'] = 'Column'; +$lang['Columns'] = 'Columns'; $lang['Comment'] = 'Comment'; $lang['Commitable'] = 'Commitable'; $lang['Committer'] = 'Committer'; diff --git a/codepot/src/codepot/language/indonesian/common_lang.php b/codepot/src/codepot/language/indonesian/common_lang.php index 385d9190..8d3bd3ab 100644 --- a/codepot/src/codepot/language/indonesian/common_lang.php +++ b/codepot/src/codepot/language/indonesian/common_lang.php @@ -7,6 +7,8 @@ $lang['Change'] = 'Change'; $lang['Change log'] = 'Change log'; $lang['Code'] = 'Kode'; $lang['Code changes'] = 'Kode changes' +$lang['Column'] = 'Column'; +$lang['Columns'] = 'Columns'; $lang['Comment'] = 'Comment'; $lang['Commitable'] = 'Commitable'; $lang['Committer'] = 'Pengarang'; diff --git a/codepot/src/codepot/language/korean/common_lang.php b/codepot/src/codepot/language/korean/common_lang.php index bc7fb962..fdbd6e3e 100644 --- a/codepot/src/codepot/language/korean/common_lang.php +++ b/codepot/src/codepot/language/korean/common_lang.php @@ -9,6 +9,8 @@ $lang['Change'] = '변경'; $lang['Change log'] = '변경기록'; $lang['Code'] = '코드'; $lang['Code changes'] = '코드변경'; +$lang['Column'] = '칼럼'; +$lang['Columns'] = '칼럼'; $lang['Comment'] = '소견'; $lang['Commitable'] = '커밋가능'; $lang['Committer'] = '커밋터'; diff --git a/codepot/src/codepot/models/wikimodel.php b/codepot/src/codepot/models/wikimodel.php index e092a33d..847e5e4d 100644 --- a/codepot/src/codepot/models/wikimodel.php +++ b/codepot/src/codepot/models/wikimodel.php @@ -105,6 +105,7 @@ class WikiModel extends Model $this->db->set ('projectid', $wiki->projectid); $this->db->set ('name', $wiki->name); $this->db->set ('text', $wiki->text); + $this->db->set ('columns', $wiki->columns); $this->db->set ('createdon', $now); $this->db->set ('updatedon', $now); $this->db->set ('createdby', $userid); @@ -215,6 +216,7 @@ class WikiModel extends Model $this->db->where ('projectid', $wiki->projectid); $this->db->where ('name', $effective_wiki_name); $this->db->set ('text', $wiki->text); + $this->db->set ('columns', $wiki->columns); $this->db->set ('updatedon', $now); $this->db->set ('updatedby', $userid); $this->db->update ('wiki'); diff --git a/codepot/src/codepot/views/wiki_edit.php b/codepot/src/codepot/views/wiki_edit.php index 3ccdbbc0..8b5c287b 100644 --- a/codepot/src/codepot/views/wiki_edit.php +++ b/codepot/src/codepot/views/wiki_edit.php @@ -27,6 +27,20 @@ $hexname = $this->converter->AsciiToHex ($wiki->name); function render_wiki(input_text) { + var column_count = $("#wiki_edit_mainarea_text_column_count").val(); + var x_column_count = parseInt (column_count); + if (isNaN(x_column_count) || x_column_count < 1) x_column_count = 1; + else if (x_column_count > 9) x_column_count = 9; // sync this max value with wiki_show. TODO: put this into codepot.ini + + column_count = x_column_count.toString(); + $("#wiki_edit_mainarea_text_column_count").val(column_count); + + $("#wiki_edit_mainarea_text_preview").css ({ + "-moz-column-count": column_count, + "-webkit-column-count": column_count, + "column-count": column_count + }); + creole_render_wiki_with_input_text ( input_text, "wiki_edit_mainarea_text_preview", @@ -96,8 +110,9 @@ $this->load->view ( '.htmlspecialchars($message).''; ?> +
id}/".$this->converter->AsciiToHex($wiki->name))?> - +
lang->line('Name').': ', 'wiki_name')?> @@ -113,7 +128,22 @@ $this->load->view (
lang->line('Text').': ', 'wiki_text')?> - lang->line('Preview')?> + lang->line('Preview')?> + + 'wiki_columns', + 'id' => 'wiki_edit_mainarea_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) +
@@ -184,8 +214,9 @@ $this->load->view (
- + +
diff --git a/codepot/src/codepot/views/wiki_show.php b/codepot/src/codepot/views/wiki_show.php index ed04a3fd..4d1cd34a 100644 --- a/codepot/src/codepot/views/wiki_show.php +++ b/codepot/src/codepot/views/wiki_show.php @@ -53,6 +53,19 @@ $(function () { function render_wiki() { + var column_count = 'columns ?>'; + var x_column_count = parseInt (column_count); + if (isNaN(x_column_count) || x_column_count < 1) x_column_count = 1; + else if (x_column_count > 9) x_column_count = 9; // sync this max value with wiki_edit. TODO: put this into codepot.ini + + column_count = x_column_count.toString(); + + $("#wiki_show_mainarea_wiki").css ({ + "-moz-column-count": column_count, + "-webkit-column-count": column_count, + "column-count": column_count + }); + creole_render_wiki ( "wiki_show_mainarea_wiki_text", "wiki_show_mainarea_wiki", diff --git a/codepot/src/css/common.css b/codepot/src/css/common.css index ad370ccd..72a7381f 100644 --- a/codepot/src/css/common.css +++ b/codepot/src/css/common.css @@ -446,7 +446,7 @@ body { border: none; font-family: consolas, "Andale Mono", monospace; line-height: 1.2em; - padding: 1em; + padding: 0.3em; tab-size: 5; -moz-tab-size: 5; diff --git a/codepot/src/css/wiki.css b/codepot/src/css/wiki.css index f10c47ee..43170c22 100644 --- a/codepot/src/css/wiki.css +++ b/codepot/src/css/wiki.css @@ -5,6 +5,14 @@ #wiki_show_mainarea_result { position: relative; min-height: 13em; + + -moz-column-rule: 1px dotted grey; + -webkit-column-rule: 1px dotted grey; + column-rule: 1px dotted grey; + + -moz-column-gap: 2em; + -webkit-column-gap: 2em; + column-gap: 2em; } #wiki_show_mainarea_result_info { @@ -36,7 +44,22 @@ /*--------------------------------------------- * wiki edit *---------------------------------------------*/ +#wiki_edit_mainarea_form { + border: #D4DBE8 1px solid; + padding: 0.5em; +} + #wiki_edit_mainarea_text { width: 100%; } +#wiki_edit_mainarea_text_preview { + -moz-column-rule: 1px dotted grey; + -webkit-column-rule: 1px dotted grey; + column-rule: 1px dotted grey; + + -moz-column-gap: 2em; + -webkit-column-gap: 2em; + column-gap: 2em; +} +