added logging to project, wiki, and file operations.

touched up the log views.
This commit is contained in:
hyung-hwan 2010-03-03 13:12:11 +00:00
parent 95d6be9445
commit 2d57f9e77e
19 changed files with 424 additions and 88 deletions

View File

@ -38,7 +38,9 @@ class File extends Controller
} }
else if ($project === NULL) else if ($project === NULL)
{ {
$data['message'] = "NO SUCH PROJECT - $projectid"; $data['message'] =
$this->lang->line('MSG_NO_SUCH_PROJECT') .
" - {$projectid}";
$this->load->view ($this->VIEW_ERROR, $data); $this->load->view ($this->VIEW_ERROR, $data);
} }
else else
@ -78,7 +80,9 @@ class File extends Controller
} }
else if ($project === NULL) else if ($project === NULL)
{ {
$data['message'] = "NO SUCH PROJECT - $projectid"; $data['message'] =
$this->lang->line('MSG_NO_SUCH_PROJECT') .
" - {$projectid}";
$this->load->view ($this->VIEW_ERROR, $data); $this->load->view ($this->VIEW_ERROR, $data);
} }
else else
@ -123,7 +127,9 @@ class File extends Controller
} }
else if ($project === NULL) else if ($project === NULL)
{ {
$data['message'] = "NO SUCH PROJECT - $projectid"; $data['message'] =
$this->lang->line('MSG_NO_SUCH_PROJECT') .
" - {$projectid}";
$this->load->view ($this->VIEW_ERROR, $data); $this->load->view ($this->VIEW_ERROR, $data);
} }
else else
@ -178,7 +184,9 @@ class File extends Controller
} }
else if ($project === NULL) else if ($project === NULL)
{ {
$data['message'] = "NO SUCH PROJECT - $projectid"; $data['message'] =
$this->lang->line('MSG_NO_SUCH_PROJECT') .
" - {$projectid}";
$this->load->view ($this->VIEW_ERROR, $data); $this->load->view ($this->VIEW_ERROR, $data);
} }
else if (!$login['sysadmin?'] && else if (!$login['sysadmin?'] &&
@ -369,7 +377,9 @@ class File extends Controller
} }
else if ($project === NULL) else if ($project === NULL)
{ {
$data['message'] = "NO SUCH PROJECT - $projectid"; $data['message'] =
$this->lang->line('MSG_NO_SUCH_PROJECT') .
" - {$projectid}";
$this->load->view ($this->VIEW_ERROR, $data); $this->load->view ($this->VIEW_ERROR, $data);
} }
else if (!$login['sysadmin?'] && else if (!$login['sysadmin?'] &&

View File

@ -39,7 +39,9 @@ class Project extends Controller
} }
else if ($project === NULL) else if ($project === NULL)
{ {
$data['message'] = "NO SUCH PROJECT - $projectid"; $data['message'] =
$this->lang->line('MSG_NO_SUCH_PROJECT') .
" - {$projectid}";
$this->load->view ($this->VIEW_ERROR, $data); $this->load->view ($this->VIEW_ERROR, $data);
} }
else else
@ -173,7 +175,9 @@ class Project extends Controller
else if ($project === NULL) else if ($project === NULL)
{ {
$data['login'] = $login; $data['login'] = $login;
$data['message'] = "NO SUCH PROJECT - $projectid"; $data['message'] =
$this->lang->line('MSG_NO_SUCH_PROJECT') .
" - {$projectid}";
$this->load->view ($this->VIEW_ERROR, $data); $this->load->view ($this->VIEW_ERROR, $data);
} }
else if (!$login['sysadmin?'] && else if (!$login['sysadmin?'] &&
@ -265,7 +269,9 @@ class Project extends Controller
else if ($project === NULL) else if ($project === NULL)
{ {
$data['login'] = $login; $data['login'] = $login;
$data['message'] = "NO SUCH PROJECT - $projectid"; $data['message'] =
$this->lang->line('MSG_NO_SUCH_PROJECT') .
" - {$projectid}";
$this->load->view ($this->VIEW_ERROR, $data); $this->load->view ($this->VIEW_ERROR, $data);
} }
else if (!$login['sysadmin?'] && else if (!$login['sysadmin?'] &&

View File

@ -132,7 +132,7 @@ class Site extends Controller
else if ($site === NULL) else if ($site === NULL)
{ {
$data['login'] = $login; $data['login'] = $login;
$data['message'] = "NO SUCH PROJECT - $siteid"; $data['message'] = "NO SUCH SITE - $siteid";
$this->load->view ($this->VIEW_ERROR, $data); $this->load->view ($this->VIEW_ERROR, $data);
} }
else if (!$login['sysadmin?']) else if (!$login['sysadmin?'])
@ -224,7 +224,7 @@ class Site extends Controller
else if ($site === NULL) else if ($site === NULL)
{ {
$data['login'] = $login; $data['login'] = $login;
$data['message'] = "NO SUCH PROJECT - $siteid"; $data['message'] = "NO SUCH SITE - $siteid";
$this->load->view ($this->VIEW_ERROR, $data); $this->load->view ($this->VIEW_ERROR, $data);
} }
else if (!$login['sysadmin?']) else if (!$login['sysadmin?'])

View File

@ -48,7 +48,9 @@ class Source extends Controller
} }
else if ($project === NULL) else if ($project === NULL)
{ {
$data['message'] = "NO SUCH PROJECT - $projectid"; $data['message'] =
$this->lang->line('MSG_NO_SUCH_PROJECT') .
" - {$projectid}";
$this->load->view ($this->VIEW_ERROR, $data); $this->load->view ($this->VIEW_ERROR, $data);
} }
else else
@ -120,7 +122,9 @@ class Source extends Controller
} }
else if ($project === NULL) else if ($project === NULL)
{ {
$data['message'] = "NO SUCH PROJECT - $projectid"; $data['message'] =
$this->lang->line('MSG_NO_SUCH_PROJECT') .
" - {$projectid}";
$this->load->view ($this->VIEW_ERROR, $data); $this->load->view ($this->VIEW_ERROR, $data);
} }
else else
@ -179,7 +183,9 @@ class Source extends Controller
} }
else if ($project === NULL) else if ($project === NULL)
{ {
$data['message'] = "NO SUCH PROJECT - $projectid"; $data['message'] =
$this->lang->line('MSG_NO_SUCH_PROJECT') .
" - {$projectid}";
$this->load->view ($this->VIEW_ERROR, $data); $this->load->view ($this->VIEW_ERROR, $data);
} }
else else
@ -228,7 +234,9 @@ class Source extends Controller
} }
else if ($project === NULL) else if ($project === NULL)
{ {
$data['message'] = "NO SUCH PROJECT - $projectid"; $data['message'] =
$this->lang->line('MSG_NO_SUCH_PROJECT') .
" - {$projectid}";
$this->load->view ($this->VIEW_ERROR, $data); $this->load->view ($this->VIEW_ERROR, $data);
} }
else else
@ -276,7 +284,9 @@ class Source extends Controller
} }
else if ($project === NULL) else if ($project === NULL)
{ {
$data['message'] = "NO SUCH PROJECT - $projectid"; $data['message'] =
$this->lang->line('MSG_NO_SUCH_PROJECT') .
" - {$projectid}";
$this->load->view ($this->VIEW_ERROR, $data); $this->load->view ($this->VIEW_ERROR, $data);
} }
else else

