Changeset 13234


Ignore:
Timestamp:
Feb 18, 2012, 9:26:52 PM (9 years ago)
Author:
patdenice
Message:

feature:2577
Many improvements

Location:
trunk
Files:
1 added
19 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/category_default.inc.php

    r13115 r13234  
    3535  $page['nb_image_page']
    3636  );
     37
     38$selection = trigger_event('loc_index_thumbnails_selection', $selection);
    3739
    3840if (count($selection) > 0)
  • trunk/include/common.inc.php

    r13172 r13234  
    193193else
    194194{ // Classic template
    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   }
     195  $theme = mobile_theme() ? $conf['mobile_theme'] : $user['theme'];
    217196  $template = new Template(PHPWG_ROOT_PATH.'themes', $theme );
    218197}
  • trunk/include/functions.inc.php

    r13086 r13234  
    16791679  return implode('.', array_slice(explode('.', $version), 0, 2));
    16801680}
     1681
     1682/**
     1683 * return the device type: mobile, tablet or desktop
     1684 */
     1685function get_device()
     1686{
     1687  $device = pwg_get_session_var('device');
     1688
     1689  if (is_null($device))
     1690  {
     1691    include_once(PHPWG_ROOT_PATH.'include/mdetect.php');
     1692    $uagent_obj = new uagent_info();
     1693    if ($uagent_obj->DetectTierIphone())
     1694    {
     1695      $device = 'mobile';
     1696    }
     1697    elseif ($uagent_obj->DetectTierTablet())
     1698    {
     1699      $device = 'tablet';
     1700    }
     1701    else
     1702    {
     1703      $device = 'desktop';
     1704    }
     1705    pwg_set_session_var('device', $device);
     1706  }
     1707
     1708  return $device;
     1709}
     1710
     1711/**
     1712 * return true if mobile theme should be loaded
     1713 */
     1714function mobile_theme()
     1715{
     1716  global $conf;
     1717
     1718  if (empty($conf['mobile_theme']))
     1719  {
     1720    return false;
     1721  }
     1722
     1723  if (isset($_GET['mobile']))
     1724  {
     1725    $is_mobile_theme = get_boolean($_GET['mobile']);
     1726    pwg_set_session_var('mobile_theme', $is_mobile_theme);
     1727    unset($_GET['mobile']);
     1728  }
     1729  else
     1730  {
     1731    $is_mobile_theme = pwg_get_session_var('mobile_theme');
     1732  }
     1733
     1734  if (is_null($is_mobile_theme))
     1735  {
     1736    $is_mobile_theme = (get_device() == 'mobile');
     1737    pwg_set_session_var('mobile_theme', $is_mobile_theme);
     1738  }
     1739
     1740  return $is_mobile_theme;
     1741}
    16811742?>
  • trunk/include/page_tail.php

    r12922 r13234  
    6666$template->assign('debug', $debug_vars );
    6767
     68//------------------------------------------------------------- mobile version
     69if (get_device() != 'desktop')
     70{
     71  $template->assign('TOGGLE_MOBILE_THEME_URL',
     72      add_url_params(
     73        make_index_url(),
     74        array('mobile' => mobile_theme() ? 'false' : 'true')
     75      )
     76    );
     77}
     78
    6879trigger_action('loc_end_page_tail');
    6980//
  • trunk/language/en_UK/admin.lang.php

    r13172 r13234  
    847847$lang['Move to album'] = 'Move to album';
    848848$lang['You can activate only one mobile theme.'] = 'You can activate only one mobile theme.';
    849 $lang['mobile'] = 'mobile';
    850849?>
  • trunk/language/en_UK/common.lang.php

    r13225 r13234  
    384384$lang['If you think you\'ve received this email in error, please contact us at %s'] = 'If you think you\'ve received this email in error, please contact us at %s';
    385385$lang['Photo sizes'] = 'Photo sizes';
     386$lang['View in'] = 'View in';
     387$lang['Mobile'] = 'Mobile';
     388$lang['Desktop'] = 'Desktop';
    386389?>
  • trunk/language/fr_FR/admin.lang.php

    r13229 r13234  
    845845$lang['Move to album'] = 'Déplacer vers l\'album';
    846846$lang['You can activate only one mobile theme.'] = 'Vous ne pouvez activer qu\'un seul thème mobile.';
    847 $lang['mobile'] = 'mobile';
    848847$lang['Center of interest'] = 'Centre d\'interêt';
    849848$lang['Not cropped correctly?'] = 'La photo n\'est pas recadrée corectement ?';
  • trunk/language/fr_FR/common.lang.php

    r13231 r13234  
    384384$lang['Show latest comments first'] = 'Montrer les commentaires les plus récents en premier';
    385385$lang['Show oldest comments first'] = 'Montrer les commentaires les plus anciens en premier';
     386$lang['View in'] = 'Affichage';
     387$lang['Mobile'] = 'Mobile';
     388$lang['Desktop'] = 'Classique';
    386389?>
  • trunk/themes/default/template/footer.tpl

    r8492 r13234  
    1313        - {'Contact'|@translate}
    1414        <a href="mailto:{$CONTACT_MAIL}?subject={'A comment on your site'|@translate|@escape:url}">{'Webmaster'|@translate}</a>
     15        {/if}
     16        {if isset($TOGGLE_MOBILE_THEME_URL)}
     17        - {'Display'|@translate} : <a href="{$TOGGLE_MOBILE_THEME_URL}">{'Mobile'|@translate}</a> | <b>{'Classic'|@translate}</b>
    1518        {/if}
    1619
  • trunk/themes/smartpocket/template/footer.tpl

    r13182 r13234  
    1 
     1{if !empty($navbar)}
     2{include file='navigation_bar.tpl'|@get_extent:'navbar'}
     3{else}
     4<div class="pwg_footer ui-bar-a">
     5  <h6>
     6        {'Powered by'|@translate}       <a href="{$PHPWG_URL}" class="Piwigo">Piwigo</a>
     7        {$VERSION}
     8        {if isset($CONTACT_MAIL)}
     9        - {'Contact'|@translate}
     10        <a href="mailto:{$CONTACT_MAIL}?subject={'A comment on your site'|@translate|@escape:url}">{'Webmaster'|@translate}</a>
     11        {/if}
     12  <br>{'Display'|@translate} :
     13    <b>{'Mobile'|@translate}</b> | <a href="{$TOGGLE_MOBILE_THEME_URL}">{'Classic'|@translate}</a>
     14  </h6>
     15</div>
     16{/if}
    217{get_combined_scripts load='footer'}
    318</div><!-- /page -->
  • trunk/themes/smartpocket/template/header.tpl

    r13182 r13234  
    4747
    4848<body>
    49 <div data-role="page">
     49<div data-role="page" data-theme="a">
    5050
    51 <div data-role="header" data-theme="c">
     51<div data-role="header">
    5252  <div class="title">
    5353    <a href="{$U_HOME}" class="home_button" data-icon="home" data-iconpos="notext" data-role="button"></a>
  • trunk/themes/smartpocket/template/index.tpl

    r13182 r13234  
    1 <div data-role="content">
     1<div data-role="content" data-theme="a">
    22{if !empty($CATEGORIES)}{$CATEGORIES}{/if}
    33{if !empty($THUMBNAILS)}{$THUMBNAILS}{/if}
  • trunk/themes/smartpocket/template/infos_errors.tpl

    r13182 r13234  
    1 {if isset($errors) }
    2 <div class="errors">
    3   <ul>
    4     {foreach from=$errors item=error}
    5     <li>{$error}</li>
    6     {/foreach}
    7   </ul>
     1{if isset($errors)}
     2<div class="ui-bar ui-bar-e errors">
     3  <h3>{'Error'|@translate}</h3>
     4        <div><a href="#" data-role="button" data-icon="delete" data-iconpos="notext" class="close-button">Button</a></div>
     5        <p>{'<br>'|@implode:$errors}</p>
    86</div>
    97{/if}
    108
    119{if not empty($infos)}
    12 <div class="infos">
    13   <ul>
    14     {foreach from=$infos item=info}
    15     <li>{$info}</li>
    16     {/foreach}
    17   </ul>
     10<div class="ui-bar ui-bar-b infos">
     11  <h3>{'Info'|@translate}</h3>
     12        <div><a href="#" data-role="button" data-icon="delete" data-iconpos="notext" class="close-button">Button</a></div>
     13        <p>{'<br>'|@implode:$infos}</p>
    1814</div>
    1915{/if}
     16
     17{footer_script}{literal}
     18$(document).ready(function () {
     19  $('.close-button').click(function() {
     20    $(this).parents('.ui-bar').remove();
     21  });
     22});
     23{/literal}{/footer_script}
  • trunk/themes/smartpocket/template/menubar.tpl

    r13182 r13234  
    11<select name="identification" id="identification" data-icon="grid" data-iconpos="notext" data-native-menu="false">
    22
    3   <option value="" data-placeholder="true">{'Identification'|@translate}</option>
     3  <option></option>
     4  <optgroup label="{'Identification'|@translate}">
    45
    56        {if isset($U_REGISTER)}
     
    1920        {/if}
    2021
     22  </optgroup>
     23
    2124</select>
    2225
  • trunk/themes/smartpocket/template/profile.tpl

    r13182 r13234  
     1{include file='infos_errors.tpl'}
    12<div data-role="content">
    2 {include file='infos_errors.tpl'}
    33{$PROFILE_CONTENT}
    44</div>
  • trunk/themes/smartpocket/template/profile_content.tpl

    r13182 r13234  
    1 
    21<form method="post" name="profile" action="{$F_ACTION}" id="profile" class="properties">
    32
     
    3130{if $ALLOW_USER_CUSTOMIZATION}
    3231  <div data-role="fieldcontain">
     32  <label for="nb_image_page">{'Number of photos per page'|@translate}</label>
     33  <input type="range" name="nb_image_page" id="nb_image_page" value="{$NB_IMAGE_PAGE}" min="1" max="100" />
     34  </div>
     35
     36  <div data-role="fieldcontain">
    3337  <label for="language">{'Language'|@translate}</label>
    3438  {html_options name=language options=$language_options selected=$language_selection}
     
    3943  <div data-role="fieldcontain">
    4044    {if $ALLOW_USER_CUSTOMIZATION}
    41     <input type="hidden" name="nb_image_page" value="{$NB_IMAGE_PAGE}">
    4245    <input type="hidden" name="theme" value="{$template_selection}">
    4346    <input type="hidden" name="recent_period" value="{$RECENT_PERIOD}">
  • trunk/themes/smartpocket/template/thumbnails.tpl

    r13182 r13234  
    33{combine_script id='photoswipe' path='themes/smartpocket/js/code.photoswipe.jquery.min.js' require='klass,jquery.mobile'}
    44
    5 {define_derivative name='derivative_params_thumb' width=150 height=150 crop=true}
     5{define_derivative name='derivative_params_thumb' width=120 height=120 crop=true}
    66{define_derivative name='derivative_params_full' type='large'}
    77
     
    1111    var options = {
    1212      jQueryMobile: true,
    13       //allowUserZoom: false,
    1413      imageScaleMethod: "fitNoUpscale"
    1514    };
    1615    $(".thumbnails a").photoSwipe(options);
    17     $(".thumbnails img").load(function() { $(this).css('border', '1px solid #3c3c3c') });
     16    $(document).bind('orientationchange', set_thumbnails_width);
     17    set_thumbnails_width();
    1818  });
    1919}(window, window.jQuery, window.Code.PhotoSwipe));
     20
     21function set_thumbnails_width() {
     22  nb_thumbs = Math.max(3, Math.ceil($('.thumbnails').width() / 130));
     23  width = Math.floor(1000000 / nb_thumbs) / 10000;
     24  $('.thumbnails li').css('width', width+'%');
     25}
     26
    2027{/literal}{/footer_script}
    21 <div data-role="content">
    2228<ul class="thumbnails">
    23 {foreach from=$thumbnails item=thumbnail}
     29{foreach from=$thumbnails item=thumbnail}{strip}
     30{if isset($page_selection[$thumbnail.id])}
    2431        <li>
    2532          <a href="{$pwg->derivative_url($derivative_params_full, $thumbnail.src_image)}" rel="external">
     
    2734    </a>
    2835  </li>
    29 {/foreach}
     36{else}
     37        <li style="display:none;">
     38          <a href="{$pwg->derivative_url($derivative_params_full, $thumbnail.src_image)}" rel="external"></a>
     39  </li>
     40{/if}
     41{/strip}{/foreach}
    3042</ul>
    31 </div>
    3243{/if}
  • trunk/themes/smartpocket/theme.css

    r13182 r13234  
    33
    44.title { margin: 10px; text-align: center; }
     5.title .ui-btn { margin-top: -5px; }
    56.menubar { float: right; }
    67.home_button { float: left; }
     8.pwg_footer h6 { margin: 8px; text-align:right;}
     9
     10.errors  h3, .infos  h3{ float:left; margin-top:8px; }
     11.errors div, .infos div { float:right; margin-top:4px; }
     12.errors p, .infos p { clear:both; font-size:85%; margin-bottom:8px; }
    713
    814.ui-icon-profil { background-image: url("images/profil.png"); background-color: transparent; }
    915
    1016.ui-content { overflow: hidden; }
    11 .ui-field-contain { padding: 5px; border: 0; }
     17.ui-field-contain, .ui-br { padding: 5px; border: 0 !important; }
    1218
    1319.thumbnails { list-style: none; padding: 0; margin: 0; }
    1420.thumbnails:after { clear: both; content: "."; display: block; height: 0; visibility: hidden; }
    15 .thumbnails li { float: left; width: 33.33333333%; }
     21.thumbnails li { float: left; }
    1622.thumbnails li a { display: block; margin: 5px; }
    1723.thumbnails li img { display: block; width: 100%; height: auto; }
  • trunk/themes/smartpocket/themeconf.inc.php

    r13182 r13234  
    1212  'mobile' => true,
    1313);
     14
     15//Retrive all pictures on thumbnails page
     16add_event_handler('loc_index_thumbnails_selection', 'sp_select_all_thumbnails');
     17
     18function sp_select_all_thumbnails($selection)
     19{
     20  global $page, $template;
     21
     22  $template->assign('page_selection', array_flip($selection));
     23
     24  return $page['items'];
     25}
     26
    1427?>
Note: See TracChangeset for help on using the changeset viewer.