finished revision log message editing
This commit is contained in:
parent
bcbe7a8f02
commit
61be4c7695
@ -247,6 +247,7 @@ class Code extends Controller
|
|||||||
$this->load->model ('ProjectModel', 'projects');
|
$this->load->model ('ProjectModel', 'projects');
|
||||||
$this->load->model ('SubversionModel', 'subversion');
|
$this->load->model ('SubversionModel', 'subversion');
|
||||||
|
|
||||||
|
|
||||||
$login = $this->login->getUser ();
|
$login = $this->login->getUser ();
|
||||||
if (CODEPOT_SIGNIN_COMPULSORY && $login['id'] == '')
|
if (CODEPOT_SIGNIN_COMPULSORY && $login['id'] == '')
|
||||||
redirect ("main/signin/" . $this->converter->AsciiTohex(current_url()));
|
redirect ("main/signin/" . $this->converter->AsciiTohex(current_url()));
|
||||||
@ -277,6 +278,40 @@ class Code extends Controller
|
|||||||
redirect ("main/signin/" . $this->converter->AsciiTohex(current_url()));
|
redirect ("main/signin/" . $this->converter->AsciiTohex(current_url()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$data['edit_error_message'] = '';
|
||||||
|
if ($login['id'] != '' &&
|
||||||
|
$login['id'] == $this->subversion->getRevProp($projectid, $rev, 'svn:author'))
|
||||||
|
{
|
||||||
|
// the current user must be the author of the revision to be able to
|
||||||
|
// change the log message.
|
||||||
|
$this->load->helper ('form');
|
||||||
|
$this->load->library ('form_validation');
|
||||||
|
|
||||||
|
$this->form_validation->set_rules ('edit_log_message', 'Message', 'required|min_length[2]');
|
||||||
|
$this->form_validation->set_error_delimiters('<span class="form_field_error">','</span>');
|
||||||
|
|
||||||
|
if ($this->input->post('edit_log_message'))
|
||||||
|
{
|
||||||
|
$logmsg = $this->input->post('edit_log_message');
|
||||||
|
if ($this->form_validation->run())
|
||||||
|
{
|
||||||
|
if ($logmsg != $this->subversion->getRevProp ($projectid, $rev, 'svn:log'))
|
||||||
|
{
|
||||||
|
$actual_rev = $this->subversion->setRevProp (
|
||||||
|
$projectid, $rev, 'svn:log', $logmsg, $login['id']);
|
||||||
|
if ($actual_rev === FALSE)
|
||||||
|
{
|
||||||
|
$data['edit_error_message'] = 'Cannot change revision log message';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$data['edit_error_message'] = 'Invalid revision log message';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$file = $this->subversion->getRevHistory ($projectid, $path, $rev);
|
$file = $this->subversion->getRevHistory ($projectid, $path, $rev);
|
||||||
if ($file === FALSE)
|
if ($file === FALSE)
|
||||||
{
|
{
|
||||||
|
@ -768,6 +768,24 @@ class SubversionModel extends Model
|
|||||||
return $log[0]['rev'];
|
return $log[0]['rev'];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function getRevProp ($projectid, $rev, $prop)
|
||||||
|
{
|
||||||
|
$url = 'file://'.$this->_canonical_path(CODEPOT_SVNREPO_DIR."/{$projectid}");
|
||||||
|
return @svn_revprop_get ($url, $rev, $prop);
|
||||||
|
}
|
||||||
|
|
||||||
|
function setRevProp ($projectid, $rev, $prop, $propval, $user)
|
||||||
|
{
|
||||||
|
$url = 'file://'.$this->_canonical_path(CODEPOT_SVNREPO_DIR."/{$projectid}");
|
||||||
|
|
||||||
|
$orguser = @svn_auth_get_parameter (SVN_AUTH_PARAM_DEFAULT_USERNAME);
|
||||||
|
@svn_auth_set_parameter (SVN_AUTH_PARAM_DEFAULT_USERNAME, $user);
|
||||||
|
|
||||||
|
$result = @svn_revprop_set ($url, $rev, $prop, $propval);
|
||||||
|
|
||||||
|
@svn_auth_set_parameter (SVN_AUTH_PARAM_DEFAULT_USERNAME, $orguser);
|
||||||
|
return $result;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
@ -12,6 +12,9 @@
|
|||||||
|
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
|
|
||||||
|
<?php $can_edit = ($login['id'] == $file['history']['author']); ?>
|
||||||
|
|
||||||
|
<?php if ($can_edit): ?>
|
||||||
$(function() {
|
$(function() {
|
||||||
$("#code_revision_edit_div").dialog (
|
$("#code_revision_edit_div").dialog (
|
||||||
{
|
{
|
||||||
@ -40,7 +43,25 @@ $(function() {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
|
<?php if (strlen($edit_error_message) > 0): ?>
|
||||||
|
$("#code_revision_edit_error_div").dialog( {
|
||||||
|
title: '<?=$this->lang->line('Error')?>',
|
||||||
|
width: 'auto',
|
||||||
|
height: 'auto',
|
||||||
|
modal: true,
|
||||||
|
autoOpen: true,
|
||||||
|
buttons: {
|
||||||
|
"<?=$this->lang->line('OK')?>": function() {
|
||||||
|
$( this ).dialog( "close" );
|
||||||
|
}
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
<?php endif; ?>
|
||||||
|
|
||||||
|
});
|
||||||
|
<?php endif; ?>
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<title><?=htmlspecialchars($project->name)?></title>
|
<title><?=htmlspecialchars($project->name)?></title>
|
||||||
@ -155,13 +176,14 @@ $history = $file['history'];
|
|||||||
|
|
||||||
<div id="code_revision_mainarea_result">
|
<div id="code_revision_mainarea_result">
|
||||||
|
|
||||||
<div class="title"><?=$this->lang->line('Message')?>
|
<div class="title"><?=$this->lang->line('Message')?>
|
||||||
|
<?php if ($can_edit): ?>
|
||||||
<span class='anchor'>
|
<span class='anchor'>
|
||||||
<?=anchor ("#", $this->lang->line('Edit'),
|
<?=anchor ("#", $this->lang->line('Edit'),
|
||||||
array ('id' => 'code_revision_edit_logmsg_button'));
|
array ('id' => 'code_revision_edit_logmsg_button'));
|
||||||
?>
|
?>
|
||||||
</span>
|
</span>
|
||||||
|
<?php endif; ?>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<pre id="code_revision_mainarea_result_msg">
|
<pre id="code_revision_mainarea_result_msg">
|
||||||
@ -215,17 +237,27 @@ $history = $file['history'];
|
|||||||
|
|
||||||
</div> <!-- code_revision_content -->
|
</div> <!-- code_revision_content -->
|
||||||
|
|
||||||
|
<?php if ($can_edit): ?>
|
||||||
<div id="code_revision_edit_div">
|
<div id="code_revision_edit_div">
|
||||||
<?=form_open("code/revision/{$project->id}${revreqroot}", 'id="code_revision_edit_logmsg_form"')?>
|
<?=form_open("code/revision/{$project->id}${revreqroot}", 'id="code_revision_edit_logmsg_form"')?>
|
||||||
<?=
|
<?=
|
||||||
|
|
||||||
form_textarea (
|
form_textarea (
|
||||||
array ('name' => 'code_revision_edit_logmsg',
|
array ('name' => 'edit_log_message',
|
||||||
'value' => $history['msg'], 'rows'=> 10, 'cols' => 70)
|
'value' => $history['msg'], 'rows'=> 10, 'cols' => 70,
|
||||||
);
|
'id' => 'code_revision_edit_log_message')
|
||||||
|
)
|
||||||
?>
|
?>
|
||||||
<?=form_close()?>
|
<?=form_close()?>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<?php if (strlen($edit_error_message) > 0): ?>
|
||||||
|
<div id="code_revision_edit_error_div">
|
||||||
|
<?=$edit_error_message?>
|
||||||
|
</div>
|
||||||
|
<?php endif; ?>
|
||||||
|
<?php endif; ?> <!-- $can_edit -->
|
||||||
|
|
||||||
</body>
|
</body>
|
||||||
|
|
||||||
</html>
|
</html>
|
||||||
|
@ -185,7 +185,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
#code_revision_mainarea_result .title .anchor {
|
#code_revision_mainarea_result .title .anchor {
|
||||||
font-size: 9pt;
|
font-size: 70%;
|
||||||
}
|
}
|
||||||
|
|
||||||
#code_revision_mainarea_result_msg {
|
#code_revision_mainarea_result_msg {
|
||||||
|
14
codepot/src/css/jquery-ui.css
vendored
14
codepot/src/css/jquery-ui.css
vendored
@ -349,12 +349,15 @@ button.ui-button-icons-only { width: 3.7em; }
|
|||||||
|
|
||||||
/*button text element */
|
/*button text element */
|
||||||
.ui-button .ui-button-text { display: block; line-height: 1.4; }
|
.ui-button .ui-button-text { display: block; line-height: 1.4; }
|
||||||
.ui-button-text-only .ui-button-text { padding: .4em 1em; }
|
//.ui-button-text-only .ui-button-text { padding: .4em 1em; }
|
||||||
|
.ui-button-text-only .ui-button-text { padding: .2em .5em; }
|
||||||
.ui-button-icon-only .ui-button-text, .ui-button-icons-only .ui-button-text { padding: .4em; text-indent: -9999999px; }
|
.ui-button-icon-only .ui-button-text, .ui-button-icons-only .ui-button-text { padding: .4em; text-indent: -9999999px; }
|
||||||
.ui-button-text-icon .ui-button-text, .ui-button-text-icons .ui-button-text { padding: .4em 1em .4em 2.1em; }
|
//.ui-button-text-icon .ui-button-text, .ui-button-text-icons .ui-button-text { padding: .4em 1em .4em 2.1em; }
|
||||||
|
.ui-button-text-icon .ui-button-text, .ui-button-text-icons .ui-button-text { padding: .2em 1em .2em 2.1em; }
|
||||||
.ui-button-text-icons .ui-button-text { padding-left: 2.1em; padding-right: 2.1em; }
|
.ui-button-text-icons .ui-button-text { padding-left: 2.1em; padding-right: 2.1em; }
|
||||||
/* no icon support for input elements, provide padding by default */
|
/* no icon support for input elements, provide padding by default */
|
||||||
input.ui-button { padding: .4em 1em; }
|
//input.ui-button { padding: .4em 1em; }
|
||||||
|
input.ui-button { padding: .2em .5em; }
|
||||||
|
|
||||||
/*button icon element(s) */
|
/*button icon element(s) */
|
||||||
.ui-button-icon-only .ui-icon, .ui-button-text-icon .ui-icon, .ui-button-text-icons .ui-icon, .ui-button-icons-only .ui-icon { position: absolute; top: 50%; margin-top: -8px; }
|
.ui-button-icon-only .ui-icon, .ui-button-text-icon .ui-icon, .ui-button-text-icons .ui-icon, .ui-button-icons-only .ui-icon { position: absolute; top: 50%; margin-top: -8px; }
|
||||||
@ -383,7 +386,10 @@ button.ui-button::-moz-focus-inner { border: 0; padding: 0; } /* reset extra pad
|
|||||||
.ui-dialog .ui-dialog-titlebar-close:hover, .ui-dialog .ui-dialog-titlebar-close:focus { padding: 0; }
|
.ui-dialog .ui-dialog-titlebar-close:hover, .ui-dialog .ui-dialog-titlebar-close:focus { padding: 0; }
|
||||||
.ui-dialog .ui-dialog-content { border: 0; padding: .5em 1em; background: none; overflow: auto; zoom: 1; }
|
.ui-dialog .ui-dialog-content { border: 0; padding: .5em 1em; background: none; overflow: auto; zoom: 1; }
|
||||||
.ui-dialog .ui-dialog-buttonpane { text-align: left; border-width: 1px 0 0 0; background-image: none; margin: .5em 0 0 0; padding: .1em 1em .3em .4em; }
|
.ui-dialog .ui-dialog-buttonpane { text-align: left; border-width: 1px 0 0 0; background-image: none; margin: .5em 0 0 0; padding: .1em 1em .3em .4em; }
|
||||||
.ui-dialog .ui-dialog-buttonpane button { float: right; margin: .5em .4em .5em 0; cursor: pointer; padding: .2em .6em .3em .6em; line-height: 1.4em; width:auto; overflow:visible; }
|
|
||||||
|
//.ui-dialog .ui-dialog-buttonpane button { float: right; margin: .5em .4em .5em 0; cursor: pointer; padding: .2em .6em .3em .6em; line-height: 1.4em; width:auto; overflow:visible; }
|
||||||
|
.ui-dialog .ui-dialog-buttonpane button { float: right; margin: .5em .4em .5em 0; cursor: pointer; padding: .2em .5em .2em .5em; line-height: 1.4em; width:auto; overflow:visible; }
|
||||||
|
|
||||||
.ui-dialog .ui-resizable-se { width: 14px; height: 14px; right: 3px; bottom: 3px; }
|
.ui-dialog .ui-resizable-se { width: 14px; height: 14px; right: 3px; bottom: 3px; }
|
||||||
.ui-draggable .ui-dialog-titlebar { cursor: move; }
|
.ui-draggable .ui-dialog-titlebar { cursor: move; }
|
||||||
/* Slider
|
/* Slider
|
||||||
|
Loading…
Reference in New Issue
Block a user