mirror of
https://github.com/Pathduck/gallery3.git
synced 2026-05-06 04:59:07 -04:00
Split themes into two tabs for regular and admin themes
This commit is contained in:
@@ -22,17 +22,24 @@ class Admin_Themes_Controller extends Admin_Controller {
|
||||
$view = new Admin_View("admin.html");
|
||||
$view->content = new View("admin_themes.html");
|
||||
$themeDir = scandir(THEMEPATH);
|
||||
$themes = array();
|
||||
$themes = $admin_themes = array();
|
||||
foreach ($themeDir as $theme_name) {
|
||||
if (substr($theme_name, 0, 1) == ".") continue;
|
||||
$file = THEMEPATH . $theme_name . "/theme.info";
|
||||
$theme_info = new ArrayObject(parse_ini_file($file), ArrayObject::ARRAY_AS_PROPS);
|
||||
$details = theme::get_edit_form_admin($theme_info);
|
||||
$theme_info['details'] = $details;
|
||||
$themes[$theme_name] = $theme_info;
|
||||
if ($theme_info->regular) {
|
||||
$themes[$theme_name] = $theme_info;
|
||||
}
|
||||
if ($theme_info->admin) {
|
||||
$admin_themes[$theme_name] = $theme_info;
|
||||
}
|
||||
}
|
||||
$view->content->themes = $themes;
|
||||
$view->content->admin_themes = $admin_themes;
|
||||
$view->content->active = module::get_var("core", "active_theme");
|
||||
$view->content->active_admin = module::get_var("core", "active_admin_theme");
|
||||
print $view;
|
||||
}
|
||||
|
||||
|
||||
@@ -3,26 +3,58 @@
|
||||
<h1><?= t("Theme Administration") ?></h1>
|
||||
<form method="post" id="gThemeAdmin" action="<?= url::site("admin/themes/save") ?>">
|
||||
<?= access::csrf_form_field() ?>
|
||||
<table><tbody><tr><td>
|
||||
<?= t("Current theme") ?><br />
|
||||
<a href="#">
|
||||
<img src="<?= url::file("themes/{$active}/thumbnail.png") ?>" alt="<?= $themes[$active]->name ?>" />
|
||||
</a><br />
|
||||
<?= $themes[$active]->description ?><br />
|
||||
<input type="radio" name="themes" value="<?= $active ?>" checked="checked">
|
||||
<?= $themes[$active]->name ?>
|
||||
</td>
|
||||
<? foreach ($themes as $id => $theme): ?>
|
||||
<? if ($id == $active) continue; ?>
|
||||
<td>
|
||||
<a href="#">
|
||||
<img src="<?= url::file("themes/{$id}/thumbnail.png") ?>" alt="<?= $theme->name ?>" />
|
||||
</a><br />
|
||||
<?= $theme->description ?><br />
|
||||
<input type="radio" name="themes" value="<?= $id ?>"> <?= $theme->name ?>
|
||||
</td>
|
||||
<? endforeach ?>
|
||||
</tr></tbody></table>
|
||||
<div id="gThemeTabs">
|
||||
<ul>
|
||||
<li><a href="#gtRegular"><span>Regular</span></a></li>
|
||||
<li><a href="#gtAdmin"><span>Admin</span></a></li>
|
||||
</ul>
|
||||
<div id="gtRegular">
|
||||
<table><tbody><tr><td>
|
||||
<?= t("Current theme") ?><br />
|
||||
<a href="#">
|
||||
<img src="<?= url::file("themes/{$active}/thumbnail.png") ?>" alt="<?= $themes[$active]->name ?>" />
|
||||
</a><br />
|
||||
<?= $themes[$active]->description ?><br />
|
||||
<input type="radio" name="themes" value="<?= $active ?>" checked="checked">
|
||||
<?= $themes[$active]->name ?>
|
||||
</td>
|
||||
<? foreach ($themes as $id => $theme): ?>
|
||||
<? if ($id == $active) continue; ?>
|
||||
<td>
|
||||
<a href="#">
|
||||
<img src="<?= url::file("themes/{$id}/thumbnail.png") ?>" alt="<?= $theme->name ?>" />
|
||||
</a><br />
|
||||
<?= $theme->description ?><br />
|
||||
<input type="radio" name="themes" value="<?= $id ?>"> <?= $theme->name ?>
|
||||
</td>
|
||||
<? endforeach ?>
|
||||
</tr></tbody></table>
|
||||
</div>
|
||||
<div id="gtAdmin">
|
||||
<table><tbody><tr><td>
|
||||
<?= t("Current theme") ?><br />
|
||||
<a href="#">
|
||||
<img src="<?= url::file("themes/{$active_admin}/thumbnail.png") ?>"
|
||||
alt="<?= $themes[$active_admin]->name ?>" />
|
||||
</a><br />
|
||||
<?= $admin_themes[$active_admin]->description ?><br />
|
||||
<input type="radio" name="admin_themes" value="<?= $active_admin ?>" checked="checked">
|
||||
<?= $admin_themes[$active_admin]->name ?>
|
||||
</td>
|
||||
<? foreach ($admin_themes as $id => $theme): ?>
|
||||
<? if ($id == $active_admin) continue; ?>
|
||||
<td>
|
||||
<a href="#">
|
||||
<img src="<?= url::file("themes/{$id}/thumbnail.png") ?>" alt="<?= $theme->name ?>" />
|
||||
</a><br />
|
||||
<?= $theme->description ?><br />
|
||||
<input type="radio" name="admin_themes" value="<?= $id ?>"> <?= $theme->name ?>
|
||||
</td>
|
||||
<? endforeach ?>
|
||||
</tr></tbody></table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<input type="submit" value="<?= t("Save") ?>"/>
|
||||
</form>
|
||||
<div id="gThemeDetails">
|
||||
|
||||
@@ -24,7 +24,18 @@ $(document).ready(function(){
|
||||
};
|
||||
|
||||
$("#gThemeAdmin :radio").click(function(event) {
|
||||
console.log("clicked radio " + event.target.value);
|
||||
$("#gThemeDetails").load("themes/edit/" + event.target.value);
|
||||
});
|
||||
|
||||
$("#gThemeTabs > ul").tabs({ select: updateThemeDetails });
|
||||
});
|
||||
|
||||
function updateThemeDetails(evt, ui) {
|
||||
var themeName;
|
||||
if (ui.index == 0) {
|
||||
themeName = $("#gtRegular :checked").val();
|
||||
} else {
|
||||
themeName = $("#gtAdmin :checked").val();
|
||||
}
|
||||
$("#gThemeDetails").load("themes/edit/" + themeName);
|
||||
}
|
||||
|
||||
@@ -2,3 +2,5 @@ name = Default Admin
|
||||
description = Default Gallery theme to administer
|
||||
version = 1
|
||||
author = Gallery Team
|
||||
admin = 1
|
||||
regular = 1
|
||||
|
||||
@@ -16,6 +16,9 @@
|
||||
type="text/css" media="screen,projection">
|
||||
<link rel="stylesheet" href="<?= $theme->url("css/screen.css") ?>"
|
||||
type="text/css" media="screen,projection">
|
||||
<!-- This is temporary, to support tabview -->
|
||||
<link rel="stylesheet" href="http://ui.jquery.com/latest/themes/flora/flora.all.css" type="text/css" media="screen" title="Flora (Default)">
|
||||
|
||||
<script src="<?= url::file("lib/jquery.js") ?>" type="text/javascript"></script>
|
||||
<script src="<?= url::file("lib/jquery.form.js") ?>" type="text/javascript"></script>
|
||||
<script src="<?= url::file("lib/jquery-ui.js") ?>" type="text/javascript"></script>
|
||||
|
||||
@@ -2,3 +2,5 @@ name = Default
|
||||
description = Default Gallery theme to view photos and albums
|
||||
version = 1
|
||||
author = Gallery Team
|
||||
regular = 1
|
||||
admin = 0
|
||||
|
||||
Reference in New Issue
Block a user