Ignore:
Timestamp:
Jul 13, 2012, 12:09:19 PM (12 years ago)
Author:
mistic100
Message:

-rework the main menu
-bug when a collection is create through AJAX
-add "Remove from collection" on colorbox
-minor interfaces changes

File:
1 edited

Legend:

Unmodified
Added
Removed
  • extensions/UserCollections/include/collections.inc.php

    r16658 r16688  
    2424        case 'new':
    2525        {
    26           new UserCollection('new', array(), empty($_GET['name']) ? 'temp' : $_GET['name'], 1);
    27           redirect(USER_COLLEC_PUBLIC);
    28           break;
    29         }
    30        
    31         // clear
    32         case 'clear':
    33         {
    34           $query = '
    35 DELETE ci
    36   FROM '.COLLECTION_IMAGES_TABLE.' AS ci
    37     INNER JOIN '.COLLECTIONS_TABLE.' AS c
    38     ON ci.col_id = c.id
    39   WHERE
    40     c.user_id = '.$user['id'].'
    41     AND c.id = '.$_GET['col_id'].'
    42 ;';
    43           pwg_query($query);
     26          $UserCollection = new UserCollection('new', array(), empty($_GET['name']) ? 'temp' : $_GET['name'], 1);
    4427         
    45           if (!empty($_SERVER['HTTP_REFERER']))
     28          if (isset($_GET['redirect']))
    4629          {
    47             redirect($_SERVER['HTTP_REFERER']);
     30            $redirect = USER_COLLEC_PUBLIC.'edit/'.$UserCollection->getParam('id');
    4831          }
     32          else
     33          {
     34            $redirect = USER_COLLEC_PUBLIC;
     35          }
     36          redirect($redirect);
    4937          break;
    5038        }
     
    194182      }
    195183     
     184      // clear
     185      if ( isset($_GET['action']) and $_GET['action'] == 'clear' )
     186      {
     187        $UserCollection->clearImages();
     188      }
     189     
    196190      // remove an element
    197191      if ( isset($_GET['collection_toggle']) and preg_match('#^[0-9]+$#', $_GET['collection_toggle']) )
    198192      {
    199193        $UserCollection->removeImages(array($_GET['collection_toggle']));
     194        unset($_GET['collection_toggle']);
    200195      }
    201196     
     
    205200     
    206201      // collection content
    207       $template->assign('collection', $UserCollection->getCollectionInfo());
     202      $col = $UserCollection->getCollectionInfo();
     203      $col['U_CLEAR'] = $self_url.'&action=clear';
     204      $col['U_DELETE'] = USER_COLLEC_PUBLIC.'&action=delete&col_id='.$page['col_id'];
     205      $template->assign('collection', $col);
     206     
    208207      $page['items'] = $UserCollection->getImages();
    209208     
     
    252251      $UserCollection = new UserCollection($page['col_id']);
    253252     
    254       // backlink for owner
    255       if ($UserCollection->getParam('user_id') == $user['id'])
    256       {
    257         $template->assign('U_LIST', USER_COLLEC_PUBLIC);
    258       }
    259      
    260253      // special template
    261254      add_event_handler('loc_end_index_thumbnails', 'user_collections_thumbnails_in_collection', EVENT_HANDLER_PRIORITY_NEUTRAL+10, 2); // +10 to overload GThumb+
    262255     
    263256      // collection content
    264       $template->assign('collection', $UserCollection->getCollectionInfo());
    265257      $page['items'] = $UserCollection->getImages();
    266258     
Note: See TracChangeset for help on using the changeset viewer.