Changeset 13172


Ignore:
Timestamp:
Feb 15, 2012, 5:52:24 PM (9 years ago)
Author:
patdenice
Message:

feature:2577
Add functionnality in core files.

Location:
trunk
Files:
1 added
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/admin/include/themes.class.php

    r12922 r13172  
    4949  function perform_action($action, $theme_id)
    5050  {
     51    global $conf;
     52
    5153    if (isset($this->db_themes_by_id[$theme_id]))
    5254    {
     
    8789        }
    8890
     91        if ($this->fs_themes[$theme_id]['mobile'] and !empty($conf['mobile_theme']))
     92        {
     93          array_push($errors, l10n('You can activate only one mobile theme.'));
     94          break;
     95        }
     96
    8997        if (file_exists($file_to_include))
    9098        {
     
    106114;';
    107115          pwg_query($query);
     116
     117          if ($this->fs_themes[$theme_id]['mobile'])
     118          {
     119            conf_update_param('mobile_theme', $theme_id);
     120          }
    108121        }
    109122        break;
     
    165178;';
    166179        pwg_query($query);
     180
     181        if ($this->fs_themes[$theme_id]['mobile'])
     182        {
     183          conf_update_param('mobile_theme', '');
     184        }
    167185        break;
    168186
     
    326344            'description' => '',
    327345            'author' => '',
     346            'mobile' => false,
    328347            );
    329348          $theme_data = implode( '', file($path.'/themeconf.inc.php') );
     
    366385            $theme['parent'] = $val[1];
    367386          }
    368           if (preg_match('/["\']activable["\'].*?(true|false)/', $theme_data, $val))
     387          if (preg_match('/["\']activable["\'].*?(true|false)/i', $theme_data, $val))
    369388          {
    370389            $theme['activable'] = get_boolean($val[1]);
     390          }
     391          if (preg_match('/["\']mobile["\'].*?(true|false)/i', $theme_data, $val))
     392          {
     393            $theme['mobile'] = get_boolean($val[1]);
    371394          }
    372395
  • trunk/admin/themes/default/template/themes_installed.tpl

    r12613 r13172  
    1818{foreach from=$active_themes item=theme}
    1919  <div class="themeBox{if $theme.is_default} themeDefault{/if}">
    20     <div class="themeName">{$theme.name}{if $theme.is_default} <em>({'default'|@translate})</em>{/if}</div>
     20    <div class="themeName">{$theme.name}{if $theme.is_default} <em>({'default'|@translate})</em>{/if} {if $theme.mobile} <em>({'mobile'|@translate})</em>{/if}</div>
    2121    <div class="themeShot"><a href="{$theme.screenshot}" class="preview-box" title="{$theme.name}"><img src="{$theme.screenshot}" alt=""></a></div>
    2222    <div class="themeActions">
     
    4848{foreach from=$inactive_themes item=theme}
    4949  <div class="themeBox">
    50     <div class="themeName">{$theme.name}</div>
     50    <div class="themeName">{$theme.name}{if $theme.mobile} <em>({'mobile'|@translate})</em>{/if}</div>
    5151    <div class="themeShot"><a href="{$theme.screenshot}" class="preview-box" title="{$theme.name}"><img src="{$theme.screenshot}" alt=""></a></div>
    5252    <div class="themeActions">
  • trunk/include/common.inc.php

    r12922 r13172  
    193193else
    194194{ // Classic template
    195   $template = new Template(PHPWG_ROOT_PATH.'themes', $user['theme'] );
     195  $theme = $user['theme'];
     196
     197  if (!isset($_SESSION['is_mobile']))
     198  {
     199    include_once(PHPWG_ROOT_PATH.'include/mdetect.php');
     200    $uagent_obj = new uagent_info();
     201    if ($_SESSION['is_mobile'] = $uagent_obj->DetectMobileLong())
     202    {
     203      $_SESSION['use_mobile_theme'] = !empty($conf['mobile_theme']);
     204    }
     205  }
     206  if ($_SESSION['is_mobile'])
     207  {
     208    if (isset($_REQUEST['mobile']))
     209    {
     210      $_SESSION['use_mobile_theme'] = get_boolean($_REQUEST['mobile']);
     211    }
     212    if ($_SESSION['use_mobile_theme'])
     213    {
     214      $theme = $conf['mobile_theme'];
     215    }
     216  }
     217  $template = new Template(PHPWG_ROOT_PATH.'themes', $theme );
    196218}
    197219
  • trunk/language/en_UK/admin.lang.php

    r13068 r13172  
    846846$lang['Center of interest'] = 'Center of interest';
    847847$lang['Move to album'] = 'Move to album';
     848$lang['You can activate only one mobile theme.'] = 'You can activate only one mobile theme.';
     849$lang['mobile'] = 'mobile';
    848850?>
  • trunk/language/fr_FR/admin.lang.php

    r13068 r13172  
    847847$lang['%s has been successfully updated.'] = '%s a été mis à jour avec succès.';
    848848$lang['Move to album'] = 'Déplacer vers l\'album';
     849$lang['You can activate only one mobile theme.'] = 'Vous ne pouvez activer qu\'un seul thème mobile.';
     850$lang['mobile'] = 'mobile';
    849851?>
Note: See TracChangeset for help on using the changeset viewer.