From 92f80e5d799aa7fef5f00cbf5c27e32f92c4b2ea Mon Sep 17 00:00:00 2001 From: rvelices Date: Tue, 11 Sep 2007 02:24:51 +0000 Subject: feature 731: permissions at image level - this is the first version - I wait for feedback before changing help files git-svn-id: http://piwigo.org/svn/trunk@2084 68402e56-0260-453c-a942-63ccdbb3a9ee --- admin/element_set_global.php | 33 +++++++++++++++++++++++++++++---- 1 file changed, 29 insertions(+), 4 deletions(-) (limited to 'admin/element_set_global.php') diff --git a/admin/element_set_global.php b/admin/element_set_global.php index b3f254b10..6cb0aab39 100644 --- a/admin/element_set_global.php +++ b/admin/element_set_global.php @@ -136,7 +136,7 @@ DELETE $datas = array(); $dbfields = array('primary' => array('id'), 'update' => array()); - $formfields = array('author', 'name', 'date_creation'); + $formfields = array('author', 'name', 'date_creation', 'level'); foreach ($formfields as $formfield) { if ($_POST[$formfield.'_action'] != 'leave') @@ -163,7 +163,6 @@ SELECT id if ('set' == $_POST['author_action']) { $data['author'] = $_POST['author']; - if ('' == $data['author']) { unset($data['author']); @@ -173,7 +172,6 @@ SELECT id if ('set' == $_POST['name_action']) { $data['name'] = $_POST['name']; - if ('' == $data['name']) { unset($data['name']); @@ -189,6 +187,11 @@ SELECT id ; } + if ('set' == $_POST['level_action']) + { + $data['level'] = $_POST['level']; + } + array_push($datas, $data); } // echo '
'; print_r($datas); echo '
'; @@ -345,6 +348,18 @@ else } $template->assign_vars(array('DATE_CREATION_YEAR_VALUE'=>$year)); +// image level options +$blockname = 'level_option'; +foreach ($conf['available_permission_levels'] as $level) +{ + $template->assign_block_vars( + $blockname, + array( + 'VALUE' => $level, + 'CONTENT' => l10n( sprintf('Level %d', $level) ), + )); +} + // +-----------------------------------------------------------------------+ // | global mode thumbnails | // +-----------------------------------------------------------------------+ @@ -377,7 +392,7 @@ if (count($page['cat_elements_id']) > 0) $template->assign_vars(array('NAV_BAR' => $nav_bar)); $query = ' -SELECT id,path,tn_ext,file,filesize +SELECT id,path,tn_ext,file,filesize,level FROM '.IMAGES_TABLE.' WHERE id IN ('.implode(',', $page['cat_elements_id']).') '.$conf['order_by'].' @@ -405,6 +420,16 @@ SELECT id,path,tn_ext,file,filesize 'TITLE' => get_thumbnail_title($row) ) ); + + if ( $row['level']>0 ) + { + $template->assign_block_vars('thumbnails.thumbnail.level', + array( + 'LEVEL' => $row['level'], + 'TITLE' => l10n( sprintf('Level %d', $row['level']) ), + ) + ); + } } } -- cgit v1.2.3