renewed the code diff view and enhanced the code controller and the subversion model as necessary

This commit is contained in:
hyung-hwan 2016-01-10 16:58:33 +00:00
parent e445a8ed13
commit 79c239f919
9 changed files with 568 additions and 566 deletions

View File

@ -915,7 +915,6 @@ class Code extends Controller
print codepot_json_encode ($result);
}
function history ($projectid = '', $path = '', $rev = SVN_REVISION_HEAD)
{
$this->load->model ('ProjectModel', 'projects');
@ -1175,8 +1174,15 @@ class Code extends Controller
$data['message'] = 'Failed to get diff';
$this->load->view ($this->VIEW_ERROR, $data);
}
else if (($head_rev = $this->subversion->getHeadRev ($projectid, $path, $rev1)) === FALSE)
{
$data['project'] = $project;
$data['message'] = 'Failed to get head revision';
$this->load->view ($this->VIEW_ERROR, $data);
}
else
{
$file['head_rev'] = $head_rev;
$file['prev_rev'] =
$this->subversion->getPrevRev ($projectid, $path, $file['created_rev']);
$file['next_rev'] =

View File

@ -146,6 +146,12 @@ class SubversionModel extends Model
$fileinfo['last_author'] = '';
else
$fileinfo['last_author'] = $info0['last_changed_author'];
if (array_key_exists ('last_changed_date', $info0) === FALSE)
$fileinfo['last_changed_date'] = '';
else
$fileinfo['last_changed_date'] = $info0['last_changed_date'];
$fileinfo['content'] = $list;
return $fileinfo;
}
@ -310,7 +316,6 @@ class SubversionModel extends Model
return TRUE;
}
function importFiles ($projectid, $path, $committer, $commit_message, $files, $uploader)
{
$this->errmsg = '';
@ -1090,6 +1095,16 @@ class SubversionModel extends Model
}
fclose ($diff);
$log = @svn_log ($info1[0]['url'], $fileinfo['created_rev'], $fileinfo['created_rev'], 1, SVN_DISCOVER_CHANGED_PATHS);
if ($log === FALSE) $log = @svn_log ($workurl1, $fileinfo['created_rev'], $fileinfo['created_rev'], 1, SVN_DISCOVER_CHANGED_PATHS);
if ($log === FALSE) $fileinfo['logmsg'] = '';
else $fileinfo['logmsg'] = (count($log) > 0)? $log[0]['msg']: '';
$log = @svn_log ($info2[0]['url'], $fileinfo['against']['created_rev'], $fileinfo['against']['created_rev'], 1, SVN_DISCOVER_CHANGED_PATHS);
if ($log === FALSE) $log = @svn_log ($workurl2, $fileinfo['against']['created_rev'], $fileinfo['against']['created_rev'], 1, SVN_DISCOVER_CHANGED_PATHS);
if ($log === FALSE) $fileinfo['logmsg'] = '';
else $fileinfo['against']['logmsg'] = (count($log) > 0)? $log[0]['msg']: '';
return $fileinfo;
}

View File

