mirror of
https://github.com/Piwigo/Piwigo.git
synced 2026-03-28 17:42:57 +01:00
related to #1704 Better 'visible' attribute implementation in API
* fixed SQL error * Use correct function to save 'visible' attribute * Underlined the 'Unlock it' button on the orange alert
This commit is contained in:
@@ -73,7 +73,6 @@ jQuery(document).ready(function() {
|
||||
comment: $("#cat-comment").val(),
|
||||
visible: $("#cat-locked").is(":checked") ? 'false' : 'true',
|
||||
commentable: $("#cat-commentable").is(":checked") ? "true":"false",
|
||||
apply_commentable_to_subalbums: $("#cat-apply-commentable-on-sub").is(":checked")? "true":"false",
|
||||
},
|
||||
success:function(data) {
|
||||
if (data.stat == "ok") {
|
||||
|
||||
@@ -406,6 +406,7 @@ LI.menuLi {
|
||||
/* Cat Modify */
|
||||
.unlock-album {
|
||||
cursor: pointer;
|
||||
text-decoration: underline;
|
||||
}
|
||||
|
||||
.cat-modify {
|
||||
|
||||
@@ -792,7 +792,21 @@ SELECT *
|
||||
'id' => $params['category_id'],
|
||||
);
|
||||
|
||||
$info_columns = array('name', 'comment','commentable', 'visible');
|
||||
foreach (array('visible', 'commentable') as $param_name)
|
||||
{
|
||||
if (isset($params[$param_name]) and !preg_match('/^(true|false)$/i', $params[$param_name]))
|
||||
{
|
||||
return new PwgError(WS_ERR_INVALID_PARAM, 'Invalid param '.$param_name.' : '.$params[$param_name]);
|
||||
}
|
||||
}
|
||||
|
||||
if (!empty($params['visible']) and ($params['visible'] != $category['visible']))
|
||||
{
|
||||
include_once(PHPWG_ROOT_PATH.'admin/include/functions.php');
|
||||
set_cat_visible(array($params['category_id']), $params['visible']);
|
||||
}
|
||||
|
||||
$info_columns = array('name', 'comment','commentable');
|
||||
|
||||
$perform_update = false;
|
||||
foreach ($info_columns as $key)
|
||||
@@ -807,15 +821,15 @@ SELECT *
|
||||
|
||||
if (isset($params['commentable']) && isset($params['apply_commentable_to_subalbums']) && $params['apply_commentable_to_subalbums'])
|
||||
{
|
||||
$subcats = get_subcat_ids(array('id' => $params['category_id']));
|
||||
$subcats = get_subcat_ids(array($params['category_id']));
|
||||
if (count($subcats) > 0)
|
||||
{
|
||||
$query = '
|
||||
$query = '
|
||||
UPDATE '.CATEGORIES_TABLE.'
|
||||
SET commentable = \''.$params['commentable'].'\'
|
||||
WHERE id IN ('.implode(',', $subcats).')
|
||||
SET commentable = \''.$params['commentable'].'\'
|
||||
WHERE id IN ('.implode(',', $subcats).')
|
||||
;';
|
||||
pwg_query($query);
|
||||
pwg_query($query);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
4
ws.php
4
ws.php
@@ -856,10 +856,10 @@ function ws_addDefaultMethods( $arr )
|
||||
'info'=>'public, private'),
|
||||
'visible' => array('default'=>null,
|
||||
'flags'=>WS_PARAM_OPTIONAL),
|
||||
'commentable' => array('default'=>true,
|
||||
'commentable' => array('default'=>null,
|
||||
'flags'=>WS_PARAM_OPTIONAL,
|
||||
'info'=>'Boolean, effective if configuration variable activate_comments is set to true'),
|
||||
'apply_commentable_to_subalbums' => array('default'=>false,
|
||||
'apply_commentable_to_subalbums' => array('default'=>null,
|
||||
'flags'=>WS_PARAM_OPTIONAL,
|
||||
'info'=>'If true, set commentable to all sub album'),
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user