diff options
author | Chad Kieffer <ckieffer@gmail.com> | 2009-07-11 23:17:30 -0600 |
---|---|---|
committer | Chad Kieffer <ckieffer@gmail.com> | 2009-07-11 23:17:30 -0600 |
commit | 872b5eed4644bdd3e3645eb38a69fdd1ca5ee360 (patch) | |
tree | e6530601ee2442f653fc62e372a682984a7ffbf2 /modules/server_add/js/server_add.js | |
parent | 8bfcf09b4c9628f13fdee2b958b3d11c9abce474 (diff) | |
parent | 214d977f4dc9ac78f4571a7cc89109fd95f5a2eb (diff) |
Merge branch 'master' of git@github.com:gallery/gallery3
Diffstat (limited to 'modules/server_add/js/server_add.js')
-rw-r--r-- | modules/server_add/js/server_add.js | 67 |
1 files changed, 19 insertions, 48 deletions
diff --git a/modules/server_add/js/server_add.js b/modules/server_add/js/server_add.js index 1a78d733..989555cc 100644 --- a/modules/server_add/js/server_add.js +++ b/modules/server_add/js/server_add.js @@ -1,51 +1,9 @@ /** - * We've clicked the + icon next to a directory. Load up children of this - * directory from the server and display them. + * Manage file selection state. */ -function open_close_branch(path, id) { - var parent = $("#file_" + id); - var children = $("#tree_" + id); - var icon = parent.find(".ui-icon:first"); - - if (!children.html()) { - parent.addClass("gLoadingSmall"); - $.ajax({ - url: GET_CHILDREN_URL.replace("__PATH__", path), - success: function(data, textStatus) { - children.html(data); - parent.removeClass("gLoadingSmall"); - - // Propagate checkbox value - children.find("input[type=checkbox]").attr( - "checked", parent.find("input[type=checkbox]:first").attr("checked")); - } - }); - } - - children.slideToggle("fast", function() { - if (children.is(":hidden")) { - icon.addClass("ui-icon-plus"); - icon.removeClass("ui-icon-minus"); - } else { - icon.addClass("ui-icon-minus"); - icon.removeClass("ui-icon-plus"); - parent.removeClass("gCollapsed"); - } - }); -} - -/** - * We've clicked a checkbox. Propagate the value downwards as necessary. - */ -function click_node(checkbox) { - var parent = $(checkbox).parents("li").get(0); - var checked = $(checkbox).attr("checked"); - $(parent).find("input[type=checkbox]").attr("checked", checked); - - // @todo if we uncheck all the children for a parent, we should uncheck the - // parent itself, otherwise in the code we'll add the entire parent since if - // we find an album as a leaf, we assume that it's never been expanded in the UI. - if ($("#gServerAddTree").find("input[type=checkbox]").is(":checked")) { +function select_file(li) { + $(li).toggleClass("selected"); + if ($("#gServerAdd span.selected").length) { $("#gServerAddAddButton").enable(true); $("#gServerAddAddButton").removeClass("ui-state-disabled"); } else { @@ -54,11 +12,24 @@ function click_node(checkbox) { } } +/** + * Load a new directory + */ +function open_dir(path) { + $.ajax({ + url: GET_CHILDREN_URL.replace("__PATH__", path), + success: function(data, textStatus) { + $("#gServerAddTree").html(data); + } + }); +} + function start_add() { var paths = []; - $.each($("#gServerAdd :checkbox[checked]"), function () { - paths.push(this.value); + $.each($("#gServerAdd span.selected"), function () { + paths.push($(this).attr("file")); }); + $.ajax({ url: START_URL, type: "POST", |