* implemented wiki attachment

** added wiki_attachment table
** enhanced wikicreole to support a relative image URL.
* introduced 'ldap_server_uri' to take over 'ldap_server_host' and 'ldap_server_uri' deprecated.
** mainly done to support ldaps.
This commit is contained in:
hyung-hwan 2010-04-27 14:56:11 +00:00
parent f777386e37
commit 7596d92c9e
37 changed files with 785 additions and 185 deletions

View File

@ -9,12 +9,14 @@ install-data-hook:
$(INSTALL) -d "$(DESTDIR)@DEPOTDIR@" $(INSTALL) -d "$(DESTDIR)@DEPOTDIR@"
$(INSTALL) -d "$(DESTDIR)@DEPOTDIR@/svnrepo" $(INSTALL) -d "$(DESTDIR)@DEPOTDIR@/svnrepo"
$(INSTALL) -d "$(DESTDIR)@DEPOTDIR@/files" $(INSTALL) -d "$(DESTDIR)@DEPOTDIR@/files"
$(INSTALL) -d "$(DESTDIR)@DEPOTDIR@/attachments"
$(INSTALL) -d "$(DESTDIR)@LOGDIR@" $(INSTALL) -d "$(DESTDIR)@LOGDIR@"
$(INSTALL) -d "$(DESTDIR)@CACHEDIR@" $(INSTALL) -d "$(DESTDIR)@CACHEDIR@"
uninstall-hook: uninstall-hook:
$(RMDIR) "$(DESTDIR)@DEPOTDIR@/svnrepo" $(RMDIR) "$(DESTDIR)@DEPOTDIR@/attachments"
$(RMDIR) "$(DESTDIR)@DEPOTDIR@/files" $(RMDIR) "$(DESTDIR)@DEPOTDIR@/files"
$(RMDIR) "$(DESTDIR)@DEPOTDIR@/svnrepo"
$(RMDIR) "$(DESTDIR)@DEPOTDIR@" $(RMDIR) "$(DESTDIR)@DEPOTDIR@"
$(RMDIR) "$(DESTDIR)@LOGDIR@" $(RMDIR) "$(DESTDIR)@LOGDIR@"
$(RMDIR) "$(DESTDIR)@CACHEDIR@" $(RMDIR) "$(DESTDIR)@CACHEDIR@"

View File

@ -694,12 +694,14 @@ install-data-hook:
$(INSTALL) -d "$(DESTDIR)@DEPOTDIR@" $(INSTALL) -d "$(DESTDIR)@DEPOTDIR@"
$(INSTALL) -d "$(DESTDIR)@DEPOTDIR@/svnrepo" $(INSTALL) -d "$(DESTDIR)@DEPOTDIR@/svnrepo"
$(INSTALL) -d "$(DESTDIR)@DEPOTDIR@/files" $(INSTALL) -d "$(DESTDIR)@DEPOTDIR@/files"
$(INSTALL) -d "$(DESTDIR)@DEPOTDIR@/attachments"
$(INSTALL) -d "$(DESTDIR)@LOGDIR@" $(INSTALL) -d "$(DESTDIR)@LOGDIR@"
$(INSTALL) -d "$(DESTDIR)@CACHEDIR@" $(INSTALL) -d "$(DESTDIR)@CACHEDIR@"
uninstall-hook: uninstall-hook:
$(RMDIR) "$(DESTDIR)@DEPOTDIR@/svnrepo" $(RMDIR) "$(DESTDIR)@DEPOTDIR@/svnrepo"
$(RMDIR) "$(DESTDIR)@DEPOTDIR@/files" $(RMDIR) "$(DESTDIR)@DEPOTDIR@/files"
$(RMDIR) "$(DESTDIR)@DEPOTDIR@/attachments"
$(RMDIR) "$(DESTDIR)@DEPOTDIR@" $(RMDIR) "$(DESTDIR)@DEPOTDIR@"
$(RMDIR) "$(DESTDIR)@LOGDIR@" $(RMDIR) "$(DESTDIR)@LOGDIR@"
$(RMDIR) "$(DESTDIR)@CACHEDIR@" $(RMDIR) "$(DESTDIR)@CACHEDIR@"

View File

@ -25,8 +25,7 @@ database_prefix = ""
; ${userid} and ${password} to represent the actual user ID ; ${userid} and ${password} to represent the actual user ID
; and the password respectively. ; and the password respectively.
;------------------------------------------------------------------------------ ;------------------------------------------------------------------------------
ldap_server_host = "127.0.0.1" ldap_server_uri = "ldap://127.0.0.1:389"
ldap_server_port = "389"
ldap_server_protocol_version = "3" ldap_server_protocol_version = "3"
ldap_userid_format = "${userid}" ldap_userid_format = "${userid}"
ldap_password_format = "${password}" ldap_password_format = "${password}"
@ -125,6 +124,11 @@ svnrepo_dir = "@DEPOTDIR@/svnrepo"
;------------------------------------------------------------------------------ ;------------------------------------------------------------------------------
file_dir = "@DEPOTDIR@/files" file_dir = "@DEPOTDIR@/files"
;------------------------------------------------------------------------------
; directory to store wiki attachments
;------------------------------------------------------------------------------
attachment_dir = "@DEPOTDIR@/attachments"
;------------------------------------------------------------------------------ ;------------------------------------------------------------------------------
; log threshold ; log threshold
;------------------------------------------------------------------------------ ;------------------------------------------------------------------------------

View File

