* 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@/svnrepo"
$(INSTALL) -d "$(DESTDIR)@DEPOTDIR@/files"
$(INSTALL) -d "$(DESTDIR)@DEPOTDIR@/attachments"
$(INSTALL) -d "$(DESTDIR)@LOGDIR@"
$(INSTALL) -d "$(DESTDIR)@CACHEDIR@"
uninstall-hook:
$(RMDIR) "$(DESTDIR)@DEPOTDIR@/svnrepo"
$(RMDIR) "$(DESTDIR)@DEPOTDIR@/attachments"
$(RMDIR) "$(DESTDIR)@DEPOTDIR@/files"
$(RMDIR) "$(DESTDIR)@DEPOTDIR@/svnrepo"
$(RMDIR) "$(DESTDIR)@DEPOTDIR@"
$(RMDIR) "$(DESTDIR)@LOGDIR@"
$(RMDIR) "$(DESTDIR)@CACHEDIR@"

View File

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

View File

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

View File

@ -50,6 +50,24 @@ CREATE TABLE wiki (
ON DELETE RESTRICT ON UPDATE CASCADE
) 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 (
projectid VARCHAR(32) NOT NULL,
id BIGINT NOT NULL,

View File

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

View File

@ -302,9 +302,8 @@ class File extends Controller
$md5sum = md5_file ($upload['full_path']);
if ($md5sum === FALSE)
{
unlink (CODEPOT_FILE_DIR . "/{$file->encname}");
$data['message'] = "CANNOT GET MD5SUM OF FILE - {$file->name}";
@unlink ($upload['full_path']);
$data['message'] = "CANNOT GET MD5SUM - {$file->name}";
$data['file'] = $file;
$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->lang->load ('common', CODEPOT_LANG);
$this->lang->load ('wiki', CODEPOT_LANG);
}
function home ($projectid = '')
@ -98,7 +98,8 @@ class Wiki extends Controller
}
else
{
$link = $this->wikihelper->parseLink ($name, $projectid, $this->converter);
$link = $this->wikihelper->parseLink (
$name, $projectid, $this->converter);
if ($link === FALSE)
{
$data['project'] = $project;
@ -132,9 +133,8 @@ class Wiki extends Controller
else
{
$data['project'] = $project;
$data['message'] =
$this->lang->line('MSG_NO_SUCH_WIKI_PAGE') .
" - {$name}";
$data['message'] = sprintf (
$this->lang->line('WIKI_MSG_NO_SUCH_PAGE'), $name);
$this->load->view ($this->VIEW_ERROR, $data);
}
}
@ -157,10 +157,126 @@ class Wiki extends Controller
$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)
{
$this->load->helper ('form');
$this->load->library ('form_validation');
$this->load->library ('upload');
$this->load->model ('ProjectModel', 'projects');
$this->load->model ('WikiModel', 'wikis');
@ -208,9 +324,39 @@ class Wiki extends Controller
if ($this->input->post('wiki'))
{
$wiki->projectid = $this->input->post('wiki_projectid');
$wiki->name = $this->input->post('wiki_name');
$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->wikihelper->_is_reserved ($wiki->name, FALSE))
@ -221,17 +367,38 @@ class Wiki extends Controller
}
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')?
$this->wikis->update ($login['id'], $wiki):
$this->wikis->create ($login['id'], $wiki);
if ($result === FALSE)
{
foreach ($extra as $att)
@unlink ($att['fullencpath']);
$data['message'] = 'DATABASE ERROR';
$data['wiki'] = $wiki;
$this->load->view ($this->VIEW_EDIT, $data);
}
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}/" .
$this->converter->AsciiToHex($wiki->name));
}
@ -257,7 +424,7 @@ class Wiki extends Controller
else if ($wiki == NULL)
{
$data['message'] =
$this->lang->line('MSG_NO_SUCH_WIKI_PAGE') .
$this->lang->line('WIKI_MSG_NO_SUCH_PAGE') .
" - {$name}";
$this->load->view ($this->VIEW_ERROR, $data);
}
@ -383,9 +550,8 @@ class Wiki extends Controller
}
else if ($wiki === NULL)
{
$data['message'] =
$this->lang->line('MSG_NO_SUCH_WIKI_PAGE') .
" - {$name}";
$data['message'] = sprintf (
$this->lang->line('WIKI_MSG_NO_SUCH_PAGE'), $name);
$this->load->view ($this->VIEW_ERROR, $data);
}
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 \
index.html \
project_lang.php \
site_lang.php
site_lang.php \
wiki_lang.php
EXTRA_DIST = $(www_DATA)