@ -227,7 +227,6 @@ $this->load->view (
print '<div class="metadata-menu">';
$detail_anchor_text = $this->lang->line('Details');
$history_anchor_text = '<i class="fa fa-history"></i> ' . $this->lang->line('History');
$download_anchor_text = '<i class="fa fa-download"></i> ' . $this->lang->line('Download');

View File

@ -21,8 +21,115 @@
<script type="text/javascript" src="<?php print base_url_make('/js/jquery-ui.min.js')?>"></script>
<link type="text/css" rel="stylesheet" href="<?php print base_url_make('/css/jquery-ui.css')?>" />
<?php
$hex_headpath = $this->converter->AsciiTohex ($headpath);
if ($revision1 <= 0)
{
$revreq = '';
$revreqroot = '';
$history_path = "/code/history/{$project->id}/{$hex_headpath}";
}
else
{
$revreq = "/{$file['created_rev']}";
$revreqroot = '/' . $this->converter->AsciiToHex ('.') . $revreq;
if ($hex_headpath == '') $revtrailer = $revreqroot;
else $revtrailer = "/{$hex_headpath}{$revreq}";
$history_path = "/code/history/{$project->id}{$revtrailer}";
}
$revreq_against = "/{$file['against']['created_rev']}";
$revreqroot_against = '/' . $this->converter->AsciiToHex ('.') . $revreq_against;
if ($hex_headpath == '') $revtrailer_against = $revreqroot_against;
else $revtrailer_against = "/{$hex_headpath}{$revreq_against}";
$history_against_path = "/code/history/{$project->id}{$revtrailer_against}";
$head_revision_text = '<i class="fa fa-exclamation-triangle" style="color:#CC2222"></i> ' . $this->lang->line('Head revision');
$history_anchor_text = '<i class="fa fa-history"></i> ' . $this->lang->line('History');
$blame_anchor_text = '<i class="fa fa-bomb"></i> ' . $this->lang->line('Blame');
$download_anchor_text = '<i class="fa fa-download"></i> ' . $this->lang->line('Download');
if ($fullview)
{
$diff_view = 'fulldiff';
$altdiff_view = 'diff';
$diff_anchor_text = '<i class="fa fa-tasks"></i> ' . $this->lang->line('Full Difference');
$altdiff_anchor_text = '<i class="fa fa-server"></i> ' . $this->lang->line('Difference');
}
else
{
$diff_view = 'diff';
$altdiff_view = 'fulldiff';
$diff_anchor_text = '<i class="fa fa-server"></i> ' . $this->lang->line('Difference');
$altdiff_anchor_text = '<i class="fa fa-tasks"></i> ' . $this->lang->line('Full Difference');
}
?>
<script type="text/javascript">
$(function() {
$('#code_diff_metadata').accordion({
collapsible: true
});
$('#code_diff_metadata_against').accordion({
collapsible: true
});
<?php if ($file['created_rev'] != $file['head_rev']): ?>
$("#code_diff_headrev_button").button().click (function() {
$(location).attr ('href', codepot_merge_path("<?php print site_url(); ?>", '<?php print "/code/{$diff_view}/{$project->id}/${hex_headpath}"; ?>'));
return false;
});
<?php endif; ?>
$("#code_diff_detail_button").button().click (function() {
$(location).attr ('href', codepot_merge_path("<?php print site_url(); ?>", '<?php print "/code/file/{$project->id}/${hex_headpath}{$revreq}"; ?>'));
return false;
});
$("#code_diff_blame_button").button().click (function() {
$(location).attr ('href', codepot_merge_path("<?php print site_url(); ?>", '<?php print "/code/blame/{$project->id}/${hex_headpath}{$revreq}"; ?>'));
return false;
});
$("#code_diff_diff_button").button().click (function() {
$(location).attr ('href', codepot_merge_path("<?php print site_url(); ?>", '<?php print "/code/{$altdiff_view}/{$project->id}/${hex_headpath}{$revreq}"; ?>'));
return false;
});
$("#code_diff_history_button").button().click (function() {
$(location).attr ('href', codepot_merge_path("<?php print site_url(); ?>", '<?php print $history_path; ?>'));
return false;
});
$("#code_diff_download_button").button().click (function() {
$(location).attr ('href', codepot_merge_path("<?php print site_url(); ?>", '<?php print "/code/fetch/{$project->id}/${hex_headpath}{$revreq}"; ?>'));
return false;
});
$("#code_diff_detail_against_button").button().click (function() {
$(location).attr ('href', codepot_merge_path("<?php print site_url(); ?>", '<?php print "/code/file/{$project->id}/${hex_headpath}{$revreq_against}"; ?>'));
return false;
});
$("#code_diff_blame_against_button").button().click (function() {
$(location).attr ('href', codepot_merge_path("<?php print site_url(); ?>", '<?php print "/code/blame/{$project->id}/${hex_headpath}{$revreq_against}"; ?>'));
return false;
});
$("#code_diff_diff_against_button").button().click (function() {
$(location).attr ('href', codepot_merge_path("<?php print site_url(); ?>", '<?php print "/code/{$altdiff_view}/{$project->id}/${hex_headpath}{$revreq}"; ?>'));
return false;
});
$("#code_diff_history_against_button").button().click (function() {
$(location).attr ('href', codepot_merge_path("<?php print site_url(); ?>", '<?php print $history_against_path; ?>'));
return false;
});
$("#code_diff_download_against_button").button().click (function() {
$(location).attr ('href', codepot_merge_path("<?php print site_url(); ?>", '<?php print "/code/fetch/{$project->id}/${hex_headpath}{$revreq_against}"; ?>'));
return false;
});
prettyPrint();
});
</script>
@ -105,45 +212,77 @@ $this->load->view (
<div style="clear: both;"></div>
</div>
<div class="menu" id="code_diff_mainarea_menu">
<div id='code_diff_metadata_container'>
<div id='code_diff_metadata_against' class='collapsible-box'>
<div id='code_diff_metadata_against_header' class='collapsible-box-header'>
<?php
$history_anchor_text = '<i class="fa fa-history"></i> ' . $this->lang->line('History');
$diff_anchor_text = '<i class="fa fa-server"></i> ' . $this->lang->line('Difference');
$fulldiff_anchor_text = '<i class="fa fa-tasks"></i> ' . $this->lang->line('Full Difference');
$blame_anchor_text = '<i class="fa fa-bomb"></i> ' . $this->lang->line('Blame');
print '<div class="metadata-committer">';
$user_icon_url = codepot_merge_path (site_url(), '/user/icon/' . $this->converter->AsciiToHex($file['against']['last_author']));
print "<img src='{$user_icon_url}' class='metadata-committer-icon' />";
print htmlspecialchars ($file['against']['last_author']);
print '</div>';
$xpar = $this->converter->AsciiTohex ($headpath);
print anchor (
"code/file/{$project->id}/{$xpar}{$revreq}",
$this->lang->line('Details'));
print ' | ';
print anchor ("code/blame/{$project->id}/{$xpar}{$revreq}", $blame_anchor_text);
print '<div class="metadata-menu">';
print anchor ("#", $this->lang->line('Details'), 'id="code_diff_detail_against_button"');
print anchor ("#", $blame_anchor_text, 'id="code_diff_blame_against_button"');
print anchor ("#", $altdiff_anchor_text, 'id="code_diff_diff_against_button"');
print anchor ("#", $history_anchor_text, 'id="code_diff_history_against_button"');
print anchor ("#", $download_anchor_text, 'id="code_diff_download_against_button"');
print '</div>';
print ' | ';
if (!$fullview)
{
print anchor ("code/fulldiff/{$project->id}/{$xpar}{$revreq}", $fulldiff_anchor_text);
}
else
{
print anchor ("code/diff/{$project->id}/{$xpar}{$revreq}", $diff_anchor_text);
}
print ' | ';
if ($revision1 > 0)
{
if ($xpar == '') $revtrailer = $revreqroot;
else $revtrailer = "/{$xpar}{$revreq}";
print anchor ("code/history/{$project->id}{$revtrailer}", $history_anchor_text);
}
else
{
print anchor ("code/history/{$project->id}/{$xpar}", $history_anchor_text);
}
print '<div class="metadata-commit-date">';
printf ('[%s] ', $file['against']['created_rev']);
print strftime ('%Y-%m-%d %H:%M:%S %z', $file['time_t']);
print '</div>'
?>
</div> <!-- code_diff_mainarea_menu -->
<div style='clear: both'></div>
</div>
<div id='code_diff_metadata_against_body'>
<pre class='pre-wrapped'><?php print htmlspecialchars ($file['against']['logmsg']); ?></pre>
</div>
</div>
<div id='code_diff_metadata' class='collapsible-box'>
<div id='code_diff_metadata_header' class='collapsible-box-header'>
<?php
print '<div class="metadata-committer">';
$user_icon_url = codepot_merge_path (site_url(), '/user/icon/' . $this->converter->AsciiToHex($file['last_author']));
print "<img src='{$user_icon_url}' class='metadata-committer-icon' />";
print htmlspecialchars ($file['last_author']);
print '</div>';
print '<div class="metadata-menu">';
if ($file['created_rev'] != $file['head_rev'])
{
print anchor ('#', $head_revision_text, 'id="code_diff_headrev_button"');
}
print anchor ("#", $this->lang->line('Details'), 'id="code_diff_detail_button"');
print anchor ("#", $blame_anchor_text, 'id="code_diff_blame_button"');
print anchor ("#", $altdiff_anchor_text, 'id="code_diff_diff_button"');
print anchor ("#", $history_anchor_text, 'id="code_diff_history_button"');
print anchor ("#", $download_anchor_text, 'id="code_diff_download_button"');
print '</div>';
print '<div class="metadata-commit-date">';
printf ('[%s] ', $file['created_rev']);
print strftime ('%Y-%m-%d %H:%M:%S %z', $file['time_t']);
print '</div>'
?>
<div style='clear: both'></div>
</div>
<div id='code_diff_metadata_body'>
<pre class='pre-wrapped'><?php print htmlspecialchars ($file['logmsg']); ?></pre>
</div>
</div>
<div style='clear: both;'></div>
</div>
<?php
$fileext = substr(strrchr($file['name'], '.'), 1);
@ -152,7 +291,6 @@ $this->load->view (
<div class="result" id="code_diff_result">
<?php
function format_diff2 ($a, $b, $css_class)
{
$ms = codepot_find_matching_sequences ($a, $b);
@ -208,193 +346,11 @@ function format_diff2 ($a, $b, $css_class)
return $cc;
}
/*
function format_diff ($a, $b, $css_class)
{
if ($b == '') return htmlspecialchars($a);
// TODO: word by word comparison to be less position dependent
$cc = '';
$diffstart = -1;
$alen = strlen($a);
$blen = strlen($b);
for ($i = 0; $i < $alen && $i < $blen; $i++)
{
if ($a[$i] == $b[$i])
{
if ($diffstart >= 0)
{
$cc .= sprintf ('<span class="%s">', $css_class);
$cc .= htmlspecialchars(substr($a, $diffstart, $i - $diffstart));
$cc .= '</span>';
$diffstart = -1;
}
$cc .= htmlspecialchars($a[$i]);
}
else
{
if ($diffstart < 0) $diffstart = $i;
}
}
if ($diffstart >= 0)
{
$cc .= sprintf ('<span class="%s">', $css_class);
$cc .= htmlspecialchars(substr($a, $diffstart, $alen - $diffstart));
$cc .= '</span>';
}
else
{
if ($alen > $blen)
{
$cc .= sprintf ('<span class="%s">', $css_class);
$cc .= htmlspecialchars(substr ($a, $blen, $alen - $blen));
$cc .= '</span>';
}
}
return $cc;
}
*/
//if (!$fullview)
if (FALSE) // don't want to delete code for the original diff view.
{
print '<table id="code_diff_result_table">';
/*
print '<pre>';
print_r ($file['content']);
print '</pre>';
*/
print '<tr class="heading">';
print '<th>';
print ' ';
$currev = $file['created_rev'];
$prevrev = $file['against']['prev_rev'];
$prevanc = "code/diff/{$project->id}/{$xpar}/{$currev}/{$prevrev}";
print anchor ($prevanc, '<i class="fa fa-arrow-circle-left"></i>');
print ' ';
print $this->lang->line('Revision');
print ' ';
print $file['against']['created_rev'];
$currev = $file['created_rev'];
$nextrev = $file['against']['next_rev'];
$nextanc = "code/diff/{$project->id}/{$xpar}/{$currev}/{$nextrev}";
print ' ';
print anchor ($nextanc, '<i class="fa fa-arrow-circle-right"></i>');
print '</th>';
print '<th>';
print ' ';
$currev = $file['against']['created_rev'];
$prevrev = $file['prev_rev'];
$prevanc = "code/diff/{$project->id}/{$xpar}/{$prevrev}/{$currev}";
print anchor ($prevanc, '<i class="fa fa-arrow-circle-left"></i>');
print ' ';
print $this->lang->line('Revision');
print ' ';
print $file['created_rev'];
$currev = $file['against']['created_rev'];
$nextrev = $file['next_rev'];
$nextanc = "code/diff/{$project->id}/{$xpar}/{$nextrev}/{$currev}";
print ' ';
print anchor ($nextanc, '<i class="fa fa-arrow-circle-right"></i>');
print '</th>';
print '</tr>';
if ($headpath != $file['fullpath'] ||
$headpath != $file['against']['fullpath'])
{
print '<tr>';
print '<th>';
print anchor (
"code/file/{$project->id}/{$xpar}/{$file['against']['created_rev']}",
htmlspecialchars ($file['against']['fullpath']));
print '</th>';
print '<th>';
print anchor (
"code/file/{$project->id}/{$xpar}/{$file['created_rev']}",
htmlspecialchars ($file['fullpath']));
print '</th>';
print '</tr>';
}
if (empty($file['content']))
{
print '<tr>';
print '<td colspan="2">';
print htmlspecialchars ($this->lang->line('MSG_NO_DIFF'));
print '</td>';
print '</tr>';
}
else
{
foreach ($file['content'] as $x)
{
print '<tr class="diff">';
if (array_key_exists('rev1line', $x))
{
$diffclass = array_key_exists('rev1diffclass', $x)? $x['rev1diffclass']: 'diff';
print "<td class='{$diffclass}'>";
print "<pre class='prettyprint lang-{$fileext}'>";
if ($x['rev1line'] == '') print '&nbsp;';
else print htmlspecialchars($x['rev1line']);
print '</pre>';
print '</td>';
}
else
{
print '<td class="diffrow">';
print $x['rev1lineno'];
print '</td>';
}
if (array_key_exists('rev2line', $x))
{
$diffclass = array_key_exists('rev2diffclass', $x)? $x['rev2diffclass']: 'diff';
print "<td class='{$diffclass}'>";
print "<pre class='prettyprint lang-{$fileext}'>";
if ($x['rev2line'] == '') print '&nbsp;';
else print htmlspecialchars($x['rev2line']);
print '</pre>';
print '</td>';
}
else
{
print '<td class="diffrow">';
print $x['rev2lineno'];
print '</td>';
}
print '</tr>';
}
}
print '</table>';
}
else
{
$http_user_agent = $_SERVER['HTTP_USER_AGENT'];
$is_msie = (stristr($http_user_agent, 'MSIE') !== FALSE &&
stristr($http_user_agent, 'Opera') === FALSE);
if (!$is_msie) $is_msie = (preg_match ("/^Mozilla.+\(Windows.+\) like Gecko$/", $http_user_agent) !== FALSE);
$diff_view = $fullview? 'fulldiff': 'diff';
print '<div style="width: 100%; overflow: hidden;" id="code_diff_result_fullview">';
//
@ -406,21 +362,21 @@ else
$currev = $file['created_rev'];
$prevrev = $file['against']['prev_rev'];
$prevanc = "code/{$diff_view}/{$project->id}/{$xpar}/{$currev}/{$prevrev}";
$prevanc = "code/{$diff_view}/{$project->id}/{$hex_headpath}/{$currev}/{$prevrev}";
print anchor ($prevanc, '<i class="fa fa-arrow-circle-left"></i>');
print ' ';
// show the history details of the previous revision at the root directory
$revanc = "code/revision/{$project->id}/!/{$file['against']['created_rev']}";
$codeanc = "code/file/{$project->id}/{$xpar}/{$file['against']['created_rev']}";
$codeanc = "code/file/{$project->id}/{$hex_headpath}/{$file['against']['created_rev']}";
print anchor ($revanc, $this->lang->line('Revision'));
print ' ';
print anchor ($codeanc, $file['against']['created_rev']);
$currev = $file['created_rev'];
$nextrev = $file['against']['next_rev'];
$nextanc = "code/{$diff_view}/{$project->id}/{$xpar}/{$currev}/{$nextrev}";
$nextanc = "code/{$diff_view}/{$project->id}/{$hex_headpath}/{$currev}/{$nextrev}";
print ' ';
print anchor ($nextanc, '<i class="fa fa-arrow-circle-right"></i>');
print "</div>"; // navigator
@ -511,20 +467,20 @@ else
$currev = $file['against']['created_rev'];
$prevrev = $file['prev_rev'];
$prevanc = "code/{$diff_view}/{$project->id}/{$xpar}/{$prevrev}/{$currev}";
$prevanc = "code/{$diff_view}/{$project->id}/{$hex_headpath}/{$prevrev}/{$currev}";
print anchor ($prevanc, '<i class="fa fa-arrow-circle-left"></i>');
print ' ';
// show the history details of the current revision at the root directory
$revanc = "code/revision/{$project->id}/!/{$file['created_rev']}";
$codeanc = "code/file/{$project->id}/${xpar}/{$file['created_rev']}";
$codeanc = "code/file/{$project->id}/{$hex_headpath}/{$file['created_rev']}";
print anchor ($revanc, $this->lang->line('Revision'));
print ' ';
print anchor ($codeanc, $file['created_rev']);
$currev = $file['against']['created_rev'];
$nextrev = $file['next_rev'];
$nextanc = "code/{$diff_view}/{$project->id}/{$xpar}/{$nextrev}/{$currev}";
$nextanc = "code/{$diff_view}/{$project->id}/{$hex_headpath}/{$nextrev}/{$currev}";
print ' ';
print anchor ($nextanc, '<i class="fa fa-arrow-circle-right"></i>');
print "</div>"; // navigator
@ -611,7 +567,7 @@ else
print '</div>';
}
?>
</div>

View File

@ -65,6 +65,7 @@
$fulldiff_anchor_text = '<i class="fa fa-tasks"></i> ' . $this->lang->line('Full Difference');
$blame_anchor_text = '<i class="fa fa-bomb"></i> ' . $this->lang->line('Blame');
$show_search = (CODEPOT_SIGNIN_FOR_CODE_SEARCH === FALSE || (isset($login['id']) && $login['id'] != ''));
?>
<script type="text/javascript">
@ -78,7 +79,7 @@ function show_alert (outputMsg, titleMsg)
width: 'auto',
height: 'auto',
buttons: {
"OK": function () {
"<?php print $this->lang->line('OK')?>": function () {
$(this).dialog("close");
}
}
@ -613,33 +614,24 @@ $(function () {
});
<?php endif; ?>
$('#code_search_submit').button().click (function () {
if ($.trim($("#code_search_string").val()) != "")
{
$('#code_search_submit').button ('disable');
$('#code_search_string_icon').addClass("fa-cog fa-spin");
$('#code_search_form').submit ();
}
return false; // prevent the default behavior
$('#code_folder_metadata').accordion({
collapsible: true
});
$('#code_search_invertedly').button();
$('#code_search_case_insensitively').button();
$('#code_search_recursively').button();
$('#code_search_in_name').button();
$('#code_search_is_regex').button();
$('.code_search_option').tooltip();
<?php if ($revision > 0 && $revision < $next_revision): ?>
$("#code_folder_headrev_button").button().click (function() {
$(location).attr ('href', codepot_merge_path("<?php print site_url(); ?>", '<?php print "/code/file/{$project->id}/${hex_headpath}"; ?>'));
return false;
});
<?php endif; ?>
$('#code_search_wildcard').text($('input[name=search_wildcard_pattern]').val());
$('#code_search_wildcard').editable({
type: 'text',
title: '<?php print $this->lang->line('CODE_SEARCH_WILDCARD') ?>',
placement: 'bottom',
success: function(response, newValue) {
$('input[name=search_wildcard_pattern]').val(newValue);
}
$("#code_folder_history_button").button().click (function() {
$(location).attr ('href', codepot_merge_path("<?php print site_url(); ?>", '<?php print $history_path; ?>'));
return false;
});
$("#code_folder_download_button").button().click (function() {
$(location).attr ('href', codepot_merge_path("<?php print site_url(); ?>", '<?php print "/code/fetch/{$project->id}/${hex_headpath}{$revreq}"; ?>'));
return false;
});
$("#code_folder_loc_by_lang_button").button().click (function () {
@ -671,42 +663,54 @@ $(function () {
return false;
});
<?php if ($show_search): ?>
$('#code_search_invertedly').button();
$('#code_search_case_insensitively').button();
$('#code_search_recursively').button();
$('#code_search_in_name').button();
$('#code_search_is_regex').button();
$('.code_search_option').tooltip();
$("#code_folder_search").hide();
btn = $("#code_folder_search_button").button().click (function () {
if ($("#code_folder_search").is(":visible"))
{
$("#code_folder_search").hide("blind",{},200);
}
else
{
$("#code_folder_search").show("blind",{},200);
}
$('#code_search_wildcard').text($('input[name=search_wildcard_pattern]').val());
return false;
$('#code_search_wildcard').editable({
type: 'text',
title: '<?php print $this->lang->line('CODE_SEARCH_WILDCARD') ?>',
placement: 'bottom',
success: function(response, newValue) {
$('input[name=search_wildcard_pattern]').val(newValue);
}
});
$('#code_folder_metadata').accordion({
collapsible: true
$('#code_folder_search').dialog({
title: '<?php print $this->lang->line('Search'); ?>',
resizable: true,
autoOpen: false,
modal: true,
width: 'auto',
height: 'auto',
buttons: {
'<?php print $this->lang->line('OK')?>': function () {
if ($.trim($('#code_search_string').val()) != "")
{
$('#code_search_string_icon').addClass("fa-cog fa-spin");
$('#code_folder_search').dialog ('disable');
$('#code_search_form').submit ();
}
},
'<?php print $this->lang->line('Cancel')?>': function () {
if (import_in_progress) return;
$('#code_folder_search').dialog('close');
}
}
});
<?php if ($revision > 0 && $revision < $next_revision): ?>
$("#code_folder_headrev_button").button().click (function() {
$(location).attr ('href', codepot_merge_path("<?php print site_url(); ?>", '<?php print "/code/file/{$project->id}/${hex_headpath}"; ?>'));
$("#code_folder_search_button").button().click (function () {
$('#code_folder_search').dialog('open');
return false;
});
<?php endif; ?>
$("#code_folder_history_button").button().click (function() {
$(location).attr ('href', codepot_merge_path("<?php print site_url(); ?>", '<?php print $history_path; ?>'));
return false;
});
$("#code_folder_download_button").button().click (function() {
$(location).attr ('href', codepot_merge_path("<?php print site_url(); ?>", '<?php print "/code/fetch/{$project->id}/${hex_headpath}{$revreq}"; ?>'));
return false;
});
render_readme ();
});
@ -846,15 +850,18 @@ $this->load->view (
print $this->lang->line('File');
print '</a>';
if ($show_search)
{
print '<a id="code_folder_search_button" href="#">';
print $this->lang->line('Search');
print '</a>';
}
print '</div>';
print '<div class="metadata-commit-date">';
printf ('[%s] ', $file['created_rev']);
print strftime ('%Y-%m-%d %H:%M:%S %z', 0 /*$file['time_t']*/);
print strftime ('%Y-%m-%d %H:%M:%S %z', strtotime($file['last_changed_date']));
print '</div>';
?>
<div style='clear: both;'></div>
@ -889,26 +896,25 @@ $this->load->view (
<div id="code_folder_result_loc_by_file_graph"></div>
</div>
<div class="result" id="code_folder_result">
<div id="code_folder_search" class="infobox">
<div id="code_folder_search">
<?php
print form_open("code/search/{$project->id}/", 'id="code_search_form"');
if (CODEPOT_SIGNIN_FOR_CODE_SEARCH === FALSE || (isset($login['id']) && $login['id'] != ''))
if ($show_search)
{
print form_hidden('search_folder', set_value('search_folder', $file['fullpath']));
print form_hidden('search_revision', set_value('search_revision', $revision));
print '<i id="code_search_string_icon" class="fa"></i> ';
print '<div id="code_folder_search_string_div">';
print form_input(array(
'name' => 'search_string',
'value' => set_value('search_string', ''),
'id' =>'code_search_string',
'placeholder' => $this->lang->line('CODE_SEARCH_STRING')
));
print ' ';
print '<i id="code_search_string_icon" class="fa"></i> ';
print '</div>';
print '<div id="code_folder_search_option_div">';
print form_checkbox(array(
'name' => 'search_invertedly',
'id' => 'code_search_invertedly',
@ -972,13 +978,13 @@ $this->load->view (
print '<a id="code_search_wildcard" href="#"></a>';
print form_hidden('search_wildcard_pattern', set_value('search_wildcard_pattern', $wildcard_pattern));
print ' ';
printf ('<a id="code_search_submit" href="#">%s</a>', $this->lang->line('Search'));
print '</div>';
}
print form_close();
?>
</div>
<div class="result" id="code_folder_result">
<?php
function comp_files ($a, $b)
{

View File

@ -501,7 +501,7 @@ function hide_unneeded_divs()
}
$(function() {
$("#code_revision_result_message").accordion ({
$("#code_revision_metadata").accordion ({
collapsible: true
});
@ -634,16 +634,11 @@ $history = $file['history'];
<div style="clear: both;"></div>
</div>
<div class="menu" id="code_revision_mainarea_menu">
<?php
?>
</div> <!-- code_revision_mainarea_menu -->
<div class="result" id="code_revision_result">
<div id="code_revision_result_message" class="collapsible-box">
<div id="code_revision_result_message_header" class="collapsible-box-header" >
<div id="code_revision_metadata" class="collapsible-box">
<div id="code_revision_metadata_header" class="collapsible-box-header" >
<?php
print '<div class="metadata-committer">';
$user_icon_url = codepot_merge_path (site_url(), '/user/icon/' . $this->converter->AsciiToHex($history['author']));
@ -673,11 +668,13 @@ $history = $file['history'];
<div style='clear: both'></div>
</div>
<div id="code_revision_result_message_body">
<pre id="code_revision_result_message_text" class="pre-wrapped"><?php print htmlspecialchars($history['msg']); ?></pre>
<div id="code_revision_metadata_body">
<pre id="code_revision_metadata_text" class="pre-wrapped"><?php print htmlspecialchars($history['msg']); ?></pre>
</div>
</div>
<div class="result" id="code_revision_result">
<div id="code_revision_result_files" class="collapsible-box">
<div class="collapsible-box-header"><?php print $this->lang->line('Files')?></div>
<div id="code_revision_result_files_table_container" class="collapsible-box-panel">

View File

@ -110,6 +110,8 @@ $this->load->view (
<div class="mainarea" id="code_search_mainarea">
<div class="title-band" id="code_search_title_band">
<div class="title">
<?php
if ($revision <= 0)
@ -151,7 +153,7 @@ $this->load->view (
?>
</div>
<div class="infostrip" id="code_search_mainarea_infostrip">
<div class="actions">
<?php
print form_open("code/search/{$project->id}/", 'id="code_search_form"');
print form_hidden ('search_folder', set_value('search_folder', $file['fullpath']));
@ -242,6 +244,9 @@ $this->load->view (
?>
</div>
<div style="clear: both;"></div>
</div>
<div id="code_search_mainarea_result" class="result">
<?php

View File

@ -7,7 +7,8 @@
#code_blame_result,
#code_revision_result,
#code_history_result,
#code_diff_result {
#code_diff_result,
#code_search_result {
position: relative;
overflow: auto;
margin: 0.2em 0 0.2em 0;
@ -35,17 +36,34 @@
height: auto;
}
#code_diff_metadata_container {
margin: 0;
padding: 0;
}
#code_diff_metadata,
#code_diff_metadata_against {
width: 50%;
float: left;
margin: 0;
padding: 0;
}
#code_folder_metadata_header,
#code_file_metadata_header,
#code_blame_metadata_header,
#code_revision_result_message_header {
#code_revision_metadata_header,
#code_diff_metadata_header,
#code_diff_metadata_against_header {
line-height: 2em;
}
#code_folder_metadata_header .metadata-committer-icon,
#code_file_metadata_header .metadata-committer-icon,
#code_blame_metadata_header .metadata-committer-icon,
#code_revision_result_message_header .metadata-committer-icon {
#code_revision_metadata_header .metadata-committer-icon,
#code_diff_metadata_header .metadata-committer-icon,
#code_diff_metadata_against_header .metadata-committer-icon {
height: 2em;
width: auto;
vertical-align: middle;
@ -59,7 +77,9 @@
#code_folder_metadata_header .metadata-committer,
#code_file_metadata_header .metadata-committer,
#code_blame_metadata_header .metadata-committer,
#code_revision_result_message_header .metadata-committer {
#code_revision_metadata_header .metadata-committer,
#code_diff_metadata_header .metadata-committer,
#code_diff_metadata_against_header .metadata-committer {
float: left;
color: #111111;
}
@ -67,7 +87,9 @@
#code_folder_metadata_header .metadata-menu,
#code_file_metadata_header .metadata-menu,
#code_blame_metadata_header .metadata-menu,
#code_revision_result_message_header .metadata-menu {
#code_revision_metadata_header .metadata-menu,
#code_diff_metadata_header .metadata-menu,
#code_diff_metadata_against_header .metadata-menu {
float: left;
margin-left: 1em;
}
@ -75,14 +97,18 @@
#code_folder_metadata_header .metadata-commit-date,
#code_file_metadata_header .metadata-commit-date,
#code_blame_metadata_header .metadata-commit-date,
#code_revision_result_message_header .metadata-commit-date {
#code_revision_metadata_header .metadata-commit-date,
#code_diff_metadata_header .metadata-commit-date,
#code_diff_metadata_against_header .metadata-commit-date {
float: right;
}
#code_folder_metadata_body,
#code_file_metadata_body,
#code_blame_metadata_body,
#code_revision_result_message_body {
#code_revision_metadata_body,
#code_diff_metadata_body,
#code_diff_metadata_against_body {
background-color: #FCFCFC;
padding: 0.2em 0.2em 0.2em 0.2em;
margin: 0;
@ -109,10 +135,6 @@
/*-----------------------------------------------
* project source folder view
*-----------------------------------------------*/
#code_folder_search {
padding: 0.2em 0.2em 0.2em 0.2em;
}
#code_folder_result_table tr {
vertical-align: middle;
}
@ -228,11 +250,7 @@
/*-----------------------------------------------
* project source revision view
*-----------------------------------------------*/
#code_revision_result .collapsible-box {
margin-bottom: 0.5em;
}
#code_revision_result_message_text {
#code_revision_metadata_text {
line-height: 1.3em;
padding: 0 0.2em 0 0.2em;
}

View File

@ -123,7 +123,7 @@ textarea {
}
.content .collapsible-box-panel {
line-height: 2em;
line-height: 1.5em;
margin: 1px 0 0 0;
padding: 0.2em 0.2em 0.2em 0.2em !important; /* !important so that jquery-ui.css doesn't override this */
}