feature:2577
Many improvements git-svn-id: http://piwigo.org/svn/trunk@13234 68402e56-0260-453c-a942-63ccdbb3a9ee
This commit is contained in:
parent
4b696df2da
commit
26ed60c972
20 changed files with 184 additions and 55 deletions
|
|
@ -35,6 +35,8 @@ $selection = array_slice(
|
|||
$page['nb_image_page']
|
||||
);
|
||||
|
||||
$selection = trigger_event('loc_index_thumbnails_selection', $selection);
|
||||
|
||||
if (count($selection) > 0)
|
||||
{
|
||||
$rank_of = array_flip($selection);
|
||||
|
|
|
|||
|
|
@ -192,28 +192,7 @@ if (defined('IN_ADMIN') and IN_ADMIN )
|
|||
}
|
||||
else
|
||||
{ // Classic template
|
||||
$theme = $user['theme'];
|
||||
|
||||
if (!isset($_SESSION['is_mobile']))
|
||||
{
|
||||
include_once(PHPWG_ROOT_PATH.'include/mdetect.php');
|
||||
$uagent_obj = new uagent_info();
|
||||
if ($_SESSION['is_mobile'] = $uagent_obj->DetectMobileLong())
|
||||
{
|
||||
$_SESSION['use_mobile_theme'] = !empty($conf['mobile_theme']);
|
||||
}
|
||||
}
|
||||
if ($_SESSION['is_mobile'])
|
||||
{
|
||||
if (isset($_REQUEST['mobile']))
|
||||
{
|
||||
$_SESSION['use_mobile_theme'] = get_boolean($_REQUEST['mobile']);
|
||||
}
|
||||
if ($_SESSION['use_mobile_theme'])
|
||||
{
|
||||
$theme = $conf['mobile_theme'];
|
||||
}
|
||||
}
|
||||
$theme = mobile_theme() ? $conf['mobile_theme'] : $user['theme'];
|
||||
$template = new Template(PHPWG_ROOT_PATH.'themes', $theme );
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1678,4 +1678,65 @@ function get_branch_from_version($version)
|
|||
{
|
||||
return implode('.', array_slice(explode('.', $version), 0, 2));
|
||||
}
|
||||
|
||||
/**
|
||||
* return the device type: mobile, tablet or desktop
|
||||
*/
|
||||
function get_device()
|
||||
{
|
||||
$device = pwg_get_session_var('device');
|
||||
|
||||
if (is_null($device))
|
||||
{
|
||||
include_once(PHPWG_ROOT_PATH.'include/mdetect.php');
|
||||
$uagent_obj = new uagent_info();
|
||||
if ($uagent_obj->DetectTierIphone())
|
||||
{
|
||||
$device = 'mobile';
|
||||
}
|
||||
elseif ($uagent_obj->DetectTierTablet())
|
||||
{
|
||||
$device = 'tablet';
|
||||
}
|
||||
else
|
||||
{
|
||||
$device = 'desktop';
|
||||
}
|
||||
pwg_set_session_var('device', $device);
|
||||
}
|
||||
|
||||
return $device;
|
||||
}
|
||||
|
||||
/**
|
||||
* return true if mobile theme should be loaded
|
||||
*/
|
||||
function mobile_theme()
|
||||
{
|
||||
global $conf;
|
||||
|
||||
if (empty($conf['mobile_theme']))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (isset($_GET['mobile']))
|
||||
{
|
||||
$is_mobile_theme = get_boolean($_GET['mobile']);
|
||||
pwg_set_session_var('mobile_theme', $is_mobile_theme);
|
||||
unset($_GET['mobile']);
|
||||
}
|
||||
else
|
||||
{
|
||||
$is_mobile_theme = pwg_get_session_var('mobile_theme');
|
||||
}
|
||||
|
||||
if (is_null($is_mobile_theme))
|
||||
{
|
||||
$is_mobile_theme = (get_device() == 'mobile');
|
||||
pwg_set_session_var('mobile_theme', $is_mobile_theme);
|
||||
}
|
||||
|
||||
return $is_mobile_theme;
|
||||
}
|
||||
?>
|
||||
|
|
@ -65,6 +65,17 @@ if ($conf['show_gt'])
|
|||
|
||||
$template->assign('debug', $debug_vars );
|
||||
|
||||
//------------------------------------------------------------- mobile version
|
||||
if (get_device() != 'desktop')
|
||||
{
|
||||
$template->assign('TOGGLE_MOBILE_THEME_URL',
|
||||
add_url_params(
|
||||
make_index_url(),
|
||||
array('mobile' => mobile_theme() ? 'false' : 'true')
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
trigger_action('loc_end_page_tail');
|
||||
//
|
||||
// Generate the page
|
||||
|
|
|
|||
|
|
@ -846,5 +846,4 @@ $lang['Not cropped correctly?'] = 'Not cropped correctly?';
|
|||
$lang['Center of interest'] = 'Center of interest';
|
||||
$lang['Move to album'] = 'Move to album';
|
||||
$lang['You can activate only one mobile theme.'] = 'You can activate only one mobile theme.';
|
||||
$lang['mobile'] = 'mobile';
|
||||
?>
|
||||
|
|
@ -383,4 +383,7 @@ $lang['Password: %s'] = 'Password: %s';
|
|||
$lang['Username: %s'] = 'Username: %s';
|
||||
$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';
|
||||
$lang['Photo sizes'] = 'Photo sizes';
|
||||
$lang['View in'] = 'View in';
|
||||
$lang['Mobile'] = 'Mobile';
|
||||
$lang['Desktop'] = 'Desktop';
|
||||
?>
|
||||
|
|
@ -844,7 +844,6 @@ $lang['This album contains no photo.'] = 'Cet album ne contient pas de photo.';
|
|||
$lang['%s has been successfully updated.'] = '%s a été mis à jour avec succès.';
|
||||
$lang['Move to album'] = 'Déplacer vers l\'album';
|
||||
$lang['You can activate only one mobile theme.'] = 'Vous ne pouvez activer qu\'un seul thème mobile.';
|
||||
$lang['mobile'] = 'mobile';
|
||||
$lang['Center of interest'] = 'Centre d\'interêt';
|
||||
$lang['Not cropped correctly?'] = 'La photo n\'est pas recadrée corectement ?';
|
||||
$lang['Photo name'] = 'Nom de la photo';
|
||||
|
|
|
|||
|
|
@ -383,4 +383,7 @@ $lang['xlarge'] = "XLarge";
|
|||
$lang['xxlarge'] = "XXLarge";
|
||||
$lang['Show latest comments first'] = 'Montrer les commentaires les plus récents en premier';
|
||||
$lang['Show oldest comments first'] = 'Montrer les commentaires les plus anciens en premier';
|
||||
$lang['View in'] = 'Affichage';
|
||||
$lang['Mobile'] = 'Mobile';
|
||||
$lang['Desktop'] = 'Classique';
|
||||
?>
|
||||
|
|
@ -13,6 +13,9 @@
|
|||
- {'Contact'|@translate}
|
||||
<a href="mailto:{$CONTACT_MAIL}?subject={'A comment on your site'|@translate|@escape:url}">{'Webmaster'|@translate}</a>
|
||||
{/if}
|
||||
{if isset($TOGGLE_MOBILE_THEME_URL)}
|
||||
- {'Display'|@translate} : <a href="{$TOGGLE_MOBILE_THEME_URL}">{'Mobile'|@translate}</a> | <b>{'Classic'|@translate}</b>
|
||||
{/if}
|
||||
|
||||
{get_combined_scripts load='footer'}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,19 @@
|
|||
|
||||
{if !empty($navbar)}
|
||||
{include file='navigation_bar.tpl'|@get_extent:'navbar'}
|
||||
{else}
|
||||
<div class="pwg_footer ui-bar-a">
|
||||
<h6>
|
||||
{'Powered by'|@translate} <a href="{$PHPWG_URL}" class="Piwigo">Piwigo</a>
|
||||
{$VERSION}
|
||||
{if isset($CONTACT_MAIL)}
|
||||
- {'Contact'|@translate}
|
||||
<a href="mailto:{$CONTACT_MAIL}?subject={'A comment on your site'|@translate|@escape:url}">{'Webmaster'|@translate}</a>
|
||||
{/if}
|
||||
<br>{'Display'|@translate} :
|
||||
<b>{'Mobile'|@translate}</b> | <a href="{$TOGGLE_MOBILE_THEME_URL}">{'Classic'|@translate}</a>
|
||||
</h6>
|
||||
</div>
|
||||
{/if}
|
||||
{get_combined_scripts load='footer'}
|
||||
</div><!-- /page -->
|
||||
|
||||
|
|
|
|||
|
|
@ -46,9 +46,9 @@
|
|||
</head>
|
||||
|
||||
<body>
|
||||
<div data-role="page">
|
||||
<div data-role="page" data-theme="a">
|
||||
|
||||
<div data-role="header" data-theme="c">
|
||||
<div data-role="header">
|
||||
<div class="title">
|
||||
<a href="{$U_HOME}" class="home_button" data-icon="home" data-iconpos="notext" data-role="button"></a>
|
||||
{$GALLERY_TITLE}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
<div data-role="content">
|
||||
<div data-role="content" data-theme="a">
|
||||
{if !empty($CATEGORIES)}{$CATEGORIES}{/if}
|
||||
{if !empty($THUMBNAILS)}{$THUMBNAILS}{/if}
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -1,19 +1,23 @@
|
|||
{if isset($errors) }
|
||||
<div class="errors">
|
||||
<ul>
|
||||
{foreach from=$errors item=error}
|
||||
<li>{$error}</li>
|
||||
{/foreach}
|
||||
</ul>
|
||||
{if isset($errors)}
|
||||
<div class="ui-bar ui-bar-e errors">
|
||||
<h3>{'Error'|@translate}</h3>
|
||||
<div><a href="#" data-role="button" data-icon="delete" data-iconpos="notext" class="close-button">Button</a></div>
|
||||
<p>{'<br>'|@implode:$errors}</p>
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
{if not empty($infos)}
|
||||
<div class="infos">
|
||||
<ul>
|
||||
{foreach from=$infos item=info}
|
||||
<li>{$info}</li>
|
||||
{/foreach}
|
||||
</ul>
|
||||
<div class="ui-bar ui-bar-b infos">
|
||||
<h3>{'Info'|@translate}</h3>
|
||||
<div><a href="#" data-role="button" data-icon="delete" data-iconpos="notext" class="close-button">Button</a></div>
|
||||
<p>{'<br>'|@implode:$infos}</p>
|
||||
</div>
|
||||
{/if}
|
||||
{/if}
|
||||
|
||||
{footer_script}{literal}
|
||||
$(document).ready(function () {
|
||||
$('.close-button').click(function() {
|
||||
$(this).parents('.ui-bar').remove();
|
||||
});
|
||||
});
|
||||
{/literal}{/footer_script}
|
||||
|
|
@ -1,6 +1,7 @@
|
|||
<select name="identification" id="identification" data-icon="grid" data-iconpos="notext" data-native-menu="false">
|
||||
|
||||
<option value="" data-placeholder="true">{'Identification'|@translate}</option>
|
||||
<option></option>
|
||||
<optgroup label="{'Identification'|@translate}">
|
||||
|
||||
{if isset($U_REGISTER)}
|
||||
<option value="{$U_REGISTER}">{'Register'|@translate}</option>
|
||||
|
|
@ -18,6 +19,8 @@
|
|||
<option value="{$U_ADMIN}">{'Administration'|@translate}</option>
|
||||
{/if}
|
||||
|
||||
</optgroup>
|
||||
|
||||
</select>
|
||||
|
||||
{footer_script}{literal}
|
||||
|
|
|
|||
14
themes/smartpocket/template/navigation_bar.tpl
Normal file
14
themes/smartpocket/template/navigation_bar.tpl
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
{capture}{$navbar.pages|@end}{/capture}
|
||||
<div class="ui-bar ui-bar-a" style="text-align:center;">
|
||||
<div data-role="controlgroup" data-type="horizontal">
|
||||
{strip}
|
||||
{if isset($navbar.URL_PREV)}
|
||||
<a href="{$navbar.URL_PREV}" rel="prev" data-role="button" data-icon="arrow-l" data-inline="true">{'Previous'|@translate}</a>
|
||||
{/if}
|
||||
<a href="#" data-role="button" data-inline="true">{$navbar.CURRENT_PAGE} / {$navbar.pages|@key} </a>
|
||||
{if isset($navbar.URL_NEXT)}
|
||||
<a href="{$navbar.URL_NEXT}" rel="next" data-role="button" data-icon="arrow-r" data-iconpos="right" data-inline="true">{'Next'|@translate}</a>
|
||||
{/if}
|
||||
{/strip}
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
<div data-role="content">
|
||||
{include file='infos_errors.tpl'}
|
||||
<div data-role="content">
|
||||
{$PROFILE_CONTENT}
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -1,4 +1,3 @@
|
|||
|
||||
<form method="post" name="profile" action="{$F_ACTION}" id="profile" class="properties">
|
||||
|
||||
<div data-role="fieldcontain">
|
||||
|
|
@ -29,6 +28,11 @@
|
|||
{/if}
|
||||
|
||||
{if $ALLOW_USER_CUSTOMIZATION}
|
||||
<div data-role="fieldcontain">
|
||||
<label for="nb_image_page">{'Number of photos per page'|@translate}</label>
|
||||
<input type="range" name="nb_image_page" id="nb_image_page" value="{$NB_IMAGE_PAGE}" min="1" max="100" />
|
||||
</div>
|
||||
|
||||
<div data-role="fieldcontain">
|
||||
<label for="language">{'Language'|@translate}</label>
|
||||
{html_options name=language options=$language_options selected=$language_selection}
|
||||
|
|
@ -38,7 +42,6 @@
|
|||
|
||||
<div data-role="fieldcontain">
|
||||
{if $ALLOW_USER_CUSTOMIZATION}
|
||||
<input type="hidden" name="nb_image_page" value="{$NB_IMAGE_PAGE}">
|
||||
<input type="hidden" name="theme" value="{$template_selection}">
|
||||
<input type="hidden" name="recent_period" value="{$RECENT_PERIOD}">
|
||||
<input type="hidden" name="expand" value="{$EXPAND}">
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
{combine_script id='klass' path='themes/smartpocket/js/klass.min.js'}
|
||||
{combine_script id='photoswipe' path='themes/smartpocket/js/code.photoswipe.jquery.min.js' require='klass,jquery.mobile'}
|
||||
|
||||
{define_derivative name='derivative_params_thumb' width=150 height=150 crop=true}
|
||||
{define_derivative name='derivative_params_thumb' width=120 height=120 crop=true}
|
||||
{define_derivative name='derivative_params_full' type='large'}
|
||||
|
||||
{footer_script}{literal}
|
||||
|
|
@ -10,23 +10,34 @@
|
|||
$(document).ready(function(){
|
||||
var options = {
|
||||
jQueryMobile: true,
|
||||
//allowUserZoom: false,
|
||||
imageScaleMethod: "fitNoUpscale"
|
||||
};
|
||||
$(".thumbnails a").photoSwipe(options);
|
||||
$(".thumbnails img").load(function() { $(this).css('border', '1px solid #3c3c3c') });
|
||||
$(document).bind('orientationchange', set_thumbnails_width);
|
||||
set_thumbnails_width();
|
||||
});
|
||||
}(window, window.jQuery, window.Code.PhotoSwipe));
|
||||
|
||||
function set_thumbnails_width() {
|
||||
nb_thumbs = Math.max(3, Math.ceil($('.thumbnails').width() / 130));
|
||||
width = Math.floor(1000000 / nb_thumbs) / 10000;
|
||||
$('.thumbnails li').css('width', width+'%');
|
||||
}
|
||||
|
||||
{/literal}{/footer_script}
|
||||
<div data-role="content">
|
||||
<ul class="thumbnails">
|
||||
{foreach from=$thumbnails item=thumbnail}
|
||||
{foreach from=$thumbnails item=thumbnail}{strip}
|
||||
{if isset($page_selection[$thumbnail.id])}
|
||||
<li>
|
||||
<a href="{$pwg->derivative_url($derivative_params_full, $thumbnail.src_image)}" rel="external">
|
||||
<img src="{$pwg->derivative_url($derivative_params_thumb, $thumbnail.src_image)}" alt="{$thumbnail.TN_ALT}">
|
||||
</a>
|
||||
</li>
|
||||
{/foreach}
|
||||
</ul>
|
||||
</div>
|
||||
{else}
|
||||
<li style="display:none;">
|
||||
<a href="{$pwg->derivative_url($derivative_params_full, $thumbnail.src_image)}" rel="external"></a>
|
||||
</li>
|
||||
{/if}
|
||||
{/strip}{/foreach}
|
||||
</ul>
|
||||
{/if}
|
||||
|
|
|
|||
|
|
@ -2,16 +2,22 @@
|
|||
@import "photoswipe.css";
|
||||
|
||||
.title { margin: 10px; text-align: center; }
|
||||
.title .ui-btn { margin-top: -5px; }
|
||||
.menubar { float: right; }
|
||||
.home_button { float: left; }
|
||||
.pwg_footer h6 { margin: 8px; text-align:right;}
|
||||
|
||||
.errors h3, .infos h3{ float:left; margin-top:8px; }
|
||||
.errors div, .infos div { float:right; margin-top:4px; }
|
||||
.errors p, .infos p { clear:both; font-size:85%; margin-bottom:8px; }
|
||||
|
||||
.ui-icon-profil { background-image: url("images/profil.png"); background-color: transparent; }
|
||||
|
||||
.ui-content { overflow: hidden; }
|
||||
.ui-field-contain { padding: 5px; border: 0; }
|
||||
.ui-field-contain, .ui-br { padding: 5px; border: 0 !important; }
|
||||
|
||||
.thumbnails { list-style: none; padding: 0; margin: 0; }
|
||||
.thumbnails:after { clear: both; content: "."; display: block; height: 0; visibility: hidden; }
|
||||
.thumbnails li { float: left; width: 33.33333333%; }
|
||||
.thumbnails li { float: left; }
|
||||
.thumbnails li a { display: block; margin: 5px; }
|
||||
.thumbnails li img { display: block; width: 100%; height: auto; }
|
||||
|
|
|
|||
|
|
@ -11,4 +11,17 @@ Author URI: http://piwigo.org
|
|||
$themeconf = array(
|
||||
'mobile' => true,
|
||||
);
|
||||
|
||||
//Retrive all pictures on thumbnails page
|
||||
add_event_handler('loc_index_thumbnails_selection', 'sp_select_all_thumbnails');
|
||||
|
||||
function sp_select_all_thumbnails($selection)
|
||||
{
|
||||
global $page, $template;
|
||||
|
||||
$template->assign('page_selection', array_flip($selection));
|
||||
|
||||
return $page['items'];
|
||||
}
|
||||
|
||||
?>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue