added simple multi-column wiki rendering using css
This commit is contained in:
parent
23540ff950
commit
d060b4773e
@ -40,6 +40,7 @@ CREATE TABLE wiki (
|
|||||||
projectid VARCHAR(32) NOT NULL,
|
projectid VARCHAR(32) NOT NULL,
|
||||||
name VARCHAR(255) NOT NULL,
|
name VARCHAR(255) NOT NULL,
|
||||||
text TEXT NOT NULL,
|
text TEXT NOT NULL,
|
||||||
|
columns INT NOT NULL DEFAULT 1,
|
||||||
|
|
||||||
createdon DATETIME NOT NULL,
|
createdon DATETIME NOT NULL,
|
||||||
updatedon DATETIME NOT NULL,
|
updatedon DATETIME NOT NULL,
|
||||||
|
@ -353,6 +353,8 @@ class Wiki extends Controller
|
|||||||
'wiki_name', 'name', 'required|max_length[255]');
|
'wiki_name', 'name', 'required|max_length[255]');
|
||||||
$this->form_validation->set_rules (
|
$this->form_validation->set_rules (
|
||||||
'wiki_text', 'text', 'required');
|
'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 (
|
$this->form_validation->set_error_delimiters (
|
||||||
'<span class="form_field_error">','</span>');
|
'<span class="form_field_error">','</span>');
|
||||||
|
|
||||||
@ -374,6 +376,7 @@ class Wiki extends Controller
|
|||||||
$new_wiki_name = NULL;
|
$new_wiki_name = NULL;
|
||||||
}
|
}
|
||||||
$wiki->text = $this->input->post('wiki_text');
|
$wiki->text = $this->input->post('wiki_text');
|
||||||
|
$wiki->columns = $this->input->post('wiki_columns');
|
||||||
$wiki->attachments = array();
|
$wiki->attachments = array();
|
||||||
$wiki->delete_attachments = array();
|
$wiki->delete_attachments = array();
|
||||||
|
|
||||||
@ -529,6 +532,7 @@ class Wiki extends Controller
|
|||||||
$wiki->projectid = $projectid;
|
$wiki->projectid = $projectid;
|
||||||
$wiki->name = $name;
|
$wiki->name = $name;
|
||||||
$wiki->text = '';
|
$wiki->text = '';
|
||||||
|
$wiki->columns = '1';
|
||||||
|
|
||||||
$data['wiki'] = $wiki;
|
$data['wiki'] = $wiki;
|
||||||
$this->load->view ($this->VIEW_EDIT, $data);
|
$this->load->view ($this->VIEW_EDIT, $data);
|
||||||
|
@ -9,6 +9,8 @@ $lang['Change'] = 'Change';
|
|||||||
$lang['Change log'] = 'Change log';
|
$lang['Change log'] = 'Change log';
|
||||||
$lang['Code'] = 'Code';
|
$lang['Code'] = 'Code';
|
||||||
$lang['Code changes'] = 'Code changes';
|
$lang['Code changes'] = 'Code changes';
|
||||||
|
$lang['Column'] = 'Column';
|
||||||
|
$lang['Columns'] = 'Columns';
|
||||||
$lang['Comment'] = 'Comment';
|
$lang['Comment'] = 'Comment';
|
||||||
$lang['Commitable'] = 'Commitable';
|
$lang['Commitable'] = 'Commitable';
|
||||||
$lang['Committer'] = 'Committer';
|
$lang['Committer'] = 'Committer';
|
||||||
|
@ -7,6 +7,8 @@ $lang['Change'] = 'Change';
|
|||||||
$lang['Change log'] = 'Change log';
|
$lang['Change log'] = 'Change log';
|
||||||
$lang['Code'] = 'Kode';
|
$lang['Code'] = 'Kode';
|
||||||
$lang['Code changes'] = 'Kode changes'
|
$lang['Code changes'] = 'Kode changes'
|
||||||
|
$lang['Column'] = 'Column';
|
||||||
|
$lang['Columns'] = 'Columns';
|
||||||
$lang['Comment'] = 'Comment';
|
$lang['Comment'] = 'Comment';
|
||||||
$lang['Commitable'] = 'Commitable';
|
$lang['Commitable'] = 'Commitable';
|
||||||
$lang['Committer'] = 'Pengarang';
|
$lang['Committer'] = 'Pengarang';
|
||||||
|
@ -9,6 +9,8 @@ $lang['Change'] = '변경';
|
|||||||
$lang['Change log'] = '변경기록';
|
$lang['Change log'] = '변경기록';
|
||||||
$lang['Code'] = '코드';
|
$lang['Code'] = '코드';
|
||||||
$lang['Code changes'] = '코드변경';
|
$lang['Code changes'] = '코드변경';
|
||||||
|
$lang['Column'] = '칼럼';
|
||||||
|
$lang['Columns'] = '칼럼';
|
||||||
$lang['Comment'] = '소견';
|
$lang['Comment'] = '소견';
|
||||||
$lang['Commitable'] = '커밋가능';
|
$lang['Commitable'] = '커밋가능';
|
||||||
$lang['Committer'] = '커밋터';
|
$lang['Committer'] = '커밋터';
|
||||||
|
@ -105,6 +105,7 @@ class WikiModel extends Model
|
|||||||
$this->db->set ('projectid', $wiki->projectid);
|
$this->db->set ('projectid', $wiki->projectid);
|
||||||
$this->db->set ('name', $wiki->name);
|
$this->db->set ('name', $wiki->name);
|
||||||
$this->db->set ('text', $wiki->text);
|
$this->db->set ('text', $wiki->text);
|
||||||
|
$this->db->set ('columns', $wiki->columns);
|
||||||
$this->db->set ('createdon', $now);
|
$this->db->set ('createdon', $now);
|
||||||
$this->db->set ('updatedon', $now);
|
$this->db->set ('updatedon', $now);
|
||||||
$this->db->set ('createdby', $userid);
|
$this->db->set ('createdby', $userid);
|
||||||
@ -215,6 +216,7 @@ class WikiModel extends Model
|
|||||||
$this->db->where ('projectid', $wiki->projectid);
|
$this->db->where ('projectid', $wiki->projectid);
|
||||||
$this->db->where ('name', $effective_wiki_name);
|
$this->db->where ('name', $effective_wiki_name);
|
||||||
$this->db->set ('text', $wiki->text);
|
$this->db->set ('text', $wiki->text);
|
||||||
|
$this->db->set ('columns', $wiki->columns);
|
||||||
$this->db->set ('updatedon', $now);
|
$this->db->set ('updatedon', $now);
|
||||||
$this->db->set ('updatedby', $userid);
|
$this->db->set ('updatedby', $userid);
|
||||||
$this->db->update ('wiki');
|
$this->db->update ('wiki');
|
||||||
|
@ -27,6 +27,20 @@ $hexname = $this->converter->AsciiToHex ($wiki->name);
|
|||||||
|
|
||||||
function render_wiki(input_text)
|
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 (
|
creole_render_wiki_with_input_text (
|
||||||
input_text,
|
input_text,
|
||||||
"wiki_edit_mainarea_text_preview",
|
"wiki_edit_mainarea_text_preview",
|
||||||
@ -96,8 +110,9 @@ $this->load->view (
|
|||||||
|
|
||||||
<?php if ($message != "") print '<div id="wiki_edit_message" class="form_message">'.htmlspecialchars($message).'</div>'; ?>
|
<?php if ($message != "") print '<div id="wiki_edit_message" class="form_message">'.htmlspecialchars($message).'</div>'; ?>
|
||||||
|
|
||||||
|
<div id="wiki_edit_mainarea_form">
|
||||||
<?=form_open_multipart("wiki/{$mode}/{$project->id}/".$this->converter->AsciiToHex($wiki->name))?>
|
<?=form_open_multipart("wiki/{$mode}/{$project->id}/".$this->converter->AsciiToHex($wiki->name))?>
|
||||||
<?=form_fieldset()?>
|
<!-- <?=form_fieldset()?> field set is problematic. if text contains a wide pre block, preview with multi-columns overflows beyond its container. -->
|
||||||
<div class='form_input_label'>
|
<div class='form_input_label'>
|
||||||
<?=form_label($this->lang->line('Name').': ', 'wiki_name')?>
|
<?=form_label($this->lang->line('Name').': ', 'wiki_name')?>
|
||||||
<?=form_error('wiki_name');?>
|
<?=form_error('wiki_name');?>
|
||||||
@ -113,7 +128,22 @@ $this->load->view (
|
|||||||
|
|
||||||
<div class='form_input_label'>
|
<div class='form_input_label'>
|
||||||
<?=form_label($this->lang->line('Text').': ', 'wiki_text')?>
|
<?=form_label($this->lang->line('Text').': ', 'wiki_text')?>
|
||||||
<a href='#' id='wiki_edit_mainarea_text_preview_button'><?=$this->lang->line('Preview')?></a>
|
<a href='#' id='wiki_edit_mainarea_text_preview_button'><?=$this->lang->line('Preview')?></a>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
$attrs = array (
|
||||||
|
'name' => '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);
|
||||||
|
?>
|
||||||
|
|
||||||
|
<?=$this->lang->line('Columns')?>(1-9)
|
||||||
|
|
||||||
<?=form_error('wiki_text');?>
|
<?=form_error('wiki_text');?>
|
||||||
</div>
|
</div>
|
||||||
<div class='form_input_field'>
|
<div class='form_input_field'>
|
||||||
@ -184,8 +214,9 @@ $this->load->view (
|
|||||||
<?=form_submit('wiki', $caption)?>
|
<?=form_submit('wiki', $caption)?>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<?=form_fieldset_close()?>
|
<!-- <?=form_fieldset_close()?> -->
|
||||||
<?=form_close();?>
|
<?=form_close();?>
|
||||||
|
</div> <!-- wiki_edit_mainarea_form -->
|
||||||
|
|
||||||
</div> <!-- wiki_edit_mainarea -->
|
</div> <!-- wiki_edit_mainarea -->
|
||||||
|
|
||||||
|
@ -53,6 +53,19 @@ $(function () {
|
|||||||
|
|
||||||
function render_wiki()
|
function render_wiki()
|
||||||
{
|
{
|
||||||
|
var column_count = '<?= $wiki->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 (
|
creole_render_wiki (
|
||||||
"wiki_show_mainarea_wiki_text",
|
"wiki_show_mainarea_wiki_text",
|
||||||
"wiki_show_mainarea_wiki",
|
"wiki_show_mainarea_wiki",
|
||||||
|
@ -446,7 +446,7 @@ body {
|
|||||||
border: none;
|
border: none;
|
||||||
font-family: consolas, "Andale Mono", monospace;
|
font-family: consolas, "Andale Mono", monospace;
|
||||||
line-height: 1.2em;
|
line-height: 1.2em;
|
||||||
padding: 1em;
|
padding: 0.3em;
|
||||||
|
|
||||||
tab-size: 5;
|
tab-size: 5;
|
||||||
-moz-tab-size: 5;
|
-moz-tab-size: 5;
|
||||||
|
@ -5,6 +5,14 @@
|
|||||||
#wiki_show_mainarea_result {
|
#wiki_show_mainarea_result {
|
||||||
position: relative;
|
position: relative;
|
||||||
min-height: 13em;
|
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 {
|
#wiki_show_mainarea_result_info {
|
||||||
@ -36,7 +44,22 @@
|
|||||||
/*---------------------------------------------
|
/*---------------------------------------------
|
||||||
* wiki edit
|
* wiki edit
|
||||||
*---------------------------------------------*/
|
*---------------------------------------------*/
|
||||||
|
#wiki_edit_mainarea_form {
|
||||||
|
border: #D4DBE8 1px solid;
|
||||||
|
padding: 0.5em;
|
||||||
|
}
|
||||||
|
|
||||||
#wiki_edit_mainarea_text {
|
#wiki_edit_mainarea_text {
|
||||||
width: 100%;
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user