Feature 1156 fixed : add privacy level to photo bulk manager in unit mode

git-svn-id: http://piwigo.org/svn/trunk@5955 68402e56-0260-453c-a942-63ccdbb3a9ee
This commit is contained in:
nikrou
2010-04-24 21:48:13 +00:00
parent acb488486e
commit fdc4577d0b
2 changed files with 37 additions and 25 deletions
+27 -25
View File
@@ -62,44 +62,45 @@ SELECT id, date_creation
{ {
$data = array(); $data = array();
$data{'id'} = $row['id']; $data['id'] = $row['id'];
$data{'name'} = $_POST['name-'.$row['id']]; $data['name'] = $_POST['name-'.$row['id']];
$data{'author'} = $_POST['author-'.$row['id']]; $data['author'] = $_POST['author-'.$row['id']];
$data['level'] = $_POST['level-'.$row['id']];
foreach (array('name', 'author') as $field) foreach (array('name', 'author', 'level') as $field)
{ {
if (!empty($_POST[$field.'-'.$row['id']])) if (!empty($_POST[$field.'-'.$row['id']]))
{ {
$data{$field} = strip_tags($_POST[$field.'-'.$row['id']]); $data[$field] = strip_tags($_POST[$field.'-'.$row['id']]);
} }
} }
if ($conf['allow_html_descriptions']) if ($conf['allow_html_descriptions'])
{ {
$data{'comment'} = @$_POST['description-'.$row['id']]; $data['comment'] = @$_POST['description-'.$row['id']];
} }
else else
{ {
$data{'comment'} = strip_tags(@$_POST['description-'.$row['id']]); $data['comment'] = strip_tags(@$_POST['description-'.$row['id']]);
} }
if (isset($_POST['date_creation_action-'.$row['id']])) if (isset($_POST['date_creation_action-'.$row['id']]))
{ {
if ('set' == $_POST['date_creation_action-'.$row['id']]) if ('set' == $_POST['date_creation_action-'.$row['id']])
{ {
$data{'date_creation'} = $data['date_creation'] =
$_POST['date_creation_year-'.$row['id']] $_POST['date_creation_year-'.$row['id']]
.'-'.$_POST['date_creation_month-'.$row['id']] .'-'.$_POST['date_creation_month-'.$row['id']]
.'-'.$_POST['date_creation_day-'.$row['id']]; .'-'.$_POST['date_creation_day-'.$row['id']];
} }
else if ('unset' == $_POST['date_creation_action-'.$row['id']]) else if ('unset' == $_POST['date_creation_action-'.$row['id']])
{ {
$data{'date_creation'} = ''; $data['date_creation'] = '';
} }
} }
else else
{ {
$data{'date_creation'} = $row['date_creation']; $data['date_creation'] = $row['date_creation'];
} }
array_push($datas, $data); array_push($datas, $data);
@@ -116,7 +117,7 @@ SELECT id, date_creation
IMAGES_TABLE, IMAGES_TABLE,
array( array(
'primary' => array('id'), 'primary' => array('id'),
'update' => array('name','author','comment','date_creation') 'update' => array('name','author','level','comment','date_creation')
), ),
$datas $datas
); );
@@ -137,22 +138,25 @@ $month_list = $lang['month'];
$month_list[0]='------------'; $month_list[0]='------------';
ksort($month_list); ksort($month_list);
$tpl_options = array();
foreach ($conf['available_permission_levels'] as $level)
{
$tpl_options[$level] = l10n( sprintf('Level %d', $level) );
}
$template->assign( $template->assign(
array( array(
'CATEGORIES_NAV'=>$page['title'], 'CATEGORIES_NAV'=>$page['title'],
'U_ELEMENTS_PAGE' 'U_ELEMENTS_PAGE'
=>$base_url.get_query_string_diff(array('display','start')), =>$base_url.get_query_string_diff(array('display','start')),
'U_GLOBAL_MODE' 'U_GLOBAL_MODE'
=> =>
$base_url $base_url
.get_query_string_diff(array('mode','display')) .get_query_string_diff(array('mode','display'))
.'&mode=global', .'&mode=global',
'F_ACTION'=>$base_url.get_query_string_diff(array()),
'F_ACTION'=>$base_url.get_query_string_diff(array()), 'month_list' => $month_list,
'level_options' => $tpl_options
'month_list' => $month_list
) )
); );
@@ -195,7 +199,7 @@ if (count($page['cat_elements_id']) > 0)
$element_ids = array(); $element_ids = array();
$query = ' $query = '
SELECT id,path,tn_ext,name,date_creation,comment,author,file SELECT id,path,tn_ext,name,date_creation,comment,author,level,file
FROM '.IMAGES_TABLE.' FROM '.IMAGES_TABLE.'
WHERE id IN ('.implode(',', $page['cat_elements_id']).') WHERE id IN ('.implode(',', $page['cat_elements_id']).')
'.$conf['order_by'].' '.$conf['order_by'].'
@@ -205,7 +209,6 @@ SELECT id,path,tn_ext,name,date_creation,comment,author,file
while ($row = pwg_db_fetch_assoc($result)) while ($row = pwg_db_fetch_assoc($result))
{ {
// echo '<pre>'; print_r($row); echo '</pre>';
array_push($element_ids, $row['id']); array_push($element_ids, $row['id']);
$src = get_thumbnail_url($row); $src = get_thumbnail_url($row);
@@ -235,19 +238,18 @@ SELECT
array( array(
'ID' => $row['id'], 'ID' => $row['id'],
'TN_SRC' => $src, 'TN_SRC' => $src,
'LEGEND' => 'LEGEND' => !empty($row['name']) ?
!empty($row['name']) ?
$row['name'] : get_name_from_file($row['file']), $row['name'] : get_name_from_file($row['file']),
'U_EDIT' => 'U_EDIT' =>
PHPWG_ROOT_PATH.'admin.php?page=picture_modify'. PHPWG_ROOT_PATH.'admin.php?page=picture_modify'.
'&amp;image_id='.$row['id'], '&amp;image_id='.$row['id'],
'NAME' => @$row['name'], 'NAME' => !empty($row['name'])?$row['name']:'',
'AUTHOR' => @$row['author'], 'AUTHOR' => !empty($row['author'])?$row['author']:'',
'DESCRIPTION' => @$row['comment'], 'LEVEL' => !empty($row['level'])?$row['level']:'',
'DESCRIPTION' => !empty($row['comment'])?$row['comment']:'',
'DATE_CREATION_YEAR' => $year, 'DATE_CREATION_YEAR' => $year,
'DATE_CREATION_MONTH' => (int)$month, 'DATE_CREATION_MONTH' => (int)$month,
'DATE_CREATION_DAY' => (int)$day, 'DATE_CREATION_DAY' => (int)$day,
'TAGS' => $tag_selection, 'TAGS' => $tag_selection,
) )
); );
@@ -101,6 +101,16 @@
</script> </script>
</td> </td>
</tr> </tr>
<tr>
<td><strong>{'Minimum privacy level'|@translate}</strong></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-{$element.ID}" size="1">
{html_options options=$level_options selected=$element.LEVEL}
</select>
</td>
</tr>
<tr> <tr>
<td><strong>{'Tags'|@translate}</strong></td> <td><strong>{'Tags'|@translate}</strong></td>