@ -50,6 +50,24 @@ CREATE TABLE wiki (
ON DELETE RESTRICT ON UPDATE CASCADE ON DELETE RESTRICT ON UPDATE CASCADE
) charset=utf8 engine=InnoDB; ) charset=utf8 engine=InnoDB;
CREATE TABLE wiki_attachment (
projectid VARCHAR(32) NOT NULL,
wikiname VARCHAR(255) NOT NULL,
name VARCHAR(255) NOT NULL,
encname VARCHAR(255) NOT NULL,
createdon DATETIME,
createdby VARCHAR(32),
UNIQUE KEY wiki_attachment_id (projectid, wikiname, name),
CONSTRAINT wiki_attachment_projectid FOREIGN KEY (projectid) REFERENCES project(id)
ON DELETE RESTRICT ON UPDATE CASCADE,
CONSTRAINT wiki_attachment_wikiid FOREIGN KEY (projectid,wikiname) REFERENCES wiki(projectid,name)
ON DELETE RESTRICT ON UPDATE CASCADE
) charset=utf8 engine=InnoDB;
CREATE TABLE issue ( CREATE TABLE issue (
projectid VARCHAR(32) NOT NULL, projectid VARCHAR(32) NOT NULL,
id BIGINT NOT NULL, id BIGINT NOT NULL,

View File

@ -9,98 +9,97 @@
*/ */
$mimes = array( 'hqx' => 'application/mac-binhex40', $mimes = array( 'hqx' => 'application/mac-binhex40',
'cpt' => 'application/mac-compactpro', 'cpt' => 'application/mac-compactpro',
'csv' => array('text/x-comma-separated-values', 'text/comma-separated-values', 'application/octet-stream', 'application/vnd.ms-excel', 'text/csv', 'application/csv', 'application/excel', 'application/vnd.msexcel'), 'csv' => array('text/x-comma-separated-values', 'text/comma-separated-values', 'application/octet-stream', 'application/vnd.ms-excel', 'text/csv', 'application/csv', 'application/excel', 'application/vnd.msexcel'),
'bin' => 'application/macbinary', 'bin' => 'application/macbinary',
'dms' => 'application/octet-stream', 'dms' => 'application/octet-stream',
'lha' => 'application/octet-stream', 'lha' => 'application/octet-stream',
'lzh' => 'application/octet-stream', 'lzh' => 'application/octet-stream',
'exe' => 'application/octet-stream', 'exe' => 'application/octet-stream',
'class' => 'application/octet-stream', 'class' => 'application/octet-stream',
'psd' => 'application/x-photoshop', 'psd' => 'application/x-photoshop',
'so' => 'application/octet-stream', 'so' => 'application/octet-stream',
'sea' => 'application/octet-stream', 'sea' => 'application/octet-stream',
'dll' => 'application/octet-stream', 'dll' => 'application/octet-stream',
'oda' => 'application/oda', 'oda' => 'application/oda',
'pdf' => array('application/pdf', 'application/x-download'), 'pdf' => array('application/pdf', 'application/x-download'),
'ai' => 'application/postscript', 'ai' => 'application/postscript',
'eps' => 'application/postscript', 'eps' => 'application/postscript',
'ps' => 'application/postscript', 'ps' => 'application/postscript',
'smi' => 'application/smil', 'smi' => 'application/smil',
'smil' => 'application/smil', 'smil' => 'application/smil',
'mif' => 'application/vnd.mif', 'mif' => 'application/vnd.mif',
'xls' => array('application/excel', 'application/vnd.ms-excel', 'application/msexcel'), 'xls' => array('application/excel', 'application/vnd.ms-excel', 'application/msexcel'),
'ppt' => array('application/powerpoint', 'application/vnd.ms-powerpoint'), 'ppt' => array('application/powerpoint', 'application/vnd.ms-powerpoint'),
'wbxml' => 'application/wbxml', 'wbxml' => 'application/wbxml',
'wmlc' => 'application/wmlc', 'wmlc' => 'application/wmlc',
'dcr' => 'application/x-director', 'dcr' => 'application/x-director',
'dir' => 'application/x-director', 'dir' => 'application/x-director',
'dxr' => 'application/x-director', 'dxr' => 'application/x-director',
'dvi' => 'application/x-dvi', 'dvi' => 'application/x-dvi',
'gtar' => 'application/x-gtar', 'gtar' => 'application/x-gtar',
'gz' => 'application/x-gzip', 'gz' => 'application/x-gzip',
'php' => 'application/x-httpd-php', 'php' => 'application/x-httpd-php',
'php4' => 'application/x-httpd-php', 'php4' => 'application/x-httpd-php',
'php3' => 'application/x-httpd-php', 'php3' => 'application/x-httpd-php',
'phtml' => 'application/x-httpd-php', 'phtml' => 'application/x-httpd-php',
'phps' => 'application/x-httpd-php-source', 'phps' => 'application/x-httpd-php-source',
'js' => 'application/x-javascript', 'js' => 'application/x-javascript',
'swf' => 'application/x-shockwave-flash', 'swf' => 'application/x-shockwave-flash',
'sit' => 'application/x-stuffit', 'sit' => 'application/x-stuffit',
'tar' => 'application/x-tar', 'tar' => 'application/x-tar',
'tgz' => 'application/x-tar', 'tgz' => 'application/x-tar',
'xhtml' => 'application/xhtml+xml', 'xhtml' => 'application/xhtml+xml',
'xht' => 'application/xhtml+xml', 'xht' => 'application/xhtml+xml',
'zip' => array('application/x-zip', 'application/zip', 'application/x-zip-compressed'), 'zip' => array('application/x-zip', 'application/zip', 'application/x-zip-compressed'),
'mid' => 'audio/midi', 'mid' => 'audio/midi',
'midi' => 'audio/midi', 'midi' => 'audio/midi',
'mpga' => 'audio/mpeg', 'mpga' => 'audio/mpeg',
'mp2' => 'audio/mpeg', 'mp2' => 'audio/mpeg',
'mp3' => array('audio/mpeg', 'audio/mpg'), 'mp3' => array('audio/mpeg', 'audio/mpg'),
'aif' => 'audio/x-aiff', 'aif' => 'audio/x-aiff',
'aiff' => 'audio/x-aiff', 'aiff' => 'audio/x-aiff',
'aifc' => 'audio/x-aiff', 'aifc' => 'audio/x-aiff',
'ram' => 'audio/x-pn-realaudio', 'ram' => 'audio/x-pn-realaudio',
'rm' => 'audio/x-pn-realaudio', 'rm' => 'audio/x-pn-realaudio',
'rpm' => array('audio/x-pn-realaudio-plugin', 'application/x-rpm'), 'rpm' => array('audio/x-pn-realaudio-plugin', 'application/x-rpm'),
'ra' => 'audio/x-realaudio', 'ra' => 'audio/x-realaudio',
'rv' => 'video/vnd.rn-realvideo', 'rv' => 'video/vnd.rn-realvideo',
'wav' => 'audio/x-wav', 'wav' => 'audio/x-wav',
'bmp' => 'image/bmp', 'bmp' => 'image/bmp',
'gif' => 'image/gif', 'gif' => 'image/gif',
'jpeg' => array('image/jpeg', 'image/pjpeg'), 'jpeg' => array('image/jpeg', 'image/pjpeg'),
'jpg' => array('image/jpeg', 'image/pjpeg'), 'jpg' => array('image/jpeg', 'image/pjpeg'),
'jpe' => array('image/jpeg', 'image/pjpeg'), 'jpe' => array('image/jpeg', 'image/pjpeg'),
'png' => array('image/png', 'image/x-png'), 'png' => array('image/png', 'image/x-png'),
'tiff' => 'image/tiff', 'tiff' => 'image/tiff',
'tif' => 'image/tiff', 'tif' => 'image/tiff',
'css' => 'text/css', 'css' => 'text/css',
'html' => 'text/html', 'html' => 'text/html',
'htm' => 'text/html', 'htm' => 'text/html',
'shtml' => 'text/html', 'shtml' => 'text/html',
'txt' => 'text/plain', 'txt' => 'text/plain',
'text' => 'text/plain', 'text' => 'text/plain',
'log' => array('text/plain', 'text/x-log'), 'log' => array('text/plain', 'text/x-log'),
'rtx' => 'text/richtext', 'rtx' => 'text/richtext',
'rtf' => 'text/rtf', 'rtf' => 'text/rtf',
'xml' => 'text/xml', 'xml' => 'text/xml',
'xsl' => 'text/xml', 'xsl' => 'text/xml',
'mpeg' => 'video/mpeg', 'mpeg' => 'video/mpeg',
'mpg' => 'video/mpeg', 'mpg' => 'video/mpeg',
'mpe' => 'video/mpeg', 'mpe' => 'video/mpeg',
'qt' => 'video/quicktime', 'qt' => 'video/quicktime',
'mov' => 'video/quicktime', 'mov' => 'video/quicktime',
'avi' => 'video/x-msvideo', 'avi' => 'video/x-msvideo',
'movie' => 'video/x-sgi-movie', 'movie' => 'video/x-sgi-movie',
'doc' => 'application/msword', 'doc' => 'application/msword',
'docx' => 'application/vnd.openxmlformats-officedocument.wordprocessingml.document', 'docx' => 'application/vnd.openxmlformats-officedocument.wordprocessingml.document',
'xlsx' => 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', 'xlsx' => 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
'word' => array('application/msword', 'application/octet-stream'), 'word' => array('application/msword', 'application/octet-stream'),
'xl' => 'application/excel', 'xl' => 'application/excel',
'eml' => 'message/rfc822', 'eml' => 'message/rfc822',
'odt' => 'application/vnd.oasis.opendocument.text' 'odt' => 'application/vnd.oasis.opendocument.text'
); );
/* End of file mimes.php */ /* End of file mimes.php */
/* Location: ./system/application/config/mimes.php */ /* Location: ./system/application/config/mimes.php */

View File

@ -302,9 +302,8 @@ class File extends Controller
$md5sum = md5_file ($upload['full_path']); $md5sum = md5_file ($upload['full_path']);
if ($md5sum === FALSE) if ($md5sum === FALSE)
{ {
unlink (CODEPOT_FILE_DIR . "/{$file->encname}"); @unlink ($upload['full_path']);
$data['message'] = "CANNOT GET MD5SUM - {$file->name}";
$data['message'] = "CANNOT GET MD5SUM OF FILE - {$file->name}";
$data['file'] = $file; $data['file'] = $file;
$this->load->view ($this->VIEW_EDIT, $data); $this->load->view ($this->VIEW_EDIT, $data);
} }

View File

@ -454,6 +454,25 @@ class Site extends Controller
} }
} }
function image ($xlink = '')
{
$login = $this->login->getUser ();
if (CODEPOT_SIGNIN_COMPULSORY && $login['id'] == '')
redirect ('main/signin');
$data['login'] = $login;
$linkname = $this->converter->HexToAscii ($xlink);
$part = explode (':', $linkname);
if (count($part) == 3)
{
$hexwikiname = $this->converter->AsciiTohex($part[1]);
$hexattname = $this->converter->AsciiTohex($part[2]);
redirect ("wiki/attachment/{$part[0]}/{$hexwikiname}/{$hexattname}");
}
}
} }
?> ?>

View File

