1
0

Fix the delete function so the album tree is updated if an album is deleted. Also delete reference to an undefined variable.

This commit is contained in:
Tim Almdal 2009-12-18 22:32:37 -08:00
parent b16d60916f
commit f0308bf695
2 changed files with 9 additions and 4 deletions

View File

@ -203,7 +203,6 @@ class G3Remote {
$response = json_decode($response_body); $response = json_decode($response_body);
if ($response->status == "OK") { if ($response->status == "OK") {
$this->_access_token = $response->token; $this->_access_token = $response->token;
$this->_identity = $identity;
} else { } else {
throw new Exception("Remote host failure: {$response->message}"); throw new Exception("Remote host failure: {$response->message}");
} }
@ -246,7 +245,6 @@ class G3Remote {
public function delete_resource($path) { public function delete_resource($path) {
$request = "{$this->_config["gallery3_site"]}/$path"; $request = "{$this->_config["gallery3_site"]}/$path";
$headers["X_GALLERY_REQUEST_METHOD"] = "DELETE"; $headers["X_GALLERY_REQUEST_METHOD"] = "DELETE";
Kohana_Log::add("error", "access_token: " . $this->_access_token);
if (!empty($this->_access_token)) { if (!empty($this->_access_token)) {
$headers["X_GALLERY_REQUEST_KEY"] = $this->_access_token; $headers["X_GALLERY_REQUEST_KEY"] = $this->_access_token;
} }
@ -262,5 +260,4 @@ class G3Remote {
} }
return "success"; return "success";
} }
} }

View File

@ -219,6 +219,14 @@
if (data.result == "success") { if (data.result == "success") {
$("#g-dialog").dialog('close'); $("#g-dialog").dialog('close');
get_detail(data.path, _set_active_album); get_detail(data.path, _set_active_album);
if (dialog == "delete_album") {
var parent = $("#album_tree li[ref=" + resource_path + "]").parents("li:first");
$.get("/g3_client/index.php/g3_client/albums",
{path: $(parent).attr("ref")},
function(data, textStatus) {
$(parent).replaceWith(data);
});
}
} else if (data.result == "fail") { } else if (data.result == "fail") {
$("#g-dialog").dialog('close'); $("#g-dialog").dialog('close');
alert(data.message); alert(data.message);