diff options
author | Bartek Przybylski <bart.p.pl@gmail.com> | 2012-02-03 21:38:44 +0100 |
---|---|---|
committer | Bartek Przybylski <bart.p.pl@gmail.com> | 2012-02-03 21:38:44 +0100 |
commit | 8df065065892ecfb1a3e6d31294d332fa8e4daf6 (patch) | |
tree | 83e824eb08d6e20f6bdbc117dcf67097332c4d30 /apps/gallery/js | |
parent | ee01d1a81d561fb41916bb3d231452956317b7bc (diff) | |
download | nextcloud-server-8df065065892ecfb1a3e6d31294d332fa8e4daf6.tar.gz nextcloud-server-8df065065892ecfb1a3e6d31294d332fa8e4daf6.zip |
gallery settings, defining scan root and shor order
Diffstat (limited to 'apps/gallery/js')
-rw-r--r-- | apps/gallery/js/album_cover.js | 52 | ||||
-rw-r--r-- | apps/gallery/js/albums.js | 6 |
2 files changed, 52 insertions, 6 deletions
diff --git a/apps/gallery/js/album_cover.js b/apps/gallery/js/album_cover.js index e78db221cff..4ddac2f2111 100644 --- a/apps/gallery/js/album_cover.js +++ b/apps/gallery/js/album_cover.js @@ -38,10 +38,12 @@ function createNewAlbum() { var albumCounter = 0; var totalAlbums = 0; -function scanForAlbums() { +function scanForAlbums(cleanup) { + cleanup = cleanup?true:false; var albumCounter = 0; var totalAlbums = 0; - $.getJSON('ajax/galleryOp.php?operation=filescan', function(r) { + $('#g-scan-button').attr('disabled', 'true'); + $.getJSON('ajax/galleryOp.php?operation=filescan', {cleanup: cleanup}, function(r) { if (r.status == 'success') { totalAlbums = r.paths.length; @@ -68,6 +70,7 @@ function scanForAlbums() { } else { alert('Error occured: no such layer `gallery_list`'); } + $('#g-scan-button').attr('disabled', null); } }); } @@ -125,13 +128,13 @@ function galleryRename(name) { $(this).dialog("close"); return; } - $.getJSON("ajax/galleryOp.php", {operation: "rename", oldname: name, newname: newname}, function(r) { + $.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"); + $('#dialog-form').dialog('close'); }); } @@ -139,10 +142,49 @@ function galleryRename(name) { { text: t('gallery', 'Cancel'), click: function() { - $( this ).dialog( "close" ); + $( this ).dialog('close'); } } ], }); } +function settings() { + $( '#g-dialog-settings' ).dialog({ + height: 180, + width: 350, + modal: false, + buttons: [{ + text: t('gallery', 'Apply'), + click: function() { + var scanning_root = $('#g-scanning-root').val(); + var disp_order = $('#g-display-order option:selected').val(); + if (scanning_root == '') { + alert('Scanning root cannot be empty'); + return; + } + $.getJSON('ajax/galleryOp.php', {operation: 'store_settings', root: scanning_root, order: disp_order}, function(r) { + if (r.status == 'success') { + if (r.rescan == 'yes') { + $('#g-dialog-settings').dialog('close'); + Albums.clear(document.getElementById('gallery_list')); + scanForAlbums(true); + return; + } + } else { + alert('Error: ' + r.cause); + return; + } + $('#g-dialog-settings').dialog('close'); + }); + } + }, + { + text: t('gallery', 'Cancel'), + click: function() { + $(this).dialog('close'); + } + } + ], + }); +} diff --git a/apps/gallery/js/albums.js b/apps/gallery/js/albums.js index d2b4d858b55..01e146a2f12 100644 --- a/apps/gallery/js/albums.js +++ b/apps/gallery/js/albums.js @@ -52,7 +52,7 @@ Albums={ }); $(".gallery_album_decoration a.remove", local).bind('click', {name: a.name},function(event){ event.preventDefault(); - galleryRemove(a.data.name); + galleryRemove(event.data.name); }); $("a.view", local).attr('href','?view='+a.name); $('h1',local).text(a.name); @@ -80,6 +80,10 @@ Albums={ $("a.view", element).attr("href", "?view="+new_name); $("h1", element).text(new_name); } + }, + clear: function(element) { + Albums.albums = new Array(); + element.innerHTML = ''; } } |