@ -20,7 +20,7 @@ class Wiki extends Controller
$this->load->library ('Language', 'lang'); $this->load->library ('Language', 'lang');
$this->lang->load ('common', CODEPOT_LANG); $this->lang->load ('common', CODEPOT_LANG);
$this->lang->load ('wiki', CODEPOT_LANG);
} }
function home ($projectid = '') function home ($projectid = '')
@ -98,7 +98,8 @@ class Wiki extends Controller
} }
else else
{ {
$link = $this->wikihelper->parseLink ($name, $projectid, $this->converter); $link = $this->wikihelper->parseLink (
$name, $projectid, $this->converter);
if ($link === FALSE) if ($link === FALSE)
{ {
$data['project'] = $project; $data['project'] = $project;
@ -132,9 +133,8 @@ class Wiki extends Controller
else else
{ {
$data['project'] = $project; $data['project'] = $project;
$data['message'] = $data['message'] = sprintf (
$this->lang->line('MSG_NO_SUCH_WIKI_PAGE') . $this->lang->line('WIKI_MSG_NO_SUCH_PAGE'), $name);
" - {$name}";
$this->load->view ($this->VIEW_ERROR, $data); $this->load->view ($this->VIEW_ERROR, $data);
} }
} }
@ -157,10 +157,126 @@ class Wiki extends Controller
$this->_show_wiki ($projectid, $name, FALSE); $this->_show_wiki ($projectid, $name, FALSE);
} }
function attachment0 ($projectid = '', $target = '')
{
//$target => projectid:wikiname:attachment
$login = $this->login->getUser ();
if (CODEPOT_SIGNIN_COMPULSORY && $login['id'] == '')
redirect ('main/signin');
if ($target == '')
{
$data['login'] = $login;
$data['message'] = 'INVALID PARAMETERS';
$this->load->view ($this->VIEW_ERROR, $data);
return;
}
$target = $this->converter->HexToAscii ($target);
$part = explode (':', $target);
if (count($part) == 3)
{
if ($part[0] == '') $part[0] = $projectid;
$this->_handle_attachment ($login, $part[0], $part[1], $part[2]);
}
}
function attachment ($projectid = '', $wikiname = '', $name = '')
{
$login = $this->login->getUser ();
if (CODEPOT_SIGNIN_COMPULSORY && $login['id'] == '')
redirect ('main/signin');
if ($wikiname == '' || $name == '')
{
$data['login'] = $login;
$data['message'] = 'INVALID PARAMETERS';
$this->load->view ($this->VIEW_ERROR, $data);
return;
}
$wikiname = $this->converter->HexToAscii ($wikiname);
$name = $this->converter->HexToAscii ($name);
$part = explode (':', $name);
if (count($part) == 3)
{
if ($part[0] != '') $projectid = $part[0];
if ($part[1] != '') $wikiname = $part[1];
if ($part[2] != '') $name = $part[2];
}
$this->_handle_attachment ($login, $projectid, $wikiname, $name);
}
function _handle_attachment ($login, $projectid, $wikiname, $name)
{
$this->load->model ('ProjectModel', 'projects');
$this->load->model ('WikiModel', 'wikis');
$data['login'] = $login;
$project = $this->projects->get ($projectid);
if ($project === FALSE)
{
$data['message'] = 'DATABASE ERROR';
$this->load->view ($this->VIEW_ERROR, $data);
}
else if ($project === NULL)
{
$data['message'] =
$this->lang->line('MSG_NO_SUCH_PROJECT') .
" - {$projectid}";
$this->load->view ($this->VIEW_ERROR, $data);
}
else
{
$att = $this->wikis->getAttachment ($login['id'], $project, $wikiname, $name);
if ($att == FALSE)
{
$data['project'] = $project;
$data['message'] = 'DATABASE ERROR';
$this->load->view ($this->VIEW_ERROR, $data);
return;
}
else if ($att === NULL)
{
$data['project'] = $project;
$data['message'] = sprintf (
$this->lang->line('MSG_WIKI_NO_SUCH_ATTACHMENT'), $name);
$this->load->view ($this->VIEW_ERROR, $data);
}
$path = CODEPOT_ATTACHMENT_DIR . "/{$att->encname}";
$mtime = @filemtime ($path);
if ($mtime === FALSE) $mtime = time();
header('Last-Modified: ' . gmdate("D, d M Y H:i:s", $mtime) . ' GMT');
header ('Content-Type: ' . mime_content_type($path));
header("Content-Disposition: filename={$name}");
$len = @filesize($path);
if ($len !== FALSE) header("Content-Length: {$len}");
//header("Content-Transfer-Encoding: binary");
flush ();
$x = @readfile($path);
if ($x === FALSE)
{
$data['project'] = $project;
$data['message'] = sprintf (
$this->lang->line('MSG_WIKI_FAILED_TO_READ_ATTACHMENT'), $name);
$this->load->view ($this->VIEW_ERROR, $data);
}
}
}
function _edit_wiki ($projectid, $name, $mode) function _edit_wiki ($projectid, $name, $mode)
{ {
$this->load->helper ('form'); $this->load->helper ('form');
$this->load->library ('form_validation'); $this->load->library ('form_validation');
$this->load->library ('upload');
$this->load->model ('ProjectModel', 'projects'); $this->load->model ('ProjectModel', 'projects');
$this->load->model ('WikiModel', 'wikis'); $this->load->model ('WikiModel', 'wikis');
@ -208,9 +324,39 @@ class Wiki extends Controller
if ($this->input->post('wiki')) if ($this->input->post('wiki'))
{ {
$wiki->projectid = $this->input->post('wiki_projectid'); $wiki->projectid = $this->input->post('wiki_projectid');
$wiki->name = $this->input->post('wiki_name'); $wiki->name = $this->input->post('wiki_name');
$wiki->text = $this->input->post('wiki_text'); $wiki->text = $this->input->post('wiki_text');
$wiki->delete_attachments = array();
$delatts = $this->input->post('wiki_delete_attachment');
if (!empty($delatts))
{
foreach ($delatts as $att)
{
$atpos = strpos ($att, '@');
if ($atpos === FALSE) continue;
$attinfo['name'] = $this->converter->HexToAscii(substr ($att, 0, $atpos));
$attinfo['encname'] = $this->converter->HexToAscii(substr ($att, $atpos + 1));
array_push (
$wiki->delete_attachments,
(object)$attinfo
);
}
}
$wiki->attachments = $this->wikis->getAttachments (
$login['id'], $project, $wiki->name);
if ($wiki->attachments === FALSE)
{
$data['message'] = 'DATABASE ERROR';
$this->load->view ($this->VIEW_ERROR, $data);
return;
}
if ($this->form_validation->run()) if ($this->form_validation->run())
{ {
if ($this->wikihelper->_is_reserved ($wiki->name, FALSE)) if ($this->wikihelper->_is_reserved ($wiki->name, FALSE))
@ -221,17 +367,38 @@ class Wiki extends Controller
} }
else else
{ {
list($ret,$extra) =
$this->_upload_attachments ('wiki_new_attachment');
if ($ret === FALSE)
{
$data['wiki'] = $wiki;
$data['message'] = $extra;
$this->load->view ($this->VIEW_EDIT, $data);
return;
}
$wiki->new_attachments = $extra;
$result = ($mode == 'update')? $result = ($mode == 'update')?
$this->wikis->update ($login['id'], $wiki): $this->wikis->update ($login['id'], $wiki):
$this->wikis->create ($login['id'], $wiki); $this->wikis->create ($login['id'], $wiki);
if ($result === FALSE) if ($result === FALSE)
{ {
foreach ($extra as $att)
@unlink ($att['fullencpath']);
$data['message'] = 'DATABASE ERROR'; $data['message'] = 'DATABASE ERROR';
$data['wiki'] = $wiki; $data['wiki'] = $wiki;
$this->load->view ($this->VIEW_EDIT, $data); $this->load->view ($this->VIEW_EDIT, $data);
} }
else else
{ {
// delete attachments after database operation
// as 'delete' is not easy to restore.
foreach ($wiki->delete_attachments as $att)
@unlink (CODEPOT_ATTACHMENT_DIR . "/{$att->encname}");
redirect ("wiki/show/{$project->id}/" . redirect ("wiki/show/{$project->id}/" .
$this->converter->AsciiToHex($wiki->name)); $this->converter->AsciiToHex($wiki->name));
} }
@ -257,7 +424,7 @@ class Wiki extends Controller
else if ($wiki == NULL) else if ($wiki == NULL)
{ {
$data['message'] = $data['message'] =
$this->lang->line('MSG_NO_SUCH_WIKI_PAGE') . $this->lang->line('WIKI_MSG_NO_SUCH_PAGE') .
" - {$name}"; " - {$name}";
$this->load->view ($this->VIEW_ERROR, $data); $this->load->view ($this->VIEW_ERROR, $data);
} }
@ -383,9 +550,8 @@ class Wiki extends Controller
} }
else if ($wiki === NULL) else if ($wiki === NULL)
{ {
$data['message'] = $data['message'] = sprintf (
$this->lang->line('MSG_NO_SUCH_WIKI_PAGE') . $this->lang->line('WIKI_MSG_NO_SUCH_PAGE'), $name);
" - {$name}";
$this->load->view ($this->VIEW_ERROR, $data); $this->load->view ($this->VIEW_ERROR, $data);
} }
else else
@ -398,4 +564,61 @@ class Wiki extends Controller
} }
} }
function _upload_attachments ($id)
{
$attno = 0;
$count = count($_FILES);
$attachments = array ();
for ($i = 0; $i < $count; $i++)
{
$field_name = "{$id}_{$i}";
if (array_key_exists($field_name, $_FILES) &&
$_FILES[$field_name]['name'] != '')
{
$fname = $_FILES[$field_name]['name'];
if (strpos ($fname, ':') !== FALSE)
{
while ($attno > 0)
@unlink ($attachments[$attno--]['fullencpath']);
return array(FALSE,$this->lang->line('WIKI_MSG_ATTACHMENT_NAME_NO_COLON'));
}
$ext = substr ($fname, strrpos ($fname, '.') + 1);
// delete all \" instances ...
$_FILES[$field_name]['type'] =
str_replace('\"', '', $_FILES[$field_name]['type']);
// delete all \\ instances ...
$_FILES[$field_name]['type'] =
str_replace('\\', '', $_FILES[$field_name]['type']);
$config['allowed_types'] = $ext;
$config['upload_path'] = CODEPOT_ATTACHMENT_DIR;
$config['max_size'] = CODEPOT_MAX_UPLOAD_SIZE;
$config['encrypt_name'] = TRUE;
$this->upload->initialize ($config);
if (!$this->upload->do_upload ($field_name))
{
while ($attno > 0)
@unlink ($attachments[$attno--]['fullencpath']);
return array(FALSE,$this->upload->display_errors('',''));
}
$upload = $this->upload->data ();
$attachments[$attno++] = array (
'name' => $fname,
'encname' => $upload['file_name'],
'fullencpath' => $upload['full_path']);
}
}
return array(TRUE,$attachments);
}
} }

