added the commitable field to a project
This commit is contained in:
parent
d5d2aacf19
commit
6a5a585b21
@ -17,6 +17,7 @@ CREATE TABLE project (
|
||||
name VARCHAR(255) UNIQUE NOT NULL,
|
||||
summary VARCHAR(255) NOT NULL,
|
||||
description TEXT NOT NULL,
|
||||
commitable CHAR(1) NOT NULL DEFAULT 'Y',
|
||||
|
||||
createdon DATETIME NOT NULL,
|
||||
updatedon DATETIME NOT NULL,
|
||||
|
@ -3,17 +3,17 @@
|
||||
REPOBASE="`basename "${1}"`"
|
||||
USER="${2}"
|
||||
|
||||
ans="`wget -q -O- "%API%/projectHasMember/${REPOBASE}/${USER}" 2>/dev/null`"
|
||||
ans="`wget -q -O- "%API%/projectIsCommitable/${REPOBASE}/${USER}" 2>/dev/null`"
|
||||
[ "${ans}" = "YES" ] && exit 0
|
||||
|
||||
[ "${ans}" = "NO" ] && {
|
||||
echo "-------------------------------------------------------------" >&2
|
||||
echo " ${USER} is not a member of ${REPOBASE}" >&2
|
||||
echo " ${REPOBASE} is read-only or ${USER} is not a member of ${REPOBASE}" >&2
|
||||
echo "-------------------------------------------------------------" >&2
|
||||
exit 1
|
||||
}
|
||||
|
||||
echo "---------------------------------------------------------------------" >&2
|
||||
echo " Failed to check membership of ${REPOBASE} for ${USER}" >&2
|
||||
echo " Failed to check commitability of ${REPOBASE} for ${USER}" >&2
|
||||
echo "---------------------------------------------------------------------" >&2
|
||||
exit 1
|
||||
|
@ -34,6 +34,18 @@ class API extends Controller
|
||||
print ($this->projects->projectIsOwnedBy ($projectid, $userid) === FALSE)? 'NO': 'YES';
|
||||
}
|
||||
|
||||
function projectIsCommitable ($projectid, $userid)
|
||||
{
|
||||
$this->check_access ();
|
||||
|
||||
if (!isset($projectid) || !isset($userid)) return 'NO';
|
||||
|
||||
$this->load->model ('ProjectModel', 'projects');
|
||||
print ($this->projects->projectIsOwnedBy ($projectid, $userid) === FALSE ||
|
||||
$this->projects->projectIsCommitable ($projectid) === FALSE)? 'NO': 'YES';
|
||||
}
|
||||
|
||||
|
||||
function logCodeCommit ($type, $repo, $rev)
|
||||
{
|
||||
$this->check_access ();
|
||||
|
@ -168,6 +168,8 @@ class Project extends Controller
|
||||
'project_summary', 'summary', 'required|max_length[255]');
|
||||
$this->form_validation->set_rules (
|
||||
'project_description', 'description', 'required');
|
||||
$this->form_validation->set_rules (
|
||||
'project_commitable', 'commitable', 'alpha');
|
||||
$this->form_validation->set_rules (
|
||||
'project_members', 'members', 'required');
|
||||
$this->form_validation->set_error_delimiters(
|
||||
@ -187,6 +189,7 @@ class Project extends Controller
|
||||
$project->name = $this->input->post('project_name');
|
||||
$project->summary = $this->input->post('project_summary');
|
||||
$project->description = $this->input->post('project_description');
|
||||
$project->commitable = $this->input->post('project_commitable');
|
||||
$project->members = $this->input->post('project_members');
|
||||
|
||||
// validate the form
|
||||
@ -244,6 +247,7 @@ class Project extends Controller
|
||||
$project->name = '';
|
||||
$project->summary = '';
|
||||
$project->description = '';
|
||||
$project->commitable = 'Y';
|
||||
$project->members = $login['id'];
|
||||
|
||||
$this->_edit_project ($project, 'create', $login);
|
||||
|
@ -11,6 +11,7 @@ $lang['Change log'] = 'Change log';
|
||||
$lang['Code'] = 'Code';
|
||||
$lang['Code changes'] = 'Code changes';
|
||||
$lang['Comment'] = 'Comment';
|
||||
$lang['Commitable'] = 'Commitable';
|
||||
$lang['Create'] = 'Create';
|
||||
$lang['Created by'] = 'Created by';
|
||||
$lang['Created on'] = 'Created on';
|
||||
|
@ -9,6 +9,7 @@ $lang['Change log'] = 'Change log';
|
||||
$lang['Code'] = 'Kode';
|
||||
$lang['Code changes'] = 'Kode changes'
|
||||
$lang['Comment'] = 'Comment';
|
||||
$lang['Commitable'] = 'Commitable';
|
||||
$lang['Create'] = 'Dibuat';
|
||||
$lang['Created by'] = 'Dibuat oleh';
|
||||
$lang['Created on'] = 'Waktu dibuat';
|
||||
|
@ -11,6 +11,7 @@ $lang['Change log'] = '변경기록';
|
||||
$lang['Code'] = '코드';
|
||||
$lang['Code changes'] = '코드변경';
|
||||
$lang['Comment'] = '소견';
|
||||
$lang['Commitable'] = '커밋가능';
|
||||
$lang['Create'] = '생성';
|
||||
$lang['Created by'] = '최초생성인';
|
||||
$lang['Created on'] = '최초생성시간';
|
||||
|
@ -99,6 +99,7 @@ class ProjectModel extends Model
|
||||
$this->db->set ('name', $project->name);
|
||||
$this->db->set ('summary', $project->summary);
|
||||
$this->db->set ('description', $project->description);
|
||||
$this->db->set ('commitable', $project->commitable);
|
||||
$this->db->set ('createdon', date('Y-m-d H:i:s'));
|
||||
$this->db->set ('createdby', $userid);
|
||||
$this->db->set ('updatedon', date('Y-m-d H:i:s'));
|
||||
@ -207,6 +208,7 @@ class ProjectModel extends Model
|
||||
$this->db->set ('name', $project->name);
|
||||
$this->db->set ('summary', $project->summary);
|
||||
$this->db->set ('description', $project->description);
|
||||
$this->db->set ('commitable', $project->commitable);
|
||||
$this->db->set ('updatedon', date('Y-m-d H:i:s'));
|
||||
$this->db->set ('updatedby', $userid);
|
||||
$this->db->update ('project');
|
||||
@ -422,6 +424,16 @@ class ProjectModel extends Model
|
||||
return ($count == 1)? TRUE: FALSE;
|
||||
}
|
||||
|
||||
function projectIsCommitable ($projectid)
|
||||
{
|
||||
$this->db->trans_start ();
|
||||
$this->db->where ('id', $projectid);
|
||||
$this->db->where ('commitable', 'Y');
|
||||
$count = $this->db->count_all_results ('project');
|
||||
$this->db->trans_complete ();
|
||||
if ($this->db->trans_status() === FALSE) return FALSE;
|
||||
return ($count == 1)? TRUE: FALSE;
|
||||
}
|
||||
|
||||
function _delete_files_uploaded ($files)
|
||||
{
|
||||
|
@ -104,6 +104,14 @@ $this->load->view (
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<div>
|
||||
<?=form_label($this->lang->line('Commitable').': ', 'project_commitable')?>
|
||||
<?=form_checkbox('project_commitable', 'Y', set_checkbox('project_commitable', $project->commitable, $project->commitable == 'Y'))?>
|
||||
<?=form_error('project_commitable')?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<div>
|
||||
<?=form_label($this->lang->line('Members').': ', 'project_members')?>
|
||||
|
Loading…
Reference in New Issue
Block a user