Changeset 11962 for trunk/admin/include


Ignore:
Timestamp:
Aug 17, 2011, 9:56:07 PM (13 years ago)
Author:
plg
Message:

feature 2406 added: if the user wants a new album in the upload form, the album
is created before the start of the upload. The ergonomy is now simpler, the
page is smaller and cleaner.

bug 2373 fixed: now that album is created before upload, uploadify.php gets the
category_id and the level: as soon as it is uploaded (function add_uploaded_file)
the photo gets its final privacy level and is directly associated to the album.
This way, we can have an error on a photo without making orphan all photos of
the same upload group.

feature 2405 added: as soon as a photo is uploaded, its thumbnail is displayed
in the "Uploaded Photos" fieldset, without waiting for other photos to be
uploaded. The latest photos comes first.

I have slighlty changed the integration of colorbox in core. Now we have 2
styles available and by default, we use style2 (overlay in black, title and
control icons outside the popup). It is also used for zooming on bulk manager
in unit mode.

display change: on each uploading photos, instead of showing the transfer
speed, we display the transfer progression in %

bug fixed: the color of the "Start Upload" button was not correct because the
button was not a submit button but a simple type=button.

language: "Upload" button becomes "Start Upload" button.

Location:
trunk/admin/include
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/admin/include/photos_add_direct_process.inc.php

    r8734 r11962  
    4444  }
    4545 
    46   $category_id = null;
    47   if (!isset($_POST['category_type']))
    48   {
    49     // nothing to do, we certainly have the post_max_size issue
    50   }
    51   elseif ('existing' == $_POST['category_type'])
    52   {
    53     $category_id = $_POST['category'];
    54   }
    55   elseif ('new' == $_POST['category_type'])
    56   {
    57     $output_create = create_virtual_category(
    58       $_POST['category_name'],
    59       (0 == $_POST['category_parent'] ? null : $_POST['category_parent'])
    60       );
    61    
    62     $category_id = $output_create['id'];
    63 
    64     if (isset($output_create['error']))
    65     {
    66       array_push($page['errors'], $output_create['error']);
    67     }
    68     else
    69     {
    70       $category_name = get_cat_display_name_from_id($category_id, 'admin.php?page=cat_modify&cat_id=');
    71       // information
    72       array_push(
    73         $page['infos'],
    74         sprintf(
    75           l10n('Album "%s" has been added'),
    76           '<em>'.$category_name.'</em>'
    77           )
    78         );
    79       // TODO: add the onclick="window.open(this.href); return false;"
    80       // attribute with jQuery on upload.tpl side for href containing
    81       // "cat_modify"
    82     }
    83   }
     46  $category_id = $_POST['category'];
    8447
    8548  $image_ids = array();
     
    207170    {
    208171      $image_ids = $_SESSION['uploads'][ $_POST['upload_id'] ];
    209 
    210       associate_images_to_categories(
    211         $image_ids,
    212         array($category_id)
    213         );
    214 
    215       $query = '
    216 UPDATE '.IMAGES_TABLE.'
    217   SET level = '.$_POST['level'].'
    218   WHERE id IN ('.implode(', ', $image_ids).')
    219 ;';
    220       pwg_query($query);
    221    
    222       invalidate_user_cache();
    223172    }
    224173  }
     
    292241    }
    293242
    294     if ('existing' == $_POST['category_type'])
    295     {
    296       $query = '
     243    $query = '
    297244SELECT
    298245    COUNT(*)
     
    300247  WHERE category_id = '.$category_id.'
    301248;';
    302       list($count) = pwg_db_fetch_row(pwg_query($query));
    303       $category_name = get_cat_display_name_from_id($category_id, 'admin.php?page=cat_modify&amp;cat_id=');
    304      
    305       // information
    306       array_push(
    307         $page['infos'],
    308         sprintf(
    309           l10n('Album "%s" now contains %d photos'),
    310           '<em>'.$category_name.'</em>',
    311           $count
    312           )
    313         );
    314     }
    315 
     249    list($count) = pwg_db_fetch_row(pwg_query($query));
     250    $category_name = get_cat_display_name_from_id($category_id, 'admin.php?page=cat_modify&amp;cat_id=');
     251   
     252    // information
     253    array_push(
     254      $page['infos'],
     255      sprintf(
     256        l10n('Album "%s" now contains %d photos'),
     257        '<em>'.$category_name.'</em>',
     258        $count
     259        )
     260      );
     261   
    316262    $page['batch_link'] = PHOTOS_ADD_BASE_URL.'&batch='.implode(',', $image_ids);
    317263  }
  • trunk/admin/include/uploadify/uploadify.php

    r6625 r11962  
    2020$tmp = ob_get_contents();
    2121ob_end_clean();
    22 // error_log($tmp, 3, "/tmp/php-".date('YmdHis').'-'.sprintf('%020u', rand()).".log");
     22error_log($tmp, 3, "/tmp/php-".date('YmdHis').'-'.sprintf('%020u', rand()).".log");
    2323
    2424if ($_FILES['Filedata']['error'] !== UPLOAD_ERR_OK)
     
    4444  $_FILES['Filedata']['tmp_name'],
    4545  $_FILES['Filedata']['name'],
    46   null,
    47   8
     46  array($_POST['category_id']),
     47  $_POST['level']
    4848  );
    4949
     
    6363  );
    6464
     65$query = '
     66SELECT
     67    id,
     68    path,
     69    tn_ext
     70  FROM '.IMAGES_TABLE.'
     71  WHERE id = '.$image_id.'
     72;';
     73$image_infos = pwg_db_fetch_assoc(pwg_query($query));
     74
     75$thumbnail_url = preg_replace('#^'.PHPWG_ROOT_PATH.'#', './', get_thumbnail_url($image_infos));
     76
     77$return = array(
     78  'image_id' => $image_id,
     79  'category_id' => $_POST['category_id'],
     80  'thumbnail_url' => $thumbnail_url,
     81  );
     82
    6583$output = ob_get_contents();
    6684ob_end_clean();
     
    6886{
    6987  add_upload_error($_POST['upload_id'], $output);
     88  $return['error_message'] = $output;
    7089}
    7190
    72 echo "1";
     91echo json_encode($return);
    7392?>
Note: See TracChangeset for help on using the changeset viewer.