View File

@ -5,7 +5,8 @@ www_DATA = \
issue_lang.php \ issue_lang.php \
index.html \ index.html \
project_lang.php \ project_lang.php \
site_lang.php site_lang.php \
wiki_lang.php
EXTRA_DIST = $(www_DATA) EXTRA_DIST = $(www_DATA)

View File

@ -171,7 +171,8 @@ www_DATA = \
issue_lang.php \ issue_lang.php \
index.html \ index.html \
project_lang.php \ project_lang.php \
site_lang.php site_lang.php \
wiki_lang.php
EXTRA_DIST = $(www_DATA) EXTRA_DIST = $(www_DATA)
all: all-am all: all-am

View File

@ -1,6 +1,8 @@
<?php <?php
$lang['Administration'] = 'Administration'; $lang['Administration'] = 'Administration';
$lang['All'] = 'All'; $lang['All'] = 'All';
$lang['Attachment'] = 'Attachment';
$lang['Attachments'] = 'Attachments';
$lang['Author'] = 'Author'; $lang['Author'] = 'Author';
$lang['Blame'] = 'Blame'; $lang['Blame'] = 'Blame';
$lang['Cancel'] = 'Cancel'; $lang['Cancel'] = 'Cancel';
@ -41,6 +43,7 @@ $lang['MD5'] = 'MD5';
$lang['Member'] = 'Member'; $lang['Member'] = 'Member';
$lang['Members'] = 'Members'; $lang['Members'] = 'Members';
$lang['Message'] = 'Message'; $lang['Message'] = 'Message';
$lang['More'] = 'More';
$lang['My issues'] = 'My issues'; $lang['My issues'] = 'My issues';
$lang['My projects'] = 'My projects'; $lang['My projects'] = 'My projects';
$lang['Name'] = 'Name'; $lang['Name'] = 'Name';
@ -93,7 +96,5 @@ $lang['MSG_NO_ISSUES_AVAIL'] = 'No outstanding issues';
$lang['MSG_NO_SUCH_FILE'] = 'No such file'; $lang['MSG_NO_SUCH_FILE'] = 'No such file';
$lang['MSG_NO_SUCH_ISSUE'] = 'No such issue'; $lang['MSG_NO_SUCH_ISSUE'] = 'No such issue';
$lang['MSG_NO_SUCH_PROJECT'] = 'No such project'; $lang['MSG_NO_SUCH_PROJECT'] = 'No such project';
$lang['MSG_NO_SUCH_WIKI_PAGE'] = 'No such wiki page';
$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

@ -20,5 +20,6 @@ $lang['ISSUE_PRIORITY_OTHER'] = 'Other';
$lang['ISSUE_MSG_CHANGED_X_TO_Z'] = "Changed <span class='quoted'>%s</span> to <span class='quoted'>%s</span>"; $lang['ISSUE_MSG_CHANGED_X_TO_Z'] = "Changed <span class='quoted'>%s</span> to <span class='quoted'>%s</span>";
$lang['ISSUE_MSG_CHANGED_X_FROM_Y_TO_Z'] = "Changed <span class='quoted'>%s</span> from <span class='quoted'>%s</span> to <span class='quoted'>%s</span>"; $lang['ISSUE_MSG_CHANGED_X_FROM_Y_TO_Z'] = "Changed <span class='quoted'>%s</span> from <span class='quoted'>%s</span> to <span class='quoted'>%s</span>";
$lang['ISSUE_MSG_CONFIRM_UNDO'] = 'Are you sure to undo the last change?'; $lang['ISSUE_MSG_CONFIRM_UNDO'] = 'Are you sure to undo the last change?';
$lang['ISSUE_MSG_CREATED'] = 'Created';
$lang['ISSUE_MSG_TOTAL_NUM_ISSUES'] = 'Total %d issues'; $lang['ISSUE_MSG_TOTAL_NUM_ISSUES'] = 'Total %d issues';
?> ?>

View File

@ -0,0 +1,11 @@
<?php
$lang['WIKI_ATTACHMENTS'] = 'Attachments';
$lang['WIKI_NEW_ATTACHMENTS'] = 'New attachments';
$lang['WIKI_MORE_NEW_ATTACHMENTS'] = 'Add more';
$lang['WIKI_MSG_ATTACHMENT_NAME_NO_COLON'] = 'Attachment name containing a colon';
$lang['WIKI_MSG_FAILED_TO_READ_ATTACHMENT'] = 'Failed to read wiki attachment - %s';
$lang['WIKI_MSG_NO_PAGES_AVAILABLE'] = 'No wiki pages available';
$lang['WIKI_MSG_NO_SUCH_PAGE'] = 'No such wiki page - %s';
$lang['WIKI_MSG_NO_SUCH_ATTACHMENT'] = 'No such wiki attachment - %s';
?>

View File

@ -91,7 +91,5 @@ $lang['MSG_NO_ISSUES_AVAIL'] = 'Tidak ada issue';
$lang['MSG_NO_SUCH_FILE'] = 'No such file'; $lang['MSG_NO_SUCH_FILE'] = 'No such file';
$lang['MSG_NO_SUCH_ISSUE'] = 'No such issue'; $lang['MSG_NO_SUCH_ISSUE'] = 'No such issue';
$lang['MSG_NO_SUCH_PROJECT'] = 'No such project'; $lang['MSG_NO_SUCH_PROJECT'] = 'No such project';
$lang['MSG_NO_SUCH_WIKI_PAGE'] = 'No such wiki page';
$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

@ -5,7 +5,8 @@ www_DATA = \
issue_lang.php \ issue_lang.php \
index.html \ index.html \
project_lang.php \ project_lang.php \
site_lang.php site_lang.php \
wiki_lang.php
EXTRA_DIST = $(www_DATA) EXTRA_DIST = $(www_DATA)

View File

@ -171,7 +171,8 @@ www_DATA = \
issue_lang.php \ issue_lang.php \
index.html \ index.html \
project_lang.php \ project_lang.php \
site_lang.php site_lang.php \
wiki_lang.php
EXTRA_DIST = $(www_DATA) EXTRA_DIST = $(www_DATA)
all: all-am all: all-am

