diff options
| author | Andy Staudacher <andy.st@gmail.com> | 2009-11-15 19:44:47 -0800 |
|---|---|---|
| committer | Andy Staudacher <andy.st@gmail.com> | 2009-11-15 19:44:47 -0800 |
| commit | 0733dc37fda27a5ba35f9020edf3c66aa41a95a0 (patch) | |
| tree | 6877946232f1b01b1c8709054c689f6658cef34f /modules/tag/js | |
| parent | 218493c50be9362d4abed6900a816308fee5d978 (diff) | |
| parent | 9379308f91a476f790fb8d444536719535c584e4 (diff) | |
Merge commit 'upstream/master'
Conflicts:
modules/gallery/tests/xss_data.txt
Diffstat (limited to 'modules/tag/js')
| -rw-r--r-- | modules/tag/js/tag.js | 81 |
1 files changed, 0 insertions, 81 deletions
diff --git a/modules/tag/js/tag.js b/modules/tag/js/tag.js deleted file mode 100644 index 52c695c6..00000000 --- a/modules/tag/js/tag.js +++ /dev/null @@ -1,81 +0,0 @@ -$("document").ready(function() { - ajaxify_tag_form(); -}); - -function ajaxify_tag_form() { - $("#gTag form").ajaxForm({ - dataType: "json", - success: function(data) { - if (data.result == "success") { - $.get($("#gTagCloud").attr("title"), function(data, textStatus) { - $("#gTagCloud").html(data); - }); - } - $("#gTag form").resetForm(); - } - }); -} - -function closeEditInPlaceForms() { - // closes currently open inplace edit forms - if ($("#gRenameTagForm").length) { - $("#gEditErrorMessage").remove(); - var li = $("#gRenameTagForm").parent(); - $("#gRenameTagForm").parent().html($("#gRenameTagForm").parent().data("revert")); - li.height(""); - $(".gEditable", li).bind("click", editInPlace); - $(".gDialogLink", li).gallery_dialog(); - } -} - -function str_replace(search_term, replacement, string) { - var temp = string.split(search_term); - return temp.join(replacement); -} - -function editInPlace(element) { - closeEditInPlaceForms(); - - // create edit form - var tag_id = $(this).attr('id').substr(5); - var tag_name = $(this).html(); - var tag_width = $(this).width(); - $(this).parent().data("revert", $(this).parent().html()); - var form = '<form id="gRenameTagForm" method="post" class="ui-helper-clearfix" '; - form += 'action="' + TAG_RENAME_URL.replace('__ID__', tag_id) + '">'; - form += '<input name="csrf" type="hidden" value="' + csrf_token + '" />'; - form += '<input id="name" name="name" type="text" class="textbox" value="' + - str_replace('"', """, tag_name) + '" />'; - form += '<input type="submit" class="submit ui-state-default ui-corner-all" value="' + save_i18n + '" i/>'; - form += '<a href="#">' + cancel_i18n + '</a>'; - form += '</form>'; - - // add edit form - $(this).parent().html(form); - $("#gRenameTagForm #name") - .width(tag_width+30) - .focus(); - //$("#gRenameTagForm").parent().height( $("#gRenameTagForm").height() ); - $("#gRenameTagForm a").bind("click", closeEditInPlaceForms); - - ajaxify_editInPlaceForm = function() { - $("#gRenameTagForm").ajaxForm({ - dataType: "json", - success: function(data) { - if (data.result == "success") { - closeEditInPlaceForms(); // close form - $("#gTag-" + data.tag_id).text(data.new_tagname); // update tagname - console.log(data); - window.location.reload(); - } else if (data.result == "error") { - $("#gRenameTagForm #name") - .addClass("gError") - .focus(); - $("#gTagAdmin").before("<p id=\"gEditErrorMessage\" class=\"gError\">" + data.message + "</p>"); - } - } - }); - }; - ajaxify_editInPlaceForm(); -} - |
