diff --git a/admin/include/photos_add_direct_process.inc.php b/admin/include/photos_add_direct_process.inc.php
index 27cb0b9a1..15c7abebb 100644
--- a/admin/include/photos_add_direct_process.inc.php
+++ b/admin/include/photos_add_direct_process.inc.php
@@ -43,44 +43,7 @@ if (isset($_GET['processed']))
);
}
- $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'),
- ''.$category_name.''
- )
- );
- // 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();
@@ -206,20 +169,6 @@ if (isset($_GET['processed']))
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();
}
}
@@ -291,28 +240,25 @@ SELECT
);
}
- 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&cat_id=');
-
- // information
- array_push(
- $page['infos'],
- sprintf(
- l10n('Album "%s" now contains %d photos'),
- ''.$category_name.'',
- $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&cat_id=');
+
+ // information
+ array_push(
+ $page['infos'],
+ sprintf(
+ l10n('Album "%s" now contains %d photos'),
+ ''.$category_name.'',
+ $count
+ )
+ );
+
$page['batch_link'] = PHOTOS_ADD_BASE_URL.'&batch='.implode(',', $image_ids);
}
}
diff --git a/admin/include/uploadify/uploadify.php b/admin/include/uploadify/uploadify.php
index 8b3f49bb5..948280d90 100644
--- a/admin/include/uploadify/uploadify.php
+++ b/admin/include/uploadify/uploadify.php
@@ -19,7 +19,7 @@ echo '$user'."\n";
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)
{
@@ -43,8 +43,8 @@ ob_start();
$image_id = add_uploaded_file(
$_FILES['Filedata']['tmp_name'],
$_FILES['Filedata']['name'],
- null,
- 8
+ array($_POST['category_id']),
+ $_POST['level']
);
if (!isset($_SESSION['uploads']))
@@ -62,12 +62,31 @@ array_push(
$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);
?>
\ No newline at end of file
diff --git a/admin/themes/clear/theme.css b/admin/themes/clear/theme.css
index aa8b97a19..af5dcb768 100644
--- a/admin/themes/clear/theme.css
+++ b/admin/themes/clear/theme.css
@@ -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; }
@@ -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;
}
diff --git a/admin/themes/default/template/include/colorbox.inc.tpl b/admin/themes/default/template/include/colorbox.inc.tpl
index 6ca8e0502..76651eafd 100644
--- a/admin/themes/default/template/include/colorbox.inc.tpl
+++ b/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"}
\ No newline at end of file
+{combine_css path="themes/default/js/plugins/colorbox/style2/colorbox.css"}
diff --git a/admin/themes/default/template/photos_add_direct.tpl b/admin/themes/default/template/photos_add_direct.tpl
index ffcb265d5..7f17663f8 100644
--- a/admin/themes/default/template/photos_add_direct.tpl
+++ b/admin/themes/default/template/photos_add_direct.tpl
@@ -6,6 +6,8 @@
{combine_css path="admin/include/uploadify/uploadify.css"}
{/if}
+{include file='include/colorbox.inc.tpl'}
+
{footer_script}{literal}
jQuery(document).ready(function(){
function checkUploadStart() {
@@ -13,11 +15,6 @@ jQuery(document).ready(function(){
jQuery("#formErrors").hide();
jQuery("#formErrors li").hide();
- if (jQuery("input[name=category_type]:checked").val() == "new" && jQuery("input[name=category_name]").val() == "") {
- jQuery("#formErrors #emptyCategoryName").show();
- nbErrors++;
- }
-
var nbFiles = 0;
if (jQuery("#uploadBoxes").size() == 1) {
jQuery("input[name^=image_upload]").each(function() {
@@ -65,15 +62,79 @@ jQuery(document).ready(function(){
return byteSize+suffix;
}
- if (jQuery("select[name=category] option").length == 0) {
- jQuery('input[name=category_type][value=existing]').attr('disabled', true);
- jQuery('input[name=category_type]').attr('checked', false);
- jQuery('input[name=category_type][value=new]').attr('checked', true);
+ function fillCategoryListbox(selectId, selectedValue) {
+ jQuery.getJSON(
+ "ws.php?format=json&method=pwg.categories.getList",
+ {
+ recursive: true,
+ fullname: true,
+ format: "json",
+ },
+ function(data) {
+ jQuery.each(
+ data.result.categories,
+ function(i,category) {
+ var selected = "";
+ if (category.id == selectedValue) {
+ selected = "selected";
+ }
+
+ jQuery("")
+ .attr("value", category.id)
+ .attr("selected", selected)
+ .text(category.name)
+ .appendTo("#"+selectId)
+ ;
+ }
+ );
+ }
+ );
}
- jQuery("input[name=category_type]").click(function () {
- jQuery("[id^=category_type_]").hide();
- jQuery("#category_type_"+jQuery(this).attr("value")).show();
+/*
+ jQuery("#albumSelect").find("option").remove();
+ fillCategoryListbox("albumSelect");
+ fillCategoryListbox("category_parent");
+*/
+
+ jQuery(".addAlbumOpen").colorbox({inline:true, href:"#addAlbumForm"});
+
+ jQuery("#addAlbumForm form").submit(function(){
+ jQuery("#categoryNameError").text("");
+
+ jQuery.ajax({
+ url: "ws.php?format=json&method=pwg.categories.add",
+ data: {
+ parent: jQuery("select[name=category_parent] option:selected").val(),
+ name: jQuery("input[name=category_name]").val(),
+ },
+ beforeSend: function() {
+ jQuery("#albumCreationLoading").show();
+ },
+ success:function(html) {
+ jQuery("#albumCreationLoading").hide();
+
+ var newAlbum = jQuery.parseJSON(html).result.id;
+ jQuery(".addAlbumOpen").colorbox.close();
+
+ jQuery("#albumSelect").find("option").remove();
+ fillCategoryListbox("albumSelect", newAlbum);
+
+ /* we refresh the album creation form, in case the user wants to create another album */
+ jQuery("#category_parent").find("option").remove();
+ fillCategoryListbox("category_parent", newAlbum);
+
+ jQuery("#addAlbumForm form input[name=category_name]").val('');
+
+ return true;
+ },
+ error:function(XMLHttpRequest, textStatus, errorThrows) {
+ jQuery("#albumCreationLoading").hide();
+ jQuery("#categoryNameError").text(errorThrows).css("color", "red");
+ }
+ });
+
+ return false;
});
jQuery("#hideErrors").click(function() {
@@ -120,7 +181,6 @@ var sizeLimit = {$upload_max_filesize};
'cancelImg' : uploadify_path + '/cancel.png',
'queueID' : 'fileQueue',
'auto' : false,
- 'displayData' : 'speed',
'buttonText' : buttonText,
'multi' : true,
'fileDesc' : 'Photo files (*.jpg,*.jpeg,*.png)',
@@ -196,8 +256,14 @@ var sizeLimit = {$upload_max_filesize};
}
);
},
- onComplete: function (a, b ,c, d, e) {
+ onComplete: function (a, b ,c, response, e) {
var size = Math.round(c.size/1024);
+
+ var response = jQuery.parseJSON(response);
+
+ jQuery("#uploadedPhotos").parent("fieldset").show();
+ jQuery("#uploadedPhotos").prepend(' ');
+
jQuery.jGrowl(
'
Flash / Video (Iframe/Direct Link To YouTube)
+ + + +Example with alerts. Callbacks and event-hooks allow users to extend functionality without having to rewrite parts of the plugin.
+ + + + + \ No newline at end of file diff --git a/themes/default/js/plugins/colorbox/style2/colorbox.css b/themes/default/js/plugins/colorbox/style2/colorbox.css new file mode 100644 index 000000000..2aaf65e63 --- /dev/null +++ b/themes/default/js/plugins/colorbox/style2/colorbox.css @@ -0,0 +1,42 @@ +/* + ColorBox Core Style: + The following CSS is consistent between example themes and should not be altered. +*/ +#colorbox, #cboxOverlay, #cboxWrapper{position:absolute; top:0; left:0; z-index:9999; overflow:hidden;} +#cboxOverlay{position:fixed; width:100%; height:100%;} +#cboxMiddleLeft, #cboxBottomLeft{clear:left;} +#cboxContent{position:relative;} +#cboxLoadedContent{overflow:auto;} +#cboxTitle{margin:0;} +#cboxLoadingOverlay, #cboxLoadingGraphic{position:absolute; top:0; left:0; width:100%;} +#cboxPrevious, #cboxNext, #cboxClose, #cboxSlideshow{cursor:pointer;} +.cboxPhoto{float:left; margin:auto; border:0; display:block;} +.cboxIframe{width:100%; height:100%; display:block; border:0;} + +/* + User Style: + Change the following styles to modify the appearance of ColorBox. They are + ordered & tabbed in a way that represents the nesting of the generated HTML. +*/ +#cboxOverlay{background:#000;} +#colorbox{} + #cboxContent{margin-top:32px; overflow:visible;} + #cboxError{padding:50px; border:1px solid #ccc;} + #cboxLoadedContent{background:#f1f1f1; padding:1px;} + #cboxLoadingGraphic{background:url(images/loading.gif) no-repeat center center;} + #cboxLoadingOverlay{background:#000;} + #cboxTitle{position:absolute; top:-22px; left:0; color:#fff;} + #cboxTitle:first-letter{text-transform:capitalize;} + #cboxCurrent{position:absolute; top:-22px; right:205px; text-indent:-9999px;} + #cboxSlideshow, #cboxPrevious, #cboxNext, #cboxClose{text-indent:-9999px; width:20px; height:20px; position:absolute; top:-20px; background:url(images/controls.png) no-repeat 0 0;} + #cboxPrevious{background-position:0px 0px; right:44px;} + #cboxPrevious.hover{background-position:0px -25px;} + #cboxNext{background-position:-25px 0px; right:22px;} + #cboxNext.hover{background-position:-25px -25px;} + #cboxClose{background-position:-50px 0px; right:0;} + #cboxClose.hover{background-position:-50px -25px;} + .cboxSlideshow_on #cboxPrevious, .cboxSlideshow_off #cboxPrevious{right:66px;} + .cboxSlideshow_on #cboxSlideshow{background-position:-75px -25px; right:44px;} + .cboxSlideshow_on #cboxSlideshow.hover{background-position:-100px -25px;} + .cboxSlideshow_off #cboxSlideshow{background-position:-100px 0px; right:44px;} + .cboxSlideshow_off #cboxSlideshow.hover{background-position:-75px -25px;} diff --git a/themes/default/js/plugins/colorbox/style2/images/controls.png b/themes/default/js/plugins/colorbox/style2/images/controls.png new file mode 100644 index 000000000..f85134b8c Binary files /dev/null and b/themes/default/js/plugins/colorbox/style2/images/controls.png differ diff --git a/themes/default/js/plugins/colorbox/style2/images/controls.png.old b/themes/default/js/plugins/colorbox/style2/images/controls.png.old new file mode 100644 index 000000000..8569b57f1 Binary files /dev/null and b/themes/default/js/plugins/colorbox/style2/images/controls.png.old differ diff --git a/themes/default/js/plugins/colorbox/style2/images/loading.gif b/themes/default/js/plugins/colorbox/style2/images/loading.gif new file mode 100644 index 000000000..19c67bbd0 Binary files /dev/null and b/themes/default/js/plugins/colorbox/style2/images/loading.gif differ diff --git a/themes/default/js/plugins/colorbox/style2/index.html b/themes/default/js/plugins/colorbox/style2/index.html new file mode 100644 index 000000000..abf749c3c --- /dev/null +++ b/themes/default/js/plugins/colorbox/style2/index.html @@ -0,0 +1,87 @@ + + + + +Flash / Video (Iframe/Direct Link To YouTube)
+ + + +Example with alerts. Callbacks and event-hooks allow users to extend functionality without having to rewrite parts of the plugin.
+ + + + + \ No newline at end of file diff --git a/themes/default/js/plugins/jquery.colorbox.css b/themes/default/js/plugins/jquery.colorbox.css deleted file mode 100644 index 07e8c40de..000000000 --- a/themes/default/js/plugins/jquery.colorbox.css +++ /dev/null @@ -1,32 +0,0 @@ -/* ColorBox Core Style */ -#colorbox, #cboxOverlay, #cboxWrapper{position:absolute; top:0; left:0; z-index:9999; overflow:hidden;} -#cboxOverlay{position:fixed; width:100%; height:100%;} -#cboxMiddleLeft, #cboxBottomLeft{clear:left;} -#cboxContent{position:relative;} -#cboxLoadedContent{overflow:auto;} -#cboxTitle{margin:0;} -#cboxLoadingOverlay, #cboxLoadingGraphic{position:absolute; top:0; left:0; width:100%;} -#cboxPrevious, #cboxNext, #cboxClose, #cboxSlideshow{cursor:pointer;} -.cboxPhoto{float:left; margin:auto; border:0; display:block;} -.cboxIframe{width:100%; height:100%; display:block; border:0;} - -/* User Style */ -#cboxWrapper{border-radius:10px; -moz-border-radius:10px: -webkit-border-radius:10px; background:#fff;} -#cboxOverlay{background:#000;} -#colorbox{} - #cboxTopLeft, #cboxTopRight, #cboxBottomLeft, #cboxBottomRight{width:11px; height:11px;} - #cboxMiddleLeft, #cboxMiddleRight{width:11px;} - #cboxTopCenter, #cboxBottomCenter{height:11px;} - #cboxContent{background:#fff; overflow:hidden;} - #cboxError{padding:50px; colorbox-border:1px solid #ccc;} - #cboxLoadedContent{margin-bottom:28px;} - #cboxTitle{position:absolute; bottom:4px; left:0; text-align:center; width:100%; color:#666;} - #cboxCurrent{position:absolute; bottom:4px; left:58px; color:#949494;} - #cboxSlideshow{position:absolute; bottom:4px; right:30px; color:#0092ef;} - #cboxPrevious{position:absolute; bottom:0; left:0; background:url(../../images/colorbox-controls.png) no-repeat -50px 0; width:25px; height:25px; text-indent:-9999px;} - #cboxPrevious.hover{background-position:-50px -25px;} - #cboxNext{position:absolute; bottom:0; left:27px; background:url(../../images/colorbox-controls.png) no-repeat -25px 0; width:25px; height:25px; text-indent:-9999px;} - #cboxNext.hover{background-position:-25px -25px;} - #cboxLoadingGraphic{background:url(../../images/colorbox-loading.gif) no-repeat center center;} - #cboxClose{position:absolute; bottom:0; right:0; background:url(../../images/colorbox-controls.png) no-repeat 0 0; width:25px; height:25px; text-indent:-9999px;} - #cboxClose.hover{background-position:0 -25px;} \ No newline at end of file diff --git a/ws.php b/ws.php index 1a0f1db69..a24cc47c4 100644 --- a/ws.php +++ b/ws.php @@ -82,6 +82,7 @@ function ws_addDefaultMethods( $arr ) 'recursive' => array('default'=>false), 'public' => array('default'=>false), 'tree_output' => array('default'=>false), + 'fullname' => array('default'=>false), ), 'retrieves a list of categories (tree_output option only compatible with json/php output format' );