summaryrefslogtreecommitdiffstats
path: root/apps/gallery/js/album_cover.js
diff options
context:
space:
mode:
authorBartek Przybylski <bart.p.pl@gmail.com>2012-03-04 00:35:37 +0100
committerBartek Przybylski <bart.p.pl@gmail.com>2012-03-04 00:35:37 +0100
commitc411826fe5e7662fb0f6dc5fbcb074c68b467ea4 (patch)
treeda23da095fcc3e034d09ab978337265c26e043ff /apps/gallery/js/album_cover.js
parentf06858689f9709d3859f814ca57dfa54b9ed0865 (diff)
downloadnextcloud-server-c411826fe5e7662fb0f6dc5fbcb074c68b467ea4.tar.gz
nextcloud-server-c411826fe5e7662fb0f6dc5fbcb074c68b467ea4.zip
moving gallery op to one file, migrate gallery dialogs to oc dialogs
Diffstat (limited to 'apps/gallery/js/album_cover.js')
-rw-r--r--apps/gallery/js/album_cover.js92
1 files changed, 30 insertions, 62 deletions
diff --git a/apps/gallery/js/album_cover.js b/apps/gallery/js/album_cover.js
index d328a2d58e5..e63bed05fe4 100644
--- a/apps/gallery/js/album_cover.js
+++ b/apps/gallery/js/album_cover.js
@@ -1,6 +1,6 @@
var actual_cover;
$(document).ready(function() {
- $.getJSON('ajax/getAlbums.php', function(r) {
+ $.getJSON('ajax/galleryOp.php', {operation: 'get_galleries'}, function(r) {
if (r.status == 'success') {
for (var i in r.albums) {
var a = r.albums[i];
@@ -81,71 +81,39 @@ function scanForAlbums(cleanup) {
}
function galleryRemove(albumName) {
- // a workaround for a flaw in the demo system (http://dev.jqueryui.com/ticket/4375), ignore!
- $( "#dialog:ui-dialog" ).dialog( "destroy" );
- $('#albumName', $("#dialog-confirm")).text(albumName);
-
- $( '#dialog-confirm' ).dialog({
- resizable: false,
- height:150,
- buttons: [{
- text: t('gallery', 'OK'),
- click: function() {
- $.getJSON("ajax/galleryOp.php", {operation: "remove", name: albumName}, function(r) {
- if (r.status == "success") {
- $(".gallery_album_box").filterAttr('data-album',albumName).remove();
- Albums.remove(albumName);
- } else {
- alert("Error: " + r.cause);
- }
- $('#dialog-confirm').dialog('close');
- });
- }},
- {
- text: t('gallery', 'Cancel'),
- click: function() {
- $( this ).dialog( 'close' );
- }}]
+ OC.dialogs.confirm(t('gallery', 'Do you want to remove album ') + decodeURIComponent(escape(albumName)),
+ t('gallery', 'Remove confirmation'),
+ function(decision) {
+ if (decision) {
+ $.getJSON("ajax/galleryOp.php", {operation: "remove", name: decodeURIComponent(escape(albumName))}, function(r) {
+ if (r.status == "success") {
+ $(".gallery_album_box").filterAttr('data-album',albumName).remove();
+ Albums.remove(albumName);
+ } else {
+ OC.dialogs.alert(r.cause, "Error");
+ }
+ });
+ }
});
}
function galleryRename(name) {
- $('#name', $('#dialog-form')).val(name);
- $( "#dialog-form" ).dialog({
- height: 140,
- width: 350,
- modal: false,
- buttons: [{
- text: t('gallery', 'Change name'),
- click: function() {
- var newname = $('#name', $('#dialog-form')).val();
- if (newname == name || newname == '') {
- $(this).dialog("close");
- return;
- }
- if (Albums.find(newname)) {
- alert("Album ", newname, " exists");
- $(this).dialog("close");
- return;
- }
- $.getJSON('ajax/galleryOp.php', {operation: 'rename', oldname: name, newname: newname}, function(r) {
- if (r.status == "success") {
- Albums.rename($(".gallery_album_box").filterAttr('data-album',name), newname);
- } else {
- alert("Error: " + r.cause);
- }
- $('#dialog-form').dialog('close');
- });
-
- }
- },
- {
- text: t('gallery', 'Cancel'),
- click: function() {
- $( this ).dialog('close');
- }
- }
- ],
+ OC.dialogs.prompt(t('gallery', 'New album name'),
+ t('gallery', 'Change name'),
+ name,
+ function(newname) {
+ if (newname == name || newname == '') return;
+ if (Albums.find(newname)) {
+ OC.dialogs.alert('Album ' + newname + ' exists', 'Alert');
+ return;
+ }
+ $.getJSON('ajax/galleryOp.php', {operation: 'rename', oldname: name, newname: newname}, function(r) {
+ if (r.status == 'success') {
+ Albums.rename($(".gallery_album_box").filterAttr('data-album',name), newname);
+ } else {
+ OC.dialogs.alert('Error: ' + r.cause, 'Error');
+ }
+ });
});
}