Ignore:
Timestamp:
Jan 1, 2011, 3:35:52 PM (13 years ago)
Author:
plg
Message:

feature 2092 added: Batch Manager can filter all photos with no tag

feature 1866 added: Batch Manager can synchronize metadata

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/admin/batch_manager_global.php

    r8417 r8422  
    6565// +-----------------------------------------------------------------------+
    6666
     67// $page['prefilter'] is a shortcut to test if the current filter contains a
     68// given prefilter. The idea is to make conditions simpler to write in the
     69// code.
     70$page['prefilter'] = 'none';
     71if (isset($_SESSION['bulk_manager_filter']['prefilter']))
     72{
     73  $page['prefilter'] = $_SESSION['bulk_manager_filter']['prefilter'];
     74}
     75
     76// $page['category'] is a shortcut to test if the current filter contains a
     77// given category. The idea is the same as for prefilter
     78$page['category'] = -1;
     79if (isset($_SESSION['bulk_manager_filter']['category']))
     80{
     81  $page['category'] = $_SESSION['bulk_manager_filter']['category'];
     82}
     83
     84$redirect_url = get_root_url().'admin.php?page='.$_GET['page'];
     85
    6786if (isset($_POST['submit']))
    6887{
     
    86105    pwg_query($query);
    87106
     107    if ('caddie' == $page['prefilter'])
     108    {
     109      redirect($redirect_url);
     110    }
     111   
    88112    // if we are here in the code, it means that the user is currently
    89113    // displaying the caddie content, so we have to remove the current
     
    96120    $tag_ids = get_fckb_tag_ids($_POST['add_tags']);
    97121    add_tags($tag_ids, $collection);
     122
     123    if ('with no tag' == $page['prefilter'])
     124    {
     125      redirect(get_root_url().'admin.php?page='.$_GET['page']);
     126    }
    98127  }
    99128
     
    126155   
    127156    // let's refresh the page because we the current set might be modified
    128     $redirect_url = get_root_url().'admin.php?page='.$_GET['page'];
    129     redirect($redirect_url);
     157    if ('with no album' == $page['prefilter'])
     158    {
     159      redirect($redirect_url);
     160    }
     161
     162    if ('with no virtual album' == $page['prefilter'])
     163    {
     164      $category_info = get_cat_info($_POST['associate']);
     165      if (empty($category_info['dir']))
     166      {
     167        redirect($redirect_url);
     168      }
     169    }
    130170  }
    131171
     
    164204     
    165205      // let's refresh the page because we the current set might be modified
    166       $redirect_url = get_root_url().'admin.php?page='.$_GET['page'];
    167206      redirect($redirect_url);
    168207    }
     
    262301      $datas
    263302      );
     303
     304    if (isset($_SESSION['bulk_manager_filter']['level']))
     305    {
     306      if ($_POST['level'] < $_SESSION['bulk_manager_filter']['level'])
     307      {
     308        redirect($redirect_url);
     309      }
     310    }
    264311  }
    265312 
     
    301348      array_push($page['errors'], l10n('You need to confirm deletion'));
    302349    }
     350  }
     351
     352  // synchronize metadata
     353  if ('metadata' == $action)
     354  {
     355    $query = '
     356SELECT id, path
     357  FROM '.IMAGES_TABLE.'
     358  WHERE id IN ('.implode(',', $collection).')
     359;';
     360    $id_to_path = array();
     361    $result = pwg_query($query);
     362    while ($row = pwg_db_fetch_assoc($result))
     363    {
     364      $id_to_path[$row['id']] = $row['path'];
     365    }
     366   
     367    update_metadata($id_to_path);
     368
     369    array_push(
     370      $page['infos'],
     371      l10n('Metadata synchronized from file')
     372      );
    303373  }
    304374}
     
    478548  );
    479549
     550// metadata
     551include_once( PHPWG_ROOT_PATH.'admin/site_reader_local.php');
     552$site_reader = new LocalSiteReader('./');
     553$used_metadata = implode( ', ', $site_reader->get_metadata_attributes());
     554
     555$template->assign(
     556    array(
     557      'used_metadata' => $used_metadata,
     558    )
     559  );
     560
    480561// +-----------------------------------------------------------------------+
    481562// |                        global mode thumbnails                         |
Note: See TracChangeset for help on using the changeset viewer.