Skip to content

Commit

Permalink
bug:3122
Browse files Browse the repository at this point in the history
removed admin files profile.tpl and profile_content.tpl, integrated in configuration.tpl
take into account default_user_id with a message
prefix for template var, to avoid overwriting of already existing vars especially in admin panel

git-svn-id: http://piwigo.org/svn/trunk@29221 68402e56-0260-453c-a942-63ccdbb3a9ee
  • Loading branch information
flop25 committed Aug 15, 2014
1 parent 557fccb commit 416233c
Show file tree
Hide file tree
Showing 6 changed files with 76 additions and 116 deletions.
3 changes: 2 additions & 1 deletion admin/configuration.php
Expand Up @@ -419,7 +419,8 @@ function order_by_is_local()
load_profile_in_template(
$action,
'',
$edit_user
$edit_user,
'GUEST_'
);
$template->assign('default', array());
break;
Expand Down
51 changes: 50 additions & 1 deletion admin/themes/default/template/configuration.tpl
Expand Up @@ -854,6 +854,55 @@ jQuery("input[name='mail_theme']").change(function() {

{if isset($default)}
<div id="configContent">
{$PROFILE_CONTENT}
<form method="post" name="profile" action="{$GUEST_F_ACTION}" id="profile" class="properties">

{if $GUEST_USERNAME!='guest'}
<fieldset>
{'The settings for the guest are from the %s user'|@translate:$GUEST_USERNAME}
</fieldset>
{/if}

<fieldset>
<legend>{'Preferences'|@translate}</legend>
<input type="hidden" name="redirect" value="{$GUEST_REDIRECT}">

<ul>
<li>
<span class="property">
<label for="nb_image_page">{'Number of photos per page'|@translate}</label>
</span>
<input type="text" size="4" maxlength="3" name="nb_image_page" id="nb_image_page" value="{$GUEST_NB_IMAGE_PAGE}">
</li>
<li>
<span class="property">
<label for="recent_period">{'Recent period'|@translate}</label>
</span>
<input type="text" size="3" maxlength="2" name="recent_period" id="recent_period" value="{$GUEST_RECENT_PERIOD}">
</li>
<li>
<span class="property">{'Expand all albums'|@translate}</span>
{html_radios name='expand' options=$radio_options selected=$GUEST_EXPAND}
</li>
{if $GUEST_ACTIVATE_COMMENTS}
<li>
<span class="property">{'Show number of comments'|@translate}</span>
{html_radios name='show_nb_comments' options=$radio_options selected=$GUEST_NB_COMMENTS}
</li>
{/if}
<li>
<span class="property">{'Show number of hits'|@translate}</span>
{html_radios name='show_nb_hits' options=$radio_options selected=$GUEST_NB_HITS}
</li>
</ul>
</fieldset>

<p class="bottomButtons">
<input type="hidden" name="pwg_token" value="{$PWG_TOKEN}">
<input class="submit" type="submit" name="validate" value="{'Submit'|@translate}">
<input class="submit" type="reset" name="reset" value="{'Reset'|@translate}">
</p>

</form>

</div>
{/if}
5 changes: 0 additions & 5 deletions admin/themes/default/template/profile.tpl

This file was deleted.

93 changes: 0 additions & 93 deletions admin/themes/default/template/profile_content.tpl

This file was deleted.

1 change: 1 addition & 0 deletions language/en_UK/admin.lang.php
Expand Up @@ -802,6 +802,7 @@
$lang['The picture dimensions will be reduced to %dx%d pixels.'] = 'The picture dimensions will be reduced to %dx%d pixels.';
$lang['The Piwigo export plugin allows you to create albums and export photos.'] = 'The Piwigo export plugin allows you to create albums and export photos.';
$lang['The Piwigo publish Plug-in allows you to export and synchronize photos from Lightroom directly to your Piwigo photo gallery.'] = 'The Piwigo publish Plug-in allows you to export and synchronize photos from Lightroom directly to your Piwigo photo gallery.';
$lang['The settings for the guest are from the %s user']='The settings for the guest are from the %s user'
$lang['The uploaded file exceeds the MAX_FILE_SIZE directive that was specified in the HTML form'] = 'The uploaded file exceeds the MAX_FILE_SIZE directive that was specified in the HTML form';
$lang['The uploaded file exceeds the upload_max_filesize directive in php.ini: %sB'] = 'The uploaded file exceeds the upload_max_filesize directive in php.ini: %sB';
$lang['The uploaded file was only partially uploaded'] = 'The uploaded file was only partially uploaded';
Expand Down
39 changes: 23 additions & 16 deletions profile.php
Expand Up @@ -69,11 +69,14 @@
$title= l10n('Your Gallery Customization');
$page['body_id'] = 'theProfilePage';
$template->set_filename('profile', 'profile.tpl');
$template->set_filename('profile_content', 'profile_content.tpl');

load_profile_in_template(
get_root_url().'profile.php', // action
make_index_url(), // for redirect
$userdata );
$template->assign_var_from_handle('PROFILE_CONTENT', 'profile_content');



// include menubar
Expand Down Expand Up @@ -289,31 +292,36 @@ function save_profile_from_post($userdata, &$errors)
return true;
}


function load_profile_in_template($url_action, $url_redirect, $userdata)
/**
* Assign template variables, from arguments
* Used to build profile edition pages
*
* @param string $url_action
* @param string $url_redirect
* @param array $userdata
*/
function load_profile_in_template($url_action, $url_redirect, $userdata, $template_prefixe=null)
{
global $template, $conf;

$template->set_filename('profile_content', 'profile_content.tpl');

$template->assign('radio_options',
array(
'true' => l10n('Yes'),
'false' => l10n('No')));

$template->assign(
array(
'USERNAME'=>stripslashes($userdata['username']),
'EMAIL'=>@$userdata['email'],
'ALLOW_USER_CUSTOMIZATION'=>$conf['allow_user_customization'],
'ACTIVATE_COMMENTS'=>$conf['activate_comments'],
'NB_IMAGE_PAGE'=>$userdata['nb_image_page'],
'RECENT_PERIOD'=>$userdata['recent_period'],
'EXPAND' =>$userdata['expand'] ? 'true' : 'false',
'NB_COMMENTS'=>$userdata['show_nb_comments'] ? 'true' : 'false',
'NB_HITS'=>$userdata['show_nb_hits'] ? 'true' : 'false',
'REDIRECT' => $url_redirect,
'F_ACTION'=>$url_action,
$template_prefixe.'USERNAME'=>stripslashes($userdata['username']),
$template_prefixe.'EMAIL'=>@$userdata['email'],
$template_prefixe.'ALLOW_USER_CUSTOMIZATION'=>$conf['allow_user_customization'],
$template_prefixe.'ACTIVATE_COMMENTS'=>$conf['activate_comments'],
$template_prefixe.'NB_IMAGE_PAGE'=>$userdata['nb_image_page'],
$template_prefixe.'RECENT_PERIOD'=>$userdata['recent_period'],
$template_prefixe.'EXPAND' =>$userdata['expand'] ? 'true' : 'false',
$template_prefixe.'NB_COMMENTS'=>$userdata['show_nb_comments'] ? 'true' : 'false',
$template_prefixe.'NB_HITS'=>$userdata['show_nb_hits'] ? 'true' : 'false',
$template_prefixe.'REDIRECT' => $url_redirect,
$template_prefixe.'F_ACTION'=>$url_action,
));

$template->assign('template_selection', $userdata['theme']);
Expand All @@ -338,6 +346,5 @@ function load_profile_in_template($url_action, $url_redirect, $userdata)
trigger_notify( 'load_profile_in_template', $userdata );

$template->assign('PWG_TOKEN', get_pwg_token());
$template->assign_var_from_handle('PROFILE_CONTENT', 'profile_content');
}
?>

0 comments on commit 416233c

Please sign in to comment.