mirror of
https://github.com/jimeh/dlist.git
synced 2026-02-19 07:56:41 +00:00
- added language selection support to simple template, and the backend for it in language.exc.php
only need to get thumbnails working, and make a fully featured web 2.0/6.3/whatever template and dList should be ready for its initial public release. git-svn-id: file:///Users/jimeh/Desktop/dlist/trunk@14 a5845835-ea0f-0410-a762-dd0bfe9bfde8
This commit is contained in:
@@ -27,12 +27,19 @@ $config = array(
|
|||||||
# show hidden files & folders who's names begin with . (dot)
|
# show hidden files & folders who's names begin with . (dot)
|
||||||
'show_hidden' => false,
|
'show_hidden' => false,
|
||||||
|
|
||||||
|
# what info to show for each file/folder, valid values are:
|
||||||
|
# name, size, mtime, perms, chmod, owner, ownerid, group, groupid, ext
|
||||||
|
'fields' => 'name,size,mtime,perms,owner',
|
||||||
|
|
||||||
// Display settings
|
// Display settings
|
||||||
|
|
||||||
# if the corresponding language file can't be found
|
# if the corresponding language file can't be found
|
||||||
# dList will default to english.
|
# dList will default to english.
|
||||||
'language' => 'english',
|
'language' => 'english',
|
||||||
|
|
||||||
|
# name of the cookie dList will check for language settings per user
|
||||||
|
'lang_cookie' => 'dList_language',
|
||||||
|
|
||||||
# Smart Date shows relative time stamps ("Yesterday, 09:34") when applicable
|
# Smart Date shows relative time stamps ("Yesterday, 09:34") when applicable
|
||||||
'smartdate' => true,
|
'smartdate' => true,
|
||||||
|
|
||||||
|
|||||||
@@ -24,6 +24,7 @@ class Icon {
|
|||||||
|
|
||||||
//>Section> get_url
|
//>Section> get_url
|
||||||
function get_url ($ext, $size, $type) {
|
function get_url ($ext, $size, $type) {
|
||||||
|
//TODO enable thumbnail support using phpThumbs
|
||||||
global $config;
|
global $config;
|
||||||
if ( $size == 'large' || $size == 'big' ) {
|
if ( $size == 'large' || $size == 'big' ) {
|
||||||
$size = $config->icons_large;
|
$size = $config->icons_large;
|
||||||
|
|||||||
@@ -15,20 +15,36 @@ Author: Jim Myhrberg
|
|||||||
*/
|
*/
|
||||||
//_SCRIPT;
|
//_SCRIPT;
|
||||||
|
|
||||||
|
//==========================
|
||||||
|
//>STAGE> functions
|
||||||
|
//==========================
|
||||||
|
|
||||||
|
|
||||||
|
function installed_languages () {
|
||||||
|
$return = glob('languages/*.lang.php');
|
||||||
|
foreach( $return as $key => $value ) {
|
||||||
|
$return[$key] = preg_replace("/languages\/(.*)\.lang\.php/", "$1", $value);
|
||||||
|
}
|
||||||
|
return $return;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
//==========================
|
//==========================
|
||||||
//>STAGE> init
|
//>STAGE> init
|
||||||
//==========================
|
//==========================
|
||||||
|
|
||||||
|
|
||||||
//>Section> init:10
|
//>Section> init:10
|
||||||
if ( empty($config->language) ) $config->language = 'english';
|
if ( !empty($_REQUEST[$config->lang_cookie]) && is_readable('languages/'.$_REQUEST[$config->lang_cookie].'.lang.php')) {
|
||||||
if ( is_readable('languages/'.$config->language.'.lang.php') ) {
|
$language = $_REQUEST[$config->lang_cookie];
|
||||||
include('languages/'.$config->language.'.lang.php');
|
} elseif ( is_readable('languages/'.$config->language.'.lang.php') ) {
|
||||||
|
$language = $config->language;
|
||||||
} elseif ( is_readable('languages/'.$config->default_lang.'.lang.php') ) {
|
} elseif ( is_readable('languages/'.$config->default_lang.'.lang.php') ) {
|
||||||
include('languages/'.$config->default_lang.'.lang.php');
|
$language = $config->default_lang;
|
||||||
} else {
|
} else {
|
||||||
die("ERROR: Can't open language file.");
|
die("ERROR: Can't open language file.");
|
||||||
}
|
}
|
||||||
|
include('languages/'.$language.'.lang.php');
|
||||||
|
|
||||||
|
|
||||||
//>Section> create_object:10
|
//>Section> create_object:10
|
||||||
@@ -58,7 +74,6 @@ setlocale(LC_ALL, array_merge($lang->_locale, $config->default_locale));
|
|||||||
define('LANG', $lang->_language);
|
define('LANG', $lang->_language);
|
||||||
define('LANG_VER', $lang->_version);
|
define('LANG_VER', $lang->_version);
|
||||||
|
|
||||||
|
|
||||||
//==========================
|
//==========================
|
||||||
//>STAGE> main
|
//>STAGE> main
|
||||||
//==========================
|
//==========================
|
||||||
|
|||||||
@@ -19,11 +19,32 @@ Author: Jim Myhrberg
|
|||||||
//>STAGE> functions
|
//>STAGE> functions
|
||||||
//==========================
|
//==========================
|
||||||
|
|
||||||
|
//>Section> class_path.start
|
||||||
|
class Path {
|
||||||
|
|
||||||
//>Section> sort_class.start
|
//>Section> path.url2links
|
||||||
|
function url2links ($path, $root='') {
|
||||||
|
if ( !empty($path) ) {
|
||||||
|
$return = '';
|
||||||
|
$previous = '';
|
||||||
|
$path = str_replace("\\", '/', $path);
|
||||||
|
$path = explode('/', rtrim($path, '/'));
|
||||||
|
$last = count($path)-1;
|
||||||
|
foreach( $path as $key => $value ) {
|
||||||
|
$return .= ($key != $last) ? '<a href="'.$root.$previous.$value.'/">'.$value.'/</a>' : $value.'/';
|
||||||
|
$previous .= $value.'/';
|
||||||
|
}
|
||||||
|
return $return;
|
||||||
|
} else return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
//>Section> path_class.end
|
||||||
|
}
|
||||||
|
|
||||||
|
//>Section> class_sort.start
|
||||||
class Sort {
|
class Sort {
|
||||||
|
|
||||||
//>Section> get_url
|
//>Section> sort.get_url
|
||||||
function get_url ($sortby) {
|
function get_url ($sortby) {
|
||||||
global $config;
|
global $config;
|
||||||
$return = array();
|
$return = array();
|
||||||
@@ -84,11 +105,22 @@ $is_root = ( DIR_URL != '' && DIR_URL != '/' ) ? false : true;
|
|||||||
//>Section> do_render:5
|
//>Section> do_render:5
|
||||||
if ( $do_render ) {
|
if ( $do_render ) {
|
||||||
|
|
||||||
//>Section> set_parent:10
|
//>Section> set_vars:10
|
||||||
$parent = $dlist->parent;
|
$parent = $dlist->parent;
|
||||||
|
if ( !empty($_REQUEST['sort']) && !empty($dlist->sort_order[strtolower($_REQUEST['sort'])]) ) {
|
||||||
|
$current_sort = $_REQUEST['sort'];
|
||||||
|
} else {
|
||||||
|
$current_sort = $config->default_sort;
|
||||||
|
}
|
||||||
|
//>Section> set_fields:10
|
||||||
|
$fields = explode(',', $config->fields);
|
||||||
|
//foreach( $fields as $key => $value ) $fields[$key] = trim($value);
|
||||||
|
$fields = array_flip(array_filter($fields));
|
||||||
|
|
||||||
|
|
||||||
//>Section> do_render.end:95
|
//>Section> do_render.end:95
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//_END;
|
//_END;
|
||||||
?>
|
?>
|
||||||
@@ -32,6 +32,8 @@ class lang {
|
|||||||
var $icons = 'Icons';
|
var $icons = 'Icons';
|
||||||
var $details = 'Details';
|
var $details = 'Details';
|
||||||
|
|
||||||
|
var $powered_by = 'Powered by dList';
|
||||||
|
|
||||||
|
|
||||||
// Smart Date
|
// Smart Date
|
||||||
var $sd_tomorrow = 'Tomorrow';
|
var $sd_tomorrow = 'Tomorrow';
|
||||||
|
|||||||
@@ -32,6 +32,8 @@ class lang {
|
|||||||
var $icons = 'Ikoner';
|
var $icons = 'Ikoner';
|
||||||
var $details = 'Detaljer';
|
var $details = 'Detaljer';
|
||||||
|
|
||||||
|
var $powered_by = 'Driven av dList';
|
||||||
|
|
||||||
|
|
||||||
// Smart Date
|
// Smart Date
|
||||||
var $sd_tomorrow = 'Imorgon';
|
var $sd_tomorrow = 'Imorgon';
|
||||||
|
|||||||
@@ -53,7 +53,7 @@ class dirList {
|
|||||||
// incase it might do something in the future...
|
// incase it might do something in the future...
|
||||||
function dirlist() {
|
function dirlist() {
|
||||||
// sorting orders
|
// sorting orders
|
||||||
$this->sort_order = array(
|
$this->sort_order = array(
|
||||||
'name' => 'name,mtime,size',
|
'name' => 'name,mtime,size',
|
||||||
'size' => 'size,name,mtime',
|
'size' => 'size,name,mtime',
|
||||||
'mtime' => 'mtime,name,size',
|
'mtime' => 'mtime,name,size',
|
||||||
|
|||||||
@@ -1,34 +1,26 @@
|
|||||||
<table border="0" cellspacing="1" cellpadding="0" id="list">
|
<table border="0" cellspacing="1" cellpadding="0" id="list">
|
||||||
<tr>
|
<tr>
|
||||||
<th class="icon"></th>
|
<th class="icon"></th>
|
||||||
<th class="name"><a href="<?=Sort::get_url('name')?>"><?=$lang->name?></a></th>
|
<? foreach ($fields as $key => $value): ?><th class="<?=$key?>"><a href="<?=Sort::get_url($key)?>"><?=$lang->$key?></a></th>
|
||||||
<th class="size"><a href="<?=Sort::get_url('size')?>"><?=$lang->size?></a></th>
|
<? endforeach ?>
|
||||||
<th class="mtime"><a href="<?=Sort::get_url('mtime')?>"><?=$lang->mtime?></a></th>
|
|
||||||
<th class="perms"><a href="<?=Sort::get_url('perms')?>"><?=$lang->perms?></a></th>
|
|
||||||
<th class="owner"><a href="<?=Sort::get_url('owner')?>"><?=$lang->owner?></a></th>
|
|
||||||
</tr>
|
</tr>
|
||||||
<? if ( !$is_root ): ?>
|
<? if ( !$is_root ): ?>
|
||||||
<tr>
|
<tr>
|
||||||
<td class="icon"><a href="../" title="<?=$lang->parent_dir?>"><img src="<?=Icon::get_parent($config->tpl_icon_size)?>" class="" alt="" /></a></td>
|
<td class="icon"><a href="../" title="<?=$lang->parent_dir?>"><img src="<?=Icon::get_parent($config->tpl_icon_size)?>" class="" alt="" /></a></td>
|
||||||
<td class="name"><a href="../" title="<?=$lang->parent_dir?>">..</a></td>
|
<? foreach ($fields as $key => $value):
|
||||||
<td class="size">-</td>
|
if ($key == 'name'):?><td class="name"><a href="../" title="<?=$lang->parent_dir?>">..</a></td>
|
||||||
<td class="mtime">-</td>
|
<? else: ?><td></td><? endif ?>
|
||||||
<td class="perms"><?=$parent['perms']?></td>
|
<? endforeach ?>
|
||||||
<td class="owner"><?=$parent['owner']?></td>
|
|
||||||
</tr>
|
</tr>
|
||||||
<? endif ?>
|
<? endif ?>
|
||||||
<? foreach ($dlist->list as $key => $item): ?>
|
<? foreach ($dlist->list as $key => $item): ?>
|
||||||
<tr>
|
<tr>
|
||||||
<td class="icon">
|
<td class="icon">
|
||||||
<a href="<?=DIR_URL.$item['name']?><? if($item['type'] == 'dir') echo '/'; ?>" title="<?=$item['name']?>">
|
<a href="<?=DIR_URL.$item['name']?><? if($item['type'] == 'dir') echo '/'; ?>" title="<?=$item['name']?>"><img src="<?=Icon::get_url($item['ext'], 'small', $item['type'])?>" class="" alt="" /></a>
|
||||||
<img src="<?=Icon::get_url($item['ext'], 'small', $item['type'])?>" class="" alt="" />
|
|
||||||
</a>
|
|
||||||
</td>
|
</td>
|
||||||
<td class="name"><a href="<?=DIR_URL.$item['name']?><? if($item['type'] == 'dir') echo '/'; ?>"><?=$item['name']?></a></td>
|
<? foreach ($fields as $key => $value):
|
||||||
<td class="size"><?=$item['size']?></td>
|
if ($key == 'name'):?><td class="name"><a href="<?=DIR_URL.$item['name']?><? if($item['type'] == 'dir') echo '/'; ?>"><?=$item['name']?></a></td>
|
||||||
<td class="mtime"><?=$item['mtime']?></td>
|
<? else: ?><td class="<?=$key?>"><?=$item[$key]?></td><? endif ?><? endforeach ?>
|
||||||
<td class="perms"><?=$item['perms']?></td>
|
|
||||||
<td class="owner"><?=$item['owner']?></td>
|
|
||||||
</tr>
|
</tr>
|
||||||
<? endforeach ?>
|
<? endforeach ?>
|
||||||
</table>
|
</table>
|
||||||
@@ -1,6 +1,8 @@
|
|||||||
<table border="0" cellspacing="0" cellpadding="0" id="icons"><tr><td>
|
<table border="0" cellspacing="0" cellpadding="0" id="icons"><tr><td>
|
||||||
<div id="sort-nav">
|
<div id="sort-nav">
|
||||||
<a href="<?=Sort::get_url('name')?>"><?=$lang->name?></a> | <a href="<?=Sort::get_url('size')?>"><?=$lang->size?></a> | <a href="<?=Sort::get_url('mtime')?>"><?=$lang->mtime?></a>
|
<a href="<?=Sort::get_url('name')?>"<? if($current_sort == 'name'): ?> class="current"<? endif ?>><?=$lang->name?></a> |
|
||||||
|
<a href="<?=Sort::get_url('size')?>"<? if($current_sort == 'size'): ?> class="current"<? endif ?>><?=$lang->size?></a> |
|
||||||
|
<a href="<?=Sort::get_url('mtime')?>"<? if($current_sort == 'mtime'): ?> class="current"<? endif ?>><?=$lang->mtime?></a>
|
||||||
</div>
|
</div>
|
||||||
<ul>
|
<ul>
|
||||||
<? if ( !$is_root ): ?>
|
<? if ( !$is_root ): ?>
|
||||||
|
|||||||
@@ -13,17 +13,18 @@
|
|||||||
</head>
|
</head>
|
||||||
<body id="index">
|
<body id="index">
|
||||||
<div id="header">
|
<div id="header">
|
||||||
<?=$lang->index_of.' '.DIR_URL?>
|
<?=$lang->index_of.' '.Path::url2links(DIR_URL)?>
|
||||||
</div>
|
</div>
|
||||||
<div id="view-nav">
|
<div id="view-nav">
|
||||||
<a href="javascript:;" onclick="set_view('icons')"><?=$lang->icons?></a> | <a href="javascript:;" onclick="set_view('details')"><?=$lang->details?></a>
|
<a href="javascript:;" onclick="set_view('icons');"><?=$lang->icons?></a> | <a href="javascript:;" onclick="set_view('details');"><?=$lang->details?></a>
|
||||||
</div>
|
</div>
|
||||||
<div id="server-info"><?=SERVER_INFO?></div>
|
<div id="server-info"><?=SERVER_INFO?></div>
|
||||||
<div id="files">
|
<div id="files">
|
||||||
<? include(TPL_PATH.$config->tpl_mode) ?>
|
<? include(TPL_PATH.$config->tpl_mode) ?>
|
||||||
</div>
|
</div>
|
||||||
<div id="stats">
|
<div id="stats">
|
||||||
<div id="timer">Powered by dList. <?=$timer->end()?>.</div>
|
<div id="timer"><?=$lang->powered_by?>. <?=$timer->end()?>.</div>
|
||||||
|
<div id="lang-select"><? foreach ($installed_languages as $key => $value): ?><a href="javascript:;" onclick="set_lang('<?=$value?>')"><?=ucfirst($value)?></a><? if(count($installed_languages)-1 != $key) echo ' | '; endforeach ?></div>
|
||||||
</div>
|
</div>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
@@ -6,6 +6,13 @@ function set_view (view) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function set_lang (lang) {
|
||||||
|
if (lang != readCookie('dList_language')) {
|
||||||
|
createCookie('dList_language', lang, 365);
|
||||||
|
document.location.href = '';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* Cookie Related Functions */
|
/* Cookie Related Functions */
|
||||||
function createCookie(name,value,days) {
|
function createCookie(name,value,days) {
|
||||||
if (days) {
|
if (days) {
|
||||||
|
|||||||
@@ -35,6 +35,11 @@ if ( !empty($_COOKIE['dList_simple_viewMode']) && !empty($config->tpl_modes[$_CO
|
|||||||
$config->tpl_mode = $config->tpl_modes[$config->tpl_mode];
|
$config->tpl_mode = $config->tpl_modes[$config->tpl_mode];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//>Section> installed_languages
|
||||||
|
$installed_languages = installed_languages();
|
||||||
|
|
||||||
|
|
||||||
//>Section> include_phtml
|
//>Section> include_phtml
|
||||||
include(TPL_PATH.'index.phtml');
|
include(TPL_PATH.'index.phtml');
|
||||||
|
|
||||||
|
|||||||
@@ -10,6 +10,13 @@ BODY {
|
|||||||
font: 20px "Myriad Pro", "Trebuchet MS", Verdana, sans-serif;
|
font: 20px "Myriad Pro", "Trebuchet MS", Verdana, sans-serif;
|
||||||
padding: 15px 15px 30px 30px;
|
padding: 15px 15px 30px 30px;
|
||||||
}
|
}
|
||||||
|
#header A {
|
||||||
|
color: #000;
|
||||||
|
text-decoration: none;
|
||||||
|
}
|
||||||
|
#header A:hover {
|
||||||
|
text-decoration: underline;
|
||||||
|
}
|
||||||
|
|
||||||
#files {
|
#files {
|
||||||
|
|
||||||
@@ -39,7 +46,7 @@ BODY {
|
|||||||
width: 75px;
|
width: 75px;
|
||||||
}
|
}
|
||||||
#list TH.mtime {
|
#list TH.mtime {
|
||||||
width: 175px;
|
width: 170px;
|
||||||
}
|
}
|
||||||
#list TH.perms {
|
#list TH.perms {
|
||||||
width: 100px;
|
width: 100px;
|
||||||
@@ -48,8 +55,10 @@ BODY {
|
|||||||
width: 85px;
|
width: 85px;
|
||||||
}
|
}
|
||||||
#list TH A {
|
#list TH A {
|
||||||
width: 100%;
|
color: #000;
|
||||||
display: block;
|
display: block;
|
||||||
|
width: 100%;
|
||||||
|
text-decoration: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* list cells */
|
/* list cells */
|
||||||
@@ -67,14 +76,22 @@ BODY {
|
|||||||
text-align: right;
|
text-align: right;
|
||||||
}
|
}
|
||||||
#list TD.perms {
|
#list TD.perms {
|
||||||
|
text-align: right;
|
||||||
}
|
}
|
||||||
#list TD.owner {
|
#list TD.owner {
|
||||||
|
text-align: right;
|
||||||
}
|
}
|
||||||
#list TD.name A {
|
#list TD.name A {
|
||||||
width: 100%;
|
color: #000;
|
||||||
display: block;
|
display: block;
|
||||||
|
width: 100%;
|
||||||
|
text-decoration: none;
|
||||||
|
}
|
||||||
|
#list TD.name A:hover {
|
||||||
|
text-decoration: underline;
|
||||||
|
}
|
||||||
|
#list TD.name A:visited {
|
||||||
|
color: #555;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -86,6 +103,7 @@ BODY {
|
|||||||
#icons UL {
|
#icons UL {
|
||||||
list-style: none;
|
list-style: none;
|
||||||
margin-top: 5px;
|
margin-top: 5px;
|
||||||
|
padding: 10px;
|
||||||
}
|
}
|
||||||
#icons UL A {
|
#icons UL A {
|
||||||
color: #000;
|
color: #000;
|
||||||
@@ -113,12 +131,21 @@ BODY {
|
|||||||
font-size: 10px;
|
font-size: 10px;
|
||||||
margin: 0px;
|
margin: 0px;
|
||||||
}
|
}
|
||||||
#icons #sort-nav {
|
#sort-nav {
|
||||||
|
color: #999;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
margin: 20px 20px 0px 20px;
|
margin: 20px 20px 0px 20px;
|
||||||
}
|
}
|
||||||
|
#sort-nav A {
|
||||||
|
color: #777;
|
||||||
|
text-decoration: none;
|
||||||
|
}
|
||||||
|
#sort-nav A:hover {
|
||||||
|
text-decoration: underline;
|
||||||
|
}
|
||||||
|
#sort-nav A.current {
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/* misc. */
|
/* misc. */
|
||||||
@@ -156,4 +183,24 @@ BODY {
|
|||||||
font-style: italic;
|
font-style: italic;
|
||||||
font-size: 9px;
|
font-size: 9px;
|
||||||
text-align: left;
|
text-align: left;
|
||||||
|
float: left;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#lang-select {
|
||||||
|
color: #BBB;
|
||||||
|
padding: 3px;
|
||||||
|
font-style: italic;
|
||||||
|
font-size: 9px;
|
||||||
|
float: right;
|
||||||
|
}
|
||||||
|
#lang-select A {
|
||||||
|
color: #BBB;
|
||||||
|
text-decoration: none;
|
||||||
|
}
|
||||||
|
#lang-select A:hover {
|
||||||
|
text-decoration: underline;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user