mirror of
https://github.com/jimeh/dlist.git
synced 2026-02-19 07:56:41 +00:00
updated handling of long filenames in icons views of "simple" and "slik" templates, and modified output functions in exec/output.exec.php.
git-svn-id: file:///Users/jimeh/Desktop/dlist/trunk@28 a5845835-ea0f-0410-a762-dd0bfe9bfde8
This commit is contained in:
@@ -86,21 +86,25 @@ class Path {
|
|||||||
return $r_files;
|
return $r_files;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
//>Section> path_breakFilename
|
||||||
//>Section> path_wordwrap
|
function breakFilename ($input, $maxlength, $wordbreak = 16) {
|
||||||
function wordbreak ($input, $length, $break=" ") {
|
|
||||||
if (preg_match("/(.*)\.(.*)/", $input, $preg) ) {
|
if ( $wordbreak != false ) {
|
||||||
$words = explode(' ', $preg[1]);
|
if (preg_match("/(.*)\.(.*)/", $input, $preg) ) {
|
||||||
$ext = '.'.$preg[2];
|
$words = explode(' ', $preg[1]);
|
||||||
} else {
|
$ext = '.'.$preg[2];
|
||||||
$words = explode(' ', $input);
|
} else {
|
||||||
$ext = '';
|
$words = explode(' ', $input);
|
||||||
|
$ext = '';
|
||||||
|
}
|
||||||
|
foreach( $words as $key => $value ) {
|
||||||
|
$words[$key] = wordwrap($value, $wordbreak, ' ', 1);
|
||||||
|
}
|
||||||
|
$input = implode(' ', $words).$ext;
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach( $words as $key => $value ) {
|
if ( strlen($input) > $maxlength ) return rtrim(substr($input, 0, $maxlength)).'...';
|
||||||
$words[$key] = wordwrap($value, $length, $break, 1);
|
return $input;
|
||||||
}
|
|
||||||
return implode(' ', $words).$ext;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//>Section> path_class.end
|
//>Section> path_class.end
|
||||||
|
|||||||
@@ -10,7 +10,7 @@
|
|||||||
<li><a href="../"><p class="icon"><img src="<?=Icon::get_parent('large')?>" alt="" /></p><p class="name">..</p><p class="info"><?=$lang->parent_dir?></p></a></li>
|
<li><a href="../"><p class="icon"><img src="<?=Icon::get_parent('large')?>" alt="" /></p><p class="name">..</p><p class="info"><?=$lang->parent_dir?></p></a></li>
|
||||||
<? endif ?>
|
<? endif ?>
|
||||||
<? foreach ($dlist->list as $key => $item): $info = ($item['type'] == 'file') ? $item['size'] : $item['mtime'] ;?>
|
<? foreach ($dlist->list as $key => $item): $info = ($item['type'] == 'file') ? $item['size'] : $item['mtime'] ;?>
|
||||||
<li><a href="<?=rawurlencode($item['name'])?><? if($item['type'] == 'dir') echo '/'; ?>"><p class="icon"><img src="<?=Icon::get_url($item['name'], 'large', $item['type'], true)?>" alt="" /></p><p class="name"><?=Path::wordbreak($item['name'], 24, "\n", 1)?></p><p class="info"><?=$info?></p></a></li>
|
<li><a href="<?=urlencode($item['name'])?><? if($item['type'] == 'dir') echo '/'; ?>" title="<?=$item['name']?>"><p class="icon"><img src="<?=Icon::get_url($item['name'], 'large', $item['type'], true)?>" alt="" /></p><p class="name"><?=Path::breakFilename($item['name'], $config->tpl_file_maxlength, $config->tpl_wordbreak)?></p><p class="info"><?=$info?></p></a></li>
|
||||||
<? endforeach ?>
|
<? endforeach ?>
|
||||||
</ul>
|
</ul>
|
||||||
</td></tr></table>
|
</td></tr></table>
|
||||||
@@ -5,6 +5,10 @@
|
|||||||
# default mode
|
# default mode
|
||||||
'mode' => 'icons',
|
'mode' => 'icons',
|
||||||
|
|
||||||
|
# icon mode filename handling
|
||||||
|
'file_maxlength' => 32,
|
||||||
|
'wordbreak' => 16,
|
||||||
|
|
||||||
# available modes
|
# available modes
|
||||||
'modes' => array(
|
'modes' => array(
|
||||||
'details' => '_details.phtml',
|
'details' => '_details.phtml',
|
||||||
|
|||||||
@@ -21,7 +21,7 @@
|
|||||||
<?=$lang->group_id?>: <?=$item['group_id']?><br /><? endif; ?>
|
<?=$lang->group_id?>: <?=$item['group_id']?><br /><? endif; ?>
|
||||||
</span>
|
</span>
|
||||||
<p class="p"><img src="<?=Icon::get_url($item['name'], 'large', $item['type'], true)?>" alt="" /></p>
|
<p class="p"><img src="<?=Icon::get_url($item['name'], 'large', $item['type'], true)?>" alt="" /></p>
|
||||||
<p class="n"><?=Path::wordbreak($item['name'], $config->tpl_wordbreak, "\n", 1)?></p>
|
<p class="n"><?=Path::breakFilename($item['name'], $config->tpl_file_maxlength, $config->tpl_wordbreak)?></p>
|
||||||
<p class="i"><?=$info?></p>
|
<p class="i"><?=$info?></p>
|
||||||
</a>
|
</a>
|
||||||
</li><? $n++; endforeach; ?>
|
</li><? $n++; endforeach; ?>
|
||||||
|
|||||||
@@ -8,7 +8,9 @@
|
|||||||
// Icons view settings
|
// Icons view settings
|
||||||
'file_info' => 'size',
|
'file_info' => 'size',
|
||||||
'folder_info' => 'mtime',
|
'folder_info' => 'mtime',
|
||||||
'wordbreak' => 18,
|
'file_maxlength' => 32,
|
||||||
|
'wordbreak' => 16,
|
||||||
|
|
||||||
|
|
||||||
'preview_width' => 175,
|
'preview_width' => 175,
|
||||||
'preview_height' => 175,
|
'preview_height' => 175,
|
||||||
|
|||||||
Reference in New Issue
Block a user