View File

@ -1,6 +1,8 @@
<?php <?php
$lang['Administration'] = '관리'; $lang['Administration'] = '관리';
$lang['All'] = '모두'; $lang['All'] = '모두';
$lang['Attachment'] = '첨부';
$lang['Attachments'] = '첨부';
$lang['Author'] = '저자'; $lang['Author'] = '저자';
$lang['Blame'] = '책임전가'; $lang['Blame'] = '책임전가';
$lang['Cancel'] = '취소'; $lang['Cancel'] = '취소';
@ -41,6 +43,7 @@ $lang['MD5'] = 'MD5';
$lang['Member'] = '구성원'; $lang['Member'] = '구성원';
$lang['Members'] = '구성원'; $lang['Members'] = '구성원';
$lang['Message'] = '메시지'; $lang['Message'] = '메시지';
$lang['More'] = '더';
$lang['My issues'] = '내 이슈'; $lang['My issues'] = '내 이슈';
$lang['My projects'] = '내 프로젝트'; $lang['My projects'] = '내 프로젝트';
$lang['Name'] = '이름'; $lang['Name'] = '이름';
@ -93,7 +96,5 @@ $lang['MSG_NO_ISSUES_AVAIL'] = '이슈항목이 없습니다';
$lang['MSG_NO_SUCH_FILE'] = '파일이 없습니다'; $lang['MSG_NO_SUCH_FILE'] = '파일이 없습니다';
$lang['MSG_NO_SUCH_ISSUE'] = '이슈항목이 없습니다'; $lang['MSG_NO_SUCH_ISSUE'] = '이슈항목이 없습니다';
$lang['MSG_NO_SUCH_PROJECT'] = '프로젝트가 없습니다'; $lang['MSG_NO_SUCH_PROJECT'] = '프로젝트가 없습니다';
$lang['MSG_NO_SUCH_WIKI_PAGE'] = '위키페이지가 없습니다';
$lang['MSG_NO_WIKIS_AVAIL'] = '사용가능한 위키페이지가 없습니다';
$lang['MSG_SURE_TO_DELETE_THIS'] = '반드시 이것을 삭제하고 싶어요'; $lang['MSG_SURE_TO_DELETE_THIS'] = '반드시 이것을 삭제하고 싶어요';
?> ?>

View File

@ -20,5 +20,6 @@ $lang['ISSUE_PRIORITY_OTHER'] = '기타';
$lang['ISSUE_MSG_CHANGED_X_TO_Z'] = "<span class='quoted'>%s</span>을/를 <span class='quoted'>%s</span>(으)로 변경"; $lang['ISSUE_MSG_CHANGED_X_TO_Z'] = "<span class='quoted'>%s</span>을/를 <span class='quoted'>%s</span>(으)로 변경";
$lang['ISSUE_MSG_CHANGED_X_FROM_Y_TO_Z'] = "<span class='quoted'>%s</span>을/를 <span class='quoted'>%s</span>에서 <span class='quoted'>%s</span>(으)로 변경"; $lang['ISSUE_MSG_CHANGED_X_FROM_Y_TO_Z'] = "<span class='quoted'>%s</span>을/를 <span class='quoted'>%s</span>에서 <span class='quoted'>%s</span>(으)로 변경";
$lang['ISSUE_MSG_CONFIRM_UNDO'] = '마지막 변경내용을 취소할까요?'; $lang['ISSUE_MSG_CONFIRM_UNDO'] = '마지막 변경내용을 취소할까요?';
$lang['ISSUE_MSG_CREATED'] = '생성됨';
$lang['ISSUE_MSG_TOTAL_NUM_ISSUES'] = '전체 이슈 %d개'; $lang['ISSUE_MSG_TOTAL_NUM_ISSUES'] = '전체 이슈 %d개';
?> ?>

View File

@ -0,0 +1,11 @@
<?php
$lang['WIKI_ATTACHMENTS'] = '첨부파일';
$lang['WIKI_NEW_ATTACHMENTS'] = '새로운 첨부파일';
$lang['WIKI_MORE_NEW_ATTACHMENTS'] = '첨부파일 추가';
$lang['WIKI_MSG_ATTACHMENT_NAME_NO_COLON'] = '첨부파일이름에 콜론기호가 포함될 수 없습니다';
$lang['WIKI_MSG_FAILED_TO_READ_ATTACHMENT'] = '위키 첨부파일을 읽을 수 없습니다 - %s';
$lang['WIKI_MSG_NO_PAGES_AVAILABLE'] = '위키 페이지가 없습니다';
$lang['WIKI_MSG_NO_SUCH_PAGE'] = '위키 페이지를 찾을수 없습니다 - %s';
$lang['WIKI_MSG_NO_SUCH_ATTACHMENT'] = '위키 첨부파일을 찾을 수 없습니다 - %s';
?>

View File