View File

@ -40,7 +40,9 @@ class Wiki extends Controller
} }
else if ($project === NULL) else if ($project === NULL)
{ {
$data['message'] = "NO SUCH PROJECT - $projectid"; $data['message'] =
$this->lang->line('MSG_NO_SUCH_PROJECT') .
" - {$projectid}";
$this->load->view ($this->VIEW_ERROR, $data); $this->load->view ($this->VIEW_ERROR, $data);
} }
else else
@ -80,21 +82,36 @@ class Wiki extends Controller
} }
else if ($project === NULL) else if ($project === NULL)
{ {
$data['message'] = "NO SUCH PROJECT - $projectid"; $data['message'] =
$this->lang->line('MSG_NO_SUCH_PROJECT') .
" - {$projectid}";
$this->load->view ($this->VIEW_ERROR, $data); $this->load->view ($this->VIEW_ERROR, $data);
} }
else else
{ {
if ($name == '__PROJECT_HOME__') if ($name == '__PROJECT_HOME__')
{ {
redirect ('project/home/' . $projectid); redirect ("project/home/{$projectid}");
} }
else if ($name == '__WIKI_HOME__') else if ($name == '__WIKI_HOME__')
{ {
redirect ('wiki/home/' . $projectid . '/' . $name); redirect ("wiki/home/{$projectid}");
} }
else else
{ {
$ex = explode (':', $name);
if (count($ex) == 2)
{
if ($ex[0] == '__PROJECT_HOME__')
{
redirect ("project/home/{$ex[1]}");
}
else if ($ex[0] == '__WIKI_HOME__')
{
redirect ("wiki/home/{$ex[1]}");
}
}
$wiki = $this->wikis->get ($login['id'], $project, $name); $wiki = $this->wikis->get ($login['id'], $project, $name);
if ($wiki === FALSE) if ($wiki === FALSE)
{ {
@ -103,7 +120,7 @@ class Wiki extends Controller
} }
else if ($wiki === NULL) else if ($wiki === NULL)
{ {
redirect ('wiki/create/'. $projectid . '/' . redirect ("wiki/create/{$projectid}/" .
$this->converter->AsciiToHex($name)); $this->converter->AsciiToHex($name));
} }
else else
@ -137,7 +154,9 @@ class Wiki extends Controller
} }
else if ($project === NULL) else if ($project === NULL)
{ {
$data['message'] = "NO SUCH PROJECT - $projectid"; $data['message'] =
$this->lang->line('MSG_NO_SUCH_PROJECT') .
" - {$projectid}";
$this->load->view ($this->VIEW_ERROR, $data); $this->load->view ($this->VIEW_ERROR, $data);
} }
else if (!$login['sysadmin?'] && else if (!$login['sysadmin?'] &&
@ -263,7 +282,9 @@ class Wiki extends Controller
} }
else if ($project === NULL) else if ($project === NULL)
{ {
$data['message'] = "NO SUCH PROJECT - $projectid"; $data['message'] =
$this->lang->line('MSG_NO_SUCH_PROJECT') .
" - {$projectid}";
$this->load->view ($this->VIEW_ERROR, $data); $this->load->view ($this->VIEW_ERROR, $data);
} }
else if (!$login['sysadmin?'] && else if (!$login['sysadmin?'] &&

View File

@ -54,9 +54,16 @@ $lang['Username'] = 'Username';
$lang['Wiki'] = 'Wiki'; $lang['Wiki'] = 'Wiki';
$lang['Wikis'] = 'Wikis'; $lang['Wikis'] = 'Wikis';
$lang['MSG_LOG_COMMIT_BY'] = 'committed by %s';
$lang['MSG_LOG_CREATE_BY'] = 'created by %s';
$lang['MSG_LOG_DELETE_BY'] = 'deleted by %s';
$lang['MSG_LOG_UPDATE_BY'] = 'updated by %s';
$lang['MSG_NO_DIFF'] = 'No difference found'; $lang['MSG_NO_DIFF'] = 'No difference found';
$lang['MSG_NO_FILES_AVAIL'] = 'No files available'; $lang['MSG_NO_FILES_AVAIL'] = 'No files available';
$lang['MSG_NO_SOURCE_AVAIL'] = 'No source available'; $lang['MSG_NO_SOURCE_CODE_AVAIL'] = 'No source code available';
$lang['MSG_NO_SUCH_PROJECT'] = 'No such project';
$lang['MSG_NO_WIKIS_AVAIL'] = 'No wiki pages available'; $lang['MSG_NO_WIKIS_AVAIL'] = 'No wiki pages available';
$lang['MSG_SURE_TO_DELETE_THIS'] = "I'm sure to delete this"; $lang['MSG_SURE_TO_DELETE_THIS'] = "I'm sure to delete this";
?> ?>

View File

@ -54,9 +54,15 @@ $lang['Username'] = 'Nama pemakai';
$lang['Wiki'] = 'Wiki'; $lang['Wiki'] = 'Wiki';
$lang['Wikis'] = 'Wiki'; $lang['Wikis'] = 'Wiki';
$lang['MSG_LOG_COMMIT_BY'] = 'committed by %s';
$lang['MSG_LOG_CREATE_BY'] = 'created by %s';
$lang['MSG_LOG_DELETE_BY'] = 'deleted by %s';
$lang['MSG_LOG_UPDATE_BY'] = 'updated by %s';
$lang['MSG_NO_DIFF'] = 'Tidak ada bedanya'; $lang['MSG_NO_DIFF'] = 'Tidak ada bedanya';
$lang['MSG_NO_FILES_AVAIL'] = 'Tidak ada file tersedia'; $lang['MSG_NO_FILES_AVAIL'] = 'Tidak ada file tersedia';
$lang['MSG_NO_SOURCE_AVAIL'] = 'Tidak ada sumber tersedia'; $lang['MSG_NO_SOURCE_CODE_AVAIL'] = 'Tidak ada kode sumber tersedia';
$lang['MSG_NO_SUCH_PROJECT'] = 'No such project';
$lang['MSG_NO_WIKIS_AVAIL'] = 'Tidak ada halaman wiki tersedia'; $lang['MSG_NO_WIKIS_AVAIL'] = 'Tidak ada halaman wiki tersedia';
$lang['MSG_SURE_TO_DELETE_THIS'] = "Saya yakin untuk menghapus"; $lang['MSG_SURE_TO_DELETE_THIS'] = "Saya yakin untuk menghapus";
?> ?>

View File

@ -54,9 +54,15 @@ $lang['Username'] = '사용자명';
$lang['Wiki'] = '위키'; $lang['Wiki'] = '위키';
$lang['Wikis'] = '위키'; $lang['Wikis'] = '위키';
$lang['MSG_LOG_COMMIT_BY'] = '%s에 의해 커밋되었습니다';
$lang['MSG_LOG_CREATE_BY'] = '%s에 의해 생성되었습니다';
$lang['MSG_LOG_DELETE_BY'] = '%s에 의해 삭제되었습니다';
$lang['MSG_LOG_UPDATE_BY'] = '%s에 의해 갱신되었습니다';
$lang['MSG_NO_DIFF'] = '차이점이 없습니다'; $lang['MSG_NO_DIFF'] = '차이점이 없습니다';
$lang['MSG_NO_FILES_AVAIL'] = '사용가능한 파일이 없습니다'; $lang['MSG_NO_FILES_AVAIL'] = '사용가능한 파일이 없습니다';
$lang['MSG_NO_SOURCE_AVAIL'] = '사용가능한 소스가 없습니다'; $lang['MSG_NO_SOURCE_CODE_AVAIL'] = '사용가능한 소스코드가 없습니다';
$lang['MSG_NO_SUCH_PROJECT'] = '프로젝트가 없습니다';
$lang['MSG_NO_WIKIS_AVAIL'] = '사용가능한 위키페이지가 없습니다'; $lang['MSG_NO_WIKIS_AVAIL'] = '사용가능한 위키페이지가 없습니다';
$lang['MSG_SURE_TO_DELETE_THIS'] = '반드시 이것을 삭제하고 싶어요'; $lang['MSG_SURE_TO_DELETE_THIS'] = '반드시 이것을 삭제하고 싶어요';
?> ?>

View File

@ -47,8 +47,16 @@ class FileModel extends Model
$this->db->set ('createdby', $userid); $this->db->set ('createdby', $userid);
$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);
$this->db->insert ('file'); $this->db->insert ('file');
$this->db->set ('createdon', date('Y-m-d H:i:s'));
$this->db->set ('type', 'file');
$this->db->set ('action', 'create');
$this->db->set ('projectid', $file->projectid);
$this->db->set ('userid', $userid);
$this->db->set ('message', $file->name);
$this->db->insert ('log');
$this->db->trans_complete (); $this->db->trans_complete ();
return $this->db->trans_status(); return $this->db->trans_status();
} }
@ -63,8 +71,16 @@ class FileModel extends Model
$this->db->set ('description', $file->description); $this->db->set ('description', $file->description);
$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);
$this->db->update ('file'); $this->db->update ('file');
$this->db->set ('createdon', date('Y-m-d H:i:s'));
$this->db->set ('type', 'file');
$this->db->set ('action', 'update');
$this->db->set ('projectid', $file->projectid);
$this->db->set ('userid', $userid);
$this->db->set ('message', $file->name);
$this->db->insert ('log');
$this->db->trans_complete (); $this->db->trans_complete ();
return $this->db->trans_status(); return $this->db->trans_status();
} }
@ -94,6 +110,14 @@ class FileModel extends Model
$this->db->where ('projectid', $file->projectid); $this->db->where ('projectid', $file->projectid);
$this->db->where ('name', $file->name); $this->db->where ('name', $file->name);
$this->db->delete ('file'); $this->db->delete ('file');
$this->db->set ('createdon', date('Y-m-d H:i:s'));
$this->db->set ('type', 'file');
$this->db->set ('action', 'delete');
$this->db->set ('projectid', $file->projectid);
$this->db->set ('userid', $userid);
$this->db->set ('message', $file->name);
$this->db->insert ('log');
if ($this->db->trans_status() === FALSE) if ($this->db->trans_status() === FALSE)
{ {

View File

@ -41,7 +41,6 @@ class LogModel extends Model
$commits = array (); $commits = array ();
foreach ($result as $row) foreach ($result as $row)
{ {
list($type,$repo,$rev) = split('[,]', $row->message);
/* $row->project must be equal to $repo */ /* $row->project must be equal to $repo */
$commits[$count]['createdon'] = $row->createdon; $commits[$count]['createdon'] = $row->createdon;
@ -50,27 +49,36 @@ class LogModel extends Model
$commits[$count]['projectid'] = $row->projectid; $commits[$count]['projectid'] = $row->projectid;
$commits[$count]['userid'] = $row->userid; $commits[$count]['userid'] = $row->userid;
$tmp['type'] = $type; if ($row->type == 'code')
$tmp['repo'] = $repo;
$tmp['rev'] = $rev;
$log = @svn_log (
'file:///'.CODEPOT_SVNREPO_DIR."/{$repo}",
$rev, $rev, 1,SVN_DISCOVER_CHANGED_PATHS);
if ($log === FALSE || count($log) < 1)
{ {
$tmp['time'] = ''; list($type,$repo,$rev) = split('[,]', $row->message);
$tmp['author'] = ''; $tmp['type'] = $type;
$tmp['message'] = ''; $tmp['repo'] = $repo;
$tmp['rev'] = $rev;
$log = @svn_log (
'file:///'.CODEPOT_SVNREPO_DIR."/{$repo}",
$rev, $rev, 1,SVN_DISCOVER_CHANGED_PATHS);
if ($log === FALSE || count($log) < 1)
{
$tmp['time'] = '';
$tmp['author'] = '';
$tmp['message'] = '';
}
else
{
$tmp['time'] = $log[0]['date'];
$tmp['author'] = $log[0]['author'];
$tmp['message'] = $log[0]['msg'];
}
$commits[$count]['message'] = $tmp;
} }
else else
{ {
$tmp['time'] = $log[0]['date']; $commits[$count]['message'] = $row->message;
$tmp['author'] = $log[0]['author'];
$tmp['message'] = $log[0]['msg'];
} }
$commits[$count][$row->type.'-'.$row->action] = $tmp;
$count++; $count++;
} }

View File

@ -78,6 +78,14 @@ class ProjectModel extends Model
$this->db->insert ('project_membership'); $this->db->insert ('project_membership');
} }
$this->db->set ('createdon', date('Y-m-d H:i:s'));
$this->db->set ('type', 'project');
$this->db->set ('action', 'create');
$this->db->set ('projectid', $project->id);
$this->db->set ('userid', $userid);
$this->db->set ('message', $project->name);
$this->db->insert ('log');
if ($priority <= 0 || $this->db->trans_status() === FALSE) if ($priority <= 0 || $this->db->trans_status() === FALSE)
{ {
$this->db->trans_rollback (); $this->db->trans_rollback ();
@ -140,6 +148,14 @@ class ProjectModel extends Model
$this->db->insert ('project_membership'); $this->db->insert ('project_membership');
} }
$this->db->set ('createdon', date('Y-m-d H:i:s'));
$this->db->set ('type', 'project');
$this->db->set ('action', 'update');
$this->db->set ('projectid', $project->id);
$this->db->set ('userid', $userid);
$this->db->set ('message', $project->name);
$this->db->insert ('log');
if ($priority <= 0 || $this->db->trans_status() === FALSE) if ($priority <= 0 || $this->db->trans_status() === FALSE)
{ {
$this->db->trans_rollback (); $this->db->trans_rollback ();
@ -160,6 +176,14 @@ class ProjectModel extends Model
$this->db->where ('id', $project->id); $this->db->where ('id', $project->id);
$this->db->delete ('project'); $this->db->delete ('project');
$this->db->set ('createdon', date('Y-m-d H:i:s'));
$this->db->set ('type', 'project');
$this->db->set ('action', 'delete');
$this->db->set ('projectid', $project->id);
$this->db->set ('userid', $userid);
$this->db->set ('message', $project->name);
$this->db->insert ('log');
if ($this->db->trans_status() === FALSE) if ($this->db->trans_status() === FALSE)
{ {
$this->db->trans_rollback (); $this->db->trans_rollback ();

View File

@ -45,6 +45,15 @@ class WikiModel extends Model
$this->db->set ('createdby', $userid); $this->db->set ('createdby', $userid);
$this->db->set ('updatedby', $userid); $this->db->set ('updatedby', $userid);
$this->db->insert ('wiki'); $this->db->insert ('wiki');
$this->db->set ('createdon', date('Y-m-d H:i:s'));
$this->db->set ('type', 'wiki');
$this->db->set ('action', 'create');
$this->db->set ('projectid', $wiki->projectid);
$this->db->set ('userid', $userid);
$this->db->set ('message', $wiki->name);
$this->db->insert ('log');
$this->db->trans_complete (); $this->db->trans_complete ();
return $this->db->trans_status(); return $this->db->trans_status();
} }
@ -59,6 +68,15 @@ class WikiModel extends Model
$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);
$this->db->update ('wiki'); $this->db->update ('wiki');
$this->db->set ('createdon', date('Y-m-d H:i:s'));
$this->db->set ('type', 'wiki');
$this->db->set ('action', 'update');
$this->db->set ('projectid', $wiki->projectid);
$this->db->set ('userid', $userid);
$this->db->set ('message', $wiki->name);
$this->db->insert ('log');
$this->db->trans_complete (); $this->db->trans_complete ();
return $this->db->trans_status(); return $this->db->trans_status();
} }
@ -70,6 +88,15 @@ class WikiModel extends Model
$this->db->where ('projectid', $wiki->projectid); $this->db->where ('projectid', $wiki->projectid);
$this->db->where ('name', $wiki->name); $this->db->where ('name', $wiki->name);
$this->db->delete ('wiki'); $this->db->delete ('wiki');
$this->db->set ('createdon', date('Y-m-d H:i:s'));
$this->db->set ('type', 'wiki');
$this->db->set ('action', 'delete');
$this->db->set ('projectid', $wiki->projectid);
$this->db->set ('userid', $userid);
$this->db->set ('message', $wiki->name);
$this->db->insert ('log');
$this->db->trans_complete (); $this->db->trans_complete ();
return $this->db->trans_status(); return $this->db->trans_status();
} }

