Show full filename on mouseover.

This commit is contained in:
Savetheinternet 2011-10-01 22:12:31 +10:00
parent d62f0ee046
commit 339853e5de
6 changed files with 32 additions and 9 deletions

View File

@ -120,6 +120,10 @@
$config['body_truncate'] = 15;
// Amount of characters to show on the index page
$config['body_truncate_char'] = 2500;
// Maximum filename length (will be truncated)
$config['max_filename_len'] = 255;
// Maximum filename length to display (the rest can be viewed upon mouseover)
$config['max_filename_display'] = 30;
$config['threads_per_page'] = 10;
$config['max_pages'] = 10;

View File

@ -352,7 +352,14 @@
}
if($config['show_filename']) {
// Filename
$built .= ', ' . $this->filename;
$built .= ', ' .
(strlen($this->filename) > $config['max_filename_display'] ?
'<span title="' . $this->filename . '">' .
substr($this->filename, 0, $config['max_filename_display']) . '&hellip;' .
'</span>'
:
$this->filename
);
}
$built .= ')</span></p>' .
@ -511,7 +518,14 @@
}
if($config['show_filename']) {
// Filename
$built .= ', ' . $this->filename;
$built .= ', ' .
(strlen($this->filename) > $config['max_filename_display'] ?
'<span title="' . $this->filename . '">' .
substr($this->filename, 0, $config['max_filename_display']) . '&hellip;' .
'</span>'
:
$this->filename
);
}
$built .= ')</span></p>' .

View File

@ -1,6 +1,6 @@
<?php
// Installation/upgrade file
define('VERSION', 'v0.9.3-dev-7');
define('VERSION', 'v0.9.3-dev-8');
require 'inc/functions.php';
require 'inc/display.php';
@ -102,8 +102,13 @@
}
foreach($tables as &$table) {
query("ALTER TABLE `{$table}` ENGINE = MYISAM DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci");
}
query("ALTER TABLE `{$table}` ENGINE = MYISAM DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci") or error(db_error());
}
case 'v0.9.3-dev-7':
$boards = listBoards();
foreach($boards as &$board) {
query(sprintf("ALTER TABLE `posts_%s` CHANGE `filename` `filename` TEXT CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL", $board['uri'])) or error(db_error());
}
case false:
// Update version number
file_write($config['has_installed'], VERSION);

View File

@ -202,7 +202,7 @@ CREATE TABLE IF NOT EXISTS `posts_b` (
`filewidth` int(11) DEFAULT NULL,
`fileheight` int(11) DEFAULT NULL,
`filesize` int(11) DEFAULT NULL,
`filename` varchar(30) DEFAULT NULL,
`filename` text DEFAULT NULL,
`filehash` text DEFAULT NULL,
`password` varchar(20) DEFAULT NULL,
`ip` varchar(45) NOT NULL,

View File

@ -413,8 +413,8 @@
$is_an_image = !in_array($post['extension'], $config['allowed_ext_files']);
// Just trim the filename if it's too long
if(strlen($post['filename']) > 30) $post['filename'] = substr($post['filename'], 0, 27).'…';
// Truncate filename if it is too long
$post['filename'] = substr($post['filename'], 0, $config['max_filename_len']);
// Move the uploaded file
if(!@move_uploaded_file($_FILES['file']['tmp_name'], $post['file'])) error($config['error']['nomove']);

View File

@ -16,7 +16,7 @@ CREATE TABLE IF NOT EXISTS `posts_{board}` (
`filewidth` int(11) DEFAULT NULL,
`fileheight` int(11) DEFAULT NULL,
`filesize` int(11) DEFAULT NULL,
`filename` varchar(30) DEFAULT NULL,
`filename` text DEFAULT NULL,
`filehash` text DEFAULT NULL,
`password` varchar(20) DEFAULT NULL,
`ip` varchar(45) NOT NULL,