Update type system.
Before Width: | Height: | Size: 667 B After Width: | Height: | Size: 667 B |
Before Width: | Height: | Size: 2.2 KiB After Width: | Height: | Size: 2.2 KiB |
Before Width: | Height: | Size: 644 B After Width: | Height: | Size: 644 B |
Before Width: | Height: | Size: 2.3 KiB After Width: | Height: | Size: 2.3 KiB |
Before Width: | Height: | Size: 380 B After Width: | Height: | Size: 380 B |
Before Width: | Height: | Size: 2.3 KiB After Width: | Height: | Size: 2.3 KiB |
Before Width: | Height: | Size: 784 B After Width: | Height: | Size: 784 B |
Before Width: | Height: | Size: 2.3 KiB After Width: | Height: | Size: 2.3 KiB |
Before Width: | Height: | Size: 1.5 KiB After Width: | Height: | Size: 1.5 KiB |
Before Width: | Height: | Size: 5.6 KiB After Width: | Height: | Size: 5.6 KiB |
Before Width: | Height: | Size: 206 B After Width: | Height: | Size: 206 B |
Before Width: | Height: | Size: 2.2 KiB After Width: | Height: | Size: 2.2 KiB |
@ -1,14 +1,29 @@
|
||||
|
||||
modulejs.define('core/resource', ['config', 'core/settings'], function (config, settings) {
|
||||
|
||||
var image = function (id) {
|
||||
var imagesHref = settings.appHref + 'client/images/',
|
||||
fallbackHref = settings.appHref + 'client/images/fallback/',
|
||||
themesHref = settings.appHref + 'client/themes/',
|
||||
fallbacks = ['file', 'folder', 'folder-page', 'folder-parent'],
|
||||
|
||||
return settings.appHref + 'client/images/' + id + '.svg';
|
||||
image = function (id) {
|
||||
|
||||
return imagesHref + id + '.svg';
|
||||
},
|
||||
|
||||
icon = function (id) {
|
||||
|
||||
return settings.appHref + 'client/themes/' + config.theme[id];
|
||||
var baseId = id.split('-')[0],
|
||||
href = config.theme[id] || config.theme[baseId];
|
||||
|
||||
if (href) {
|
||||
return themesHref + href;
|
||||
}
|
||||
|
||||
if (fallbacks.indexOf(id) >= 0) {
|
||||
return fallbackHref + id + '.svg';
|
||||
}
|
||||
return fallbackHref + 'file.svg';
|
||||
};
|
||||
|
||||
return {
|
||||
|
@ -36,36 +36,22 @@ class App {
|
||||
}
|
||||
|
||||
|
||||
public function get_icon($theme, $type, $fallback = null) {
|
||||
|
||||
foreach (App::$ICON_EXTS as $ext) {
|
||||
$icon = "${theme}/icons/${type}.${ext}";
|
||||
if (is_file(APP_PATH . "/client/themes/${icon}")) {
|
||||
return $icon;
|
||||
}
|
||||
}
|
||||
|
||||
return $fallback;
|
||||
}
|
||||
|
||||
|
||||
public function get_theme() {
|
||||
|
||||
$theme = $this->options["view"]["theme"];
|
||||
$types = $this->get_types();
|
||||
$theme_path = APP_PATH . "/client/themes/${theme}/icons";
|
||||
|
||||
$icons = array();
|
||||
foreach (array("file", "folder", "folder-page", "folder-parent") as $type) {
|
||||
$icons[$type] = $this->get_icon($theme, $type, "fallback/icons/${type}.svg");
|
||||
}
|
||||
foreach ($types as $type => $exts) {
|
||||
if (!array_key_exists($type, $icons)) {
|
||||
$icon = $this->get_icon($theme, $type);
|
||||
if ($icon === null) {
|
||||
$type_parts = explode('-', $type);
|
||||
$icon = $this->get_icon($theme, $type_parts[0], $icons["file"]);
|
||||
|
||||
if (is_dir($theme_path)) {
|
||||
if ($dir = opendir($theme_path)) {
|
||||
while (($name = readdir($dir)) !== false) {
|
||||
$path_parts = pathinfo($name);
|
||||
if (in_array($path_parts["extension"], App::$ICON_EXTS)) {
|
||||
$icons[$path_parts["filename"]] = "${theme}/icons/${name}";
|
||||
}
|
||||
}
|
||||
$icons[$type] = $icon;
|
||||
closedir($dir);
|
||||
}
|
||||
}
|
||||
|
||||
@ -218,7 +204,7 @@ class App {
|
||||
|
||||
if ($folder->get_parent($cache)) {
|
||||
$html .= "<tr>";
|
||||
$html .= "<td class='fb-i'><img src='" . APP_HREF . "client/themes/fallback/icons/folder-parent.png' alt='folder-parent'/></td>";
|
||||
$html .= "<td class='fb-i'><img src='" . APP_HREF . "client/images/fallback/folder-parent.png' alt='folder-parent'/></td>";
|
||||
$html .= "<td class='fb-n'><a href='..'>Parent Directory</a></td>";
|
||||
$html .= "<td class='fb-d'></td>";
|
||||
$html .= "<td class='fb-s'></td>";
|
||||
@ -229,7 +215,7 @@ class App {
|
||||
$type = $item->is_folder ? "folder" : "file";
|
||||
|
||||
$html .= "<tr>";
|
||||
$html .= "<td class='fb-i'><img src='" . APP_HREF . "client/themes/fallback/icons/" . $type . ".png' alt='" . $type . "'/></td>";
|
||||
$html .= "<td class='fb-i'><img src='" . APP_HREF . "client/images/fallback/" . $type . ".png' alt='" . $type . "'/></td>";
|
||||
$html .= "<td class='fb-n'><a href='" . $item->url . "'>" . basename($item->path) . "</a></td>";
|
||||
$html .= "<td class='fb-d'>" . date("Y-m-d H:i", $item->date) . "</td>";
|
||||
$html .= "<td class='fb-s'>" . ($item->size !== null ? intval($item->size / 1000) . " KB" : "" ) . "</td>";
|
||||
|