Changeset 29229 for trunk


Ignore:
Timestamp:
Aug 17, 2014, 10:01:10 PM (10 years ago)
Author:
flop25
Message:

feature:732
unlock sub-albums

Location:
trunk/admin
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/admin/cat_modify.php

    r28587 r29229  
    137137  $cat_info = get_cat_info($_GET['cat_id']);
    138138
    139   if ($cat_info['visible'] != get_boolean( $_POST['visible'] ) )
     139  if ($_POST['visible']=='true_sub')
     140  {
     141    set_cat_visible(array($_GET['cat_id']), true, true);
     142  }
     143  elseif ($cat_info['visible'] != get_boolean( $_POST['visible'] ) )
    140144  {
    141145    set_cat_visible(array($_GET['cat_id']), $_POST['visible']);
  • trunk/admin/include/functions.php

    r29068 r29229  
    645645 * @param int[] $categories
    646646 * @param boolean|string $value
    647  */
    648 function set_cat_visible($categories, $value)
     647 * @param boolean $unlock_child optional   default false
     648 */
     649function set_cat_visible($categories, $value, $unlock_child = false)
    649650{
    650651  if ( ($value = filter_var($value, FILTER_VALIDATE_BOOLEAN, FILTER_NULL_ON_FAILURE)) === null )
     
    657658  if ($value)
    658659  {
    659     $uppercats = get_uppercat_ids($categories);
     660    $cats = get_uppercat_ids($categories);
     661    if ($unlock_child) {
     662      $cats = array_merge($cats, get_subcat_ids($categories));
     663    }
    660664    $query = '
    661665UPDATE '.CATEGORIES_TABLE.'
    662666  SET visible = \'true\'
    663   WHERE id IN ('.implode(',', $uppercats).')';
     667  WHERE id IN ('.implode(',', $cats).')';
    664668    pwg_query($query);
    665669  }
  • trunk/admin/themes/default/template/cat_modify.tpl

    r28703 r29229  
    118118    <strong>{'Lock'|@translate}</strong>
    119119    <br>
    120                 {html_radios name='visible' values=['true','false'] output=['No'|translate,'Yes'|translate] selected=$CAT_VISIBLE}
     120                {html_radios name='visible' values=['true','true_sub','false'] output=['No'|translate,'No and unlock sub-albums'|translate,'Yes'|translate] selected=$CAT_VISIBLE}
    121121  </p>
    122122
Note: See TracChangeset for help on using the changeset viewer.