@ -10,8 +10,9 @@ class LdapLoginModel extends LoginModel
function authenticate ($userid, $password) function authenticate ($userid, $password)
{ {
$ldap = @ldap_connect ( //$ldap = @ldap_connect (
CODEPOT_LDAP_SERVER_HOST, CODEPOT_LDAP_SERVER_PORT); // CODEPOT_LDAP_SERVER_HOST, CODEPOT_LDAP_SERVER_PORT);
$ldap = @ldap_connect (CODEPOT_LDAP_SERVER_URI);
if ($ldap === FALSE) if ($ldap === FALSE)
{ {
$this->setErrorMessage ("Can't connect to LDAP server"); $this->setErrorMessage ("Can't connect to LDAP server");

View File

@ -11,15 +11,41 @@ class WikiModel extends Model
function get ($userid, $project, $name) function get ($userid, $project, $name)
{ {
$this->db->trans_start (); $this->db->trans_start ();
$this->db->where ('projectid', $project->id); $this->db->where ('projectid', $project->id);
$this->db->where ('name', $name); $this->db->where ('name', $name);
$query = $this->db->get ('wiki'); $query = $this->db->get ('wiki');
$this->db->trans_complete (); if ($this->db->trans_status() === FALSE)
{
if ($this->db->trans_status() === FALSE) return FALSE; $this->db->trans_complete ();
return FALSE;
}
$result = $query->result (); $result = $query->result ();
return empty($result)? NULL: $result[0]; if (empty($result))
{
$this->db->trans_complete ();
return NULL;
}
$this->db->select ('name,encname,createdon,createdby');
$this->db->where ('projectid', $project->id);
$this->db->where ('wikiname', $name);
$this->db->order_by ('name', 'ASC');
$query2 = $this->db->get ('wiki_attachment');
if ($this->db->trans_status() === FALSE)
{
$this->db->trans_complete ();
return FALSE;
}
$this->db->trans_complete ();
$wikis = $result[0];
$wikis->attachments = $query2->result();
return $wikis;
} }
function getAll ($userid, $project) function getAll ($userid, $project)
@ -33,20 +59,91 @@ class WikiModel extends Model
return $query->result (); return $query->result ();
} }
function getAttachment ($userid, $project, $wikiname, $name)
{
$this->db->trans_start ();
$this->db->select ('name,encname,createdon,createdby');
$this->db->where ('projectid', $project->id);
$this->db->where ('wikiname', $wikiname);
$this->db->where ('name', $name);
$query = $this->db->get ('wiki_attachment');
$this->db->trans_complete ();
if ($this->db->trans_status() === FALSE) return FALSE;
$result = $query->result ();
if (empty($result)) return NULL;
return $result[0];
}
function getAttachments ($userid, $project, $wikiname)
{
$this->db->trans_start ();
$this->db->select ('name,encname,createdon,createdby');
$this->db->where ('projectid', $project->id);
$this->db->where ('wikiname', $wikiname);
$query = $this->db->get ('wiki_attachment');
$this->db->trans_complete ();
if ($this->db->trans_status() === FALSE) return FALSE;
$result = $query->result ();
return $result;
}
function create ($userid, $wiki) function create ($userid, $wiki)
{ {
// TODO: check if userid can do this.. // TODO: check if userid can do this..
$this->db->trans_start (); $this->db->trans_begin ();
$now = date('Y-m-d H:i:s');
$this->db->set ('projectid', $wiki->projectid); $this->db->set ('projectid', $wiki->projectid);
$this->db->set ('name', $wiki->name); $this->db->set ('name', $wiki->name);
$this->db->set ('text', $wiki->text); $this->db->set ('text', $wiki->text);
$this->db->set ('createdon', date('Y-m-d H:i:s')); $this->db->set ('createdon', $now);
$this->db->set ('updatedon', date('Y-m-d H:i:s')); $this->db->set ('updatedon', $now);
$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')); foreach ($wiki->delete_attachments as $att)
{
$this->db->where ('projectid', $wiki->projectid);
$this->db->where ('wikiname', $wiki->name);
$this->db->where ('name', $att->name);
$this->db->where ('encname', $att->encname);
$this->db->delete ('wiki_attachment');
if ($this->db->trans_status() === FALSE)
{
$this->db->trans_rollback ();
return FALSE;
}
if ($this->db->affected_rows() <= 0)
{
$this->db->trans_rollback ();
return FALSE;
}
}
foreach ($wiki->new_attachments as $att)
{
$this->db->set ('projectid', $wiki->projectid);
$this->db->set ('wikiname', $wiki->name);
$this->db->set ('name', $att['name']);
$this->db->set ('encname', $att['encname']);
$this->db->set ('createdon', $now);
$this->db->set ('createdby', $userid);
$this->db->insert ('wiki_attachment');
}
$this->db->set ('createdon', $now);
$this->db->set ('type', 'wiki'); $this->db->set ('type', 'wiki');
$this->db->set ('action', 'create'); $this->db->set ('action', 'create');
$this->db->set ('projectid', $wiki->projectid); $this->db->set ('projectid', $wiki->projectid);
@ -54,22 +151,63 @@ class WikiModel extends Model
$this->db->set ('message', $wiki->name); $this->db->set ('message', $wiki->name);
$this->db->insert ('log'); $this->db->insert ('log');
$this->db->trans_complete (); if ($this->db->trans_status() === FALSE)
return $this->db->trans_status(); {
$this->db->trans_rollback ();
return FALSE;
}
$this->db->trans_commit ();
return TRUE;
} }
function update ($userid, $wiki) function update ($userid, $wiki)
{ {
// TODO: check if userid can do this.. // TODO: check if userid can do this..
$this->db->trans_start (); $this->db->trans_begin ();
$now = date('Y-m-d H:i:s');
$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->set ('text', $wiki->text); $this->db->set ('text', $wiki->text);
$this->db->set ('updatedon', date('Y-m-d H:i:s')); $this->db->set ('updatedon', $now);
$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')); foreach ($wiki->delete_attachments as $att)
{
$this->db->where ('projectid', $wiki->projectid);
$this->db->where ('wikiname', $wiki->name);
$this->db->where ('name', $att->name);
$this->db->where ('encname', $att->encname);
$this->db->delete ('wiki_attachment');
if ($this->db->trans_status() === FALSE)
{
$this->db->trans_rollback ();
return FALSE;
}
if ($this->db->affected_rows() <= 0)
{
$this->db->trans_rollback ();
return FALSE;
}
}
foreach ($wiki->new_attachments as $att)
{
$this->db->set ('projectid', $wiki->projectid);
$this->db->set ('wikiname', $wiki->name);
$this->db->set ('name', $att['name']);
$this->db->set ('encname', $att['encname']);
$this->db->set ('createdon', $now);
$this->db->set ('createdby', $userid);
$this->db->insert ('wiki_attachment');
}
$this->db->set ('createdon', $now);
$this->db->set ('type', 'wiki'); $this->db->set ('type', 'wiki');
$this->db->set ('action', 'update'); $this->db->set ('action', 'update');
$this->db->set ('projectid', $wiki->projectid); $this->db->set ('projectid', $wiki->projectid);
@ -77,14 +215,25 @@ class WikiModel extends Model
$this->db->set ('message', $wiki->name); $this->db->set ('message', $wiki->name);
$this->db->insert ('log'); $this->db->insert ('log');
$this->db->trans_complete (); if ($this->db->trans_status() === FALSE)
return $this->db->trans_status(); {
$this->db->trans_rollback ();
return FALSE;
}
$this->db->trans_commit ();
return TRUE;
} }
function delete ($userid, $wiki) function delete ($userid, $wiki)
{ {
// TODO: check if userid can do this.. // TODO: check if userid can do this..
$this->db->trans_start (); $this->db->trans_start ();
$this->db->where ('projectid', $wiki->projectid);
$this->db->where ('wikiname', $wiki->name);
$this->db->delete ('wiki_attachment');
$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');

View File

@ -10,9 +10,10 @@
function render_wiki() function render_wiki()
{ {
creole_render_wiki ( creole_render_wiki (
"file_show_textpre", "file_show_mainarea_wiki_text",
"file_show_textarea", "file_show_mainarea_wiki",
"<?=site_url()?>/wiki/show/<?=$project->id?>/" "<?=site_url()?>/wiki/show/<?=$project->id?>/",
"<?=site_url()?>/wiki/attachment0/<?=$project->id?>/"
); );
} }
</script> </script>
@ -76,11 +77,11 @@ $this->load->view (
<div class="mainarea" id="file_show_mainarea"> <div class="mainarea" id="file_show_mainarea">
<div class="title"><?=htmlspecialchars($file->name)?></div> <div class="title"><?=htmlspecialchars($file->name)?></div>
<div id="file_show_textarea"> <div id="file_show_mainarea_wiki">
<pre id="file_show_textpre" style="visibility: hidden"> <pre id="file_show_mainarea_wiki_text" style="visibility: hidden">
<?php print htmlspecialchars($file->description); ?> <?php print htmlspecialchars($file->description); ?>
</pre> </pre>
</div> <!-- file_show_textarea --> </div> <!-- file_show_mainarea_wiki -->
</div> <!-- file_show_mainarea --> </div> <!-- file_show_mainarea -->

View File

@ -109,6 +109,7 @@ $(function () {
$("#issue_show_mainarea_change_form_open").button().click ( $("#issue_show_mainarea_change_form_open").button().click (
function () { function () {
$('#issue_show_mainarea_change_form').dialog('open'); $('#issue_show_mainarea_change_form').dialog('open');
return false;
} }
); );
@ -135,6 +136,7 @@ $(function () {
$("#issue_show_mainarea_undo_change").button().click ( $("#issue_show_mainarea_undo_change").button().click (
function () { function () {
$('#issue_show_mainarea_undo_change_confirm').dialog('open'); $('#issue_show_mainarea_undo_change_confirm').dialog('open');
return false;
} }
); );
@ -234,17 +236,15 @@ $this->load->view (
$msgfmt_changed_from_to = $this->lang->line ('ISSUE_MSG_CHANGED_X_FROM_Y_TO_Z'); $msgfmt_changed_from_to = $this->lang->line ('ISSUE_MSG_CHANGED_X_FROM_Y_TO_Z');
$msgfmt_changed_to = $this->lang->line ('ISSUE_MSG_CHANGED_X_TO_Z'); $msgfmt_changed_to = $this->lang->line ('ISSUE_MSG_CHANGED_X_TO_Z');
$count = count($issue->changes); $count = count($issue->changes);
if ($count > 1)
{ print '<div class="infostrip">';
print '<div class="infostrip">'; print '<span class="title">';
print '<span class="title">'; print $this->lang->line('Change log');
print $this->lang->line('Change log'); print '</span>';
print '</span>'; print '<a id="issue_show_mainarea_undo_change" href="#">';
print '<a id="issue_show_mainarea_undo_change" href="#">'; print $this->lang->line('Undo');
print $this->lang->line('Undo'); print '</a>';
print '</a>'; print '</div>';
print '</div>';
}
print '<table id="issue_show_mainarea_changes_table">'; print '<table id="issue_show_mainarea_changes_table">';
while ($count > 1) while ($count > 1)
@ -252,7 +252,7 @@ $this->load->view (
$new = $issue->changes[--$count]; $new = $issue->changes[--$count];
$old = $issue->changes[$count-1]; $old = $issue->changes[$count-1];
print "<tr>"; print '<tr>';
print '<td class="date">'; print '<td class="date">';
print '<span title="'; print '<span title="';
@ -336,6 +336,26 @@ $this->load->view (
print '</td>'; print '</td>';
print '</tr>'; print '</tr>';
} }
print '<tr>';
print '<td class="date">';
print '<span title="';
print date ('Y-m-d H:s:i', strtotime($issue->createdon));
print '">';
print date ('Y-m-d', strtotime($issue->updatedon));
print '</span>';
print '</td>';
print '<td class="updater">';
print htmlspecialchars($issue->createdby);
print '</td>';
print '<td class="details">';
print $this->lang->line('ISSUE_MSG_CREATED');
print '</td>';
print '</tr>';
print '</table>'; print '</table>';
?> ?>
@ -437,12 +457,16 @@ $this->load->view (
<script type="text/javascript"> <script type="text/javascript">
function render_wiki() function render_wiki()
{ {
<?php $creole_base = site_url() . "/wiki/show/{$project->id}/"; ?> <?php
$creole_base = site_url() . "/wiki/show/{$project->id}/";
$creole_attachment_base = site_url() . "/wiki/attachment0/{$project->id}/";
?>
creole_render_wiki ( creole_render_wiki (
"issue_show_mainarea_description_pre", "issue_show_mainarea_description_pre",
"issue_show_mainarea_description", "issue_show_mainarea_description",
"<?=$creole_base?>" "<?=$creole_base?>",
"<?=$creole_attachment_base?>"
); );
<?php <?php
@ -453,7 +477,8 @@ function render_wiki()
print "creole_render_wiki ( print "creole_render_wiki (
'issue_show_mainarea_changes_comment_pre_{$xxx}', 'issue_show_mainarea_changes_comment_pre_{$xxx}',
'issue_show_mainarea_changes_comment_{$xxx}', 'issue_show_mainarea_changes_comment_{$xxx}',
'{$creole_base}');"; '{$creole_base}',
'{$creole_attachment_base}');";
} }
} }
?> ?>

View File

@ -47,6 +47,7 @@ $(function () {
$("#project_catalog_mainarea_search_button").button().click ( $("#project_catalog_mainarea_search_button").button().click (
function () { function () {
$('#project_catalog_mainarea_search_form').dialog('open'); $('#project_catalog_mainarea_search_form').dialog('open');
return false;
} }
); );
}); });

View File

@ -10,9 +10,10 @@
function render_wiki() function render_wiki()
{ {
creole_render_wiki ( creole_render_wiki (
"project_home_textpre", "project_home_mainarea_wiki_text",
"project_home_textarea", "project_home_mainarea_wiki",
"<?=site_url()?>/wiki/show/<?=$project->id?>/" "<?=site_url()?>/wiki/show/<?=$project->id?>/",
"<?=site_url()?>/wiki/attachment0/<?=$project->id?>/"
); );
} }
</script> </script>
@ -209,11 +210,11 @@ $this->load->view (
<?=htmlspecialchars($project->name)?> <?=htmlspecialchars($project->name)?>
</div> </div>
<div id="project_home_textarea"> <div id="project_home_mainarea_wiki">
<pre id="project_home_textpre" style="visibility: hidden"> <pre id="project_home_mainarea_wiki_text" style="visibility: hidden">
<?php print htmlspecialchars($project->description); ?> <?php print htmlspecialchars($project->description); ?>
</pre> </pre>
</div> <!-- project_home_textarea --> </div> <!-- project_home_mainarea_wiki -->
</div> <!-- project_home_mainarea --> </div> <!-- project_home_mainarea -->

View File

@ -9,9 +9,10 @@
function render_wiki() function render_wiki()
{ {
creole_render_wiki ( creole_render_wiki (
"site_home_mainarea_textpre", "site_home_mainarea_wiki_text",
"site_home_mainarea_text", "site_home_mainarea_wiki",
"<?=site_url()?>/site/wiki/" "<?=site_url()?>/site/wiki/",
"<?=site_url()?>/site/image/"
); );
} }
</script> </script>
@ -204,8 +205,8 @@ foreach ($latest_projects as $project)
</div> <!-- site_home_mainarea_sidebar --> </div> <!-- site_home_mainarea_sidebar -->
<div id="site_home_mainarea_text"> <div id="site_home_mainarea_wiki">
<pre id="site_home_mainarea_textpre" style="visibility: hidden"> <pre id="site_home_mainarea_wiki_text" style="visibility: hidden">
<?php print htmlspecialchars($site->text); ?> <?php print htmlspecialchars($site->text); ?>
</pre> </pre>
</div> <!-- site_home_mainarea_text --> </div> <!-- site_home_mainarea_text -->

View File

@ -9,9 +9,10 @@
function render_wiki() function render_wiki()
{ {
creole_render_wiki ( creole_render_wiki (
"site_show_mainarea_textpre", "site_show_mainarea_wiki_text",
"site_show_mainarea_text", "site_show_mainarea_wiki",
"<?=site_url()?>/site/wiki/" "<?=site_url()?>/site/wiki/",
"<?=site_url()?>/site/image/"
); );
} }
</script> </script>
@ -67,8 +68,8 @@ $this->load->view (
<?=htmlspecialchars($site->name)?> (<?=htmlspecialchars($site->id)?>) <?=htmlspecialchars($site->name)?> (<?=htmlspecialchars($site->id)?>)
</div> </div>
<div id="site_show_mainarea_text"> <div id="site_show_mainarea_wiki">
<pre id="site_show_mainarea_textpre" style="visibility: hidden"> <pre id="site_show_mainarea_wiki_text" style="visibility: hidden">
<?php print htmlspecialchars($site->text); ?> <?php print htmlspecialchars($site->text); ?>
</pre> </pre>
</div> <!-- site_show_mainarea_text --> </div> <!-- site_show_mainarea_text -->

View File

@ -4,6 +4,28 @@
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<link type="text/css" rel="stylesheet" href="<?=base_url()?>/css/common.css" /> <link type="text/css" rel="stylesheet" href="<?=base_url()?>/css/common.css" />
<link type="text/css" rel="stylesheet" href="<?=base_url()?>/css/wiki.css" /> <link type="text/css" rel="stylesheet" href="<?=base_url()?>/css/wiki.css" />
<script type="text/javascript" src="<?=base_url()?>/js/jquery.min.js"></script>
<script type="text/javascript" src="<?=base_url()?>/js/jquery-ui.min.js"></script>
<link type="text/css" rel="stylesheet" href="<?=base_url()?>/css/jquery-ui.css" />
<script type="text/javascript">
var new_attachment_no = 0;
$(function () {
$('#wiki_edit_more_new_attachment').button().click (
function () {
var html = [
'<li><input type="file" name="wiki_new_attachment_',
++new_attachment_no,
'" /></li>'
].join("");
$('#wiki_edit_new_attachment_list').append (html);
return false;
}
);
});
</script>
<title><?=htmlspecialchars($wiki->name)?></title> <title><?=htmlspecialchars($wiki->name)?></title>
</head> </head>
@ -40,7 +62,7 @@ $this->load->view (
<?php if ($message != "") print '<div id="wiki_edit_message" class="form_message">'.htmlspecialchars($message).'</div>'; ?> <?php if ($message != "") print '<div id="wiki_edit_message" class="form_message">'.htmlspecialchars($message).'</div>'; ?>
<?=form_open("wiki/{$mode}/{$project->id}/".$this->converter->AsciiToHex($wiki->name))?> <?=form_open_multipart("wiki/{$mode}/{$project->id}/".$this->converter->AsciiToHex($wiki->name))?>
<?=form_fieldset()?> <?=form_fieldset()?>
<div> <div>
<div> <div>
@ -75,6 +97,52 @@ $this->load->view (
</div> </div>
</div> </div>
<?php if (!empty($wiki->attachments)): ?>
<div>
<div>
<?=form_label($this->lang->line('WIKI_ATTACHMENTS').': ', 'wiki_edit_attachment_list')?>
<?=form_error('wiki_attachment_list');?>
</div>
<ul id='wiki_edit_attachment_list'>
<?php
foreach ($wiki->attachments as $att)
{
$hexattname =
$this->converter->AsciiToHex($att->name) .
'@' .
$this->converter->AsciiToHex($att->encname);
$escattname = htmlspecialchars($att->name);
print '<li>';
print "<input type='checkbox' name='wiki_delete_attachment[]' value='{$hexattname}' title='Check to delete {$escattname}'/>";
print $escattname;
print '</li>';
}
?>
</ul>
</div>
<?php endif; ?>
<div>
<div>
<?=form_label($this->lang->line('WIKI_NEW_ATTACHMENTS').': ', 'wiki_edit_new_attachment_list')?>
<a href='#' id='wiki_edit_more_new_attachment'>
<?=$this->lang->line('WIKI_MORE_NEW_ATTACHMENTS')?>
</a>
<?=form_error('wiki_edit_new_attachment_list');?>
</div>
<ul id='wiki_edit_new_attachment_list'>
<li>
<input type='file' name='wiki_new_attachment_0' />
<!--<input type='checkbox' name='wiki_delete_attachment[]' value='delete'/>Delete-->
</li>
</ul>
</div>
<div> <div>
<?=form_hidden('wiki_projectid', set_value('wiki_projectid', $wiki->projectid))?> <?=form_hidden('wiki_projectid', set_value('wiki_projectid', $wiki->projectid))?>
</div> </div>

View File

@ -45,7 +45,7 @@ $this->load->view (
<?php <?php
if (empty($wikis)) if (empty($wikis))
{ {
print $this->lang->line('MSG_NO_WIKIS_AVAIL'); print $this->lang->line('WIKI_MSG_NO_PAGES_AVAILABLE');
} }
else else
{ {

View File

@ -8,14 +8,19 @@
<title><?=htmlspecialchars($wiki->name)?></title> <title><?=htmlspecialchars($wiki->name)?></title>
</head> </head>
<?php
$hexname = $this->converter->AsciiToHex ($wiki->name);
?>
<script type="text/javascript"> <script type="text/javascript">
function render_wiki() function render_wiki()
{ {
creole_render_wiki ( creole_render_wiki (
"wiki_show_textpre", "wiki_show_mainarea_wiki_text",
"wiki_show_textarea", "wiki_show_mainarea_wiki",
"<?=site_url()?>/wiki/show/<?=$project->id?>/" "<?=site_url()?>/wiki/show/<?=$project->id?>/",
"<?=site_url()?>/wiki/attachment/<?=$project->id?>/<?=$hexname?>/"
); );
} }
</script> </script>
@ -31,7 +36,6 @@ function render_wiki()
<!----------------------------------------------------------------------------> <!---------------------------------------------------------------------------->
<?php <?php
$hexname = $this->converter->AsciiToHex ($wiki->name);
$this->load->view ( $this->load->view (
'projectbar', 'projectbar',
array ( array (
@ -62,16 +66,37 @@ $this->load->view (
<li><?=$this->lang->line('Last updated by')?> <?= $wiki->updatedby ?></li> <li><?=$this->lang->line('Last updated by')?> <?= $wiki->updatedby ?></li>
</ul> </ul>
</div> </div>
<?php if (!empty($wiki->attachments)): ?>
<div class="box">
<div class="boxtitle"><?= $this->lang->line('WIKI_ATTACHMENTS') ?></div>
<ul>
<?php
foreach ($wiki->attachments as $att)
{
$hexattname = $this->converter->AsciiToHex ($att->name);
print '<li>';
print anchor (
"wiki/attachment/{$project->id}/{$hexname}/{$hexattname}",
htmlspecialchars($att->name)
);
print '</li>';
}
?>
</ul>
</div>
<?php endif; ?>
</div> </div>
<div class="mainarea" id="wiki_show_mainarea"> <div class="mainarea" id="wiki_show_mainarea">
<div class="title"><?=htmlspecialchars($wiki->name)?></div> <div class="title"><?=htmlspecialchars($wiki->name)?></div>
<div id="wiki_show_textarea"> <div id="wiki_show_mainarea_wiki">
<pre id="wiki_show_textpre" style="visibility: hidden"> <pre id="wiki_show_mainarea_wiki_text" style="visibility: hidden">
<?php print htmlspecialchars($wiki->text); ?> <?php print htmlspecialchars($wiki->text); ?>
</pre> </pre>
</div> <!-- wiki_show_textarea --> </div> <!-- wiki_show_mainarea_wiki -->
</div> <!-- wiki_show_mainarea --> </div> <!-- wiki_show_mainarea -->

View File

@ -47,8 +47,7 @@ function load_ini ($file)
array ('auth_mysql_name', 'string', ''), array ('auth_mysql_name', 'string', ''),
array ('auth_mysql_prefix', 'string', ''), array ('auth_mysql_prefix', 'string', ''),
array ('ldap_server_host', 'string', '127.0.0.1'), array ('ldap_server_uri', 'string', 'ldap://127.0.0.1:389'),
array ('ldap_server_port', 'integer', 389),
array ('ldap_server_protocol_version', 'integer', 3), array ('ldap_server_protocol_version', 'integer', 3),
array ('ldap_userid_format', 'string', '${userid}'), array ('ldap_userid_format', 'string', '${userid}'),
array ('ldap_password_format', 'string', '${password}'), array ('ldap_password_format', 'string', '${password}'),
@ -58,6 +57,7 @@ function load_ini ($file)
array ('svnrepo_dir', 'string', CODEPOT_DEPOT_DIR.'/svnrepo'), array ('svnrepo_dir', 'string', CODEPOT_DEPOT_DIR.'/svnrepo'),
array ('file_dir', 'string', CODEPOT_DEPOT_DIR.'/files'), array ('file_dir', 'string', CODEPOT_DEPOT_DIR.'/files'),
array ('attachment_dir', 'string', CODEPOT_DEPOT_DIR.'/attachments'),
array ('log_threshold', 'integer', 0), array ('log_threshold', 'integer', 0),

View File

@ -284,6 +284,11 @@ body {
.content .mainarea p.wiki { .content .mainarea p.wiki {
/* use the default for normal cases */ /* use the default for normal cases */
overflow: auto;
}
.content .mainarea p.wiki img {
max-width: 100%;
} }
.content .mainarea table p.wiki { .content .mainarea table p.wiki {

View File

@ -10,3 +10,4 @@
white-space: nowrap; white-space: nowrap;
} }

View File

@ -156,6 +156,7 @@
padding-top: 0.2em; padding-top: 0.2em;
padding-bottom: 0.2em; padding-bottom: 0.2em;
border-bottom: 1px solid lightgray; border-bottom: 1px solid lightgray;
overflow: auto;
} }
#issue_show_mainarea_changes_table td.details .list { #issue_show_mainarea_changes_table td.details .list {

View File

@ -44,9 +44,21 @@
white-space: pre-wrap; white-space: pre-wrap;
} }
/*-----------------------------------------------
* site show view
*-----------------------------------------------*/
#site_show_mainarea_text p.wiki {
overflow: auto;
}
#site_show_mainarea_text img {
max-width: 100%;
}
/*----------------------------------------------- /*-----------------------------------------------
* site edit view * site edit view
*-----------------------------------------------*/ *-----------------------------------------------*/
#site_edit_form .text { #site_edit_form .text {
width: 100%; width: 100%;
} }

View File

@ -5,3 +5,4 @@
#wiki_edit_mainarea_text { #wiki_edit_mainarea_text {
width: 100%; width: 100%;
} }

View File

@ -342,7 +342,19 @@ var Url = {
img: { regex: rx.img, img: { regex: rx.img,
build: function(node, r, options) { build: function(node, r, options) {
var img = document.createElement('img'); var img = document.createElement('img');
img.src = r[1];
if (r[1].match(rx.uriPrefix))
{
img.src = r[1];
}
else
{
var tmp = r[1].replace(/~(.)/g, '$1');
tmp = Url.encode (tmp);
img.src = options && options.imgFormat?
formatLink (tmp, options.imgFormat): tmp;
}
img.alt = r[2] === undefined img.alt = r[2] === undefined
? (options && options.defaultImageText ? options.defaultImageText : '') ? (options && options.defaultImageText ? options.defaultImageText : '')
: r[2].replace(/~(.)/g, '$1'); : r[2].replace(/~(.)/g, '$1');
@ -474,7 +486,7 @@ Parse.Simple.Creole.prototype = new Parse.Simple.Base();
Parse.Simple.Creole.prototype.constructor = Parse.Simple.Creole; Parse.Simple.Creole.prototype.constructor = Parse.Simple.Creole;
function creole_render_wiki (inputid, outputid, linkbase) function creole_render_wiki (inputid, outputid, linkbase, imgbase)
{ {
function $(id) { return document.getElementById(id); } function $(id) { return document.getElementById(id); }
@ -495,7 +507,8 @@ function creole_render_wiki (inputid, outputid, linkbase)
WikiCreole: 'http://www.wikicreole.org/wiki/', WikiCreole: 'http://www.wikicreole.org/wiki/',
Wikipedia: 'http://en.wikipedia.org/wiki/' Wikipedia: 'http://en.wikipedia.org/wiki/'
},*/ },*/
linkFormat: linkbase linkFormat: linkbase,
imgFormat: imgbase
} ); } );
var xinput = decodeEntities(input.innerHTML); var xinput = decodeEntities(input.innerHTML);