}
$.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);
}
},
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);
}
}
}
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));
}
}
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));
}