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).''; ?> +