aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorplegall <plg@piwigo.org>2010-04-30 22:38:17 +0000
committerplegall <plg@piwigo.org>2010-04-30 22:38:17 +0000
commit10dac9de37eee9b73964e8370eb39333b7760c0c (patch)
treee09eb98cd0e582064453c1c0091224c6bb6ac698
parent7e82d545d50bcdc23eb260e5402a39e04c3ab348 (diff)
bug 1637: make the privacy level the same everywher, use "who can see this photo?"
instead of "minimum privacy level". git-svn-id: http://piwigo.org/svn/trunk@6025 68402e56-0260-453c-a942-63ccdbb3a9ee
-rw-r--r--admin/element_set_global.php8
-rw-r--r--admin/element_set_unit.php10
-rw-r--r--admin/photos_add_direct.php36
-rw-r--r--admin/picture_modify.php7
-rw-r--r--admin/site_update.php6
-rw-r--r--admin/themes/default/template/configuration.tpl2
-rw-r--r--admin/themes/default/template/element_set_global.tpl4
-rw-r--r--admin/themes/default/template/element_set_unit.tpl2
-rw-r--r--admin/themes/default/template/picture_modify.tpl2
-rw-r--r--admin/themes/default/template/site_update.tpl2
-rw-r--r--include/functions.inc.php42
-rw-r--r--language/en_UK/admin.lang.php1
-rw-r--r--language/fr_FR/admin.lang.php1
-rw-r--r--picture.php2
-rw-r--r--themes/default/template/picture.tpl6
15 files changed, 60 insertions, 71 deletions
diff --git a/admin/element_set_global.php b/admin/element_set_global.php
index 14d8f8a3e..f2c708022 100644
--- a/admin/element_set_global.php
+++ b/admin/element_set_global.php
@@ -409,14 +409,10 @@ $template->assign( array(
);
// image level options
-$tpl_options = array();
-foreach ($conf['available_permission_levels'] as $level)
-{
- $tpl_options[$level] = l10n( sprintf('Level %d', $level) );
-}
$template->assign(
array(
- 'level_options'=> $tpl_options,
+ 'level_options'=> get_privacy_level_options(),
+ 'level_options_selected' => 0,
)
);
diff --git a/admin/element_set_unit.php b/admin/element_set_unit.php
index 77a1d51fc..5dbeb4f68 100644
--- a/admin/element_set_unit.php
+++ b/admin/element_set_unit.php
@@ -138,12 +138,6 @@ $month_list = $lang['month'];
$month_list[0]='------------';
ksort($month_list);
-$tpl_options = array();
-foreach ($conf['available_permission_levels'] as $level)
-{
- $tpl_options[$level] = l10n( sprintf('Level %d', $level) );
-}
-
$template->assign(
array(
'CATEGORIES_NAV'=>$page['title'],
@@ -156,7 +150,7 @@ $template->assign(
.'&amp;mode=global',
'F_ACTION'=>$base_url.get_query_string_diff(array()),
'month_list' => $month_list,
- 'level_options' => $tpl_options
+ 'level_options' => get_privacy_level_options(),
)
);
@@ -245,7 +239,7 @@ SELECT
'&amp;image_id='.$row['id'],
'NAME' => !empty($row['name'])?$row['name']:'',
'AUTHOR' => !empty($row['author'])?$row['author']:'',
- 'LEVEL' => !empty($row['level'])?$row['level']:'',
+ 'LEVEL' => !empty($row['level'])?$row['level']:'0',
'DESCRIPTION' => !empty($row['comment'])?$row['comment']:'',
'DATE_CREATION_YEAR' => $year,
'DATE_CREATION_MONTH' => (int)$month,
diff --git a/admin/photos_add_direct.php b/admin/photos_add_direct.php
index 0f11a5970..31cfd1e4f 100644
--- a/admin/photos_add_direct.php
+++ b/admin/photos_add_direct.php
@@ -430,44 +430,10 @@ display_select_cat_wrapper(
// image level options
-$tpl_options = array();
-foreach (array_reverse($conf['available_permission_levels']) as $level)
-{
- $label = null;
-
- if (0 == $level)
- {
- $label = l10n('Everybody');
- }
- else
- {
- $labels = array();
- $sub_levels = array_reverse($conf['available_permission_levels']);
- foreach ($sub_levels as $sub_level)
- {
- if ($sub_level == 0 or $sub_level < $level)
- {
- break;
- }
- array_push(
- $labels,
- l10n(
- sprintf(
- 'Level %d',
- $sub_level
- )
- )
- );
- }
-
- $label = implode(', ', $labels);
- }
- $tpl_options[$level] = $label;
-}
$selected_level = isset($_POST['level']) ? $_POST['level'] : 0;
$template->assign(
array(
- 'level_options'=> $tpl_options,
+ 'level_options'=> get_privacy_level_options(),
'level_options_selected' => array($selected_level)
)
);
diff --git a/admin/picture_modify.php b/admin/picture_modify.php
index 557f97dad..a764f0bdb 100644
--- a/admin/picture_modify.php
+++ b/admin/picture_modify.php
@@ -259,15 +259,10 @@ if ($row['has_high'] == 'true')
}
// image level options
-$tpl_options = array();
-foreach ($conf['available_permission_levels'] as $level)
-{
- $tpl_options[$level] = l10n( sprintf('Level %d', $level) ).' ('.$level.')';
-}
$selected_level = isset($_POST['level']) ? $_POST['level'] : $row['level'];
$template->assign(
array(
- 'level_options'=> $tpl_options,
+ 'level_options'=> get_privacy_level_options(),
'level_options_selected' => array($selected_level)
)
);
diff --git a/admin/site_update.php b/admin/site_update.php
index a42139e92..c6cc69f03 100644
--- a/admin/site_update.php
+++ b/admin/site_update.php
@@ -890,11 +890,7 @@ else
$cat_selected = array();
}
-$tpl_introduction['privacy_level_options']=array();
-foreach ($conf['available_permission_levels'] as $level)
-{
- $tpl_introduction['privacy_level_options'][$level] = l10n( sprintf('Level %d', $level) );
-}
+$tpl_introduction['privacy_level_options'] = get_privacy_level_options();
$template->assign('introduction', $tpl_introduction);
diff --git a/admin/themes/default/template/configuration.tpl b/admin/themes/default/template/configuration.tpl
index 4db63e05c..95fe21388 100644
--- a/admin/themes/default/template/configuration.tpl
+++ b/admin/themes/default/template/configuration.tpl
@@ -377,7 +377,7 @@
<li>
<label>
- <span class="property">{'Privacy level'|@translate} ({'available for administrators only'|@translate})</span>
+ <span class="property">{'Who can see this photo?'|@translate} ({'available for administrators only'|@translate})</span>
<input type="checkbox" name="picture_informations[privacy_level]" {if ($display.picture_informations.privacy_level)}checked="checked"{/if}>
</label>
</li>
diff --git a/admin/themes/default/template/element_set_global.tpl b/admin/themes/default/template/element_set_global.tpl
index f226bff84..857512c5b 100644
--- a/admin/themes/default/template/element_set_global.tpl
+++ b/admin/themes/default/template/element_set_global.tpl
@@ -185,12 +185,12 @@
</tr>
<tr>
- <td>{'Minimum privacy level'|@translate}</td>
+ <td>{'Who can see these photos?'|@translate}</td>
<td>
<label><input type="radio" name="level_action" value="leave" checked="checked">{'leave'|@translate}</label>
<label><input type="radio" name="level_action" value="set" id="level_action_set">{'set to'|@translate}</label>
<select onchange="document.getElementById('level_action_set').checked = true;" name="level" size="1">
- {html_options options=$level_options}
+ {html_options options=$level_options selected=$level_options_selected}
</select>
</td>
</tr>
diff --git a/admin/themes/default/template/element_set_unit.tpl b/admin/themes/default/template/element_set_unit.tpl
index 5b295d1e8..a70d9075e 100644
--- a/admin/themes/default/template/element_set_unit.tpl
+++ b/admin/themes/default/template/element_set_unit.tpl
@@ -102,7 +102,7 @@
</td>
</tr>
<tr>
- <td><strong>{'Minimum privacy level'|@translate}</strong></td>
+ <td><strong>{'Who can see this photo?'|@translate}</strong></td>
<td>
<select name="level-{$element.ID}">
{html_options options=$level_options selected=$element.LEVEL}
diff --git a/admin/themes/default/template/picture_modify.tpl b/admin/themes/default/template/picture_modify.tpl
index f771a673b..d299fa718 100644
--- a/admin/themes/default/template/picture_modify.tpl
+++ b/admin/themes/default/template/picture_modify.tpl
@@ -152,7 +152,7 @@
</tr>
<tr>
- <td><strong>{'Minimum privacy level'|@translate}</strong></td>
+ <td><strong>{'Who can see this photo?'|@translate}</strong></td>
<td>
<select name="level" size="1">
{html_options options=$level_options selected=$level_options_selected}
diff --git a/admin/themes/default/template/site_update.tpl b/admin/themes/default/template/site_update.tpl
index 90a2562cf..b13c1ffc8 100644
--- a/admin/themes/default/template/site_update.tpl
+++ b/admin/themes/default/template/site_update.tpl
@@ -69,7 +69,7 @@
<ul style="padding-left:3em">
<li><label><input type="checkbox" name="display_info" value="1" {if $introduction.display_info}checked="checked"{/if}> {'display maximum informations (added categories and elements, deleted categories and elements)'|@translate}</label></li>
<li><label><input type="checkbox" name="add_to_caddie" value="1" {if $introduction.add_to_caddie}checked="checked"{/if}> {'add new elements to caddie'|@translate}</label></li>
- <li><label>{'Minimum privacy level'|@translate} <select name="privacy_level">{html_options options=$introduction.privacy_level_options selected=$introduction.privacy_level_selected}</select></label></li>
+ <li><label>{'Who can see these photos?'|@translate} <select name="privacy_level">{html_options options=$introduction.privacy_level_options selected=$introduction.privacy_level_selected}</select></label></li>
</ul>
</li>
</ul>
diff --git a/include/functions.inc.php b/include/functions.inc.php
index 16be2fca4..e44421fdb 100644
--- a/include/functions.inc.php
+++ b/include/functions.inc.php
@@ -1524,4 +1524,46 @@ function check_input_parameter($param_name, $param_array, $is_array, $pattern)
}
}
}
+
+
+function get_privacy_level_options()
+{
+ global $conf;
+
+ $options = array();
+ foreach (array_reverse($conf['available_permission_levels']) as $level)
+ {
+ $label = null;
+
+ if (0 == $level)
+ {
+ $label = l10n('Everybody');
+ }
+ else
+ {
+ $labels = array();
+ $sub_levels = array_reverse($conf['available_permission_levels']);
+ foreach ($sub_levels as $sub_level)
+ {
+ if ($sub_level == 0 or $sub_level < $level)
+ {
+ break;
+ }
+ array_push(
+ $labels,
+ l10n(
+ sprintf(
+ 'Level %d',
+ $sub_level
+ )
+ )
+ );
+ }
+
+ $label = implode(', ', $labels);
+ }
+ $options[$level] = $label;
+ }
+ return $options;
+}
?> \ No newline at end of file
diff --git a/language/en_UK/admin.lang.php b/language/en_UK/admin.lang.php
index 472d6e28f..990cb98ee 100644
--- a/language/en_UK/admin.lang.php
+++ b/language/en_UK/admin.lang.php
@@ -670,6 +670,7 @@ $lang['Select files'] = 'Select files';
$lang['JPEG files or ZIP archives with JPEG files inside please.'] = 'JPEG files or ZIP archives with JPEG files inside please.';
$lang['Everybody'] = 'Everybody';
$lang['Who can see these photos?'] = 'Who can see these photos?';
+$lang['Who can see this photo?'] = 'Who can see this photo?';
$lang['... or switch to the old style form'] = '... or switch to the old style form';
$lang['... or switch to the multiple files form'] = '... or switch to the multiple files form';
diff --git a/language/fr_FR/admin.lang.php b/language/fr_FR/admin.lang.php
index ded4f38ab..d2d13861d 100644
--- a/language/fr_FR/admin.lang.php
+++ b/language/fr_FR/admin.lang.php
@@ -671,6 +671,7 @@ $lang['Select files'] = 'Choisir des fichiers';
$lang['JPEG files or ZIP archives with JPEG files inside please.'] = 'Fichiers JPEG ou archives ZIP contenant des fichiers JPEG s\'il vous plaît.';
$lang['Everybody'] = 'Tout le monde';
$lang['Who can see these photos?'] = 'Qui peut voir ces photos ?';
+$lang['Who can see this photo?'] = 'Qui peut voir cette photo ?';
$lang['... or switch to the old style form'] = '... ou utiliser le formulaire "à l\'ancienne"';
$lang['... or switch to the multiple files form'] = '... ou utiliser le formulaire multi-fichiers';
diff --git a/picture.php b/picture.php
index ecaee0caa..80679b19f 100644
--- a/picture.php
+++ b/picture.php
@@ -782,7 +782,7 @@ if (is_admin())
)
);
- $template->assign('available_permission_levels', $conf['available_permission_levels']);
+ $template->assign('available_permission_levels', get_privacy_level_options());
}
// favorite manipulation
diff --git a/themes/default/template/picture.tpl b/themes/default/template/picture.tpl
index 73bd52840..39ef2ee9d 100644
--- a/themes/default/template/picture.tpl
+++ b/themes/default/template/picture.tpl
@@ -222,7 +222,7 @@ y.callService(
{if $display_info.privacy_level and isset($available_permission_levels) }
<tr id="Privacy">
- <td class="label">{'Privacy level'|@translate}:</td>
+ <td class="label">{'Who can see this photo?'|@translate}</td>
<td class="value">
<script type="text/javascript">
{literal}function setPrivacyLevel(selectElement, rootUrl, id, level)
@@ -240,9 +240,7 @@ y.callService(
}{/literal}
</script>
<select onchange="setPrivacyLevel(this, '{$ROOT_URL|@escape:'javascript'}', {$current.id}, this.options[selectedIndex].value)">
- {foreach from=$available_permission_levels item=level}
- <option value="{$level}"{if $current.level==$level} selected="selected"{/if}>{$pwg->l10n($pwg->sprintf('Level %d',$level))}</option>
- {/foreach}
+ {html_options options=$available_permission_levels selected=$current.level}
</select>
</td></tr>
{/if}