Skip to content

Commit

Permalink
feature 2406 added: if the user wants a new album in the upload form,…
Browse files Browse the repository at this point in the history
… 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.


git-svn-id: http://piwigo.org/svn/trunk@11962 68402e56-0260-453c-a942-63ccdbb3a9ee
  • Loading branch information
plegall committed Aug 17, 2011
1 parent e255cd8 commit 64ba898
Show file tree
Hide file tree
Showing 33 changed files with 484 additions and 163 deletions.
84 changes: 15 additions & 69 deletions admin/include/photos_add_direct_process.inc.php
Expand Up @@ -43,44 +43,7 @@
);
}

$category_id = null;
if (!isset($_POST['category_type']))
{
// nothing to do, we certainly have the post_max_size issue
}
elseif ('existing' == $_POST['category_type'])
{
$category_id = $_POST['category'];
}
elseif ('new' == $_POST['category_type'])
{
$output_create = create_virtual_category(
$_POST['category_name'],
(0 == $_POST['category_parent'] ? null : $_POST['category_parent'])
);

$category_id = $output_create['id'];

if (isset($output_create['error']))
{
array_push($page['errors'], $output_create['error']);
}
else
{
$category_name = get_cat_display_name_from_id($category_id, 'admin.php?page=cat_modify&cat_id=');
// information
array_push(
$page['infos'],
sprintf(
l10n('Album "%s" has been added'),
'<em>'.$category_name.'</em>'
)
);
// TODO: add the onclick="window.open(this.href); return false;"
// attribute with jQuery on upload.tpl side for href containing
// "cat_modify"
}
}
$category_id = $_POST['category'];

$image_ids = array();

Expand Down Expand Up @@ -206,20 +169,6 @@
if (isset($_SESSION['uploads'][ $_POST['upload_id'] ]))
{
$image_ids = $_SESSION['uploads'][ $_POST['upload_id'] ];

associate_images_to_categories(
$image_ids,
array($category_id)
);

$query = '
UPDATE '.IMAGES_TABLE.'
SET level = '.$_POST['level'].'
WHERE id IN ('.implode(', ', $image_ids).')
;';
pwg_query($query);

invalidate_user_cache();
}
}

Expand Down Expand Up @@ -291,28 +240,25 @@
);
}

if ('existing' == $_POST['category_type'])
{
$query = '
$query = '
SELECT
COUNT(*)
FROM '.IMAGE_CATEGORY_TABLE.'
WHERE category_id = '.$category_id.'
;';
list($count) = pwg_db_fetch_row(pwg_query($query));
$category_name = get_cat_display_name_from_id($category_id, 'admin.php?page=cat_modify&amp;cat_id=');

// information
array_push(
$page['infos'],
sprintf(
l10n('Album "%s" now contains %d photos'),
'<em>'.$category_name.'</em>',
$count
)
);
}

list($count) = pwg_db_fetch_row(pwg_query($query));
$category_name = get_cat_display_name_from_id($category_id, 'admin.php?page=cat_modify&amp;cat_id=');

// information
array_push(
$page['infos'],
sprintf(
l10n('Album "%s" now contains %d photos'),
'<em>'.$category_name.'</em>',
$count
)
);

$page['batch_link'] = PHOTOS_ADD_BASE_URL.'&batch='.implode(',', $image_ids);
}
}
Expand Down
27 changes: 23 additions & 4 deletions admin/include/uploadify/uploadify.php
Expand Up @@ -19,7 +19,7 @@
print_r($user);
$tmp = ob_get_contents();
ob_end_clean();
// error_log($tmp, 3, "/tmp/php-".date('YmdHis').'-'.sprintf('%020u', rand()).".log");
error_log($tmp, 3, "/tmp/php-".date('YmdHis').'-'.sprintf('%020u', rand()).".log");

if ($_FILES['Filedata']['error'] !== UPLOAD_ERR_OK)
{
Expand All @@ -43,8 +43,8 @@
$image_id = add_uploaded_file(
$_FILES['Filedata']['tmp_name'],
$_FILES['Filedata']['name'],
null,
8
array($_POST['category_id']),
$_POST['level']
);

if (!isset($_SESSION['uploads']))
Expand All @@ -62,12 +62,31 @@
$image_id
);

$query = '
SELECT
id,
path,
tn_ext
FROM '.IMAGES_TABLE.'
WHERE id = '.$image_id.'
;';
$image_infos = pwg_db_fetch_assoc(pwg_query($query));

$thumbnail_url = preg_replace('#^'.PHPWG_ROOT_PATH.'#', './', get_thumbnail_url($image_infos));

$return = array(
'image_id' => $image_id,
'category_id' => $_POST['category_id'],
'thumbnail_url' => $thumbnail_url,
);

$output = ob_get_contents();
ob_end_clean();
if (!empty($output))
{
add_upload_error($_POST['upload_id'], $output);
$return['error_message'] = $output;
}

echo "1";
echo json_encode($return);
?>
3 changes: 2 additions & 1 deletion admin/themes/clear/theme.css
Expand Up @@ -20,7 +20,7 @@ body, h3, dt, h2, .throw, .content, label { color:#777; }
th { color: #888; }
INPUT, select, textarea { color:#666; background-color: #ccc; }
input[type="radio"], input[type="checkbox"] { background-color: transparent; }
INPUT[type="submit"], INPUT[type="reset"] { color:#666; border: 1px solid #777; background-color: #bbb; padding: 1px 15px; }
INPUT[type="submit"], INPUT[type="button"], INPUT[type="reset"] { color:#666; border: 1px solid #777; background-color: #bbb; padding: 1px 15px; }
legend, h3 { color: #777; }
h2 { color: #777; }

Expand Down Expand Up @@ -50,6 +50,7 @@ input[type="button"], input[type="submit"], input[type="reset"] {
}

input[type="button"]:hover, input[type="submit"]:hover, input[type="reset"]:hover {
cursor:pointer;
color:#666;
border-color: #999;
}
Expand Down
2 changes: 1 addition & 1 deletion admin/themes/default/template/include/colorbox.inc.tpl
@@ -1,2 +1,2 @@
{combine_script id='jquery.colorbox' load='footer' require='jquery' path='themes/default/js/plugins/jquery.colorbox.min.js'}
{combine_css path="themes/default/js/plugins/jquery.colorbox.css"}
{combine_css path="themes/default/js/plugins/colorbox/style2/colorbox.css"}

0 comments on commit 64ba898

Please sign in to comment.