fix renaming albums

This commit is contained in:
Robin Appelman 2012-01-20 19:32:08 +01:00
parent b5ae924031
commit 415e968612
3 changed files with 5 additions and 5 deletions

View File

@ -98,7 +98,7 @@ function galleryRename(name) {
}
$.getJSON("ajax/galleryOp.php", {operation: "rename", oldname: name, newname: result}, function(r) {
if (r.status == "success") {
Albums.rename($(".gallery_album_box").filterAttr('data-album',albumName), result);
Albums.rename($(".gallery_album_box").filterAttr('data-album',name), result);
} else {
alert("Error: " + r.cause);
}

View File

@ -75,8 +75,8 @@ Albums={
},
rename: function(element, new_name) {
if (new_name) {
$(element).attr("title", new_name);
$("a", element).attr("href", "?view="+new_name);
$(element).attr("data-album", new_name);
$("a.view", element).attr("href", "?view="+new_name);
$("h1", element).text(new_name);
}
}

View File

@ -28,7 +28,7 @@ class OC_Gallery_Album {
}
public static function rename($oldname, $newname, $owner) {
$stmt = OC_DB::prepare('UPDATE OR IGNORE *PREFIX*gallery_albums SET album_name=? WHERE uid_owner=? AND album_name=?');
$stmt = OC_DB::prepare('UPDATE *PREFIX*gallery_albums SET album_name=? WHERE uid_owner=? AND album_name=?');
$stmt->execute(array($newname, $owner, $oldname));
}
@ -76,7 +76,7 @@ class OC_Gallery_Album {
}
public static function changePath($oldname, $newname, $owner) {
$stmt = OC_DB::prepare('UPDATE OR IGNORE *PREFIX*gallery_albums SET album_path=? WHERE uid_owner=? AND album_path=?');
$stmt = OC_DB::prepare('UPDATE *PREFIX*gallery_albums SET album_path=? WHERE uid_owner=? AND album_path=?');
$stmt->execute(array($newname, $owner, $oldname));
}