aboutsummaryrefslogtreecommitdiffstats
path: root/admin
diff options
context:
space:
mode:
authorpatdenice <patdenice@piwigo.org>2012-02-15 16:52:24 +0000
committerpatdenice <patdenice@piwigo.org>2012-02-15 16:52:24 +0000
commit46864ea0b6c61c39e126e09a7d55144c1a7e11f3 (patch)
treee19720dfdb4bee31419831f2b4f6be656d44d0e9 /admin
parent97132d9c6f54cf8f3253dec6c5b77b3e0678483b (diff)
feature:2577
Add functionnality in core files. git-svn-id: http://piwigo.org/svn/trunk@13172 68402e56-0260-453c-a942-63ccdbb3a9ee
Diffstat (limited to '')
-rw-r--r--admin/include/themes.class.php25
-rw-r--r--admin/themes/default/template/themes_installed.tpl4
2 files changed, 26 insertions, 3 deletions
diff --git a/admin/include/themes.class.php b/admin/include/themes.class.php
index b30c25add..505785b73 100644
--- a/admin/include/themes.class.php
+++ b/admin/include/themes.class.php
@@ -48,6 +48,8 @@ class themes
*/
function perform_action($action, $theme_id)
{
+ global $conf;
+
if (isset($this->db_themes_by_id[$theme_id]))
{
$crt_db_theme = $this->db_themes_by_id[$theme_id];
@@ -86,6 +88,12 @@ class themes
break;
}
+ if ($this->fs_themes[$theme_id]['mobile'] and !empty($conf['mobile_theme']))
+ {
+ array_push($errors, l10n('You can activate only one mobile theme.'));
+ break;
+ }
+
if (file_exists($file_to_include))
{
include($file_to_include);
@@ -105,6 +113,11 @@ INSERT INTO '.THEMES_TABLE.'
\''.$this->fs_themes[$theme_id]['name'].'\')
;';
pwg_query($query);
+
+ if ($this->fs_themes[$theme_id]['mobile'])
+ {
+ conf_update_param('mobile_theme', $theme_id);
+ }
}
break;
@@ -164,6 +177,11 @@ DELETE
WHERE id= \''.$theme_id.'\'
;';
pwg_query($query);
+
+ if ($this->fs_themes[$theme_id]['mobile'])
+ {
+ conf_update_param('mobile_theme', '');
+ }
break;
case 'delete':
@@ -325,6 +343,7 @@ SELECT
'uri' => '',
'description' => '',
'author' => '',
+ 'mobile' => false,
);
$theme_data = implode( '', file($path.'/themeconf.inc.php') );
@@ -365,10 +384,14 @@ SELECT
{
$theme['parent'] = $val[1];
}
- if (preg_match('/["\']activable["\'].*?(true|false)/', $theme_data, $val))
+ if (preg_match('/["\']activable["\'].*?(true|false)/i', $theme_data, $val))
{
$theme['activable'] = get_boolean($val[1]);
}
+ if (preg_match('/["\']mobile["\'].*?(true|false)/i', $theme_data, $val))
+ {
+ $theme['mobile'] = get_boolean($val[1]);
+ }
// screenshot
$screenshot_path = $path.'/screenshot.png';
diff --git a/admin/themes/default/template/themes_installed.tpl b/admin/themes/default/template/themes_installed.tpl
index f591e14f1..57df78a79 100644
--- a/admin/themes/default/template/themes_installed.tpl
+++ b/admin/themes/default/template/themes_installed.tpl
@@ -17,7 +17,7 @@ jQuery(document).ready(function() {
<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'|@translate})</em>{/if}</div>
+ <div class="themeName">{$theme.name}{if $theme.is_default} <em>({'default'|@translate})</em>{/if} {if $theme.mobile} <em>({'mobile'|@translate})</em>{/if}</div>
<div class="themeShot"><a href="{$theme.screenshot}" class="preview-box" title="{$theme.name}"><img src="{$theme.screenshot}" alt=""></a></div>
<div class="themeActions">
<div>
@@ -47,7 +47,7 @@ jQuery(document).ready(function() {
<div class="themeBoxes">
{foreach from=$inactive_themes item=theme}
<div class="themeBox">
- <div class="themeName">{$theme.name}</div>
+ <div class="themeName">{$theme.name}{if $theme.mobile} <em>({'mobile'|@translate})</em>{/if}</div>
<div class="themeShot"><a href="{$theme.screenshot}" class="preview-box" title="{$theme.name}"><img src="{$theme.screenshot}" alt=""></a></div>
<div class="themeActions">
<div>