View File

@ -91,32 +91,80 @@ $this->load->view (
$xdot = $this->converter->AsciiToHex ('.'); $xdot = $this->converter->AsciiToHex ('.');
foreach ($log_entries as $log) foreach ($log_entries as $log)
{ {
if ($log['type'] == 'code' && $log['action'] == 'commit') if ($log['type'] == 'code')
{ {
$x = $log['code-commit']; $x = $log['message'];
print '<tr class="odd">'; print '<tr class="odd">';
print '<td>'; print '<td>';
print substr($x['time'], 0, 10); print substr($x['time'], 5, 5);
print '</td>'; print '</td>';
print '<td>'; print '<td>';
print anchor ( print anchor (
"/source/revision/{$x['repo']}/{$xdot}/{$x['rev']}", "/source/revision/{$x['repo']}/{$xdot}/{$x['rev']}",
$x['rev']); "r{$x['rev']}");
print '</td>';
print '<td>';
print htmlspecialchars ($x['author']);
print '</td>'; print '</td>';
print '</tr>'; print '</tr>';
print '<tr class="even">'; print '<tr class="even">';
print '<td colspan=3>';
print '<td></td>';
print '<td colspan=1>';
print '<span class="description">';
$fmt = $this->lang->line (
'MSG_LOG_'.strtoupper($log['action']).'_BY');
print htmlspecialchars (sprintf($fmt, $x['author']));
print '</span>';
print '<pre class="message">';
$sm = strtok (trim ($x['message']), "\r\n"); $sm = strtok (trim ($x['message']), "\r\n");
print htmlspecialchars ($sm); print htmlspecialchars ($sm);
print '</pre>';
print '</td>'; print '</td>';
print '</tr>'; print '</tr>';
} }
else
{
print '<tr class="odd">';
print '<td>';
print date ('m-d', strtotime($log['createdon']));
print '</td>';
print '<td>';
$uri = '';
if ($log['type'] == 'project')
{
$uri = "/project/home/{$log['projectid']}";
}
else if ($log['type'] == 'wiki' ||
$log['type'] == 'file')
{
$hex = $this->converter->AsciiToHex ($log['message']);
$uri = "/{$log['type']}/show/{$log['projectid']}/{$hex}";
}
$trimmed = preg_replace("/(.{20}).+/u", "$1…", $log['message']);
if ($uri != '')
print anchor ($uri, htmlspecialchars($trimmed));
else
print htmlspecialchars($trimmed);
print '</td>';
print '</tr>';
print '<tr class="even">';
print '<td></td>';
print '<td colspan=1>';
print '<span class="description">';
$fmt = $this->lang->line (
'MSG_LOG_'.strtoupper($log['action']).'_BY');
print htmlspecialchars (sprintf($fmt, $log['userid']));
print '</span>';
print '</td>';
print '</tr>';
}
} }
?> ?>
</table> </table>

View File

@ -5,8 +5,15 @@ function show_projectbar ($con, $site, $project, $pageid, $ctxmenuitems)
{ {
print "<div class='title'>"; print "<div class='title'>";
if (isset($project)) print $project->name; if (isset($project))
else if (isset($site) && $site->name != '') print htmlspecialchars($site->name); {
if (strcasecmp ($project->name, $project->id) == 0)
print $project->name;
else
print "{$project->name} ({$project->id})";
}
else if (isset($site) && $site->name != '')
print htmlspecialchars($site->name);
else print htmlspecialchars(CODEPOT_DEFAULT_BANNER); else print htmlspecialchars(CODEPOT_DEFAULT_BANNER);
print "</div>"; print "</div>";

View File

@ -99,7 +99,7 @@ $this->load->view (
if (count($file['content']) <= 0) if (count($file['content']) <= 0)
{ {
print $this->lang->line('MSG_NO_SOURCE_AVAIL'); print $this->lang->line('MSG_NO_SOURCE_CODE_AVAIL');
} }
else else
{ {

View File

@ -88,13 +88,13 @@ foreach ($latest_projects as $project)
$xdot = $this->converter->AsciiToHex ('.'); $xdot = $this->converter->AsciiToHex ('.');
foreach ($log_entries as $log) foreach ($log_entries as $log)
{ {
if ($log['type'] == 'code' && $log['action'] == 'commit') if ($log['type'] == 'code')
{ {
$x = $log['code-commit']; $x = $log['message'];
print '<tr class="odd">'; print '<tr class="odd">';
print '<td>'; print '<td>';
print substr($x['time'], 0, 10); print substr($x['time'], 5, 5);
print '</td>'; print '</td>';
print '<td>'; print '<td>';
print anchor ( print anchor (
@ -104,20 +104,73 @@ foreach ($latest_projects as $project)
print '<td>'; print '<td>';
print anchor ( print anchor (
"/source/revision/{$x['repo']}/{$xdot}/{$x['rev']}", "/source/revision/{$x['repo']}/{$xdot}/{$x['rev']}",
$x['rev']); "r{$x['rev']}");
print '</td>';
print '<td>';
print htmlspecialchars ($x['author']);
print '</td>'; print '</td>';
print '</tr>'; print '</tr>';
print '<tr class="even">'; print '<tr class="even">';
print '<td colspan=4>';
print '<td></td>';
print '<td colspan=2>';
print '<span class="description">';
$fmt = $this->lang->line (
'MSG_LOG_'.strtoupper($log['action']).'_BY');
print htmlspecialchars (sprintf($fmt, $x['author']));
print '</span>';
print '<pre class="message">';
$sm = strtok (trim ($x['message']), "\r\n"); $sm = strtok (trim ($x['message']), "\r\n");
print htmlspecialchars ($sm); print htmlspecialchars ($sm);
print '</pre>';
print '</td>'; print '</td>';
print '</tr>'; print '</tr>';
} }
else
{
print '<tr class="odd">';
print '<td>';
print date ('m-d', strtotime($log['createdon']));
print '</td>';
print '<td>';
print anchor ("/project/home/{$log['projectid']}", $log['projectid']);
print '</td>';
print '<td>';
$uri = '';
if ($log['type'] == 'project')
{
$uri = "/project/home/{$log['projectid']}";
}
else if ($log['type'] == 'wiki' ||
$log['type'] == 'file')
{
$hex = $this->converter->AsciiToHex ($log['message']);
$uri = "/{$log['type']}/show/{$log['projectid']}/{$hex}";
}
$trimmed = preg_replace("/(.{15}).+/u", "$1…", $log['message']);
if ($uri != '')
print anchor ($uri, htmlspecialchars($trimmed));
else
print htmlspecialchars($trimmed);
print '</td>';
print '</tr>';
print '<tr class="even">';
print '<td></td>';
print '<td colspan=2>';
print '<span class="description">';
$fmt = $this->lang->line (
'MSG_LOG_'.strtoupper($log['action']).'_BY');
print htmlspecialchars (sprintf($fmt, $log['userid']));
print '</span>';
print '</td>';
print '</tr>';
}
} }
?> ?>
</table> </table>

View File

@ -56,12 +56,12 @@ $this->load->view (
foreach ($log_entries as $log) foreach ($log_entries as $log)
{ {
if ($log['type'] == 'code' && $log['action'] == 'commit') if ($log['type'] == 'code')
{ {
$code_commit = $log['code-commit']; $code = $log['message'];
$date = substr($code_commit['time'], 0, 10); $date = substr($code['time'], 0, 10);
$time = substr($code_commit['time'], 11, 5); $time = substr($code['time'], 11, 5);
} }
else else
{ {
@ -71,8 +71,8 @@ $this->load->view (
if ($curdate != $date) if ($curdate != $date)
{ {
print "<tr class='break'><td colspan=3 class='break'>&nbsp;</td></tr>"; print "<tr class='break'><td colspan=4 class='break'>&nbsp;</td></tr>";
print "<tr class='head'><td colspan=3 class='date'>$date</td></tr>"; print "<tr class='head'><td colspan=4 class='date'>$date</td></tr>";
$curdate = $date; $curdate = $date;
$rowcount = 0; $rowcount = 0;
} }
@ -82,34 +82,81 @@ $this->load->view (
print '<td class="time">' . $time . '</td>'; print '<td class="time">' . $time . '</td>';
print '<td class="projectid">'; print '<td class="projectid">';
print anchor (
"/project/home/{$log['projectid']}",
$log['projectid']);
print '</td>';
print '<td class="details">';
if ($log['type'] == 'code' && $log['action'] == 'commit') if ($log['type'] == 'code' && $log['action'] == 'commit')
{ {
print '<span class="description">'; print anchor (
"/source/file/{$code['repo']}/{$xdot}/{$code['rev']}",
$log['projectid']);
}
else
{
print anchor (
"/project/home/{$log['projectid']}",
$log['projectid']);
}
print '</td>';
if ($log['type'] == 'code')
{
print '<td class="obejct">';
print anchor ( print anchor (
"/source/revision/{$log['projectid']}/{$xdot}/{$code_commit['rev']}", "/source/revision/{$log['projectid']}/{$xdot}/{$code['rev']}",
"r{$code_commit['rev']}"); "r{$code['rev']}");
print ' committed by '; print '</td>';
print htmlspecialchars ($code_commit['author']);
print '<td class="details">';
print '<span class="description">';
$fmt = $this->lang->line (
'MSG_LOG_'.strtoupper($log['action']).'_BY');
print htmlspecialchars (sprintf($fmt, $code['author']));
print '</span>'; print '</span>';
print '<pre class="message">'; print '<pre class="message">';
print htmlspecialchars ($code_commit['message']); print htmlspecialchars ($code['message']);
print '</pre>'; print '</pre>';
} }
else
{
print '<td class="obejct">';
$uri = '';
if ($log['type'] == 'project')
{
$uri = "/project/home/{$log['projectid']}";
}
else if ($log['type'] == 'wiki' ||
$log['type'] == 'file')
{
$hex = $this->converter->AsciiToHex ($log['message']);
$uri = "/{$log['type']}/show/{$log['projectid']}/{$hex}";
}
$trimmed = preg_replace("/(.{10}).+/u", "$1…", $log['message']);
if ($uri != '')
{
print anchor (
$uri,
htmlspecialchars ($trimmed),
'title="'.htmlspecialchars ($log['message']).'"');
}
else print htmlspecialchars ($trimmed);
print '</td>';
print '<td class="details">';
print '<span class="description">';
$fmt = $this->lang->line (
'MSG_LOG_'.strtoupper($log['action']).'_BY');
print htmlspecialchars (sprintf($fmt, $log['userid']));
print '</span>';
}
print '</td>'; print '</td>';
print '</tr>'; print '</tr>';
} }
?> ?>
<tr class='foot'> <tr class='foot'>
<td colspan=3 class='pages'><?= $page_links ?></td> <td colspan=4 class='pages'><?= $page_links ?></td>
</table> </table>
</div> <!-- user_sitelog_mainarea_result --> </div> <!-- user_sitelog_mainarea_result -->

View File

@ -5,7 +5,7 @@ body {
.content .content
{ {
font-size: 90%; font-size: 0.9em;
font-family: sans-serif; font-family: sans-serif;
} }

View File

@ -6,7 +6,7 @@
* user home view * user home view
*-----------------------------------------------*/ *-----------------------------------------------*/
#user_home_mainarea_sidebar { #user_home_mainarea_sidebar {
width: 25em; width: 24em;
} }
#user_home_mainarea_sidebar_log_table { #user_home_mainarea_sidebar_log_table {
@ -24,9 +24,19 @@
#user_home_mainarea_sidebar_log_table tr.even { #user_home_mainarea_sidebar_log_table tr.even {
background-color: inherit; background-color: inherit;
}
#user_home_mainarea_sidebar_log_table tr.even .description {
font-style: italic; font-style: italic;
} }
#user_home_mainarea_sidebar_log_table tr.even pre.message {
border: 0;
margin: 1px;
background-color: inherit;
white-space: pre-wrap;
}
/*----------------------------------------------- /*-----------------------------------------------
* user sidelog view * user sidelog view
*-----------------------------------------------*/ *-----------------------------------------------*/
@ -66,7 +76,7 @@
} }
#user_sitelog_mainarea_result_table td.details .description { #user_sitelog_mainarea_result_table td.details .description {
font-style: italic; /*font-style: italic;*/
} }
#user_sitelog_mainarea_result_table td.details pre.message { #user_sitelog_mainarea_result_table td.details pre.message {
@ -100,10 +110,21 @@
#project_home_mainarea_sidebar_log_table tr.even { #project_home_mainarea_sidebar_log_table tr.even {
background-color: inherit; background-color: inherit;
//font-size: 0.9em; /*font-size: 0.9em;*/
font-style: italic; font-style: italic;
} }
#project_home_mainarea_sidebar_log_table tr.even .description {
/*font-style: italic;*/
}
#project_home_mainarea_sidebar_log_table tr.even pre.message {
border: 0;
margin: 1px;
background-color: inherit;
white-space: pre-wrap;
}
/*----------------------------------------------- /*-----------------------------------------------
* project file home view * project file home view
*-----------------------------------------------*/ *-----------------------------------------------*/
@ -376,3 +397,14 @@
margin: 0; margin: 0;
} }
/*-----------------------------------------------
* project source diff view
*-----------------------------------------------*/
#project_wiki_show_textarea table th {
background-color: #bbccdd;
}
#project_wiki_show_textarea table td {
vertical-align: top;
border-bottom: 1px dashed #bbccdd;
}