aboutsummaryrefslogtreecommitdiffstats
path: root/admin/themes
diff options
context:
space:
mode:
authorplegall <plg@piwigo.org>2010-03-17 00:48:38 +0000
committerplegall <plg@piwigo.org>2010-03-17 00:48:38 +0000
commitf82430dd3b92a2e37a58108fa81cd0bc6255fb00 (patch)
treedb0e7d249e591f0187ade853d8cf517a011f3fe1 /admin/themes
parent54148c8d6039695456cec9cdf3e912810e8105db (diff)
feature 1514: new screen to manage installed themes; activate, deactivate,
delete, set as default. plugins.class.php was merged back to a state it doesn't manage themes at all. themes.class.php was created instead, from a duplication of plugins.class.php and strongly modified then. feature 1507: the display of available themes is now much more "graphic". git-svn-id: http://piwigo.org/svn/trunk@5153 68402e56-0260-453c-a942-63ccdbb3a9ee
Diffstat (limited to '')
-rw-r--r--admin/themes/clear/images/missing_screenshot.pngbin0 -> 1684 bytes
-rw-r--r--admin/themes/default/default-layout.css11
-rw-r--r--admin/themes/default/template/footer.tpl2
-rw-r--r--admin/themes/default/template/themes_installed.tpl42
-rw-r--r--admin/themes/default/template/themes_new.tpl10
-rw-r--r--admin/themes/roma/images/missing_screenshot.pngbin0 -> 3316 bytes
-rw-r--r--admin/themes/roma/theme.css2
-rw-r--r--admin/themes_installed.php112
-rw-r--r--admin/themes_new.php18
9 files changed, 179 insertions, 18 deletions
diff --git a/admin/themes/clear/images/missing_screenshot.png b/admin/themes/clear/images/missing_screenshot.png
new file mode 100644
index 000000000..4c67f618d
--- /dev/null
+++ b/admin/themes/clear/images/missing_screenshot.png
Binary files differ
diff --git a/admin/themes/default/default-layout.css b/admin/themes/default/default-layout.css
index 6b7827fad..4aa719cda 100644
--- a/admin/themes/default/default-layout.css
+++ b/admin/themes/default/default-layout.css
@@ -737,8 +737,13 @@ BODY#thePopuphelpPage {
height: 4em; /* legend height (don't set auto to be Gecko friendly)*/
}
-.themeBox {float:left; text-align:center; height:170px; background-color:#eee; margin:5px; -moz-border-radius:5px;}
+.themeBox {float:left; text-align:center; height:180px; background-color:#eee; margin:5px; -moz-border-radius:5px;}
.themeBox IMG {border:1px solid white; margin:0 15px;}
.themeName {font-size:1.1em; margin:5px 0;}
-.themeActions {margin:5px 0;}
-.themeActions A {display:block;}
+.themeActions {margin:5px 0; font-size:12px;}
+.themeActions A {}
+
+#themesContent .themeBox IMG {width:150px; height:120px;}
+#themesContent H3 {font-size:16px; text-align:left; border-bottom:1px solid #444; letter-spacing:1px; margin:5px;}
+
+.themeBoxes {min-height:300px;} \ No newline at end of file
diff --git a/admin/themes/default/template/footer.tpl b/admin/themes/default/template/footer.tpl
index e8709b59f..f7c83474e 100644
--- a/admin/themes/default/template/footer.tpl
+++ b/admin/themes/default/template/footer.tpl
@@ -45,7 +45,7 @@
{literal}
<script type='text/javascript'>
$(function() {
- $('#pwgHead A, #footer A').tipTip({
+ $('#pwgHead A, #footer A, .themeActions A').tipTip({
'delay' : 0,
'fadeIn' : 200,
'fadeOut' : 200,
diff --git a/admin/themes/default/template/themes_installed.tpl b/admin/themes/default/template/themes_installed.tpl
new file mode 100644
index 000000000..8c0fca6fa
--- /dev/null
+++ b/admin/themes/default/template/themes_installed.tpl
@@ -0,0 +1,42 @@
+<div class="titrePage">
+ <h2>{'Installed Themes'|@translate}</h2>
+</div>
+
+<div id="themesContent">
+
+<h3>Active Themes</h3>
+{if isset($active_themes)}
+<div class="themeBoxes">
+{foreach from=$active_themes item=theme}
+ <div class="themeBox{if $theme.is_default} themeDefault{/if}">
+ <div class="themeName">{$theme.name}{if $theme.is_default} <em>(default)</em>{/if}</div>
+ <div class="themeShot"><img src="{$theme.screenshot}"></div>
+ <div class="themeActions">
+ <a href="{$deactivate_baseurl}{$theme.id}" title="{'Forbid this theme to users'|@translate}">{'Deactivate'|@translate}</a>
+{if not $theme.is_default}
+ | <a href="{$set_default_baseurl}{$theme.id}" title="{'Set as default theme for unregistered and new users'|@translate}">{'Default'|@translate}</a>
+{/if}
+ </div> <!-- themeActions -->
+ </div>
+{/foreach}
+</div> <!-- themeBoxes -->
+{/if}
+
+{if isset($inactive_themes)}
+<h3>Inactive Themes</h3>
+<div class="themeBoxes">
+{foreach from=$inactive_themes item=theme}
+ <div class="themeBox">
+ <div class="themeName">{$theme.name}</div>
+ <div class="themeShot"><img src="{$theme.screenshot}"></div>
+ <div class="themeActions">
+ <a href="{$activate_baseurl}{$theme.id}" title="{'Make this theme available to users'|@translate}">{'Activate'|@translate}</a>
+ | <a href="{$delete_baseurl}{$theme.id}" title="{'Delete this theme'|@translate}">{'Delete'|@translate}</a>
+ </div>
+
+ </div>
+{/foreach}
+</div> <!-- themeBoxes -->
+{/if}
+
+</div> <!-- themesContent --> \ No newline at end of file
diff --git a/admin/themes/default/template/themes_new.tpl b/admin/themes/default/template/themes_new.tpl
index 0edcb4130..1eb67b74b 100644
--- a/admin/themes/default/template/themes_new.tpl
+++ b/admin/themes/default/template/themes_new.tpl
@@ -1,15 +1,15 @@
<div class="titrePage">
- <h2>{'Install New Theme'|@translate}</h2>
+ <h2>{'Add New Theme'|@translate}</h2>
</div>
{if isset($themes)}
-<div id="themesBox">
+<div id="themeBoxes">
{foreach from=$new_themes item=theme name=themes_loop}
<div class="themeBox">
<div class="themeName">{$theme.name}</div>
- <div class="themeShot"><img src="{$theme.src}"></div>
- <div class="themeActions"><a href="{$theme.install_url}">Install</a></div>
+ <div class="themeShot"><img src="{$theme.screenshot}"></div>
+ <div class="themeActions"><a href="{$theme.install_url}">{'Install'|@translate}</a></div>
</div>
{/foreach}
-</div> <!-- themesBox -->
+</div> <!-- themeBoxes -->
{/if} \ No newline at end of file
diff --git a/admin/themes/roma/images/missing_screenshot.png b/admin/themes/roma/images/missing_screenshot.png
new file mode 100644
index 000000000..97610eaeb
--- /dev/null
+++ b/admin/themes/roma/images/missing_screenshot.png
Binary files differ
diff --git a/admin/themes/roma/theme.css b/admin/themes/roma/theme.css
index f66413ac4..835732d75 100644
--- a/admin/themes/roma/theme.css
+++ b/admin/themes/roma/theme.css
@@ -222,3 +222,5 @@ html>body #menubar {min-height:477px; height:477px;} /* IE 7 and modern browsers
.themeBox IMG {border:1px solid #666;}
.themeName {color:white;}
.themeActions A {border-bottom:none;}
+
+.themeDefault {background-color:#555;} \ No newline at end of file
diff --git a/admin/themes_installed.php b/admin/themes_installed.php
new file mode 100644
index 000000000..201202cb8
--- /dev/null
+++ b/admin/themes_installed.php
@@ -0,0 +1,112 @@
+<?php
+// +-----------------------------------------------------------------------+
+// | Piwigo - a PHP based picture gallery |
+// +-----------------------------------------------------------------------+
+// | Copyright(C) 2008-2009 Piwigo Team http://piwigo.org |
+// | Copyright(C) 2003-2008 PhpWebGallery Team http://phpwebgallery.net |
+// | Copyright(C) 2002-2003 Pierrick LE GALL http://le-gall.net/pierrick |
+// +-----------------------------------------------------------------------+
+// | This program is free software; you can redistribute it and/or modify |
+// | it under the terms of the GNU General Public License as published by |
+// | the Free Software Foundation |
+// | |
+// | This program is distributed in the hope that it will be useful, but |
+// | WITHOUT ANY WARRANTY; without even the implied warranty of |
+// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
+// | General Public License for more details. |
+// | |
+// | You should have received a copy of the GNU General Public License |
+// | along with this program; if not, write to the Free Software |
+// | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
+// | USA. |
+// +-----------------------------------------------------------------------+
+
+if( !defined("PHPWG_ROOT_PATH") )
+{
+ die ("Hacking attempt!");
+}
+
+include_once(PHPWG_ROOT_PATH.'admin/include/themes.class.php');
+
+$base_url = get_root_url().'admin.php?page='.$page['page'];
+
+$themes = new themes();
+
+// +-----------------------------------------------------------------------+
+// | perform actions |
+// +-----------------------------------------------------------------------+
+
+if (isset($_GET['action']) and isset($_GET['theme']) and !is_adviser())
+{
+ $page['errors'] = $themes->perform_action($_GET['action'], $_GET['theme']);
+
+ if (empty($page['errors']))
+ {
+ if ($_GET['action'] == 'activate' or $_GET['action'] == 'deactivate')
+ {
+ $template->delete_compiled_templates();
+ }
+ redirect($base_url);
+ }
+}
+
+// +-----------------------------------------------------------------------+
+// | start template output |
+// +-----------------------------------------------------------------------+
+
+$themes->sort_fs_themes();
+
+$default_theme = get_default_theme();
+
+$db_themes = $themes->get_db_themes();
+$db_theme_ids = array();
+foreach ($db_themes as $db_theme)
+{
+ array_push($db_theme_ids, $db_theme['id']);
+}
+
+$active_themes = array();
+$inactive_themes = array();
+
+foreach($themes->fs_themes as $theme_id => $fs_theme)
+{
+ if ($theme_id == 'default')
+ {
+ continue;
+ }
+
+ if (in_array($theme_id, $db_theme_ids))
+ {
+ if ($theme_id == $default_theme)
+ {
+ $fs_theme['is_default'] = true;
+ array_unshift($active_themes, $fs_theme);
+ }
+ else
+ {
+ array_push($active_themes, $fs_theme);
+ }
+ }
+ else
+ {
+ array_push($inactive_themes, $fs_theme);
+ }
+}
+
+$template->assign(
+ array(
+ 'activate_baseurl' => $base_url.'&action=activate&theme=',
+ 'deactivate_baseurl' => $base_url.'&action=deactivate&theme=',
+ 'set_default_baseurl' => $base_url.'&action=set_default&theme=',
+ 'delete_baseurl' => $base_url.'&action=delete&theme=',
+
+ 'active_themes' => $active_themes,
+ 'inactive_themes' => $inactive_themes,
+ )
+ );
+
+
+$themes->set_tabsheet($page['page']);
+$template->set_filenames(array('themes' => 'themes_installed.tpl'));
+$template->assign_var_from_handle('ADMIN_CONTENT', 'themes');
+?> \ No newline at end of file
diff --git a/admin/themes_new.php b/admin/themes_new.php
index c606f97b1..2c11cf6a7 100644
--- a/admin/themes_new.php
+++ b/admin/themes_new.php
@@ -2,7 +2,7 @@
// +-----------------------------------------------------------------------+
// | Piwigo - a PHP based picture gallery |
// +-----------------------------------------------------------------------+
-// | Copyright(C) 2008-2009 Piwigo Team http://piwigo.org |
+// | Copyright(C) 2008-2010 Piwigo Team http://piwigo.org |
// | Copyright(C) 2003-2008 PhpWebGallery Team http://phpwebgallery.net |
// | Copyright(C) 2002-2003 Pierrick LE GALL http://le-gall.net/pierrick |
// +-----------------------------------------------------------------------+
@@ -26,11 +26,12 @@ if( !defined("PHPWG_ROOT_PATH") )
die ("Hacking attempt!");
}
-include_once(PHPWG_ROOT_PATH.'admin/include/plugins.class.php');
+include_once(PHPWG_ROOT_PATH.'admin/include/themes.class.php');
$base_url = get_root_url().'admin.php?page='.$page['page'];
-$themes = new plugins();
+$themes = new themes();
+$themes->set_tabsheet('themes_new');
// +-----------------------------------------------------------------------+
// | setup check |
@@ -54,11 +55,10 @@ if (!is_writable($themes_dir))
if (isset($_GET['revision']) and isset($_GET['extension']) and !is_adviser())
{
- $install_status = $themes->extract_plugin_files(
+ $install_status = $themes->extract_theme_files(
'install',
$_GET['revision'],
- $_GET['extension'],
- 'theme'
+ $_GET['extension']
);
redirect($base_url.'&installstatus='.$install_status);
@@ -105,9 +105,9 @@ if (isset($_GET['installstatus']))
$template->set_filenames(array('themes' => 'themes_new.tpl'));
-if ($themes->get_server_plugins(true, 'theme'))
+if ($themes->get_server_themes(true)) // only new themes
{
- foreach($themes->server_plugins as $theme)
+ foreach($themes->server_themes as $theme)
{
$url_auto_install = htmlentities($base_url)
. '&amp;revision=' . $theme['revision_id']
@@ -118,7 +118,7 @@ if ($themes->get_server_plugins(true, 'theme'))
'new_themes',
array(
'name' => $theme['extension_name'],
- 'src' => PEM_URL.'/upload/extension-'.$theme['extension_id'].'/thumbnail.jpg',
+ 'screenshot' => PEM_URL.'/upload/extension-'.$theme['extension_id'].'/thumbnail.jpg',
'install_url' => $url_auto_install,
)
);