Files
gallery3/modules/local_import/js/admin.js
Tim Almdal 08c47f28f2 Inline the admin view creation that was in helpers/local_import.php
and remove it.  Cleanup unused variables. Rename the method remove()
to remove_path()
2009-03-03 22:19:46 +00:00

48 lines
1.2 KiB
JavaScript

/**
* Set up autocomplete on the server path list
*
*/
$("document").ready(function() {
add_autocomplete();
ajaxify_import_form();
add_onclick();
});
function add_autocomplete() {
$("#gLocalImportAdmin input:text").autocomplete(base_url + "admin/local_import/autocomplete", {
extraParams: {csrf: csrf},
mustMatch: true,
max: 256});
}
function ajaxify_import_form(options) {
$("#gLocalImportAdmin form").ajaxForm({
dataType: "json",
success: function(data) {
if (data.form) {
$("#gLocalImportAdmin form").replaceWith(data.form);
ajaxify_import_form();
add_autocomplete();
}
if (data.result == "success") {
$("#gNoImportPaths").css("display", "none");
$("#gAuthorizedPath").html(data.paths);
add_onclick();
}
}
});
}
function add_onclick() {
$(".gRemoveDir").click(function() {
var parent = $(this).parent();
$.post(
base_url + "admin/local_import/remove_path",
{csrf: csrf,
path: parent.text().replace(/^\s\s*/, "").replace(/\s\s*$/, "")},
function(data, textStatus) {
$("#gAuthorizedPath").html(data);
add_onclick();
});
});
}