From dded962ded654bbb73eb144d77bea681aad95868 Mon Sep 17 00:00:00 2001 From: plegall Date: Fri, 19 Aug 2005 19:07:13 +0000 Subject: [PATCH] - improvement : less compact presentation of screen admin/element_set_unit. git-svn-id: http://piwigo.org/svn/trunk@836 68402e56-0260-453c-a942-63ccdbb3a9ee --- admin/element_set_unit.php | 90 ++++++++++++++------- doc/ChangeLog | 5 ++ template/default/admin/cat_modify.tpl | 2 +- template/default/admin/element_set_unit.tpl | 65 +++++++-------- template/default/admin/picture_modify.tpl | 2 +- template/default/default.css | 11 +++ 6 files changed, 113 insertions(+), 62 deletions(-) diff --git a/admin/element_set_unit.php b/admin/element_set_unit.php index 15dcd62a3..9ccbf9346 100644 --- a/admin/element_set_unit.php +++ b/admin/element_set_unit.php @@ -45,17 +45,7 @@ if (isset($_POST['submit'])) { $collection = explode(',', $_POST['list']); -// echo '
';
-//   print_r($_POST);
-//   echo '
'; -// exit(); - $datas = array(); - $dbfields = - array( - 'primary' => array('id'), - 'update' => array('name','author','comment','date_creation','keywords') - ); $query = ' SELECT id, date_creation @@ -67,34 +57,70 @@ SELECT id, date_creation while ($row = mysql_fetch_array($result)) { $data = array(); - $data['id'] = $row['id']; - - foreach (array_diff($dbfields['update'], array('date_creation')) as $field) + + $data{'id'} = $row['id']; + $data{'name'} = $_POST['name-'.$row['id']]; + $data{'author'} = $_POST['author-'.$row['id']]; + + foreach (array('name', 'author') as $field) { if (!empty($_POST[$field.'-'.$row['id']])) { - $data[$field] = $_POST[$field.'-'.$row['id']]; + $data{$field} = strip_tags($_POST[$field.'-'.$row['id']]); } } - - if ('set' == $_POST['date_creation_action-'.$row['id']]) + + if ($conf['allow_html_descriptions']) { - $data['date_creation'] = - $_POST['date_creation_year-'.$row['id']] - .'-'.$_POST['date_creation_month-'.$row['id']] - .'-'.$_POST['date_creation_day-'.$row['id']] - ; + $data{'comment'} = @$_POST['description-'.$row['id']]; } - else if ('leave' == $_POST['date_creation_action-'.$row['id']] - and !empty($row['date_creation'])) + else { - $data['date_creation'] = $row['date_creation']; + $data{'comment'} = strip_tags(@$_POST['description-'.$row['id']]); + } + + if (isset($_POST['date_creation_action-'.$row['id']])) + { + if ('set' == $_POST['date_creation_action-'.$row['id']]) + { + $data{'date_creation'} = + $_POST['date_creation_year-'.$row['id']] + .'-'.$_POST['date_creation_month-'.$row['id']] + .'-'.$_POST['date_creation_day-'.$row['id']]; + } + else if ('unset' == $_POST['date_creation_action-'.$row['id']]) + { + $data{'date_creation'} = ''; + } + } + else + { + $data{'date_creation'} = $row['date_creation']; + } + + $keywords = get_keywords($_POST['keywords-'.$row['id']]); + if (count($keywords) > 0) + { + $data{'keywords'} = implode(',', $keywords); + } + else + { + $data{'keywords'} = ''; } array_push($datas, $data); } - // echo '
'; print_r($datas); echo '
'; - mass_updates(IMAGES_TABLE, $dbfields, $datas); + + mass_updates( + IMAGES_TABLE, + array( + 'primary' => array('id'), + 'update' => array('name','author','comment','date_creation','keywords') + ), + $datas + ); + + array_push($page['infos'], l10n('Picture informations updated')); } // +-----------------------------------------------------------------------+ @@ -148,7 +174,7 @@ if (count($page['cat_elements_id']) > 0) $element_ids = array(); $query = ' -SELECT id,path,tn_ext,name,date_creation,comment,keywords,author +SELECT id,path,tn_ext,name,date_creation,comment,keywords,author,file FROM '.IMAGES_TABLE.' WHERE id IN ('.implode(',', $page['cat_elements_id']).') '.$conf['order_by'].' @@ -176,12 +202,20 @@ SELECT id,path,tn_ext,name,date_creation,comment,keywords,author $template->assign_block_vars( 'element', array( + 'LEGEND' => + !empty($row['name']) ? + $row['name'] : get_name_from_file($row['file']), + 'U_EDIT' => + add_session_id( + PHPWG_ROOT_PATH.'admin.php?page=picture_modify'. + '&image_id='.$row['id'] + ), 'ID' => $row['id'], 'FILENAME' => $row['path'], 'TN_SRC' => $src, 'NAME' => @$row['name'], 'AUTHOR' => @$row['author'], - 'COMMENT' => @$row['comment'], + 'DESCRIPTION' => @$row['comment'], 'DATE_CREATION_YEAR' => $year, 'KEYWORDS' => @$row['keywords'] ) diff --git a/doc/ChangeLog b/doc/ChangeLog index 4996a81c4..14db5793e 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -1,3 +1,8 @@ +2005-08-19 Pierrick LE GALL + + * improvement : less compact presentation of screen + admin/element_set_unit. + 2005-08-19 Pierrick LE GALL * improvement : standardization of categories navigation bar on diff --git a/template/default/admin/cat_modify.tpl b/template/default/admin/cat_modify.tpl index 54de1af66..b738bae3f 100644 --- a/template/default/admin/cat_modify.tpl +++ b/template/default/admin/cat_modify.tpl @@ -42,7 +42,7 @@ {L_EDIT_COMMENT} - + diff --git a/template/default/admin/element_set_unit.tpl b/template/default/admin/element_set_unit.tpl index 494e81478..df1247d2d 100644 --- a/template/default/admin/element_set_unit.tpl +++ b/template/default/admin/element_set_unit.tpl @@ -24,39 +24,31 @@ -
+ - Elements + +
+ {element.LEGEND} - + - +
- + - + + + - - - - - - - - - + + - - - - + + + + + + + + + +
  - name - author - description - creation date - keywords + {lang:Name}
{lang:Author}
- leave unchanged -
unset -
- +
{lang:Creation date} + + set to
{lang:Keywords}
{lang:Description}
-

- -

-
+ + +

+ + +

+ diff --git a/template/default/admin/picture_modify.tpl b/template/default/admin/picture_modify.tpl index d59c69f59..90a5b7751 100644 --- a/template/default/admin/picture_modify.tpl +++ b/template/default/admin/picture_modify.tpl @@ -104,7 +104,7 @@ {lang:Description} - + diff --git a/template/default/default.css b/template/default/default.css index 2b7ad8bbb..026ca626c 100644 --- a/template/default/default.css +++ b/template/default/default.css @@ -616,3 +616,14 @@ div#adminMain img.thumbnail { margin: 0 auto; display: block; } + +textarea.description { + height: 100px; + width: 500px; + overflow: auto; +} + +fieldset.elementEdit>a { + display: block; + float: right; +} \ No newline at end of file