# added a summary column to the site table.

made related UI changes for the added column
This commit is contained in:
hyung-hwan 2015-04-25 04:43:38 +00:00
parent b875aba90d
commit 390f154215
8 changed files with 32 additions and 15 deletions

View File

@ -12,9 +12,8 @@ UPGRADING FROM 0.2.0
The code_hide_details column in the user_settings table has been renamed The code_hide_details column in the user_settings table has been renamed
to code_hide_metadata. You must rename your existing database manually. to code_hide_metadata. You must rename your existing database manually.
mysql> ALTER TABLE user_settings CHANGE code_hide_details code_hide_metadata char(1) NOT NULL; mysql> ALTER TABLE user_settings CHANGE code_hide_details code_hide_metadata CHAR(1) NOT NULL;
oracle> ALTER TABLE user_settings RENAME COLUMN code_hide_details TO code_hide_metadata; mysql> ALTER TABLE site ADD COLUMN(summary VARCHAR(255) NOT NULL);
INSTALLATION ON CENTOS INSTALLATION ON CENTOS

View File

@ -6,6 +6,7 @@
CREATE TABLE site ( CREATE TABLE site (
id VARCHAR(32) PRIMARY KEY, id VARCHAR(32) PRIMARY KEY,
name VARCHAR(128) NOT NULL, name VARCHAR(128) NOT NULL,
summary VARCHAR(255) NOT NULL,
text TEXT NOT NULL, text TEXT NOT NULL,
createdon DATETIME NOT NULL, createdon DATETIME NOT NULL,

View File

@ -148,7 +148,7 @@ class Site extends Controller
$data['login'] = $login; $data['login'] = $login;
$site = $this->sites->get ($siteid); $site = $this->sites->get ($siteid);
if ($site === FALSE) if ($site === FALSE)
{ {
$data['login'] = $login; $data['login'] = $login;
@ -174,11 +174,13 @@ class Site extends Controller
$data['login'] = $login; $data['login'] = $login;
// SET VALIDATION RULES // SET VALIDATION RULES
$this->form_validation->set_rules ( $this->form_validation->set_rules (
'site_id', 'ID', 'required|alpha_dash|max_length[32]'); 'site_id', 'ID', 'required|alpha_dash|max_length[32]');
$this->form_validation->set_rules ( $this->form_validation->set_rules (
'site_name', 'name', 'required|max_length[128]'); 'site_name', 'name', 'required|max_length[128]');
$this->form_validation->set_rules (
'site_summary', 'summary', 'max_length[255]');
$this->form_validation->set_rules ( $this->form_validation->set_rules (
'site_text', 'text', 'required'); 'site_text', 'text', 'required');
$this->form_validation->set_error_delimiters( $this->form_validation->set_error_delimiters(
@ -195,7 +197,9 @@ class Site extends Controller
// recompose the site information from POST data. // recompose the site information from POST data.
unset ($site); unset ($site);
$site->id = $tmpid; $site->id = $tmpid;
$site->name = $this->input->post('site_name'); $site->name = $this->input->post('site_name');
$site->summary = $this->input->post('site_summary');
$site->text = $this->input->post('site_text'); $site->text = $this->input->post('site_text');
// validate the form // validate the form
@ -257,6 +261,7 @@ class Site extends Controller
{ {
$site->id = $siteid; $site->id = $siteid;
$site->name = ''; $site->name = '';
$site->summary = '';
$site->text = ''; $site->text = '';
$this->_edit_site ($site, 'create', $login); $this->_edit_site ($site, 'create', $login);

View File

@ -12,6 +12,7 @@ class SiteModel extends Model
{ {
$site->id = CODEPOT_DEFAULT_SITE_LANGUAGE; $site->id = CODEPOT_DEFAULT_SITE_LANGUAGE;
$site->name = CODEPOT_DEFAULT_SITE_NAME; $site->name = CODEPOT_DEFAULT_SITE_NAME;
$site->summary = '';
$site->text = ''; $site->text = '';
$site->updatedby = ''; $site->updatedby = '';
$site->createdby = ''; $site->createdby = '';
@ -63,6 +64,7 @@ class SiteModel extends Model
$this->db->set ('id', $site->id); $this->db->set ('id', $site->id);
$this->db->set ('name', $site->name); $this->db->set ('name', $site->name);
$this->db->set ('summary', $site->summary);
$this->db->set ('text', $site->text); $this->db->set ('text', $site->text);
$this->db->set ('createdon', date('Y-m-d H:i:s')); $this->db->set ('createdon', date('Y-m-d H:i:s'));
$this->db->set ('createdby', $userid); $this->db->set ('createdby', $userid);
@ -88,6 +90,7 @@ class SiteModel extends Model
$this->db->where ('id', $site->id); $this->db->where ('id', $site->id);
$this->db->set ('name', $site->name); $this->db->set ('name', $site->name);
$this->db->set ('summary', $site->summary);
$this->db->set ('text', $site->text); $this->db->set ('text', $site->text);
$this->db->set ('updatedon', date('Y-m-d H:i:s')); $this->db->set ('updatedon', date('Y-m-d H:i:s'));
$this->db->set ('updatedby', $userid); $this->db->set ('updatedby', $userid);

View File

@ -16,7 +16,10 @@ function show_projectbar ($con, $banner, $page, $ctxmenuitems)
if (isset($banner)) if (isset($banner))
{ {
print htmlspecialchars($banner); if (is_array($banner))
print htmlspecialchars($banner[0]);
else
print htmlspecialchars($banner);
} }
else if ($type == 'project') else if ($type == 'project')
{ {
@ -46,15 +49,16 @@ function show_projectbar ($con, $banner, $page, $ctxmenuitems)
print "<div class='subtitle'>"; print "<div class='subtitle'>";
if (isset($banner)) if (isset($banner))
{ {
// anything? if (is_array($banner) && count($banner) > 1)
print htmlspecialchars($banner[1]);
} }
else if ($type == 'project') else if ($type == 'project')
{ {
print htmlspecialchars($project->summary); if (isset($project)) print htmlspecialchars($project->summary);
} }
else if ($type == 'site') else if ($type == 'site')
{ {
// anything? if (isset($site)) print htmlspecialchars($site->summary);
} }
else if ($type == 'user') else if ($type == 'user')
{ {
@ -84,7 +88,6 @@ function show_projectbar ($con, $banner, $page, $ctxmenuitems)
{ {
$menuitems = array ( $menuitems = array (
array ("project/home/{$project->id}", $con->lang->line('Overview')), array ("project/home/{$project->id}", $con->lang->line('Overview')),
//array ("project/home/{$project->id}", '<i class="fa fa-code fa-2x"></i>'),
array ("wiki/home/{$project->id}", $con->lang->line('Wiki')), array ("wiki/home/{$project->id}", $con->lang->line('Wiki')),
array ("issue/home/{$project->id}", $con->lang->line('Issues')), array ("issue/home/{$project->id}", $con->lang->line('Issues')),
array ("code/home/{$project->id}", $con->lang->line('Code')), array ("code/home/{$project->id}", $con->lang->line('Code')),

View File

@ -94,9 +94,7 @@ $this->load->view (
$extra .= 'maxlength="32" size="16" class="id"'; $extra .= 'maxlength="32" size="16" class="id"';
?> ?>
<?php print form_input('site_id', <?php print form_input('site_id', set_value('site_id', $site->id), $extra)
set_value('site_id', $site->id),
$extra)
?> ?>
<?php print form_error('site_id')?> <?php print form_error('site_id')?>
</div> </div>
@ -110,6 +108,15 @@ $this->load->view (
<?php print form_error('site_name')?> <?php print form_error('site_name')?>
</div> </div>
<div class='form_input_field'>
<?php print form_label($this->lang->line('Summary').': ', 'site_summary')?>
<?php print form_input('site_summary',
set_value('site_summary', $site->summary),
'maxlength="100" size="50" class="summary"');
?>
<?php print form_error('site_summary')?>
</div>
<div class='form_input_label'> <div class='form_input_label'>
<?php print form_label($this->lang->line('Text').': ', 'site_text')?> <?php print form_label($this->lang->line('Text').': ', 'site_text')?>
<a href='#' id='site_edit_mainarea_text_preview_button'><?php print $this->lang->line('Preview')?></a> <a href='#' id='site_edit_mainarea_text_preview_button'><?php print $this->lang->line('Preview')?></a>

View File

@ -90,7 +90,7 @@ $(function () {
$this->load->view ( $this->load->view (
'projectbar', 'projectbar',
array ( array (
'banner' => $site->name, 'banner' => array($site->name, $site->summary),
'page' => array ( 'page' => array (
'type' => ($login['sysadmin?']? 'site': ''), 'type' => ($login['sysadmin?']? 'site': ''),

View File

@ -249,7 +249,6 @@ body {
.content .projectbar .subtitle { .content .projectbar .subtitle {
font-size: 1em; font-size: 1em;
white-space: nowrap; white-space: nowrap;
padding-left: 0.1em;
color: #1C94C4; color: #1C94C4;
} }