diff options
author | Tim Almdal <tnalmdal@shaw.ca> | 2008-12-11 17:20:55 +0000 |
---|---|---|
committer | Tim Almdal <tnalmdal@shaw.ca> | 2008-12-11 17:20:55 +0000 |
commit | e1f2a5d4e60f431e0a94c998afc026f1136fb26b (patch) | |
tree | 76d05837701cbe78a6a2b3a845fd05cf971f4693 /modules/local_import/js/local_import.js | |
parent | 773d7024eb57765822e345380be7682ce5f14d17 (diff) |
1) Begins the creation of the local import module by adding the administation component to the scaffolding Actions tab. The importing functionality will follow shortly.
2) Defines a routining pattern for module administration controllers. URI's of the form admin/module/method/parameters gets remapped into module_admin/method/parameters. This will result in the lookup of the the controller Module_Admin_Controller
Diffstat (limited to 'modules/local_import/js/local_import.js')
-rw-r--r-- | modules/local_import/js/local_import.js | 67 |
1 files changed, 67 insertions, 0 deletions
diff --git a/modules/local_import/js/local_import.js b/modules/local_import/js/local_import.js new file mode 100644 index 00000000..3ad01ce8 --- /dev/null +++ b/modules/local_import/js/local_import.js @@ -0,0 +1,67 @@ +/** + * Set up autocomplete on the server path list + * + */ +$("document").ready(function() { + var previous_search = ""; + $("#gLocalImportAdmin input").autocomplete({ + url: base_url + "admin/local_import/autocomplete", + mustMatch: true, + }); + ajaxify_form({ + form: "#gLocalImportAdmin form", + url: "admin/local_import/", + returnCode: 200, + callback: function(xhr, statusText) { + $("#gImportLocalDirList").html(xhr.responseText); + setDroppable("#gImportLocalDirList #gRemoveDir"); + setDraggable("#gImportLocalDirList li"); + } + }); + + setDroppable("#gImportLocalDirList #gRemoveDir"); + setDraggable("#gImportLocalDirList li"); +}); + +function setDraggable(selector) { + $(selector).draggable({ + helper: 'clone', +// containment: "#gImportLocalDirList", + opacity: .6, + revert: "invalid" + }); +} + +function setDroppable(selector) { + $(selector).droppable({ + accept: "#gImportLocalDirList li", + drop: function(ev, ui) { + var element = ui.draggable[0]; + + if (confirm("Do you really want to remove " + element.textContent)) { + $.ajax({ + data: "path=" + element.textContent, + url: base_url + "admin/local_import/remove", + success: function(data, textStatus) { + $("#gImportLocalDirList").html(data); + setDroppable("#gImportLocalDirList #gRemoveDir"); + setDraggable("#gImportLocalDirList li"); + }, + error: function(xhr, textStatus, errorThrown) { + alert("Text Status: " + textStatus + " Http Error Code: " + xhr.status); + }, + type: "POST" + }); + } + } + }); +} + +function ajaxify_form(options) { + $(options.form).ajaxForm({ + complete:function(xhr, statusText) { + options.callback(xhr, statusText); + $(options.form).clearForm(); + } + }); +} |