View File

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

View File

@ -1,6 +1,8 @@
<?php
$lang['Administration'] = 'Administration';
$lang['All'] = 'All';
$lang['Attachment'] = 'Attachment';
$lang['Attachments'] = 'Attachments';
$lang['Author'] = 'Author';
$lang['Blame'] = 'Blame';
$lang['Cancel'] = 'Cancel';
@ -41,6 +43,7 @@ $lang['MD5'] = 'MD5';
$lang['Member'] = 'Member';
$lang['Members'] = 'Members';
$lang['Message'] = 'Message';
$lang['More'] = 'More';
$lang['My issues'] = 'My issues';
$lang['My projects'] = 'My projects';
$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_ISSUE'] = 'No such issue';
$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";
?>

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_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_CREATED'] = 'Created';
$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_ISSUE'] = 'No such issue';
$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";
?>

View File

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

View File

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

View File

@ -1,6 +1,8 @@
<?php
$lang['Administration'] = '관리';
$lang['All'] = '모두';
$lang['Attachment'] = '첨부';
$lang['Attachments'] = '첨부';
$lang['Author'] = '저자';
$lang['Blame'] = '책임전가';
$lang['Cancel'] = '취소';
@ -41,6 +43,7 @@ $lang['MD5'] = 'MD5';
$lang['Member'] = '구성원';
$lang['Members'] = '구성원';
$lang['Message'] = '메시지';
$lang['More'] = '더';
$lang['My issues'] = '내 이슈';
$lang['My projects'] = '내 프로젝트';
$lang['Name'] = '이름';
@ -93,7 +96,5 @@ $lang['MSG_NO_ISSUES_AVAIL'] = '이슈항목이 없습니다';
$lang['MSG_NO_SUCH_FILE'] = '파일이 없습니다';
$lang['MSG_NO_SUCH_ISSUE'] = '이슈항목이 없습니다';
$lang['MSG_NO_SUCH_PROJECT'] = '프로젝트가 없습니다';
$lang['MSG_NO_SUCH_WIKI_PAGE'] = '위키페이지가 없습니다';
$lang['MSG_NO_WIKIS_AVAIL'] = '사용가능한 위키페이지가 없습니다';
$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_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_CREATED'] = '생성됨';
$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)
{
$ldap = @ldap_connect (
CODEPOT_LDAP_SERVER_HOST, CODEPOT_LDAP_SERVER_PORT);
//$ldap = @ldap_connect (
// CODEPOT_LDAP_SERVER_HOST, CODEPOT_LDAP_SERVER_PORT);
$ldap = @ldap_connect (CODEPOT_LDAP_SERVER_URI);
if ($ldap === FALSE)
{
$this->setErrorMessage ("Can't connect to LDAP server");

View File

@ -11,15 +11,41 @@ class WikiModel extends Model
function get ($userid, $project, $name)
{
$this->db->trans_start ();
$this->db->where ('projectid', $project->id);
$this->db->where ('name', $name);
$query = $this->db->get ('wiki');
$this->db->trans_complete ();
if ($this->db->trans_status() === FALSE) return FALSE;
if ($this->db->trans_status() === FALSE)
{
$this->db->trans_complete ();
return FALSE;
}
$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)
@ -33,20 +59,91 @@ class WikiModel extends Model
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)
{
// 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 ('name', $wiki->name);
$this->db->set ('text', $wiki->text);
$this->db->set ('createdon', date('Y-m-d H:i:s'));
$this->db->set ('updatedon', date('Y-m-d H:i:s'));
$this->db->set ('createdon', $now);
$this->db->set ('updatedon', $now);
$this->db->set ('createdby', $userid);
$this->db->set ('updatedby', $userid);
$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 ('action', 'create');
$this->db->set ('projectid', $wiki->projectid);
@ -54,22 +151,63 @@ class WikiModel extends Model
$this->db->set ('message', $wiki->name);
$this->db->insert ('log');
$this->db->trans_complete ();
return $this->db->trans_status();
if ($this->db->trans_status() === FALSE)
{
$this->db->trans_rollback ();
return FALSE;
}
$this->db->trans_commit ();
return TRUE;
}
function update ($userid, $wiki)
{
// 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 ('name', $wiki->name);
$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->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 ('action', 'update');
$this->db->set ('projectid', $wiki->projectid);
@ -77,14 +215,25 @@ class WikiModel extends Model
$this->db->set ('message', $wiki->name);
$this->db->insert ('log');
$this->db->trans_complete ();
return $this->db->trans_status();
if ($this->db->trans_status() === FALSE)
{
$this->db->trans_rollback ();
return FALSE;
}
$this->db->trans_commit ();
return TRUE;
}
function delete ($userid, $wiki)
{
// TODO: check if userid can do this..
$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 ('name', $wiki->name);
$this->db->delete ('wiki');

View File

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

View File

@ -109,6 +109,7 @@ $(function () {
$("#issue_show_mainarea_change_form_open").button().click (
function () {
$('#issue_show_mainarea_change_form').dialog('open');
return false;
}
);
@ -135,6 +136,7 @@ $(function () {
$("#issue_show_mainarea_undo_change").button().click (
function () {
$('#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_to = $this->lang->line ('ISSUE_MSG_CHANGED_X_TO_Z');
$count = count($issue->changes);
if ($count > 1)
{
print '<div class="infostrip">';
print '<span class="title">';
print $this->lang->line('Change log');
print '</span>';
print '<a id="issue_show_mainarea_undo_change" href="#">';
print $this->lang->line('Undo');
print '</a>';
print '</div>';
}
print '<div class="infostrip">';
print '<span class="title">';
print $this->lang->line('Change log');
print '</span>';
print '<a id="issue_show_mainarea_undo_change" href="#">';
print $this->lang->line('Undo');
print '</a>';
print '</div>';
print '<table id="issue_show_mainarea_changes_table">';
while ($count > 1)
@ -252,7 +252,7 @@ $this->load->view (
$new = $issue->changes[--$count];
$old = $issue->changes[$count-1];
print "<tr>";
print '<tr>';
print '<td class="date">';
print '<span title="';
@ -336,6 +336,26 @@ $this->load->view (
print '</td>';
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>';
?>
@ -437,12 +457,16 @@ $this->load->view (
<script type="text/javascript">
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 (
"issue_show_mainarea_description_pre",
"issue_show_mainarea_description",
"<?=$creole_base?>"
"<?=$creole_base?>",
"<?=$creole_attachment_base?>"
);
<?php
@ -453,7 +477,8 @@ function render_wiki()
print "creole_render_wiki (
'issue_show_mainarea_changes_comment_pre_{$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 (
function () {
$('#project_catalog_mainarea_search_form').dialog('open');
return false;
}
);
});

View File

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

View File

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

View File

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

View File

@ -4,6 +4,28 @@
<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/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>
</head>
@ -40,7 +62,7 @@ $this->load->view (
<?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()?>
<div>
<div>
@ -74,6 +96,52 @@ $this->load->view (
?>
</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>
<?=form_hidden('wiki_projectid', set_value('wiki_projectid', $wiki->projectid))?>

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -44,9 +44,21 @@
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_form .text {
width: 100%;
}

View File

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

View File

@ -342,7 +342,19 @@ var Url = {
img: { regex: rx.img,
build: function(node, r, options) {
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
? (options && options.defaultImageText ? options.defaultImageText : '')
: 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;
function creole_render_wiki (inputid, outputid, linkbase)
function creole_render_wiki (inputid, outputid, linkbase, imgbase)
{
function $(id) { return document.getElementById(id); }
@ -495,7 +507,8 @@ function creole_render_wiki (inputid, outputid, linkbase)
WikiCreole: 'http://www.wikicreole.org/wiki/',
Wikipedia: 'http://en.wikipedia.org/wiki/'
},*/
linkFormat: linkbase
linkFormat: linkbase,
imgFormat: imgbase
} );
var xinput = decodeEntities(input.innerHTML);