mirror of
https://github.com/Piwigo/Piwigo.git
synced 2025-04-27 11:49:56 +03:00
- improvement : screen admin/picture_modify rewritten. Presentation copied
from admin/cat_modify : fieldsets regroup fields. Ability to synchronize metadata for the displayed item. - bug 110 fixed : "return to element view from element edition fails depending on permissions". If a reachable (for the connected admin) category is available, a "jump to" link is displayed, by default, using the category given in URL. - bug fixed : in mass_updates function, the first item of $fields['update'] has not always 0 for id (as in any array). - modification : get_keywords function understands spaces as separator, allow less than 3 chars keywords, allow quotes. - new : ability to allow HTML in picture or category description (false by default) git-svn-id: http://piwigo.org/svn/trunk@825 68402e56-0260-453c-a942-63ccdbb3a9ee
This commit is contained in:
parent
a7e5dbf37c
commit
7a8b502e11
12 changed files with 460 additions and 228 deletions
|
@ -41,36 +41,26 @@ $template->set_filenames( array('categories'=>'admin/cat_modify.tpl') );
|
||||||
//--------------------------------------------------------- form criteria check
|
//--------------------------------------------------------- form criteria check
|
||||||
if (isset($_POST['submit']))
|
if (isset($_POST['submit']))
|
||||||
{
|
{
|
||||||
$query = 'UPDATE '.CATEGORIES_TABLE;
|
$data =
|
||||||
$query.= ' SET name = ';
|
array(
|
||||||
if ( empty($_POST['name']))
|
'id' => $_GET['cat_id'],
|
||||||
$query.= 'NULL';
|
'name' => @$_POST['name'],
|
||||||
else
|
'commentable' => $_POST['commentable'],
|
||||||
$query.= "'".htmlentities( $_POST['name'], ENT_QUOTES)."'";
|
'uploadable' =>
|
||||||
|
isset($_POST['uploadable']) ? $_POST['uploadable'] : 'false',
|
||||||
|
'comment' =>
|
||||||
|
$conf['allow_html_descriptions'] ?
|
||||||
|
@$_POST['comment'] : strip_tags(@$_POST['comment'])
|
||||||
|
);
|
||||||
|
|
||||||
$query.= ', comment = ';
|
mass_updates(
|
||||||
if ( empty($_POST['comment']))
|
CATEGORIES_TABLE,
|
||||||
$query.= 'NULL';
|
array(
|
||||||
else
|
'primary' => array('id'),
|
||||||
$query.= "'".htmlentities( $_POST['comment'], ENT_QUOTES )."'";
|
'update' => array_diff(array_keys($data), array('id'))
|
||||||
|
),
|
||||||
if ( isset( $_POST['uploadable'] ) )
|
array($data)
|
||||||
$query.= ", uploadable = '".$_POST['uploadable']."'";
|
);
|
||||||
|
|
||||||
if ( isset( $_POST['commentable'] ) )
|
|
||||||
$query.= ", commentable = '".$_POST['commentable']."'";
|
|
||||||
|
|
||||||
if ( isset( $_POST['associate'] ) )
|
|
||||||
{
|
|
||||||
$query.= ', id_uppercat = ';
|
|
||||||
if ( $_POST['associate'] == -1 or $_POST['associate'] == '' )
|
|
||||||
$query.= 'NULL';
|
|
||||||
else
|
|
||||||
$query.= $_POST['associate'];
|
|
||||||
}
|
|
||||||
$query.= ' WHERE id = '.$_GET['cat_id'];
|
|
||||||
$query.= ';';
|
|
||||||
pwg_query( $query );
|
|
||||||
|
|
||||||
set_cat_visible(array($_GET['cat_id']), $_POST['visible']);
|
set_cat_visible(array($_GET['cat_id']), $_POST['visible']);
|
||||||
set_cat_status(array($_GET['cat_id']), $_POST['status']);
|
set_cat_status(array($_GET['cat_id']), $_POST['status']);
|
||||||
|
|
|
@ -201,11 +201,11 @@ $template->set_filenames(array('cat_perm'=>'admin/cat_perm.tpl'));
|
||||||
|
|
||||||
$template->assign_vars(
|
$template->assign_vars(
|
||||||
array(
|
array(
|
||||||
'TITLE' =>
|
'CATEGORIES_NAV' =>
|
||||||
sprintf(
|
get_cat_display_name_from_id(
|
||||||
l10n('Manage permissions for category "%s"'),
|
$page['cat'],
|
||||||
get_cat_display_name_from_id($page['cat'])
|
'admin.php?page=cat_modify&cat_id='
|
||||||
)
|
),
|
||||||
'F_ACTION' =>
|
'F_ACTION' =>
|
||||||
add_session_id(
|
add_session_id(
|
||||||
PHPWG_ROOT_PATH.'admin.php?page=cat_perm&cat='.$page['cat']
|
PHPWG_ROOT_PATH.'admin.php?page=cat_perm&cat='.$page['cat']
|
||||||
|
|
|
@ -582,23 +582,23 @@ function date_convert_back( $date )
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// get_keywords returns an array with relevant keywords found in the string
|
/**
|
||||||
// given in argument. Keywords must be separated by comma in this string.
|
* returns an array with relevant keywords found in the given string.
|
||||||
// keywords must :
|
*
|
||||||
// - be longer or equal to 3 characters
|
* Keywords must be separated by comma or space characters.
|
||||||
// - not contain ', " or blank characters
|
*
|
||||||
// - unique in the string ("test,test" -> "test")
|
* @param string keywords_string
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
function get_keywords($keywords_string)
|
function get_keywords($keywords_string)
|
||||||
{
|
{
|
||||||
$keywords = array();
|
return
|
||||||
|
array_unique(
|
||||||
$candidates = explode( ',', $keywords_string );
|
preg_split(
|
||||||
foreach ( $candidates as $candidate ) {
|
'/[\s,]+/',
|
||||||
if ( strlen($candidate) >= 3 and !preg_match( '/(\'|"|\s)/', $candidate ) )
|
$keywords_string
|
||||||
array_push( $keywords, $candidate );
|
)
|
||||||
}
|
);
|
||||||
|
|
||||||
return array_unique( $keywords );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -742,14 +742,15 @@ function mass_updates($tablename, $dbfields, $datas)
|
||||||
$query = '
|
$query = '
|
||||||
UPDATE '.$tablename.'
|
UPDATE '.$tablename.'
|
||||||
SET ';
|
SET ';
|
||||||
|
$is_first = true;
|
||||||
foreach ($dbfields['update'] as $num => $key)
|
foreach ($dbfields['update'] as $num => $key)
|
||||||
{
|
{
|
||||||
if ($num >= 1)
|
if (!$is_first)
|
||||||
{
|
{
|
||||||
$query.= ",\n ";
|
$query.= ",\n ";
|
||||||
}
|
}
|
||||||
$query.= $key.' = ';
|
$query.= $key.' = ';
|
||||||
if (isset($data[$key]))
|
if (isset($data[$key]) and $data[$key] != '')
|
||||||
{
|
{
|
||||||
$query.= '\''.$data[$key].'\'';
|
$query.= '\''.$data[$key].'\'';
|
||||||
}
|
}
|
||||||
|
@ -757,6 +758,7 @@ UPDATE '.$tablename.'
|
||||||
{
|
{
|
||||||
$query.= 'NULL';
|
$query.= 'NULL';
|
||||||
}
|
}
|
||||||
|
$is_first = false;
|
||||||
}
|
}
|
||||||
$query.= '
|
$query.= '
|
||||||
WHERE ';
|
WHERE ';
|
||||||
|
|
|
@ -204,4 +204,28 @@ SELECT id, path
|
||||||
|
|
||||||
return $files;
|
return $files;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// used_metadata string is displayed to inform admin which metadata will be
|
||||||
|
// used from files for synchronization
|
||||||
|
function get_used_metadata_list()
|
||||||
|
{
|
||||||
|
global $conf;
|
||||||
|
|
||||||
|
$used_metadata = array('filesize', 'width', 'height');
|
||||||
|
|
||||||
|
if ($conf['use_exif'])
|
||||||
|
{
|
||||||
|
array_push($used_metadata, 'date_creation');
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($conf['use_iptc'])
|
||||||
|
{
|
||||||
|
foreach (array_keys($conf['use_iptc_mapping']) as $key)
|
||||||
|
{
|
||||||
|
array_push($used_metadata, $key);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return array_unique($used_metadata);
|
||||||
|
}
|
||||||
?>
|
?>
|
|
@ -27,61 +27,93 @@
|
||||||
|
|
||||||
if(!defined("PHPWG_ROOT_PATH"))
|
if(!defined("PHPWG_ROOT_PATH"))
|
||||||
{
|
{
|
||||||
die ("Hacking attempt!");
|
die('Hacking attempt!');
|
||||||
}
|
}
|
||||||
include_once(PHPWG_ROOT_PATH.'admin/include/isadmin.inc.php');
|
include_once(PHPWG_ROOT_PATH.'admin/include/isadmin.inc.php');
|
||||||
//--------------------------------------------------------- update informations
|
|
||||||
// first, we verify whether there is a mistake on the given creation date
|
// +-----------------------------------------------------------------------+
|
||||||
if (isset($_POST['date_creation']) and !empty($_POST['date_creation']))
|
// | synchronize metadata |
|
||||||
|
// +-----------------------------------------------------------------------+
|
||||||
|
|
||||||
|
if (isset($_GET['sync_metadata']))
|
||||||
{
|
{
|
||||||
if (!check_date_format($_POST['date_creation']))
|
$query = '
|
||||||
|
SELECT path
|
||||||
|
FROM '.IMAGES_TABLE.'
|
||||||
|
WHERE id = '.$_GET['image_id'].'
|
||||||
|
;';
|
||||||
|
list($path) = mysql_fetch_row(pwg_query($query));
|
||||||
|
update_metadata(array($_GET['image_id'] => $path));
|
||||||
|
|
||||||
|
array_push($page['infos'], l10n('Metadata synchronized from file'));
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------- update informations
|
||||||
|
|
||||||
|
// first, we verify whether there is a mistake on the given creation date
|
||||||
|
if (isset($_POST['date_creation_action'])
|
||||||
|
and 'set' == $_POST['date_creation_action'])
|
||||||
|
{
|
||||||
|
if (!checkdate(
|
||||||
|
$_POST['date_creation_month'],
|
||||||
|
$_POST['date_creation_day'],
|
||||||
|
$_POST['date_creation_year'])
|
||||||
|
)
|
||||||
{
|
{
|
||||||
array_push($page['errors'], $lang['err_date']);
|
array_push($page['errors'], $lang['err_date']);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isset($_POST['submit']) and count($page['errors']) == 0)
|
if (isset($_POST['submit']) and count($page['errors']) == 0)
|
||||||
{
|
{
|
||||||
$query = 'UPDATE '.IMAGES_TABLE.' SET name = ';
|
$data = array();
|
||||||
if ($_POST['name'] == '')
|
$data{'id'} = $_GET['image_id'];
|
||||||
$query.= 'NULL';
|
$data{'name'} = $_POST['name'];
|
||||||
else
|
$data{'author'} = $_POST['author'];
|
||||||
$query.= "'".htmlentities($_POST['name'], ENT_QUOTES)."'";
|
|
||||||
|
|
||||||
$query.= ', author = ';
|
if ($conf['allow_html_descriptions'])
|
||||||
if ($_POST['author'] == '')
|
{
|
||||||
$query.= 'NULL';
|
$data{'comment'} = @$_POST['description'];
|
||||||
else
|
}
|
||||||
$query.= "'".htmlentities($_POST['author'],ENT_QUOTES)."'";
|
|
||||||
|
|
||||||
$query.= ', comment = ';
|
|
||||||
if ($_POST['comment'] == '')
|
|
||||||
$query.= 'NULL';
|
|
||||||
else
|
|
||||||
$query.= "'".htmlentities($_POST['comment'],ENT_QUOTES)."'";
|
|
||||||
|
|
||||||
$query.= ', date_creation = ';
|
|
||||||
if (!empty($_POST['date_creation']))
|
|
||||||
$query.= "'".date_convert($_POST['date_creation'])."'";
|
|
||||||
else if ($_POST['date_creation'] == '')
|
|
||||||
$query.= 'NULL';
|
|
||||||
|
|
||||||
$query.= ', keywords = ';
|
|
||||||
$keywords_array = get_keywords($_POST['keywords']);
|
|
||||||
if (count($keywords_array) == 0)
|
|
||||||
$query.= 'NULL';
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$query.= "'";
|
$data{'comment'} = strip_tags(@$_POST['description']);
|
||||||
foreach ($keywords_array as $i => $keyword) {
|
|
||||||
if ($i > 0) $query.= ',';
|
|
||||||
$query.= $keyword;
|
|
||||||
}
|
|
||||||
$query.= "'";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$query.= ' WHERE id = '.$_GET['image_id'];
|
if (isset($_POST['date_creation_action']))
|
||||||
$query.= ';';
|
{
|
||||||
pwg_query($query);
|
if ('set' == $_POST['date_creation_action'])
|
||||||
|
{
|
||||||
|
$data{'date_creation'} = $_POST['date_creation_year']
|
||||||
|
.'-'.$_POST['date_creation_month']
|
||||||
|
.'-'.$_POST['date_creation_day'];
|
||||||
|
}
|
||||||
|
else if ('unset' == $_POST['date_creation_action'])
|
||||||
|
{
|
||||||
|
$data{'date_creation'} = '';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$keywords = get_keywords($_POST['keywords']);
|
||||||
|
if (count($keywords) > 0)
|
||||||
|
{
|
||||||
|
$data{'keywords'} = implode(',', $keywords);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$data{'keywords'} = '';
|
||||||
|
}
|
||||||
|
|
||||||
|
mass_updates(
|
||||||
|
IMAGES_TABLE,
|
||||||
|
array(
|
||||||
|
'primary' => array('id'),
|
||||||
|
'update' => array_diff(array_keys($data), array('id'))
|
||||||
|
),
|
||||||
|
array($data)
|
||||||
|
);
|
||||||
|
|
||||||
|
array_push($page['infos'], l10n('Picture informations updated'));
|
||||||
}
|
}
|
||||||
// associate the element to other categories than its storage category
|
// associate the element to other categories than its storage category
|
||||||
if (isset($_POST['associate'])
|
if (isset($_POST['associate'])
|
||||||
|
@ -137,85 +169,175 @@ if (isset($_POST['dismiss'])
|
||||||
|
|
||||||
// retrieving direct information about picture
|
// retrieving direct information about picture
|
||||||
$query = '
|
$query = '
|
||||||
SELECT i.*, c.uppercats
|
SELECT *
|
||||||
FROM '.IMAGES_TABLE.' AS i
|
FROM '.IMAGES_TABLE.'
|
||||||
INNER JOIN '.CATEGORIES_TABLE.' AS c ON i.storage_category_id = c.id
|
WHERE id = '.$_GET['image_id'].'
|
||||||
WHERE i.id = '.$_GET['image_id'].'
|
|
||||||
;';
|
;';
|
||||||
$row = mysql_fetch_array(pwg_query($query));
|
$row = mysql_fetch_array(pwg_query($query));
|
||||||
|
|
||||||
$storage_category_id = $row['storage_category_id'];
|
$storage_category_id = $row['storage_category_id'];
|
||||||
|
|
||||||
if (empty($row['name']))
|
|
||||||
{
|
|
||||||
$title = str_replace('_', ' ',get_filename_wo_extension($row['file']));
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$title = $row['name'];
|
|
||||||
}
|
|
||||||
// Navigation path
|
// Navigation path
|
||||||
$thumbnail_url = get_thumbnail_src($row['path'], @$row['tn_ext']);
|
|
||||||
|
|
||||||
$url_img = PHPWG_ROOT_PATH.'picture.php?image_id='.$_GET['image_id'];
|
|
||||||
$url_img .= '&cat='.$row['storage_category_id'];
|
|
||||||
$date = isset($_POST['date_creation']) && empty($page['errors'])
|
$date = isset($_POST['date_creation']) && empty($page['errors'])
|
||||||
?$_POST['date_creation']:date_convert_back(@$row['date_creation']);
|
?$_POST['date_creation']:date_convert_back(@$row['date_creation']);
|
||||||
|
|
||||||
$url = PHPWG_ROOT_PATH.'admin.php?page=cat_modify&cat_id=';
|
// +-----------------------------------------------------------------------+
|
||||||
$storage_category = get_cat_display_name_cache($row['uppercats'],
|
// | template init |
|
||||||
$url,
|
// +-----------------------------------------------------------------------+
|
||||||
false);
|
|
||||||
//----------------------------------------------------- template initialization
|
|
||||||
$template->set_filenames(
|
$template->set_filenames(
|
||||||
array(
|
array(
|
||||||
'picture_modify' => 'admin/picture_modify.tpl'
|
'picture_modify' => 'admin/picture_modify.tpl'
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
$template->assign_vars(array(
|
$template->assign_vars(
|
||||||
'TITLE_IMG'=>$title,
|
array(
|
||||||
'STORAGE_CATEGORY_IMG'=>$storage_category,
|
'U_SYNC' =>
|
||||||
'PATH_IMG'=>$row['path'],
|
add_session_id(
|
||||||
'FILE_IMG'=>$row['file'],
|
PHPWG_ROOT_PATH.'admin.php?page=picture_modify'.
|
||||||
'TN_URL_IMG'=>$thumbnail_url,
|
'&image_id='.$_GET['image_id'].
|
||||||
'URL_IMG'=>add_session_id($url_img),
|
(isset($_GET['cat_id']) ? '&cat_id='.$_GET['cat_id'] : '').
|
||||||
'DEFAULT_NAME_IMG'=>str_replace('_',' ',get_filename_wo_extension($row['file'])),
|
'&sync_metadata=1'
|
||||||
'FILE_IMG'=>$row['file'],
|
),
|
||||||
'NAME_IMG'=>isset($_POST['name'])?$_POST['name']:@$row['name'],
|
|
||||||
'SIZE_IMG'=>@$row['width'].' * '.@$row['height'],
|
|
||||||
'FILESIZE_IMG'=>@$row['filesize'].' KB',
|
|
||||||
'REGISTRATION_DATE_IMG'
|
|
||||||
=> format_date($row['date_available'], 'mysql_datetime', true),
|
|
||||||
'AUTHOR_IMG'=>isset($_POST['author'])?$_POST['author']:@$row['author'],
|
|
||||||
'CREATION_DATE_IMG'=>$date,
|
|
||||||
'KEYWORDS_IMG'=>isset($_POST['keywords'])?$_POST['keywords']:@$row['keywords'],
|
|
||||||
'COMMENT_IMG'=>isset($_POST['comment'])?$_POST['comment']:@$row['comment'],
|
|
||||||
|
|
||||||
'L_UPLOAD_NAME'=>$lang['upload_name'],
|
'PATH'=>$row['path'],
|
||||||
'L_DEFAULT'=>$lang['default'],
|
|
||||||
'L_FILE'=>$lang['file'],
|
|
||||||
'L_SIZE'=>$lang['size'],
|
|
||||||
'L_FILESIZE'=>$lang['filesize'],
|
|
||||||
'L_REGISTRATION_DATE'=>$lang['registration_date'],
|
|
||||||
'L_AUTHOR'=>$lang['author'],
|
|
||||||
'L_CREATION_DATE'=>$lang['creation_date'],
|
|
||||||
'L_KEYWORDS'=>$lang['keywords'],
|
|
||||||
'L_COMMENT'=>$lang['description'],
|
|
||||||
'L_CATEGORIES'=>$lang['categories'],
|
|
||||||
'L_DISSOCIATE'=>$lang['dissociate'],
|
|
||||||
'L_INFOIMAGE_ASSOCIATE'=>$lang['infoimage_associate'],
|
|
||||||
'L_SUBMIT'=>$lang['submit'],
|
|
||||||
'L_RESET'=>$lang['reset'],
|
|
||||||
'L_CAT_ASSOCIATED'=>$lang['infoimage_associated'],
|
|
||||||
'L_CAT_DISSOCIATED'=>$lang['infoimage_dissociated'],
|
|
||||||
'L_PATH'=>$lang['path'],
|
|
||||||
'L_STORAGE_CATEGORY'=>$lang['storage_category'],
|
|
||||||
'L_REPRESENTS'=>$lang['represents'],
|
|
||||||
'L_DOESNT_REPRESENT'=>$lang['doesnt_represent'],
|
|
||||||
|
|
||||||
'F_ACTION'=>add_session_id(PHPWG_ROOT_PATH.'admin.php?'.$_SERVER['QUERY_STRING'])
|
'TN_SRC' => get_thumbnail_src($row['path'], @$row['tn_ext']),
|
||||||
));
|
|
||||||
|
'NAME' =>
|
||||||
|
isset($_POST['name']) ?
|
||||||
|
stripslashes($_POST['name']) : @$row['name'],
|
||||||
|
|
||||||
|
'DIMENSIONS' => @$row['width'].' * '.@$row['height'],
|
||||||
|
|
||||||
|
'FILESIZE' => @$row['filesize'].' KB',
|
||||||
|
|
||||||
|
'REGISTRATION_DATE' =>
|
||||||
|
format_date($row['date_available'], 'mysql_datetime', false),
|
||||||
|
|
||||||
|
'AUTHOR' => isset($_POST['author']) ? $_POST['author'] : @$row['author'],
|
||||||
|
|
||||||
|
'CREATION_DATE' => $date,
|
||||||
|
|
||||||
|
'KEYWORDS' =>
|
||||||
|
isset($_POST['keywords']) ?
|
||||||
|
stripslashes($_POST['keywords']) : @$row['keywords'],
|
||||||
|
|
||||||
|
'DESCRIPTION' =>
|
||||||
|
isset($_POST['description']) ?
|
||||||
|
stripslashes($_POST['description']) : @$row['comment'],
|
||||||
|
|
||||||
|
'F_ACTION' =>
|
||||||
|
add_session_id(
|
||||||
|
PHPWG_ROOT_PATH.'admin.php'
|
||||||
|
.get_query_string_diff(array('sync_metadata'))
|
||||||
|
)
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
// creation date
|
||||||
|
unset($day, $month, $year);
|
||||||
|
|
||||||
|
if (isset($_POST['date_creation_action'])
|
||||||
|
and 'set' == $_POST['date_creation_action'])
|
||||||
|
{
|
||||||
|
foreach (array('day', 'month', 'year') as $varname)
|
||||||
|
{
|
||||||
|
$$varname = $_POST['date_creation_'.$varname];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (isset($row['date_creation']) and !empty($row['date_creation']))
|
||||||
|
{
|
||||||
|
list($year, $month, $day) = explode('-', $row['date_creation']);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
list($year, $month, $day) = array('', 0, 0);
|
||||||
|
}
|
||||||
|
get_day_list('date_creation_day', $day);
|
||||||
|
get_month_list('date_creation_month', $month);
|
||||||
|
$template->assign_vars(array('DATE_CREATION_YEAR_VALUE' => $year));
|
||||||
|
|
||||||
|
$query = '
|
||||||
|
SELECT category_id, uppercats
|
||||||
|
FROM '.IMAGE_CATEGORY_TABLE.' AS ic
|
||||||
|
INNER JOIN '.CATEGORIES_TABLE.' AS c
|
||||||
|
ON c.id = ic.category_id
|
||||||
|
WHERE image_id = '.$_GET['image_id'].'
|
||||||
|
;';
|
||||||
|
$result = pwg_query($query);
|
||||||
|
|
||||||
|
if (mysql_num_rows($result) > 1)
|
||||||
|
{
|
||||||
|
$template->assign_block_vars('links', array());
|
||||||
|
}
|
||||||
|
|
||||||
|
while ($row = mysql_fetch_array($result))
|
||||||
|
{
|
||||||
|
$name =
|
||||||
|
get_cat_display_name_cache(
|
||||||
|
$row['uppercats'],
|
||||||
|
PHPWG_ROOT_PATH.'admin.php?page=cat_modify&cat_id=',
|
||||||
|
false
|
||||||
|
);
|
||||||
|
|
||||||
|
if ($row['category_id'] == $storage_category_id)
|
||||||
|
{
|
||||||
|
$template->assign_vars(array('STORAGE_CATEGORY' => $name));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$template->assign_block_vars('links.category', array('NAME' => $name));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// jump to link
|
||||||
|
//
|
||||||
|
// 1. find all linked categories that are reachable for the current user.
|
||||||
|
// 2. if a category is available in the URL, use it if reachable
|
||||||
|
// 3. if URL category not available or reachable, use the first reachable
|
||||||
|
// linked category
|
||||||
|
// 4. if no category reachable, no jumpto link
|
||||||
|
$base_url_img = PHPWG_ROOT_PATH.'picture.php';
|
||||||
|
$base_url_img.= '?image_id='.$_GET['image_id'];
|
||||||
|
$base_url_img.= '&cat=';
|
||||||
|
unset($url_img);
|
||||||
|
|
||||||
|
$query = '
|
||||||
|
SELECT category_id
|
||||||
|
FROM '.IMAGE_CATEGORY_TABLE.'
|
||||||
|
WHERE image_id = '.$_GET['image_id'].'
|
||||||
|
;';
|
||||||
|
$authorizeds = array_diff(
|
||||||
|
array_from_query($query, 'category_id'),
|
||||||
|
explode(',', calculate_permissions($user['id'], $user['status']))
|
||||||
|
);
|
||||||
|
|
||||||
|
if (isset($_GET['cat_id'])
|
||||||
|
and in_array($_GET['cat_id'], $authorizeds))
|
||||||
|
{
|
||||||
|
$url_img = $base_url_img.$_GET['cat_id'];
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
foreach ($authorizeds as $category)
|
||||||
|
{
|
||||||
|
$url_img = $base_url_img.$category;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isset($url_img))
|
||||||
|
{
|
||||||
|
$template->assign_block_vars(
|
||||||
|
'jumpto',
|
||||||
|
array(
|
||||||
|
'URL' => $url_img
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
// associate to another category ?
|
// associate to another category ?
|
||||||
$query = '
|
$query = '
|
||||||
|
@ -258,6 +380,5 @@ display_select_cat_wrapper($query, array(), 'dismissed_option');
|
||||||
|
|
||||||
//----------------------------------------------------------- sending html code
|
//----------------------------------------------------------- sending html code
|
||||||
|
|
||||||
|
|
||||||
$template->assign_var_from_handle('ADMIN_CONTENT', 'picture_modify');
|
$template->assign_var_from_handle('ADMIN_CONTENT', 'picture_modify');
|
||||||
?>
|
?>
|
||||||
|
|
|
@ -1,3 +1,24 @@
|
||||||
|
2005-08-18 Pierrick LE GALL
|
||||||
|
|
||||||
|
* improvement : screen admin/picture_modify
|
||||||
|
rewritten. Presentation copied from admin/cat_modify : fieldsets
|
||||||
|
regroup fields. Ability to synchronize metadata for the displayed
|
||||||
|
item.
|
||||||
|
|
||||||
|
* bug 110 fixed : "return to element view from element edition
|
||||||
|
fails depending on permissions". If a reachable (for the connected
|
||||||
|
admin) category is available, a "jump to" link is displayed, by
|
||||||
|
default, using the category given in URL.
|
||||||
|
|
||||||
|
* bug fixed : in mass_updates function, the first item of
|
||||||
|
$fields['update'] has not always 0 for id (as in any array).
|
||||||
|
|
||||||
|
* modification : get_keywords function understands spaces as
|
||||||
|
separator, allow less than 3 chars keywords, allow quotes.
|
||||||
|
|
||||||
|
* new : ability to allow HTML in picture or category description
|
||||||
|
(false by default)
|
||||||
|
|
||||||
2005-08-17 Pierrick LE GALL
|
2005-08-17 Pierrick LE GALL
|
||||||
|
|
||||||
* improvement : in admin/user_perm, already authorized categories
|
* improvement : in admin/user_perm, already authorized categories
|
||||||
|
|
|
@ -265,4 +265,8 @@ $conf['guest_id'] = 2;
|
||||||
// must update categories informations in screen [Admin > General >
|
// must update categories informations in screen [Admin > General >
|
||||||
// Maintenance].
|
// Maintenance].
|
||||||
$conf['allow_random_representative'] = false;
|
$conf['allow_random_representative'] = false;
|
||||||
|
|
||||||
|
// allow_html_descriptions : authorize administrators to use HTML in
|
||||||
|
// category and element description.
|
||||||
|
$conf['allow_html_descriptions'] = true;
|
||||||
?>
|
?>
|
||||||
|
|
|
@ -259,8 +259,9 @@ function get_cat_display_name($cat_informations,
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$output.= '
|
$output.= '<a class=""';
|
||||||
<a class="" href="'.add_session_id(PHPWG_ROOT_PATH.$url.$id).'">'.$name.'</a>';
|
$output.= ' href="'.add_session_id(PHPWG_ROOT_PATH.$url.$id).'">';
|
||||||
|
$output.= $name.'</a>';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ($replace_space)
|
if ($replace_space)
|
||||||
|
@ -455,6 +456,6 @@ function get_cat_display_name_from_id($cat_id,
|
||||||
$replace_space = true)
|
$replace_space = true)
|
||||||
{
|
{
|
||||||
$cat_info = get_cat_info($cat_id);
|
$cat_info = get_cat_info($cat_id);
|
||||||
get_cat_display_name($cat_info['id'], $url, $replace_space);
|
return get_cat_display_name($cat_info['name'], $url, $replace_space);
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
|
|
|
@ -1,4 +1,6 @@
|
||||||
<h1>{TITLE}</h1>
|
<h1>{lang:Manage permissions for a category}</h1>
|
||||||
|
|
||||||
|
<h2>{CATEGORIES_NAV}</h2>
|
||||||
|
|
||||||
<form action="{F_ACTION}" method="post" id="categoryPermissions">
|
<form action="{F_ACTION}" method="post" id="categoryPermissions">
|
||||||
|
|
||||||
|
|
|
@ -1,75 +1,131 @@
|
||||||
<h1>{lang:title_picmod}</h1>
|
<h1>{lang:title_picmod}</h1>
|
||||||
|
|
||||||
<div class="admin">{TITLE_IMG}</div>
|
<img src="{TN_SRC}" alt="{lang:thumbnail}" class="thumbnail" />
|
||||||
<form action="{F_ACTION}" method="POST">
|
|
||||||
<table style="width:100%;">
|
<ul class="categoryActions">
|
||||||
|
<!-- BEGIN jumpto -->
|
||||||
|
<li><a href="{jumpto.URL}" title="{lang:jump to image}"><img src="./template/default/theme/category_jump-to.png" alt="{lang:jump to}" /></a></li>
|
||||||
|
<!-- END jumpto -->
|
||||||
|
<li><a href="{U_SYNC}" title="{lang:synchronize metadata}"><img src="./template/default/theme/sync_metadata.png" alt="{lang:synchronize}" /></a></li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
<form action="{F_ACTION}" method="post">
|
||||||
|
|
||||||
|
<fieldset>
|
||||||
|
<legend>{lang:Informations}</legend>
|
||||||
|
|
||||||
|
<table>
|
||||||
|
|
||||||
<tr>
|
<tr>
|
||||||
<td colspan="2" align="center"><a href="{URL_IMG}" class="thumbnail"><img src="{TN_URL_IMG}" alt="" class="miniature" /></a></td>
|
<td><strong>{lang:Path}</strong></td>
|
||||||
|
<td>{PATH}</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
<tr>
|
<tr>
|
||||||
<td style="width:50%;"><strong>{L_UPLOAD_NAME}</strong></td>
|
<td><strong>{lang:Registration date}</strong></td>
|
||||||
<td class="row1"><input type="text" name="name" value="{NAME_IMG}" /> [ {L_DEFAULT} : {DEFAULT_NAME_IMG} ]</td>
|
<td>{REGISTRATION_DATE}</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
<tr>
|
<tr>
|
||||||
<td style="width:50%;"><strong>{L_FILE}</strong></td>
|
<td><strong>{lang:Dimensions}</strong></td>
|
||||||
<td class="row1">{FILE_IMG}</td>
|
<td>{DIMENSIONS}</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
<tr>
|
<tr>
|
||||||
<td style="width:50%;"><strong>{L_SIZE}</strong></td>
|
<td><strong>{lang:Filesize}</strong></td>
|
||||||
<td class="row1">{SIZE_IMG}</td>
|
<td>{FILESIZE}</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
<tr>
|
<tr>
|
||||||
<td style="width:50%;"><strong>{L_FILESIZE}</strong></td>
|
<td><strong>{lang:Storage category}</strong></td>
|
||||||
<td class="row1">{FILESIZE_IMG}</td>
|
<td>{STORAGE_CATEGORY}</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
|
<!-- BEGIN links -->
|
||||||
<tr>
|
<tr>
|
||||||
<td style="width:50%;"><strong>{L_REGISTRATION_DATE}</strong></td>
|
<td><strong>{lang:Linked categories}</strong></td>
|
||||||
<td class="row1">{REGISTRATION_DATE_IMG}</td>
|
<td>
|
||||||
</tr>
|
<ul>
|
||||||
<tr>
|
<!-- BEGIN category -->
|
||||||
<td style="width:50%;"><strong>{L_PATH}</strong></td>
|
<li>{links.category.NAME}</li>
|
||||||
<td class="row1">{PATH_IMG}</td>
|
<!-- END category -->
|
||||||
</tr>
|
</ul>
|
||||||
<tr>
|
|
||||||
<td style="width:50%;"><strong>{L_STORAGE_CATEGORY}</strong></td>
|
|
||||||
<td class="row1">{STORAGE_CATEGORY_IMG}</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td style="width:50%;"><strong>{L_AUTHOR}</strong></td>
|
|
||||||
<td class="row1"><input type="text" name="author" value="{AUTHOR_IMG}" /></td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td style="width:50%;"><strong>{L_CREATION_DATE}</strong></td>
|
|
||||||
<td class="row1"><input type="text" name="date_creation" value="{CREATION_DATE_IMG}" /></td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td style="width:50%;"><strong>{L_KEYWORDS}</strong></td>
|
|
||||||
<td class="row1"><input type="text" name="keywords" value="{KEYWORDS_IMG}" size="50" /></td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td style="width:50%;"><strong>{L_COMMENT}</strong></td>
|
|
||||||
<td class="row1"><textarea name="comment" rows="5" cols="50" style="overflow:auto">{COMMENT_IMG}</textarea></td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td colspan="2"><div style="margin-bottom:0px"> </div></td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td colspan="2" align="center">
|
|
||||||
<input type="submit" name="submit" value="{L_SUBMIT}" class="bouton" />
|
|
||||||
<input type="reset" name="reset" value="{L_RESET}" class="bouton" />
|
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
<!-- END links -->
|
||||||
|
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
|
</fieldset>
|
||||||
|
|
||||||
|
<fieldset>
|
||||||
|
<legend>{lang:Properties}</legend>
|
||||||
|
|
||||||
|
<table>
|
||||||
|
|
||||||
|
<tr>
|
||||||
|
<td><strong>{lang:Name}</strong></td>
|
||||||
|
<td><input type="text" name="name" value="{NAME}" /></td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
<tr>
|
||||||
|
<td><strong>{lang:Author}</strong></td>
|
||||||
|
<td><input type="text" name="author" value="{AUTHOR}" /></td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
<tr>
|
||||||
|
<td><strong>{lang:Creation date}</strong></td>
|
||||||
|
<td>
|
||||||
|
<label><input type="radio" name="date_creation_action" value="unset" /> unset</label>
|
||||||
|
<input type="radio" name="date_creation_action" value="set" id="date_creation_action_set" /> set to
|
||||||
|
<select onmousedown="document.getElementById('date_creation_action_set').checked = true;" name="date_creation_day">
|
||||||
|
<!-- BEGIN date_creation_day -->
|
||||||
|
<option {date_creation_day.SELECTED} value="{date_creation_day.VALUE}">{date_creation_day.OPTION}</option>
|
||||||
|
<!-- END date_creation_day -->
|
||||||
|
</select>
|
||||||
|
<select onmousedown="document.getElementById('date_creation_action_set').checked = true;" name="date_creation_month">
|
||||||
|
<!-- BEGIN date_creation_month -->
|
||||||
|
<option {date_creation_month.SELECTED} value="{date_creation_month.VALUE}">{date_creation_month.OPTION}</option>
|
||||||
|
<!-- END date_creation_month -->
|
||||||
|
</select>
|
||||||
|
<input onmousedown="document.getElementById('date_creation_action_set').checked = true;"
|
||||||
|
name="date_creation_year"
|
||||||
|
type="text"
|
||||||
|
size="4"
|
||||||
|
maxlength="4"
|
||||||
|
value="{DATE_CREATION_YEAR_VALUE}" />
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
<tr>
|
||||||
|
<td><strong>{lang:Keywords}</strong></td>
|
||||||
|
<td><input type="text" name="keywords" value="{KEYWORDS}" size="50" /></td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
<tr>
|
||||||
|
<td><strong>{lang:Description}</strong></td>
|
||||||
|
<td><textarea name="description" rows="5" cols="50" style="overflow:auto">{DESCRIPTION}</textarea></td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
</table>
|
||||||
|
|
||||||
|
<p style="text-align:center;">
|
||||||
|
<input type="submit" value="{lang:Submit}" name="submit" />
|
||||||
|
<input type="reset" value="{lang:Reset}" name="reset" />
|
||||||
|
</p>
|
||||||
|
|
||||||
|
</fieldset>
|
||||||
|
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
<form name="form1" method="post" action="{F_ACTION}">
|
<form id="associations" method="post" action="{F_ACTION}#associations">
|
||||||
<fieldset>
|
<fieldset>
|
||||||
<legend>{lang:Association to categories}</legend>
|
<legend>{lang:Association to categories}</legend>
|
||||||
|
|
||||||
<table class="doubleSelect">
|
<table class="doubleSelect">
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
<h3>{L_CAT_ASSOCIATED}</h3>
|
<h3>{lang:Associated}</h3>
|
||||||
<select class="categoryList" name="cat_associated[]" multiple="multiple" size="30">
|
<select class="categoryList" name="cat_associated[]" multiple="multiple" size="30">
|
||||||
<!-- BEGIN associated_option -->
|
<!-- BEGIN associated_option -->
|
||||||
<option {associated_option.SELECTED} value="{associated_option.VALUE}">{associated_option.OPTION}</option>
|
<option {associated_option.SELECTED} value="{associated_option.VALUE}">{associated_option.OPTION}</option>
|
||||||
|
@ -79,7 +135,7 @@
|
||||||
</td>
|
</td>
|
||||||
|
|
||||||
<td>
|
<td>
|
||||||
<h3>{L_CAT_DISSOCIATED}</h3>
|
<h3>{lang:Dissociated}</h3>
|
||||||
<select class="categoryList" name="cat_dissociated[]" multiple="multiple" size="30">
|
<select class="categoryList" name="cat_dissociated[]" multiple="multiple" size="30">
|
||||||
<!-- BEGIN dissociated_option -->
|
<!-- BEGIN dissociated_option -->
|
||||||
<option {dissociated_option.SELECTED} value="{dissociated_option.VALUE}">{dissociated_option.OPTION}</option>
|
<option {dissociated_option.SELECTED} value="{dissociated_option.VALUE}">{dissociated_option.OPTION}</option>
|
||||||
|
@ -93,14 +149,14 @@
|
||||||
</fieldset>
|
</fieldset>
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
<form name="form2" method="post" action="{F_ACTION}">
|
<form id="representation" method="post" action="{F_ACTION}#representation">
|
||||||
<fieldset>
|
<fieldset>
|
||||||
<legend>{lang:Representation of categories}</legend>
|
<legend>{lang:Representation of categories}</legend>
|
||||||
|
|
||||||
<table class="doubleSelect">
|
<table class="doubleSelect">
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
<h3>{L_REPRESENTS}</h3>
|
<h3>{lang:Represents}</h3>
|
||||||
<select class="categoryList" name="cat_elected[]" multiple="multiple" size="30">
|
<select class="categoryList" name="cat_elected[]" multiple="multiple" size="30">
|
||||||
<!-- BEGIN elected_option -->
|
<!-- BEGIN elected_option -->
|
||||||
<option {elected_option.SELECTED} value="{elected_option.VALUE}">{elected_option.OPTION}</option>
|
<option {elected_option.SELECTED} value="{elected_option.VALUE}">{elected_option.OPTION}</option>
|
||||||
|
@ -110,7 +166,7 @@
|
||||||
</td>
|
</td>
|
||||||
|
|
||||||
<td>
|
<td>
|
||||||
<h3>{L_DOESNT_REPRESENT}</h3>
|
<h3>{lang:Does not represent}</h3>
|
||||||
<select class="categoryList" name="cat_dismissed[]" multiple="multiple" size="30">
|
<select class="categoryList" name="cat_dismissed[]" multiple="multiple" size="30">
|
||||||
<!-- BEGIN dismissed_option -->
|
<!-- BEGIN dismissed_option -->
|
||||||
<option {dismissed_option.SELECTED} value="{dismissed_option.VALUE}">{dismissed_option.OPTION}</option>
|
<option {dismissed_option.SELECTED} value="{dismissed_option.VALUE}">{dismissed_option.OPTION}</option>
|
||||||
|
|
|
@ -426,6 +426,11 @@ form#categoryOrdering ul.categoryActions {
|
||||||
margin-top: 5px;
|
margin-top: 5px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ul.categoryActions {
|
||||||
|
margin: 5px;
|
||||||
|
padding: 5px;
|
||||||
|
}
|
||||||
|
|
||||||
div.titrePage ul.categoryActions {
|
div.titrePage ul.categoryActions {
|
||||||
float: right;
|
float: right;
|
||||||
margin: 0;
|
margin: 0;
|
||||||
|
@ -605,3 +610,9 @@ div#adminMain>fieldset {
|
||||||
fieldset>legend {
|
fieldset>legend {
|
||||||
font-style: italic;
|
font-style: italic;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
div#adminMain img.thumbnail {
|
||||||
|
border: 1px solid white;
|
||||||
|
margin: 0 auto;
|
||||||
|
display: block;
|
||||||
|
}
|
||||||
|
|
BIN
template/default/theme/sync_metadata.png
Normal file
BIN
template/default/theme/sync_metadata.png
Normal file
Binary file not shown.
Loading…
Add table
Add a link
Reference in a new issue