]> source.dussan.org Git - nextcloud-server.git/commitdiff
fix renaming albums
authorRobin Appelman <icewind@owncloud.com>
Fri, 20 Jan 2012 18:32:08 +0000 (19:32 +0100)
committerRobin Appelman <icewind@owncloud.com>
Fri, 20 Jan 2012 18:32:08 +0000 (19:32 +0100)
apps/gallery/js/album_cover.js
apps/gallery/js/albums.js
apps/gallery/lib/album.php

index b871c3d89b5550bb7406d0a679a275ec03aa1816..44503de28e03d324865e0b5327be708174e0a7c7 100644 (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);
       }
index f18d1deca4cca44b2ce8d8b004f0853345f3e4fd..6150b0daa1ee29442461726a5241f2af26a6ca5b 100644 (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);
        }
   }
index d2c420eb9ef8b3943edebf00461d65252806f3a8..4eb12cc0b8155be6dd729ca44a922b2da5fdc058 100644 (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));
   }